diff --git a/N3OW/common/governments/00_government_types.txt b/N3OW/common/governments/00_government_types.txt index 5bf22cbd..c0215529 100644 --- a/N3OW/common/governments/00_government_types.txt +++ b/N3OW/common/governments/00_government_types.txt @@ -54,6 +54,7 @@ republic_government = { noble_families = yes treasury = yes administrative = yes + landless_playable = yes replace_gold_cost_by_treasury = yes admin_allows_holding_multiple_primary_tier_titles = yes } diff --git a/N3OW/common/laws/00_realm_laws.txt b/N3OW/common/laws/00_realm_laws.txt index f1b83882..aeebf0bb 100644 --- a/N3OW/common/laws/00_realm_laws.txt +++ b/N3OW/common/laws/00_realm_laws.txt @@ -13,6 +13,9 @@ @camp_purpose_ai_will_do_bonus_t2 = 20 @camp_purpose_ai_will_do_bonus_t3 = 30 +@mandala_decree_piety_cost = 1000 +@mandala_decree_prestige_cost = 500 + crown_authority = { default = crown_authority_1 cumulative = yes @@ -32,8 +35,8 @@ crown_authority = { realm_law_use_crown_authority = yes trigger_if = { limit = { - government_has_flag = government_is_administrative - is_independent_ruler = no + government_allows = administrative + top_liege != this } liege = { has_realm_law = crown_authority_0 } } @@ -64,8 +67,8 @@ crown_authority = { realm_law_use_crown_authority = yes trigger_if = { limit = { - government_has_flag = government_is_administrative - is_independent_ruler = no + government_allows = administrative + top_liege != this } liege = { has_realm_law = crown_authority_1 } } @@ -143,8 +146,8 @@ crown_authority = { realm_law_use_crown_authority = yes trigger_if = { limit = { - government_has_flag = government_is_administrative - is_independent_ruler = no + government_allows = administrative + top_liege != this } liege = { has_realm_law = crown_authority_2 } } @@ -155,8 +158,8 @@ crown_authority = { limit = { NOT = { has_realm_law = crown_authority_3 } NAND = { - government_has_flag = government_is_administrative - is_independent_ruler = no + government_allows = administrative + top_liege != this } } has_realm_law = crown_authority_1 @@ -225,8 +228,8 @@ crown_authority = { realm_law_use_crown_authority = yes trigger_if = { limit = { - government_has_flag = government_is_administrative - is_independent_ruler = no + government_allows = administrative + top_liege != this } liege = { has_realm_law = crown_authority_3 } } @@ -236,8 +239,8 @@ crown_authority = { trigger_if = { limit = { NAND = { - government_has_flag = government_is_administrative - is_independent_ruler = no + government_allows = administrative + top_liege != this } } has_realm_law = crown_authority_2 @@ -385,8 +388,17 @@ tribal_authority = { can_keep = { realm_law_use_tribal_authority = yes - NOT = { - is_confederation_member = yes + trigger_if = { + limit = { + NOT = { + culture = { + has_cultural_parameter = forming_confederations_is_easier + } + } + } + NOT = { + is_confederation_member = yes + } } } @@ -455,8 +467,17 @@ tribal_authority = { can_keep = { realm_law_use_tribal_authority = yes - NOT = { - is_confederation_member = yes + trigger_if = { + limit = { + NOT = { + culture = { + has_cultural_parameter = forming_confederations_is_easier + } + } + } + NOT = { + is_confederation_member = yes + } } } @@ -588,66 +609,68 @@ camp_purpose = { } ai_will_do = { - # Traits. - ## Education. - if = { - limit = { has_trait = education_martial } - add = @camp_purpose_ai_will_do_bonus_t3 - } - ## Personality. - ### Cultural traditions - if = { - limit = { - culture = { - OR = { - has_cultural_parameter = much_more_likely_to_be_laamps - has_cultural_parameter = more_likely_to_be_laamps - } - } - } - add = @camp_purpose_ai_will_do_bonus_t3 - } - ### Wrathful - if = { - limit = { has_trait = wrathful } - add = @camp_purpose_ai_will_do_bonus_t3 - } - ### Calm - if = { - limit = { has_trait = calm } - add = @camp_purpose_ai_will_do_malus_t3 - } - ### Callous - if = { - limit = { has_trait = callous } - add = @camp_purpose_ai_will_do_bonus_t3 - } - ### Sadistic - if = { - limit = { has_trait = sadistic } - add = @camp_purpose_ai_will_do_bonus_t3 - } - ### Compassionate - if = { - limit = { has_trait = compassionate } - add = @camp_purpose_ai_will_do_malus_t3 - } - ### Brave - if = { - limit = { has_trait = brave } - add = @camp_purpose_ai_will_do_bonus_t3 - } - ### Craven - if = { - limit = { has_trait = craven } - add = @camp_purpose_ai_will_do_malus_t3 - } # If we've picked a purpose, don't change it. if = { limit = { NOT = { has_realm_law = camp_purpose_wanderers } } - multiply = 0 + value = 0 + } + else = { + # Traits. + ## Education. + if = { + limit = { has_trait = education_martial } + add = @camp_purpose_ai_will_do_bonus_t3 + } + ## Personality. + ### Cultural traditions + if = { + limit = { + culture = { + OR = { + has_cultural_parameter = much_more_likely_to_be_laamps + has_cultural_parameter = more_likely_to_be_laamps + } + } + } + add = @camp_purpose_ai_will_do_bonus_t3 + } + ### Wrathful + if = { + limit = { has_trait = wrathful } + add = @camp_purpose_ai_will_do_bonus_t3 + } + ### Calm + if = { + limit = { has_trait = calm } + add = @camp_purpose_ai_will_do_malus_t3 + } + ### Callous + if = { + limit = { has_trait = callous } + add = @camp_purpose_ai_will_do_bonus_t3 + } + ### Sadistic + if = { + limit = { has_trait = sadistic } + add = @camp_purpose_ai_will_do_bonus_t3 + } + ### Compassionate + if = { + limit = { has_trait = compassionate } + add = @camp_purpose_ai_will_do_malus_t3 + } + ### Brave + if = { + limit = { has_trait = brave } + add = @camp_purpose_ai_will_do_bonus_t3 + } + ### Craven + if = { + limit = { has_trait = craven } + add = @camp_purpose_ai_will_do_malus_t3 + } } } } @@ -703,69 +726,71 @@ camp_purpose = { } ai_will_do = { - # Traits. - ## Education. - if = { - limit = { has_trait = education_learning } - add = @camp_purpose_ai_will_do_bonus_t3 - } - if = { - limit = { has_trait = education_stewardship } - add = @camp_purpose_ai_will_do_bonus_t1 - } - ## Personality. - ### Honest - if = { - limit = { has_trait = honest } - add = @camp_purpose_ai_will_do_bonus_t1 - } - ### Generous - if = { - limit = { has_trait = generous } - add = @camp_purpose_ai_will_do_bonus_t2 - } - ### Calm - if = { - limit = { has_trait = calm } - add = @camp_purpose_ai_will_do_bonus_t2 - } - ### Wrathful - if = { - limit = { has_trait = wrathful } - add = @camp_purpose_ai_will_do_malus_t2 - } - ### Eccentric - if = { - limit = { has_trait = eccentric } - add = @camp_purpose_ai_will_do_bonus_t3 - } - ### Patient - if = { - limit = { has_trait = patient } - add = @camp_purpose_ai_will_do_bonus_t3 - } - ### Impatient - if = { - limit = { has_trait = impatient } - add = @camp_purpose_ai_will_do_malus_t3 - } - ### Shy - if = { - limit = { has_trait = shy } - add = @camp_purpose_ai_will_do_bonus_t1 - } - ### Gregarious - if = { - limit = { has_trait = gregarious } - add = @camp_purpose_ai_will_do_malus_t1 - } # If we've picked a purpose, don't change it. if = { limit = { NOT = { has_realm_law = camp_purpose_wanderers } } - multiply = 0 + value = 0 } + else = { + # Traits. + ## Education. + if = { + limit = { has_trait = education_learning } + add = @camp_purpose_ai_will_do_bonus_t3 + } + if = { + limit = { has_trait = education_stewardship } + add = @camp_purpose_ai_will_do_bonus_t1 + } + ## Personality. + ### Honest + if = { + limit = { has_trait = honest } + add = @camp_purpose_ai_will_do_bonus_t1 + } + ### Generous + if = { + limit = { has_trait = generous } + add = @camp_purpose_ai_will_do_bonus_t2 + } + ### Calm + if = { + limit = { has_trait = calm } + add = @camp_purpose_ai_will_do_bonus_t2 + } + ### Wrathful + if = { + limit = { has_trait = wrathful } + add = @camp_purpose_ai_will_do_malus_t2 + } + ### Eccentric + if = { + limit = { has_trait = eccentric } + add = @camp_purpose_ai_will_do_bonus_t3 + } + ### Patient + if = { + limit = { has_trait = patient } + add = @camp_purpose_ai_will_do_bonus_t3 + } + ### Impatient + if = { + limit = { has_trait = impatient } + add = @camp_purpose_ai_will_do_malus_t3 + } + ### Shy + if = { + limit = { has_trait = shy } + add = @camp_purpose_ai_will_do_bonus_t1 + } + ### Gregarious + if = { + limit = { has_trait = gregarious } + add = @camp_purpose_ai_will_do_malus_t1 + } + } } } @@ -820,73 +845,75 @@ camp_purpose = { } ai_will_do = { - # Traits. - ## Education. - if = { - limit = { has_trait = education_diplomacy } - add = @camp_purpose_ai_will_do_bonus_t3 - } - if = { - limit = { has_trait = education_stewardship } - add = @camp_purpose_ai_will_do_bonus_t2 - } - ## Personality. - ### Diligent - if = { - limit = { has_trait = diligent } - add = @camp_purpose_ai_will_do_bonus_t2 - } - ### Lazy - if = { - limit = { has_trait = lazy } - add = @camp_purpose_ai_will_do_malus_t2 - } - ### Athletic - if = { - limit = { has_trait = athletic } - add = @camp_purpose_ai_will_do_bonus_t3 - } - ### Brave - if = { - limit = { has_trait = brave } - add = @camp_purpose_ai_will_do_bonus_t2 - } - ### Craven - if = { - limit = { has_trait = craven } - add = @camp_purpose_ai_will_do_malus_t2 - } - ### Eccentric - if = { - limit = { has_trait = eccentric } - add = @camp_purpose_ai_will_do_bonus_t2 - } - ### Stubborn - if = { - limit = { has_trait = stubborn } - add = @camp_purpose_ai_will_do_bonus_t1 - } - ### Fickle - if = { - limit = { has_trait = fickle } - add = @camp_purpose_ai_will_do_bonus_t2 - } - ### Humble - if = { - limit = { has_trait = humble } - add = @camp_purpose_ai_will_do_bonus_t2 - } - ### Arrogant - if = { - limit = { has_trait = arrogant } - add = @camp_purpose_ai_will_do_malus_t2 - } # If we've picked a purpose, don't change it. if = { limit = { NOT = { has_realm_law = camp_purpose_wanderers } } - multiply = 0 + value = 0 + } + else = { + # Traits. + ## Education. + if = { + limit = { has_trait = education_diplomacy } + add = @camp_purpose_ai_will_do_bonus_t3 + } + if = { + limit = { has_trait = education_stewardship } + add = @camp_purpose_ai_will_do_bonus_t2 + } + ## Personality. + ### Diligent + if = { + limit = { has_trait = diligent } + add = @camp_purpose_ai_will_do_bonus_t2 + } + ### Lazy + if = { + limit = { has_trait = lazy } + add = @camp_purpose_ai_will_do_malus_t2 + } + ### Athletic + if = { + limit = { has_trait = athletic } + add = @camp_purpose_ai_will_do_bonus_t3 + } + ### Brave + if = { + limit = { has_trait = brave } + add = @camp_purpose_ai_will_do_bonus_t2 + } + ### Craven + if = { + limit = { has_trait = craven } + add = @camp_purpose_ai_will_do_malus_t2 + } + ### Eccentric + if = { + limit = { has_trait = eccentric } + add = @camp_purpose_ai_will_do_bonus_t2 + } + ### Stubborn + if = { + limit = { has_trait = stubborn } + add = @camp_purpose_ai_will_do_bonus_t1 + } + ### Fickle + if = { + limit = { has_trait = fickle } + add = @camp_purpose_ai_will_do_bonus_t2 + } + ### Humble + if = { + limit = { has_trait = humble } + add = @camp_purpose_ai_will_do_bonus_t2 + } + ### Arrogant + if = { + limit = { has_trait = arrogant } + add = @camp_purpose_ai_will_do_malus_t2 + } } } } @@ -944,102 +971,104 @@ camp_purpose = { } ai_will_do = { - # Traits. - ## Education. - if = { - limit = { has_trait = education_intrigue } - add = @camp_purpose_ai_will_do_bonus_t3 - } - ### Cultural traditions - if = { - limit = { - culture = { - OR = { - has_cultural_parameter = much_more_likely_to_be_laamps - has_cultural_parameter = more_likely_to_be_laamps - } - } - } - add = @camp_purpose_ai_will_do_bonus_t3 - } - ## Personality. - ### Deceitful. - if = { - limit = { has_trait = deceitful } - add = @camp_purpose_ai_will_do_bonus_t3 - } - ### Honest. - if = { - limit = { has_trait = honest } - add = @camp_purpose_ai_will_do_malus_t3 - } - ### Arbitrary. - if = { - limit = { has_trait = arbitrary } - add = @camp_purpose_ai_will_do_bonus_t3 - } - ### Just, - if = { - limit = { has_trait = just } - add = @camp_purpose_ai_will_do_malus_t3 - } - ### Greedy + either Humble or Content. - if = { - limit = { - has_trait = greedy - OR = { - has_trait = humble - has_trait = content - } - } - add = @camp_purpose_ai_will_do_bonus_t2 - } - ### Generous. - if = { - limit = { has_trait = generous } - add = @camp_purpose_ai_will_do_malus_t2 - } - ### Arrogant. - if = { - limit = { has_trait = arrogant } - add = @camp_purpose_ai_will_do_malus_t2 - } - ### Ambitious. - if = { - limit = { has_trait = ambitious } - add = @camp_purpose_ai_will_do_malus_t2 - } - ### Wrathful. - if = { - limit = { has_trait = wrathful } - add = @camp_purpose_ai_will_do_bonus_t1 - } - ### Calm. - if = { - limit = { has_trait = calm } - add = @camp_purpose_ai_will_do_malus_t1 - } - ### Sadistic. - if = { - limit = { has_trait = sadistic } - add = @camp_purpose_ai_will_do_bonus_t2 - } - ### Callous. - if = { - limit = { has_trait = callous } - add = @camp_purpose_ai_will_do_bonus_t2 - } - ### Compassionate. - if = { - limit = { has_trait = compassionate } - add = @camp_purpose_ai_will_do_malus_t2 - } # If we've picked a purpose, don't change it. if = { limit = { NOT = { has_realm_law = camp_purpose_wanderers } } - multiply = 0 + value = 0 + } + else = { + # Traits. + ## Education. + if = { + limit = { has_trait = education_intrigue } + add = @camp_purpose_ai_will_do_bonus_t3 + } + ### Cultural traditions + if = { + limit = { + culture = { + OR = { + has_cultural_parameter = much_more_likely_to_be_laamps + has_cultural_parameter = more_likely_to_be_laamps + } + } + } + add = @camp_purpose_ai_will_do_bonus_t3 + } + ## Personality. + ### Deceitful. + if = { + limit = { has_trait = deceitful } + add = @camp_purpose_ai_will_do_bonus_t3 + } + ### Honest. + if = { + limit = { has_trait = honest } + add = @camp_purpose_ai_will_do_malus_t3 + } + ### Arbitrary. + if = { + limit = { has_trait = arbitrary } + add = @camp_purpose_ai_will_do_bonus_t3 + } + ### Just, + if = { + limit = { has_trait = just } + add = @camp_purpose_ai_will_do_malus_t3 + } + ### Greedy + either Humble or Content. + if = { + limit = { + has_trait = greedy + OR = { + has_trait = humble + has_trait = content + } + } + add = @camp_purpose_ai_will_do_bonus_t2 + } + ### Generous. + if = { + limit = { has_trait = generous } + add = @camp_purpose_ai_will_do_malus_t2 + } + ### Arrogant. + if = { + limit = { has_trait = arrogant } + add = @camp_purpose_ai_will_do_malus_t2 + } + ### Ambitious. + if = { + limit = { has_trait = ambitious } + add = @camp_purpose_ai_will_do_malus_t2 + } + ### Wrathful. + if = { + limit = { has_trait = wrathful } + add = @camp_purpose_ai_will_do_bonus_t1 + } + ### Calm. + if = { + limit = { has_trait = calm } + add = @camp_purpose_ai_will_do_malus_t1 + } + ### Sadistic. + if = { + limit = { has_trait = sadistic } + add = @camp_purpose_ai_will_do_bonus_t2 + } + ### Callous. + if = { + limit = { has_trait = callous } + add = @camp_purpose_ai_will_do_bonus_t2 + } + ### Compassionate. + if = { + limit = { has_trait = compassionate } + add = @camp_purpose_ai_will_do_malus_t2 + } } } } @@ -1099,54 +1128,56 @@ camp_purpose = { ai_will_do = { # Weight up legitimists inherently. value = 100 - # Traits. - ## Education. - if = { - limit = { - OR = { - has_trait = education_diplomacy - has_trait = education_martial - } - } - add = @camp_purpose_ai_will_do_bonus_t3 - } - ## Personality. - ### Ambitious - if = { - limit = { has_trait = ambitious } - add = @camp_purpose_ai_will_do_bonus_t3 - } - ### Content - if = { - limit = { has_trait = content } - add = @camp_purpose_ai_will_do_malus_t3 - } - ### Arrogant - if = { - limit = { has_trait = arrogant } - add = @camp_purpose_ai_will_do_bonus_t3 - } - ### Humble - if = { - limit = { has_trait = humble } - add = @camp_purpose_ai_will_do_malus_t3 - } - ### Vengeful - if = { - limit = { has_trait = vengeful } - add = @camp_purpose_ai_will_do_bonus_t3 - } - ### Forgiving - if = { - limit = { has_trait = forgiving } - add = @camp_purpose_ai_will_do_malus_t3 - } # If we've picked a purpose, don't change it. if = { limit = { NOT = { has_realm_law = camp_purpose_wanderers } } - multiply = 0 + value = 0 + } + else = { + # Traits. + ## Education. + if = { + limit = { + OR = { + has_trait = education_diplomacy + has_trait = education_martial + } + } + add = @camp_purpose_ai_will_do_bonus_t3 + } + ## Personality. + ### Ambitious + if = { + limit = { has_trait = ambitious } + add = @camp_purpose_ai_will_do_bonus_t3 + } + ### Content + if = { + limit = { has_trait = content } + add = @camp_purpose_ai_will_do_malus_t3 + } + ### Arrogant + if = { + limit = { has_trait = arrogant } + add = @camp_purpose_ai_will_do_bonus_t3 + } + ### Humble + if = { + limit = { has_trait = humble } + add = @camp_purpose_ai_will_do_malus_t3 + } + ### Vengeful + if = { + limit = { has_trait = vengeful } + add = @camp_purpose_ai_will_do_bonus_t3 + } + ### Forgiving + if = { + limit = { has_trait = forgiving } + add = @camp_purpose_ai_will_do_malus_t3 + } } } } @@ -1166,13 +1197,14 @@ imperial_bureaucracy = { courtly_opinion = 5 } flag = uses_imperial_bureaucracy + flag = can_have_tributaries flag = titles_cannot_leave_realm_on_succession # Hardcoded flag can_keep = { realm_law_use_imperial_bureaucracy = yes trigger_if = { limit = { - is_independent_ruler = no + top_liege != this } liege = { has_realm_law = imperial_bureaucracy_0 } } @@ -1181,7 +1213,7 @@ imperial_bureaucracy = { can_pass = { trigger_if = { limit = { - is_independent_ruler = no + top_liege != this liege = { has_realm_law = imperial_bureaucracy_0 } } custom_tooltip = { @@ -1205,7 +1237,6 @@ imperial_bureaucracy = { parochial_opinion = -15 courtly_opinion = -5 minority_opinion = -10 - administrative_government_tax_contribution_add = 0.05 vassal_limit = 100 } flag = can_have_tributaries @@ -1219,7 +1250,7 @@ imperial_bureaucracy = { realm_law_use_imperial_bureaucracy = yes trigger_if = { limit = { - is_independent_ruler = no + top_liege != this } liege = { has_realm_law = imperial_bureaucracy_1 } } @@ -1229,7 +1260,7 @@ imperial_bureaucracy = { trigger_if = { limit = { has_realm_law = imperial_bureaucracy_0 - is_independent_ruler = yes + top_liege = this } custom_description = { subject = root @@ -1244,7 +1275,7 @@ imperial_bureaucracy = { } trigger_if = { limit = { - is_independent_ruler = no + top_liege != this liege = { has_realm_law = imperial_bureaucracy_1 } } custom_tooltip = { @@ -1298,7 +1329,6 @@ imperial_bureaucracy = { courtly_opinion = -5 zealot_opinion = -10 minority_opinion = -10 - administrative_government_tax_contribution_add = 0.05 republic_government_tax_contribution_add = 0.05 vassal_limit = 100 } @@ -1312,7 +1342,7 @@ imperial_bureaucracy = { realm_law_use_imperial_bureaucracy = yes trigger_if = { limit = { - is_independent_ruler = no + top_liege != this } liege = { has_realm_law = imperial_bureaucracy_2 } } @@ -1322,7 +1352,7 @@ imperial_bureaucracy = { trigger_if = { limit = { NOT = { has_realm_law = imperial_bureaucracy_3 } - is_independent_ruler = yes + top_liege = this } has_realm_law = imperial_bureaucracy_1 custom_description = { @@ -1338,7 +1368,7 @@ imperial_bureaucracy = { } trigger_if = { limit = { - is_independent_ruler = no + top_liege != this liege = { has_realm_law = imperial_bureaucracy_2 } } custom_tooltip = { @@ -1389,7 +1419,6 @@ imperial_bureaucracy = { courtly_opinion = -10 zealot_opinion = -20 minority_opinion = -30 - administrative_government_tax_contribution_add = 0.1 republic_government_tax_contribution_add = 0.05 vassal_limit = 200 } @@ -1401,7 +1430,7 @@ imperial_bureaucracy = { realm_law_use_imperial_bureaucracy = yes trigger_if = { limit = { - is_independent_ruler = no + top_liege != this } liege = { has_realm_law = imperial_bureaucracy_3 } } @@ -1410,7 +1439,7 @@ imperial_bureaucracy = { can_pass = { trigger_if = { limit = { - is_independent_ruler = yes + top_liege = this } has_realm_law = imperial_bureaucracy_2 custom_description = { @@ -1426,7 +1455,7 @@ imperial_bureaucracy = { } trigger_if = { limit = { - is_independent_ruler = no + top_liege != this liege = { has_realm_law = imperial_bureaucracy_3 } } custom_tooltip = { @@ -1466,6 +1495,7 @@ nomadic_authority = { default = nomadic_authority_1 cumulative = yes flag = realm_law + flag = dominance_law nomadic_authority_1 = { pass_phrase = nomadic_authority_1_pass_phrase @@ -1578,7 +1608,7 @@ nomadic_authority = { } } } - + nomadic_authority_3 = { pass_phrase = nomadic_authority_3_pass_phrase confirmation_title = nomadic_authority_3_pass_phrase @@ -1600,8 +1630,17 @@ nomadic_authority = { can_keep = { realm_law_use_nomadic_authority = yes - NOT = { - is_confederation_member = yes + trigger_if = { + limit = { + NOT = { + culture = { + has_cultural_parameter = forming_confederations_is_easier + } + } + } + NOT = { + is_confederation_member = yes + } } } @@ -1679,8 +1718,17 @@ nomadic_authority = { can_keep = { realm_law_use_nomadic_authority = yes - NOT = { - is_confederation_member = yes + trigger_if = { + limit = { + NOT = { + culture = { + has_cultural_parameter = forming_confederations_is_easier + } + } + } + NOT = { + is_confederation_member = yes + } } } @@ -1759,8 +1807,17 @@ nomadic_authority = { can_keep = { realm_law_use_nomadic_authority = yes - NOT = { - is_confederation_member = yes + trigger_if = { + limit = { + NOT = { + culture = { + has_cultural_parameter = forming_confederations_is_easier + } + } + } + NOT = { + is_confederation_member = yes + } } } @@ -1834,3 +1891,1297 @@ nomadic_authority = { } } } + +celestial_bureaucracy = { # A variant of Imperial Bureaucracy for Celestial Government + default = celestial_bureaucracy_1 + cumulative = yes + flag = realm_law + + celestial_bureaucracy_0 = { + modifier = { + courtly_opinion = -20 # Pro-hegemon movement + #parochial_opinion = 0 # Advancement movement + #belligerent_opinion = 0 # Expansion movement + glory_hound_opinion = 10 # Conservative movement + #zealot_opinion = 0 + barons_and_minor_landholders_opinion = 10 + minority_opinion = 10 + + celestial_government_tax_contribution_add = 0.05 + republic_government_tax_contribution_add = 0.05 + } + flag = uses_celestial_bureaucracy + flag = titles_cannot_leave_realm_on_succession # Hardcoded flag + flag = can_have_tributaries + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + trigger_if = { + limit = { + is_independent_ruler = no + } + liege = { has_realm_law = celestial_bureaucracy_0 } + } + } + + can_pass = { + trigger_if = { + limit = { + is_independent_ruler = no + liege = { has_realm_law = celestial_bureaucracy_0 } + } + custom_tooltip = { + text = imperial_bureaucracy_pending_law_change + always = no + } + } + } + + on_pass = { + # Remove modifiers. + remove_law_related_modifiers_effect = yes + } + } + + celestial_bureaucracy_1 = { + modifier = { + courtly_opinion = 20 # Pro-hegemon movement + parochial_opinion = -5 # Advancement movement + belligerent_opinion = -5 # Expansion movement + glory_hound_opinion = -10 # Conservative movement + #zealot_opinion = 0 + barons_and_minor_landholders_opinion = -15 + minority_opinion = -15 + + celestial_government_tax_contribution_add = 0.05 + republic_government_tax_contribution_add = 0.05 + } + flag = uses_celestial_bureaucracy + flag = title_revocation_allowed + flag = vassal_retraction_allowed + flag = can_change_partition_succession_laws + flag = vassal_internal_wars_banned + flag = diarchs_want_to_subsidise_without_this_flag + flag = can_have_tributaries + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + trigger_if = { + limit = { + is_independent_ruler = no + } + liege = { has_realm_law = celestial_bureaucracy_1 } + } + } + + can_pass = { + trigger_if = { + limit = { + has_realm_law = celestial_bureaucracy_0 + is_independent_ruler = yes + } + custom_description = { + subject = root + text = "has_celestial_bureaucracy_cooldown" + NAND = { + has_variable = imperial_bureaucracy_cooldown + NOT = { + culture = { has_innovation = innovation_all_things } + } + } + } + } + trigger_if = { + limit = { + is_independent_ruler = no + liege = { has_realm_law = celestial_bureaucracy_1 } + } + custom_tooltip = { + text = imperial_bureaucracy_pending_law_change + always = no + } + } + can_pass_law_ca1_trigger = yes + } + + pass_cost = { + prestige = { + if = { + limit = { + NOR = { + has_realm_law = celestial_bureaucracy_2 + has_realm_law = celestial_bureaucracy_3 + } + } + add = increase_crown_authority_prestige_cost + } + } + } + + on_pass = { + # Increment cooldown breaker tally, if appropriate. + calculate_authority_cooldown_break_effect = yes + # Set regular cooldown. + set_variable = { + name = imperial_bureaucracy_cooldown + years = @imperial_bureaucracy_cooldown_years_1 + } + # Remove modifiers. + remove_law_related_modifiers_effect = yes + } + + ai_will_do = { + if = { + limit = { has_realm_law = celestial_bureaucracy_0 } + value = 1 + } + } + } + + celestial_bureaucracy_2 = { + modifier = { + courtly_opinion = 5 # Pro-hegemon movement + parochial_opinion = -5 # Advancement movement + belligerent_opinion = -5 # Expansion movement + glory_hound_opinion = -15 # Conservative movement + zealot_opinion = -5 + barons_and_minor_landholders_opinion = -15 + minority_opinion = -15 + + celestial_government_tax_contribution_add = 0.10 + republic_government_tax_contribution_add = 0.10 + } + flag = uses_celestial_bureaucracy + flag = vassal_refusal_is_treason + flag = can_change_succession_laws + flag = vassal_all_wars_banned + flag = admin_change_vassal_gov_cheaper + flag = can_have_tributaries + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + trigger_if = { + limit = { + is_independent_ruler = no + } + liege = { has_realm_law = celestial_bureaucracy_2 } + } + } + + can_pass = { + trigger_if = { + limit = { + NOT = { has_realm_law = celestial_bureaucracy_3 } + is_independent_ruler = yes + } + has_realm_law = celestial_bureaucracy_1 + custom_description = { + subject = root + text = "has_celestial_bureaucracy_cooldown" + NAND = { + has_variable = imperial_bureaucracy_cooldown + NOT = { + culture = { has_innovation = innovation_all_things } + } + } + } + } + trigger_if = { + limit = { + is_independent_ruler = no + liege = { has_realm_law = celestial_bureaucracy_2 } + } + custom_tooltip = { + text = imperial_bureaucracy_pending_law_change + always = no + } + } + can_pass_law_ca2_trigger = yes + } + + pass_cost = { + prestige = { + if = { + limit = { + NOT = { has_realm_law = celestial_bureaucracy_3 } + } + add = increase_crown_authority_prestige_cost + } + } + } + + on_pass = { + # Increment cooldown breaker tally, if appropriate. + calculate_authority_cooldown_break_effect = yes + # Set regular cooldown. + set_variable = { + name = imperial_bureaucracy_cooldown + years = @imperial_bureaucracy_cooldown_years_2 + } + # Remove modifiers. + remove_law_related_modifiers_effect = yes + } + + ai_will_do = { + if = { + limit = { has_realm_law = celestial_bureaucracy_1 } + value = 1 + } + } + } + + celestial_bureaucracy_3 = { + modifier = { + courtly_opinion = 10 # Pro-hegemon movement + parochial_opinion = -10 # Advancement movement + belligerent_opinion = -10 # Expansion movement + glory_hound_opinion = -15 # Conservative movement + zealot_opinion = -15 + barons_and_minor_landholders_opinion = -20 + minority_opinion = -20 + + celestial_government_tax_contribution_add = 0.10 + republic_government_tax_contribution_add = 0.10 + } + flag = uses_celestial_bureaucracy + flag = vassal_all_wars_banned_permanent + flag = max_authority_level + flag = can_have_tributaries + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + trigger_if = { + limit = { + this = title:h_china.holder + } + situation:dynastic_cycle ?= { + NOR = { + situation_current_phase = situation_dynastic_cycle_phase_instability + situation_current_phase = situation_dynastic_cycle_phase_instability_conquest + } + } + } + trigger_if = { + limit = { + is_independent_ruler = no + } + liege = { has_realm_law = celestial_bureaucracy_3 } + } + } + + can_pass = { + trigger_if = { + limit = { + is_independent_ruler = yes + } + has_realm_law = celestial_bureaucracy_2 + custom_description = { + subject = root + text = "has_celestial_bureaucracy_cooldown" + NAND = { + has_variable = imperial_bureaucracy_cooldown + NOT = { + culture = { has_innovation = innovation_all_things } + } + } + } + } + trigger_if = { + limit = { + is_independent_ruler = no + liege = { has_realm_law = celestial_bureaucracy_3 } + } + custom_tooltip = { + text = imperial_bureaucracy_pending_law_change + always = no + } + } + can_pass_law_ca3_trigger = yes + } + + pass_cost = { + prestige = { + if = { + limit = { + NOT = { has_realm_law = celestial_bureaucracy_3 } + } + add = increase_crown_authority_prestige_cost + } + } + } + + on_pass = { + # Increment cooldown breaker tally, if appropriate. + calculate_authority_cooldown_break_effect = yes + # Set regular cooldown. + set_variable = { + name = imperial_bureaucracy_cooldown + years = @imperial_bureaucracy_cooldown_years_3 + } + # Remove modifiers. + remove_law_related_modifiers_effect = yes + } + } +} + +mandala_decree = { + default = mandala_decree_reverence + flag = mandala_law + + mandala_decree_none = { + #Standard laws + flag = can_have_tributaries + flag = title_revocation_allowed + flag = vassal_retraction_allowed + flag = can_change_succession_laws + + can_keep = { realm_law_is_mandala = yes } + + can_pass = { + } + + pass_cost = { + prestige = @mandala_decree_prestige_cost + } + + on_pass = { + } + + ai_will_do = { + value = 0 + } + } + + mandala_decree_prosperity = { + modifier = { + men_at_arms_maintenance = 0.25 + levy_size = -0.25 + tributary_opinion = 15 + } + #Standard laws + flag = can_have_tributaries + flag = title_revocation_allowed + flag = vassal_retraction_allowed + flag = can_change_succession_laws + #Decree specific + flag = piety_devotion_from_defensive_wars + flag = subjects_appear_more_economical + flag = can_use_piety_to_reassert_tributary + flag = tributaries_less_likely_to_break_free + + can_keep = { realm_law_is_mandala = yes } + + can_pass = { + legitimacy_level >= 2 + trigger_if = { + limit = { + house ?= { NOT = { has_house_head_parameter = can_enact_prosperity_decree } } + } + custom_tooltip = { + text = devaraja_aspect_does_not_allow_this_decree + always = no + } + } + } + + pass_cost = { + prestige = @mandala_decree_prestige_cost + } + + on_pass = { + #Don't need the alert no more + set_variable = { + name = has_picked_mandala_decree + value = flag:yes + } + } + + ai_will_do = { + value = 1 + #Traits + if = { + limit = { has_trait = greedy } + add = 5 + } + if = { + limit = { has_trait = craven } + add = 5 + } + if = { + limit = { ai_has_economical_boom_personality = yes } + add = 10 + } + } + } + + mandala_decree_expansion = { + modifier = { + vassal_levy_contribution_mult = 0.25 + independent_ruler_opinion = -25 + tributary_opinion = 25 + } + #Standard laws + flag = can_have_tributaries + flag = title_revocation_allowed + flag = vassal_retraction_allowed + flag = can_change_succession_laws + #Decree specific + flag = piety_devotion_from_offensive_wars + flag = piety_for_sieging_capital_temple_complexes + flag = can_call_tributaries_for_piety + flag = subjects_appear_more_warlike + + can_keep = { realm_law_is_mandala = yes } + + can_pass = { + trigger_if = { + limit = { + house ?= { NOT = { has_house_head_parameter = can_enact_expansion_decree } } + } + custom_tooltip = { + text = devaraja_aspect_does_not_allow_this_decree + always = no + } + } + legitimacy_level >= 2 + } + + pass_cost = { + prestige = @mandala_decree_prestige_cost + } + + on_pass = { + #Don't need the alert no more + set_variable = { + name = has_picked_mandala_decree + value = flag:yes + } + } + + ai_will_do = { + value = 1 + #Traits + if = { + limit = { has_trait = brave } + add = 5 + } + if = { + limit = { has_trait = ambitious } + add = 5 + } + if = { + limit = { ai_has_warlike_personality = yes } + add = 10 + } + } + } + + mandala_decree_reverence = { + modifier = { + } + #Standard laws + flag = can_have_tributaries + flag = title_revocation_allowed + flag = vassal_retraction_allowed + flag = can_change_succession_laws + #Decree specific + flag = cheaper_pilgrimages + flag = vassals_more_inclined_to_convert + flag = subjects_appear_more_pious + flag = can_convert_all_subjects_to_mandalas #Vassals more likely to accept, can now also ask Tribs + flag = tributaries_more_likely_to_contribute_to_GPs + + can_keep = { realm_law_is_mandala = yes } + + can_pass = { + legitimacy_level >= 2 + trigger_if = { + limit = { + house ?= { NOT = { has_house_head_parameter = can_enact_reverence_decree } } + } + custom_tooltip = { + text = devaraja_aspect_does_not_allow_this_decree + always = no + } + } + } + + pass_cost = { + prestige = @mandala_decree_prestige_cost + } + + on_pass = { + #Don't need the alert no more + set_variable = { + name = has_picked_mandala_decree + value = flag:yes + } + } + + ai_will_do = { + value = 1 + #Traits + if = { + limit = { has_trait = zealous } + add = 5 + } + if = { + limit = { has_trait = arrogant } + add = 5 + } + if = { + limit = { ai_has_pious_builder_personality = yes } + add = 10 + } + } + } +} + +meritocratic_bureaucracy = { # A variant of Imperial Bureaucracy for Meritocratic Government + default = meritocratic_bureaucracy_1 + cumulative = yes + flag = realm_law + + meritocratic_bureaucracy_0 = { + modifier = { + belligerent_opinion = -10 + barons_and_minor_landholders_opinion = 20 + glory_hound_opinion = 10 + parochial_opinion = 10 + courtly_opinion = 5 + } + flag = uses_meritocratic_bureaucracy + flag = titles_cannot_leave_realm_on_succession # Hardcoded flag + flag = can_have_tributaries + + can_keep = { + realm_law_use_meritocratic_bureaucracy = yes + trigger_if = { + limit = { + is_independent_ruler = no + } + liege = { has_realm_law = meritocratic_bureaucracy_0 } + } + } + + can_pass = { + trigger_if = { + limit = { + is_independent_ruler = no + liege = { has_realm_law = meritocratic_bureaucracy_0 } + } + custom_tooltip = { + text = imperial_bureaucracy_pending_law_change + always = no + } + } + } + + on_pass = { + # Remove modifiers. + remove_law_related_modifiers_effect = yes + } + } + + meritocratic_bureaucracy_1 = { + modifier = { + belligerent_opinion = 5 + barons_and_minor_landholders_opinion = -30 + glory_hound_opinion = -15 + parochial_opinion = -15 + courtly_opinion = -5 + minority_opinion = -10 + meritocratic_government_tax_contribution_add = 0.05 + } + flag = uses_meritocratic_bureaucracy + flag = title_revocation_allowed + flag = vassal_retraction_allowed + flag = can_change_partition_succession_laws + flag = vassal_internal_wars_banned + flag = diarchs_want_to_subsidise_without_this_flag + flag = can_have_tributaries + + can_keep = { + realm_law_use_meritocratic_bureaucracy = yes + trigger_if = { + limit = { + is_independent_ruler = no + } + liege = { has_realm_law = meritocratic_bureaucracy_1 } + } + } + + can_pass = { + trigger_if = { + limit = { + has_realm_law = meritocratic_bureaucracy_0 + is_independent_ruler = yes + } + custom_description = { + subject = root + text = "has_meritocratic_bureaucracy_cooldown" + NAND = { + has_variable = imperial_bureaucracy_cooldown + NOT = { + culture = { has_innovation = innovation_all_things } + } + } + } + } + trigger_if = { + limit = { + is_independent_ruler = no + liege = { has_realm_law = meritocratic_bureaucracy_1 } + } + custom_tooltip = { + text = imperial_bureaucracy_pending_law_change + always = no + } + } + can_pass_law_ca1_trigger = yes + } + + pass_cost = { + prestige = { + if = { + limit = { + NOR = { + has_realm_law = meritocratic_bureaucracy_2 + has_realm_law = meritocratic_bureaucracy_3 + } + } + add = increase_crown_authority_prestige_cost + } + } + } + + on_pass = { + # Increment cooldown breaker tally, if appropriate. + calculate_authority_cooldown_break_effect = yes + # Set regular cooldown. + set_variable = { + name = imperial_bureaucracy_cooldown + years = @imperial_bureaucracy_cooldown_years_1 + } + # Remove modifiers. + remove_law_related_modifiers_effect = yes + } + + ai_will_do = { + if = { + limit = { has_realm_law = meritocratic_bureaucracy_0 } + value = 1 + } + } + } + + meritocratic_bureaucracy_2 = { + modifier = { + belligerent_opinion = 10 + barons_and_minor_landholders_opinion = -10 + glory_hound_opinion = -10 + parochial_opinion = -10 + courtly_opinion = -5 + zealot_opinion = -10 + minority_opinion = -10 + meritocratic_government_tax_contribution_add = 0.05 + republic_government_tax_contribution_add = 0.05 + } + flag = uses_meritocratic_bureaucracy + flag = vassal_refusal_is_treason + flag = can_change_succession_laws + flag = vassal_all_wars_banned + flag = admin_change_vassal_gov_cheaper + flag = can_have_tributaries + + can_keep = { + realm_law_use_meritocratic_bureaucracy = yes + trigger_if = { + limit = { + this = title:h_china.holder + } + situation:dynastic_cycle ?= { + NOR = { + situation_current_phase = situation_dynastic_cycle_phase_instability + situation_current_phase = situation_dynastic_cycle_phase_instability_conquest + } + } + } + trigger_if = { + limit = { + is_independent_ruler = no + } + liege = { has_realm_law = meritocratic_bureaucracy_2 } + } + } + + can_pass = { + trigger_if = { + limit = { + NOT = { has_realm_law = meritocratic_bureaucracy_3 } + is_independent_ruler = yes + } + has_realm_law = meritocratic_bureaucracy_1 + custom_description = { + subject = root + text = "has_meritocratic_bureaucracy_cooldown" + NAND = { + has_variable = imperial_bureaucracy_cooldown + NOT = { + culture = { has_innovation = innovation_all_things } + } + } + } + } + trigger_if = { + limit = { + is_independent_ruler = no + liege = { has_realm_law = meritocratic_bureaucracy_2 } + } + custom_tooltip = { + text = imperial_bureaucracy_pending_law_change + always = no + } + } + can_pass_law_ca2_trigger = yes + } + + pass_cost = { + prestige = { + if = { + limit = { + NOT = { has_realm_law = meritocratic_bureaucracy_3 } + } + add = increase_crown_authority_prestige_cost + } + } + } + + on_pass = { + # Increment cooldown breaker tally, if appropriate. + calculate_authority_cooldown_break_effect = yes + # Set regular cooldown. + set_variable = { + name = imperial_bureaucracy_cooldown + years = @imperial_bureaucracy_cooldown_years_2 + } + # Remove modifiers. + remove_law_related_modifiers_effect = yes + } + + ai_will_do = { + if = { + limit = { has_realm_law = meritocratic_bureaucracy_1 } + value = 1 + } + } + } + + meritocratic_bureaucracy_3 = { + modifier = { + belligerent_opinion = 15 + barons_and_minor_landholders_opinion = -20 + glory_hound_opinion = -25 + parochial_opinion = -25 + courtly_opinion = -10 + zealot_opinion = -20 + minority_opinion = -30 + meritocratic_government_tax_contribution_add = 0.1 + republic_government_tax_contribution_add = 0.05 + } + flag = uses_meritocratic_bureaucracy + flag = vassal_all_wars_banned_permanent + flag = max_authority_level + flag = can_have_tributaries + + can_keep = { + realm_law_use_meritocratic_bureaucracy = yes + trigger_if = { + limit = { + is_independent_ruler = no + } + liege = { has_realm_law = meritocratic_bureaucracy_3 } + } + } + + can_pass = { + trigger_if = { + limit = { + is_independent_ruler = yes + } + has_realm_law = meritocratic_bureaucracy_2 + custom_description = { + subject = root + text = "has_meritocratic_bureaucracy_cooldown" + NAND = { + has_variable = imperial_bureaucracy_cooldown + NOT = { + culture = { has_innovation = innovation_all_things } + } + } + } + } + trigger_if = { + limit = { + is_independent_ruler = no + liege = { has_realm_law = meritocratic_bureaucracy_3 } + } + custom_tooltip = { + text = imperial_bureaucracy_pending_law_change + always = no + } + } + can_pass_law_ca3_trigger = yes + } + + pass_cost = { + prestige = { + if = { + limit = { + NOT = { has_realm_law = meritocratic_bureaucracy_3 } + } + add = increase_crown_authority_prestige_cost + } + } + } + + on_pass = { + # Increment cooldown breaker tally, if appropriate. + calculate_authority_cooldown_break_effect = yes + # Set regular cooldown. + set_variable = { + name = imperial_bureaucracy_cooldown + years = @imperial_bureaucracy_cooldown_years_3 + } + # Remove modifiers. + remove_law_related_modifiers_effect = yes + } + } +} + +japanese_bureaucracy = { # A variant of Imperial Bureaucracy for Ritsuryo Government + default = japanese_bureaucracy_1 + cumulative = yes + flag = realm_law + + japanese_bureaucracy_0 = { + modifier = { + belligerent_opinion = -10 + barons_and_minor_landholders_opinion = 20 + glory_hound_opinion = 10 + parochial_opinion = 10 + courtly_opinion = 5 + } + flag = uses_japanese_bureaucracy + flag = titles_cannot_leave_realm_on_succession # Hardcoded flag + + can_keep = { + realm_law_use_japanese_bureaucracy = yes + trigger_if = { + limit = { is_independent_ruler = no } + liege = { has_realm_law = japanese_bureaucracy_0 } + } + } + + can_pass = { + trigger_if = { + limit = { + is_independent_ruler = no + liege = { has_realm_law = japanese_bureaucracy_0 } + } + custom_tooltip = { + text = imperial_bureaucracy_pending_law_change + always = no + } + } + } + + on_pass = { + # Remove modifiers. + remove_law_related_modifiers_effect = yes + } + } + + japanese_bureaucracy_1 = { + modifier = { + belligerent_opinion = 5 + barons_and_minor_landholders_opinion = -30 + glory_hound_opinion = -15 + parochial_opinion = -15 + courtly_opinion = -5 + minority_opinion = -10 + japan_administrative_government_tax_contribution_add = 0.05 + } + flag = uses_celestial_bureaucracy + flag = title_revocation_allowed + flag = vassal_retraction_allowed + flag = can_change_partition_succession_laws + flag = diarchs_want_to_subsidise_without_this_flag + + can_keep = { + realm_law_use_japanese_bureaucracy = yes + trigger_if = { + limit = { is_independent_ruler = no } + liege = { has_realm_law = japanese_bureaucracy_1 } + } + } + + can_pass = { + trigger_if = { + limit = { + has_realm_law = japanese_bureaucracy_0 + is_independent_ruler = yes + } + custom_description = { + subject = root + text = "has_japanese_bureaucracy_cooldown" + NAND = { + has_variable = imperial_bureaucracy_cooldown + NOT = { + culture = { has_innovation = innovation_all_things } + } + } + } + } + trigger_if = { + limit = { + is_independent_ruler = no + liege = { has_realm_law = japanese_bureaucracy_1 } + } + custom_tooltip = { + text = imperial_bureaucracy_pending_law_change + always = no + } + } + can_pass_law_ca1_trigger = yes + } + + pass_cost = { + prestige = { + if = { + limit = { + NOR = { + has_realm_law = japanese_bureaucracy_2 + has_realm_law = japanese_bureaucracy_3 + } + } + add = increase_crown_authority_prestige_cost + } + } + } + + on_pass = { + # Increment cooldown breaker tally, if appropriate. + calculate_authority_cooldown_break_effect = yes + # Set regular cooldown. + set_variable = { + name = imperial_bureaucracy_cooldown + years = @imperial_bureaucracy_cooldown_years_1 + } + # Remove modifiers. + remove_law_related_modifiers_effect = yes + } + + ai_will_do = { + if = { + limit = { has_realm_law = japanese_bureaucracy_0 } + value = 1 + } + } + } + + japanese_bureaucracy_2 = { + modifier = { + belligerent_opinion = 10 + barons_and_minor_landholders_opinion = -10 + glory_hound_opinion = -10 + parochial_opinion = -10 + courtly_opinion = -5 + zealot_opinion = -10 + minority_opinion = -10 + japan_administrative_government_tax_contribution_add = 0.05 + republic_government_tax_contribution_add = 0.05 + } + flag = uses_japanese_bureaucracy + flag = vassal_refusal_is_treason + flag = can_change_succession_laws + flag = admin_change_vassal_gov_cheaper + + can_keep = { + realm_law_use_japanese_bureaucracy = yes + trigger_if = { + limit = { + this = title:h_china.holder + } + situation:dynastic_cycle ?= { + NOR = { + situation_current_phase = situation_dynastic_cycle_phase_instability + situation_current_phase = situation_dynastic_cycle_phase_instability_conquest + } + } + } + trigger_if = { + limit = { is_independent_ruler = no } + liege = { has_realm_law = japanese_bureaucracy_2 } + } + } + + can_pass = { + trigger_if = { + limit = { + NOT = { has_realm_law = japanese_bureaucracy_3 } + is_independent_ruler = yes + } + has_realm_law = japanese_bureaucracy_1 + custom_description = { + subject = root + text = "has_japanese_bureaucracy_cooldown" + NAND = { + has_variable = imperial_bureaucracy_cooldown + NOT = { + culture = { has_innovation = innovation_all_things } + } + } + } + } + trigger_if = { + limit = { + is_independent_ruler = no + liege = { has_realm_law = japanese_bureaucracy_2 } + } + custom_tooltip = { + text = imperial_bureaucracy_pending_law_change + always = no + } + } + can_pass_law_ca2_trigger = yes + } + + pass_cost = { + prestige = { + if = { + limit = { + NOT = { has_realm_law = japanese_bureaucracy_3 } + } + add = increase_crown_authority_prestige_cost + } + } + } + + on_pass = { + # Increment cooldown breaker tally, if appropriate. + calculate_authority_cooldown_break_effect = yes + # Set regular cooldown. + set_variable = { + name = imperial_bureaucracy_cooldown + years = @imperial_bureaucracy_cooldown_years_2 + } + # Remove modifiers. + remove_law_related_modifiers_effect = yes + } + + ai_will_do = { + if = { + limit = { has_realm_law = japanese_bureaucracy_1 } + value = 1 + } + } + } + + japanese_bureaucracy_3 = { + modifier = { + belligerent_opinion = 15 + barons_and_minor_landholders_opinion = -20 + glory_hound_opinion = -25 + parochial_opinion = -25 + courtly_opinion = -10 + zealot_opinion = -20 + minority_opinion = -30 + japan_administrative_government_tax_contribution_add = 0.1 + republic_government_tax_contribution_add = 0.05 + } + flag = uses_japanese_bureaucracy + flag = max_authority_level + + can_keep = { + realm_law_use_japanese_bureaucracy = yes + trigger_if = { + limit = { is_independent_ruler = no } + liege = { has_realm_law = japanese_bureaucracy_3 } + } + } + + can_pass = { + trigger_if = { + limit = { is_independent_ruler = yes } + has_realm_law = japanese_bureaucracy_2 + custom_description = { + subject = root + text = "has_japanese_bureaucracy_cooldown" + NAND = { + has_variable = imperial_bureaucracy_cooldown + NOT = { + culture = { has_innovation = innovation_all_things } + } + } + } + } + trigger_if = { + limit = { + is_independent_ruler = no + liege = { has_realm_law = japanese_bureaucracy_3 } + } + custom_tooltip = { + text = imperial_bureaucracy_pending_law_change + always = no + } + } + can_pass_law_ca3_trigger = yes + } + + pass_cost = { + prestige = { + if = { + limit = { + NOT = { has_realm_law = japanese_bureaucracy_3 } + } + add = increase_crown_authority_prestige_cost + } + } + } + + on_pass = { + # Increment cooldown breaker tally, if appropriate. + calculate_authority_cooldown_break_effect = yes + # Set regular cooldown. + set_variable = { + name = imperial_bureaucracy_cooldown + years = @imperial_bureaucracy_cooldown_years_3 + } + # Remove modifiers. + remove_law_related_modifiers_effect = yes + } + + } +} + +crowned_laws = { + default = uncrowned + cumulative = no + flag = realm_law + flag = realm_law_no_number + flag = realm_no_pass + + uncrowned = { + can_keep = { + coronation_trigger = yes + NOT = { + has_game_rule = coronation_laws_off + } + } + can_have = { + coronation_trigger = yes + NOT = { + has_game_rule = coronation_laws_off + } + } + modifier = { + vassal_opinion = -10 + legitimacy_gain_mult = -0.25 + monthly_legitimacy_add = -2.5 + ai_war_chance = -100 + } + can_pass = { + custom_tooltip = { + text = can_only_be_lost_through_losing_titles + NOR = { + has_realm_law = crowned_king + has_realm_law = crowned_emperor + } + } + } + potential = { + coronation_trigger = yes + NOT = { + has_game_rule = coronation_laws_off + } + } + } + + crowned_king = { + can_keep = { + coronation_trigger = yes + NOT = { + has_game_rule = coronation_laws_off + } + } + can_have = { + coronation_trigger = yes + NOT = { + has_game_rule = coronation_laws_off + } + } + modifier = { + courtly_opinion = 5 + barons_and_minor_landholders_opinion = 5 + } + can_pass = { + # If you have a worse Coronation law, we will tell the player they can gain this with a Coronation + custom_tooltip = { + text = can_only_be_passed_through_coronation + NOT = { has_realm_law = uncrowned } + } + # If you have a better Coronation law, we will tell the player this is pointless for them + custom_tooltip = { + text = already_better_coronation + NOT = { has_realm_law = crowned_emperor } + } + } + potential = { + coronation_trigger = yes + NOT = { + has_game_rule = coronation_laws_off + } + } + } + + crowned_emperor = { + can_keep = { + coronation_trigger = yes + NOT = { + has_game_rule = coronation_laws_off + } + } + can_have = { + coronation_trigger = yes + NOT = { + has_game_rule = coronation_laws_off + } + } + modifier = { + courtly_opinion = 10 + barons_and_minor_landholders_opinion = 10 + zealot_opinion = 5 + } + can_pass = { + # If you have a worse Coronation law, we will tell the player they can gain this with a Coronation + custom_tooltip = { + text = can_only_be_passed_through_coronation + NOR = { + has_realm_law = uncrowned + has_realm_law = crowned_king + } + } + } + should_start_with = { + always = no + } + potential = { + coronation_trigger = yes + NOT = { + has_game_rule = coronation_laws_off + } + } + + } +} diff --git a/N3OW/common/laws/00_succession_laws.txt b/N3OW/common/laws/00_succession_laws.txt index 22059969..a48e719f 100644 --- a/N3OW/common/laws/00_succession_laws.txt +++ b/N3OW/common/laws/00_succession_laws.txt @@ -1,6 +1,17 @@ succession_order_laws = { + flag = succession_order_laws + can_change_law_group = { + custom_tooltip = { + text = CANT_CHANGE_LAW_TOOLTIP + NOR = { + has_realm_law = mandala_succession_law + government_has_flag = government_is_japan_administrative + } + } + } + confederate_partition_succession_law = { can_keep = { always = yes @@ -66,6 +77,10 @@ government_has_flag = government_is_nomadic government_has_flag = government_is_clan government_has_flag = government_is_administrative + government_has_flag = government_is_mandala + government_has_flag = government_is_celestial + government_has_flag = government_is_meritocratic + government_has_flag = government_is_steppe_admin } } } @@ -117,7 +132,7 @@ has_innovation = innovation_heraldry } } - NOT = { government_has_flag = government_is_administrative } + NOT = { government_allows = administrative } } succession = { order_of_succession = inheritance @@ -149,6 +164,10 @@ government_has_flag = government_is_nomadic government_has_flag = government_is_clan government_has_flag = government_is_administrative + government_has_flag = government_is_mandala + government_has_flag = government_is_celestial + government_has_flag = government_is_meritocratic + government_has_flag = government_is_steppe_admin } } } @@ -173,11 +192,8 @@ government_has_flag = government_is_feudal culture = { has_innovation = innovation_heraldry - NOT = { - has_innovation = innovation_hereditary_rule - } } - NOT = { government_has_flag = government_is_administrative } + NOT = { government_allows = administrative } } succession = { order_of_succession = inheritance @@ -213,6 +229,10 @@ government_has_flag = government_is_nomadic government_has_flag = government_is_clan government_has_flag = government_is_administrative + government_has_flag = government_is_mandala + government_has_flag = government_is_celestial + government_has_flag = government_is_meritocratic + government_has_flag = government_is_steppe_admin } } } @@ -224,11 +244,15 @@ custom_description = { text = succession_laws_must_not_be_forced_partition NAND = { - is_independent_ruler = no + top_liege != this vassal_contract_has_flag = locked_to_partition } } } + can_title_have = { + # Ceremonial Regent + NOT = { exists = var:administrative_ui_special_title.holder } + } can_have = { NOT = { government_has_flag = government_is_nomadic } can_have_single_heir_succession_law_trigger = yes @@ -243,7 +267,7 @@ } trigger_if = { limit = { - government_has_flag = government_is_administrative + government_allows = administrative } influence_level >= 4 has_active_diarchy = no @@ -252,7 +276,6 @@ } should_start_with = { historical_succession_access_single_heir_succession_law_trigger = yes - NOT = { government_has_flag = government_is_administrative } } succession = { order_of_succession = inheritance @@ -291,12 +314,18 @@ } potential = { - NOT = { government_has_flag = government_is_nomadic } + NOR = { + government_has_flag = government_is_nomadic + government_has_flag = government_is_mandala + } trigger_if = { limit = { - government_has_flag = government_is_administrative + government_allows = administrative + } + OR = { + is_independent_ruler = yes + tgp_is_ceremonial_liege_trigger = yes } - is_independent_ruler = yes } } } @@ -350,7 +379,7 @@ custom_description = { text = succession_laws_must_not_be_forced_partition NAND = { - is_independent_ruler = no + top_liege != this vassal_contract_has_flag = locked_to_partition } } @@ -369,7 +398,7 @@ } trigger_if = { limit = { - government_has_flag = government_is_administrative + government_allows = administrative } influence_level >= 4 has_active_diarchy = no @@ -416,7 +445,10 @@ } is_independent_ruler = yes } - NOT = { government_has_flag = government_is_nomadic } + NOR = { + government_has_flag = government_is_nomadic + government_has_flag = government_is_mandala + } } } @@ -427,7 +459,7 @@ custom_description = { text = succession_laws_must_not_be_forced_partition NAND = { - is_independent_ruler = no + top_liege != this vassal_contract_has_flag = locked_to_partition } } @@ -447,7 +479,7 @@ } should_start_with = { historical_succession_access_single_heir_dynasty_house_trigger = yes - NOT = { government_has_flag = government_is_administrative } + NOT = { government_allows = administrative } } succession = { order_of_succession = inheritance @@ -499,6 +531,7 @@ NOR = { government_has_flag = government_is_administrative government_has_flag = government_is_nomadic + government_has_flag = government_is_mandala } } } @@ -506,18 +539,30 @@ acclamation_succession_law = { can_keep = { can_keep_acclamation_succession_law_trigger = yes + NOT ={ + government_has_flag = government_is_special_republic + } } can_pass = { can_change_acclamation_succession_law_trigger = yes + NOT ={ + government_has_flag = government_is_special_republic + } } can_have = { NOT = { government_has_flag = government_is_nomadic } can_have_acclamation_succession_law_trigger = yes + NOT ={ + government_has_flag = government_is_special_republic + } } should_start_with = { has_ep3_dlc_trigger = yes has_title = title:e_byzantium - government_has_flag = government_is_administrative + government_allows = administrative + NOT ={ + government_has_flag = government_is_special_republic + } } succession = { order_of_succession = appointment @@ -542,7 +587,7 @@ } } potential = { - government_has_flag = government_is_administrative + government_allows = administrative is_independent_ruler = yes } } @@ -550,12 +595,14 @@ appointment_succession_law = { can_keep = { can_keep_appointment_succession_law_trigger = yes - + NOT ={ + government_has_flag = government_is_special_republic + } # Vassal Contract allows it custom_description = { text = succession_laws_must_not_be_forced_partition NAND = { - is_independent_ruler = no + top_liege != this vassal_contract_has_flag = locked_to_partition } } @@ -563,12 +610,21 @@ can_have = { NOT = { government_has_flag = government_is_nomadic } can_have_appointment_succession_law_trigger = yes + NOT ={ + government_has_flag = government_is_special_republic + } } can_pass = { can_change_appointment_succession_law_trigger = yes } should_start_with = { - government_has_flag = government_is_administrative + government_allows = administrative + NOR = { + government_has_flag = government_is_celestial + government_has_flag = government_is_special_republic + government_has_flag = government_is_japan_administrative + government_has_flag = government_is_meritocratic + } is_independent_ruler = no } succession = { @@ -604,7 +660,12 @@ } potential = { - government_has_flag = government_is_administrative + government_allows = administrative # Default succession law for all admin types... + NOR = { # ... Unless you have a unique succession available + government_has_flag = government_is_celestial + government_has_flag = government_is_japan_administrative + government_has_flag = government_is_meritocratic + } is_independent_ruler = no } } @@ -713,7 +774,7 @@ can_have_city_succession_law_trigger = yes } should_start_with = { - government_has_flag = government_is_special_republic + government_has_flag = government_is_republic } succession = { order_of_succession = generate @@ -1026,6 +1087,534 @@ can_have_herder_succession_law_trigger = yes } } + + celestial_appointment_succession_law = { + can_keep = { + government_allows = administrative + is_independent_ruler = no + custom_tooltip = { + text = celestial_appointment_allowed_desc + NOT = { vassal_contract_has_flag = celestial_military_appointment } + } + # Vassal Contract allows it + custom_description = { + text = succession_laws_must_not_be_forced_partition + NAND = { + is_independent_ruler = no + vassal_contract_has_flag = locked_to_partition + } + } + } + can_have = { + government_allows = administrative + is_independent_ruler = no + } + can_pass = { + government_allows = administrative + is_independent_ruler = no + } + should_start_with = { + government_has_flag = government_is_celestial + is_independent_ruler = no + custom_tooltip = { + text = celestial_appointment_allowed_desc + NOT = { vassal_contract_has_flag = celestial_military_appointment } + } + } + succession = { + order_of_succession = appointment + appointment_type = celestial_civic_governor + } + flag = advanced_succession_law + flag = appointment_type_succession + modifier = { + glory_hound_opinion = -10 + courtly_opinion = 5 + player_heir_opinion = 20 + eligible_child_except_player_heir_opinion = -5 + } + pass_cost = { + prestige = change_succession_law_prestige_cost + } + revoke_cost = { + prestige = change_succession_law_prestige_cost + } + + ai_will_do = { + if = { + limit = { + OR = { + has_realm_law = confederate_partition_succession_law + has_realm_law = partition_succession_law + has_realm_law = high_partition_succession_law + } + } + value = 3 + } + } + + potential = { + government_has_flag = government_is_celestial + is_independent_ruler = no + } + } + + celestial_military_appointment_succession_law = { + can_keep = { + government_allows = administrative + is_independent_ruler = no + custom_tooltip = { + text = celestial_military_appointment_allowed_desc + vassal_contract_has_flag = celestial_military_appointment + } + # Vassal Contract allows it + custom_description = { + NAND = { + is_independent_ruler = no + vassal_contract_has_flag = locked_to_partition + } + } + } + can_have = { + government_allows = administrative + is_independent_ruler = no + } + can_pass = { + can_change_succession_law_trigger = yes + government_allows = administrative + is_independent_ruler = no + } + should_start_with = { + government_has_flag = government_is_celestial + is_independent_ruler = no + custom_tooltip = { + text = celestial_military_appointment_allowed_desc + vassal_contract_has_flag = celestial_military_appointment + } + } + succession = { + order_of_succession = appointment + appointment_type = celestial_military_governor + } + flag = advanced_succession_law + flag = appointment_type_succession + modifier = { + glory_hound_opinion = 5 + courtly_opinion = -10 + player_heir_opinion = 20 + eligible_child_except_player_heir_opinion = -5 + } + pass_cost = { + prestige = change_succession_law_prestige_cost + } + revoke_cost = { + prestige = change_succession_law_prestige_cost + } + + ai_will_do = { + if = { + limit = { + OR = { + has_realm_law = confederate_partition_succession_law + has_realm_law = partition_succession_law + has_realm_law = high_partition_succession_law + } + } + value = 3 + } + } + + potential = { + government_has_flag = government_is_celestial + is_independent_ruler = no + } + } + + japanese_regency_succession_law = { + can_keep = { + can_have_japanese_regency_succession_law_trigger = yes + } + can_pass = { + can_have_japanese_regency_succession_law_trigger = yes + } + can_have = { + can_have_japanese_regency_succession_law_trigger = yes + } + can_title_have = { + exists = var:administrative_ui_special_title + } + should_show_for_title = { # Never show this in the UI, just apply it through script + always = no + } + can_remove_from_title = { + always = no + } + should_start_with = { + always = no + } + succession = { + order_of_succession = appointment + appointment_type = japanese_regent + } + flag = advanced_succession_law + flag = can_designate_heirs + flag = appointment_type_succession + pass_cost = { + prestige = change_succession_law_prestige_cost + } + ai_will_do = { + if = { + limit = { has_realm_law = confederate_partition_succession_law } + value = 1 + } + } + potential = { + government_has_flag = government_is_japan_administrative + } + } + + japanese_appointment_succession_law = { + can_keep = { + can_keep_japanese_appointment_succession_law_trigger = yes + } + can_pass = { + can_change_japanese_appointment_succession_law_trigger = yes + } + can_have = { + can_have_japanese_appointment_succession_law_trigger = yes + } + should_start_with = { + government_has_flag = government_is_japan_administrative + is_independent_ruler = no + NOT = { has_title = title:k_chrysanthemum_throne } + } + succession = { + order_of_succession = appointment + appointment_type = japanese_governor + } + flag = advanced_succession_law + flag = appointment_type_succession + modifier = { + glory_hound_opinion = -10 + parochial_opinion = -5 + player_heir_opinion = 20 + eligible_child_except_player_heir_opinion = -5 + } + pass_cost = { + prestige = change_succession_law_prestige_cost + } + revoke_cost = { + prestige = change_succession_law_prestige_cost + } + + ai_will_do = { + if = { + limit = { + OR = { + has_realm_law = confederate_partition_succession_law + has_realm_law = partition_succession_law + has_realm_law = high_partition_succession_law + } + } + value = 3 + } + } + + potential = { + government_has_flag = government_is_japan_administrative + is_independent_ruler = no + } + } + + japanese_military_appointment_succession_law = { + can_keep = { + government_allows = administrative + is_independent_ruler = no + custom_tooltip = { + text = celestial_military_appointment_allowed_desc + vassal_contract_has_flag = japan_administrative_military_appointment + } + # Vassal Contract allows it + custom_description = { + NAND = { + is_independent_ruler = no + vassal_contract_has_flag = locked_to_partition + } + } + } + can_have = { + government_allows = administrative + is_independent_ruler = no + } + can_pass = { + can_change_succession_law_trigger = yes + government_allows = administrative + is_independent_ruler = no + } + should_start_with = { + government_has_flag = government_is_japan_administrative + is_independent_ruler = no + custom_tooltip = { + text = celestial_military_appointment_allowed_desc + vassal_contract_has_flag = japan_administrative_military_appointment + } + } + succession = { + order_of_succession = appointment + appointment_type = japanese_military_governor + } + flag = advanced_succession_law + flag = appointment_type_succession + modifier = { + glory_hound_opinion = 5 + courtly_opinion = -10 + player_heir_opinion = 20 + eligible_child_except_player_heir_opinion = -5 + } + pass_cost = { + prestige = change_succession_law_prestige_cost + } + revoke_cost = { + prestige = change_succession_law_prestige_cost + } + + ai_will_do = { + if = { + limit = { + OR = { + has_realm_law = confederate_partition_succession_law + has_realm_law = partition_succession_law + has_realm_law = high_partition_succession_law + } + } + value = 3 + } + } + + potential = { + government_has_flag = government_is_japan_administrative + is_independent_ruler = no + } + } + + mandala_succession_law = { + can_keep = { + realm_law_is_mandala = yes + } + can_have = { + realm_law_is_mandala = yes + } + can_pass = { + realm_law_is_mandala = yes + } + should_start_with = { + realm_law_is_mandala = yes + } + should_show_for_title = { # Never show this in the UI, just apply it through script + always = no + } + can_remove_from_title = { + always = no + } + succession = { + order_of_succession = inheritance + traversal_order = children + rank = oldest + title_division = single_heir + } + flag = can_designate_heirs + + potential = { + realm_law_is_mandala = yes + } + } + + meritocratic_appointment_succession_law = { + can_keep = { + government_allows = administrative + is_independent_ruler = no + custom_tooltip = { + text = celestial_military_appointment_allowed_desc + NOT = { vassal_contract_has_flag = meritocratic_military_appointment } + } + # Vassal Contract allows it + custom_description = { + text = succession_laws_must_not_be_forced_partition + NAND = { + is_independent_ruler = no + vassal_contract_has_flag = locked_to_partition + } + } + } + can_have = { + government_allows = administrative + is_independent_ruler = no + } + can_pass = { + government_allows = administrative + is_independent_ruler = no + } + should_start_with = { + government_has_flag = government_is_meritocratic + is_independent_ruler = no + custom_tooltip = { + text = celestial_military_appointment_allowed_desc + NOT = { vassal_contract_has_flag = meritocratic_military_appointment } + } + } + succession = { + order_of_succession = appointment + appointment_type = meritocratic_civic_governor + } + flag = advanced_succession_law + flag = appointment_type_succession + modifier = { + glory_hound_opinion = -10 + courtly_opinion = 5 + player_heir_opinion = 20 + eligible_child_except_player_heir_opinion = -5 + } + pass_cost = { + prestige = change_succession_law_prestige_cost + } + revoke_cost = { + prestige = change_succession_law_prestige_cost + } + + ai_will_do = { + if = { + limit = { + OR = { + has_realm_law = confederate_partition_succession_law + has_realm_law = partition_succession_law + has_realm_law = high_partition_succession_law + } + } + value = 3 + } + } + + potential = { + government_has_flag = government_is_meritocratic + is_independent_ruler = no + } + } + + meritocratic_military_appointment_succession_law = { + can_keep = { + government_allows = administrative + is_independent_ruler = no + custom_tooltip = { + text = celestial_military_appointment_allowed_desc + vassal_contract_has_flag = meritocratic_military_appointment + } + # Vassal Contract allows it + custom_description = { + text = succession_laws_must_not_be_forced_partition + NAND = { + is_independent_ruler = no + vassal_contract_has_flag = locked_to_partition + } + } + } + can_have = { + government_allows = administrative + is_independent_ruler = no + } + can_pass = { + government_allows = administrative + is_independent_ruler = no + } + should_start_with = { + government_has_flag = government_is_meritocratic + is_independent_ruler = no + custom_tooltip = { + text = celestial_military_appointment_allowed_desc + vassal_contract_has_flag = meritocratic_military_appointment + } + } + succession = { + order_of_succession = appointment + appointment_type = meritocratic_military_governor + } + flag = advanced_succession_law + flag = appointment_type_succession + modifier = { + glory_hound_opinion = -10 + courtly_opinion = 5 + player_heir_opinion = 20 + eligible_child_except_player_heir_opinion = -5 + } + pass_cost = { + prestige = change_succession_law_prestige_cost + } + revoke_cost = { + prestige = change_succession_law_prestige_cost + } + + ai_will_do = { + if = { + limit = { + OR = { + has_realm_law = confederate_partition_succession_law + has_realm_law = partition_succession_law + has_realm_law = high_partition_succession_law + } + } + value = 3 + } + } + + potential = { + government_has_flag = government_is_meritocratic + is_independent_ruler = no + } + } + + meritocratic_regency_succession_law = { + can_keep = { + can_have_meritocratic_regency_succession_law_trigger = yes + } + can_pass = { + can_have_meritocratic_regency_succession_law_trigger = yes + } + can_have = { + can_have_meritocratic_regency_succession_law_trigger = yes + } + can_title_have = { + exists = var:administrative_ui_special_title + } + should_show_for_title = { # Never show this in the UI, just apply it through script + always = no + } + can_remove_from_title = { + always = no + } + should_start_with = { + always = no + } + succession = { + order_of_succession = appointment + appointment_type = meritocratic_regent + } + flag = advanced_succession_law + flag = can_designate_heirs + flag = appointment_type_succession + pass_cost = { + prestige = change_succession_law_prestige_cost + } + ai_will_do = { + if = { + limit = { has_realm_law = confederate_partition_succession_law } + value = 1 + } + } + potential = { + government_allows = administrative + government_allows = merit + tgp_realm_has_ceremonial_liege_trigger = yes + } + } } succession_gender_laws = { @@ -1042,14 +1631,14 @@ succession_gender_laws = { can_keep = { trigger_if = { limit = { - is_independent_ruler = no - government_has_flag = government_is_administrative + top_liege != this + government_allows = administrative } top_liege = { has_realm_law = male_only_law } } trigger_else = { custom_tooltip = { - text = culture_not_female_only_tt + text = culture_not_male_only_tt OR = { faith = { has_doctrine = doctrine_gender_male_dominated } NOT = { @@ -1065,8 +1654,16 @@ succession_gender_laws = { should_start_with = { trigger_if = { limit = { - is_independent_ruler = no - government_has_flag = government_is_administrative + government_has_flag = government_has_merit + } + faith = { + has_doctrine = doctrine_gender_male_dominated + } + } + trigger_else_if = { + limit = { + top_liege != this + government_allows = administrative } top_liege = { has_realm_law = male_only_law } } @@ -1102,8 +1699,8 @@ succession_gender_laws = { can_keep = { trigger_if = { limit = { - is_independent_ruler = no - government_has_flag = government_is_administrative + top_liege != this + government_allows = administrative } top_liege = { has_realm_law = male_preference_law } } @@ -1131,8 +1728,8 @@ succession_gender_laws = { should_start_with = { trigger_if = { limit = { - is_independent_ruler = no - government_has_flag = government_is_administrative + top_liege != this + government_allows = administrative } top_liege = { has_realm_law = male_preference_law } } @@ -1142,8 +1739,14 @@ succession_gender_laws = { } OR = { faith = { - NOT = { + NOR = { religion_tag = islam_religion + AND = { + root = { + government_has_flag = government_has_merit + } + has_doctrine = doctrine_gender_male_dominated + } } has_doctrine = doctrine_gender_male_dominated } @@ -1152,7 +1755,7 @@ succession_gender_laws = { trigger_if = { limit = { is_independent_ruler = no - government_has_flag = government_is_administrative + government_allows = administrative } NOT = { top_liege = { has_realm_law = male_only_law } @@ -1198,8 +1801,8 @@ succession_gender_laws = { can_keep = { trigger_if = { limit = { - is_independent_ruler = no - government_has_flag = government_is_administrative + top_liege != this + government_allows = administrative } top_liege = { has_realm_law = equal_law } } @@ -1230,8 +1833,8 @@ succession_gender_laws = { should_start_with = { trigger_if = { limit = { - is_independent_ruler = no - government_has_flag = government_is_administrative + top_liege != this + government_allows = administrative } top_liege = { has_realm_law = equal_law } } @@ -1287,19 +1890,25 @@ succession_gender_laws = { can_keep = { trigger_if = { limit = { - is_independent_ruler = no - government_has_flag = government_is_administrative + top_liege != this + government_allows = administrative } top_liege = { has_realm_law = female_preference_law } } trigger_else = { + custom_description = { + text = change_law_female_preference_faith_requirement + faith = { + NOT = { has_doctrine = doctrine_gender_male_dominated } + } + } custom_tooltip = { text = female_preference_law_faith_or_culture_trigger OR = { - faith = { - NOT = { has_doctrine = doctrine_gender_male_dominated } + faith = { has_doctrine = doctrine_gender_female_dominated } + NOT = { + culture = { has_cultural_parameter = male_only_inheritance } } - culture = { has_cultural_parameter = female_preference_inheritance } } } } @@ -1307,8 +1916,8 @@ succession_gender_laws = { should_start_with = { trigger_if = { limit = { - is_independent_ruler = no - government_has_flag = government_is_administrative + top_liege != this + government_allows = administrative } top_liege = { has_realm_law = female_preference_law } } @@ -1349,17 +1958,17 @@ succession_gender_laws = { can_keep = { trigger_if = { limit = { - is_independent_ruler = no - government_has_flag = government_is_administrative + top_liege != this + government_allows = administrative } top_liege = { has_realm_law = female_only_law } } trigger_else = { custom_tooltip = { - text = female_only_law_faith_or_culture_trigger - OR = { - faith = { has_doctrine = doctrine_gender_female_dominated } - culture = { has_cultural_parameter = female_only_inheritance } + text = culture_not_female_only_tt + faith = { has_doctrine = doctrine_gender_female_dominated } + NOT = { + culture = { has_cultural_parameter = male_only_inheritance } } } } @@ -1383,8 +1992,8 @@ succession_gender_laws = { should_start_with = { trigger_if = { limit = { - is_independent_ruler = no - government_has_flag = government_is_administrative + top_liege != this + government_allows = administrative } top_liege = { has_realm_law = female_only_law } } diff --git a/N3OW/common/laws/01_title_succession_laws.txt b/N3OW/common/laws/01_title_succession_laws.txt index aa1630a0..385a2c2c 100644 --- a/N3OW/common/laws/01_title_succession_laws.txt +++ b/N3OW/common/laws/01_title_succession_laws.txt @@ -2,8 +2,11 @@ # Default Feudal Elective feudal_elective_succession_law = { can_have = { - government_has_flag = government_is_feudal - highest_held_title_tier >= tier_duchy + OR = { + government_has_flag = government_is_feudal + government_has_flag = government_is_special_republic + } + highest_held_title_tier >= tier_county NOR = { #Cultures have their special flavor. culture = { has_cultural_parameter = witenagemot_succession_enabled } culture = { has_cultural_parameter = scandinavian_elective_enabled } @@ -16,6 +19,9 @@ can_title_have = { can_title_have_law_general_trigger = yes } + should_start_with = { + government_has_flag = government_is_special_republic + } succession = { order_of_succession = election election_type = feudal_elective @@ -226,6 +232,7 @@ } succession = { order_of_succession = noble_family + title_division = single_heir } flag = can_designate_heirs } @@ -258,7 +265,9 @@ can_title_have = { tier >= tier_kingdom } - should_show_for_title = { always = no } + should_show_for_title = { + has_variable = confederation_culture + } succession = { order_of_succession = election election_type = confederation_elective @@ -266,12 +275,91 @@ flag = elective_succession_law title_allegiance_opinion = 10 revoke_cost = { - prestige = change_title_succession_law_prestige_cost + prestige = { + value = change_title_succession_law_prestige_cost + multiply = 8 + if = { + limit = { + NOR = { + government_has_flag = government_is_tribal + government_has_flag = government_is_nomadic + } + } + multiply = 0.1 + } + } } pass_cost = { prestige = change_title_succession_law_prestige_cost } } + + # Celestial Ministry Succession + celestial_ministry_appointment_succession_law = { + can_have = { + government_has_flag = government_is_celestial + } + can_pass = { + } + can_title_have = { + OR = { + this = title:e_minister_chancellor + this = title:e_minister_censor + this = title:e_minister_of_personnel + this = title:e_minister_of_revenue + this = title:e_minister_of_rites + this = title:e_minister_of_war + this = title:e_minister_of_justice + this = title:e_minister_of_works + } + } + can_realm_have = { + always = no + } + can_remove_from_title = { + custom_tooltip = { + text = celestial_ministry_appointment_cannot_remove_desc + always = no + } + } + succession = { + order_of_succession = appointment + appointment_type = celestial_minister + } + modifier = { + celestial_government_opinion = 5 + } + flag = appointment_type_succession + } + + # Celestial Grand Marshal Succession + celestial_grand_marshal_appointment_succession_law = { + can_have = { + government_has_flag = government_is_celestial + } + can_pass = { + } + can_title_have = { + this = title:e_minister_grand_marshal + } + can_realm_have = { + always = no + } + can_remove_from_title = { + custom_tooltip = { + text = celestial_ministry_appointment_cannot_remove_desc + always = no + } + } + succession = { + order_of_succession = appointment + appointment_type = celestial_military_governor + } + modifier = { + celestial_government_opinion = 5 + } + flag = appointment_type_succession + } } diff --git a/N3OW/common/laws/02_admininistrative_laws.txt b/N3OW/common/laws/02_admininistrative_laws.txt index 44bcd5bb..9e5a034e 100644 --- a/N3OW/common/laws/02_admininistrative_laws.txt +++ b/N3OW/common/laws/02_admininistrative_laws.txt @@ -3,6 +3,7 @@ ##################### @admin_law_cooldown_value = 5 +# ADMINISTRATIVE GOVERNMENT province_war_law = { default = province_war_law_0 cumulative = yes @@ -17,7 +18,7 @@ province_war_law = { realm_law_use_imperial_bureaucracy = yes trigger_if = { limit = { - is_independent_ruler = no + top_liege != this } liege = { has_realm_law = province_war_law_0 } } @@ -26,7 +27,7 @@ province_war_law = { can_pass = { trigger_if = { limit = { - is_independent_ruler = no + top_liege != this liege = { has_realm_law = province_war_law_0 } } custom_tooltip = { @@ -55,7 +56,7 @@ province_war_law = { realm_law_use_imperial_bureaucracy = yes trigger_if = { limit = { - is_independent_ruler = yes + top_liege = this } custom_tooltip = { text = have_bureaucracy_1_or_higher @@ -68,7 +69,7 @@ province_war_law = { } trigger_if = { limit = { - is_independent_ruler = no + top_liege != this } liege = { has_realm_law = province_war_law_1 } } @@ -77,7 +78,7 @@ province_war_law = { can_pass = { trigger_if = { limit = { - is_independent_ruler = yes + top_liege = this } custom_tooltip = { text = admin_law_cooldown_desc @@ -86,7 +87,7 @@ province_war_law = { } trigger_if = { limit = { - is_independent_ruler = no + top_liege != this liege = { has_realm_law = province_war_law_1 } } custom_tooltip = { @@ -137,7 +138,7 @@ province_war_law = { realm_law_use_imperial_bureaucracy = yes trigger_if = { limit = { - is_independent_ruler = yes + top_liege = this } custom_tooltip = { text = have_bureaucracy_2_or_higher @@ -149,7 +150,7 @@ province_war_law = { } trigger_if = { limit = { - is_independent_ruler = no + top_liege != this } liege = { has_realm_law = province_war_law_2 } } @@ -158,7 +159,7 @@ province_war_law = { can_pass = { trigger_if = { limit = { - is_independent_ruler = yes + top_liege = this } custom_tooltip = { text = admin_law_cooldown_desc @@ -167,7 +168,7 @@ province_war_law = { } trigger_if = { limit = { - is_independent_ruler = no + top_liege != this liege = { has_realm_law = province_war_law_2 } } custom_tooltip = { @@ -195,7 +196,7 @@ province_war_law = { if = { limit = { has_realm_law = province_war_law_1 - ai_has_economical_boom_personality = yes + ai_has_builder_or_pious_builder_personality = yes } value = 1 } @@ -212,7 +213,7 @@ province_war_law = { realm_law_use_imperial_bureaucracy = yes trigger_if = { limit = { - is_independent_ruler = yes + top_liege = this } custom_tooltip = { text = have_bureaucracy_3 @@ -221,7 +222,7 @@ province_war_law = { } trigger_if = { limit = { - is_independent_ruler = no + top_liege != this } liege = { has_realm_law = province_war_law_3 } } @@ -230,7 +231,7 @@ province_war_law = { can_pass = { trigger_if = { limit = { - is_independent_ruler = yes + top_liege = this } custom_tooltip = { text = admin_law_cooldown_desc @@ -239,7 +240,7 @@ province_war_law = { } trigger_if = { limit = { - is_independent_ruler = no + top_liege != this liege = { has_realm_law = province_war_law_3 } } custom_tooltip = { @@ -264,7 +265,13 @@ province_war_law = { } ai_will_do = { - value = 0 + if = { + limit = { + has_realm_law = province_war_law_2 + ai_has_pious_builder_personality = yes + } + value = 1 + } } } } @@ -283,7 +290,7 @@ province_border_law = { realm_law_use_imperial_bureaucracy = yes trigger_if = { limit = { - is_independent_ruler = no + top_liege != this } liege = { has_realm_law = province_border_law_0 } } @@ -292,7 +299,7 @@ province_border_law = { can_pass = { trigger_if = { limit = { - is_independent_ruler = no + top_liege != this liege = { has_realm_law = province_border_law_0 } } custom_tooltip = { @@ -326,7 +333,8 @@ province_border_law = { realm_law_use_imperial_bureaucracy = yes trigger_if = { limit = { - is_independent_ruler = yes + top_liege = this + realm_law_use_imperial_bureaucracy = yes } custom_tooltip = { text = have_bureaucracy_2_or_higher @@ -338,7 +346,20 @@ province_border_law = { } trigger_if = { limit = { - is_independent_ruler = no + top_liege = this + realm_law_use_celestial_bureaucracy = yes + } + custom_tooltip = { + text = have_celestial_bureaucracy_2_or_higher + OR = { + has_realm_law = celestial_bureaucracy_2 + has_realm_law = celestial_bureaucracy_3 + } + } + } + trigger_if = { + limit = { + top_liege != this } liege = { has_realm_law = province_border_law_1 } } @@ -347,7 +368,7 @@ province_border_law = { can_pass = { trigger_if = { limit = { - is_independent_ruler = yes + top_liege = this } custom_tooltip = { text = admin_law_cooldown_desc @@ -356,7 +377,7 @@ province_border_law = { } trigger_if = { limit = { - is_independent_ruler = no + top_liege != this liege = { has_realm_law = province_border_law_1 } } custom_tooltip = { @@ -405,7 +426,8 @@ province_border_law = { realm_law_use_imperial_bureaucracy = yes trigger_if = { limit = { - is_independent_ruler = yes + top_liege = this + realm_law_use_imperial_bureaucracy = yes } custom_tooltip = { text = have_bureaucracy_3 @@ -414,7 +436,17 @@ province_border_law = { } trigger_if = { limit = { - is_independent_ruler = no + top_liege = this + realm_law_use_celestial_bureaucracy = yes + } + custom_tooltip = { + text = have_celestial_bureaucracy_3 + has_realm_law = celestial_bureaucracy_3 + } + } + trigger_if = { + limit = { + top_liege != this } liege = { has_realm_law = province_border_law_2 } } @@ -423,7 +455,7 @@ province_border_law = { can_pass = { trigger_if = { limit = { - is_independent_ruler = yes + top_liege = this } custom_tooltip = { text = admin_law_cooldown_desc @@ -432,7 +464,7 @@ province_border_law = { } trigger_if = { limit = { - is_independent_ruler = no + top_liege != this liege = { has_realm_law = province_border_law_2 } } custom_tooltip = { @@ -461,3 +493,2936 @@ province_border_law = { } } } + +# CELESTIAL GOVERNMENT +celestial_army_liege_law = { + # NOTE: This law is mirrored by `celestial_army_vassal_law`! + # The top-liege has `celestial_army_liege_law` and all vassals have the `celestial_army_vassal_law` at the same level. + + default = celestial_army_liege_law_0 + cumulative = no + flag = admin_law + + celestial_army_liege_law_0 = { + modifier = { + celestial_government_tax_contribution_add = -0.05 + } + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + } + + can_pass = { + custom_tooltip = { + text = admin_law_cooldown_desc + NOT = { has_variable = admin_law_cooldown } + } + } + + on_pass = { + ## Set cooldown + set_variable = { + name = admin_law_cooldown + years = @admin_law_cooldown_value + } + } + + ai_will_do = { + value = 0 + if = { + limit = { + NOR = { # Rulers should keep any higher levels + has_realm_law = celestial_army_liege_law_1 + has_realm_law = celestial_army_liege_law_2 + has_realm_law = celestial_army_liege_law_3 + } + } + add = 1 + } + } + } + + celestial_army_liege_law_1 = { + modifier = { + celestial_government_vassal_opinion = -5 + men_at_arms_title_cap = 1 + } + flag = admin_title_troop_cost_reduction + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + custom_tooltip = { + text = have_celestial_bureaucracy_1_or_higher + OR = { + has_realm_law = celestial_bureaucracy_1 + has_realm_law = celestial_bureaucracy_2 + has_realm_law = celestial_bureaucracy_3 + } + } + } + + can_pass = { + is_independent_ruler = yes + custom_tooltip = { + text = admin_law_cooldown_desc + NOT = { has_variable = admin_law_cooldown } + } + } + + pass_cost = { + prestige = { + add = admin_law_prestige_cost + } + } + + on_pass = { + ## Set cooldown + set_variable = { + name = admin_law_cooldown + years = @admin_law_cooldown_value + } + } + + ai_will_do = { + value = 0 + if = { + limit = { + NOR = { # Rulers should keep any higher levels + has_realm_law = celestial_army_liege_law_2 + has_realm_law = celestial_army_liege_law_3 + } + OR = { + ai_has_cautious_personality = yes + ai_has_warlike_personality = yes + } + } + add = 2 + } + } + } + + celestial_army_liege_law_2 = { + modifier = { + celestial_government_vassal_opinion = -10 + } + flag = admin_title_troop_cost_reduction_high + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + custom_tooltip = { + text = have_celestial_bureaucracy_2_or_higher + OR = { + has_realm_law = celestial_bureaucracy_2 + has_realm_law = celestial_bureaucracy_3 + } + } + } + + can_pass = { + is_independent_ruler = yes + custom_tooltip = { + text = admin_law_cooldown_desc + NOT = { has_variable = admin_law_cooldown } + } + } + + pass_cost = { + prestige = { + add = admin_law_prestige_cost + } + } + + on_pass = { + ## Set cooldown + set_variable = { + name = admin_law_cooldown + years = @admin_law_cooldown_value + } + } + + ai_will_do = { + value = 0 + if = { + limit = { + NOT = { # Rulers should keep any higher levels + has_realm_law = celestial_army_liege_law_3 + } + OR = { # AI should want this if warlike, or if in the expansion phase, regardless of personality + ai_has_warlike_personality = yes + situation:dynastic_cycle ?= { + situation_current_phase = situation_dynastic_cycle_phase_stability_expansion + } + } + } + add = 3 + } + } + } + + celestial_army_liege_law_3 = { + modifier = { + celestial_government_vassal_opinion = -15 + men_at_arms_title_cap = 2 + } + flag = admin_title_troop_cost_reduction_very_high + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + custom_tooltip = { + text = have_celestial_bureaucracy_3 + has_realm_law = celestial_bureaucracy_3 + } + trigger_if = { + limit = { + this = title:h_china.holder + } + situation:dynastic_cycle ?= { + situation_current_phase = situation_dynastic_cycle_phase_stability_expansion + } + } + } + + can_pass = { + is_independent_ruler = yes + custom_tooltip = { + text = admin_law_cooldown_desc + NOT = { has_variable = admin_law_cooldown } + } + } + + pass_cost = { + prestige = { + add = admin_law_prestige_cost + } + } + + on_pass = { + ## Set cooldown + set_variable = { + name = admin_law_cooldown + years = @admin_law_cooldown_value + } + } + + ai_will_do = { + value = 0 + if = { + limit = { + ai_has_warlike_personality = yes + } + add = 4 + } + } + } +} + +celestial_army_vassal_law = { + default = celestial_army_vassal_law_0 + cumulative = no + flag = admin_law + + celestial_army_vassal_law_0 = { + modifier = { + celestial_government_tax_contribution_add = -0.05 + men_at_arms_cap = 2 + } + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = no + trigger_if = { + limit = { + liege = { is_independent_ruler = yes } + } + liege = { has_realm_law = celestial_army_liege_law_0 } + } + trigger_else = { + liege = { has_realm_law = celestial_army_vassal_law_0 } + } + } + + can_pass = { + trigger_if = { + limit = { + liege = { + OR = { + has_realm_law = celestial_army_liege_law_0 + has_realm_law = celestial_army_vassal_law_0 + } + } + } + custom_tooltip = { + text = imperial_bureaucracy_pending_law_change + always = no + } + } + } + + on_pass = { + ## Set cooldown + set_variable = { + name = admin_law_cooldown + years = @admin_law_cooldown_value + } + } + + ai_will_do = { + value = 0 + } + } + + celestial_army_vassal_law_1 = { + modifier = { + men_at_arms_cap = -2 + men_at_arms_title_cap = 1 + } + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = no + trigger_if = { + limit = { + liege = { is_independent_ruler = yes } + } + liege = { has_realm_law = celestial_army_liege_law_1 } + } + trigger_else = { + liege = { has_realm_law = celestial_army_vassal_law_1 } + } + } + + can_pass = { + trigger_if = { + limit = { + liege = { + OR = { + has_realm_law = celestial_army_liege_law_1 + has_realm_law = celestial_army_vassal_law_1 + } + } + } + custom_tooltip = { + text = imperial_bureaucracy_pending_law_change + always = no + } + } + } + + pass_cost = { + prestige = { + add = admin_law_prestige_cost + } + } + + on_pass = { + ## Set cooldown + set_variable = { + name = admin_law_cooldown + years = @admin_law_cooldown_value + } + } + + ai_will_do = { + value = 0 + } + } + + celestial_army_vassal_law_2 = { + modifier = { + men_at_arms_cap = -20 + men_at_arms_title_cap = 2 + } + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = no + trigger_if = { + limit = { + liege = { is_independent_ruler = yes } + } + liege = { has_realm_law = celestial_army_liege_law_2 } + } + trigger_else = { + liege = { has_realm_law = celestial_army_vassal_law_2 } + } + } + + can_pass = { + trigger_if = { + limit = { + liege = { + OR = { + has_realm_law = celestial_army_liege_law_2 + has_realm_law = celestial_army_vassal_law_2 + } + } + } + custom_tooltip = { + text = imperial_bureaucracy_pending_law_change + always = no + } + } + } + + pass_cost = { + prestige = { + add = admin_law_prestige_cost + } + } + + on_pass = { + ## Set cooldown + set_variable = { + name = admin_law_cooldown + years = @admin_law_cooldown_value + } + } + + ai_will_do = { + value = 0 + } + } + + celestial_army_vassal_law_3 = { + modifier = { + men_at_arms_cap = -20 + men_at_arms_title_cap = 4 + } + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = no + trigger_if = { + limit = { + liege = { is_independent_ruler = yes } + } + liege = { has_realm_law = celestial_army_liege_law_3 } + } + trigger_else = { + liege = { has_realm_law = celestial_army_vassal_law_3 } + } + } + + can_pass = { + trigger_if = { + limit = { + liege = { + OR = { + has_realm_law = celestial_army_liege_law_3 + has_realm_law = celestial_army_vassal_law_3 + } + } + } + custom_tooltip = { + text = imperial_bureaucracy_pending_law_change + always = no + } + } + } + + pass_cost = { + prestige = { + add = admin_law_prestige_cost + } + } + + on_pass = { + ## Set cooldown + set_variable = { + name = admin_law_cooldown + years = @admin_law_cooldown_value + } + } + + ai_will_do = { + value = 0 + } + } +} + +celestial_retirement_law = { + default = celestial_retirement_law_5 + cumulative = no + flag = admin_law + + celestial_retirement_law_0 = { + flag = celestial_retirement_age_0 + flag = celestial_retirement_law + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + trigger_if = { + limit = { + top_liege = this + } + custom_tooltip = { + text = have_celestial_bureaucracy_1_or_higher + NOT = { realm_law_group_at_minimum_level = celestial_bureaucracy } + } + } + trigger_if = { + limit = { + top_liege != this + } + liege = { has_realm_law = celestial_retirement_law_0 } + } + } + + can_pass = { + trigger_if = { + limit = { + top_liege = this + } + custom_tooltip = { + text = admin_law_cooldown_desc + NOT = { has_variable = admin_law_cooldown } + } + } + trigger_if = { + limit = { + top_liege != this + liege = { has_realm_law = province_border_law_1 } + } + custom_tooltip = { + text = imperial_bureaucracy_pending_law_change + always = no + } + } + } + + pass_cost = { + prestige = { + add = admin_law_prestige_cost + } + } + + on_pass = { + ## Set cooldown + set_variable = { + name = admin_law_cooldown + years = @admin_law_cooldown_value + } + } + + ai_will_do = { + value = 0 + } + } + + celestial_retirement_law_1 = { + flag = celestial_retirement_age_1 + flag = celestial_retirement_law + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + trigger_if = { + limit = { + top_liege = this + } + custom_tooltip = { + text = have_celestial_bureaucracy_1_or_higher + NOT = { realm_law_group_at_minimum_level = celestial_bureaucracy } + } + } + trigger_if = { + limit = { + top_liege != this + } + liege = { has_realm_law = celestial_retirement_law_1 } + } + } + + can_pass = { + trigger_if = { + limit = { + top_liege = this + } + custom_tooltip = { + text = admin_law_cooldown_desc + NOT = { has_variable = admin_law_cooldown } + } + } + trigger_if = { + limit = { + top_liege != this + liege = { has_realm_law = celestial_retirement_law_1 } + } + custom_tooltip = { + text = imperial_bureaucracy_pending_law_change + always = no + } + } + } + + pass_cost = { + prestige = { + add = admin_law_prestige_cost + } + } + + on_pass = { + ## Set cooldown + set_variable = { + name = admin_law_cooldown + years = @admin_law_cooldown_value + } + } + + ai_will_do = { + value = 0 + } + } + + celestial_retirement_law_2 = { + flag = celestial_retirement_age_2 + flag = celestial_retirement_law + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + trigger_if = { + limit = { + top_liege = this + } + custom_tooltip = { + text = have_celestial_bureaucracy_1_or_higher + NOT = { realm_law_group_at_minimum_level = celestial_bureaucracy } + } + } + trigger_if = { + limit = { + top_liege != this + } + liege = { has_realm_law = celestial_retirement_law_2 } + } + } + + can_pass = { + trigger_if = { + limit = { + top_liege = this + } + custom_tooltip = { + text = admin_law_cooldown_desc + NOT = { has_variable = admin_law_cooldown } + } + } + trigger_if = { + limit = { + top_liege != this + liege = { has_realm_law = celestial_retirement_law_2 } + } + custom_tooltip = { + text = imperial_bureaucracy_pending_law_change + always = no + } + } + } + + pass_cost = { + prestige = { + add = admin_law_prestige_cost + } + } + + on_pass = { + ## Set cooldown + set_variable = { + name = admin_law_cooldown + years = @admin_law_cooldown_value + } + } + + ai_will_do = { + value = 0 + } + } + + celestial_retirement_law_3 = { + flag = celestial_retirement_age_3 + flag = celestial_retirement_law + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + trigger_if = { + limit = { + top_liege = this + } + custom_tooltip = { + text = have_celestial_bureaucracy_1_or_higher + NOT = { realm_law_group_at_minimum_level = celestial_bureaucracy } + } + } + trigger_if = { + limit = { + top_liege != this + } + liege = { has_realm_law = celestial_retirement_law_3 } + } + } + + can_pass = { + trigger_if = { + limit = { + top_liege = this + } + custom_tooltip = { + text = admin_law_cooldown_desc + NOT = { has_variable = admin_law_cooldown } + } + } + trigger_if = { + limit = { + top_liege != this + liege = { has_realm_law = celestial_retirement_law_3 } + } + custom_tooltip = { + text = imperial_bureaucracy_pending_law_change + always = no + } + } + } + + pass_cost = { + prestige = { + add = admin_law_prestige_cost + } + } + + on_pass = { + ## Set cooldown + set_variable = { + name = admin_law_cooldown + years = @admin_law_cooldown_value + } + } + + ai_will_do = { + value = 0 + } + } + + celestial_retirement_law_4 = { + flag = celestial_retirement_age_4 + flag = celestial_retirement_law + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + trigger_if = { + limit = { + top_liege = this + } + custom_tooltip = { + text = have_celestial_bureaucracy_1_or_higher + NOT = { realm_law_group_at_minimum_level = celestial_bureaucracy } + } + } + trigger_if = { + limit = { + top_liege != this + } + liege = { has_realm_law = celestial_retirement_law_4 } + } + } + + can_pass = { + trigger_if = { + limit = { + top_liege = this + } + custom_tooltip = { + text = admin_law_cooldown_desc + NOT = { has_variable = admin_law_cooldown } + } + } + trigger_if = { + limit = { + top_liege != this + liege = { has_realm_law = celestial_retirement_law_4 } + } + custom_tooltip = { + text = imperial_bureaucracy_pending_law_change + always = no + } + } + } + + pass_cost = { + prestige = { + add = admin_law_prestige_cost + } + } + + on_pass = { + ## Set cooldown + set_variable = { + name = admin_law_cooldown + years = @admin_law_cooldown_value + } + } + + ai_will_do = { + value = 0 + } + } + + celestial_retirement_law_5 = { + flag = celestial_retirement_age_5 + flag = celestial_retirement_law + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + trigger_if = { + limit = { + top_liege != this + } + liege = { has_realm_law = celestial_retirement_law_5 } + } + } + + can_pass = { + trigger_if = { + limit = { + top_liege != this + liege = { has_realm_law = celestial_retirement_law_5 } + } + custom_tooltip = { + text = imperial_bureaucracy_pending_law_change + always = no + } + } + } + + on_pass = { + ## Set cooldown + set_variable = { + name = admin_law_cooldown + years = @admin_law_cooldown_value + } + } + + ai_will_do = { + value = 0 + } + } +} + +# BORDER WARS +border_wars_laws = { + default = top_liege_redirected_to_border_wars_law + cumulative = no + flag = imperial_policy + + top_liege_redirected_to_border_wars_law = { + flag = top_liege_redirected_to_border_wars_law + + can_keep = { + is_landed = yes + highest_held_title_tier >= tier_duchy + #Empire or lower tier + highest_held_title_tier < tier_hegemony + #Small realm size + sub_realm_size < border_war_sized_realm_value + #Not an antagonitsic house + house ?= { + NOT = { has_house_unity_stage = antagonistic } + } + #Not defending in any civil wars + NOT = { + any_character_war = { + primary_defender = root + using_civil_war_cb_trigger = yes + } + } + } + + on_pass = { + primary_title = { + set_vassal_wars_are_redirected_to_holder = yes + } + } + + ai_will_do = { + value = 0 + } + } + + top_liege_not_redirected_to_border_wars_law = { + flag = top_liege_not_redirected_to_border_wars_law + + can_keep = { + is_independent_ruler = yes + is_landed = yes + highest_held_title_tier >= tier_duchy + custom_description = { + text = border_wars_laws_triggers + value = sub_realm_size + OR = { + #hegemonies + highest_held_title_tier >= tier_hegemony + #any large realm + sub_realm_size >= border_war_sized_realm_value + #antagonistic houses + house ?= { + has_house_unity_stage = antagonistic + } + #defending in a civil war + any_character_war = { + primary_defender = root + using_civil_war_cb_trigger = yes + } + } + } + } + + on_pass = { + primary_title = { + set_vassal_wars_are_redirected_to_holder = no + } + } + should_start_with = { + OR = { + #hegemonies + highest_held_title_tier >= tier_hegemony + #any large realm + sub_realm_size >= border_war_sized_realm_value + #antagonistic houses + house ?= { + has_house_unity_stage = antagonistic + } + #defending in a civil war + any_character_war = { + primary_defender = root + using_civil_war_cb_trigger = yes + } + } + } + ai_will_do = { + value = 0 + } + } +} + +# REGENCY +grand_secretariat_laws = { + default = grand_chancellor_law + cumulative = no + flag = imperial_policy + + grand_chancellor_law = { + flag = grand_chancellor_law + can_have = { + has_title = title:h_china + government_has_flag = government_is_celestial + } + can_pass = { + exists = title:e_minister_chancellor.holder + OR = { + situation:dynastic_cycle ?= { + situation_current_phase = situation_dynastic_cycle_phase_stability_advancement + } + is_movement_in_power = { + MOVEMENT = advancement_movement + } + } + custom_tooltip = { + text = admin_law_cooldown_desc + NOT = { has_variable = admin_law_cooldown } + } + } + + on_pass = { + hidden_effect = { + designate_diarch = title:e_minister_chancellor.holder + diarch = { + depose_diarch = yes + } + } + ## Set cooldown + set_variable = { + name = admin_law_cooldown + years = @admin_law_cooldown_value + } + } + + ai_will_do = { + value = 10 + if = { + limit = { + is_movement_in_power = { + MOVEMENT = advancement_movement + } + } + add = 1 + } + if = { + limit = { + situation:dynastic_cycle ?= { + situation_current_phase = situation_dynastic_cycle_phase_stability_expansion + } + } + add = -10 + } + if = { + limit = { + title:e_minister_grand_marshal.holder = { + is_ai = no + NOT = { has_court_position = favored_minister_court_position } + } + } + add = 20 + } + if = { + limit = { + diarch = { + has_variable = asked_to_be_secretary_director + } + } + add = -1000 + } + } + } + + grand_marshal_law = { + flag = grand_marshal_law + can_have = { + has_title = title:h_china + government_has_flag = government_is_celestial + } + + can_pass = { + exists = title:e_minister_grand_marshal.holder + situation:dynastic_cycle ?= { + NOR = { + situation_current_phase = situation_dynastic_cycle_phase_stability_advancement + situation_current_phase = situation_dynastic_cycle_phase_instability + } + situation_participant_group:expansion_movement ?= { + save_temporary_scope_as = my_movement + + custom_tooltip = { + text = my_movement_is_not_in_power + exists = var:movement_favored + } + } + } + custom_tooltip = { + text = admin_law_cooldown_desc + NOT = { has_variable = admin_law_cooldown } + } + } + + on_pass = { + hidden_effect = { + designate_diarch = title:e_minister_grand_marshal.holder + diarch = { + depose_diarch = yes + } + } + ## Set cooldown + set_variable = { + name = admin_law_cooldown + years = @admin_law_cooldown_value + } + } + + ai_will_do = { + value = -2 + if = { + limit = { + is_movement_in_power = { + MOVEMENT = expansion_movement + } + } + add = 1 + } + if = { + limit = { + title:e_minister_chancellor.holder ?= { + is_ai = no + NOT = { has_court_position = favored_minister_court_position } + } + } + add = 20 + } + if = { + limit = { + exists = title:e_minister_grand_marshal.holder + title:e_minister_grand_marshal.holder.merit_level >= root.diarch.merit_level + title:e_minister_grand_marshal.holder.merit >= root.diarch.merit + } + add = 1 + } + if = { + limit = { + exists = root.diarch.var:movement_power + exists = var:movement_power + } + if = { + limit = { + var:movement_power >= root.diarch.var:movement_power + } + add = 1 + } + else = { + add = -1 + } + } + if = { + limit = { + diarch = { + has_variable = asked_to_be_secretary_director + } + } + add = -1000 + } + } + } + + grand_censor_law = { + flag = grand_censor_law + can_have = { + has_title = title:h_china + government_has_flag = government_is_celestial + } + + can_pass = { + exists = title:e_minister_censor.holder + situation:dynastic_cycle ?= { + NOR = { + situation_current_phase = situation_dynastic_cycle_phase_stability_expansion + situation_current_phase = situation_dynastic_cycle_phase_stability_advancement + } + } + situation:dynastic_cycle.situation_participant_group:conservative_movement ?= { + save_temporary_scope_as = my_movement + + custom_tooltip = { + text = my_movement_is_not_in_power + exists = var:movement_favored + } + } + custom_tooltip = { + text = admin_law_cooldown_desc + NOT = { has_variable = admin_law_cooldown } + } + } + + on_pass = { + hidden_effect = { + designate_diarch = title:e_minister_censor.holder + diarch = { + depose_diarch = yes + } + } + ## Set cooldown + set_variable = { + name = admin_law_cooldown + years = @admin_law_cooldown_value + } + } + + ai_will_do = { + value = -2 + if = { + limit = { + is_movement_in_power = { + MOVEMENT = conservative_movement + } + } + add = 1 + } + if = { + limit = { + title:e_minister_chancellor.holder = { + is_ai = no + NOT = { has_court_position = favored_minister_court_position } + } + } + add = 20 + } + if = { + limit = { + exists = title:e_minister_censor.holder + title:e_minister_censor.holder.merit_level >= root.diarch.merit_level + title:e_minister_censor.holder.merit >= root.diarch.merit + } + add = 1 + } + if = { + limit = { + exists = root.diarch.var:movement_power + exists = var:movement_power + } + if = { + limit = { + var:movement_power >= root.diarch.var:movement_power + } + add = 1 + } + else = { + add = -1 + } + } + if = { + limit = { + diarch = { + has_variable = asked_to_be_secretary_director + } + } + add = -1000 + } + } + } +} + +candidate_score_laws = { + default = candidate_score_merit_law + cumulative = no + flag = imperial_policy + + candidate_score_merit_law = { + flag = candidate_score_merit_law + can_have = { + has_title = title:h_china + government_has_flag = government_is_celestial + } + can_pass = { + NOT = { + is_movement_in_power = { + MOVEMENT = conservative_movement + } + } + can_pass_candidate_score_merit_law_trigger = yes + custom_tooltip = { + text = admin_law_cooldown_desc + NOT = { has_variable = admin_law_cooldown } + } + } + + pass_cost = { + influence = 1000 + treasury = { + value = realm_size + multiply = 10 + } + } + + on_pass = { + ## Set cooldown + set_variable = { + name = admin_law_cooldown + years = @admin_law_cooldown_value + } + } + + ai_will_do = { #AI can only do it if convinced through Movement Petition + value = 0 + } + } + + candidate_score_prestige_law = { + flag = candidate_score_prestige_law + can_have = { + has_title = title:h_china + government_has_flag = government_is_celestial + } + + can_pass = { + is_movement_in_power = { + MOVEMENT = conservative_movement + } + can_pass_candidate_score_prestige_law_trigger = yes + custom_tooltip = { + text = admin_law_cooldown_desc + NOT = { has_variable = admin_law_cooldown } + } + } + + pass_cost = { + influence = 1000 + treasury = { + value = realm_size + multiply = 10 + } + } + + on_pass = { + ## Set cooldown + set_variable = { + name = admin_law_cooldown + years = @admin_law_cooldown_value + } + } + + ai_will_do = { #AI can only do it if convinced through Movement Petition + value = 0 + } + } +} + +budget_allocation_salary_law = { + is_treasury_budget_group = yes + + flag = treasury_budget_law + flag = treasury_budget_salary + + default = budget_allocation_salary_30 + + budget_allocation_salary_0 = { + shown_in_encyclopedia = no + + flag = salary_budget_law_major_negative_impact + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_salary_budget_allocation = 0.0 + + vassal_opinion = -30 + vassal_tax_mult = -0.3 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + on_pass = { + add_legitimacy = { + value = treasury_budget_law_change_legitimacy_loss_base + multiply = 4 + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_salary_5 = { + shown_in_encyclopedia = no + + flag = salary_budget_law_major_negative_impact + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_salary_budget_allocation = 0.05 + + vassal_opinion = -25 + vassal_tax_mult = -0.25 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + on_pass = { + add_legitimacy = { + value = treasury_budget_law_change_legitimacy_loss_base + multiply = 4 + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_salary_10 = { + shown_in_encyclopedia = no + + flag = salary_budget_law_major_negative_impact + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_salary_budget_allocation = 0.10 + + vassal_opinion = -20 + vassal_tax_mult = -0.20 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + on_pass = { + add_legitimacy = { + value = treasury_budget_law_change_legitimacy_loss_base + multiply = 3 + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_salary_15 = { + shown_in_encyclopedia = no + + flag = salary_budget_law_major_negative_impact + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_salary_budget_allocation = 0.15 + + vassal_opinion = -15 + vassal_tax_mult = -0.15 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + on_pass = { + add_legitimacy = { + value = treasury_budget_law_change_legitimacy_loss_base + multiply = 2 + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_salary_20 = { + shown_in_encyclopedia = no + + flag = salary_budget_law_major_negative_impact + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_salary_budget_allocation = 0.20 + + vassal_opinion = -10 + vassal_tax_mult = -0.1 + } + + on_pass = { + add_legitimacy = { + value = treasury_budget_law_change_legitimacy_loss_base + multiply = 1 + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_salary_25 = { + shown_in_encyclopedia = no + + flag = salary_budget_law_minor_negative_impact + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_salary_budget_allocation = 0.25 + + vassal_opinion = -5 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_salary_30 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + should_start_with = { + always = yes + } + + modifier = { + treasury_salary_budget_allocation = 0.30 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_salary_35 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_salary_budget_allocation = 0.35 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_salary_40 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_salary_budget_allocation = 0.40 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_salary_45 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_salary_budget_allocation = 0.45 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_salary_50 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_salary_budget_allocation = 0.50 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_salary_55 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_salary_budget_allocation = 0.55 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_salary_60 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_salary_budget_allocation = 0.60 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_salary_65 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_salary_budget_allocation = 0.65 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_salary_70 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_salary_budget_allocation = 0.70 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_salary_75 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_salary_budget_allocation = 0.75 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_salary_80 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_salary_budget_allocation = 0.80 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_salary_85 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_salary_budget_allocation = 0.85 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_salary_90 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_salary_budget_allocation = 0.90 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_salary_95 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_salary_budget_allocation = 0.95 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_salary_100 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_salary_budget_allocation = 1.00 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } +} + +budget_allocation_ministry_law = { + is_treasury_budget_group = yes + + flag = treasury_budget_law + flag = treasury_budget_ministry + + default = budget_allocation_ministry_25 + + budget_allocation_ministry_0 = { + shown_in_encyclopedia = no + + flag = ministry_budget_law_major_negative_impact + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + } + + modifier = { + treasury_ministry_budget_allocation = 0 + + vassal_tax_mult = -0.2 + monthly_legitimacy_add = -20 + courtly_opinion = -30 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + on_pass = { + add_legitimacy = { + value = treasury_budget_law_change_legitimacy_loss_base + multiply = 4 + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_ministry_5 = { + shown_in_encyclopedia = no + + flag = ministry_budget_law_major_negative_impact + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + } + + modifier = { + treasury_ministry_budget_allocation = 0.05 + + vassal_tax_mult = -0.15 + monthly_legitimacy_add = -15 + courtly_opinion = -25 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + on_pass = { + add_legitimacy = { + value = treasury_budget_law_change_legitimacy_loss_base + multiply = 4 + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_ministry_10 = { + shown_in_encyclopedia = no + + flag = ministry_budget_law_major_negative_impact + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + } + + modifier = { + treasury_ministry_budget_allocation = 0.10 + + vassal_tax_mult = -0.1 + monthly_legitimacy_add = -10 + courtly_opinion = -20 + } + + on_pass = { + add_legitimacy = { + value = treasury_budget_law_change_legitimacy_loss_base + multiply = 3 + } + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + + budget_allocation_ministry_15 = { + shown_in_encyclopedia = no + + flag = ministry_budget_law_major_negative_impact + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + } + + modifier = { + treasury_ministry_budget_allocation = 0.15 + + vassal_tax_mult = -0.05 + monthly_legitimacy_add = -5 + courtly_opinion = -15 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + on_pass = { + add_legitimacy = { + value = treasury_budget_law_change_legitimacy_loss_base + multiply = 1 + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_ministry_20 = { + shown_in_encyclopedia = no + + flag = ministry_budget_law_minor_negative_impact + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + } + + modifier = { + treasury_ministry_budget_allocation = 0.20 + + courtly_opinion = -10 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_ministry_25 = { + shown_in_encyclopedia = no + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + } + + modifier = { + treasury_ministry_budget_allocation = 0.25 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_ministry_30 = { + shown_in_encyclopedia = no + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + } + + ai_will_do = { + value = 0 + } + + should_start_with = { + always = yes + } + + modifier = { + treasury_ministry_budget_allocation = 0.30 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_ministry_35 = { + shown_in_encyclopedia = no + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + } + + modifier = { + treasury_ministry_budget_allocation = 0.35 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_ministry_40 = { + shown_in_encyclopedia = no + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + } + + modifier = { + treasury_ministry_budget_allocation = 0.40 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_ministry_45 = { + shown_in_encyclopedia = no + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + } + + modifier = { + treasury_ministry_budget_allocation = 0.45 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_ministry_50 = { + shown_in_encyclopedia = no + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + } + + modifier = { + treasury_ministry_budget_allocation = 0.50 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_ministry_55 = { + shown_in_encyclopedia = no + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + } + + modifier = { + treasury_ministry_budget_allocation = 0.55 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_ministry_60 = { + shown_in_encyclopedia = no + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + } + + modifier = { + treasury_ministry_budget_allocation = 0.60 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_ministry_65 = { + shown_in_encyclopedia = no + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + } + + modifier = { + treasury_ministry_budget_allocation = 0.65 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_ministry_70 = { + shown_in_encyclopedia = no + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + } + + modifier = { + treasury_ministry_budget_allocation = 0.70 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_ministry_75 = { + shown_in_encyclopedia = no + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + } + + modifier = { + treasury_ministry_budget_allocation = 0.75 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_ministry_80 = { + shown_in_encyclopedia = no + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + } + + modifier = { + treasury_ministry_budget_allocation = 0.80 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_ministry_85 = { + shown_in_encyclopedia = no + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + } + + modifier = { + treasury_ministry_budget_allocation = 0.85 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_ministry_90 = { + shown_in_encyclopedia = no + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + } + + modifier = { + treasury_ministry_budget_allocation = 0.9 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_ministry_95 = { + shown_in_encyclopedia = no + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + } + + modifier = { + treasury_ministry_budget_allocation = 0.95 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_ministry_100 = { + shown_in_encyclopedia = no + + can_keep = { + realm_law_use_celestial_bureaucracy = yes + is_independent_ruler = yes + } + + modifier = { + treasury_ministry_budget_allocation = 1.0 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } +} + +budget_allocation_military_law = { + is_treasury_budget_group = yes + + flag = treasury_budget_law + flag = treasury_budget_military + + default = budget_allocation_military_20 + + budget_allocation_military_0 = { + shown_in_encyclopedia = no + + flag = military_budget_law_major_negative_impact + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_military_budget_allocation = 0 + + glory_hound_opinion = -35 + army_damage_mult = -0.4 + army_toughness_mult = -0.4 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + on_pass = { + add_legitimacy = { + value = treasury_budget_law_change_legitimacy_loss_base + multiply = 4 + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_military_5 = { + shown_in_encyclopedia = no + + flag = military_budget_law_major_negative_impact + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_military_budget_allocation = 0.05 + + glory_hound_opinion = -30 + army_damage_mult = -0.3 + army_toughness_mult = -0.3 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + on_pass = { + add_legitimacy = { + value = treasury_budget_law_change_legitimacy_loss_base + multiply = 2 + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_military_10 = { + shown_in_encyclopedia = no + + flag = military_budget_law_major_negative_impact + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_military_budget_allocation = 0.10 + + glory_hound_opinion = -25 + army_damage_mult = -0.2 + army_toughness_mult = -0.2 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + on_pass = { + add_legitimacy = { + value = treasury_budget_law_change_legitimacy_loss_base + multiply = 1 + } + } + + ai_will_do = { + value = 0 + } + } + + + budget_allocation_military_15 = { + shown_in_encyclopedia = no + + flag = military_budget_law_major_negative_impact + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_military_budget_allocation = 0.15 + + glory_hound_opinion = -20 + army_damage_mult = -0.1 + army_toughness_mult = -0.1 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_military_20 = { + shown_in_encyclopedia = no + + flag = military_budget_law_minor_negative_impact + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + should_start_with = { + always = yes + } + + modifier = { + treasury_military_budget_allocation = 0.20 + + glory_hound_opinion = -10 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_military_25 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_military_budget_allocation = 0.25 + + glory_hound_opinion = -5 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_military_30 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + ai_will_do = { + value = 0 + } + + modifier = { + treasury_military_budget_allocation = 0.30 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_military_35 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_military_budget_allocation = 0.35 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_military_40 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_military_budget_allocation = 0.40 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_military_45 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_military_budget_allocation = 0.45 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_military_50 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_military_budget_allocation = 0.50 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_military_55 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_military_budget_allocation = 0.55 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_military_60 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_military_budget_allocation = 0.60 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_military_65 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_military_budget_allocation = 0.65 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_military_70 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_military_budget_allocation = 0.70 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_military_75 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_military_budget_allocation = 0.75 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_military_80 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_military_budget_allocation = 0.8 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_military_85 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_military_budget_allocation = 0.85 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_military_90 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_military_budget_allocation = 0.9 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_military_95 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_military_budget_allocation = 0.95 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } + + budget_allocation_military_100 = { + shown_in_encyclopedia = no + + can_keep = { + realm_uses_treasury_laws_trigger = yes + is_independent_ruler = yes + } + + modifier = { + treasury_military_budget_allocation = 1.0 + } + + pass_cost = { + prestige = { + add = change_admin_budget_law_prestige_cost + } + } + + ai_will_do = { + value = 0 + } + } +} diff --git a/N3OW/common/laws/03_imperial_policies.txt b/N3OW/common/laws/03_imperial_policies.txt new file mode 100644 index 00000000..6ec6c61d --- /dev/null +++ b/N3OW/common/laws/03_imperial_policies.txt @@ -0,0 +1,361 @@ +##################### +# IMPERIAL POLICIES # +##################### + +@imperial_policy_laws_cooldown_value = 10 +@imperial_policy_cost_value = 500 + +imperial_policy_laws = { + default = manor_reform_law + cumulative = no + flag = imperial_policy + + defense_mobilization_law = { + flag = defense_mobilization_law + + can_keep = { + realm_law_use_imperial_policy_trigger = yes + trigger_if = { + limit = { is_independent_ruler = no } + liege = { has_realm_law = defense_mobilization_law } + } + } + + can_pass = { + trigger_if = { + limit = { + top_liege = this + } + custom_tooltip = { + text = imperial_policy_laws_cooldown_desc + NOT = { has_variable = imperial_policy_laws_cooldown } + } + } + tgp_japan_defense_mobilization_valid_trigger = yes + } + + on_pass = { + ## Set cooldown + set_variable = { + name = imperial_policy_laws_cooldown + years = @imperial_policy_laws_cooldown_value + } + tgp_imperial_policy_event_effect = yes + } + + modifier = { + same_heritage_county_advantage_add = 5 + men_at_arms_maintenance = -0.15 + fort_level = 1 + hostile_raid_time = 0.15 + } + flag = governors_may_recruit_japanese_horse_archers + flag = cheaper_japanese_domicile_military_buildings + + pass_cost = { + prestige = @imperial_policy_cost_value + } + + ai_will_do = { + value = 250 + } + } + + disarmament_law = { + flag = disarmament_law + flag = vassal_internal_wars_cost_doubled + flag = japan_administrative_can_build_castles + + can_keep = { + realm_law_use_imperial_policy_trigger = yes + trigger_if = { + limit = { is_independent_ruler = no } + liege = { has_realm_law = disarmament_law } + } + } + + can_pass = { + trigger_if = { + limit = { + top_liege = this + } + custom_tooltip = { + text = imperial_policy_laws_cooldown_desc + NOT = { has_variable = imperial_policy_laws_cooldown } + } + } + } + + on_pass = { + ## Set cooldown + set_variable = { + name = imperial_policy_laws_cooldown + years = @imperial_policy_laws_cooldown_value + } + tgp_imperial_policy_event_effect = yes + } + + modifier = { + men_at_arms_recruitment_cost = 0.25 + japan_feudal_government_vassal_opinion = -15 + development_growth_factor = 0.15 + } + + pass_cost = { + prestige = @imperial_policy_cost_value + } + + ai_will_do = { + value = 200 + if = { + limit = { + ai_has_warlike_personality = yes + } + value = -50 + } + if = { + limit = { government_has_flag = government_is_japan_feudal } + add = -1000 + } + } + } + + isolation_law = { + flag = isolation_law + flag = better_physician_treatments + + can_keep = { + realm_law_use_imperial_policy_trigger = yes + trigger_if = { + limit = { is_independent_ruler = no } + liege = { has_realm_law = isolation_law } + } + } + + can_pass = { + trigger_if = { + limit = { + top_liege = this + } + custom_tooltip = { + text = imperial_policy_laws_cooldown_desc + NOT = { has_variable = imperial_policy_laws_cooldown } + } + } + } + + on_pass = { + ## Set cooldown + set_variable = { + name = imperial_policy_laws_cooldown + years = @imperial_policy_laws_cooldown_value + } + tgp_imperial_policy_event_effect = yes + } + + modifier = { + development_growth_factor = -0.15 + epidemic_resistance = 15 + diplomatic_range_mult = -0.15 + } + + pass_cost = { + prestige = @imperial_policy_cost_value + } + + ai_will_do = { + value = 0 + if = { + limit = { + any_realm_county = { + any_county_province = { + any_province_epidemic = { + count >= 1 + outbreak_intensity >= apocalyptic + } + } + } + } + add = 200 + } + } + } + + imperial_expansion_law = { + flag = imperial_expansion_law + flag = cheaper_japanese_domicile_military_buildings + + can_keep = { + realm_law_use_imperial_policy_trigger = yes + trigger_if = { + limit = { is_independent_ruler = no } + liege = { has_realm_law = imperial_expansion_law } + } + } + + can_pass = { + trigger_if = { + limit = { + top_liege = this + } + custom_tooltip = { + text = imperial_policy_laws_cooldown_desc + NOT = { has_variable = imperial_policy_laws_cooldown } + } + } + tgp_japan_imperial_expansion_internal_peace_trigger = yes + } + + on_pass = { + ## Set cooldown + set_variable = { + name = imperial_policy_laws_cooldown + years = @imperial_policy_laws_cooldown_value + } + tgp_imperial_policy_event_effect = yes + } + + modifier = { + mercenary_hire_cost_mult = -0.15 + men_at_arms_recruitment_cost = -0.15 + japan_administrative_government_vassal_opinion = -35 + travel_danger = 20 + } + + pass_cost = { + prestige = @imperial_policy_cost_value + } + + ai_will_do = { + value = 80 + if = { + limit = { + ai_has_warlike_personality = yes + } + add = 50 + } + if = { + limit = { government_has_flag = government_is_japan_administrative } + add = -1000 + } + } + } + + manor_reform_law = { + flag = manor_reform_law + + can_keep = { + realm_law_use_imperial_policy_trigger = yes + trigger_if = { + limit = { is_independent_ruler = no } + liege = { has_realm_law = manor_reform_law } + } + } + + can_pass = { + trigger_if = { + limit = { + top_liege = this + } + custom_tooltip = { + text = imperial_policy_laws_cooldown_desc + NOT = { has_variable = imperial_policy_laws_cooldown } + } + } + } + + on_pass = { + ## Set cooldown + set_variable = { + name = imperial_policy_laws_cooldown + years = @imperial_policy_laws_cooldown_value + } + tgp_imperial_policy_event_effect = yes + } + + should_start_with = { + realm_law_use_imperial_policy_trigger = yes + } + + modifier = { + domicile_build_gold_cost = 0.25 + domicile_monthly_influence_mult = -0.25 + domicile_build_speed = 0.25 + build_gold_cost = -0.15 + build_speed = -0.15 + japan_administrative_government_vassal_opinion = -15 + } + + pass_cost = { + prestige = @imperial_policy_cost_value + } + + ai_will_do = { + value = 100 + if = { + limit = { + ai_has_builder_or_pious_builder_personality = yes + } + add = 25 + } + if = { + limit = { government_has_flag = government_is_japan_administrative } + add = -100 + } + } + } + + bandit_crackdown_law = { + flag = bandit_crackdown_law + + can_keep = { + realm_law_use_imperial_policy_trigger = yes + trigger_if = { + limit = { is_independent_ruler = no } + liege = { has_realm_law = bandit_crackdown_law } + } + } + + can_pass = { + trigger_if = { + limit = { + top_liege = this + } + custom_tooltip = { + text = imperial_policy_laws_cooldown_desc + NOT = { has_variable = imperial_policy_laws_cooldown } + } + } + } + + on_pass = { + ## Set cooldown + set_variable = { + name = imperial_policy_laws_cooldown + years = @imperial_policy_laws_cooldown_value + } + tgp_imperial_policy_event_effect = yes + } + + modifier = { + city_holding_build_gold_cost = -0.1 + barons_and_minor_landholders_opinion = 15 + monthly_county_control_growth_factor = 0.05 + monthly_county_control_growth_add = 0.2 + development_growth_factor = -0.15 + travel_danger = -10 + } + + pass_cost = { + prestige = @imperial_policy_cost_value + } + + ai_will_do = { + value = 0 + if = { + limit = { capital_county.county_control <= low_county_control } + add = 150 + } + } + } +} diff --git a/N3OW/common/laws/_laws.info b/N3OW/common/laws/_laws.info index a7537eae..6716e264 100644 --- a/N3OW/common/laws/_laws.info +++ b/N3OW/common/laws/_laws.info @@ -1,124 +1,353 @@ -In this folder, law groups and laws can be defined. +law_group_name = { + + ### brief = default ( database key, optional ) + # New rulers will use this law by default, provided its "should_start_with" trigger + # returns true or is undefined + # + default = law_name -== Inheritance == -Any heir that goes up one or more tier due to inheritance gets the laws of the dead ruler. -Note that currently the law conditions are not checked in any way for law inheritance. + ### brief: cumulative ( bool, optional ) + # If set, each subsequent law in the group will provide all effects of the previous law + # default = no + # + cumulative = no -== Structure == -All script has the ruler as ROOT. + ### brief: flag ( flag ) + # See below for flags with special treatment in code. These flags may also be checked + # in the data/GUI system with LawGroup.HasFlag('some_arbitrary_flag') + # + flag = some_arbitrary_flag -law_group_name = { - default = law_name # Optional. New rulers will by default use this law, as long as its "should_start_with" trigger returns true or is not defined + ### brief: cumulative ( bool, optional ) + # If set, this law group is considered part of the Treasury Budget set, and will be displayed within a specific + # budget interface. + # default = no + # + is_treasury_budget_group = no - cumulative = yes # If set, each subsequent law in the group will provide all effects of the previous law - - flag = some_arbitrary_flag # See below for flags treated specially. Also can check it in the data/GUI system with LawGroup.HasFlag('some_arbitrary_flag') + ### brief: can_change_law_group ( trigger ) + # Optional trigger for law groups that maybe some rulers should see but cant change + # Default is leaving this empty - and then it will always be true + # If this trigger fails - the lawgroup will still be visible but can't be changed by the ruler + # + can_change_law_group = { } law_name = { - can_keep = { # Requirements for keeping the law in the ruler's scope. If this invalidates, the law will be replaced with the default law (see own section) within a month. Also checked after changing faith since doctrinal changes are likely to invalidate laws. Always true if not specified. + + ### brief: can_keep ( trigger ) + # Requirements for keeping the law. If this invalidates, the law will + # be replaced with the default law (see own section) within a month. + # Also checked after changing faith since doctrinal changes are likely + # to invalidate laws. Always true if not specified. + # Root scope = ruler with the law + # + can_keep = { } + + ### brief: can_have ( trigger ) + # Requirements for adopting the law in the ruler's scope. If this is true, + # the character is allowed to adopt the law and the law will show as + # available (but it can be currently disabled if can_pass is false). + # Always true if not specified. + # Root scope = ruler for whom we are checking the law + # + can_have = { } + + ### brief: can_pass ( trigger ) + # Requirements for adopting the law in the ruler's scope. For more + # temporary conditions, e.g. being at war ("I can have the law, but + # can't pass it right now"). Always true if not specified. + # Root scope = ruler for whom we are checking the law + # + can_pass = { } + + ### brief: should_start_with ( trigger ) + # If these conditions are true, this is a valid law for a ruler to start + # with. Note that it always includes the can_keep check. + # Root scope = ruler for whom we are checking the law + # + should_start_with = { } + + ### brief: can_title_have ( trigger ) + # Requirements for titles being able to have this law. Always false if + # not specified. + # Root scope = title for which we are checking the law + # + can_title_have = { } + + ### brief: can_realm_have ( trigger ) + # Requirements for characters being able to apply this law at realm level. + # Always false if not specified. + # By default, the following succession orders imply they can be applied to the whole realm: + # * inheritance + # * theocracy + # * company + # * generate + # * appointment + # Root scope = character for which we are checking the law + # + can_realm_have = { } + + ### brief: should_show_for_title ( trigger ) + # Should this law be shown in the UI for titles? + # + should_show_for_title = { } + + ### brief: pass_cost ( scripted cost ) + # The cost of enacting this law + # Root scope = ruler wanting to pass the law + # + pass_cost = { gold/piety/prestige = ... } + + ### brief: revoke_cost ( scripted cost ) + # The cost of revoking or clearing this law + # Root scope = ruler wanting to revoke the law + # + revoke_cost = { gold/piety/prestige = ... } + + ### brief: modifier ( character modifier ) + # Modifier applied to the ruler when this law is active + # + modifier = { } + + ### brief: flag ( flag ) + # See below for flags treated specially. Can be checked in script + # with has_realm_law_flag = some_arbitrary_flag. + # See below for flags treated specially in code. + # + flag = some_arbitrary_flag + + ### brief: triggered_flag ( flag ) + # Checks and adds flag only if the trigger's condition is met. + # Both trigger and flag *must* be specified within this block. + # + triggered_flag = { + + # Some trigger, root is the ruler character scope + # + trigger = { ... } + + # See below for flags treated specially in code. Can be checked in + # script with has_realm_law_flag = some_arbitrary_flag + # + flag = some_arbitrary_flag } - can_have = { # Requirements for adopting the law in the ruler's scope. If this is true, the character is allowed to adopt the law and the law will show as available (but it can be currantly disabled if can_pass is false). Always true if not specified. - } + ### brief: shown_in_encyclopedia ( bool, optional ) + # If this law should show up in the Encyclopedia + # default = yes + # + shown_in_encyclopedia = yes - can_pass = { # Requirements for adopting the law in the ruler's scope. For more temporary conditions, e.g. being at war ("I can have the law, but can't pass it right now"). Always true if not specified. - } + ### brief: on_pass ( effect ) + # Effect run just before law change. + # Effect run on the ruler when the law is added. Does *NOT* get run + # when default laws are initialized, nor when inheriting a law from + # someone else. + # Root = ruler in question + # If this is done on a title, the title is accessible as scope:title + # + on_pass = { } - should_start_with = { # If these conditions are true, this is a valid law to start with. Note that it always includes the can_keep check. - } + ### brief: on_after_pass ( effect ) + # Effect run just after law change. + # Effect run on the ruler when the law is added. Does *NOT* get run + # when default laws are initialized, nor when inheriting a law from + # someone else. + # Root = ruler in question + # If this is done on a title, the title is accessible as scope:title + # + on_after_pass = { } - can_title_have = { # Requirements for titles being able to have this law, in the title's scope. Always false if not specified - } + ### brief: on_revoke ( effect ) + # Effect run on ruler when the law is removed. Does *NOT* get run when + # law is removed due to inheriting a law from someone else. + # Root = ruler in question + # If this is done on a title, the title is accessible as scope:title + # + on_revoke = { } - should_show_for_title = { # Should the law be shown in the UI for titles? - } - - pass_cost = { gold/piety/prestige = ... } # Cost of enacting this law - - revoke_cost = { gold/piety/prestige = ... } # Cost of revoking or clearing this law - - modifier = { # Modifier applied to the ruler when this law is active - } - - flag = some_arbitrary_flag # See below for flags treated specially. Also can be checked in script with has_realm_law_flag = some_arbitrary_flag - - triggered_flag = { # Checks and adds flag only if the trigger's condition is met. Both trigger and flag *must* be specified within this block - trigger = { } # Some trigger (has character scope) - flag = some_arbitrary_flag # See below for flags treated specially. Also can be checked in script with has_realm_law_flag = some_arbitrary_flag - } - - on_pass = { # Effect run on ruler when the law is added. Does *NOT* get run when default laws are initialized, nor when inheriting a law from someone else. If this is done on a title, the title is accessible as scope:title - } - - on_revoke = { # Effect run on ruler when the law is removed. Does *NOT* get run when law is removed due to inheriting a law from someone else. If this is done on a title, the title is accessible as scope:title - } - - # Succession rules. Any new law with a rule set will override the previous law's rule. + ### brief: succession ( struct, optional ) + # Succession rules. Any new law with a rule set will override the + # previous law's rule set. # Overriding is in law definition order + # succession = { - order_of_succession = inheritance/election/appointment/theocratic/company/generate/player_heir/noble_family - # For inheritance: - title_division = partition/single_heir # only "traversal_order = children" supports partition + ### brief: order_of_succession ( enum ) + # Which order of succession ( provided by code ) does this law use? + # + # Options: + # inheritance + # election + # appointment ( requires traversal, division and rank be undefined ) + # theocratic + # company + # generate + # generate_from_template + # player_heir + # noble_family + # + order_of_succession = inheritance + ### brief: title_division ( enum ) + # Used to determine how titles are split during succession + # Requires order_of_succession = inheritance or noble_family + # + # Options: + # partition ( only available when traversal_order = children ) + # single_heir ( only valid for inheritance and noble_family order_of_succession ) + # + title_division = partition + + ### brief: traversal_order ( enum ) + # Determines which set of characters is considered when building + # the line of succession. + # + # Options: + # children( may only be defined if title_division = partition ) + # dynasty + # dynasty_house + # traversal_order = children/dynasty_house/dynasty - rank = oldest/youngest + ### brief: rank ( enum ) + # Determines how characters in the line of succession are sorted + # + # Options: + # oldest + # youngest + # + rank = oldest - # For theocratic & company only: - pool_character_config = key # entry in common/pool_character_selectors, used when choosing a character from the pool or generating a new one + ### brief: pool_character_config ( database key, situational ) + # Entry in common/pool_character_selectors, used when choosing a + # character from the pool or generating a new character. + # Only available for theocratic, company, and generate. + # + pool_character_config = key - # For election only: - election_type = key # entry in common/succession_election + ### brief: election_type ( database key, situational ) + # Entry in common/succession_election, used to determine which type + # of election should be used for succession. + # Only available for election. + # + election_type = key - # For appointment only: - appointment_type = key # entry in common/succession_appointment + ### brief: appointment_type ( database key, situational ) + # Entry in common/succession_appointment, used to determine which type + # of appointment should be used for succession. + # Only available for appointment. + # + appointment_type = key - # Generic rules: - gender_law = male_only/male_preference/equal/female_preference/female_only - faith = same_faith/same_religion/same_family # Faith restrictions on who can inherit. If no one fulfilling this is found, the restriction is ignored (but titles with the flag destroy_if_invalid_heir = yes will be destroyed) + ### Generic Rules - create_primary_tier_titles = yes # If set, then under partition all titles you can create of your primary tier will be created for free, resulting in a more split-up realm + ### brief: gender_law ( enum, optional ) + # Used to determine which gender(s) are valid for succession. + # + # Options: + # male_only + # male_preference + # equal + # female_preference + # female_only + # + gender_law = equal - primary_heir_minimum_share = 0.5 # The primary heir will get at least this portion of titles, which means if there's a lot of heirs the primary still gets a lot of land + ### brief: gender_law ( enum, optional ) + # Used to determine which faith(s) are valid for succession. + # If no character fulfilling this requirement is found, the restriction + # is ignored (but titles with the flag destroy_if_invalid_heir = yes + # will be destroyed). + # + # Options: + # same_faith + # same_religion + # same_family + # + faith = same_faith - exclude_rulers = yes # If set, the title can not be inherited by rulers (anyone with titles) + ### brief: create_primary_tier_titles ( bool, optional ) + # If set, then under partition all titles you can create of your primary + # tier will be created for free, resulting in a more split-up realm + # default = no + # + create_primary_tier_titles = no - limit_to_courtiers = no # If set, only immediate courtiers and away courtiers of a ruler will be allowed to inherit + ### brief: primary_heir_minimum_share ( fixed point, optional ) + # If defined, the primary heir will get at least this portion of + # titles, which means if there's a lot of heirs the primary still + # gets a guaranteed amount of land + # + primary_heir_minimum_share = 0.5 + + ### brief: exclude_rulers ( bool, optional ) + # If set, the title can not be inherited by rulers (anyone with titles) + # default = no + # + exclude_rulers = no + + ### brief: limit_to_courtiers ( bool, optional ) + # If set, only immediate courtiers and away courtiers of a ruler + # will be allowed to inherit + # default = no + # + limit_to_courtiers = no } - ai_will_do = { ... } # Script value in ruler scope. If above 0, the AI will enact this law if able. Law enactment is checked in the RARE_TASK_TICK. If multiple laws are possible, the AI will enact the one with the highest score + ### brief: ai_will_do ( value ) + # Script value in the ruler scope. If above 0, the AI will enact this + # law if able. Law enactment is checked in the RARE_TASK_TICK. If multiple + # laws are possible, the AI will enact the one with the highest score. + # Root scope = ruler in question + # + ai_will_do = { ... } } + # Multiple laws can be defined in a single law group. another_law_name = {} } -== Default law == +### NOTES ### + +### Inheritance ### +Any heir that goes up one or more tier due to inheritance gets the laws of the dead ruler. +Note that currently the law conditions are not checked in any way for law inheritance. + +### Default law ### All rulers have a single law from each group. If a group has a default set, that law will be checked first. Otherwise, or if it is invalid, the laws are checked in definition order. -The first checked law where "should_start_with" returns true (or does not exist) gets used. Note that "can_pass" is ignored entirely. +The first checked law where "should_start_with" returns true (or does not exist) gets used. Note that "can_pass" is ignored entirely when determining a default law. When a default law is set, "on_pass" is *not* executed -== Title Succession Laws == -Laws are usually defined for realm. However some succession laws are valid for only titles, or for both realms and titles: -Title only: -- order_of_succession = elective -Realm only: -- order_of_succession = theocratic/company -- order_of_succession = inheritance + title_division = partition -Realm & Title: -- order_of_succession = inheritance + title_division = single_heir +### Title Succession Laws ### +Laws are usually defined for realm. However some succession laws are valid for titles. +This is primary based on order_of_succession: -== Associated loc == + Title only: + player_heir + election + noble_family + generate_from_template + Realm only: + inheritance ( title_division = partition ) + theocratic + company + generate + Realm & Title: + inheritance ( title_division = single_heir ) + appointment + +### Associated Localization ### The key of the law will be used as its name. E.G., law_name: "Law Name" The key plus "_effects" can optionally be defined to provide custom effects. E.G., law_name_effects: "Does some law thingy" The key plus "_effects_not_in_prev" can optionally be defined to provide custom effects that should *not* be included when listing effects inherited from earlier laws. E.G., law_name_effects_not_in_prev: "Does some law thingy" CHARACTER.GetActiveLawInGroupWithFlag('realm_law') - Will get the character's active law in a group. The group must have the given flag. Note that it does not work for dead characters -== Hardcoded flags == +### Hardcoded Flags ### Some flags have special meaning, and are used by the game code. Law Groups: diff --git a/N3OW/common/on_action/game_start.txt b/N3OW/common/on_action/game_start.txt index b56b5276..b210f62e 100644 --- a/N3OW/common/on_action/game_start.txt +++ b/N3OW/common/on_action/game_start.txt @@ -22,10 +22,9 @@ on_game_start = { title:e_benelux = { set_coa = e_lotharingia } } } - title:c_genoa.holder = { - create_confederation = { - name = holy_lombard_league - } + title:c_genoa.holder = { + create_confederation = { + name = holy_lombard_league } scope:new_confederation = { add_confederation_member = title:d_emilia.holder @@ -37,12 +36,22 @@ on_game_start = { add_confederation_member = title:c_pavia.holder add_confederation_member = title:c_luni.holder } - ##NEOW End - #Epidemics 3 months grace + } + # Chinese Song-fashion + if = { + limit = { + current_date >= 960.1.1 + } + set_global_variable = { + name = chinese_fashion_change + value = 1 + } + } + #Epidemics 10 years grace set_global_variable = { name = start_epidemic_grace value = yes - months = 3 + years = 10 } #Set Cumania name if there is no MPO DLC if = { @@ -169,11 +178,9 @@ on_game_start = { limit = { exists = character:223522 current_date >= 1178.1.1 - AND = { - character:223541 = { - is_ai = yes - is_alive = yes - } + character:223541 = { + is_ai = yes + is_alive = yes } } character:223522 = { @@ -183,6 +190,26 @@ on_game_start = { } } } + ### 1066 - LIANG LUOYAO ### + if = { + limit = { + exists = character:tangut_liang_1 + current_date >= 1066.1.1 + character:tangut_liang_1.primary_spouse ?= character:206651 + } + character:tangut_liang_1 = { + add_gold = { + value = { + value = 0 + add = { 200 350 } + } + } + trigger_event = { + id = bookmark.0400 + days = { 14 21 } + } + } + } ### HRE SETUP ### if = { @@ -245,6 +272,196 @@ on_game_start = { } } + ### CORONATION LOCATION SETUP ### + if = { + limit = { + current_date >= 1066.1.1 + has_dlc_feature = coronations + } + # London (England) + province:1527 = { + add_province_modifier = coronation_tradition_modifier + set_variable = { + name = coronation_tradition_location + value = 5 + } + } + # Aachen (Germany) + province:2092 = { + add_province_modifier = coronation_tradition_modifier + set_variable = { + name = coronation_tradition_location + value = 5 + } + } + # Reims (France) + province:2390 = { + add_province_modifier = coronation_tradition_modifier + set_variable = { + name = coronation_tradition_location + value = 5 + } + } + # Rome (Italy) + province:2575 = { + add_province_modifier = coronation_tradition_modifier + set_variable = { + name = coronation_tradition_location + value = 5 + } + } + # Milan (Italy) + province:2482 = { + add_province_modifier = coronation_tradition_modifier + set_variable = { + name = coronation_tradition_location + value = 5 + } + } + # Gniezno (Poland) + province:4905 = { + add_province_modifier = coronation_tradition_modifier + set_variable = { + name = coronation_tradition_location + value = 5 + } + } + # Szekesfehervar (Hungary) + province:3805 = { + add_province_modifier = coronation_tradition_modifier + set_variable = { + name = coronation_tradition_location + value = 5 + } + } + # Scone Abbey, Gowrie (Scotland) + province:1741 = { + add_province_modifier = coronation_tradition_modifier + set_variable = { + name = coronation_tradition_location + value = 5 + } + } + # Byzantium (Byzantines) + province:496 = { + add_province_modifier = coronation_long_tradition_modifier + set_variable = { + name = coronation_tradition_location + value = 10 + } + } + # Mahdiya (Africa) + province:4578 = { + add_province_modifier = coronation_tradition_modifier + set_variable = { + name = coronation_tradition_location + value = 5 + } + } + # Cairo (Egypt) + province:6042 = { + add_province_modifier = coronation_tradition_modifier + set_variable = { + name = coronation_tradition_location + value = 5 + } + } + # Damascus (Syria) + province:5924 = { + add_province_modifier = coronation_tradition_modifier + set_variable = { + name = coronation_tradition_location + value = 5 + } + } + # Baghdad (Mesopotamia) + province:4828 = { + add_province_modifier = coronation_long_tradition_modifier + set_variable = { + name = coronation_tradition_location + value = 10 + } + } + # Rayy (Persia) + province:4319 = { + add_province_modifier = coronation_tradition_modifier + set_variable = { + name = coronation_tradition_location + value = 5 + } + } + # Ghazna (Kabulistan) + province:4500 = { + add_province_modifier = coronation_tradition_modifier + set_variable = { + name = coronation_tradition_location + value = 5 + } + } + # Lahur (Punjab) + province:1362 = { + add_province_modifier = coronation_tradition_modifier + set_variable = { + name = coronation_tradition_location + value = 5 + } + } + # Samarkand (Transoxiana) + province:4404 = { + add_province_modifier = coronation_tradition_modifier + set_variable = { + name = coronation_tradition_location + value = 5 + } + } + # Bukhara (Transoxiana) + province:4394 = { + add_province_modifier = coronation_tradition_modifier + set_variable = { + name = coronation_tradition_location + value = 5 + } + } + # Medina (Arabia) + province:6212 = { + add_province_modifier = coronation_tradition_modifier + set_variable = { + name = coronation_tradition_location + value = 5 + } + } + # Kutaisi (Georgia) + province:601 = { + add_province_modifier = coronation_tradition_modifier + set_variable = { + name = coronation_tradition_location + value = 5 + } + } + } + if = { + limit = { + current_date >= 1178.1.1 + has_dlc_feature = coronations + } + # Marrakesh (Maghreb) + province:4718 = { + add_province_modifier = coronation_tradition_modifier + set_variable = { + name = coronation_tradition_location + value = 5 + } + } + # Karakorum (Mongolia) + province:1457 = { + add_province_modifier = coronation_tradition_modifier + set_variable = { + name = coronation_tradition_location + value = 5 + } + } + } + ### Every nomad and herder in the Steppe Region becomes tribal if DLC not enabled, pre-lobby history setup ### if = { limit = { @@ -277,7 +494,53 @@ on_game_start = { } } - setup_tributaries_effect = yes # defined in 00_tributary_setup_effect.txt + + + # To prevent the Season Changes event from triggering on game start + situation:the_great_steppe ?= { + every_participant_group = { + every_situation_group_participant = { + set_variable = { + name = steppe_game_start_var + years = 1 + } + } + } + } + + #CP3 Special Buildings - Goes Before Holy Sites + if = { + limit = { + has_cp3_dlc_trigger = yes + } + title:b_barcelona.title_province = { add_special_building_slot = drassanes_01 } #1892 + title:b_merv.title_province = { add_special_building = kyz_kala_01 } #4238 + if = { limit = { game_start_date >= 1178.10.1 } title:b_cluny.title_province = { add_special_building = cluny_abbey_02 } } #2304 + else_if = { limit = { game_start_date >= 1066.9.15 } title:b_cluny.title_province = { add_special_building = cluny_abbey_01 } } + else = { title:b_cluny.title_province = { add_special_building_slot = cluny_abbey_01 } } + title:b_york.title_province = { add_special_building = york_walls_01 } #1595 + title:b_damascus.title_province = { add_special_building = damascus_mosque_01 } #5924 + title:b_lhasa.title_province = { add_special_building = jokhang_01 } #9237 + if = { limit = { game_start_date >= 1178.10.1 } title:b_schmalkalden.title_province = { add_special_building = wartburg_01 } } #3010 + else = { title:b_schmalkalden.title_province = { add_special_building_slot = wartburg_01 } } + title:b_lalibela.title_province = { add_special_building_slot = beta_giyorgis_01 } #8301 + if = { limit = { game_start_date >= 1066.9.15 } title:b_novgorod.title_province = { add_special_building = holy_wisdom_01 } } #5137 + else = { title:b_novgorod.title_province = { add_special_building_slot = holy_wisdom_01 } } + title:b_kano.title_province = { add_special_building_slot = kano_walls_01 } #6519 + title:b_somapur.title_province = { add_special_building = somapura_university_01 } #848 + if = { limit = { game_start_date >= 1178.10.1 } title:b_firenze.title_province = { add_special_building = duomo_florence_02 } } #2543 + else = { title:b_firenze.title_province = { add_special_building = duomo_florence_01 } } + title:b_konarak.title_province = { add_special_building_slot = konark_temple_01 } #928 + title:b_fes.title_province = { add_special_building = al_qarawiyyin_university_01 } #4694 + title:b_kairouan.title_province = { add_special_building = kairouan_basins_01 } #4594 + title:b_al-ghaba.title_province = { add_special_building = ghana_palace_01 } #6628 #NOTE: likely existed since the 8th, but earliest (only) source on palace is from 1068 + title:b_visegrad_hun.title_province = { add_special_building_slot = visegrad_castle_01 } #3803 + if = { limit = { game_start_date >= 1161.9.15 } title:b_leczyca.title_province = { add_special_building = wawel_cathedral_01 } } #4924 #Date of consecreation of Archcollegiate Church of St. Mary and St. Alexius in Tum + else = { title:b_leczyca.title_province = { add_special_building_slot = wawel_cathedral_01 } } + title:b_vatapi.title_province = { add_special_building = vatapi_caves_01 } #1198 + if = { limit = { game_start_date >= 1178.10.1 } title:b_jaisalmer.title_province = { add_special_building = jaisalmer_fort_01 } } #3387 + else = { title:b_jaisalmer.title_province = { add_special_building_slot = jaisalmer_fort_01 } } #3387 + } ### RELIGIOUS THINGS ### # Set up Holy Site Buildings to be buildable in Holy Sites @@ -323,11 +586,66 @@ on_game_start = { } } } + religion:buddhism_religion = { + every_faith = { + every_holy_site = { + limit = { + title_province = { + has_special_building_slot = no + } + } + title_province = { + add_special_building_slot = holy_site_buddhist_grand_temple_01 + } + } + } + } + religion:shintoism_religion = { + every_faith = { + every_holy_site = { + limit = { + title_province = { + has_special_building_slot = no + } + } + title_province = { + add_special_building_slot = holy_site_japanese_temple_01 + } + } + } + } + religion:taoism_religion = { + every_faith = { + every_holy_site = { + limit = { + title_province = { + has_special_building_slot = no + } + } + title_province = { + add_special_building_slot = holy_site_chinese_temple_01 + } + } + } + } + religion:confucianism_religion = { + every_faith = { + every_holy_site = { + limit = { + title_province = { + has_special_building_slot = no + } + } + title_province = { + add_special_building_slot = holy_site_chinese_temple_01 + } + } + } + } every_religion_global = { limit = { OR = { this = religion:hinduism_religion - this = religion:buddhism_religion this = religion:jainism_religion this = religion:tani_religion this = religion:bon_religion @@ -346,6 +664,33 @@ on_game_start = { } } } + every_religion_global = { + limit = { + OR = { + this = religion:satsana_phi_religion + this = religion:dayawism_religion + this = religion:hantuism_religion + this = religion:satsana_phi_religion + this = religion:kaharingan_religion + this = religion:tolotang_religion + this = religion:aluk_religion + this = religion:dab_qhuas_religion + this = religion:biliku_religion + } + } + every_faith = { + every_holy_site = { + limit = { + title_province = { + has_special_building_slot = no + } + } + title_province = { + add_special_building_slot = holy_site_se_asia_pagan_temple_01 + } + } + } + } every_religion_global = { limit = { is_in_family = rf_pagan @@ -475,7 +820,22 @@ on_game_start = { } ### UNIVERSITIES ### - title:b_fes.title_province = { add_special_building_slot = generic_university } + title:b_fes.title_province = { + if = { + limit = { + has_special_building_slot = no #Depends on DLC + } + add_special_building_slot = generic_university + } + } + title:b_somapur.title_province = { + if = { + limit = { + has_special_building_slot = no #Depends on DLC + } + add_special_building_slot = generic_university + } + } #title:b_bologna.title_province = { add_special_building_slot = generic_university } # Added in province history title:b_salamanca.title_province = { add_special_building_slot = generic_university } title:b_madrid.title_province = { add_special_building_slot = generic_university } @@ -514,41 +874,50 @@ on_game_start = { } title:b_dumbarton.title_province = { add_special_building_slot = generic_university } # 1450ish, but still fun to build title:b_bidar.title_province = { add_special_building_slot = generic_university } # 1450ish, but still fun to build - - if = { - limit = { - has_cp3_dlc_trigger = yes - } - title:b_barcelona.title_province = { add_special_building_slot = drassanes_01 } #1892 - title:b_merv.title_province = { add_special_building = kyz_kala_01 } #4238 - if = { limit = { game_start_date >= 1178.10.1 } title:b_cluny.title_province = { add_special_building = cluny_abbey_02 } } #2304 - else_if = { limit = { game_start_date >= 1066.9.15 } title:b_cluny.title_province = { add_special_building = cluny_abbey_01 } } - else = { title:b_cluny.title_province = { add_special_building_slot = cluny_abbey_01 } } - title:b_york.title_province = { add_special_building = york_walls_01 } #1595 - title:b_damascus.title_province = { add_special_building = damascus_mosque_01 } #5924 - title:b_lhasa.title_province = { add_special_building = jokhang_01 } #9237 - if = { limit = { game_start_date >= 1178.10.1 } title:b_schmalkalden.title_province = { add_special_building = wartburg_01 } } #3010 - else = { title:b_schmalkalden.title_province = { add_special_building_slot = wartburg_01 } } - title:b_lalibela.title_province = { add_special_building_slot = beta_giyorgis_01 } #8301 - if = { limit = { game_start_date >= 1066.9.15 } title:b_novgorod.title_province = { add_special_building = holy_wisdom_01 } } #5137 - else = { title:b_novgorod.title_province = { add_special_building_slot = holy_wisdom_01 } } - title:b_kano.title_province = { add_special_building_slot = kano_walls_01 } #6519 - #NOTE: b_somapur already has a special building - title:b_somapur.title_province = { remove_building = generic_university add_special_building = somapura_university_01 } #848 - if = { limit = { game_start_date >= 1178.10.1 } title:b_firenze.title_province = { add_special_building = duomo_florence_02 } } #2543 - else = { title:b_firenze.title_province = { add_special_building = duomo_florence_01 } } - title:b_konarak.title_province = { add_special_building_slot = konark_temple_01 } #928 - title:b_fes.title_province = { add_special_building = al_qarawiyyin_university_01 } #4694 - title:b_kairouan.title_province = { add_special_building = kairouan_basins_01 } #4594 - title:b_al-ghaba.title_province = { add_special_building = ghana_palace_01 } #6628 #NOTE: likely existed since the 8th, but earliest (only) source on palace is from 1068 - title:b_visegrad_hun.title_province = { add_special_building_slot = visegrad_castle_01 } #3803 - if = { limit = { game_start_date >= 1161.9.15 } title:b_leczyca.title_province = { add_special_building = wawel_cathedral_01 } } #4924 #Date of consecreation of Archcollegiate Church of St. Mary and St. Alexius in Tum - else = { title:b_leczyca.title_province = { add_special_building_slot = wawel_cathedral_01 } } - title:b_vatapi.title_province = { add_special_building = vatapi_caves_01 } #1198 - if = { limit = { game_start_date >= 1178.10.1 } title:b_jaisalmer.title_province = { add_special_building = jaisalmer_fort_01 } } #3387 - else = { title:b_jaisalmer.title_province = { add_special_building_slot = jaisalmer_fort_01 } } #3387 + title:b_changsha.title_province = { + add_special_building_slot = generic_university } + ### GREAT WALL OF CHINA ### + + title:b_wulan.title_province = { add_great_building = the_great_wall_01 } + title:b_fengan.title_province = { add_great_building = the_great_wall_01 } + title:b_mingsha.title_province = { add_great_building = the_great_wall_01 } + title:b_yaode.title_province = { add_great_building = the_great_wall_01 } + title:b_huile.title_province = { add_great_building = the_great_wall_01 } + title:b_baojing.title_province = { add_great_building = the_great_wall_01 } + title:b_huaiyuan.title_province = { add_great_building = the_great_wall_01 } + title:b_shengwei.title_province = { add_great_building = the_great_wall_01 } + title:b_hequ.title_province = { add_great_building = the_great_wall_01 } + title:b_helan.title_province = { add_great_building = the_great_wall_01 } + title:b_dengkou.title_province = { add_great_building = the_great_wall_01 } + title:b_wuluhai.title_province = { add_great_building = the_great_wall_01 } + title:b_yongfeng.title_province = { add_great_building = the_great_wall_01 } + title:b_jiuyuan.title_province = { add_great_building = the_great_wall_01 } + title:b_tiande.title_province = { add_great_building = the_great_wall_01 } + + title:b_jincheng.title_province = { add_great_building = the_great_wall_02 } + title:b_huichuan.title_province = { add_great_building = the_great_wall_02 } + title:b_huairong_2.title_province = { add_great_building = the_great_wall_02 } + title:b_pinggao.title_province = { add_great_building = the_great_wall_02 } + title:b_huaide.title_province = { add_great_building = the_great_wall_02 } + title:b_fangqu.title_province = { add_great_building = the_great_wall_02 } + title:b_huaian_2.title_province = { add_great_building = the_great_wall_02 } + title:b_luoyuan.title_province = { add_great_building = the_great_wall_02 } + title:b_hengshan_3.title_province = { add_great_building = the_great_wall_02 } + title:b_wuyan.title_province = { add_great_building = the_great_wall_02 } + title:b_ningshuo.title_province = { add_great_building = the_great_wall_02 } + title:b_longquan.title_province = { add_great_building = the_great_wall_02 } + title:b_rulin.title_province = { add_great_building = the_great_wall_02 } + title:b_kaiguang.title_province = { add_great_building = the_great_wall_02 } + title:b_linzhou_yincheng.title_province = { add_great_building = the_great_wall_02 } + title:b_xiazhou_dejing_east.title_province = { add_great_building = the_great_wall_02 } + + title:b_xuande.title_province = { add_great_building = the_great_wall_03 } + title:b_baishui.title_province = { add_great_building = the_great_wall_03 } + title:b_rouxuan.title_province = { add_great_building = the_great_wall_03 } + title:b_cirlxj_yangcheng.title_province = { add_great_building = the_great_wall_03 } + ### COA ### if = { limit = { @@ -707,8 +1076,6 @@ on_game_start = { ### REGENCIES ### # Pre-defined historic regencies setup. ## NOTE: we do these first to avoid feed messages getting weird due to regents being replaced immediately after getting their position. - ## 867. - ### None. Yet. ## 1066. if = { limit = { game_start_date = 1066.9.15 } @@ -817,7 +1184,7 @@ on_game_start = { LIEGE = character:3040 } } - if = { + else_if = { limit = { game_start_date = 1178.10.1 } # Set up some diarchs. ## The future Richard I of England managing Aquitaine in place of his mother (who is under house arrest) @@ -849,6 +1216,11 @@ on_game_start = { try_start_diarchy = nomad_regency set_diarch = character:188909 } + ## Dai Viet, Long Trat Vuong & To Hien Thanh + character:viet_ly_2 = { + set_diarch = character:viet_to_1 + #designate_diarch = character:viet_to_1 + } # Plus remove all the generated opinions. ## Richard I and Eleanor of Aquitaine remove_generated_diarch_consequences_effect = { @@ -875,16 +1247,28 @@ on_game_start = { NEW_DIARCH = character:209510 LIEGE = character:209503 } - ## Wolila and Zhilugu + ## Wolila and Zhilugu remove_generated_diarch_consequences_effect = { NEW_DIARCH = character:188909 LIEGE = character:188912 } - + ## Long Trat Vuong and To Hien Thanh + remove_generated_diarch_consequences_effect = { + NEW_DIARCH = character:viet_to_1 + LIEGE = character:viet_ly_2 + } } - # Set up anyone who should be in a regency at start whether we have sources or not. - ## If you start as a child, incapable, or imprisoned, you get a regency. - every_ruler = { + if = { + limit = { has_tgp_dlc_trigger = no } + title:k_yongson_throne ?= { + holder ?= { + destroy_title = prev + } + } + } + every_ruler = { # PUT EVERY_RULER TYPE STUFF HERE FOR PERFORMANCE REASONS + # Set up anyone who should be in a regency at start whether we have sources or not. + ## If you start as a child, incapable, or imprisoned, you get a regency. if = { limit = { OR = { @@ -927,7 +1311,197 @@ on_game_start = { change_government = tribal_government } } + + # Set Coronation laws for everyone + if = { + limit = { + coronation_trigger = yes + } + if = { + limit = { + highest_held_title_tier = tier_kingdom + } + add_realm_law_skip_effects = crowned_king + set_variable = crowned_king_var + } + else_if = { + limit = { + highest_held_title_tier > tier_kingdom + } + add_realm_law_skip_effects = crowned_emperor + set_variable = crowned_emperor_var + } + } + + # Admin - Let's give existing governors the Governor trait on game start + if = { + limit = { + is_governor = yes + NOT = { has_trait = governor } + OR = { + government_allows = administrative + government_is_japanese_trigger = yes + } + } + add_trait = governor + add_trait_xp = { + trait = governor + value = { + add = primary_title.title_held_years + multiply = 2 + if = { + limit = { + age >= 50 + has_government = japan_administrative_government + } + add = { + value = age + divide = 4 + } + } + } + } + } + # Clean up TGP governments is the Expansion is not enabled + if = { + limit = { has_tgp_dlc_trigger = no } + # TGP: Clean up maritime tribal govs and revert them to non-dlc tribals + if = { + limit = { + government_has_flag = government_is_wanua + } + change_government = tribal_government + } + # TGP: Clean up mandala govs and revert them to non-dlc feudals + else_if = { + limit = { + government_has_flag = government_is_mandala + } + change_government = feudal_government + } + ### Every Celestial/Meritocratic/Japanese Government becomes feudal if DLC not enabled, pre-lobby history setup ### + else_if = { + limit = { + OR = { + has_government = celestial_government + has_government = meritocratic_government + has_government = steppe_admin_government + has_government = japan_administrative_government + has_government = japan_feudal_government + } + } + change_government = feudal_government + + } + if = { + limit = { + any_held_title = { + is_noble_family_title = yes + } + } + every_held_title = { + limit = { + is_noble_family_title = yes + title_domicile ?= { + OR = { + is_domicile_type = japanese_manor + is_domicile_type = east_asian_estate + } + } + } + save_temporary_scope_as = family_title + prev = { destroy_title = scope:family_title } + } + } + } + # TGP: Adjust China's starting laws + else_if = { + limit = { + realm_law_use_celestial_bureaucracy = yes + } + if = { + limit = { + game_start_date >= 1066.9.15 + } + add_realm_law_skip_effects = celestial_bureaucracy_2 + if = { + limit = { + top_liege != this + } + add_realm_law_skip_effects = celestial_army_vassal_law_2 + } + else = { + add_realm_law_skip_effects = celestial_army_liege_law_2 # Let's give them the matching army level as well + } + } + } + if = { + limit = { + has_domicile = yes + any_held_title = { + is_noble_family_title = yes + } + } + if = { + limit = { + is_landed = yes + domicile.domicile_location != this.capital_province + } + random_held_title = { + limit = { + is_noble_family_title = yes + } + set_capital_county = prev.capital_county + } + domicile ?= { + move_domicile = prev.capital_province + } + } + if = { + limit = { + tgp_is_any_minister = yes + } + random_held_title = { + limit = { + tier = tier_empire + } + set_capital_county = prev.top_liege.capital_county + } + random_held_title = { + limit = { + is_noble_family_title = yes + } + set_capital_county = prev.top_liege.capital_county + } + domicile ?= { + move_domicile = prev.top_liege.capital_province + } + } + } } + # DYNASTIC CYCLE SETUP + situation:dynastic_cycle ?= { + title:h_china = { + set_variable = { + name = years_since_imperial_examination + value = 0 + } + } + if = { + limit = { game_start_date < 868.1.1 } + tgp_set_wuking_element_effect = { ELEMENT = earth } # Tang + every_situation_sub_region = { + add_takeover_phase_points = { + phase = situation_dynastic_cycle_phase_chaos + points = 800 + } + } + } + else = { + tgp_set_wuking_element_effect = { ELEMENT = fire } # Song + } + } + setup_tributaries_effect = yes # defined in 00_tributary_setup_effect.txt # Sort custom regencies. ## Fatimid Caliphate - basically stuck in the back-end of an entrenched regencies from game start. if = { @@ -1051,17 +1625,17 @@ on_game_start = { culture:kerait = { add_culture_tradition = tradition_horse_lords add_culture_tradition = tradition_steppe_tolerance } culture:khitan = { add_culture_tradition = tradition_horse_lords } culture:tuyuhun = { add_culture_tradition = tradition_horse_lords } - culture:jurchen = { add_culture_tradition = tradition_horse_lords } + culture:jurchen = { add_culture_tradition = tradition_horse_lords } culture:cuman = { add_culture_tradition = tradition_horse_lords } culture:khazar = { add_culture_tradition = tradition_horse_lords add_culture_tradition = tradition_steppe_tolerance } - culture:bolghar = { add_culture_tradition = tradition_horse_lords } - culture:bashkir = { add_culture_tradition = tradition_horse_lords } + culture:bolghar = { add_culture_tradition = tradition_horse_lords } + culture:bashkir = { add_culture_tradition = tradition_horse_lords } culture:avar = { add_culture_tradition = tradition_horse_lords } culture:karluk = { add_culture_tradition = tradition_horse_lords add_culture_tradition = tradition_steppe_tolerance } culture:kimek = { add_culture_tradition = tradition_horse_lords } - culture:kipchak = { add_culture_tradition = tradition_horse_lords } + culture:kipchak = { add_culture_tradition = tradition_horse_lords } culture:laktan = { add_culture_tradition = tradition_horse_lords } - culture:kirghiz = { add_culture_tradition = tradition_horse_lords } + culture:kirghiz = { add_culture_tradition = tradition_horse_lords } culture:yughur = { add_culture_tradition = tradition_horse_lords add_culture_tradition = tradition_steppe_tolerance } culture:uriankhai = { add_culture_tradition = tradition_horse_lords } culture:chuvash = { add_culture_tradition = tradition_horse_lords } @@ -1410,7 +1984,11 @@ on_game_start = { enter_realm_event = ep3_emperor_yearly.2000 } set_important_location = { - title = title:e_roman_empire + title = title:h_roman_empire + enter_realm_event = ep3_emperor_yearly.2000 + } + set_important_location = { + title = title:h_eastern_roman_empire enter_realm_event = ep3_emperor_yearly.2000 } } @@ -1420,7 +1998,11 @@ on_game_start = { enter_realm_event = ep3_emperor_yearly.2000 } set_important_location = { - title = title:e_roman_empire + title = title:h_roman_empire + enter_realm_event = ep3_emperor_yearly.2000 + } + set_important_location = { + title = title:h_eastern_roman_empire enter_realm_event = ep3_emperor_yearly.2000 } } @@ -1430,7 +2012,11 @@ on_game_start = { enter_realm_event = ep3_emperor_yearly.2000 } set_important_location = { - title = title:e_roman_empire + title = title:h_roman_empire + enter_realm_event = ep3_emperor_yearly.2000 + } + set_important_location = { + title = title:h_eastern_roman_empire enter_realm_event = ep3_emperor_yearly.2000 } } @@ -1440,7 +2026,11 @@ on_game_start = { enter_realm_event = ep3_emperor_yearly.2000 } set_important_location = { - title = title:e_roman_empire + title = title:h_roman_empire + enter_realm_event = ep3_emperor_yearly.2000 + } + set_important_location = { + title = title:h_eastern_roman_empire enter_realm_event = ep3_emperor_yearly.2000 } } @@ -1450,7 +2040,11 @@ on_game_start = { enter_realm_event = ep3_emperor_yearly.2000 } set_important_location = { - title = title:e_roman_empire + title = title:h_roman_empire + enter_realm_event = ep3_emperor_yearly.2000 + } + set_important_location = { + title = title:h_eastern_roman_empire enter_realm_event = ep3_emperor_yearly.2000 } } @@ -1460,7 +2054,11 @@ on_game_start = { enter_realm_event = ep3_emperor_yearly.2000 } set_important_location = { - title = title:e_roman_empire + title = title:h_roman_empire + enter_realm_event = ep3_emperor_yearly.2000 + } + set_important_location = { + title = title:h_eastern_roman_empire enter_realm_event = ep3_emperor_yearly.2000 } } @@ -1470,7 +2068,11 @@ on_game_start = { enter_realm_event = ep3_emperor_yearly.2000 } set_important_location = { - title = title:e_roman_empire + title = title:h_roman_empire + enter_realm_event = ep3_emperor_yearly.2000 + } + set_important_location = { + title = title:h_eastern_roman_empire enter_realm_event = ep3_emperor_yearly.2000 } } @@ -1480,7 +2082,11 @@ on_game_start = { enter_realm_event = ep3_emperor_yearly.2000 } set_important_location = { - title = title:e_roman_empire + title = title:h_roman_empire + enter_realm_event = ep3_emperor_yearly.2000 + } + set_important_location = { + title = title:h_eastern_roman_empire enter_realm_event = ep3_emperor_yearly.2000 } } @@ -1490,7 +2096,11 @@ on_game_start = { enter_realm_event = ep3_emperor_yearly.2000 } set_important_location = { - title = title:e_roman_empire + title = title:h_roman_empire + enter_realm_event = ep3_emperor_yearly.2000 + } + set_important_location = { + title = title:h_eastern_roman_empire enter_realm_event = ep3_emperor_yearly.2000 } } @@ -1500,7 +2110,11 @@ on_game_start = { enter_realm_event = ep3_emperor_yearly.2000 } set_important_location = { - title = title:e_roman_empire + title = title:h_roman_empire + enter_realm_event = ep3_emperor_yearly.2000 + } + set_important_location = { + title = title:h_eastern_roman_empire enter_realm_event = ep3_emperor_yearly.2000 } } @@ -1510,7 +2124,11 @@ on_game_start = { enter_realm_event = ep3_emperor_yearly.2000 } set_important_location = { - title = title:e_roman_empire + title = title:h_roman_empire + enter_realm_event = ep3_emperor_yearly.2000 + } + set_important_location = { + title = title:h_eastern_roman_empire enter_realm_event = ep3_emperor_yearly.2000 } } @@ -1520,7 +2138,11 @@ on_game_start = { enter_realm_event = ep3_emperor_yearly.2000 } set_important_location = { - title = title:e_roman_empire + title = title:h_roman_empire + enter_realm_event = ep3_emperor_yearly.2000 + } + set_important_location = { + title = title:h_eastern_roman_empire enter_realm_event = ep3_emperor_yearly.2000 } } @@ -1530,7 +2152,11 @@ on_game_start = { enter_realm_event = ep3_emperor_yearly.2000 } set_important_location = { - title = title:e_roman_empire + title = title:h_roman_empire + enter_realm_event = ep3_emperor_yearly.2000 + } + set_important_location = { + title = title:h_eastern_roman_empire enter_realm_event = ep3_emperor_yearly.2000 } } @@ -1540,7 +2166,11 @@ on_game_start = { enter_realm_event = ep3_emperor_yearly.2000 } set_important_location = { - title = title:e_roman_empire + title = title:h_roman_empire + enter_realm_event = ep3_emperor_yearly.2000 + } + set_important_location = { + title = title:h_eastern_roman_empire enter_realm_event = ep3_emperor_yearly.2000 } } @@ -1550,7 +2180,11 @@ on_game_start = { enter_realm_event = ep3_emperor_yearly.2000 } set_important_location = { - title = title:e_roman_empire + title = title:h_roman_empire + enter_realm_event = ep3_emperor_yearly.2000 + } + set_important_location = { + title = title:h_eastern_roman_empire enter_realm_event = ep3_emperor_yearly.2000 } } @@ -1560,7 +2194,11 @@ on_game_start = { enter_realm_event = ep3_emperor_yearly.2000 } set_important_location = { - title = title:e_roman_empire + title = title:h_roman_empire + enter_realm_event = ep3_emperor_yearly.2000 + } + set_important_location = { + title = title:h_eastern_roman_empire enter_realm_event = ep3_emperor_yearly.2000 } } @@ -1570,7 +2208,11 @@ on_game_start = { enter_realm_event = ep3_emperor_yearly.2000 } set_important_location = { - title = title:e_roman_empire + title = title:h_roman_empire + enter_realm_event = ep3_emperor_yearly.2000 + } + set_important_location = { + title = title:h_eastern_roman_empire enter_realm_event = ep3_emperor_yearly.2000 } } @@ -1580,7 +2222,11 @@ on_game_start = { enter_realm_event = ep3_emperor_yearly.2000 } set_important_location = { - title = title:e_roman_empire + title = title:h_roman_empire + enter_realm_event = ep3_emperor_yearly.2000 + } + set_important_location = { + title = title:h_eastern_roman_empire enter_realm_event = ep3_emperor_yearly.2000 } } @@ -1590,7 +2236,11 @@ on_game_start = { enter_realm_event = roman_restoration.1200 } set_important_location = { - title = title:e_roman_empire + title = title:h_roman_empire + enter_realm_event = roman_restoration.1200 + } + set_important_location = { + title = title:h_eastern_roman_empire enter_realm_event = roman_restoration.1200 } } @@ -1615,10 +2265,10 @@ on_game_start = { else = { add_county_modifier = mpo_siberian_permafrost_modifier_bad } - + } } - + # Byzantine name game rule title:e_byzantium = { if = { @@ -1631,7 +2281,7 @@ on_game_start = { limit = { has_game_rule = roman_empire_name_of_byzantium } - set_title_name = e_roman_empire + set_title_name = h_roman_empire } else_if = { limit = { @@ -1659,24 +2309,167 @@ on_game_start = { } } - # Admin - Let's give existing governors the Governor trait on game start - every_independent_ruler = { - limit = { government_allows = administrative } - every_vassal = { - limit = { - is_governor = yes - NOT = { has_trait = governor } - } - add_trait = governor - add_trait_xp = { - trait = governor - value = { - add = primary_title.title_held_years - multiply = 2 + # Remove Coronation Doctrine if you don't have the DLC + if = { + limit = { + has_ach_dlc_trigger = no + } + every_religion_global = { + every_faith = { + switch = { + trigger = has_doctrine + doctrine_no_anointment = { remove_doctrine = doctrine_no_anointment } + doctrine_anointment_permitted = { remove_doctrine = doctrine_anointment_permitted } + doctrine_imperial_anointment = { remove_doctrine = doctrine_imperial_anointment } } } } } + + # Set Coronation laws for everyone + if = { + limit = { + has_ach_dlc_trigger = yes + } + every_ruler = { + limit = { + coronation_trigger = yes + age >= 12 + NOT = { this = character:1316 } # Heinrich IV was coronated in 1084 + } + save_temporary_scope_as = ruler + if = { + limit = { + highest_held_title_tier > tier_kingdom + NOT = { + has_any_shunned_or_criminal_trait_in_faith_trigger = { + CHARACTER = scope:ruler + FAITH = scope:ruler.faith + } + faith = { has_doctrine = doctrine_no_anointment } + } + } + if = { + limit = { + NOT = { + has_game_rule = coronation_laws_off + has_realm_law = crowned_emperor + } + } + add_realm_law_skip_effects = crowned_emperor + } + set_variable = crowned_emperor_var + } + else = { + if = { + limit = { + NOT = { + has_game_rule = coronation_laws_off + has_realm_law = crowned_king + } + } + add_realm_law_skip_effects = crowned_king + } + set_variable = crowned_king_var + } + } + } + + # TGP: extra legitimacy for the Hegemon, so you don't fold over immediately + if = { + limit = { has_tgp_dlc_trigger = yes } + title:h_china.holder = { + # and even more for the Song, as they were in a pretty good shape on our start dates + if = { + limit = { + situation:dynastic_cycle ?= { + OR = { + situation_current_phase = situation_dynastic_cycle_phase_stability_expansion + situation_current_phase = situation_dynastic_cycle_phase_stability_advancement + } + } + } + add_legitimacy = 4500 + } + else = { + add_legitimacy = 3000 + } + } + } + ### TGP SILK ROAD INNOVATIONS + tgp_silk_road_innovation_setup_effect = yes + + set_global_variable = { + name = natural_disaster_initial_grace_period + years = natural_disaster_initial_grace_period_years + } + + ### TGP Earthquake Regions + add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_europe } + add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_europe_south } + add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_asia } + add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_asia_china } + add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_asia_japan } + add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_asia_minor } + add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_asia_indonesia } + add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_asia_philippines } + add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_asia_sakhalin_hokkaido } + add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_middle_east } + add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_india } + add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_steppe } + add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_siberia } + add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_burma } + add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:custom_arakan_mountains } + add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:custom_bactria } + add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_tibet } + add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_himalaya } + add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_africa } + add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_africa_north_east } + + ### TGP Flood Regions + add_to_global_variable_list = { name = flood_region_list target = geographical_region:amur_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:danube_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:daugava_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:dnieper_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:dniester_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:don_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:elbe_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:ganges_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:garonne_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:godavari_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:guadalquivir_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:guadiana_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:indus_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:irrawaddy_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:kaveri_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:loire_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:lovat_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:mahanadi_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:mekong_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:niger_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:nile_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:pearl_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:po_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:rhine_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:rhone_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:seine_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:tapti_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:tigris_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:vistula_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:volga_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:yangtze_river_region } + add_to_global_variable_list = { name = flood_region_list target = geographical_region:yellow_river_region } + ##### HISTORICAL HOUSE RELATIONS - deliberately placed above blocs + tgp_setup_historical_house_relation_effect = yes + ##### TGP JAPAN ##### + if = { + limit = { has_tgp_dlc_trigger = yes } + ### DYNASTIES + tgp_dynasty_house_name_setup_effect = yes + ### BLOCS + tgp_setup_historical_house_bloc_effect = yes + } + # if = { limit = { title:k_magyar = { @@ -1687,43 +2480,6 @@ on_game_start = { add_title_law = confederation_elective_succession_law } } - #Admin - generate families - every_independent_ruler = { - limit = { has_government = administrative_government } - every_vassal = { - limit = { - has_government = administrative_government - is_house_head = yes - highest_held_title_tier >= tier_duchy - NOR = { - any_held_title = { is_noble_family_title = yes } - house = { - any_house_member = { - any_held_title = { is_noble_family_title = yes } - } - } - } - } - } - create_noble_family_effect = yes - domicile ?= { set_up_domicile_estate_effect = yes } - } - create_noble_family_effect = yes - domicile ?= { set_up_domicile_estate_effect = yes } - } - every_independent_ruler = { - limit = { has_government = republic_government tier = tier_duchy } - every_vassal = { - limit = { - tier = tier_duchy - has_government = republic_government - } - create_noble_family_effect = yes - domicile ?= { set_up_domicile_estate_effect = yes } - } - create_noble_family_effect = yes - domicile ?= { set_up_domicile_estate_effect = yes } - } } } @@ -1926,7 +2682,7 @@ on_game_start_after_lobby = { has_mpo_dlc_trigger = yes has_game_rule = sahel_nomad_region_on } - start_situation = { + start_situation = { type = game_rule_extra_nomads_sahel start_phase = situation_steppe_severe_drought_season save_scope_as = my_situation @@ -1982,14 +2738,14 @@ on_game_start_after_lobby = { } } } - } + } #Horn of Africa if = { limit = { has_mpo_dlc_trigger = yes has_game_rule = horn_of_africa_nomad_region_on } - start_situation = { + start_situation = { type = game_rule_extra_nomads_horn start_phase = situation_steppe_severe_drought_season save_scope_as = my_situation @@ -2037,8 +2793,18 @@ on_game_start_after_lobby = { } } } - } - every_ruler = { + } + ### INITIAL BUDGET CALC, ONE MORE AFTER THE EVERY_RULER ASSIGNS PROVINCE TYPES ### + if = { + limit = { + exists = title:h_china.holder + has_tgp_dlc_trigger = yes + } + title:h_china.holder ?= { + enact_treasury_budgets_init = yes + } + } + every_ruler = { # PUT EVERY_RULER TYPE STUFF HERE FOR PERFORMANCE REASONS ### Every nomad in the Steppe Region gets their yurt domicile goodies ### if = { limit = { @@ -2080,6 +2846,22 @@ on_game_start_after_lobby = { } } } + if = { + limit = { + has_mpo_dlc_trigger = yes + has_tgp_dlc_trigger = yes + } + dynasty:1045082 ?= { # Khitan Yelu + every_dynasty_member = { + add_trait = nomadic_philosophy + } + } + dynasty:nn_dyn_shulu ?= { # Khitan Xiao + every_dynasty_member = { + add_trait = nomadic_philosophy + } + } + } switch = { trigger = primary_title.tier tier_county = { @@ -2347,7 +3129,7 @@ on_game_start_after_lobby = { remove_short_term_gold = 5 } # We're fine with them having 10 gold max - + if = { limit = { is_ai = no @@ -2438,6 +3220,1137 @@ on_game_start_after_lobby = { } trigger_event = game_rule.1001 } + + ### CE1 LEGITIMACY SETUP ### + if = { + limit = { + exists = this + has_legitimacy = yes + } + add_legitimacy = base_legitimacy_value + } + + ### MANDALA SETUP ### + if = { + limit = { government_has_flag = government_is_mandala } + + #Triple Mandala's Legitimacy to make them not start at a negative expectation at game start + add_legitimacy = { + value = legitimacy + multiply = 2 + if = { + limit = { + highest_held_title_tier > tier_duchy + } + multiply = 3 + } + else = { multiply = 2 } + } + + #Yer starter kit + change_to_mandala_government_decree_effect = yes + #No Succession for this character pls + set_variable = { + name = not_subject_to_succession_trials + value = flag:started_as_mandala + } + if = { + limit = { var:not_subject_to_succession_trials ?= flag:started_as_mandala } + #To prevent 'unused except in loc' errors :catto: + } + + #Aspect modifiers? + house = { + #Start counting years of peace + if = { + limit = { has_house_head_parameter = peaceful_rule_5_year_modifier } + house_head = { + #Aspect modifier + set_variable = { + name = mandala_house_power_accumulated_increments_of_peace + value = 1 + } + add_character_modifier = { modifier = mandala_increments_of_peace_modifier } + trigger_event = { + id = tgp_east_asia_mandala_events.0200 + years = 5 + } + #Aspect trigger + set_variable = { + name = serenity_mandala_years_of_non_aggression_war + value = 0 + } + trigger_event = { + id = tgp_east_asia_mandala_events.0205 + years = 1 + } + } + } + #Give the initial Creator modifier + if = { + limit = { has_house_head_parameter = creator_10_year_modifier } + house_head = { + set_variable = { + name = mandala_house_power_accumulated_creator + value = 1 + years = 10 + } + hidden_effect = { + mandala_apply_10_year_modifier = yes + } + } + } + } + } + + if = { + limit = { + title:h_china.holder ?= top_liege + this != top_liege + } + ### TGP MERIT AND TREASURY HANDOUT ON GAME START ### + if = { + limit = { + culture = { + has_cultural_pillar = heritage_chinese + } + NOR = { + AND = { + has_council_position = councillor_court_chaplain + NOT = { has_title = title:e_minister_of_rites } + } + has_trait = devoted + } + government_has_flag = government_is_celestial + is_faith_dominant_gender = yes + } + save_temporary_scope_as = exam_contender + hidden_effect = { + assign_completed_exams_based_on_merit_effect = yes + } + if = { + limit = { + any_parent = { + OR = { + has_trait = ambitious + has_trait = scholar + has_trait = diligent + has_trait = confucian_education + } + } + NOR = { + has_trait = lazy + has_trait = dull + has_trait = intellect_bad + location.county ?= { + development_level <= bad_development_level + } + } + } + add_character_flag = passed_child_exam + } + if = { # We adjust Merit depending on the dynastic cycle phase + limit = { + situation:dynastic_cycle ?= { + situation_current_phase = situation_dynastic_cycle_phase_stability_advancement + } + } + change_merit = { + value = merit + multiply = 0.1 + } + } + if = { + limit = { + is_ai = no + is_governor_or_admin_count = yes + } + spawn_celestial_governance_contract_effect = yes + } + if = { + limit = { + game_start_date = 867.1.1 + } + title:k_hebei.holder = { + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + } + } + } + title:k_youji.holder = { + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + } + } + } + title:k_daibei.holder = { + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + } + } + } + title:k_guannei.holder = { + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + } + } + } + title:k_viet.holder = { + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + } + } + } + title:k_lingxi.holder = { + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + } + } + } + } + else_if = { + limit = { + game_start_date = 1066.9.15 + } + title:k_hebei.holder = { + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + } + } + } + title:k_hedong.holder = { + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + } + } + } + title:k_guannei.holder = { + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + } + } + } + title:k_lingxi.holder = { + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + } + } + } + } + else_if = { + limit = { + game_start_date = 1178.10.1 + } + title:k_huainan.holder = { + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + } + } + } + title:k_shannan.holder = { + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + } + } + } + title:k_xingyuan.holder = { + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + } + } + } + title:k_lingxi.holder = { + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + } + } + } + title:k_xichuan.holder = { + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + every_vassal = { + limit = { + primary_title.tier >= tier_county + } + hidden_effect = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 # Military + } + if = { + limit = { + NOT = { + has_realm_law = celestial_military_appointment_succession_law + } + } + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + } + } + } + } + } + ### Examination pass status and initial wave of governor candidates done after game start, in order to include generated families ### + every_courtier = { + limit = { + is_lowborn = no + culture = { has_cultural_pillar = heritage_chinese } + NOR = { + has_council_position = councillor_court_chaplain + has_trait = devoted + } + government_has_flag = government_is_celestial # courtiers have governments, too! + is_faith_dominant_gender = yes + age >= 30 + static_group_filter = { + group = ai_filter + match = 0.5 + } + } + hidden_effect = { + add_character_flag = passed_provincial_exam + add_character_modifier = { + modifier = tgp_passed_provincial_exam_modifier + } + add_character_flag = passed_metropolitan_exam + add_character_modifier = { + modifier = tgp_passed_metropolitan_exam_modifier + } + change_merit = { + value = county_starting_merit_value + add = age + add = learning + } + } + } + save_scope_as = governor + } + + if = { + limit = { + government_has_flag = government_has_merit + title:h_china.holder != top_liege + } + ### TGP MERITOCRATIC/STEPPE ADMIN SETUP ON GAME START ### + if = { + limit = { + NOR = { + AND = { + has_council_position = councillor_court_chaplain + NOT = { has_title = title:e_minister_of_rites } + } + has_trait = devoted + } + government_has_flag = government_has_merit + is_faith_dominant_gender = yes + } + hidden_effect = { + meritocratic_assign_completed_exams_based_on_merit_effect = yes + } + } + } + + #elder/disciple setup + if = { + limit = { + government_allows = merit + top_overlord != title:h_china.holder + } + if = { + limit = { + top_liege = this + merit_level >= merit_level_expected_kingdom_value + } + add_to_list = elders + } + else_if = { + limit = { + merit_level >= merit_level_expected_duchy_value + } + add_to_list = elders + } + else = { + add_to_list = disciple + } + } + + # Sexualities if game rules are default + if = { + limit = { has_game_rule = sexuality_distribution_default } + if = { + limit = { + is_adult = no + age >= 10 + } + game_rule_sexuality_distribution_reroll_effect = yes + } + + every_courtier_or_guest = { + if = { + limit = { + is_adult = no + age >= 10 + } + game_rule_sexuality_distribution_reroll_effect = yes + } + } + } + } + + if = { + limit = { has_game_rule = sexuality_distribution_default } + every_duchy = { + limit = { + exists = title_capital_county.title_province + } + title_capital_county.title_province = { save_scope_as = pool_province } + # Sexualities for Pool Characters if game rules are default + every_pool_character = { + limit = { + NOT = { is_in_list = pool_characters } + } + province = scope:pool_province + add_to_list = pool_characters + } + } + every_in_list = { + list = pool_characters + if = { + limit = { + is_adult = no + age >= 10 + } + game_rule_sexuality_distribution_reroll_effect = yes + } + } + } + + #elder/disciple setup (continued from above) + every_in_list = { + list = disciple + save_scope_as = disciple + random_in_list = { + list = elders + limit = { + top_liege = scope:disciple.top_liege + eligible_for_elder_trigger = { + DISCIPLE = scope:disciple + } + } + save_scope_as = elder + } + if = { + limit = { + exists = scope:elder + } + random = { + chance = 65 + set_relation_elder = scope:elder + } + } } if = { @@ -2517,15 +4430,16 @@ on_game_start_after_lobby = { limit = { has_game_rule = inversed_gender_equality } game_rule_inversed_gender_equality_effect = yes } + else_if = { + limit = { has_game_rule = lenient_gender_equality } + game_rule_lenient_gender_equality_effect = yes + } ### GAME RULE: SEXUALITY DISTRIBUTION ### if = { limit = { NOT = { has_game_rule = sexuality_distribution_default } } game_rule_sexuality_distribution_effect = yes } - else = { # So that children 10+ starts with a sexuality - child_sexuality_distribution_effect = yes - } ### GAME RULE: SITUATION TOGGLES struggle:iberian_struggle ?= { @@ -2559,7 +4473,7 @@ on_game_start_after_lobby = { } character:83355 = { every_held_title = { - limit = { tier >= tier_county } + title_tier >= county change_title_holder = { holder = character:906 change = scope:title_change @@ -2646,8 +4560,8 @@ on_game_start_after_lobby = { limit = { highest_held_title_tier >= tier_kingdom NOR = { - government_has_flag = government_is_administrative - government_has_flag = government_is_landless_adventurer + government_allows = administrative + is_landed = no } } convert_to_administrative_from_feudalism_game_start_effect = yes @@ -2659,8 +4573,8 @@ on_game_start_after_lobby = { limit = { highest_held_title_tier >= tier_kingdom NOR = { - government_has_flag = government_is_administrative - government_has_flag = government_is_landless_adventurer + government_allows = administrative + is_landed = no } has_trait = august } @@ -2704,6 +4618,78 @@ on_game_start_after_lobby = { if = { limit = { has_multiple_players = no } every_player = { + # TGP + if = { + limit = { + government_has_flag = government_is_wanua + } + add_achievement_global_variable_effect = { + VARIABLE = started_ep4_15_humble_beginnings_achievement + VALUE = yes + } + } + if = { + limit = { + has_title = title:k_chrysanthemum_throne + } + add_achievement_global_variable_effect = { + VARIABLE = started_ep4_03_sword_of_japan_achievement + VALUE = yes + } + } + if = { + limit = { + is_landed = no + tgp_is_any_minister = no + } + add_achievement_global_variable_effect = { + VARIABLE = started_ep4_05_grand_governor_achievement + VALUE = yes + } + } + if = { + limit = { + NAND = { + tgp_passed_children_examination = yes + tgp_passed_provincial_examination = yes + tgp_passed_metropolitan_examination = yes + tgp_passed_palace_examination = yes + } + } + add_achievement_global_variable_effect = { + VARIABLE = started_ep4_16_flying_colors_achievement + VALUE = yes + } + } + if = { + limit = { + NOT = { + culture = { + any_known_innovation = { + has_innovation_parameter = silk_road_innovation_parameter + } + } + } + } + add_achievement_global_variable_effect = { + VARIABLE = started_ep4_17_highway_of_ideas_achievement + VALUE = yes + } + } + if = { + limit = { + NOR = { + tgp_passed_children_examination = yes + tgp_passed_provincial_examination = yes + tgp_passed_metropolitan_examination = yes + tgp_passed_palace_examination = yes + } + } + add_achievement_global_variable_effect = { + VARIABLE = started_ep4_19_stamp_of_approval_achievement + VALUE = yes + } + } # Base Title if = { limit = { @@ -3091,7 +5077,7 @@ on_game_start_after_lobby = { ##12 Turkish Eagle if = { limit = { - NOT = { this = character:3040 } # Not Alp Arslan + this != character:3040 # Not Alp Arslan house = house:house_seljuk # Seljuk game_start_date < 1067.1.1 # 1066 only, and no Seljuks in 867 } @@ -3983,7 +5969,80 @@ on_game_start_after_lobby = { } } } - + #set up cultural acceptance between China and East Asian Empires to aid in the learning of Chinese effect for on_birthday_adulthood + + if = { + limit = { game_start_date = 867.1.1 } + culture:japanese = { + change_cultural_acceptance = { + target = culture:han + value = 80 + desc = cultural_acceptance_historical_relations + } + } + culture:goguryeo = { + change_cultural_acceptance = { + target = culture:han + value = 80 + desc = cultural_acceptance_historical_relations + } + } + culture:silla = { + change_cultural_acceptance = { + target = culture:han + value = 80 + desc = cultural_acceptance_historical_relations + } + } + culture:baekje = { + change_cultural_acceptance = { + target = culture:han + value = 80 + desc = cultural_acceptance_historical_relations + } + } + culture:balhae = { + change_cultural_acceptance = { + target = culture:han + value = 80 + desc = cultural_acceptance_historical_relations + } + } + } + if = { + limit = { game_start_date = 1066.9.15 } + culture:japanese = { + change_cultural_acceptance = { + target = culture:han + value = 70 + desc = cultural_acceptance_historical_relations + } + } + culture:goryeo = { + change_cultural_acceptance = { + target = culture:han + value = 70 + desc = cultural_acceptance_historical_relations + } + } + } + if = { + limit = { game_start_date = 1178.10.1 } + culture:japanese = { + change_cultural_acceptance = { + target = culture:han + value = 60 + desc = cultural_acceptance_historical_relations + } + } + culture:goryeo = { + change_cultural_acceptance = { + target = culture:han + value = 60 + desc = cultural_acceptance_historical_relations + } + } + } # Specific innovation unlock if = { @@ -4014,13 +6073,6 @@ on_game_start_after_lobby = { } } } - ### CE1 LEGITIMACY SETUP ### - every_ruler = { - limit = { - has_legitimacy = yes - } - add_legitimacy = base_legitimacy_value - } if = { # Special historical events for Matilda! limit = { @@ -4085,7 +6137,7 @@ on_game_start_after_lobby = { ### EP3 LAAMP SETUP ### # Resources. every_independent_ruler = { - limit = { is_landless_adventurer = yes } + limit = { has_government = landless_adventurer_government } # Cash. add_gold = { value = { @@ -4174,7 +6226,7 @@ on_game_start_after_lobby = { if = { limit = { is_alive = yes - is_landless_adventurer = yes + has_government = landless_adventurer_government } add_realm_law_skip_effects = camp_purpose_mercenaries if = { @@ -4208,7 +6260,7 @@ on_game_start_after_lobby = { if = { limit = { is_alive = yes - is_landless_adventurer = yes + has_government = landless_adventurer_government } add_realm_law_skip_effects = camp_purpose_mercenaries } @@ -4218,7 +6270,7 @@ on_game_start_after_lobby = { if = { limit = { is_alive = yes - is_landless_adventurer = yes + has_government = landless_adventurer_government } add_realm_law_skip_effects = camp_purpose_scholars } @@ -4228,7 +6280,7 @@ on_game_start_after_lobby = { if = { limit = { is_alive = yes - is_landless_adventurer = yes + has_government = landless_adventurer_government } add_realm_law_skip_effects = camp_purpose_mercenaries trigger_event = bookmark.1073 # Suleyman's beef with Alp Arslan @@ -4239,7 +6291,7 @@ on_game_start_after_lobby = { if = { limit = { is_alive = yes - is_landless_adventurer = yes + has_government = landless_adventurer_government } add_realm_law_skip_effects = camp_purpose_scholars trigger_event = ep3_story_cycle_violet_poet.0001 @@ -4250,7 +6302,7 @@ on_game_start_after_lobby = { if = { limit = { is_alive = yes - is_landless_adventurer = yes + has_government = landless_adventurer_government } add_realm_law_skip_effects = camp_purpose_mercenaries } @@ -4260,11 +6312,274 @@ on_game_start_after_lobby = { if = { limit = { is_alive = yes - is_landless_adventurer = yes + has_government = landless_adventurer_government } add_realm_law_skip_effects = camp_purpose_mercenaries } } + ## Prince Takaoka (Shinnyo) + character:japanese_yamato_181 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_scholars + # and because history in character file does not work... + character:japanese_lowborn_1 = { set_employer = character:japanese_yamato_181 } # Anten + character:japanese_lowborn_2 = { set_employer = character:japanese_yamato_181 } # Enkaku + character:japanese_lowborn_3 = { set_employer = character:japanese_yamato_181 } # Akimaru + } + } + ## Ding Hui + character:ding_hui_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_mercenaries + } + } + ## Liang Zhu Quanzhong + character:liang_zhu_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_mercenaries + } + } + ## Miyoshi Kiyotsura + character:miyoshi_kiyotsura_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_scholars + } + } + ## Yang-kil + character:yang_kil_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_brigands + } + } + ## Yŏn'gi Tosŏn + character:toson_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_scholars + } + } + ## Lý Do Độc + character:ly_do_doc_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_mercenaries + } + } + ## Song Jiang + character:song_jiang_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_mercenaries + } + } + ## Yang Zongbao + character:yang_zongbao_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_mercenaries + } + } + character:furong_daokai_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_scholars + } + } + character:jojin_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_scholars + } + } + character:isawa_no_saburo_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_mercenaries + } + } + character:tsukushi_no_koretaka_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_brigands + } + } + character:kim_mu_che_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_scholars + } + } + character:baekho_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_brigands + } + } + character:khong_lo_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_scholars + } + } + character:nga_yamankan_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_mercenaries + } + } + character:mpu_bharada_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_scholars + } + } + character:wang_chuyi_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_scholars + } + } + character:jiang_kui_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_scholars + } + } + character:lembong_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_brigands + } + } + character:zhu_zhongba_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_explorers + } + } + character:quach_boc_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_mercenaries + } + } + character:bojo_jinul_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_scholars + } + } + character:gochi_in_no_tajima_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_mercenaries + } + } + character:shin_capata_1 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_scholars + } + } + ## Yoshitsune Minamoto + character:japanese_minamoto_seiwa_139 ?= { + if = { + limit = { + is_alive = yes + has_government = landless_adventurer_government + } + add_realm_law_skip_effects = camp_purpose_mercenaries + every_courtier = { + limit = { dynasty = character:japanese_minamoto_seiwa_139.dynasty } + set_employer = character:japanese_minamoto_seiwa_10 # Yoritomo + } + add_courtier = character:japanese_musashibo_1 # Benkei + add_courtier = character:japanese_ise_2_1 # Yoshimori + } + } every_independent_ruler = { if = { limit = { is_landless_adventurer = yes } @@ -4342,11 +6657,391 @@ on_game_start_after_lobby = { } } } - set_color_from_title = scope:nf_holder.capital_county } } } } + ### TGP SETUP ### + if = { + limit = { has_tgp_dlc_trigger = yes } + ### JAPAN + + # Special variable that UI uses to display correct title + title:e_japan = { + # More starting house relations + holder = { + every_noble_family = { + holder.house ?= { + save_temporary_scope_as = house_temp + every_house_member = { + limit = { + is_married = yes + exists = primary_spouse.house + NOT = { + primary_spouse.house = { has_house_relation_with = scope:house_temp } + } + } + save_temporary_scope_as = member_temp + primary_spouse = { save_temporary_scope_as = spouse_temp } + house = { + change_house_relation_effect = { + HOUSE = scope:member_temp.primary_spouse.house + VALUE = house_relation_improve_minor_value + REASON = preexisting_marriage + CHAR = scope:member_temp + TARGET_CHAR = scope:spouse_temp + TITLE = scope:dummy_gender + } + } + } + } + } + } + } + + ### IMPERIAL FAMILY + title:k_chrysanthemum_throne.holder ?= { + save_scope_as = japanese_emperor + # Give him some cash + add_gold = monumental_gold_value + house = { + # ENSURE MEMBERS REMAIN IN COURT OF EMPEROR + every_house_member = { + limit = { + is_ruler = no + is_married = no + NOT = { liege = scope:japanese_emperor } + } + save_scope_as = imperial_family_member + scope:japanese_emperor = { add_courtier = scope:imperial_family_member } + } + } + # GET THOSE ROOKIE NUMBERS UP + dynasty = { + while = { + limit = { dynasty_prestige_level < high_dynasty_prestige_level } + add_dynasty_prestige_level = 1 + } + } + } + + ### DYNASTY TRACKING SETUP + japan_dynasty_tracker_setup_effect = yes + + + ### TGP NOBLE FAMILIES & DOMICILE SETUP ### + # Required due to landless top liege + title:e_japan.holder ?= { + add_realm_law_skip_effects = japanese_bureaucracy_1 + noble_family_title_realm_setup_effect = yes + every_vassal_or_below = { # Move Soryo domiciles to their own realm + limit = { + government_has_flag = government_is_japan_feudal + } + domicile ?= { move_domicile = owner.capital_province } + } + every_vassal_or_below = { # Move Ritsuryo domiciles to the capital + limit = { + government_has_flag = government_is_japan_administrative + } + domicile ?= { move_domicile = title:e_japan.holder.capital_province } + } + } + + + ### MANDALA + + #Starting Mandala Temple Complexes + #Dvaravati + province:10822 = { + add_great_building = mandala_capital_01 + if = { + limit = { + game_start_date >= 1066.1.1 + } + ruin_great_building = yes + } + add_to_global_variable_list = { # Add to list so it can be found by the PoI + name = mandala_poi_list + target = this + } + } + #Haripunjaya + province:11441 = { + add_great_building = mandala_capital_01 + add_to_global_variable_list = { # Add to list so it can be found by the PoI + name = mandala_poi_list + target = this + } + } + #Pagan + province:9550 = { + if = { + limit = { + game_start_date < 1066.1.1 + } + add_great_building = mandala_capital_01 + } + else_if = { + limit = { game_start_date >= 1066.1.1 } + add_great_building = mandala_capital_02 + } + add_to_global_variable_list = { # Add to list so it can be found by the PoI + name = mandala_poi_list + target = this + } + } + #Angkor + province:10816 = { + if = { + limit = { + game_start_date < 1066.1.1 + } + add_great_building = mandala_capital_01 + } + else_if = { + limit = { game_start_date >= 1066.1.1 } + add_great_building = mandala_capital_02 + } + else = { + add_great_building = mandala_capital_03 + } + add_to_global_variable_list = { # Add to list so it can be found by the PoI + name = mandala_poi_list + target = this + } + } + #Srivijaya/Palembang + province:11296 = { + add_great_building = mandala_capital_02 + if = { + limit = { + game_start_date >= 1066.1.1 + } + ruin_great_building = yes #Could also be completely destroyed - almost nothing left today + } + add_to_global_variable_list = { # Add to list so it can be found by the PoI + name = mandala_poi_list + target = this + } + } + #Mataram + #Prambanan + province:11343 = { + add_great_building = mandala_capital_01 + if = { + limit = { + game_start_date >= 1066.1.1 + } + ruin_great_building = yes + } + add_to_global_variable_list = { # Add to list so it can be found by the PoI + name = mandala_poi_list + target = this + } + } + #Champa + #Indrapura + province:10830 = { + if = { + limit = { + game_start_date < 1066.1.1 + } + add_great_building = mandala_capital_01 + add_to_global_variable_list = { # Add to list so it can be found by the PoI + name = mandala_poi_list + target = this + } + } + } + #Vijaya + province:10827 = { + if = { + limit = { game_start_date >= 1066.1.1 } + add_great_building = mandala_capital_01 + add_to_global_variable_list = { # Add to list so it can be found by the PoI + name = mandala_poi_list + target = this + } + } + } + #Apply the Godking AI story to Maharajas with a temple + every_independent_ruler = { + limit = { government_has_flag = government_is_mandala } + if = { + limit = { + is_ai = yes + highest_held_title_tier >= tier_kingdom + has_mandala_capital_trigger = yes + trigger_if = { + limit = { has_ruined_mandala_capital_trigger = yes } + less_than_max_amount_of_mandala_capitals_trigger = yes + } + } + create_story = story_mandala + } + } + } + ### TGP MERIT AND TREASURY HANDOUT ON GAME START ### + if = { + limit = { + has_tgp_dlc_trigger = yes + } + title:h_china.holder ?= { + # If the hegemon is from the ruler designer, let's ensure we got decent starting values + if = { + limit = { + is_from_ruler_designer = yes + } + if = { + limit = { # If we don't have enough legitimacy, let's increase it + legitimacy < legitimacy_level_3 + } + add_legitimacy = { + value = legitimacy_level_3 + add = 100 # To provide a margin and not drop down a level too quickly + subtract = legitimacy + } + } + if = { + limit = { # If the royal court is enabled, set it to a decent default + has_royal_court = yes + } + set_current_court_grandeur = court_grandeur_minimum_expected + } + # Let's add some starting currencies + add_prestige = 1000 + add_piety = 500 + change_influence = 1000 + dynasty ?= { add_dynasty_prestige = 500 } + } + # Set Grand Chancellor as Chinese diarchy + try_start_diarchy = grand_secretariat + } + } + ### TGP KOREA SETUP + if = { + # Special variable that UI uses to display correct title + limit = { + exists = title:e_goryeo.holder + has_tgp_dlc_trigger = yes + game_start_date >= 1066.1.1 + } + # GORYEO GOVERNORSHIP SETUP + title:d_bukgye = { add_to_temporary_list = goryeo_military_provinces } + title:d_donggye = { add_to_temporary_list = goryeo_military_provinces } + title:d_yukju = { add_to_temporary_list = goryeo_military_provinces } + every_in_list = { + list = goryeo_military_provinces + limit = { + holder ?= { is_governor = yes } + } + holder = { + vassal_contract_set_obligation_level = { + type = meritocratic_provinces + level = meritocratic_province_military + } + add_realm_law_skip_effects = meritocratic_military_appointment_succession_law + } + } + } + else_if = { + limit = { + exists = title:k_silla.holder + has_tgp_dlc_trigger = yes + game_start_date = 867.1.1 + } + # SILLA GOVERNORSHIP SETUP + title:d_bukgye = { add_to_temporary_list = silla_military_provinces } + title:d_donggye = { add_to_temporary_list = silla_military_provinces } + title:d_yukju = { add_to_temporary_list = silla_military_provinces } + every_in_list = { + list = silla_military_provinces + limit = { + holder ?= { is_governor = yes } + } + holder = { + vassal_contract_set_obligation_level = { + type = meritocratic_provinces + level = meritocratic_province_military + } + add_realm_law_skip_effects = meritocratic_military_appointment_succession_law + } + } + } + ### TGP JAPAN SETUP + if = { + limit = { + exists = title:e_japan.holder + has_tgp_dlc_trigger = yes + } + title:c_chikuzen ?= { # Dazaifu + if = { + limit = { + holder ?= { is_governor = yes } + } + holder = { + vassal_contract_set_obligation_level = { + type = japan_administrative_provinces + level = japan_administrative_province_trade + } + } + } + } + title:d_hitakami ?= { add_to_temporary_list = japan_military_provinces } # Mutsu + title:d_nushiro ?= { add_to_temporary_list = japan_military_provinces } # Dewa + every_in_list = { + list = japan_military_provinces + limit = { + holder ?= { is_governor = yes } + } + holder = { + vassal_contract_set_obligation_level = { + type = japan_administrative_provinces + level = japan_administrative_province_military + } + add_realm_law_skip_effects = japanese_military_appointment_succession_law + } + } + if = { + limit = { + game_start_date >= 1066.1.1 + game_start_date < 1178.10.1 + } + title:e_japan.holder = { + trigger_event = tgp_japan_career.0001 + every_vassal = { + trigger_event = tgp_japan_career.0001 + } + } + } + } + ##TEACH CHINESE TO RELEVENT NOBLES### + title:e_japan.holder ?= { + add_to_list = holder_to_learn_chinese + } + title:e_goryeo.holder ?= { + add_to_list = holder_to_learn_chinese + } + title:h_china.holder ?= { + every_tributary = { + add_to_list = holder_to_learn_chinese + } + } + every_in_list = { + list = holder_to_learn_chinese + tgp_learn_chinese_effect_game_start = yes + every_noble_family = { + holder ?= { + tgp_learn_chinese_effect_game_start = yes + house = { + every_house_member = { + tgp_learn_chinese_effect_game_start = yes + } + } + } + } + } # Byzantium naming title:e_byzantium = { if = { @@ -4359,7 +7054,7 @@ on_game_start_after_lobby = { limit = { has_game_rule = roman_empire_name_of_byzantium } - set_title_name = e_roman_empire + set_title_name = h_roman_empire } else_if = { limit = { @@ -4406,21 +7101,42 @@ on_game_start_after_lobby = { brewery_counter_start_effect = yes } every_domicile = { - if = { - limit = { - is_domicile_type = estate - exists = owner - } - if = { - limit = { - NOT = { has_domicile_building_or_higher = estate_main_02 } - owner.culture ?= { has_innovation = innovation_city_planning } + limit = { exists = owner } + switch = { + trigger = is_domicile_type + estate = { + if = { + limit = { + NOT = { has_domicile_building_or_higher = estate_main_02 } + owner.culture ?= { has_innovation = innovation_city_planning } + } + add_domicile_building = estate_main_02 + add_random_internal_estate_building = yes } - add_domicile_building = estate_main_02 - add_random_internal_estate_building = yes + fill_external_estate_building_effect = yes + } + japanese_manor = { + if = { + limit = { + NOT = { has_domicile_building_or_higher = japanese_manor_main_02 } + owner.culture ?= { has_innovation = innovation_city_planning } + } + add_domicile_building = japanese_manor_main_02 + add_random_internal_japanese_manor_building = yes + } + fill_external_japanese_manor_building_effect = yes + } + east_asian_estate = { + if = { + limit = { + NOT = { has_domicile_building_or_higher = east_asian_estate_main_02 } + owner.culture ?= { has_innovation = innovation_city_planning } + } + add_domicile_building = east_asian_estate_main_02 + add_random_internal_east_asian_estate_building = yes + } + fill_external_east_asian_estate_building_effect = yes } - - fill_external_estate_building_effect = yes } } } @@ -4613,33 +7329,80 @@ on_game_start_after_lobby = { # } # } #} - if = { - limit = { - is_domicile_type = estate - exists = owner - } - if = { - limit = { - NOT = { has_domicile_building_or_higher = estate_main_02 } - owner.culture ?= { has_innovation = innovation_city_planning } + every_domicile = { + limit = { exists = owner } + switch = { + trigger = is_domicile_type + estate = { + if = { + limit = { + NOT = { has_domicile_building_or_higher = estate_main_02 } + owner.culture ?= { has_innovation = innovation_city_planning } + } + add_domicile_building = estate_main_02 + add_random_internal_estate_building = yes + } + if = { + limit = { + has_domicile_building = estate_main_02 + NOT = { has_domicile_building_or_higher = estate_main_03 } + owner.culture ?= { has_innovation = innovation_manorialism } + } + add_domicile_building = estate_main_03 + while = { + count = 2 + add_random_internal_estate_building = yes + } + } + fill_external_estate_building_effect = yes } - add_domicile_building = estate_main_02 - add_random_internal_estate_building = yes - } - if = { - limit = { - has_domicile_building = estate_main_02 - NOT = { has_domicile_building_or_higher = estate_main_03 } - owner.culture ?= { has_innovation = innovation_manorialism } + japanese_manor = { + if = { + limit = { + NOT = { has_domicile_building_or_higher = japanese_manor_main_02 } + owner.culture ?= { has_innovation = innovation_city_planning } + } + add_domicile_building = japanese_manor_main_02 + add_random_internal_japanese_manor_building = yes + } + if = { + limit = { + has_domicile_building = japanese_manor_main_02 + NOT = { has_domicile_building_or_higher = japanese_manor_main_03 } + owner.culture ?= { has_innovation = innovation_manorialism } + } + add_domicile_building = japanese_manor_main_03 + while = { + count = 2 + add_random_internal_japanese_manor_building = yes + } + } + fill_external_japanese_manor_building_effect = yes } - add_domicile_building = estate_main_03 - while = { - count = 2 - add_random_internal_estate_building = yes + east_asian_estate = { + if = { + limit = { + NOT = { has_domicile_building_or_higher = east_asian_estate_main_02 } + owner.culture ?= { has_innovation = innovation_city_planning } + } + add_domicile_building = east_asian_estate_main_02 + add_random_internal_east_asian_estate_building = yes + } + if = { + limit = { + has_domicile_building = east_asian_estate_main_02 + NOT = { has_domicile_building_or_higher = east_asian_estate_main_03 } + owner.culture ?= { has_innovation = innovation_manorialism } + } + add_domicile_building = east_asian_estate_main_03 + while = { + count = 2 + add_random_internal_east_asian_estate_building = yes + } + } + fill_external_east_asian_estate_building_effect = yes } } - - fill_external_estate_building_effect = yes } } } @@ -4652,7 +7415,10 @@ on_game_start_after_lobby = { save_temporary_scope_as = this_ruler every_held_title = { limit = { - has_title_law = noble_family_succession_law + is_noble_family_title = yes + title_domicile ?= { + is_domicile_type = estate + } } scope:this_ruler = { destroy_title = prev @@ -4661,6 +7427,63 @@ on_game_start_after_lobby = { } } + ##### GENPEI WAR + ### 1178 - MINATOMO YORITOMO ### + if = { + limit = { + character:japanese_minamoto_seiwa_10 ?= { is_alive = yes } + } + character:japanese_minamoto_seiwa_10 ?= { trigger_event = tgp_genpei_character.1000 } + } + ### 1178 - MINATOMO YOSHINAKA ### + if = { + limit = { + character:japanese_minamoto_seiwa_207 ?= { is_alive = yes } + } + character:japanese_minamoto_seiwa_207 = { trigger_event = tgp_genpei_character.1090 } + } + ### 1178 - MINATOMO YOSHITSUNE ### + if = { + limit = { + character:japanese_minamoto_seiwa_139 ?= { is_alive = yes } + } + character:japanese_minamoto_seiwa_139 = { trigger_event = tgp_genpei_character.1100 } + } + ### 1178 - TAIRA KIYOMORI ### + if = { + limit = { + character:japanese_taira_kanmu_34 ?= { is_alive = yes } + } + character:japanese_taira_kanmu_34 = { + trigger_event = tgp_genpei_character.2000 + trigger_event = { #Delayed event + id = tgp_genpei_character.2010 + months = 6 + } + } + } + ### 1178 - FUJIWARA MOTOFUSA ### + if = { + limit = { + character:japanese_fujiwara_511 ?= { is_alive = yes } + } + character:japanese_fujiwara_511 = { trigger_event = tgp_genpei_character.3000 } + } + ### 1178 - FUJIWARA HIDEHIRA ### + if = { + limit = { + character:japanese_fujiwara_497 ?= { is_alive = yes } + } + character:japanese_fujiwara_497 = { trigger_event = tgp_genpei_character.3100 } + } + ### 1178 - EMPEROR GO-SHIRAKAWA ### + if = { + limit = { + character:japanese_yamato_51 ?= { is_alive = yes } + } + character:japanese_yamato_51 = { trigger_event = tgp_genpei_character.4000 } + } + every_county_in_region = { region = world_steppe limit = { @@ -4738,7 +7561,7 @@ on_game_start_after_lobby = { create_story = story_conqueror } } - + every_player = { limit = { is_landed = yes @@ -4764,7 +7587,7 @@ on_game_start_after_lobby = { after_creation = { random_list = { 200 = { - # Character is of average weight, nothing happens + # Character is of average weight, nothing happens } 25 = { change_current_weight = -25 @@ -4796,7 +7619,7 @@ on_game_start_after_lobby = { after_creation = { random_list = { 200 = { - # Character is of average weight, nothing happens + # Character is of average weight, nothing happens } 25 = { change_current_weight = -25 @@ -4829,11 +7652,26 @@ on_game_start_after_lobby = { run_setup_tests_effect = yes } set_global_variable = game_has_started + + every_independent_ruler = { + # Border War Law setup + if = { + limit = { + has_realm_law_flag = top_liege_not_redirected_to_border_wars_law + } + primary_title = { + set_vassal_wars_are_redirected_to_holder = no + } + } + # Treasury setup for any government using treasury + tgp_treasury_setup_effect = yes + } } events = { game_rule.1011 #Hungarian Migration management. historical_artifacts.0023 # Historical Artifacts Generator + coronation_events.0302 # ACH crown giveaway } } diff --git a/N3OW/common/on_action/title_on_actions.txt b/N3OW/common/on_action/title_on_actions.txt index 4eae4e9d..9b6ce296 100644 --- a/N3OW/common/on_action/title_on_actions.txt +++ b/N3OW/common/on_action/title_on_actions.txt @@ -27,16 +27,26 @@ # scope:landed_title = the title that is being destroyed # Does *not* provide scope:transfer_type on_title_destroyed = { - events = { - british_isles.1031 # Danelaw-England partition calc. - } - effect = { - scope:landed_title = { - every_claimant = { remove_claim = prev } # remove existing claims + # If the title of an independent admin ruler is destroyed, let's make sure we handle any stray admin vassals + if = { + limit = { + government_allows = administrative + top_liege = this + administrative_counts_can_be_independent = no + NOT = { + any_held_title = { + title_tier >= kingdom + + this != scope:landed_title + is_noble_family_title = no + } + } + } + admin_change_government_effect = yes } # Adjust the size of the laamps tally. - if = { + else_if = { limit = { # Pre-filter out anything higher or lower. scope:landed_title = { tier = tier_duchy } @@ -49,12 +59,12 @@ on_title_destroyed = { } } #Notify folks the latin empire has fallen - if = { + else_if = { limit = { scope:landed_title = title:e_latin_empire } frankokratia_latin_emp_end_msg_effect = yes } #Create byz collapse variable that defines anarchy period - if = { + else_if = { limit = { scope:landed_title = { this = title:e_byzantium @@ -73,22 +83,106 @@ on_title_destroyed = { add = 100 } } + # Silk Road prosperity gets hit if Byzantium dies + tgp_silk_road_byzantium_destroyed_effect = yes } - - # If the title of an independent admin ruler is destroyed, let's make sure we handle any stray admin vassals - if = { + else_if = { limit = { - government_has_flag = government_is_administrative - is_independent_ruler = yes - NOT = { - any_held_title = { - tier > tier_duchy - NOT = { this = scope:landed_title } - is_noble_family_title = no + scope:landed_title = title:h_china + } + situation:dynastic_cycle ?= { + if = { + limit = { + situation_top_has_catalyst = catalyst_hegemon_lost_mandate_of_heaven + } + trigger_situation_catalyst = { + catalyst = catalyst_hegemon_lost_mandate_of_heaven + character = root } } } - admin_change_government_effect = yes + every_vassal = { + # Because a change in liege isn't triggered when the title being destroyed + if = { + limit = { + government_has_flag = government_is_celestial + highest_held_title_tier >= tier_kingdom + primary_title = { + has_custom_title_name = no + } + tgp_capital_not_in_chinese_naming_region = no + } + if = { + limit = { + is_ai = no + } + trigger_event = { + id = tgp_dynastic_cycle.9000 + days = 1 # so the player gets to choose first + } + } + else = { + trigger_event = { + id = tgp_dynastic_cycle.9000 + days = 2 + } + } + } + } + title:h_china = { + reset_title_name = yes + } + } + else_if = { # Danelaw-England partition calc. + limit = { + # Partition must be active. + exists = global_var:partition_active_danelaw + # And the destroyed title must be one of the two partitioned entities. + OR = { + scope:landed_title = title:k_england + scope:landed_title = title:k_danelaw + } + } + # If k_england has been destroyed, set k_danelaw as the de jure inheritor. + if = { + limit = { scope:landed_title = title:k_england } + title:k_danelaw = { save_scope_as = partition_winner } + # Try to grab the old holder for down the line. + if = { + limit = { + exists = this + is_alive = yes + } + save_scope_as = loser + } + } + # If k_danelaw has been destroyed, set k_england as the de jure inheritor. + if = { + limit = { scope:landed_title = title:k_danelaw } + title:k_england = { save_scope_as = partition_winner } + if = { + limit = { + exists = this + is_alive = yes + } + save_scope_as = loser + } + } + # Either way, trigger the maintenance event. + trigger_event = british_isles.1041 + } + # Safety against invalid house bloc members + else_if = { + limit = { + scope:landed_title = { is_noble_family_title = yes } + exists = house.house_confederation + } + house = { + tgp_leave_house_bloc_effect = { + OPINION = flag:no + TRUCE = flag:no + } + } } } } @@ -99,938 +193,2136 @@ on_title_destroyed = { # scope:previous_holder = previous holder. Might be dead on_title_gain = { effect = { - # Nomads - scope:title = { + ###################### + # COUNTY-TIER TITLES # + ###################### + if = { + limit = { + scope:title.tier = tier_county + } + + ########### + # MPO - Nomad Title Handling + ########### if = { limit = { - is_nomad_title = yes - exists = title_domicile - } - if = { - limit = { - root = { - any_held_title = { - is_nomad_title = yes - exists = title_domicile - NOT = { this = scope:title } - } - } - } - if = { - limit = { - root = { - any_held_title = { - is_nomad_title = yes - exists = title_domicile - NOT = { this = scope:title } - exists = var:player_domicile_title - } - } - } - root = { - random_held_title = { - limit = { - is_nomad_title = yes - exists = title_domicile - NOT = { this = scope:title } - exists = var:player_domicile_title - } - title_domicile = { - if = { - limit = { - exists = root.dynasty - scope:previous_holder.dynasty ?= root.dynasty - } - change_herd = { - value = scope:title.title_domicile.herd - } - } - } - root = { - destroy_title = scope:title - } - } - } - } - else_if = { - limit = { - is_nomad_title = yes - exists = title_domicile - exists = var:player_domicile_title - } - root = { - random_held_title = { - limit = { - is_nomad_title = yes - exists = title_domicile - NOT = { this = scope:title } - } - save_scope_as = old_nomad_title_to_clean_up - } - } - title_domicile = { - if = { - limit = { - exists = root.dynasty - scope:previous_holder.dynasty ?= root.dynasty - } - change_herd = { - value = scope:old_nomad_title_to_clean_up.title_domicile.herd - } - } - } - root = { - destroy_title = scope:old_nomad_title_to_clean_up - } - } - else_if = { - limit = { - root = { - any_held_title = { - is_nomad_title = yes - exists = title_domicile - NOT = { this = scope:title } - title_domicile.herd > scope:title.title_domicile.herd - } - } - } - root = { - random_held_title = { - limit = { - is_nomad_title = yes - exists = title_domicile - NOT = { this = scope:title } - title_domicile.herd > scope:title.title_domicile.herd - } - title_domicile = { - if = { - limit = { - exists = root.dynasty - scope:previous_holder.dynasty ?= root.dynasty - } - change_herd = { - value = scope:title.title_domicile.herd - } - } - } - } - destroy_title = scope:title - } - } - else = { - root = { - random_held_title = { - limit = { - is_nomad_title = yes - exists = title_domicile - NOT = { this = scope:title } - } - save_scope_as = old_nomad_title_to_clean_up - } - } - title_domicile = { - if = { - limit = { - exists = root.dynasty - scope:previous_holder.dynasty ?= root.dynasty - } - change_herd = { - value = scope:old_nomad_title_to_clean_up.title_domicile.herd - } - } - } - root = { - destroy_title = scope:old_nomad_title_to_clean_up - } - } - } - if = { - limit = { + scope:title = { + is_nomad_title = yes exists = title_domicile - exists = global_var:game_has_started - NOT = { - exists = previous_holder - } } + } + scope:title = { if = { limit = { root = { - OR = { - house.house_head ?= { - this != root - any_held_title = { - is_nomad_title = yes + any_held_title = { + is_nomad_title = yes + exists = title_domicile + NOT = { this = scope:title } + } + } + } + if = { + limit = { + root = { + any_held_title = { + is_nomad_title = yes + exists = title_domicile + NOT = { this = scope:title } + exists = var:player_domicile_title + } + } + } + root = { + random_held_title = { + limit = { + is_nomad_title = yes + exists = title_domicile + NOT = { this = scope:title } + exists = var:player_domicile_title + } + title_domicile = { + if = { + limit = { + exists = root.dynasty + scope:previous_holder.dynasty ?= root.dynasty + } + change_herd = { + value = scope:title.title_domicile.herd + } } } - dynasty.dynast ?= { - this != root - any_held_title = { - is_nomad_title = yes - } - } - any_close_family_member = { - this != root - any_held_title = { - is_nomad_title = yes - } + root = { + destroy_title = scope:title } } } } - generate_coa = yes # To lessen confusion thinking titles are the same + else_if = { + limit = { + exists = var:player_domicile_title + } + root = { + random_held_title = { + limit = { + is_nomad_title = yes + exists = title_domicile + NOT = { this = scope:title } + } + save_scope_as = old_nomad_title_to_clean_up + } + } + title_domicile = { + if = { + limit = { + exists = root.dynasty + scope:previous_holder.dynasty ?= root.dynasty + } + change_herd = { + value = scope:old_nomad_title_to_clean_up.title_domicile.herd + } + } + } + root = { + destroy_title = scope:old_nomad_title_to_clean_up + } + } + else_if = { + limit = { + root = { + any_held_title = { + is_nomad_title = yes + exists = title_domicile + NOT = { this = scope:title } + title_domicile.herd > scope:title.title_domicile.herd + } + } + } + root = { + random_held_title = { + limit = { + is_nomad_title = yes + exists = title_domicile + NOT = { this = scope:title } + title_domicile.herd > scope:title.title_domicile.herd + } + title_domicile = { + if = { + limit = { + exists = root.dynasty + scope:previous_holder.dynasty ?= root.dynasty + } + change_herd = { + value = scope:title.title_domicile.herd + } + } + } + } + destroy_title = scope:title + } + } + else = { + root = { + random_held_title = { + limit = { + is_nomad_title = yes + exists = title_domicile + NOT = { this = scope:title } + } + save_scope_as = old_nomad_title_to_clean_up + } + } + title_domicile = { + if = { + limit = { + exists = root.dynasty + scope:previous_holder.dynasty ?= root.dynasty + } + change_herd = { + value = scope:old_nomad_title_to_clean_up.title_domicile.herd + } + } + } + root = { + destroy_title = scope:old_nomad_title_to_clean_up + } + } } if = { limit = { - current_year >= 1300 + exists = global_var:game_has_started + NOT = { + exists = previous_holder + } } - title_domicile = { - add_domicile_building = yurt_main_02 - add_domicile_building = yurt_main_03 - add_domicile_building = yurt_main_04 - add_random_yurt_external_building_effect = yes - add_random_yurt_external_building_effect = yes - add_random_yurt_external_building_effect = yes - add_random_yurt_external_building_effect = yes - add_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - } - } - else_if = { - limit = { - current_year >= 1200 - } - title_domicile = { - add_domicile_building = yurt_main_02 - add_domicile_building = yurt_main_03 - add_domicile_building = yurt_main_04 - add_random_yurt_external_building_effect = yes - add_random_yurt_external_building_effect = yes - add_random_yurt_external_building_effect = yes - add_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - } - } - else_if = { - limit = { - current_year >= 1100 - } - title_domicile = { - add_domicile_building = yurt_main_02 - if = { - limit = { - has_domicile_building = yurt_main_02 - owner ?= { - OR = { - has_realm_law = nomadic_authority_2 - has_realm_law = nomadic_authority_3 - has_realm_law = nomadic_authority_4 - has_realm_law = nomadic_authority_5 + if = { + limit = { + root = { + OR = { + house.house_head ?= { + this != root + any_held_title = { + is_nomad_title = yes + } + } + dynasty.dynast ?= { + this != root + any_held_title = { + is_nomad_title = yes + } + } + any_close_family_member = { + this != root + any_held_title = { + is_nomad_title = yes + } } } } - add_domicile_building = yurt_main_03 } - add_random_yurt_external_building_effect = yes - add_random_yurt_external_building_effect = yes - add_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes + generate_coa = yes # To lessen confusion thinking titles are the same + } + if = { + limit = { + current_year >= 1300 + } + title_domicile = { + add_domicile_building = yurt_main_02 + add_domicile_building = yurt_main_03 + add_domicile_building = yurt_main_04 + add_random_yurt_external_building_effect = yes + add_random_yurt_external_building_effect = yes + add_random_yurt_external_building_effect = yes + add_random_yurt_external_building_effect = yes + add_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + } + } + else_if = { + limit = { + current_year >= 1200 + } + title_domicile = { + add_domicile_building = yurt_main_02 + add_domicile_building = yurt_main_03 + add_domicile_building = yurt_main_04 + add_random_yurt_external_building_effect = yes + add_random_yurt_external_building_effect = yes + add_random_yurt_external_building_effect = yes + add_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + } + } + else_if = { + limit = { + current_year >= 1100 + } + title_domicile = { + add_domicile_building = yurt_main_02 + if = { + limit = { + has_domicile_building = yurt_main_02 + owner ?= { + OR = { + has_realm_law = nomadic_authority_2 + has_realm_law = nomadic_authority_3 + has_realm_law = nomadic_authority_4 + has_realm_law = nomadic_authority_5 + } + } + } + add_domicile_building = yurt_main_03 + } + add_random_yurt_external_building_effect = yes + add_random_yurt_external_building_effect = yes + add_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + } + } + else_if = { + limit = { + current_year >= 900 + } + title_domicile = { + add_domicile_building = yurt_main_02 + add_random_yurt_external_building_effect = yes + add_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + upgrade_random_yurt_external_building_effect = yes + } } } - else_if = { + } + + ########### + # MPO - Edge case Nomadic Philosophy handover + ########### + if = { + limit = { + government_has_flag = government_is_nomadic + NOT = { + has_trait = nomadic_philosophy + } + exists = situation:the_great_steppe + any_character_situation = { + this = situation:the_great_steppe + } + } + add_trait = nomadic_philosophy + every_heir = { limit = { - current_year >= 900 - } - title_domicile = { - add_domicile_building = yurt_main_02 - add_random_yurt_external_building_effect = yes - add_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes - upgrade_random_yurt_external_building_effect = yes + top_liege ?= root + NOT = { + has_trait = nomadic_philosophy + } } + add_trait = nomadic_philosophy } } } ########### # Nomads switch faith/culture of conquered nomadic counties ########### - if = { + else_if = { limit = { - tier = tier_county - title_province ?= { + scope:title.title_province ?= { OR = { has_holding_type = nomad_holding has_holding_type = herder_holding } } - root = { - government_has_flag = government_is_nomadic - exists = domicile - } + government_has_flag = government_is_nomadic + exists = domicile } if = { limit = { - root = { - has_character_flag = domicile_culture_and_faith_check - OR = { - domicile.domicile_culture != scope:title.culture - domicile.domicile_faith != scope:title.faith - } + has_character_flag = domicile_culture_and_faith_check + OR = { + domicile.domicile_culture != scope:title.culture + domicile.domicile_faith != scope:title.faith } } - root.domicile = { + domicile = { set_domicile_culture = scope:title.culture set_domicile_faith = scope:title.faith } - root = { - remove_character_flag = domicile_culture_and_faith_check - } + remove_character_flag = domicile_culture_and_faith_check } else = { if = { - limit = { - root.domicile.domicile_culture != scope:title.culture - } + limit = { domicile.domicile_culture != scope:title.culture } scope:title ?= { set_variable = { name = migration_previous_culture value = culture } + set_county_culture = root.domicile.domicile_culture } - set_county_culture = root.domicile.domicile_culture } if = { - limit = { - root.domicile.domicile_faith != scope:title.faith - } - set_county_faith = root.domicile.domicile_faith + limit = { domicile.domicile_faith != scope:title.faith } + scope:title = { set_county_faith = root.domicile.domicile_faith } } } } - } - ########### - # Nomads leaving confederacies - ########### - if = { - limit = { - is_confederation_member = yes - scope:title.tier >= tier_kingdom - } - confederation = { - remove_confederation_member = root - } - } - # EP3 ADVENTURERS BECOMING LANDED - if = { - limit = { - scope:title = { is_titular = no } - any_held_title = { has_variable = adventurer_creation_reason } - } - save_scope_as = adventurer - if = { - limit = { - NOR = { - has_trait = adventurer - government_has_flag = government_is_nomadic - } - } - add_trait = adventurer - } - every_courtier = { - set_variable = { - name = former_camp_leader - value = scope:adventurer - } - add_trait = adventurer_follower - } - if = { - limit = { - house = { - has_house_modifier = legacy_adventurer_house_modifier - } - } - add_legitimacy = massive_legitimacy_gain - set_variable = { - name = legacy_adventurers_to_levies - value = 0 - } - every_courtier = { - root = { - change_variable = { name = legacy_adventurers_to_levies add = 25 } - } - } - every_held_title = { - limit = { has_variable = adventurer_creation_reason } - save_scope_as = prev_title - } - spawn_army = { - levies = var:legacy_adventurers_to_levies - location = capital_province - name = remnants_adventurer_army - } - remove_variable = legacy_adventurers_to_levies - } - destroy_laamp_effect = { ADVENTURER = scope:adventurer } - # EP3 - Ensure NF holders are Admin - if = { - limit = { - scope:title = { is_noble_family_title = yes } - NOT = { government_has_flag = government_is_administrative } - } - change_government = administrative_government - } - } - # Note: anything that should be run after creation can go in on_noble_family_title_created - if = { - limit = { - OR = { - government_has_flag = government_is_administrative - government_has_flag = government_is_special_republic - } - highest_held_title_tier >= tier_county - liege = { - is_independent_ruler = yes - government_has_flag = government_is_administrative - } - } - domicile ?= { set_up_domicile_estate_effect = yes } - } - # Apply Law of the Land title succession law if appropriate - scope:title = { - add_law_of_the_land_title_succession_law_if_appropriate_effect = yes - } - # MPO - edge case Nomadic Philosophy handover, factions, unlikely claimants, etc etc - if = { - limit = { - primary_title = { - this = scope:title - } - government_has_flag = government_is_nomadic - NOT = { - has_trait = nomadic_philosophy - } - exists = situation:the_great_steppe - any_character_situation = { - this = situation:the_great_steppe - } - } - add_trait = nomadic_philosophy - every_heir = { - limit = { - top_liege ?= root - NOT = { - has_trait = nomadic_philosophy - } - } - add_trait = nomadic_philosophy - } - } - # MPO - Siberian permafrost modifier switcharoo - if = { - limit = { + else = { + ########### + # Apply Law of the Land title succession law if appropriate + ########### scope:title = { - tier = tier_county - title_province = { + add_law_of_the_land_title_succession_law_if_appropriate_effect = yes + } + } + + ########### + # MPO - Siberian permafrost modifier switcharoo + ########### + if = { + limit = { + scope:title.title_province = { geographical_region = geographical_region:mpo_region_permafrost } } - } - if = { - limit = { - scope:title = { - has_county_modifier = mpo_siberian_permafrost_modifier_bad - } - culture ?= scope:title.culture - culture ?= { has_cultural_parameter = permafrost_modifier_mechanic } - } - scope:title = { - remove_county_modifier = mpo_siberian_permafrost_modifier_bad - add_county_modifier = mpo_siberian_permafrost_modifier - } - } - else_if = { - limit = { - scope:title = { - has_county_modifier = mpo_siberian_permafrost_modifier - } - NOT = { + if = { + limit = { + scope:title = { + has_county_modifier = mpo_siberian_permafrost_modifier_bad + } culture ?= scope:title.culture culture ?= { has_cultural_parameter = permafrost_modifier_mechanic } } - } - scope:title = { - remove_county_modifier = mpo_siberian_permafrost_modifier - add_county_modifier = mpo_siberian_permafrost_modifier_bad - } - } - - } - # EP3 - Ensure Emperor keeps old realm capital in admin realms & apply unique domicile building bonus if appropriate - if = { - limit = { - government_has_flag = government_is_administrative - is_independent_ruler = yes - highest_held_title_tier >= tier_empire - } - if = { # Ensure we keep the old realm capital - limit = { scope:title = { - tier = tier_empire - NOT = { title_capital_county = root.capital_county } - # Constantinople must have been inherited - title_capital_county.holder = root + remove_county_modifier = mpo_siberian_permafrost_modifier_bad + add_county_modifier = mpo_siberian_permafrost_modifier } } - set_realm_capital = scope:title.title_capital_county - } - if = { # Get legitimacy from Reception Hall House Bonus - limit = { - house = { has_variable = ep3_legacy_legitimacy_counter } - primary_title = scope:title - } - trigger_event = { - id = ep3_admin_events.0010 - days = 1 - } - } - } - # EP3 - Fire a became governor event - else_if = { - limit = { - government_has_flag = government_is_administrative - is_independent_ruler = no - is_governor = yes - any_held_title = { - count < 1 - NOT = { this = scope:title } - tier >= scope:title.tier - is_landless_type_title = no - is_noble_family_title = no - } - } - trigger_event = { - id = ep3_admin_events.0002 - delayed = yes - } - } - - scope:title = { update_dynamic_coa = yes } - - if = { - limit = { - scope:title = { is_holy_order = yes } - NOT = { has_trait = order_member } - government_has_flag = government_is_holy_order - } - add_trait = order_member - } - - if = { - limit = { - has_character_flag = peasant_outfit - NOT = { government_has_flag = government_is_herder } - } - remove_character_flag = peasant_outfit - } - - # Did I receive a title from my sibling? - if = { - limit = { - exists = scope:previous_holder - scope:previous_holder = { - is_alive = yes - exists = var:sibling_waiting_for_land - any_sibling = { - this = root - this = scope:previous_holder.var:sibling_waiting_for_land - } - } - } - add_character_flag = { - flag = got_title_from_sibling - years = 4 - } - } - - # Grandeur in elective realms - if = { - limit = { - exists = var:previous_holder_grandeur_value - has_royal_court = yes - has_dlc_feature = royal_court - } - hidden_effect = { - change_current_court_grandeur = -100 # Reset to 0 - change_current_court_grandeur = var:previous_holder_grandeur_value - remove_variable = previous_holder_grandeur_value - } - } - - # Petition allowed again - if = { - limit = { has_variable = petition_title_cooldown } - remove_variable = petition_title_cooldown - } - - # If a player is on their way to pay homage, invalidate. - if = { - limit = { - exists = scope:previous_holder - any_player = { var:homage_liege_scope ?= scope:previous_holder } - } - every_player = { - limit = { - var:homage_liege_scope ?= scope:previous_holder - NOT = { has_character_flag = currently_invalidating_petition_liege_travel } - } - current_travel_plan = { cancel_travel_plan = yes } - trigger_event = pay_homage.0601 - add_character_flag = { - flag = currently_invalidating_petition_liege_travel - days = 1 - } - } - } - - if = { - limit = { - exists = scope:previous_holder - scope:previous_holder = { - any_character_artifact = { - has_variable = artifact_succession_title #Is this an artifact that should follow a title? - var:artifact_succession_title = { is_title_created = yes } #Does the title the artifact should follow exist? - var:artifact_succession_title = scope:title #Scope title is the artifact title - } - } - } - scope:previous_holder = { - every_character_artifact = { + else_if = { limit = { - has_variable = artifact_succession_title #Is this an artifact that should follow a title? - var:artifact_succession_title = { is_title_created = yes } #Does the title the artifact should follow exist? - var:artifact_succession_title = scope:title #Scope title is the artifact title + scope:title = { + has_county_modifier = mpo_siberian_permafrost_modifier + } + NOR = { + culture ?= scope:title.culture + culture ?= { has_cultural_parameter = permafrost_modifier_mechanic } + } + } + scope:title = { + remove_county_modifier = mpo_siberian_permafrost_modifier + add_county_modifier = mpo_siberian_permafrost_modifier_bad + } + } + } + else_if = { + limit = { + OR = { + scope:title = title:c_antiocheia + scope:title = title:c_jerusalem + scope:title = title:c_alexandria + scope:title = title:c_roma + } + } + if = { + limit = { + OR = { + AND = { + is_roman_emperor_trigger = yes + faith = faith:orthodox + faith = { has_doctrine = special_doctrine_ecumenical_christian } + } + any_liege_or_above = { + is_roman_emperor_trigger = yes + faith = faith:orthodox + faith = { has_doctrine = special_doctrine_ecumenical_christian } + } + } + } + trigger_event = roman_restoration.0199 + } + ########### + # Transfer the Samaritan HoF to the realm that holds Jerusalem + ########### + if = { + limit = { + scope:title = title:c_jerusalem + title:d_samaritan.holder ?= { + # Samaritan HoF is not independent + # Samaritan liege is not Samaritan + top_liege.faith != faith:samaritan + top_liege != root + } + # root is at least a king, or their liege is, or their liege's liege is + OR = { + highest_held_title_tier >= tier_kingdom + any_liege_or_above = { + highest_held_title_tier >= tier_kingdom + } + } + } + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no } if = { limit = { - OR = { - scope:transfer_type = flag:conquest - scope:transfer_type = flag:conquest_holy_war - scope:transfer_type = flag:conquest_claim - scope:transfer_type = flag:conquest_populist - scope:transfer_type = flag:abdication - scope:transfer_type = flag:usurped - scope:transfer_type = flag:revoked - scope:transfer_type = flag:faction_demand - } + highest_held_title_tier >= tier_kingdom } - set_owner = { - target = root - history = { - type = conquest - actor = scope:previous_holder - recipient = root - location = scope:previous_holder.location + title:d_samaritan.holder = { + change_liege = { + liege = root + change = scope:title_change } } } else = { - set_owner = { - target = root - history = { - type = inherited - recipient = root + title:d_samaritan.holder = { + change_liege = { + liege = root.top_liege + change = scope:title_change + } + } + } + resolve_title_and_vassal_change = scope:title_change + } + } + + ########### + # FP1 - New holder for a county with a stele. + ########### + if = { + limit = { + # Using a scripted effect here so we can look at the same trigger in the grant title interaction + fp1_remove_stele_new_holder_trigger = { + TITLE = scope:title + PREVIOUS_HOLDER = scope:previous_holder + NEW_HOLDER = root + } + has_fp1_dlc_trigger = yes + } + scope:title = { + remove_variable = stele_scope_type + remove_variable = stele_container + remove_variable = stele_carver + remove_variable = stele_commissioner + remove_variable = stele_slot_occupied + remove_county_modifier = fp1_stele_ancestors_strong + remove_county_modifier = fp1_stele_ancestors_weak + remove_county_modifier = fp1_stele_conquest_strong + remove_county_modifier = fp1_stele_conquest_weak + remove_county_modifier = fp1_stele_promotion_strong + remove_county_modifier = fp1_stele_promotion_weak + } + } + ########### + # Non-FP1 - New holder of the county with a runestone + ########### + else_if = { + limit = { + scope:title = { + exists = var:ancestor_to_bury + } + dynasty != scope:previous_holder.dynasty #We only have to change something if the new holder is of a different dynasty + scope:title = { + NOT = { var:ancestor_to_bury.dynasty = root.dynasty } + } + } + scope:title = { + remove_county_modifier = county_raised_runestone_modifier + remove_variable = ancestor_to_bury + } + } + + ########### + # EP3 ADVENTURERS BECOMING LANDED + ########### + if = { + limit = { + scope:title = { is_landless_type_title = no } + any_held_title = { + title_tier = duchy + has_variable = adventurer_creation_reason + } + } + save_scope_as = adventurer + if = { + limit = { + NOR = { + has_trait = adventurer + government_has_flag = government_is_nomadic + } + } + add_trait = adventurer + } + every_courtier = { + set_variable = { + name = former_camp_leader + value = scope:adventurer + } + add_trait = adventurer_follower + } + if = { + limit = { + house = { + has_house_modifier = legacy_adventurer_house_modifier + } + } + add_legitimacy = massive_legitimacy_gain + set_variable = { + name = legacy_adventurers_to_levies + value = 0 + } + every_courtier = { + root = { + change_variable = { name = legacy_adventurers_to_levies add = 25 } + } + } + every_held_title = { + limit = { has_variable = adventurer_creation_reason } + save_scope_as = prev_title + } + spawn_army = { + levies = var:legacy_adventurers_to_levies + location = capital_province + name = remnants_adventurer_army + } + remove_variable = legacy_adventurers_to_levies + } + destroy_laamp_effect = { ADVENTURER = scope:adventurer } + # EP3 - Ensure NF holders are Admin + if = { + limit = { + scope:title = { is_noble_family_title = yes } + NOT = { government_has_flag = government_is_administrative } + } + change_government = administrative_government + } + } + } + ##################### + # DUCHY-TIER TITLES # + ##################### + else_if = { + limit = { + scope:title.tier = tier_duchy + } + + # Special Legitimacy gain for being elected (This is present in two places in this on_action) + if = { + limit = { + scope:title = { + has_order_of_succession = election + } + has_legitimacy = yes + } + save_scope_value_as = { + name = title_tier_minus_2 + value = { + value = scope:title.tier + subtract = 2 + } + } + send_interface_toast = { + type = msg_legitimacy_gain + title = legitimacy_gain_toast + left_icon = root + right_icon = scope:title + add_legitimacy = { + value = { + value = major_legitimacy_gain + multiply = scope:title_tier_minus_2 + } + } + } + } + + # Transfer title-bound artifacts with the title it's associated with (This is present in two places in this on_action) + if = { + limit = { + scope:previous_holder ?= { + any_character_artifact = { + has_variable = artifact_succession_title #Is this an artifact that should follow a title? + var:artifact_succession_title = { is_title_created = yes } #Does the title the artifact should follow exist? + var:artifact_succession_title = scope:title #Scope title is the artifact title + } + } + } + scope:previous_holder = { + every_character_artifact = { + limit = { + has_variable = artifact_succession_title #Is this an artifact that should follow a title? + var:artifact_succession_title = { is_title_created = yes } #Does the title the artifact should follow exist? + var:artifact_succession_title = scope:title #Scope title is the artifact title + } + if = { + limit = { + OR = { + scope:transfer_type = flag:conquest + scope:transfer_type = flag:conquest_holy_war + scope:transfer_type = flag:conquest_claim + scope:transfer_type = flag:conquest_populist + scope:transfer_type = flag:abdication + scope:transfer_type = flag:usurped + scope:transfer_type = flag:revoked + scope:transfer_type = flag:faction_demand + } + } + set_owner = { + target = root + history = { + type = conquest + actor = scope:previous_holder + recipient = root + location = scope:previous_holder.location + } + } + } + else = { + set_owner = { + target = root + history = { + type = inherited + recipient = root + } } } } } } - } - # FP3 Title Transfer Notification - if = { - limit = { - exists = struggle:persian_struggle - OR = { - scope:title = title:d_sunni - scope:title = title:e_arabia + if = { + limit = { + government_has_flag = government_is_landless_adventurer + } + # EP3 ADVENTURERS TELEPORT TO THEIR CAMP + trigger_event = { + id = title_event.9911 + days = 1 } } - struggle:persian_struggle = { # Wet script - every_involved_ruler = { - send_interface_toast = { - type = event_toast_effect_bad - title = persian_struggle_central_title_transfer.t - left_icon = scope:previous_holder - right_icon = scope:title.holder - custom_tooltip = persian_struggle_central_title_transfer.desc + # EP3 ADVENTURER TITLE BEING INHERITED BY A LANDED RULER + if = { + limit = { + scope:title = { + has_variable = adventurer_creation_reason + } + any_held_title = { + NOT = { has_variable = adventurer_creation_reason } } } - every_interloper_ruler = { - send_interface_toast = { - type = event_toast_effect_bad - title = persian_struggle_central_title_transfer.t - left_icon = scope:previous_holder - right_icon = scope:title.holder - - custom_tooltip = persian_struggle_central_title_transfer.desc - } + every_held_title = { + limit = { has_variable = adventurer_creation_reason } + save_scope_as = landless_adventurer_title + root = { destroy_title = scope:landless_adventurer_title } } } - } - - #Struggle Catalyst - if = { - limit = { - exists = struggle:persian_struggle - exists = scope:title.empire - scope:title = { - empire = title:e_persia - tier >= tier_county - is_landless_type_title = no + # Have we been given a fair shake as a laamp, but we're sucking? + else_if = { + limit = { + has_government = landless_adventurer_government + is_ai = yes + scope:previous_holder = { is_ai = yes } + primary_title = { + any_past_holder = { count >= 4 } + } + NOR = { + # If the heir is sufficiently impressive, then we'll keep 'em around. + prestige_level >= 2 + # Legitimists are always worthwhile. + has_realm_law = camp_purpose_legitimists + # Reserve successful mercenary outfits. + AND = { + max_military_strength >= 1500 + # Allow absolute decimations to destroy mercs from time to time. + current_military_strength <= 150 + } + # Or those currently fighting alongside/against players. + AND = { + is_at_war = yes + OR = { + any_war_ally = { is_ai = no } + any_war_enemy = { is_ai = no } + } + } + # Depending on camp purpose, we want various skills. + AND = { + has_realm_law = camp_purpose_wanderers + OR = { + highest_skill_value >= very_high_skill_rating + prowess >= very_high_skill_rating + } + } + AND = { + has_realm_law = camp_purpose_mercenaries + OR = { + martial >= high_skill_rating + prowess >= high_skill_rating + } + } + AND = { + has_realm_law = camp_purpose_scholars + OR = { + learning >= high_skill_rating + diplomacy >= high_skill_rating + } + } + AND = { + has_realm_law = camp_purpose_explorers + OR = { + diplomacy >= high_skill_rating + stewardship >= high_skill_rating + } + } + AND = { + has_realm_law = camp_purpose_brigands + OR = { + intrigue >= high_skill_rating + prowess >= high_skill_rating + } + } + # Finally, keep anyone who's important to the player. + any_player = { + OR = { + root.dynasty ?= dynasty + is_consort_of = root + has_important_relationship_with_character_trigger = { CHARACTER = root } + any_pinned_character = { this = root } + any_pinned_character = { this = scope:previous_holder } + } + } + } } - NOR = { + destroy_laamp_effect = { ADVENTURER = root } + } + # Holy Order Trait + else_if = { + limit = { + scope:title = { is_holy_order = yes } + NOT = { has_trait = order_member } + government_has_flag = government_is_holy_order + } + add_trait = order_member + } + + # Apply Created Title opinion to Courtly Vassals (This is present in two places in this on_action) + if = { + limit = { scope:transfer_type = flag:created - scope:transfer_type = flag:inheritance + is_alive = yes + } + every_vassal = { + vassal_stance = courtly + if = { + limit = { + scope:title.tier = tier_duchy + } + add_opinion = { + target = root + modifier = courtly_title_creation_opinion + opinion = 10 + } + } + else = { + add_opinion = { + target = root + modifier = courtly_title_creation_opinion + opinion = 30 + } + } } } + # Lil Johnny Lackland changes his nickname. if = { limit = { - fp3_character_uninvolved_in_struggle_trigger = yes - scope:previous_holder ?= { - fp3_character_involved_in_struggle_trigger = yes - any_character_struggle = { - phase_has_catalyst = catalyst_interloper_uninvolved_gain_struggle_titles - } - } - } - scope:previous_holder ?= { - every_character_struggle = { - limit = { phase_has_catalyst = catalyst_interloper_uninvolved_gain_struggle_titles } - activate_struggle_catalyst = { - catalyst = catalyst_interloper_uninvolved_gain_struggle_titles - character = root - } - log_debug_variable_for_persian_struggle_effect = { VAR = concession_catalyst_interloper_uninvolved_gain_struggle_titles } - } + has_nickname = nick_lackland_young } + give_nickname = nick_lackland_ironic } + } + ##################### + # KING+ TIER TITLES # + ##################### + else = { + # Hegemonies cannot have Ceremonial Regents if = { limit = { - fp3_character_involved_in_struggle_trigger = yes - any_character_struggle = { - phase_has_catalyst = catalyst_gain_struggle_titles_from_interlopers_uninvolved - # Stop catalyst from affecting those who are only just now uninvolved due to losing this title - OR = { - NOT = { is_culture_involved_in_struggle = scope:previous_holder.culture } - NOT = { is_faith_involved_in_struggle = scope:previous_holder.faith } - } - } - scope:previous_holder ?= { - OR = { - fp3_character_uninvolved_in_struggle_trigger = yes - fp3_character_interloper_in_struggle_trigger = yes - } - } - } - every_character_struggle = { - limit = { phase_has_catalyst = catalyst_gain_struggle_titles_from_interlopers_uninvolved } - activate_struggle_catalyst = { - catalyst = catalyst_gain_struggle_titles_from_interlopers_uninvolved - character = root - } - log_debug_variable_for_persian_struggle_effect = { VAR = stabil_catalyst_gain_struggle_titles_from_interlopers_uninvolved } + exists = this + tgp_realm_has_ceremonial_liege_trigger = yes + scope:title.tier = tier_hegemony } + tgp_destroy_ceremonial_throne_effect = yes } - } - - # Achievements - if = { # FP2 El Cid - limit = { - scope:title = title:k_valencia - has_character_flag = fp2_el_cid_blood_relation_legacy - } - set_global_variable = { # DO. NOT. USE. add_achievement_global_variable_effect. IT BREAKS THE ACHIEVEMENT. - name = fp2_el_cid_achievement_unlocked - value = yes - } - } - - # Am I The Chad? - if = { - limit = { root = character:easteregg_chad_uhl } - set_house = house:house_chad_uhl - } - - if = { - limit = { - scope:transfer_type = flag:created - is_alive = yes - } - every_vassal = { + # Ceremonial Liege + if = { limit = { - has_vassal_stance = courtly + OR = { + exists = scope:title.var:ceremonial_title + top_liege.primary_title.var:administrative_ui_special_title ?= scope:title + } } if = { limit = { - scope:title.tier = tier_duchy - } - add_opinion = { - target = root - modifier = courtly_title_creation_opinion - opinion = 10 + exists = house + exists = scope:previous_holder.house + scope:previous_holder.house != house } + scope:title = { set_coa = root.house } } - else = { - add_opinion = { - target = root - modifier = courtly_title_creation_opinion - opinion = 30 - } - } - } - } - if = { - limit = { - scope:title = title:c_jerusalem - # Samaritan HoF exists - exists = title:d_samaritan.holder - # Samaritan HoF is not independent - title:d_samaritan.holder = { exists = liege } - # Samaritan HoF is not Samaritan - title:d_samaritan.holder = { NOT = { faith = faith:samaritan } } - # root is at least a king, or their liege is, or their liege's liege is - OR = { - highest_held_title_tier >= tier_kingdom - liege ?= { highest_held_title_tier >= tier_kingdom } - liege.liege ?= { highest_held_title_tier >= tier_kingdom } - } - } - create_title_and_vassal_change = { - type = created - save_scope_as = title_change - add_claim_on_loss = no + remove_character_flag = ceremonial_regent_flag } + if = { + limit = { exists = scope:title.var:ceremonial_title } + add_character_flag = ceremonial_liege_flag + } + # Reset raid remit if = { limit = { - highest_held_title_tier >= tier_kingdom + this = top_liege + any_noble_family = { } } - title:d_samaritan.holder = { - change_liege = { - liege = root - change = scope:title_change + every_noble_family = { + holder = { remove_variable = raid_estate_permission } + } + } + # Special Legitimacy gain for being elected (This is present in two places in this on_action) + if = { + limit = { + scope:title = { + has_order_of_succession = election + } + has_legitimacy = yes + } + save_scope_value_as = { + name = title_tier_minus_2 + value = { + value = scope:title.tier + subtract = 2 + } + } + send_interface_toast = { + type = msg_legitimacy_gain + title = legitimacy_gain_toast + left_icon = root + right_icon = scope:title + add_legitimacy = { + value = { + value = major_legitimacy_gain + multiply = scope:title_tier_minus_2 + } } } } + # Transfer title-bound artifacts with the title it's associated with (This is present in two places in this on_action) + if = { + limit = { + scope:previous_holder ?= { + any_character_artifact = { + has_variable = artifact_succession_title #Is this an artifact that should follow a title? + var:artifact_succession_title = { is_title_created = yes } #Does the title the artifact should follow exist? + var:artifact_succession_title = scope:title #Scope title is the artifact title + } + } + } + scope:previous_holder = { + every_character_artifact = { + limit = { + has_variable = artifact_succession_title #Is this an artifact that should follow a title? + var:artifact_succession_title = { is_title_created = yes } #Does the title the artifact should follow exist? + var:artifact_succession_title = scope:title #Scope title is the artifact title + } + if = { + limit = { + OR = { + scope:transfer_type = flag:conquest + scope:transfer_type = flag:conquest_holy_war + scope:transfer_type = flag:conquest_claim + scope:transfer_type = flag:conquest_populist + scope:transfer_type = flag:abdication + scope:transfer_type = flag:usurped + scope:transfer_type = flag:revoked + scope:transfer_type = flag:faction_demand + } + } + set_owner = { + target = root + history = { + type = conquest + actor = scope:previous_holder + recipient = root + location = scope:previous_holder.location + } + } + } + else = { + set_owner = { + target = root + history = { + type = inherited + recipient = root + } + } + } + } + } + } + # Grandeur in elective realms + if = { + limit = { + exists = var:previous_holder_grandeur_value + has_royal_court = yes + has_dlc_feature = royal_court + } + hidden_effect = { + change_current_court_grandeur = -100 # Reset to 0 + change_current_court_grandeur = var:previous_holder_grandeur_value + remove_variable = previous_holder_grandeur_value + } + } + # Apply Created Title opinion to Courtly Vassals (This is present in two places in this on_action) + if = { + limit = { + scope:transfer_type = flag:created + is_alive = yes + } + every_vassal = { + vassal_stance = courtly + if = { + limit = { + scope:title.tier = tier_duchy + } + add_opinion = { + target = root + modifier = courtly_title_creation_opinion + opinion = 10 + } + } + else = { + add_opinion = { + target = root + modifier = courtly_title_creation_opinion + opinion = 30 + } + } + } + } + # Empire and Hegemony stuff + if = { + limit = { + scope:title = { + tier >= tier_empire + } + } + # Byzantine-only: The Patriarch refuses to crown you as new emperor because you have a criminal trait (e.g. kinslayer) + if = { + limit = { + valid_for_byz_emperor_content_trigger = yes + has_ep3_dlc_trigger = yes + exists = root.faith.religious_head + this != faith.religious_head + faith.religious_head = { + opinion = { + target = root + value <= 0 + } + location = root.location + } + has_any_criminal_trait_in_faith_trigger = { + CHARACTER = root + FAITH = root.faith + } + NOT = { has_character_flag = has_had_ep3_2020 } + } + trigger_event = { + id = ep3_emperor_yearly.2020 + days = 1 + } + } + ### EP3 Admin Emperor Flavor ### + if = { + limit = { + # Not for meritocratic + NOT = { government_has_flag = government_has_merit } + # Admin only + government_allows = administrative + has_ep3_dlc_trigger = yes + # Independent rulers only + this = top_liege + # New title is higher or equal to your primary tier + highest_held_title_tier >= scope:title.tier + # You didn't just create the title + scope:title = { + any_past_holder = { } + # Your predecessor wasn't from your same house - not much to celebrate if you got the title from dad! + previous_holder ?= { + house != root.house + } + } + # Handled separately + tgp_realm_has_ceremonial_liege_trigger = no + } + trigger_event = { + id = ep3_emperor_yearly.2050 + days = 5 + } + } + #Byzantium is reborn! + if = { + limit = { + scope:title = { + this = title:e_byzantium + } + exists = global_var:byz_collapse_counter + } + save_scope_as = byz_emperor + title:e_byzantium = { + every_in_de_jure_hierarchy = { + limit = { + tier <= tier_kingdom + tier >= tier_county + is_title_created = yes + exists = holder + } + if = { + limit = { + holder ?= { + is_alive = yes + NOR = { + is_in_list = byz_return_notify + any_held_title = { + this = title:e_byzantium + } + } + } + } + holder = { + add_to_list = byz_return_notify + } + } + } + } + title:e_latin_empire = { + every_in_de_jure_hierarchy = { + limit = { + tier <= tier_kingdom + tier >= tier_county + is_title_created = yes + exists = holder + } + if = { + limit = { + holder = { + is_alive = yes + NOR = { + is_in_list = byz_return_notify + any_held_title = { + this = title:e_byzantium + } + } + } + } + holder = { + add_to_list = byz_return_notify + } + } + } + } + every_in_list = { + list = byz_return_notify + trigger_event = ep3_frankokratia_events.0130 + } + remove_global_variable = byz_collapse_counter + } + # TGP CHINA + else_if = { + limit = { + scope:title = title:h_china + } + # When conquering China - Change to conquest phase + if = { + limit = { + root.house != scope:previous_holder.house + is_valid_celestial_dynasty = no + } + situation:dynastic_cycle = { + situation_top_sub_region = { + change_phase = { phase = situation_dynastic_cycle_phase_instability_conquest } + } + } + } + # When inheriting China - Move towards instability/chaotic phase + else_if = { + limit = { + root.house != scope:previous_holder.house + months_from_game_start > 0 # We check this to avoid potentially triggering this immediately on game start + } + situation:dynastic_cycle = { + if = { + limit = { + situation_top_has_catalyst = catalyst_new_dynasty_inherits + } + trigger_situation_catalyst = catalyst_new_dynasty_inherits + } + else_if = { + limit = { + situation_current_phase = situation_dynastic_cycle_phase_instability_conquest + } + situation_top_sub_region = { + change_phase = { phase = situation_dynastic_cycle_phase_instability } + } + } + } + } + # Clear the Strengthen Capital great project cooldown + situation:dynastic_cycle ?= { + if = { + limit = { has_variable = gp_strengthen_capital_cooldown } + remove_variable = gp_strengthen_capital_cooldown + } + } + #setup Grand Secretariat + if = { + limit = { + has_dlc_feature = all_under_heaven + NOT = { has_diarchy_type = grand_secretariat } + } + if = { + limit = { + has_realm_law = grand_chancellor_law + exists = title:h_china.holder.cp:councillor_chancellor + } + try_start_diarchy = grand_secretariat + set_diarch = title:h_china.holder.cp:councillor_chancellor + } + else_if = { + limit = { + has_realm_law = grand_marshal_law + exists = title:h_china.holder.cp:minister_grand_marshal + } + try_start_diarchy = grand_secretariat + set_diarch = title:h_china.holder.cp:minister_grand_marshal + } + else_if = { + limit = { + exists = title:h_china.holder.cp:councillor_spymaster + } + try_start_diarchy = grand_secretariat + set_diarch = title:h_china.holder.cp:councillor_spymaster + } + } + root.house.house_head.domicile ?= { + set_family_accomplishment_effect = { ACCOMPLISHMENT = family_accomplishment_dynasty } + } + } + else_if = { + limit = { + OR = { + scope:title = title:e_minister_chancellor + scope:title = title:e_minister_censor + scope:title = title:e_minister_grand_marshal + scope:title = title:e_minister_of_personnel + scope:title = title:e_minister_of_revenue + scope:title = title:e_minister_of_rites + scope:title = title:e_minister_of_war + scope:title = title:e_minister_of_justice + scope:title = title:e_minister_of_works + } + } + # If we get a minister title, make sure we set things up correctly + switch = { + trigger = scope:title + title:e_minister_chancellor = { + got_minister_position_effect = { MINISTER_TITLE = e_minister_chancellor MINISTER_POSITION = councillor_chancellor } + } + title:e_minister_censor = { + got_minister_position_effect = { MINISTER_TITLE = e_minister_censor MINISTER_POSITION = councillor_spymaster } + } + title:e_minister_grand_marshal = { + got_minister_position_effect = { MINISTER_TITLE = e_minister_grand_marshal MINISTER_POSITION = minister_grand_marshal } + } + title:e_minister_of_personnel = { + got_minister_position_effect = { MINISTER_TITLE = e_minister_of_personnel MINISTER_POSITION = minister_personnel } + } + title:e_minister_of_revenue = { + got_minister_position_effect = { MINISTER_TITLE = e_minister_of_revenue MINISTER_POSITION = councillor_steward } + } + title:e_minister_of_rites = { + got_minister_position_effect = { MINISTER_TITLE = e_minister_of_rites MINISTER_POSITION = councillor_court_chaplain } + } + title:e_minister_of_war = { + got_minister_position_effect = { MINISTER_TITLE = e_minister_of_war MINISTER_POSITION = councillor_marshal } + } + title:e_minister_of_justice = { + got_minister_position_effect = { MINISTER_TITLE = e_minister_of_justice MINISTER_POSITION = minister_justice } + } + title:e_minister_of_works = { + got_minister_position_effect = { MINISTER_TITLE = e_minister_of_works MINISTER_POSITION = minister_works } + } + } + } + # TGP JAPAN + else_if = { + limit = { scope:title = title:e_japan } + # TGP RETIRED EMPEROR + if = { + limit = { + exists = title:e_japan.var:administrative_ui_special_title + has_title = title:e_japan.var:administrative_ui_special_title + } + # Flavourization setup + title:e_japan = { remove_variable = shogun_flag } + remove_character_flag = shogun_flag + if = { # Flavourization setup + limit = { has_global_variable = tenno_restored } + title:e_japan = { set_variable = ceremonial_liege_flag } + add_character_flag = ceremonial_liege_flag + trigger_event = { + id = tgp_japan_general.9100 + days = 1 + } + } + else = { # Event to abdicate and become Joko + trigger_event = { + id = tgp_japan_general.9120 + days = 1 + } + } + } + # TGP SHOGUN + else_if = { + limit = { + has_government = japan_feudal_government + has_global_variable = shogunate_established + } + title:e_japan = { remove_variable = ceremonial_liege_flag } + remove_character_flag = ceremonial_liege_flag + title:e_japan = { set_variable = shogun_flag } + add_character_flag = shogun_flag + } + # TGP KAMPAKU + else = { + title:e_japan = { remove_variable = ceremonial_liege_flag } + remove_character_flag = ceremonial_liege_flag + title:e_japan = { remove_variable = shogun_flag } + remove_character_flag = shogun_flag + } + # Japanese regent laws + if = { + limit = { + tgp_realm_has_ceremonial_liege_trigger = yes + government_is_japanese_trigger = yes + NOR = { + has_global_variable = shogunate_established + has_global_variable = tenno_restored + } + } + if = { + limit = { + government_has_flag = government_is_japan_administrative + NOT = { has_realm_law = japanese_regency_succession_law } + } + add_realm_law_skip_effects = japanese_regency_succession_law + } + else_if = { + limit = { + government_has_flag = government_is_japan_feudal + has_realm_law = japanese_regency_succession_law + } + remove_realm_law = japanese_regency_succession_law + } + } + } + # ROME + else_if = { + limit = { + OR = { + scope:title = title:h_roman_empire + scope:title = title:h_eastern_roman_empire + } + NOT = { has_trait = augustus } + } + trigger_event = roman_restoration.0005 + } + #Mongol empire and GoK should lose other empires + if = { + limit = { + primary_title ?= { + OR = { + this = title:e_mongol_empire + AND = { + exists = global_var:greatest_of_khans_title + this = global_var:greatest_of_khans_title + } + } + } + scope:title = { + NOR = { + this = title:e_mongol_empire + AND = { + exists = global_var:greatest_of_khans_title + this = global_var:greatest_of_khans_title + } + } + } + is_ai = yes + } + destroy_title = scope:title + } + # You just inherited an Emperor title!! + if = { + limit = { + primary_title = scope:title + exists = scope:previous_holder + NOT = { #You don't already have an empire tier title + any_held_title = { + title_tier = empire + this != scope:title + } + } + # That isn't a part of the ministry + NOR = { + scope:title = title:e_minister_chancellor + scope:title = title:e_minister_censor + scope:title = title:e_minister_grand_marshal + scope:title = title:e_minister_of_personnel + scope:title = title:e_minister_of_revenue + scope:title = title:e_minister_of_rites + scope:title = title:e_minister_of_war + scope:title = title:e_minister_of_justice + scope:title = title:e_minister_of_works + } + } + trigger_event = { + id = realm_maintenance.2001 + days = 1 + } + } + if = { + limit = { + is_independent_ruler = yes + tgp_realm_has_ceremonial_liege_trigger = no + government_has_flag = government_is_meritocratic + } + trigger_event = { + id = tgp_korea_decision.9203 + days = 1 + } + } + # TGP CEREMONIAL FLAVOR + scope:previous_holder ?= { + if = { + limit = { is_alive = yes } + remove_character_flag = ceremonial_liege_flag + remove_character_flag = ceremonial_regent_flag + } + } + if = { + limit = { is_alive = yes } + remove_character_flag = ceremonial_liege_flag + remove_character_flag = ceremonial_regent_flag + } + top_liege.primary_title.var:administrative_ui_special_title.holder ?= { + remove_character_flag = ceremonial_liege_flag + remove_character_flag = ceremonial_regent_flag + } + if = { + limit = { tgp_is_ceremonial_regent_trigger = yes } # Not 'actual' ruler + add_character_flag = ceremonial_regent_flag + top_liege.primary_title.var:administrative_ui_special_title.holder ?= { add_character_flag = ceremonial_liege_flag } + } + } + # West Francia becomes France when no longer controlled by a Karling else_if = { limit = { - exists = liege - liege = { highest_held_title_tier >= tier_kingdom } - } - title:d_samaritan.holder = { - change_liege = { - liege = root.liege - change = scope:title_change + scope:title = { + this = title:k_france + } + NOR = { + dynasty = { this = dynasty:25061 } # Not held by a Karling + any_liege_or_above = { + dynasty = { this = dynasty:25061 } # And does not have a liege that is a Karling + } + has_global_variable = west_francia_renamed } } + trigger_event = { + id = title_event.0001 + days = 1 + } } + # East Francia becomes Germany when no longer controlled by a Karling else_if = { limit = { - exists = liege.liege - liege.liege = { highest_held_title_tier >= tier_kingdom } + scope:title = { + this = title:k_east_francia + } + NOR = { + dynasty = { this = dynasty:25061 } # Not held by a Karling + any_liege_or_above = { + dynasty = { this = dynasty:25061 } # And does not have a liege that is a Karling + } + has_global_variable = east_francia_renamed + } } - title:d_samaritan.holder = { - change_liege = { - liege = root.liege.liege - change = scope:title_change + trigger_event = { + id = title_event.0002 + days = 1 + } + } + # Hidden management event to determine if we need to axe Asturias &, if we do, what notification events to send out afterwards. + else_if = { + limit = { + scope:title = title:k_castille + title:k_asturias = { + # Leon must be de jure part of Asturias, or else there's no reason to ever stop calling it Asturias. + any_in_de_jure_hierarchy = { this = title:d_leon } + } + } + trigger_event = { + id = title_event.0011 + days = 1 + } + } + # FP2 El Cid Achievement + else_if = { + limit = { + scope:title = title:k_valencia + has_character_flag = fp2_el_cid_blood_relation_legacy + } + set_global_variable = { # DO. NOT. USE. add_achievement_global_variable_effect. IT BREAKS THE ACHIEVEMENT. + name = fp2_el_cid_achievement_unlocked + value = yes + } + } + # TGP CEREMONIAL RULER + # IMPERIAL INHERITANCE + else_if = { + limit = { + exists = scope:title.var:ceremonial_title + } + add_character_flag = ceremonial_liege_flag + trigger_event = { + id = tgp_japan_general.9100 + days = 1 + } + } + # Norway stuff + else_if = { + limit = { + # The title they've acquired is Norway. + scope:title = title:k_norway + } + # Tanglehair becomes Fairhair. + if = { + limit = { + # This character is Harald Fairhair. + exists = character:144000 + this = character:144000 + # Norway has been created by them. + scope:transfer_type = flag:created + # Norway has not been created previously. + NOT = { exists = global_var:norway_created } + } + trigger_event = { + id = fp1_major_decisions.1011 + days = 1 + } + } + # Check Norway's creation status. + if = { + limit = { + scope:transfer_type = flag:created + NOT = { exists = global_var:norway_created } + } + trigger_event = { + id = fp1_major_decisions.1012 + days = 1 } } } - resolve_title_and_vassal_change = scope:title_change + # English Partition Result - Gained Both + else_if = { + limit = { + # Partition must be active. + exists = global_var:partition_active_danelaw + # The gained title must be one of the two partitioned entities. + OR = { + scope:title = title:k_england + scope:title = title:k_danelaw + } + # And you must now hold both titles. + this = title:k_england.holder + this = title:k_danelaw.holder + } + trigger_event = { + id = british_isles.1032 + days = 1 + } + } + # Lil Johnny Lackland changes his nickname. + if = { + limit = { + has_nickname = nick_lackland_young + } + give_nickname = nick_lackland_ironic + } } - # FP3 Struggle special cases - ## Convert detractors to supporters if they inherit either of the titles they're detracting against. + ############# + # STRUGGLES # + ############# if = { limit = { exists = struggle:persian_struggle - NOT = { has_trait = fp3_struggle_supporter } - OR = { - scope:title = title:d_sunni - scope:title = title:e_arabia + } + #Struggle Catalysts + if = { + limit = { + scope:title.empire ?= title:e_persia + scope:title = { + tier >= tier_county + is_landless_type_title = no + } + NOR = { + scope:transfer_type = flag:created + scope:transfer_type = flag:inheritance + } + } + if = { + limit = { + fp3_character_uninvolved_in_struggle_trigger = yes + scope:previous_holder ?= { + fp3_character_involved_in_struggle_trigger = yes + any_character_struggle = { + phase_has_catalyst = catalyst_interloper_uninvolved_gain_struggle_titles + } + } + } + scope:previous_holder ?= { + every_character_struggle = { + limit = { phase_has_catalyst = catalyst_interloper_uninvolved_gain_struggle_titles } + activate_struggle_catalyst = { + catalyst = catalyst_interloper_uninvolved_gain_struggle_titles + character = root + } + log_debug_variable_for_persian_struggle_effect = { VAR = concession_catalyst_interloper_uninvolved_gain_struggle_titles } + } + } + } + if = { + limit = { + fp3_character_involved_in_struggle_trigger = yes + any_character_struggle = { + phase_has_catalyst = catalyst_gain_struggle_titles_from_interlopers_uninvolved + # Stop catalyst from affecting those who are only just now uninvolved due to losing this title + OR = { + NOT = { is_culture_involved_in_struggle = scope:previous_holder.culture } + NOT = { is_faith_involved_in_struggle = scope:previous_holder.faith } + } + } + scope:previous_holder ?= { + OR = { + fp3_character_uninvolved_in_struggle_trigger = yes + fp3_character_interloper_in_struggle_trigger = yes + } + } + } + every_character_struggle = { + limit = { phase_has_catalyst = catalyst_gain_struggle_titles_from_interlopers_uninvolved } + activate_struggle_catalyst = { + catalyst = catalyst_gain_struggle_titles_from_interlopers_uninvolved + character = root + } + log_debug_variable_for_persian_struggle_effect = { VAR = stabil_catalyst_gain_struggle_titles_from_interlopers_uninvolved } + } } } + # FP3 Struggle special cases if = { - limit = { has_trait = fp3_struggle_detractor } - remove_trait = fp3_struggle_detractor + limit = { + scope:title = { + OR = { + this = title:d_sunni + this = title:e_arabia + } + } + } + ## Convert detractors to supporters if they inherit either of the titles they're detracting against. + if = { + limit = { + NOT = { has_trait = fp3_struggle_supporter } + } + if = { + limit = { has_trait = fp3_struggle_detractor } + remove_trait = fp3_struggle_detractor + } + add_trait = fp3_struggle_supporter + } + # FP3 Title Transfer Notification + struggle:persian_struggle = { # Wet script + every_involved_ruler = { + send_interface_toast = { + type = event_toast_effect_bad + title = persian_struggle_central_title_transfer.t + left_icon = scope:previous_holder + right_icon = scope:title.holder + + custom_tooltip = persian_struggle_central_title_transfer.desc + } + } + every_interloper_ruler = { + send_interface_toast = { + type = event_toast_effect_bad + title = persian_struggle_central_title_transfer.t + left_icon = scope:previous_holder + right_icon = scope:title.holder + + custom_tooltip = persian_struggle_central_title_transfer.desc + } + } + } } - add_trait = fp3_struggle_supporter } - # Special Legitimacy gain for being elected + ############### + # GOVERNMENTS # + ############### + + # TGP bloc joining + if = { + limit = { + government_is_japanese_trigger = yes + tgp_house_bloc_interaction_valid_trigger = yes + is_house_head = no + NOT = { exists = confederation } + exists = house.house_head.confederation + liege = house.house_head.liege + is_at_war = no + } + save_scope_as = bloc_joiner + house.house_head.confederation = { add_confederation_member = scope:bloc_joiner } + } + # Challenged as house head in Japan + if = { + limit = { + government_is_japanese_trigger = yes + is_house_head = yes + } + trigger_event = { + weeks = { 2 4 } + id = tgp_japan_yearly_events.1210 + } + } + # TGP Catalysts + if = { + limit = { + scope:previous_holder ?= { + has_title = title:h_china + } + OR = { + scope:transfer_type = flag:granted + scope:transfer_type = flag:appointment + } + NOT = { has_appointment_level_for_title = scope:title } + } + situation:dynastic_cycle ?= { + if = { + limit = { situation_top_has_catalyst = catalyst_hegemon_appointing_low_merit_governor } + trigger_situation_catalyst = { + catalyst = catalyst_hegemon_appointing_low_merit_governor + character = scope:previous_holder + } + } + } + } + # If the minister's merit rank is too low, it will affect the dynastic cycle if = { limit = { scope:title = { - has_order_of_succession = election - } - has_legitimacy = yes - } - save_scope_value_as = { - name = title_tier_minus_2 - value = { - value = scope:title.tier - subtract = 2 - } - } - send_interface_toast = { - type = msg_legitimacy_gain - title = legitimacy_gain_toast - left_icon = root - right_icon = scope:title - add_legitimacy = { - value = { - value = major_legitimacy_gain - multiply = scope:title_tier_minus_2 + OR = { + this = title:e_minister_chancellor + this = title:e_minister_censor + this = title:e_minister_grand_marshal + this = title:e_minister_of_personnel + this = title:e_minister_of_revenue + this = title:e_minister_of_rites + this = title:e_minister_of_war + this = title:e_minister_of_justice + this = title:e_minister_of_works } } + NOT = { has_appointment_level_for_title = scope:title } + } + situation:dynastic_cycle ?= { + if = { + limit = { situation_top_has_catalyst = catalyst_hegemon_appointing_low_merit_councillor } + trigger_situation_catalyst = { + catalyst = catalyst_hegemon_appointing_low_merit_councillor + character = root + } + } + } + } + # Admin Stuff + if = { + limit = { + OR = { + government_allows = administrative + government_has_flag = government_is_japan_feudal + } + } + # Note: anything that should be run after creation can go in on_noble_family_title_created + if = { + limit = { + is_house_head = yes + trigger_if = { + limit = { + government_has_flag = government_is_japan_feudal + } + highest_held_title_tier >= tier_county + } + trigger_else_if = { + # To avoid noble family spam, we only create family titles for county tier if that is also the primary governor tier. + limit = { main_administrative_tier = tier_county } + highest_held_title_tier >= tier_county + } + trigger_else = { highest_held_title_tier >= tier_duchy } + liege = { + OR = { + government_allows = administrative + government_has_flag = government_is_japan_feudal + } + } + NOR = { + any_held_title = { is_noble_family_title = yes } + house = { + any_house_member = { + any_held_title = { is_noble_family_title = yes } + } + } + } + } + create_noble_family_effect = { GOVERNMENT_GIVER = this } + domicile ?= { set_up_domicile_estate_effect = yes } + } + # EP3 - Ensure Emperor keeps old realm capital in admin realms & apply unique domicile building bonus if appropriate + if = { + limit = { + top_liege = this + highest_held_title_tier >= tier_empire + } + if = { # Ensure we keep the old realm capital + limit = { + scope:title = { + tier = tier_empire + title_capital_county != root.capital_county + # Constantinople must have been inherited + title_capital_county.holder = root + } + } + set_realm_capital = scope:title.title_capital_county + } + if = { # Get legitimacy from Reception Hall House Bonus + limit = { + house = { has_variable = ep3_legacy_legitimacy_counter } + primary_title = scope:title + } + trigger_event = { + id = ep3_admin_events.0010 + days = 1 + } + } + } + # EP3 - Fire a became governor event + else_if = { + limit = { + top_liege != this + trigger_if = { + limit = { government_allows = merit } + is_governor_or_admin_count = yes + } + trigger_else = { + is_governor = yes + } + any_held_title = { + count < 1 + this != scope:title + tier >= scope:title.tier + is_landless_type_title = no + is_noble_family_title = no + } + } + trigger_event = { + id = ep3_admin_events.0002 + delayed = yes + } + } + # Admin vassals get the Governor trait when they first become a governor + if = { + limit = { + is_governor = yes + NOT = { has_trait = governor } + scope:title = { + tier >= root.main_administrative_tier + } + } + add_trait = governor + } + #Admin imperial succession notification event (it's a big deal) + if = { + limit = { + top_liege = this + highest_held_title_tier >= tier_kingdom + scope:title = root.primary_title + has_ep3_dlc_trigger = yes + #Checks so this event doesn't fire after character creation, although it's not really a problem if it does + trigger_if = { + limit = { + game_start_date = 867.1.1 + } + current_date >= 867.1.4 + } + trigger_if = { + limit = { + game_start_date = 1066.9.15 + } + current_date >= 1066.9.18 + } + trigger_if = { + limit = { + game_start_date = 1178.10.1 + } + current_date >= 1178.10.4 + } + } + save_scope_as = emperor + #Should trigger special event during fourth crusade! + if = { + limit = { + exists = global_var:byz_claimant_champion + global_var:byz_claimant_champion = { + any_owned_story = { + type = frankokratia_story + exists = var:byz_claimant + var:byz_claimant = { + this = root + } + } + } + } + every_vassal_or_below = { + limit = { + is_playable_character = yes + } + trigger_event = ep3_frankokratia_events.0110 + } + } + else = { + if = { + limit = { + exists = root.house + } + #normal triggering + every_vassal_or_below = { + limit = { + is_playable_character = yes + exists = scope:previous_holder + has_government = administrative_government + OR = { + highest_held_title_tier >= main_administrative_tier # All governors + liege = root + } + } + trigger_event = { + id = ep3_governor_yearly.3060 + days = 1 + } + } + } + } + } + #Admin event about rewarding person who helped you get title + if = { + limit = { + has_succession_appointment_investors = scope:title + has_ep3_dlc_trigger = yes + scope:title = { + any_succession_appointment_investors = { + count >= 1 + candidate = root + value >= 20 + NOT = { + house ?= root.house + } + is_alive = yes + is_imprisoned = no + NOR = { + has_relation_rival = root + is_at_war_with = root + } + } + } + } + save_scope_as = new_landed_admin + trigger_event = { + id = ep3_interactions_events.0600 + days = { 5 10 } + } + } + #Notification for house members of title holder + if = { + limit = { + scope:title.tier > tier_barony + primary_title.tier <= scope:title.tier + NOT = { has_character_flag = admin_title_gain_notification_sent } + exists = house + any_player = { + house ?= root.house + top_liege = root.top_liege + government_allows = administrative + this != root + } + } + add_character_flag = { + flag = admin_title_gain_notification_sent + days = 10 + } + save_scope_as = title_gainer + every_player = { + limit = { + house ?= root.house + top_liege = root.top_liege + government_allows = administrative + this != scope:title_gainer + scope:title != title:k_chrysanthemum_throne + } + send_interface_message = { + type = msg_admin_title_gained + title = msg_admin_title_gained_house.tt + desc = msg_admin_title_gained.desc + left_icon = scope:title_gainer + right_icon = scope:title + } + } + } + #Notification for admin investors in new title holder + if = { + limit = { + NOT = { has_character_flag = admin_title_gain_notification_sent } + scope:title = { + tier > tier_barony + any_succession_appointment_investors = { + is_ai = no + candidate = root + trigger_if = { + limit = { exists = root.house } + NOT = { house ?= root.house } + } + } + } + } + add_character_flag = { + flag = admin_title_gain_notification_sent + days = 10 + } + save_scope_as = title_gainer + scope:title = { + every_succession_appointment_investors = { + candidate = root + value > 0 + limit = { + is_ai = no + trigger_if = { + limit = { exists = root.house } + NOT = { house ?= root.house } + } + } + send_interface_message = { + type = msg_admin_title_gained + title = msg_admin_title_gained_investor.tt + desc = msg_admin_title_gained.desc + left_icon = scope:title_gainer + right_icon = scope:title + } + } + every_succession_appointment_investors = { + candidate = root + value < 0 + limit = { + is_ai = no + trigger_if = { + limit = { exists = root.house } + NOT = { house ?= root.house } + } + } + send_interface_message = { + type = msg_admin_title_gained_foe + title = msg_admin_title_gained_foe.tt + desc = msg_admin_title_gained.desc + left_icon = scope:title_gainer + right_icon = scope:title + } + } + } + } + + # Merit based candidate score bonus is removed when successfully getting a new governorship + if = { + limit = { + OR = { + has_variable = merit_civilian_career_score_bonus + has_variable = merit_military_career_score_bonus + } + is_landed = yes + scope:title.tier >= primary_title.tier + } + if = { + limit = { has_variable = merit_civilian_career_score_bonus } + remove_variable = merit_civilian_career_score_bonus + } + else_if = { + limit = { has_variable = merit_military_career_score_bonus } + remove_variable = merit_military_career_score_bonus + } + } + } + + ######## + # MISC # + ######## + + # TGP, bow before liege mandated + if = { + limit = { + culture = { has_cultural_parameter = must_pledge_loyalty_to_liege } + } + if = { # if you are now the top liege, all your direct vassals with the same parameter who have not yet sworn fealty to you must swear fealty + limit = { + this = top_liege + primary_title.tier <= scope:title.tier + } + every_vassal = { + limit = { + culture = { has_cultural_parameter = must_pledge_loyalty_to_liege } + NOT = { var:pledge_loyalty_to_liege_grace ?= liege } + NOT = { owns_story_of_type = story_cycle_pledge_loyalty_to_liege_overdue } + } + create_story = story_cycle_pledge_loyalty_to_liege_overdue + random_owned_story = { + type = story_cycle_pledge_loyalty_to_liege_overdue + set_variable = new_liege_variant + } + } + } + else_if = { # if you now have a new liege, and they also follow a culture with the Pay Homage requirement, you must swear continued fealty + limit = { + liege.culture = { has_cultural_parameter = must_pledge_loyalty_to_liege } + NOT = { var:pledge_loyalty_to_liege_grace ?= liege } + NOT = { owns_story_of_type = story_cycle_pledge_loyalty_to_liege_overdue } + } + create_story = story_cycle_pledge_loyalty_to_liege_overdue + random_owned_story = { + type = story_cycle_pledge_loyalty_to_liege_overdue + set_variable = new_title_variant + } } } @@ -1073,33 +2365,80 @@ on_title_gain = { } } - # EP3 ADVENTURERS TELEPORT TO THEIR CAMP - trigger_event = { - id = title_event.9911 - days = 1 - } - - current_travel_plan ?= { - if = { - limit = { is_travel_with_domicile = yes } - abort_travel_plan = yes - } - } - - # EP3 ADVENTURER BEING INHERITED BY LANDED + # Everything that requires a previous_holder if = { limit = { - scope:title = { - has_variable = adventurer_creation_reason + exists = scope:previous_holder + } + # If a player is on their way to pay homage, invalidate. + if = { + limit = { + any_player = { var:homage_liege_scope ?= scope:previous_holder } } - any_held_title = { - NOT = { has_variable = adventurer_creation_reason } + every_player = { + limit = { + var:homage_liege_scope ?= scope:previous_holder + NOT = { has_character_flag = currently_invalidating_petition_liege_travel } + } + current_travel_plan = { + if = { + limit = { can_cancel = yes } + cancel_travel_plan = yes + } + } + trigger_event = pay_homage.0601 + add_character_flag = { + flag = currently_invalidating_petition_liege_travel + days = 1 + } } } - every_held_title = { - limit = { has_variable = adventurer_creation_reason } - save_scope_as = landless_adventurer_title - root = { destroy_title = scope:landless_adventurer_title } + # If a player is on their way to bow before liege, invalidate. + else_if = { + limit = { + any_player = { var:pledge_loyalty_to_liege_scope ?= scope:previous_holder } + } + every_player = { + limit = { + var:pledge_loyalty_to_liege_scope ?= scope:previous_holder + NOT = { has_character_flag = currently_invalidating_petition_liege_travel } + } + current_travel_plan = { + if = { + limit = { can_cancel = yes } + cancel_travel_plan = yes + } + } + trigger_event = pledge_loyalty_to_liege.0601 + add_character_flag = { + flag = currently_invalidating_petition_liege_travel + days = 1 + } + } + } + + # Feud + if = { + limit = { + scope:previous_holder = { + house_has_feud_relation_with_trigger = { TARGET = root } + house = { + any_house_relation = { + any_relation_house = { + this = root.house + NOT = { this = scope:previous_holder.house } + } + var:house_feud_reason ?= flag:competing_claim + var:house_feud_attacker.house ?= scope:previous_holder.house + var:house_feud_victim.house ?= root.house + var:house_feud_title ?= scope:title + NOT = { exists = var:feud_avenged } + } + } + } + } + scope:previous_holder.house_head = { save_scope_as = house_feud_rival } + trigger_event = bp1_house_feud.7000 } } @@ -1112,419 +2451,55 @@ on_title_gain = { ep3_laamp_supporter_invalidated_effect = yes } - ### EP3 Admin Emperor Flavor ### + # Natural Disaster Recovery project invalidation + great_projects_ensure_unique_disaster_recovery_projects_effect = yes + + ########### + # Nomads/Tribals leaving confederacies + ########### if = { limit = { - has_ep3_dlc_trigger = yes - # You didn't just create the title - scope:title = { - tier >= tier_empire - any_past_holder = { - count >= 1 - } - # Your predecessor wasn't from your same house - not much to celebrate if you got the title from dad! - previous_holder ?= { - NOT = { house = root.house } - } - } - # Admin only - government_has_flag = government_is_administrative + is_confederation_member = yes + scope:title.tier >= tier_kingdom + government_is_japanese_trigger = no } - trigger_event = { - id = ep3_emperor_yearly.2050 - days = 5 + confederation = { + remove_confederation_member = root } } - # Admin vassals get the Governor trait when they first become a governor + # Peasants dress like nobles if landed if = { limit = { - is_governor = yes - NOT = { has_trait = governor } - scope:title = { - tier >= tier_duchy - } + has_character_flag = peasant_outfit + NOT = { government_has_flag = government_is_herder } } - add_trait = governor + remove_character_flag = peasant_outfit } - # Additional Flavor Titles - root = { additional_flavor_check_effect = yes } - - #Admin imperial succession notification event (it's a big deal) + # Petition allowed again if = { - limit = { - has_ep3_dlc_trigger = yes - government_has_flag = government_is_administrative - is_independent_ruler = yes - highest_held_title_tier >= tier_kingdom - scope:title = { - this = root.primary_title - } - #Checks so this event doesn't fire after character creation, although it's not really a problem if it does - trigger_if = { - limit = { - game_start_date = 867.1.1 - } - current_date >= 867.1.4 - } - trigger_if = { - limit = { - game_start_date = 1066.9.15 - } - current_date >= 1066.9.18 - } - trigger_if = { - limit = { - game_start_date = 1178.10.1 - } - current_date >= 1178.10.4 - } - } - save_scope_as = emperor - #Should trigger special event during fourth crusade! + limit = { has_variable = petition_title_cooldown } + remove_variable = petition_title_cooldown + } + + # Cancel Domicile travels + current_travel_plan ?= { if = { - limit = { - exists = global_var:byz_claimant_champion - global_var:byz_claimant_champion = { - any_owned_story = { - story_type = frankokratia_story - exists = var:byz_claimant - var:byz_claimant = { - this = root - } - } - } - } - every_vassal_or_below = { - limit = { - is_playable_character = yes - } - trigger_event = ep3_frankokratia_events.0110 - } + limit = { is_travel_with_domicile = yes } + abort_travel_plan = yes } - else = { - if = { - limit = { - exists = root.house - } - #normal triggering - every_vassal_or_below = { - limit = { - is_playable_character = yes - exists = scope:previous_holder - government_has_flag = government_is_administrative - OR = { - highest_held_title_tier >= tier_duchy - liege = root - } - } - trigger_event = { - id = ep3_governor_yearly.3060 - days = 1 - } - } - } - } - } - # Reset raid remit - if = { - limit = { - this = top_liege - any_noble_family = { count > 0 } - } - every_noble_family = { - holder = { remove_variable = raid_estate_permission } - } - } - #Admin event about rewarding person who helped you get title - if = { - limit = { - has_ep3_dlc_trigger = yes - government_has_flag = government_is_administrative - has_succession_appointment_investors = scope:title - scope:title = { - any_succession_appointment_investors = { - count >= 1 - candidate = root - value >= 20 - NOT = { - house ?= root.house - } - is_alive = yes - is_imprisoned = no - NOR = { - has_relation_rival = root - is_at_war_with = root - } - } - } - } - save_scope_as = new_landed_admin - trigger_event = { - id = ep3_interactions_events.0600 - days = { 5 10 } - } - } - - # Have we been given a fair shake as a laamp, but we're sucking? - if = { - limit = { - is_landless_adventurer = yes - is_ai = yes - scope:previous_holder = { is_ai = yes } - primary_title = { - any_past_holder = { count >= 4 } - } - NOR = { - # If the heir is sufficiently impressive, then we'll keep 'em around. - prestige_level >= 2 - # Legitimists are always worthwhile. - has_realm_law = camp_purpose_legitimists - # Reserve successful mercenary outfits. - AND = { - max_military_strength >= 1500 - # Allow absolute decimations to destroy mercs from time to time. - current_military_strength <= 150 - } - # Or those currently fighting alongside/against players. - AND = { - is_at_war = yes - OR = { - any_war_ally = { is_ai = no } - any_war_enemy = { is_ai = no } - } - } - # Depending on camp purpose, we want various skills. - AND = { - has_realm_law = camp_purpose_wanderers - OR = { - highest_skill_value >= very_high_skill_rating - prowess >= very_high_skill_rating - } - } - AND = { - has_realm_law = camp_purpose_mercenaries - OR = { - martial >= high_skill_rating - prowess >= high_skill_rating - } - } - AND = { - has_realm_law = camp_purpose_scholars - OR = { - learning >= high_skill_rating - diplomacy >= high_skill_rating - } - } - AND = { - has_realm_law = camp_purpose_explorers - OR = { - diplomacy >= high_skill_rating - stewardship >= high_skill_rating - } - } - AND = { - has_realm_law = camp_purpose_brigands - OR = { - intrigue >= high_skill_rating - prowess >= high_skill_rating - } - } - # Finally, keep anyone who's important to the player. - any_player = { - OR = { - root.dynasty ?= dynasty - is_consort_of = root - has_important_relationship_with_character_trigger = { CHARACTER = root } - any_pinned_character = { this = root } - any_pinned_character = { this = scope:previous_holder } - } - } - } - } - destroy_laamp_effect = { ADVENTURER = root } - } - #Notification for house members of title holder - if = { - limit = { - scope:title.tier > tier_barony - primary_title.tier <= scope:title.tier - government_has_flag = government_is_administrative - NOT = { has_character_flag = admin_title_gain_notification_sent } - house ?= { - any_house_member = { - is_ai = no - top_liege = root.top_liege - government_has_flag = government_is_administrative - NOT = { this = root } - } - } - } - add_character_flag = { - flag = admin_title_gain_notification_sent - days = 10 - } - save_scope_as = title_gainer - house = { - every_house_member = { - limit = { - is_ai = no - top_liege = root.top_liege - government_has_flag = government_is_administrative - NOT = { this = scope:title_gainer } - } - send_interface_message = { - type = msg_admin_title_gained - title = msg_admin_title_gained_house.tt - desc = msg_admin_title_gained.desc - left_icon = scope:title_gainer - right_icon = scope:title - } - } - } - } - #Notification for admin investors in new title holder - if = { - limit = { - NOT = { has_character_flag = admin_title_gain_notification_sent } - scope:title = { - tier > tier_barony - any_succession_appointment_investors = { - candidate = root - is_ai = no - trigger_if = { - limit = { exists = root.house } - NOT = { house ?= root.house } - } - } - } - } - add_character_flag = { - flag = admin_title_gain_notification_sent - days = 10 - } - save_scope_as = title_gainer - scope:title = { - every_succession_appointment_investors = { - candidate = root - value > 0 - limit = { - is_ai = no - trigger_if = { - limit = { exists = root.house } - NOT = { house ?= root.house } - } - } - send_interface_message = { - type = msg_admin_title_gained - title = msg_admin_title_gained_investor.tt - desc = msg_admin_title_gained.desc - left_icon = scope:title_gainer - right_icon = scope:title - } - } - every_succession_appointment_investors = { - candidate = root - value < 0 - limit = { - is_ai = no - trigger_if = { - limit = { exists = root.house } - NOT = { house ?= root.house } - } - } - send_interface_message = { - type = msg_admin_title_gained_foe - title = msg_admin_title_gained_foe.tt - desc = msg_admin_title_gained.desc - left_icon = scope:title_gainer - right_icon = scope:title - } - } - } - } - #Byzantium is reborn! - if = { - limit = { - scope:title = { - this = title:e_byzantium - } - exists = global_var:byz_collapse_counter - } - save_scope_as = byz_emperor - title:e_byzantium = { - every_in_de_jure_hierarchy = { - limit = { - tier <= tier_kingdom - tier >= tier_county - is_title_created = yes - exists = holder - } - if = { - limit = { - exists = holder - holder = { - is_alive = yes - NOR = { - is_in_list = byz_return_notify - any_held_title = { - this = title:e_byzantium - } - } - } - } - holder = { - add_to_list = byz_return_notify - } - } - } - } - title:e_latin_empire = { - every_in_de_jure_hierarchy = { - limit = { - tier <= tier_kingdom - tier >= tier_county - is_title_created = yes - exists = holder - } - if = { - limit = { - holder = { - is_alive = yes - NOR = { - is_in_list = byz_return_notify - any_held_title = { - this = title:e_byzantium - } - } - } - } - holder = { - add_to_list = byz_return_notify - } - } - } - } - every_in_list = { - list = byz_return_notify - trigger_event = ep3_frankokratia_events.0130 - } - remove_global_variable = byz_collapse_counter - } - - # Lil Johnny Lackland changes his nickname. - if = { - limit = { - has_nickname = nick_lackland_young - highest_held_title_tier >= tier_duchy - } - give_nickname = nick_lackland_ironic } # BP3 - Inspector perks cleanup effect landless_inspector_cleanup_modifier = yes - + + # Update flavorful titles (Margrave, Tenno, etc.) + additional_flavor_check_effect = yes + + # Update CoAs + scope:title = { update_dynamic_coa = yes } + ### MEMORIES - SHOULD STAY AT BOTTOM ### # Ascended to the throne if = { @@ -1533,7 +2508,7 @@ on_title_gain = { is_ruler = no highest_held_title_tier <= scope:title.tier government_has_flag = government_is_landless_adventurer - government_has_flag = government_is_administrative + government_allows = administrative } } if = { @@ -1597,38 +2572,136 @@ on_title_gain = { } } } - #Mongol empire and GoK should lose other empires + + # If we weren't already in a diarchy but should be, put us in one. if = { limit = { - primary_title ?= { - OR = { - this = title:e_mongol_empire - AND = { - exists = global_var:greatest_of_khans_title - this = global_var:greatest_of_khans_title - } - } - } - scope:title = { - tier = tier_empire - NOR = { - this = title:e_mongol_empire - AND = { - exists = global_var:greatest_of_khans_title - this = global_var:greatest_of_khans_title - } - } - } - is_ai = yes + scope:title.tier >= tier_county } - destroy_title = scope:title + trigger_event = { + id = diarchy.0011 + days = 1 + } + } + #Confederation titles being re-created... get confederation law bb + if = { + limit = { + scope:transfer_type = flag:created + scope:title = { + has_variable = confederation_culture + NOT = { + has_title_law = confederation_elective_succession_law + } + } + } + scope:bloc = { add_confederation_member = scope:bloc_joiner } + } + #Coronation modifier is lost + if = { + limit = { + scope:title = { + tier = tier_county + OR = { + has_county_modifier = major_coronation_approval_unsettled_modifier + has_county_modifier = medium_coronation_approval_unsettled_modifier + has_county_modifier = minor_coronation_approval_unsettled_modifier + has_county_modifier = major_coronation_approval_modifier + has_county_modifier = medium_coronation_approval_modifier + has_county_modifier = minor_coronation_approval_modifier + } + } + NOR = { + scope:transfer_type = flag:inheritance + scope:transfer_type = flag:leased_out + scope:transfer_type = flag:abdication + scope:transfer_type = flag:granted + scope:transfer_type = flag:election + scope:transfer_type = flag:abdication + scope:transfer_type = flag:stepped_down + scope:transfer_type = flag:swear_fealty + scope:transfer_type = flag:created + } + } + #Add negative modifiers if stolen + scope:title = { + switch = { + trigger = has_county_modifier + major_coronation_approval_modifier = { + scope:title = { + remove_county_modifier = major_coronation_approval_modifier + add_county_modifier = { + modifier = major_coronation_approval_malus_modifier + years = 5 + } + } + } + major_coronation_approval_unsettled_modifier = { + scope:title = { + remove_county_modifier = major_coronation_approval_unsettled_modifier + add_county_modifier = { + modifier = major_coronation_approval_malus_unsettled_modifier + years = 5 + } + } + } + medium_coronation_approval_modifier = { + scope:title = { + remove_county_modifier = medium_coronation_approval_modifier + add_county_modifier = { + modifier = medium_coronation_approval_malus_modifier + years = 5 + } + } + } + medium_coronation_approval_unsettled_modifier = { + scope:title = { + remove_county_modifier = medium_coronation_approval_unsettled_modifier + add_county_modifier = { + modifier = medium_coronation_approval_malus_unsettled_modifier + years = 5 + } + } + } + minor_coronation_approval_modifier = { + scope:title = { + remove_county_modifier = minor_coronation_approval_modifier + add_county_modifier = { + modifier = minor_coronation_approval_malus_modifier + years = 5 + } + } + } + minor_coronation_approval_unsettled_modifier = { + scope:title = { + remove_county_modifier = minor_coronation_approval_unsettled_modifier + add_county_modifier = { + modifier = minor_coronation_approval_malus_unsettled_modifier + years = 5 + } + } + } + } + } + } + + # House head goes to independent ruler for Japanese AI + if = { + limit = { + is_house_head = no + is_ai = yes + government_is_japanese_trigger = yes + house.house_head = { + is_ai = yes + is_vassal_or_below_of = root + } + is_independent_ruler = yes + } + house = { set_house_head = root } } } events = { roman_restoration.0005 #New Roman Emperor gets Augustus trait. (old holder, if still alive, loses it) roman_restoration.0199 #Restoring the Pentarchy. - religious_decision.0312 # Base game: new holder of a county with a runestone - fp1_other_decisions.0113 # FP1: new holder of a county with a runestone delay = { days = 1 } realm_maintenance.2001 #Big notification about inheriting emperor tier title british_isles.1032 # Danelaw-England partition calc. @@ -1649,7 +2722,6 @@ on_title_gain = { # scope:previous_holder = previous holder. Should be dead on_title_gain_inheritance = { events = { - diarchy.0011 delay = { days = 1 } # Try to end inherited entrenched regencies automatically — we need to launder this by a day to make sure the AI realises they've inherited a diarchy. diarchy.0113 @@ -1670,17 +2742,15 @@ on_title_gain_inheritance = { } add_dread = 50 } - - if = { - limit = { scope:title = title:e_roman_empire } + else_if = { + limit = { + OR = { + scope:title = title:h_roman_empire + scope:title = title:h_eastern_roman_empire + } + } set_variable = uses_custom_caesar_flavourization } - - # Additional Flavor Title - additional_flavor_check_effect = yes - - # BP3 - Inspector perks cleanup effect - landless_inspector_cleanup_modifier = yes } } @@ -1696,11 +2766,7 @@ on_title_gain_usurpation = { if = { limit = { # FP2 # We are only interested in the title within the Struggle Region - title:e_spain = { - any_in_de_jure_hierarchy = { - this = scope:title - } - } + scope:title.empire ?= title:e_spain # Only for usurpation scope:transfer_type = flag:usurped @@ -1730,10 +2796,9 @@ on_title_gain_usurpation = { } } } - - if = { + else_if = { limit = { # FP3 - title:e_persia = { any_in_de_jure_hierarchy = { this = scope:title } } + scope:title.empire ?= title:e_persia scope:transfer_type = flag:usurped root = { @@ -1763,12 +2828,6 @@ on_title_gain_usurpation = { } } } - - # Additional Flavor Titles - additional_flavor_check_effect = yes - - # BP3 - Inspector perks cleanup effect - landless_inspector_cleanup_modifier = yes } } @@ -1789,9 +2848,9 @@ on_title_lost = { has_title = title:k_fashion NOT = { any_held_title = { # Only trigger if you don't have any kingdom titles other than Fashion and the kingdom you just lost. Double negative is confusing but it's the only way I could think to script it - tier = tier_kingdom + title_tier = kingdom NOT = { this = title:k_fashion } - NOT = { this = scope:title } + this != scope:title } } } @@ -1850,7 +2909,7 @@ on_title_lost = { if = { limit = { is_playable_character = no - any_concubine = { count >= 1 } + any_concubine = { } } every_concubine = { root = { remove_concubine = prev } } } @@ -2001,7 +3060,7 @@ on_title_lost = { any_province_domicile = { is_domicile_type = estate owner ?= { - NOT = { top_liege = scope:new_holder.top_liege } + top_liege != scope:new_holder.top_liege } } } @@ -2015,7 +3074,7 @@ on_title_lost = { any_province_domicile = { is_domicile_type = estate owner ?= { - NOT = { top_liege = scope:new_holder.top_liege } + top_liege != scope:new_holder.top_liege } } } @@ -2025,10 +3084,10 @@ on_title_lost = { limit = { is_domicile_type = estate owner ?= { - NOT = { top_liege = scope:new_holder.top_liege } + top_liege != scope:new_holder.top_liege } } - + # First, let's do some damage to the estate - We randomize the level of damage taken random_list = { 40 = { # Damage 1 @@ -2091,13 +3150,13 @@ on_title_lost = { destroy_random_estate_building_variable_effect = yes destroy_random_estate_building_effect = yes } - + # Clear the variable if = { limit = { has_variable = domicile_damage_count } remove_variable = domicile_damage_count } - + # Then we'll move the estate to keep it within the realm's borders if = { # If you have a capital (i.e. you are a governor) let's move the estate there limit = { @@ -2140,12 +3199,12 @@ on_title_lost = { } move_domicile = owner.top_liege.capital_province } - + # Save the new estate location for msg domicile_location.barony = { save_scope_as = new_estate_location } - + # Finally, let's make sure the owner moves to the new estate location owner = { if = { @@ -2160,7 +3219,7 @@ on_title_lost = { } set_location_to_default = yes } - + # And notify the owner that all of this just happened if = { limit = { is_ai = no } @@ -2180,9 +3239,14 @@ on_title_lost = { # Additional Flavor Title additional_flavor_check_effect = yes - + if = { - limit = { scope:title = title:e_roman_empire } + limit = { + OR = { + scope:title = title:h_roman_empire + scope:title = title:h_eastern_roman_empire + } + } remove_variable = uses_custom_caesar_flavourization } #Notification for house members of loser @@ -2197,7 +3261,7 @@ on_title_lost = { } is_alive = yes NOT = { has_character_flag = admin_title_loss_notification_sent } - government_has_flag = government_is_administrative + government_allows = administrative house ?= { any_house_member = { is_ai = no @@ -2205,8 +3269,8 @@ on_title_lost = { limit = { exists = root.top_liege } top_liege = root.top_liege } - government_has_flag = government_is_administrative - NOT = { this = root } + government_allows = administrative + this != root } } } @@ -2223,8 +3287,8 @@ on_title_lost = { limit = { exists = root.top_liege } top_liege = root.top_liege } - government_has_flag = government_is_administrative - NOT = { this = scope:title_loser } + government_allows = administrative + this != scope:title_loser } send_interface_message = { type = msg_admin_title_lost @@ -2367,6 +3431,27 @@ on_title_lost = { remove_character_modifier = the_great_khan_modifier } } + #Coronation loyalty modifier + if = { + limit = { + scope:title = { + has_variable = coronation_loyal_to_title + var:coronation_loyal_to_title = { + NOT = { + this = scope:new_holder.primary_title + } + } + } + } + scope:title = { + remove_county_modifier = coronation_loyal_to_the_crown_modifier + remove_variable = coronation_loyal_to_title + add_county_modifier = { + modifier = coronation_still_loyal_modifier + years = 5 + } + } + } } } @@ -2388,7 +3473,7 @@ on_explicit_claim_gain = { if = { # FP2 limit = { NOT = { scope:transfer_type = flag:inheritance } - + root = { any_character_struggle = { is_struggle_type = iberian_struggle @@ -2416,7 +3501,7 @@ on_explicit_claim_gain = { else_if = { # FP3 limit = { NOT = { scope:transfer_type = flag:inheritance } - + root = { any_character_struggle = { is_struggle_type = persian_struggle @@ -2468,6 +3553,68 @@ on_rank_up = { # Will not fire during history execution or for dying characters events = { } effect = { + if = { # ACH call to coronation reminder + limit = { + coronation_trigger = yes + NOT = { + has_game_rule = coronation_laws_off + } + is_ai = no + primary_title.tier >= tier_kingdom + has_realm_law = uncrowned + NOR = { + has_variable = crowned_king_var + has_variable = crowned_emperor_var + } + NOR = { + has_character_flag = had_coronation_reminder + any_sponsored_inspiration = { has_inspiration_type = smith_inspiration } + } + is_available_adult = yes + } + trigger_event = { + id = ach_yearly_events.1005 + months = 4 + } + } + #ACH new emperors losing their crowned status + else_if = { + limit = { + coronation_trigger = yes + NOR = { + has_game_rule = coronation_laws_no_imperial_uncrowned + has_game_rule = coronation_laws_off + has_character_flag = claimed_the_mandate_of_heaven + } + highest_held_title_tier >= tier_empire + exists = scope:title + scope:title = { + tier >= tier_kingdom + #Just double checking + tier < root.highest_held_title_tier + } + OR = { + has_realm_law = crowned_king + has_realm_law = crowned_emperor + has_variable = crowned_king_var + has_variable = crowned_emperor_var + } + } + if = { + limit = { + has_variable = crowned_emperor_var + } + remove_variable = crowned_emperor_var + } + if = { + limit = { + has_variable = crowned_king_var + } + remove_variable = crowned_king_var + } + add_realm_law_skip_effects = uncrowned + trigger_event = ach_yearly_events.1010 + } if = { limit = { is_landed = yes } add_achievement_flag_effect = { FLAG = achievement_moving_up_in_the_world_flag } @@ -2500,7 +3647,7 @@ on_rank_up = { # Will not fire during history execution or for dying characters update_embassies_effect = yes } if = { - limit = { is_independent_ruler = yes } + limit = { top_liege = this } remove_variable = use_co_ruler_title } # Make a note of ranking up for stele purposes. @@ -2525,12 +3672,13 @@ on_rank_up = { # Will not fire during history execution or for dying characters # Additional Flavor Title additional_flavor_check_effect = yes + #Admin kings becoming emperors need their MAA transferred to new primary title if = { limit = { is_independent_ruler = yes - government_has_flag = government_is_administrative - scope:title = { + government_allows = administrative + scope:title ?= { any_title_maa_regiment = { count >= 1 } @@ -2540,6 +3688,91 @@ on_rank_up = { # Will not fire during history execution or for dying characters transfer_title_maa_ownership = root.primary_title } } + + if = { + limit = { + is_independent_ruler = yes + government_has_flag = government_is_celestial + scope:title ?= { + tier >= tier_kingdom + has_custom_title_name = yes + } + primary_title = { + has_custom_title_name = no + } + } + scope:title = { + move_title_name_to = root.primary_title + reset_title_name = yes + } + } + if = { + limit = { + is_independent_ruler = yes + government_has_flag = government_is_celestial + highest_held_title_tier >= tier_kingdom + OR = { + primary_title ?= { + has_custom_title_name = no + } + primary_title.previous_holder.dynasty != root.dynasty + } + trigger_if = { + limit = { + tgp_capital_not_in_chinese_naming_region = yes + } + primary_title ?= title:h_china + } + } + if = { + limit = { + is_ai = no + } + trigger_event = { + id = tgp_dynastic_cycle.9000 + days = 1 # so the player gets to choose first + } + } + else = { + trigger_event = { + id = tgp_dynastic_cycle.9000 + days = 2 + } + } + } + else_if = { # Make sure non-Celestials get to rename/recolor china + limit = { + is_independent_ruler = yes + has_tgp_dlc_trigger = yes + NOT = { government_has_flag = government_is_celestial } + exists = var:claimed_mandate_var + primary_title ?= title:h_china + OR = { + primary_title ?= { + has_custom_title_name = no + } + primary_title.previous_holder.dynasty != root.dynasty + } + } + if = { + limit = { + is_ai = no + } + trigger_event = { + id = tgp_dynastic_cycle.9000 + days = 1 # so the player gets to choose first + } + } + else = { + trigger_event = { + id = tgp_dynastic_cycle.9000 + days = 2 + } + } + } + + # ACH - Remove Coronated laws when titles are passed onto a new character + coronation_reset_realm_law_effect = yes } } @@ -2574,7 +3807,7 @@ on_rank_down = { # Will not fire during history execution or for dying character # Inform hostage havers if = { limit = { - any_home_court_hostage = { count >= 1 } + any_home_court_hostage = { } } save_scope_as = home_court every_home_court_hostage = { @@ -2585,9 +3818,20 @@ on_rank_down = { # Will not fire during history execution or for dying character } } } - + # Additional Flavor Title additional_flavor_check_effect = yes + + # ACH - Remove variables if they are going below certain ranks + coronation_reset_realm_law_variable_effect = yes + + # ACH - if you are below king tier, remove all oaths + if = { + limit = { + highest_held_title_tier < tier_kingdom + } + ach_remove_oaths_on_king_minus_effect = yes + } } } @@ -2600,11 +3844,12 @@ on_vassal_gained = { realm_maintenance.1000 # Notify vassals of new liege } effect = { - #Confederation members must be independent + #Nomadic Confederation members must be independent if = { limit = { scope:vassal = { is_confederation_member = yes + scope:vassal.confederation = { has_leading_house = no } } } scope:vassal.confederation = { @@ -2616,7 +3861,7 @@ on_vassal_gained = { limit = { has_any_landed_title_trigger = no } save_scope_as = new_liege if = { - limit = { is_independent_ruler = no } + limit = { top_liege != this } create_title_and_vassal_change = { type = swear_fealty save_scope_as = change @@ -2645,6 +3890,24 @@ on_vassal_gained = { scope:vassal = { additional_flavor_check_effect = yes } + + # Destroy ceremonial titles of vassalized realms + if = { + limit = { + # The necessary checks are baked into the effect below + scope:vassal = { + highest_held_title_tier >= tier_empire + any_held_title = { + OR = { + exists = var:ceremonial_title + exists = var:administrative_ui_special_title + } + } + } + } + # TGP end the ceremonial liege + tgp_destroy_ceremonial_throne_effect = yes + } } } @@ -2654,66 +3917,23 @@ on_vassal_gained = { # It is also fired for rulers gaining independence, those can be identified by checking current liege on_vassal_change = { effect = { - if = { - limit = { - OR = { - liege ?= { - NOT = { government_has_flag = government_is_administrative } - } - AND = { - is_independent_ruler = yes - primary_title.tier <= tier_duchy - } - } - any_held_title = { is_noble_family_title = yes } - } - every_held_title = { - limit = { is_noble_family_title = yes } - save_scope_as = title_to_destroy - root = { destroy_title = scope:title_to_destroy } - } - } - ### GOVERNORS CHANGE GOVERNMENT IF NEW LIEGE IS NOT ADMINISTRATIVE - if = { - limit = { - exists = top_liege - government_has_flag = government_is_administrative - NOT = { - top_liege = { government_has_flag = government_is_administrative } - } - } - top_liege = { save_scope_as = new_liege } - send_interface_message = { - type = msg_government_changed - title = new_liege_government_changed_title - desc = new_liege_government_changed_desc - right_icon = scope:new_liege - admin_change_government_effect = yes - } - hidden_effect = { - # VASSALS AND BELOW - every_vassal_or_below = { - limit = { government_has_flag = government_is_administrative } - send_interface_message = { - type = msg_government_changed - title = new_liege_government_changed_title - desc = new_liege_government_changed_desc - right_icon = scope:new_liege - admin_change_government_effect = yes - } - } - } - } ### If a admin duke-tier character becomes the top-liege's direct vassal, ensure that they have a noble family title if = { limit = { - government_has_flag = government_is_administrative - highest_held_title_tier >= tier_duchy + government_allows = administrative + is_house_head = yes + trigger_if = { + # This trigger is intentionally different from the similar effecy in on_title_gain up above. We want all direct vassals of the top liege to have a family title if they can + limit = { government_has_flag = government_has_county_tier_noble_families } + highest_held_title_tier >= tier_county + } + trigger_else = { highest_held_title_tier >= tier_duchy } liege = { - is_independent_ruler = yes - government_has_flag = government_is_administrative + top_liege = this + government_allows = administrative } NOR = { + any_held_title = { is_noble_family_title = yes } house = { any_house_member = { any_held_title = { is_noble_family_title = yes } @@ -2721,20 +3941,181 @@ on_vassal_change = { } } } + create_noble_family_effect = { GOVERNMENT_GIVER = this } domicile ?= { set_up_domicile_estate_effect = yes } } - ### If an admin ruler becomes independent, who are not of a high enough rank, changes government + ### If an admin ruler becomes independent... if = { limit = { liege = root # I.e. root is independent government_has_flag = government_is_administrative - highest_held_title_tier < tier_kingdom } - admin_change_government_effect = yes + # And is not of a high enough rank, change government + if = { + limit = { + administrative_tier_allows_independence = no + } + admin_change_government_effect = yes + } + # If they can be independent, make sure they have a noble family title + else_if = { + limit = { + NOT = { + any_held_title = { + is_noble_family_title = yes + } + } + } + create_noble_family_effect = { GOVERNMENT_GIVER = this } + domicile ?= { set_up_domicile_estate_effect = yes } + } + } + ### Independent Celestial rulers who become direct vassals of a top liege adopt Military obligations if they have title troops - Everyone else will default to Standard. + if = { + limit = { + government_has_flag = government_is_celestial + scope:old_liege = this # I.e. they were independent + liege != this + liege = top_liege + primary_title = { + any_title_maa_regiment = { count >= 1 } + } + } + vassal_contract_set_obligation_level = { type = celestial_provinces level = 3 } + } + + ### If a minister becomes independent we destroy the ministry title + if = { + limit = { + OR = { + liege ?= { tgp_has_access_to_ministry_trigger = no } + this = top_liege + } + any_held_title = { + OR = { + this = title:e_minister_chancellor + this = title:e_minister_censor + this = title:e_minister_grand_marshal + this = title:e_minister_of_personnel + this = title:e_minister_of_revenue + this = title:e_minister_of_rites + this = title:e_minister_of_war + this = title:e_minister_of_justice + this = title:e_minister_of_works + } + } + } + every_held_title = { + switch = { + trigger = this + title:e_minister_chancellor = { + root = { destroy_title = title:e_minister_chancellor } + } + title:e_minister_censor = { + root = { destroy_title = title:e_minister_censor } + } + title:e_minister_grand_marshal = { + root = { destroy_title = title:e_minister_grand_marshal } + } + title:e_minister_of_personnel = { + root = { destroy_title = title:e_minister_of_personnel } + } + title:e_minister_of_revenue = { + root = { destroy_title = title:e_minister_of_revenue } + } + title:e_minister_of_rites = { + root = { destroy_title = title:e_minister_of_rites } + } + title:e_minister_of_war = { + root = { destroy_title = title:e_minister_of_war } + } + title:e_minister_of_justice = { + root = { destroy_title = title:e_minister_of_justice } + } + title:e_minister_of_works = { + root = { destroy_title = title:e_minister_of_works } + } + } + } } # Additional Flavor Title additional_flavor_check_effect = yes + + if = { + limit = { + # We have become independent! + NOT = { + scope:old_liege = root + } + liege = root + government_has_flag = government_is_celestial + highest_held_title_tier >= tier_kingdom + primary_title = { + has_custom_title_name = no # sanity check + } + OR = { + tgp_capital_not_in_chinese_naming_region = no + primary_title = title:h_china # failsafe, in case this somehow ends up here + } + } + if = { + limit = { + is_ai = no + } + trigger_event = { + id = tgp_dynastic_cycle.9000 + days = 1 # so the player gets to choose first + } + } + else = { + trigger_event = { + id = tgp_dynastic_cycle.9000 + days = 2 + } + } + } + if = { + limit = { + scope:old_liege = root + NOT = { + liege = root + } + primary_title ?= { + has_custom_title_name = yes + } + } + primary_title = { + reset_title_name = yes + } + } + + # Destroy ceremonial titles of vassalized realms + if = { + limit = { + # The necessary checks are baked into the effect below + highest_held_title_tier >= tier_empire + any_held_title = { + OR = { + exists = var:ceremonial_title + exists = var:administrative_ui_special_title + } + } + } + # TGP end the ceremonial liege + tgp_destroy_ceremonial_throne_effect = yes + } + + # Bloc + if = { + # Let code trigger this if this is due to succession + limit = { + scope:old_liege ?= { + is_alive = yes + } + } + tgp_liege_change_bloc_management_effect = { VASSAL = root } + } } } @@ -2898,3 +4279,10 @@ on_realm_capital_change = { } } } + +# Primary Title has changed +# root = character +# scope:previous_title = previous primary title held by character +# Not called if new primary title is the same as the previous primary title +on_primary_title_change = { +} diff --git a/N3OW/common/scripted_effects/00_accolades_scripted_effects.txt b/N3OW/common/scripted_effects/00_accolades_scripted_effects.txt new file mode 100644 index 00000000..a2c88fd7 --- /dev/null +++ b/N3OW/common/scripted_effects/00_accolades_scripted_effects.txt @@ -0,0 +1,4141 @@ +################################################## +# Accolade Effects + +accolades_development_growth_for_least_developed_county_effect = { + # First, should this apply at all? + if = { + limit = { + # Do you have a knight with this accolade at all? + any_active_accolade = { + OR = { + has_accolade_parameter = accolade_development_growth_on_tournament_completion_low + has_accolade_parameter = accolade_development_growth_on_tournament_completion_high + } + } + # Plus, pre-filter out landless rulers. + is_landed_or_landless_administrative = yes + } + # Now, find our least developed county. + ordered_held_title = { + title_tier = county + order_by = { + value = development_level + multiply = -1 + } + save_scope_as = least_developed_county + } + # Next, we'll need to apply a bonus to it. + ## Low boost. + if = { + limit = { + any_active_accolade = { + accolade_parameter = accolade_development_growth_on_tournament_completion_low + } + } + scope:least_developed_county = { change_development_progress_with_overflow = accolade_development_growth_on_tournament_completion_value } + } + ## High boost. + if = { + limit = { + any_active_accolade = { + accolade_parameter = accolade_development_growth_on_tournament_completion_high + } + } + scope:least_developed_county = { change_development_level = accolade_development_level_on_tournament_completion_value } + } + } +} + +accolades_contender_tournament_xp_gain_effect = { + custom_tooltip = accolade_tournament_xp_gain_contender_only.tt + hidden_effect = { + if = { + limit = { + NOT = { has_trait = tourney_participant } + } + add_trait = tourney_participant + } + } + # Low level bonus + if = { + limit = { + accolade = { + has_accolade_parameter = accolade_tournament_xp_gain_contender_only_low + } + } + + hidden_effect = { + random_list = { + 10 = { + show_chance = no + add_trait_xp = { + trait = tourney_participant + track = foot + value = accolade_contender_trait_xp_low_value + } + } + 10 = { + show_chance = no + add_trait_xp = { + trait = tourney_participant + track = horse + value = accolade_contender_trait_xp_low_value + } + } + 10 = { + show_chance = no + add_trait_xp = { + trait = tourney_participant + track = bow + value = accolade_contender_trait_xp_low_value + } + } + 10 = { + show_chance = no + add_trait_xp = { + trait = tourney_participant + track = wit + value = accolade_contender_trait_xp_low_value + } + } + } + } + } + # Mid level bonus + else_if = { + limit = { + accolade = { + has_accolade_parameter = accolade_tournament_xp_gain_contender_only + } + } + hidden_effect = { + random_list = { + 10 = { + add_trait_xp = { + trait = tourney_participant + track = foot + value = accolade_contender_trait_xp_medium_value + } + } + 10 = { + add_trait_xp = { + trait = tourney_participant + track = horse + value = accolade_contender_trait_xp_medium_value + } + } + 10 = { + add_trait_xp = { + trait = tourney_participant + track = bow + value = accolade_contender_trait_xp_medium_value + } + } + 10 = { + add_trait_xp = { + trait = tourney_participant + track = wit + value = accolade_contender_trait_xp_medium_value + } + } + } + } + } + # High level bonus + else_if = { + limit = { + accolade = { + has_accolade_parameter = accolade_tournament_xp_gain_contender_only_high + } + } + hidden_effect = { + random_list = { + 10 = { + add_trait_xp = { + trait = tourney_participant + track = foot + value = accolade_contender_trait_xp_high_value + } + } + 10 = { + add_trait_xp = { + trait = tourney_participant + track = horse + value = accolade_contender_trait_xp_high_value + } + } + 10 = { + add_trait_xp = { + trait = tourney_participant + track = bow + value = accolade_contender_trait_xp_high_value + } + } + 10 = { + add_trait_xp = { + trait = tourney_participant + track = wit + value = accolade_contender_trait_xp_high_value + } + } + } + } + } +} + +accolades_all_knights_liege_tournament_xp_gain_effect = { + custom_tooltip = accolade_tournament_xp_gain_all_knights.tt + hidden_effect = { + if = { + limit = { + NOT = { has_trait = tourney_participant } + } + add_trait = tourney_participant + } + } + # low bonus + if = { + limit = { + liege = { + any_active_accolade = { + accolade_parameter = accolade_tournament_xp_gain_all_knights + } + } + } + hidden_effect = { + random_list = { + 10 = { + modifier = { + add = 20 + has_trait_xp = { + trait = tourney_participant + track = foot + value = 30 + } + } + add_trait_xp = { + trait = tourney_participant + track = foot + value = accolade_all_knights_trait_xp_low_value + } + } + 10 = { + modifier = { + add = 20 + has_trait_xp = { + trait = tourney_participant + track = horse + value = 30 + } + } + add_trait_xp = { + trait = tourney_participant + track = horse + value = accolade_all_knights_trait_xp_low_value + } + } + 10 = { + modifier = { + add = 20 + has_trait_xp = { + trait = tourney_participant + track = bow + value = 30 + } + } + add_trait_xp = { + trait = tourney_participant + track = bow + value = accolade_all_knights_trait_xp_low_value + } + } + 10 = { + modifier = { + add = 20 + has_trait_xp = { + trait = tourney_participant + track = wit + value = 30 + } + } + add_trait_xp = { + trait = tourney_participant + track = wit + value = accolade_all_knights_trait_xp_low_value + } + } + } + } + } + # high bonus + else_if = { + limit = { + liege = { + any_active_accolade = { + accolade_parameter = accolade_tournament_xp_gain_all_knights_high + } + } + } + hidden_effect = { + random_list = { + 10 = { + modifier = { + add = 20 + has_trait_xp = { + trait = tourney_participant + track = foot + value = 30 + } + } + add_trait_xp = { + trait = tourney_participant + track = foot + value = accolade_all_knights_trait_xp_high_value + } + } + 10 = { + modifier = { + add = 20 + has_trait_xp = { + trait = tourney_participant + track = horse + value = 30 + } + } + add_trait_xp = { + trait = tourney_participant + track = horse + value = accolade_all_knights_trait_xp_high_value + } + } + 10 = { + modifier = { + add = 20 + has_trait_xp = { + trait = tourney_participant + track = bow + value = 30 + } + } + add_trait_xp = { + trait = tourney_participant + track = bow + value = accolade_all_knights_trait_xp_high_value + } + } + 10 = { + modifier = { + add = 20 + has_trait_xp = { + trait = tourney_participant + track = wit + value = 30 + } + } + add_trait_xp = { + trait = tourney_participant + track = wit + value = accolade_all_knights_trait_xp_high_value + } + } + } + } + } +} + +#GLORY GAIN FOR TOURS +accolades_activity_complete_tour_glory_effect = { + # Decent glory if you did a grand-ass tour + if = { + limit = { + scope:activity = { + any_attending_character = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + } + scope:activity = { + variable_list_size = { + name = tour_vassals_to_visit + value >= activity_tour_high_stop_value + } + } + } + scope:activity = { + add_activity_log_entry = { + key = liege_accolades_glory_reward_tour + tags = { completed } + score = 10 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + every_attending_character = { + limit = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + accolade = { add_glory = medium_glory_gain } + } + } + } + } + # An ok amount for a sort of long tour + else_if = { + limit = { + scope:activity = { + any_attending_character = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + } + scope:activity = { + variable_list_size = { + name = tour_vassals_to_visit + value >= activity_tour_low_stop_value + } + } + } + scope:activity = { + add_activity_log_entry = { + key = liege_accolades_glory_reward_tour + tags = { completed } + score = 10 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + every_attending_character = { + limit = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + accolade = { add_glory = minor_glory_gain } + } + } + } + } + # Otherwise, it's scraps for you. + else_if = { + limit = { + scope:activity = { + any_attending_character = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + } + } + scope:activity = { + add_activity_log_entry = { + key = liege_accolades_glory_reward_tour + tags = { completed } + score = 10 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + every_attending_character = { + limit = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + accolade = { add_glory = minimal_glory_gain } + } + } + } + } +} + +#GLORY GAIN FOR HUNTS +accolades_activity_complete_hunt_glory_effect = { + save_scope_as = root_scope + # Glory management. + ## We want to toss out a little glory to knights who go hunting without their liege + if = { + limit = { + scope:root_scope = { + is_acclaimed = yes + #this acclaimed knight's liege is not present + exists = liege + scope:root_scope.location != liege.location + } + } + scope:root_scope = { + accolade = { + add_glory = { + value = 20 + multiply = hunt_prestige_animal_level_value + if = { + limit = { scope:activity.var:hunt_success = flag:no } + divide = 5 + } + } + } + } + } + ## We want to toss out a little glory when lieges' knights go hunting with them + else_if = { + limit = { + scope:activity = { + any_attending_character = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + } + } + scope:activity = { + every_attending_character = { + limit = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + accolade = { + add_glory = { + value = 20 + multiply = hunt_prestige_animal_level_value + if = { + limit = { scope:activity.var:hunt_success = flag:no } + divide = 5 + } + } + } + } + } + } +} + +#GLORY GAIN FOR WEDDINGS +accolades_activity_complete_wedding_glory_effect = { + # Much glory if you did a magnificent wedding + if = { + limit = { + scope:root_scope = { + is_acclaimed = yes + #this acclaimed knight's liege is not present + exists = liege + scope:root_scope.location != liege.location + } + scope:activity = { + # perfect options + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_good + } + has_activity_option = { + category = wedding_option_food + option = wedding_food_good + } + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_good + } + } + } + scope:activity = { + add_activity_log_entry = { + key = knight_accolade_glory_reward + tags = { completed } + score = 10 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + #more glory gain if primary participant + if = { + limit = { + scope:root_scope = { + OR = { + this = scope:spouse_1 + this = scope:spouse_2 + } + } + } + scope:root_scope = { + accolade = { add_glory = massive_glory_gain } + } + } + else = { + scope:root_scope = { + accolade = { add_glory = minor_glory_gain } + } + } + } + } + } + # Much glory if you did a magnificent wedding + else_if = { + limit = { + scope:activity = { + any_attending_character = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + } + scope:activity = { + # perfect options + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_good + } + has_activity_option = { + category = wedding_option_food + option = wedding_food_good + } + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_good + } + } + } + scope:activity = { + add_activity_log_entry = { + key = liege_accolades_glory_reward + tags = { completed } + score = 10 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + #more glory gain if you are primary participant + if = { + limit = { + OR = { + scope:root_scope = scope:host + scope:root_scope = scope:spouse_1 + scope:root_scope = scope:spouse_2 + } + } + every_attending_character = { + limit = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + if = { + limit = { + OR = { + this = scope:spouse_1 + this = scope:spouse_2 + } + } + accolade = { add_glory = massive_glory_gain } + } + else = { + accolade = { add_glory = medium_glory_gain } + } + } + } + # more glory for a primary participant knight + else = { + every_attending_character = { + limit = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + if = { + limit = { + OR = { + this = scope:spouse_1 + this = scope:spouse_2 + } + } + accolade = { add_glory = massive_glory_gain } + } + else = { + accolade = { add_glory = minor_glory_gain } + } + } + } + } + } + } + # Decent glory if acclaimed knights went to a nice wedding without liege + else_if = { + limit = { + scope:root_scope = { + is_acclaimed = yes + #this acclaimed knight's liege is not present + exists = liege + scope:root_scope.location != liege.location + } + scope:activity = { + OR = { + AND = { + # at least two tier threes + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_good + } + has_activity_option = { + category = wedding_option_food + option = wedding_food_good + } + } + AND = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_good + } + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_good + } + } + AND = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_good + } + has_activity_option = { + category = wedding_option_food + option = wedding_food_good + } + } + # a tier 3 and two tier 2s + AND = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_good + } + has_activity_option = { + category = wedding_option_food + option = wedding_food_normal + } + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_normal + } + } + AND = { + has_activity_option = { + category = wedding_option_food + option = wedding_food_good + } + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_normal + } + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_normal + } + } + AND = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_good + } + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_normal + } + has_activity_option = { + category = wedding_option_food + option = wedding_food_normal + } + } + } + } + } + scope:activity = { + add_activity_log_entry = { + key = knight_accolade_glory_reward + tags = { completed } + score = 10 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + #more glory gain if primary participant + if = { + limit = { + scope:root_scope = { + OR = { + scope:root_scope = scope:spouse_1 + scope:root_scope = scope:spouse_2 + } + } + } + scope:root_scope = { + accolade = { add_glory = major_glory_gain } + } + } + else = { + scope:root_scope = { + accolade = { add_glory = minimal_glory_gain } + } + } + } + } + } + # Decent glory if you went to a nice wedding with acclaimed knights + else_if = { + limit = { + scope:activity = { + any_attending_character = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + } + scope:activity = { + OR = { + AND = { + # at least two tier threes + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_good + } + has_activity_option = { + category = wedding_option_food + option = wedding_food_good + } + } + AND = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_good + } + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_good + } + } + AND = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_good + } + has_activity_option = { + category = wedding_option_food + option = wedding_food_good + } + } + # a tier 3 and two tier 2s + AND = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_good + } + has_activity_option = { + category = wedding_option_food + option = wedding_food_normal + } + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_normal + } + } + AND = { + has_activity_option = { + category = wedding_option_food + option = wedding_food_good + } + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_normal + } + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_normal + } + } + AND = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_good + } + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_normal + } + has_activity_option = { + category = wedding_option_food + option = wedding_food_normal + } + } + } + } + } + scope:activity = { + add_activity_log_entry = { + key = liege_accolades_glory_reward + tags = { completed } + score = 10 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + #more glory gain if you are primary participant + if = { + limit = { + OR = { + scope:root_scope = scope:host + scope:root_scope = scope:spouse_1 + scope:root_scope = scope:spouse_2 + } + } + every_attending_character = { + limit = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + if = { + limit = { + OR = { + this = scope:spouse_1 + this = scope:spouse_2 + } + } + accolade = { add_glory = major_glory_gain } + } + else = { + accolade = { add_glory = minor_glory_gain } + } + } + } + # more glory for a primary participant knight + else = { + every_attending_character = { + limit = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + if = { + limit = { + OR = { + this = scope:spouse_1 + this = scope:spouse_2 + } + } + accolade = { add_glory = major_glory_gain } + } + else = { + accolade = { add_glory = minimal_glory_gain } + } + } + } + } + } + } + # An ok amount for a sort of grand wedding, knights without attending liege + else_if = { + limit = { + scope:root_scope = { + is_acclaimed = yes + #this acclaimed knight's liege is not present + exists = liege + scope:root_scope.location != liege.location + } + scope:activity = { + # 1 tier 3 option + OR = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_good + } + has_activity_option = { + category = wedding_option_food + option = wedding_food_good + } + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_good + } + # 2 tier 2 options + AND = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_normal + } + has_activity_option = { + category = wedding_option_food + option = wedding_food_normal + } + } + AND = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_normal + } + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_normal + } + } + AND = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_normal + } + has_activity_option = { + category = wedding_option_food + option = wedding_food_normal + } + } + } + } + } + scope:activity = { + add_activity_log_entry = { + key = knight_accolade_glory_reward + tags = { completed } + score = 10 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + #more glory gain if primary participant + if = { + limit = { + scope:root_scope = { + OR = { + this = scope:spouse_1 + this = scope:spouse_2 + } + } + } + scope:root_scope = { + accolade = { add_glory = medium_glory_gain } + } + } + else = { + scope:root_scope = { + accolade = { add_glory = sub_minimal_glory_gain } + } + } + } + } + } + # An ok amount for a sort of grand wedding, liege with attending knights + else_if = { + limit = { + scope:activity = { + any_attending_character = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + } + scope:activity = { + #this + OR = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_good + } + has_activity_option = { + category = wedding_option_food + option = wedding_food_good + } + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_good + } + # 2 tier 2 options + AND = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_normal + } + has_activity_option = { + category = wedding_option_food + option = wedding_food_normal + } + } + AND = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_normal + } + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_normal + } + } + AND = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_normal + } + has_activity_option = { + category = wedding_option_food + option = wedding_food_normal + } + } + } + } + } + scope:activity = { + add_activity_log_entry = { + key = liege_accolades_glory_reward + tags = { completed } + score = 10 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + #more glory gain if primary participant + if = { + limit = { + OR = { + scope:root_scope = scope:host + scope:root_scope = scope:spouse_1 + scope:root_scope = scope:spouse_2 + } + } + every_attending_character = { + limit = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + if = { + limit = { + OR = { + this = scope:spouse_1 + this = scope:spouse_2 + } + } + accolade = { add_glory = medium_glory_gain } + } + else = { + accolade = { add_glory = minimal_glory_gain } + } + } + } + # more glory for a primary participant knight + else = { + every_attending_character = { + limit = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + if = { + limit = { + OR = { + this = scope:spouse_1 + this = scope:spouse_2 + } + } + accolade = { add_glory = medium_glory_gain } + } + else = { + accolade = { add_glory = sub_minimal_glory_gain } + } + } + } + } + } + } + # Otherwise, attending knights without liege only get glory as a spouse + else_if = { + limit = { + scope:root_scope = { + OR = { + this = scope:spouse_1 + this = scope:spouse_2 + } + is_acclaimed = yes + #this acclaimed knight's liege is not present + exists = liege + scope:root_scope.location != liege.location + } + } + scope:activity = { + add_activity_log_entry = { + key = knight_accolade_glory_reward + tags = { completed } + score = 10 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + scope:root_scope = { + accolade = { add_glory = minor_glory_gain } + } + } + } + } + # attending knights of liege get scraps + else_if = { + limit = { + scope:activity = { + any_attending_character = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + } + } + scope:activity = { + add_activity_log_entry = { + key = liege_accolades_glory_reward + tags = { completed } + score = 10 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + #more glory gain if primary participant + if = { + limit = { + OR = { + scope:root_scope = scope:host + scope:root_scope = scope:spouse_1 + scope:root_scope = scope:spouse_2 + } + } + every_attending_character = { + limit = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + if = { + limit = { + OR = { + this = scope:spouse_1 + this = scope:spouse_2 + } + } + accolade = { add_glory = minor_glory_gain } + } + else = { + accolade = { add_glory = sub_minimal_glory_gain } + } + } + } + # more glory for a primary participant knight + else = { + every_attending_character = { + limit = { + is_knight_of = scope:root_scope + is_acclaimed = yes + OR = { + this = scope:spouse_1 + this = scope:spouse_2 + } + } + accolade = { add_glory = minor_glory_gain } + } + } + } + } + } +} + +#GLORY GAIN FOR FEASTS +accolades_activity_complete_feast_glory_effect = { + if = { + limit = { + scope:activity.special_guest:honorary_guest_regular ?= { + is_acclaimed = yes + } + } + scope:activity.special_guest:honorary_guest_regular ?= { + save_scope_as = honorary_guest_knight + } + } + # Decent glory if the acclaimed knight attends a grand-ass feast without liege + if = { + limit = { + scope:root_scope = { + is_acclaimed = yes + #this acclaimed knight's liege is not present + exists = liege + scope:root_scope.location != liege.location + } + scope:activity = { + has_activity_option = { + category = feast_option_food + option = feast_food_good + } + has_activity_option = { + category = feast_option_courses + option = feast_courses_good + } + } + } + scope:activity = { + add_activity_log_entry = { + key = knight_accolade_glory_reward + tags = { completed } + score = 10 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + if = { + limit = { + #more glory gain only if honored guest + exists = scope:honorary_guest_knight + scope:root_scope = scope:honorary_guest_knight + } + scope:root_scope = { + accolade = { add_glory = major_glory_gain } + } + } + else = { + scope:root_scope = { + accolade = { add_glory = minimal_glory_gain } + } + } + + } + } + } + # Decent glory if the liege attends a grand-ass feast with acclaimed knights + else_if = { + limit = { + scope:activity = { + any_attending_character = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + } + scope:activity = { + has_activity_option = { + category = feast_option_food + option = feast_food_good + } + has_activity_option = { + category = feast_option_courses + option = feast_courses_good + } + } + } + scope:activity = { + add_activity_log_entry = { + key = liege_accolades_glory_reward + tags = { completed } + score = 10 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + #more glory gain if host + if = { + limit = { + scope:root_scope = { + this = scope:host + } + } + every_attending_character = { + limit = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + if = { + limit = { + exists = scope:honorary_guest_knight + this = scope:honorary_guest_knight + } + accolade = { add_glory = major_glory_gain } + } + else = { + accolade = { add_glory = minor_glory_gain } + } + } + } + else = { + every_attending_character = { + limit = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + if = { + limit = { + exists = scope:honorary_guest_knight + this = scope:honorary_guest_knight + } + accolade = { add_glory = major_glory_gain } + } + else = { + accolade = { add_glory = minimal_glory_gain } + } + } + } + } + } + } + # An ok amount for a sort of grand feast, knight's liege not attending + else_if = { + limit = { + scope:root_scope = { + is_acclaimed = yes + #this acclaimed knight's liege is not present + exists = liege + scope:root_scope.location != liege.location + } + scope:activity = { + OR = { + has_activity_option = { + category = feast_option_food + option = feast_food_good + } + has_activity_option = { + category = feast_option_food + option = feast_food_normal + } + } + OR = { + has_activity_option = { + category = feast_option_courses + option = feast_courses_good + } + has_activity_option = { + category = feast_option_courses + option = feast_courses_normal + } + } + } + } + scope:activity = { + add_activity_log_entry = { + key = knight_accolade_glory_reward + tags = { completed } + score = 10 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + if = { + limit = { + #more glory gain only if honored guest + exists = scope:honorary_guest_knight + scope:root_scope = scope:honorary_guest_knight + } + scope:root_scope = { + accolade = { add_glory = medium_glory_gain } + } + } + else = { + scope:root_scope = { + accolade = { add_glory = sub_minimal_glory_gain } + } + } + } + } + } + # An ok amount for a sort of grand feast, for acclaimed knights of attending liege + else_if = { + limit = { + scope:activity = { + any_attending_character = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + } + scope:activity = { + OR = { + has_activity_option = { + category = feast_option_food + option = feast_food_good + } + has_activity_option = { + category = feast_option_food + option = feast_food_normal + } + } + OR = { + has_activity_option = { + category = feast_option_courses + option = feast_courses_good + } + has_activity_option = { + category = feast_option_courses + option = feast_courses_normal + } + } + } + } + scope:activity = { + add_activity_log_entry = { + key = liege_accolades_glory_reward + tags = { completed } + score = 10 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + #more glory gain if host + if = { + limit = { + scope:root_scope = { + this = scope:host + } + } + every_attending_character = { + limit = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + if = { + limit = { + exists = scope:honorary_guest_knight + this = scope:honorary_guest_knight + } + accolade = { add_glory = medium_glory_gain } + } + else = { + accolade = { add_glory = minimal_glory_gain } + } + } + } + else = { + every_attending_character = { + limit = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + if = { + limit = { + exists = scope:honorary_guest_knight + this = scope:honorary_guest_knight + } + accolade = { add_glory = medium_glory_gain } + } + else = { + accolade = { add_glory = sub_minimal_glory_gain } + } + } + } + } + } + } + # Otherwise, it's scraps for attending knights without liege + else_if = { + limit = { + scope:root_scope = { + is_acclaimed = yes + #this acclaimed knight's liege is not present + exists = liege + scope:root_scope.location != liege.location + exists = scope:honorary_guest_knight + this = scope:honorary_guest_knight + } + } + scope:activity = { + add_activity_log_entry = { + key = knight_accolade_glory_reward + tags = { completed } + score = 10 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + scope:root_scope = { + accolade = { add_glory = minor_glory_gain } + } + } + } + } + # Otherwise, it's scraps for attending knights of liege + else_if = { + limit = { + scope:activity = { + any_attending_character = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + } + } + scope:activity = { + add_activity_log_entry = { + key = liege_accolades_glory_reward + tags = { completed } + score = 10 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + #more glory gain if host + if = { + limit = { + scope:root_scope = { + this = scope:host + } + } + every_attending_character = { + limit = { + is_knight_of = scope:root_scope + is_acclaimed = yes + } + if = { + limit = { + exists = scope:honorary_guest_knight + this = scope:honorary_guest_knight + } + accolade = { add_glory = minor_glory_gain } + } + else = { + accolade = { add_glory = sub_minimal_glory_gain } + } + } + } + else = { + scope:honorary_guest_knight ?= { + accolade = { add_glory = minor_glory_gain } + } + } + } + } + } +} + + +#Glory Gain from winning wars against THE BIG BAD +# little wars when the attacker wins +accolade_attacker_war_end_glory_gain_low_effect = { + if = { + limit = { + has_dlc_feature = accolades + } + if = { + limit = { + tier_difference = { + target = scope:defender + value <= -3 + } + } + every_active_accolade = { + custom = custom.attacker_every_active_accolade + add_glory = medium_glory_gain + } + } + else_if = { + limit = { + tier_difference = { + target = scope:defender + value = -2 + } + } + every_active_accolade = { + custom = custom.attacker_every_active_accolade + add_glory = minor_glory_gain + } + } + else_if = { + limit = { + tier_difference = { + target = scope:defender + value = -1 + } + } + every_active_accolade = { + custom = custom.attacker_every_active_accolade + add_glory = minimal_glory_gain + } + } + } +} + +# little wars when the defender wins +accolade_defender_war_end_glory_gain_low_effect = { + if = { + limit = { + has_dlc_feature = accolades + } + if = { + limit = { + tier_difference = { + target = scope:attacker + value <= -3 + } + } + every_active_accolade = { + custom = custom.defender_every_active_accolade + add_glory = medium_glory_gain + } + } + else_if = { + limit = { + tier_difference = { + target = scope:attacker + value = -2 + } + } + every_active_accolade = { + custom = custom.defender_every_active_accolade + add_glory = minor_glory_gain + } + } + else_if = { + limit = { + tier_difference = { + target = scope:attacker + value = -1 + } + } + every_active_accolade = { + custom = custom.defender_every_active_accolade + add_glory = minimal_glory_gain + } + } + } +} + +# duchy-type wars when the attacker wins +accolade_attacker_war_end_glory_gain_med_effect = { + if = { + limit = { + has_dlc_feature = accolades + } + if = { + limit = { + tier_difference = { + target = scope:defender + value <= -3 + } + } + every_active_accolade = { + custom = custom.attacker_every_active_accolade + add_glory = major_glory_gain + } + } + else_if = { + limit = { + tier_difference = { + target = scope:defender + value = -2 + } + } + every_active_accolade = { + custom = custom.attacker_every_active_accolade + add_glory = medium_glory_gain + } + } + else_if = { + limit = { + tier_difference = { + target = scope:defender + value = -1 + } + } + every_active_accolade = { + custom = custom.attacker_every_active_accolade + add_glory = minor_glory_gain + } + } + } +} + +# duchy-type wars when the defender wins +accolade_defender_war_end_glory_gain_med_effect = { + if = { + limit = { + has_dlc_feature = accolades + } + if = { + limit = { + tier_difference = { + target = scope:attacker + value <= -3 + } + } + every_active_accolade = { + custom = custom.defender_every_active_accolade + add_glory = major_glory_gain + } + } + else_if = { + limit = { + tier_difference = { + target = scope:attacker + value = -2 + } + } + every_active_accolade = { + custom = custom.defender_every_active_accolade + add_glory = medium_glory_gain + } + } + else_if = { + limit = { + tier_difference = { + target = scope:attacker + value = -1 + } + } + every_active_accolade = { + custom = custom.defender_every_active_accolade + add_glory = minor_glory_gain + } + } + } +} + +# KINGDOM-type wars when the attacker wins +accolade_attacker_war_end_glory_gain_high_effect = { + if = { + limit = { + has_dlc_feature = accolades + } + if = { + limit = { + tier_difference = { + target = scope:defender + value <= -3 + } + } + every_active_accolade = { + custom = custom.attacker_every_active_accolade + add_glory = massive_glory_gain + } + } + else_if = { + limit = { + tier_difference = { + target = scope:defender + value = -2 + } + } + every_active_accolade = { + custom = custom.attacker_every_active_accolade + add_glory = major_glory_gain + } + } + else_if = { + limit = { + tier_difference = { + target = scope:defender + value = -1 + } + } + every_active_accolade = { + custom = custom.attacker_every_active_accolade + add_glory = medium_glory_gain + } + } + } +} + +# KINGDOM-type wars when the defender wins +accolade_defender_war_end_glory_gain_high_effect = { + if = { + limit = { + has_dlc_feature = accolades + } + if = { + limit = { + tier_difference = { + target = scope:attacker + value <= -3 + } + } + every_active_accolade = { + custom = custom.defender_every_active_accolade + add_glory = massive_glory_gain + } + } + else_if = { + limit = { + tier_difference = { + target = scope:attacker + value = -2 + } + } + every_active_accolade = { + custom = custom.defender_every_active_accolade + add_glory = major_glory_gain + } + } + else_if = { + limit = { + tier_difference = { + target = scope:attacker + value = -1 + } + } + every_active_accolade = { + custom = custom.defender_every_active_accolade + add_glory = medium_glory_gain + } + } + } +} + +# EMPIRE-type wars when the attacker wins +accolade_attacker_war_end_glory_gain_very_high_effect = { + if = { + limit = { + has_dlc_feature = accolades + } + if = { + limit = { + tier_difference = { + target = scope:defender + value <= -3 + } + } + every_active_accolade = { + custom = custom.attacker_every_active_accolade + add_glory = monumental_glory_gain + } + } + else_if = { + limit = { + tier_difference = { + target = scope:defender + value = -2 + } + } + every_active_accolade = { + custom = custom.attacker_every_active_accolade + add_glory = massive_glory_gain + } + } + else_if = { + limit = { + tier_difference = { + target = scope:defender + value = -1 + } + } + every_active_accolade = { + custom = custom.attacker_every_active_accolade + add_glory = major_glory_gain + } + } + } +} + +# EMPIRE-type wars when the defender wins +accolade_defender_war_end_glory_gain_very_high_effect = { + if = { + limit = { + has_dlc_feature = accolades + } + if = { + limit = { + tier_difference = { + target = scope:attacker + value <= -3 + } + } + every_active_accolade = { + custom = custom.defender_every_active_accolade + add_glory = monumental_glory_gain + } + } + else_if = { + limit = { + tier_difference = { + target = scope:attacker + value = -2 + } + } + every_active_accolade = { + custom = custom.defender_every_active_accolade + add_glory = massive_glory_gain + } + } + else_if = { + limit = { + tier_difference = { + target = scope:attacker + value = -1 + } + } + every_active_accolade = { + custom = custom.defender_every_active_accolade + add_glory = major_glory_gain + } + } + } +} + +#Add glory with accolade checks MINIMAL GAIN +accolade_minimal_glory_gain_with_checks_effect = { + if = { + limit = { + is_acclaimed = yes + is_alive = yes + accolade = { + is_accolade_active = yes + } + } + accolade = { + add_glory = minimal_glory_gain + } + } +} +#Add glory with accolade checks MINOR GAIN +accolade_minor_glory_gain_with_checks_effect = { + if = { + limit = { + is_acclaimed = yes + is_alive = yes + accolade = { + is_accolade_active = yes + } + } + accolade = { + add_glory = minor_glory_gain + } + } +} +#Add glory with accolade checks MEDIUM GAIN +accolade_medium_glory_gain_with_checks_effect = { + if = { + limit = { + is_acclaimed = yes + is_alive = yes + accolade = { + is_accolade_active = yes + } + } + accolade = { + add_glory = medium_glory_gain + } + } +} +#Add glory with accolade checks MAJOR GAIN +accolade_major_glory_gain_with_checks_effect = { + if = { + limit = { + is_acclaimed = yes + is_alive = yes + accolade = { + is_accolade_active = yes + } + } + accolade = { + add_glory = major_glory_gain + } + } +} +#Add glory with accolade checks MASSIVE GAIN +accolade_massive_glory_gain_with_checks_effect = { + if = { + limit = { + is_acclaimed = yes + is_alive = yes + accolade = { + is_accolade_active = yes + } + } + accolade = { + add_glory = massive_glory_gain + } + } +} + +#Add glory with accolade checks MONUMENTAL GAIN +accolade_monumental_glory_gain_with_checks_effect = { + if = { + limit = { + is_acclaimed = yes + is_alive = yes + accolade = { + is_accolade_active = yes + } + } + accolade = { + add_glory = monumental_glory_gain + } + } +} + +#Add glory with accolade checks MINIMAL LOSS +accolade_minimal_glory_loss_with_checks_effect = { + if = { + limit = { + is_acclaimed = yes + is_alive = yes + accolade = { + is_accolade_active = yes + } + } + accolade = { + add_glory = minimal_glory_loss + } + } +} +#Add glory with accolade checks MINOR LOSS +accolade_minor_glory_loss_with_checks_effect = { + if = { + limit = { + is_acclaimed = yes + is_alive = yes + accolade = { + is_accolade_active = yes + } + } + accolade = { + add_glory = minor_glory_loss + } + } +} +#Add glory with accolade checks MEDIUM LOSS +accolade_medium_glory_loss_with_checks_effect = { + if = { + limit = { + is_acclaimed = yes + is_alive = yes + accolade = { + is_accolade_active = yes + } + } + accolade = { + add_glory = medium_glory_loss + } + } +} +#Add glory with accolade checks MAJOR LOSS +accolade_major_glory_loss_with_checks_effect = { + if = { + limit = { + is_acclaimed = yes + is_alive = yes + accolade = { + is_accolade_active = yes + } + } + accolade = { + add_glory = major_glory_loss + } + } +} +#Add glory with accolade checks MASSIVE LOSS +accolade_massive_glory_loss_with_checks_effect = { + if = { + limit = { + is_acclaimed = yes + is_alive = yes + accolade = { + is_accolade_active = yes + } + } + accolade = { + add_glory = massive_glory_loss + } + } +} + +#Add glory with accolade checks MONUMENTAL LOSS +accolade_monumental_glory_loss_with_checks_effect = { + if = { + limit = { + is_acclaimed = yes + is_alive = yes + accolade = { + is_accolade_active = yes + } + } + accolade = { + add_glory = monumental_glory_loss + } + } +} + +# FIND SUITABLE ACCOLADE SUCCESSOR INTERACTION +#this saves a random culture that's known for its knights and is familiar enough to the accolade_tournament_xp_gain_all_knights +save_general_accolade_successor_culture_effect = { + random_culture_global = { + limit = { + OR = { + has_cultural_pillar = ethos_stoic + has_cultural_pillar = ethos_bellicose + has_cultural_parameter = wanderers_gain_extra_combat_skills + has_cultural_parameter = high_prowess_ignores_knight_restrictions + has_cultural_parameter = prowess_from_martial_education + has_cultural_parameter = martial_education_more_valued + has_cultural_parameter = strong_traits_more_valued + } + trigger_if = { + limit = { + root = { + highest_held_title_tier >= tier_duchy + } + exists = root.capital_county + } + any_culture_county = { + OR = { + holder = { + this = root + } + holder.liege = { + this = root + } + holder.top_liege = { + this = root + } + empire = root.capital_county.empire + } + } + } + trigger_else = { + exists = root.capital_county + any_culture_county = { + OR = { + holder = { + this = root + } + holder.liege = { + this = root + } + holder.top_liege = { + this = root + } + kingdom = root.capital_county.kingdom + } + } + } + culture_number_of_counties > 0 + cultural_acceptance = { + target = root.culture + value >= 15 + } + } + save_scope_as = knight_culture + } +} + +#this one's just for the varangians +save_varangian_successor_culture_effect = { + if = { + limit = { + current_date < 1400 + root = { + has_title = title:e_byzantium + } + } + random_culture_global = { + limit = { + OR = { + has_cultural_parameter = unlock_maa_huscarls + has_cultural_parameter = unlock_maa_varangian_veterans + } + culture_number_of_counties > 0 + any_culture_duchy = { + NOT = { + this = title:d_iceland + } + } + NOT = { + this = culture:estonian + } + NAND = { + this = culture:anglo_saxon + current_date < 1067 + } + } + save_scope_as = varangian_culture + } + } +} + +#this one's just for the varangians +save_turkic_successor_culture_effect = { + if = { + limit = { + root = { + faith.religion = religion:islam_religion + capital_county.title_province ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_africa_north_east + geographical_region = world_asia_minor + geographical_region = world_europe_south_east + geographical_region = world_steppe + } + } + culture = { + NOT = { + culture_has_archer_cavalry_maa = yes + } + } + NOT = { has_trait = nomadic_philosophy } + highest_held_title_tier >= tier_kingdom + } + } + random_culture_global = { + limit = { + culture_has_archer_cavalry_maa = yes + has_cultural_pillar = heritage_turkic + culture_number_of_counties > 0 + any_culture_county = { + holder = { + in_diplomatic_range = root + } + } + } + weight = { + modifier = { + add = 100 + any_culture_county = { + empire = root.capital_county.empire + } + } + modifier = { + add = 50 + any_culture_county = { + kingdom = root.capital_county.kingdom + } + } + } + save_scope_as = turkic_culture + } + } +} + +#this saves appropriate cultures for specific accolade types, just need to check for the type along with its relevant cultural triggers +save_type_specific_successor_culture_effect = { + random_culture_global = { + limit = { + OR = { + # Marauder + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:marauder_attribute + } + } + OR = { + has_cultural_pillar = ethos_bellicose + has_cultural_tradition = tradition_ruling_caste + has_cultural_tradition = tradition_eye_for_an_eye + } + } + # Idealist + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:idealist_attribute + } + } + OR = { + has_cultural_pillar = ethos_egalitarian + has_cultural_tradition = tradition_charitable + has_cultural_tradition = tradition_loyal_soldiers + has_cultural_tradition = tradition_chivalry + } + } + # Charmer + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:charmer_attribute + } + } + OR = { + has_cultural_pillar = ethos_courtly + has_cultural_tradition = tradition_welcoming + } + } + # Thug + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:thug_attribute + } + } + OR = { + has_cultural_pillar = ethos_bellicose + has_cultural_tradition = tradition_battlefield_looters + has_cultural_tradition = tradition_ruling_caste + has_cultural_tradition = tradition_quarrelsome + } + } + # Disciplinarian + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:disciplinarian_attribute + } + } + OR = { + has_cultural_pillar = ethos_stoic + has_cultural_pillar = ethos_bureaucratic + has_cultural_tradition = tradition_hard_working + has_cultural_tradition = tradition_staunch_traditionalists + has_cultural_tradition = tradition_formation_fighting + } + } + # Valiant + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:valiant_attribute + } + } + OR = { + has_cultural_pillar = ethos_bellicose + has_cultural_tradition = tradition_talent_acquisition + has_cultural_tradition = tradition_only_the_strong + has_cultural_tradition = tradition_stand_and_fight + has_cultural_tradition = tradition_warrior_culture + has_cultural_tradition = tradition_fp1_performative_honour + has_cultural_tradition = tradition_fp1_the_right_to_prove + } + } + # Stalwart + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:stalwart_attribute + } + } + OR = { + has_cultural_pillar = ethos_stoic + has_cultural_pillar = ethos_communal + has_cultural_tradition = tradition_stalwart_defenders + has_cultural_tradition = tradition_stand_and_fight + has_cultural_tradition = tradition_druzhina + has_cultural_tradition = tradition_hird + has_cultural_tradition = tradition_fp1_coastal_warriors + } + NOT = { + has_cultural_tradition = tradition_hit_and_run + } + } + # Scoundrel + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:scoundrel_attribute + } + } + OR = { + has_cultural_pillar = ethos_bellicose + has_cultural_tradition = tradition_hit_and_run + has_cultural_tradition = tradition_quarrelsome + has_cultural_tradition = tradition_swords_for_hire + has_cultural_tradition = tradition_ep3_audacious_cadets + has_cultural_tradition = tradition_fp1_coastal_warriors + has_cultural_tradition = tradition_fp2_state_ransoming + has_cultural_tradition = tradition_practiced_pirates + } + NOT = { + has_cultural_tradition = tradition_hit_and_run + } + } + # Politicker + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:politicker_attribute + } + } + OR = { + has_cultural_pillar = ethos_courtly + has_cultural_pillar = ethos_egalitarian + has_cultural_parameter = facilitate_alliance_acceptance + has_cultural_parameter = can_make_republican_vassals + has_cultural_parameter = learns_more_languages + has_cultural_parameter = diplomacy_education_better_outcomes + has_cultural_parameter = eunuch_trait_bonuses + } + NOT = { + has_cultural_parameter = ai_doesnt_marry_outside_culture + } + } + # Tactician + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:tactician_attribute + } + } + OR = { + has_cultural_pillar = ethos_bellicose + has_cultural_pillar = ethos_bureaucratic + has_cultural_tradition = tradition_adaptive_skirmishing + has_cultural_tradition = tradition_formation_fighting + has_cultural_parameter = better_knights_from_decision + has_cultural_tradition = tradition_hit_and_run + } + } + # Reeve + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:reeve_attribute + } + } + OR = { + has_cultural_pillar = ethos_bureaucratic + has_cultural_pillar = ethos_egalitarian + has_cultural_parameter = martial_education_worse_outcomes + has_cultural_parameter = poorly_educated_leaders_distrusted + has_cultural_parameter = just_trait_more_common + has_cultural_tradition = tradition_hard_working + } + } + # Manipulator + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:manipulator_attribute + } + } + OR = { + has_cultural_pillar = ethos_courtly + has_cultural_pillar = ethos_communal + has_cultural_parameter = eunuch_trait_bonuses + has_cultural_parameter = rivalries_more_common + } + NOR = { + has_cultural_tradition = tradition_stand_and_fight + has_cultural_parameter = honest_trait_more_common + } + } + # Mentor + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:mentor_attribute + } + } + OR = { + has_cultural_pillar = ethos_communal + has_cultural_pillar = ethos_spiritual + has_cultural_parameter = guardians_can_transfer_commander_traits + has_cultural_parameter = generous_trait_more_common + has_cultural_parameter = patient_trait_more_common + has_cultural_parameter = innovation_from_learning_traits + has_cultural_parameter = better_ward_education + } + NOT = { + has_cultural_parameter = minimum_prowess_for_knights + } + } + # Contender + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:contender_attribute + } + } + OR = { + has_cultural_pillar = ethos_bellicose + has_cultural_pillar = ethos_stoic + has_cultural_parameter = high_prowess_ignores_knight_restrictions + has_cultural_parameter = prowess_from_martial_education + has_cultural_parameter = martial_education_more_valued + has_cultural_parameter = strong_traits_more_valued + has_cultural_parameter = better_knights_from_decision + has_cultural_parameter = minimum_prowess_for_knights + has_cultural_parameter = + has_access_to_trials_by_combat + } + } + # Archer + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:archer_attribute + } + } + OR = { + has_cultural_pillar = heritage_brythonic + has_cultural_pillar = heritage_east_african + has_cultural_pillar = heritage_indo_aryan + has_cultural_pillar = heritage_dravidian + has_cultural_pillar = heritage_burman + has_cultural_pillar = heritage_yoruba + has_cultural_pillar = heritage_baltic + has_cultural_pillar = heritage_balto_finnic + } + } + # Skirmisher + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:skirmisher_attribute + } + } + OR = { + has_cultural_pillar = heritage_baltic + has_cultural_pillar = heritage_ugro_permian + has_cultural_pillar = heritage_balto_finnic + has_cultural_pillar = heritage_somalian + has_cultural_pillar = heritage_west_african + has_cultural_pillar = heritage_goidelic + has_cultural_pillar = heritage_brythonic + } + } + # Pike + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:pike_attribute + } + } + OR = { + has_cultural_pillar = heritage_central_germanic + has_cultural_pillar = heritage_latin + } + } + # Outrider + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:outrider_attribute + } + } + OR = { + has_cultural_tradition = tradition_ep3_indomitable_azatani + has_cultural_tradition = tradition_desert_ribat + has_cultural_tradition = tradition_chanson_de_geste + has_cultural_tradition = tradition_hussar + } + OR = { + has_cultural_pillar = heritage_iranian + has_cultural_pillar = heritage_turkic + has_cultural_pillar = heritage_mongolic + has_cultural_pillar = heritage_arabic + has_cultural_pillar = heritage_berber + has_cultural_pillar = heritage_iberian + has_cultural_pillar = heritage_indo_aryan + has_cultural_pillar = heritage_magyar + } + } + # Vanguard + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:vanguard_attribute + } + } + OR = { + has_innovation = innovation_quilted_armor + has_cultural_tradition = tradition_fp1_coastal_warriors + has_cultural_tradition = tradition_hird + has_cultural_tradition = tradition_futuwaa + has_cultural_tradition = tradition_druzhina + has_cultural_tradition = tradition_khadga_puja + has_cultural_tradition = tradition_garuda_warriors + has_cultural_tradition = tradition_himalayan_settlers + has_cultural_tradition = tradition_mubarizuns + has_cultural_tradition = tradition_burman_royal_army + has_cultural_tradition = tradition_mountaineer_ruralism + has_innovation = innovation_sarawit + has_innovation = innovation_legionnaires + } + OR = { + has_cultural_pillar = heritage_central_germanic + has_cultural_pillar = heritage_north_germanic + has_cultural_pillar = heritage_west_germanic + has_cultural_pillar = heritage_east_slavic + has_cultural_pillar = heritage_burman + has_cultural_pillar = heritage_qiangic + has_cultural_pillar = heritage_tibetan + } + } + # Lancer + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:lancer_attribute + } + } + OR = { + has_innovation = innovation_arched_saddle + has_cultural_tradition = tradition_caucasian_wolves + has_cultural_tradition = tradition_roman_legacy + has_innovation = innovation_valets + has_cultural_tradition = tradition_ep3_audacious_cadets + has_cultural_tradition = tradition_ep3_imperial_tagmata + } + OR = { + has_cultural_pillar = heritage_iranian + has_cultural_pillar = heritage_turkic + has_cultural_pillar = heritage_mongolic + has_cultural_pillar = heritage_central_germanic + has_cultural_pillar = heritage_frankish + has_cultural_pillar = heritage_indo_aryan + has_cultural_pillar = heritage_byzantine + has_cultural_pillar = heritage_caucasian + } + } + # Besieger + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:besieger_attribute + } + } + has_innovation = innovation_mangonel + OR = { + has_cultural_tradition = tradition_castle_keepers + has_cultural_tradition = tradition_hereditary_hierarchy + has_cultural_tradition = tradition_hard_working + has_cultural_tradition = tradition_swords_for_hire + has_cultural_tradition = tradition_ep3_audacious_cadets + has_cultural_tradition = tradition_malleable_invaders + has_cultural_tradition = tradition_metal_craftsmanship + } + } + # Crossbowman + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:crossbowmen_attribute + } + } + OR = { + has_innovation = innovation_advanced_bowmaking + has_innovation = innovation_repeating_crossbow + } + OR = { + has_cultural_pillar = heritage_chinese + has_cultural_pillar = heritage_latin + has_cultural_tradition = tradition_swords_for_hire + } + } + # Camel Rider + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:camelry_attribute + } + } + has_innovation = innovation_war_camels + OR = { + has_cultural_pillar = heritage_arabic + has_cultural_pillar = heritage_berber + has_cultural_tradition = tradition_desert_nomads + has_cultural_tradition = tradition_warriors_of_the_dry + } + } + # Elephant Rider + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:elephantry_attribute + } + } + has_innovation = innovation_elephantry + OR = { + has_cultural_pillar = heritage_dravidian + has_cultural_pillar = heritage_indo_aryan + has_cultural_pillar = heritage_burman + } + } + # Horse Archer + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:horse_archer_attribute + } + } + culture_has_archer_cavalry_maa = yes + OR = { + has_cultural_pillar = heritage_turkic + has_cultural_pillar = heritage_mongolic + has_cultural_pillar = heritage_burman + } + } + # Huntsmaster + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:huntsmaster_attribute + } + } + OR = { + has_cultural_tradition = tradition_bush_hunting + has_cultural_tradition = tradition_hunters + has_cultural_tradition = tradition_sacred_hunts + has_cultural_tradition = tradition_forest_fighters + has_cultural_tradition = tradition_jungle_warriors + has_cultural_tradition = tradition_land_of_the_bow + has_cultural_tradition = tradition_bush_hunting + has_cultural_tradition = tradition_hunters + has_cultural_tradition = tradition_sacred_hunts + } + NOT = { + has_cultural_tradition = tradition_vegetarianism + } + } + # Blademaster + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:blademaster_attribute + } + } + OR = { + has_cultural_tradition = tradition_druzhina + has_cultural_tradition = tradition_futuwaa + has_cultural_tradition = tradition_khadga_puja + has_cultural_tradition = tradition_talent_acquisition + has_cultural_tradition = tradition_swords_for_hire + has_cultural_tradition = tradition_warriors_by_merit + has_cultural_tradition = tradition_only_the_strong + has_cultural_tradition = tradition_martial_admiration + has_cultural_tradition = tradition_fp1_trials_by_combat + has_cultural_tradition = tradition_chanson_de_geste + has_cultural_tradition = tradition_fp1_performative_honour + has_cultural_tradition = tradition_chivalry + has_cultural_tradition = tradition_warrior_culture + has_cultural_tradition = tradition_fp1_the_right_to_prove + has_cultural_tradition = tradition_garuda_warriors + } + } + # Master of Revels + AND = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:master_of_revels_attribute + } + } + OR = { + has_cultural_tradition = tradition_esteemed_hospitality + has_cultural_tradition = tradition_wedding_ceremonies + has_cultural_tradition = tradition_welcoming + has_cultural_tradition = tradition_music_theory + has_cultural_tradition = tradition_festivities + has_cultural_tradition = tradition_culinary_art + } + } + } + trigger_if = { + limit = { + exists = root.capital_county + root = { + highest_held_title_tier >= tier_duchy + } + } + any_culture_county = { + OR = { + holder = { + this = root + } + holder.liege = { + this = root + } + holder.top_liege = { + this = root + } + empire = root.capital_county.empire + } + } + } + trigger_else = { + exists = root.capital_county + any_culture_county = { + OR = { + holder = { + this = root + } + holder.liege = { + this = root + } + holder.top_liege = { + this = root + } + kingdom = root.capital_county.kingdom + } + } + } + culture_number_of_counties > 0 + cultural_acceptance = { + target = root.culture + value >= 15 + } + } + save_scope_as = type_specific_culture + } +} + +accolade_character_creation_effect = { + #don't want AI using our performance intensive checks + if = { + limit = { + root = { + OR = { + is_ai = no + any_held_title = { this = title:e_byzantium } + } + } + } + #save a general knight-y culture that can randomly be used + save_general_accolade_successor_culture_effect = yes + #varangians if relevant + save_varangian_successor_culture_effect = yes + #turkic warriors if relevant + save_turkic_successor_culture_effect = yes + #save one specific to the accolade type + save_type_specific_successor_culture_effect = yes + } + #let's get creating - but needs to be the right type of knight + #Marauder + if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:marauder_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_marauder_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { exists = root.location.culture } + } + scope:knight_culture = { + trigger = { exists = scope:knight_culture } + } + scope:varangian_culture = { + trigger = { exists = scope:varangian_culture } + } + scope:turkic_culture = { + trigger = { exists = scope:turkic_culture } + } + scope:type_specific_culture = { + trigger = { exists = scope:type_specific_culture } + } + } + save_scope_as = chosen_knight + } + } + #Idealist + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:idealist_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_idealist_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { exists = root.location.culture } + } + scope:knight_culture = { + trigger = { exists = scope:knight_culture } + } + scope:type_specific_culture = { + trigger = { exists = scope:type_specific_culture } + } + } + save_scope_as = chosen_knight + } + } + #Charmer + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:charmer_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_charmer_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { exists = root.location.culture } + } + scope:knight_culture = { + trigger = { exists = scope:knight_culture } + } + scope:type_specific_culture = { + trigger = { exists = scope:type_specific_culture } + } + } + save_scope_as = chosen_knight + } + } + #Thug + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:thug_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_thug_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { exists = root.location.culture } + } + scope:knight_culture = { + trigger = { exists = scope:knight_culture } + } + scope:varangian_culture = { + trigger = { exists = scope:varangian_culture } + } + scope:turkic_culture = { + trigger = { exists = scope:turkic_culture } + } + scope:type_specific_culture = { + trigger = { exists = scope:type_specific_culture } + } + } + save_scope_as = chosen_knight + } + } + #Disciplinarian + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:disciplinarian_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_disciplinarian_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { exists = root.location.culture } + } + scope:knight_culture = { + trigger = { exists = scope:knight_culture } + } + scope:varangian_culture = { + trigger = { exists = scope:varangian_culture } + } + scope:turkic_culture = { + trigger = { exists = scope:turkic_culture } + } + scope:type_specific_culture = { + trigger = { exists = scope:type_specific_culture } + } + } + save_scope_as = chosen_knight + } + } + #Fanatic + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:fanatic_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_fanatic_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { exists = root.location.culture } + } + } + save_scope_as = chosen_knight + } + } + #Valiant + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:valiant_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_valiant_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { exists = root.location.culture } + } + scope:knight_culture = { + trigger = { exists = scope:knight_culture } + } + scope:varangian_culture = { + trigger = { exists = scope:varangian_culture } + } + scope:turkic_culture = { + trigger = { exists = scope:turkic_culture } + } + scope:type_specific_culture = { + trigger = { exists = scope:type_specific_culture } + } + } + save_scope_as = chosen_knight + } + } + #Stalwart + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:stalwart_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_stalwart_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { exists = root.location.culture } + } + scope:knight_culture = { + trigger = { exists = scope:knight_culture } + } + scope:varangian_culture = { + trigger = { exists = scope:varangian_culture } + } + scope:turkic_culture = { + trigger = { exists = scope:turkic_culture } + } + scope:type_specific_culture = { + trigger = { exists = scope:type_specific_culture } + } + } + save_scope_as = chosen_knight + } + } + #Scoundrel + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:scoundrel_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_scoundrel_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { exists = root.location.culture } + } + scope:knight_culture = { + trigger = { exists = scope:knight_culture } + } + scope:varangian_culture = { + trigger = { exists = scope:varangian_culture } + } + scope:turkic_culture = { + trigger = { exists = scope:turkic_culture } + } + scope:type_specific_culture = { + trigger = { exists = scope:type_specific_culture } + } + } + save_scope_as = chosen_knight + } + } + #Politicker + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:politicker_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_politicker_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { exists = root.location.culture } + } + scope:knight_culture = { + trigger = { exists = scope:knight_culture } + } + scope:type_specific_culture = { + trigger = { exists = scope:type_specific_culture } + } + } + save_scope_as = chosen_knight + } + if = { + limit = { + scope:chosen_knight = { diplomacy < 15 } + } + scope:chosen_knight = { + add_diplomacy_skill = { + value = 15 + subtract = diplomacy + } + } + } + } + #Tactician + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:tactician_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_tactician_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { exists = root.location.culture } + } + scope:knight_culture = { + trigger = { exists = scope:knight_culture } + } + scope:varangian_culture = { + trigger = { exists = scope:varangian_culture } + } + scope:turkic_culture = { + trigger = { exists = scope:turkic_culture } + } + scope:type_specific_culture = { + trigger = { exists = scope:type_specific_culture } + } + } + save_scope_as = chosen_knight + } + if = { + limit = { + scope:chosen_knight = { martial < 15 } + } + scope:chosen_knight = { + add_martial_skill = { + value = 15 + subtract = martial + } + } + } + } + #Reeve + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:reeve_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_reeve_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { exists = root.location.culture } + } + scope:knight_culture = { + trigger = { exists = scope:knight_culture } + } + scope:turkic_culture = { + trigger = { exists = scope:turkic_culture } + } + scope:type_specific_culture = { + trigger = { exists = scope:type_specific_culture } + } + } + save_scope_as = chosen_knight + } + if = { + limit = { + scope:chosen_knight = { stewardship < 15 } + } + scope:chosen_knight = { + add_stewardship_skill = { + value = 15 + subtract = stewardship + } + } + } + } + #Manipulator + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:manipulator_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_manipulator_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { exists = root.location.culture } + } + scope:knight_culture = { + trigger = { exists = scope:knight_culture } + } + scope:varangian_culture = { + trigger = { exists = scope:varangian_culture } + } + scope:turkic_culture = { + trigger = { exists = scope:turkic_culture } + } + scope:type_specific_culture = { + trigger = { exists = scope:type_specific_culture } + } + } + save_scope_as = chosen_knight + } + if = { + limit = { + scope:chosen_knight = { intrigue < 15 } + } + scope:chosen_knight = { + add_intrigue_skill = { + value = 15 + subtract = intrigue + } + } + } + } + #Mentor + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:mentor_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_mentor_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { exists = root.location.culture } + } + scope:knight_culture = { + trigger = { exists = scope:knight_culture } + } + scope:type_specific_culture = { + trigger = { exists = scope:type_specific_culture } + } + } + save_scope_as = chosen_knight + } + if = { + limit = { + scope:chosen_knight = { learning < 15 } + } + scope:chosen_knight = { + add_learning_skill = { + value = 15 + subtract = learning + } + } + } + } + #Contender + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:contender_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_contender_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { exists = root.location.culture } + } + scope:knight_culture = { + trigger = { exists = scope:knight_culture } + } + scope:varangian_culture = { + trigger = { exists = scope:varangian_culture } + } + scope:turkic_culture = { + trigger = { exists = scope:turkic_culture } + } + scope:type_specific_culture = { + trigger = { exists = scope:type_specific_culture } + } + } + save_scope_as = chosen_knight + } + if = { + limit = { + scope:chosen_knight = { prowess < 20 } + } + scope:chosen_knight = { + add_prowess_skill = { + value = 20 + subtract = prowess + } + } + } + } + #Archer + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:archer_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_archer_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { exists = root.location.culture } + } + scope:knight_culture = { + trigger = { exists = scope:knight_culture } + } + scope:turkic_culture = { + trigger = { exists = scope:turkic_culture } + } + scope:type_specific_culture = { + trigger = { exists = scope:type_specific_culture } + } + } + save_scope_as = chosen_knight + } + } + #Skirmisher + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:skirmisher_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_skirmisher_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { exists = root.location.culture } + } + scope:knight_culture = { + trigger = { exists = scope:knight_culture } + } + scope:type_specific_culture = { + trigger = { exists = scope:type_specific_culture } + } + } + save_scope_as = chosen_knight + } + } + #Pike + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:pike_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_pike_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { exists = root.location.culture } + } + scope:knight_culture = { + trigger = { exists = scope:knight_culture } + } + scope:varangian_culture = { + trigger = { exists = scope:varangian_culture } + } + scope:type_specific_culture = { + trigger = { exists = scope:type_specific_culture } + } + } + save_scope_as = chosen_knight + } + } + #Outrider + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:outrider_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_outrider_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { exists = root.location.culture } + } + scope:knight_culture = { + trigger = { exists = scope:knight_culture } + } + scope:turkic_culture = { + trigger = { exists = scope:turkic_culture } + } + scope:type_specific_culture = { + trigger = { exists = scope:type_specific_culture } + } + } + save_scope_as = chosen_knight + } + } + #Vanguard + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:vanguard_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_vanguard_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { + exists = root.location.culture + root.location.culture = { + OR = { + has_innovation = innovation_quilted_armor + has_cultural_tradition = tradition_fp1_coastal_warriors + has_cultural_tradition = tradition_hird + has_cultural_tradition = tradition_futuwaa + has_cultural_tradition = tradition_druzhina + has_cultural_tradition = tradition_khadga_puja + has_cultural_tradition = tradition_garuda_warriors + has_cultural_tradition = tradition_himalayan_settlers + has_cultural_tradition = tradition_mubarizuns + has_cultural_tradition = tradition_burman_royal_army + has_cultural_tradition = tradition_mountaineer_ruralism + has_innovation = innovation_sarawit + has_innovation = innovation_legionnaires + } + } + } + } + scope:knight_culture = { + trigger = { + exists = scope:knight_culture + scope:knight_culture = { + OR = { + has_innovation = innovation_quilted_armor + has_cultural_tradition = tradition_fp1_coastal_warriors + has_cultural_tradition = tradition_hird + has_cultural_tradition = tradition_futuwaa + has_cultural_tradition = tradition_druzhina + has_cultural_tradition = tradition_khadga_puja + has_cultural_tradition = tradition_garuda_warriors + has_cultural_tradition = tradition_himalayan_settlers + has_cultural_tradition = tradition_mubarizuns + has_cultural_tradition = tradition_burman_royal_army + has_cultural_tradition = tradition_mountaineer_ruralism + has_innovation = innovation_sarawit + has_innovation = innovation_legionnaires + } + } + } + } + scope:varangian_culture = { + trigger = { + exists = scope:varangian_culture + scope:varangian_culture = { + OR = { + has_innovation = innovation_quilted_armor + has_cultural_tradition = tradition_fp1_coastal_warriors + has_cultural_tradition = tradition_hird + has_cultural_tradition = tradition_futuwaa + has_cultural_tradition = tradition_druzhina + has_cultural_tradition = tradition_khadga_puja + has_cultural_tradition = tradition_garuda_warriors + has_cultural_tradition = tradition_himalayan_settlers + has_cultural_tradition = tradition_mubarizuns + has_cultural_tradition = tradition_burman_royal_army + has_cultural_tradition = tradition_mountaineer_ruralism + has_innovation = innovation_sarawit + has_innovation = innovation_legionnaires + } + } + } + } + scope:type_specific_culture = { + trigger = { + exists = scope:type_specific_culture + scope:type_specific_culture = { + OR = { + has_innovation = innovation_quilted_armor + has_cultural_tradition = tradition_fp1_coastal_warriors + has_cultural_tradition = tradition_hird + has_cultural_tradition = tradition_futuwaa + has_cultural_tradition = tradition_druzhina + has_cultural_tradition = tradition_khadga_puja + has_cultural_tradition = tradition_garuda_warriors + has_cultural_tradition = tradition_himalayan_settlers + has_cultural_tradition = tradition_mubarizuns + has_cultural_tradition = tradition_burman_royal_army + has_cultural_tradition = tradition_mountaineer_ruralism + has_innovation = innovation_sarawit + has_innovation = innovation_legionnaires + } + } + } + } + } + save_scope_as = chosen_knight + } + } + #Lancer + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:lancer_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_lancer_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { + exists = root.location.culture + root.location.culture = { + OR = { + has_innovation = innovation_arched_saddle + has_cultural_tradition = tradition_caucasian_wolves + has_cultural_tradition = tradition_ep3_audacious_cadets + has_cultural_tradition = tradition_roman_legacy + has_cultural_tradition = tradition_ep3_imperial_tagmata + has_innovation = innovation_valets + } + } + } + } + scope:knight_culture = { + trigger = { + exists = scope:knight_culture + scope:knight_culture = { + OR = { + has_innovation = innovation_arched_saddle + has_cultural_tradition = tradition_caucasian_wolves + has_cultural_tradition = tradition_ep3_audacious_cadets + has_cultural_tradition = tradition_roman_legacy + has_cultural_tradition = tradition_ep3_imperial_tagmata + has_innovation = innovation_valets + } + } + } + } + scope:turkic_culture = { + trigger = { + exists = scope:turkic_culture + scope:turkic_culture = { + OR = { + has_innovation = innovation_arched_saddle + has_cultural_tradition = tradition_caucasian_wolves + has_cultural_tradition = tradition_ep3_audacious_cadets + has_cultural_tradition = tradition_roman_legacy + has_cultural_tradition = tradition_ep3_imperial_tagmata + has_innovation = innovation_valets + } + } + } + } + scope:type_specific_culture = { + trigger = { + exists = scope:type_specific_culture + scope:type_specific_culture = { + OR = { + has_innovation = innovation_arched_saddle + has_cultural_tradition = tradition_caucasian_wolves + has_cultural_tradition = tradition_ep3_audacious_cadets + has_cultural_tradition = tradition_roman_legacy + has_cultural_tradition = tradition_ep3_imperial_tagmata + has_innovation = innovation_valets + } + } + } + } + } + save_scope_as = chosen_knight + } + } + #Besieger + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:besieger_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_besieger_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { + exists = root.location.culture + root.location.culture = { has_innovation = innovation_mangonel } + } + } + scope:knight_culture = { + trigger = { + exists = scope:knight_culture + scope:knight_culture = { has_innovation = innovation_mangonel } + } + } + scope:varangian_culture = { + trigger = { + exists = scope:varangian_culture + scope:varangian_culture = { has_innovation = innovation_mangonel } + } + } + scope:turkic_culture = { + trigger = { + exists = scope:turkic_culture + scope:turkic_culture = { has_innovation = innovation_mangonel } + } + } + scope:type_specific_culture = { + trigger = { + exists = scope:type_specific_culture + scope:type_specific_culture = { has_innovation = innovation_mangonel } + } + } + } + save_scope_as = chosen_knight + } + } + #Crossbowman + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:crossbowmen_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_crossbowmen_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { + exists = root.location.culture + root.location.culture = { + has_innovation = innovation_advanced_bowmaking + has_innovation = innovation_repeating_crossbow + } + } + } + scope:knight_culture = { + trigger = { + exists = scope:knight_culture + scope:knight_culture = { + OR = { + has_innovation = innovation_advanced_bowmaking + has_innovation = innovation_repeating_crossbow + } + } + } + } + scope:turkic_culture = { + trigger = { + exists = scope:turkic_culture + scope:turkic_culture = { + OR = { + has_innovation = innovation_advanced_bowmaking + has_innovation = innovation_repeating_crossbow + } + } + } + } + scope:type_specific_culture = { + trigger = { + exists = scope:type_specific_culture + scope:type_specific_culture = { + OR = { + has_innovation = innovation_advanced_bowmaking + has_innovation = innovation_repeating_crossbow + } + } + } + } + } + save_scope_as = chosen_knight + } + } + #Camel Rider + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:camelry_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_camelry_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { + exists = root.location.culture + root.location.culture = { has_innovation = innovation_war_camels } + } + } + scope:knight_culture = { + trigger = { + exists = scope:knight_culture + scope:knight_culture = { has_innovation = innovation_war_camels } + } + } + scope:turkic_culture = { + trigger = { + exists = scope:turkic_culture + scope:turkic_culture = { has_innovation = innovation_war_camels } + } + } + scope:type_specific_culture = { + trigger = { + exists = scope:type_specific_culture + scope:type_specific_culture = { has_innovation = innovation_war_camels } + } + } + } + save_scope_as = chosen_knight + } + } + #Elephant Rider + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:elephantry_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_elephantry_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { + exists = root.location.culture + root.location.culture = { has_innovation = innovation_elephantry } + } + } + scope:knight_culture = { + trigger = { + exists = scope:knight_culture + scope:knight_culture = { has_innovation = innovation_elephantry } + } + } + scope:type_specific_culture = { + trigger = { + exists = scope:type_specific_culture + scope:type_specific_culture = { has_innovation = innovation_elephantry } + } + } + } + save_scope_as = chosen_knight + } + } + #Horse Archer + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:horse_archer_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_horse_archer_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { + exists = root.location.culture + root.location.culture = { culture_has_archer_cavalry_maa = yes } + } + } + scope:knight_culture = { + trigger = { + exists = scope:knight_culture + scope:knight_culture = { culture_has_archer_cavalry_maa = yes } + } + } + scope:turkic_culture = { + trigger = { + exists = scope:turkic_culture + scope:turkic_culture = { culture_has_archer_cavalry_maa = yes } + } + } + scope:type_specific_culture = { + trigger = { + exists = scope:type_specific_culture + scope:type_specific_culture = { culture_has_archer_cavalry_maa = yes } + } + } + } + save_scope_as = chosen_knight + } + } + #Huntsmaster + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:huntsmaster_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_huntsmaster_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { + exists = root.location.culture + root.location.culture = { NOT = { has_cultural_tradition = tradition_vegetarianism } } + } + } + scope:knight_culture = { + trigger = { + exists = scope:knight_culture + scope:knight_culture = { NOT = { has_cultural_tradition = tradition_vegetarianism } } + } + } + scope:turkic_culture = { + trigger = { + exists = scope:turkic_culture + scope:turkic_culture = { NOT = { has_cultural_tradition = tradition_vegetarianism } } + } + } + scope:type_specific_culture = { + trigger = { + exists = scope:type_specific_culture + scope:type_specific_culture = { NOT = { has_cultural_tradition = tradition_vegetarianism } } + } + } + } + save_scope_as = chosen_knight + } + } + #Blademaster + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:blademaster_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_blademaster_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { + exists = root.location.culture + } + } + scope:knight_culture = { + trigger = { + exists = scope:knight_culture + } + } + scope:varangian_culture = { + trigger = { + exists = scope:varangian_culture + } + } + scope:turkic_culture = { + trigger = { + exists = scope:turkic_culture + } + } + scope:type_specific_culture = { + trigger = { + exists = scope:type_specific_culture + } + } + } + save_scope_as = chosen_knight + } + } + #Reveler + else_if = { + limit = { + scope:accolade_in_need = { + primary_type = { + this = accolade_type:master_of_revels_attribute + } + } + } + create_character = { + location = root.capital_province + template = accolade_master_of_revels_character + faith = root.faith + random_culture = { + root.culture = { + trigger = { always = yes } + } + root.location.culture = { + trigger = { + exists = root.location.culture + } + } + scope:knight_culture = { + trigger = { + exists = scope:knight_culture + } + } + scope:type_specific_culture = { + trigger = { + exists = scope:type_specific_culture + } + } + } + save_scope_as = chosen_knight + } + } + if = { + limit = { + scope:chosen_knight ?= { prowess < 12 } + } + scope:chosen_knight = { + add_prowess_skill = { + value = 12 + subtract = prowess + } + } + } + if = { + limit = { + scope:chosen_knight ?= { has_trait = devoted } + } + scope:chosen_knight = { + remove_trait = devoted + } + } + if = { + limit = { + scope:chosen_knight ?= { has_trait = celibate } + } + scope:chosen_knight = { + remove_trait = celibate + } + } +} diff --git a/N3OW/common/scripted_effects/00_achievement_effects.txt b/N3OW/common/scripted_effects/00_achievement_effects.txt new file mode 100644 index 00000000..4601fbd6 --- /dev/null +++ b/N3OW/common/scripted_effects/00_achievement_effects.txt @@ -0,0 +1,385 @@ +# Adds $FLAG$ to the character if a player +add_achievement_flag_effect = { + if = { + limit = { + is_ai = no + } + add_character_flag = $FLAG$ + } +} + +# Adds $VALUE$ to the character $VARIABLE$ if a player, sets to zero first if not already a present variable +add_achievement_variable_effect = { + if = { + limit = { + is_ai = no + } + if = { + limit = { + NOT = { has_variable = $VARIABLE$ } + } + set_variable = { + name = $VARIABLE$ + value = 0 + } + } + change_variable = { + name = $VARIABLE$ + add = $VALUE$ + } + } +} + +# Sets $VALUE$ to the global variable named $VARIABLE$ if a player +add_achievement_global_variable_effect = { + if = { + limit = { + is_ai = no + } + set_global_variable = { + name = $VARIABLE$ + value = $VALUE$ + } + } +} + +# Adds $FLAG$ to list of unavailable achievements if a player +add_to_global_unavailable_achievements_list_effect = { + if = { + limit = { + is_ai = no + } + add_to_global_variable_list = { + name = unavailable_achievements + target = $FLAG$ + } + } +} + +fp2_had_friend_with_benefits = { # History's Best Friend + if = { + limit = { + is_ai = no + has_fp2_dlc_trigger = yes + has_relation_best_friend = scope:had_sex_with_effect_partner + AND = { # Implicit for readability + culture = { has_cultural_tradition = tradition_fp2_ritualised_friendship } + scope:had_sex_with_effect_partner.culture = { has_cultural_tradition = tradition_fp2_ritualised_friendship } + } + } + add_achievement_global_variable_effect = { # (Has additional check for consistency) + VARIABLE = fp2_historys_best_friends_achievement_unlocked + VALUE = yes + } + } +} + +fp2_holiday_in_iberia_check = { + if = { + limit = { exists = global_var:fp2_holiday_in_iberia_achievement_unlocked } + add_achievement_global_variable_effect = { + VARIABLE = fp2_holiday_in_iberia_achievement_unlocked + VALUE = yes + } + } +} + +ep2_im_in_my_elements_terrain_grabber_effect = { + # Grab various terrain types and add them to a list. + ## Plains + if = { + limit = { + location = { terrain = plains } + } + add_to_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:plains + } + } + ## Sea + else_if = { + limit = { + location = { terrain = sea } + } + add_to_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:sea + } + } + ## Coastal_sea + else_if = { + limit = { + location = { terrain = coastal_sea } + } + add_to_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:coastal_sea + } + } + ## Farmlands + else_if = { + limit = { + location = { terrain = farmlands } + } + add_to_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:farmlands + } + } + ## Hills + else_if = { + limit = { + location = { terrain = hills } + } + add_to_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:hills + } + } + ## Mountains + else_if = { + limit = { + location = { terrain = mountains } + } + add_to_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:mountains + } + } + ## Desert + else_if = { + limit = { + location = { terrain = desert } + } + add_to_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:desert + } + } + ## Desert_mountains + else_if = { + limit = { + location = { terrain = desert_mountains } + } + add_to_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:desert_mountains + } + } + ## Oasis + else_if = { + limit = { + location = { terrain = oasis } + } + add_to_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:oasis + } + } + ## Jungle + else_if = { + limit = { + location = { terrain = jungle } + } + add_to_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:jungle + } + } + ## Forest + else_if = { + limit = { + location = { terrain = forest } + } + add_to_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:forest + } + } + ## Taiga + else_if = { + limit = { + location = { terrain = taiga } + } + add_to_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:taiga + } + } + ## Wetlands + else_if = { + limit = { + location = { terrain = wetlands } + } + add_to_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:wetlands + } + } + ## Steppe + else_if = { + limit = { + location = { terrain = steppe } + } + add_to_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:steppe + } + } + ## Floodplains + else_if = { + limit = { + location = { terrain = floodplains } + } + add_to_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:floodplains + } + } + ## Drylands + else_if = { + limit = { + location = { terrain = drylands } + } + add_to_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:drylands + } + } + ## Terraced Hills + else_if = { + limit = { + location = { terrain = terraced_hills } + } + add_to_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:terraced_hills + } + } + # Error suppression. + if = { + limit = { + always = no + is_target_in_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:plains + } + is_target_in_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:sea + } + is_target_in_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:coastal_sea + } + is_target_in_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:farmlands + } + is_target_in_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:hills + } + is_target_in_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:mountains + } + is_target_in_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:desert + } + is_target_in_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:desert_mountains + } + is_target_in_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:oasis + } + is_target_in_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:jungle + } + is_target_in_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:forest + } + is_target_in_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:taiga + } + is_target_in_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:wetlands + } + is_target_in_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:steppe + } + is_target_in_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:floodplains + } + is_target_in_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:drylands + } + is_target_in_variable_list = { + name = ep2_im_in_my_elements_achievement_terrain_list + target = flag:terraced_hills + } + } + } +} + +player_succeeded_at_a_thousand_and_one_nights_achievement_effect = { + scope:host = { + if = { + limit = { + exists = global_var:started_a_thousand_and_one_nights_achievement + is_ai = no + } + set_global_variable = { + name = finished_a_thousand_and_one_nights_achievement + value = yes + } + } + } +} + +process_tour_achievement_tallies_effect = { + scope:host = { + if = { + limit = { + exists = global_var:started_the_grandest_tour_achievement + is_ai = no + scope:stop_host_scope.highest_held_title_tier >= tier_kingdom + } + scope:activity = { + add_to_variable_list = { + name = the_grandest_tour_achievement_tally_list + target = scope:stop_host_scope + } + } + } + if = { + limit = { + exists = global_var:started_imperial_march_achievement + is_ai = no + scope:activity = { + has_activity_option = { + category = special_type + option = tour_type_intimidation + } + } + scope:stop_host_scope = { is_powerful_vassal = yes } + } + scope:activity = { + add_to_variable_list = { + name = imperial_march_achievement_list + target = scope:stop_host_scope + } + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_activity_effects.txt b/N3OW/common/scripted_effects/00_activity_effects.txt new file mode 100644 index 00000000..b86752b1 --- /dev/null +++ b/N3OW/common/scripted_effects/00_activity_effects.txt @@ -0,0 +1,4589 @@ +####################### +# ACTIVITY REWARDS +# by Chad Uhl +####################### +disburse_tournament_activity_rewards = { + # for the loc + save_scope_as = root_scope + + # Rewards based on amount of Contests + if = { + limit = { + scope:activity = { + num_phases > 5 + } + } + + # Host Rewards + # Prestige Gain + if = { + limit = { + culture = { has_cultural_era_or_later = culture_era_high_medieval } + } + add_prestige = 1800 + } + else = { + add_prestige = 1500 + } + dynasty = { add_dynasty_prestige = massive_dynasty_prestige_value } + + # Glory Hound Vassal Opinion + every_vassal_or_below = { + vassal_stance = glory_hound + limit = { + is_participant_in_activity = scope:activity + } + custom = every_participating_glory_hound_vassal + add_opinion = { + modifier = hosted_tournament_opinion + target = root + opinion = 25 + } + } + # Belligerent Vassal Opinion + every_vassal_or_below = { + limit = { + has_vassal_stance = belligerent + is_participant_in_activity = scope:activity + } + custom = every_participating_belligerent_vassal + add_opinion = { + modifier = hosted_tournament_opinion + target = root + opinion = 25 + } + } + } + else_if = { + limit = { + scope:activity = { + num_phases = 5 + } + } + # Host Rewards + # Prestige Gain + if = { + limit = { + culture = { has_cultural_era_or_later = culture_era_high_medieval } + } + add_prestige = 1500 + } + else = { + add_prestige = 1200 + } + dynasty = { add_dynasty_prestige = major_dynasty_prestige_value } + + # Glory Hound Vassal Opinion + every_vassal_or_below = { + vassal_stance = glory_hound + limit = { + is_participant_in_activity = scope:activity + } + custom = every_participating_glory_hound_vassal + add_opinion = { + modifier = hosted_tournament_opinion + target = root + opinion = 20 + } + } + # Belligerent Vassal Opinion + every_vassal_or_below = { + limit = { + has_vassal_stance = belligerent + is_participant_in_activity = scope:activity + } + custom = every_participating_belligerent_vassal + add_opinion = { + modifier = hosted_tournament_opinion + target = root + opinion = 20 + } + } + } + else_if = { + limit = { + scope:activity = { + num_phases = 4 + } + } + dynasty = { add_dynasty_prestige = medium_dynasty_prestige_value } + + # Host Rewards + # Prestige Gain + if = { + limit = { + culture = { has_cultural_era_or_later = culture_era_high_medieval } + } + add_prestige = 1200 + } + else = { + add_prestige = 1000 + } + + # Glory Hound Vassal Opinion + every_vassal_or_below = { + vassal_stance = glory_hound + limit = { + is_participant_in_activity = scope:activity + } + custom = every_participating_glory_hound_vassal + add_opinion = { + modifier = hosted_tournament_opinion + target = root + opinion = 15 + } + } + # Belligerent Vassal Opinion + every_vassal_or_below = { + limit = { + has_vassal_stance = belligerent + is_participant_in_activity = scope:activity + } + custom = every_participating_belligerent_vassal + add_opinion = { + modifier = hosted_tournament_opinion + target = root + opinion = 15 + } + } + } + else_if = { + limit = { + scope:activity = { + num_phases = 3 + } + } + + # Host Rewards + # Prestige Gain + if = { + limit = { + culture = { has_cultural_era_or_later = culture_era_high_medieval } + } + add_prestige = 1000 + } + else = { + add_prestige = 800 + } + + # Glory Hound Vassal Opinion + every_vassal_or_below = { + vassal_stance = glory_hound + limit = { + is_participant_in_activity = scope:activity + } + custom = every_participating_glory_hound_vassal + add_opinion = { + modifier = hosted_tournament_opinion + target = root + opinion = 10 + } + } + # Belligerent Vassal Opinion + every_vassal_or_below = { + limit = { + has_vassal_stance = belligerent + is_participant_in_activity = scope:activity + } + custom = every_participating_belligerent_vassal + add_opinion = { + modifier = hosted_tournament_opinion + target = root + opinion = 10 + } + } + } + else_if = { + limit = { + scope:activity = { + num_phases = 2 + OR = { + has_activity_option = { + category = tournament_option_accommodations + option = tournament_accommodations_good + } + has_activity_option = { + category = tournament_option_accommodations + option = tournament_accommodations_normal + } + } + } + } + + # Host Rewards + # Prestige Gain + if = { + limit = { + culture = { has_cultural_era_or_later = culture_era_high_medieval } + } + add_prestige = 800 + } + else = { + add_prestige = 600 + } + + # Glory Hound Vassal Opinion + every_vassal_or_below = { + vassal_stance = glory_hound + limit = { + is_participant_in_activity = scope:activity + } + custom = every_participating_glory_hound_vassal + add_opinion = { + modifier = hosted_tournament_opinion + target = root + opinion = 5 + } + } + # Belligerent Vassal Opinion + every_vassal_or_below = { + limit = { + has_vassal_stance = belligerent + is_participant_in_activity = scope:activity + } + custom = every_participating_belligerent_vassal + add_opinion = { + modifier = hosted_tournament_opinion + target = root + opinion = 5 + } + } + } + else = { # 2 phases, bad accommodation + # Host Rewards + # Prestige Gain + if = { + limit = { + culture = { has_cultural_era_or_later = culture_era_high_medieval } + } + add_prestige = 600 + } + else = { + add_prestige = 400 + } + } + # Add some bonuses from accolades. + accolades_development_growth_for_least_developed_county_effect = yes + + scope:activity = { + if = { + limit = { + scope:activity = { + num_phases > 2 + } + } + activity_location = { + add_province_modifier = { + modifier = tournament_men_at_arms_reward_modifier + years = 10 + } + } + } + ## Distribute glory to our _lucky winners_. + every_guest_subset = { + name = winner + limit = { + NOT = { scope:melee_winner ?= this } + accolade ?= { is_accolade_active = yes } + } + custom = tournament_accolade_winner_tt + accolade = { + # For a bit of nuance, we want glory to be relative to how big the Tourney is. A less magnificent tourney is less glorious to win, after all. + ## Great stonking gads of glory. + ## High glory. + if = { + limit = { + scope:activity = { + num_phases > 4 + } + } + add_glory = monumental_glory_gain + } + ## Moderate glory. + else_if = { + limit = { + scope:activity = { + num_phases > 3 + } + } + add_glory = massive_glory_gain + } + ## Low glory. + else_if = { + limit = { + scope:activity = { + num_phases > 2 + } + } + add_glory = major_glory_gain + } + ## Otherwise... well otherwise I don't even know how this qualified as *grand*. + else = { add_glory = medium_glory_gain } + } + } + ## Plus, some consolation glory for every participant. + every_guest_subset = { + name = qualified + limit = { + save_temporary_scope_as = new_list_member_temp + NOT = { + scope:activity = { + any_guest_subset = { + name = winner + this = scope:new_list_member_temp + } + } + } + accolade ?= { is_accolade_active = yes } + } + custom = tournament_accolade_qualified_tt + accolade = { add_glory = minor_glory_gain } + } + # accolade bonus xp for the Contender + every_attending_character = { + limit = { + is_acclaimed = yes + accolade = { + is_accolade_active = yes + OR = { + has_accolade_parameter = accolade_tournament_xp_gain_contender_only_low + has_accolade_parameter = accolade_tournament_xp_gain_contender_only + has_accolade_parameter = accolade_tournament_xp_gain_contender_only_high + } + } + } + save_scope_as = contender + accolades_contender_tournament_xp_gain_effect = yes + } + # accolade trait xp for all knights who hang with a Contender + every_attending_character = { + limit = { + # Does the knight have a comrade with this bonus? + exists = liege + is_knight = yes + liege = { + any_active_accolade = { + OR = { + has_accolade_parameter = accolade_tournament_xp_gain_all_knights + has_accolade_parameter = accolade_tournament_xp_gain_all_knights_high + } + } + } + # Can the knight get it? Or get it the self-training one? + NAND = { + is_acclaimed = yes + accolade = { + has_accolade_type = contender_attribute + } + } + } + custom = tournament_accolade_attendees_tt + accolades_all_knights_liege_tournament_xp_gain_effect = yes + } + } + + # If character had the reduce stress intent, give them stress loss + disburse_activity_stress_loss = yes +} + +disburse_tour_activity_rewards = { + # for the loc + save_scope_as = root_scope + + # Rewards based on Magnficence level + # Rewards based on Tour Type are handed out at the end of each stop + + # Success rewards (includes Magnificence points) + # Max 50 points: 25 Magnificence levels + 25 from events + #Level 5 + if = { + limit = { + var:tour_success_var >= 100 + } + custom_tooltip = level_5_reward_tt + scope:activity = { + add_activity_log_entry = { + key = level_5_reward_tt + tags = { good major completed } + show_in_conclusion = yes + character = scope:root_scope + + # Effects + root = { + add_character_modifier = { #10 years + modifier = mega_itinerant_liege_modifier + years = 20 + } + add_prestige = tour_level_5_prestige_reward + if = { + limit = { + OR = { + this.dynasty.dynast ?= this + is_ai = no + } + } + dynasty ?= { add_dynasty_prestige = major_dynasty_prestige_gain } + } + # Parochial Vassal Opinion + every_vassal_or_below = { + vassal_stance = parochial + limit = { + is_participant_in_activity = scope:activity + } + custom = every_participating_parochial_vassal + add_opinion = { + modifier = hosted_tour_opinion + target = root + opinion = 50 + } + } + } + # Increase Vassal Opinion + every_in_list = { + variable = tour_visited_vassals + custom = every_visited_vassal + limit = { + is_alive = yes + } + add_opinion = { + modifier = tour_visited_vassal_opinion + target = root + opinion = 30 + } + } + } + } + create_character_memory = { + type = legendary_tour + } + } + #Level 4 + else_if = { + limit = { + var:tour_success_var >= 80 + } + custom_tooltip = level_4_reward_tt + scope:activity = { + add_activity_log_entry = { + key = level_4_reward_tt + tags = { good major completed } + show_in_conclusion = yes + character = scope:root_scope + + # Effects + root = { + add_character_modifier = { #10 years + modifier = itinerant_liege_modifier + years = 20 + } + add_prestige = tour_level_4_prestige_reward + if = { + limit = { + OR = { + this.dynasty.dynast ?= this + is_ai = no + } + } + dynasty ?= { add_dynasty_prestige = major_dynasty_prestige_gain } + } + # Parochial Vassal Opinion + every_vassal_or_below = { + vassal_stance = parochial + limit = { + is_participant_in_activity = scope:activity + } + custom = every_participating_parochial_vassal + add_opinion = { + modifier = hosted_tour_opinion + target = root + opinion = 40 + } + } + } + + # Increase Vassal Opinion + every_in_list = { + variable = tour_visited_vassals + custom = every_visited_vassal + limit = { + is_alive = yes + } + add_opinion = { + modifier = tour_visited_vassal_opinion + target = root + opinion = 25 + } + } + } + } + create_character_memory = { + type = good_tour + } + } + #Level 3 + else_if = { + limit = { + var:tour_success_var >= 60 + } + custom_tooltip = level_3_reward_tt + + scope:activity = { + add_activity_log_entry = { + key = level_3_reward_tt + tags = { good major completed } + show_in_conclusion = yes + character = scope:root_scope + + # Effects + root = { + add_prestige = tour_level_3_prestige_reward + if = { + limit = { + OR = { + this.dynasty.dynast ?= this + is_ai = no + } + } + dynasty ?= { add_dynasty_prestige = medium_dynasty_prestige_gain } + } + # Parochial Vassal Opinion + every_vassal_or_below = { + vassal_stance = parochial + limit = { + is_participant_in_activity = scope:activity + } + custom = every_participating_parochial_vassal + add_opinion = { + modifier = hosted_tour_opinion + target = root + opinion = 35 + } + } + } + + # Increase Vassal Opinion + scope:activity = { + every_in_list = { + variable = tour_visited_vassals + custom = every_visited_vassal + limit = { + is_alive = yes + } + add_opinion = { + modifier = tour_visited_vassal_opinion + target = root + opinion = 20 + } + } + } + } + } + create_character_memory = { + type = good_tour + } + } + #Level 2 + else_if = { + limit = { + var:tour_success_var >= 40 + } + custom_tooltip = level_2_reward_tt + + scope:activity = { + add_activity_log_entry = { + key = level_2_reward_tt + tags = { good major completed } + show_in_conclusion = yes + character = scope:root_scope + + # Effects + root = { + add_prestige = tour_level_2_prestige_reward + if = { + limit = { + OR = { + this.dynasty.dynast ?= this + is_ai = no + } + } + dynasty ?= { add_dynasty_prestige = minor_dynasty_prestige_gain } + } + # Parochial Vassal Opinion + every_vassal_or_below = { + vassal_stance = parochial + limit = { + is_participant_in_activity = scope:activity + } + custom = every_participating_parochial_vassal + add_opinion = { + modifier = hosted_tour_opinion + target = root + opinion = 30 + } + } + } + } + } + create_character_memory = { + type = good_tour + } + } + #Level 1 + else_if = { + limit = { + var:tour_success_var >= 20 + } + custom_tooltip = level_1_reward_tt + + scope:activity = { + add_activity_log_entry = { + key = level_1_reward_tt + tags = { good major completed } + show_in_conclusion = yes + character = scope:root_scope + + # Effects + root = { + add_prestige = tour_level_1_prestige_reward + } + } + } + create_character_memory = { + type = underwhelming_tour + } + } + + # No reward - var < 20 + else = { + custom_tooltip = failed_to_get_reward_tt + + scope:activity = { + add_activity_log_entry = { + key = failed_to_get_reward_tt + tags = { good major completed } + show_in_conclusion = yes + character = scope:root_scope + + # Effects + root = { + add_prestige = 200 #pity prize + } + } + } + create_character_memory = { + type = underwhelming_tour + } + } + # If character had the reduce stress intent, give them stress loss + disburse_activity_stress_loss = yes + # Accolade - politicker attribute reward modifier + add_character_modifier = { + modifier = dutiful_realm_knights_modifier + years = 10 + } + + # Glory management. + ## We want to toss out a little glory to knights who go socialize and make themselves known + accolades_activity_complete_tour_glory_effect = yes + # LEGITIMACY GAIN FOR GRAND ACTIVITY PARTICIPATION - TOUR + grand_activity_participation_legitimacy_effect = yes +} + +disburse_witch_ritual_host_rewards_effect = { + scope:activity = { + add_activity_log_entry = { + key = host_witch_ritual + tags = { completed } + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:host + + scope:host = { + add_stress = major_stress_loss + } + } + } +} + +disburse_murder_wedding_host_rewards = { + # for the loc + save_scope_as = root_scope + if = { + limit = { + has_variable = murder_feast_liege_var + } + add_prestige_level = -3 + } + if = { + limit = { + has_variable = murder_feast_head_of_faith_var + } + add_piety_level = -3 + } + if = { + limit = { + culture = { #if this is a cultural thing, people don't really love it + has_cultural_tradition = tradition_wedding_ceremonies + } + } + add_prestige = major_prestige_loss + } + if = { + limit = { + faith = { #if this is a religious thing, people don't really love it + has_doctrine = tenet_ritual_celebrations + } + } + add_piety = major_piety_loss + } + if = { + limit = { has_variable = bloody_wedding_murder_family_var } #you've killed EVERYONE + if = { + limit = { + faith = { #if you can get excommunicated by kinslaying we do so + has_doctrine_parameter = excommunication_active + NOR = { + has_doctrine = doctrine_kinslaying_accepted + has_doctrine = doctrine_kinslaying_shunned + } + } + } + add_trait_force_tooltip = excommunicated + scope:activity = { + add_activity_log_entry = { + key = host_bloody_wedding_excommunication + tags = { completed } + show_in_conclusion = yes + character = scope:host + + scope:host = { + add_excommunication_actual_effect_5_years_version = yes + } + } + } + } + else = { + add_piety_level = -1 + } + scope:activity = { + add_activity_log_entry = { + key = host_bloody_wedding_family_kill + tags = { completed } + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:host + + scope:host = { + add_dread = monumental_dread_gain + add_legitimacy = major_legitimacy_loss + add_character_modifier = { + modifier = gwedding_hosted_murder_wedding_modifier + years = 15 + } + set_variable = just_widowed_var + } + } + } + } + else = { #Rewards for a "normal" feast + if = { #if you failed your attempt it doesn't look great + limit = { has_variable = bloody_murder_fail } + add_legitimacy = minor_legitimacy_loss + add_prestige = minor_prestige_loss + if = { + limit = { + scope:activity = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_good + } + } + } + custom_tooltip = host_wedding_entertainment_good + scope:activity = { + add_activity_log_entry = { + key = host_wedding_entertainment_good + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:host + + scope:host = { + add_prestige = minor_prestige_gain + } + every_attending_character = { + limit = { + NOR = { + this = scope:host + this = scope:spouse_1 + } + } + custom = custom.every_activity_guest + add_prestige = minor_prestige_gain + } + } + } + } + else_if = { + limit = { + scope:activity = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_normal + } + } + } + custom_tooltip = host_wedding_entertainment_normal + scope:activity = { + add_activity_log_entry = { + key = host_wedding_entertainment_normal + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + scope:host = { add_prestige = miniscule_prestige_gain } + } + } + } + + # Food + if = { + limit = { + scope:activity = { + has_activity_option = { + category = wedding_option_food + option = wedding_food_good + } + } + } + custom_tooltip = host_wedding_food_good + scope:activity = { + add_activity_log_entry = { + key = host_wedding_food_good + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:host + + every_attending_character = { + limit = { this != scope:host } + custom = custom.every_attending_character + add_opinion = { + target = scope:host + modifier = impressed_opinion + opinion = 10 + } + } + every_attending_character = { + limit = { + NOR = { + this = scope:host + this = scope:spouse_1 + } + } + custom = custom.every_activity_guest + # Guest opinion from host and spouses + if = { + limit = { + scope:host = { is_ai = yes } + } + custom_tooltip = came_to_my_wedding_opinion_host_high + hidden_effect = { + reverse_add_opinion = { + target = scope:host + modifier = came_to_my_wedding_opinion + opinion = 5 + } + } + } + if = { + limit = { + scope:spouse_1 = { is_ai = yes } + } + custom_tooltip = came_to_my_wedding_opinion_spouse_1_high + hidden_effect = { + reverse_add_opinion = { + target = scope:spouse_1 + modifier = came_to_my_wedding_opinion + opinion = 5 + } + } + } + } + } + } + } + else_if = { + limit = { + scope:activity = { + has_activity_option = { + category = wedding_option_food + option = wedding_food_normal + } + } + } + custom_tooltip = host_wedding_food_normal + scope:activity = { + add_activity_log_entry = { + key = host_wedding_food_normal + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:host + + every_attending_character = { + limit = { this != scope:host } + custom = custom.every_attending_character + add_opinion = { + target = scope:host + modifier = impressed_opinion + opinion = 5 + } + } + } + } + } + + # Decoration + if = { + limit = { + scope:activity = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_good + } + } + } + custom_tooltip = host_wedding_decoration_good + scope:activity = { + add_activity_log_entry = { + key = host_wedding_decoration_good + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:host + + scope:host = { + every_vassal_or_below = { + vassal_stance = courtly + custom = every_courtly_vassal + add_opinion = { + modifier = hosted_wedding_opinion + target = root + opinion = 10 + } + } + } + } + } + } + else_if = { + limit = { + scope:activity = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_normal + } + } + } + custom_tooltip = host_wedding_decoration_normal + scope:activity = { + add_activity_log_entry = { + key = host_wedding_decoration_normal + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:host + + root = { + every_vassal_or_below = { + vassal_stance = courtly + custom = every_courtly_vassal + add_opinion = { + modifier = hosted_wedding_opinion + target = root + opinion = 5 + } + } + } + } + } + } + } + else_if = { #if you've killed your target you get these + limit = { + NOT = { has_variable = bloody_murder_fail } + NOT = { has_variable = bloody_wedding_murder_family_var } + } + scope:activity = { + add_activity_log_entry = { + key = host_bloody_wedding_solo_kill + tags = { completed } + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:host + + scope:host = { + add_dread = massive_dread_gain + add_legitimacy = medium_legitimacy_loss + add_character_modifier = { + modifier = gwedding_hosted_murder_wedding_modifier + years = 10 + } + set_variable = just_widowed_var + } + } + } + } + # Regular wedding hosting rewards - smaller + if = { + limit = { + scope:activity = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_good + } + } + } + custom_tooltip = host_wedding_entertainment_good + scope:activity = { + add_activity_log_entry = { + key = host_wedding_entertainment_good + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:host + + scope:host = { add_prestige = minor_prestige_gain } + every_attending_character = { + limit = { + NOR = { + this = scope:host + this = scope:spouse_1 + } + } + custom = custom.every_activity_guest + add_prestige = minor_prestige_gain + } + } + } + } + else_if = { + limit = { + scope:activity = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_normal + } + } + } + custom_tooltip = host_wedding_entertainment_normal + scope:activity = { + add_activity_log_entry = { + key = host_wedding_entertainment_normal + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + scope:host = { add_prestige = miniscule_prestige_gain } + } + } + } + + # Food + if = { + limit = { + scope:activity = { + has_activity_option = { + category = wedding_option_food + option = wedding_food_good + } + } + } + custom_tooltip = host_wedding_food_good + scope:activity = { + add_activity_log_entry = { + key = host_wedding_food_good + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:host + + every_attending_character = { + limit = { this != scope:host } + custom = custom.every_attending_character + add_opinion = { + target = scope:host + modifier = impressed_opinion + opinion = 10 + } + } + every_attending_character = { + limit = { + NOR = { + this = scope:host + this = scope:spouse_1 + } + } + custom = custom.every_activity_guest + # Guest opinion from host and spouses + if = { + limit = { + scope:host = { is_ai = yes } + } + custom_tooltip = came_to_my_wedding_opinion_host_high + hidden_effect = { + reverse_add_opinion = { + target = scope:host + modifier = came_to_my_wedding_opinion + opinion = 5 + } + } + } + if = { + limit = { + scope:spouse_1 = { is_ai = yes } + } + custom_tooltip = came_to_my_wedding_opinion_spouse_1_high + hidden_effect = { + reverse_add_opinion = { + target = scope:spouse_1 + modifier = came_to_my_wedding_opinion + opinion = 5 + } + } + } + } + } + } + } + else_if = { + limit = { + scope:activity = { + has_activity_option = { + category = wedding_option_food + option = wedding_food_normal + } + } + } + custom_tooltip = host_wedding_food_normal + scope:activity = { + add_activity_log_entry = { + key = host_wedding_food_normal + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:host + + every_attending_character = { + limit = { this != scope:host } + custom = custom.every_attending_character + add_opinion = { + target = scope:host + modifier = impressed_opinion + opinion = 5 + } + } + } + } + } + + # Decoration + if = { + limit = { + scope:activity = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_good + } + } + } + custom_tooltip = host_wedding_decoration_good + scope:activity = { + add_activity_log_entry = { + key = host_wedding_decoration_good + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:host + + scope:host = { + every_vassal_or_below = { + vassal_stance = courtly + custom = every_courtly_vassal + add_opinion = { + modifier = hosted_wedding_opinion + target = root + opinion = 10 + } + } + } + } + } + } + else_if = { + limit = { + scope:activity = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_normal + } + } + } + custom_tooltip = host_wedding_decoration_normal + scope:activity = { + add_activity_log_entry = { + key = host_wedding_decoration_normal + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:host + + root = { + every_vassal_or_below = { + vassal_stance = courtly + custom = every_courtly_vassal + add_opinion = { + modifier = hosted_wedding_opinion + target = root + opinion = 5 + } + } + } + } + } + } + } + # # Vassal Opinion + every_vassal_or_below = { + limit = { + OR = { + has_trait = torturer + has_trait = sadistic + has_trait = vengeful + has_trait = callous + } + } + custom = every_cruel_vassal + add_opinion = { + modifier = respect_opinion + target = scope:host + opinion = 20 + } + } + every_vassal_or_below = { + limit = { + NOR = { + has_trait = torturer + has_trait = sadistic + has_trait = vengeful + has_trait = callous + } + } + custom = wedding_every_other_vassal + add_opinion = { + modifier = suspicion_opinion + target = scope:host + opinion = -25 + } + } + + # Accolade glory gain + accolades_activity_complete_wedding_glory_effect = yes +} + +disburse_wedding_activity_rewards = { + # for the loc + save_scope_as = root_scope + + scope:activity = { + ### Rewards based on Options + # Entertainment + if = { + limit = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_good + } + } + add_activity_log_entry = { + key = host_wedding_entertainment_good + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + root = { add_prestige = 900 } + every_attending_character = { + limit = { + NOR = { + this = scope:host + this = scope:spouse_1 + this = scope:spouse_2 + } + } + custom = custom.every_activity_guest + add_prestige = major_prestige_gain + } + } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_normal + } + } + add_activity_log_entry = { + key = host_wedding_entertainment_normal + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + root = { add_prestige = 600 } + every_attending_character = { + limit = { + NOR = { + this = scope:host + this = scope:spouse_1 + this = scope:spouse_2 + } + } + custom = custom.every_activity_guest + add_prestige = medium_prestige_gain + } + } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_bad + } + } + add_activity_log_entry = { + key = host_wedding_entertainment_bad + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + root = { add_prestige = 300 } + every_attending_character = { + limit = { + NOR = { + this = scope:host + this = scope:spouse_1 + this = scope:spouse_2 + } + } + custom = custom.every_activity_guest + add_prestige = minor_prestige_gain + } + } + } + + # Food + if = { + limit = { + has_activity_option = { + category = wedding_option_food + option = wedding_food_good + } + } + add_activity_log_entry = { + key = host_wedding_food_good + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + every_attending_character = { + limit = { this != root } + custom = custom.every_activity_guest + add_opinion = { + target = root + modifier = impressed_opinion + opinion = 30 + } + } + every_attending_character = { + limit = { + NOR = { + this = scope:host + this = scope:spouse_1 + this = scope:spouse_2 + } + } + custom = custom.every_activity_guest + # Guest opinion from host and spouses + if = { + limit = { + scope:host = { is_ai = yes } + } + custom_tooltip = came_to_my_wedding_opinion_host_high + hidden_effect = { + reverse_add_opinion = { + target = scope:host + modifier = came_to_my_wedding_opinion + opinion = 15 + } + } + } + if = { + limit = { + scope:spouse_1 = { is_ai = yes } + } + custom_tooltip = came_to_my_wedding_opinion_spouse_1_high + hidden_effect = { + reverse_add_opinion = { + target = scope:spouse_1 + modifier = came_to_my_wedding_opinion + opinion = 15 + } + } + } + if = { + limit = { + scope:spouse_2 = { is_ai = yes } + } + custom_tooltip = came_to_my_wedding_opinion_spouse_2_high + hidden_effect = { + reverse_add_opinion = { + target = scope:spouse_2 + modifier = came_to_my_wedding_opinion + opinion = 15 + } + } + } + } + } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_food + option = wedding_food_normal + } + } + add_activity_log_entry = { + key = host_wedding_food_normal + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + every_attending_character = { + limit = { this != root } + custom = custom.every_activity_guest + add_opinion = { + target = root + modifier = impressed_opinion + opinion = 20 + } + } + every_attending_character = { + limit = { + NOR = { + this = scope:host + this = scope:spouse_1 + this = scope:spouse_2 + } + } + custom = custom.every_activity_guest + # Opinion from host and spouses + if = { + limit = { + scope:host = { is_ai = yes } + } + custom_tooltip = came_to_my_wedding_opinion_host_medium + hidden_effect = { + reverse_add_opinion = { + target = scope:host + modifier = came_to_my_wedding_opinion + opinion = 10 + } + } + } + if = { + limit = { + scope:spouse_1 = { is_ai = yes } + } + custom_tooltip = came_to_my_wedding_opinion_spouse_1_medium + hidden_effect = { + reverse_add_opinion = { + target = scope:spouse_1 + modifier = came_to_my_wedding_opinion + opinion = 10 + } + } + } + if = { + limit = { + scope:spouse_2 = { is_ai = yes } + } + custom_tooltip = came_to_my_wedding_opinion_spouse_2_medium + hidden_effect = { + reverse_add_opinion = { + target = scope:spouse_2 + modifier = came_to_my_wedding_opinion + opinion = 10 + } + } + } + } + } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_food + option = wedding_food_bad + } + } + add_activity_log_entry = { + key = host_wedding_food_bad + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + every_attending_character = { + limit = { this != root } + custom = custom.every_activity_guest + add_opinion = { + target = root + modifier = impressed_opinion + opinion = 5 + } + } + every_attending_character = { + limit = { + NOR = { + this = scope:host + this = scope:spouse_1 + this = scope:spouse_2 + } + } + custom = custom.every_activity_guest + # Opinion from host and spouses + if = { + limit = { + scope:host = { is_ai = yes } + } + custom_tooltip = came_to_my_wedding_opinion_host_low + hidden_effect = { + reverse_add_opinion = { + target = scope:host + modifier = came_to_my_wedding_opinion + opinion = 5 + } + } + } + if = { + limit = { + scope:spouse_1 = { is_ai = yes } + } + custom_tooltip = came_to_my_wedding_opinion_spouse_1_low + hidden_effect = { + reverse_add_opinion = { + target = scope:spouse_1 + modifier = came_to_my_wedding_opinion + opinion = 5 + } + } + } + if = { + limit = { + scope:spouse_2 = { is_ai = yes } + } + custom_tooltip = came_to_my_wedding_opinion_spouse_2_low + hidden_effect = { + reverse_add_opinion = { + target = scope:spouse_2 + modifier = came_to_my_wedding_opinion + opinion = 5 + } + } + } + } + } + } + + # Decoration + if = { + limit = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_good + } + } + add_activity_log_entry = { + key = host_wedding_decoration_good + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + root = { + add_character_modifier = { + modifier = gwedding_magnificent_host_modifier + years = 20 + } + if = { + limit = { + any_vassal_or_below = { + vassal_stance = courtly + } + } + every_vassal_or_below = { + vassal_stance = courtly + custom = every_courtly_vassal + add_opinion = { + modifier = hosted_wedding_opinion + target = root + opinion = 30 + } + } + } + } + every_attending_character = { + limit = { + NOR = { + this = scope:host + this = scope:spouse_1 + this = scope:spouse_2 + } + } + custom = custom.every_activity_guest + add_character_modifier = { + modifier = wedding_of_the_century_modifier + years = 20 + } + if = { + limit = { + has_trait = lifestyle_reveler + } + add_trait_xp = { + trait = lifestyle_reveler + value = 10 + } + } + } + } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_normal + } + } + add_activity_log_entry = { + key = host_wedding_decoration_normal + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + root = { + add_character_modifier = { + modifier = gwedding_gracious_host_modifier + years = 20 + } + if = { + limit = { + any_vassal_or_below = { + vassal_stance = courtly + } + } + every_vassal_or_below = { + vassal_stance = courtly + custom = every_courtly_vassal + add_opinion = { + modifier = hosted_wedding_opinion + target = root + opinion = 20 + } + } + } + } + every_attending_character = { + limit = { + NOR = { + this = scope:host + this = scope:spouse_1 + this = scope:spouse_2 + } + has_trait = lifestyle_reveler + } + custom = custom.every_activity_guest + add_trait_xp = { + trait = lifestyle_reveler + value = 5 + } + } + } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_bad + } + } + add_activity_log_entry = { + key = host_wedding_decoration_bad + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + root = { + if = { + limit = { + has_trait = lifestyle_reveler + } + add_trait_xp = { + trait = lifestyle_reveler + value = 10 + } + } + else = { + add_trait = lifestyle_reveler + } + if = { + limit = { + any_vassal_or_below = { + vassal_stance = courtly + } + } + every_vassal_or_below = { + vassal_stance = courtly + custom = every_courtly_vassal + add_opinion = { + modifier = hosted_wedding_opinion + target = root + opinion = 5 + } + } + } + } + scope:activity = { + every_attending_character = { + limit = { + NOR = { + this = scope:host + this = scope:spouse_1 + this = scope:spouse_2 + } + has_trait = lifestyle_reveler + } + custom = custom.every_activity_guest + add_trait_xp = { + trait = lifestyle_reveler + value = 3 + } + } + } + } + } + } + + # Bonuses for location + if = { + limit = { + scope:wedding_venue = { + OR = { + has_building_or_higher = royal_garden_01 + has_building_or_higher = leisure_palace_01 + barony = { is_holy_site_of = scope:host.faith } + barony = { is_holy_site_of = scope:spouse_1.faith } + barony = { is_holy_site_of = scope:spouse_2.faith } + this = scope:host.capital_province + } + } + } + scope:activity = { + add_activity_log_entry = { + key = host_wedding_venue + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + + if = { + limit = { + OR = { + scope:wedding_venue = { has_building_or_higher = royal_garden_03 } + scope:wedding_venue = { has_building_or_higher = leisure_palace_03 } + } + } + root = { + stress_impact = { + base = massive_stress_impact_loss + } + dynasty ?= { add_dynasty_prestige = minor_dynasty_prestige_gain } + } + } + else_if = { + limit = { + OR = { + scope:wedding_venue = { has_building_or_higher = royal_garden_02 } + scope:wedding_venue = { has_building_or_higher = leisure_palace_02 } + } + } + root = { + stress_impact = { + base = major_stress_impact_loss + } + dynasty ?= { add_dynasty_prestige = miniscule_dynasty_prestige_gain } + } + } + else_if = { + limit = { + OR = { + scope:wedding_venue = { has_building_or_higher = royal_garden_01 } + scope:wedding_venue = { has_building_or_higher = leisure_palace_01 } + } + } + root = { + stress_impact = { + base = medium_stress_impact_loss + } + dynasty ?= { add_dynasty_prestige = 10 } + } + } + if = { + limit = { + scope:wedding_venue = { + barony = { is_holy_site_of = scope:host.faith } + } + } + root = { + add_piety = major_piety_gain + } + } + if = { + limit = { + scope:wedding_venue = { + this = root.capital_province + } + } + # Replace marriage_effect.2001 + root = { + add_gold = minor_gold_value + } + } + if = { + limit = { + scope:wedding_venue.barony = { is_holy_site_of = scope:spouse_1.faith } + } + scope:spouse_1 = { add_piety = massive_piety_gain } + } + if = { + limit = { + scope:wedding_venue.barony = { is_holy_site_of = scope:spouse_2.faith } + } + scope:spouse_2 = { add_piety = massive_piety_gain } + } + } + } + } + + # If character had the reduce stress intent, give them stress loss + root = { disburse_activity_stress_loss = yes } + scope:activity = { + every_attending_character = { + limit = { + NOR = { + this = scope:host + this = scope:spouse_1 + this = scope:spouse_2 + } + } + custom = custom.every_activity_guest + disburse_activity_stress_loss = yes + } + } + + # Accolade glory gain + accolades_activity_complete_wedding_glory_effect = yes +} + +disburse_wedding_spouse_activity_rewards = { + # for the loc + save_scope_as = root_scope + if = { + limit = { + this = scope:spouse_1 + } + scope:spouse_2 = { save_scope_as = other_spouse } + } + else_if = { + limit = { + this = scope:spouse_2 + } + scope:spouse_1 = { save_scope_as = other_spouse } + } + + scope:activity = { + ### Rewards based on Options + # Entertainment + if = { + limit = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_good + } + } + add_activity_log_entry = { + key = spouse_wedding_entertainment_good + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + target = scope:other_spouse + + scope:root_scope = { add_prestige = 800 } + } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_normal + } + } + add_activity_log_entry = { + key = spouse_wedding_entertainment_normal + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + target = scope:other_spouse + + scope:root_scope = { add_prestige = 600 } + } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_bad + } + } + add_activity_log_entry = { + key = spouse_wedding_entertainment_bad + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + target = scope:other_spouse + + scope:root_scope = { add_prestige = 400 } + } + } + + # Food + if = { + limit = { + has_activity_option = { + category = wedding_option_food + option = wedding_food_good + } + } + add_activity_log_entry = { + key = spouse_wedding_food_good + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + target = scope:other_spouse + + scope:activity = { + every_attending_character = { + limit = { + NOR = { + this = scope:root_scope + this = scope:host + this = scope:other_spouse + } + } + custom = custom.every_activity_guest + add_opinion = { + target = scope:root_scope + modifier = impressed_opinion + opinion = 25 + } + } + } + scope:root_scope = { + if = { + limit = { + has_trait = lifestyle_reveler + } + add_trait_xp = { + trait = lifestyle_reveler + value = 15 + } + } + } + } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_food + option = wedding_food_normal + } + } + add_activity_log_entry = { + key = spouse_wedding_food_normal + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + target = scope:other_spouse + + scope:activity = { + every_attending_character = { + limit = { + NOR = { + this = scope:root_scope + this = scope:host + this = scope:other_spouse + } + } + custom = custom.every_activity_guest + add_opinion = { + target = scope:root_scope + modifier = impressed_opinion + opinion = 15 + } + } + } + scope:root_scope = { + if = { + limit = { + has_trait = lifestyle_reveler + } + add_trait_xp = { + trait = lifestyle_reveler + value = 7 + } + } + } + } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_food + option = wedding_food_bad + } + } + add_activity_log_entry = { + key = spouse_wedding_food_bad + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + target = scope:other_spouse + + scope:activity = { + every_attending_character = { + limit = { + NOR = { + this = scope:root_scope + this = scope:host + this = scope:other_spouse + } + } + custom = custom.every_activity_guest + add_opinion = { + target = scope:root_scope + modifier = impressed_opinion + opinion = 5 + } + } + } + scope:root_scope = { + if = { + limit = { + has_trait = lifestyle_reveler + } + add_trait_xp = { + trait = lifestyle_reveler + value = 3 + } + } + } + } + } + + # Decoration + if = { + limit = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_good + } + } + add_activity_log_entry = { + key = spouse_wedding_decoration_good + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + target = scope:other_spouse + + scope:root_scope = { + add_character_modifier = { + modifier = gwedding_magnificent_wedding_modifier + years = 20 + } + dynasty ?= { + add_dynasty_prestige = medium_dynasty_prestige_gain + } + } + } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_normal + } + } + add_activity_log_entry = { + key = spouse_wedding_decoration_normal + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + target = scope:other_spouse + + scope:root_scope = { + add_character_modifier = { + modifier = gwedding_grandiose_wedding_modifier + years = 20 + } + dynasty ?= { + add_dynasty_prestige = minor_dynasty_prestige_gain + } + } + } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_bad + } + } + add_activity_log_entry = { + key = spouse_wedding_decoration_bad + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + target = scope:other_spouse + + scope:root_scope = { + add_character_modifier = { + modifier = gwedding_grand_wedding_modifier + years = 20 + } + dynasty ?= { + add_dynasty_prestige = miniscule_dynasty_prestige_gain + } + } + } + } + } + + # If character had the reduce stress intent, give them stress loss + disburse_activity_stress_loss = yes + + # LEGITIMACY GAIN FOR GRAND ACTIVITY PARTICIPATION - WEDDING + grand_activity_participation_legitimacy_effect = yes +} + +tooltip_disburse_wedding_host_activity_rewards = { + scope:activity = { + if = { + limit = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_good + } + } + root = { add_prestige = 1200 } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_normal + } + } + root = { add_prestige = 800 } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_bad + } + } + root = { add_prestige = 400 } + } + if = { + limit = { + has_activity_option = { + category = wedding_option_food + option = wedding_food_good + } + } + every_attending_character = { + limit = { this != root } + custom = custom.every_activity_guest + add_opinion = { + target = root + modifier = impressed_opinion + opinion = 30 + } + } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_food + option = wedding_food_normal + } + } + every_attending_character = { + limit = { this != root } + custom = custom.every_activity_guest + add_opinion = { + target = root + modifier = impressed_opinion + opinion = 20 + } + } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_food + option = wedding_food_bad + } + } + every_attending_character = { + limit = { this != root } + custom = custom.every_activity_guest + add_opinion = { + target = root + modifier = impressed_opinion + opinion = 5 + } + } + } + if = { + limit = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_good + } + } + root = { + add_character_modifier = { + modifier = gwedding_magnificent_host_modifier + years = 20 + } + if = { + limit = { + any_vassal_or_below = { + vassal_stance = courtly + } + } + every_vassal_or_below = { + vassal_stance = courtly + custom = every_courtly_vassal + add_opinion = { + modifier = hosted_wedding_opinion + target = root + opinion = 30 + } + } + } + } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_normal + } + } + root = { + add_character_modifier = { + modifier = gwedding_gracious_host_modifier + years = 20 + } + if = { + limit = { + any_vassal_or_below = { + vassal_stance = courtly + } + } + every_vassal_or_below = { + vassal_stance = courtly + custom = every_courtly_vassal + add_opinion = { + modifier = hosted_wedding_opinion + target = root + opinion = 20 + } + } + } + } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_bad + } + } + root = { + if = { + limit = { + has_trait = lifestyle_reveler + } + add_trait_xp = { + trait = lifestyle_reveler + value = 10 + } + } + else = { + add_trait = lifestyle_reveler + } + if = { + limit = { + any_vassal_or_below = { + vassal_stance = courtly + } + } + every_vassal_or_below = { + vassal_stance = courtly + custom = every_courtly_vassal + add_opinion = { + modifier = hosted_wedding_opinion + target = root + opinion = 5 + } + } + } + } + } + if = { + limit = { + OR = { + scope:wedding_venue = { has_building_or_higher = royal_garden_03 } + scope:wedding_venue = { has_building_or_higher = leisure_palace_03 } + } + } + root = { + stress_impact = { + base = massive_stress_impact_loss + } + dynasty ?= { add_dynasty_prestige = minor_dynasty_prestige_gain } + } + } + else_if = { + limit = { + OR = { + scope:wedding_venue = { has_building_or_higher = royal_garden_02 } + scope:wedding_venue = { has_building_or_higher = leisure_palace_02 } + } + } + root = { + stress_impact = { + base = major_stress_impact_loss + } + dynasty ?= { add_dynasty_prestige = miniscule_dynasty_prestige_gain } + } + } + else_if = { + limit = { + OR = { + scope:wedding_venue = { has_building_or_higher = royal_garden_01 } + scope:wedding_venue = { has_building_or_higher = leisure_palace_01 } + } + } + root = { + stress_impact = { + base = medium_stress_impact_loss + } + dynasty ?= { add_dynasty_prestige = 10 } + } + } + if = { + limit = { + scope:wedding_venue = { + barony = { is_holy_site_of = scope:host.faith } + } + } + root = { + add_piety = major_piety_gain + } + } + if = { + limit = { + scope:wedding_venue = { + this = root.capital_province + } + } + # Replace marriage_effect.2001 + root = { + add_gold = minor_gold_value + } + } + } + # If character had the reduce stress intent, give them stress loss + root = { disburse_activity_stress_loss = yes } + + # Accolade glory gain + accolades_activity_complete_wedding_glory_effect = yes + + # LEGITIMACY GAIN FOR GRAND ACTIVITY PARTICIPATION - WEDDING + grand_activity_participation_legitimacy_effect = yes +} + +tooltip_disburse_wedding_guest_activity_rewards = { + scope:activity = { + if = { + limit = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_good + } + } + root = { add_prestige = major_prestige_gain } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_normal + } + } + root = { add_prestige = medium_prestige_gain } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_entertainment + option = wedding_entertainment_bad + } + } + root = { add_prestige = minor_prestige_gain } + } + if = { + limit = { + has_activity_option = { + category = wedding_option_food + option = wedding_food_good + } + } + if = { + limit = { + scope:host = { is_ai = yes } + } + custom_tooltip = came_to_my_wedding_opinion_host_high + } + if = { + limit = { + scope:spouse_1 = { is_ai = yes } + } + custom_tooltip = came_to_my_wedding_opinion_spouse_1_high + } + if = { + limit = { + scope:spouse_2 = { is_ai = yes } + } + custom_tooltip = came_to_my_wedding_opinion_spouse_2_high + } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_food + option = wedding_food_normal + } + } + if = { + limit = { + scope:host = { is_ai = yes } + } + custom_tooltip = came_to_my_wedding_opinion_host_medium + } + if = { + limit = { + scope:spouse_1 = { is_ai = yes } + } + custom_tooltip = came_to_my_wedding_opinion_spouse_1_medium + } + if = { + limit = { + scope:spouse_2 = { is_ai = yes } + } + custom_tooltip = came_to_my_wedding_opinion_spouse_2_medium + } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_food + option = wedding_food_bad + } + } + if = { + limit = { + scope:host = { is_ai = yes } + } + custom_tooltip = came_to_my_wedding_opinion_host_low + } + if = { + limit = { + scope:spouse_1 = { is_ai = yes } + } + custom_tooltip = came_to_my_wedding_opinion_spouse_1_low + } + if = { + limit = { + scope:spouse_2 = { is_ai = yes } + } + custom_tooltip = came_to_my_wedding_opinion_spouse_2_low + } + } + if = { + limit = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_good + } + } + root = { + add_character_modifier = { + modifier = wedding_of_the_century_modifier + years = 20 + } + if = { + limit = { + has_trait = lifestyle_reveler + } + add_trait_xp = { + trait = lifestyle_reveler + value = 10 + } + } + } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_normal + } + } + root = { + if = { + limit = { + has_trait = lifestyle_reveler + } + add_trait_xp = { + trait = lifestyle_reveler + value = 5 + } + } + } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_bad + } + } + root = { + if = { + limit = { + has_trait = lifestyle_reveler + } + add_trait_xp = { + trait = lifestyle_reveler + value = 3 + } + } + } + } + } + disburse_activity_stress_loss = yes + + # Accolade glory gain + accolades_activity_complete_wedding_glory_effect = yes + + # LEGITIMACY GAIN FOR GRAND ACTIVITY PARTICIPATION - WEDDING + grand_activity_participation_legitimacy_effect = yes +} + +disburse_wedding_spouse_host_activity_rewards = { + # for the loc + save_scope_as = root_scope + if = { + limit = { + root = scope:spouse_1 + } + scope:spouse_2 = { save_scope_as = other_spouse } + } + else_if = { + limit = { + root = scope:spouse_2 + } + scope:spouse_1 = { save_scope_as = other_spouse } + } + + scope:activity = { + if = { + limit = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_good + } + } + add_activity_log_entry = { + key = host_wedding_decoration_good + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + target = scope:other_spouse + + scope:root_scope = { + add_character_modifier = { + modifier = gwedding_magnificent_wedding_modifier + years = 20 + } + } + } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_normal + } + } + custom_tooltip = host_wedding_decoration_normal + add_activity_log_entry = { + key = host_wedding_decoration_normal + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + target = scope:other_spouse + + scope:root_scope = { + add_character_modifier = { + modifier = gwedding_grandiose_wedding_modifier + years = 20 + } + } + } + } + else_if = { + limit = { + has_activity_option = { + category = wedding_option_decoration + option = wedding_decoration_bad + } + } + custom_tooltip = host_wedding_decoration_bad + add_activity_log_entry = { + key = host_wedding_decoration_bad + tags = { completed } + score = 100 + # this line below adds the entry to the Effects section of the conclusion UI + show_in_conclusion = yes + character = scope:root_scope + target = scope:other_spouse + + scope:root_scope = { + add_character_modifier = { + modifier = gwedding_grand_wedding_modifier + years = 20 + } + } + } + } + } + + # LEGITIMACY GAIN FOR GRAND ACTIVITY PARTICIPATION - WEDDING + grand_activity_participation_legitimacy_effect = yes +} + +disburse_hunt_activity_rewards = { + # for the loc + save_scope_as = root_scope + if = { # To show correct tooltips for guests + limit = { has_trait = lifestyle_hunter } + add_character_flag = { + flag = host_existing_hunter + weeks = 1 + } + } + hunt_individual_guest_awards_effect = yes + # Rewards based on Magnficence level + # Host Rewards + # Adventurer Provisions + if = { + limit = { + has_government = landless_adventurer_government + } + domicile = { + change_provisions = { + value = hunt_provisions_reward_value + } + } + } + # Nomads gain dread and prowess from dangerous animal kills + if = { + limit = { + government_has_flag = government_is_nomadic + scope:activity = { + var:hunt_success ?= flag:yes + NOT = { exists = var:animal_spared } + hunt_animal_type_dangerous_trigger = { VAR = var:animal_type } + } + } + add_dread = massive_dread_gain + add_prowess_skill = 1 + } + # Nomad Discount Modifier for Feasts + if = { + limit = { + government_has_flag = government_is_nomadic + scope:activity.var:hunt_success ?= flag:yes + NOT = { exists = scope:activity.var:animal_spared } + scope:activity = { + NOR = { + var:animal_type ?= flag:hare + var:animal_type ?= flag:fox + } + } + } + custom_tooltip = nomad_good_hunt_tt + add_character_modifier = { + modifier = mpo_si_slaughtered_animals + } + } + else_if = { + limit = { + government_has_flag = government_is_nomadic + scope:activity.var:hunt_success ?= flag:yes + NOT = { exists = scope:activity.var:animal_spared } + } + custom_tooltip = nomad_meager_hunt_tt + } + # Prestige/Piety Gain + if = { + limit = { + culture = { has_cultural_parameter = sacred_hunts } + } + add_prestige = hunt_prestige_with_piety_reward_value + add_piety = hunt_piety_reward_value + } + else = { add_prestige = hunt_prestige_reward_value } + # Triggered bonuses + if = { + limit = { has_character_flag = impressive_hunt } + every_vassal = { + add_opinion = { + modifier = hosted_hunt_opinion + target = scope:root_scope + opinion = 5 + } + } + remove_character_flag = impressive_hunt + } + if = { + limit = { has_character_flag = personal_hunt } + if = { + limit = { scope:activity.var:hunt_success ?= flag:yes } + scope:activity = { + random_attending_character = { + limit = { + NOR = { + has_trait = loyal + has_trait = disloyal + } + is_ai = yes + } + weight = { + base = 1 + opinion_modifier = { + opinion_target = root + } + } + add_trait = loyal + } + } + } + else = { + scope:activity = { + random_attending_character = { + limit = { + NOR = { + has_trait = loyal + has_trait = disloyal + } + is_ai = yes + } + weight = { + base = 1 + opinion_modifier = { + opinion_target = root + } + } + random = { + chance = 50 + add_trait = loyal + } + } + } + } + remove_character_flag = personal_hunt + } + if = { + limit = { has_character_flag = glorious_hunt } + if = { + limit = { scope:activity.var:hunt_success ?= flag:yes } + add_legitimacy_effect = { LEGITIMACY = minor_legitimacy_gain } + } + else = { + add_legitimacy_effect = { LEGITIMACY = miniscule_legitimacy_gain } + } + remove_character_flag = glorious_hunt + } + # Glory Hound Vassal Opinion + set_variable = { + name = attending_glory_hounds + value = scope:root_scope.number_of_participating_glory_hound_vassals + } + every_vassal = { + vassal_stance = glory_hound + limit = { + is_participant_in_activity = scope:activity + } + custom = every_participating_glory_hound_vassal + add_opinion = { + modifier = hosted_hunt_opinion + target = scope:root_scope + opinion = hunt_glory_hound_vassal_opinion_value + } + } + remove_variable = attending_glory_hounds + # Belligerent Vassal Opinion + set_variable = { + name = attending_belligerent + value = scope:root_scope.number_of_participating_belligerent_vassals + } + every_vassal_or_below = { + limit = { + has_vassal_stance = belligerent + is_participant_in_activity = scope:activity + } + custom = every_participating_belligerent_vassal + add_opinion = { + modifier = hosted_hunt_opinion + target = scope:root_scope + opinion = 15 + } + } + remove_variable = attending_belligerent + scope:activity = { + hidden_effect = { + if = { + limit = { + activity_host = { has_trait = lifestyle_hunter } + } + add_to_variable_list = { + name = trait_rewards + target = trait:lifestyle_hunter + } + } + } + # People happy when their nobles clear dangerous beasts + if = { + limit = { + var:hunt_success ?= flag:yes + NOT = { exists = var:animal_spared } + hunt_animal_type_predator_trigger = { VAR = var:animal_type } + activity_location.county.holder.top_liege ?= scope:host.top_liege # own nobles + } + activity_location.county = { + add_county_modifier = { + modifier = hunt_dangerous_beast_slain_modifier + years = 10 + } + } + } + show_as_tooltip = { + every_attending_character = { + limit = { + NOR = { + this = scope:host + this = root + } + is_adult = yes + trigger_if = { + limit = { + scope:activity = { + NOT = { + has_activity_option = { category = special_type option = hunt_type_falconry } + } + } + } + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:root_scope } + } + trigger_if = { + limit = { is_clergy = yes } + faith = { has_doctrine_parameter = clergy_can_fight } + } + } + custom = hunt_every_other_hunter_tt + add_prestige = hunt_prestige_guest_gain_value + if = { + limit = { + government_has_flag = government_is_nomadic + scope:activity = { + var:hunt_success ?= flag:yes + NOT = { exists = var:animal_spared } + hunt_animal_type_dangerous_trigger = { VAR = var:animal_type } + } + } + add_prowess_skill = 1 + } + } + } + } + + # Remove strife if relevant. + remove_strife_per_invited_powerful_vassal_effect = yes +} + +disburse_feast_activity_rewards = { + # for the loc + save_scope_as = root_scope + + # Rewards based on Activity Options + + # Number of courses + if = { + limit = { + scope:activity = { + has_activity_option = { + category = feast_option_courses + option = feast_courses_good + } + } + } + scope:activity = { + add_activity_log_entry = { + key = courses_good_reward_tt + tags = { completed } + character = scope:root_scope + show_in_conclusion = yes + score = 50 + + # Effects + root = { + # Host Rewards + + + #Max Food Option will make Courtly Vassals more happy than other guests. + #Court Amenities can increase this further. + + every_vassal_or_below = { + vassal_stance = courtly + limit = { + is_participant_in_activity = scope:activity + } + custom = every_courtly_vassal + add_opinion = { + modifier = hosted_feast_opinion + target = root + opinion = feast_opinion_max_food_value + } + } + # Vassal Opinion + scope:activity = { + every_attending_character = { + limit = { + this != root + trigger_if = { + limit = { + is_vassal_of = root + } + NOT = { has_vassal_stance = courtly } + } + } + custom = custom.every_attending_character_but_courtly + add_opinion = { + target = root + modifier = impressed_opinion + opinion = feast_opinion_max_food_value + } + } + } + } + } + } + } + else_if = { + limit = { + scope:activity = { + has_activity_option = { + category = feast_option_courses + option = feast_courses_normal + } + } + } + #With Middle Food Option + scope:activity = { + add_activity_log_entry = { + key = courses_normal_reward_tt + tags = { completed } + character = scope:root_scope + show_in_conclusion = yes + score = 50 + + # Effects + root = { + # Host Rewards + + #With Middle Food Option Courtly vassals have slightly higher opinion gain than others + #Very High Court Amenities can increase it slightly. + + # Courtly Vassal Opinion + every_vassal_or_below = { + vassal_stance = courtly + limit = { + is_participant_in_activity = scope:activity + } + custom = every_courtly_vassal + add_opinion = { + modifier = hosted_feast_opinion + target = root + opinion = feast_opinion_medium_food_value + } + } + # Vassal Opinion + scope:activity = { + every_attending_character = { + limit = { + this != root + trigger_if = { + limit = { + is_vassal_of = root + } + NOT = { has_vassal_stance = courtly } + } + } + custom = custom.every_attending_character_but_courtly + add_opinion = { + target = root + modifier = impressed_opinion + opinion = feast_opinion_medium_food_value + } + } + } + } + } + } + } + else = { + scope:activity = { + add_activity_log_entry = { + key = courses_bad_reward_tt + tags = { completed } + character = scope:root_scope + show_in_conclusion = yes + score = 50 + + # Effects + root = { + # Host Rewards + + #With Low food option the opinion gain with Courtly vassals is always lower than for normal guests. Even if you have very high court amenities (though they do mitigate it a bit). + every_vassal_or_below = { + vassal_stance = courtly + limit = { + is_participant_in_activity = scope:activity + } + custom = every_courtly_vassal + add_opinion = { + modifier = hosted_mediocre_feast_opinion + target = root + opinion = feast_opinion_mediocre_food_value + } + } + + # Vassal Opinion + scope:activity = { + #Other guests + every_attending_character = { + limit = { + this != root + trigger_if = { + limit = { + is_vassal_of = root + } + NOT = { has_vassal_stance = courtly } + } + } + custom = custom.every_attending_character_but_courtly + add_opinion = { + target = root + modifier = impressed_opinion + opinion = feast_opinion_mediocre_food_value + } + } + } + } + } + } + } + + # If you have an Estate, with the relevant upgrade, you get additional opinion + # This does create a duplicate opinion entry in the list of effects, but is easier for script maintenance + if = { + limit = { + scope:host = { + domicile ?= { + has_domicile_parameter = estate_improved_feast_opinion + domicile_location = scope:activity_location + } + } + } + scope:activity = { + add_activity_log_entry = { + key = feast_estate_reward_tt + tags = { completed } + character = scope:root_scope + show_in_conclusion = yes + score = 50 + + root = { + scope:activity = { + every_attending_character = { + limit = { + this != root + } + custom = custom.every_attending_character + add_opinion = { + target = root + modifier = impressed_opinion + opinion = 5 + } + } + } + } + } + } + } + + # Dish complexity + if = { + limit = { + scope:activity = { + has_activity_option = { + category = feast_option_food + option = feast_food_good + } + } + } + scope:activity = { + add_activity_log_entry = { + key = food_good_reward_tt + tags = { completed } + character = scope:root_scope + show_in_conclusion = yes + score = 50 + + # Effects + root = { + # Host Rewards + add_prestige = { + value = 225 + scope:host = { + if = { + limit = { + has_royal_court = yes + has_dlc_feature = royal_court + amenity_level = { target = court_food_quality value >= 5 } + } + multiply = 1.5 + } + multiply = court_brewmaster_multiplier + } + if = { + limit = { + culture = { + has_cultural_parameter = refined_feasts + } + } + add = major_prestige_gain + } + if = { + limit = { + any_character_struggle = { + involvement = involved + has_struggle_phase_parameter = struggle_prestige_from_feast + } + } + add = medium_prestige_gain + } + if = { + limit = { + confederation ?= { has_cohesion_level_parameter = any_member_increased_feast_rewards } + } + multiply = 1.1 + } + } + } + } + } + } + else_if = { + limit = { + scope:activity = { + has_activity_option = { + category = feast_option_food + option = feast_food_normal + } + } + } + scope:activity = { + add_activity_log_entry = { + key = food_normal_reward_tt + tags = { completed } + character = scope:root_scope + show_in_conclusion = yes + score = 50 + + # Effects + root = { + # Host Rewards + add_prestige = { + value = 115 + scope:host = { + if = { + limit = { + scope:host = { + has_royal_court = yes + has_dlc_feature = royal_court + amenity_level = { target = court_food_quality value >= 5 } + } + } + multiply = 2 + } + else_if = { + limit = { + scope:host = { + has_royal_court = yes + has_dlc_feature = royal_court + amenity_level = { target = court_food_quality value >= 3 } + } + } + multiply = 1.5 + } + multiply = court_brewmaster_multiplier + } + + + if = { + limit = { + culture = { + has_cultural_parameter = refined_feasts + } + } + add = major_prestige_gain + } + if = { + limit = { + any_character_struggle = { + involvement = involved + has_struggle_phase_parameter = struggle_prestige_from_feast + } + } + add = medium_prestige_gain + } + if = { + limit = { + confederation ?= { has_cohesion_level_parameter = any_member_increased_feast_rewards } + } + multiply = 1.1 + } + } + } + } + } + } + else = { + scope:activity = { + add_activity_log_entry = { + key = food_bad_reward_tt + tags = { completed } + character = scope:root_scope + show_in_conclusion = yes + score = 50 + + # Effects + root = { + # Host Rewards + add_prestige = { + value = 35 + scope:host = { + if = { + limit = { + scope:host = { + has_royal_court = yes + has_dlc_feature = royal_court + amenity_level = { target = court_food_quality value >= 5 } + } + } + multiply = 2 + } + else_if = { + limit = { + scope:host = { + has_royal_court = yes + has_dlc_feature = royal_court + amenity_level = { target = court_food_quality value >= 3 } + } + } + multiply = 1.5 + } + multiply = court_brewmaster_multiplier + } + + if = { + limit = { + culture = { + has_cultural_parameter = refined_feasts + } + } + add = major_prestige_gain + } + if = { + limit = { + any_character_struggle = { + involvement = involved + has_struggle_phase_parameter = struggle_prestige_from_feast + } + } + add = medium_prestige_gain + } + if = { + limit = { + confederation ?= { has_cohesion_level_parameter = any_member_increased_feast_rewards } + } + multiply = 1.1 + } + } + } + } + } + } + + # Estate Unlock: Wine Selection + if = { + limit = { + scope:activity = { + has_activity_option = { + category = feast_option_wine + option = feast_wine_extensive + } + } + } + scope:activity = { + add_activity_log_entry = { + key = wine_extensive_reward_tt + tags = { completed } + character = scope:root_scope + show_in_conclusion = yes + score = 50 + + # Effects + root = { + change_influence = { + value = 15 + + scope:activity = { + every_attending_character = { + limit = { + NOR = { + this = root + is_courtier_of = root # Guest shouldn't originate from you own court + } + } + add = 15 + } + } + scope:host = { multiply = court_brewmaster_multiplier } + if = { + limit = { + domicile ?= { has_domicile_parameter = estate_improved_wine_cellar_3 } + } + multiply = { + value = 1 + add = estate_improved_wine_cellar_3_value + } + } + else_if = { + limit = { + domicile ?= { has_domicile_parameter = estate_improved_wine_cellar_2 } + } + multiply = { + value = 1 + add = estate_improved_wine_cellar_2_value + } + } + else_if = { + limit = { + domicile ?= { has_domicile_parameter = estate_improved_wine_cellar_1 } + } + multiply = { + value = 1 + add = estate_improved_wine_cellar_1_value + } + } + } + } + } + } + } + else_if = { + limit = { + scope:activity = { + has_activity_option = { + category = feast_option_wine + option = feast_wine_normal + } + } + } + scope:activity = { + add_activity_log_entry = { + key = wine_normal_reward_tt + tags = { completed } + character = scope:root_scope + show_in_conclusion = yes + score = 50 + + # Effects + root = { + change_influence = { + value = 10 + + scope:activity = { + every_attending_character = { + limit = { + NOR = { + this = root + is_courtier_of = root # Guest shouldn't originate from you own court + } + } + add = 10 + } + } + scope:host = { multiply = court_brewmaster_multiplier } + if = { + limit = { + domicile ?= { has_domicile_parameter = estate_improved_wine_cellar_3 } + } + multiply = { + value = 1 + add = estate_improved_wine_cellar_3_value + } + } + else_if = { + limit = { + domicile ?= { has_domicile_parameter = estate_improved_wine_cellar_2 } + } + multiply = { + value = 1 + add = estate_improved_wine_cellar_2_value + } + } + else_if = { + limit = { + domicile ?= { has_domicile_parameter = estate_improved_wine_cellar_1 } + } + multiply = { + value = 1 + add = estate_improved_wine_cellar_1_value + } + } + } + } + } + } + } + else_if = { + limit = { + scope:activity = { + has_activity_option = { + category = feast_option_wine + option = feast_wine_limited + } + } + } + scope:activity = { + add_activity_log_entry = { + key = wine_limited_reward_tt + tags = { completed } + character = scope:root_scope + show_in_conclusion = yes + score = 50 + + # Effects + root = { + change_influence = { + value = 5 + + scope:activity = { + every_attending_character = { + limit = { + NOR = { + this = root + is_courtier_of = root # Guest shouldn't originate from you own court + } + } + add = 5 + } + } + scope:host = { multiply = court_brewmaster_multiplier } + if = { + limit = { + domicile ?= { has_domicile_parameter = estate_improved_wine_cellar_3 } + } + multiply = { + value = 1 + add = estate_improved_wine_cellar_3_value + } + } + else_if = { + limit = { + domicile ?= { has_domicile_parameter = estate_improved_wine_cellar_2 } + } + multiply = { + value = 1 + add = estate_improved_wine_cellar_2_value + } + } + else_if = { + limit = { + domicile ?= { has_domicile_parameter = estate_improved_wine_cellar_1 } + } + multiply = { + value = 1 + add = estate_improved_wine_cellar_1_value + } + } + } + } + } + } + } + + # We give you the regular rewards + hosted_successful_feast_new_effect = yes + # We give out the Reveler trait/xp + disburse_feast_reveler_rewards = yes + #Accolade glory gain + accolades_activity_complete_feast_glory_effect = yes + #Stress loss + if = { + limit = { + OR = { + has_trait = shy + has_trait = reclusive + } + } + custom_tooltip = host_feast_decision_desc_shy + } + else = { + if = { + limit = { + has_royal_court = yes + has_dlc_feature = royal_court + amenity_level = { target = court_food_quality value >= 5 } + } + stress_impact = { + base = exotic_feast_stress_loss_value + gluttonous = feast_stress_loss_value + gregarious = feast_stress_loss_value + lifestyle_reveler = feast_stress_loss_value + drunkard = feast_stress_loss_value + comfort_eater = feast_stress_loss_value + generous = feast_stress_loss_value + greedy = activity_stress_gain_impact + } + } + else_if = { + limit = { + has_royal_court = yes + has_dlc_feature = royal_court + amenity_level = { target = court_food_quality value >= 4 } + } + stress_impact = { + base = lavish_feast_stress_loss_value + gluttonous = feast_stress_loss_value + gregarious = feast_stress_loss_value + lifestyle_reveler = feast_stress_loss_value + drunkard = feast_stress_loss_value + comfort_eater = feast_stress_loss_value + generous = feast_stress_loss_value + greedy = activity_stress_gain_impact + } + } + else_if = { + limit = { + has_royal_court = yes + has_dlc_feature = royal_court + amenity_level = { target = court_food_quality value >= 3 } + } + stress_impact = { + base = medium_feast_stress_loss_value + gluttonous = feast_stress_loss_value + gregarious = feast_stress_loss_value + lifestyle_reveler = feast_stress_loss_value + drunkard = feast_stress_loss_value + comfort_eater = feast_stress_loss_value + generous = feast_stress_loss_value + greedy = activity_stress_gain_impact + } + } + else_if = { + limit = { + has_royal_court = yes + has_dlc_feature = royal_court + amenity_level = { target = court_food_quality value <= 1 } + } + stress_impact = { + base = meager_feast_stress_loss_value + gluttonous = feast_stress_loss_value + gregarious = feast_stress_loss_value + lifestyle_reveler = feast_stress_loss_value + drunkard = feast_stress_loss_value + comfort_eater = feast_stress_loss_value + generous = feast_stress_loss_value + greedy = activity_stress_gain_impact + } + } + else = { + stress_impact = { + base = feast_stress_loss_value + gluttonous = activity_stress_loss_impact + gregarious = activity_stress_loss_impact + lifestyle_reveler = feast_stress_loss_value + drunkard = activity_stress_loss_impact + comfort_eater = activity_stress_loss_impact + generous = activity_stress_loss_impact + greedy = activity_stress_gain_impact + } + } + } + + # Remove strife if relevant. + remove_strife_per_invited_powerful_vassal_effect = yes +} + +disburse_murder_feast_activity_rewards = { + if = { + limit = { + has_variable = murder_feast_liege_var + } + scope:activity = { + add_activity_log_entry = { + key = murder_feast_liege_kill_tt + tags = { completed } + character = scope:root_scope + show_in_conclusion = yes + score = 50 + + root = { + add_prestige_level = -2 + } + } + } + } + if = { + limit = { + has_variable = murder_feast_head_of_faith_var + } + scope:activity = { + add_activity_log_entry = { + key = murder_feast_hof_kill_tt + tags = { completed } + character = scope:root_scope + show_in_conclusion = yes + score = 50 + + root = { + add_piety_level = -2 + } + } + } + } + if = { + limit = { + faith = { #if this is a religious thing, people don't really love it + has_doctrine = tenet_ritual_celebrations + } + } + add_piety = medium_piety_loss + } + if = { + limit = { has_variable = murder_feast_entourage_murder_var } #you've killed EVERYONE + scope:activity = { + add_activity_log_entry = { + key = murder_feast_entourage_kill_tt + tags = { completed } + character = scope:root_scope + show_in_conclusion = yes + score = 50 + + root = { + add_dread = 35 + add_legitimacy = major_legitimacy_loss + add_character_modifier = { + modifier = murder_feast_great_murderer_modifier + years = 15 + } + } + } + # # Guest Opinion + every_attending_character = { + limit = { + NOR = { + has_trait = torturer + has_trait = sadistic + has_trait = vengeful + has_trait = callous + } + } + custom = feast_every_guest + add_opinion = { + modifier = suspicion_opinion + target = scope:host + opinion = -10 + } + } + } + } + else = { #Rewards for a "normal" feast + if = { #if you failed your attempt it doesn't look great + limit = { has_variable = murder_feast_murder_failure_var } + scope:activity = { + add_activity_log_entry = { + key = murder_feast_failed_tt + tags = { completed } + character = scope:root_scope + show_in_conclusion = yes + score = 50 + + root = { + add_prestige = minor_prestige_loss + add_legitimacy = minor_legitimacy_loss + } + } + } + } + else_if = { #if you've killed your target you get these + limit = { NOT = { has_variable = murder_feast_murder_failure_var } } + scope:activity = { + add_activity_log_entry = { + key = murder_feast_solo_kill_tt + tags = { completed } + character = scope:root_scope + show_in_conclusion = yes + score = 50 + + root = { + add_dread = 25 + add_legitimacy = medium_legitimacy_loss + add_character_modifier = { + modifier = murder_feast_murderer_modifier + years = 10 + } + } + } + # # Guest Opinion + every_attending_character = { + limit = { + NOR = { + has_trait = torturer + has_trait = sadistic + has_trait = vengeful + has_trait = callous + } + } + custom = feast_every_guest + add_opinion = { + modifier = suspicion_opinion + target = scope:host + opinion = -5 + } + } + } + } + # Rewards based on Activity Options + # Smaller than regular feasts for reasons apparent + + # Number of courses + if = { + limit = { + scope:activity = { + has_activity_option = { + category = feast_option_courses + option = feast_courses_good + } + } + } + custom_tooltip = courses_good_reward_tt + scope:activity = { + add_activity_log_entry = { + key = courses_good_reward_tt + tags = { completed } + character = scope:root_scope + show_in_conclusion = yes + score = 50 + + # Effects + root = { + # Host Rewards + + # Courtly Vassal Opinion + every_vassal_or_below = { + vassal_stance = courtly + limit = { + is_participant_in_activity = scope:activity + } + custom = every_courtly_vassal + add_opinion = { + modifier = hosted_feast_opinion + target = root + opinion = 15 + } + } + # Vassal Opinion + scope:activity = { + every_attending_character = { + limit = { this != root } + custom = custom.every_attending_character + add_opinion = { + target = root + modifier = impressed_opinion + opinion = 10 + } + } + } + } + } + } + } + else_if = { + limit = { + scope:activity = { + has_activity_option = { + category = feast_option_courses + option = feast_courses_normal + } + } + } + custom_tooltip = courses_normal_reward_tt + scope:activity = { + add_activity_log_entry = { + key = courses_normal_reward_tt + tags = { completed } + character = scope:root_scope + show_in_conclusion = yes + score = 50 + + # Effects + root = { + # Host Rewards + + # Courtly Vassal Opinion + every_vassal_or_below = { + vassal_stance = courtly + limit = { + is_participant_in_activity = scope:activity + } + custom = every_courtly_vassal + add_opinion = { + modifier = hosted_feast_opinion + target = root + opinion = 5 + } + } + # Vassal Opinion + scope:activity = { + every_attending_character = { + limit = { this != root } + custom = custom.every_attending_character + add_opinion = { + target = root + modifier = impressed_opinion + opinion = 5 + } + } + } + } + } + } + } + + # Dish complexity + if = { + limit = { + scope:activity = { + has_activity_option = { + category = feast_option_food + option = feast_food_good + } + } + } + custom_tooltip = food_good_reward_tt + scope:activity = { + add_activity_log_entry = { + key = food_good_reward_tt + tags = { completed } + character = scope:root_scope + show_in_conclusion = yes + score = 50 + + # Effects + root = { + # Host Rewards + add_prestige = 100 + } + } + } + } + else_if = { + limit = { + scope:activity = { + has_activity_option = { + category = feast_option_food + option = feast_food_normal + } + } + } + custom_tooltip = food_normal_reward_tt + scope:activity = { + add_activity_log_entry = { + key = food_normal_reward_tt + tags = { completed } + character = scope:root_scope + show_in_conclusion = yes + score = 50 + + # Effects + root = { + # Host Rewards + add_prestige = 50 + } + } + } + } + } + # Stress loss according to traits in the ending event + + #Accolade glory gain + accolades_activity_complete_feast_glory_effect = yes +} + +disburse_activity_stress_loss = { + stress_impact = { + base = medium_stress_impact_loss + shy = minor_stress_impact_gain + reclusive = minor_stress_impact_gain + } +} + +disburse_feast_reveler_rewards = { + if = { + limit = { + has_trait = lifestyle_reveler + scope:activity = { + has_activity_option = { + category = feast_option_courses + option = feast_courses_good + } + } + scope:activity = { + has_activity_option = { + category = feast_option_food + option = feast_food_good + } + } + } + add_trait_xp = { + trait = lifestyle_reveler + value = 15 + } + } + else_if = { + limit = { + has_trait = lifestyle_reveler + scope:activity = { + has_activity_option = { + category = feast_option_food + option = feast_food_good + } + } + } + add_trait_xp = { + trait = lifestyle_reveler + value = 10 + } + } + else_if = { + limit = { + has_trait = lifestyle_reveler + scope:activity = { + has_activity_option = { + category = feast_option_courses + option = feast_courses_good + } + } + } + add_trait_xp = { + trait = lifestyle_reveler + value = 10 + } + } + else_if = { + limit = { has_trait = lifestyle_reveler } + add_trait_xp = { + trait = lifestyle_reveler + value = 5 + } + } + else = { #progress towards reveler + custom_tooltip = { + text = progress_towards_reveler_tt + reveler_points_gain_effect = { + CHANGE = 1 + RANDOM_CHANGE = 1 + } + } + } + # LEGITIMACY GAIN FOR STANDARD ACTIVITY PARTICIPATION - FEAST + standard_activity_participation_legitimacy_effect = yes +} + + +########################## +# ACTIVITY WAR HANDLING +# by Chad Uhl +########################## + +# Called in the war_on_actions.txt file +# Used to send out the correct events if a character becomes involved in a war while attending an activity +activity_on_war_declared_events_effect = { + trigger_event = religious_decision.0200 # Stop mediation in its tracks + if = { + limit = { + this.involved_activity ?= { + is_activity_complete = no + } + } + this.involved_activity ?= { + save_scope_as = target_activity + activity_type = { save_scope_as = target_activity_type } + activity_host = { save_scope_as = target_activity_host } + } + if = { # Send one event if you're the host + limit = { + exists = this.involved_activity + this = this.involved_activity.activity_host + } + # This event fires follow-up events for the guests depending on the character's choice + trigger_event = activity_system.0300 + } + else_if = { # Send another if you're just a guest + limit = { + exists = this.involved_activity + NOT = { + any_war_enemy = { this = scope:target_activity_host } + } + } + trigger_event = activity_system.0310 + } + else_if = { # Just go home if you're at war with host + limit = { + exists = this.involved_activity + any_war_enemy = { this = scope:target_activity_host } + } + send_interface_toast = { + type = event_toast_effect_bad + left_icon = scope:target_activity_host + title = at_war_difficulty #"At war" + current_travel_plan = { + if = { + limit = { can_cancel = yes } + cancel_travel_plan = yes + } + } + } + + } + } +} + +####################### +# ACTIVITY SETUP +# by Filippa Gannholm Kirsten +####################### + +#Set this in the on_start of your activity (note - NOT the PHASE on_start, but your ACTIVITY on_start) +activity_setup_special_type_progression_effect = { + set_variable = { + name = activity_special_type_progression + value = 0 + } +} + +####################### +# ACTIVITY SPECIAL TYPE PROGRESSION +# by Filippa Gannholm Kirsten +####################### + +activity_special_type_progression_variable = { + if = { + limit = { exists = var:activity_special_type_progression } + change_variable = { + name = activity_special_type_progression + add = $NUM$ + } + } +} + +activity_special_type_progression_miniscule = { + if = { + limit = { exists = var:activity_special_type_progression } + change_variable = { + name = activity_special_type_progression + add = 1 + } + } +} + +activity_special_type_progression_tiny = { + if = { + limit = { exists = var:activity_special_type_progression } + change_variable = { + name = activity_special_type_progression + add = 3 + } + } +} + +activity_special_type_progression_medium = { + if = { + limit = { exists = var:activity_special_type_progression } + change_variable = { + name = activity_special_type_progression + add = 5 + } + } +} + +activity_special_type_progression_major = { + if = { + limit = { exists = var:activity_special_type_progression } + change_variable = { + name = activity_special_type_progression + add = 10 + } + } +} + +activity_special_type_progression_huge = { + if = { + limit = { exists = var:activity_special_type_progression } + change_variable = { + name = activity_special_type_progression + add = 20 + } + } +} + +activity_special_type_progression_massive = { + if = { + limit = { exists = var:activity_special_type_progression } + change_variable = { + name = activity_special_type_progression + add = 40 + } + } +} + +activity_special_type_progression_negative_tiny = { + if = { + limit = { exists = var:activity_special_type_progression } + change_variable = { + name = activity_special_type_progression + add = -3 + } + } +} + +activity_special_type_progression_negative = { + if = { + limit = { exists = var:activity_special_type_progression } + change_variable = { + name = activity_special_type_progression + add = -5 + } + } +} + +activity_special_type_progression_negative_major = { + if = { + limit = { exists = var:activity_special_type_progression } + change_variable = { + name = activity_special_type_progression + add = -10 + } + } +} + +activity_special_type_progression_negative_huge = { + if = { + limit = { exists = var:activity_special_type_progression } + change_variable = { + name = activity_special_type_progression + add = -25 + } + } +} + +####################### +# ACTIVITY ADD CHARACTER TO EVERYTHING +# by Arkadiusz Majewski +####################### + +add_to_court_and_entourage_effect = { + root = { + add_courtier = prev + } + if = { + limit = { exists = root.current_travel_plan } + root.current_travel_plan = { add_companion = prev } + } + if = { + limit = { exists = scope:activity } + add_to_activity = scope:activity + } +} + +add_to_court_and_entourage_only_effect = { + root = { + add_courtier = prev + } + hidden_effect = { + if = { + limit = { exists = root.current_travel_plan } + root.current_travel_plan = { add_companion = prev } + } + } +} + + + +#The following effects take the CHAR_TO_ADD and NEW_COURT_OWNER scopes, determining if the CHAR_TO_ADD is a pool character since the add_companion automatically adds pool characters as a courtier, whereas if CHAR_TO_ADD is not a pool character, it does not. +# "X joins your Court" +add_to_entourage_court_and_activity_effect = { + #If the character is a pool character + $NEW_COURT_OWNER$ = { + if = { + limit = { + #Pool characters get automatically added as courtiers + $CHAR_TO_ADD$ = { is_pool_character = yes } + } + show_as_tooltip = { add_courtier = $CHAR_TO_ADD$ } #This already happens with add_companion + hidden_effect = { # This must go above activity effect, or they will try and make their own travel plan! + if = { + limit = { $CHAR_TO_ADD$ = { NOT = { exists = current_travel_plan } } } + $NEW_COURT_OWNER$.current_travel_plan ?= { add_companion = $CHAR_TO_ADD$ } + } + } + if = { + limit = { exists = involved_activity } + $CHAR_TO_ADD$ = { add_to_activity = $NEW_COURT_OWNER$.involved_activity } + } + } + #If the character is NOT a pool character + else = { + if = { + limit = { + $CHAR_TO_ADD$ = { + NOT = { is_courtier_of = $NEW_COURT_OWNER$ } + } + } + add_courtier = $CHAR_TO_ADD$ + } + hidden_effect = { # This must go above activity effect, or they will try and make their own travel plan! + if = { + limit = { $CHAR_TO_ADD$ = { NOT = { exists = current_travel_plan } } } + $NEW_COURT_OWNER$.current_travel_plan ?= { add_companion = $CHAR_TO_ADD$ } + } + } + if = { + limit = { + exists = involved_activity + $CHAR_TO_ADD$ = { can_join_activity = $NEW_COURT_OWNER$.involved_activity } + } + $CHAR_TO_ADD$ = { add_to_activity = $NEW_COURT_OWNER$.involved_activity } + } + } + } +} + +# "You recruit X to your Court" +recruit_to_entourage_court_and_activity_effect = { + #If the character is a pool character + $NEW_COURT_OWNER$ = { + if = { + limit = { + #Pool characters get automatically added as courtiers + $CHAR_TO_ADD$ = { is_pool_character = yes } + } + show_as_tooltip = { add_courtier = $CHAR_TO_ADD$ } #This already happens with add_companion + hidden_effect = { # This must go above activity effect, or they will try and make their own travel plan! + if = { + limit = { $CHAR_TO_ADD$ = { NOT = { exists = current_travel_plan } } } + current_travel_plan ?= { add_companion = $CHAR_TO_ADD$ } + } + } + if = { + limit = { exists = involved_activity } + $CHAR_TO_ADD$ = { add_to_activity = $NEW_COURT_OWNER$.involved_activity } + } + } + #If the character is NOT a pool character + else = { + if = { + limit = { + $CHAR_TO_ADD$ = { + NOT = { is_courtier_of = $NEW_COURT_OWNER$ } + } + } + add_courtier = $CHAR_TO_ADD$ + } + hidden_effect = { # This must go above activity effect, or they will try and make their own travel plan! + if = { + limit = { $CHAR_TO_ADD$ = { NOT = { exists = current_travel_plan } } } + current_travel_plan ?= { add_companion = $CHAR_TO_ADD$ } + } + } + if = { + limit = { exists = involved_activity } + $CHAR_TO_ADD$ = { add_to_activity = $NEW_COURT_OWNER$.involved_activity } + } + } + } +} + +add_to_entourage_but_not_court_effect = { + #If the character is a pool character + $NEW_COURT_OWNER$ = { + if = { + limit = { + exists = capital_province + $CHAR_TO_ADD$ = { is_pool_character = yes } + } + current_travel_plan ?= { add_companion = $CHAR_TO_ADD$ } + $CHAR_TO_ADD$ = { + hidden_effect = { move_to_pool_at = $NEW_COURT_OWNER$.capital_province } + } + } + #If the character is NOT a pool character + else = { + if = { + limit = { $CHAR_TO_ADD$ = { NOT = { exists = current_travel_plan } } } + current_travel_plan ?= { add_companion = $CHAR_TO_ADD$ } + } + } + } +} + +add_to_entourage_and_activity_but_not_court_effect = { + #If the character is a pool character + $NEW_COURT_OWNER$ = { + if = { + limit = { + exists = capital_province + $CHAR_TO_ADD$ = { is_pool_character = yes } + } + hidden_effect = { # This must go above activity effect, or they will try and make their own travel plan! + if = { + limit = { $CHAR_TO_ADD$ = { NOT = { exists = current_travel_plan } } } + current_travel_plan ?= { add_companion = $CHAR_TO_ADD$ } + } + } + $CHAR_TO_ADD$ = { + hidden_effect = { move_to_pool_at = $NEW_COURT_OWNER$.capital_province } + if = { + limit = { exists = $NEW_COURT_OWNER$.involved_activity } + add_to_activity = $NEW_COURT_OWNER$.involved_activity + } + } + + } + #If the character is NOT a pool character + else = { + if = { # This must go above activity effect, or they will try and make their own travel plan! + limit = { $CHAR_TO_ADD$ = { NOT = { exists = current_travel_plan } } } + current_travel_plan ?= { add_companion = $CHAR_TO_ADD$ } + } + if = { + limit = { exists = $NEW_COURT_OWNER$.involved_activity } + $CHAR_TO_ADD$ = { add_to_activity = $NEW_COURT_OWNER$.involved_activity } + } + } + } +} + +host_has_taken_freebie_activity_effect = { + if = { + limit = { + this = scope:host + dynasty ?= { has_dynasty_perk = ep2_activities_legacy_5 } + this = house.house_head + } + set_variable = { + name = ep2_activities_legacy_5_had_freebie + value = yes + } + } +} + +invalidation_incapable_effect = { + if = { + limit = { + scope:host = { is_incapable = yes } + scope:activity = { NOT = { has_variable = invalidation_effect_set } } + } + scope:activity = { + set_variable = { name = invalidation_effect_set } + activity_type = { save_scope_as = activity_type } + } + scope:host = { + trigger_event = activity_system.0330 + } + every_attending_character = { + limit = { this != scope:host } + trigger_event = activity_system.0331 + } + } +} + +invalidation_unlanded_effect = { + if = { + limit = { + scope:host = { is_landed = no } + scope:activity = { NOT = { has_variable = invalidation_effect_set } } + } + scope:activity = { + set_variable = { name = invalidation_effect_set } + activity_type = { save_scope_as = activity_type } + } + every_attending_character = { + trigger_event = activity_system.0320 + } + } +} + +invalidation_host_death_effect = { + scope:activity = { + set_variable = { name = invalidation_effect_set } + activity_type = { save_scope_as = activity_type } + } + every_attending_character = { + limit = { is_alive = yes } + trigger_event = { + id = activity_system.0500 + days = 1 # So you don't get spammed + } + } +} + +invalidation_imprisoned_effect = { + if = { + limit = { + scope:host = { is_imprisoned = yes } + scope:activity = { NOT = { has_variable = invalidation_effect_set } } + } + scope:activity = { + set_variable = { name = invalidation_effect_set } + activity_type = { save_scope_as = activity_type } + } + scope:host = { trigger_event = activity_system.0550 } + every_attending_character = { trigger_event = activity_system.0551 } + } +} diff --git a/N3OW/common/scripted_effects/00_administrative_effects.txt b/N3OW/common/scripted_effects/00_administrative_effects.txt index a19b18de..bf6ad928 100644 --- a/N3OW/common/scripted_effects/00_administrative_effects.txt +++ b/N3OW/common/scripted_effects/00_administrative_effects.txt @@ -22,29 +22,169 @@ change_to_administrative_hereditary_effect = { change_to_administrative_effect = { save_scope_as = governor + top_liege = { save_scope_as = governor_liege } if = { limit = { - NOT = { government_has_flag = government_is_administrative } + OR = { + NOT = { government_allows = administrative } + AND = { + government_allows = administrative + scope:governor_liege = { government_has_flag = government_is_japan_administrative } + NOT = { government_has_flag = government_is_japan_administrative } + } + AND = { + government_allows = administrative + scope:governor_liege = { government_has_flag = government_is_meritocratic } + NOT = { government_has_flag = government_is_meritocratic } + } + AND = { + government_allows = administrative + scope:governor_liege = { government_has_flag = government_is_celestial } + NOT = { government_has_flag = government_is_celestial } + } + AND = { + government_allows = administrative + scope:governor_liege = { government_has_flag = government_is_steppe_admin } + NOT = { government_has_flag = government_is_steppe_admin } + } + } + } + # Only case where Estate type is shared between Admin and non-Admin + if = { + limit = { + NAND = { + government_has_flag = government_is_japan_feudal + scope:governor_liege = { government_has_flag = government_is_japan_administrative } + } + } + save_scope_as = new_admin + } + # Change government + if = { + limit = { + scope:governor_liege = { government_has_flag = government_is_japan_administrative } + } + tgp_domicile_conversion_when_changing_government_type = { + NEW_DOMICILE_TYPE = japanese_manor + NEW_GOVERNMENT_TYPE = japan_administrative_government + } + change_government = japan_administrative_government + } + else_if = { + limit = { + OR = { + #This is Mongol breakup and they are hegemon + AND = { + exists = scope:great_yuan_ruler + this = scope:great_yuan_ruler + primary_title = title:h_china + } + scope:governor_liege = { government_has_flag = government_is_celestial } + } + } + capital_province = { + if = { + limit = { + OR = { + has_holding_type = tribal_holding + has_holding_type = herder_holding + has_holding_type = nomad_holding + } + } + set_holding_type = castle_holding + } + } + tgp_domicile_conversion_when_changing_government_type = { + NEW_DOMICILE_TYPE = east_asian_estate + NEW_GOVERNMENT_TYPE = celestial_government + } + change_government = celestial_government + } + else_if = { + limit = { + scope:governor_liege = { government_has_flag = government_is_steppe_admin } + } + capital_province = { + if = { + limit = { + OR = { + has_holding_type = tribal_holding + has_holding_type = herder_holding + has_holding_type = nomad_holding + } + } + set_holding_type = castle_holding + } + } + tgp_domicile_conversion_when_changing_government_type = { + NEW_DOMICILE_TYPE = east_asian_estate + NEW_GOVERNMENT_TYPE = steppe_admin_government + } + change_government = steppe_admin_government + } + else_if = { + limit = { + OR = { + scope:governor_liege = { government_has_flag = government_is_meritocratic } + tgp_should_become_meritocratic_trigger = yes + } + } + capital_province = { + if = { + limit = { + OR = { + has_holding_type = tribal_holding + has_holding_type = herder_holding + has_holding_type = nomad_holding + } + } + set_holding_type = castle_holding + } + } + tgp_domicile_conversion_when_changing_government_type = { + NEW_DOMICILE_TYPE = east_asian_estate + NEW_GOVERNMENT_TYPE = meritocratic_government + } + change_government = meritocratic_government + } + else = { + capital_province = { + if = { + limit = { + OR = { + has_holding_type = tribal_holding + has_holding_type = herder_holding + has_holding_type = nomad_holding + } + } + set_holding_type = castle_holding + } + } + add_character_flag = new_government_is_byz_admin + tgp_domicile_conversion_when_changing_government_type = { + NEW_DOMICILE_TYPE = estate + NEW_GOVERNMENT_TYPE = administrative_government + } + change_government = administrative_government + remove_character_flag = new_government_is_byz_admin } - change_government = administrative_government - save_scope_as = new_admin } if = { limit = { - primary_title.tier >= tier_duchy + primary_title.tier >= min_appointment_tier liege = { - is_independent_ruler = yes - government_has_flag = government_is_administrative + scope:governor_liege = this + government_allows = administrative } house.house_head = { + top_liege = scope:governor_liege NOT = { any_held_title = { is_noble_family_title = yes } } } } - create_noble_family_effect = yes + create_noble_family_effect = { GOVERNMENT_GIVER = top_liege } } - hidden_effect = { if = { limit = { @@ -55,7 +195,10 @@ change_to_administrative_effect = { } } if = { - limit = { exists = scope:new_admin } + limit = { + exists = scope:new_admin + exists = domicile + } domicile ?= { set_up_domicile_estate_effect = yes } @@ -64,38 +207,87 @@ change_to_administrative_effect = { change_to_administrative_interaction_effect = { scope:actor = { - pay_short_term_gold = { - target = scope:recipient - gold = { - value = 50 - scope:recipient = { + if = { + limit = { has_treasury = yes } + pay_short_term_treasury = { + target = scope:recipient + treasury = { + value = 50 + scope:recipient = { + if = { + limit = { highest_held_title_tier >= tier_kingdom } + multiply = 10 + } + else_if = { + limit = { highest_held_title_tier >= tier_duchy } + multiply = 6 + } + else_if = { + limit = { highest_held_title_tier >= tier_county } + multiply = 3 + } + } if = { - limit = { highest_held_title_tier >= tier_kingdom } - multiply = 10 + limit = { scope:gold ?= yes } + add = scope:actor.medium_gold_value } - else_if = { - limit = { highest_held_title_tier >= tier_duchy } - multiply = 6 - } - else_if = { - limit = { highest_held_title_tier >= tier_county } - multiply = 3 + if = { + limit = { + scope:actor = { has_realm_law_flag = admin_change_vassal_gov_cheaper } + } + multiply = 0.5 } } - if = { - limit = { scope:gold ?= yes } - add = scope:actor.medium_gold_value - } - if = { - limit = { - scope:actor = { has_realm_law_flag = admin_change_vassal_gov_cheaper } + } + } + else = { + pay_short_term_gold = { + target = scope:recipient + gold = { + value = 50 + scope:recipient = { + if = { + limit = { highest_held_title_tier >= tier_kingdom } + multiply = 10 + } + else_if = { + limit = { highest_held_title_tier >= tier_duchy } + multiply = 6 + } + else_if = { + limit = { highest_held_title_tier >= tier_county } + multiply = 3 + } + } + if = { + limit = { scope:gold ?= yes } + add = scope:actor.medium_gold_value + } + if = { + limit = { + scope:actor = { has_realm_law_flag = admin_change_vassal_gov_cheaper } + } + multiply = 0.5 } - multiply = 0.5 } } } } - scope:recipient = { change_to_administrative_effect = yes } + scope:recipient = { + change_to_administrative_effect = yes + + #And now we also convert all the administrative vassals below so they also match the actor's form of admin. + #For non admin sub-vassals the newly converted main vassal can still ask using the same interaction but we + hidden_effect = { + every_vassal_or_below = { + limit = { + government_allows = administrative + is_ai = yes #Humans get to be asked directly + } + change_to_administrative_effect = yes + } + } + } if = { limit = { scope:hook = yes @@ -118,41 +310,6 @@ change_to_administrative_interaction_effect = { } } -set_up_domicile_patrician_estate_effect = { - if = { - limit = { is_domicile_type = patrician_estate } - # Intentionally one level lower than what you can get - if = { - limit = { - NOT = { has_domicile_building_or_higher = estate_main_02 } - owner.culture ?= { has_innovation = innovation_city_planning } - } - add_domicile_building = estate_main_02 - } - if = { - limit = { - has_domicile_building = estate_main_02 - NOT = { has_domicile_building_or_higher = estate_main_03 } - owner.culture ?= { has_innovation = innovation_manorialism } - } - add_domicile_building = estate_main_03 - } - switch = { - trigger = has_domicile_building - estate_main_03 = { - while = { - count = 2 - add_random_internal_estate_building = yes - } - } - estate_main_02 = { - add_random_internal_estate_building = yes - } - } - fill_external_estate_building_effect = yes - } -} - set_up_domicile_estate_effect = { if = { limit = { is_domicile_type = estate } @@ -172,19 +329,111 @@ set_up_domicile_estate_effect = { } add_domicile_building = estate_main_03 } - switch = { - trigger = has_domicile_building - estate_main_03 = { - while = { - count = 2 + hidden_effect = { + switch = { + trigger = has_domicile_building + estate_main_03 = { + while = { + count = 2 + add_random_internal_estate_building = yes + } + } + estate_main_02 = { add_random_internal_estate_building = yes } } - estate_main_02 = { - add_random_internal_estate_building = yes - } } fill_external_estate_building_effect = yes } + else_if = { + limit = { is_domicile_type = japanese_manor } + # Intentionally one level lower than what you can get + if = { + limit = { + NOT = { has_domicile_building_or_higher = japanese_manor_main_02 } + owner.culture ?= { has_innovation = innovation_city_planning } + } + add_domicile_building = japanese_manor_main_02 + } + if = { + limit = { + has_domicile_building = japanese_manor_main_02 + NOT = { has_domicile_building_or_higher = japanese_manor_main_03 } + owner.culture ?= { has_innovation = innovation_manorialism } + } + add_domicile_building = japanese_manor_main_03 + } + hidden_effect = { + switch = { + trigger = has_domicile_building + japanese_manor_main_03 = { + while = { + count = 2 + add_random_internal_japanese_manor_building = yes + } + } + japanese_manor_main_02 = { + add_random_internal_japanese_manor_building = yes + } + } + } + fill_external_japanese_manor_building_effect = yes + } + else_if = { + limit = { is_domicile_type = east_asian_estate } + # Intentionally one level lower than what you can get + if = { + limit = { + NOT = { has_domicile_building_or_higher = east_asian_estate_main_02 } + owner.culture ?= { has_innovation = innovation_city_planning } + } + add_domicile_building = east_asian_estate_main_02 + } + if = { + limit = { + has_domicile_building = east_asian_estate_main_02 + NOT = { has_domicile_building_or_higher = east_asian_estate_main_03 } + owner.culture ?= { has_innovation = innovation_manorialism } + } + add_domicile_building = east_asian_estate_main_03 + } + hidden_effect = { + switch = { + trigger = has_domicile_building + east_asian_estate_main_03 = { + while = { + count = 2 + add_random_internal_east_asian_estate_building = yes + } + } + east_asian_estate_main_02 = { + add_random_internal_east_asian_estate_building = yes + } + } + } + fill_external_east_asian_estate_building_effect = yes + } } +noble_family_title_realm_setup_effect = { + save_scope_as = top_liege + every_noble_family = { + save_scope_as = nf_title + holder ?= { + save_scope_as = nf_holder + house ?= { + save_scope_as = nf_house + # Ensure holders of historical noble family titles are the default house heads + if = { + limit = { house_head != scope:nf_holder } + set_house_head = scope:nf_holder + } + } + } + scope:nf_title = { + set_color_from_title = scope:nf_holder.capital_county + # Ensure Noble Family CoA match House + set_coa = scope:nf_house + } + } +} diff --git a/N3OW/common/scripted_effects/00_adultery_effects.txt b/N3OW/common/scripted_effects/00_adultery_effects.txt new file mode 100644 index 00000000..29848f1a --- /dev/null +++ b/N3OW/common/scripted_effects/00_adultery_effects.txt @@ -0,0 +1,653 @@ + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! + + + + +#### Extramaritial sex effects: applies adultery/fornicator traits, opionions and informs spouse. Needs SPOUSE_EVENT = yes/no +# extramarital_sex_attempt_exposure_consequences_with_target_effect - for failed sex attempts, spouse does not dislike target +# extramarital_sex_exposure_consequences_with_target_effect - standard one for exposure (note, you have to run this on both characters!) +# extramaritial_sex_exposure_consequences_with_had_recent_sex_var_effect - for sex without targets, based on had_recent_sex var (set in had_sex_with_unknown_effect) +# extramarital_sex_exposure_consequences_effect - "support" effect +# extramarital_sex_discovery_consequences_with_target_effect +# - standard one discovery (note, you have to run this on both characters!) + + +# mother_of_young_child_has_lover_variable_effect +# - when adultery has been discovered, this effect can set if paternity could be doubted + +# spy_on_mother_pregnancy_adultery_effect + +# expose_lover_secret_or_run_consequence_effect +# - Checks for the existence of a Lover Secret with a target, and which either exposes it, or runs the extramarital_sex_exposure_consequences_with_target_effect for both characters. Takes TARGET and EXPOSER + +##################################################################### +# EFFECTS +##################################################################### + + +####Extramaritial sex effects: +#To be used when a character is exposed/discovered as an adulterer/fornicator (for the consequences, not the exposure/discovery itself). Lover secret exposure, discovered seduce schemes, events. +# Exposure effects: These are used when the cheating has been made public (i.e. not for secret discovery without exposure) +# Discovery effects: These re used when the cheating is not public, but a partner has discovered the cheater +#The target version is for situations where it's known who the other character was and adds some opinion penalties and consequences for them as well. + +extramarital_sex_exposure_consequences_with_target_effect = { #Note: only adds stuff for one of the sex partners, it must be run twice! It is intentionally kept this way so you can apply it in two different places in an event chain etc. + save_temporary_scope_as = sex_character + + #Applies traits, piety level loss, unfaithfulness opinions + $TARGET$ = { save_scope_as = sex_partner } + if = { # Check to make absolutely sure it's extramarital + limit = { + NOT = { scope:sex_character = { is_consort_of = scope:sex_partner } } + } + if = { # Check to make sure your culture isn't A-okay with this + limit = { + NOT = { + culture = { has_cultural_parameter = adultery_always_accepted } + } + } + extramarital_sex_exposure_consequences_effect = { SPOUSE_EVENT = $SPOUSE_EVENT$ } + + #Slept with spouse opinions & potential rivalry + $TARGET$ = { + every_spouse = { + limit = { this != scope:sex_character } #Extra safety + save_scope_as = sex_partner_spouse + + hidden_effect = { + #Remove duplicate opinion from discovery + if = { + limit = { + has_opinion_modifier = { + target = scope:sex_character + modifier = slept_with_spouse_discovered_opinion + } + } + remove_opinion = { + target = scope:sex_character + modifier = slept_with_spouse_discovered_opinion + } + } + } + + if = { + limit = { accepts_adultery_without_penalty_trigger = no } + if = { #(only visible for directly relevant exposure) + limit = { + always = yes + } + add_opinion = { + target = scope:sex_character + modifier = slept_with_spouse_exposed_opinion + } + } + else = { + hidden_effect = { + add_opinion = { + target = scope:sex_character + modifier = slept_with_spouse_exposed_opinion + } + } + } + hidden_effect = { + #Rivalry + if = { + limit = { + is_ai = yes + scope:sex_character = { is_ai = yes } + ai_vengefulness >= medium_positive_ai_value + can_set_relation_nemesis_trigger = { CHARACTER = scope:sex_character } + } + set_relation_nemesis = { + reason = nemesis_extramarital_sex_exposure + copy_reason = rival + target = scope:sex_character + involved_character = scope:sex_partner + } + } + else = { + scope:sex_partner = { save_scope_as = relationship_reason_involved_character } + progress_towards_rival_effect = { CHARACTER = scope:sex_character OPINION = 0 REASON = rival_slept_with_spouse } + clear_saved_scope = relationship_reason_involved_character + } + # HOUSE RELATIONS + if = { + limit = { + exists = house + exists = scope:sex_character.house + } + house = { + change_house_relation_effect = { + HOUSE = scope:sex_character.house + VALUE = house_relation_damage_medium_value + REASON = cuckoldry + CHAR = scope:sex_character + TARGET_CHAR = root + TITLE = scope:dummy_gender + } + } + } + } + } + } + } + } + } +} + +extramaritial_sex_exposure_consequences_with_had_recent_sex_var_effect = { + if = { + limit = { exists = var:had_recent_sex } + + if = { + limit = { var:had_recent_sex = flag:male } + dummy_male = { save_scope_as = unknown_sex_partner } + } + else = { + dummy_female = { save_scope_as = unknown_sex_partner } + } + + extramarital_sex_exposure_consequences_effect = { SPOUSE_EVENT = $SPOUSE_EVENT$ } + } +} + +extramarital_sex_attempt_exposure_consequences_with_target_effect = { + #Applies traits, piety level loss, unfaithfulness opinions + $TARGET$ = { save_scope_as = sex_partner } + save_scope_value_as = { #For use desc in adultery.4001 + name = unsuccessful_sex_attempt + value = yes + } + extramarital_sex_exposure_consequences_effect = { SPOUSE_EVENT = $SPOUSE_EVENT$ } +} + + +extramarital_sex_exposure_consequences_effect = { + save_temporary_scope_as = sex_character + save_temporary_scope_value_as = { + name = spouse_event + value = $SPOUSE_EVENT$ + } + + #APPLY TRAITS & REMOVE PIETY LEVELS + add_adulterer_fornicator_trait_or_nothing_effect = yes + remove_piety_level_for_shunned_or_criminal_trait_effect = { TRAIT = adulterer } #Fornicator falls under same doctrine + if = { + limit = { + OR = { + AND = { + exists = scope:sex_partner + relation_with_character_is_sodomy_in_my_or_lieges_faith_trigger = { CHARACTER = scope:sex_partner } + } + AND = { + exists = scope:unknown_sex_partner + relation_with_character_is_sodomy_in_my_or_lieges_faith_trigger = { CHARACTER = scope:unknown_sex_partner } + } + } + } + add_trait = sodomite + remove_piety_level_for_shunned_or_criminal_trait_effect = { TRAIT = sodomite } + } + if = { + limit = { + exists = scope:sex_partner + relation_with_character_is_incestuous_in_my_or_lieges_faith_trigger = { CHARACTER = scope:sex_partner } + } + add_trait = incestuous + remove_piety_level_for_shunned_or_criminal_trait_effect = { TRAIT = incestuous } + } + #Family Feud + house_feud_lover_exposure_effect = yes + + #APPLY UNFAITHFUL OPINIONS TOWARDS SPOUSES AND LOVERS (only visible for directly relevant exposure) + if = { + limit = { + always = yes + } + every_relation = { + type = soulmate + limit = { + soulmate_relation_is_exclusive_trigger = yes + NOT = { #So we don't add it both at discovery and exposure + has_opinion_modifier = { + target = scope:sex_character + modifier = betrayed_our_promise + } + } + } + add_opinion = { + target = scope:sex_character + modifier = betrayed_our_promise + } + } + + every_spouse = { + if = { + limit = { accepts_adultery_without_penalty_trigger = no } + add_opinion = { + target = scope:sex_character + modifier = unfaithful_spouse_exposed_opinion + } + } + } + } + else = { + hidden_effect = { + every_relation = { + type = soulmate + limit = { + soulmate_relation_is_exclusive_trigger = yes + NOT = { #So we don't add it both at discovery and exposure + has_opinion_modifier = { + target = scope:sex_character + modifier = betrayed_our_promise + } + } + } + add_opinion = { + target = scope:sex_character + modifier = betrayed_our_promise + } + } + + every_spouse = { + if = { + limit = { accepts_adultery_without_penalty_trigger = no } + add_opinion = { + target = scope:sex_character + modifier = unfaithful_spouse_exposed_opinion + } + } + } + } + } + every_spouse = { + hidden_effect = { + #Remove duplicate opinion from discovery + if = { + limit = { + has_opinion_modifier = { + target = scope:sex_character + modifier = unfaithful_spouse_discovered_opinion + } + } + remove_opinion = { + target = scope:sex_character + modifier = unfaithful_spouse_discovered_opinion + } + } + } + + #NOTIFY SPOUSE (SHOULD ALWAYS BE "NO" IF EFFECT IS USED ON SECRET EXPOSURE) + if = { + limit = { + scope:spouse_event = yes + accepts_adultery_without_penalty_trigger = no + } + + scope:sex_character = { save_scope_as = adultery_spouse } + trigger_event = adultery.4001 + } + } +} + +extramarital_sex_discovery_consequences_with_target_effect = { + save_temporary_scope_as = sex_character + + # If the discoverer is my partner + if = { + limit = { + OR = { + is_consort_of = $DISCOVERER$ + has_relation_lover = $DISCOVERER$ + has_relation_soulmate = $DISCOVERER$ + } + } + + #Spouse and lover opinions + $DISCOVERER$ = { + if = { + limit = { + has_relation_soulmate = scope:sex_character + soulmate_relation_is_exclusive_trigger = yes + NOT = { $TARGET$ = $DISCOVERER$ } + } + add_opinion = { + target = scope:sex_character + modifier = betrayed_our_promise + } + } + + if = { + limit = { + is_consort_of = scope:sex_character + accepts_adultery_without_penalty_trigger = no + } + add_opinion = { + target = scope:sex_character + modifier = unfaithful_spouse_discovered_opinion + } + } + } + } + + # If the discoverer is my sex partner's spouse + if = { + limit = { + $TARGET$ = { + is_consort_of = $DISCOVERER$ + } + } + $DISCOVERER$ = { + if = { + limit = { accepts_adultery_without_penalty_trigger = no } + add_opinion = { + target = scope:sex_character + modifier = slept_with_spouse_discovered_opinion + } + } + } + } +} + + + +###misc + + +mother_of_young_child_has_lover_variable_effect = { + if = { + limit = { + $LOVER_1$ = { sex_opposite_of = $LOVER_2$ } + } + + #Who is the woman? + if = { + limit = { $LOVER_1$ = { is_female = yes } } + $LOVER_1$ = { save_temporary_scope_as = mother_check } + } + else = { + $LOVER_2$ = { save_temporary_scope_as = mother_check } + } + + #Is SPOUSE the woman's spouse, and do they have a young child together? + $SPOUSE$ = { + if = { + limit = { + is_spouse_of = scope:mother_check + any_child = { + is_child_of = scope:mother_check + NOR = { + has_trait = bastard + has_trait = legitimized_bastard + } + age <= 5 + } + } + set_variable = { + name = mother_of_young_child_has_lover + value = scope:mother_check + } + } + } + } +} + +spy_on_mother_pregnancy_adultery_effect = { + show_as_tooltip = { + if = { # Check whether root or Spymaster should spy + limit = { + exists = cp:councillor_spymaster + NOT = { cp:councillor_spymaster = scope:mother } + cp:councillor_spymaster.intrigue > intrigue + } + cp:councillor_spymaster = { + duel = { + skill = intrigue + target = scope:mother + + 6 = { + compare_modifier = { + value = scope:duel_value + multiplier = 0.5 + min = -5 + } + desc = adultery.1003.duel_success + root = { + custom_tooltip = adultery.1003.duel_success_tt + } + } + + 4 = { + compare_modifier = { + value = scope:duel_value + multiplier = -0.5 + min = -3 + } + desc = adultery.1003.duel_failure + root = { + reverse_add_opinion = { + target = scope:mother + modifier = spied_on_me_opinion + } + } + } + } + } + } + else = { + duel = { + skill = intrigue + target = scope:mother + + 6 = { + compare_modifier = { + value = scope:duel_value + multiplier = 0.5 + min = -5 + } + desc = adultery.1003.duel_success + custom_tooltip = adultery.1003.duel_success_tt + } + + 4 = { + compare_modifier = { + value = scope:duel_value + multiplier = -0.5 + min = -3 + } + desc = adultery.1003.duel_failure + reverse_add_opinion = { + target = scope:mother + modifier = spied_on_me_opinion + } + } + } + } + } + hidden_effect = { + scope:mother = { + if = { + limit = { + is_alive = yes + } + add_character_flag = { + flag = father_suspects_this_pregnancy + months = 8 + } + } + } + + if = { # Check whether root or Spymaster should spy + limit = { + exists = cp:councillor_spymaster + NOT = { cp:councillor_spymaster = scope:mother } + cp:councillor_spymaster.intrigue > intrigue + } + cp:councillor_spymaster = { + duel = { + skill = intrigue + target = scope:mother + + 6 = { + compare_modifier = { + value = scope:duel_value + multiplier = 0.5 + min = -5 + } + trigger = { + scope:mother.pregnancy_real_father != root + exists = scope:mother.pregnancy_assumed_father + } + root = { + debug_spouse_and_pregnancy_real_father_effect = yes + trigger_event = { + id = adultery.1004 + days = { 10 15 } + } + } + } + + 4 = { + compare_modifier = { + value = scope:duel_value + multiplier = -0.5 + min = -3 + } + root = { + trigger_event = { + id = adultery.1009 + days = { 10 15 } + } + } + } + } + } + } + else = { + duel = { + skill = intrigue + target = scope:mother + + 6 = { + compare_modifier = { + value = scope:duel_value + multiplier = 0.5 + min = -5 + } + trigger = { + scope:mother.pregnancy_real_father != root + } + debug_spouse_and_pregnancy_real_father_effect = yes + trigger_event = { + id = adultery.1004 + days = { 10 15 } + } + } + + 4 = { + compare_modifier = { + value = scope:duel_value + multiplier = -0.5 + min = -3 + } + compare_modifier = { + trigger = { + exists = cp:councillor_spymaster + cp:councillor_spymaster = scope:mother.pregnancy_real_father + } + target = cp:councillor_spymaster + value = intrigue + multiplier = 5 + } + trigger_event = { + id = adultery.1009 + days = { 10 15 } + } + } + } + } + } +} + + + +expose_lover_secret_or_run_consequence_effect = { + # TARGET = lover to be checked + # EXPOSER = secret_exposer in case of a Secret reveal + + # Look for a Lover Secret and save it if one exists + if = { + limit = { + $TARGET$ = { is_alive = yes} # Check whether the other party is still alive + any_secret = { + type = secret_lover + secret_target = $TARGET$ + } + } + random_secret = { + type = secret_lover + limit = { + secret_target = $TARGET$ + } + save_scope_as = lover_secret_to_expose + } + } + + # Expose the Secret if it exists + if = { + limit = { + exists = scope:lover_secret_to_expose + } + scope:lover_secret_to_expose = { + expose_secret = $EXPOSER$ + } + } + + # Otherwise run the expose effects + else = { + if = { + limit = { + is_spouse_of = $EXPOSER$ + } + extramarital_sex_exposure_consequences_with_target_effect = { + TARGET = $TARGET$ + SPOUSE_EVENT = no + } + } + else = { + extramarital_sex_exposure_consequences_with_target_effect = { + TARGET = $TARGET$ + SPOUSE_EVENT = yes + } + } + save_scope_as = this_character + if = { + limit = { $TARGET$ = { is_alive = yes } } # Check whether the other party is still alive + $TARGET$ = { + extramarital_sex_exposure_consequences_with_target_effect = { + TARGET = scope:this_character + SPOUSE_EVENT = yes + } + } + } + } +} + + +debug_spouse_and_pregnancy_real_father_effect = { + scope:mother.pregnancy_real_father = { save_scope_as = real_father } + scope:mother.pregnancy_assumed_father = { save_scope_as = assumed_father } + if = { + limit = { scope:real_father = scope:assumed_father } + debug_log = "Real Father and Assumed Father were the same!" + } + else = { + #debug_log = "Adultery discovered from spying on mother!" + #debug_log_scopes = yes + } +} diff --git a/N3OW/common/scripted_effects/00_adventure_effects.txt b/N3OW/common/scripted_effects/00_adventure_effects.txt new file mode 100644 index 00000000..9beac79d --- /dev/null +++ b/N3OW/common/scripted_effects/00_adventure_effects.txt @@ -0,0 +1,90 @@ +##################################################################### +# EFFECT LIST +##################################################################### + +# Effects used in the Adventure Inspiration + +start_adventure_effect = { + + #To save the location so we can use it in the effect checking the distance + set_adventure_distance_variable_effect = { # Figure out how far it is there + ADVENTURER = $ADVENTURER$ + DESTINATION = $LOCATION$ + } + + $ADVENTURER$ = { + # Set a variable to check for availability + set_variable = gone_adventuring + + # Set up the event cycle + # To trigger the event that progresses the inspiration + trigger_event = { + id = fund_inspiration.0053 + days = 1 + } + # Fallback to make sure the inspiration is handled somehow if it goes on for too long + trigger_event = { + id = fund_inspiration.0054 + years = 10 + } + } +} + + +set_adventure_distance_variable_effect = { + # Requires ADVENTURER = character + # Requires DESTINATION = barony_title + $ADVENTURER$.location = { + save_temporary_scope_as = start_barony + } + # Calculate distance to the destination + # The value set indicates how long time it will take for the adventurer to come back + if = { + limit = { + scope:start_barony = { + squared_distance = { + target = $DESTINATION$ + value > long_adventure_max_length + } + } + } + set_variable = { + name = adventure_distance + value = very_long_adventure_var + } + } + else_if = { + limit = { + scope:start_barony = { + squared_distance = { + target = $DESTINATION$ + value > medium_adventure_max_length + } + } + } + set_variable = { + name = adventure_distance + value = long_adventure_var + } + } + else_if = { + limit = { + scope:start_barony = { + squared_distance = { + target = $DESTINATION$ + value > short_adventure_max_length + } + } + } + set_variable = { + name = adventure_distance + value = medium_adventure_var + } + } + else = { + set_variable = { + name = adventure_distance + value = short_adventure_var + } + } +} diff --git a/N3OW/common/scripted_effects/00_ai_budget_effects.txt b/N3OW/common/scripted_effects/00_ai_budget_effects.txt new file mode 100644 index 00000000..5fa97912 --- /dev/null +++ b/N3OW/common/scripted_effects/00_ai_budget_effects.txt @@ -0,0 +1,730 @@ +####################################### +# AI Tweaks # +# For a better challenge, a better AI # +####################################### +ai_budget_manipulation_effect = { + # Tweaks to the War Chest AI budget - sometimes the AI will be brave enough to boom + + if = { # Some special logic to make certain AI's save up gold to revoke titles in their desired domain + limit = { + is_ai = yes + is_at_war = no + is_playable_character = yes + OR = { + AND = { + has_treasury = no + gold >= 50 + gold < minimum_ai_gold_value_for_tyranny_wars + } + AND = { + has_treasury = yes + treasury >= 50 + treasury < minimum_ai_treasury_value_for_tyranny_wars + } + } + NOR = { + has_character_flag = ai_revoke_recheck_cooldown + government_has_flag = government_is_nomadic + } + primary_title.tier >= tier_duchy + years_from_game_start >= 3 + domain_size < domain_limit + has_realm_law_flag = title_revocation_allowed + OR = { # Tyranny tolerance is based on rationality + AND = { + ai_rationality < 0 + tyranny <= 15 # Don't go crazy with tyranny, just a bit is fine + } + AND = { + ai_rationality >= 0 + ai_rationality < 50 + tyranny <= 5 # Don't go crazy with tyranny, just a bit is fine + } + AND = { + ai_rationality >= 50 + tyranny <= 0 # Don't go crazy with tyranny, just a bit is fine + } + } + OR = { + primary_title.title_capital_county = { + holder != root + holder = { + current_military_strength < root.current_military_strength + is_vassal_or_below_of = root + NOR = { + vassal_contract_has_flag = vassal_contract_cannot_revoke_titles + has_relation_friend = root + has_relation_best_friend = root + has_relation_lover = root + has_relation_soulmate = root + is_child_of = root + is_grandchild_of = root + is_great_grandchild_of = root + } + } + } + AND = { + primary_title.tier >= tier_kingdom + exists = primary_title.title_capital_county.de_jure_liege.holder + primary_title.title_capital_county.de_jure_liege = { + holder != root + holder = { + current_military_strength < root.current_military_strength + is_vassal_or_below_of = root + NOR = { + vassal_contract_has_flag = vassal_contract_cannot_revoke_titles + has_relation_friend = root + has_relation_best_friend = root + has_relation_lover = root + has_relation_soulmate = root + is_child_of = root + is_grandchild_of = root + is_great_grandchild_of = root + } + } + } + } + any_sub_realm_county = { + holder != root + title_province = { has_holding_type = castle_holding } + this != root.primary_title.title_capital_county + duchy = root.primary_title.title_capital_county.duchy + holder = { + current_military_strength < root.current_military_strength + NOR = { + vassal_contract_has_flag = vassal_contract_cannot_revoke_titles + has_relation_friend = root + has_relation_best_friend = root + has_relation_lover = root + has_relation_soulmate = root + is_child_of = root + is_grandchild_of = root + is_great_grandchild_of = root + } + } + } + } + trigger_if = { + limit = { + domain_size > 3 + } + NOR = { + has_trait = generous + has_trait = just + } + } + NOT = { + primary_title = title:e_hre + } + } + if = { + limit = { + primary_title.title_capital_county = { + holder != root + holder = { + current_military_strength < root.current_military_strength + is_vassal_or_below_of = root + NOT = { vassal_contract_has_flag = vassal_contract_cannot_revoke_titles } + } + } + } + add_character_flag = { flag = ai_save_gold_for_revoke years = 6 } + } + else_if = { + limit = { + primary_title.title_capital_county = { + holder = root + title_province = { free_building_slots <= 0 } + } + } + add_character_flag = { flag = ai_save_gold_for_revoke years = 6 } + } + else = { + random_list = { + 50 = { + add_character_flag = { flag = ai_save_gold_for_revoke years = 6 } + } + 50 = { + add_character_flag = { flag = ai_revoke_recheck_cooldown years = 6 } + } + } + } + } + else_if = { + limit = { + is_ai = yes + is_playable_character = yes + primary_title.tier >= tier_duchy + years_from_game_start >= 3 + NOR = { + has_character_flag = ai_revoke_recheck_cooldown + has_character_flag = ai_save_gold_for_revoke + government_has_flag = government_is_nomadic + } + } + add_character_flag = { flag = ai_revoke_recheck_cooldown years = 6 } + } + + if = { # Conquerors are special; they don't care about states or eras - they just want to conquer, and put their resources towards just that. + limit = { + has_variable = conqueror + } + # For now they just buff the war chest, and nothing else + move_budget_gold = { gold = long_term_gold from = budget_long_term to = budget_war_chest } + move_budget_gold = { gold = short_term_gold from = budget_short_term to = budget_war_chest } + # Conquerors have no concern for the future; only here and now matters + move_budget_gold = { gold = long_term_gold from = budget_long_term to = budget_short_term } + if = { + limit = { + has_treasury = yes + } + # For now they just buff the war chest, and nothing else + move_budget_treasury = { treasury = long_term_treasury from = budget_long_term to = budget_war_chest } + move_budget_treasury = { treasury = short_term_treasury from = budget_short_term to = budget_war_chest } + # Conquerors have no concern for the future; only here and now matters + move_budget_treasury = { treasury = long_term_treasury from = budget_long_term to = budget_short_term } + } + } + else_if = { # Adventurers only need short term gold. + limit = { + is_ai = yes + has_government = landless_adventurer_government + } + move_budget_gold = { gold = long_term_gold from = budget_long_term to = budget_short_term } + move_budget_gold = { gold = war_chest_gold from = budget_war_chest to = budget_short_term } + } + else = { + if = { + limit = { + is_ai = yes + is_at_war = no # While at war, the War Chest should be preserved at all costs + is_playable_character = yes + OR = { + AND = { + has_treasury = no + gold > 0 + war_chest_gold >= 10 + } + AND = { + has_treasury = yes + treasury > 0 + war_chest_treasury >= 10 + } + } + NOR = { + has_character_flag = ai_save_gold_for_revoke + any_targeting_faction = { + NOT = { faction_is_type = peasant_faction } + faction_power >= halved_faction_power_threshold + } + } + trigger_if = { + limit = { + government_has_flag = government_is_tribal + } + prestige >= expensive_building_tier_1_cost + } + NAND = { # Iberian Struggle rulers that go for escalation should always go for a full war chest + any_character_struggle = { + phase_has_catalyst = catalyst_winning_large_conquest_war + } + has_character_flag = agenda_towards_escalation + } + } + + # Chance to make an AI boom its economy if they do not fall into an archetype + if = { + limit = { + ai_has_builder_or_pious_builder_personality = no + ai_has_warlike_personality = no + ai_has_cautious_personality = no + NOT = { + has_character_flag = ai_boom_cooldown + } + } + random = { + chance = { + value = primary_title.tier + if = { + limit = { + has_trait = diligent + } + add = 1 + } + if = { + limit = { + has_trait = architect + } + add = 4 + } + } + add_character_flag = { flag = ai_boom years = 15 } + add_character_flag = { flag = ai_boom_cooldown years = 30 } # To balance the AI out + } + } + + # Early Game, there are still building slots to fill + # At this point, the AI will boom more aggressively than normal + if = { + limit = { + OR = { + any_held_title = { + title_tier = county + title_province = { free_building_slots > 0 } + } + ai_should_focus_on_building_in_their_capital = yes + } + ai_has_warlike_personality = no # Warlike AI's go straight to the more restrictive second set of conditions + } + # Early Game - Capital Focus + # AI's want to fill up their Capital County's building slots, first level buildings have the highest RoI so it's stupid not to + # There's no guarantee that they will spend the gold on buildings for specifically their capital, but they are heavily incentivised to do so + # They may spend on buildings in secondary counties/baronies, or on MaA + if = { + limit = { + capital_county.title_province = { + free_building_slots > 0 + } + ai_has_warlike_personality = no + ai_has_cautious_personality = no + } + move_budget_gold = { gold = war_chest_gold from = budget_war_chest to = budget_short_term } + if = { + limit = { + has_treasury = yes + } + move_budget_treasury = { treasury = war_chest_treasury from = budget_war_chest to = budget_short_term } + } + } + else_if = { # Cautious AI's keep a half of their war chest as a buffer + limit = { + capital_county.title_province = { + free_building_slots > 0 + } + ai_has_cautious_personality = yes + OR = { + AND = { + has_treasury = no + war_chest_gold >= halved_ai_war_chest_gold_maximum + } + AND = { + has_treasury = yes + war_chest_treasury >= halved_ai_war_chest_treasury_maximum + } + } + } + move_budget_gold = { gold = excess_over_halved_ai_war_chest_gold from = budget_war_chest to = budget_short_term } + if = { + limit = { + has_treasury = yes + } + move_budget_treasury = { treasury = excess_over_halved_ai_war_chest_treasury from = budget_war_chest to = budget_short_term } + } + } + + # Early Game - Building up Secondary Counties + # The AI wants first-level buildings in all of its Counties + # This is when personalities will begin to manifest in a bigger way + # The else_if is intended, it's a continuation of the above logic + else_if = { # Economical boom AI's just go for it, hard + limit = { + ai_has_builder_or_pious_builder_personality = yes + } + move_budget_gold = { gold = war_chest_gold from = budget_war_chest to = budget_short_term } + if = { + limit = { + has_treasury = yes + } + move_budget_treasury = { treasury = war_chest_treasury from = budget_war_chest to = budget_short_term } + } + } + else_if = { # Cautious AI's will want a minimum war chest in absolute terms, based on tier + limit = { + OR = { + AND = { + has_treasury = no + war_chest_gold > cautious_ai_minimum_war_chest_gold + } + AND = { + has_treasury = yes + war_chest_treasury > cautious_ai_minimum_war_chest_treasury + } + } + ai_has_cautious_personality = yes + } + move_budget_gold = { gold = excess_over_cautious_ai_minimum_war_chest_gold from = budget_war_chest to = budget_short_term } + if = { + limit = { + has_treasury = yes + } + move_budget_treasury = { treasury = excess_over_cautious_ai_minimum_war_chest_treasury from = budget_war_chest to = budget_short_term } + } + } + # Warlike AI's have a few conditions + # If they have a full war chest and have been at peace for 3 years, they'll stuff half their war chest into short term + # This is a somewhat close representation of if they want to declare war + # But it's not a particularly aggressive cooldown, as we do want AI's to build up a minimum, even if they are warlike + else_if = { + limit = { + ai_has_warlike_personality = yes + OR = { + AND = { + has_treasury = no + war_chest_gold >= war_chest_gold_maximum + } + AND = { + has_treasury = yes + war_chest_treasury >= war_chest_treasury_maximum + } + } + days_of_continuous_peace >= 1825 # 5 years + } + move_budget_gold = { gold = excess_over_a_quarter_ai_war_chest_gold from = budget_war_chest to = budget_short_term } + if = { + limit = { + has_treasury = yes + } + move_budget_treasury = { treasury = excess_over_a_quarter_ai_war_chest_gold from = budget_war_chest to = budget_short_term } + } + } + # If no personality archetype is present, AI's with the ai_boom flag, appropriate traits, or decent boldness will boom + else_if = { + limit = { + OR = { + has_character_flag = ai_boom + ai_boldness >= 25 + has_trait = diligent + has_trait = architect + } + } + if = { # If you have enough war chest gold and short term gold to build a holding, and doing so would be smart, do it! + limit = { + domain_size < domain_limit + OR = { + AND = { + has_treasury = no + gold >= main_building_tier_1_cost + long_term_gold < main_building_tier_1_cost + } + AND = { + has_treasury = yes + treasury >= main_building_tier_1_cost + long_term_treasury < main_building_tier_1_cost + } + } + NOT = { + government_has_flag = government_is_tribal + } + culture = { # The requirements for Castles, temples, and Cities + has_innovation = innovation_motte + has_innovation = innovation_city_planning + } + any_held_title = { + title_tier = county + any_county_province = { + has_holding = no + barony_cannot_construct_holding = no + } + } + } + move_budget_gold = { gold = main_building_tier_1_cost from = budget_war_chest to = budget_long_term } + move_budget_gold = { gold = main_building_tier_1_cost from = budget_short_term to = budget_long_term } + if = { + limit = { + has_treasury = yes + } + move_budget_treasury = { treasury = main_building_tier_1_cost from = budget_war_chest to = budget_long_term } + move_budget_treasury = { treasury = main_building_tier_1_cost from = budget_short_term to = budget_long_term } + } + } + else = { + move_budget_gold = { gold = war_chest_gold from = budget_war_chest to = budget_short_term } + if = { + limit = { + has_treasury = yes + } + move_budget_treasury = { treasury = war_chest_treasury from = budget_war_chest to = budget_short_term } + } + } + } + } + + # Mid-Late game, there are no more building slots to fill + # Heavily personality based, with some quirks here and there + # The else_if is intended, it's a continuation of the above logic + else_if = { # Economical boom AI's will empty their entire treasury to boom + limit = { + ai_has_builder_or_pious_builder_personality = yes + } + if = { # If you have enough war chest gold and short term gold to build a holding, and doing so would be smart, do it! + limit = { + domain_size < domain_limit + OR = { + AND = { + has_treasury = no + gold >= main_building_tier_1_cost + long_term_gold < main_building_tier_1_cost + } + AND = { + has_treasury = yes + treasury >= main_building_tier_1_cost + long_term_treasury < main_building_tier_1_cost + } + } + NOT = { + government_has_flag = government_is_tribal + } + culture = { # The requirements for Castles, temples, and Cities + has_innovation = innovation_motte + has_innovation = innovation_city_planning + } + any_held_title = { + title_tier = county + any_county_province = { + has_holding = no + barony_cannot_construct_holding = no + } + } + } + move_budget_gold = { gold = main_building_tier_1_cost from = budget_war_chest to = budget_long_term } + move_budget_gold = { gold = main_building_tier_1_cost from = budget_short_term to = budget_long_term } + if = { + limit = { + has_treasury = yes + } + move_budget_treasury = { treasury = main_building_tier_1_cost from = budget_war_chest to = budget_long_term } + move_budget_treasury = { treasury = main_building_tier_1_cost from = budget_short_term to = budget_long_term } + } + } + else = { + move_budget_gold = { gold = war_chest_gold from = budget_war_chest to = budget_short_term } + if = { + limit = { + has_treasury = yes + } + move_budget_treasury = { treasury = war_chest_treasury from = budget_war_chest to = budget_short_term } + } + } + } + else_if = { # Cautious AI's will only boom if they feel really, really safe + limit = { + OR = { + AND = { + has_treasury = no + war_chest_gold > cautious_ai_minimum_war_chest_gold + } + AND = { + has_treasury = yes + war_chest_treasury > cautious_ai_minimum_war_chest_treasury + } + } + ai_has_cautious_personality = yes + current_military_strength >= max_military_strength + days_of_continuous_peace >= 1825 # 5 years + OR = { + any_ally = { + count >= 2 + } + dread >= 50 # Dread makes cautious characters feel safe + } + } + move_budget_gold = { gold = excess_over_cautious_ai_minimum_war_chest_gold from = budget_war_chest to = budget_short_term } + if = { + limit = { + has_treasury = yes + } + move_budget_treasury = { treasury = excess_over_cautious_ai_minimum_war_chest_treasury from = budget_war_chest to = budget_short_term } + } + } + else_if = { # Warlike AI's will invest half their war chest if it's full, and nothing is going on + limit = { + ai_has_warlike_personality = yes + OR = { + AND = { + has_treasury = no + war_chest_gold >= war_chest_gold_maximum + } + AND = { + has_treasury = yes + war_chest_treasury >= war_chest_treasury_maximum + } + } + NOT = { + government_has_flag = government_is_nomadic + } + capital_county.title_province = { + free_building_slots <= 0 + } + days_of_continuous_peace >= 2555 # 7 years + } + move_budget_gold = { gold = halved_ai_war_chest_gold from = budget_war_chest to = budget_short_term } + if = { + limit = { + has_treasury = yes + } + move_budget_treasury = { treasury = halved_ai_war_chest_treasury from = budget_war_chest to = budget_short_term } + } + } + else_if = { # Special logic for warlike AI's during the Iranian Intermezzo, they need to be more aggressive than usual + limit = { + has_trait = fp3_struggle_detractor + ai_has_warlike_personality = yes + OR = { + AND = { + has_treasury = no + war_chest_gold < war_chest_gold_maximum + } + AND = { + has_treasury = yes + war_chest_treasury < war_chest_treasury_maximum + } + } + days_of_continuous_peace < 2555 + } + move_budget_gold = { gold = short_term_gold from = budget_short_term to = budget_war_chest } + move_budget_gold = { gold = long_term_gold from = budget_long_term to = budget_war_chest } + if = { + limit = { + has_treasury = yes + } + move_budget_treasury = { treasury = short_term_treasury from = budget_short_term to = budget_war_chest } + move_budget_treasury = { treasury = long_term_treasury from = budget_long_term to = budget_war_chest } + } + } + else_if = { # Warlike AI's will invest their long term gold into their war chest if it's not full + limit = { + ai_has_warlike_personality = yes + OR = { + AND = { + has_treasury = no + war_chest_gold < war_chest_gold_maximum + long_term_gold >= 1 + } + AND = { + has_treasury = yes + war_chest_treasury < war_chest_treasury_maximum + long_term_treasury >= 1 + } + } + } + move_budget_gold = { gold = long_term_gold from = budget_long_term to = budget_war_chest } + if = { + limit = { + has_treasury = yes + } + move_budget_treasury = { treasury = long_term_treasury from = budget_long_term to = budget_war_chest } + } + } + + # For AI's with no particular personality, warlike, booming, or cautious, we have them boom through a flag system + # Bold AI's boom with all their war chest gold, non-bold with half + else_if = { + limit = { + has_character_flag = ai_boom + ai_boldness >= 25 + } + if = { # If you have enough war chest gold and short term gold to build a holding, and doing so would be smart, do it! + limit = { + domain_size < domain_limit + OR = { + AND = { + has_treasury = no + gold >= main_building_tier_1_cost + long_term_gold < main_building_tier_1_cost + } + AND = { + has_treasury = yes + treasury >= main_building_tier_1_cost + long_term_treasury < main_building_tier_1_cost + } + } + NOT = { + government_has_flag = government_is_tribal + } + culture = { # The requirements for Castles, temples, and Cities + has_innovation = innovation_motte + has_innovation = innovation_city_planning + } + any_held_title = { + title_tier = county + any_county_province = { + has_holding = no + barony_cannot_construct_holding = no + } + } + } + move_budget_gold = { gold = main_building_tier_1_cost from = budget_war_chest to = budget_long_term } + move_budget_gold = { gold = main_building_tier_1_cost from = budget_short_term to = budget_long_term } + if = { + limit = { + has_treasury = yes + } + move_budget_treasury = { treasury = main_building_tier_1_cost from = budget_war_chest to = budget_long_term } + move_budget_treasury = { treasury = main_building_tier_1_cost from = budget_short_term to = budget_long_term } + } + } + else = { + move_budget_gold = { gold = war_chest_gold from = budget_war_chest to = budget_short_term } + if = { + limit = { + has_treasury = yes + } + move_budget_gold = { gold = war_chest_treasury from = budget_war_chest to = budget_short_term } + } + } + } + else_if = { + limit = { + has_character_flag = ai_boom + OR = { + AND = { + has_treasury = no + war_chest_gold >= halved_ai_war_chest_gold_maximum + } + AND = { + has_treasury = yes + war_chest_treasury >= halved_ai_war_chest_treasury_maximum + } + } + } + move_budget_gold = { gold = excess_over_halved_ai_war_chest_gold from = budget_war_chest to = budget_short_term } + if = { + limit = { + has_treasury = yes + } + move_budget_treasury = { treasury = excess_over_halved_ai_war_chest_treasury from = budget_war_chest to = budget_short_term } + } + } + + if = { # Some special logic to catch the rare instances where a non-Tribe ends up with a tribal main holding + limit = { + NOT = { + government_has_flag = government_is_tribal + } + capital_province = { + has_holding_type = tribal_holding + } + OR = { + AND = { + has_treasury = no + long_term_gold < feudalize_holding_interaction_cost + } + AND = { + has_treasury = yes + long_term_treasury < feudalize_holding_interaction_cost + } + } + } + move_budget_gold = { gold = feudalize_holding_interaction_cost from = budget_war_chest to = budget_long_term } + move_budget_gold = { gold = feudalize_holding_interaction_cost from = budget_short_term to = budget_long_term } + if = { + limit = { + has_treasury = yes + } + move_budget_treasury = { treasury = feudalize_holding_interaction_cost from = budget_war_chest to = budget_long_term } + move_budget_treasury = { treasury = feudalize_holding_interaction_cost from = budget_short_term to = budget_long_term } + } + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_ai_conqueror_effects.txt b/N3OW/common/scripted_effects/00_ai_conqueror_effects.txt new file mode 100644 index 00000000..d5880ce5 --- /dev/null +++ b/N3OW/common/scripted_effects/00_ai_conqueror_effects.txt @@ -0,0 +1,1275 @@ +ai_conqueror_yearly_effect = { + if = { + limit = { + has_variable = conqueror + top_liege = this + } + save_scope_as = root_scope + + ###### BUDGETING + if = { + limit = { + is_at_war = no + years_from_game_start >= 5 + NOT = { + has_character_flag = conqueror_anti_pacing_flag + } + primary_title = { title_held_years >= 3 } # Do not go into buildup mode if there's a brother you need to destroy immediately! + OR = { + any_neighboring_and_across_water_top_liege_realm_owner = { + count = all + current_military_strength >= scope:root_scope.max_military_strength + NOR = { + is_allied_to = scope:root_scope + has_relation_friend = scope:root_scope + has_relation_lover = scope:root_scope + } + } + any_neighboring_and_across_water_top_liege_realm_owner = { + count >= 2 + current_military_strength >= scope:root_scope.max_military_strength + NOR = { + is_allied_to = scope:root_scope + has_relation_friend = scope:root_scope + has_relation_lover = scope:root_scope + } + } + any_vassal = { + joined_faction ?= { + faction_power >= faction_power_halfway_threshold + } + } + AND = { + NOT = { ai_should_get_conqueror_bonuses = yes } # They have a 75% discount + monthly_character_income_minus_expenses > half_monthly_character_income # Try to spend at least 50% of income on MaA! + } + } + } + add_character_flag = { # Conquerors should sometimes spend on MaA, if there are strong neighbours + flag = conqueror_pacing_flag + years = 3 + } + add_character_flag = { + flag = conqueror_anti_pacing_flag + years = 10 + } + } + if = { + limit = { + has_character_flag = conqueror_pacing_flag + } + move_budget_gold = { gold = long_term_gold from = budget_long_term to = budget_short_term } + move_budget_gold = { gold = war_chest_gold from = budget_war_chest to = budget_short_term } + if = { + limit = { + has_treasury = yes + } + move_budget_treasury = { treasury = long_term_treasury from = budget_long_term to = budget_short_term } + move_budget_treasury = { treasury = war_chest_treasury from = budget_war_chest to = budget_short_term } + } + } + else = { # Conquerors are special; they don't care about states or eras - they just want to conquer, and put their resources towards just that. + move_budget_gold = { gold = long_term_gold from = budget_long_term to = budget_war_chest } + move_budget_gold = { gold = short_term_gold from = budget_short_term to = budget_war_chest } + # Conquerors have no concern for the future; only here and now matters + move_budget_gold = { gold = long_term_gold from = budget_long_term to = budget_short_term } + if = { + limit = { + has_treasury = yes + } + move_budget_treasury = { treasury = long_term_treasury from = budget_long_term to = budget_war_chest } + move_budget_treasury = { treasury = short_term_treasury from = budget_short_term to = budget_war_chest } + # Conquerorstreasurye no treasuryern for the future; only here and now matters + move_budget_treasury = { treasury = long_term_treasury from = budget_long_term to = budget_short_term } + } + } + + ###### IMPORTANT DECISIONS + if = { + limit = { + can_execute_decision = mpo_become_greatest_of_khans_decision + } + execute_decision = mpo_become_greatest_of_khans_decision + } + if = { + limit = { + can_execute_decision = nomad_higher_tier_title_decision + } + execute_decision = nomad_higher_tier_title_decision + } + + ###### LIFESTYLES + if = { # Conquerors change lifestyle focus to suit their needs + limit = { + NOT = { has_character_flag = ai_focus_cd } # No cheating! + } + if = { + limit = { + is_at_war = no + war_chest_gold < war_chest_gold_maximum + NOT = { has_focus = stewardship_wealth_focus } + } + set_focus = stewardship_wealth_focus + add_character_flag = { + flag = ai_focus_cd + years = 5 + } + } + else_if = { # Prestige is important for CB's + limit = { + is_at_war = no + OR = { + AND = { + prestige_level < 4 + can_use_conquest_cbs_trigger = yes + } + prestige < 1000 + } + NOT = { has_focus = diplomacy_majesty_focus } + NOT = { has_trait = august } + } + set_focus = diplomacy_majesty_focus + add_character_flag = { + flag = ai_focus_cd + years = 5 + } + } + else_if = { # Certain conquerors will level up the skulduggery tree so they can murder important enemies to weaken them + limit = { + is_at_war = no + intrigue >= martial + intrigue >= 12 + NOT = { has_focus = intrigue_skulduggery_focus } + NOT = { has_trait = schemer } + } + set_focus = intrigue_skulduggery_focus + add_character_flag = { + flag = ai_focus_cd + years = 5 + } + } + else_if = { + limit = { + is_commanding_army = yes + NOT = { has_focus = martial_chivalry_focus } + } + set_focus = martial_chivalry_focus + add_character_flag = { + flag = ai_focus_cd + years = 5 + } + } + else_if = { + limit = { + NOT = { has_focus = martial_authority_focus } + any_held_title = { + title_tier = county + county_control < 100 + } + } + set_focus = martial_authority_focus + add_character_flag = { + flag = ai_focus_cd + years = 5 + } + } + else_if = { + limit = { + NOT = { has_focus = martial_strategy_focus } + } + set_focus = martial_strategy_focus + add_character_flag = { + flag = ai_focus_cd + years = 5 + } + } + } + + ##### SCHEMES + if = { # End murder schemes that are useless + limit = { + any_scheme = { + type = murder + is_scheme_exposed = yes + } + } + every_scheme = { + type = murder + limit = { + is_scheme_exposed = yes + } + end_scheme = yes + } + } + if = { # Murders + limit = { + NOT = { # Really honorable characters do not stoop this low, ever + ai_honor >= high_positive_ai_value + } + OR = { + NOT = { + any_scheme = { + OR = { + scheme_type = murder + scheme_type = abduct + scheme_type = claim_throne + scheme_type = fabricate_hook + } + } + } + AND = { + has_perk = twice_schemed_perk + any_scheme = { + count < 2 + OR = { + scheme_type = murder + scheme_type = abduct + scheme_type = claim_throne + scheme_type = fabricate_hook + } + } + } + } + } + every_neighboring_and_across_water_top_liege_realm_owner = { # Weaken strong neighbours + limit = { + save_temporary_scope_as = target_scope + scope:root_scope = { + current_military_strength >= scope:target_scope.current_military_strength + has_any_cb_on = scope:target_scope + } + NOR = { + is_allied_to = scope:root_scope + has_relation_friend = scope:root_scope + has_relation_lover = scope:root_scope + } + OR = { + AND = { # Children are usually weaker rulers + is_adult = yes + primary_heir ?= { + is_adult = no + } + } + AND = { # Split the realm + has_partition_succession_realm_law_trigger = yes + any_heir = { + count >= 2 + } + } + } + scope:root_scope = { + can_start_scheme = { + type = murder + target_character = scope:target_scope + } + } + } + add_to_list = targets + } + every_targeting_faction = { + faction_type = claimant_faction + limit = { + exists = special_character + save_temporary_scope_as = faction_in_question + scope:root_scope = { + can_start_scheme = { + type = murder + target_character = scope:faction_in_question.special_character + } + } + } + special_character = { + add_to_list = targets + } + } + every_relation = { + type = rival + add_to_list = targets + } + random_in_list = { + list = targets + save_scope_as = murder_target + } + if = { + limit = { + exists = scope:murder_target + } + start_scheme = { + type = murder + target_character = scope:murder_target + } + } + } + if = { # End hook schemes that are useless + limit = { + any_scheme = { + type = fabricate_hook + is_scheme_exposed = yes + } + } + every_scheme = { + type = fabricate_hook + limit = { + is_scheme_exposed = yes + } + end_scheme = yes + } + } + if = { # Fabricate Hook + limit = { + has_perk = truth_is_relative_perk + OR = { + NOT = { + any_scheme = { + OR = { + scheme_type = murder + scheme_type = abduct + scheme_type = claim_throne + scheme_type = fabricate_hook + } + } + } + AND = { + has_perk = twice_schemed_perk + any_scheme = { + count < 2 + OR = { + scheme_type = murder + scheme_type = abduct + scheme_type = claim_throne + scheme_type = fabricate_hook + } + } + } + } + } + every_courtier = { + limit = { + is_theocratic_lessee = yes + scope:root_scope = { + can_start_scheme = { + type = fabricate_hook + target_character = prev + } + } + } + add_to_list = hook_targets + } + every_vassal = { + limit = { + highest_held_title_tier >= tier_county + government_has_flag = government_is_feudal + vassal_contract_can_be_modified_trigger = yes + scope:root_scope = { + can_start_scheme = { + type = fabricate_hook + target_character = prev + } + } + } + add_to_list = hook_targets + } + if = { + limit = { + has_perk = golden_obligations_perk + } + every_vassal = { + limit = { + gold >= 200 + scope:root_scope = { + can_start_scheme = { + type = fabricate_hook + target_character = prev + } + } + } + add_to_list = hook_targets + } + every_neighboring_and_across_water_top_liege_realm_owner = { + limit = { + gold >= 100 + scope:root_scope = { + can_start_scheme = { + type = fabricate_hook + target_character = prev + } + } + } + add_to_list = hook_targets + } + } + random_in_list = { + list = hook_targets + weight = { + base = 1 + modifier = { + add = primary_title.tier + } + } + save_scope_as = hook_target + } + if = { + limit = { + exists = scope:hook_target + } + start_scheme = { + type = fabricate_hook + target_character = scope:hook_target + } + } + } + + if = { # Sway + limit = { + OR = { + NOT = { + any_scheme = { + OR = { + scheme_type = befriend + scheme_type = sway + scheme_type = seduce + scheme_type = courting + scheme_type = elope + scheme_type = learn_language + } + } + } + AND = { + OR = { + dynasty ?= { has_dynasty_perk = glory_legacy_5 } + AND = { + has_royal_court = yes + has_dlc_feature = royal_court + has_court_type = court_diplomatic + court_grandeur_current_level >= 10 + } + } + any_scheme = { + count < 2 + OR = { + scheme_type = befriend + scheme_type = sway + scheme_type = seduce + scheme_type = courting + scheme_type = elope + scheme_type = learn_language + } + } + } + AND = { + dynasty ?= { has_dynasty_perk = glory_legacy_5 } + has_royal_court = yes + has_dlc_feature = royal_court + has_court_type = court_diplomatic + court_grandeur_current_level >= 10 + any_scheme = { + count < 3 + OR = { + scheme_type = befriend + scheme_type = sway + scheme_type = seduce + scheme_type = courting + scheme_type = elope + scheme_type = learn_language + } + } + } + } + } + every_courtier = { + limit = { + OR = { + is_theocratic_lessee = yes + has_council_position = councillor_spymaster + } + opinion = { + target = scope:root_scope + value < 100 + } + scope:root_scope = { + can_start_scheme = { + type = sway + target_character = prev + } + } + } + add_to_list = sway_targets + } + every_vassal = { + limit = { + highest_held_title_tier >= tier_county + opinion = { + target = scope:root_scope + value < 100 + } + scope:root_scope = { + can_start_scheme = { + type = sway + target_character = prev + } + } + } + add_to_list = sway_targets + } + random_in_list = { + list = sway_targets + weight = { + base = 1 + modifier = { + add = 1000 + is_theocratic_lessee = yes + } + modifier = { + add = 1000 + opinion = { + target = scope:root_scope + value <= 0 + } + } + } + save_scope_as = sway_target + } + if = { + limit = { + exists = scope:sway_target + } + start_scheme = { + type = sway + target_character = scope:sway_target + } + } + } + + ###### WAR! Or, well... Coronation first + if = { + limit = { + highest_held_title_tier >= tier_kingdom + has_realm_law = uncrowned + can_host_activity = activity_coronation + } + ai_attempt_to_host_activity = activity_coronation + } + else_if = { + limit = { + is_at_war = no + war_chest_gold >= war_chest_gold_maximum + NOR = { + has_character_flag = conqueror_pacing_flag + any_owned_story = { story_type = story_greatest_of_khans } + any_owned_story = { story_type = story_mongol_invasion } + } + } + # Lots of nested ai_start_best_war here, priority as follows: Start high-impact CB war, start 3 wars against rulers with 30% or less strength, start 2 wars against rulers with less than 40%, or just start any good war + if = { # Kingdom+ Claims first + limit = { + any_claim = { + pressed = yes + tier >= tier_kingdom + } + } + ai_start_best_war = { + cb = { + claim_cb + } + is_valid = { + scope:target_title.tier >= tier_kingdom + scope:target_character = { + current_military_strength < root.current_military_strength + OR = { + gold < root.gold + current_military_strength <= root.fifty_percent_of_current_military_strength + } + } + } + on_failure = { + # Start one very high-impact war with a very good CB + ai_start_best_war = { + cb = { + major_religious_war + invasion_war + clan_invasion_war + directed_great_holy_war + tribal_subjugation_cb + de_jure_cb + de_jure_cb_nomadic + } + is_valid = { + } + on_failure = { + # Either go for one decent war, or three 'small' wars immediately + random_list = { + 50 = { + ai_start_best_war = { + cb = { + claim_cb + duchy_conquest_cb + religious_war + vassalization_cb + individual_duchy_de_jure_cb + sovereignty_cb + nomadic_conquest_duchy_cb + } + is_valid = { + trigger_if = { + limit = { + scope:casus_belli_type = casus_belli_type:claim_cb + } + scope:target_title.tier > tier_county + } + scope:target_character = { + current_military_strength < root.current_military_strength + OR = { + gold < root.gold + current_military_strength <= root.fifty_percent_of_current_military_strength + } + } + } + on_failure = { + ai_start_best_war = { + cb = { + claim_cb + county_conquest_cb + individual_county_de_jure_cb + minor_religious_war + county_struggle_cb + ducal_conquest_cb + nomadic_conquest_cb + } + is_valid = { + scope:target_character = { + current_military_strength <= root.a_third_of_current_military_strength + gold < root.gold + } + } + on_failure = { + ai_start_best_war = { + cb = { + claim_cb + county_conquest_cb + individual_county_de_jure_cb + minor_religious_war + county_struggle_cb + ducal_conquest_cb + nomadic_conquest_cb + } + is_valid = { + scope:target_character = { + current_military_strength < root.forty_percent_of_current_military_strength + gold < root.gold + } + } + on_failure = { + ai_start_best_war = { + cb = { + claim_cb + county_conquest_cb + individual_county_de_jure_cb + minor_religious_war + county_struggle_cb + ducal_conquest_cb + nomadic_conquest_cb + } + } + } + } + ai_start_best_war = { + cb = { + claim_cb + county_conquest_cb + individual_county_de_jure_cb + minor_religious_war + county_struggle_cb + ducal_conquest_cb + nomadic_conquest_cb + } + is_valid = { + scope:target_character = { + current_military_strength < root.forty_percent_of_current_military_strength + gold < root.gold + } + } + } + } + } + ai_start_best_war = { + cb = { + claim_cb + county_conquest_cb + individual_county_de_jure_cb + minor_religious_war + county_struggle_cb + ducal_conquest_cb + nomadic_conquest_cb + } + is_valid = { + scope:target_character = { + current_military_strength <= root.a_third_of_current_military_strength + gold < root.gold + } + } + } + ai_start_best_war = { + cb = { + claim_cb + county_conquest_cb + individual_county_de_jure_cb + minor_religious_war + county_struggle_cb + ducal_conquest_cb + nomadic_conquest_cb + } + is_valid = { + scope:target_character = { + current_military_strength <= root.a_third_of_current_military_strength + gold < root.gold + } + } + } + } + } + } + 50 = { + ai_start_best_war = { + cb = { + claim_cb + duchy_conquest_cb + religious_war + vassalization_cb + individual_duchy_de_jure_cb + tribal_subjugation_cb + de_jure_cb + de_jure_cb_nomadic + nomadic_conquest_duchy_cb + } + is_valid = { + scope:target_character = { + current_military_strength <= root.a_third_of_current_military_strength + gold < root.gold + } + } + on_failure = { + ai_start_best_war = { + cb = { + claim_cb + county_conquest_cb + vassalization_cb + individual_county_de_jure_cb + minor_religious_war + county_struggle_cb + ducal_conquest_cb + nomadic_conquest_duchy_cb + } + is_valid = { + scope:target_character = { + current_military_strength <= root.a_third_of_current_military_strength + gold < root.gold + } + } + on_failure = { + ai_start_best_war = { + cb = { + claim_cb + county_conquest_cb + individual_county_de_jure_cb + minor_religious_war + county_struggle_cb + ducal_conquest_cb + nomadic_conquest_cb + } + is_valid = { + scope:target_character = { + current_military_strength < root.forty_percent_of_current_military_strength + gold < root.gold + } + } + on_failure = { + ai_start_best_war = { + cb = { + claim_cb + county_conquest_cb + individual_county_de_jure_cb + minor_religious_war + county_struggle_cb + ducal_conquest_cb + nomadic_conquest_cb + } + } + } + } + ai_start_best_war = { + cb = { + claim_cb + county_conquest_cb + individual_county_de_jure_cb + minor_religious_war + county_struggle_cb + ducal_conquest_cb + nomadic_conquest_cb + } + is_valid = { + scope:target_character = { + current_military_strength < root.forty_percent_of_current_military_strength + gold < root.gold + } + } + } + } + } + ai_start_best_war = { + cb = { + claim_cb + county_conquest_cb + individual_county_de_jure_cb + minor_religious_war + county_struggle_cb + ducal_conquest_cb + nomadic_conquest_cb + } + is_valid = { + scope:target_character = { + current_military_strength <= root.a_third_of_current_military_strength + gold < root.gold + } + } + } + ai_start_best_war = { + cb = { + claim_cb + county_conquest_cb + individual_county_de_jure_cb + minor_religious_war + county_struggle_cb + ducal_conquest_cb + nomadic_conquest_cb + } + is_valid = { + scope:target_character = { + current_military_strength <= root.a_third_of_current_military_strength + gold < root.gold + } + } + } + } + } + ai_start_best_war = { + cb = { + claim_cb + duchy_conquest_cb + religious_war + vassalization_cb + individual_duchy_de_jure_cb + de_jure_cb + de_jure_cb_nomadic + nomadic_conquest_duchy_cb + } + is_valid = { + scope:target_character = { + current_military_strength <= root.a_third_of_current_military_strength + gold < root.gold + } + } + } + ai_start_best_war = { + cb = { + claim_cb + duchy_conquest_cb + religious_war + vassalization_cb + individual_duchy_de_jure_cb + de_jure_cb + de_jure_cb_nomadic + nomadic_conquest_duchy_cb + } + is_valid = { + scope:target_character = { + current_military_strength <= root.a_third_of_current_military_strength + gold < root.gold + } + } + } + } + } + } + } + } + } + } + else = { # Then everything else + # Start one very high-impact war with a very good CB + ai_start_best_war = { + cb = { + major_religious_war + invasion_war + clan_invasion_war + directed_great_holy_war + tribal_subjugation_cb + de_jure_cb + de_jure_cb_nomadic + } + is_valid = { + } + on_failure = { + # Either go for one decent war, or three 'small' wars immediately + random_list = { + 50 = { + ai_start_best_war = { + cb = { + claim_cb + duchy_conquest_cb + religious_war + vassalization_cb + individual_duchy_de_jure_cb + sovereignty_cb + nomadic_conquest_duchy_cb + } + is_valid = { + trigger_if = { + limit = { + scope:casus_belli_type = casus_belli_type:claim_cb + } + scope:target_title.tier > tier_county + } + scope:target_character = { + current_military_strength < root.current_military_strength + OR = { + gold < root.gold + current_military_strength <= root.fifty_percent_of_current_military_strength + } + } + } + on_failure = { + ai_start_best_war = { + cb = { + claim_cb + county_conquest_cb + individual_county_de_jure_cb + minor_religious_war + county_struggle_cb + ducal_conquest_cb + nomadic_conquest_cb + } + is_valid = { + scope:target_character = { + current_military_strength <= root.a_third_of_current_military_strength + gold < root.gold + } + } + on_failure = { + ai_start_best_war = { + cb = { + claim_cb + county_conquest_cb + individual_county_de_jure_cb + minor_religious_war + county_struggle_cb + ducal_conquest_cb + nomadic_conquest_cb + } + is_valid = { + scope:target_character = { + current_military_strength < root.forty_percent_of_current_military_strength + gold < root.gold + } + } + on_failure = { + ai_start_best_war = { + cb = { + claim_cb + county_conquest_cb + individual_county_de_jure_cb + minor_religious_war + county_struggle_cb + ducal_conquest_cb + nomadic_conquest_cb + } + } + } + } + ai_start_best_war = { + cb = { + claim_cb + county_conquest_cb + individual_county_de_jure_cb + minor_religious_war + county_struggle_cb + ducal_conquest_cb + nomadic_conquest_cb + } + is_valid = { + scope:target_character = { + current_military_strength < root.forty_percent_of_current_military_strength + gold < root.gold + } + } + } + } + } + ai_start_best_war = { + cb = { + claim_cb + county_conquest_cb + individual_county_de_jure_cb + minor_religious_war + county_struggle_cb + ducal_conquest_cb + nomadic_conquest_cb + } + is_valid = { + scope:target_character = { + current_military_strength <= root.a_third_of_current_military_strength + gold < root.gold + } + } + } + ai_start_best_war = { + cb = { + claim_cb + county_conquest_cb + individual_county_de_jure_cb + minor_religious_war + county_struggle_cb + ducal_conquest_cb + nomadic_conquest_cb + } + is_valid = { + scope:target_character = { + current_military_strength <= root.a_third_of_current_military_strength + gold < root.gold + } + } + } + } + } + } + 50 = { + ai_start_best_war = { + cb = { + claim_cb + duchy_conquest_cb + religious_war + vassalization_cb + individual_duchy_de_jure_cb + tribal_subjugation_cb + de_jure_cb + de_jure_cb_nomadic + nomadic_conquest_duchy_cb + } + is_valid = { + scope:target_character = { + current_military_strength <= root.a_third_of_current_military_strength + gold < root.gold + } + } + on_failure = { + ai_start_best_war = { + cb = { + claim_cb + county_conquest_cb + vassalization_cb + individual_county_de_jure_cb + minor_religious_war + county_struggle_cb + ducal_conquest_cb + nomadic_conquest_duchy_cb + } + is_valid = { + scope:target_character = { + current_military_strength <= root.a_third_of_current_military_strength + gold < root.gold + } + } + on_failure = { + ai_start_best_war = { + cb = { + claim_cb + county_conquest_cb + individual_county_de_jure_cb + minor_religious_war + county_struggle_cb + ducal_conquest_cb + nomadic_conquest_cb + } + is_valid = { + scope:target_character = { + current_military_strength < root.forty_percent_of_current_military_strength + gold < root.gold + } + } + on_failure = { + ai_start_best_war = { + cb = { + claim_cb + county_conquest_cb + individual_county_de_jure_cb + minor_religious_war + county_struggle_cb + ducal_conquest_cb + nomadic_conquest_cb + } + } + } + } + ai_start_best_war = { + cb = { + claim_cb + county_conquest_cb + individual_county_de_jure_cb + minor_religious_war + county_struggle_cb + ducal_conquest_cb + nomadic_conquest_cb + } + is_valid = { + scope:target_character = { + current_military_strength < root.forty_percent_of_current_military_strength + gold < root.gold + } + } + } + } + } + ai_start_best_war = { + cb = { + claim_cb + county_conquest_cb + individual_county_de_jure_cb + minor_religious_war + county_struggle_cb + ducal_conquest_cb + nomadic_conquest_cb + } + is_valid = { + scope:target_character = { + current_military_strength <= root.a_third_of_current_military_strength + gold < root.gold + } + } + } + ai_start_best_war = { + cb = { + claim_cb + county_conquest_cb + individual_county_de_jure_cb + minor_religious_war + county_struggle_cb + ducal_conquest_cb + nomadic_conquest_cb + } + is_valid = { + scope:target_character = { + current_military_strength <= root.a_third_of_current_military_strength + gold < root.gold + } + } + } + } + } + ai_start_best_war = { + cb = { + claim_cb + duchy_conquest_cb + religious_war + vassalization_cb + individual_duchy_de_jure_cb + de_jure_cb + de_jure_cb_nomadic + nomadic_conquest_duchy_cb + } + is_valid = { + scope:target_character = { + current_military_strength <= root.a_third_of_current_military_strength + gold < root.gold + } + } + } + ai_start_best_war = { + cb = { + claim_cb + duchy_conquest_cb + religious_war + vassalization_cb + individual_duchy_de_jure_cb + de_jure_cb + de_jure_cb_nomadic + nomadic_conquest_duchy_cb + } + is_valid = { + scope:target_character = { + current_military_strength <= root.a_third_of_current_military_strength + gold < root.gold + } + } + } + } + } + } + } + } + } + + + ###### Get claimants to join your court! + if = { + limit = { + is_ai = yes + highest_held_title_tier >= tier_duchy + is_at_war = no + war_chest_gold >= war_chest_gold_maximum + NOT = { + has_character_flag = conqueror_pacing_flag + } + ai_should_get_conqueror_bonuses = yes + } + random_character_to_title_neighboring_duchy = { + limit = { + holder ?= { + top_liege.current_military_strength < scope:root_scope.current_military_strength + } + any_claimant = { + is_ruler = no + is_physically_able_adult = yes + NOT = { + is_weak_claimant_due_to_gender_trigger = { FAITH = this.faith CHARACTER = this } + } + OR = { + is_pool_character = yes + liege ?= { + NOR = { + is_ai = no + is_parent_of = prev + is_grandparent_of = prev + is_great_grandparent_of = prev + this = scope:root_scope + } + } + } + } + } + random_claimant = { + limit = { + is_ruler = no + is_physically_able_adult = yes + NOT = { + is_weak_claimant_due_to_gender_trigger = { FAITH = this.faith CHARACTER = this } + } + OR = { + is_pool_character = yes + liege ?= { + NOR = { + is_ai = no + is_parent_of = prev + is_grandparent_of = prev + is_great_grandparent_of = prev + this = scope:root_scope + } + } + } + } + scope:root_scope = { + add_courtier = prev + } + } + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_ai_value_effects.txt b/N3OW/common/scripted_effects/00_ai_value_effects.txt new file mode 100644 index 00000000..16faaae4 --- /dev/null +++ b/N3OW/common/scripted_effects/00_ai_value_effects.txt @@ -0,0 +1,875 @@ + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! + +#remove_adultery_variables_effect + +##################################################################### +# EFFECTS +##################################################################### + +#Saves a scope value with the "strongest" ai value (not exact values but based on the low/medium/high values in 00_ai_values.txt) +strongest_ai_value_effect = { + random_list = { + 1 = { #Positive boldness + trigger = { ai_boldness > 0 } + modifier = { + ai_boldness >= low_positive_boldness + factor = 100 + } + modifier = { + ai_boldness >= medium_positive_boldness + factor = 100 + } + modifier = { + ai_boldness >= high_positive_boldness + factor = 100 + } + set_variable = { + name = strongest_ai_value + value = flag:positive_boldness + } + } + 1 = { #Positive compassion + trigger = { ai_compassion > 0 } + modifier = { + ai_compassion >= low_positive_compassion + factor = 100 + } + modifier = { + ai_compassion >= medium_positive_compassion + factor = 100 + } + modifier = { + ai_compassion >= high_positive_compassion + factor = 100 + } + set_variable = { + name = strongest_ai_value + value = flag:positive_compassion + } + } + 1 = { #Positive greed + trigger = { ai_greed > 0 } + modifier = { + ai_greed >= low_positive_greed + factor = 100 + } + modifier = { + ai_greed >= medium_positive_greed + factor = 100 + } + modifier = { + ai_greed >= high_positive_greed + factor = 100 + } + set_variable = { + name = strongest_ai_value + value = flag:positive_greed + } + } + 1 = { #Positive energy + trigger = { ai_energy > 0 } + modifier = { + ai_energy >= low_positive_energy + factor = 100 + } + modifier = { + ai_energy >= medium_positive_energy + factor = 100 + } + modifier = { + ai_energy >= high_positive_energy + factor = 100 + } + set_variable = { + name = strongest_ai_value + value = flag:positive_energy + } + } + 1 = { #Positive honor + trigger = { ai_honor > 0 } + modifier = { + ai_honor >= low_positive_honor + factor = 100 + } + modifier = { + ai_honor >= medium_positive_honor + factor = 100 + } + modifier = { + ai_honor >= high_positive_honor + factor = 100 + } + set_variable = { + name = strongest_ai_value + value = flag:positive_honor + } + } + 1 = { #Positive rationality + trigger = { ai_rationality > 0 } + modifier = { + ai_rationality >= low_positive_rationality + factor = 100 + } + modifier = { + ai_rationality >= medium_positive_rationality + factor = 100 + } + modifier = { + ai_rationality >= high_positive_rationality + factor = 100 + } + set_variable = { + name = strongest_ai_value + value = flag:positive_rationality + } + } + 1 = { #Positive vengefulness + trigger = { ai_vengefulness > 0 } + modifier = { + ai_vengefulness >= low_positive_vengefulness + factor = 100 + } + modifier = { + ai_vengefulness >= medium_positive_vengefulness + factor = 100 + } + modifier = { + ai_vengefulness >= high_positive_vengefulness + factor = 100 + } + set_variable = { + name = strongest_ai_value + value = flag:positive_vengefulness + } + } + 1 = { #Positive zeal + trigger = { ai_zeal > 0 } + modifier = { + ai_zeal >= low_positive_zeal + factor = 100 + } + modifier = { + ai_zeal >= medium_positive_zeal + factor = 100 + } + modifier = { + ai_zeal >= high_positive_zeal + factor = 100 + } + set_variable = { + name = strongest_ai_value + value = flag:positive_zeal + } + } + 1 = { #negative boldness + trigger = { ai_boldness < 0 } + modifier = { + ai_boldness <= low_negative_boldness + factor = 100 + } + modifier = { + ai_boldness <= medium_negative_boldness + factor = 100 + } + modifier = { + ai_boldness <= high_negative_boldness + factor = 100 + } + set_variable = { + name = strongest_ai_value + value = flag:negative_boldness + } + } + 1 = { #negative compassion + trigger = { ai_compassion < 0 } + modifier = { + ai_compassion <= low_negative_compassion + factor = 100 + } + modifier = { + ai_compassion <= medium_negative_compassion + factor = 100 + } + modifier = { + ai_compassion <= high_negative_compassion + factor = 100 + } + set_variable = { + name = strongest_ai_value + value = flag:negative_compassion + } + } + 1 = { #negative greed + trigger = { ai_greed < 0 } + modifier = { + ai_greed <= low_negative_greed + factor = 100 + } + modifier = { + ai_greed <= medium_negative_greed + factor = 100 + } + modifier = { + ai_greed <= high_negative_greed + factor = 100 + } + set_variable = { + name = strongest_ai_value + value = flag:negative_greed + } + } + 1 = { #negative energy + trigger = { ai_energy < 0 } + modifier = { + ai_energy <= low_negative_energy + factor = 100 + } + modifier = { + ai_energy <= medium_negative_energy + factor = 100 + } + modifier = { + ai_energy <= high_negative_energy + factor = 100 + } + set_variable = { + name = strongest_ai_value + value = flag:negative_energy + } + } + 1 = { #negative honor + trigger = { ai_honor < 0 } + modifier = { + ai_honor <= low_negative_honor + factor = 100 + } + modifier = { + ai_honor <= medium_negative_honor + factor = 100 + } + modifier = { + ai_honor <= high_negative_honor + factor = 100 + } + set_variable = { + name = strongest_ai_value + value = flag:negative_honor + } + } + 1 = { #negative rationality + trigger = { ai_rationality < 0 } + modifier = { + ai_rationality <= low_negative_rationality + factor = 100 + } + modifier = { + ai_rationality <= medium_negative_rationality + factor = 100 + } + modifier = { + ai_rationality <= high_negative_rationality + factor = 100 + } + set_variable = { + name = strongest_ai_value + value = flag:negative_rationality + } + } + 1 = { #negative vengefulness + trigger = { ai_vengefulness < 0 } + modifier = { + ai_vengefulness <= low_negative_vengefulness + factor = 100 + } + modifier = { + ai_vengefulness <= medium_negative_vengefulness + factor = 100 + } + modifier = { + ai_vengefulness <= high_negative_vengefulness + factor = 100 + } + set_variable = { + name = strongest_ai_value + value = flag:negative_vengefulness + } + } + 1 = { #negative zeal + trigger = { ai_zeal < 0 } + modifier = { + ai_zeal <= low_negative_zeal + factor = 100 + } + modifier = { + ai_zeal <= medium_negative_zeal + factor = 100 + } + modifier = { + ai_zeal <= high_negative_zeal + factor = 100 + } + set_variable = { + name = strongest_ai_value + value = flag:negative_zeal + } + } + } +} + +ai_chance_to_become_conqueror_effect = { + save_scope_as = possible_conqueror + if = { + limit = { + NOT = { has_game_rule = no_conquerors_frequency } + ai_has_cautious_personality = no + top_liege = this + is_landed = yes + is_adult = yes + age <= 60 + NOT = { is_incapable = yes } + ai_boldness >= 0 + ai_greed >= 0 + gold >= 50 + is_at_war = no + highest_held_title_tier >= tier_duchy + domain_size >= 3 + NOR = { + any_ally = { + is_ai = no # Would be annoying as conquerors don't help their allies + } + mpo_has_gok_mongol_empire_trigger = yes + has_character_flag = used_to_be_conqueror + } + any_neighboring_and_across_water_top_liege_realm_owner = { + scope:possible_conqueror = { + has_any_cb_on = prev + current_military_strength >= prev.current_military_strength + } + } + NOT = { + any_owned_story = { + story_type = story_take_mandate_of_heaven + } + } + trigger_if = { + limit = { + OR = { + has_game_rule = strong_default_conquerors_frequency + has_game_rule = strong_few_conquerors_frequency + has_game_rule = strong_very_few_conquerors_frequency + has_game_rule = strong_many_conquerors_frequency + } + } + sub_realm_size >= 15 + domain_size >= 4 + current_military_strength >= 3000 + gold >= 500 + age <= 35 + } + OR = { + AND = { + is_ai = no + NOT = { has_game_rule = no_conquerors_bonuses } + } + AND = { + exists = global_var:active_conquerors + global_var:active_conquerors < 12 + } + } + } + random = { + chance = { + value = 0.25 + add = { + value = primary_title.tier + divide = 12 + } + if = { + limit = { + martial >= 10 + } + add = { + value = martial + divide = 5 + } + } + if = { + limit = { + intrigue >= 10 + } + add = { + value = intrigue + divide = 10 + } + } + if = { + limit = { + diplomacy >= 10 + } + add = { + value = diplomacy + divide = 10 + } + } + if = { + limit = { + has_trait = brave + } + add = 0.25 + } + if = { + limit = { + has_trait = ambitious + } + add = 0.5 + } + if = { + limit = { + has_trait = compassionate + } + add = -0.25 + } + if = { + limit = { + has_trait = shy + } + add = -0.25 + } + if = { + limit = { + has_trait = lazy + } + add = -0.25 + } + if = { + limit = { + has_trait = content + } + add = -1 + } + if = { + limit = { + has_trait = craven + } + add = -1 + } + if = { + limit = { + ai_has_warlike_personality = yes + } + add = 0.25 + } + if = { + limit = { + OR = { + government_has_flag = government_is_tribal + government_has_flag = government_is_clan + } + } + add = 1.5 + } + if = { + limit = { + government_has_flag = government_is_nomadic + } + add = 2 + } + if = { + limit = { + government_has_flag = government_is_nomadic + highest_held_title_tier >= tier_kingdom + domicile.herd >= 10000 + } + add = 2 + } + if = { + limit = { + gold >= massive_gold_value + } + add = 0.25 + } + if = { + limit = { + war_chest_gold >= war_chest_gold_maximum + } + add = 0.25 + } + if = { + limit = { + culture = { has_cultural_pillar = ethos_bellicose } + } + add = 0.25 + } + if = { + limit = { + prestige_level >= 3 + } + add = 0.25 + } + if = { + limit = { + faith = { has_doctrine = tenet_warmonger } + } + add = 0.25 + } + if = { + limit = { + culture = { has_cultural_parameter = reduced_cost_for_conversion_to_pacifist_faith } + } + add = -0.25 + } + if = { + limit = { + faith = { has_doctrine_parameter = pacifist_opinion_active } + } + add = -0.25 + } + if = { + limit = { + ai_has_economical_boom_personality = yes + } + add = -0.25 + } + if = { + limit = { + can_use_conquest_cbs_trigger = yes + } + add = 2 + } + if = { + limit = { + can_use_conquest_cbs_trigger = no + } + add = -0.5 + } + if = { + limit = { + can_use_conquest_cbs_trigger = yes + primary_title.tier >= tier_kingdom + prestige_level >= 2 + gold >= major_gold_value + } + add = 4 + } + if = { # Caliphs/caliph-holders should often become conquerors + limit = { + faith = { has_doctrine = doctrine_temporal_head } + OR = { + this = faith.religious_head + any_vassal_or_below = { + this = faith.religious_head + } + } + } + add = 5 + } + if = { + limit = { + primary_title = { has_title_law = princely_elective_succession_law } + } + add = -0.25 + } + if = { + limit = { + has_trait = education_martial_5 + } + add = 1 + } + if = { + limit = { + is_ai = yes + OR = { + has_character_modifier = bp2_destined_modifier + has_character_modifier = bp2_tool_of_fate_modifier + } + } + add = 2 + } + if = { + limit = { + is_ai = yes + OR = { + has_character_modifier = a_cultures_great_defender_modifier + has_character_modifier = inspired_defenders_modifier + has_character_modifier = uniter_and_conqueror_modifier + } + } + add = 2 + } + if = { + limit = { + is_ai = no + } + add = -2.5 + } + if = { + limit = { + is_ai = no + has_game_rule = hard_difficulty + } + add = -7.5 + } + else_if = { + limit = { + is_ai = no + has_game_rule = very_hard_difficulty + } + add = -50 + } + if = { + limit = { + is_ai = yes + AND = { + exists = global_var:active_conquerors + global_var:active_conquerors >= 3 + } + } + add = -1 + } + if = { + limit = { + is_ai = yes + AND = { + exists = global_var:active_conquerors + global_var:active_conquerors >= 5 + } + } + add = -3.5 + } + if = { + limit = { + is_ai = yes + AND = { + exists = global_var:active_conquerors + global_var:active_conquerors >= 7 + } + } + add = -2 + } + if = { + limit = { + is_ai = yes + AND = { + exists = global_var:active_conquerors + global_var:active_conquerors >= 10 + } + } + add = -2 + } + if = { + limit = { + is_ai = no + OR = { + has_character_modifier = bp2_destined_modifier + has_character_modifier = bp2_tool_of_fate_modifier + } + } + multiply = 5 + } + if = { + limit = { + is_ai = no + OR = { + has_character_modifier = a_cultures_great_defender_modifier + has_character_modifier = inspired_defenders_modifier + has_character_modifier = uniter_and_conqueror_modifier + } + } + multiply = 5 + } + if = { + limit = { + OR = { + has_game_rule = few_conquerors_frequency + has_game_rule = strong_few_conquerors_frequency + } + } + multiply = 0.5 + } + if = { + limit = { + OR = { + has_game_rule = very_few_conquerors_frequency + has_game_rule = strong_very_few_conquerors_frequency + } + } + multiply = 0.1 + } + if = { + limit = { + is_ai = yes + has_game_rule = strong_many_conquerors_frequency + } + add = 0.5 + } + if = { + limit = { + is_ai = yes + OR = { + has_game_rule = many_conquerors_frequency + has_game_rule = strong_many_conquerors_frequency + } + } + add = 0.5 + multiply = 2 + } + } + if = { + limit = { + is_ai = no + } + trigger_event = { + id = conqueror.0001 + days = 10 + } + } + else = { + trigger_event = conqueror.0001 + } + } + } +} + +ai_chance_to_become_mandala_godking_effect = { + save_scope_as = possible_godking + if = { + limit = { + top_overlord = this + is_landed = yes + age <= 50 + NOT = { is_incapable = yes } + is_ai = yes + is_at_war = no + trigger_if = { + limit = { exists = global_var:active_mandalas } + global_var:active_mandalas < 5 + } + any_neighboring_and_across_water_top_liege_realm_owner = { + OR = { + current_military_strength < scope:possible_godking.current_military_strength + any_tributary = { + in_diplomatic_range = scope:possible_godking + current_military_strength < scope:possible_godking.current_military_strength + } + } + } + #There aren't already 2 active Mandala Capitals in the dejure Kingdom + less_than_max_amount_of_mandala_capitals_trigger = yes + } + + random = { + chance = { + value = 50 + #If has Mandala Capital or Ruined Capital make into 100 + if = { + limit = { has_mandala_capital_trigger = yes } + add = 100 + } + add = primary_title.tier + if = { + limit = { martial >= 10 } + add = { + value = martial + divide = 5 + } + } + if = { + limit = { intrigue >= 10 } + add = { + value = intrigue + divide = 10 + } + } + if = { + limit = { diplomacy >= 10 } + add = { + value = diplomacy + divide = 10 + } + } + if = { + limit = { stewardship >= 10 } + add = { + value = stewardship + divide = 10 + } + } + if = { + limit = { learning >= 10 } + add = { + value = learning + divide = 10 + } + } + if = { + limit = { has_trait = zealous } + add = 1 + } + if = { + limit = { has_trait = pilgrim } + add = 1 + } + if = { + limit = { has_trait = brave } + add = 0.25 + } + if = { + limit = { has_trait = ambitious } + add = 0.5 + } + if = { + limit = { has_trait = compassionate } + add = -0.25 + } + if = { + limit = { has_trait = shy } + add = -0.25 + } + if = { + limit = { has_trait = lazy } + add = -0.25 + } + if = { + limit = { has_trait = content } + add = -1 + } + if = { + limit = { has_trait = craven } + add = -1 + } + if = { + limit = { has_trait = cynical } + add = -1 + } + if = { + limit = { gold >= massive_gold_value } + add = 1 + } + if = { + limit = { + house = { has_house_power_parameter = aspect_of_destruction } + war_chest_gold >= war_chest_gold_maximum + } + add = 1 + } + add = piety_level + if = { + limit = { + OR = { + has_trait = education_diplomacy_5 + has_trait = education_stewardship_5 + has_trait = education_intrigue_5 + has_trait = education_martial_5 + } + } + add = 1 + } + } + create_story = story_mandala + } + } +} diff --git a/N3OW/common/scripted_effects/00_alert_actions_effects.txt b/N3OW/common/scripted_effects/00_alert_actions_effects.txt new file mode 100644 index 00000000..6fcbfb72 --- /dev/null +++ b/N3OW/common/scripted_effects/00_alert_actions_effects.txt @@ -0,0 +1,32 @@ +try_create_lawfully_imprison = { + if = { + limit = { + is_imprisoned = no + root = { + has_imprisonment_reason = prev + } + } + try_create_important_action = { + important_action_type = action_can_lawfully_imprison + actor = root + recipient = this + } + } +} + +try_create_pardon = { + if = { + limit = { + target_is_liege_or_above = root + is_imprisoned = no + root = { + has_imprisonment_reason = prev + } + } + try_create_important_action = { + important_action_type = action_can_pardon + actor = root + recipient = this + } + } +} \ No newline at end of file diff --git a/N3OW/common/scripted_effects/00_almohad_invasion_effects.txt b/N3OW/common/scripted_effects/00_almohad_invasion_effects.txt new file mode 100644 index 00000000..362ba391 --- /dev/null +++ b/N3OW/common/scripted_effects/00_almohad_invasion_effects.txt @@ -0,0 +1,376 @@ +find_title_for_almohad_spawn_effect = { + if = { # The important thing is to not mess too much with players who can't resist + limit = { + title:c_tinmallal = { + holder = { is_ai = yes } + OR = { + NOT = { exists = duchy.holder } + duchy.holder = { is_ai = yes } + } + } + } + title:c_tinmallal = { + save_scope_as = almohad_county + } + } + else = { + title:k_maghreb = { + random_in_de_jure_hierarchy = { + continue = { tier > tier_county } + limit = { + tier = tier_county + holder = { is_ai = yes } # Let's not murder players + NOT = { this = title:c_marrakesh } + save_temporary_scope_as = potential_almohad_county + # If someone holds k_maghreb, put the Almohads in their realm + trigger_if = { + limit = { exists = title:k_maghreb.holder } + title:k_maghreb.holder = { + OR = { + this = scope:potential_almohad_county.holder + any_sub_realm_county = { + this = scope:potential_almohad_county + } + } + } + } + # Either this should be the holder's only title, or it should NOT be their capital + trigger_if = { + limit = { + holder = { + any_sub_realm_county = { count > 1 } + } + } + this != holder.capital_county + } + } + weight = { + base = 1 + # Prefer already Muslim counties + modifier = { + add = 5 + religion = religion:islam_religion + } + # Massively prefer to avoid a player-held Duchies if possible + modifier = { + factor = 0.01 + exists = duchy.holder + duchy.holder = { is_ai = no } + } + } + save_scope_as = almohad_county + } + } + } + + if = { # Discard stuff from here on out + limit = { NOT = { exists = scope:almohad_county } } + debug_log = "No Almohad title found, Almohad's won't spawn" + } + # Convert the County and warn relevant people + else = { + set_global_variable = { + name = spawned_almohads + value = yes + } + scope:almohad_county = { + set_county_faith = faith:masmudi + } + scope:almohad_county.holder = { + if = { + limit = { + is_ai = no + } + trigger_event = almohad.1001 + } + every_liege_or_above = { + limit = { is_ai = no } + trigger_event = almohad.1001 + } + } + trigger_event = { # Random amount of time to convert the province or otherwise prepare + id = almohad.0002 + days = { 400 1000 } + } + } +} + + +create_almohads_effect = { + create_character = { + template = ibn_tumart_character_template + name = Amghar_ibn_Tumert + location = scope:almohad_county.title_province + dynasty_house = house:house_tumert + save_scope_as = ibn_tumart + } + faith:masmudi = { + change_fervor = { + value = 50 + desc = fervor_gain_almohads + } + } + scope:ibn_tumart = { + create_story = { + type = story_almohad_invasion + save_scope_as = story + } + add_pressed_claim = title:k_maghreb + add_character_modifier = { + modifier = almohad_leader_modifier + } + add_character_flag = { + flag = immune_to_disease + years = 15 + } + } + scope:story = { + set_variable = { + name = ibn_tumart + value = scope:ibn_tumart + } + set_variable = { + name = almohad_county + value = scope:almohad_county + } + } + almohads_find_target_titles_effect = yes + + find_almohad_titles_and_assign_to_ibn_tumart_effect = yes + + create_character = { + template = abd_al_mumin_character_template + name = Abd_al_Mu_min + employer = scope:ibn_tumart + dynasty_house = house:house_almohad + save_scope_as = al_mumin + } + scope:al_mumin = { + add_pressed_claim = title:k_maghreb + add_character_modifier = { + modifier = almohad_leader_modifier + } + add_character_flag = { + flag = immune_to_disease + years = 15 + } + } + scope:story = { + set_variable = { + name = al_mumin + value = scope:al_mumin + } + } + + scope:almohad_county.holder = { + set_global_variable = { + name = almohads_waiting_for_player_responses + value = 0 + years = 1 # Clear out eventually, just in case + } + set_global_variable = { + name = almohads_player_responses_received + value = 0 + years = 1 # Clear out eventually, just in case + } + if = { + limit = { is_ai = no } + change_global_variable = { + name = almohads_waiting_for_player_responses + add = 1 + } + trigger_event = almohad.1002 + } + every_liege_or_above = { + limit = { is_ai = no } + change_global_variable = { + name = almohads_waiting_for_player_responses + add = 1 + } + trigger_event = almohad.1002 + } + if = { + limit = { + global_var:almohads_waiting_for_player_responses = 0 + } + remove_global_variable = almohads_waiting_for_player_responses + remove_global_variable = almohads_player_responses_received + almohads_go_to_war_effect = yes + } + else = { + trigger_event = { + id = almohad.0004 + days = 5 + } + } + } +} + +find_almohad_titles_and_assign_to_ibn_tumart_effect = { + + create_title_and_vassal_change = { + type = usurped + save_scope_as = change + add_claim_on_loss = no + } + scope:almohad_county = { + change_title_holder = { + holder = scope:ibn_tumart + change = scope:change + take_baronies = yes + } + } + resolve_title_and_vassal_change = scope:change + + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + scope:ibn_tumart.faith.religious_head_title = { + change_title_holder = { + holder = scope:ibn_tumart + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change +} + +almohads_go_to_war_effect = { + scope:ibn_tumart = { + almohads_become_independent_effect = yes + almohads_declare_war_for_target_title_effect = yes + spawn_first_almohad_troops_effect = yes + } +} + +almohads_become_independent_effect = { + hidden_effect = { + if = { + limit = { scope:ibn_tumart = { is_imprisoned = yes } } + scope:ibn_tumart = { release_from_prison = yes } + } + } + create_title_and_vassal_change = { + type = independency + save_scope_as = going_independent + add_claim_on_loss = no + } + scope:ibn_tumart = { + becomes_independent = { + change = scope:going_independent + } + } + + resolve_title_and_vassal_change = scope:going_independent +} + +almohads_find_target_titles_effect = { + if = { + limit = { exists = title:k_maghreb.holder } + title:k_maghreb = { + save_scope_as = maghreb_target_title + holder = { + save_scope_as = first_target + } + } + if = { + limit = { + NOT = { scope:almohad_county.holder.top_liege = title:k_maghreb.holder.top_liege } + scope:almohad_county.holder.top_liege = { + any_sub_realm_county = { + this != scope:almohad_county + kingdom = title:k_maghreb + } + } + } + scope:almohad_county.holder.top_liege = { + save_scope_as = second_target + } + } + } + else = { + ordered_independent_ruler = { + limit = { highest_held_title_tier > tier_county } + order_by = titles_held_in_k_maghreb + position = 0 + save_scope_as = first_target + } + } +} + + +almohads_declare_war_for_target_title_effect = { + save_scope_as = war_leader + if = { + limit = { exists = scope:first_target } + start_war = { + cb = claim_cb + target = scope:first_target + claimant = scope:war_leader + target_title = scope:maghreb_target_title + } + + if = { + limit = { + exists = scope:second_target + NOT = { exists = global_var:almohads_do_not_attack_second_target } + } + start_war = { + cb = claim_cb + target = scope:second_target + claimant = scope:war_leader + target_title = scope:maghreb_target_title + } + } + } + if = { + limit = { exists = global_var:almohads_do_not_attack_second_target } + remove_global_variable = almohads_do_not_attack_second_target + } + else = { + debug_log = "Failed to find a valid war target for the Almohads!" + } +} + + +spawn_first_almohad_troops_effect = { + spawn_army = { + uses_supply = yes + inheritable = no + name = first_almohad_event_troops + levies = { + value = 1000 + } + location = scope:ibn_tumart.capital_province + } +} + +spawn_second_almohad_troops_effect = { + if = { + limit = { + is_at_war = yes + } + ordered_war_enemy = { + order_by = max_military_strength + position = 0 + save_scope_as = powerful_war_enemy + } + spawn_army = { + uses_supply = yes + inheritable = no + name = second_almohad_event_troops + levies = { + if = { + limit = { exists = scope:powerful_war_enemy } + add = scope:powerful_war_enemy.max_military_strength + multiply = 2 + } + else = { + add = 3000 + } + } + location = capital_province + } + } +} diff --git a/N3OW/common/scripted_effects/00_animal_effects.txt b/N3OW/common/scripted_effects/00_animal_effects.txt new file mode 100644 index 00000000..0272a049 --- /dev/null +++ b/N3OW/common/scripted_effects/00_animal_effects.txt @@ -0,0 +1,2339 @@ +#Effects used in animal events + + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects here !!! +# + +# CAT +#start_cat_story_cycle_effect +#assign_name_options_cat_story_cycle_effect +#assign_cat_gender_effect +#assign_cat_fur_color_effect +#assign_cat_eye_color_effect +#remove_cat_story_modifiers_effect +#transfer_cat_story_cycle_to_effect + +#DOG +#start_dog_story_cycle_effect +#assign_name_options_dog_story_cycle_effect +#assign_dog_gender_effect +#assign_dog_fur_color_effect +#assign_dog_eye_color_effect +#dog_got_pregnant_effect +#remove_dog_story_modifiers_effect +#transfer_dog_story_cycle_to_effect + +#WARHORSE +#start_warhorse_story_cycle_effect +#assign_horse_gender_effect +#level_horse_modifier_effect +#remove_horse_story_modifiers_effect + +#EAGLE +#start_eagle_story_cycle_effect +#assign_eagle_gender_effect +#assign_name_options_eagle_story_cycle_effect + +###################################################################### +# EFFECTS +###################################################################### + +######## +# CAT +######## + +#Effect to start the story and show the right modifier +start_cat_story_cycle_effect = { + show_as_tooltip = { + add_character_modifier = { + modifier = cat_story_modifier + } + } + hidden_effect = { + create_story = story_cycle_pet_cat + } +} + +#Pick out name options to show +assign_name_options_cat_story_cycle_effect = { + random_list = { + 1 = { #A cat who prowled around Beaulieu Abbey in the 13th century + trigger = { NOT = { has_character_flag = name_mite } } + add_character_flag = name_mite + } + 1 = { + trigger = { NOT = { has_character_flag = name_paws } } + add_character_flag = name_paws + } + 1 = { + trigger = { NOT = { has_character_flag = name_mittens } } + add_character_flag = name_mittens + } + 10 = { + trigger = { + NOT = { has_character_flag = name_gray } + scope:story.var:cat_fur_color = flag:gray + } + add_character_flag = name_gray + } + 10 = { + trigger = { + NOT = { has_character_flag = name_flame } + scope:story.var:cat_fur_color = flag:orange + } + add_character_flag = name_flame + } + 10 = { + trigger = { + NOT = { has_character_flag = name_snow } + scope:story.var:cat_fur_color = flag:white + } + add_character_flag = name_snow + } + 10 = { + trigger = { + NOT = { has_character_flag = name_shadow } + scope:story.var:cat_fur_color = flag:black + } + add_character_flag = name_shadow + } + 10 = { + trigger = { + NOT = { has_character_flag = name_spooky } + scope:story.var:cat_fur_color = flag:black + } + add_character_flag = name_spooky + } + 10 = { #Short form of Gilbert - lots of domesticated cats had this name + trigger = { + NOT = { has_character_flag = name_gyb } + has_culture = culture:english + } + add_character_flag = name_gyb + } + 10 = { #From old Irish legal texts + trigger = { + NOT = { has_character_flag = name_meone } + culture = { has_cultural_pillar = heritage_goidelic } + } + add_character_flag = name_meone + } + 10 = { #From old Irish legal texts + trigger = { + NOT = { has_character_flag = name_cruibne } + culture = { has_cultural_pillar = heritage_goidelic } + } + add_character_flag = name_cruibne + } + } +} + +#Assign the gender of the cat +assign_cat_gender_effect = { + save_temporary_scope_value_as = { + name = gender + value = flag:$GENDER$ + } + if = { + limit = { scope:gender = flag:random } + hidden_effect = { + random_list = { + 50 = { + set_variable = { + name = cat_gender + value = flag:female + } + } + 50 = { + set_variable = { + name = cat_gender + value = flag:male + } + } + } + } + } + else_if = { + limit = { + OR = { + scope:gender = flag:male + scope:gender = flag:female + } + } + set_variable = { + name = cat_gender + value = flag:$GENDER$ + } + } +} + +#Assign the fur-color of the cat +assign_cat_fur_color_effect = { + save_temporary_scope_value_as = { + name = fur_color + value = flag:$COLOR$ + } + if = { + limit = { scope:fur_color = flag:random } + hidden_effect = { + random_list = { + 50 = { + set_variable = { + name = cat_fur_color + value = flag:brown + } + } + 50 = { + set_variable = { + name = cat_fur_color + value = flag:gray + } + } + 50 = { + set_variable = { + name = cat_fur_color + value = flag:orange + } + } + 50 = { + set_variable = { + name = cat_fur_color + value = flag:black + } + } + 50 = { + set_variable = { + name = cat_fur_color + value = flag:white + } + } + } + } + } + else_if = { + limit = { + OR = { + scope:fur_color = flag:brown + scope:fur_color = flag:gray + scope:fur_color = flag:orange + scope:fur_color = flag:black + scope:fur_color = flag:white + } + } + set_variable = { + name = cat_fur_color + value = flag:$COLOR$ + } + } +} + +#Assign the eye-color of the cat +assign_cat_eye_color_effect = { + save_temporary_scope_value_as = { + name = eye_color + value = flag:$COLOR$ + } + if = { + limit = { scope:eye_color = flag:random } + hidden_effect = { + random_list = { + 50 = { + set_variable = { + name = cat_eye_color + value = flag:blue + } + } + 50 = { + set_variable = { + name = cat_eye_color + value = flag:yellow + } + } + 50 = { + set_variable = { + name = cat_eye_color + value = flag:green + } + } + 50 = { + set_variable = { + name = cat_eye_color + value = flag:amber + } + } + 50 = { + set_variable = { + name = cat_eye_color + value = flag:copper + } + } + 50 = { + set_variable = { + name = cat_eye_color + value = flag:emerald + } + } + } + } + } + else_if = { + limit = { + OR = { + scope:eye_color = flag:blue + scope:eye_color = flag:yellow + scope:eye_color = flag:green + scope:eye_color = flag:amber + scope:eye_color = flag:copper + scope:eye_color = flag:emerald + } + } + set_variable = { + name = cat_eye_color + value = flag:$COLOR$ + } + } +} + +#Remove everything related to the story +remove_cat_story_modifiers_effect = { + if = { + limit = { + has_character_modifier = cat_story_modifier + } + remove_character_modifier = cat_story_modifier + } + if = { + limit = { + has_character_modifier = cat_story_allergy_modifier + } + remove_character_modifier = cat_story_allergy_modifier + } + if = { + limit = { + any_spouse = { + has_character_modifier = cat_story_allergy_modifier + } + } + random_spouse = { + limit = { + has_character_modifier = cat_story_allergy_modifier + } + remove_character_modifier = cat_story_allergy_modifier + } + } + if = { + limit = { + has_character_modifier = rat_hunting_cat_modifier + } + remove_character_modifier = rat_hunting_cat_modifier + } + if = { + limit = { + has_character_modifier = adventurous_pet_modifier + } + remove_character_modifier = adventurous_pet_modifier + } + if = { + limit = { + has_character_modifier = feral_pet_modifier + } + remove_character_modifier = feral_pet_modifier + } + if = { + limit = { + has_character_modifier = feast_well_fed_cat_modifier + } + remove_character_modifier = feast_well_fed_cat_modifier + } +} + +remove_cat_name_effect = { + remove_variable = story_cycle_cat_name + remove_variable = cat_city + remove_localized_text = story_cycle_cat_name +} + +#Effect to transfer the story to another character +transfer_cat_story_cycle_to_effect = { + remove_cat_story_modifiers_effect = yes + + save_scope_as = original_owner + + $CHARACTER$ = { + if = { + limit = { + scope:original_owner = { + has_variable = cat_city + } + } + set_variable = { + name = cat_city + value = scope:original_owner.var:cat_city + } + } + set_variable = { + name = story_cycle_cat_name + value = $STORY$.var:story_cycle_cat_name + } + if = { + limit = { + scope:original_owner = { is_alive = yes } + } + copy_localized_text = { + key = story_cycle_cat_name + target = scope:original_owner + } + } + add_character_modifier = { + modifier = cat_story_modifier + } + add_character_flag = had_cat_story + } + + remove_cat_name_effect = yes + + $STORY$ = { + make_story_owner = $CHARACTER$ + } +} + + +######## +# DOG +######## + +#Effect to start the story and show the right modifier +start_dog_story_cycle_effect = { + show_as_tooltip = { + add_character_modifier = { + modifier = dog_story_modifier + } + } + hidden_effect = { + create_story = story_cycle_pet_dog + } +} + +#Pick out name options to show +assign_name_options_dog_story_cycle_effect = { + random_list = { + 1 = { + trigger = { NOT = { has_character_flag = name_amiable } } + add_character_flag = name_amiable + } + 1 = { + trigger = { NOT = { has_character_flag = name_nosewise } } + add_character_flag = name_nosewise + } + 1 = { + trigger = { NOT = { has_character_flag = name_holdfast } } + add_character_flag = name_holdfast + } + 10 = { + trigger = { + NOT = { has_character_flag = name_gray } + scope:story.var:dog_fur_color = flag:gray + } + add_character_flag = name_gray + } + 10 = { + trigger = { + NOT = { has_character_flag = name_choplicker } + scope:story.var:dog_fur_color = flag:black + } + add_character_flag = name_choplicker + } + 10 = { + trigger = { + NOT = { has_character_flag = name_shadow } + scope:story.var:dog_fur_color = flag:black + } + add_character_flag = name_shadow + } + 10 = { + trigger = { + NOT = { has_character_flag = name_snow } + scope:story.var:dog_fur_color = flag:white + } + add_character_flag = name_snow + } + } +} + +#Assign the gender of the dog +assign_dog_gender_effect = { + save_temporary_scope_value_as = { + name = gender + value = flag:$GENDER$ + } + if = { + limit = { scope:gender = flag:random } + hidden_effect = { + random_list = { + 50 = { + set_variable = { + name = dog_gender + value = flag:female + } + } + 50 = { + set_variable = { + name = dog_gender + value = flag:male + } + } + } + } + } + else_if = { + limit = { + OR = { + scope:gender = flag:male + scope:gender = flag:female + } + } + set_variable = { + name = dog_gender + value = flag:$GENDER$ + } + } +} + +#Assign the fur-color of the dog +assign_dog_fur_color_effect = { + save_temporary_scope_value_as = { + name = fur_color + value = flag:$COLOR$ + } + if = { + limit = { scope:fur_color = flag:random } + hidden_effect = { + random_list = { + 50 = { + set_variable = { + name = dog_fur_color + value = flag:brown + } + } + 50 = { + set_variable = { + name = dog_fur_color + value = flag:gray + } + } + 50 = { + set_variable = { + name = dog_fur_color + value = flag:black + } + } + 50 = { + set_variable = { + name = dog_fur_color + value = flag:white + } + } + } + } + } + else_if = { + limit = { + OR = { + scope:fur_color = flag:brown + scope:fur_color = flag:gray + scope:fur_color = flag:black + scope:fur_color = flag:white + } + } + set_variable = { + name = dog_fur_color + value = flag:$COLOR$ + } + } +} + +#Assign the eye-color of the dog +assign_dog_eye_color_effect = { + save_temporary_scope_value_as = { + name = eye_color + value = flag:$COLOR$ + } + if = { + limit = { scope:eye_color = flag:random } + hidden_effect = { + random_list = { + 50 = { + set_variable = { + name = dog_eye_color + value = flag:blue + } + } + 50 = { + set_variable = { + name = dog_eye_color + value = flag:amber + } + } + 50 = { + set_variable = { + name = dog_eye_color + value = flag:gray + } + } + 50 = { + set_variable = { + name = dog_eye_color + value = flag:brown + } + } + } + } + } + else_if = { + limit = { + OR = { + scope:eye_color = flag:blue + scope:eye_color = flag:amber + scope:eye_color = flag:gray + scope:eye_color = flag:brown + } + } + set_variable = { + name = dog_eye_color + value = flag:$COLOR$ + } + } +} + +dog_got_pregnant_effect = { + custom_tooltip = dog_got_pregnant_tooltip + trigger_event = { + id = pet_animal.1190 + days = { 58 68 } + } +} + +#Remove everything related to the story +remove_dog_story_modifiers_effect = { + if = { + limit = { + has_character_modifier = dog_story_modifier + } + remove_character_modifier = dog_story_modifier + } + if = { + limit = { + has_character_modifier = dog_story_walking_modifier + } + remove_character_modifier = dog_story_walking_modifier + } + if = { + limit = { + has_character_modifier = rat_hunting_dog_modifier + } + remove_character_modifier = rat_hunting_dog_modifier + } + if = { + limit = { + has_character_modifier = adventurous_pet_modifier + } + remove_character_modifier = adventurous_pet_modifier + } + if = { + limit = { + has_character_modifier = feral_pet_modifier + } + remove_character_modifier = feral_pet_modifier + } + if = { + limit = { + has_character_modifier = dog_story_scenthound_modifier + } + remove_character_modifier = dog_story_scenthound_modifier + } + if = { + limit = { + has_character_modifier = dog_story_beasthound_modifier + } + remove_character_modifier = dog_story_beasthound_modifier + } + if = { + limit = { + has_character_modifier = feast_well_fed_dog_modifier + } + remove_character_modifier = feast_well_fed_dog_modifier + } +} + +remove_dog_name_effect = { + remove_variable = story_cycle_dog_name + remove_localized_text = story_cycle_dog_name +} + +#Effect to transfer the story to another character +transfer_dog_story_cycle_to_effect = { + remove_dog_story_modifiers_effect = yes + + save_temporary_scope_as = original_owner + + $CHARACTER$ = { + set_variable = { + name = story_cycle_dog_name + value = $STORY$.var:story_cycle_dog_name + } + if = { + limit = { + scope:original_owner = { is_alive = yes } + } + copy_localized_text = { + key = story_cycle_dog_name + target = scope:original_owner + } + } + add_character_modifier = { + modifier = dog_story_modifier + } + add_character_flag = had_dog_story + } + + remove_dog_name_effect = yes + + $STORY$ = { + make_story_owner = $CHARACTER$ + } +} + + +######## +# WARHORSE +######## + +#Effect to start the story and show the right modifier +start_warhorse_story_cycle_effect = { + show_as_tooltip = { + add_character_modifier = { + modifier = horse_story_modifier + } + } + hidden_effect = { + create_story = story_cycle_martial_lifestyle_warhorse + } +} + +assign_horse_gender_effect = { + save_temporary_scope_value_as = { + name = gender + value = flag:$GENDER$ + } + if = { + limit = { scope:gender = flag:random } + hidden_effect = { + random_list = { + 50 = { + set_variable = { + name = horse_gender + value = flag:female + } + } + 50 = { + set_variable = { + name = horse_gender + value = flag:male + } + } + } + } + } + else_if = { + limit = { + OR = { + scope:gender = flag:male + scope:gender = flag:female + } + } + set_variable = { + name = horse_gender + value = flag:$GENDER$ + } + } +} + +level_horse_modifier_effect = { + if = { + limit = { + OR = { #first generation horse modifier + has_character_modifier = horse_strength_modifier + has_character_modifier = horse_agility_modifier + has_character_modifier = horse_endurance_modifier + has_character_modifier = horse_fierceness_modifier + } + } + if = { + limit = { + scope:horse_skill_to_level = flag:strength + } + if = { + limit = { + has_character_modifier = horse_strength_modifier + } + remove_character_modifier = horse_strength_modifier + add_character_modifier = { + modifier = horse_strength_strength_modifier + } + } + else_if = { + limit = { + has_character_modifier = horse_agility_modifier + } + remove_character_modifier = horse_agility_modifier + add_character_modifier = { + modifier = horse_agility_strength_modifier + } + } + else_if = { + limit = { + has_character_modifier = horse_endurance_modifier + } + remove_character_modifier = horse_endurance_modifier + add_character_modifier = { + modifier = horse_endurance_strength_modifier + } + } + else_if = { + limit = { + has_character_modifier = horse_fierceness_modifier + } + remove_character_modifier = horse_fierceness_modifier + add_character_modifier = { + modifier = horse_fierceness_strength_modifier + } + } + } + else_if = { + limit = { + scope:horse_skill_to_level = flag:agility + } + if = { + limit = { + has_character_modifier = horse_strength_modifier + } + remove_character_modifier = horse_strength_modifier + add_character_modifier = { + modifier = horse_agility_strength_modifier + } + } + else_if = { + limit = { + has_character_modifier = horse_agility_modifier + } + remove_character_modifier = horse_agility_modifier + add_character_modifier = { + modifier = horse_agility_agility_modifier + } + } + else_if = { + limit = { + has_character_modifier = horse_endurance_modifier + } + remove_character_modifier = horse_endurance_modifier + add_character_modifier = { + modifier = horse_endurance_agility_modifier + } + } + else_if = { + limit = { + has_character_modifier = horse_fierceness_modifier + } + remove_character_modifier = horse_fierceness_modifier + add_character_modifier = { + modifier = horse_fierceness_agility_modifier + } + } + } + else_if = { + limit = { + scope:horse_skill_to_level = flag:endurance + } + if = { + limit = { + has_character_modifier = horse_strength_modifier + } + remove_character_modifier = horse_strength_modifier + add_character_modifier = { + modifier = horse_endurance_strength_modifier + } + } + else_if = { + limit = { + has_character_modifier = horse_agility_modifier + } + remove_character_modifier = horse_agility_modifier + add_character_modifier = { + modifier = horse_endurance_agility_modifier + } + } + else_if = { + limit = { + has_character_modifier = horse_endurance_modifier + } + remove_character_modifier = horse_endurance_modifier + add_character_modifier = { + modifier = horse_endurance_endurance_modifier + } + } + else_if = { + limit = { + has_character_modifier = horse_fierceness_modifier + } + remove_character_modifier = horse_fierceness_modifier + add_character_modifier = { + modifier = horse_fierceness_endurance_modifier + } + } + } + else_if = { + limit = { + scope:horse_skill_to_level = flag:fierceness + } + if = { + limit = { + has_character_modifier = horse_strength_modifier + } + remove_character_modifier = horse_strength_modifier + add_character_modifier = { + modifier = horse_fierceness_strength_modifier + } + } + else_if = { + limit = { + has_character_modifier = horse_agility_modifier + } + remove_character_modifier = horse_agility_modifier + add_character_modifier = { + modifier = horse_fierceness_agility_modifier + } + } + else_if = { + limit = { + has_character_modifier = horse_endurance_modifier + } + remove_character_modifier = horse_endurance_modifier + add_character_modifier = { + modifier = horse_fierceness_endurance_modifier + } + } + else_if = { + limit = { + has_character_modifier = horse_fierceness_modifier + } + remove_character_modifier = horse_fierceness_modifier + add_character_modifier = { + modifier = horse_fierceness_fierceness_modifier + } + } + } + set_variable = { + name = warhorse_modifier_level + value = 2 #In case we want to add more levels later + } + } + else_if = { + limit = { + has_character_modifier = horse_story_modifier + } + remove_character_modifier = horse_story_modifier + if = { + limit = { + scope:horse_skill_to_level = flag:strength + } + add_character_modifier = { + modifier = horse_strength_modifier + } + } + else_if = { + limit = { + scope:horse_skill_to_level = flag:agility + } + add_character_modifier = { + modifier = horse_agility_modifier + } + } + else_if = { + limit = { + scope:horse_skill_to_level = flag:endurance + } + add_character_modifier = { + modifier = horse_endurance_modifier + } + } + else_if = { + limit = { + scope:horse_skill_to_level = flag:fierceness + } + add_character_modifier = { + modifier = horse_fierceness_modifier + } + } + } +} + +remove_horse_story_modifiers_effect = { + if = { + limit = { + has_character_modifier = horse_story_modifier + } + remove_character_modifier = horse_story_modifier + } + if = { + limit = { + has_character_modifier = horse_strength_modifier + } + remove_character_modifier = horse_strength_modifier + } + if = { + limit = { + has_character_modifier = horse_agility_modifier + } + remove_character_modifier = horse_agility_modifier + } + if = { + limit = { + has_character_modifier = horse_endurance_modifier + } + remove_character_modifier = horse_endurance_modifier + } + if = { + limit = { + has_character_modifier = horse_fierceness_modifier + } + remove_character_modifier = horse_fierceness_modifier + } + if = { + limit = { + has_character_modifier = horse_strength_strength_modifier + } + remove_character_modifier = horse_strength_strength_modifier + } + if = { + limit = { + has_character_modifier = horse_agility_strength_modifier + } + remove_character_modifier = horse_agility_strength_modifier + } + if = { + limit = { + has_character_modifier = horse_agility_agility_modifier + } + remove_character_modifier = horse_agility_agility_modifier + } + if = { + limit = { + has_character_modifier = horse_endurance_strength_modifier + } + remove_character_modifier = horse_endurance_strength_modifier + } + if = { + limit = { + has_character_modifier = horse_endurance_agility_modifier + } + remove_character_modifier = horse_endurance_agility_modifier + } + if = { + limit = { + has_character_modifier = horse_endurance_endurance_modifier + } + remove_character_modifier = horse_endurance_endurance_modifier + } + if = { + limit = { + has_character_modifier = horse_fierceness_strength_modifier + } + remove_character_modifier = horse_fierceness_strength_modifier + } + if = { + limit = { + has_character_modifier = horse_fierceness_agility_modifier + } + remove_character_modifier = horse_fierceness_agility_modifier + } + if = { + limit = { + has_character_modifier = horse_fierceness_endurance_modifier + } + remove_character_modifier = horse_fierceness_endurance_modifier + } + if = { + limit = { + has_character_modifier = horse_fierceness_fierceness_modifier + } + remove_character_modifier = horse_fierceness_fierceness_modifier + } + if = { + limit = { + exists = var:warhorse_modifier_level + } + remove_variable = warhorse_modifier_level + } +} + + +### EAGLE +#Effect to start the story and show the right modifier +start_eagle_story_cycle_effect = { + if = { + limit = { + exists = scope:eagle_capture_method + } + if = { + limit = { + scope:eagle_capture_method = flag:standard + } + add_character_flag = eagle_capture_method_standard + } + else_if = { + limit = { + scope:eagle_capture_method = flag:lure + } + add_character_flag = eagle_capture_method_lure + } + else_if = { + limit = { + scope:eagle_capture_method = flag:stolen + } + add_character_flag = eagle_capture_method_stolen + } + else_if = { + limit = { + scope:eagle_capture_method = flag:gift + } + add_character_flag = eagle_capture_method_gift + } + else_if = { + limit = { + scope:eagle_capture_method = flag:market + } + add_character_flag = eagle_capture_method_market + } + } + else = { + add_character_flag = eagle_capture_method_none + } + add_character_modifier = { + modifier = eagle_story_modifier + } + hidden_effect = { + create_story = story_cycle_pet_eagle + } +} + +#Assign the gender of the eagle +assign_eagle_gender_effect = { + save_temporary_scope_value_as = { + name = gender + value = flag:$GENDER$ + } + if = { + limit = { scope:gender = flag:random } + hidden_effect = { + random_list = { + 80 = { # Female eagles are thought to be larger / fiercer + set_variable = { + name = eagle_gender + value = flag:female + } + } + 20 = { + set_variable = { + name = eagle_gender + value = flag:male + } + } + } + } + } + else_if = { + limit = { + OR = { + scope:gender = flag:male + scope:gender = flag:female + } + } + set_variable = { + name = eagle_gender + value = flag:$GENDER$ + } + } +} + +#Pick out name options to show +assign_name_options_eagle_story_cycle_effect = { + random_list = { + 10 = { + trigger = { + var:eagle_gender = flag:female + NOT = { any_in_list = { variable = story_cycle_eagle_names this = flag:lyra } } + } + add_to_variable_list = { name = story_cycle_eagle_names target = flag:lyra } + } + 10 = { + trigger = { + var:eagle_gender = flag:female + NOT = { any_in_list = { variable = story_cycle_eagle_names this = flag:astana } } + } + add_to_variable_list = { name = story_cycle_eagle_names target = flag:astana } + } + 10 = { + trigger = { + var:eagle_gender = flag:female + NOT = { any_in_list = { variable = story_cycle_eagle_names this = flag:jargal } } + } + add_to_variable_list = { name = story_cycle_eagle_names target = flag:jargal } + } + 10 = { + trigger = { + var:eagle_gender = flag:female + NOT = { any_in_list = { variable = story_cycle_eagle_names this = flag:khair } } + } + add_to_variable_list = { name = story_cycle_eagle_names target = flag:khair } + } + 10 = { + trigger = { + var:eagle_gender = flag:male + NOT = { any_in_list = { variable = story_cycle_eagle_names this = flag:anda } } + } + add_to_variable_list = { name = story_cycle_eagle_names target = flag:anda } + } + 10 = { + trigger = { + var:eagle_gender = flag:male + NOT = { any_in_list = { variable = story_cycle_eagle_names this = flag:timur } } + } + add_to_variable_list = { name = story_cycle_eagle_names target = flag:timur } + } + 10 = { + trigger = { + var:eagle_gender = flag:male + NOT = { any_in_list = { variable = story_cycle_eagle_names this = flag:torebek } } + } + add_to_variable_list = { name = story_cycle_eagle_names target = flag:torebek } + } + 10 = { + trigger = { + var:eagle_gender = flag:male + NOT = { any_in_list = { variable = story_cycle_eagle_names this = flag:elmek } } + } + add_to_variable_list = { name = story_cycle_eagle_names target = flag:elmek } + } + 10 = { + trigger = { + NOT = { any_in_list = { variable = story_cycle_eagle_names this = flag:khongor } } + } + add_to_variable_list = { name = story_cycle_eagle_names target = flag:khongor } + } + 10 = { + trigger = { + NOT = { any_in_list = { variable = story_cycle_eagle_names this = flag:chania } } + } + add_to_variable_list = { name = story_cycle_eagle_names target = flag:chania } + } + 10 = { + trigger = { + NOT = { any_in_list = { variable = story_cycle_eagle_names this = flag:qyliinshaq } } + } + add_to_variable_list = { name = story_cycle_eagle_names target = flag:qyliinshaq } + } + 10 = { + trigger = { + NOT = { any_in_list = { variable = story_cycle_eagle_names this = flag:janym } } + } + add_to_variable_list = { name = story_cycle_eagle_names target = flag:janym } + } + 10 = { + trigger = { + NOT = { any_in_list = { variable = story_cycle_eagle_names this = flag:syr } } + } + add_to_variable_list = { name = story_cycle_eagle_names target = flag:syr } + } + 10 = { + trigger = { + NOT = { any_in_list = { variable = story_cycle_eagle_names this = flag:halik } } + } + add_to_variable_list = { name = story_cycle_eagle_names target = flag:halik } + } + 10 = { + trigger = { + NOT = { any_in_list = { variable = story_cycle_eagle_names this = flag:zephyr } } + } + add_to_variable_list = { name = story_cycle_eagle_names target = flag:zephyr } + } + } +} + +#Remove everything related to the story +remove_eagle_story_modifiers_effect = { + if = { + limit = { + has_character_modifier = eagle_story_modifier + } + remove_character_modifier = eagle_story_modifier + } + if = { + limit = { + has_character_modifier = weak_eagle_modifier + } + remove_character_modifier = weak_eagle_modifier + } + if = { + limit = { + has_character_modifier = very_weak_eagle_modifier + } + remove_character_modifier = very_weak_eagle_modifier + } + if = { + limit = { + has_character_modifier = strong_eagle_modifier + } + remove_character_modifier = strong_eagle_modifier + } + if = { + limit = { + has_character_modifier = skilled_eagle_modifier + } + remove_character_modifier = skilled_eagle_modifier + } + remove_eagle_personality_trait_effect = yes + if = { + limit = { + has_variable = eagle_personality_level + } + remove_variable = eagle_personality_level + } + if = { + limit = { + has_variable = eagle_personality_trait_2 + } + remove_variable = eagle_personality_trait_2 + } + if = { + limit = { + has_character_flag = eagle_marked_for_death + } + remove_character_flag = eagle_marked_for_death + } + if = { + limit = { + has_character_flag = eagle_is_dying + } + remove_character_flag = eagle_is_dying + } + if = { + limit = { + has_character_flag = eagle_capture_method_standard + } + remove_character_flag = eagle_capture_method_standard + } + if = { + limit = { + has_character_flag = eagle_capture_method_lure + } + remove_character_flag = eagle_capture_method_lure + } + if = { + limit = { + has_character_flag = eagle_capture_method_gift + } + remove_character_flag = eagle_capture_method_gift + } + if = { + limit = { + has_character_flag = eagle_capture_method_none + } + remove_character_flag = eagle_capture_method_none + } + if = { + limit = { + has_character_flag = eagle_capture_method_market + } + remove_character_flag = eagle_capture_method_market + } + if = { + limit = { + has_character_flag = eagle_capture_method_stolen + } + remove_character_flag = eagle_capture_method_stolen + } + if = { + limit = { + has_character_flag = cant_sell_eagle + } + remove_character_flag = cant_sell_eagle + } +} + +change_eagle_personality_trait_effect = { + if = { + limit = { + has_eagle_personality_trait_trigger = yes + } + remove_eagle_personality_trait_effect = yes + } + set_random_eagle_personality_trait_effect = { ADD_MODIFIER = yes } +} + +remove_eagle_personality_trait_effect = { + if = { + limit = { + has_variable = eagle_personality_level + } + remove_variable = eagle_personality_level + } + remove_eagle_personality_modifier_effect = yes +} + +remove_eagle_personality_modifier_effect = { + if = { + limit = { + has_character_modifier = brave_eagle_story_modifier + } + remove_character_modifier = brave_eagle_story_modifier + } + if = { + limit = { + has_character_modifier = curious_eagle_story_modifier + } + remove_character_modifier = curious_eagle_story_modifier + } + if = { + limit = { + has_character_modifier = loyal_eagle_story_modifier + } + remove_character_modifier = loyal_eagle_story_modifier + } + if = { + limit = { + has_character_modifier = calm_eagle_story_modifier + } + remove_character_modifier = calm_eagle_story_modifier + } + if = { + limit = { + has_character_modifier = wise_eagle_story_modifier + } + remove_character_modifier = wise_eagle_story_modifier + } + if = { + limit = { + has_character_modifier = cunning_eagle_story_modifier + } + remove_character_modifier = cunning_eagle_story_modifier + } + if = { + limit = { + has_character_modifier = aggressive_eagle_story_modifier + } + remove_character_modifier = aggressive_eagle_story_modifier + } + if = { + limit = { + has_character_modifier = observant_eagle_story_modifier + } + remove_character_modifier = observant_eagle_story_modifier + } + if = { + limit = { + has_character_modifier = protective_eagle_story_modifier + } + remove_character_modifier = protective_eagle_story_modifier + } +} + +set_random_eagle_personality_trait_effect = { + if = { + limit = { + NOT = { has_variable = eagle_personality_level } + } + set_variable = { name = eagle_personality_level value = 1 } + } + if = { + limit = { + has_character_modifier = eagle_story_modifier + } + remove_character_modifier = eagle_story_modifier + } + random_list = { + 10 = { + set_variable = { name = eagle_personality_trait value = flag:brave } + } + 10 = { + set_variable = { name = eagle_personality_trait value = flag:curious } + } + 10 = { + set_variable = { name = eagle_personality_trait value = flag:loyal } + } + 10 = { + set_variable = { name = eagle_personality_trait value = flag:calm } + } + 10 = { + set_variable = { name = eagle_personality_trait value = flag:wise } + } + 10 = { + set_variable = { name = eagle_personality_trait value = flag:cunning } + } + } + if = { + limit = { + $ADD_MODIFIER$ = yes + } + add_eagle_personality_modifier_effect = yes + } +} + +set_eagle_personality_trait_effect = { + if = { + limit = { + NOT = { has_variable = eagle_personality_level } + } + set_variable = { name = eagle_personality_level value = 1 } + } + set_variable = { name = eagle_personality_trait value = flag:$TRAIT$ } + if = { + limit = { + $ADD_MODIFIER$ = yes + } + add_eagle_personality_modifier_effect = yes + } +} + +add_eagle_personality_modifier_effect = { + if = { + limit = { + has_character_modifier = eagle_story_modifier + } + remove_character_modifier = eagle_story_modifier + } + if = { + limit = { + has_variable = eagle_personality_trait + } + switch = { + trigger = var:eagle_personality_trait + flag:brave = { + add_character_modifier = brave_eagle_story_modifier + } + flag:curious = { + add_character_modifier = curious_eagle_story_modifier + } + flag:loyal = { + add_character_modifier = loyal_eagle_story_modifier + } + flag:calm = { + add_character_modifier = calm_eagle_story_modifier + } + flag:wise = { + add_character_modifier = wise_eagle_story_modifier + } + flag:cunning = { + add_character_modifier = cunning_eagle_story_modifier + } + } + } +} + +set_random_secondary_eagle_personality_trait_effect = { # Hunt modifiers + random_list = { + 10 = { # Increase sightings + set_variable = { name = eagle_personality_trait_2 value = flag:observant } + add_character_modifier = { modifier = observant_eagle_story_modifier } + } + 10 = { # Prevent injury + set_variable = { name = eagle_personality_trait_2 value = flag:protective } + add_character_modifier = { modifier = protective_eagle_story_modifier } + } + 10 = { # Increase success chance + set_variable = { name = eagle_personality_trait_2 value = flag:aggressive } + add_character_modifier = { modifier = aggressive_eagle_story_modifier } + } + } +} + +# Eagle getting weak :( +weaken_eagle_effect = { + if = { + limit = { + has_character_modifier = weak_eagle_modifier + } + remove_character_modifier = weak_eagle_modifier + add_character_modifier = very_weak_eagle_modifier + hidden_effect = { + random_list = { + 40 = { # 40% chance of death + add_character_flag = eagle_marked_for_death + trigger_event = { + id = pet_animal.3199 + days = { 120 720 } + } + } + 60 = { } + } + } + } + else_if = { + limit = { + has_character_modifier = very_weak_eagle_modifier + } + hidden_effect = { + add_character_flag = cant_sell_eagle + random_list = { + 70 = { # 70% chance of death + add_character_flag = eagle_marked_for_death + trigger_event = { + id = pet_animal.3199 + days = { 60 600 } + } + } + 30 = { } + } + } + } + else = { + add_character_modifier = weak_eagle_modifier + hidden_effect = { + random_list = { + 10 = { # 10% chance of death + add_character_flag = eagle_marked_for_death + trigger_event = { + id = pet_animal.3199 + days = { 180 720 } + } + } + 90 = { } + } + } + } +} + +unweaken_eagle_effect = { + if = { + limit = { + has_character_modifier = weak_eagle_modifier + } + remove_character_modifier = weak_eagle_modifier + } + if = { + limit = { + has_character_modifier = very_weak_eagle_modifier + } + remove_character_modifier = very_weak_eagle_modifier + if = { + limit = { + $FULL$ = no + } + add_character_modifier = weak_eagle_modifier + } + } + if = { + limit = { + has_character_flag = eagle_marked_for_death + } + remove_character_flag = eagle_marked_for_death + if = { # If you couldn't sell the eagle because it was very weak or something + limit = { + has_character_flag = cant_sell_eagle + } + remove_character_flag = cant_sell_eagle + } + } +} + +eagle_treatment_effect = { + $HEALER$ = { save_scope_as = healer } + random_list = { + 15 = { # Treatment is very successful + modifier = { + is_alive = yes + add = scope:healer.learning + } + modifier = { + flag:$BONUS$ = flag:court_physician + add = 5 + } + desc = pet_animal.3030.very_good + stress_impact = { + base = medium_stress_impact_loss + } + send_interface_toast = { + title = pet_animal.eagle_unweak_title + type = event_toast_effect_good + left_icon = root + right_icon = scope:healer + unweaken_eagle_effect = { FULL = yes } + add_character_modifier = { + modifier = strong_eagle_modifier + years = 3 + } + add_opinion = { + modifier = grateful_opinion + target = scope:healer + opinion = 25 + } + } + } + 30 = { # Treatment is successful + modifier = { + is_alive = yes + add = scope:healer.learning + } + modifier = { + flag:$BONUS$ = flag:court_physician + add = 10 + } + modifier = { + OR = { + flag:$BONUS$ = flag:courtier + flag:$BONUS$ = flag:hunter + } + add = 20 + } + desc = pet_animal.3030.good + stress_impact = { + base = minor_stress_impact_loss + } + send_interface_toast = { + title = pet_animal.eagle_unweak_title + type = event_toast_effect_good + left_icon = root + right_icon = scope:healer + unweaken_eagle_effect = { FULL = no } + add_opinion = { + modifier = grateful_opinion + target = scope:healer + opinion = 15 + } + } + } + 40 = { # Treatment is unsuccessful + modifier = { + flag:$BONUS$ = flag:court_physician + add = -15 + } + modifier = { + flag:$BONUS$ = flag:courtier + add = -7 + } + desc = pet_animal.3030.nothing + stress_impact = { + base = miniscule_stress_impact_gain + callous = miniscule_stress_impact_loss + } + send_interface_toast = { + title = pet_animal.3030.nothing + type = event_toast_effect_bad + left_icon = root + right_icon = scope:healer + add_opinion = { + modifier = disappointed_opinion + target = scope:healer + opinion = -15 + } + } + } + 20 = { # Makes it worse somehow + modifier = { + flag:$BONUS$ = flag:court_physician + add = -10 + } + modifier = { + flag:$BONUS$ = flag:courtier + add = -5 + } + desc = pet_animal.3030.bad + stress_impact = { + base = minor_stress_impact_gain + callous = minor_stress_impact_loss + } + send_interface_toast = { + title = pet_animal.eagle_unweak_title + type = event_toast_effect_bad + left_icon = root + right_icon = scope:healer + weaken_eagle_effect = yes + add_opinion = { + modifier = angry_opinion + target = scope:healer + opinion = -25 + } + } + } + } +} + +transfer_eagle_effect = { + $RECIPIENT$ = { save_scope_as = recipient } + $GIVER$ = { save_scope_as = giver } + if = { + limit = { + flag:$METHOD$ = flag:gift + } + scope:recipient = { save_scope_value_as = { name = eagle_capture_method value = flag:gift } } + } + else_if = { + limit = { + flag:$METHOD$ = flag:market + } + scope:recipient = { save_scope_value_as = { name = eagle_capture_method value = flag:market } } + } + else_if = { + limit = { + flag:$METHOD$ = flag:stolen + } + scope:recipient = { save_scope_value_as = { name = eagle_capture_method value = flag:stolen } } + } + + scope:giver = { + random_owned_story = { # Get the story + limit = { + story_type = story_cycle_pet_eagle + } + save_scope_as = story + } + # Transfer the eagle to the recipient + scope:recipient = { # Start the story and transfer the age + add_character_flag = { flag = cant_sell_eagle years = 1 } # Can't sell it for a while + set_variable = { # Set the name + name = story_cycle_eagle_name + value = scope:giver.var:story_cycle_eagle_name + } + set_variable = { # Set the gender + name = eagle_gender + value = scope:giver.var:eagle_gender + } + set_variable = { + name = eagle_age_variable + value = scope:giver.var:eagle_age_variable + } + start_eagle_story_cycle_effect = yes # Start the story + } + if = { # Get the eagle's personality traits + limit = { + has_eagle_personality_trait_trigger = yes + } + switch = { + trigger = var:eagle_personality_trait + flag:brave = { + scope:recipient = { set_variable = { name = eagle_personality_trait value = flag:brave } } + } + flag:curious = { + scope:recipient = { set_variable = { name = eagle_personality_trait value = flag:curious } } + } + flag:loyal = { + scope:recipient = { set_variable = { name = eagle_personality_trait value = flag:loyal } } + } + flag:calm = { + scope:recipient = { set_variable = { name = eagle_personality_trait value = flag:calm } } + } + flag:wise = { + scope:recipient = { set_variable = { name = eagle_personality_trait value = flag:wise } } + } + flag:cunning = { + scope:recipient = { set_variable = { name = eagle_personality_trait value = flag:cunning } } + } + } + if = { # Get the eagle's secondary personality trait + limit = { + has_secondary_eagle_personality_trait_trigger = yes + } + switch = { + trigger = var:eagle_personality_trait_2 + flag:observant = { + scope:recipient = { set_variable = { name = eagle_personality_trait_2 value = flag:observant } } + add_character_modifier = { modifier = observant_eagle_story_modifier } + } + flag:protective = { + scope:recipient = { set_variable = { name = eagle_personality_trait_2 value = flag:protective } } + add_character_modifier = { modifier = protective_eagle_story_modifier } + } + flag:aggressive = { + scope:recipient = { set_variable = { name = eagle_personality_trait_2 value = flag:aggressive } } + add_character_modifier = { modifier = aggressive_eagle_story_modifier } + } + } + } + scope:recipient = { # Get the eagle's personality level + add the modifier + set_variable = { + name = eagle_personality_level + value = scope:giver.var:eagle_personality_level + } + add_eagle_personality_modifier_effect = yes + } + } + # Get the eagle's sickness + if = { + limit = { + has_character_modifier = weak_eagle_modifier + } + scope:recipient = { add_character_modifier = { modifier = weak_eagle_modifier years = 1 } } + } + else_if = { + limit = { + has_character_modifier = very_weak_eagle_modifier + } + scope:recipient = { add_character_modifier = { modifier = very_weak_eagle_modifier years = 1 } } + } + else = { + limit = { + has_character_modifier = strong_eagle_modifier + } + scope:recipient = { add_character_modifier = { modifier = strong_eagle_modifier years = 1 } } + } + # Remove the eagle from the giver + show_as_tooltip = { + remove_eagle_story_modifiers_effect = yes + } + scope:story = { hidden_effect = { end_story = yes } } + } + +} + +sell_eagle_effect = { + $SELLER$ = { add_gold = $PRICE$ } + transfer_eagle_effect = { + RECIPIENT = $RECIPIENT$ + GIVER = $SELLER$ + METHOD = market + } +} + +get_eagle_training_method_effect = { + random_list = { + 10 = { + trigger = { + NOT = { + any_in_list = { variable = eagle_training_methods this = flag:martial } + has_character_flag = eagle_training_martial + } + } + add_to_variable_list = { name = eagle_training_methods target = flag:martial } + } + 10 = { + trigger = { + NOT = { + any_in_list = { variable = eagle_training_methods this = flag:diplomacy } + has_character_flag = eagle_training_diplomacy + } + } + add_to_variable_list = { name = eagle_training_methods target = flag:diplomacy } + } + 10 = { + trigger = { + NOT = { + any_in_list = { variable = eagle_training_methods this = flag:stewardship } + has_character_flag = eagle_training_stewardship + } + } + add_to_variable_list = { name = eagle_training_methods target = flag:stewardship } + } + 10 = { + trigger = { + NOT = { + any_in_list = { variable = eagle_training_methods this = flag:intrigue } + has_character_flag = eagle_training_intrigue + } + } + add_to_variable_list = { name = eagle_training_methods target = flag:intrigue } + } + 10 = { + trigger = { + NOT = { + any_in_list = { variable = eagle_training_methods this = flag:learning } + has_character_flag = eagle_training_learning + } + } + add_to_variable_list = { name = eagle_training_methods target = flag:learning } + } + } +} + +eagle_training_effect = { + duel = { + skill = $METHOD$ + value = decent_skill_rating + 50 = { + compare_modifier = { + value = scope:duel_value + multiplier = 3.5 + min = -49 + } + modifier = { always = yes add = { 15 25 } } + eagle_training_success_effect = { METHOD = $METHOD$ } + } + 30 = { + compare_modifier = { + value = scope:duel_value + multiplier = -3.5 + min = -49 + } + eagle_training_failure_effect = yes + } + } + add_character_flag = { + flag = eagle_training_$METHOD$ + years = 5 + } +} + +eagle_training_success_effect = { + add_prestige = medium_prestige_gain + random_list = { + desc = pet_animal.3040.training_good_desc + 20 = { # Change personality + show_chance = no + trigger = { + has_eagle_personality_trait_trigger = yes + } + set_variable = { + name = eagle_personality_trait_prev + value = var:eagle_personality_trait + } + desc = pet_animal.3040.personality_change + show_as_tooltip = { remove_eagle_personality_trait_effect = yes } + custom_tooltip = pet_animal.3040.personality_change_tooltip + hidden_effect = { + random_list = { + 10 = { + trigger = { NOT = { var:eagle_personality_trait_prev ?= flag:brave } } + modifier = { flag:$METHOD$ = flag:martial add = 10 } + send_interface_toast = { + title = pet_animal.3040.training_good_title + type = event_toast_effect_good + left_icon = root + remove_eagle_personality_trait_effect = yes + set_eagle_personality_trait_effect = { ADD_MODIFIER = yes TRAIT = brave } + show_as_tooltip = { add_character_modifier = brave_eagle_story_modifier } + } + } + 10 = { + trigger = { NOT = { var:eagle_personality_trait_prev ?= flag:curious } } + modifier = { flag:$METHOD$ = flag:learning add = 10 } + send_interface_toast = { + title = pet_animal.3040.training_good_title + type = event_toast_effect_good + left_icon = root + remove_eagle_personality_trait_effect = yes + set_eagle_personality_trait_effect = { ADD_MODIFIER = yes TRAIT = curious } + show_as_tooltip = { add_character_modifier = curious_eagle_story_modifier } + } + } + 10 = { + trigger = { NOT = { var:eagle_personality_trait_prev ?= flag:cunning } } + modifier = { flag:$METHOD$ = flag:intrigue add = 10 } + send_interface_toast = { + title = pet_animal.3040.training_good_title + type = event_toast_effect_good + left_icon = root + remove_eagle_personality_trait_effect = yes + set_eagle_personality_trait_effect = { ADD_MODIFIER = yes TRAIT = cunning } + show_as_tooltip = { add_character_modifier = cunning_eagle_story_modifier } + } + } + 10 = { + trigger = { NOT = { var:eagle_personality_trait_prev ?= flag:loyal } } + modifier = { flag:$METHOD$ = flag:diplomacy add = 10 } + send_interface_toast = { + title = pet_animal.3040.training_good_title + type = event_toast_effect_good + left_icon = root + remove_eagle_personality_trait_effect = yes + set_eagle_personality_trait_effect = { ADD_MODIFIER = yes TRAIT = loyal } + show_as_tooltip = { add_character_modifier = loyal_eagle_story_modifier } + } + } + 10 = { + trigger = { NOT = { var:eagle_personality_trait_prev ?= flag:wise } } + modifier = { flag:$METHOD$ = flag:stewardship add = 10 } + send_interface_toast = { + title = pet_animal.3040.training_good_title + type = event_toast_effect_good + left_icon = root + remove_eagle_personality_trait_effect = yes + set_eagle_personality_trait_effect = { ADD_MODIFIER = yes TRAIT = wise } + show_as_tooltip = { add_character_modifier = wise_eagle_story_modifier } + } + } + 10 = { + trigger = { NOT = { var:eagle_personality_trait_prev ?= flag:calm } } + send_interface_toast = { + title = pet_animal.3040.training_good_title + type = event_toast_effect_good + left_icon = root + remove_eagle_personality_trait_effect = yes + set_eagle_personality_trait_effect = { ADD_MODIFIER = yes TRAIT = calm } + show_as_tooltip = { add_character_modifier = calm_eagle_story_modifier } + } + } + } + } + remove_variable = eagle_personality_trait_prev + } + 30 = { # Give secondary + show_chance = no + desc = pet_animal.3040.personality + modifier = { flag:$METHOD$ = flag:none add = 10 } + trigger = { + has_eagle_personality_trait_trigger = yes + has_secondary_eagle_personality_trait_trigger = no + } + + random_list = { + 10 = { # Increase sightings + show_chance = no + desc = pet_animal.3040.personality_new_observant + modifier = { flag:$METHOD$ = flag:stewardship add = 10 } + modifier = { flag:$METHOD$ = flag:learning add = 10 } + custom_tooltip = pet_animal.3040.personality_bonus_learning + custom_tooltip = pet_animal.3040.personality_bonus_stewardship + set_variable = { name = eagle_personality_trait_2 value = flag:observant } + send_interface_toast = { + title = pet_animal.3040.training_good_title + type = event_toast_effect_good + left_icon = root + add_character_modifier = { modifier = observant_eagle_story_modifier } + } + } + 10 = { # Prevent injury + show_chance = no + desc = pet_animal.3040.personality_new_protective + modifier = { flag:$METHOD$ = flag:intrigue add = 10 } + modifier = { flag:$METHOD$ = flag:diplomacy add = 10 } + custom_tooltip = pet_animal.3040.personality_bonus_intrigue + custom_tooltip = pet_animal.3040.personality_bonus_diplomacy + set_variable = { name = eagle_personality_trait_2 value = flag:protective } + send_interface_toast = { + title = pet_animal.3040.training_good_title + type = event_toast_effect_good + left_icon = root + add_character_modifier = { modifier = protective_eagle_story_modifier } + } + } + 10 = { # Increase success chance + show_chance = no + desc = pet_animal.3040.personality_new_aggressive + modifier = { flag:$METHOD$ = flag:martial add = 10 } + custom_tooltip = pet_animal.3040.personality_bonus_martial + set_variable = { name = eagle_personality_trait_2 value = flag:aggressive } + send_interface_toast = { + title = pet_animal.3040.training_good_title + type = event_toast_effect_good + left_icon = root + add_character_modifier = { modifier = aggressive_eagle_story_modifier } + } + } + } + } + 30 = { # Level personality + show_chance = no + desc = pet_animal.3040.personality_level + trigger = { + has_eagle_personality_trait_trigger = yes + has_variable = eagle_personality_level + var:eagle_personality_level <= 2 + } + hidden_effect = { + remove_eagle_personality_trait_effect = yes + change_variable = { + name = eagle_personality_level + add = 1 + } + } + send_interface_toast = { + title = pet_animal.3040.training_good_title + type = event_toast_effect_good + left_icon = root + add_eagle_personality_modifier_effect = yes + } + } + 30 = { # Give personality + show_chance = no + desc = pet_animal.3040.personality + trigger = { + has_eagle_personality_trait_trigger = no + } + random_list = { + 10 = { + desc = pet_animal.3040.personality_new_brave + show_chance = no + modifier = { always = yes add = { 10 20 } } + modifier = { flag:$METHOD$ = flag:martial add = 10 } + custom_tooltip = pet_animal.3040.personality_bonus_martial + send_interface_toast = { + title = pet_animal.3040.training_good_title + type = event_toast_effect_good + left_icon = root + set_eagle_personality_trait_effect = { ADD_MODIFIER = yes TRAIT = brave } + show_as_tooltip = { add_character_modifier = brave_eagle_story_modifier } + } + } + 10 = { + desc = pet_animal.3040.personality_new_curious + show_chance = no + modifier = { always = yes add = { 10 20 } } + modifier = { flag:$METHOD$ = flag:learning add = 10 } + custom_tooltip = pet_animal.3040.personality_bonus_learning + send_interface_toast = { + title = pet_animal.3040.training_good_title + type = event_toast_effect_good + left_icon = root + set_eagle_personality_trait_effect = { ADD_MODIFIER = yes TRAIT = curious } + show_as_tooltip = { add_character_modifier = curious_eagle_story_modifier } + } + } + 10 = { + desc = pet_animal.3040.personality_new_cunning + show_chance = no + modifier = { always = yes add = { 10 20 } } + modifier = { flag:$METHOD$ = flag:intrigue add = 10 } + custom_tooltip = pet_animal.3040.personality_bonus_intrigue + send_interface_toast = { + title = pet_animal.3040.training_good_title + type = event_toast_effect_good + left_icon = root + set_eagle_personality_trait_effect = { ADD_MODIFIER = yes TRAIT = cunning } + show_as_tooltip = { add_character_modifier = cunning_eagle_story_modifier } + } + } + 10 = { + desc = pet_animal.3040.personality_new_loyal + show_chance = no + modifier = { always = yes add = { 10 20 } } + modifier = { flag:$METHOD$ = flag:diplomacy add = 10 } + custom_tooltip = pet_animal.3040.personality_bonus_diplomacy + send_interface_toast = { + title = pet_animal.3040.training_good_title + type = event_toast_effect_good + left_icon = root + set_eagle_personality_trait_effect = { ADD_MODIFIER = yes TRAIT = loyal } + show_as_tooltip = { add_character_modifier = loyal_eagle_story_modifier } + } + } + 10 = { + desc = pet_animal.3040.personality_new_wise + show_chance = no + modifier = { always = yes add = { 10 20 } } + modifier = { flag:$METHOD$ = flag:stewardship add = 10 } + custom_tooltip = pet_animal.3040.personality_bonus_stewardship + send_interface_toast = { + title = pet_animal.3040.training_good_title + type = event_toast_effect_good + left_icon = root + set_eagle_personality_trait_effect = { ADD_MODIFIER = yes TRAIT = wise } + show_as_tooltip = { add_character_modifier = wise_eagle_story_modifier } + } + } + 10 = { + desc = pet_animal.3040.personality_new_calm + show_chance = no + modifier = { always = yes add = { 15 20 } } + send_interface_toast = { + title = pet_animal.3040.training_good_title + type = event_toast_effect_good + left_icon = root + set_eagle_personality_trait_effect = { ADD_MODIFIER = yes TRAIT = calm } + show_as_tooltip = { add_character_modifier = calm_eagle_story_modifier } + } + } + } + } + 10 = { # Generic bonus + show_chance = no + desc = pet_animal.3040.training_good_generic + send_interface_toast = { + title = pet_animal.3040.training_good_title + type = event_toast_effect_good + left_icon = root + add_character_modifier = { + modifier = skilled_eagle_modifier + years = 2 + } + } + } + } +} + +eagle_training_failure_effect = { + random_list = { + desc = pet_animal.3040.training_bad_desc + 30 = { # Lose some skill + show_chance = no + desc = pet_animal.3040.training_bad + trigger = { + has_eagle_personality_trait_trigger = yes + var:eagle_personality_level >= 2 + } + send_interface_toast = { + title = pet_animal.3040.training_bad_title + type = event_toast_effect_bad + left_icon = root + custom_tooltip = pet_animal.3040.personality_less_effective + hidden_effect = { + remove_eagle_personality_trait_effect = yes + change_variable = { + name = eagle_personality_level + add = -1 + } + add_eagle_personality_modifier_effect = yes + } + } + } + 20 = { # Eagle is injured :( + show_chance = no + desc = pet_animal.3040.training_very_bad + modifier = { + add = -10 + has_character_modifier = skilled_eagle_modifier + } + modifier = { + add = 10 + has_character_modifier = weak_eagle_modifier + } + modifier = { + add = 20 + has_character_modifier = very_weak_eagle_modifier + } + modifier = { + add = 10 + has_trait = intellect_bad_1 + } + modifier = { + add = 20 + has_trait = intellect_bad_2 + } + modifier = { + add = 30 + has_trait = intellect_bad_3 + } + save_scope_value_as = { + name = eagle_injury_source + value = flag:training + } + show_as_tooltip = { + weaken_eagle_effect = yes + } + trigger_event = { + id = pet_animal.3030 + } + } + 40 = { # Nothing happens + show_chance = no + desc = pet_animal.3040.training_neutral + send_interface_toast = { + title = pet_animal.3040.training_bad_title + type = event_toast_effect_bad + left_icon = root + add_stress = miniscule_stress_impact_gain + add_prestige = minor_prestige_loss + } + } + } +} \ No newline at end of file diff --git a/N3OW/common/scripted_effects/00_antiquarian_artifact_improvement_effects.txt b/N3OW/common/scripted_effects/00_antiquarian_artifact_improvement_effects.txt new file mode 100644 index 00000000..38d9ac6d --- /dev/null +++ b/N3OW/common/scripted_effects/00_antiquarian_artifact_improvement_effects.txt @@ -0,0 +1,1001 @@ + +antiquarian_improve_artifact_effect = { + if = { + limit = { + artifact_slot_type = primary_armament + } + primary_armament_improvement_effect = yes + } + else_if = { + limit = { + artifact_slot_type = armor + } + armor_improvement_effect = yes + } + else_if = { + limit = { + artifact_slot_type = regalia + } + regalia_improvement_effect = yes + } + else_if = { + limit = { + artifact_slot_type = helmet + } + helmet_improvement_effect = yes + } + else_if = { + limit = { + artifact_slot_type = throne + } + throne_improvement_effect = yes + } + else_if = { + limit = { + artifact_slot_type = wall_big + } + wall_big_improvement_effect = yes + } + else_if = { + limit = { + artifact_slot_type = wall_small + } + wall_small_improvement_effect = yes + } + else_if = { + limit = { + artifact_slot_type = sculpture + } + sculpture_improvement_effect = yes + } + else_if = { + limit = { + artifact_slot_type = book + } + book_improvement_effect = yes + } + else_if = { + limit = { + artifact_slot_type = pedestal + } + pedestal_improvement_effect = yes + } + else_if = { + limit = { + artifact_slot_type = miscellaneous + } + miscellaneous_improvement_effect = yes + } + else_if = { + limit = { + artifact_slot_type = journal + } + journal_improvement_effect = yes + } +} + +antiquarian_apply_modifier_to_artifact_effect = { + if = { + limit = { + scope:liege = { + has_character_flag = ach_intent_artifact_boost_flag + } + } + scope:artifact_target = { + add_artifact_modifier = $MODIFIER$ + } + } + else = { + scope:liege = { + send_interface_toast = { + type = event_artifact_good + left_icon = scope:antiquarian_from_task + right_icon = scope:artifact_target + title = antiquarian_improved_artifact_message + scope:artifact_target = { + add_artifact_modifier = $MODIFIER$ + } + } + } + } + +} + +primary_armament_improvement_effect = { + random_list = { + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_prowess_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_knight_effectiveness_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_glory_hound_levy_contribution_mult_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_enemy_hard_casualty_modifier_1_modifier } + } + 10 = { + trigger = { + scope:liege = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = plains + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = plains + } + } + } + } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_plains_advantage_1_modifier } + } + 10 = { + trigger = { + scope:liege = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = farmlands + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = farmlands + } + } + } + } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_farmlands_advantage_1_modifier } + } + 10 = { + trigger = { + scope:liege = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = hills + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = hills + } + } + } + } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_hills_advantage_1_modifier } + } + 10 = { + trigger = { + scope:liege = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = mountains + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = mountains + } + } + } + } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_mountains_advantage_1_modifier } + } + 10 = { + trigger = { + scope:liege = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = desert + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = desert + } + } + } + } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_desert_advantage_1_modifier } + } + 10 = { + trigger = { + scope:liege = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = desert_mountains + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = desert_mountains + } + } + } + } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_desert_mountains_advantage_1_modifier } + } + 10 = { + trigger = { + scope:liege = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = oasis + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = oasis + } + } + } + } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_oasis_advantage_1_modifier } + } + 10 = { + trigger = { + scope:liege = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = jungle + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = jungle + } + } + } + } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_jungle_advantage_1_modifier } + } + 10 = { + trigger = { + scope:liege = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = forest + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = forest + } + } + } + } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_forest_advantage_1_modifier } + } + 10 = { + trigger = { + scope:liege = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = taiga + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = taiga + } + } + } + } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_taiga_advantage_1_modifier } + } + 10 = { + trigger = { + scope:liege = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = wetlands + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = wetlands + } + } + } + } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_wetlands_advantage_1_modifier } + } + 10 = { + trigger = { + scope:liege = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = steppe + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = steppe + } + } + } + } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_steppe_advantage_1_modifier } + } + 10 = { + trigger = { + scope:liege = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = floodplains + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = floodplains + } + } + } + } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_floodplains_advantage_1_modifier } + } + 10 = { + trigger = { + scope:liege = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = drylands + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = drylands + } + } + } + } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_drylands_advantage_1_modifier } + } + } +} + +armor_improvement_effect = { + random_list = { + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_prowess_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_knight_effectiveness_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_controlled_province_advantage_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_glory_hound_levy_contribution_mult_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_hard_casualty_modifier_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_belligerent_levy_contribution_mult_1_modifier } + } + } +} + +regalia_improvement_effect = { + save_scope_as = root_scope + random_list = { + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_minor_prestige_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_piety_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_prestige_add_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_short_reign_duration_mult_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_tyranny_1_modifier } + } + 10 = { + trigger = { + scope:root_scope.top_overlord = { + NOT = { government_has_flag = no_powerful_vassals } + } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_happy_powerful_vassal_tax_contribution_mult_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_courtly_tax_contribution_mult_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_courtly_vassal_opinion_1_modifier } + } + 2 = { + trigger = { + scope:root_scope.top_overlord = { + NOT = { government_has_flag = no_powerful_vassals } + } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_powerful_vassal_opinion_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_parochial_vassal_opinion_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_parochial_tax_contribution_mult_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_belligerent_tax_contribution_mult_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_belligerent_vassal_opinion_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_courtier_and_guest_opinion_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_men_at_arms_maintenance_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_build_gold_cost_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_domain_tax_mult_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_zealot_vassal_opinion_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_zealot_tax_contribution_mult_1_modifier } + } + } +} + +helmet_improvement_effect = { + random_list = { + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_minor_prestige_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_piety_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_prestige_add_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_short_reign_duration_mult_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_tyranny_1_modifier } + } + 10 = { + trigger = { + scope:root_scope.top_overlord = { + NOT = { government_has_flag = no_powerful_vassals } + } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_happy_powerful_vassal_tax_contribution_mult_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_belligerent_tax_contribution_mult_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_belligerent_vassal_opinion_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_courtly_tax_contribution_mult_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_courtly_vassal_opinion_1_modifier } + } + 2 = { + trigger = { + scope:root_scope.top_overlord = { + NOT = { government_has_flag = no_powerful_vassals } + } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_powerful_vassal_opinion_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_parochial_vassal_opinion_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_parochial_tax_contribution_mult_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_courtier_and_guest_opinion_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_men_at_arms_maintenance_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_build_gold_cost_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_domain_tax_mult_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_zealot_vassal_opinion_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_zealot_tax_contribution_mult_1_modifier } + } + 10 = { + trigger = { scope:liege ?= { government_has_flag = government_is_nomadic } } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_herd_gain_1_modifier } + } + 2 = { + trigger = { scope:liege ?= { government_has_flag = government_is_nomadic } } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_herd_conversion_1_modifier } + } + } +} + +throne_improvement_effect = { + random_list = { + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_prestige_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_court_grandeur_baseline_add_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_piety_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_prestige_add_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_short_reign_duration_mult_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_tyranny_1_modifier } + } + 10 = { + trigger = { + scope:root_scope.top_overlord = { + NOT = { government_has_flag = no_powerful_vassals } + } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_happy_powerful_vassal_tax_contribution_mult_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_courtly_tax_contribution_mult_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_courtly_vassal_opinion_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_glory_hound_tax_contribution_mult_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_glory_hound_vassal_opinion_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_belligerent_tax_contribution_mult_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_belligerent_vassal_opinion_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_mercenary_hire_cost_mult_1_modifier } + } + 2 = { + trigger = { + scope:root_scope.top_overlord = { + NOT = { government_has_flag = no_powerful_vassals } + } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_powerful_vassal_opinion_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_parochial_vassal_opinion_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_parochial_tax_contribution_mult_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_courtier_and_guest_opinion_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_men_at_arms_maintenance_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_build_gold_cost_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_domain_tax_mult_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_zealot_vassal_opinion_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_zealot_tax_contribution_mult_1_modifier } + } + 10 = { + trigger = { scope:liege ?= { government_has_flag = government_is_nomadic } } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_herd_gain_1_modifier } + } + 2 = { + trigger = { scope:liege ?= { government_has_flag = government_is_nomadic } } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_herd_conversion_1_modifier } + } + } +} + +wall_big_improvement_effect = { + random_list = { + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_knight_effectiveness_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_prestige_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_court_grandeur_baseline_add_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_prestige_add_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_short_reign_duration_mult_1_modifier } + } + 10 = { + trigger = { + scope:root_scope.top_overlord = { + NOT = { government_has_flag = no_powerful_vassals } + } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_happy_powerful_vassal_tax_contribution_mult_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_courtly_tax_contribution_mult_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_mercenary_hire_cost_mult_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_parochial_vassal_opinion_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_parochial_tax_contribution_mult_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_belligerent_tax_contribution_mult_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_belligerent_vassal_opinion_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_men_at_arms_maintenance_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_build_gold_cost_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_domain_tax_mult_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_zealot_vassal_opinion_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_zealot_tax_contribution_mult_1_modifier } + } + 10 = { + trigger = { + scope:liege ?= { NOT = { government_has_flag = government_is_nomadic } } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_development_growth_1_modifier } + } + 10 = { + trigger = { + scope:liege ?= { government_has_flag = government_is_nomadic } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_fertility_growth_1_modifier } + } + } +} + +wall_small_improvement_effect = { + random_list = { + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_minor_prestige_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_court_grandeur_baseline_add_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_prestige_add_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_glory_hound_tax_contribution_mult_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_glory_hound_vassal_opinion_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_belligerent_tax_contribution_mult_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_belligerent_vassal_opinion_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_men_at_arms_maintenance_1_modifier } + } + 10 = { + trigger = { scope:liege ?= { government_has_flag = government_is_nomadic } } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_herd_gain_1_modifier } + } + 2 = { + trigger = { scope:liege ?= { government_has_flag = government_is_nomadic } } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_herd_conversion_1_modifier } + } + } +} + +sculpture_improvement_effect = { + random_list = { + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_prestige_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_court_grandeur_baseline_add_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_piety_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_prestige_add_1_modifier } + } + 10 = { + trigger = { + scope:root_scope.top_overlord = { + NOT = { government_has_flag = no_powerful_vassals } + } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_happy_powerful_vassal_tax_contribution_mult_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_courtly_tax_contribution_mult_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_courtly_vassal_opinion_1_modifier } + } + 10 = { + trigger = { + scope:liege = { NOT = { government_has_flag = government_is_nomadic } } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_development_growth_1_modifier } + } + 10 = { + trigger = { + scope:liege = { government_has_flag = government_is_nomadic } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_fertility_growth_1_modifier } + } + } +} + +book_improvement_effect = { + random_list = { + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_minor_prestige_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_vassal_limit_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_parochial_vassal_opinion_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_parochial_tax_contribution_mult_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_zealot_vassal_opinion_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_zealot_tax_contribution_mult_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_owned_scheme_secrecy_add_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_hostile_scheme_phase_duration_add_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_personal_scheme_phase_duration_add_1_modifier } + } + 10 = { + trigger = { + scope:liege = { NOT = { government_has_flag = government_is_nomadic } } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_development_growth_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_learn_language_scheme_phase_duration_add_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_lifestyle_xp_minor_modifier } + } + 10 = { + trigger = { + scope:liege = { government_has_flag = government_is_nomadic } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_fertility_growth_1_modifier } + } + } +} + +pedestal_improvement_effect = { + random_list = { + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_prestige_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_court_grandeur_baseline_add_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_prestige_add_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_courtly_tax_contribution_mult_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_courtly_vassal_opinion_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_build_gold_cost_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_zealot_vassal_opinion_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_zealot_tax_contribution_mult_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_belligerent_tax_contribution_mult_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_belligerent_vassal_opinion_1_modifier } + } + 10 = { + trigger = { + scope:liege = { NOT = { government_has_flag = government_is_nomadic } } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_development_growth_1_modifier } + } + 10 = { + trigger = { + scope:liege = { government_has_flag = government_is_nomadic } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_fertility_growth_1_modifier } + } + } +} + +miscellaneous_improvement_effect = { + random_list = { + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_minor_prestige_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_vassal_limit_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_owned_scheme_secrecy_add_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_hostile_scheme_phase_duration_add_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_personal_scheme_phase_duration_add_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_learn_language_scheme_phase_duration_add_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_lifestyle_xp_miniscule_modifier } + } + } +} + +journal_improvement_effect = { + random_list = { + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_minor_prestige_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_vassal_limit_1_modifier } + } + 2 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_parochial_vassal_opinion_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_parochial_tax_contribution_mult_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_owned_scheme_secrecy_add_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_hostile_scheme_phase_duration_add_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_personal_scheme_phase_duration_add_1_modifier } + } + 10 = { + trigger = { + scope:liege = { NOT = { government_has_flag = government_is_nomadic } } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_development_growth_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_learn_language_scheme_phase_duration_add_1_modifier } + } + 10 = { + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_monthly_lifestyle_xp_minor_modifier } + } + 10 = { + trigger = { + scope:liege = { government_has_flag = government_is_nomadic } + } + antiquarian_apply_modifier_to_artifact_effect = { MODIFIER = artifact_fertility_growth_1_modifier } + } + } +} diff --git a/N3OW/common/scripted_effects/00_bastard_effects.txt b/N3OW/common/scripted_effects/00_bastard_effects.txt new file mode 100644 index 00000000..b09390af --- /dev/null +++ b/N3OW/common/scripted_effects/00_bastard_effects.txt @@ -0,0 +1,1332 @@ + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! + +#bastard_secret_check_effect +#bastard_real_father_suspicion_chance_effect +#remove_all_bastard_traits - Removes any and all relevant bastard traits, used primarily in the adoption interaction + +##################################################################### +# EFFECTS +##################################################################### + +#Sets the correct "parent house" for a known bastard +set_parent_house_effect = { + if = { + limit = { + age < bastard_legitimacy_change_cutoff_age + } + if = { + limit = { + should_mother_give_house_to_bastard_trigger = yes + } + set_house = mother.house + } + else_if = { + limit = { + exists = father + exists = father.house + } + set_house = father.house + } + else = { + set_to_lowborn = yes + } + } +} + +#Sets the correct bastard trait +add_bastard_trait_based_on_faith_effect = { + if = { + limit = { + faith = { + has_doctrine_parameter = bastards_none + } + } + add_trait_force_tooltip = wild_oat + } + else = { + add_trait_force_tooltip = bastard + scope:father ?= { + random_memory = { + limit = { + OR = { + has_memory_type = first_born + has_memory_type = twins_born + has_memory_type = child_born + } + any_memory_participant = { scope:child ?= this } + } + set_variable = bastard + } + } + scope:mother ?= { + random_memory = { + limit = { + OR = { + has_memory_type = first_born + has_memory_type = twins_born + has_memory_type = child_born + } + any_memory_participant = { scope:child ?= this } + } + set_variable = bastard + } + } + scope:real_father = { + scope:child = { + if = { + limit = { has_trait = twin } + random_sibling = { + limit = { is_twin_of = scope:child } + save_scope_as = child_2 + } + } + } + if = { + limit = { + NOR = { + any_child = { + even_if_dead = yes + this != scope:child + } + exists = scope:child_2 + } + } + create_character_memory = { + type = first_born + participants = { child = scope:child } + } + } + else = { + if = { + limit = { exists = scope:child_2 } + create_character_memory = { + type = twins_born + participants = { + child = scope:child + child_2 = scope:child_2 + } + } + } + else = { + create_character_memory = { + type = child_born + participants = { child = scope:child } + } + } + } + scope:new_memory = { set_variable = bastard } + } + } +} + + +#Sets correct bastard trait and parentage depending on age + + +#Replaces one bastard-type trait with another as faith changes +replace_bastard_trait_based_on_faith_effect = { + if = { + limit = { + has_trait = bastard + } + if = { + limit = { + faith = { + has_doctrine_parameter = bastards_none + } + } + remove_trait = bastard + add_trait_force_tooltip = wild_oat + } + else = { + add_trait_force_tooltip = bastard + } + } +} + + + +pregnancy_spouse_suspicion_chance_effect = { + hidden_effect = { #Scopes mother and real_father exist + save_scope_as = spouse + random_list = { + 0 = { #Father is suspicious + trigger = { + accepts_adultery_without_penalty_trigger = no + } + + #Base chance + modifier = { + add = husband_suspicion_base_value + always = yes + } + #Increased chance of suspicion if it actually is a bastard + modifier = { + add = 50 + scope:real_father != scope:spouse + } + #Increase significantly if the mother has a known lover + modifier = { + add = 150 + scope:mother = { + OR = { + any_secret = { # Trigger for secret relations + type = secret_lover + is_known_by = scope:spouse + trigger_if = { + limit = { + exists = secret_target + } + secret_target != scope:spouse + } + } + any_relation = { # Trigger for public relations + type = lover + this != scope:spouse # No suspicion chance if their lover is us! + NOT = { has_secret_relation_lover = scope:mother } # Not a secret relation (That's checked in the above step). + } + } + } + } + #Increased chance of suspicion if the child is a bastard and the mother is not very smart + modifier = { + add = 10 + scope:real_father != scope:spouse + scope:mother = { + has_trait_rank = { + trait = intellect_bad + rank > 0 + } + } + } + modifier = { + add = 15 + scope:real_father != scope:spouse + scope:mother = { + has_trait_rank = { + trait = intellect_bad + rank > 1 + } + } + } + modifier = { + add = 20 + scope:real_father != scope:spouse + scope:mother = { + has_trait_rank = { + trait = intellect_bad + rank > 2 + } + } + } + #Negative modifier if the mother is smart + modifier = { + add = -5 + scope:mother = { + has_trait_rank = { + trait = intellect_good + rank > 0 + } + } + } + modifier = { + add = -10 + scope:mother = { + has_trait_rank = { + trait = intellect_good + rank > 1 + } + } + + } + modifier = { + add = -15 + scope:mother = { + has_trait_rank = { + trait = intellect_good + rank > 2 + } + } + } + #Bonuses for high intelligence if it is a bastard + modifier = { + add = 30 + scope:real_father != scope:spouse + has_trait_rank = { + trait = intellect_good + rank > 0 + } + } + modifier = { + add = 30 + scope:real_father != scope:spouse + has_trait_rank = { + trait = intellect_good + rank > 1 + } + } + modifier = { + add = 30 + scope:real_father != scope:spouse + has_trait_rank = { + trait = intellect_good + rank > 2 + } + } + #Negative modifiers for high intelligence if it is NOT a bastard + modifier = { + add = -30 + scope:real_father = scope:spouse + has_trait_rank = { + trait = intellect_good + rank > 0 + } + } + modifier = { + add = -30 + scope:real_father = scope:spouse + has_trait_rank = { + trait = intellect_good + rank > 1 + } + } + modifier = { + add = -30 + scope:real_father = scope:spouse + has_trait_rank = { + trait = intellect_good + rank > 2 + } + } + #Increased chance if father is paranoid + modifier = { + add = 50 + has_trait = paranoid + } + #Very high chance if father is Celibate and not stupid + modifier = { + add = 1500 + has_trait = celibate + NOT = { + has_trait_rank = { + trait = intellect_bad + rank > 2 + } + } + } + modifier = { + scope:mother = { has_variable = borte_first_child_var } # You already know about this + factor = 0 + } + trigger_event = adultery.1001 + } + 100 = { #No suspicion. Regular notification message is good enough for this if it's not the first child + trigger = { + accepts_adultery_without_penalty_trigger = no + } + + #Base chance + modifier = { + add = { + value = 0 + subtract = husband_suspicion_base_value + } + always = yes + } + + if = { + limit = { + OR = { + any_child = { count < 1 } + AND = { + NOT = { any_child = { dynasty = scope:spouse.dynasty } } + scope:spouse = { matrilinear_marriage = no } + } + } + } + trigger_event = pregnancy.1002 + } + else = { + send_interface_toast = { + type = msg_known_pregnancy + left_icon = scope:mother + title = pregnancy_not_first_child_message_title + desc = pregnancy_not_first_child_message + show_as_tooltip = { + scope:mother = { add_trait_force_tooltip = pregnant } + } + } + } + } + } + } +} + + +bastard_real_father_suspicion_chance_effect = { + hidden_effect = { #Root will here refer to the mother with a pregnancy + save_scope_as = mother + + #Build a list of potential fathers + every_in_list = { + variable = potential_father_variable_list + limit = { + NOT = { is_consort_of = scope:mother } + } + add_to_list = potential_fathers + } + clear_variable_list = potential_father_variable_list #Remove list when unnecessary + every_relation = { + type = lover + limit = { + NOR = { + root = { is_consort_of = prev } + is_in_list = potential_fathers + } + } + add_to_list = potential_fathers + } + if = { + limit = { + scope:real_father = { + NOR = { + root = { is_consort_of = prev } + is_in_list = potential_fathers + } + } + } + scope:real_father = { + add_to_list = potential_fathers + } + } + + every_in_list = { + list = potential_fathers + random = { #Real father has a random chance of suspecting that they are + chance = real_father_suspicion_base_value + modifier = { + add = 10 + has_trait = shrewd + } + modifier = { + add = 10 + has_trait = intellect_good_1 + } + modifier = { + add = 20 + has_trait = intellect_good_2 + } + modifier = { + add = 30 + has_trait = intellect_good_3 + } + modifier = { + add = -30 + has_trait = dull + } + modifier = { + add = -10 + has_trait = intellect_bad_1 + } + modifier = { + add = -20 + has_trait = intellect_bad_2 + } + modifier = { + add = -10 + has_trait = intellect_bad_3 + } + modifier = { + add = 35 + is_married = no + is_concubine = no + } + modifier = { + add = { + value = intrigue + } + } + #Very low chance if the potential_father is in fact, a woman and not stupid + modifier = { + add = -1500 + is_female = yes + NOT = { + has_trait_rank = { + trait = intellect_bad + rank > 2 + } + } + } + if = { + limit = { + scope:mother = { + exists = var:event_triggered + } + } + trigger_event = { + id = pregnancy.3001 + days = { 5 20 } + } + } + + if = { + limit = { + NOT = { + scope:mother = { + exists = var:event_triggered + } + } + } + scope:mother = { + set_variable = { + name = event_triggered + value = yes + days = 365 + } + } + } + } + } + } +} + +bastard_pregnancy_mother_announcement_effect = { + hidden_effect = { + if = { + limit = { + NOT = { has_trait = pregnant } + } + add_trait_force_tooltip = pregnant + } + } + # Could build an event target list instead, and use it to fire a first_valid on_action where all the events have triggers inside them so that only one event will fire for any given character + + scope:mother = { + set_known_bastard_on_pregnancy = yes + add_character_flag = { + flag = pregnancy_real_father_of_bastard_is_known_flag + months = 9 + } + trigger_event = { + id = pregnancy.6001 + days = 3 + } + } + scope:real_father = { + trigger_event = { + id = pregnancy.6002 + days = 3 + } + } + if = { + limit = { + scope:mother = { is_married = yes } + } + scope:mother = { + every_spouse = { + if = { + limit = { accepts_adultery_without_penalty_trigger = yes } + trigger_event = { + id = pregnancy.6999 + days = 3 + } + } + else = { + trigger_event = { + id = pregnancy.6003 + days = 3 + } + } + } + } + + } + + + scope:mother = { + every_parent = { + limit = { + is_ai = no # No need to send pure notifications to AI + NOR = { + this = scope:mother + this = scope:real_father + } + trigger_if = { + limit = { exists = scope:father } + this != scope:father + } + accepts_adultery_without_penalty_trigger = no + } + add_to_list = mother_family_list + trigger_event = { + id = pregnancy.6004 + days = 3 + } + } + every_child = { + limit = { + is_ai = no # No need to send pure notifications to AI + NOR = { + this = scope:mother + this = scope:real_father + } + trigger_if = { + limit = { + exists = scope:father + } + this != scope:father + } + accepts_adultery_without_penalty_trigger = no + } + add_to_list = mother_family_list + trigger_event = { + id = pregnancy.6004 + days = 3 + } + } + every_sibling = { + limit = { + is_ai = no # No need to send pure notifications to AI + NOR = { + this = scope:mother + this = scope:real_father + } + trigger_if = { + limit = { + exists = scope:father + } + this != scope:father + } + accepts_adultery_without_penalty_trigger = no + } + add_to_list = mother_family_list + trigger_event = { + id = pregnancy.6004 + days = 3 + } + } + } + scope:real_father = { + if = { + limit = { exists = primary_partner } + primary_partner = { + if = { + limit = { + NOT = { is_in_list = mother_family_list } #To guard against incest triggering multiple events + is_ai = no # No need to send pure notifications to AI + NOR = { + this = scope:mother + this = scope:real_father + } + trigger_if = { + limit = { + exists = scope:father + } + this != scope:father + } + accepts_adultery_without_penalty_trigger = no + } + trigger_event = { + id = pregnancy.6005 + days = 3 + } + } + } + } + every_parent = { + limit = { + NOT = { is_in_list = mother_family_list } #To guard against incest triggering multiple events + is_ai = no # No need to send pure notifications to AI + NOR = { + this = scope:mother + this = scope:real_father + } + trigger_if = { + limit = { + exists = scope:father + } + this != scope:father + } + accepts_adultery_without_penalty_trigger = no + } + trigger_event = { + id = pregnancy.6006 + days = 3 + } + } + every_child = { + limit = { + NOT = { is_in_list = mother_family_list } #To guard against incest triggering multiple events + NOR = { + this = scope:mother + this = scope:real_father + } + trigger_if = { + limit = { + exists = scope:father + } + this != scope:father + } + accepts_adultery_without_penalty_trigger = no + } + trigger_event = { + id = pregnancy.6006 + days = 3 + } + } + every_sibling = { + limit = { + NOT = { is_in_list = mother_family_list } #To guard against incest triggering multiple events + NOR = { + this = scope:mother + this = scope:real_father + } + trigger_if = { + limit = { + exists = scope:father + } + this != scope:father + } + accepts_adultery_without_penalty_trigger = no + } + trigger_event = { + id = pregnancy.6006 + days = 3 + } + } + } +} + + +bastard_pregnancy_married_mother_announcement_effect = { + save_scope_as = secret_exposer + add_to_temporary_list = notified_of_bastardy + scope:mother.pregnancy_assumed_father = { + save_scope_as = father + } + scope:mother.pregnancy_real_father = { + save_scope_as = real_father + } + + scope:mother = { + add_character_flag = { + flag = pregnancy_real_father_of_bastard_is_known_flag + months = 8 + } + set_known_bastard_on_pregnancy = yes + + if = { + limit = { + NOT = { is_in_list = notified_of_bastardy } + } + trigger_event = { + id = secret_bastard.0010 + days = 1 + } + add_to_temporary_list = notified_of_bastardy + } + } + scope:father = { + if = { + limit = { + NOT = { is_in_list = notified_of_bastardy } + } + trigger_event = { + id = secret_bastard.0011 + days = 1 + } + add_to_temporary_list = notified_of_bastardy + } + } + scope:real_father = { + if = { + limit = { + NOT = { is_in_list = notified_of_bastardy } + } + trigger_event = { + id = secret_bastard.0013 + days = 1 + } + add_to_temporary_list = notified_of_bastardy + } + add_to_temporary_list = notified_of_bastardy + + if = { + limit = { + exists = primary_partner + } + primary_partner = { + if = { + limit = { + NOT = { is_in_list = notified_of_bastardy } + } + trigger_event = { + id = secret_bastard.0014 + days = 1 + } + add_to_temporary_list = notified_of_bastardy + } + } + } + } + scope:mother = { + every_close_or_extended_family_member = { + limit = { + NOT = { is_in_list = notified_of_bastardy } + + } + add_to_temporary_list = to_be_notified_of_bastardy + } + if = { + limit = { + is_playable_character = yes + liege ?= { NOT = { is_in_list = notified_of_bastardy } } + } + liege = { + add_to_temporary_list = to_be_notified_of_bastardy + } + } + } + scope:real_father = { + every_close_family_member = { + limit = { + NOT = { is_in_list = notified_of_bastardy } + + } + add_to_temporary_list = to_be_notified_of_bastardy + } + } + scope:father = { + every_close_family_member = { + limit = { + NOT = { is_in_list = notified_of_bastardy } + + } + add_to_temporary_list = to_be_notified_of_bastardy + } + } + + every_in_list = { + list = to_be_notified_of_bastardy + limit = { + NOT = { is_in_list = notified_of_bastardy } + } + trigger_event = { + id = secret_bastard.0012 + days = 1 + } + + add_to_temporary_list = notified_of_bastardy + } +} + +bastard_pregnancy_unmarried_mother_announcement_effect = { + + save_scope_as = secret_exposer + + scope:mother.pregnancy_real_father = { + save_scope_as = real_father + } + + scope:mother = { + set_known_bastard_on_pregnancy = yes + add_character_flag = { + flag = pregnancy_real_father_of_bastard_is_known_flag + months = 9 + } + + trigger_event = { + id = secret_bastard.1000 + days = 1 + } + add_to_temporary_list = notified_of_bastardy + } + scope:real_father = { + trigger_event = { + id = secret_bastard.1003 + days = 1 + } + add_to_temporary_list = notified_of_bastardy + + if = { + limit = { + is_married = yes + } + primary_spouse = { + trigger_event = { + id = secret_bastard.1004 + days = 1 + } + add_to_temporary_list = notified_of_bastardy + } + } + } + scope:mother = { + every_parent = { + limit = { + NOT = { is_in_list = notified_of_bastardy } + + } + trigger_event = { + id = secret_bastard.1001 + days = 1 + } + add_to_temporary_list = notified_of_bastardy + } + every_close_or_extended_family_member = { + limit = { + NOT = { is_in_list = notified_of_bastardy } + + } + add_to_temporary_list = to_be_notified_of_bastardy + } + if = { + limit = { + is_playable_character = yes + liege ?= { NOT = { is_in_list = notified_of_bastardy } } + } + liege = { + add_to_temporary_list = to_be_notified_of_bastardy + } + } + } + scope:real_father = { + every_close_or_extended_family_member = { + limit = { + NOT = { is_in_list = notified_of_bastardy } + + } + add_to_temporary_list = to_be_notified_of_bastardy + } + } + + every_in_list = { + list = to_be_notified_of_bastardy + limit = { + NOT = { is_in_list = notified_of_bastardy } + } + trigger_event = { + id = secret_bastard.1002 + days = 1 + } + add_to_temporary_list = notified_of_bastardy + } +} + + +#Selects the correct bastard pregnancy announcement to fire +bastardy_pregnancy_announcement_effect = { + custom_tooltip = bastardy_pregnancy_announcement_tooltip + if = { + limit = { + this = scope:mother + } + bastard_pregnancy_mother_announcement_effect = yes + } + else_if = { + limit = { + exists = scope:mother.pregnancy_assumed_father + } + bastard_pregnancy_married_mother_announcement_effect = yes + } + else = { + bastard_pregnancy_unmarried_mother_announcement_effect = yes + } + if = { + limit = { + is_ai = no + } + add_character_flag = { + flag = tutorial_reactive_advice_bastards + } + } +} + + + +#Effect run in the legitimize bastard interactions +legitimize_bastard_interaction_opinions_effect = { + hidden_effect = { + $LEGITIMIZER$ = { + save_scope_as = actor + } + if = { + limit = { + exists = $HOUSE_HEAD$ + } + $HOUSE_HEAD$ = { + save_scope_as = house_head + } + } + + if = { + limit = { + scope:actor = { + is_parent_of = $BASTARD$ + } + } + scope:actor = { + save_scope_as = parent + } + } + else = { + $BASTARD$ = { + random_parent = { + limit = { + house = scope:actor.house + is_playable_character = yes + } + alternative_limit = { + house = scope:actor.house + } + alternative_limit = { + always = yes + } + weight = { + base = 1 + compare_modifier = { + value = highest_held_title_tier + multiplier = 1000 + } + } + save_scope_as = parent + } + } + } + } + # Reveal secret if you are the father + if = { + limit = { + any_secret = { + type = secret_unmarried_illegitimate_child + secret_target = { + real_father = { + this = scope:actor + } + } + } + } + random_secret = { + type = secret_unmarried_illegitimate_child + limit = { + secret_target = { + real_father = { + this = root + } + } + } + expose_secret = scope:actor + } + } + + $BASTARD$ = { + hidden_effect = { remove_trait = bastard } + add_trait_force_tooltip = legitimized_bastard + add_opinion = { + target = scope:actor + modifier = legitimized_me_opinion + } + scope:actor = { + if = { + limit = { + is_parent_of = $BASTARD$ + } + $BASTARD$ = { + random_parent = { + limit = { this != scope:actor } + add_opinion = { + target = scope:actor + modifier = legitimized_my_child_opinion + } + } + } + every_spouse = { + limit = { + NOT = { is_parent_of = $BASTARD$ } + } + add_opinion = { + target = scope:actor + modifier = legitimized_a_bastard_opinion + } + } + if = { + limit = { + any_child = { + is_adult = yes + NOT = { this = $BASTARD$ } + NOR = { + has_trait = bastard + has_trait = legitimized_bastard + opinion = { + value >= 40 + target = $BASTARD$ + } + } + } + } + every_child = { + limit = { + is_adult = yes + NOT = { this = $BASTARD$ } + NOR = { + has_trait = bastard + has_trait = legitimized_bastard + opinion = { + value >= 40 + target = $BASTARD$ + } + } + } + custom = every_child_adult_non_bastard_dislike + add_opinion = { + target = scope:actor + modifier = legitimized_a_bastard_opinion + } + } + } + } + } + } + + hidden_effect = { + $BASTARD$ = { + trigger_event = bastard_interaction.0001 + + save_scope_as = legitimized_bastard + + if = { + limit = { + NOT = { exists = scope:newborn_legitimization } + } + every_parent = { + limit = { this != scope:actor } + trigger_event = bastard_interaction.0003 + } + } + } + + scope:actor = { + if = { + limit = { + NOT = { exists = scope:newborn_legitimization } + is_parent_of = $BASTARD$ + } + trigger_event = bastard_interaction.0002 + } + + if = { + limit = { + is_parent_of = $BASTARD$ + } + every_spouse = { + limit = { + NOT = { is_parent_of = $BASTARD$ } + this != scope:actor + } + $BASTARD$ = { save_scope_as = legitimized_bastard } + trigger_event = bastard_interaction.0004 + } + every_child = { + limit = { + is_adult = yes + NOT = { this = $BASTARD$ } + this != scope:actor + } + trigger_event = bastard_interaction.0005 + } + } + else = { + scope:parent ?= { + if = { + limit = { + NOT = { exists = scope:newborn_legitimization } + } + trigger_event = bastard_interaction.0006 + } + + every_spouse = { + limit = { + NOT = { is_parent_of = $BASTARD$ } + this != scope:actor + } + trigger_event = bastard_interaction.0007 + } + + every_child = { + limit = { + is_adult = yes + NOT = { this = $BASTARD$ } + this != scope:actor + } + trigger_event = bastard_interaction.0008 + } + } + } + } + } +} + + +bastard_real_father_discovery_on_birth_effect = { + hidden_effect = { + random_secret = { + limit = { + OR = { + secret_type = secret_unmarried_illegitimate_child + secret_type = secret_disputed_heritage + } + secret_target = scope:child + } + save_scope_as = secret + } + + scope:child.real_father = { + random = { + chance = real_father_suspicion_base_value + compare_modifier = { + value = intrigue + } + modifier = { + add = 25 + has_trait = intellect_good + } + modifier = { + add = -20 + has_trait = intellect_bad + } + + trigger_event = { + id = birth.1006 + days = 5 + } + } + } + } +} + + + +bastard_to_wild_oat_conversion_effect = { + if = { #If you're a bastard and your new faith says they don't exist! + limit = { + has_trait = bastard + faith = { has_doctrine_parameter = bastards_none } + trigger_if = { #If you have a highborn parent, then you have to have their dynasty and their faith has to say no to bastards as well! Otherwise we might mess up too many successions... + limit = { + any_parent = { + exists = dynasty + } + } + exists = root.dynasty + any_parent = { + dynasty = root.dynasty + faith = { has_doctrine_parameter = bastards_none } + } + } + } + remove_trait = bastard + add_trait = wild_oat + } +} + +bastard_to_wild_oat_conversion_interaction_effect = { + if = { #If you're a bastard and your new faith says they don't exist! + limit = { + has_trait = bastard + scope:actor.faith = { has_doctrine_parameter = bastards_none } + trigger_if = { #If you have a highborn parent, then you have to have their dynasty and their faith has to say no to bastards as well! Otherwise we might mess up too many successions... + limit = { + any_parent = { + exists = dynasty + } + } + exists = scope:recipient.dynasty + any_parent = { + dynasty = scope:recipient.dynasty + faith = { has_doctrine_parameter = bastards_none } + } + } + } + remove_trait = bastard + add_trait_force_tooltip = wild_oat + } +} + +bastard_to_wild_oat_conversion_assimilation_effect = { + if = { #If you're a bastard and your new faith says they don't exist! + limit = { + has_trait = bastard + scope:new_faith = { has_doctrine_parameter = bastards_none } + trigger_if = { #If you have a highborn parent, then you have to have their dynasty and their faith has to say no to bastards as well! Otherwise we might mess up too many successions... + limit = { + any_parent = { + exists = dynasty + } + } + exists = dynasty + any_parent = { + dynasty = prev.dynasty + faith = { has_doctrine_parameter = bastards_none } + } + } + } + remove_trait = bastard + add_trait_force_tooltip = wild_oat + } +} + +remove_inherited_descendent_traits_effect = { + if = { + limit = { + has_trait = sayyid + exists = scope:real_father + NOT = { + scope:real_father = { has_trait = sayyid } + } + } + remove_trait = sayyid + } + if = { + limit = { + has_trait = golden_lineage + exists = scope:real_father + NOT = { + scope:real_father = { has_trait = golden_lineage } + } + } + remove_trait = golden_lineage + } +} + + +#Removes all bastard traits +remove_all_bastard_traits = { + if = { + limit = { + has_trait = wild_oat + } + remove_trait = wild_oat + } + if = { + limit = { + has_trait = bastard + } + remove_trait = bastard + } + if = { + limit = { + has_trait = legitimized_bastard + } + remove_trait = legitimized_bastard + } + if = { + limit = { + has_trait = disputed_heritage + } + remove_trait = disputed_heritage + } +} diff --git a/N3OW/common/scripted_effects/00_board_game_effects.txt b/N3OW/common/scripted_effects/00_board_game_effects.txt new file mode 100644 index 00000000..7ab97412 --- /dev/null +++ b/N3OW/common/scripted_effects/00_board_game_effects.txt @@ -0,0 +1,583 @@ + +################################################## +# Effects related to Board Games +################################################## + +################################################## +# SETUP & CLEANUP EFFECTS + +configure_start_board_game_effect = { + # DOCUMENTATION + ## scope:bg_initiator + ### Who started the board game? This is who the output/invalidation events will fire for. + ## scope:bg_attacker + ### The hostile party - in the event of a tie, the match is decided against them. + ## scope:bg_defender + ### The defending party - in the event of a tie, the match is decided in their favour. + ## scope:bg_system = flag:XYZ + ### These control both the relevant skills, counters, & some flavour adjacent to the game. + ### chess + ### pachisi + ### hnefatafl + ### tabula + ### go + ### fidchell + ## scope:locale = flag:XYZ + ### These just trigger the event background of the same name. New ones can be added as needed, but should be added across all three events (round, victory, loss/board_games.0001, board_games.0031, board_games.0041), as we can't add a scripted list. + ### terrain_scope + ### wilderness_scope + ### battlefield + ### temple + ### council_chamber + ### courtyard + ### dungeon + ### docks + ### feast + ### gallows + ### garden + ### market + ### sitting_room + ### bedchamber + ### study + ### physicians_study + ### tavern + ### throne_room + ### army_camp + ### random_nice_day + #### Selects either garden or sitting_room, depending on season. + ## output event ID + ### Which event fires after the game's completion? + + # Sort parties. + $BG_INITIATOR$ = { save_scope_as = bg_initiator } + $BG_DEFENDER$ = { save_scope_as = bg_defender } + $BG_ATTACKER$ = { save_scope_as = bg_attacker } + # Make sure they're clean for setup. + hidden_effect = { remove_board_game_variables_effect = yes} + # Set them both to busy for the single combat. + scope:bg_defender = { + set_variable = { + name = engaged_in_board_game + value = yes + } + } + scope:bg_attacker = { + set_variable = { + name = engaged_in_board_game + value = yes + } + } + ## Sadly, we have no good justification for ripping your shirt off whilst playing board games. + # Set rules & system. + save_scope_value_as = { + name = bg_system + value = flag:$SYSTEM$ + } + ## Chess + ### In chess, our counter order is Martial -> Learning -> Intrigue. + if = { + limit = { scope:bg_system = flag:chess } + save_scope_value_as = { + name = bg_skill_a + value = flag:martial + } + save_scope_value_as = { + name = bg_skill_b + value = flag:learning + } + save_scope_value_as = { + name = bg_skill_c + value = flag:intrigue + } + } + ## Pachisi + ### For pachisi, our counter order is Diplomacy -> Intrigue -> Stewardship. + else_if = { + limit = { scope:bg_system = flag:pachisi } + save_scope_value_as = { + name = bg_skill_a + value = flag:diplomacy + } + save_scope_value_as = { + name = bg_skill_b + value = flag:intrigue + } + save_scope_value_as = { + name = bg_skill_c + value = flag:stewardship + } + } + ## Hnefatafl + ### For hnefatafl, our counter order is Intrigue -> Martial -> Prowess. + else_if = { + limit = { scope:bg_system = flag:hnefatafl } + save_scope_value_as = { + name = bg_skill_a + value = flag:intrigue + } + save_scope_value_as = { + name = bg_skill_b + value = flag:martial + } + save_scope_value_as = { + name = bg_skill_c + value = flag:prowess + } + } + ## Tabula + ### For tabula, our counter order is Intrigue -> Learning -> Stewardship. + else_if = { + limit = { scope:bg_system = flag:tabula } + save_scope_value_as = { + name = bg_skill_a + value = flag:intrigue + } + save_scope_value_as = { + name = bg_skill_b + value = flag:learning + } + save_scope_value_as = { + name = bg_skill_c + value = flag:stewardship + } + } + ## Go + ### For go, our counter order is Learning -> Martial -> Intrigue. + ### Additional game design credit: Alexander Windahl. + else_if = { + limit = { scope:bg_system = flag:go } + save_scope_value_as = { + name = bg_skill_a + value = flag:learning + } + save_scope_value_as = { + name = bg_skill_b + value = flag:martial + } + save_scope_value_as = { + name = bg_skill_c + value = flag:intrigue + } + } + ## Fidchell + ### For fidchell, our counter order is Learning -> Prowess -> Diplomacy. + else_if = { + limit = { scope:bg_system = flag:fidchell } + save_scope_value_as = { + name = bg_skill_a + value = flag:learning + } + save_scope_value_as = { + name = bg_skill_b + value = flag:prowess + } + save_scope_value_as = { + name = bg_skill_c + value = flag:diplomacy + } + } + # Note where the fight is taking place, if we're using a specific location. + save_scope_value_as = { + name = bg_locale + value = flag:$LOCALE$ + } + ## Grab _scope backgrounds appropriately.. + if = { + limit = { scope:bg_locale = flag:terrain_scope } + scope:bg_defender.location = { save_scope_as = background_terrain_scope } + } + else_if = { + limit = { scope:bg_locale = flag:wilderness_scope } + scope:bg_defender.location = { save_scope_as = background_wilderness_scope } + } + ## Sort any random_ backgrounds if necessary. + else_if = { + limit = { scope:bg_locale = flag:random_nice_day } + random_list = { + # Indoors. + 50 = { + trigger = { + exists = scope:bg_defender.location + is_nice_season_to_be_inside_trigger = { LOCATION = scope:bg_defender.location } + } + save_scope_value_as = { + name = bg_locale + value = flag:sitting_room + } + } + # Outdoors. + 50 = { + trigger = { + exists = scope:bg_defender.location + is_nice_season_to_be_outside_trigger = { LOCATION = scope:bg_defender.location } + } + save_scope_value_as = { + name = bg_locale + value = flag:garden + } + } + # Fallback: occasionally characters fall into a bloody void between space and time, I guess, and when they do we need to stop trying to calculate the weather for non-Euclidian space. + 50 = { + trigger = { + NOT = { exists = scope:bg_defender.location } + } + save_scope_value_as = { + name = bg_locale + # Because black holes are from space and space lives inside books. + value = flag:study + } + } + } + } + # Arrange aftermath. + save_scope_value_as = { + name = follow_up_event + value = event_id:$OUTPUT_EVENT$ + } + save_scope_value_as = { + name = invalidation_event + value = event_id:$INVALIDATION_EVENT$ + } + # Configure starting scopes'n'variables. + scope:bg_defender = { + # Set our current round. + set_variable = { + name = bg_current_round + value = 1 + } + # Set up our initial scores. + set_variable = { + name = bg_current_score + value = 0 + } + } + scope:bg_attacker = { + # Set up our initial scores. + set_variable = { + name = bg_current_score + value = 0 + } + } + # Finally, send the first event. + scope:bg_defender = { trigger_event = board_games.0001 } +} + +# Clean up all variables resulting from playing a board game. +remove_board_game_variables_effect = { + # Player-side variables. + remove_variable = bg_current_round + remove_variable = bg_current_score + remove_variable = bg_move_result + # If there are any wagering counties, clear the blockers on their being wagered. + if = { + limit = { exists = scope:bg_stake_land_recipient } + scope:bg_stake_land_recipient = { remove_variable = wagered_county } + } + if = { + limit = { exists = scope:bg_stake_land_actor } + scope:bg_stake_land_actor = { remove_variable = wagered_county } + } + # Remove any debug variables. + remove_variable = bg_gib_only_losing_locs + remove_variable = bg_gib_only_winning_locs + # Note, we don't remove var:engaged_in_board_game here, as we run this effect at the start of games for clean-up also. +} + +remove_engaged_in_board_game_variables_effect = { + scope:bg_attacker = { + if = { + # Restrict to live characters to prevent errors. + limit = { is_alive = yes } + remove_variable = engaged_in_board_game + } + } + scope:bg_defender = { + if = { + # Restrict to live characters to prevent errors. + limit = { is_alive = yes } + remove_variable = engaged_in_board_game + } + } +} + +# Clean all consequences of a single combat. +remove_board_game_info_effect = { + scope:bg_defender = { + # Only remove variables if they're alive, as otherwise we get errors. + if = { + limit = { is_alive = yes } + remove_board_game_variables_effect = yes + } + } + scope:bg_attacker = { + # Only remove variables if they're alive, as otherwise we get errors. + if = { + limit = { is_alive = yes } + remove_board_game_variables_effect = yes + } + } + remove_engaged_in_board_game_variables_effect = yes +} + +bg_fire_clean_up_and_invalidate_effect = { + remove_engaged_in_board_game_variables_effect = yes + # We try to wing this at scope:bg_defender... + if = { + limit = { + scope:bg_defender = { is_alive = yes } + } + scope:bg_defender = { + trigger_event = { saved_event_id = scope:invalidation_event } + } + } + # ... then scope:bg_attacker... + else_if = { + limit = { + scope:bg_attacker = { is_alive = yes } + } + scope:bg_attacker = { + trigger_event = { saved_event_id = scope:invalidation_event } + } + } + # ... then scope:bg_initiator... + else_if = { + limit = { + scope:bg_initiator = { is_alive = yes } + } + scope:bg_initiator = { + trigger_event = { saved_event_id = scope:invalidation_event } + } + } + # ... then we give up, as somehow *everyone* involved in the board game has died simultaneously. +} + +################################################## +# INTERACTION-SPECIFIC EFFECTS + +challenge_to_2p_chess_interaction_lock_in_actor_stake_land_effect = { + scope:actor = { + save_temporary_scope_as = ordering_char_temp + ordered_held_title = { + limit = { + bg_stake_land_valid_neighbouring_county_to_trade_trigger = { NEIGHBOUR = scope:recipient } + } + order_by = bg_stake_land_evaluate_appropriate_county_ordering_value + save_scope_as = bg_stake_land_actor + set_variable = wagered_county + } + } +} + +challenge_to_2p_chess_interaction_lock_in_game_type_effect = { + $GAME_TYPE_SETTER$ = { + # Landless characters use their location. + if = { + limit = { is_playable_character = no } + location = { + # Pachisi - favoured in the eastern parts of the map. + if = { + limit = { bg_game_type_region_pachisi_trigger = yes } + save_scope_value_as = { + name = bg_interaction_game_type + value = flag:pachisi + } + } + # Hnefatafl - favoured in the northern parts of the map. + else_if = { + limit = { bg_game_type_region_hnefatafl_trigger = yes } + save_scope_value_as = { + name = bg_interaction_game_type + value = flag:hnefatafl + } + } + # Tabula - favoured around the Med. + else_if = { + limit = { bg_game_type_region_tabula_trigger = yes } + save_scope_value_as = { + name = bg_interaction_game_type + value = flag:tabula + } + } + # Go - favoured around Tibet. + else_if = { + limit = { bg_game_type_region_go_trigger = yes } + save_scope_value_as = { + name = bg_interaction_game_type + value = flag:go + } + } + # Fidchell - favoured around the Celtic rim. + else_if = { + limit = { bg_game_type_region_fidchell_trigger = yes } + save_scope_value_as = { + name = bg_interaction_game_type + value = flag:fidchell + } + } + # Chess - fallback. + else = { + save_scope_value_as = { + name = bg_interaction_game_type + value = flag:chess + } + } + } + } + # Landed characters use their capital. + else = { + capital_province = { + # Pachisi - favoured in the eastern parts of the map. + if = { + limit = { bg_game_type_region_pachisi_trigger = yes } + save_scope_value_as = { + name = bg_interaction_game_type + value = flag:pachisi + } + } + # Hnefatafl - favoured in the northern parts of the map. + else_if = { + limit = { bg_game_type_region_hnefatafl_trigger = yes } + save_scope_value_as = { + name = bg_interaction_game_type + value = flag:hnefatafl + } + } + # Tabula - favoured around the Med. + else_if = { + limit = { bg_game_type_region_tabula_trigger = yes } + save_scope_value_as = { + name = bg_interaction_game_type + value = flag:tabula + } + } + # Go - favoured around Tibet. + else_if = { + limit = { bg_game_type_region_go_trigger = yes } + save_scope_value_as = { + name = bg_interaction_game_type + value = flag:go + } + } + # Fidchell - favoured around the Celtic rim. + else_if = { + limit = { bg_game_type_region_fidchell_trigger = yes } + save_scope_value_as = { + name = bg_interaction_game_type + value = flag:fidchell + } + } + # Chess - fallback. + else = { + save_scope_value_as = { + name = bg_interaction_game_type + value = flag:chess + } + } + } + } + } +} + +fp2_bg_stake_friendly_effect = { + $VICTOR$ = { + if = { + # Obscure opinion adds from players. + limit = { is_ai = yes } + add_opinion = { + target = $LOSER$ + modifier = pleased_opinion + opinion = 25 + } + } + add_stress = minor_stress_loss + } + $LOSER$ = { + if = { + # Obscure opinion adds from players. + limit = { is_ai = yes } + add_opinion = { + target = $VICTOR$ + modifier = pleased_opinion + opinion = 10 + } + } + add_stress = minor_stress_gain + } +} + +fp2_bg_stake_fame_effect = { + $VICTOR$ = { add_prestige = medium_prestige_gain } + $LOSER$ = { add_prestige = minor_prestige_loss } +} + +fp2_bg_stake_fortune_effect = { + # A nice, simple, transfer of funds. + $LOSER$ = { + pay_short_term_gold = { + target = $VICTOR$ + gold = scope:bg_stake_gold + } + } +} + +fp2_bg_stake_titles_effect = { + create_title_and_vassal_change = { + type = granted + save_scope_as = change + } + if = { + limit = { $VICTOR$ = scope:actor } + scope:bg_stake_land_recipient = { + change_title_holder = { + holder = scope:actor + change = scope:change + } + } + } + else_if = { + limit = { $VICTOR$ = scope:recipient } + scope:bg_stake_land_actor = { + change_title_holder = { + holder = scope:recipient + change = scope:change + } + } + } + resolve_title_and_vassal_change = scope:change +} + +################################################## +# RESULT EFFECTS + +perk_interaction_0122_apply_effects_effect = { + # Stakes. + ## Friendlies bet opinion & stress. + if = { + limit = { always = scope:chess_friendly } + fp2_bg_stake_friendly_effect = { + VICTOR = scope:bg_victor + LOSER = scope:bg_loser + } + } + ## Fame bets prestige. + if = { + limit = { always = scope:chess_prestige } + fp2_bg_stake_fame_effect = { + VICTOR = scope:bg_victor + LOSER = scope:bg_loser + } + } + ## Fortune bets gold. + if = { + limit = { always = scope:chess_gold } + fp2_bg_stake_fortune_effect = { + VICTOR = scope:bg_victor + LOSER = scope:bg_loser + } + } + ## Land bets... land. + if = { + limit = { always = scope:chess_land } + fp2_bg_stake_titles_effect = { VICTOR = scope:bg_victor } + } +} diff --git a/N3OW/common/scripted_effects/00_bookmark_effects.txt b/N3OW/common/scripted_effects/00_bookmark_effects.txt new file mode 100644 index 00000000..9acae130 --- /dev/null +++ b/N3OW/common/scripted_effects/00_bookmark_effects.txt @@ -0,0 +1,27 @@ +################ +# 867 NORTHMEN # +################ + +bookmark_867_northmen_aellas_capture_war_imprisonment_effect = { + if = { + limit = { + scope:defender_loser = { + this = character:163103 #Aella + is_ai = yes + } + NOR = { + is_target_in_global_variable_list = { + name = triggered_bookmark_events + target = flag:bookmark_867_northmen_aellas_capture + } + character:163103 = { is_imprisoned = yes } + } + } + scope:attacker_winner = { + imprison = { + target = scope:defender_loser + type = dungeon + } + } + } +} \ No newline at end of file diff --git a/N3OW/common/scripted_effects/00_bp1_artifact_creation_effects.txt b/N3OW/common/scripted_effects/00_bp1_artifact_creation_effects.txt new file mode 100644 index 00000000..cb3d5e60 --- /dev/null +++ b/N3OW/common/scripted_effects/00_bp1_artifact_creation_effects.txt @@ -0,0 +1,169 @@ +add_tier_one_perfume_effect = { + random_list = { + pick = 1 + unique = yes + + 1 = { + add_artifact_modifier = artifact_monthly_minor_prestige_1_modifier + } + 1 = { + add_artifact_modifier = artifact_monthly_prestige_gain_per_happy_powerful_vassal_add_1_modifier + } + 1 = { + add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_1_modifier + } + 1 = { + add_artifact_modifier = artifact_courtier_and_guest_opinion_1_modifier + } + 1 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_1_modifier + } + } +} + +add_tier_two_perfume_effect = { + random_list = { + pick = 1 + unique = yes + + 1 = { + add_artifact_modifier = artifact_monthly_minor_prestige_2_modifier + } + 1 = { + add_artifact_modifier = artifact_monthly_prestige_gain_per_happy_powerful_vassal_add_2_modifier + } + 1 = { + add_artifact_modifier = artifact_courtier_and_guest_opinion_2_modifier + } + 1 = { + add_artifact_modifier = artifact_clergy_opinion_1_modifier + } + 1 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_2_modifier + } + } +} + +add_tier_three_perfume_effect = { + random_list = { + pick = 1 + unique = yes + + 1 = { + add_artifact_modifier = artifact_monthly_minor_prestige_3_modifier + } + 1 = { + add_artifact_modifier = artifact_dynasty_opinion_1_modifier + } + 1 = { + add_artifact_modifier = artifact_monthly_dynasty_prestige_1_modifier + } + 1 = { + add_artifact_modifier = artifact_monthly_prestige_gain_per_happy_powerful_vassal_add_3_modifier + } + 1 = { + add_artifact_modifier = artifact_courtier_and_guest_opinion_3_modifier + } + 1 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_3_modifier + } + 1 = { + add_artifact_modifier = artifact_seduce_scheme_phase_duration_add_1_modifier + } + 1 = { + add_artifact_modifier = artifact_courting_scheme_phase_duration_add_1_modifier + } + 1 = { + add_artifact_modifier = artifact_spouse_opinion_add_1_modifier + } + 1 = { + add_artifact_modifier = artifact_stress_gain_1_modifier + } + 1 = { + add_artifact_modifier = artifact_negate_health_penalty_add_1_modifier + } + } +} + +add_tier_four_perfume_effect = { + random_list = { + pick = 1 + unique = yes + + 1 = { + add_artifact_modifier = artifact_monthly_minor_prestige_4_modifier + } + 1 = { + add_artifact_modifier = artifact_dynasty_opinion_2_modifier + } + 1 = { + add_artifact_modifier = artifact_monthly_dynasty_prestige_2_modifier + } + 1 = { + add_artifact_modifier = artifact_monthly_prestige_gain_per_happy_powerful_vassal_add_4_modifier + } + 1 = { + add_artifact_modifier = artifact_courtier_and_guest_opinion_4_modifier + } + 1 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_4_modifier + } + 1 = { + add_artifact_modifier = artifact_seduce_scheme_phase_duration_add_2_modifier + } + 1 = { + add_artifact_modifier = artifact_courting_scheme_phase_duration_add_2_modifier + } + 1 = { + add_artifact_modifier = artifact_spouse_opinion_add_2_modifier + } + 1 = { + add_artifact_modifier = artifact_stress_gain_2_modifier + } + 1 = { + add_artifact_modifier = artifact_negate_health_penalty_add_2_modifier + } + } +} + +add_vetiver_effect = { + random_list = { + pick = 1 + unique = yes + + 1 = { + add_artifact_modifier = artifact_health_gain_2_modifier + } + 1 = { + add_artifact_modifier = artifact_health_gain_3_modifier + } + } +} + +add_camphor_effect = { + random_list = { + pick = 1 + unique = yes + + 1 = { + add_artifact_modifier = artifact_courtly_vassal_opinion_2_modifier + } + 1 = { + add_artifact_modifier = artifact_courtly_vassal_opinion_3_modifier + } + } +} + +add_ambergris_effect = { + random_list = { + pick = 1 + unique = yes + + 1 = { + add_artifact_modifier = artifact_monthly_dynasty_prestige_2_modifier + } + 1 = { + add_artifact_modifier = artifact_monthly_dynasty_prestige_3_modifier + } + } +} diff --git a/N3OW/common/scripted_effects/00_building_effects.txt b/N3OW/common/scripted_effects/00_building_effects.txt new file mode 100644 index 00000000..b83464e9 --- /dev/null +++ b/N3OW/common/scripted_effects/00_building_effects.txt @@ -0,0 +1,2978 @@ +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! + +#add_next_building_tier_effect +#add_random_building_effect +#add_random_building_variable_effect + +##################################################################### +# EFFECTS +##################################################################### + +# Builds or upgrades the specified building, e.g. outposts +add_next_building_tier_effect = { + if = { + limit = { + NOT = { has_building_or_higher = $BUILDING$_01 } + } + add_building = $BUILDING$_01 + } + else_if = { + limit = { has_building = $BUILDING$_01 } + add_building = $BUILDING$_02 + } + else_if = { + limit = { has_building = $BUILDING$_02 } + add_building = $BUILDING$_03 + } + else_if = { + limit = { has_building = $BUILDING$_03 } + add_building = $BUILDING$_04 + } + else_if = { + limit = { has_building = $BUILDING$_04 } + add_building = $BUILDING$_05 + } + else_if = { + limit = { has_building = $BUILDING$_05 } + add_building = $BUILDING$_06 + } + else_if = { + limit = { has_building = $BUILDING$_06 } + add_building = $BUILDING$_07 + } + else_if = { + limit = { has_building = $BUILDING$_07 } + add_building = $BUILDING$_08 + } +} + +#### Create Random Building - 2 Part Effect #### + +# creates a random building in a holding, limited by innovations and holding level, and weighted to cheapest/lowest level, excludes tribal holdings/buildings, only for use in castle/church/city baronies + +# ensure the event/script where this is used checks that a building can be built, based on innovations and holding level, as if noe can be built this effect will do absolutely nada + +# 1, sets variable based on fitness of possible buildings +add_random_building_variable_effect = { # Province scope + province_owner = { save_scope_as = build_owner } + province_owner = { save_scope_as = holder } #Since building requirements reference scope:holder. + random_list = { # Which building? + # Generic/Terrain + 10 = { # outposts : Cheap + trigger = { + add_random_building_trigger = { BUILDING = outposts } # Generic eligiblity + generic_recruitment_building_innovations_trigger = { BUILDING = outposts } + } + set_variable = { + name = random_building_variable + value = 0 + days = 365 + } + } + 10 = { # logging_camps : Cheap + trigger = { + add_random_building_trigger = { BUILDING = logging_camps } + generic_economic_building_innovation_trigger = { BUILDING = logging_camps } + } + set_variable = { + name = random_building_variable + value = 1 + days = 365 + } + } + 10 = { # peat_quarries : Cheap + trigger = { + add_random_building_trigger = { BUILDING = peat_quarries } + generic_economic_building_innovation_trigger = { BUILDING = peat_quarries } + } + set_variable = { + name = random_building_variable + value = 2 + days = 365 + } + } + 10 = { # hill_forts : Cheap + trigger = { + add_random_building_trigger = { BUILDING = hill_forts } + generic_fortification_building_innovations_trigger = { BUILDING = hill_forts } + } + set_variable = { + name = random_building_variable + value = 3 + days = 365 + } + } + 10 = { # plantations : Cheap + trigger = { + add_random_building_trigger = { BUILDING = plantations } + generic_economic_building_innovation_trigger = { BUILDING = plantations } + } + set_variable = { + name = random_building_variable + value = 4 + days = 365 + } + } + 10 = { # quarries : Cheap + trigger = { + add_random_building_trigger = { BUILDING = quarries } + generic_economic_building_innovation_trigger = { BUILDING = quarries } + } + set_variable = { + name = random_building_variable + value = 5 + days = 365 + } + } + 10 = { # hunting_grounds : Cheap + trigger = { + add_random_building_trigger = { BUILDING = hunting_grounds } + generic_economic_building_innovation_trigger = { BUILDING = hunting_grounds } + } + set_variable = { + name = random_building_variable + value = 6 + days = 365 + } + } + 10 = { # military_camps : Cheap + trigger = { + add_random_building_trigger = { BUILDING = military_camps } + generic_recruitment_building_innovations_trigger = { BUILDING = military_camps } + } + set_variable = { + name = random_building_variable + value = 7 + days = 365 + } + } + 10 = { # horse_pastures : Cheap + trigger = { + add_random_building_trigger = { BUILDING = horse_pastures } + generic_recruitment_building_innovations_trigger = { BUILDING = horse_pastures } + } + set_variable = { + name = random_building_variable + value = 8 + days = 365 + } + } + 10 = { # hillside_grazing : Cheap + trigger = { + add_random_building_trigger = { BUILDING = hillside_grazing } + generic_recruitment_building_innovations_trigger = { BUILDING = hillside_grazing } + } + set_variable = { + name = random_building_variable + value = 9 + days = 365 + } + } + 10 = { # warrior_lodges : Cheap + trigger = { + add_random_building_trigger = { BUILDING = warrior_lodges } + generic_recruitment_building_innovations_trigger = { BUILDING = warrior_lodges } + } + set_variable = { + name = random_building_variable + value = 10 + days = 365 + } + } + 2 = { # pastures : Normal + trigger = { + add_random_building_trigger = { BUILDING = pastures } + generic_economic_building_innovation_trigger = { BUILDING = pastures } + } + set_variable = { + name = random_building_variable + value = 11 + days = 365 + } + } + 2 = { # ramparts : Normal + trigger = { + add_random_building_trigger = { BUILDING = ramparts } + generic_fortification_building_innovations_trigger = { BUILDING = ramparts } + } + set_variable = { + name = random_building_variable + value = 12 + days = 365 + } + } + 2 = { # curtain_walls : Normal + trigger = { + add_random_building_trigger = { BUILDING = curtain_walls } + generic_fortification_building_innovations_trigger = { BUILDING = curtain_walls } + } + set_variable = { + name = random_building_variable + value = 13 + days = 365 + } + } + 2 = { # watchtowers : Normal + trigger = { + add_random_building_trigger = { BUILDING = watchtowers } + generic_fortification_building_innovations_trigger = { BUILDING = watchtowers } + } + set_variable = { + name = random_building_variable + value = 14 + days = 365 + } + } + 2 = { # cereal_fields : Normal + trigger = { + add_random_building_trigger = { BUILDING = cereal_fields } + generic_economic_building_innovation_trigger = { BUILDING = cereal_fields } + } + set_variable = { + name = random_building_variable + value = 15 + days = 365 + } + } + 2 = { # barracks : Normal + trigger = { + add_random_building_trigger = { BUILDING = barracks } + generic_recruitment_building_innovations_trigger = { BUILDING = barracks } + } + set_variable = { + name = random_building_variable + value = 16 + days = 365 + } + } + 2 = { # camel_farms : Normal + trigger = { + add_random_building_trigger = { BUILDING = camel_farms } + generic_recruitment_building_innovations_trigger = { BUILDING = camel_farms } + } + set_variable = { + name = random_building_variable + value = 17 + days = 365 + } + } + 2 = { # hill_farms : Normal + trigger = { + add_random_building_trigger = { BUILDING = hill_farms } + generic_economic_building_innovation_trigger = { BUILDING = hill_farms } + } + set_variable = { + name = random_building_variable + value = 18 + days = 365 + } + } + 2 = { # elephant_pens : Normal + trigger = { + add_random_building_trigger = { BUILDING = elephant_pens } + generic_economic_building_innovation_trigger = { BUILDING = elephant_pens } + } + set_variable = { + name = random_building_variable + value = 19 + days = 365 + } + } + 2 = { # common_tradeport : Normal + trigger = { + add_random_building_trigger = { BUILDING = common_tradeport } + # Innovation triggers + trigger_if = { + limit = { has_building_or_higher = common_tradeport_01 } + scope:build_owner.culture = { + OR = { + has_innovation = innovation_crop_rotation + has_cultural_parameter = next_level_trade_ports + } + } + } + trigger_if = { + limit = { has_building_or_higher = common_tradeport_02 } + building_requirement_castle_city_church = { LEVEL = 02 } + scope:build_owner.culture = { + OR = { + has_innovation = innovation_manorialism + AND = { + has_innovation = innovation_crop_rotation + has_cultural_parameter = next_level_trade_ports + } + } + } + } + trigger_if = { + limit = { has_building_or_higher = common_tradeport_04 } + building_requirement_castle_city_church = { LEVEL = 03 } + scope:build_owner.culture = { + OR = { + has_innovation = innovation_windmills + AND = { + has_innovation = innovation_manorialism + has_cultural_parameter = next_level_trade_ports + } + } + } + } + trigger_if = { + limit = { has_building_or_higher = common_tradeport_06 } + building_requirement_castle_city_church = { LEVEL = 04 } + scope:build_owner.culture = { + OR = { + has_innovation = innovation_cranes + AND = { + has_innovation = innovation_windmills + has_cultural_parameter = next_level_trade_ports + } + } + } + } + } + set_variable = { + name = random_building_variable + value = 20 + days = 365 + } + } + 2 = { # hospices : Normal + trigger = { + add_random_building_trigger = { BUILDING = hospices } + generic_economic_building_innovation_trigger = { BUILDING = hospices } + } + set_variable = { + name = random_building_variable + value = 21 + days = 365 + } + } + 2 = { # qanats : Normal + trigger = { + add_random_building_trigger = { BUILDING = qanats } + building_requirement_castle_city_church = { LEVEL = 01 } + trigger_if = { + limit = { + NOT = { + has_building_or_higher = qanats_01 + } + } + scope:build_owner.culture = { + has_cultural_parameter = unlocks_qanat_building + } + } + trigger_if = { + limit = { + has_building_or_higher = qanats_02 + } + building_requirement_castle_city_church = { LEVEL = 02 } + } + trigger_if = { + limit = { + has_building_or_higher = qanats_04 + } + building_requirement_castle_city_church = { LEVEL = 03 } + } + trigger_if = { + limit = { + has_building_or_higher = qanats_06 + } + building_requirement_castle_city_church = { LEVEL = 04 } + } + } + set_variable = { + name = random_building_variable + value = 22 + days = 365 + } + } + 2 = { # murex_farm : Normal + trigger = { + add_random_building_trigger = { BUILDING = murex_farm } + building_requirement_castle_city_church = { LEVEL = 01 } + county = { NOT = { has_county_modifier = backwater_county_modifier } } + trigger_if = { + limit = { + has_building_or_higher = murex_farm_02 + } + building_requirement_castle_city_church = { LEVEL = 02 } + } + trigger_if = { + limit = { + has_building_or_higher = murex_farm_04 + } + building_requirement_castle_city_church = { LEVEL = 03 } + } + trigger_if = { + limit = { + has_building_or_higher = murex_farm_06 + } + building_requirement_castle_city_church = { LEVEL = 03 } + } + } + set_variable = { + name = random_building_variable + value = 23 + days = 365 + } + } + 2 = { # wind_furnace : Normal + trigger = { + add_random_building_trigger = { BUILDING = wind_furnace } + building_requirement_castle_city_church = { LEVEL = 01 } + trigger_if = { + limit = { + has_building_or_higher = wind_furnace_01 + } + scope:build_owner.culture = { + has_innovation = innovation_barracks + } + } + trigger_if = { + limit = { + has_building_or_higher = wind_furnace_02 + } + building_requirement_castle_city_church = { LEVEL = 02 } + scope:build_owner.culture = { + has_innovation = innovation_burhs + } + } + trigger_if = { + limit = { + has_building_or_higher = wind_furnace_04 + } + building_requirement_castle_city_church = { LEVEL = 03 } + scope:build_owner.culture = { + has_innovation = innovation_castle_baileys + } + } + trigger_if = { + limit = { + has_building_or_higher = wind_furnace_05 + } + scope:build_owner.culture = { + has_innovation = innovation_royal_armory + } + } + trigger_if = { + limit = { + has_building_or_higher = wind_furnace_06 + } + building_requirement_castle_city_church = { LEVEL = 04 } + } + } + set_variable = { + name = random_building_variable + value = 24 + days = 365 + } + } + 2 = { # stables : Normal + trigger = { + add_random_building_trigger = { BUILDING = stables } + generic_recruitment_building_innovations_trigger = { BUILDING = stables } + } + set_variable = { + name = random_building_variable + value = 25 + days = 365 + } + } + 2 = { # smiths : Normal + trigger = { + add_random_building_trigger = { BUILDING = smiths } + generic_recruitment_building_innovations_trigger = { BUILDING = smiths } + } + set_variable = { + name = random_building_variable + value = 26 + days = 365 + } + } + 1 = { # orchards : Expensive + trigger = { + add_random_building_trigger = { BUILDING = orchards } + generic_economic_building_innovation_trigger = { BUILDING = orchards } + } + set_variable = { + name = random_building_variable + value = 27 + days = 365 + } + } + 1 = { # farm_estates : Expensive + trigger = { + add_random_building_trigger = { BUILDING = farm_estates } + generic_economic_building_innovation_trigger = { BUILDING = farm_estates } + } + set_variable = { + name = random_building_variable + value = 28 + days = 365 + } + } + 1 = { # regimental_grounds : Expensive + trigger = { + add_random_building_trigger = { BUILDING = regimental_grounds } + generic_recruitment_building_innovations_trigger = { BUILDING = regimental_grounds } + } + set_variable = { + name = random_building_variable + value = 29 + days = 365 + } + } + 1 = { # caravanserai : Expensive + trigger = { + is_county_capital = yes + building_caravanserai_requirement_terrain = yes + scope:build_owner.culture = { + has_innovation = innovation_guilds + } + building_requirement_castle_city_church = { LEVEL = 01 } + trigger_if = { # if all slots are full, this building type exists already + limit = { free_building_slots = 0 } + has_building_or_higher = caravanserai_01 + } + trigger_if = { + limit = { has_building_or_higher = caravanserai_01 } + NOT = { + has_lesser_building_trigger = { COMPARE = caravanserai } + } + } + # City level triggers + trigger_if = { + limit = { has_building_or_higher = caravanserai_02 } + building_requirement_castle_city_church = { LEVEL = 02 } + } + trigger_if = { + limit = { has_building_or_higher = caravanserai_04 } + building_requirement_castle_city_church = { LEVEL = 03 } + } + trigger_if = { + limit = { has_building_or_higher = caravanserai_05 } + scope:build_owner.culture = { has_innovation = innovation_cranes } + } + trigger_if = { + limit = { has_building_or_higher = caravanserai_06 } + building_requirement_castle_city_church = { LEVEL = 04 } + } + } + set_variable = { + name = random_building_variable + value = 30 + days = 365 + } + } + 1 = { # watermills : Expensive + trigger = { + is_county_capital = yes + building_watermills_requirement_terrain = yes + scope:build_owner.culture = { + has_innovation = innovation_windmills + } + building_requirement_castle_city_church = { LEVEL = 01 } + trigger_if = { # if all slots are full, this building type exists already + limit = { free_building_slots = 0 } + has_building_or_higher = watermills_01 + } + trigger_if = { + limit = { has_building_or_higher = watermills_01 } + NOT = { + has_lesser_building_trigger = { COMPARE = watermills } + } + } + # City level triggers + trigger_if = { + limit = { has_building_or_higher = watermills_02 } + building_requirement_castle_city_church = { LEVEL = 02 } + } + trigger_if = { + limit = { has_building_or_higher = watermills_04 } + building_requirement_castle_city_church = { LEVEL = 03 } + } + trigger_if = { + limit = { has_building_or_higher = watermills_05 } + scope:build_owner.culture = { has_innovation = innovation_cranes } + } + trigger_if = { + limit = { has_building_or_higher = watermills_06 } + building_requirement_castle_city_church = { LEVEL = 04 } + } + } + set_variable = { + name = random_building_variable + value = 31 + days = 365 + } + } + 1 = { # windmills : Expensive + trigger = { + is_county_capital = yes + building_windmills_requirement_terrain = yes + scope:build_owner.culture = { + has_innovation = innovation_windmills + } + building_requirement_castle_city_church = { LEVEL = 01 } + trigger_if = { # if all slots are full, this building type exists already + limit = { free_building_slots = 0 } + has_building_or_higher = windmills_01 + } + trigger_if = { + limit = { has_building_or_higher = windmills_01 } + NOT = { + has_lesser_building_trigger = { COMPARE = windmills } + } + } + # City level triggers + trigger_if = { + limit = { has_building_or_higher = windmills_02 } + building_requirement_castle_city_church = { LEVEL = 02 } + } + trigger_if = { + limit = { has_building_or_higher = windmills_04 } + building_requirement_castle_city_church = { LEVEL = 03 } + } + trigger_if = { + limit = { has_building_or_higher = windmills_05 } + scope:build_owner.culture = { has_innovation = innovation_cranes } + } + trigger_if = { + limit = { has_building_or_higher = windmills_06 } + building_requirement_castle_city_church = { LEVEL = 04 } + } + } + set_variable = { + name = random_building_variable + value = 32 + days = 365 + } + } + 1 = { # workshops : Expensive + trigger = { + add_random_building_trigger = { BUILDING = workshops } + building_requirement_castle_city_church = { LEVEL = 01 } + scope:build_owner.culture = { + has_innovation = innovation_advanced_bowmaking + } + trigger_if = { + limit = { + has_building_or_higher = workshops_02 + } + building_requirement_castle_city_church = { LEVEL = 02 } + } + trigger_if = { + limit = { + has_building_or_higher = workshops_04 + } + building_requirement_castle_city_church = { LEVEL = 03 } + } + trigger_if = { + limit = { + has_building_or_higher = workshops_05 + } + scope:build_owner.culture = { + has_innovation = innovation_royal_armory + } + } + trigger_if = { + limit = { + has_building_or_higher = workshops_06 + } + building_requirement_castle_city_church = { LEVEL = 04 } + } + } + set_variable = { + name = random_building_variable + value = 33 + days = 365 + } + } + # Holding Type Specific : Normal + 10 = { # monastic_schools : Normal + trigger = { + has_holding_type = church_holding + trigger_if = { # if all slots are full, this building type exists already + limit = { free_building_slots = 0 } + has_building_or_higher = monastic_schools_01 + } + trigger_if = { + limit = { has_building_or_higher = monastic_schools_01 } + NOT = { + has_lesser_building_trigger = { COMPARE = monastic_schools } + } + } + # Innovation triggers + trigger_if = { + limit = { has_building_or_higher = monastic_schools_01 } + scope:build_owner.culture = { has_innovation = innovation_city_planning } + } + trigger_if = { + limit = { has_building_or_higher = monastic_schools_02 } + building_requirement_castle_city_church = { LEVEL = 02 } + scope:build_owner.culture = { has_innovation = innovation_manorialism } + } + trigger_if = { + limit = { has_building_or_higher = monastic_schools_04 } + building_requirement_castle_city_church = { LEVEL = 03 } + scope:build_owner.culture = { has_innovation = innovation_windmills } + } + trigger_if = { + limit = { has_building_or_higher = monastic_schools_06 } + building_requirement_castle_city_church = { LEVEL = 04 } + scope:build_owner.culture = { has_innovation = innovation_cranes } + } + } + set_variable = { + name = random_building_variable + value = 34 + days = 365 + } + } + 10 = { # guild_halls : Normal + trigger = { + has_holding_type = city_holding + trigger_if = { # if all slots are full, this building type exists already + limit = { free_building_slots = 0 } + has_building_or_higher = guild_halls_01 + } + trigger_if = { + limit = { has_building_or_higher = guild_halls_01 } + NOT = { + has_lesser_building_trigger = { COMPARE = guild_halls } + } + } + # Innovation triggers + trigger_if = { + limit = { has_building_or_higher = guild_halls_01 } + scope:build_owner.culture = { + OR = { + has_innovation = innovation_crop_rotation + has_cultural_parameter = next_level_guild_halls + } + } + } + trigger_if = { + limit = { has_building_or_higher = guild_halls_02 } + OR = { + AND = { + building_requirement_castle_city_church = { LEVEL = 02 } + scope:build_owner.culture = { + has_innovation = innovation_manorialism + } + } + scope:build_owner.culture = { + has_cultural_parameter = next_level_guild_halls + has_innovation = innovation_crop_rotation + } + } + } + trigger_if = { + limit = { has_building_or_higher = guild_halls_04 } + OR = { + AND = { + building_requirement_castle_city_church = { LEVEL = 03 } + scope:build_owner.culture = { + has_innovation = innovation_guilds + } + } + AND = { + building_requirement_castle_city_church = { LEVEL = 02 } + scope:build_owner.culture = { + has_cultural_parameter = next_level_guild_halls + has_innovation = innovation_manorialism + } + } + } + } + trigger_if = { + limit = { has_building_or_higher = guild_halls_06 } + OR = { + AND = { + building_requirement_castle_city_church = { LEVEL = 04 } + scope:build_owner.culture = { + has_innovation = innovation_cranes + } + } + AND = { + building_requirement_castle_city_church = { LEVEL = 03 } + scope:build_owner.culture = { + has_cultural_parameter = next_level_guild_halls + has_innovation = innovation_guilds + } + } + } + } + } + set_variable = { + name = random_building_variable + value = 35 + days = 365 + } + } + 10 = { # scriptorium : Normal + trigger = { + has_holding_type = church_holding + scope:build_owner = { + has_dlc_feature = legends + } + trigger_if = { # if all slots are full, this building type exists already + limit = { free_building_slots = 0 } + has_building_or_higher = scriptorium_01 + } + trigger_if = { + limit = { has_building_or_higher = scriptorium_01 } + NOT = { + has_lesser_building_trigger = { COMPARE = scriptorium } + } + } + generic_economic_building_innovation_trigger = { BUILDING = scriptorium } + } + set_variable = { + name = random_building_variable + value = 36 + days = 365 + } + } + 10 = { # megalith : Normal + trigger = { + has_holding_type = church_holding + scope:build_owner.faith = { + has_doctrine_parameter = can_build_megaliths + } + trigger_if = { # if all slots are full, this building type exists already + limit = { free_building_slots = 0 } + has_building_or_higher = megalith_01 + } + trigger_if = { + limit = { has_building_or_higher = megalith_01 } + NOT = { + has_lesser_building_trigger = { COMPARE = megalith } + } + } + trigger_if = { + limit = { has_building_or_higher = megalith_02 } + scope:build_owner.culture = { + has_innovation = innovation_city_planning + } + } + trigger_if = { + limit = { has_building_or_higher = megalith_03 } + building_requirement_castle_city_church = { LEVEL = 02 } + } + } + set_variable = { + name = random_building_variable + value = 37 + days = 365 + } + } + 2 = { # waterworks : Normal + trigger = { + add_random_building_trigger = { BUILDING = waterworks } + building_requirement_castle_city_church = { LEVEL = 01 } + county = { NOT = { has_county_modifier = backwater_county_modifier } } + trigger_if = { + limit = { + has_building_or_higher = waterworks_02 + } + building_requirement_castle_city_church = { LEVEL = 02 } + } + trigger_if = { + limit = { + has_building_or_higher = waterworks_04 + } + building_requirement_castle_city_church = { LEVEL = 03 } + } + trigger_if = { + limit = { + has_building_or_higher = waterworks_06 + } + building_requirement_castle_city_church = { LEVEL = 03 } + } + } + set_variable = { + name = random_building_variable + value = 42 + days = 365 + } + } + 2 = { # paddy_fields : Normal + trigger = { + add_random_building_trigger = { BUILDING = paddy_fields } + generic_economic_building_innovation_trigger = { BUILDING = paddy_fields } + } + set_variable = { + name = random_building_variable + value = 43 + days = 365 + } + } + } +} + +# 2, builds based on variable +add_random_building_construct_effect = { # Province scope + if = { + limit = { has_variable = random_building_variable } + switch = { + trigger = var:random_building_variable + 0 = { + add_next_building_tier_effect = { BUILDING = outposts } + } + 1 = { + add_next_building_tier_effect = { BUILDING = logging_camps } + } + 2 = { + add_next_building_tier_effect = { BUILDING = peat_quarries } + } + 3 = { + add_next_building_tier_effect = { BUILDING = hill_forts } + } + 4 = { + add_next_building_tier_effect = { BUILDING = plantations } + } + 5 = { + add_next_building_tier_effect = { BUILDING = quarries } + } + 6 = { + add_next_building_tier_effect = { BUILDING = hunting_grounds } + } + 7 = { + add_next_building_tier_effect = { BUILDING = military_camps } + } + 8 = { + add_next_building_tier_effect = { BUILDING = horse_pastures } + } + 9 = { + add_next_building_tier_effect = { BUILDING = hillside_grazing } + } + 10 = { + add_next_building_tier_effect = { BUILDING = warrior_lodges } + } + 11 = { + add_next_building_tier_effect = { BUILDING = pastures } + } + 12 = { + add_next_building_tier_effect = { BUILDING = ramparts } + } + 13 = { + add_next_building_tier_effect = { BUILDING = curtain_walls } + } + 14 = { + add_next_building_tier_effect = { BUILDING = watchtowers } + } + 15 = { + add_next_building_tier_effect = { BUILDING = cereal_fields } + } + 16 = { + add_next_building_tier_effect = { BUILDING = barracks } + } + 17 = { + add_next_building_tier_effect = { BUILDING = camel_farms } + } + 18 = { + add_next_building_tier_effect = { BUILDING = hill_farms } + } + 19 = { + add_next_building_tier_effect = { BUILDING = elephant_pens } + } + 20 = { + add_next_building_tier_effect = { BUILDING = common_tradeport } + } + 21 = { + add_next_building_tier_effect = { BUILDING = hospices } + } + 22 = { + add_next_building_tier_effect = { BUILDING = qanats } + } + 23 = { + add_next_building_tier_effect = { BUILDING = murex_farm } + } + 24 = { + add_next_building_tier_effect = { BUILDING = wind_furnace } + } + 25 = { + add_next_building_tier_effect = { BUILDING = stables } + } + 26 = { + add_next_building_tier_effect = { BUILDING = smiths } + } + 27 = { + add_next_building_tier_effect = { BUILDING = orchards } + } + 28 = { + add_next_building_tier_effect = { BUILDING = farm_estates } + } + 29 = { + add_next_building_tier_effect = { BUILDING = regimental_grounds } + } + 30 = { + add_next_building_tier_effect = { BUILDING = caravanserai } + } + 31 = { + add_next_building_tier_effect = { BUILDING = windmills } + } + 32 = { + add_next_building_tier_effect = { BUILDING = watermills } + } + 33 = { + add_next_building_tier_effect = { BUILDING = workshops } + } + 34 = { + add_next_building_tier_effect = { BUILDING = monastic_schools } + } + 35 = { + add_next_building_tier_effect = { BUILDING = guild_halls } + } + 36 = { + add_next_building_tier_effect = { BUILDING = scriptorium } + } + 37 = { + add_next_building_tier_effect = { BUILDING = megalith } + } + 42 = { + add_next_building_tier_effect = { BUILDING = waterworks } + } + 43 = { + add_next_building_tier_effect = { BUILDING = paddy_fields } + } + } + remove_variable = random_building_variable + } +} + +# For stuff that has exactly _eight_ levels of upgrades. +destroy_or_downgrade_building_effect = { + if = { + limit = { has_building = $BUILDING$_08 } + remove_building = $BUILDING$_08 + hidden_effect = { add_building = $BUILDING$_07 } + } + else_if = { + limit = { has_building = $BUILDING$_07 } + remove_building = $BUILDING$_07 + hidden_effect = { add_building = $BUILDING$_06 } + } + else_if = { + limit = { has_building = $BUILDING$_06 } + remove_building = $BUILDING$_06 + hidden_effect = { add_building = $BUILDING$_05 } + } + else_if = { + limit = { has_building = $BUILDING$_05 } + remove_building = $BUILDING$_05 + hidden_effect = { add_building = $BUILDING$_04 } + } + else_if = { + limit = { has_building = $BUILDING$_04 } + remove_building = $BUILDING$_04 + hidden_effect = { add_building = $BUILDING$_03 } + } + else_if = { + limit = { has_building = $BUILDING$_03 } + remove_building = $BUILDING$_03 + hidden_effect = { add_building = $BUILDING$_02 } + } + else_if = { + limit = { has_building = $BUILDING$_02 } + remove_building = $BUILDING$_02 + hidden_effect = { add_building = $BUILDING$_01 } + } + else = { remove_building = $BUILDING$_01 } +} + +# For stuff that has exactly _three_ levels of upgrades. +destroy_or_downgrade_ducal_building_effect = { + if = { + limit = { has_building = $BUILDING$_03 } + remove_building = $BUILDING$_03 + hidden_effect = { add_building = $BUILDING$_02 } + } + else_if = { + limit = { has_building = $BUILDING$_02 } + remove_building = $BUILDING$_02 + hidden_effect = { add_building = $BUILDING$_01 } + } + else = { remove_building = $BUILDING$_01 } +} + +# For stuff that has exactly _two_ levels of upgrades. +destroy_or_downgrade_tribal_building_effect = { + if = { + limit = { has_building = $BUILDING$_02 } + remove_building = $BUILDING$_02 + hidden_effect = { add_building = $BUILDING$_01 } + } + else = { remove_building = $BUILDING$_01 } +} + +destroy_random_building_variable_effect = { # Province scope + save_scope_as = raid_province + if = { + limit = { has_variable = destroyed_building_variable } + remove_variable = destroyed_building_variable + } + random_list = { # Which building? + # Generic/Terrain + 10 = { # outposts : Cheap + trigger = { has_building_or_higher = outposts_01 } + set_variable = { + name = destroyed_building_variable + value = 0 + months = 1 + } + } + 10 = { # logging_camps : Cheap + trigger = { has_building_or_higher = logging_camps_01 } + set_variable = { + name = destroyed_building_variable + value = 1 + months = 1 + } + } + 10 = { # peat_quarries : Cheap + trigger = { has_building_or_higher = peat_quarries_01 } + set_variable = { + name = destroyed_building_variable + value = 2 + months = 1 + } + } + 10 = { # hill_forts : Cheap + trigger = { has_building_or_higher = hill_forts_01 } + set_variable = { + name = destroyed_building_variable + value = 3 + months = 1 + } + } + 10 = { # plantations : Cheap + trigger = { has_building_or_higher = plantations_01 } + set_variable = { + name = destroyed_building_variable + value = 4 + months = 1 + } + } + 10 = { # quarries : Cheap + trigger = { has_building_or_higher = quarries_01 } + set_variable = { + name = destroyed_building_variable + value = 5 + months = 1 + } + } + 10 = { # hunting_grounds : Cheap + trigger = { has_building_or_higher = hunting_grounds_01 } + set_variable = { + name = destroyed_building_variable + value = 6 + months = 1 + } + } + 10 = { # military_camps : Cheap + trigger = { has_building_or_higher = military_camps_01 } + set_variable = { + name = destroyed_building_variable + value = 7 + months = 1 + } + } + 10 = { # horse_pastures : Cheap + trigger = { has_building_or_higher = horse_pastures_01 } + set_variable = { + name = destroyed_building_variable + value = 8 + months = 1 + } + } + 10 = { # hillside_grazing : Cheap + trigger = { has_building_or_higher = hillside_grazing_01 } + set_variable = { + name = destroyed_building_variable + value = 9 + months = 1 + } + } + 10 = { # warrior_lodges : Cheap + trigger = { has_building_or_higher = warrior_lodges_01 } + set_variable = { + name = destroyed_building_variable + value = 10 + months = 1 + } + } + 2 = { # pastures : Normal + trigger = { has_building_or_higher = pastures_01 } + set_variable = { + name = destroyed_building_variable + value = 11 + months = 1 + } + } + 2 = { # ramparts : Normal + trigger = { has_building_or_higher = ramparts_01 } + set_variable = { + name = destroyed_building_variable + value = 12 + months = 1 + } + } + 2 = { # curtain_walls : Normal + trigger = { has_building_or_higher = curtain_walls_01 } + set_variable = { + name = destroyed_building_variable + value = 13 + months = 1 + } + } + 2 = { # watchtowers : Normal + trigger = { has_building_or_higher = watchtowers_01 } + set_variable = { + name = destroyed_building_variable + value = 14 + months = 1 + } + } + 2 = { # cereal_fields : Normal + trigger = { has_building_or_higher = cereal_fields_01 } + set_variable = { + name = destroyed_building_variable + value = 15 + months = 1 + } + } + 2 = { # barracks : Normal + trigger = { has_building_or_higher = barracks_01 } + set_variable = { + name = destroyed_building_variable + value = 16 + months = 1 + } + } + 2 = { # camel_farms : Normal + trigger = { has_building_or_higher = camel_farms_01 } + set_variable = { + name = destroyed_building_variable + value = 17 + months = 1 + } + } + 2 = { # hill_farms : Normal + trigger = { has_building_or_higher = hill_farms_01 } + set_variable = { + name = destroyed_building_variable + value = 18 + months = 1 + } + } + 2 = { # paddy_fields : Normal + trigger = { has_building_or_higher = hill_farms_01 } + set_variable = { + name = destroyed_building_variable + value = 43 + months = 1 + } + } + 2 = { # elephant_pens : Normal + trigger = { has_building_or_higher = elephant_pens_01 } + set_variable = { + name = destroyed_building_variable + value = 19 + months = 1 + } + } + 2 = { # common_tradeport : Normal + trigger = { has_building_or_higher = common_tradeport_01 } + set_variable = { + name = destroyed_building_variable + value = 20 + months = 1 + } + } + 2 = { # hospices : Normal + trigger = { has_building_or_higher = hospices_01 } + set_variable = { + name = destroyed_building_variable + value = 21 + months = 1 + } + } + 2 = { # qanats : Normal + trigger = { has_building_or_higher = qanats_01 } + set_variable = { + name = destroyed_building_variable + value = 22 + months = 1 + } + } + 2 = { # murex_farm : Normal + trigger = { has_building_or_higher = murex_farm_01 } + set_variable = { + name = destroyed_building_variable + value = 23 + months = 1 + } + } + 2 = { # waterworks : Normal + trigger = { has_building_or_higher = waterworks_01 } + set_variable = { + name = destroyed_building_variable + value = 42 + months = 1 + } + } + 2 = { # wind_furnace : Normal + trigger = { has_building_or_higher = wind_furnace_01 } + set_variable = { + name = destroyed_building_variable + value = 24 + months = 1 + } + } + 2 = { # stables : Normal + trigger = { has_building_or_higher = stables_01 } + set_variable = { + name = destroyed_building_variable + value = 25 + months = 1 + } + } + 2 = { # smiths : Normal + trigger = { has_building_or_higher = smiths_01 } + set_variable = { + name = destroyed_building_variable + value = 26 + months = 1 + } + } + 1 = { # orchards : Expensive + trigger = { has_building_or_higher = orchards_01 } + set_variable = { + name = destroyed_building_variable + value = 27 + months = 1 + } + } + 1 = { # farm_estates : Expensive + trigger = { has_building_or_higher = farm_estates_01 } + set_variable = { + name = destroyed_building_variable + value = 28 + months = 1 + } + } + 1 = { # regimental_grounds : Expensive + trigger = { has_building_or_higher = regimental_grounds_01 } + set_variable = { + name = destroyed_building_variable + value = 29 + months = 1 + } + } + 1 = { # caravanserai : Expensive + trigger = { has_building_or_higher = caravanserai_01 } + set_variable = { + name = destroyed_building_variable + value = 30 + months = 1 + } + } + 1 = { # watermills : Expensive + trigger = { has_building_or_higher = watermills_01 } + set_variable = { + name = destroyed_building_variable + value = 31 + months = 1 + } + } + 1 = { # windmills : Expensive + trigger = { has_building_or_higher = windmills_01 } + set_variable = { + name = destroyed_building_variable + value = 32 + months = 1 + } + } + 1 = { # workshops : Expensive + trigger = { has_building_or_higher = workshops_01 } + set_variable = { + name = destroyed_building_variable + value = 33 + months = 1 + } + } + # Holding Type Specific : Normal + 10 = { # monastic_schools : Normal + trigger = { has_building_or_higher = monastic_schools_01 } + set_variable = { + name = destroyed_building_variable + value = 21 + months = 1 + } + } + 10 = { # guild_halls : Normal + trigger = { has_building_or_higher = guild_halls_01 } + set_variable = { + name = destroyed_building_variable + value = 35 + months = 1 + } + } + 10 = { # scriptorium : Normal + trigger = { has_building_or_higher = scriptorium_01 } + set_variable = { + name = destroyed_building_variable + value = 36 + months = 1 + } + } + 10 = { # megalith : Normal + trigger = { has_building_or_higher = megalith_01 } + set_variable = { + name = destroyed_building_variable + value = 37 + months = 1 + } + } + 10 = { # Waterworks + trigger = { has_building_or_higher = waterworks_01 } + set_variable = { + name = destroyed_building_variable + value = 42 + months = 1 + } + } + 10 = { # Paddy Fields + trigger = { has_building_or_higher = paddy_fields_01 } + set_variable = { + name = destroyed_building_variable + value = 43 + months = 1 + } + } + # Tribal + 10 = { # Market Villages + trigger = { has_building_or_higher = market_villages_01 } + set_variable = { + name = destroyed_building_variable + value = 38 + months = 1 + } + } + 10 = { # Palisades + trigger = { has_building_or_higher = palisades_01 } + set_variable = { + name = destroyed_building_variable + value = 39 + months = 1 + } + } + 10 = { # War Camps + trigger = { has_building_or_higher = war_camps_01 } + set_variable = { + name = destroyed_building_variable + value = 40 + months = 1 + } + } + 10 = { # Longhouses + trigger = { has_building_or_higher = longhouses_01 } + set_variable = { + name = destroyed_building_variable + value = 41 + months = 1 + } + } + } +} + +destroy_random_building_effect = { + if = { + limit = { has_variable = destroyed_building_variable } + switch = { + trigger = var:destroyed_building_variable + 0 = { # outposts : Cheap + destroy_or_downgrade_building_effect = { BUILDING = outposts } + } + 1 = { # logging_camps : Cheap + destroy_or_downgrade_building_effect = { BUILDING = logging_camps } + } + 2 = { # peat_quarries : Cheap + destroy_or_downgrade_building_effect = { BUILDING = peat_quarries } + } + 3 = { # hill_forts : Cheap + destroy_or_downgrade_building_effect = { BUILDING = hill_forts } + } + 4 = { # plantations : Cheap + destroy_or_downgrade_building_effect = { BUILDING = plantations } + } + 5 = { # quarries : Cheap + destroy_or_downgrade_building_effect = { BUILDING = quarries } + } + 6 = { # hunting_grounds : Cheap + destroy_or_downgrade_building_effect = { BUILDING = hunting_grounds } + } + 7 = { # military_camps : Cheap + destroy_or_downgrade_building_effect = { BUILDING = military_camps } + } + 8 = { # horse_pastures : Cheap + destroy_or_downgrade_building_effect = { BUILDING = horse_pastures } + } + 9 = { # hillside_grazing : Cheap + destroy_or_downgrade_building_effect = { BUILDING = hillside_grazing } + } + 10 = { # warrior_lodges : Cheap + destroy_or_downgrade_building_effect = { BUILDING = warrior_lodges } + } + 11 = { # pastures : Normal + destroy_or_downgrade_building_effect = { BUILDING = pastures } + } + 12 = { # ramparts : Normal + destroy_or_downgrade_building_effect = { BUILDING = ramparts } + } + 13 = { # curtain_walls : Normal + destroy_or_downgrade_building_effect = { BUILDING = curtain_walls } + } + 14 = { # watchtowers : Normal + destroy_or_downgrade_building_effect = { BUILDING = watchtowers } + } + 15 = { # cereal_fields : Normal + destroy_or_downgrade_building_effect = { BUILDING = cereal_fields } + } + 16 = { # barracks : Normal + destroy_or_downgrade_building_effect = { BUILDING = barracks } + } + 17 = { # camel_farms : Normal + destroy_or_downgrade_building_effect = { BUILDING = camel_farms } + } + 18 = { # hill_farms : Normal + destroy_or_downgrade_building_effect = { BUILDING = hill_farms } + } + 19 = { # elephant_pens : Normal + destroy_or_downgrade_building_effect = { BUILDING = elephant_pens } + } + 20 = { # common_tradeport : Normal + destroy_or_downgrade_building_effect = { BUILDING = common_tradeport } + } + 21 = { # hospices : Normal + destroy_or_downgrade_building_effect = { BUILDING = hospices } + } + 22 = { # qanats : Normal + destroy_or_downgrade_building_effect = { BUILDING = qanats } + } + 23 = { # murex_farm : Normal + destroy_or_downgrade_building_effect = { BUILDING = murex_farm } + } + 24 = { # wind_furnace : Normal + destroy_or_downgrade_building_effect = { BUILDING = wind_furnace } + } + 25 = { # stables : Normal + destroy_or_downgrade_building_effect = { BUILDING = stables } + } + 26 = { # smiths : Normal + destroy_or_downgrade_building_effect = { BUILDING = smiths } + } + 27 = { # orchards : Expensive + destroy_or_downgrade_building_effect = { BUILDING = orchards } + } + 28 = { # farm_estates : Expensive + destroy_or_downgrade_building_effect = { BUILDING = farm_estates } + } + 29 = { # regimental_grounds : Expensive + destroy_or_downgrade_building_effect = { BUILDING = regimental_grounds } + } + 30 = { # caravanserai : Expensive + destroy_or_downgrade_building_effect = { BUILDING = caravanserai } + } + 31 = { # watermills : Expensive + destroy_or_downgrade_building_effect = { BUILDING = watermills } + } + 32 = { # windmills : Expensive + destroy_or_downgrade_building_effect = { BUILDING = windmills } + } + 33 = { # workshops : Expensive + destroy_or_downgrade_building_effect = { BUILDING = workshops } + } + # Holding Type Specific : Normal + 34 = { # monastic_schools : Normal + destroy_or_downgrade_building_effect = { BUILDING = monastic_schools } + } + 35 = { # guild_halls : Normal + destroy_or_downgrade_building_effect = { BUILDING = guild_halls } + } + 36 = { # scriptorium : Normal + destroy_or_downgrade_building_effect = { BUILDING = scriptorium } + } + 37 = { # megalith : Normal + destroy_or_downgrade_building_effect = { BUILDING = megalith } + } + 42 = { # waterworks : Normal + destroy_or_downgrade_building_effect = { BUILDING = waterworks } + } + 43 = { # paddy_fields : Normal + destroy_or_downgrade_building_effect = { BUILDING = paddy_fields } + } + # Tribal + 38 = { # megalith : Normal + destroy_or_downgrade_tribal_building_effect = { BUILDING = market_villages } + } + 39 = { # megalith : Normal + destroy_or_downgrade_tribal_building_effect = { BUILDING = palisades } + } + 40 = { # megalith : Normal + destroy_or_downgrade_tribal_building_effect = { BUILDING = war_camps } + } + 41 = { # megalith : Normal + destroy_or_downgrade_tribal_building_effect = { BUILDING = longhouses } + } + } + remove_variable = destroyed_building_variable + } +} + +destroy_or_downgrade_estate_building_2_effect = { + if = { + limit = { has_domicile_building = $BUILDING$_02 } + lower_domicile_building_no_refund = $BUILDING$_02 + } + else = { remove_domicile_building_no_refund = $BUILDING$_01 } +} + +destroy_or_downgrade_estate_building_3_effect = { + if = { + limit = { has_domicile_building = $BUILDING$_03 } + lower_domicile_building_no_refund = $BUILDING$_03 + } + else_if = { + limit = { has_domicile_building = $BUILDING$_02 } + lower_domicile_building_no_refund = $BUILDING$_02 + } + else = { remove_domicile_building_no_refund = $BUILDING$_01 } +} + +destroy_or_downgrade_estate_building_4_effect = { + if = { + limit = { has_domicile_building = $BUILDING$_04 } + lower_domicile_building_no_refund = $BUILDING$_04 + } + else_if = { + limit = { has_domicile_building = $BUILDING$_03 } + lower_domicile_building_no_refund = $BUILDING$_03 + } + else_if = { + limit = { has_domicile_building = $BUILDING$_02 } + lower_domicile_building_no_refund = $BUILDING$_02 + } + else = { remove_domicile_building_no_refund = $BUILDING$_01 } +} + +destroy_or_downgrade_estate_building_5_effect = { + if = { + limit = { has_domicile_building = $BUILDING$_05 } + lower_domicile_building_no_refund = $BUILDING$_05 + } + else_if = { + limit = { has_domicile_building = $BUILDING$_04 } + lower_domicile_building_no_refund = $BUILDING$_04 + } + else_if = { + limit = { has_domicile_building = $BUILDING$_03 } + lower_domicile_building_no_refund = $BUILDING$_03 + } + else_if = { + limit = { has_domicile_building = $BUILDING$_02 } + lower_domicile_building_no_refund = $BUILDING$_02 + } + else = { remove_domicile_building_no_refund = $BUILDING$_01 } +} + +destroy_or_downgrade_estate_building_6_effect = { + if = { + limit = { has_domicile_building = $BUILDING$_06 } + lower_domicile_building_no_refund = $BUILDING$_06 + } + if = { + limit = { has_domicile_building = $BUILDING$_05 } + lower_domicile_building_no_refund = $BUILDING$_05 + } + if = { + limit = { has_domicile_building = $BUILDING$_04 } + lower_domicile_building_no_refund = $BUILDING$_04 + } + if = { + limit = { has_domicile_building = $BUILDING$_03 } + lower_domicile_building_no_refund = $BUILDING$_03 + } + else_if = { + limit = { has_domicile_building = $BUILDING$_02 } + lower_domicile_building_no_refund = $BUILDING$_02 + } + else = { remove_domicile_building_no_refund = $BUILDING$_01 } +} + +destroy_or_downgrade_estate_building_2_4_replacement_effect = { + if = { + limit = { has_domicile_building = $BUILDING$_04 } + lower_domicile_building_no_refund = $BUILDING$_04 + } + else = { + lower_domicile_building_no_refund = $BUILDING$_03 + } +} + +destroy_or_downgrade_estate_building_2_6_replacement_effect = { + if = { + limit = { has_domicile_building = $BUILDING$_06 } + lower_domicile_building_no_refund = $BUILDING$_06 + } + else_if = { + limit = { has_domicile_building = $BUILDING$_05 } + lower_domicile_building_no_refund = $BUILDING$_05 + } + else_if = { + limit = { has_domicile_building = $BUILDING$_04 } + lower_domicile_building_no_refund = $BUILDING$_04 + } + else = { + lower_domicile_building_no_refund = $BUILDING$_03 + } +} + +destroy_or_downgrade_estate_building_3_6_replacement_effect = { + if = { + limit = { has_domicile_building = $BUILDING$_06 } + lower_domicile_building_no_refund = $BUILDING$_06 + } + else_if = { + limit = { has_domicile_building = $BUILDING$_05 } + lower_domicile_building_no_refund = $BUILDING$_05 + } + else = { + lower_domicile_building_no_refund = $BUILDING$_04 + } +} + +destroy_random_estate_building_variable_effect = { # Domicile scope + save_scope_as = raid_domicile + if = { + limit = { has_variable = destroyed_building_variable } + remove_variable = destroyed_building_variable + } + random_list = { # Which building? + # Generic/Terrain + 10 = { # barracks : Normal + trigger = { has_domicile_building_or_higher = barracks_01 } + set_variable = { + name = destroyed_building_variable + value = 0 + months = 1 + } + } + 10 = { # watchtower : Normal + trigger = { has_domicile_building_or_higher = watchtower_01 } + set_variable = { + name = destroyed_building_variable + value = 1 + months = 1 + } + } + 10 = { # guardhouse : Normal + trigger = { has_domicile_building_or_higher = guardhouse_01 } + set_variable = { + name = destroyed_building_variable + value = 2 + months = 1 + } + } + 10 = { # garden : Normal + trigger = { has_domicile_building_or_higher = garden_01 } + set_variable = { + name = destroyed_building_variable + value = 3 + months = 1 + } + } + 10 = { # stable : Normal + trigger = { has_domicile_building_or_higher = stable_01 } + set_variable = { + name = destroyed_building_variable + value = 4 + months = 1 + } + } + 10 = { # workshop : Normal + trigger = { has_domicile_building_or_higher = workshop_01 } + set_variable = { + name = destroyed_building_variable + value = 5 + months = 1 + } + } + 10 = { # storage : Normal + trigger = { has_domicile_building_or_higher = storage_01 } + set_variable = { + name = destroyed_building_variable + value = 6 + months = 1 + } + } + 10 = { # market : Normal + trigger = { has_domicile_building_or_higher = market_01 } + set_variable = { + name = destroyed_building_variable + value = 7 + months = 1 + } + } + 10 = { # grazing_land : Normal + trigger = { has_domicile_building_or_higher = grazing_land_01 } + set_variable = { + name = destroyed_building_variable + value = 8 + months = 1 + } + } + 10 = { # grain_field : Normal + trigger = { has_domicile_building_or_higher = grain_field_01 } + set_variable = { + name = destroyed_building_variable + value = 9 + months = 1 + } + } + 10 = { # living_quarters : Normal + trigger = { has_domicile_building_or_higher = living_quarters_01 } + set_variable = { + name = destroyed_building_variable + value = 10 + months = 1 + } + } + 10 = { # vineyard : Normal + trigger = { has_domicile_building_or_higher = vineyard_01 } + set_variable = { + name = destroyed_building_variable + value = 11 + months = 1 + } + } + 10 = { # olive : Normal + trigger = { has_domicile_building_or_higher = olive_01 } + set_variable = { + name = destroyed_building_variable + value = 12 + months = 1 + } + } + 10 = { # temple : Normal + trigger = { has_domicile_building_or_higher = temple_small_01 } + set_variable = { + name = destroyed_building_variable + value = 13 + months = 1 + } + } + 10 = { # grand_solar : Normal + trigger = { has_domicile_building_or_higher = grand_solar_01 } + set_variable = { + name = destroyed_building_variable + value = 14 + months = 1 + } + } + 10 = { # cabinet_of_curiosities : Normal + trigger = { has_domicile_building_or_higher = cabinet_of_curiosities_01 } + set_variable = { + name = destroyed_building_variable + value = 15 + months = 1 + } + } + 10 = { # reception_hall : Normal + trigger = { has_domicile_building_or_higher = reception_hall_01 } + set_variable = { + name = destroyed_building_variable + value = 16 + months = 1 + } + } + 10 = { # prison : Normal + trigger = { has_domicile_building_or_higher = prison_01 } + set_variable = { + name = destroyed_building_variable + value = 17 + months = 1 + } + } + 10 = { # courtyard : Normal + trigger = { has_domicile_building_or_higher = courtyard_01 } + set_variable = { + name = destroyed_building_variable + value = 18 + months = 1 + } + } + 10 = { # wine_cellar : Normal + trigger = { has_domicile_building_or_higher = wine_cellar_01 } + set_variable = { + name = destroyed_building_variable + value = 19 + months = 1 + } + } + 10 = { # guest_room : Normal + trigger = { has_domicile_building_or_higher = guest_room_01 } + set_variable = { + name = destroyed_building_variable + value = 20 + months = 1 + } + } + 10 = { # bath : Normal + trigger = { has_domicile_building_or_higher = bath_01 } + set_variable = { + name = destroyed_building_variable + value = 21 + months = 1 + } + } + 10 = { # library : Normal + trigger = { has_domicile_building_or_higher = library_01 } + set_variable = { + name = destroyed_building_variable + value = 22 + months = 1 + } + } + 10 = { # servants_quarters : Normal + trigger = { has_domicile_building_or_higher = servants_quarters_01 } + set_variable = { + name = destroyed_building_variable + value = 23 + months = 1 + } + } + 10 = { # office : Normal + trigger = { has_domicile_building_or_higher = office_01 } + set_variable = { + name = destroyed_building_variable + value = 24 + months = 1 + } + } + 10 = { # trophy_room : Normal + trigger = { has_domicile_building_or_higher = trophy_room_01 } + set_variable = { + name = destroyed_building_variable + value = 25 + months = 1 + } + } + 10 = { # silk : Normal + trigger = { has_domicile_building_or_higher = silk_01 } + set_variable = { + name = destroyed_building_variable + value = 26 + months = 1 + } + } + } +} + +destroy_random_estate_building_effect = { + if = { + limit = { has_variable = destroyed_building_variable } + switch = { + trigger = var:destroyed_building_variable + 0 = { # barracks : Cheap + destroy_or_downgrade_estate_building_6_effect = { BUILDING = barracks } + } + 1 = { # watchtower : Cheap + destroy_or_downgrade_estate_building_6_effect = { BUILDING = watchtower } + } + 2 = { # guardhouse : Cheap + destroy_or_downgrade_estate_building_4_effect = { BUILDING = guardhouse } + } + 3 = { # garden : Cheap + if = { + limit = { has_domicile_building_or_higher = garden_leisure_04 } + destroy_or_downgrade_estate_building_3_6_replacement_effect = { BUILDING = garden_leisure } + } + else_if = { + limit = { has_domicile_building_or_higher = garden_fruit_04 } + destroy_or_downgrade_estate_building_3_6_replacement_effect = { BUILDING = garden_fruit } + } + else = { + destroy_or_downgrade_estate_building_3_effect = { BUILDING = garden } + } + } + 4 = { # stable : Cheap + if = { + limit = { has_domicile_building_or_higher = stable_grand_04 } + destroy_or_downgrade_estate_building_3_6_replacement_effect = { BUILDING = stable_grand } + } + else_if = { + limit = { has_domicile_building_or_higher = stable_kennel_04 } + destroy_or_downgrade_estate_building_3_6_replacement_effect = { BUILDING = stable_kennel } + } + else_if = { + limit = { has_domicile_building_or_higher = stable_chariot_04 } + destroy_or_downgrade_estate_building_3_6_replacement_effect = { BUILDING = stable_chariot } + } + else = { + destroy_or_downgrade_estate_building_3_effect = { BUILDING = stable } + } + } + 5 = { # workshop : Cheap + if = { + limit = { has_domicile_building_or_higher = workshop_carpenter_03 } + destroy_or_downgrade_estate_building_2_6_replacement_effect = { BUILDING = workshop_carpenter } + } + else_if = { + limit = { has_domicile_building_or_higher = workshop_mason_03 } + destroy_or_downgrade_estate_building_2_6_replacement_effect = { BUILDING = workshop_mason } + } + else_if = { + limit = { has_domicile_building_or_higher = workshop_textile_03 } + destroy_or_downgrade_estate_building_2_6_replacement_effect = { BUILDING = workshop_textile } + } + else = { + destroy_or_downgrade_estate_building_2_effect = { BUILDING = workshop } + } + } + 6 = { # storage : Cheap + if = { + limit = { has_domicile_building_or_higher = storage_warehouse_03 } + destroy_or_downgrade_estate_building_2_4_replacement_effect = { BUILDING = storage_warehouse } + } + else_if = { + limit = { has_domicile_building_or_higher = storage_granary_03 } + destroy_or_downgrade_estate_building_2_4_replacement_effect = { BUILDING = storage_granary } + } + else = { + destroy_or_downgrade_estate_building_2_effect = { BUILDING = storage } + } + } + 7 = { # market : Cheap + destroy_or_downgrade_estate_building_6_effect = { BUILDING = market } + } + 8 = { # grazing_land : Cheap + if = { + limit = { has_domicile_building_or_higher = horse_pasture_04 } + destroy_or_downgrade_estate_building_3_6_replacement_effect = { BUILDING = horse_pasture } + } + else_if = { + limit = { has_domicile_building_or_higher = camel_pasture_04 } + destroy_or_downgrade_estate_building_3_6_replacement_effect = { BUILDING = camel_pasture } + } + else_if = { + limit = { has_domicile_building_or_higher = elephant_pasture_04 } + destroy_or_downgrade_estate_building_3_6_replacement_effect = { BUILDING = elephant_pasture } + } + else = { + destroy_or_downgrade_estate_building_6_effect = { BUILDING = grazing_land } + } + } + 9 = { # grain_field : Cheap + destroy_or_downgrade_estate_building_6_effect = { BUILDING = grain_field } + } + 10 = { # living_quarters : Cheap + destroy_or_downgrade_estate_building_4_effect = { BUILDING = living_quarters } + } + 11 = { # vineyard : Cheap + destroy_or_downgrade_estate_building_6_effect = { BUILDING = vineyard } + } + 12 = { # olive : Cheap + destroy_or_downgrade_estate_building_6_effect = { BUILDING = olive } + } + 13 = { # temple : Cheap + if = { + limit = { has_domicile_building_or_higher = temple_crypt_04 } + destroy_or_downgrade_estate_building_3_6_replacement_effect = { BUILDING = temple_crypt } + } + else_if = { + limit = { has_domicile_building_or_higher = temple_large_04 } + destroy_or_downgrade_estate_building_3_6_replacement_effect = { BUILDING = temple_large } + } + else_if = { + limit = { has_domicile_building_or_higher = temple_monastery_04 } + destroy_or_downgrade_estate_building_3_6_replacement_effect = { BUILDING = temple_monastery } + } + else = { + destroy_or_downgrade_estate_building_3_effect = { BUILDING = temple_small } + } + } + 14 = { # grand_solar : Cheap + destroy_or_downgrade_estate_building_4_effect = { BUILDING = grand_solar } + } + 15 = { # cabinet_of_curiosities : Cheap + destroy_or_downgrade_estate_building_3_effect = { BUILDING = cabinet_of_curiosities } + } + 16 = { # reception_hall : Cheap + destroy_or_downgrade_estate_building_5_effect = { BUILDING = reception_hall } + } + 17 = { # prison : Cheap + destroy_or_downgrade_estate_building_4_effect = { BUILDING = prison } + } + 18 = { # courtyard : Cheap + destroy_or_downgrade_estate_building_4_effect = { BUILDING = courtyard } + } + 19 = { # wine_cellar : Cheap + destroy_or_downgrade_estate_building_3_effect = { BUILDING = wine_cellar } + } + 20 = { # guest_room : Cheap + destroy_or_downgrade_estate_building_6_effect = { BUILDING = guest_room } + } + 21 = { # bath : Cheap + destroy_or_downgrade_estate_building_4_effect = { BUILDING = bath } + } + 22 = { # library : Cheap + if = { + limit = { has_domicile_building_or_higher = library_observatory_03 } + destroy_or_downgrade_estate_building_2_4_replacement_effect = { BUILDING = library_observatory } + } + else_if = { + limit = { has_domicile_building_or_higher = library_education_03 } + destroy_or_downgrade_estate_building_2_4_replacement_effect = { BUILDING = library_education } + } + else = { + destroy_or_downgrade_estate_building_2_effect = { BUILDING = library } + } + } + 23 = { # servants_quarters : Cheap + destroy_or_downgrade_estate_building_4_effect = { BUILDING = servants_quarters } + } + 24 = { # office : Cheap + destroy_or_downgrade_estate_building_4_effect = { BUILDING = office } + } + 25 = { # trophy_room : Cheap + destroy_or_downgrade_estate_building_4_effect = { BUILDING = trophy_room } + } + 26 = { # silk : Cheap + destroy_or_downgrade_estate_building_6_effect = { BUILDING = silk } + } + } + remove_variable = destroyed_building_variable + } +} + +# Destroy building effects for chinese estates - In domicile scope +destroy_random_east_asian_estate_building_variable_effect = { + save_scope_as = raid_domicile + if = { + limit = { has_variable = destroyed_building_variable } + remove_variable = destroyed_building_variable + } + random_list = { # Which building? + # Upgrades/internal buildings + 10 = { # living_quarters + trigger = { has_domicile_building_or_higher = east_asian_estate_living_quarters_01 } + set_variable = { + name = destroyed_building_variable + value = 1 + months = 1 + } + } + 10 = { # commander's study + trigger = { has_domicile_building_or_higher = east_asian_estate_commander_study_01 } + set_variable = { + name = destroyed_building_variable + value = 2 + months = 1 + } + } + 10 = { # office + trigger = { has_domicile_building_or_higher = east_asian_estate_office_01 } + set_variable = { + name = destroyed_building_variable + value = 3 + months = 1 + } + } + 10 = { # servants_quarters + trigger = { has_domicile_building_or_higher = east_asian_estate_servants_quarters_01 } + set_variable = { + name = destroyed_building_variable + value = 4 + months = 1 + } + } + 10 = { # library + trigger = { has_domicile_building_or_higher = east_asian_estate_library_01 } + set_variable = { + name = destroyed_building_variable + value = 5 + months = 1 + } + } + 10 = { # bath + trigger = { has_domicile_building_or_higher = east_asian_estate_bath_01 } + set_variable = { + name = destroyed_building_variable + value = 6 + months = 1 + } + } + 10 = { # guest_room + trigger = { has_domicile_building_or_higher = east_asian_estate_guest_room_01 } + set_variable = { + name = destroyed_building_variable + value = 7 + months = 1 + } + } + 10 = { # wine_cellar + trigger = { has_domicile_building_or_higher = east_asian_estate_wine_cellar_01 } + set_variable = { + name = destroyed_building_variable + value = 8 + months = 1 + } + } + 10 = { # courtyard + trigger = { has_domicile_building_or_higher = east_asian_estate_courtyard_01 } + set_variable = { + name = destroyed_building_variable + value = 9 + months = 1 + } + } + 10 = { # prison + trigger = { has_domicile_building_or_higher = east_asian_estate_prison_01 } + set_variable = { + name = destroyed_building_variable + value = 10 + months = 1 + } + } + 10 = { # reception_hall + trigger = { has_domicile_building_or_higher = east_asian_estate_reception_hall_01 } + set_variable = { + name = destroyed_building_variable + value = 11 + months = 1 + } + } + 10 = { # cabinet_of_curiosities + trigger = { has_domicile_building_or_higher = east_asian_estate_cabinet_of_curiosities_01 } + set_variable = { + name = destroyed_building_variable + value = 12 + months = 1 + } + } + # External buildings + 10 = { # ancestral shrine + trigger = { has_domicile_building_or_higher = east_asian_estate_ancestral_shrine_01 } + set_variable = { + name = destroyed_building_variable + value = 13 + months = 1 + } + } + 10 = { # pagoda + trigger = { has_domicile_building_or_higher = east_asian_estate_temple_01 } + set_variable = { + name = destroyed_building_variable + value = 14 + months = 1 + } + } + 10 = { # barracks + trigger = { has_domicile_building_or_higher = east_asian_estate_barracks_01 } + set_variable = { + name = destroyed_building_variable + value = 15 + months = 1 + } + } + 10 = { # watchtower + trigger = { has_domicile_building_or_higher = east_asian_estate_watchtower_01 } + set_variable = { + name = destroyed_building_variable + value = 16 + months = 1 + } + } + 10 = { # garden + trigger = { has_domicile_building_or_higher = east_asian_estate_garden_01 } + set_variable = { + name = destroyed_building_variable + value = 18 + months = 1 + } + } + 10 = { # stable + trigger = { has_domicile_building_or_higher = east_asian_estate_stable_01 } + set_variable = { + name = destroyed_building_variable + value = 19 + months = 1 + } + } + 10 = { # workshop + trigger = { has_domicile_building_or_higher = east_asian_estate_workshop_01 } + set_variable = { + name = destroyed_building_variable + value = 20 + months = 1 + } + } + 10 = { # storage + trigger = { has_domicile_building_or_higher = east_asian_estate_storage_01 } + set_variable = { + name = destroyed_building_variable + value = 21 + months = 1 + } + } + 10 = { # market + trigger = { has_domicile_building_or_higher = east_asian_estate_market_01 } + set_variable = { + name = destroyed_building_variable + value = 22 + months = 1 + } + } + 10 = { # grazing_land + trigger = { has_domicile_building_or_higher = east_asian_estate_grazing_land_01 } + set_variable = { + name = destroyed_building_variable + value = 23 + months = 1 + } + } + 10 = { # rice_field + trigger = { has_domicile_building_or_higher = east_asian_estate_rice_field_01 } + set_variable = { + name = destroyed_building_variable + value = 25 + months = 1 + } + } + 10 = { # tea plantation + trigger = { has_domicile_building_or_higher = east_asian_estate_tea_01 } + set_variable = { + name = destroyed_building_variable + value = 27 + months = 1 + } + } + 10 = { # physician's office + trigger = { has_domicile_building_or_higher = east_asian_estate_health_01 } + set_variable = { + name = destroyed_building_variable + value = 28 + months = 1 + } + } + 10 = { # silk + trigger = { has_domicile_building_or_higher = east_asian_estate_silk_01 } + set_variable = { + name = destroyed_building_variable + value = 29 + months = 1 + } + } + 10 = { # study + trigger = { has_domicile_building_or_higher = east_asian_estate_study_01 } + set_variable = { + name = destroyed_building_variable + value = 30 + months = 1 + } + } + 10 = { # minister's office + trigger = { has_domicile_building_or_higher = east_asian_estate_minister_office_01 } + set_variable = { + name = destroyed_building_variable + value = 31 + months = 1 + } + } + 10 = { # dynastic pavilion/movement leader building + trigger = { has_domicile_building_or_higher = east_asian_estate_movement_study_01 } + set_variable = { + name = destroyed_building_variable + value = 32 + months = 1 + } + } + 10 = { # archive + trigger = { has_domicile_building_or_higher = east_asian_estate_archive_01 } + set_variable = { + name = destroyed_building_variable + value = 33 + months = 1 + } + } + 10 = { # gate + trigger = { has_domicile_building_or_higher = east_asian_estate_gate_01 } + set_variable = { + name = destroyed_building_variable + value = 34 + months = 1 + } + } + 10 = { # taxation office + trigger = { has_domicile_building_or_higher = east_asian_estate_taxation_01 } + set_variable = { + name = destroyed_building_variable + value = 35 + months = 1 + } + } + 10 = { # yamen office + trigger = { has_domicile_building_or_higher = east_asian_peasant_quarters_01 } + set_variable = { + name = destroyed_building_variable + value = 36 + months = 1 + } + } + } +} + +destroy_random_east_asian_estate_building_effect = { + if = { + limit = { has_variable = destroyed_building_variable } + switch = { + trigger = var:destroyed_building_variable + 1 = { # living_quarters + destroy_or_downgrade_estate_building_4_effect = { BUILDING = east_asian_estate_living_quarters } + } + 2 = { # commander's study + destroy_or_downgrade_estate_building_4_effect = { BUILDING = east_asian_estate_commander_study } + } + 3 = { # office + destroy_or_downgrade_estate_building_4_effect = { BUILDING = east_asian_estate_office } + } + 4 = { # servants_quarters + destroy_or_downgrade_estate_building_4_effect = { BUILDING = east_asian_estate_servants_quarters } + } + 5 = { # library + if = { + limit = { has_domicile_building_or_higher = east_asian_estate_library_education_03 } + destroy_or_downgrade_estate_building_2_4_replacement_effect = { BUILDING = east_asian_estate_library_education } + } + else = { + destroy_or_downgrade_estate_building_2_effect = { BUILDING = east_asian_estate_library } + } + } + 6 = { # bath + destroy_or_downgrade_estate_building_4_effect = { BUILDING = east_asian_estate_bath } + } + 7 = { # guest_room + destroy_or_downgrade_estate_building_4_effect = { BUILDING = east_asian_estate_guest_room } + } + 8 = { # wine_cellar + destroy_or_downgrade_estate_building_3_effect = { BUILDING = east_asian_estate_wine_cellar } + } + 9 = { # courtyard + destroy_or_downgrade_estate_building_4_effect = { BUILDING = east_asian_estate_courtyard } + } + 10 = { # prison + destroy_or_downgrade_estate_building_4_effect = { BUILDING = east_asian_estate_prison } + } + 11 = { # reception_hall + destroy_or_downgrade_estate_building_5_effect = { BUILDING = east_asian_estate_reception_hall } + } + 12 = { # cabinet_of_curiosities + destroy_or_downgrade_estate_building_3_effect = { BUILDING = east_asian_estate_cabinet_of_curiosities } + } + 13 = { # ancestral shrine + destroy_or_downgrade_estate_building_6_effect = { BUILDING = east_asian_estate_ancestral_shrine } + } + 14 = { # pagoda + destroy_or_downgrade_estate_building_6_effect = { BUILDING = east_asian_estate_temple } + } + 15 = { # barracks + destroy_or_downgrade_estate_building_6_effect = { BUILDING = east_asian_estate_barracks } + } + 16 = { # watchtower + destroy_or_downgrade_estate_building_6_effect = { BUILDING = east_asian_estate_watchtower } + } + 18 = { # garden + if = { + limit = { has_domicile_building_or_higher = east_asian_estate_garden_leisure_04 } + destroy_or_downgrade_estate_building_3_6_replacement_effect = { BUILDING = east_asian_estate_garden_leisure } + } + else_if = { + limit = { has_domicile_building_or_higher = east_asian_estate_garden_fruit_04 } + destroy_or_downgrade_estate_building_3_6_replacement_effect = { BUILDING = east_asian_estate_garden_fruit } + } + else = { + destroy_or_downgrade_estate_building_3_effect = { BUILDING = east_asian_estate_garden } + } + } + 19 = { # stable + if = { + limit = { has_domicile_building_or_higher = east_asian_estate_stable_grand_04 } + destroy_or_downgrade_estate_building_3_6_replacement_effect = { BUILDING = east_asian_estate_stable_grand } + } + else_if = { + limit = { has_domicile_building_or_higher = east_asian_estate_stable_kennel_04 } + destroy_or_downgrade_estate_building_3_6_replacement_effect = { BUILDING = east_asian_estate_stable_kennel } + } + else = { + destroy_or_downgrade_estate_building_3_effect = { BUILDING = east_asian_estate_stable } + } + } + 20 = { # workshop + if = { + limit = { has_domicile_building_or_higher = east_asian_estate_workshop_carpenter_03 } + destroy_or_downgrade_estate_building_2_6_replacement_effect = { BUILDING = east_asian_estate_workshop_carpenter } + } + else_if = { + limit = { has_domicile_building_or_higher = east_asian_estate_workshop_mason_03 } + destroy_or_downgrade_estate_building_2_6_replacement_effect = { BUILDING = east_asian_estate_workshop_mason } + } + else_if = { + limit = { has_domicile_building_or_higher = east_asian_estate_workshop_textile_03 } + destroy_or_downgrade_estate_building_2_6_replacement_effect = { BUILDING = east_asian_estate_workshop_textile } + } + else = { + destroy_or_downgrade_estate_building_2_effect = { BUILDING = east_asian_estate_workshop } + } + } + 21 = { # storage + if = { + limit = { has_domicile_building_or_higher = east_asian_estate_storage_warehouse_03 } + destroy_or_downgrade_estate_building_2_6_replacement_effect = { BUILDING = east_asian_estate_storage_warehouse } + } + else_if = { + limit = { has_domicile_building_or_higher = east_asian_estate_storage_granary_03 } + destroy_or_downgrade_estate_building_2_6_replacement_effect = { BUILDING = east_asian_estate_storage_granary } + } + else = { + destroy_or_downgrade_estate_building_2_effect = { BUILDING = east_asian_estate_storage } + } + } + 22 = { # market + destroy_or_downgrade_estate_building_6_effect = { BUILDING = east_asian_estate_market } + } + 23 = { # grazing_land + if = { + limit = { has_domicile_building_or_higher = east_asian_estate_horse_pasture_04 } + destroy_or_downgrade_estate_building_3_6_replacement_effect = { BUILDING = east_asian_estate_horse_pasture } + } + else_if = { + limit = { has_domicile_building_or_higher = east_asian_estate_camel_pasture_04 } + destroy_or_downgrade_estate_building_3_6_replacement_effect = { BUILDING = east_asian_estate_camel_pasture } + } + else_if = { + limit = { has_domicile_building_or_higher = east_asian_estate_elephant_pasture_04 } + destroy_or_downgrade_estate_building_3_6_replacement_effect = { BUILDING = east_asian_estate_elephant_pasture } + } + else = { + destroy_or_downgrade_estate_building_6_effect = { BUILDING = east_asian_estate_grazing_land } + } + } + 25 = { # rice_field + destroy_or_downgrade_estate_building_6_effect = { BUILDING = east_asian_estate_rice_field } + } + 27 = { # tea + destroy_or_downgrade_estate_building_6_effect = { BUILDING = east_asian_estate_tea } + } + 28 = { # health + destroy_or_downgrade_estate_building_6_effect = { BUILDING = east_asian_estate_health } + } + 29 = { # silk + destroy_or_downgrade_estate_building_6_effect = { BUILDING = east_asian_estate_silk } + } + 30 = { # study + destroy_or_downgrade_estate_building_4_effect = { BUILDING = east_asian_estate_study } + } + 31 = { # minister's office + destroy_or_downgrade_estate_building_4_effect = { BUILDING = east_asian_estate_minister_office } + } + 32 = { # dynastic pavilion/movement leader building + destroy_or_downgrade_estate_building_4_effect = { BUILDING = east_asian_estate_movement_study } + } + 33 = { # archive + destroy_or_downgrade_estate_building_4_effect = { BUILDING = east_asian_estate_archive } + } + 34 = { # gate + destroy_or_downgrade_estate_building_6_effect = { BUILDING = east_asian_estate_gate } + } + 35 = { # tax office + destroy_or_downgrade_estate_building_4_effect = { BUILDING = east_asian_estate_taxation } + } + 36 = { # peasants quarters + destroy_or_downgrade_estate_building_4_effect = { BUILDING = east_asian_peasant_quarters } + } + } + remove_variable = destroyed_building_variable + } +} + +add_random_economic_building_effect = { + save_scope_as = building_scope + custom_tooltip = random_economic_building_tt + hidden_effect = { + random_list = { + 10 = { # Caravanserai + trigger = { + NOT = { has_building_or_higher = caravanserai_01 } + building_caravanserai_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + culture = { + has_innovation = innovation_guilds + } + } + add_building = caravanserai_01 + } + 10 = { # Watermills + trigger = { + NOT = { has_building_or_higher = watermills_01 } + building_watermills_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + culture = { + has_innovation = innovation_windmills + } + } + add_building = watermills_01 + } + 10 = { # Windmills + trigger = { + NOT = { has_building_or_higher = windmills_01 } + building_windmills_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + culture = { + has_innovation = innovation_windmills + } + } + add_building = windmills_01 + } + 10 = { # Trade Port + trigger = { + NOT = { has_building_or_higher = common_tradeport_01 } + building_common_tradeport_requirement_terrain = yes + OR = { + AND = { + culture = { + has_cultural_parameter = trade_ports_enabled_for_tribals + } + has_building_or_higher = tribe_01 + } + building_requirement_castle_city_church = { LEVEL = 01 } + } + } + add_building = common_tradeport_01 + } + 10 = { # Pastures + trigger = { + NOT = { has_building_or_higher = pastures_01 } + building_pastures_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + } + add_building = pastures_01 + } + 10 = { # Hunting Grounds + trigger = { + NOT = { has_building_or_higher = hunting_grounds_01 } + building_hunting_grounds_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + } + add_building = hunting_grounds_01 + } + 10 = { # Orchards + trigger = { + NOT = { has_building_or_higher = orchards_01 } + building_orchards_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + } + add_building = orchards_01 + } + 10 = { # Farm Estates + trigger = { + NOT = { has_building_or_higher = farm_estates_01 } + building_farm_estates_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + } + add_building = farm_estates_01 + } + 10 = { # Cereal Fields + trigger = { + NOT = { has_building_or_higher = cereal_fields_01 } + building_cereal_fields_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + } + add_building = cereal_fields_01 + } + 10 = { # Logging Camps + trigger = { + NOT = { has_building_or_higher = logging_camps_01 } + building_logging_camps_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + } + add_building = logging_camps_01 + } + 10 = { # Peat Quarries + trigger = { + NOT = { has_building_or_higher = peat_quarries_01 } + building_peat_quarries_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + } + add_building = peat_quarries_01 + } + 10 = { # Hill Farms + trigger = { + NOT = { has_building_or_higher = hill_farms_01 } + building_hill_farms_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + } + add_building = hill_farms_01 + } + 10 = { # Elephant Pens + trigger = { + NOT = { has_building_or_higher = elephant_pens_01 } + building_elephant_pens_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + } + add_building = elephant_pens_01 + } + 10 = { # Plantations + trigger = { + NOT = { has_building_or_higher = plantations_01 } + building_plantations_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + } + add_building = plantations_01 + } + 10 = { # Quarries + trigger = { + NOT = { has_building_or_higher = quarries_01 } + building_quarries_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + } + add_building = quarries_01 + } + 10 = { # Qanats + trigger = { + NOT = { has_building_or_higher = qanats_01 } + building_qanats_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + culture = { + has_cultural_parameter = unlocks_qanat_building + } + } + add_building = qanats_01 + } + 10 = { # Murex Farms + trigger = { + NOT = { has_building_or_higher = murex_farm_01 } + building_murex_farm_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + } + add_building = murex_farm_01 + } + 10 = { # Guild Halls - City Specific + trigger = { + NOT = { has_building_or_higher = guild_halls_01 } + has_building_or_higher = city_01 + } + add_building = guild_halls_01 + } + 10 = { # Monastic Schools - Temple Specific + trigger = { + NOT = { has_building_or_higher = monastic_schools_01 } + has_building_or_higher = temple_01 + } + add_building = monastic_schools_01 + } + } + } +} + +add_random_fortification_building_effect = { + save_scope_as = building_scope + custom_tooltip = random_fortification_building_tt + hidden_effect = { + random_list = { + 10 = { # Ramparts + trigger = { + NOT = { has_building_or_higher = ramparts_01 } + building_ramparts_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + } + add_building = ramparts_01 + } + 10 = { # Curtain Walls + trigger = { + NOT = { has_building_or_higher = curtain_walls_01 } + building_curtain_walls_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + } + add_building = curtain_walls_01 + } + 10 = { # Watchtowers + trigger = { + NOT = { has_building_or_higher = watchtowers_01 } + building_watchtowers_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + } + add_building = watchtowers_01 + } + 10 = { # Hill Forts + trigger = { + NOT = { has_building_or_higher = hill_forts_01 } + building_hill_forts_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + } + add_building = hill_forts_01 + } + } + } +} + +add_random_military_building_effect = { + save_scope_as = building_scope + custom_tooltip = random_military_building_tt + hidden_effect = { + random_list = { + 10 = { # Wind Furnace + trigger = { + NOT = { has_building_or_higher = wind_furnace_01 } + building_wind_furnace_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + } + add_building = wind_furnace_01 + } + 10 = { # Workshops + trigger = { + NOT = { has_building_or_higher = workshops_01 } + building_workshops_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + scope:building_scope.county.holder.culture = { + has_innovation = innovation_advanced_bowmaking + } + } + add_building = workshops_01 + } + 10 = { # Horse Pastures + trigger = { + NOT = { has_building_or_higher = windmills_01 } + building_horse_pastures_requirement_terrain = yes + } + add_building = windmills_01 + } + 10 = { # Hillside Grazing + trigger = { + NOT = { has_building_or_higher = hillside_grazing_01 } + building_hillside_grazing_requirement_terrain = yes + } + add_building = hillside_grazing_01 + } + 10 = { # Warrior Lodges + trigger = { + NOT = { has_building_or_higher = warrior_lodges_01 } + building_warrior_lodges_requirement_terrain = yes + } + add_building = warrior_lodges_01 + } + 10 = { # Military Camps + trigger = { + NOT = { has_building_or_higher = military_camps_01 } + building_military_camps_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + } + add_building = military_camps_01 + } + 10 = { # Regimental Grounds + trigger = { + NOT = { has_building_or_higher = regimental_grounds_01 } + building_regimental_grounds_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + } + add_building = regimental_grounds_01 + } + 10 = { # Outposts + trigger = { + NOT = { has_building_or_higher = outposts_01 } + building_outposts_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + } + add_building = outposts_01 + } + 10 = { # Barracks + trigger = { + NOT = { has_building_or_higher = barracks_01 } + building_barracks_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + } + add_building = barracks_01 + } + 10 = { # Camel Farms + trigger = { + NOT = { has_building_or_higher = camel_farms_01 } + building_camel_farms_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + } + add_building = camel_farms_01 + } + 10 = { # Stables + trigger = { + NOT = { has_building_or_higher = stables_01 } + building_stables_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + } + add_building = stables_01 + } + 10 = { # Smiths + trigger = { + NOT = { has_building_or_higher = smiths_01 } + building_smiths_requirement_terrain = yes + building_requirement_castle_city_church = { LEVEL = 01 } + } + add_building = smiths_01 + } + } + } +} + +destroy_or_downgrade_temple_effect = { + if = { + limit = { has_building = temple_04 } + remove_building = temple_04 + hidden_effect = { add_building = temple_03 } + } + else_if = { + limit = { has_building = temple_03 } + remove_building = temple_03 + hidden_effect = { add_building = temple_02 } + } + else_if = { + limit = { has_building = temple_02 } + remove_building = temple_02 + hidden_effect = { add_building = temple_01 } + } + else = { remove_building = temple_01 } +} + +add_next_temple_tier_effect = { + if = { + limit = { + NOT = { has_building_or_higher = temple_01 } + } + add_building = temple_01 + } + else_if = { + limit = { has_building = temple_01 } + add_building = temple_02 + } + else_if = { + limit = { has_building = temple_02 } + add_building = temple_03 + } + else_if = { + limit = { has_building = temple_03 } + add_building = temple_04 + } +} diff --git a/N3OW/common/scripted_effects/00_camp_officer_effects.txt b/N3OW/common/scripted_effects/00_camp_officer_effects.txt new file mode 100644 index 00000000..2298a87d --- /dev/null +++ b/N3OW/common/scripted_effects/00_camp_officer_effects.txt @@ -0,0 +1,434 @@ + +################### +# Generic effects that are used for basic opinion gain etc. +################### + +#Basic effect for gaining a camp officer +basic_gained_camp_officer_effect = { + scope:liege = { + # Gain a bit of opinion for being appointed. + reverse_add_opinion = { + target = scope:employee + modifier = made_me_officer_opinion + } + # If they now like us sufficiently, then set up a potential friendship. + hidden_effect = { + if = { + limit = { + reverse_opinion = { + target = scope:employee + value >= 50 + } + can_set_relation_potential_friend_trigger = { CHARACTER = scope:employee } + } + set_relation_potential_friend = scope:employee + } + } + # Plus, some ripple consequences. + every_courtier = { + limit = { + this != scope:employee + } + # Friends'n'lovers. + if = { + limit = { + has_any_moderate_good_relationship_with_character_trigger = { CHARACTER = scope:employee } + } + add_opinion = { + target = scope:liege + modifier = made_friend_officer_opinion + } + } + # Foes... + if = { + limit = { + has_any_moderate_bad_relationship_with_character_trigger = { CHARACTER = scope:employee } + } + add_opinion = { + target = scope:liege + modifier = made_foe_officer_opinion + } + } + # ... and family who are not foes. + else_if = { + limit = { is_close_or_extended_family_of = scope:employee } + add_opinion = { + target = scope:liege + modifier = made_family_officer_opinion + } + } + } + } +} + +#Basic effect for losing a court position +basic_revoked_camp_officer_effect = { + scope:employee = { + add_opinion = { + modifier = revoked_camp_officer_opinion + target = scope:liege + } + } + # Lose whatever you might have gained. + scope:employee = { + remove_opinion = { + target = scope:liege + modifier = made_me_officer_opinion + } + } + scope:liege = { + # If they now dislike us sufficiently, then set up a potential rivalry. + hidden_effect = { + if = { + limit = { + reverse_opinion = { + target = scope:employee + value <= -50 + } + can_set_relation_potential_rival_trigger = { CHARACTER = scope:employee } + } + set_relation_potential_rival = scope:employee + } + } + # Plus, some ripple consequences. + every_courtier = { + limit = { + this != scope:employee + } + # Friends'n'lovers. + if = { + limit = { + has_any_moderate_good_relationship_with_character_trigger = { CHARACTER = scope:employee } + } + remove_opinion = { + target = scope:liege + modifier = made_friend_officer_opinion + } + } + # Foes... + if = { + limit = { + has_any_moderate_bad_relationship_with_character_trigger = { CHARACTER = scope:employee } + } + remove_opinion = { + target = scope:liege + modifier = made_foe_officer_opinion + } + } + # ... and family who are not foes. + else_if = { + limit = { is_close_or_extended_family_of = scope:employee } + remove_opinion = { + target = scope:liege + modifier = made_family_officer_opinion + } + } + } + } +} + +#Basic effect for a camp_officer invalidating +basic_invalidated_camp_officer_effect = {} + + +################ +# EFFECTS FOR SPECIFIC CAMP OFFICER +################ + +# SECOND +second_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +second_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes + scope:employee = { + if = { + limit = { var:loyalty_dependent_on_position ?= scope:liege } + scope:liege = { + remove_hook = { + target = scope:employee + type = loyalty_hook + } + } + } + if = { + limit = { has_character_modifier = ep3_laamp_flavour_ewan_2071_b_work_self_to_death_modifier } + remove_character_modifier = ep3_laamp_flavour_ewan_2071_b_work_self_to_death_modifier + } + } +} +second_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# Quartermaster +quartermaster_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +quartermaster_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +quartermaster_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# Armorer +armorer_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +armorer_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +armorer_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# chief forager +chief_forager_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +chief_forager_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +chief_forager_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# master thief +master_thief_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +master_thief_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +master_thief_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# head porter +head_porter_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +head_porter_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +head_porter_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# head groom +head_groom_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +head_groom_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +head_groom_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# huntperson +huntperson_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +huntperson_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +huntperson_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# kennelperson +kennelperson_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +kennelperson_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +kennelperson_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# chief_engineer +chief_engineer_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +chief_engineer_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +chief_engineer_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# witness +witness_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +witness_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +witness_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# person_haggler +person_haggler_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +person_haggler_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +person_haggler_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# camp cook +camp_cook_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +camp_cook_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +camp_cook_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# master_bard +master_bard_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +master_bard_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +master_bard_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# stooge +stooge_camp_officer_title_accepted_effect = { + # No basic effect here — it applies default opinions that are flipped for a stooge. +} +stooge_camp_officer_title_revoked_effect = { + # No basic effect here — it applies default opinions that are flipped for a stooge. +} +stooge_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# master_of_arms +master_of_arms_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +master_of_arms_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +master_of_arms_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# light_cav_captain +light_cavalry_captain_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +light_cavalry_captain_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +light_cavalry_captain_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# camelry_captain +camelry_captain_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +camelry_captain_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +camelry_captain_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# elephantry_captain +elephantry_captain_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +elephantry_captain_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +elephantry_captain_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# heavy_cavalry_captain +heavy_cavalry_captain_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +heavy_cavalry_captain_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +heavy_cavalry_captain_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# horse_archer_captain +horse_archer_captain_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +horse_archer_captain_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +horse_archer_captain_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# archer_captain +archer_captain_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +archer_captain_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +archer_captain_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# heavy_infantry_captain +heavy_infantry_captain_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +heavy_infantry_captain_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +heavy_infantry_captain_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# light_infantry_captain +light_infantry_captain_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +light_infantry_captain_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +light_infantry_captain_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# pike_captain +pike_captain_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +pike_captain_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +pike_captain_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} +# master_of_spoils_captain +master_of_spoils_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +master_of_spoils_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +master_of_spoils_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} + +# camp_priest +camp_priest_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +camp_priest_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +camp_priest_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} + +# laureate +laureate_camp_officer_title_accepted_effect = { + basic_gained_camp_officer_effect = yes +} +laureate_camp_officer_title_revoked_effect = { + basic_revoked_camp_officer_effect = yes +} +laureate_camp_officer_title_invalidated_effect = { + basic_invalidated_camp_officer_effect = yes +} diff --git a/N3OW/common/scripted_effects/00_casus_belli_effects.txt b/N3OW/common/scripted_effects/00_casus_belli_effects.txt new file mode 100644 index 00000000..d640e595 --- /dev/null +++ b/N3OW/common/scripted_effects/00_casus_belli_effects.txt @@ -0,0 +1,520 @@ +#Effects relating to Casus Bellis. + +############################################################################################################################################################################################################# +# modify_participants_fame_values # +# by Sean Hughes # +# # +# Description: Makes the correct adjustments to prestige or piety for each participant in a war. # +# # +# Parameters: # +# WINNER: The character who won the war. # +# LOSER: The character who lost the war. # +# IS_RELIGIOUS_WAR: If yes we will modify Piety values instead of Prestige values. # +# FAME_BASE: The base value for calculating how much Prestige or Piety is gained/lost by each character, as below: # +# WINNER_FAME_SCALE: The winner will receive Prestige/Piety equal to FAME_BASE multiplied by this scale. # +# LOSER_FAME_SCALE: The winner will receive Prestige/Piety equal to FAME_BASE multiplied by this scale. **NOTE: This value should always be negative, otherwise the loser will gain piety/prestige!** # +# WINNER_ALLY_FAME_SCALE: Winner's allies will receive Prestige/Piety based on FAME_BASE, multiplied by this scale, then adjusted based on their War Contributuion. # +# LOSER_ALLY_FAME_SCALE: As above, but for the loser's side. ** NOTE: In the current design this should always be the same as WINNER_ALLY_FAME_SCALE, but I'm splitting it out in order to future-proof # +# this effect in case the design changes or modders want to alter how it works. ** # +# # +############################################################################################################################################################################################################# + +@maximum_prestige_winner = 1000 +@maximum_piety_winner = 1000 +@maximum_merit_winner = 1000 +@minimum_prestige_loser = -1000 +@minimum_piety_loser = -1000 + +@maximum_prestige_winner_ally = 1000 +@maximum_piety_winner_ally = 1000 +@maximum_merit_winner_ally = 1000 +@maximum_prestige_loser_ally = 1000 +@maximum_piety_loser_ally = 1000 + +modify_all_participants_fame_values = { + + # Give the winner the appropriate type & amount of 'fame' (prestige or piety). + if = { + # If the attacker is the winner, we only award fame *experience* instead of actual fame currency. + limit = { + $WINNER$ = scope:attacker + } + if = { + # Piety level progress for winning offensive religious wars. + limit = { + $IS_RELIGIOUS_WAR$ = yes + } + scope:attacker = { + add_piety_experience = { + value = $FAME_BASE$ + multiply = $WINNER_FAME_SCALE$ + max = @maximum_piety_winner + } + } + } + else = { + # Prestige level progress for winning all other offensive wars. + scope:attacker = { + add_prestige_experience = { + value = $FAME_BASE$ + multiply = $WINNER_FAME_SCALE$ + max = @maximum_prestige_winner + } + } + } + } + else = { + # If the defender is the winner, they get actual fame currency as a reward. + if = { + # Gain piety for winning defensive religious wars. + limit = { + $IS_RELIGIOUS_WAR$ = yes + } + scope:defender = { + add_piety = { + value = $FAME_BASE$ + multiply = $WINNER_FAME_SCALE$ + max = @maximum_piety_winner + } + } + } + else = { + # Gain prestige for winning all other defensive wars. + scope:defender = { + add_prestige = { + value = $FAME_BASE$ + multiply = $WINNER_FAME_SCALE$ + max = @maximum_prestige_winner + } + } + } + } + if = { + # Award Merit to the victorious attacker + limit = { + $WINNER$ = scope:attacker + } + scope:attacker = { + if = { + limit = { + government_allows = merit + } + change_merit = { + value = $FAME_BASE$ + multiply = $WINNER_FAME_SCALE$ + max = @maximum_merit_winner + } + } + } + } + else = { + # Award Merit to the victorious defender + scope:defender = { + if = { + limit = { + government_allows = merit + } + change_merit = { + value = $FAME_BASE$ + multiply = $WINNER_FAME_SCALE$ + max = @maximum_merit_winner + } + } + } + } + + # Award the appropriate type & amount of 'fame' to the allies of both primary participants. + modify_allies_of_participants_fame_values = { + WINNER = $WINNER$ + IS_RELIGIOUS_WAR = $IS_RELIGIOUS_WAR$ + FAME_BASE = $FAME_BASE$ + WINNER_ALLY_FAME_SCALE = $WINNER_ALLY_FAME_SCALE$ + LOSER_ALLY_FAME_SCALE = $LOSER_ALLY_FAME_SCALE$ + } + + # Take the appropriate type & amount of 'fame' away from the loser of the war. + if = { + # Religious wars cost Piety for the loser. + limit = { + $IS_RELIGIOUS_WAR$ = yes + } + + $LOSER$ = { + add_piety = { + value = $FAME_BASE$ + multiply = $LOSER_FAME_SCALE$ + min = @minimum_piety_loser + } + } + } + else = { + # All other war types cost Prestige from the loser. + $LOSER$ = { + add_prestige = { + value = $FAME_BASE$ + multiply = $LOSER_FAME_SCALE$ + min = @minimum_prestige_loser + } + } + } +} + +modify_all_participants_fame_values_crusading_claim = { + + # Give the winner the appropriate type & amount of 'fame' (prestige or piety). + if = { + # If the attacker is the winner, we only award fame *experience* instead of actual fame currency. + limit = { + $WINNER$ = scope:attacker + } + scope:attacker = { + add_prestige_experience = { + value = $FAME_BASE$ + multiply = $WINNER_FAME_SCALE$ + } + } + } + else = { + # Gain prestige for winning all other defensive wars. + scope:defender = { + add_prestige = { + value = $FAME_BASE$ + multiply = $WINNER_FAME_SCALE$ + } + } + } + + # Award the appropriate type & amount of 'fame' to the allies of both primary participants. + modify_allies_of_participants_fame_values_crusading_claim = { + WINNER = $WINNER$ + FAME_BASE = $FAME_BASE$ + WINNER_ALLY_FAME_SCALE = $WINNER_ALLY_FAME_SCALE$ + LOSER_ALLY_FAME_SCALE = $LOSER_ALLY_FAME_SCALE$ + } + + # All other war types cost Prestige from the loser. + $LOSER$ = { + add_prestige = { + value = $FAME_BASE$ + multiply = $LOSER_FAME_SCALE$ + } + } +} + +############################################################################################################################################################################################################# +# modify_allies_of_participants_fame_values # +# by Sean Hughes # +# # +# Description: Makes the correct adjustments to prestige or piety but ONLY for the allies in a war (e.g., not the primary attacker/defender). # +# Used as part of 'modify_participants_fame_values' but can also be used on it's own where desired, such as in a white peace where you don't want to give the primary participants any prestige/piety. # +# # +# Parameters: # +# WINNER: The character who won the war. # +# IS_RELIGIOUS_WAR: If yes we will modify Piety values instead of Prestige values. # +# FAME_BASE: The base value for calculating how much Prestige or Piety is gained/lost by each character, as below: # +# WINNER_ALLY_FAME_SCALE: Winner's allies will receive Prestige/Piety based on FAME_BASE, multiplied by this scale, then adjusted based on their War Contributuion. # +# LOSER_ALLY_FAME_SCALE: As above, but for the loser's side. ** NOTE: In the current design this should always be the same as WINNER_ALLY_FAME_SCALE, but I'm splitting it out in order to future-proof # +# this effect in case the design changes or modders want to alter how it works. ** # +# # +############################################################################################################################################################################################################# + +modify_allies_of_participants_fame_values = { + # Give the allies of both primary participants the appropriate type & amount of 'fame'. + + if = { + # Religious wars award Piety to participants. + limit = { + $IS_RELIGIOUS_WAR$ = yes + } + if = { + # Award Piety to the victorious attacker's allies. + limit = { + $WINNER$ = scope:attacker + } + add_from_contribution_attackers = { + piety = { + value = $FAME_BASE$ + multiply = $WINNER_ALLY_FAME_SCALE$ + max = @maximum_piety_winner_ally + } + opinion = { + modifier = contributed_in_war + } + } + # Award Piety to the defeated defender's allies. + add_from_contribution_defenders = { + piety = { + value = $FAME_BASE$ + multiply = $LOSER_ALLY_FAME_SCALE$ + max = @maximum_prestige_loser_ally + } + opinion = { + modifier = contributed_in_war + } + } + } + else = { + # Award Piety to the victorious defender's allies. + add_from_contribution_defenders = { + piety = { + value = $FAME_BASE$ + multiply = $WINNER_ALLY_FAME_SCALE$ + max = @maximum_piety_winner_ally + } + opinion = { + modifier = contributed_in_war + } + } + # Award Piety to the defeated attacker's allies. + add_from_contribution_attackers = { + piety = { + value = $FAME_BASE$ + multiply = $LOSER_ALLY_FAME_SCALE$ + max = @maximum_prestige_loser_ally + } + opinion = { + modifier = contributed_in_war + } + } + } + } + else = { + # All other war types award Prestige to participants. + if = { + # Award Prestige to the victorious attacker's allies. + limit = { + $WINNER$ = scope:attacker + } + add_from_contribution_attackers = { + prestige = { + value = $FAME_BASE$ + multiply = $WINNER_ALLY_FAME_SCALE$ + max = @maximum_prestige_winner_ally + } + opinion = { + modifier = contributed_in_war + } + } + # Award Prestige to the defeated defender's allies. + add_from_contribution_defenders = { + prestige = { + value = $FAME_BASE$ + multiply = $LOSER_ALLY_FAME_SCALE$ + max = @maximum_prestige_loser_ally + } + opinion = { + modifier = contributed_in_war + } + } + } + else = { + # Award Prestige to the victorious defender's allies. + add_from_contribution_defenders = { + prestige = { + value = $FAME_BASE$ + multiply = $WINNER_ALLY_FAME_SCALE$ + max = @maximum_prestige_winner_ally + } + opinion = { + modifier = contributed_in_war + } + } + # Award Prestige to the defeated attacker's allies. + add_from_contribution_attackers = { + prestige = { + value = $FAME_BASE$ + multiply = $LOSER_ALLY_FAME_SCALE$ + max = @maximum_prestige_loser_ally + } + opinion = { + modifier = contributed_in_war + } + } + } + } + # Award Merit to each participant of the winning side + if = { + # Award Merit to the victorious attacker's allies. + limit = { + $WINNER$ = scope:attacker + } + add_from_contribution_attackers = { + merit = { + value = $FAME_BASE$ + multiply = $WINNER_ALLY_FAME_SCALE$ + max = @maximum_merit_winner_ally + } + } + } + else = { + # Award Merit to the victorious defender's allies. + add_from_contribution_defenders = { + merit = { + value = $FAME_BASE$ + multiply = $LOSER_ALLY_FAME_SCALE$ + max = @maximum_merit_winner_ally + } + } + } +} + +modify_allies_of_participants_fame_both_values = { + # Give the allies of both primary participants the appropriate type & amount of 'fame'. + + if = { + # Award Piety to the victorious attacker's allies. + limit = { + $WINNER$ = scope:attacker + } + add_from_contribution_attackers = { + prestige = { + value = $PRESTIGE_FAME_BASE$ + multiply = $WINNER_ALLY_FAME_SCALE$ + max = @maximum_prestige_winner_ally + } + piety = { + value = $PIETY_FAME_BASE$ + multiply = $WINNER_ALLY_FAME_SCALE$ + max = @maximum_piety_winner_ally + } + opinion = { + modifier = contributed_in_war + } + } + # Award Piety to the defeated defender's allies. + add_from_contribution_defenders = { + prestige = { + value = $PRESTIGE_FAME_BASE$ + multiply = $LOSER_ALLY_FAME_SCALE$ + max = @maximum_prestige_loser_ally + } + piety = { + value = $PIETY_FAME_BASE$ + multiply = $LOSER_ALLY_FAME_SCALE$ + max = @maximum_piety_loser_ally + } + opinion = { + modifier = contributed_in_war + } + } + } + else = { + # Award Piety to the victorious defender's allies. + add_from_contribution_defenders = { + prestige = { + value = $PRESTIGE_FAME_BASE$ + multiply = $WINNER_ALLY_FAME_SCALE$ + max = @maximum_prestige_winner_ally + } + piety = { + value = $PIETY_FAME_BASE$ + multiply = $WINNER_ALLY_FAME_SCALE$ + max = @maximum_piety_winner_ally + } + opinion = { + modifier = contributed_in_war + } + } + # Award Piety to the defeated attacker's allies. + add_from_contribution_attackers = { + prestige = { + value = $PRESTIGE_FAME_BASE$ + multiply = $LOSER_ALLY_FAME_SCALE$ + max = @maximum_prestige_loser_ally + } + piety = { + value = $PIETY_FAME_BASE$ + multiply = $LOSER_ALLY_FAME_SCALE$ + max = @maximum_piety_loser_ally + } + opinion = { + modifier = contributed_in_war + } + } + } + +} + +modify_allies_of_participants_fame_values_crusading_claim = { + # Give the allies of both primary participants the appropriate type & amount of 'fame'. + + if = { + # Award Prestige to the victorious attacker's allies. + limit = { + $WINNER$ = scope:attacker + } + add_from_contribution_attackers = { + prestige = { + value = $FAME_BASE$ + multiply = $WINNER_ALLY_FAME_SCALE$ + } + opinion = { + modifier = contributed_in_war + } + } + # Award Prestige to the defeated defender's allies. + add_from_contribution_defenders = { + prestige = { + value = $FAME_BASE$ + multiply = $LOSER_ALLY_FAME_SCALE$ + } + opinion = { + modifier = contributed_in_war + } + } + } + else = { + # Award Prestige to the victorious defender's allies. + add_from_contribution_defenders = { + prestige = { + value = $FAME_BASE$ + multiply = $WINNER_ALLY_FAME_SCALE$ + } + opinion = { + modifier = contributed_in_war + } + } + # Award Prestige to the defeated attacker's allies. + add_from_contribution_attackers = { + prestige = { + value = $FAME_BASE$ + multiply = $LOSER_ALLY_FAME_SCALE$ + multiply = -1 + } + opinion = { + modifier = contributed_in_war + } + } + } +} + +add_hook_from_temp_de_jure_liege_to_attacker = { + # Assumes scope of title to be conquered. + # Assumes scope:attacker to be set for the character initiating the war. + # Assumes scope:temp_de_jure_liege to be set for the de jure liege that + # might gain a title from the war. + # Outcome: De jure liege of the contested title will owe a favor towards + # the attacker of the war if the de jure liege is in the vassal tree of the attacker. + if = { + limit = { + exists = scope:temp_de_jure_liege + scope:temp_de_jure_liege != scope:attacker + scope:temp_de_jure_liege = { target_is_liege_or_above = scope:attacker } + scope:temp_de_jure_liege = { + is_ai = yes + } + scope:attacker = { + can_add_hook = { + type = favor_hook + target = scope:temp_de_jure_liege + } + } + } + scope:attacker = { + add_hook = { + type = favor_hook + target = scope:temp_de_jure_liege + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_childhood_effects.txt b/N3OW/common/scripted_effects/00_childhood_effects.txt new file mode 100644 index 00000000..a088a1d1 --- /dev/null +++ b/N3OW/common/scripted_effects/00_childhood_effects.txt @@ -0,0 +1,778 @@ +#Scripted effects relating to childhood + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! + +#get_guardian_event_target_effect +#save_good_character_effect + #Save a relation scope for the child, use the arguments: + #RELATION = friend + #RELATION = crush + #RELATION = bully + #RELATION = victim + +###################################################################### +# EFFECTS +###################################################################### + + +#Get a child's Guardian, or alternatively a suitable stand-in, since the event relies on an adult being present +get_guardian_scope_effect = { + if = { + limit = { + any_relation = { + type = guardian + always = yes + } + } + random_relation = { + type = guardian + save_scope_as = guardian + } + } + if = { + limit = { + NOT = { exists = scope:guardian } + exists = court_owner.court_position:court_tutor_court_position + } + court_owner.court_position:court_tutor_court_position ?= { + save_scope_as = guardian + } + } + else_if = { + limit = { + NOT = { exists = scope:guardian } + exists = court_owner.court_position:court_guru_court_position + } + court_owner.court_position:court_guru_court_position ?= { + save_scope_as = guardian + } + } + if = { + limit = { + NOT = { exists = scope:guardian } + is_ruler = yes + any_parent = { + is_available_ai_adult = yes + is_in_the_same_court_as = root + } + } + random_parent = { + limit = { + is_available_ai_adult = yes + is_in_the_same_court_as = root + } + save_scope_as = guardian + } + } + if = { + limit = { + NOT = { exists = scope:guardian } + is_ruler = yes + any_courtier_or_guest = { + is_available_ai_adult = yes + } + } + random_courtier_or_guest = { + limit = { + is_available_ai_adult = yes + } + save_scope_as = guardian + } + } + if = { + limit = { + NOT = { exists = scope:guardian } + any_parent = { + is_ai = yes + is_available = yes + } + } + random_parent = { + limit = { + is_in_the_same_court_as = root + is_ai = yes + is_available = yes + } + alternative_limit = { + is_ai = yes + is_available = yes + } + save_scope_as = guardian + } + } + if = { + limit = { + NOT = { exists = scope:guardian } + any_sibling = { + is_available_ai_adult = yes + } + } + random_sibling = { + limit = { + is_available_ai_adult = yes + is_in_the_same_court_as = root + } + alternative_limit = { + is_available_ai_adult = yes + } + save_scope_as = guardian + } + } + if = { + limit = { + NOT = { exists = scope:guardian } + liege ?= { + any_courtier_or_guest = { + is_available_ai_adult = yes + } + } + } + liege = { + random_courtier_or_guest = { + limit = { + is_available_ai_adult = yes + } + save_scope_as = guardian + } + } + } + if = { + limit = { + NOT = { exists = scope:guardian } + liege ?= { + is_available_ai_adult = yes + } + } + liege = { + save_scope_as = guardian + } + } + if = { #Close to last resort + limit = { + NOT = { exists = scope:guardian } + any_ruler = { + is_ai = yes + culture = root.culture + faith = root.faith + is_available = yes + } + } + random_ruler = { + limit = { + is_ai = yes + culture = root.culture + faith = root.faith + is_available = yes + } + save_scope_as = guardian + } + } + if = { + limit = { + NOT = { exists = scope:guardian } + any_ruler = { + is_ai = yes + is_available = yes + OR = { + culture = root.culture + faith = root.faith + } + } + } + debug_log = "Resorted to last resort when finding guardian for child" + debug_log_scopes = yes + random_ruler = { + limit = { + is_ai = yes + is_available = yes + OR = { + culture = root.culture + faith = root.faith + } + } + save_scope_as = guardian + } + } + if = { + limit = { + NOT = { exists = scope:guardian } + any_ruler = { + is_ai = yes + is_available = yes + } + } + debug_log = "Resorted to absolute last resort when finding guardian for child" + debug_log_scopes = yes + random_ruler = { + limit = { + is_ai = yes + is_available = yes + } + save_scope_as = guardian + } + } +} + + +#Save a relation scope for the child, use the arguments: + #RELATION = + #SCOPE = +save_good_character_effect = { + #Make sure that this list prioritizes other child vassals/heirs when the child being bullied is a player or player heir. + save_temporary_scope_value_as = { + name = $SCOPE$_relation + value = yes + } + if = { + limit = { + NOT = { exists = scope:$RELATION$ } + is_playable_character = yes + } + every_vassal = { + if = { + limit = { + save_good_$RELATION$_character_trigger_check = yes + } + add_to_list = good_child_relation_character + } + every_child = { + limit = { + save_good_$RELATION$_character_trigger_check = yes + } + add_to_list = good_child_relation_character + } + every_warden_hostage = { + limit = { + save_good_$RELATION$_character_trigger_check = yes + } + add_to_list = good_child_relation_character + } + } + } + if = { + limit = { + is_playable_character = yes + NOT = { exists = scope:$RELATION$ } + } + every_courtier = { + limit = { + save_good_$RELATION$_character_trigger_check = yes + } + add_to_list = good_child_relation_character + } + } + if = { + limit = { + is_playable_character = yes + NOT = { exists = scope:$RELATION$ } + exists = liege + this != liege + } + liege = { + if = { + limit = { + save_good_$RELATION$_character_trigger_check = yes + } + add_to_list = good_child_relation_character + } + every_vassal = { + if = { + limit = { + save_good_$RELATION$_character_trigger_check = yes + } + add_to_list = good_child_relation_character + } + every_child = { + limit = { + save_good_$RELATION$_character_trigger_check = yes + } + add_to_list = good_child_relation_character + } + every_warden_hostage = { + limit = { + save_good_$RELATION$_character_trigger_check = yes + } + add_to_list = good_child_relation_character + } + } + every_child = { + limit = { + save_good_$RELATION$_character_trigger_check = yes + } + add_to_list = good_child_relation_character + } + every_warden_hostage = { + limit = { + save_good_$RELATION$_character_trigger_check = yes + } + add_to_list = good_child_relation_character + } + } + } + if = { + limit = { + is_playable_character = no + NOT = { exists = scope:$RELATION$ } + exists = liege + this != liege + } + liege = { + if = { + limit = { + save_good_$RELATION$_character_trigger_check = yes + } + add_to_list = good_child_relation_character + } + every_vassal = { + if = { + limit = { + save_good_$RELATION$_character_trigger_check = yes + } + add_to_list = good_child_relation_character + } + every_child = { + limit = { + save_good_$RELATION$_character_trigger_check = yes + } + add_to_list = good_child_relation_character + } + every_warden_hostage = { + limit = { + save_good_$RELATION$_character_trigger_check = yes + } + add_to_list = good_child_relation_character + } + } + every_child = { + limit = { + save_good_$RELATION$_character_trigger_check = yes + } + add_to_list = good_child_relation_character + } + every_warden_hostage = { + limit = { + save_good_$RELATION$_character_trigger_check = yes + } + add_to_list = good_child_relation_character + } + every_courtier_or_guest = { + limit = { + save_good_$RELATION$_character_trigger_check = yes + } + add_to_list = good_child_relation_character + } + } + } + + if = { + limit = { + NOT = { exists = scope:$RELATION$ } + exists = host + this != host + } + host = { + if = { + limit = { + save_good_$RELATION$_character_trigger_check = yes + } + add_to_list = good_child_relation_character + } + every_vassal = { + if = { + limit = { + save_good_$RELATION$_character_trigger_check = yes + } + add_to_list = good_child_relation_character + } + every_child = { + limit = { + save_good_$RELATION$_character_trigger_check = yes + } + add_to_list = good_child_relation_character + } + every_warden_hostage = { + limit = { + save_good_$RELATION$_character_trigger_check = yes + } + add_to_list = good_child_relation_character + } + } + every_child = { + limit = { + save_good_$RELATION$_character_trigger_check = yes + } + add_to_list = good_child_relation_character + } + every_warden_hostage = { + limit = { + save_good_$RELATION$_character_trigger_check = yes + } + add_to_list = good_child_relation_character + } + every_courtier_or_guest = { + limit = { + save_good_$RELATION$_character_trigger_check = yes + } + add_to_list = good_child_relation_character + } + } + } + + if = { + limit = { + NOT = { exists = scope:$RELATION$ } + } + #To actually pick the relation + random_in_list = { + list = good_child_relation_character + limit = { + is_vassal_of = root + } + alternative_limit = { + is_courtier_of = root + } + alternative_limit = { + exists = liege + is_primary_heir_of = liege + } + alternative_limit = { + exists = liege + is_heir_of = liege + } + alternative_limit = { + always = yes + } + weight = { + base = 1 + modifier = { + add = 2 + is_powerful_vassal_of = root + } + modifier = { + add = 1 + exists = root.liege + is_vassal_of = root.liege + } + modifier = { + add = 1 + exists = root.liege + any_parent = { + is_vassal_of = root.liege + } + } + modifier = { + add = 4 + age >= root.age_dif_child_down + age <= root.age_dif_child_up + } + modifier = { + add = -0.5 + exists = scope:crush_relation + root = { has_sexuality = none } + OR = { + AND = { + is_female = yes + root = { is_female = yes } + } + AND = { + is_male = yes + root = { is_male = yes } + } + } + } + } + save_scope_as = $SCOPE$ + } + } +} + +send_event_about_player_heir_childhood_personality_effect = { + every_heir_title = { + limit = { + holder ?= { + is_ai = no + player_heir ?= scope:personality_child + NOT = { is_in_list = childhood_personality_event } + } + is_title_created = yes #Since partition succession may result in uncreated titles having heirs but not holders. + } + holder = { + add_to_list = childhood_personality_event + } + } + + every_in_list = { + list = childhood_personality_event + trigger_event = child_personality.$ID$ + } +} + +add_suitable_same_realm_children_to_list = { + if = { + limit = { + OR = { + father ?= { + is_ai = no + } + mother ?= { + is_ai = no + } + host ?= { + is_ai = no + } + } + } + if = { + limit = { exists = location.county.holder.top_liege } + location.county.holder.top_liege = { + save_scope_as = top_liege_scope + } + } + else = { + save_scope_as = top_liege_scope + } + scope:top_liege_scope = { + if = { + limit = { + is_ai = yes + is_available_child = yes + this != root + age >= 6 + } + add_to_list = suitable_same_realm_children + } + if = { + limit = { + any_courtier_or_guest = { + is_ai = yes + is_available_child = yes + this != root + age >= 6 + } + } + every_courtier_or_guest = { + limit = { + is_ai = yes + is_available_child = yes + this != root + age >= 6 + } + add_to_list = suitable_same_realm_children + } + } + if = { + limit = { + any_warden_hostage = { + is_ai = yes + is_available_child = yes + this != root + age >= 6 + } + } + every_warden_hostage = { + limit = { + is_ai = yes + is_available_child = yes + this != root + age >= 6 + } + add_to_list = suitable_same_realm_children + } + } + if = { + limit = { + any_vassal_or_below = { + is_ai = yes + is_available_child = yes + this != root + age >= 6 + } + } + every_vassal_or_below = { + limit = { + is_ai = yes + is_available_child = yes + this != root + age >= 6 + } + add_to_list = suitable_same_realm_children + } + } + if = { + limit = { + any_vassal_or_below = { + any_courtier_or_guest = { + is_ai = yes + is_available_child = yes + this != root + age >= 6 + } + } + } + every_vassal_or_below = { + limit = { + any_courtier_or_guest = { + is_ai = yes + is_available_child = yes + this != root + age >= 6 + } + } + every_courtier_or_guest = { + limit = { + is_ai = yes + is_available_child = yes + this != root + age >= 6 + } + add_to_list = suitable_same_realm_children + } + } + } + if = { + limit = { + any_vassal_or_below = { + any_warden_hostage = { + is_ai = yes + is_available_child = yes + this != root + age >= 6 + } + } + } + every_vassal_or_below = { + limit = { + any_warden_hostage = { + is_ai = yes + is_available_child = yes + this != root + age >= 6 + } + } + every_warden_hostage = { + limit = { + is_ai = yes + is_available_child = yes + this != root + age >= 6 + } + add_to_list = suitable_same_realm_children + } + } + } + } + } + else = { + if = { + limit = { exists = location.county.holder } + location.county.holder = { + save_scope_as = top_liege_scope + } + } + else = { + save_scope_as = top_liege_scope + } + + scope:top_liege_scope = { + if = { + limit = { + is_ai = yes + is_available_child = yes + this != root + age >= 6 + } + add_to_list = suitable_same_realm_children + } + every_courtier = { + limit = { + is_ai = yes + is_available_child = yes + this != root + age >= 6 + } + add_to_list = suitable_same_realm_children + } + every_warden_hostage = { + limit = { + is_ai = yes + is_available_child = yes + this != root + age >= 6 + } + add_to_list = suitable_same_realm_children + } + } + } +} + +add_similar_age_same_court_children_to_list = { + location.county.holder = { + if = { + limit = { + is_ai = yes + save_good_crush_character_trigger_check = yes + } + add_to_list = similar_age_same_court_children + } + if = { + limit = { + any_courtier_or_guest = { + is_ai = yes + save_good_crush_character_trigger_check = yes + } + } + every_courtier_or_guest = { + limit = { + is_ai = yes + save_good_crush_character_trigger_check = yes + } + add_to_list = similar_age_same_court_children + } + } + if = { + limit = { + any_warden_hostage = { + is_ai = yes + save_good_crush_character_trigger_check = yes + } + } + every_warden_hostage = { + limit = { + is_ai = yes + save_good_crush_character_trigger_check = yes + } + add_to_list = similar_age_same_court_children + } + } + } +} + +guardian_or_court_tutor_trigger_event = { + if = { + limit = { + any_relation = { + type = guardian + } + } + random_relation = { + type = guardian + trigger_event = $EVENT$ + } + } + else_if = { + limit = { + exists = court_owner.court_position:court_guru_court_position + } + court_owner.court_position:court_guru_court_position = { + trigger_event = $EVENT$ + } + } + else = { + court_owner.court_position:court_tutor_court_position ?= { + trigger_event = $EVENT$ + } + } +} diff --git a/N3OW/common/scripted_effects/00_commander_effects.txt b/N3OW/common/scripted_effects/00_commander_effects.txt new file mode 100644 index 00000000..2688a5f9 --- /dev/null +++ b/N3OW/common/scripted_effects/00_commander_effects.txt @@ -0,0 +1,801 @@ +#Effects relating to commanders + +#get_valid_commander_list_effect: Creates a list of all valid commander characters called "valid_commanders" + +get_valid_commander_list_effect = { + every_vassal = { + limit = { + can_be_commander_now_trigger = { ARMY_OWNER = $ARMY_OWNER$ } + } + add_to_list = $LIST$ + } + every_courtier = { + limit = { + can_be_commander_now_trigger = { ARMY_OWNER = $ARMY_OWNER$ } + } + add_to_list = $LIST$ + } +} + +knight_increase_prowess_chance_effect = { + random_list = { + 60 = { + modifier = { + add = { + value = this.learning + multiply = -1 + multiply = 2 + } + } + modifier = { + factor = 0.5 + dynasty ?= { + has_dynasty_perk = warfare_legacy_3 + } + } + } + 30 = { + add_prowess_skill = 1 + } + 10 = { + blademaster_lifestyle_rank_up_effect = yes + modifier = { + add = 5 + has_education_martial_trigger = yes + } + modifier = { + add = 4 + has_trait = education_martial_prowess_1 + } + modifier = { + add = 8 + has_trait = education_martial_prowess_2 + } + modifier = { + add = 12 + has_trait = education_martial_prowess_3 + } + modifier = { + add = 16 + has_trait = education_martial_prowess_4 + } + modifier = { + add = 15 + has_trait = lifestyle_blademaster + } + modifier = { + add = 10 + has_trait = shrewd + } + modifier = { + add = 10 + has_trait = physique_good + } + modifier = { + add = 5 + has_trait = intellect_good_1 + } + modifier = { + add = 15 + has_trait = intellect_good_2 + } + modifier = { + add = 30 + has_trait = intellect_good_3 + } + modifier = { + factor = 3 + culture = { + has_cultural_parameter = blademaster_traits_more_common + } + } + modifier = { + factor = 0 + AND = { + has_trait = lifestyle_blademaster + has_trait_xp = { + trait = lifestyle_blademaster + value >= trait_third_level + } + } + } + } + } + + #This effect is used when the knight does something "good", so let's save them for the player to perhaps reward in the future + if = { + limit = { + liege ?= { is_ai = no } + NOT = { has_character_flag = was_the_target_of_event_court_5060 } + } + if = { + limit = { + exists = var:number_of_impressive_knight_things + } + change_variable = { + name = number_of_impressive_knight_things + add = 1 + } + } + else = { + set_variable = { + name = number_of_impressive_knight_things + value = 1 + } + } + + # Maintenance of the variable + if = { + limit = { + NOT = { has_character_flag = is_schedueled_for_court_5061_maintenance } + } + add_character_flag = { + flag = is_schedueled_for_court_5061_maintenance + years = 4 + } + trigger_event = { + id = court.5061 + years = 4 + } + } + liege = { + add_to_variable_list = { + name = impressive_knights + target = prev + } + } + } +} + +berserker_kill_version_randomization_effect = { + random_list = { + 10 = { + scope:combat_side = { + battle_event = { + key = "berserker_rage_killed_enemy_no_trait" + left_portrait = root + right_portrait = scope:enemy_knight + type = death + target_right = yes + } + } + scope:enemy_knight = { + death = { + death_reason = death_head_ripped_off + killer = root + } + } + } + 10 = { + scope:combat_side = { + battle_event = { + key = "berserker_rage_killed_enemy_no_trait_v2" + left_portrait = root + right_portrait = scope:enemy_knight + type = death + target_right = yes + } + } + scope:enemy_knight = { + death = { + death_reason = death_cloven_in_half + killer = root + } + } + } + 10 = { + scope:combat_side = { + battle_event = { + key = "berserker_rage_killed_enemy_no_trait_v3" + left_portrait = root + right_portrait = scope:enemy_knight + type = death + target_right = yes + } + } + scope:enemy_knight = { + death = { + death_reason = death_viciously_dismembered + killer = root + } + } + } + 10 = { + scope:combat_side = { + battle_event = { + key = "berserker_rage_killed_enemy_no_trait_v4" + left_portrait = root + right_portrait = scope:enemy_knight + type = death + target_right = yes + } + } + scope:enemy_knight = { + death = { + death_reason = death_ripped_apart_limb_by_limb + killer = root + } + } + } + 10 = { + scope:combat_side = { + battle_event = { + key = "berserker_rage_killed_enemy_no_trait_v5" + left_portrait = root + right_portrait = scope:enemy_knight + type = death + target_right = yes + } + } + scope:enemy_knight = { + death = { + death_reason = death_chopped_to_pieces + killer = root + } + } + } + 10 = { + scope:combat_side = { + battle_event = { + key = "berserker_rage_killed_enemy_no_trait_v6" + left_portrait = root + right_portrait = scope:enemy_knight + type = death + target_right = yes + } + } + scope:enemy_knight = { + death = { + death_reason = death_heart_ripped_out + killer = root + } + } + } + 1 = { + trigger = { + scope:enemy_knight = { + NOT = { + has_trait = brave + } + } + } + modifier = { + add = 99 + scope:enemy_knight = { + has_trait = craven + } + } + scope:combat_side = { + battle_event = { + key = "berserker_rage_killed_enemy_no_trait_v7" + left_portrait = root + right_portrait = scope:enemy_knight + type = death + target_right = yes + } + } + scope:enemy_knight = { + death = { + death_reason = death_fear + killer = root + } + } + } + 10 = { + scope:combat_side = { + battle_event = { + key = "berserker_rage_killed_enemy_no_trait_v8" + left_portrait = root + right_portrait = scope:enemy_knight + type = death + target_right = yes + } + } + scope:enemy_knight = { + death = { + death_reason = death_skull_cracked_open + killer = root + } + } + } + 10 = { + scope:combat_side = { + battle_event = { + key = "berserker_rage_killed_enemy_no_trait_v9" + left_portrait = root + right_portrait = scope:enemy_knight + type = death + target_right = yes + } + } + scope:enemy_knight = { + death = { + death_reason = death_strangled_with_own_intestines + killer = root + } + } + } + } +} + +shieldmaiden_kill_version_randomisation_effect = { + random_list = { + 10 = { + scope:combat_side = { + battle_event = { + key = "shieldmaiden_skill_killed_enemy_no_trait_v1" + left_portrait = root + right_portrait = scope:enemy_knight + type = death + target_right = yes + } + } + scope:enemy_knight = { + death = { + death_reason = death_decapitated + killer = root + } + } + } + 10 = { + scope:combat_side = { + battle_event = { + key = "shieldmaiden_skill_killed_enemy_no_trait_v2" + left_portrait = root + right_portrait = scope:enemy_knight + type = death + target_right = yes + } + } + scope:enemy_knight = { + death = { + death_reason = death_cloven_in_half + killer = root + } + } + } + 10 = { + scope:combat_side = { + battle_event = { + key = "shieldmaiden_skill_killed_enemy_no_trait_v3" + left_portrait = root + right_portrait = scope:enemy_knight + type = death + target_right = yes + } + } + scope:enemy_knight = { + death = { + death_reason = death_viciously_dismembered + killer = root + } + } + } + 10 = { + scope:combat_side = { + battle_event = { + key = "shieldmaiden_skill_killed_enemy_no_trait_v4" + left_portrait = root + right_portrait = scope:enemy_knight + type = death + target_right = yes + } + } + scope:enemy_knight = { + death = { + death_reason = death_piteously_cut_down + killer = root + } + } + } + 10 = { + scope:combat_side = { + battle_event = { + key = "shieldmaiden_skill_killed_enemy_no_trait_v5" + left_portrait = root + right_portrait = scope:enemy_knight + type = death + target_right = yes + } + } + scope:enemy_knight = { + death = { + death_reason = death_chopped_to_pieces + killer = root + } + } + } + } +} + +recruit_terrain_specialist_effect = { + if = { + limit = { + exists = root.capital_province + any_pool_character = { + is_adult = yes + province = root.capital_province + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } + martial >= medium_skill_rating + culture = root.culture + opinion = { # Just to make sure you don't pull in rivals or similar + value >= -30 + target = root + } + } + } + random_pool_character = { + province = root.capital_province + limit = { + is_adult = yes + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } + martial >= medium_skill_rating + culture = root.culture + opinion = { # Just to make sure you don't pull in rivals or similar + value >= -30 + target = root + } + } + if = { + limit = { + NOT = { + has_trait = $SPECIALIST_TRAIT$ + } + } + add_trait = $SPECIALIST_TRAIT$ + } + random = { + chance = 50 + wanderer_give_random_commander_trait_effect = yes + } + save_scope_as = new_commander + } + } + else = { + create_character = { + employer = root + template = $SPECIALIST_TEMPLATE_CHARACTER$ + faith = root.faith + culture = root.culture + gender_female_chance = { + if = { + limit = { root.culture = { has_cultural_parameter = martial_custom_male_only_combatant } } + add = 0 + } + else_if = { + limit = { root.culture = { has_cultural_parameter = martial_custom_female_only_combatant } } + add = 100 + } + else = { + add = 50 + } + } + save_scope_as = new_commander + } + } + if = { # Error suppression + limit = { + exists = scope:new_commander + } + scope:new_commander = { + add_character_flag = { + flag = blocked_from_leaving + years = 25 + } + } + if = { + limit = { + scope:new_commander = { + NOT = { + is_courtier_of = root + } + } + } + add_courtier = scope:new_commander + } + send_interface_toast = { + title = commander_recruited.t + left_icon = scope:new_commander + custom_tooltip = commander_recruited.desc + } + } +} + +recruit_three_nomadic_capital_characters_effect = { + save_scope_as = root_scope + create_character = { + employer = scope:root_scope + template = $NOMAD_TEMPLATE_CHARACTER$ + faith = domicile.domicile_faith + culture = domicile.domicile_culture + save_scope_as = new_commander + } + if = { # Error suppression + limit = { + exists = scope:new_commander + } + scope:new_commander = { + assign_random_nickname_effect = yes + add_character_flag = { + flag = blocked_from_leaving + years = 25 + } + } + if = { + limit = { + scope:new_commander = { + NOT = { + is_courtier_of = scope:root_scope + } + } + } + add_courtier = scope:new_commander + } + send_interface_message = { + title = nomad_character_recruited.t + left_icon = scope:new_commander + custom_tooltip = commander_recruited.desc + } + } + create_character = { + employer = scope:root_scope + template = $NOMAD_TEMPLATE_CHARACTER$ + faith = domicile.domicile_faith + culture = domicile.domicile_culture + save_scope_as = new_commander + } + if = { # Error suppression + limit = { + exists = scope:new_commander + } + scope:new_commander = { + assign_random_nickname_effect = yes + add_character_flag = { + flag = blocked_from_leaving + years = 25 + } + } + if = { + limit = { + scope:new_commander = { + NOT = { + is_courtier_of = scope:root_scope + } + } + } + add_courtier = scope:new_commander + } + send_interface_message = { + title = nomad_character_recruited.t + left_icon = scope:new_commander + custom_tooltip = commander_recruited.desc + } + } + create_character = { + employer = scope:root_scope + template = $NOMAD_TEMPLATE_CHARACTER$ + faith = domicile.domicile_faith + culture = domicile.domicile_culture + save_scope_as = new_commander + } + if = { # Error suppression + limit = { + exists = scope:new_commander + } + scope:new_commander = { + assign_random_nickname_effect = yes + add_character_flag = { + flag = blocked_from_leaving + years = 25 + } + } + if = { + limit = { + scope:new_commander = { + NOT = { + is_courtier_of = scope:root_scope + } + } + } + add_courtier = scope:new_commander + } + send_interface_message = { + title = nomad_character_recruited.t + left_icon = scope:new_commander + custom_tooltip = commander_recruited.desc + } + } +} + +commander_trait_lvling_ai_effect = { + save_scope_as = root_scope + random_list = { + 1 = { + trigger = { has_trait = logistician } + add_trait_xp = { + trait = logistician + value = { + value = 100 + subtract = "scope:root_scope.has_trait_xp(logistician)" + divide = 100 + } + } + } + 1 = { + trigger = { has_trait = military_engineer } + add_trait_xp = { + trait = military_engineer + value = { + value = 100 + subtract = "scope:root_scope.has_trait_xp(military_engineer)" + divide = 100 + } + } + } + 1 = { + trigger = { has_trait = aggressive_attacker } + add_trait_xp = { + trait = aggressive_attacker + value = { + value = 100 + subtract = "scope:root_scope.has_trait_xp(aggressive_attacker)" + divide = 100 + } + } + } + 1 = { + trigger = { has_trait = unyielding_defender } + add_trait_xp = { + trait = unyielding_defender + value = { + value = 100 + subtract = "scope:root_scope.has_trait_xp(unyielding_defender)" + divide = 100 + } + } + } + 1 = { + trigger = { has_trait = forder } + add_trait_xp = { + trait = forder + value = { + value = 100 + subtract = "scope:root_scope.has_trait_xp(forder)" + divide = 100 + } + } + } + 1 = { + trigger = { has_trait = flexible_leader } + add_trait_xp = { + trait = flexible_leader + value = { + value = 100 + subtract = "scope:root_scope.has_trait_xp(flexible_leader)" + divide = 100 + } + } + } + 1 = { + trigger = { has_trait = desert_warrior } + add_trait_xp = { + trait = desert_warrior + value = { + value = 100 + subtract = "scope:root_scope.has_trait_xp(desert_warrior)" + divide = 100 + } + } + } + 1 = { + trigger = { has_trait = jungle_stalker } + add_trait_xp = { + trait = jungle_stalker + value = { + value = 100 + subtract = "scope:root_scope.has_trait_xp(jungle_stalker)" + divide = 100 + } + } + } + 1 = { + trigger = { has_trait = reaver } + add_trait_xp = { + trait = reaver + value = { + value = 100 + subtract = "scope:root_scope.has_trait_xp(reaver)" + divide = 100 + } + } + } + 1 = { + trigger = { has_trait = reckless } + add_trait_xp = { + trait = reckless + value = { + value = 100 + subtract = "scope:root_scope.has_trait_xp(reckless)" + divide = 100 + } + } + } + 1 = { + trigger = { has_trait = holy_warrior } + add_trait_xp = { + trait = holy_warrior + value = { + value = 100 + subtract = "scope:root_scope.has_trait_xp(holy_warrior)" + divide = 100 + } + } + } + 1 = { + trigger = { has_trait = open_terrain_expert } + add_trait_xp = { + trait = open_terrain_expert + value = { + value = 100 + subtract = "scope:root_scope.has_trait_xp(open_terrain_expert)" + divide = 100 + } + } + } + 1 = { + trigger = { has_trait = rough_terrain_expert } + add_trait_xp = { + trait = rough_terrain_expert + value = { + value = 100 + subtract = "scope:root_scope.has_trait_xp(rough_terrain_expert)" + divide = 100 + } + } + } + 1 = { + trigger = { has_trait = forest_fighter } + add_trait_xp = { + trait = forest_fighter + value = { + value = 100 + subtract = "scope:root_scope.has_trait_xp(forest_fighter)" + divide = 100 + } + } + } + 1 = { + trigger = { has_trait = cautious_leader } + add_trait_xp = { + trait = cautious_leader + value = { + value = 100 + subtract = "scope:root_scope.has_trait_xp(cautious_leader)" + divide = 100 + } + } + } + 1 = { + trigger = { has_trait = organizer } + add_trait_xp = { + trait = organizer + value = { + value = 100 + subtract = "scope:root_scope.has_trait_xp(organizer)" + divide = 100 + } + } + } + 1 = { + trigger = { has_trait = winter_soldier } + add_trait_xp = { + trait = winter_soldier + value = { + value = 100 + subtract = "scope:root_scope.has_trait_xp(winter_soldier)" + divide = 100 + } + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_compliment_effects.txt b/N3OW/common/scripted_effects/00_compliment_effects.txt new file mode 100644 index 00000000..dac857cf --- /dev/null +++ b/N3OW/common/scripted_effects/00_compliment_effects.txt @@ -0,0 +1,689 @@ +#Effects used in Lifestyle Focus events + + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! +# + + +##################### +# COMPLIMENT SYSTEM # +##################### +#This system evaluates whether a character would accept a certain type of compliment (types listed below) from another character. It will set a compliment_outcome varaible with a flag value of either good, neutral or bad which can be used to trigger follow up events. + +#randomize_available_compliment_effect - as there are more compliment types than option buttons, you can use this effect to randomize a number of flags to trigger options (12 types of compliments). +#randomize_good_available_compliment_effect - this one will do its best to pick a good compliment option, recommended to use this one for at least one of the randomized options so that the player has at least one option which is likely to be successful. Defaults to randomize_available_compliment_effect if nothing good can be found. +#randomize_available_ai_value_compliment_effect - as the one above, but only uses the ai value compliments (8 types), the "light" version. +#clear_available_compliments_effect - clears all available compliment flags. +#evaluate_compliment_effect - evaluates the outcome of the compliment with a random_list and sets a compliment_outcome variable. +#evaluate_compliment_with_type_variable_effect - the same as the one above but also saves a variable containing the type of comliment used. + +#COMPLIMENT TYPES +#compassionate (ai value) +#bold (ai value) +#honorable (ai value) +#rational (ai value) +#zealous (ai value) +#energetic (ai value) +#forgiving (ai value) +#beautiful +#strong +#extroverted +#dominant + +#If you don't want to specify the available compliments, you can use this to get a selection relative to your root.diplomacy skill and your target's preferences. +#Run the effect as many times as the amount of compliment options you need. +#More diplomatically skilled characters has a higher chance to receive options which have a high likelihood of success. +#If you want to block a certain compliment, you can add that flag yourself before randomizing and then removing it afterwards. +#Use in scope of compliment giver. +#Needs arguments COMPLIMENT_RECEIVER +randomize_available_compliment_effect = { + random_list = { + 1 = { + trigger = { NOT = { has_character_flag = available_compliment_compassionate } } + modifier = { + factor = 3 + root.diplomacy >= decent_skill_rating + $COMPLIMENT_RECEIVER$ = { ai_compassion >= low_positive_compassion } + } + modifier = { + factor = 2 + root.diplomacy < medium_skill_rating + $COMPLIMENT_RECEIVER$ = { ai_compassion < 0 } + } + add_character_flag = available_compliment_compassionate + } + 1 = { + trigger = { NOT = { has_character_flag = available_compliment_bold } } + modifier = { + factor = 3 + root.diplomacy >= decent_skill_rating + $COMPLIMENT_RECEIVER$ = { ai_boldness >= low_positive_boldness } + } + modifier = { + factor = 2 + root.diplomacy < medium_skill_rating + $COMPLIMENT_RECEIVER$ = { ai_boldness < 0 } + } + add_character_flag = available_compliment_bold + } + 1 = { + trigger = { NOT = { has_character_flag = available_compliment_honorable } } + modifier = { + factor = 3 + root.diplomacy >= decent_skill_rating + $COMPLIMENT_RECEIVER$ = { ai_honor >= low_positive_honor } + } + modifier = { + factor = 2 + root.diplomacy < medium_skill_rating + $COMPLIMENT_RECEIVER$ = { ai_honor < 0 } + } + add_character_flag = available_compliment_honorable + } + 1 = { + trigger = { NOT = { has_character_flag = available_compliment_greedy } } + modifier = { + factor = 3 + root.diplomacy >= decent_skill_rating + $COMPLIMENT_RECEIVER$ = { ai_greed >= low_positive_greed } + } + modifier = { + factor = 2 + root.diplomacy < medium_skill_rating + $COMPLIMENT_RECEIVER$ = { ai_greed < 0 } + } + add_character_flag = available_compliment_greedy + } + 1 = { + trigger = { NOT = { has_character_flag = available_compliment_rational } } + modifier = { + factor = 3 + root.diplomacy >= decent_skill_rating + $COMPLIMENT_RECEIVER$ = { ai_rationality >= low_positive_rationality } + } + modifier = { + factor = 2 + root.diplomacy < medium_skill_rating + $COMPLIMENT_RECEIVER$ = { ai_rationality < 0 } + } + add_character_flag = available_compliment_rational + } + 1 = { + trigger = { NOT = { has_character_flag = available_compliment_zealous } } + modifier = { + factor = 3 + root.diplomacy >= decent_skill_rating + $COMPLIMENT_RECEIVER$ = { ai_zeal >= low_positive_zeal } + } + modifier = { + factor = 2 + root.diplomacy < medium_skill_rating + $COMPLIMENT_RECEIVER$ = { ai_zeal < 0 } + } + add_character_flag = available_compliment_zealous + } + 1 = { + trigger = { NOT = { has_character_flag = available_compliment_energetic } } + modifier = { + factor = 3 + root.diplomacy >= decent_skill_rating + $COMPLIMENT_RECEIVER$ = { ai_energy >= low_positive_energy } + } + modifier = { + factor = 2 + root.diplomacy < medium_skill_rating + $COMPLIMENT_RECEIVER$ = { ai_energy < 0 } + } + add_character_flag = available_compliment_energetic + } + 1 = { + trigger = { NOT = { has_character_flag = available_compliment_forgiving } } + modifier = { + factor = 3 + root.diplomacy >= decent_skill_rating + $COMPLIMENT_RECEIVER$ = { ai_vengefulness <= low_negative_vengefulness } + } + modifier = { + factor = 2 + root.diplomacy < medium_skill_rating + $COMPLIMENT_RECEIVER$ = { ai_vengefulness > 0 } + } + add_character_flag = available_compliment_forgiving + } + 1 = { + trigger = { NOT = { has_character_flag = available_compliment_beautiful } } + modifier = { + factor = 3 + root.diplomacy >= decent_skill_rating + $COMPLIMENT_RECEIVER$ = { attraction >= 10 } + } + modifier = { + factor = 2 + root.diplomacy < medium_skill_rating + $COMPLIMENT_RECEIVER$ = { attraction < -10 } + } + add_character_flag = available_compliment_beautiful + } + 1 = { + trigger = { NOT = { has_character_flag = available_compliment_strong } } + modifier = { + factor = 3 + root.diplomacy >= decent_skill_rating + $COMPLIMENT_RECEIVER$ = { + OR = { + has_trait = strong + has_trait = physique_good_1 + has_trait = physique_good_2 + has_trait = physique_good_3 + } + } + } + modifier = { + factor = 2 + root.diplomacy < medium_skill_rating + $COMPLIMENT_RECEIVER$ = { + OR = { + has_trait = weak + has_trait = physique_bad_1 + has_trait = physique_bad_2 + has_trait = physique_bad_3 + } + } + } + add_character_flag = available_compliment_strong + } + 1 = { + trigger = { NOT = { has_character_flag = available_compliment_extroverted } } + modifier = { + factor = 3 + root.diplomacy >= decent_skill_rating + $COMPLIMENT_RECEIVER$ = { has_personality_extroverted_trigger = yes } + } + modifier = { + factor = 2 + root.diplomacy < medium_skill_rating + $COMPLIMENT_RECEIVER$ = { has_personality_introverted_trigger = yes } + } + add_character_flag = available_compliment_extroverted + } + 1 = { + trigger = { NOT = { has_character_flag = available_compliment_dominant } } + modifier = { + factor = 3 + root.diplomacy >= decent_skill_rating + $COMPLIMENT_RECEIVER$ = { has_personality_dominant_trigger = yes } + } + modifier = { + factor = 2 + root.diplomacy < medium_skill_rating + $COMPLIMENT_RECEIVER$ = { has_personality_submissive_trigger = yes } + } + add_character_flag = available_compliment_dominant + } + } +} + +#Randomizes an available compliment which is likely to work, needs argument COMPLIMENT_RECEIVER. +randomize_good_available_compliment_effect = { + random_list = { + 100 = { + trigger = { + $COMPLIMENT_RECEIVER$ = { ai_compassion >= low_positive_compassion } + NOT = { has_character_flag = available_compliment_compassionate } + } + add_character_flag = available_compliment_compassionate + } + 100 = { + trigger = { + $COMPLIMENT_RECEIVER$ = { ai_boldness >= low_positive_boldness } + NOT = { has_character_flag = available_compliment_bold } + } + add_character_flag = available_compliment_bold + } + 100 = { + trigger = { + $COMPLIMENT_RECEIVER$ = { ai_honor >= low_positive_honor } + NOT = { has_character_flag = available_compliment_honorable } + } + add_character_flag = available_compliment_honorable + } + 100 = { + trigger = { + $COMPLIMENT_RECEIVER$ = { ai_greed >= low_positive_greed } + NOT = { has_character_flag = available_compliment_greedy } + } + add_character_flag = available_compliment_greedy + } + 100 = { + trigger = { + $COMPLIMENT_RECEIVER$ = { ai_rationality >= low_positive_rationality } + NOT = { has_character_flag = available_compliment_rational } + } + add_character_flag = available_compliment_rational + } + 100 = { + trigger = { + $COMPLIMENT_RECEIVER$ = { ai_zeal >= low_positive_zeal } + NOT = { has_character_flag = available_compliment_zealous } + } + add_character_flag = available_compliment_zealous + } + 100 = { + trigger = { + $COMPLIMENT_RECEIVER$ = { ai_energy >= low_positive_energy } + NOT = { has_character_flag = available_compliment_energetic } + } + add_character_flag = available_compliment_energetic + } + 100 = { + trigger = { + $COMPLIMENT_RECEIVER$ = { ai_vengefulness <= low_negative_vengefulness } + NOT = { has_character_flag = available_compliment_forgiving } + } + add_character_flag = available_compliment_forgiving + } + 100 = { + trigger = { + $COMPLIMENT_RECEIVER$ = { attraction >= 10 } + NOT = { has_character_flag = available_compliment_beautiful } + } + add_character_flag = available_compliment_beautiful + } + 100 = { + trigger = { + $COMPLIMENT_RECEIVER$ = { + OR = { + has_trait = strong + has_trait = physique_good + } + } + NOT = { has_character_flag = available_compliment_strong } + } + add_character_flag = available_compliment_strong + } + 100 = { + trigger = { + $COMPLIMENT_RECEIVER$ = { has_personality_extroverted_trigger = yes } + NOT = { has_character_flag = available_compliment_extroverted } + } + add_character_flag = available_compliment_extroverted + } + 100 = { + trigger = { + $COMPLIMENT_RECEIVER$ = { has_personality_dominant_trigger = yes } + NOT = { has_character_flag = available_compliment_dominant } + } + add_character_flag = available_compliment_dominant + } + 1 = { #Fallback + randomize_available_compliment_effect = { COMPLIMENT_RECEIVER = $COMPLIMENT_RECEIVER$ } + } + } +} + +#Same as randomize_available_compliment_effect but it only uses the 8 ai value compliments. Required argument COMPLIMENT_RECEIVER (not tested) +randomize_available_ai_value_compliment_effect = { + add_character_flag = available_compliment_beautiful + add_character_flag = available_compliment_strong + add_character_flag = available_compliment_extroverted + add_character_flag = available_compliment_dominant + + randomize_available_compliment_effect = { COMPLIMENT_RECEIVER = $COMPLIMENT_RECEIVER$ } + + remove_character_flag = available_compliment_beautiful + remove_character_flag = available_compliment_strong + remove_character_flag = available_compliment_extroverted + remove_character_flag = available_compliment_dominant +} + +#Clears all the compliment flags after the event +clear_available_compliments_effect = { + remove_character_flag = available_compliment_compassionate + remove_character_flag = available_compliment_bold + remove_character_flag = available_compliment_honorable + remove_character_flag = available_compliment_greedy + remove_character_flag = available_compliment_rational + remove_character_flag = available_compliment_zealous + remove_character_flag = available_compliment_energetic + remove_character_flag = available_compliment_forgiving + remove_character_flag = available_compliment_beautiful + remove_character_flag = available_compliment_strong + remove_character_flag = available_compliment_extroverted + remove_character_flag = available_compliment_dominant +} + +#EVALUATION +#Use in scope of compliment receiver. +#2 types, regular evaluate_compliment_effect and evaluate_compliment_with_type_variable_effect which saves the variable containing the type (evaluated_compliment_type) +#Needs arguments COMPLIMENT_TYPE (see compliment type list above) and COMPLIMENT_GIVER (the name of the scope). + +evaluate_compliment_effect = { + + save_scope_value_as = { + name = evaluated_compliment_type + value = flag:$COMPLIMENT_TYPE$ + } + + if = { + limit = { exists = scope:evaluated_compliment_type } #Because there are error messages otherwise + + random_list = { + # BAD OUTCOME + 0 = { # Base chance of 0, since we don't ever want to randomly penalize the player due to bad luck even if they picked the right compliment. + modifier = { + add = 100 #Incorrect type of compliment significantly increases chances of being insulted. + OR = { + AND = { + scope:evaluated_compliment_type = flag:compassionate + ai_compassion < 0 + } + AND = { + scope:evaluated_compliment_type = flag:bold + ai_boldness < 0 + } + AND = { + scope:evaluated_compliment_type = flag:honorable + ai_honor < 0 + } + AND = { + scope:evaluated_compliment_type = flag:greedy + ai_greed < 0 + } + AND = { + scope:evaluated_compliment_type = flag:rational + ai_rationality < 0 + } + AND = { + scope:evaluated_compliment_type = flag:zealous + ai_zeal < 0 + } + AND = { + scope:evaluated_compliment_type = flag:energetic + ai_energy < 0 + } + AND = { + scope:evaluated_compliment_type = flag:forgiving + ai_vengefulness > 0 + } + AND = { + scope:evaluated_compliment_type = flag:beautiful + attraction < -10 + } + AND = { + scope:evaluated_compliment_type = flag:strong + OR = { + has_trait = weak + has_trait = physique_bad_1 + has_trait = physique_bad_2 + has_trait = physique_bad_3 + } + } + AND = { + scope:evaluated_compliment_type = flag:extroverted + has_personality_introverted_trigger = yes + } + AND = { + scope:evaluated_compliment_type = flag:dominant + has_personality_submissive_trigger = yes + } + } + } + modifier = { #Humble people struggle with compliments + factor = 1.5 + has_trait = humble + } + + save_scope_value_as = { + name = compliment_outcome + value = flag:bad + } + } + + 60 = { #NEUTRAL OUTCOME + modifier = { + factor = 1.3 + has_trait = arrogant + } + modifier = { + factor = 1.3 + has_trait = humble + } + + save_scope_value_as = { + name = compliment_outcome + value = flag:neutral + } + } + + 25 = { #GOOD OUTCOME + modifier = { #Great compliment (not step-based) + factor = 8 + OR = { + AND = { + scope:evaluated_compliment_type = flag:extroverted + has_personality_extroverted_trigger = yes + } + AND = { + scope:evaluated_compliment_type = flag:dominant + has_personality_dominant_trigger = yes + } + } + } + modifier = { #Great compliment (step-based) + factor = 2 #Adds up to 8 with the two modifiers below + OR = { + AND = { + scope:evaluated_compliment_type = flag:compassionate + ai_compassion >= high_positive_compassion + } + AND = { + scope:evaluated_compliment_type = flag:bold + ai_boldness >= high_positive_boldness + } + AND = { + scope:evaluated_compliment_type = flag:honorable + ai_honor >= high_positive_honor + } + AND = { + scope:evaluated_compliment_type = flag:greedy + ai_greed >= high_positive_greed + } + AND = { + scope:evaluated_compliment_type = flag:rational + ai_rationality >= high_positive_rationality + } + AND = { + scope:evaluated_compliment_type = flag:zealous + ai_zeal >= high_positive_zeal + } + AND = { + scope:evaluated_compliment_type = flag:energetic + ai_energy >= high_positive_energy + } + AND = { + scope:evaluated_compliment_type = flag:forgiving + ai_vengefulness <= high_negative_vengefulness + } + AND = { + scope:evaluated_compliment_type = flag:beautiful + attraction >= 30 + } + AND = { + scope:evaluated_compliment_type = flag:strong + has_trait = physique_good_3 + } + } + } + modifier = { #Good compliment (step-based) + factor = 2 #Adds up to 4 with the modifier below + OR = { + AND = { + scope:evaluated_compliment_type = flag:compassionate + ai_compassion >= medium_positive_compassion + } + AND = { + scope:evaluated_compliment_type = flag:bold + ai_boldness >= medium_positive_boldness + } + AND = { + scope:evaluated_compliment_type = flag:honorable + ai_honor >= medium_positive_honor + } + AND = { + scope:evaluated_compliment_type = flag:greedy + ai_greed >= medium_positive_greed + } + AND = { + scope:evaluated_compliment_type = flag:rational + ai_rationality >= medium_positive_rationality + } + AND = { + scope:evaluated_compliment_type = flag:zealous + ai_zeal >= medium_positive_zeal + } + AND = { + scope:evaluated_compliment_type = flag:energetic + ai_energy >= medium_positive_energy + } + AND = { + scope:evaluated_compliment_type = flag:forgiving + ai_vengefulness <= medium_negative_vengefulness + } + AND = { + scope:evaluated_compliment_type = flag:beautiful + attraction >= 20 + } + AND = { + scope:evaluated_compliment_type = flag:strong + OR = { + has_trait = physique_good_2 + has_trait = physique_good_3 + has_trait = strong + } + } + } + } + modifier = { #Good compliment (step-based) + factor = 4 + OR = { + AND = { + scope:evaluated_compliment_type = flag:compassionate + ai_compassion >= low_positive_compassion + } + AND = { + scope:evaluated_compliment_type = flag:bold + ai_boldness >= low_positive_boldness + } + AND = { + scope:evaluated_compliment_type = flag:honorable + ai_honor >= low_positive_honor + } + AND = { + scope:evaluated_compliment_type = flag:greedy + ai_greed >= low_positive_greed + } + AND = { + scope:evaluated_compliment_type = flag:rational + ai_rationality >= low_positive_rationality + } + AND = { + scope:evaluated_compliment_type = flag:zealous + ai_zeal >= low_positive_zeal + } + AND = { + scope:evaluated_compliment_type = flag:energetic + ai_energy >= low_positive_energy + } + AND = { + scope:evaluated_compliment_type = flag:forgiving + ai_vengefulness <= low_negative_vengefulness + } + AND = { + scope:evaluated_compliment_type = flag:beautiful + attraction >= 10 + } + AND = { + scope:evaluated_compliment_type = flag:strong + OR = { + has_trait = physique_good_1 + has_trait = physique_good_2 + has_trait = physique_good_3 + has_trait = strong + } + } + } + } + modifier = { #Arrogant people like compliments + factor = 1.5 + has_trait = arrogant + } + modifier = { #Diplomacy affects success chance + factor = { + value = $COMPLIMENT_GIVER$.diplomacy + subtract = diplomacy + multiply = 0.05 #I.e. 0.5 if 10 skill difference + add = 1 #To bring it to something like 1.5 + } + } + + save_scope_value_as = { + name = compliment_outcome + value = flag:good + } + } + } + } +} + +compliment_to_love_letter_effect = { + if = { + limit = { exists = scope:compliment_outcome } + + if = { + limit = { scope:compliment_outcome = flag:good } + set_variable = { + name = love_letter_quality + value = 4 + days = 150 + } + } + else_if = { + limit = { scope:compliment_outcome = flag:neutral } + set_variable = { + name = love_letter_quality + value = 2 + days = 150 + } + } + else_if = { + limit = { scope:compliment_outcome = flag:bad } + set_variable = { + name = love_letter_quality + value = 1 + days = 150 + } + } + + set_variable = { + name = love_letter_compliment_type + value = scope:evaluated_compliment_type + } + } +} + +compliment_to_love_letter_cleanup_effect = { + if = { + limit = { has_variable = love_letter_quality } + remove_variable = love_letter_quality + } + if = { + limit = { has_variable = love_letter_quality } + remove_variable = love_letter_compliment_type + } +} + + + diff --git a/N3OW/common/scripted_effects/00_councillor_effects.txt b/N3OW/common/scripted_effects/00_councillor_effects.txt new file mode 100644 index 00000000..be75fe17 --- /dev/null +++ b/N3OW/common/scripted_effects/00_councillor_effects.txt @@ -0,0 +1,1032 @@ + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! + +#got_council_position_effect: gives the corresponding opinion to the liege +#fired_from_council_position_effect: gives the corresponding opinion to the liege + +##################################################################### +# COUNCIL EFFECTS +##################################################################### + +got_council_position_effect = { + save_scope_as = new_councillor + # Travel Leaders can't be councillors, but should appear in the councillor list + if = { + limit = { has_court_position = travel_leader_court_position } + liege = { + revoke_court_position = { + recipient = scope:new_councillor + court_position = travel_leader_court_position + } + } + } + #If there is a fired opinion remove it + if = { + limit = { + has_opinion_modifier = { + modifier = fired_from_council_opinion + target = liege + } + } + remove_opinion = { + modifier = fired_from_council_opinion + target = liege + } + } + # No longer angry for losing court position - this is *better*! + if = { + limit = { + has_opinion_modifier = { + modifier = revoked_court_position_opinion + target = liege + } + } + remove_opinion = { + modifier = revoked_court_position_opinion + target = liege + } + } + + add_character_flag = is_in_the_council +} + +fired_from_council_position_effect = { + + add_opinion = { + modifier = fired_from_council_opinion + target = liege + } + + # If we're a clan this affects unity + #add_clan_unity_interaction_effect = { + # CHARACTER = root.liege + # TARGET = this + # VALUE = miniscule_unity_loss + # DESC = clan_unity_fired_from_council.desc + # REVERSE_NON_HOUSE_TARGET = no + #} + + remove_character_flag = is_in_the_council +} + +##################################################################### +# SPOUSE COUNCILLOR EFFECTS +##################################################################### + +councillor_spouse_learning_2601_tutoring_effect = { + $STUDENT$ = { save_scope_as = tutoring_student } + scope:tutoring_student = { + random_list = { + 20 = { #Critical success + modifier = { + has_education_rank_trigger = { RANK = 3 OPERATOR = equals } + factor = 0.6 + } + modifier = { + has_education_rank_trigger = { RANK = 4 OPERATOR = equals } + factor = 0.6 + } + modifier = { + root = { spouse_learning_tier_3_trigger = yes } + factor = 1.5 + } + desc = councillor_spouse_learning_2601_tutoring_effect.critical_success + root = { + send_interface_toast = { + type = event_toast_effect_good + title = councillor_spouse_learning_2601_tutoring_effect.critical_success + left_icon = scope:tutoring_student + right_icon = scope:councillor + scope:tutoring_student = { + rank_up_education_effect = yes + } + } + add_character_flag = { + flag = had_councillor_spouse_learning_2601_event + days = 7300 + } + } + + hidden_effect = { + if = { + limit = { scope:councillor != scope:tutoring_student } #Since the effect can be used on yourself. + scope:tutoring_student = { + add_opinion = { + target = scope:councillor + modifier = grateful_opinion + opinion = 15 + } + } + } + scope:councillor = { + if = { + limit = { scope:tutoring_student = { has_trait = education_diplomacy } } + add_character_modifier = { + modifier = studying_diplomacy + years = 10 + } + } + else_if = { + limit = { scope:tutoring_student = { has_trait = education_martial } } + add_character_modifier = { + modifier = studying_martial + years = 10 + } + } + else_if = { + limit = { scope:tutoring_student = { has_trait = education_stewardship } } + add_character_modifier = { + modifier = studying_stewardship + years = 10 + } + } + else_if = { + limit = { scope:tutoring_student = { has_trait = education_intrigue } } + add_character_modifier = { + modifier = studying_intrigue + years = 10 + } + } + else_if = { + limit = { scope:tutoring_student = { has_trait = education_learning } } + add_character_modifier = { + modifier = studying_learning + years = 10 + } + } + random_list = { + 1 = { set_nickname_effect = { NICKNAME = nick_the_scholar } } + 1 = { set_nickname_effect = { NICKNAME = nick_the_wise } } + 10 = { } + } + } + } + } + 55 = { #Success + desc = councillor_spouse_learning_2601_tutoring_effect.success + root = { + send_interface_toast = { + type = event_toast_effect_good + title = councillor_spouse_learning_2601_tutoring_effect.success + left_icon = scope:tutoring_student + right_icon = scope:councillor + scope:tutoring_student = { + if = { + limit = { has_trait = education_diplomacy } + add_character_modifier = { + modifier = studying_diplomacy + years = 10 + } + } + else_if = { + limit = { has_trait = education_martial } + add_character_modifier = { + modifier = studying_martial + years = 10 + } + } + else_if = { + limit = { has_trait = education_stewardship } + add_character_modifier = { + modifier = studying_stewardship + years = 10 + } + } + else_if = { + limit = { has_trait = education_intrigue } + add_character_modifier = { + modifier = studying_intrigue + years = 10 + } + } + else_if = { + limit = { has_trait = education_learning } + add_character_modifier = { + modifier = studying_learning + years = 10 + } + } + add_character_flag = { + flag = had_councillor_spouse_learning_2601_event + days = 3650 + } + } + } + } + hidden_effect = { + if = { + limit = { + scope:tutoring_student != scope:councillor #Since the effect can be used on yourself. + } + scope:tutoring_student = { + add_opinion = { + target = scope:councillor + modifier = grateful_opinion + opinion = 10 + } + } + } + } + } + } + } +} + +councillor_spouse_learning_2603_scopes_for_portraits_support_effect = { + if = { + limit = { exists = scope:councillor_2 } + save_scope_as = councillor_3 + } + else_if = { + limit = { exists = scope:councillor_1 } + save_scope_as = councillor_2 + } + else = { + save_scope_as = councillor_1 + } +} + +councillor_spouse_learning_2603_scopes_for_portraits_effect = { + if = { + limit = { is_ai = no } + + #Saves the (up to) 3 chosen chancellors for portraits. Set up like this to make sure the options and portraits are in the same order. + if = { + limit = { exists = scope:chancellor } + scope:chancellor = { councillor_spouse_learning_2603_scopes_for_portraits_support_effect = yes } + } + if = { + limit = { exists = scope:marshal } + scope:marshal = { councillor_spouse_learning_2603_scopes_for_portraits_support_effect = yes } + } + if = { + limit = { exists = scope:steward } + scope:steward = { councillor_spouse_learning_2603_scopes_for_portraits_support_effect = yes } + } + if = { + limit = { exists = scope:spymaster } + scope:spymaster = { councillor_spouse_learning_2603_scopes_for_portraits_support_effect = yes } + } + if = { + limit = { exists = scope:court_chaplain } + scope:court_chaplain = { councillor_spouse_learning_2603_scopes_for_portraits_support_effect = yes } + } + } +} + +councillor_spouse_learning_2603_scope_save_effect = { + if = { + limit = { + any_normal_councillor = { + councillor_spouse_learning_2603_valid_councillor_trigger = yes + NOR = { + AND = { + exists = scope:chancellor + this = scope:chancellor + } + AND = { + exists = scope:marshal + this = scope:marshal + } + AND = { + exists = scope:steward + this = scope:steward + } + AND = { + exists = scope:spymaster + this = scope:spymaster + } + AND = { + exists = scope:court_chaplain + this = scope:court_chaplain + } + } + } + } + random_list = { + 1 = { + trigger = { + exists = cp:councillor_chancellor + cp:councillor_chancellor = { councillor_spouse_learning_2603_valid_councillor_trigger = yes } + NOT = { exists = scope:chancellor } + } + modifier = { + cp:councillor_chancellor = { diplomacy <= mediocre_skill_rating } + factor = 3 + } + cp:councillor_chancellor = { save_scope_as = chancellor } + } + 1 = { + trigger = { + exists = cp:councillor_marshal + cp:councillor_marshal = { councillor_spouse_learning_2603_valid_councillor_trigger = yes } + NOT = { exists = scope:marshal } + } + modifier = { + cp:councillor_marshal = { martial <= mediocre_skill_rating } + factor = 3 + } + cp:councillor_marshal = { save_scope_as = marshal } + } + 1 = { + trigger = { + exists = cp:councillor_steward + cp:councillor_steward = { councillor_spouse_learning_2603_valid_councillor_trigger = yes } + NOT = { exists = scope:steward } + } + modifier = { + cp:councillor_steward = { stewardship <= mediocre_skill_rating } + factor = 3 + } + cp:councillor_steward = { save_scope_as = steward } + } + 1 = { + trigger = { + exists = cp:councillor_spymaster + cp:councillor_spymaster = { councillor_spouse_learning_2603_valid_councillor_trigger = yes } + NOT = { exists = scope:spymaster } + } + modifier = { + cp:councillor_spymaster = { intrigue <= mediocre_skill_rating } + factor = 3 + } + cp:councillor_spymaster = { save_scope_as = spymaster } + } + 1 = { + trigger = { + exists = cp:councillor_court_chaplain + cp:councillor_court_chaplain = { councillor_spouse_learning_2603_valid_councillor_trigger = yes } + NOT = { exists = scope:court_chaplain } + } + modifier = { + cp:councillor_court_chaplain = { learning <= mediocre_skill_rating } + factor = 3 + } + cp:councillor_court_chaplain = { save_scope_as = court_chaplain } + } + } + } +} + +councillor_spouse_learning_2603_chosen_councillor_effect = { + if = { + limit = { + OR = { + has_trait = humble + has_trait = calm + has_trait = diligent + has_trait = trusting + has_trait = compassionate + has_trait = forgiving + has_trait = content + } + NOT = { + has_trait = arrogant + } + } + add_opinion = { + target = root + modifier = grateful_opinion + opinion = 15 + } + hidden_effect = { + add_opinion = { + target = scope:councillor + modifier = grateful_opinion + opinion = 15 + } + } + } + else = { + add_opinion = { + target = root + modifier = insult_opinion + opinion = -15 + } + } +} + +add_patronage_spouse_education_points_effect = { + if = { + limit = { + exists = host.cp:councillor_spouse + } + host.cp:councillor_spouse = { save_scope_as = councillor } + if = { + limit ={ + spouse_learning_tier_1_trigger = yes + has_education_focus_trigger = yes + trigger_if = { + limit = { + has_variable = patronage_spouse_tutor + } + var:patronage_spouse_tutor = scope:councillor + } + } + save_scope_as = patronage_student + random = { + chance = 7 + modifier = { + add = 7 #14% + host = { spouse_learning_tier_2_trigger = yes } + } + modifier = { + add = 7 #21% + host = { spouse_learning_tier_3_trigger = yes } + } + modifier = { + NOR = { + is_child_of = scope:councillor + reverse_opinion = { + target = scope:councillor + value >= 25 + } + } + add = -5 + } + modifier = { + reverse_opinion = { + target = scope:councillor + value >= 50 + } + add = 5 + } + modifier = { + NOT = { is_child_of = scope:councillor } + any_parent = { is_spouse_of = scope:councillor } + OR = { + has_trait = bastard + has_trait = legitimized_bastard + } + scope:councillor = { + NOR = { + ai_compassion >= high_positive_ai_value + opinion = { target = scope:patronage_student value >= 50 } + } + } + add = -20 + } + + if = { + limit = { + has_variable = patronage_spouse_tutor + has_variable = patronage_spouse_tutor_points + } + change_variable = { + name = patronage_spouse_tutor_points + add = 1 + } + } + else = { + set_variable = { + name = patronage_spouse_tutor + value = scope:councillor + days = 5475 + } + set_variable = { + name = patronage_spouse_tutor_points + value = 1 + days = 5475 + } + } + host = { + save_scope_as = host + if = { + limit = { + any_child = { this = scope:patronage_student } + } + send_interface_message = { + type = msg_spouse_patronage + title = add_patronage_spouse_education_points_effect.t + desc = add_patronage_spouse_education_points_child_effect.desc + left_icon = scope:patronage_student + right_icon = scope:councillor + } + } + else_if = { + limit = { + player_heir ?= { this = scope:patronage_student } + } + send_interface_message = { + type = msg_spouse_patronage + title = add_patronage_spouse_education_points_effect.t + desc = add_patronage_spouse_education_points_effect.desc + left_icon = scope:patronage_student + right_icon = scope:councillor + } + } + } + } + } + } +} + +results_of_patronage_spouse_education_points_effect = { + if = { + limit = { has_variable = patronage_spouse_tutor } + + var:patronage_spouse_tutor = { + save_scope_as = patronage_spouse_tutor + } + + #Checks their current level + if = { + limit = { education_points_equals_education_rank = { RANK = 1 } } + save_scope_value_as = { + name = education_rank_before_patronage + value = 1 + } + } + else_if = { + limit = { education_points_equals_education_rank = { RANK = 2 } } + save_scope_value_as = { + name = education_rank_before_patronage + value = 2 + } + } + else_if = { + limit = { education_points_equals_education_rank = { RANK = 3 } } + save_scope_value_as = { + name = education_rank_before_patronage + value = 3 + } + } + else_if = { + limit = { education_points_equals_education_rank = { RANK = 4 } } + save_scope_value_as = { + name = education_rank_before_patronage + value = 4 + } + } + #Adding the points to the current education + if = { + limit = { has_focus = education_diplomacy } + change_variable = { + name = education_diplomacy_variable + add = var:patronage_spouse_tutor_points + } + } + else_if = { + limit = { has_focus = education_martial } + change_variable = { + name = education_martial_variable + add = var:patronage_spouse_tutor_points + } + } + else_if = { + limit = { has_focus = education_stewardship } + change_variable = { + name = education_stewardship_variable + add = var:patronage_spouse_tutor_points + } + } + else_if = { + limit = { has_focus = education_intrigue } + change_variable = { + name = education_intrigue_variable + add = var:patronage_spouse_tutor_points + } + } + else_if = { + limit = { has_focus = education_learning } + change_variable = { + name = education_learning_variable + add = var:patronage_spouse_tutor_points + } + } + + #Checks their new level + if = { + limit = { education_points_equals_education_rank = { RANK = 1 } } + save_scope_value_as = { + name = education_rank_after_patronage + value = 1 + } + } + else_if = { + limit = { education_points_equals_education_rank = { RANK = 2 } } + save_scope_value_as = { + name = education_rank_after_patronage + value = 2 + } + } + else_if = { + limit = { education_points_equals_education_rank = { RANK = 3 } } + save_scope_value_as = { + name = education_rank_after_patronage + value = 3 + } + } + else_if = { + limit = { education_points_equals_education_rank = { RANK = 4 } } + save_scope_value_as = { + name = education_rank_after_patronage + value = 4 + } + } + + #Sets flag for result + if = { + limit = { + exists = scope:education_rank_before_patronage + exists = scope:education_rank_after_patronage + } + if = { + limit = { #+1 + OR = { + AND = { + scope:education_rank_before_patronage = 1 + scope:education_rank_after_patronage = 2 + } + AND = { + scope:education_rank_before_patronage = 2 + scope:education_rank_after_patronage = 3 + } + AND = { + scope:education_rank_before_patronage = 3 + scope:education_rank_after_patronage = 4 + } + } + } + save_scope_value_as = { + name = education_rank_patronage_bonus + value = flag:1 + } + } + else_if = { #+2 or more + limit = { scope:education_rank_after_patronage != scope:education_rank_before_patronage } + save_scope_value_as = { + name = education_rank_patronage_bonus + value = flag:2_or_more + } + } + } + + if = { + limit = { + exists = scope:education_rank_patronage_bonus + scope:education_rank_patronage_bonus = flag:1 + scope:education_rank_patronage_bonus = flag:2_or_more + } + } + + if = { + limit = { + has_variable = patronage_spouse_tutor_points + } + remove_variable = patronage_spouse_tutor_points + } + #Got to keep the tutor var for now, but it is automatically cleared with time + } +} + +block_firing_councillor_effect = { + set_variable = { + name = block_fire_councillor + value = $COURT_OWNER$ + years = council_position_locked_value + } +} + +block_hiring_councillor_effect = { + set_variable = { + name = block_hire_councillor + value = $COURT_OWNER$ + years = council_position_locked_value + } +} + +unblock_firing_councillor_effect = { + remove_variable = block_fire_councillor +} + +councillor_leaving_effect = { + if = { + limit = { + NOT = { is_councillor_of = scope:old_employer } + scope:old_employer = { government_allows = council } + } + scope:councillor = { + # Councillor leaving because of marriage + if = { + limit = { + is_playable_character = no + is_married = yes + primary_spouse = { is_playable_character = yes } + } + scope:old_employer = { + send_interface_message = { + type = msg_left_council_position + title = councillor_leaving_court_message_title + desc = councillor_leaving_court_marriage_notification + left_icon = scope:councillor + right_icon = scope:councillor.primary_spouse + } + } + } + # Councillor leaving because of title inheritance + else_if = { + limit = { + is_playable_character = yes + NOT = { is_vassal_of = scope:old_employer } + } + scope:old_employer = { + send_interface_message = { + type = msg_left_council_position + title = councillor_leaving_court_message_title + desc = councillor_leaving_court_landed_notification + left_icon = scope:councillor + right_icon = scope:councillor.primary_title + } + } + } + # Generic fallback + else = { + scope:old_employer = { + send_interface_message = { + type = msg_left_council_position + title = councillor_leaving_court_message_title + desc = councillor_leaving_court_generic_fallback_notification + left_icon = scope:councillor + } + } + } + } + } +} + +councillor_increase_relevant_skill_effect = { + switch = { + trigger = has_council_position + councillor_chancellor = { add_diplomacy_skill = 1 } + councillor_court_chaplain = { add_learning_skill = 1 } + councillor_marshal = { add_martial_skill = 1 } + councillor_steward = { add_stewardship_skill = 1 } + councillor_spymaster = { add_intrigue_skill = 1 } + councillor_kurultai_1 = { add_martial_skill = 1 } + councillor_kurultai_2 = { add_martial_skill = 1 } + councillor_kurultai_3 = { add_martial_skill = 1 } + councillor_kurultai_4 = { add_martial_skill = 1 } + } +} + +councillor_increase_relevant_skill_five_points_effect = { + switch = { + trigger = has_council_position + councillor_chancellor = { add_diplomacy_skill = 5 } + councillor_court_chaplain = { add_learning_skill = 5 } + councillor_marshal = { add_martial_skill = 5 } + councillor_steward = { add_stewardship_skill = 5 } + councillor_spymaster = { add_intrigue_skill = 5 } + councillor_kurultai_1 = { add_martial_skill = 5 } + councillor_kurultai_2 = { add_martial_skill = 5 } + councillor_kurultai_3 = { add_martial_skill = 5 } + councillor_kurultai_4 = { add_martial_skill = 5 } + } +} + +councillor_increase_relevant_skill_two_points_effect = { + switch = { + trigger = has_council_position + councillor_chancellor = { add_diplomacy_skill = 2 } + councillor_court_chaplain = { add_learning_skill = 2 } + councillor_marshal = { add_martial_skill = 2 } + councillor_steward = { add_stewardship_skill = 2 } + councillor_spymaster = { add_intrigue_skill = 2 } + councillor_kurultai_1 = { add_martial_skill = 2 } + councillor_kurultai_2 = { add_martial_skill = 2 } + councillor_kurultai_3 = { add_martial_skill = 2 } + councillor_kurultai_4 = { add_martial_skill = 2 } + } +} + +assign_appropriate_councillor_position_effect = { + if = { + limit = { + $CHARACTER$ = { highest_skill = diplomacy } + } + if = { + limit = { exists = cp:councillor_chancellor } + fire_councillor = cp:councillor_chancellor + } + assign_councillor_type = { + type = councillor_chancellor + target = $CHARACTER$ + } + } + else_if = { + limit = { + $CHARACTER$ = { highest_skill = intrigue } + } + if = { + limit = { exists = cp:councillor_spymaster } + fire_councillor = cp:councillor_spymaster + } + assign_councillor_type = { + type = councillor_spymaster + target = $CHARACTER$ + } + } + else_if = { + limit = { + $CHARACTER$ = { highest_skill = stewardship } + } + if = { + limit = { exists = cp:councillor_steward } + fire_councillor = cp:councillor_steward + } + assign_councillor_type = { + type = councillor_steward + target = $CHARACTER$ + } + } + else_if = { + limit = { + $CHARACTER$ = { highest_skill = martial } + } + if = { + limit = { exists = cp:councillor_marshal } + fire_councillor = cp:councillor_marshal + } + assign_councillor_type = { + type = councillor_marshal + target = $CHARACTER$ + } + } + else_if = { + limit = { + $CHARACTER$ = { highest_skill = learning } + faith = { + has_doctrine = doctrine_theocracy_temporal + } + } + if = { + limit = { exists = cp:councillor_court_chaplain } + fire_councillor = cp:councillor_court_chaplain + } + assign_councillor_type = { + type = councillor_court_chaplain + target = $CHARACTER$ + } + } + else = { + if = { + limit = { exists = cp:councillor_chancellor } + fire_councillor = cp:councillor_chancellor + } + assign_councillor_type = { # Fallback, mostly for faiths that don't allow Chaplain appointment + type = councillor_chancellor + target = $CHARACTER$ + } + } +} + +make_councillor_kurultai_effect = { + if = { + limit = { # bruh + is_kurultai_trigger = no + } + + if = { + limit = { + can_be_kurultai_trigger = { + COURT_OWNER = root.liege_or_court_owner + CP1 = councillor_kurultai_2 + CP2 = councillor_kurultai_3 + CP3 = councillor_kurultai_4 + } + } + assign_councillor_type = { + type = councillor_kurultai_1 + remove_existing_councillor = yes + target = root + } + } + else_if = { + limit = { + can_be_kurultai_trigger = { + COURT_OWNER = root.liege_or_court_owner + CP1 = councillor_kurultai_1 + CP2 = councillor_kurultai_3 + CP3 = councillor_kurultai_4 + } + } + assign_councillor_type = { + type = councillor_kurultai_2 + remove_existing_councillor = yes + target = root + } + } + else_if = { + limit = { + can_be_kurultai_trigger = { + COURT_OWNER = root.liege_or_court_owner + CP1 = councillor_kurultai_1 + CP2 = councillor_kurultai_2 + CP3 = councillor_kurultai_4 + } + } + assign_councillor_type = { + type = councillor_kurultai_3 + remove_existing_councillor = yes + target = root + } + } + else_if = { + limit = { + can_be_kurultai_trigger = { + COURT_OWNER = root.liege_or_court_owner + CP1 = councillor_kurultai_1 + CP2 = councillor_kurultai_2 + CP3 = councillor_kurultai_3 + } + } + assign_councillor_type = { + type = councillor_kurultai_4 + remove_existing_councillor = yes + target = root + } + } + } +} + +make_councillor_start_up_effect = { + save_scope_as = new_councillor + liege_or_court_owner = { + if = { + limit = { + NOT = { exists = cp:councillor_kurultai_1 } + scope:new_councillor = { + can_be_kurultai_trigger = { + COURT_OWNER = scope:new_councillor.liege_or_court_owner + CP1 = councillor_kurultai_2 + CP2 = councillor_kurultai_3 + CP3 = councillor_kurultai_4 + } + } + } + assign_councillor_type = { + type = councillor_kurultai_1 + remove_existing_councillor = yes + target = scope:new_councillor + } + } + else_if = { + limit = { + NOT = { exists = cp:councillor_kurultai_2 } + scope:new_councillor = { + can_be_kurultai_trigger = { + COURT_OWNER = scope:new_councillor.liege_or_court_owner + CP1 = councillor_kurultai_1 + CP2 = councillor_kurultai_3 + CP3 = councillor_kurultai_4 + } + } + } + assign_councillor_type = { + type = councillor_kurultai_2 + remove_existing_councillor = yes + target = scope:new_councillor + } + } + else_if = { + limit = { + NOT = { exists = cp:councillor_kurultai_3 } + scope:new_councillor = { + can_be_kurultai_trigger = { + COURT_OWNER = scope:new_councillor.liege_or_court_owner + CP1 = councillor_kurultai_1 + CP2 = councillor_kurultai_2 + CP3 = councillor_kurultai_4 + } + } + } + assign_councillor_type = { + type = councillor_kurultai_3 + remove_existing_councillor = yes + target = scope:new_councillor + } + } + else_if = { + limit = { + NOT = { exists = cp:councillor_kurultai_4 } + scope:new_councillor = { + can_be_kurultai_trigger = { + COURT_OWNER = scope:new_councillor.liege_or_court_owner + CP1 = councillor_kurultai_1 + CP2 = councillor_kurultai_2 + CP3 = councillor_kurultai_3 + } + } + } + assign_councillor_type = { + type = councillor_kurultai_4 + remove_existing_councillor = yes + target = scope:new_councillor + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_county_corruption_effects.txt b/N3OW/common/scripted_effects/00_county_corruption_effects.txt new file mode 100644 index 00000000..03f59699 --- /dev/null +++ b/N3OW/common/scripted_effects/00_county_corruption_effects.txt @@ -0,0 +1,2279 @@ + +##################################################################### +# EFFECT LIST +##################################################################### + +# add_random_county_corruption_modifier_effect - Adds a random CC modifier the County does not already have +# remove_random_county_corruption_modifier_effect - Removes a random CC the County has + +##################################################################### +# EFFECTS +##################################################################### + + +add_inefficient_tax_collection_modifier_effect = { + save_scope_as = county + holder = { + send_interface_message = { + type = msg_county_corruption_bad + title = { + first_valid = { + triggered_desc = { + trigger = { exists = scope:deficit } + desc = gain_county_corruption.message.deficit + } + triggered_desc = { + trigger = { exists = scope:low_control } + desc = gain_county_corruption.message.low_control + } + desc = gain_county_corruption.message.county_corruption + } + } + left_icon = scope:county + scope:county = { + add_county_modifier = { + modifier = county_corruption_inefficient_tax_collection_modifier + years = 10 + } + } + } + } +} + +add_deserting_levies_modifier_effect = { + save_scope_as = county + holder = { + send_interface_message = { + type = msg_county_corruption_bad + title = { + first_valid = { + triggered_desc = { + trigger = { exists = scope:deficit } + desc = gain_county_corruption.message.deficit + } + triggered_desc = { + trigger = { exists = scope:low_control } + desc = gain_county_corruption.message.low_control + } + desc = gain_county_corruption.message.county_corruption + } + } + left_icon = scope:county + scope:county = { + add_county_modifier = { + modifier = county_corruption_deserting_levies_modifier + years = 10 + } + } + } + } +} + +add_smuggling_ring_modifier_effect = { + save_scope_as = county + holder = { + send_interface_message = { + type = msg_county_corruption_bad + title = { + first_valid = { + triggered_desc = { + trigger = { exists = scope:deficit } + desc = gain_county_corruption.message.deficit + } + triggered_desc = { + trigger = { exists = scope:low_control } + desc = gain_county_corruption.message.low_control + } + desc = gain_county_corruption.message.county_corruption + } + } + left_icon = scope:county + scope:county = { + add_county_modifier = { + modifier = county_corruption_smuggling_ring_modifier + years = 10 + } + } + } + } +} + +add_bandits_rampant_modifier_effect = { + save_scope_as = county + holder = { + send_interface_message = { + type = msg_county_corruption_bad + title = { + first_valid = { + triggered_desc = { + trigger = { exists = scope:deficit } + desc = gain_county_corruption.message.deficit + } + triggered_desc = { + trigger = { exists = scope:low_control } + desc = gain_county_corruption.message.low_control + } + desc = gain_county_corruption.message.county_corruption + } + } + left_icon = scope:county + scope:county = { + add_county_modifier = { + modifier = county_corruption_bandits_rampant_modifier + years = 10 + } + } + } + } +} + +add_inefficient_census_modifier_effect = { + save_scope_as = county + holder = { + send_interface_message = { + type = msg_county_corruption_bad + title = { + first_valid = { + triggered_desc = { + trigger = { exists = scope:deficit } + desc = gain_county_corruption.message.deficit + } + triggered_desc = { + trigger = { exists = scope:low_control } + desc = gain_county_corruption.message.low_control + } + desc = gain_county_corruption.message.county_corruption + } + } + left_icon = scope:county + scope:county = { + add_county_modifier = { + modifier = county_corruption_inefficient_census_modifier + years = 10 + } + } + } + } +} + +add_lack_of_sheriffs_modifier_effect = { + save_scope_as = county + holder = { + send_interface_message = { + type = msg_county_corruption_bad + title = { + first_valid = { + triggered_desc = { + trigger = { exists = scope:deficit } + desc = gain_county_corruption.message.deficit + } + triggered_desc = { + trigger = { exists = scope:low_control } + desc = gain_county_corruption.message.low_control + } + desc = gain_county_corruption.message.county_corruption + } + } + left_icon = scope:county + scope:county = { + add_county_modifier = { + modifier = county_corruption_lack_of_sheriffs_modifier + years = 10 + } + } + } + } +} + +add_lack_of_courts_modifier_effect = { + save_scope_as = county + holder = { + send_interface_message = { + type = msg_county_corruption_bad + title = { + first_valid = { + triggered_desc = { + trigger = { exists = scope:deficit } + desc = gain_county_corruption.message.deficit + } + triggered_desc = { + trigger = { exists = scope:low_control } + desc = gain_county_corruption.message.low_control + } + desc = gain_county_corruption.message.county_corruption + } + } + left_icon = scope:county + scope:county = { + add_county_modifier = { + modifier = county_corruption_lack_of_courts_modifier + years = 10 + } + } + } + } +} + +add_thieves_guild_modifier_effect = { + save_scope_as = county + holder = { + send_interface_message = { + type = msg_county_corruption_bad + title = { + first_valid = { + triggered_desc = { + trigger = { exists = scope:deficit } + desc = gain_county_corruption.message.deficit + } + triggered_desc = { + trigger = { exists = scope:low_control } + desc = gain_county_corruption.message.low_control + } + desc = gain_county_corruption.message.county_corruption + } + } + left_icon = scope:county + scope:county = { + add_county_modifier = { + modifier = county_corruption_thieves_guild_modifier + years = 10 + } + } + } + } +} + +add_unsafe_highways_modifier_effect = { + save_scope_as = county + holder = { + send_interface_message = { + type = msg_county_corruption_bad + title = { + first_valid = { + triggered_desc = { + trigger = { exists = scope:deficit } + desc = gain_county_corruption.message.deficit + } + triggered_desc = { + trigger = { exists = scope:low_control } + desc = gain_county_corruption.message.low_control + } + desc = gain_county_corruption.message.county_corruption + } + } + left_icon = scope:county + scope:county = { + add_county_modifier = { + modifier = county_corruption_unsafe_highways_modifier + years = 10 + } + } + } + } +} + +add_uncooperative_guilds_modifier_effect = { + save_scope_as = county + holder = { + send_interface_message = { + type = msg_county_corruption_bad + title = { + first_valid = { + triggered_desc = { + trigger = { exists = scope:deficit } + desc = gain_county_corruption.message.deficit + } + triggered_desc = { + trigger = { exists = scope:low_control } + desc = gain_county_corruption.message.low_control + } + desc = gain_county_corruption.message.county_corruption + } + } + left_icon = scope:county + scope:county = { + add_county_modifier = { + modifier = county_corruption_uncooperative_guilds_modifier + years = 10 + } + } + } + } +} + +add_lackluster_administration_modifier_effect = { + save_scope_as = county + holder = { + send_interface_message = { + type = msg_county_corruption_bad + title = { + first_valid = { + triggered_desc = { + trigger = { exists = scope:deficit } + desc = gain_county_corruption.message.deficit + } + desc = gain_county_corruption.message.county_corruption + } + } + left_icon = scope:county + scope:county = { + add_county_modifier = { + modifier = county_corruption_lackluster_administration_modifier + years = 10 + } + } + } + } +} + +add_roaming_bandits_modifier_effect = { + save_scope_as = county + holder = { + send_interface_message = { + type = msg_county_corruption_bad + title = { + first_valid = { + triggered_desc = { + trigger = { exists = scope:deficit } + desc = gain_county_corruption.message.deficit + } + desc = gain_county_corruption.message.county_corruption + } + } + left_icon = scope:county + scope:county = { + add_county_modifier = { + modifier = county_corruption_roaming_bandits_modifier + years = 10 + } + } + } + } +} + +add_wild_beast_attacks_modifier_effect = { + save_scope_as = county + holder = { + send_interface_message = { + type = msg_county_corruption_bad + title = { + first_valid = { + triggered_desc = { + trigger = { exists = scope:deficit } + desc = gain_county_corruption.message.deficit + } + desc = gain_county_corruption.message.county_corruption + } + } + left_icon = scope:county + scope:county = { + add_county_modifier = { + modifier = county_corruption_wild_beast_attacks_modifier + years = 10 + } + } + } + } +} + +add_upset_shepherds_modifier_effect = { + save_scope_as = county + holder = { + send_interface_message = { + type = msg_county_corruption_bad + title = { + first_valid = { + triggered_desc = { + trigger = { exists = scope:deficit } + desc = gain_county_corruption.message.deficit + } + desc = gain_county_corruption.message.county_corruption + } + } + left_icon = scope:county + scope:county = { + add_county_modifier = { + modifier = county_corruption_upset_shepherds_modifier + years = 10 + } + } + } + } +} + +add_rogue_warriors_modifier_effect = { + save_scope_as = county + holder = { + send_interface_message = { + type = msg_county_corruption_bad + title = { + first_valid = { + triggered_desc = { + trigger = { exists = scope:deficit } + desc = gain_county_corruption.message.deficit + } + desc = gain_county_corruption.message.county_corruption + } + } + left_icon = scope:county + scope:county = { + add_county_modifier = { + modifier = county_corruption_rogue_warriors_modifier + years = 10 + } + } + } + } +} + +add_unruly_nomads_modifier_effect = { + save_scope_as = county + holder = { + send_interface_message = { + type = msg_county_corruption_bad + title = { + first_valid = { + triggered_desc = { + trigger = { exists = scope:deficit } + desc = gain_county_corruption.message.deficit + } + desc = gain_county_corruption.message.county_corruption + } + } + left_icon = scope:county + scope:county = { + add_county_modifier = { + modifier = county_corruption_unruly_nomads_modifier + years = 10 + } + } + } + } +} + + +#Use this for random addition of County Corruption, APART from Low Control +add_random_county_corruption_modifier_effect = { + random_list = { + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_inefficient_tax_collection_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + add_inefficient_tax_collection_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_deserting_levies_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + add_deserting_levies_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_smuggling_ring_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + add_smuggling_ring_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_bandits_rampant_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + add_bandits_rampant_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_inefficient_census_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + add_inefficient_census_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_lack_of_sheriffs_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + add_lack_of_sheriffs_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_lack_of_courts_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + add_lack_of_courts_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_thieves_guild_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + add_thieves_guild_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_unsafe_highways_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + add_unsafe_highways_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_uncooperative_guilds_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + add_uncooperative_guilds_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_lackluster_administration_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + add_lackluster_administration_modifier_effect = yes + } + 100 = { + trigger = { + NOT = { + has_county_modifier = county_corruption_roaming_bandits_modifier + } + OR = { + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + add_roaming_bandits_modifier_effect = yes + } + 100 = { + trigger = { + NOT = { + has_county_modifier = county_corruption_wild_beast_attacks_modifier + } + OR = { + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + add_wild_beast_attacks_modifier_effect = yes + } + 100 = { + trigger = { + NOT = { + has_county_modifier = county_corruption_upset_shepherds_modifier + } + OR = { + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + add_upset_shepherds_modifier_effect = yes + } + 100 = { + trigger = { + NOT = { + has_county_modifier = county_corruption_rogue_warriors_modifier + } + OR = { + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + add_rogue_warriors_modifier_effect = yes + } + 100 = { + trigger = { + NOT = { + has_county_modifier = county_corruption_unruly_nomads_modifier + } + OR = { + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + add_unruly_nomads_modifier_effect = yes + } + } +} + + +#Notification includes reference about Low Control +add_random_county_corruption_low_control_effect = { + random_list = { + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_inefficient_tax_collection_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = low_control + value = yes + } + add_inefficient_tax_collection_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_deserting_levies_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = low_control + value = yes + } + add_deserting_levies_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_smuggling_ring_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = low_control + value = yes + } + add_smuggling_ring_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_bandits_rampant_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = low_control + value = yes + } + add_bandits_rampant_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_inefficient_census_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = low_control + value = yes + } + add_inefficient_census_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_lack_of_sheriffs_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = low_control + value = yes + } + add_lack_of_sheriffs_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_lack_of_courts_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = low_control + value = yes + } + add_lack_of_sheriffs_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_thieves_guild_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = low_control + value = yes + } + add_thieves_guild_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_unsafe_highways_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = low_control + value = yes + } + add_unsafe_highways_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_uncooperative_guilds_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = low_control + value = yes + } + add_uncooperative_guilds_modifier_effect = yes + } + 100 = { + trigger = { + NOT = { + has_county_modifier = county_corruption_roaming_bandits_modifier + } + OR = { + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + add_roaming_bandits_modifier_effect = yes + } + 100 = { + trigger = { + NOT = { + has_county_modifier = county_corruption_wild_beast_attacks_modifier + } + OR = { + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + add_wild_beast_attacks_modifier_effect = yes + } + 100 = { + trigger = { + NOT = { + has_county_modifier = county_corruption_upset_shepherds_modifier + } + OR = { + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + add_upset_shepherds_modifier_effect = yes + } + 100 = { + trigger = { + NOT = { + has_county_modifier = county_corruption_rogue_warriors_modifier + } + OR = { + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + add_rogue_warriors_modifier_effect = yes + } + 100 = { + trigger = { + NOT = { + has_county_modifier = county_corruption_unruly_nomads_modifier + } + OR = { + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + add_unruly_nomads_modifier_effect = yes + } + } +} + + +#Notification includes reference about Debt +add_random_county_corruption_in_debt_effect = { + random_list = { + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_inefficient_tax_collection_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = deficit + value = yes + } + add_inefficient_tax_collection_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_deserting_levies_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = deficit + value = yes + } + add_deserting_levies_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_smuggling_ring_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = deficit + value = yes + } + add_smuggling_ring_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_bandits_rampant_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = deficit + value = yes + } + add_bandits_rampant_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_inefficient_census_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = deficit + value = yes + } + add_inefficient_census_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_lack_of_sheriffs_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = deficit + value = yes + } + add_lack_of_sheriffs_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_lack_of_courts_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = deficit + value = yes + } + add_lack_of_sheriffs_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_thieves_guild_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = deficit + value = yes + } + add_thieves_guild_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_unsafe_highways_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = deficit + value = yes + } + add_unsafe_highways_modifier_effect = yes + } + 100 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_uncooperative_guilds_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = deficit + value = yes + } + add_uncooperative_guilds_modifier_effect = yes + } + 500 = { + trigger = { + NOR = { + has_county_modifier = county_corruption_lackluster_administration_modifier + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = deficit + value = yes + } + add_lackluster_administration_modifier_effect = yes + } + 100 = { + trigger = { + NOT = { + has_county_modifier = county_corruption_roaming_bandits_modifier + } + OR = { + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = deficit + value = yes + } + add_roaming_bandits_modifier_effect = yes + } + 100 = { + trigger = { + NOT = { + has_county_modifier = county_corruption_wild_beast_attacks_modifier + } + OR = { + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = deficit + value = yes + } + add_wild_beast_attacks_modifier_effect = yes + } + 100 = { + trigger = { + NOT = { + has_county_modifier = county_corruption_upset_shepherds_modifier + } + OR = { + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = deficit + value = yes + } + add_upset_shepherds_modifier_effect = yes + } + 100 = { + trigger = { + NOT = { + has_county_modifier = county_corruption_rogue_warriors_modifier + } + OR = { + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = deficit + value = yes + } + add_rogue_warriors_modifier_effect = yes + } + 100 = { + trigger = { + NOT = { + has_county_modifier = county_corruption_unruly_nomads_modifier + } + OR = { + title_province = { has_holding_type = nomad_holding } + title_province = { has_holding_type = herder_holding } + } + is_landless_type_title = no + } + save_scope_value_as = { + name = deficit + value = yes + } + add_unruly_nomads_modifier_effect = yes + } + } +} + +############# +# Removal of County Corruption +############# + +remove_inefficient_tax_collection_modifier_effect = { + save_scope_as = county + holder = { + if = { + limit = { + exists = scope:marshal_removal + } + send_interface_message = { + type = msg_county_corruption_good_increase_control + title = remove_county_corruption.message.marshal_removal + left_icon = scope:county + right_icon = scope:councillor + + scope:county = { + remove_county_modifier = county_corruption_inefficient_tax_collection_modifier + } + } + } + else = { + scope:county = { + remove_county_modifier = county_corruption_inefficient_tax_collection_modifier + } + } + } +} + +remove_deserting_levies_modifier_effect = { + save_scope_as = county + holder = { + if = { + limit = { + exists = scope:marshal_removal + } + send_interface_message = { + type = msg_county_corruption_good_increase_control + title = remove_county_corruption.message.marshal_removal + left_icon = scope:county + right_icon = scope:councillor + + scope:county = { + remove_county_modifier = county_corruption_deserting_levies_modifier + } + } + } + else = { + scope:county = { + remove_county_modifier = county_corruption_deserting_levies_modifier + } + } + } +} + +remove_smuggling_ring_modifier_effect = { + save_scope_as = county + holder = { + if = { + limit = { + exists = scope:marshal_removal + } + send_interface_message = { + type = msg_county_corruption_good_increase_control + title = remove_county_corruption.message.marshal_removal + left_icon = scope:county + right_icon = scope:councillor + + scope:county = { + remove_county_modifier = county_corruption_smuggling_ring_modifier + } + } + } + else = { + scope:county = { + remove_county_modifier = county_corruption_smuggling_ring_modifier + } + } + } +} + +remove_bandits_rampant_modifier_effect = { + save_scope_as = county + holder = { + if = { + limit = { + exists = scope:marshal_removal + } + send_interface_message = { + type = msg_county_corruption_good_increase_control + title = remove_county_corruption.message.marshal_removal + left_icon = scope:county + right_icon = scope:councillor + + scope:county = { + remove_county_modifier = county_corruption_bandits_rampant_modifier + } + } + } + else = { + scope:county = { + remove_county_modifier = county_corruption_bandits_rampant_modifier + } + } + } +} + +remove_inefficient_census_modifier_effect = { + save_scope_as = county + holder = { + if = { + limit = { + exists = scope:marshal_removal + } + send_interface_message = { + type = msg_county_corruption_good_increase_control + title = remove_county_corruption.message.marshal_removal + left_icon = scope:county + right_icon = scope:councillor + + scope:county = { + remove_county_modifier = county_corruption_inefficient_census_modifier + } + } + } + else = { + scope:county = { + remove_county_modifier = county_corruption_inefficient_census_modifier + } + } + } +} + +remove_lack_of_sheriffs_modifier_effect = { + save_scope_as = county + holder = { + if = { + limit = { + exists = scope:marshal_removal + } + send_interface_message = { + type = msg_county_corruption_good_increase_control + title = remove_county_corruption.message.marshal_removal + left_icon = scope:county + right_icon = scope:councillor + + scope:county = { + remove_county_modifier = county_corruption_lack_of_sheriffs_modifier + } + } + } + else = { + scope:county = { + remove_county_modifier = county_corruption_lack_of_sheriffs_modifier + } + } + } +} + +remove_lack_of_courts_modifier_effect = { + save_scope_as = county + holder = { + if = { + limit = { + exists = scope:marshal_removal + } + send_interface_message = { + type = msg_county_corruption_good_increase_control + title = remove_county_corruption.message.marshal_removal + left_icon = scope:county + right_icon = scope:councillor + + scope:county = { + remove_county_modifier = county_corruption_lack_of_courts_modifier + } + } + } + else = { + scope:county = { + remove_county_modifier = county_corruption_lack_of_courts_modifier + } + } + } +} + +remove_thieves_guild_modifier_effect = { + save_scope_as = county + holder = { + if = { + limit = { + exists = scope:marshal_removal + } + send_interface_message = { + type = msg_county_corruption_good_increase_control + title = remove_county_corruption.message.marshal_removal + left_icon = scope:county + right_icon = scope:councillor + + scope:county = { + remove_county_modifier = county_corruption_thieves_guild_modifier + } + } + } + else = { + scope:county = { + remove_county_modifier = county_corruption_thieves_guild_modifier + } + } + } +} + +remove_unsafe_highways_modifier_effect = { + save_scope_as = county + holder = { + if = { + limit = { + exists = scope:marshal_removal + } + send_interface_message = { + type = msg_county_corruption_good_increase_control + title = remove_county_corruption.message.marshal_removal + left_icon = scope:county + right_icon = scope:councillor + + scope:county = { + remove_county_modifier = county_corruption_unsafe_highways_modifier + } + } + } + else = { + scope:county = { + remove_county_modifier = county_corruption_unsafe_highways_modifier + } + } + } +} + +remove_uncooperative_guilds_modifier_effect = { + save_scope_as = county + holder = { + if = { + limit = { + exists = scope:marshal_removal + } + send_interface_message = { + type = msg_county_corruption_good_increase_control + title = remove_county_corruption.message.marshal_removal + left_icon = scope:county + right_icon = scope:councillor + + scope:county = { + remove_county_modifier = county_corruption_uncooperative_guilds_modifier + } + } + } + else = { + scope:county = { + remove_county_modifier = county_corruption_uncooperative_guilds_modifier + } + } + } +} + +remove_lackluster_administration_modifier_effect = { + save_scope_as = county + holder = { + if = { + limit = { + exists = scope:marshal_removal + } + send_interface_message = { + type = msg_county_corruption_good_increase_control + title = remove_county_corruption.message.marshal_removal + left_icon = scope:county + right_icon = scope:councillor + + scope:county = { + remove_county_modifier = county_corruption_lackluster_administration_modifier + } + } + } + else = { + scope:county = { + remove_county_modifier = county_corruption_lackluster_administration_modifier + } + } + } +} + +remove_roaming_bandits_modifier_effect = { + save_scope_as = county + holder = { + if = { + limit = { + exists = scope:marshal_removal + } + send_interface_message = { + type = msg_county_corruption_good_increase_control + title = remove_county_corruption.message.marshal_removal + left_icon = scope:county + right_icon = scope:councillor + + scope:county = { + remove_county_modifier = county_corruption_roaming_bandits_modifier + } + } + } + else = { + scope:county = { + remove_county_modifier = county_corruption_roaming_bandits_modifier + } + } + } +} + +remove_wild_beast_attacks_modifier_effect = { + save_scope_as = county + holder = { + if = { + limit = { + exists = scope:marshal_removal + } + send_interface_message = { + type = msg_county_corruption_good_increase_control + title = remove_county_corruption.message.marshal_removal + left_icon = scope:county + right_icon = scope:councillor + + scope:county = { + remove_county_modifier = county_corruption_wild_beast_attacks_modifier + } + } + } + else = { + scope:county = { + remove_county_modifier = county_corruption_wild_beast_attacks_modifier + } + } + } +} + +remove_upset_shepherds_modifier_effect = { + save_scope_as = county + holder = { + if = { + limit = { + exists = scope:marshal_removal + } + send_interface_message = { + type = msg_county_corruption_good_increase_control + title = remove_county_corruption.message.marshal_removal + left_icon = scope:county + right_icon = scope:councillor + + scope:county = { + remove_county_modifier = county_corruption_upset_shepherds_modifier + } + } + } + else = { + scope:county = { + remove_county_modifier = county_corruption_upset_shepherds_modifier + } + } + } +} + +remove_rogue_warriors_modifier_effect = { + save_scope_as = county + holder = { + if = { + limit = { + exists = scope:marshal_removal + } + send_interface_message = { + type = msg_county_corruption_good_increase_control + title = remove_county_corruption.message.marshal_removal + left_icon = scope:county + right_icon = scope:councillor + + scope:county = { + remove_county_modifier = county_corruption_rogue_warriors_modifier + } + } + } + else = { + scope:county = { + remove_county_modifier = county_corruption_rogue_warriors_modifier + } + } + } +} + +remove_unruly_nomads_modifier_effect = { + save_scope_as = county + holder = { + if = { + limit = { + exists = scope:marshal_removal + } + send_interface_message = { + type = msg_county_corruption_good_increase_control + title = remove_county_corruption.message.marshal_removal + left_icon = scope:county + right_icon = scope:councillor + + scope:county = { + remove_county_modifier = county_corruption_unruly_nomads_modifier + } + } + } + else = { + scope:county = { + remove_county_modifier = county_corruption_unruly_nomads_modifier + } + } + } +} + +remove_small_investment_in_revolt_modifier_effect = { + save_scope_as = county + holder = { + if = { + limit = { + exists = scope:marshal_removal + } + send_interface_message = { + type = msg_county_corruption_good_increase_control + title = remove_county_corruption.message.marshal_removal + left_icon = scope:county + right_icon = scope:councillor + + scope:county = { + remove_county_modifier = small_investment_in_revolt_modifier + } + } + } + else = { + scope:county = { + remove_county_modifier = small_investment_in_revolt_modifier + } + } + } +} + +remove_medium_investment_in_revolt_modifier_effect = { + save_scope_as = county + holder = { + if = { + limit = { + exists = scope:marshal_removal + } + send_interface_message = { + type = msg_county_corruption_good_increase_control + title = remove_county_corruption.message.marshal_removal + left_icon = scope:county + right_icon = scope:councillor + + scope:county = { + remove_county_modifier = medium_investment_in_revolt_modifier + } + } + } + else = { + scope:county = { + remove_county_modifier = medium_investment_in_revolt_modifier + } + } + } +} + +remove_high_investment_in_revolt_modifier_effect = { + save_scope_as = county + holder = { + if = { + limit = { + exists = scope:marshal_removal + } + send_interface_message = { + type = msg_county_corruption_good_increase_control + title = remove_county_corruption.message.marshal_removal + left_icon = scope:county + right_icon = scope:councillor + + scope:county = { + remove_county_modifier = high_investment_in_revolt_modifier + } + } + } + else = { + scope:county = { + remove_county_modifier = high_investment_in_revolt_modifier + } + } + } +} + +remove_random_county_corruption_modifier_effect = { + random_list = { + 100 = { + trigger = { + has_county_modifier = county_corruption_inefficient_tax_collection_modifier + } + remove_inefficient_tax_collection_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_deserting_levies_modifier + } + remove_deserting_levies_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_smuggling_ring_modifier + } + remove_smuggling_ring_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_bandits_rampant_modifier + } + remove_bandits_rampant_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_inefficient_census_modifier + } + remove_inefficient_census_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_lack_of_sheriffs_modifier + } + remove_lack_of_sheriffs_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_lack_of_courts_modifier + } + remove_lack_of_courts_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_thieves_guild_modifier + } + remove_thieves_guild_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_unsafe_highways_modifier + } + remove_unsafe_highways_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_uncooperative_guilds_modifier + } + remove_uncooperative_guilds_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_lackluster_administration_modifier + } + remove_lackluster_administration_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_roaming_bandits_modifier + } + remove_roaming_bandits_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_wild_beast_attacks_modifier + } + remove_wild_beast_attacks_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_upset_shepherds_modifier + } + remove_upset_shepherds_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_rogue_warriors_modifier + } + remove_rogue_warriors_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_unruly_nomads_modifier + } + remove_unruly_nomads_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = small_investment_in_revolt_modifier + } + remove_small_investment_in_revolt_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = medium_investment_in_revolt_modifier + } + remove_medium_investment_in_revolt_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = high_investment_in_revolt_modifier + } + remove_high_investment_in_revolt_modifier_effect = yes + } + } +} + +remove_every_county_corruption_modifier_effect = { + if = { + limit = { + has_county_modifier = county_corruption_inefficient_tax_collection_modifier + } + remove_inefficient_tax_collection_modifier_effect = yes + } + if = { + limit = { + has_county_modifier = county_corruption_deserting_levies_modifier + } + remove_deserting_levies_modifier_effect = yes + } + if = { + limit = { + has_county_modifier = county_corruption_smuggling_ring_modifier + } + remove_smuggling_ring_modifier_effect = yes + } + if = { + limit = { + has_county_modifier = county_corruption_bandits_rampant_modifier + } + remove_bandits_rampant_modifier_effect = yes + } + if = { + limit = { + has_county_modifier = county_corruption_inefficient_census_modifier + } + remove_inefficient_census_modifier_effect = yes + } + if = { + limit = { + has_county_modifier = county_corruption_lack_of_sheriffs_modifier + } + remove_lack_of_sheriffs_modifier_effect = yes + } + if = { + limit = { + has_county_modifier = county_corruption_lack_of_courts_modifier + } + remove_lack_of_courts_modifier_effect = yes + } + if = { + limit = { + has_county_modifier = county_corruption_thieves_guild_modifier + } + remove_thieves_guild_modifier_effect = yes + } + if = { + limit = { + has_county_modifier = county_corruption_unsafe_highways_modifier + } + remove_unsafe_highways_modifier_effect = yes + } + if = { + limit = { + has_county_modifier = county_corruption_uncooperative_guilds_modifier + } + remove_uncooperative_guilds_modifier_effect = yes + } + if = { + limit = { + has_county_modifier = county_corruption_lackluster_administration_modifier + } + remove_lackluster_administration_modifier_effect = yes + } + if = { + limit = { + has_county_modifier = county_corruption_roaming_bandits_modifier + } + remove_roaming_bandits_modifier_effect = yes + } + if = { + limit = { + has_county_modifier = county_corruption_wild_beast_attacks_modifier + } + remove_wild_beast_attacks_modifier_effect = yes + } + if = { + limit = { + has_county_modifier = county_corruption_upset_shepherds_modifier + } + remove_upset_shepherds_modifier_effect = yes + } + if = { + limit = { + has_county_modifier = county_corruption_rogue_warriors_modifier + } + remove_rogue_warriors_modifier_effect = yes + } + if = { + limit = { + has_county_modifier = county_corruption_unruly_nomads_modifier + } + remove_unruly_nomads_modifier_effect = yes + } + if = { + limit = { + has_county_modifier = small_investment_in_revolt_modifier + } + remove_small_investment_in_revolt_modifier_effect = yes + } + if = { + limit = { + has_county_modifier = medium_investment_in_revolt_modifier + } + remove_medium_investment_in_revolt_modifier_effect = yes + } + if = { + limit = { + has_county_modifier = high_investment_in_revolt_modifier + } + remove_high_investment_in_revolt_modifier_effect = yes + } +} + +marshal_remove_random_county_corruption_modifier_effect = { + random_list = { + 100 = { + trigger = { + has_county_modifier = county_corruption_inefficient_tax_collection_modifier + } + if = { + limit = { + scope:councillor = { + OR = { + scope:county.holder.cp:councillor_marshal ?= this + is_kurultai_trigger = yes + } + } + } + save_scope_value_as = { + name = marshal_removal + value = yes + } + } + hidden_effect = { + set_variable = { + name = county_corruption_recent_removal + years = 3 + } + } + remove_inefficient_tax_collection_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_deserting_levies_modifier + } + if = { + limit = { + scope:councillor = { + OR = { + scope:county.holder.cp:councillor_marshal ?= this + is_kurultai_trigger = yes + } + } + } + save_scope_value_as = { + name = marshal_removal + value = yes + } + } + hidden_effect = { + set_variable = { + name = county_corruption_recent_removal + years = 3 + } + } + remove_deserting_levies_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_smuggling_ring_modifier + } + if = { + limit = { + scope:councillor = { + OR = { + scope:county.holder.cp:councillor_marshal ?= this + is_kurultai_trigger = yes + } + } + } + save_scope_value_as = { + name = marshal_removal + value = yes + } + } + hidden_effect = { + set_variable = { + name = county_corruption_recent_removal + years = 3 + } + } + remove_smuggling_ring_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_bandits_rampant_modifier + } + if = { + limit = { + scope:councillor = { + OR = { + scope:county.holder.cp:councillor_marshal ?= this + is_kurultai_trigger = yes + } + } + } + save_scope_value_as = { + name = marshal_removal + value = yes + } + } + hidden_effect = { + set_variable = { + name = county_corruption_recent_removal + years = 3 + } + } + remove_bandits_rampant_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_inefficient_census_modifier + } + if = { + limit = { + scope:councillor = { + OR = { + scope:county.holder.cp:councillor_marshal ?= this + is_kurultai_trigger = yes + } + } + } + save_scope_value_as = { + name = marshal_removal + value = yes + } + } + hidden_effect = { + set_variable = { + name = county_corruption_recent_removal + years = 3 + } + } + remove_inefficient_census_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_lack_of_sheriffs_modifier + } + if = { + limit = { + scope:councillor = { + OR = { + scope:county.holder.cp:councillor_marshal ?= this + is_kurultai_trigger = yes + } + } + } + save_scope_value_as = { + name = marshal_removal + value = yes + } + } + hidden_effect = { + set_variable = { + name = county_corruption_recent_removal + years = 3 + } + } + remove_lack_of_sheriffs_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_lack_of_courts_modifier + } + if = { + limit = { + scope:councillor = { + OR = { + scope:county.holder.cp:councillor_marshal ?= this + is_kurultai_trigger = yes + } + } + } + save_scope_value_as = { + name = marshal_removal + value = yes + } + } + hidden_effect = { + set_variable = { + name = county_corruption_recent_removal + years = 3 + } + } + remove_lack_of_courts_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_thieves_guild_modifier + } + if = { + limit = { + scope:councillor = { + OR = { + scope:county.holder.cp:councillor_marshal ?= this + is_kurultai_trigger = yes + } + } + } + save_scope_value_as = { + name = marshal_removal + value = yes + } + } + hidden_effect = { + set_variable = { + name = county_corruption_recent_removal + years = 3 + } + } + remove_thieves_guild_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_unsafe_highways_modifier + } + if = { + limit = { + scope:councillor = { + OR = { + scope:county.holder.cp:councillor_marshal ?= this + is_kurultai_trigger = yes + } + } + } + save_scope_value_as = { + name = marshal_removal + value = yes + } + } + hidden_effect = { + set_variable = { + name = county_corruption_recent_removal + years = 3 + } + } + remove_unsafe_highways_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_uncooperative_guilds_modifier + } + if = { + limit = { + scope:councillor = { + OR = { + scope:county.holder.cp:councillor_marshal ?= this + is_kurultai_trigger = yes + } + } + } + save_scope_value_as = { + name = marshal_removal + value = yes + } + } + hidden_effect = { + set_variable = { + name = county_corruption_recent_removal + years = 3 + } + } + remove_uncooperative_guilds_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_lackluster_administration_modifier + } + if = { + limit = { + scope:councillor = { + OR = { + scope:county.holder.cp:councillor_marshal ?= this + is_kurultai_trigger = yes + } + } + } + save_scope_value_as = { + name = marshal_removal + value = yes + } + } + hidden_effect = { + set_variable = { + name = county_corruption_recent_removal + years = 3 + } + } + remove_lackluster_administration_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_roaming_bandits_modifier + } + if = { + limit = { + scope:councillor = { + OR = { + scope:county.holder.cp:councillor_marshal ?= this + is_kurultai_trigger = yes + } + } + } + save_scope_value_as = { + name = marshal_removal + value = yes + } + } + hidden_effect = { + set_variable = { + name = county_corruption_recent_removal + years = 3 + } + } + remove_roaming_bandits_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_wild_beast_attacks_modifier + } + if = { + limit = { + scope:councillor = { + OR = { + scope:county.holder.cp:councillor_marshal ?= this + is_kurultai_trigger = yes + } + } + } + save_scope_value_as = { + name = marshal_removal + value = yes + } + } + hidden_effect = { + set_variable = { + name = county_corruption_recent_removal + years = 3 + } + } + remove_wild_beast_attacks_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_upset_shepherds_modifier + } + if = { + limit = { + scope:councillor = { + OR = { + scope:county.holder.cp:councillor_marshal ?= this + is_kurultai_trigger = yes + } + } + } + save_scope_value_as = { + name = marshal_removal + value = yes + } + } + hidden_effect = { + set_variable = { + name = county_corruption_recent_removal + years = 3 + } + } + remove_upset_shepherds_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_rogue_warriors_modifier + } + if = { + limit = { + scope:councillor = { + OR = { + scope:county.holder.cp:councillor_marshal ?= this + is_kurultai_trigger = yes + } + } + } + save_scope_value_as = { + name = marshal_removal + value = yes + } + } + hidden_effect = { + set_variable = { + name = county_corruption_recent_removal + years = 3 + } + } + remove_rogue_warriors_modifier_effect = yes + } + 100 = { + trigger = { + has_county_modifier = county_corruption_unruly_nomads_modifier + } + if = { + limit = { + scope:councillor = { + OR = { + scope:county.holder.cp:councillor_marshal ?= this + is_kurultai_trigger = yes + } + } + } + save_scope_value_as = { + name = marshal_removal + value = yes + } + } + hidden_effect = { + set_variable = { + name = county_corruption_recent_removal + years = 3 + } + } + remove_unruly_nomads_modifier_effect = yes + } + } +} diff --git a/N3OW/common/scripted_effects/00_court_position_effects.txt b/N3OW/common/scripted_effects/00_court_position_effects.txt new file mode 100644 index 00000000..09ed8514 --- /dev/null +++ b/N3OW/common/scripted_effects/00_court_position_effects.txt @@ -0,0 +1,3909 @@ + +################### +# Generic effects that are used for basic opinion gain etc. +################### + +#Basic effect for gaining a court position +basic_gained_court_position_effect = { + scope:employee = { + if = { + limit = { + has_opinion_modifier = { + modifier = revoked_court_position_opinion + target = scope:liege + } + } + remove_opinion = { + modifier = revoked_court_position_opinion + target = scope:liege + } + } + if = { + limit = { + is_ruler = yes + has_vassal_stance = courtly + } + add_opinion = { + target = scope:liege + modifier = courtly_court_position_opinion + } + } + if = { + limit = { + scope:liege = { is_ai = no } + } + set_variable = { + name = court_8311_cooldown + years = 2 + } + } + + # Unity impact + #add_clan_unity_interaction_effect = { + # CHARACTER = scope:liege + # TARGET = this + # VALUE = 0 #minor_unity_gain + # DESC = clan_unity_assigned_to_court_position.desc + # REVERSE_NON_HOUSE_TARGET = yes + #} + } +} + +#Basic effect for losing a court position +basic_revoked_court_position_effect = { + scope:employee = { + if = { + limit = { + has_opinion_modifier = { + modifier = courtly_court_position_opinion + target = scope:liege + } + } + remove_opinion = { + modifier = courtly_court_position_opinion + target = scope:liege + } + } + if = { + limit = { + has_opinion_modifier = { + modifier = hired_me_opinion + target = scope:liege + } + } + remove_opinion = { + modifier = hired_me_opinion + target = scope:liege + } + } + if = { + limit = { + NOT = { has_character_flag = no_revoke_opinion_loss } + } + add_opinion = { + modifier = revoked_court_position_opinion + target = scope:liege + opinion = -30 + } + } + + # Unity impact + #add_clan_unity_interaction_effect = { + # CHARACTER = scope:liege + # TARGET = this + # VALUE = 0 #minor_unity_loss + # DESC = clan_unity_assigned_to_court_position.desc + # REVERSE_NON_HOUSE_TARGET = no + #} + } + employed_booner_invalidation_effect = { EMPLOYEE = scope:employee LIEGE = scope:liege } +} + +#Basic effect for a court position invalidating +basic_invalidated_court_position_effect = { + employed_booner_invalidation_effect = { EMPLOYEE = scope:employee LIEGE = scope:liege } +} + + +################ +# EFFECTS FOR SPECIFIC COURT POSITIONS +################ + +# COURT PHYSICIAN +court_physician_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +court_physician_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +court_physician_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# COURT EUNUCH +chief_eunuch_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +chief_eunuch_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +chief_eunuch_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# KEEPER OF SWANS +keeper_of_swans_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +keeper_of_swans_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +keeper_of_swans_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# MASTER OF THE HORSE +master_of_horse_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +master_of_horse_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +master_of_horse_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# COURT JESTER +court_jester_title_accepted_effect = { + +} +court_jester_title_revoked_effect = { + scope:employee = { + if = { #Only lowborn/unlanded are insulted if it's revoked + limit = { + OR = { + is_lowborn = yes + is_playable_character = no + } + } + add_opinion = { + modifier = insult_opinion + target = liege + opinion = -15 + } + } + } +} +court_jester_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# MASTER OF THE HUNT +master_of_hunt_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +master_of_hunt_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +master_of_hunt_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# HIGH ALMONER +high_almoner_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +high_almoner_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +high_almoner_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# CUPBEARER +cupbearer_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +cupbearer_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +cupbearer_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# SENESCHAL +seneschal_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +seneschal_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +seneschal_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# ANTIQUARIAN +antiquarian_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +antiquarian_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +antiquarian_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# COURT TUTOR +court_tutor_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +court_tutor_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +court_tutor_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# ROYAL ARCHITECT +royal_architect_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +royal_architect_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +royal_architect_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# COURT POET +court_poet_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +court_poet_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +court_poet_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# BODYGUARD +bodyguard_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +bodyguard_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +bodyguard_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# CHAMPION +champion_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +champion_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +champion_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# COURT MUSICIAN +court_musician_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +court_musician_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +court_musician_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# FOOD TASTER +food_taster_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +food_taster_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +food_taster_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# LADY-IN-WAITING +lady_in_waiting_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +lady_in_waiting_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +lady_in_waiting_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# EXECUTIONER +executioner_title_accepted_effect = { + scope:liege = { + consume_imprisonment_reasons = scope:employee + } + scope:employee = { + if = { + limit = { is_imprisoned = yes } + release_from_prison = yes + } + } + basic_gained_court_position_effect = yes +} +executioner_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +executioner_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# GARUDA +garuda_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +garuda_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +garuda_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# COURT GARDENER +court_gardener_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +court_gardener_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +court_gardener_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# CARAVAN MASTER +court_travel_leader_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +court_travel_leader_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +court_travel_leader_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# WET NURSE +wet_nurse_title_accepted_effect = { + basic_gained_court_position_effect = yes + scope:liege = { #set wet_nurse and nursed_child relation with liege's children, siblings, hostages and liege if they are not adult + every_courtier = { + limit = { + is_adult = no + is_playable_character = no + OR = { + is_child_of = scope:liege + is_sibling_of = scope:liege + is_hostage_of = scope:liege + } + NOT = { has_relation_wet_nurse = scope:employee } + } + set_relation_wet_nurse = scope:employee + } + if = { + limit = { + scope:liege = { is_adult = no } + NOT = { has_relation_wet_nurse = scope:employee } + } + set_relation_wet_nurse = scope:employee + } + } +} + +wet_nurse_title_revoked_effect = { + basic_revoked_court_position_effect = yes + #if any child has positive realtion with the fired nurse trigger an event about them complaining + if = { + limit = { + scope:employee = { + any_relation = { + type = nursed_child + is_alive = yes + age >= 3 + is_adult = no + OR = { + opinion = { + target = prev + value >= medium_positive_opinion + } + has_relation_friend = prev + has_relation_best_friend = prev + } + } + } + } + scope:employee = { + random_relation = { + type = nursed_child + limit = { + is_alive = yes + age >= 3 + OR = { + opinion = { + target = prev + value >= medium_positive_opinion + } + has_relation_friend = prev + has_relation_best_friend = prev + } + } + save_scope_as = nursed_child + } + save_scope_as = former_wet_nurse + } + scope:liege = { + trigger_event = { + id = bp2_yearly.7012 + days = { 5 10 } + } + } + } +} + +wet_nurse_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# AKOLOUTHOS +akolouthos_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +akolouthos_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +akolouthos_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# COURT BREWMASTER +court_brewmaster_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +court_brewmaster_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +court_brewmaster_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# GRAND PRECEPTOR + +grand_preceptor_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +grand_preceptor_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +grand_preceptor_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# GRAND GUARDIAN + +grand_guardian_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +grand_guardian_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +grand_guardian_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# GRAND MENTOR + +grand_mentor_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +grand_mentor_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +grand_mentor_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# FIRE DRAGON ENGINEER + +fire_dragon_engineer_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +fire_dragon_engineer_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +fire_dragon_engineer_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +# KEEPER OF THE HAREM + +keeper_of_the_harem_title_accepted_effect = { + basic_gained_court_position_effect = yes +} +keeper_of_the_harem_title_revoked_effect = { + basic_revoked_court_position_effect = yes +} +keeper_of_the_harem_title_invalidated_effect = { + basic_invalidated_court_position_effect = yes +} + +court_position_old_holder_effect = { # Save existing holder if relevant + $EMPLOYER$ = { + if = { + limit = { employs_court_position = $POS$_court_position } + random_court_position_holder = { + type = $POS$_court_position + save_scope_as = old_holder + } + } + } +} + +camp_officer_old_holder_effect = { # Save existing holder if relevant + $EMPLOYER$ = { + if = { + limit = { employs_court_position = $POS$_camp_officer } + random_court_position_holder = { + type = $POS$_camp_officer + save_scope_as = old_holder + } + } + } +} + +court_position_grant_effect = { # Give position, and revoke old holder's if they exist + if = { #Bodyguards - we replace the worst one + limit = { + $EMPLOYER$ = { + any_court_position_holder = { + type = $POS$_court_position + count >= 2 + } + } + } + $EMPLOYER$ = { + ordered_court_position_holder = { + type = $POS$_court_position + order_by = { + value = aptitude:$POS$_court_position + multiply = -1 + } + save_scope_as = old_holder #Should be the one with worst aptitude + } + } + } + else_if = { + limit = { + $EMPLOYER$.court_position:$POS$_court_position ?= { has_court_position = $POS$_court_position } + } + $EMPLOYER$.court_position:$POS$_court_position = { save_scope_as = old_holder } + } + $CANDIDATE$ = { + save_scope_as = candidate + if = { + limit = { + NOR = { + is_vassal_of = $EMPLOYER$ + is_courtier_of = $EMPLOYER$ + employer = $EMPLOYER$ + } + } + hidden_effect = { set_employer = $EMPLOYER$ } + } + } + $EMPLOYER$ = { + if = { + limit = { + scope:old_holder ?= { has_court_position = bodyguard_court_position } + any_court_position_holder = { + type = bodyguard_court_position + has_court_position = bodyguard_court_position + count > 1 + } + } + send_interface_toast = { + title = move_and_grant_court_position_effect_tooltip + left_icon = $CANDIDATE$ + right_icon = scope:old_holder + replace_court_position = { + recipient = $CANDIDATE$ + holder = scope:old_holder + court_position = $POS$_court_position + } + } + } + else = { + send_interface_toast = { + title = move_and_grant_court_position_effect_tooltip + left_icon = $CANDIDATE$ + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = $POS$_court_position + } + } + } + } + $CANDIDATE$ = { + $EMPLOYER$ = { + save_scope_as = liege + if = { + limit = { exists = scope:old_holder } + custom_tooltip = $POS$_old_holder_aptitude_tooltip + } + else = { custom_tooltip = $POS$_aptitude_tooltip } + } + } + #LAAMPs don't pay salaries + if = { + limit = { + $EMPLOYER$ = { is_landless_adventurer = no } + } + custom_tooltip = $POS$_salary_tooltip + } +} + +camp_officer_grant_effect = { # Give position, and revoke old holder's if they exist + if = { + limit = { + $EMPLOYER$.court_position:$POS$_camp_officer ?= { has_court_position = $POS$_camp_officer } + } + $EMPLOYER$.court_position:$POS$_camp_officer = { save_scope_as = old_holder } + } + $CANDIDATE$ = { + save_scope_as = candidate + if = { + limit = { + NOR = { + is_vassal_of = $EMPLOYER$ + is_courtier_of = $EMPLOYER$ + employer = $EMPLOYER$ + } + } + hidden_effect = { set_employer = $EMPLOYER$ } + } + } + $EMPLOYER$ = { + if = { + limit = { exists = scope:old_holder } + send_interface_toast = { + title = move_and_grant_court_position_effect_tooltip + left_icon = $CANDIDATE$ + right_icon = scope:old_holder + replace_court_position = { + recipient = $CANDIDATE$ + holder = scope:old_holder + court_position = $POS$_camp_officer + } + } + } + else = { + send_interface_toast = { + title = move_and_grant_court_position_effect_tooltip + left_icon = $CANDIDATE$ + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = $POS$_camp_officer + } + } + } + } + $CANDIDATE$ = { + $EMPLOYER$ = { + save_scope_as = liege + if = { + limit = { exists = scope:old_holder } + custom_tooltip = $POS$_old_holder_aptitude_tooltip + } + else = { custom_tooltip = $POS$_aptitude_tooltip } + } + } + #LAAMPs don't pay salaries + if = { + limit = { + $EMPLOYER$ = { is_landless_adventurer = no } + } + custom_tooltip = $POS$_salary_tooltip + } +} + +court_position_generator_variable_effect = { + set_variable = { + name = $VAR$_court_position + value = flag:$POS$ + years = 1 + } + court_position_old_holder_effect = { POS = $POS$ EMPLOYER = $EMPLOYER$ } +} + +camp_officer_generator_variable_effect = { + set_variable = { + name = $VAR$_camp_officer + value = flag:$POS$ + years = 1 + } + camp_officer_old_holder_effect = { POS = $POS$ EMPLOYER = $EMPLOYER$ } +} + +# Sets variable of court position suitable to a character's skills +# Actual job is set with court_position_generator_assignment_effect after using this effect +# VAR - can be used to allow multiple event options: 'target', 'second', 'backup' +# EMPLOYER - should be the char hiring the position +# ROOT - should be the char taking the position +# Saves scope:old_holder as existing holder if they exist +# NOTE: candidates must be courtiers of the employer for this to work +court_position_generator_effect = { + save_scope_as = candidate + $EMPLOYER$ = { save_scope_as = liege } + # Randomly select a fitting role and save it to a variable + random_list = { + 2 = { # ARCHITECT + trigger = { + court_position_generator_pickable_trigger = { POS = royal_architect EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = royal_architect + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = royal_architect + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # SENESCHAL + trigger = { + court_position_generator_pickable_trigger = { POS = seneschal EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = seneschal + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = seneschal + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # TUTOR + trigger = { + court_position_generator_pickable_trigger = { POS = court_tutor EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = court_tutor + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = court_tutor + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # HIGH ALMONER + trigger = { + court_position_generator_pickable_trigger = { POS = high_almoner EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = high_almoner + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = high_almoner + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # COURT PHYSICIAN + trigger = { + court_position_generator_pickable_trigger = { POS = court_physician EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = court_physician + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = court_physician + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # ANTIQUARIAN + trigger = { + court_position_generator_pickable_trigger = { POS = antiquarian EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = antiquarian + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = antiquarian + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # HORSE MASTER + trigger = { + court_position_generator_pickable_trigger = { POS = master_of_horse EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = master_of_horse + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = master_of_horse + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # BODYGUARD + trigger = { + court_position_generator_pickable_trigger = { POS = bodyguard EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = bodyguard + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = bodyguard + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # HUNT MASTER + trigger = { + court_position_generator_pickable_trigger = { POS = master_of_hunt EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = master_of_hunt + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = master_of_hunt + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # CHAMPION + trigger = { + court_position_generator_pickable_trigger = { POS = champion EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = champion + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = champion + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # POET + trigger = { + court_position_generator_pickable_trigger = { POS = court_poet EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = court_poet + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = court_poet + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # MUSICIAN + trigger = { + court_position_generator_pickable_trigger = { POS = court_musician EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = court_musician + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = court_musician + EMPLOYER = $EMPLOYER$ + } + } + 1 = { # COURT JESTER + trigger = { + court_position_generator_pickable_trigger = { POS = court_jester EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = court_jester + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = court_jester + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # EXECUTIONER + trigger = { + court_position_generator_pickable_trigger = { POS = executioner EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = executioner + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = executioner + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # FOOD TASTER + trigger = { + court_position_generator_pickable_trigger = { POS = food_taster EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = food_taster + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = food_taster + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # CUPBEARER + trigger = { + court_position_generator_pickable_trigger = { POS = cupbearer EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = cupbearer + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = cupbearer + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # LADY-IN-WAITING + trigger = { + court_position_generator_pickable_trigger = { POS = lady_in_waiting EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = lady_in_waiting + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = lady_in_waiting + EMPLOYER = $EMPLOYER$ + } + } + 4 = { # EUNUCH + trigger = { + court_position_generator_pickable_trigger = { POS = chief_eunuch EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = chief_eunuch + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = chief_eunuch + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # GARDENER + trigger = { + court_position_generator_pickable_trigger = { POS = court_gardener EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = court_gardener + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = court_gardener + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # ARTIFICER + trigger = { + court_position_generator_pickable_trigger = { POS = court_artificer EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = court_artificer + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = court_artificer + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # CULTURAL EMISSARY + trigger = { + court_position_generator_pickable_trigger = { POS = cultural_emissary EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = cultural_emissary + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = cultural_emissary + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # CHIEF QADI + trigger = { + court_position_generator_pickable_trigger = { POS = chief_qadi EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = chief_qadi + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = chief_qadi + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # GARUDA + trigger = { + court_position_generator_pickable_trigger = { POS = garuda EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = garuda + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = garuda + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # KEEPER OF SWANS + trigger = { + court_position_generator_pickable_trigger = { POS = keeper_of_swans EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = keeper_of_swans + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = keeper_of_swans + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # CARAVAN MASTER + trigger = { + court_position_generator_pickable_trigger = { POS = travel_leader EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = travel_leader + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = travel_leader + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # WET NURSE + trigger = { + court_position_generator_pickable_trigger = { POS = wet_nurse EMPLOYER = $EMPLOYER$ } + } + modifier = { + add = 5 + has_trait = loyal + } + modifier = { + add = 10 + has_relation_friend = $EMPLOYER$ + } + modifier = { + add = 20 + has_relation_best_friend = $EMPLOYER$ + } + modifier = { + add = 30 + has_relation_lover = $EMPLOYER$ + } + modifier = { + add = 40 + has_relation_soulmate = $EMPLOYER$ + } + court_position_generator_shared_modifier = { + POS = wet_nurse + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = wet_nurse + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # CAVE HERMIT + trigger = { + court_position_generator_pickable_trigger = { POS = cave_hermit EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = cave_hermit + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = cave_hermit + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # MASTER ASSASSIN + trigger = { + court_position_generator_pickable_trigger = { POS = master_assassin EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = master_assassin + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = master_assassin + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # COURT SCHOLAR + trigger = { + court_position_generator_pickable_trigger = { POS = court_scholar EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = court_scholar + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = court_scholar + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # CHRONICLER + trigger = { + court_position_generator_pickable_trigger = { POS = chronicler EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = chronicler + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = chronicler + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # AKOLOUTHOS + trigger = { + court_position_generator_pickable_trigger = { POS = akolouthos EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = akolouthos + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = akolouthos + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # COURT ASTROLOGER + trigger = { + court_position_generator_pickable_trigger = { POS = court_astrologer EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = court_astrologer + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = court_astrologer + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # GRAND PRECEPTOR + trigger = { + court_position_generator_pickable_trigger = { POS = grand_preceptor EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = grand_preceptor + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = grand_preceptor + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # GRAND GUARDIAN + trigger = { + court_position_generator_pickable_trigger = { POS = grand_guardian EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = grand_guardian + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = grand_guardian + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # GRAND MENTOR + trigger = { + court_position_generator_pickable_trigger = { POS = grand_mentor EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = grand_mentor + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = grand_mentor + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # FIRE DRAGON ENGINEER + trigger = { + court_position_generator_pickable_trigger = { POS = fire_dragon_engineer EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = fire_dragon_engineer + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = fire_dragon_engineer + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # KEEPER OF THE HAREM + trigger = { + court_position_generator_pickable_trigger = { POS = keeper_of_the_harem EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = keeper_of_the_harem + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = keeper_of_the_harem + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # BOYAN + trigger = { + court_position_generator_pickable_trigger = { POS = boyan EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = boyan + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = boyan + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # SIEGE ENGINEER + trigger = { + court_position_generator_pickable_trigger = { POS = siege_engineer EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = siege_engineer + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = siege_engineer + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # YURTCHI + trigger = { + court_position_generator_pickable_trigger = { POS = yurtchi EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = yurtchi + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = yurtchi + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # CHERBI + trigger = { + court_position_generator_pickable_trigger = { POS = cherbi EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = cherbi + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = cherbi + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # YEKE JARQUCHI + trigger = { + court_position_generator_pickable_trigger = { POS = yeke_jarquchi EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = yeke_jarquchi + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = yeke_jarquchi + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # FOREIGN EMISSARY + trigger = { + court_position_generator_pickable_trigger = { POS = foreign_emissary EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = foreign_emissary + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = foreign_emissary + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # KEEPER OF THE HORSES + trigger = { + court_position_generator_pickable_trigger = { POS = keeper_of_the_horses EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = keeper_of_the_horses + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = keeper_of_the_horses + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # Court Guru + trigger = { + court_position_generator_pickable_trigger = { POS = court_guru EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = court_guru + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = court_guru + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # Court Brahmin + trigger = { + court_position_generator_pickable_trigger = { POS = court_brahmin EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = court_brahmin + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = court_brahmin + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # Khlon Glan + trigger = { + court_position_generator_pickable_trigger = { POS = khlon_glan EMPLOYER = $EMPLOYER$ } + } + court_position_generator_shared_modifier = { + POS = khlon_glan + EMPLOYER = $EMPLOYER$ + } + court_position_generator_variable_effect = { + VAR = $VAR$ + POS = khlon_glan + EMPLOYER = $EMPLOYER$ + } + } + } +} + +# Gives job of court position suitable to a character's skills +# Job is picked in court_position_generator_effect +# VAR - valid parameters: 'target', 'second', 'backup' +# EMPLOYER - should be the char hiring the position +# CANDIDATE - should be the char taking the position +court_position_generator_assignment_effect = { + switch = { + trigger = $CANDIDATE$.var:$VAR$_court_position + # Architect + flag:royal_architect = { + court_position_grant_effect = { POS = royal_architect CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Seneschal + flag:seneschal = { + court_position_grant_effect = { POS = seneschal CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Court Tutor + flag:court_tutor = { + court_position_grant_effect = { POS = court_tutor CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # High Almoner + flag:high_almoner = { + court_position_grant_effect = { POS = high_almoner CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Physician + flag:court_physician = { + court_position_grant_effect = { POS = court_physician CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Antiquarian + flag:antiquarian = { + court_position_grant_effect = { POS = antiquarian CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Master of the Horse + flag:master_of_horse = { + court_position_grant_effect = { POS = master_of_horse CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Bodyguard + flag:bodyguard = { + court_position_grant_effect = { POS = bodyguard CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Champion + flag:champion = { + court_position_grant_effect = { POS = champion CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Master of the Hunt + flag:master_of_hunt = { + court_position_grant_effect = { POS = master_of_hunt CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Poet + flag:court_poet = { + court_position_grant_effect = { POS = court_poet CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Musician + flag:court_musician = { + court_position_grant_effect = { POS = court_musician CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Court Jester + flag:court_jester = { + court_position_grant_effect = { POS = court_jester CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Executioner + flag:executioner = { + court_position_grant_effect = { POS = executioner CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Food Taster + flag:food_taster = { + court_position_grant_effect = { POS = food_taster CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Cupbearer + flag:cupbearer = { + court_position_grant_effect = { POS = cupbearer CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Lady-in-waiting + flag:lady_in_waiting = { + court_position_grant_effect = { POS = lady_in_waiting CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Eunuch + flag:chief_eunuch = { + court_position_grant_effect = { POS = chief_eunuch CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Gardener + flag:court_gardener = { + court_position_grant_effect = { POS = court_gardener CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Court Artificer + flag:court_artificer = { + court_position_grant_effect = { POS = court_artificer CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Cultural Emissary + flag:cultural_emissary = { + court_position_grant_effect = { POS = cultural_emissary CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Chief Qadi + flag:chief_qadi = { + court_position_grant_effect = { POS = chief_qadi CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Garuda + flag:garuda = { + court_position_grant_effect = { POS = garuda CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Keeper of the Swans + flag:keeper_of_swans = { + court_position_grant_effect = { POS = keeper_of_swans CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Caravan Master + flag:travel_leader = { + court_position_grant_effect = { POS = travel_leader CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Wet Nurse + flag:wet_nurse = { + court_position_grant_effect = { POS = wet_nurse CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Cave Hermit + flag:cave_hermit = { + court_position_grant_effect = { POS = cave_hermit CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Master Assassin + flag:master_assassin = { + court_position_grant_effect = { POS = master_assassin CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Court Scholar + flag:court_scholar = { + court_position_grant_effect = { POS = court_scholar CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Chronciler + flag:chronicler = { + court_position_grant_effect = { POS = chronicler CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Akolouthos + flag:akolouthos = { + court_position_grant_effect = { POS = akolouthos CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Court Astrologer + flag:court_astrologer = { + court_position_grant_effect = { POS = court_astrologer CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Grand Preceptor + flag:grand_preceptor = { + court_position_grant_effect = { POS = grand_preceptor CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Grand Guardian + flag:grand_guardian = { + court_position_grant_effect = { POS = grand_guardian CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Grand Mentor + flag:grand_mentor = { + court_position_grant_effect = { POS = grand_mentor CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Fire Dragon Engineer + flag:fire_dragon_engineer = { + court_position_grant_effect = { POS = fire_dragon_engineer CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Keeper of the Harem + flag:keeper_of_the_harem = { + court_position_grant_effect = { POS = keeper_of_the_harem CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Boyan + flag:boyan = { + court_position_grant_effect = { POS = boyan CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Siege Engineer + flag:siege_engineer = { + court_position_grant_effect = { POS = siege_engineer CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Yurtchi + flag:yurtchi = { + court_position_grant_effect = { POS = yurtchi CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Cherbi + flag:cherbi = { + court_position_grant_effect = { POS = cherbi CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Yeke Jarquchi + flag:yeke_jarquchi = { + court_position_grant_effect = { POS = yeke_jarquchi CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Foreign Emissary + flag:foreign_emissary = { + court_position_grant_effect = { POS = foreign_emissary CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Keeper of the Horses + flag:keeper_of_the_horses = { + court_position_grant_effect = { POS = keeper_of_the_horses CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Court Guru + flag:court_guru = { + court_position_grant_effect = { POS = court_guru CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Court Brahmin + flag:court_brahmin = { + court_position_grant_effect = { POS = court_brahmin CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # Khlon Glan + flag:khlon_glan = { + court_position_grant_effect = { POS = khlon_glan CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + } +} + +# Sets variable of court position suitable to a character's skills +# Actual job is set with camp_officer_generator_assignment_effect after using this effect +# VAR - can be used to allow multiple event options: 'target', 'second', 'backup' +# EMPLOYER - should be the char hiring the position +# ROOT - should be the char taking the position +# Saves scope:old_holder as existing holder if they exist +camp_officer_generator_effect = { + save_scope_as = candidate + $EMPLOYER$ = { save_scope_as = liege } + # Randomly select a fitting role and save it to a variable + random_list = { + 2 = { # second + trigger = { + camp_officer_generator_pickable_trigger = { POS = second EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = second + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = second + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # quartermaster + trigger = { + camp_officer_generator_pickable_trigger = { POS = quartermaster EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = quartermaster + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = quartermaster + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # armorer + trigger = { + camp_officer_generator_pickable_trigger = { POS = armorer EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = armorer + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = armorer + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # chief_forager + trigger = { + camp_officer_generator_pickable_trigger = { POS = chief_forager EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = chief_forager + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = chief_forager + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # master_thief + trigger = { + camp_officer_generator_pickable_trigger = { POS = master_thief EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = master_thief + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = master_thief + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # head_porter + trigger = { + camp_officer_generator_pickable_trigger = { POS = head_porter EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = head_porter + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = head_porter + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # head_groom + trigger = { + camp_officer_generator_pickable_trigger = { POS = head_groom EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = head_groom + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = head_groom + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # huntperson + trigger = { + camp_officer_generator_pickable_trigger = { POS = huntperson EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = huntperson + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = huntperson + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # kennelperson + trigger = { + camp_officer_generator_pickable_trigger = { POS = kennelperson EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = kennelperson + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = kennelperson + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # chief_engineer + trigger = { + camp_officer_generator_pickable_trigger = { POS = chief_engineer EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = chief_engineer + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = chief_engineer + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # witness + trigger = { + camp_officer_generator_pickable_trigger = { POS = witness EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = witness + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = witness + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # person_haggler + trigger = { + camp_officer_generator_pickable_trigger = { POS = person_haggler EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = person_haggler + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = person_haggler + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # camp_cook + trigger = { + camp_officer_generator_pickable_trigger = { POS = camp_cook EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = camp_cook + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = camp_cook + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # master_bard + trigger = { + camp_officer_generator_pickable_trigger = { POS = master_bard EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = master_bard + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = master_bard + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # stooge + trigger = { + camp_officer_generator_pickable_trigger = { POS = stooge EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = stooge + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = stooge + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # master_of_arms + trigger = { + camp_officer_generator_pickable_trigger = { POS = master_of_arms EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = master_of_arms + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = master_of_arms + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # light_cavalry_captain + trigger = { + camp_officer_generator_pickable_trigger = { POS = light_cavalry_captain EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = light_cavalry_captain + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = light_cavalry_captain + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # camelry_captain + trigger = { + camp_officer_generator_pickable_trigger = { POS = camelry_captain EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = camelry_captain + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = camelry_captain + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # elephantry_captain + trigger = { + camp_officer_generator_pickable_trigger = { POS = elephantry_captain EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = elephantry_captain + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = elephantry_captain + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # heavy_cavalry_captain + trigger = { + camp_officer_generator_pickable_trigger = { POS = heavy_cavalry_captain EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = heavy_cavalry_captain + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = heavy_cavalry_captain + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # horse_archer_captain + trigger = { + camp_officer_generator_pickable_trigger = { POS = horse_archer_captain EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = horse_archer_captain + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = horse_archer_captain + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # archer_captain + trigger = { + camp_officer_generator_pickable_trigger = { POS = archer_captain EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = archer_captain + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = archer_captain + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # heavy_infantry_captain + trigger = { + camp_officer_generator_pickable_trigger = { POS = heavy_infantry_captain EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = heavy_infantry_captain + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = heavy_infantry_captain + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # light_infantry_captain + trigger = { + camp_officer_generator_pickable_trigger = { POS = light_infantry_captain EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = light_infantry_captain + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = light_infantry_captain + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # pike_captain + trigger = { + camp_officer_generator_pickable_trigger = { POS = pike_captain EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = pike_captain + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = pike_captain + EMPLOYER = $EMPLOYER$ + } + } + 2 = { # master_of_spoils + trigger = { + camp_officer_generator_pickable_trigger = { POS = master_of_spoils EMPLOYER = $EMPLOYER$ } + } + camp_officer_generator_shared_modifier = { + POS = master_of_spoils + EMPLOYER = $EMPLOYER$ + } + camp_officer_generator_variable_effect = { + VAR = $VAR$ + POS = master_of_spoils + EMPLOYER = $EMPLOYER$ + } + } + } +} + +# Gives job of court position suitable to a character's skills +# Job is picked in camp_officer_generator_effect +# VAR - valid parameters: 'target', 'second', 'backup' +# EMPLOYER - should be the char hiring the position +# CANDIDATE - should be the char taking the position +camp_officer_generator_assignment_effect = { + switch = { + trigger = $CANDIDATE$.var:$VAR$_camp_officer + # second + flag:second = { + camp_officer_grant_effect = { POS = second CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # quartermaster + flag:quartermaster = { + camp_officer_grant_effect = { POS = quartermaster CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # armorer + flag:armorer = { + camp_officer_grant_effect = { POS = armorer CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # chief_forager + flag:chief_forager = { + camp_officer_grant_effect = { POS = chief_forager CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # master_thief + flag:master_thief = { + camp_officer_grant_effect = { POS = master_thief CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # head_porter + flag:head_porter = { + camp_officer_grant_effect = { POS = head_porter CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # head_groom + flag:head_groom = { + camp_officer_grant_effect = { POS = head_groom CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # huntperson + flag:huntperson = { + camp_officer_grant_effect = { POS = huntperson CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # kennelperson + flag:kennelperson = { + camp_officer_grant_effect = { POS = kennelperson CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # chief_engineer + flag:chief_engineer = { + camp_officer_grant_effect = { POS = chief_engineer CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # witness + flag:witness = { + camp_officer_grant_effect = { POS = witness CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # person_haggler + flag:person_haggler = { + camp_officer_grant_effect = { POS = person_haggler CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # camp_cook + flag:camp_cook = { + camp_officer_grant_effect = { POS = camp_cook CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # master_bard + flag:master_bard = { + camp_officer_grant_effect = { POS = master_bard CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # stooge + flag:stooge = { + camp_officer_grant_effect = { POS = stooge CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # master_of_arms + flag:master_of_arms = { + camp_officer_grant_effect = { POS = master_of_arms CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # light_cavalry_captain + flag:light_cavalry_captain = { + camp_officer_grant_effect = { POS = light_cavalry_captain CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # camelry_captain + flag:camelry_captain = { + camp_officer_grant_effect = { POS = camelry_captain CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # elephantry_captain + flag:elephantry_captain = { + camp_officer_grant_effect = { POS = elephantry_captain CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # heavy_cavalry_captain + flag:heavy_cavalry_captain = { + camp_officer_grant_effect = { POS = heavy_cavalry_captain CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # horse_archer_captain + flag:horse_archer_captain = { + camp_officer_grant_effect = { POS = horse_archer_captain CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # archer_captain + flag:archer_captain = { + camp_officer_grant_effect = { POS = archer_captain CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # heavy_infantry_captain + flag:heavy_infantry_captain = { + camp_officer_grant_effect = { POS = heavy_infantry_captain CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # light_infantry_captain + flag:light_infantry_captain = { + camp_officer_grant_effect = { POS = light_infantry_captain CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # pike_captain + flag:pike_captain = { + camp_officer_grant_effect = { POS = pike_captain CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + # master_of_spoils + flag:master_of_spoils = { + camp_officer_grant_effect = { POS = master_of_spoils CANDIDATE = $CANDIDATE$ EMPLOYER = $EMPLOYER$ } + } + } +} + +# Giving out generic court positions +decide_court_position_to_give_effect = { + $EMPLOYER$ = { + if = { + limit = { exists = $CANDIDATE$ } + if = { + limit = { + $CANDIDATE$ = { + OR = { + has_trait = education_learning + learning >= high_skill_rating + } + } + } + random_list = { + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = court_physician_court_position + } + } + $CANDIDATE$ = { add_character_flag = physician_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = court_tutor_court_position + } + } + $CANDIDATE$ = { add_character_flag = tutor_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = court_guru_court_position + } + } + $CANDIDATE$ = { add_character_flag = tutor_flag } # reusing same flag as tutor for simplicity later on + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = high_almoner_court_position + } + } + $CANDIDATE$ = { add_character_flag = almoner_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = antiquarian_court_position + } + } + $CANDIDATE$ = { add_character_flag = antiquarian_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = chief_qadi_court_position + } + } + $CANDIDATE$ = { add_character_flag = qadi_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = fire_dragon_engineer_court_position + } + } + $CANDIDATE$ = { add_character_flag = fire_dragon_engineer_flag } + } + } + } + else_if = { + limit = { + $CANDIDATE$ = { + OR = { + has_trait = education_intrigue + intrigue >= high_skill_rating + } + } + } + random_list = { + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = food_taster_court_position + } + } + $CANDIDATE$ = { add_character_flag = taster_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = executioner_court_position + } + } + $CANDIDATE$ = { add_character_flag = executioner_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = court_tutor_court_position + } + } + $CANDIDATE$ = { add_character_flag = tutor_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = court_guru_court_position + } + } + $CANDIDATE$ = { add_character_flag = tutor_flag } # reusing flag as tutor for simplicity later on + } + } + } + else_if = { + limit = { + $CANDIDATE$ = { + OR = { + has_trait = education_diplomacy + diplomacy >= high_skill_rating + } + } + } + random_list = { + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = cupbearer_court_position + } + } + $CANDIDATE$ = { add_character_flag = cupbearer_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = lady_in_waiting_court_position + } + $CANDIDATE$ = { is_female = yes } + } + $CANDIDATE$ = { add_character_flag = lady_in_waiting_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = court_tutor_court_position + } + } + $CANDIDATE$ = { add_character_flag = tutor_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = court_guru_court_position + } + } + $CANDIDATE$ = { add_character_flag = tutor_flag } # reusing same flag as tutor for simplicity later on + } + 20 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = court_jester_court_position + } + } + $CANDIDATE$ = { add_character_flag = jester_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = court_poet_court_position + } + } + $CANDIDATE$ = { add_character_flag = poet_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = court_musician_court_position + } + } + $CANDIDATE$ = { add_character_flag = musician_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = wet_nurse_court_position + } + $CANDIDATE$ = { is_female = yes } + } + $CANDIDATE$ = { add_character_flag = wet_nurse_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = grand_preceptor_court_position + } + } + $CANDIDATE$ = { add_character_flag = grand_preceptor_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = grand_guardian_court_position + } + } + $CANDIDATE$ = { add_character_flag = grand_guardian_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = grand_mentor_court_position + } + } + $CANDIDATE$ = { add_character_flag = grand_mentor_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = keeper_of_the_harem_court_position + } + } + $CANDIDATE$ = { add_character_flag = keeper_of_the_harem_flag } + } + } + } + else_if = { + limit = { + $CANDIDATE$ = { + OR = { + has_trait = education_stewardship + stewardship >= high_skill_rating + } + } + } + random_list = { + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = court_gardener_court_position + } + } + $CANDIDATE$ = { add_character_flag = gardener_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = royal_architect_court_position + } + } + $CANDIDATE$ = { add_character_flag = architect_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = court_tutor_court_position + } + } + $CANDIDATE$ = { add_character_flag = tutor_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = court_guru_court_position + } + } + $CANDIDATE$ = { add_character_flag = tutor_flag } # reusing same flag as tutor for simplicity later on + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = keeper_of_swans_court_position + } + } + $CANDIDATE$ = { add_character_flag = swan_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = seneschal_court_position + } + } + $CANDIDATE$ = { add_character_flag = seneschal_flag } + } + } + } + else_if = { + limit = { + $CANDIDATE$ = { + OR = { + has_trait = education_martial + martial >= high_skill_rating + } + } + } + random_list = { + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = master_of_horse_court_position + } + } + $CANDIDATE$ = { add_character_flag = horse_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = garuda_court_position + } + } + $CANDIDATE$ = { add_character_flag = garuda_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = court_tutor_court_position + } + } + $CANDIDATE$ = { add_character_flag = tutor_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = court_guru_court_position + } + } + $CANDIDATE$ = { add_character_flag = tutor_flag } # reusing tutor flag for simplicity later on + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = master_of_hunt_court_position + } + } + $CANDIDATE$ = { add_character_flag = hunt_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = bodyguard_court_position + } + } + $CANDIDATE$ = { add_character_flag = bodyguard_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = champion_court_position + } + } + $CANDIDATE$ = { add_character_flag = champion_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = akolouthos_court_position + } + } + $CANDIDATE$ = { add_character_flag = akolouthos_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = court_astrologer_court_position + } + } + $CANDIDATE$ = { add_character_flag = court_astrologer_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = boyan_court_position + } + } + $CANDIDATE$ = { add_character_flag = boyan_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = siege_engineer_court_position + } + } + $CANDIDATE$ = { add_character_flag = siege_engineer_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = yurtchi_court_position + } + } + $CANDIDATE$ = { add_character_flag = yurtchi_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = yeke_jarquchi_court_position + } + } + $CANDIDATE$ = { add_character_flag = yeke_jarquchi_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = foreign_emissary_court_position + } + } + $CANDIDATE$ = { add_character_flag = foreign_emissary_flag } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CANDIDATE$ + COURT_POS = keeper_of_the_horses_court_position + } + } + $CANDIDATE$ = { add_character_flag = keeper_of_the_horses_flag } + } + } + } + } + } +} + +### This effect does NOT care if you are already employing someone in that position +assign_appropriate_court_position_effect = { + if = { + limit = { + $CANDIDATE$ = { + OR = { + has_trait = education_learning + learning >= high_skill_rating + } + } + } + random_list = { + 10 = { + trigger = { + can_employ_court_position_type = court_physician_court_position + } + $CANDIDATE$ = { add_character_flag = physician_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = high_almoner_court_position + } + $CANDIDATE$ = { add_character_flag = almoner_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = antiquarian_court_position + } + $CANDIDATE$ = { add_character_flag = antiquarian_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = chief_qadi_court_position + } + $CANDIDATE$ = { add_character_flag = qadi_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = siege_engineer_court_position + } + $CANDIDATE$ = { add_character_flag = siege_engineer_flag } + } + } + } + else_if = { + limit = { + $CANDIDATE$ = { + OR = { + has_trait = education_intrigue + intrigue >= high_skill_rating + } + } + } + random_list = { + 10 = { + trigger = { + can_employ_court_position_type = food_taster_court_position + } + $CANDIDATE$ = { add_character_flag = taster_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = executioner_court_position + } + $CANDIDATE$ = { add_character_flag = executioner_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = court_astrologer_court_position + } + $CANDIDATE$ = { add_character_flag = court_astrologer_flag } + } + } + } + else_if = { + limit = { + $CANDIDATE$ = { + OR = { + has_trait = education_diplomacy + diplomacy >= high_skill_rating + } + } + } + random_list = { + 10 = { + trigger = { + can_employ_court_position_type = cupbearer_court_position + } + $CANDIDATE$ = { add_character_flag = cupbearer_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = lady_in_waiting_court_position + $CANDIDATE$ = { is_female = yes } + } + $CANDIDATE$ = { add_character_flag = lady_in_waiting_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = court_tutor_court_position + } + $CANDIDATE$ = { add_character_flag = tutor_flag } + } + 20 = { + trigger = { + can_employ_court_position_type = court_jester_court_position + } + $CANDIDATE$ = { add_character_flag = jester_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = court_poet_court_position + } + $CANDIDATE$ = { add_character_flag = poet_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = court_musician_court_position + } + $CANDIDATE$ = { add_character_flag = musician_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = wet_nurse_court_position + $CANDIDATE$ = { is_female = yes } + } + $CANDIDATE$ = { add_character_flag = wet_nurse_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = foreign_emissary_court_position + } + $CANDIDATE$ = { add_character_flag = foreign_emissary_flag } + } + } + } + else_if = { + limit = { + $CANDIDATE$ = { + OR = { + has_trait = education_stewardship + stewardship >= high_skill_rating + } + } + } + random_list = { + 10 = { + trigger = { + can_employ_court_position_type = travel_leader_court_position + } + $CANDIDATE$ = { add_character_flag = travel_leader_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = court_gardener_court_position + } + $CANDIDATE$ = { add_character_flag = gardener_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = royal_architect_court_position + } + $CANDIDATE$ = { add_character_flag = architect_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = keeper_of_swans_court_position + } + $CANDIDATE$ = { add_character_flag = swan_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = seneschal_court_position + } + $CANDIDATE$ = { add_character_flag = seneschal_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = yurtchi_court_position + } + $CANDIDATE$ = { add_character_flag = yurtchi_flag } + } + } + } + else_if = { + limit = { + $CANDIDATE$ = { + OR = { + has_trait = education_martial + martial >= high_skill_rating + } + } + } + random_list = { + 10 = { + trigger = { + can_employ_court_position_type = master_of_horse_court_position + } + $CANDIDATE$ = { add_character_flag = horse_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = garuda_court_position + } + $CANDIDATE$ = { add_character_flag = garuda_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = master_of_hunt_court_position + } + $CANDIDATE$ = { add_character_flag = hunt_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = bodyguard_court_position + } + $CANDIDATE$ = { add_character_flag = bodyguard_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = champion_court_position + } + $CANDIDATE$ = { add_character_flag = champion_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = akolouthos_court_position + } + $CANDIDATE$ = { add_character_flag = akolouthos_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = boyan_court_position + } + $CANDIDATE$ = { add_character_flag = boyan_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = yeke_jarquchi_court_position + } + $CANDIDATE$ = { add_character_flag = yeke_jarquchi_flag } + } + 10 = { + trigger = { + can_employ_court_position_type = keeper_of_the_horses_court_position + } + $CANDIDATE$ = { add_character_flag = keeper_of_the_horses_flag } + } + } + } +} + +distribute_determined_court_position_effect = { + $EMPLOYER$ = { + if = { + limit = { $CANDIDATE$ = { has_character_flag = physician_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = court_physician_court_position + } + } + else_if = { + limit = { + $CANDIDATE$ = { has_character_flag = tutor_flag } + NOT = { government_has_flag = government_is_mandala } + } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = court_tutor_court_position + } + } + else_if = { + limit = { + $CANDIDATE$ = { has_character_flag = tutor_flag } + government_has_flag = government_is_mandala + } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = court_guru_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = almoner_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = high_almoner_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = antiquarian_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = antiquarian_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = qadi_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = chief_qadi_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = taster_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = food_taster_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = executioner_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = executioner_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = cupbearer_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = cupbearer_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = lady_in_waiting_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = lady_in_waiting_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = jester_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = court_jester_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = poet_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = court_poet_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = musician_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = court_musician_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = gardener_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = court_gardener_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = architect_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = royal_architect_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = swan_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = keeper_of_swans_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = seneschal_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = seneschal_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = horse_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = master_of_horse_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = garuda_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = garuda_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = hunt_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = master_of_hunt_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = bodyguard_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = bodyguard_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = champion_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = champion_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = travel_leader_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = travel_leader_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = wet_nurse_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = wet_nurse_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = akolouthos_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = akolouthos_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = court_astrologer_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = court_astrologer_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = grand_preceptor_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = grand_preceptor_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = grand_guardian_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = grand_guardian_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = grand_mentor_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = grand_mentor_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = fire_dragon_engineer_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = fire_dragon_engineer_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = keeper_of_the_harem_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = keeper_of_the_harem_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = boyan_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = boyan_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = siege_engineer_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = siege_engineer_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = yurtchi_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = yurtchi_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = yeke_jarquchi_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = yeke_jarquchi_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = foreign_emissary_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = foreign_emissary_court_position + } + } + else_if = { + limit = { $CANDIDATE$ = { has_character_flag = keeper_of_the_horses_flag } } + appoint_court_position = { + recipient = $CANDIDATE$ + court_position = keeper_of_the_horses_court_position + } + } + } +} + +give_relevant_valid_court_position = { + decide_court_position_to_give_effect = { + EMPLOYER = $EMPLOYER$ + CANDIDATE = $CANDIDATE$ + } + distribute_determined_court_position_effect = { + EMPLOYER = $EMPLOYER$ + CANDIDATE = $CANDIDATE$ + } +} + +### Court Tutor Task Effects ### +court_tutor_improve_others_skill_effect = { + send_interface_toast = { + type = event_royal_court_good_with_text + title = court_tutor_improve_others_title + desc = court_tutor_improve_others_notification_desc + left_icon = root + right_icon = scope:target_character + + scope:target_character = { add_$SKILL$_skill = 1 } + } +} + +court_tutor_improve_others_trait_effect = { + send_interface_toast = { + type = event_royal_court_good_with_text + title = court_tutor_improve_others_title + desc = court_tutor_improve_others_notification_desc + left_icon = root + right_icon = scope:target_character + + scope:target_character = { add_trait = $TRAIT$ } + } +} + +court_tutor_improve_others_trait_xp_effect = { + send_interface_toast = { + type = event_royal_court_good_with_text + title = court_tutor_improve_others_title + desc = court_tutor_improve_others_notification_desc + left_icon = root + right_icon = scope:target_character + + scope:target_character = { + add_trait_xp = { + trait = $TRAIT$ + value = 5 + } + } + } +} + +court_tutor_improve_others_trait_track_xp_effect = { + send_interface_toast = { + type = event_royal_court_good_with_text + title = court_tutor_improve_others_title + desc = court_tutor_improve_others_notification_desc + left_icon = root + right_icon = scope:target_character + + scope:target_character = { + add_trait_xp = { + trait = $TRAIT$ + track = $TRACK$ + value = 5 + } + } + } +} + +wet_nurse_instill_virtue_effect = { + scope:notification_character = { + send_interface_toast = { + type = event_royal_court_good_with_text + title = wet_nurse_instill_virtue + desc = wet_nurse_instill_virtue_notification_desc + left_icon = root + right_icon = scope:child_character + + scope:child_character = { + add_trait = $TRAIT$ + } + } + } +} + +# Need a 'notification_character' scope for it to work properly +instill_virtue_trait_effect = { + save_scope_as = child_character + # Find fitting trait + random_list = { + 1 = { # Lustful + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = lustful } + NOT = { has_trait = chaste } + } + wet_nurse_instill_virtue_effect = { TRAIT = lustful } + } + 1 = { # Chaste + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = chaste } + NOT = { has_trait = lustful } + } + wet_nurse_instill_virtue_effect = { TRAIT = chaste } + } + 1 = { # Gluttonous + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = gluttonous } + NOT = { has_trait = temperate } + } + wet_nurse_instill_virtue_effect = { TRAIT = gluttonous } + } + 1 = { # Temperate + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = temperate } + NOT = { has_trait = gluttonous } + } + wet_nurse_instill_virtue_effect = { TRAIT = temperate } + } + 1 = { # Greedy + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = greedy } + NOT = { has_trait = generous } + } + wet_nurse_instill_virtue_effect = { TRAIT = greedy } + } + 1 = { # Generous + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = generous } + NOT = { has_trait = greedy } + } + wet_nurse_instill_virtue_effect = { TRAIT = generous } + } + 1 = { # Lazy + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = lazy } + NOT = { has_trait = diligent } + } + wet_nurse_instill_virtue_effect = { TRAIT = lazy } + } + 1 = { # Diligent + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = diligent } + NOT = { has_trait = lazy } + } + wet_nurse_instill_virtue_effect = { TRAIT = diligent } + } + 1 = { # Wrathful + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = wrathful } + NOT = { has_trait = calm } + } + wet_nurse_instill_virtue_effect = { TRAIT = wrathful } + } + 1 = { # Calm + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = calm } + NOT = { has_trait = wrathful } + } + wet_nurse_instill_virtue_effect = { TRAIT = calm } + } + 1 = { # Patient + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = patient } + NOT = { has_trait = impatient } + } + wet_nurse_instill_virtue_effect = { TRAIT = patient } + } + 1 = { # Impatient + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = impatient } + NOT = { has_trait = patient } + } + wet_nurse_instill_virtue_effect = { TRAIT = impatient } + } + 1 = { # Arrogant + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = arrogant } + NOT = { has_trait = humble } + } + wet_nurse_instill_virtue_effect = { TRAIT = arrogant } + } + 1 = { # Humble + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = humble } + NOT = { has_trait = arrogant } + } + wet_nurse_instill_virtue_effect = { TRAIT = humble } + } + 1 = { # Deceitful + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = deceitful } + NOT = { has_trait = honest } + } + wet_nurse_instill_virtue_effect = { TRAIT = deceitful } + } + 1 = { # Honest + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = honest } + NOT = { has_trait = deceitful } + } + wet_nurse_instill_virtue_effect = { TRAIT = honest } + } + 1 = { # Craven + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = craven } + NOT = { has_trait = brave } + } + wet_nurse_instill_virtue_effect = { TRAIT = craven } + } + 1 = { # Brave + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = brave } + NOT = { has_trait = craven } + } + wet_nurse_instill_virtue_effect = { TRAIT = brave } + } + 1 = { # Shy + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = shy } + NOT = { has_trait = gregarious } + } + wet_nurse_instill_virtue_effect = { TRAIT = shy } + } + 1 = { # Gregarious + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = gregarious } + NOT = { has_trait = shy } + } + wet_nurse_instill_virtue_effect = { TRAIT = gregarious } + } + 1 = { # Ambitious + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = ambitious } + NOT = { has_trait = content } + } + wet_nurse_instill_virtue_effect = { TRAIT = ambitious } + } + 1 = { # Content + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = content } + NOT = { has_trait = ambitious } + } + wet_nurse_instill_virtue_effect = { TRAIT = content } + } + 1 = { # Arbitrary + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = arbitrary } + NOT = { has_trait = just } + } + wet_nurse_instill_virtue_effect = { TRAIT = arbitrary } + } + 1 = { # Just + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = just } + NOT = { has_trait = arbitrary } + } + wet_nurse_instill_virtue_effect = { TRAIT = just } + } + 1 = { # Cynical + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = cynical } + NOT = { has_trait = zealous } + } + wet_nurse_instill_virtue_effect = { TRAIT = cynical } + } + 1 = { # Zealous + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = zealous } + NOT = { has_trait = cynical } + } + wet_nurse_instill_virtue_effect = { TRAIT = zealous } + } + 1 = { # Paranoid + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = paranoid } + NOT = { has_trait = trusting } + } + wet_nurse_instill_virtue_effect = { TRAIT = paranoid } + } + 1 = { # Trusting + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = trusting } + NOT = { has_trait = paranoid } + } + wet_nurse_instill_virtue_effect = { TRAIT = trusting } + } + 1 = { # Compassionate + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = compassionate } + NOR = { + has_trait = callous + has_trait = sadistic + } + } + wet_nurse_instill_virtue_effect = { TRAIT = compassionate } + } + 1 = { # Callous + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = callous } + NOR = { + has_trait = compassionate + has_trait = sadistic + } + } + wet_nurse_instill_virtue_effect = { TRAIT = callous } + } + 1 = { # Sadistic + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = sadistic } + NOR = { + has_trait = compassionate + has_trait = callous + } + } + wet_nurse_instill_virtue_effect = { TRAIT = sadistic } + } + 1 = { # Stubborn + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = stubborn } + NOR = { + has_trait = fickle + has_trait = eccentric + } + } + wet_nurse_instill_virtue_effect = { TRAIT = stubborn } + } + 1 = { # Fickle + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = fickle } + NOR = { + has_trait = stubborn + has_trait = eccentric + } + } + wet_nurse_instill_virtue_effect = { TRAIT = fickle } + } + 1 = { # Eccentric + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = eccentric } + NOR = { + has_trait = stubborn + has_trait = fickle + } + } + wet_nurse_instill_virtue_effect = { TRAIT = eccentric } + } + 1 = { # Vengeful + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = vengeful } + NOT = { has_trait = forgiving } + } + wet_nurse_instill_virtue_effect = { TRAIT = vengeful } + } + 1 = { # Forgiving + trigger = { + wet_nurse_instill_virtue_trigger = { TRAIT = forgiving } + NOT = { has_trait = vengeful } + } + wet_nurse_instill_virtue_effect = { TRAIT = forgiving } + } + } +} + +promote_relationships_remove_relation_effect = { + random_relation = { + type = $RELATION$ + save_scope_as = relation + } + remove_relation_bully = scope:relation +} + +court_position_vacated_event_effect = { + scope:liege = { + if = { + limit = { + is_ai = no + NOT = { has_player_court_position_automation_none = court_position_type:$COURT_POSITION_TYPE$ } + } + + court_position_type:$COURT_POSITION_TYPE$ = { + save_scope_as = court_position_type + } + ordered_court_position_candidate = { + court_position_type = scope:court_position_type + order_by = aptitude_score:$COURT_POSITION_TYPE$ + + # Previous holder might still be in the court/alive - lets not include them + limit = { NOT = { this = scope:employee } } + max = 2 + check_range_bounds = no + + if = { + limit = { NOT = { exists = scope:candidate_1 } } + save_scope_as = candidate_1 + } + else_if = { + limit = { NOT = { exists = scope:candidate_2 } } + save_scope_as = candidate_2 + } + } + + if = { + limit = { + OR = { + has_player_court_position_automation_assign_best = scope:court_position_type + has_player_court_position_automation_assign_best_or_event = scope:court_position_type + } + exists = scope:candidate_1 + } + + appoint_court_position = { + recipient = scope:candidate_1 + court_position = scope:court_position_type + } + } + else_if = { + limit = { + has_player_court_position_automation_assign_best = scope:court_position_type + } + # Do nothing, the player does not want an event + } + else_if = { + limit = { is_landless_adventurer = yes } + trigger_event = court_position_management_event.0002 + } + else = { + trigger_event = court_position_management_event.0001 + } + } + } +} + +court_astrologer_task_remove_seasonal_modifiers_effect = { + hidden_effect = { + remove_character_modifier = court_astrologer_abundant_grazing_modifier + remove_character_modifier = court_astrologer_warm_nights_modifier + remove_character_modifier = court_astrologer_sky_blessing_modifier + remove_character_modifier = court_astrologer_white_zud_modifier + remove_character_modifier = court_astrologer_cold_zud_modifier + remove_character_modifier = court_astrologer_severe_drought_modifier + remove_character_modifier = court_astrologer_havsarsan_zud_modifier + } +} + +court_astrologer_task_add_seasonal_modifiers_effect = { + hidden_effect = { + save_scope_as = current_character + capital_province.county = { + random_county_situation_sub_region = { + limit = { + OR = { + sub_region_current_phase = situation_steppe_abundant_grazing_season + sub_region_current_phase = situation_steppe_warm_nights_season + sub_region_current_phase = situation_steppe_sky_blessing_season + sub_region_current_phase = situation_steppe_white_zud_season + sub_region_current_phase = situation_steppe_cold_zud_season + sub_region_current_phase = situation_steppe_severe_drought_season + sub_region_current_phase = situation_steppe_havsarsan_zud_season + } + } + switch = { + trigger = sub_region_current_phase + situation_steppe_abundant_grazing_season = { + scope:current_character = { + add_character_modifier = court_astrologer_abundant_grazing_modifier + } + } + situation_steppe_warm_nights_season = { + scope:current_character = { + add_character_modifier = court_astrologer_warm_nights_modifier + } + } + situation_steppe_sky_blessing_season = { + scope:current_character = { + add_character_modifier = court_astrologer_sky_blessing_modifier + } + } + situation_steppe_white_zud_season = { + scope:current_character = { + add_character_modifier = court_astrologer_white_zud_modifier + } + } + situation_steppe_cold_zud_season = { + scope:current_character = { + add_character_modifier = court_astrologer_cold_zud_modifier + } + } + situation_steppe_severe_drought_season = { + scope:current_character = { + add_character_modifier = court_astrologer_severe_drought_modifier + } + } + situation_steppe_havsarsan_zud_season = { + scope:current_character = { + add_character_modifier = court_astrologer_havsarsan_zud_modifier + } + } + } + } + } + } +} + +# Revoke any court position effect +## Please note that free_revoke_cost flag needs to be set. +## Save employer of person revoked as liege. +## REVOKED_CHARACTER also needs to be filled out. + +revoke_specific_court_position_effect = { + $LIEGE$ = { + revoke_court_position = { + recipient = $REVOKED_CHARACTER$ + court_position = $POS$_court_position + } + remove_character_flag = free_revoke_cost + } +} + +## Find POS in revoke_specific_court_position_effect +fire_specific_court_position_effect = { + switch = { + trigger = has_court_position + court_physician_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = court_physician + } + } + cultural_emissary_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = cultural_emissary + } + } + keeper_of_swans_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = keeper_of_swans + } + } + chief_qadi_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = chief_qadi + } + } + garuda_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = garuda + } + } + court_gardener_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = court_gardener + } + } + lady_in_waiting_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = lady_in_waiting + } + } + antiquarian_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = antiquarian + } + } + travel_leader_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = travel_leader + } + } + wet_nurse_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = wet_nurse + } + } + court_tutor_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = court_tutor + } + } + food_taster_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = food_taster + } + } + master_of_horse_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = master_of_horse + } + } + master_of_hunt_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = master_of_hunt + } + } + royal_architect_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = royal_architect + } + } + high_almoner_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = high_almoner + } + } + seneschal_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = seneschal + } + } + cupbearer_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = cupbearer + } + } + chief_eunuch_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = chief_eunuch + } + } + court_jester_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = court_jester + } + } + court_poet_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = court_poet + } + } + court_musician_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = court_musician + } + } + bodyguard_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = bodyguard + } + } + champion_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = champion + } + } + executioner_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = executioner + } + } + court_artificer_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = court_artificer + } + } + master_assassin_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = master_assassin + } + } + cave_hermit_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = cave_hermit + } + } + chronicler_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = chronicler + } + } + court_scholar_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = court_scholar + } + } + charioteer_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = charioteer + } + } + bookmaker_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = bookmaker + } + } + akolouthos_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = akolouthos + } + } + court_brewmaster_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = court_brewmaster + } + } + grand_preceptor_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = grand_preceptor + } + } + grand_mentor_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = grand_mentor + } + } + grand_guardian_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = grand_guardian + } + } + fire_dragon_engineer_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = fire_dragon_engineer + } + } + keeper_of_the_harem_court_position = { + revoke_specific_court_position_effect = { + REVOKED_CHARACTER = $CHARACTER$ + LIEGE = $LIEGE$ + POS = keeper_of_the_harem + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_courtier_guest_management_effects.txt b/N3OW/common/scripted_effects/00_courtier_guest_management_effects.txt new file mode 100644 index 00000000..159798c8 --- /dev/null +++ b/N3OW/common/scripted_effects/00_courtier_guest_management_effects.txt @@ -0,0 +1,1590 @@ +### +#fallback_move_to_pool_effect +#select_and_move_to_pool_effect - Use this to move courtiers/guests to pool + +select_fallback_pool_to_move_to_effect = { + if = { + limit = { + NOT = { exists = location } + } + random_duchy = { + limit = { + exists = title_capital_county + title_capital_county.culture = { + has_same_culture_heritage = scope:mover.culture + } + } + title_capital_county.holder.capital_province = { save_scope_as = destination } + } + if = { + limit = { + NOT = { exists = scope:destination } + } + random_duchy = { + limit = { + exists = title_capital_county + title_capital_county.faith = scope:mover.faith + } + title_capital_county.holder.capital_province = { save_scope_as = destination } + } + } + if = { + limit = { + NOT = { exists = scope:destination } + } + random_duchy = { + limit = { + exists = title_capital_county.holder.capital_province + } + title_capital_county.holder.capital_province = { save_scope_as = destination } + } + } + } + else = { + random_kingdom = { + limit = { + is_titular = no + title_capital_county.title_province ?= { + squared_distance = { + target = scope:mover.location value <= squared_distance_large + } + } + } + random_in_de_jure_hierarchy = { + limit = { + tier = tier_duchy + title_capital_county.holder.capital_province = { local_pool_is_full_trigger = no } + } + title_capital_county.holder.capital_province = { save_scope_as = destination } + } + } + if = { + limit = { + NOT = { exists = scope:destination } + exists = scope:mover.host.capital_province + } + scope:mover.host.capital_province = { save_scope_as = destination } + } + else_if = { + limit = { + NOT = { exists = scope:destination } + } + random_kingdom = { + limit = { + exists = title_capital_county + } + title_capital_county.holder.capital_province = { save_scope_as = destination } + } + } + } +} + + +fallback_move_to_pool_effect = { + save_temporary_scope_as = mover + if = { + limit = { exists = host } + set_variable = { + name = last_visited_ruler + value = this.host + days = 1825 + } + } + else = { #I.e. if we're in the pool + set_variable = { + name = last_visited_ruler + value = dummy_female #Because you must have a character value to compare it with another + days = 1825 + } + } + + select_fallback_pool_to_move_to_effect = yes + + every_traveling_family_member = { + limit = { + NOT = { is_in_pool_at = scope:destination } + } + move_to_pool_at = scope:destination + } +} + +select_pool_to_move_to_effect = { + ###CLAIMANT HANDLING### + random = { + chance = 20 + if = { + limit = { + any_claim = { tier <= tier_kingdom } + NOT = { + is_weak_claimant_due_to_gender_trigger = { FAITH = scope:mover.faith CHARACTER = scope:mover } + } + } + + every_traveling_family_member = { + add_to_temporary_list = claimant_family + } + + #Player if possible + random_player = { + limit = { + save_temporary_scope_as = player + scope:mover = { any_claim = { useful_courtier_or_guest_claim_trigger = { RULER = scope:player } } } + any_in_list = { + list = claimant_family + count = all + guest_allowed_to_arrive_trigger = { HOST = scope:player } + } + exists = capital_province + } + capital_province = { save_scope_as = destination } + } + + #Otherwise some independent ruler + if = { + limit = { NOT = { exists = scope:destination } } + random_independent_ruler = { + limit = { + save_temporary_scope_as = independent_ruler + scope:mover = { any_claim = { useful_courtier_or_guest_claim_trigger = { RULER = scope:independent_ruler } } } + any_in_list = { + list = claimant_family + count = all + guest_allowed_to_arrive_trigger = { HOST = scope:independent_ruler } + } + exists = capital_province + } + capital_province = { save_scope_as = destination } + } + } + } + } + + if = { + limit = { NOT = { exists = scope:destination } } + + ###PICK THE NEW LOCATION### + random_list = { + #Close or extended family + 25 = { + trigger = { any_close_or_extended_family_member = { is_visitable_relation_trigger = { CHARACTER = scope:mover } } } + random_close_or_extended_family_member = { + limit = { is_visitable_relation_trigger = { CHARACTER = scope:mover } } + capital_province = { save_scope_as = destination } + } + } + #Other dynasty members + 5 = { + trigger = { + dynasty ?= { + any_dynasty_member = { + is_visitable_relation_trigger = { CHARACTER = scope:mover } + NOT = { is_close_or_extended_family_of = scope:mover } + } + } + } + dynasty = { + random_dynasty_member = { + limit = { + is_visitable_relation_trigger = { CHARACTER = scope:mover } + NOT = { is_close_or_extended_family_of = scope:mover } + } + capital_province = { save_scope_as = destination } + } + } + } + #Lovers + 25 = { + trigger = { + any_relation = { + type = lover + is_visitable_relation_trigger = { CHARACTER = scope:mover } + } + } + random_relation = { + type = lover + limit = { any_close_or_extended_family_member = { is_visitable_relation_trigger = { CHARACTER = scope:mover } } } + capital_province = { save_scope_as = destination } + } + } + #Friends + 25 = { + trigger = { + any_relation = { + type = friend + is_visitable_relation_trigger = { CHARACTER = scope:mover } + } + } + random_relation = { + type = friend + limit = { is_visitable_relation_trigger = { CHARACTER = scope:mover } } + capital_province = { save_scope_as = destination } + } + } + #Secret Witch + 25 = { + trigger = { + any_secret = { + type = secret_witch + any_secret_knower = { + is_visitable_relation_trigger = { CHARACTER = scope:mover } + is_witch_trigger = yes + } + } + } + + random_secret = { + type = secret_witch + random_secret_knower = { + limit = { + is_visitable_relation_trigger = { CHARACTER = scope:mover } + is_witch_trigger = yes + } + capital_province = { save_scope_as = destination } + } + } + } + } + } + if = { + limit = { NOT = { exists = scope:destination } } + + random_list = { + #Within the realm (only for kingdoms/empires) + 15 = { + trigger = { + host.top_liege ?= { + highest_held_title_tier >= tier_kingdom + OR = { + is_visitable_relation_trigger = { CHARACTER = scope:mover } + any_vassal = { + highest_held_title_tier >= tier_county + is_visitable_relation_trigger = { CHARACTER = scope:mover } + } + } + } + } + host.top_liege = { + if = { + limit = { + is_visitable_relation_trigger = { CHARACTER = scope:mover } + } + add_to_temporary_list = same_realm_list + } + every_vassal = { + limit = { + highest_held_title_tier >= tier_county + is_visitable_relation_trigger = { CHARACTER = scope:mover } + } + add_to_temporary_list = same_realm_list + } + } + random_in_list = { + list = same_realm_list + limit = { + is_visitable_relation_trigger = { CHARACTER = scope:mover } + } + capital_province = { save_scope_as = destination } + } + } + #Neighboring realm (overseas) + 5 = { + trigger = { + host ?= { + any_neighboring_and_across_water_top_liege_realm_owner = { + OR = { + is_visitable_relation_trigger = { CHARACTER = scope:mover } + any_vassal = { + highest_held_title_tier >= tier_county + is_visitable_relation_trigger = { CHARACTER = scope:mover } + } + } + } + } + } + host = { + random_neighboring_and_across_water_top_liege_realm_owner = { + if = { + limit = { + is_visitable_relation_trigger = { CHARACTER = scope:mover } + } + add_to_temporary_list = other_realm_list + } + every_vassal_or_below = { + limit = { + highest_held_title_tier >= tier_county + is_visitable_relation_trigger = { CHARACTER = scope:mover } + } + add_to_temporary_list = other_realm_list + } + } + } + random_in_list = { + list = other_realm_list + limit = { + is_visitable_relation_trigger = { CHARACTER = scope:mover } + } + capital_province = { save_scope_as = destination } + } + } + #Neighboring realm (not overseas) + 15 = { + trigger = { + host ?= { + any_neighboring_top_liege_realm_owner = { + OR = { + is_visitable_relation_trigger = { CHARACTER = scope:mover } + any_vassal = { + highest_held_title_tier >= tier_county + is_visitable_relation_trigger = { CHARACTER = scope:mover } + } + } + } + } + } + host = { + random_neighboring_top_liege_realm_owner = { + if = { + limit = { + is_visitable_relation_trigger = { CHARACTER = scope:mover } + } + add_to_temporary_list = other_realm_list + } + every_vassal_or_below = { + limit = { + highest_held_title_tier >= tier_county + is_visitable_relation_trigger = { CHARACTER = scope:mover } + } + add_to_temporary_list = other_realm_list + } + } + } + random_in_list = { + list = other_realm_list + limit = { + is_visitable_relation_trigger = { CHARACTER = scope:mover } + } + capital_province = { save_scope_as = destination } + } + } + } + } + + if = { + limit = { + NOT = { exists = scope:destination } + } + + select_fallback_pool_to_move_to_effect = yes + } +} + +move_to_pool_effect = { + save_temporary_scope_as = mover + ###TOOLTIP FOR HOST### + show_as_tooltip = { + scope:mover = { move_to_pool = yes } + } + + ###MOVE OR FIND FALLBACK DESTINATION### + if = { + limit = { + exists = scope:destination + } + set_variable = { + name = last_visited_ruler + value = this.host + days = 3650 + } + every_traveling_family_member = { + limit = { + NOT = { is_in_pool_at = scope:destination } + is_ruler = no + trigger_if = { + limit = { + exists = scope:mover.host + is_child_of = scope:mover.host + is_adult = no + } + dynasty != scope:mover.host.dynasty + } + } + hidden_effect = { move_to_pool_at = scope:destination } + } + } +} + +select_and_move_to_pool_effect = { + save_temporary_scope_as = mover + + hidden_effect = { select_pool_to_move_to_effect = yes } + move_to_pool_effect = yes +} + +courtier_guest_pool_character_secret_giving_effect = { + random_list = { + # Deviant + 200 = { + trigger = { + NOR = { + has_trait = celibate + has_trait = chaste + any_secret = { type = secret_deviant } + has_trait = deviant + } + } + modifier = { + has_trait = lustful + add = 50 + } + + give_deviant_secret_or_trait_effect = yes + } + # Homosexual + 100 = { + trigger = { + is_male = yes + OR = { + has_sexuality = homosexual + has_sexuality = bisexual + } + NOT = { has_trait = celibate } + NOR = { + any_secret = { type = secret_homosexual } + has_trait = sodomite + } + } + modifier = { + has_trait = chaste + add = -50 + } + + give_homosexual_secret_or_nothing_effect = yes + } + # Cannibal + 100 = { + trigger = { + OR = { + has_trait = lunatic + has_trait = possessed + ai_compassion <= high_negative_ai_value + } + NOR = { + any_secret = { type = secret_cannibal } + has_trait = cannibal + } + } + ai_compassion_target_modifier = { VALUE = -50 } + + give_cannibal_secret_or_trait_effect = yes + } + # Non-believer + 500 = { + trigger = { + NOR = { + has_trait = zealous + any_secret = { type = secret_non_believer } + has_character_modifier = known_non_believer + } + } + ai_zeal_target_modifier = { VALUE = -50 } + give_non_believer_secret_effect = yes + } + # Witch + 100 = { + trigger = { + NOR = { + has_trait = zealous + any_secret = { type = secret_witch } + has_trait = witch + } + } + modifier = { + OR = { + has_trait = lifestyle_mystic + has_trait = lifestyle_herbalist + } + add = 50 + } + ai_greed_target_modifier = { VALUE = 50 } + } + } +} + +pool_character_development_effect = { + ###POSIBLE EFFECTS### + # Increase a low skill + # Get married + # Get a scripted relation + # Get a lifestyle trait + # Get a commander trait + # Get an interesting trait + # Get a secret + # Kill someone + # Learn a language + + save_temporary_scope_as = pool_character + + + random_list = { + # INCREASE A LOW SKILL + 100 = { + trigger = { diplomacy < medium_skill_rating } + add_diplomacy_skill = 1 + } + 100 = { + trigger = { martial < medium_skill_rating } + add_martial_skill = 1 + } + 100 = { + trigger = { stewardship < medium_skill_rating } + add_stewardship_skill = 1 + } + 100 = { + trigger = { intrigue < medium_skill_rating } + add_intrigue_skill = 1 + } + 100 = { + trigger = { learning < medium_skill_rating } + add_learning_skill = 1 + } + 100 = { + trigger = { prowess < medium_skill_rating } + add_prowess_skill = 1 + } + 400 = { + trigger = { + prowess > medium_skill_rating + NOT = { + has_trait = berserker + } + faith = { + has_doctrine = tenet_warmonger + } + OR = { + culture = { has_cultural_pillar = heritage_north_germanic } + religion = religion:germanic_religion + } + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:pool_character } + } + add_trait = berserker + } + 100 = { + trigger = { + diplomacy >= medium_skill_rating + NOT = { + has_trait = lifestyle_poet + } + OR = { + culture = { has_cultural_pillar = heritage_north_germanic } + religion = religion:germanic_religion + culture = { has_cultural_parameter = poet_trait_more_common } + } + } + add_trait = lifestyle_poet + } + + # GET MARRIED + 15 = { + trigger = { + age <= 40 + is_married = no + is_concubine = no + #The triggers below are here to avoid low fertility marriages (in most cases) + NOR = { + has_sexuality = asexual + has_trait = celibate + has_trait = chaste + } + fertility > low_fertility + OR = { + exists = mother + exists = father + } + can_marry_trigger = yes + } + + save_temporary_scope_as = template + + if = { + limit = { + exists = scope:pool_character.location + any_pool_character = { + province = scope:pool_character.location + allowed_to_marry_character_gender_trigger = { CHARACTER = scope:pool_character } + is_physically_able_adult = yes + age <= 40 + is_married = no + can_marry_trigger = yes + is_concubine = no + } + } + random_pool_character = { + province = scope:pool_character.location + limit = { + allowed_to_marry_character_gender_trigger = { CHARACTER = scope:pool_character } + is_physically_able_adult = yes + age <= 40 + is_married = no + can_marry_trigger = yes + is_concubine = no + } + save_temporary_scope_as = spouse + } + } + else = { + create_character = { + location = scope:template.location + gender_female_chance = scope:template.marriage_gender_adjusted_female_chance + template = mediocre_spouse + save_temporary_scope_as = spouse + } + } + + if = { + limit = { + is_female = yes + } + marry_matrilineal = scope:spouse + } + else = { + marry = scope:spouse + } + + scope:spouse = { + if = { + limit = { + exists = scope:template.host + } + visit_court_of = scope:template.host + } + } + } + + # GET A LIFESTYLE TRAIT + 50 = { + trigger = { + number_of_lifestyle_traits <= 2 + } + modifier = { + number_of_lifestyle_traits = 0 + factor = 2 + } + + random_list = { + 100 = { #REVELER + trigger = { + NAND = { + has_trait = lifestyle_reveler + has_trait_xp = { + trait = lifestyle_reveler + value >= 100 + } + } + NOR = { + has_trait = shy + has_trait = celibate + has_trait = temperate + has_trait = chaste + ai_greed < 0 + } + } + modifier = { + has_trait = lifestyle_reveler + factor = 5 + } + modifier = { + culture = { has_cultural_parameter = reveler_traits_more_common } + factor = 5 + } + if = { + limit = { + NOT = { has_trait = lifestyle_reveler } + } + add_trait = lifestyle_reveler + } + else = { + add_trait_xp = { + trait = lifestyle_reveler + value = 10 + } + } + } + 100 = { #BLADEMASTER + trigger = { + NAND = { + has_trait = lifestyle_blademaster + has_trait_xp = { + trait = lifestyle_blademaster + value >= 100 + } + } + prowess >= decent_skill_rating + } + modifier = { + has_trait = lifestyle_blademaster + factor = 5 + } + modifier = { + factor = 3 + culture = { + has_cultural_parameter = blademaster_traits_more_common + } + } + modifier = { + NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:pool_character } } + factor = 0.1 + } + if = { + limit = { has_trait = lifestyle_blademaster } + add_trait_xp = { + trait = lifestyle_blademaster + value = 10 + } + } + else = { add_trait = lifestyle_blademaster } + } + 100 = { #HUNTER + trigger = { + NOT = { + hunt_lifestyle_track_greater_equal_trigger = { TRACK = hunter GREATER_EQUAL = 100 } + } + ai_boldness >= medium_positive_ai_value + ai_energy >= low_positive_ai_value + ai_compassion < high_positive_ai_value + } + modifier = { + has_trait = lifestyle_hunter + factor = 5 + } + modifier = { + culture = { + OR = { + has_cultural_parameter = hunting_traits_more_common + has_cultural_parameter = falconer_traits_more_common + } + } + factor = 5 + } + if = { + limit = { has_trait = lifestyle_hunter } + random_list = { + 10 = { + modifier = { + culture = { has_cultural_parameter = hunting_traits_more_common } + add = 20 + } + add_trait_xp = { + trait = lifestyle_hunter + track = hunter + value = 10 + } + } + 10 = { + modifier = { + culture = { has_cultural_parameter = falconer_traits_more_common } + add = 20 + } + add_trait_xp = { + trait = lifestyle_hunter + track = falconer + value = 10 + } + } + } + } + else = { add_trait = lifestyle_hunter } + } + 100 = { #PHYSICIAN + trigger = { + NAND = { + has_trait = lifestyle_physician + has_trait_xp = { + trait = lifestyle_physician + value >= 100 + } + } + learning >= decent_skill_rating + } + modifier = { + has_trait = lifestyle_physician + factor = 5 + } + modifier = { + culture = { has_cultural_tradition = tradition_medicinal_plants } + factor = 2 + } + if = { + limit = { has_trait = lifestyle_physician } + add_trait_xp = { + trait = lifestyle_physician + value = 10 + } + } + else = { add_trait = lifestyle_physician } + } + 100 = { #MYSTIC + trigger = { + NAND = { + has_trait = lifestyle_mystic + has_trait_xp = { + trait = lifestyle_mystic + value >= 100 + } + } + learning >= decent_skill_rating + } + modifier = { + has_trait = lifestyle_mystic + factor = 5 + } + modifier = { + ai_zeal > 0 + factor = 0.5 + } + modifier = { + is_witch_trigger = yes + factor = 3 + } + modifier = { + culture = { has_cultural_parameter = mystic_trait_more_common } + factor = 5 + } + if = { + limit = { has_trait = lifestyle_mystic } + add_trait_xp = { + trait = lifestyle_mystic + value = 10 + } + } + else = { add_trait = lifestyle_mystic } + } + 100 = { #HERBALIST + trigger = { + NOT = { has_trait = lifestyle_herbalist } + learning >= decent_skill_rating + } + modifier = { + ai_zeal > 0 + factor = 0.5 + } + modifier = { + is_witch_trigger = yes + factor = 3 + } + modifier = { + culture = { has_cultural_parameter = herbalist_traits_more_common } + factor = 5 + } + add_trait = lifestyle_herbalist + } + 50 = { #GARDENER + trigger = { + NOT = { has_trait = lifestyle_gardener } + stewardship >= decent_skill_rating + } + modifier = { + culture = { has_cultural_parameter = can_appoint_court_gardener } + factor = 5 + } + add_trait = lifestyle_gardener + } + } + } + + #GET A COMMANDER TRAIT + 100 = { + trigger = { + has_trait = education_martial + number_of_commander_traits < commander_trait_limit + } + + random_list = { + 1 = { + trigger = { NOT = { has_trait = logistician } } + add_trait = logistician + } + 1 = { + trigger = { NOT = { has_trait = military_engineer } } + add_trait = military_engineer + } + 1 = { + trigger = { NOT = { has_trait = aggressive_attacker } } + add_trait = aggressive_attacker + } + 1 = { + trigger = { NOT = { has_trait = unyielding_defender } } + add_trait = unyielding_defender + } + 1 = { + trigger = { NOT = { has_trait = forder } } + add_trait = forder + } + 1 = { + trigger = { NOT = { has_trait = holy_warrior } } + add_trait = holy_warrior + } + 1 = { + trigger = { NOT = { has_trait = reckless } } + add_trait = reckless + } + 1 = { + trigger = { NOT = { has_trait = cautious_leader } } + add_trait = cautious_leader + } + 1 = { + trigger = { NOT = { has_trait = rough_terrain_expert } } + add_trait = rough_terrain_expert + } + 1 = { + trigger = { NOT = { has_trait = open_terrain_expert } } + add_trait = open_terrain_expert + } + } + } + + # GET AN INTERESTING TRAIT + 20 = { + random_list = { + 1 = { + trigger = { NOT = { has_trait = lunatic } } + add_trait = lunatic_1 + } + 1 = { + trigger = { NOT = { has_trait = possessed } } + add_trait = possessed_1 + } + 1 = { + trigger = { NOT = { has_trait = scarred } } + add_trait = scarred + add_trait_xp = { + trait = scarred + value = { + integer_range = { + min = 5 + max = 25 + } + } + } + } + 1 = { + trigger = { NOT = { has_trait = lifestyle_poet } } + add_trait = lifestyle_poet + } + 1 = { + trigger = { + can_be_drunkard = yes + } + add_trait = drunkard + } + 1 = { + trigger = { #Does not use the can_be_rakish to reduce performance hit + NOR = { + has_trait = rakish + has_trait = celibate + has_trait = chaste + has_sexuality = asexual + } + } + add_trait = rakish + } + 1 = { #Does not use the can_be_flagellant to reduce performance hit + trigger = { NOT = { has_trait = flagellant } } + add_trait = flagellant + } + 1 = { #Does not use the can_be_contrite to reduce performance hit + trigger = { + NOR = { + has_trait = deceitful + has_trait = contrite + } + } + add_trait = contrite + } + 1 = { #Does not use the can_be_journaller to reduce performance hit + trigger = { NOT = { has_trait = journaller } } + add_trait = journaller + } + 1 = { + trigger = { + is_eunuch_trigger = no + is_male = yes + age >= 12 + } + add_trait = eunuch_1 + } + 1 = { + trigger = { + is_eunuch_trigger = no + is_male = yes + age < 12 + } + add_trait = beardless_eunuch + } + 1 = { + trigger = { NOT = { has_trait = blind } } + add_trait = blind + } + 1 = { + trigger = { + NOR = { + has_trait = intellect_bad + has_trait = dull + has_trait = shrewd + } + } + add_trait = shrewd + } + 1 = { + trigger = { + NOR = { + has_trait = weak + has_trait = physique_bad + has_trait = strong + } + } + add_trait = strong + } + 1 = { + trigger = { + NOT = { + has_trait = loyal + } + } + add_trait = loyal + } + 1 = { + trigger = { + NOT = { + has_trait = disloyal + } + } + add_trait = disloyal + } + } + } + + # GET LOYAL/DISLOYAL + 10 = { + trigger = { + culture = { + has_cultural_parameter = loyal_trait_more_common + } + NOT = { has_trait = loyal } + } + add_trait = loyal + } + 10 = { + trigger = { + culture = { + has_cultural_parameter = disloyal_trait_more_common + } + NOT = { has_trait = disloyal } + } + add_trait = disloyal + } + + # GET A SECRET + 30 = { + trigger = { + NOT = { any_secret = { always = yes } } + } + + courtier_guest_pool_character_secret_giving_effect = yes + } + + # Learn a language + 30 = { + trigger = { + exists = location.county.culture + learning >= 8 + num_of_known_languages < language_soft_cap + NOT = { + knows_language_of_culture = location.county.culture + } + } + learn_language_of_culture = location.county.culture + } + } #RANDOM_LIST ENDS HERE + + # Certain characters learn languages very often + random = { + chance = { + value = 70 + if = { + limit = { + has_trait = scholar + } + add = -50 + } + } + if = { + limit = { + culture = { + has_cultural_parameter = wanderers_learn_languages + } + num_of_known_languages < language_soft_cap + exists = location.county.culture + NOT = { + knows_language_of_culture = location.county.culture + } + } + learn_language_of_culture = location.county.culture + } + } + + random = { + chance = 20 + # Cultural Traditions + if = { # blademaster_traits_more_common + limit = { + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:pool_character } + culture = { + has_cultural_parameter = blademaster_traits_more_common + } + } + blademaster_lifestyle_rank_up_effect = yes + } + } + random = { + chance = 80 + if = { # wanderers_gain_extra_combat_skills + limit = { + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:pool_character } + culture = { + has_cultural_parameter = wanderers_gain_extra_combat_skills + } + } + random_list = { + 10 = { + blademaster_lifestyle_rank_up_effect = yes + } + 10 = { + wanderer_give_random_commander_trait_effect = yes + } + 20 = { + add_prowess_skill = 1 + } + 10 = { + add_prowess_skill = 2 + } + 20 = { + add_martial_skill = 1 + } + 10 = { + add_martial_skill = 2 + } + } + } + } + if = { # wanderers_gain_extra_economic_skills + limit = { + culture = { + has_cultural_parameter = wanderers_gain_extra_economic_skills + } + } + random_list = { + 20 = { + wanderer_give_random_economic_trait_effect = yes + } + 30 = { + add_stewardship_skill = 1 + } + 10 = { + add_stewardship_skill = 2 + } + 40 = { + add_gold = 50 + } + } + } + + + # Cultural Traditions + random = { + chance = 10 + if = { + limit = { + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:pool_character } + has_education_martial_trigger = yes + culture = { + has_cultural_parameter = winter_soldier_trait_more_common + } + NOT = { + has_trait = winter_soldier + } + } + add_trait = winter_soldier + } + } + random = { + chance = 10 + if = { + limit = { + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:pool_character } + has_education_martial_trigger = yes + culture = { + has_cultural_parameter = forest_fighter_trait_more_common + } + NOT = { + has_trait = forest_fighter + } + } + add_trait = forest_fighter + } + } + random = { + chance = 10 + if = { + limit = { + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:pool_character } + has_education_martial_trigger = yes + culture = { + has_cultural_parameter = rough_terrain_expert_trait_more_common + } + NOT = { + has_trait = rough_terrain_expert + } + } + add_trait = rough_terrain_expert + } + } + random = { + chance = 10 + if = { + limit = { + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:pool_character } + has_education_martial_trigger = yes + culture = { + has_cultural_parameter = desert_warrior_trait_more_common + } + NOT = { + has_trait = desert_warrior + } + } + add_trait = desert_warrior + } + } + random = { + chance = 10 + if = { + limit = { + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:pool_character } + has_education_martial_trigger = yes + culture = { + has_cultural_parameter = jungle_stalker_trait_more_common + } + NOT = { + has_trait = jungle_stalker + } + } + add_trait = jungle_stalker + } + } +} + +purge_excess_wanderer_riches_effect = { + # Spend any excess gold to avoid having ultra-rich characters floating around + save_scope_as = pool_character + while = { + limit = { + gold >= 1000 + NOT = { + any_player = { + dynasty ?= scope:pool_character.dynasty + } + } + is_ruler = no + } + random_list = { + 100 = { # Spend gold on getting a friend + trigger = { + ai_sociability > low_negative_ai_value + NOR = { + has_trait = shy + has_trait = reclusive + } + exists = scope:pool_character.location + any_pool_character = { + province = scope:pool_character.location + is_physically_able_adult = yes + this != scope:pool_character + NOT = { has_any_scripted_relation = scope:pool_character } + } + } + random_pool_character = { + province = scope:pool_character.location + limit = { + is_physically_able_adult = yes + this != scope:pool_character + NOT = { has_any_scripted_relation = scope:pool_character } + } + save_temporary_scope_as = new_friend + } + add_prestige = major_prestige_value + set_random_friendship_reason = { TARGET = scope:new_friend } + pay_short_term_gold = { + target = scope:new_friend + gold = 500 + } + } + + 150 = { # Spend gold on for religious purposes + trigger = { + ai_zeal >= medium_positive_ai_value + learning < 30 + } + add_learning_skill = 3 + add_piety = major_piety_value + remove_short_term_gold = 500 + } + + 200 = { # Spend gold on gaining prestige and training prowess! + trigger = { + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:pool_character } + prowess < 30 + } + knight_increase_prowess_chance_effect = yes + add_prestige = major_prestige_value + remove_short_term_gold = 500 + } + + 100 = { # Spend gold on gaining prestige and skill! + trigger = { + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:pool_character } + martial < 25 + } + add_martial_skill = 2 + add_prestige = major_prestige_value + remove_short_term_gold = 500 + } + + 100 = { # Spend gold on gaining prestige and skill! + trigger = { + intrigue < 25 + } + add_intrigue_skill = 3 + add_prestige = major_prestige_value + remove_short_term_gold = 500 + } + + 100 = { # Spend gold on gaining prestige and skill! + trigger = { + stewardship < 25 + } + add_stewardship_skill = 3 + add_prestige = major_prestige_value + remove_short_term_gold = 500 + } + + 100 = { # Spend gold on gaining prestige and skill! + trigger = { + diplomacy < 25 + } + add_diplomacy_skill = 3 + add_prestige = major_prestige_value + remove_short_term_gold = 500 + } + + 100 = { # Lavish wedding! + trigger = { + age <= 40 + is_married = no + is_concubine = no + #The triggers below are here to avoid low fertility marriages + OR = { + has_sexuality = heterosexual + has_sexuality = bisexual + allowed_to_marry_same_sex_trigger = yes + } + NOR = { + has_trait = celibate + has_trait = chaste + } + fertility > low_fertility + can_marry_trigger = yes + } + + save_temporary_scope_as = template + + if = { + limit = { + exists = scope:pool_character.location + any_pool_character = { + province = scope:pool_character.location + allowed_to_marry_character_gender_trigger = { CHARACTER = scope:pool_character } + is_physically_able_adult = yes + age <= 40 + is_married = no + can_marry_trigger = yes + is_concubine = no + is_attracted_to_gender_of = scope:pool_character + } + } + random_pool_character = { + province = scope:pool_character.location + limit = { + allowed_to_marry_character_gender_trigger = { CHARACTER = scope:pool_character } + is_physically_able_adult = yes + age <= 40 + is_married = no + can_marry_trigger = yes + is_concubine = no + is_attracted_to_gender_of = scope:pool_character + } + save_temporary_scope_as = spouse + } + } + else = { + create_character = { + location = scope:template.location + gender_female_chance = scope:template.marriage_gender_adjusted_female_chance + template = mediocre_spouse + save_temporary_scope_as = spouse + } + } + + + marry = scope:spouse + + scope:spouse = { + if = { + limit = { + exists = scope:template.host + } + visit_court_of = scope:template.host + } + } + remove_short_term_gold = 500 + } + 500 = { # Become an adventurer! + trigger = { + has_dlc_feature = roads_to_power + gold >= 500 + is_physically_able_adult = yes + exists = location.county + ai_can_valid_to_create_laamp_trigger = yes + } + create_landless_adventurer_title_effect = { + REASON = flag:voluntary + FLAVOR_CHAR = root + } + if = { + limit = { + NOT = { + exists = global_var:pool_adventurer_spawn + } + } + set_global_variable = { + name = pool_adventurer_spawn + value = 1 + } + } + else = { + change_global_variable = { + name = pool_adventurer_spawn + add = 1 + } + } + } + 500 = { # Just waste the gold on nonsense + add_prestige = minor_prestige_value + remove_short_term_gold = 500 + } + } + } +} + +wanderer_give_random_commander_trait_effect = { + random_list = { + 100 = { + trigger = { NOT = { has_trait = logistician } } + add_trait = logistician + } + 100 = { + trigger = { NOT = { has_trait = military_engineer } } + add_trait = military_engineer + } + 100 = { + trigger = { NOT = { has_trait = aggressive_attacker } } + add_trait = aggressive_attacker + } + 100 = { + trigger = { NOT = { has_trait = unyielding_defender } } + add_trait = unyielding_defender + } + 100 = { + trigger = { NOT = { has_trait = forder } } + add_trait = forder + } + 100 = { + trigger = { NOT = { has_trait = flexible_leader } } + add_trait = flexible_leader + } + 100 = { + trigger = { + NOT = { has_trait = desert_warrior } + location = { + terrain = desert + } + } + add_trait = desert_warrior + } + 100 = { + trigger = { + NOT = { has_trait = jungle_stalker } + location = { + terrain = jungle + } + } + add_trait = jungle_stalker + } + 100 = { + trigger = { + NOT = { has_trait = winter_soldier } + location = { + OR = { + terrain = taiga + geographical_region = world_tibet + geographical_region = world_europe_north + geographical_region = world_europe_east + geographical_region = world_steppe + } + } + } + add_trait = winter_soldier + } + 100 = { + trigger = { NOT = { has_trait = reaver } } + add_trait = reaver + } + 100 = { + trigger = { NOT = { has_trait = reckless } } + add_trait = reckless + } + 100 = { + trigger = { NOT = { has_trait = holy_warrior } } + add_trait = holy_warrior + } + } +} + +wanderer_give_random_economic_trait_effect = { + random_list = { + 100 = { + trigger = { NOT = { has_trait = architect } } + add_trait = architect + } + 100 = { + trigger = { NOT = { has_trait = administrator } } + add_trait = administrator + } + 100 = { + trigger = { NOT = { has_trait = avaricious } } + add_trait = avaricious + } + 100 = { + trigger = { NOT = { has_trait = lifestyle_gardener } } + add_trait = lifestyle_gardener + } + } +} diff --git a/N3OW/common/scripted_effects/00_culture_effects.txt b/N3OW/common/scripted_effects/00_culture_effects.txt new file mode 100644 index 00000000..55757554 --- /dev/null +++ b/N3OW/common/scripted_effects/00_culture_effects.txt @@ -0,0 +1,1309 @@ + +convert_county_and_holder_if_in_region_effect = { + if = { + # If this county is of the old culture and is in the designated region, flip it to the new culture. + limit = { + culture = $OLD_CULTURE$ + title_province = { + geographical_region = $REGION$ + } + } + set_county_culture = $NEW_CULTURE$ + + # If the holder is also of the old culture, and their capital is in the designated region, we flip them along with the county. + holder = { + if = { + limit = { + culture = $OLD_CULTURE$ + capital_province = { + geographical_region = $REGION$ + } + } + set_culture = $NEW_CULTURE$ + } + } + } +} + +merge_cultures_in_region_effect = { + hidden_effect = { + convert_county_and_holder_if_in_region_effect = { + OLD_CULTURE = $OLD_CULTURE_1$ + NEW_CULTURE = $NEW_CULTURE$ + REGION = $REGION$ + } + convert_county_and_holder_if_in_region_effect = { + OLD_CULTURE = $OLD_CULTURE_2$ + NEW_CULTURE = $NEW_CULTURE$ + REGION = $REGION$ + } + } +} + +convert_player_realm_from_old_culture_to_new_effect = { + # For localization + $OLD_CULTURE$ = { save_scope_as = old_culture } + $NEW_CULTURE$ = { save_scope_as = new_culture } + + custom_tooltip = global_culture.custom.change_culture + hidden_effect = { + # Compile a list of everyone who will flip to the new culture. + every_vassal_or_below = { + limit = { + culture = $OLD_CULTURE$ + } + add_to_list = characters_to_convert + every_courtier = { + limit = { + culture = $OLD_CULTURE$ + } + add_to_list = characters_to_convert + } + } + every_courtier = { + limit = { + culture = $OLD_CULTURE$ + } + add_to_list = characters_to_convert + } + + # Flip the player to the new culture. + set_culture = $NEW_CULTURE$ + add_character_flag = converted_culture_this_lifetime + + # Flip their courtiers/vassals with a custom description. + every_in_list = { + list = characters_to_convert + set_culture = $NEW_CULTURE$ + } + + # Then flip all their counties. + every_sub_realm_county = { + limit = { + culture = $OLD_CULTURE$ + } + set_county_culture = $NEW_CULTURE$ + } + } +} + +merge_cultures_in_player_realm_effect = { + $OLD_CULTURE_1$ = { save_scope_as = old_culture_1 } + $OLD_CULTURE_2$ = { save_scope_as = old_culture_2 } + $NEW_CULTURE$ = { save_scope_as = new_culture } + + custom_tooltip = global_culture.custom_merge_culture + + hidden_effect = { + convert_player_realm_from_old_culture_to_new_effect = { + OLD_CULTURE = scope:old_culture_1 + NEW_CULTURE = scope:new_culture + } + convert_player_realm_from_old_culture_to_new_effect = { + OLD_CULTURE = scope:old_culture_2 + NEW_CULTURE = scope:new_culture + } + } +} + +convert_family_culture_and_notify_vassals_effect = { + # Save the root character as a reference + save_scope_as = converting_character + # Save the old culture as a scope + $OLD_CULTURE$ = { + save_scope_as = old_culture + } + $NEW_CULTURE$ = { + save_scope_as = new_culture + } + $CONVERTER$ = { + save_scope_as = converter + } + # Convert root character and AI close family members + set_culture = scope:new_culture + if = { + limit = { + is_ai = yes + } + add_character_flag = converted_culture_this_lifetime_ai + } + else = { + add_character_flag = converted_culture_this_lifetime + } + + every_close_family_member = { + custom = every_close_family_member_sharing_your_culture + limit = { + OR = { + is_courtier_of = scope:converter + is_vassal_of = scope:converter + } + # Exclude previous generations + NOT = { is_parent_of = root } + NOT = { is_grandparent_of = root } + # Only non-ruler same-culture characters + is_ruler = no + has_culture = scope:old_culture + } + set_culture = scope:new_culture + add_to_temporary_list = notified_of_culture_change + } + every_consort = { + #custom = every_consort_sharing_your_culture + limit = { + is_ruler = no + has_culture = scope:old_culture + NOT = { is_in_list = notified_of_culture_change } + } + set_culture = scope:new_culture + add_to_temporary_list = notified_of_culture_change + } + every_consort = { + limit = { + is_ruler = yes + has_culture = scope:old_culture + NOT = { is_in_list = notified_of_culture_change } + } + custom_description = { + text = decide_on_local_culture_conversion + trigger_event = { + id = culture_conversion.0001 + days = 1 + } + } + } + + # Offer every same-culture vassal a chance to convert + every_vassal = { + custom = every_old_culture_vassal_holding_new_culture_land + limit = { + culture = scope:old_culture + NOT = { is_in_list = notified_of_culture_change } + } + custom_description = { + text = decide_on_local_culture_conversion + trigger_event = { + id = culture_conversion.0001 + days = 1 + } + } + add_to_temporary_list = notified_of_culture_change + } + + # Notifications + hidden_effect = { + every_player = { + limit = { + OR = { + is_consort_of = scope:converting_character + liege ?= scope:converting_character + AND = { + exists = scope:converting_character.liege + this = scope:converting_character.liege + } + } + NOT = { is_in_list = notified_of_culture_change } + } + send_interface_message = { + type = msg_culture_conversion + title = converted_culture_msg_title + custom_tooltip = converted_from_old_culture_to_new_culture_tt + right_icon = scope:converting_character + } + } + } +} + +norse_assimilate_local_traditions_effect = { + # Save the root character as a reference + save_scope_as = converting_character + # Save the old culture as a scope + $OLD_CULTURE$ = { + save_scope_as = old_culture + } + $NEW_CULTURE$ = { + save_scope_as = new_culture + } + $OLD_FAITH$ = { + save_scope_as = old_faith + } + $NEW_FAITH$ = { + save_scope_as = new_faith + } + $CONVERTER$ = { + save_scope_as = converter + } + add_character_modifier = { + modifier = embraced_local_traditions_modifier + } + if = { + limit = { + dynasty ?= { + NOT = { + has_dynasty_modifier = settled_norse_dynasty_modifier + } + } + } + dynasty = { + add_dynasty_modifier = { modifier = settled_norse_dynasty_modifier years = 80 } + } + } + # Convert root character and AI close family members + set_culture = scope:new_culture + if = { + limit = { + NOR = { + scope:old_faith = scope:new_faith + has_trait = zealous + } + } + hidden_effect = { + bastard_to_wild_oat_conversion_assimilation_effect = yes + } + set_character_faith = scope:new_faith + } + if = { + limit = { + is_ai = yes + } + add_character_flag = converted_culture_this_lifetime_ai + } + else = { + add_character_flag = converted_culture_this_lifetime + } + + every_close_family_member = { + custom = every_close_family_member_sharing_your_culture + limit = { + is_courtier_of = scope:converter + # Only non-ruler same-culture characters + has_culture = scope:old_culture + } + set_culture = scope:new_culture + if = { + limit = { + NOR = { + scope:old_faith = scope:new_faith + has_trait = zealous + } + } + hidden_effect = { + bastard_to_wild_oat_conversion_assimilation_effect = yes + } + set_character_faith = scope:new_faith + } + hidden_effect = { + add_character_modifier = { + modifier = embraced_local_traditions_modifier + } + } + add_to_temporary_list = notified_of_culture_change + } + every_consort = { + #custom = every_consort_sharing_your_culture + limit = { + is_ruler = no + has_culture = scope:old_culture + NOT = { is_in_list = notified_of_culture_change } + } + set_culture = scope:new_culture + if = { + limit = { + NOR = { + scope:old_faith = scope:new_faith + has_trait = zealous + } + } + hidden_effect = { + bastard_to_wild_oat_conversion_assimilation_effect = yes + } + set_character_faith = scope:new_faith + } + hidden_effect = { + add_character_modifier = { + modifier = embraced_local_traditions_modifier + } + } + add_to_temporary_list = notified_of_culture_change + } + + # All Norse vassals convert + every_vassal = { + custom = every_norse_vassal + limit = { + culture = scope:old_culture + NOT = { is_in_list = notified_of_culture_change } + } + add_character_modifier = { + modifier = embraced_local_traditions_modifier + } + hidden_effect = { + if = { + limit = { + dynasty ?= { + NOT = { + has_dynasty_modifier = settled_norse_dynasty_modifier + } + } + } + dynasty = { + add_dynasty_modifier = { modifier = settled_norse_dynasty_modifier years = 80 } + } + } + } + set_culture = scope:new_culture + if = { + limit = { + NOR = { + scope:old_faith = scope:new_faith + has_trait = zealous + } + } + hidden_effect = { + bastard_to_wild_oat_conversion_assimilation_effect = yes + } + set_character_faith = scope:new_faith + } + + hidden_effect = { + every_close_family_member = { + limit = { + is_courtier_of = scope:converter + # Only non-ruler same-culture characters + has_culture = scope:old_culture + } + set_culture = scope:new_culture + if = { + limit = { + NOR = { + scope:old_faith = scope:new_faith + has_trait = zealous + } + } + hidden_effect = { + bastard_to_wild_oat_conversion_assimilation_effect = yes + } + set_character_faith = scope:new_faith + } + hidden_effect = { + add_character_modifier = { + modifier = embraced_local_traditions_modifier + } + } + add_to_temporary_list = notified_of_culture_change + } + every_consort = { + limit = { + is_ruler = no + has_culture = scope:old_culture + NOT = { is_in_list = notified_of_culture_change } + } + set_culture = scope:new_culture + if = { + limit = { + NOR = { + scope:old_faith = scope:new_faith + has_trait = zealous + } + } + hidden_effect = { + bastard_to_wild_oat_conversion_assimilation_effect = yes + } + set_character_faith = scope:new_faith + } + hidden_effect = { + add_character_modifier = { + modifier = embraced_local_traditions_modifier + } + } + add_to_temporary_list = notified_of_culture_change + } + } + + add_to_temporary_list = notified_of_culture_change + } + + # Notifications + hidden_effect = { + every_player = { + limit = { + OR = { + is_consort_of = scope:converting_character + liege ?= scope:converting_character + AND = { + exists = scope:converting_character.liege + this = scope:converting_character.liege + } + } + NOT = { is_in_list = notified_of_culture_change } + } + send_interface_message = { + type = msg_culture_conversion + title = converted_culture_msg_title + custom_tooltip = converted_from_old_culture_to_new_culture_tt + right_icon = scope:converting_character + } + } + } +} + +expand_hybrid_culture_from_origin_point = { + every_title_to_title_neighboring_and_across_water_county = { + limit = { + holder.top_liege = $CONVERTEE$.top_liege + save_temporary_scope_as = county_check + $CULTURE$ = { + any_parent_culture = { + this = scope:county_check.culture + } + } + } + + random = { + chance = { + value = 30 + if = { + limit = { + $CULTURE$ = { + any_parent_culture = { + save_temporary_scope_as = first_parent + } + any_parent_culture = { + this != scope:first_parent + cultural_acceptance = { target = scope:first_parent value >= 45 } + } + } + } + add = 5 + } + if = { + limit = { + $CULTURE$ = { + any_parent_culture = { + save_temporary_scope_as = first_parent + } + any_parent_culture = { + this != scope:first_parent + cultural_acceptance = { target = scope:first_parent value >= 50 } + } + } + } + add = 5 + } + if = { + limit = { + $CULTURE$ = { + any_parent_culture = { + save_temporary_scope_as = first_parent + } + any_parent_culture = { + this != scope:first_parent + cultural_acceptance = { target = scope:first_parent value >= 55 } + } + } + } + add = 5 + } + if = { + limit = { + $CULTURE$ = { + any_parent_culture = { + save_temporary_scope_as = first_parent + } + any_parent_culture = { + this != scope:first_parent + cultural_acceptance = { target = scope:first_parent value >= 60 } + } + } + } + add = 5 + } + if = { + limit = { + $CULTURE$ = { + any_parent_culture = { + save_temporary_scope_as = first_parent + } + any_parent_culture = { + this != scope:first_parent + cultural_acceptance = { target = scope:first_parent value >= 65 } + } + } + } + add = 5 + } + if = { + limit = { + $CULTURE$ = { + any_parent_culture = { + save_temporary_scope_as = first_parent + } + any_parent_culture = { + this != scope:first_parent + cultural_acceptance = { target = scope:first_parent value >= 70 } + } + } + } + add = 5 + } + if = { + limit = { + $CULTURE$ = { + any_parent_culture = { + save_temporary_scope_as = first_parent + } + any_parent_culture = { + this != scope:first_parent + cultural_acceptance = { target = scope:first_parent value >= 75 } + } + } + } + add = 5 + } + if = { + limit = { + $CULTURE$ = { + any_parent_culture = { + save_temporary_scope_as = first_parent + } + any_parent_culture = { + this != scope:first_parent + cultural_acceptance = { target = scope:first_parent value >= 80 } + } + } + } + add = 5 + } + if = { + limit = { + $CULTURE$ = { + any_parent_culture = { + save_temporary_scope_as = first_parent + } + any_parent_culture = { + this != scope:first_parent + cultural_acceptance = { target = scope:first_parent value >= 85 } + } + } + } + add = 5 + } + if = { + limit = { + $CULTURE$ = { + any_parent_culture = { + save_temporary_scope_as = first_parent + } + any_parent_culture = { + this != scope:first_parent + cultural_acceptance = { target = scope:first_parent value >= 90 } + } + } + } + add = 5 + } + if = { + limit = { + $CULTURE$ = { + any_parent_culture = { + save_temporary_scope_as = first_parent + } + any_parent_culture = { + this != scope:first_parent + cultural_acceptance = { target = scope:first_parent value >= 95 } + } + } + } + add = 5 + } + if = { + limit = { + $CULTURE$ = { + any_parent_culture = { + save_temporary_scope_as = first_parent + } + any_parent_culture = { + this != scope:first_parent + cultural_acceptance = { target = scope:first_parent value >= 100 } + } + } + } + add = 5 + } + } + set_county_culture = $CULTURE$ + every_title_to_title_neighboring_and_across_water_county = { + limit = { + holder.top_liege = $CONVERTEE$.top_liege + save_temporary_scope_as = county_check + $CULTURE$ = { + any_parent_culture = { + this = scope:county_check.culture + } + } + } + random = { + chance = { + value = 30 + if = { + limit = { + $CULTURE$ = { + any_parent_culture = { + save_temporary_scope_as = first_parent + } + any_parent_culture = { + this != scope:first_parent + cultural_acceptance = { target = scope:first_parent value >= 45 } + } + } + } + add = 5 + } + if = { + limit = { + $CULTURE$ = { + any_parent_culture = { + save_temporary_scope_as = first_parent + } + any_parent_culture = { + this != scope:first_parent + cultural_acceptance = { target = scope:first_parent value >= 50 } + } + } + } + add = 5 + } + if = { + limit = { + $CULTURE$ = { + any_parent_culture = { + save_temporary_scope_as = first_parent + } + any_parent_culture = { + this != scope:first_parent + cultural_acceptance = { target = scope:first_parent value >= 55 } + } + } + } + add = 5 + } + if = { + limit = { + $CULTURE$ = { + any_parent_culture = { + save_temporary_scope_as = first_parent + } + any_parent_culture = { + this != scope:first_parent + cultural_acceptance = { target = scope:first_parent value >= 60 } + } + } + } + add = 5 + } + if = { + limit = { + $CULTURE$ = { + any_parent_culture = { + save_temporary_scope_as = first_parent + } + any_parent_culture = { + this != scope:first_parent + cultural_acceptance = { target = scope:first_parent value >= 65 } + } + } + } + add = 5 + } + if = { + limit = { + $CULTURE$ = { + any_parent_culture = { + save_temporary_scope_as = first_parent + } + any_parent_culture = { + this != scope:first_parent + cultural_acceptance = { target = scope:first_parent value >= 70 } + } + } + } + add = 5 + } + if = { + limit = { + $CULTURE$ = { + any_parent_culture = { + save_temporary_scope_as = first_parent + } + any_parent_culture = { + this != scope:first_parent + cultural_acceptance = { target = scope:first_parent value >= 75 } + } + } + } + add = 5 + } + if = { + limit = { + $CULTURE$ = { + any_parent_culture = { + save_temporary_scope_as = first_parent + } + any_parent_culture = { + this != scope:first_parent + cultural_acceptance = { target = scope:first_parent value >= 80 } + } + } + } + add = 5 + } + if = { + limit = { + $CULTURE$ = { + any_parent_culture = { + save_temporary_scope_as = first_parent + } + any_parent_culture = { + this != scope:first_parent + cultural_acceptance = { target = scope:first_parent value >= 85 } + } + } + } + add = 5 + } + if = { + limit = { + $CULTURE$ = { + any_parent_culture = { + save_temporary_scope_as = first_parent + } + any_parent_culture = { + this != scope:first_parent + cultural_acceptance = { target = scope:first_parent value >= 90 } + } + } + } + add = 5 + } + if = { + limit = { + $CULTURE$ = { + any_parent_culture = { + save_temporary_scope_as = first_parent + } + any_parent_culture = { + this != scope:first_parent + cultural_acceptance = { target = scope:first_parent value >= 95 } + } + } + } + add = 5 + } + if = { + limit = { + $CULTURE$ = { + any_parent_culture = { + save_temporary_scope_as = first_parent + } + any_parent_culture = { + this != scope:first_parent + cultural_acceptance = { target = scope:first_parent value >= 100 } + } + } + } + add = 5 + } + } + set_county_culture = $CULTURE$ + } + } + } + } +} + +new_culture_created_conversion_effect = { + + # Save the hybrid culture for use with ai_will_do down the line + if = { + limit = { + $CULTURE$ = { is_hybrid_culture = yes } + } + add_to_global_variable_list = { name = hybrid_cultures target = $CULTURE$ } + } + + # Convert Counties (if of same culture as recipient's old culture) + $CONVERTEE$ = { + if = { + limit = { + capital_county = { + save_temporary_scope_as = county_check + $CULTURE$ = { + any_parent_culture = { + this = scope:county_check.culture + } + } + } + } + capital_county = { + set_county_culture = $CULTURE$ + expand_hybrid_culture_from_origin_point = { + CONVERTEE = $CONVERTEE$ + CULTURE = $CULTURE$ + } + } + } + else_if = { + limit = { + any_held_title = { + title_tier = county + save_temporary_scope_as = county_check + $CULTURE$ = { + any_parent_culture = { + this = scope:county_check.culture + } + } + } + } + random_held_title = { + title_tier = county + limit = { + save_temporary_scope_as = county_check + $CULTURE$ = { + any_parent_culture = { + this = scope:county_check.culture + } + } + } + set_county_culture = $CULTURE$ + expand_hybrid_culture_from_origin_point = { + CONVERTEE = $CONVERTEE$ + CULTURE = $CULTURE$ + } + } + } + else_if = { + limit = { + any_sub_realm_county = { + save_temporary_scope_as = county_check + $CULTURE$ = { + any_parent_culture = { + this = scope:county_check.culture + } + } + } + } + random_sub_realm_county = { + limit = { + save_temporary_scope_as = county_check + $CULTURE$ = { + any_parent_culture = { + this = scope:county_check.culture + } + } + } + set_county_culture = $CULTURE$ + expand_hybrid_culture_from_origin_point = { + CONVERTEE = $CONVERTEE$ + CULTURE = $CULTURE$ + } + } + } + } + # Spouses convert + $CONVERTEE$ = { + every_spouse = { + limit = { + OR = { + is_courtier_of = $CONVERTER$ + is_courtier_of = $CONVERTEE$ + is_vassal_of = $CONVERTER$ + is_vassal_of = $CONVERTEE$ + } + save_temporary_scope_as = spouse_check + $CULTURE$ = { + any_parent_culture = { + this = scope:spouse_check.culture + } + } + } + if = { + limit = { + exists = domicile.domicile_culture + culture = domicile.domicile_culture + } + domicile = { set_domicile_culture = $CULTURE$ } + } + set_culture = $CULTURE$ + hidden_effect = { + add_character_flag = converted_culture_this_lifetime + } + } + } + # Family in recipient's court also convert + if = { + limit = { + $CONVERTEE$ = { + is_ruler = yes + any_close_or_extended_family_member = { + court_owner ?= $CONVERTEE$ + NOT = { culture = $CULTURE$ } + is_ai = yes + } + } + } + $CONVERTEE$ = { + every_close_or_extended_family_member = { + custom = all_family_members_at_court + limit = { + court_owner ?= $CONVERTEE$ + NOT = { culture = $CULTURE$ } + is_ai = yes + save_temporary_scope_as = family_check + $CULTURE$ = { + any_parent_culture = { + this = scope:family_check.culture + } + } + } + if = { + limit = { + exists = domicile.domicile_culture + culture = domicile.domicile_culture + } + domicile = { set_domicile_culture = $CULTURE$ } + } + set_culture = $CULTURE$ + hidden_effect = { + add_character_flag = converted_culture_this_lifetime + } + } + } + } + # Make sure relevant non-significant characters convert + $CONVERTEE$ = { + hidden_effect = { + every_courtier_or_guest = { + limit = { + NOT = { culture = $CULTURE$ } + is_ai = yes + has_no_particular_noble_roots_trigger = yes + save_temporary_scope_as = family_check + $CULTURE$ = { + any_parent_culture = { + this = scope:family_check.culture + } + } + } + if = { + limit = { + exists = domicile.domicile_culture + culture = domicile.domicile_culture + } + domicile = { set_domicile_culture = $CULTURE$ } + } + set_culture = $CULTURE$ + hidden_effect = { + add_character_flag = converted_culture_this_lifetime + } + } + if = { + limit = { + exists = $CONVERTEE$.capital_province + } + every_pool_character = { + province = $CONVERTEE$.capital_province + limit = { + NOT = { culture = $CULTURE$ } + is_ai = yes + has_no_particular_noble_roots_trigger = yes + save_temporary_scope_as = family_check + $CULTURE$ = { + any_parent_culture = { + this = scope:family_check.culture + } + } + } + if = { + limit = { + exists = domicile.domicile_culture + culture = domicile.domicile_culture + } + domicile = { set_domicile_culture = $CULTURE$ } + } + set_culture = $CULTURE$ + hidden_effect = { + add_character_flag = converted_culture_this_lifetime + } + } + } + } + } + $CONVERTEE$ = { # Clean up culture in the realm for subvassals with a liege of the wrong culture + hidden_effect = { + every_vassal_or_below = { + limit = { + is_playable_character = yes + save_temporary_scope_as = vassal_check + $CULTURE$ = { + any_parent_culture = { + this = scope:vassal_check.culture + } + } + NOT = { + $CULTURE$ = { + any_parent_culture = { + this = scope:vassal_check.liege.culture + } + } + } + } + save_scope_as = vassal_converting + new_culture_created_vassal_conversion_effect = { + CONVERTEE = scope:vassal_converting + CONVERTER = $CONVERTER$ + CULTURE = $CULTURE$ + } + } + #every_sub_realm_county = { + # limit = { + # save_temporary_scope_as = county_check + # $CULTURE$ = { + # any_parent_culture = { + # this = scope:county_check.culture + # } + # } + # NOT = { + # $CULTURE$ = { + # any_parent_culture = { + # this = scope:county_check.holder.culture + # } + # } + # } + # } + # set_county_culture = $CULTURE$ + #} + } + } + $CONVERTEE$ = { + if = { + limit = { + exists = domicile.domicile_culture + culture = domicile.domicile_culture + } + domicile = { set_domicile_culture = $CULTURE$ } + } + set_culture = $CULTURE$ + hidden_effect = { + add_character_flag = converted_culture_this_lifetime + } + } +} + +new_culture_created_vassal_conversion_effect = { + + # Save the hybrid culture for use with ai_will_do down the line + if = { + limit = { + $CULTURE$ = { is_hybrid_culture = yes } + NOT = { + any_in_global_list = { + variable = hybrid_cultures + this = $CULTURE$ + } + } + } + add_to_global_variable_list = { name = hybrid_cultures target = $CULTURE$ } + } + + # Convert Counties (if of same culture as recipient's old culture) + $CONVERTEE$ = { + #every_held_title = { + # title_tier = county + # limit = { + # save_temporary_scope_as = county_check + # $CULTURE$ = { + # any_parent_culture = { + # this = scope:county_check.culture + # } + # } + # } + # set_county_culture = $CULTURE$ + #} + } + # Spouses convert + $CONVERTEE$ = { + every_spouse = { + limit = { + OR = { + is_courtier_of = $CONVERTER$ + is_courtier_of = $CONVERTEE$ + is_vassal_of = $CONVERTER$ + is_vassal_of = $CONVERTEE$ + } + save_temporary_scope_as = spouse_check + $CULTURE$ = { + any_parent_culture = { + this = scope:spouse_check.culture + } + } + } + if = { + limit = { + exists = domicile.domicile_culture + culture = domicile.domicile_culture + } + domicile = { set_domicile_culture = $CULTURE$ } + } + set_culture = $CULTURE$ + hidden_effect = { + add_character_flag = converted_culture_this_lifetime + } + } + } + # Family in recipient's court also convert + if = { + limit = { + $CONVERTEE$ = { + is_ruler = yes + any_close_or_extended_family_member = { + court_owner ?= $CONVERTEE$ + NOT = { culture = $CULTURE$ } + is_ai = yes + } + } + } + $CONVERTEE$ = { + every_close_or_extended_family_member = { + custom = all_family_members_at_court + limit = { + court_owner ?= $CONVERTEE$ + NOT = { culture = $CULTURE$ } + is_ai = yes + save_temporary_scope_as = family_check + $CULTURE$ = { + any_parent_culture = { + this = scope:family_check.culture + } + } + } + if = { + limit = { + exists = domicile.domicile_culture + culture = domicile.domicile_culture + } + domicile = { set_domicile_culture = $CULTURE$ } + } + set_culture = $CULTURE$ + hidden_effect = { + add_character_flag = converted_culture_this_lifetime + } + } + } + } + + # Make sure relevant non-significant characters convert + $CONVERTEE$ = { + hidden_effect = { + every_courtier_or_guest = { + limit = { + NOT = { culture = $CULTURE$ } + is_ai = yes + has_no_particular_noble_roots_trigger = yes + save_temporary_scope_as = family_check + $CULTURE$ = { + any_parent_culture = { + this = scope:family_check.culture + } + } + } + if = { + limit = { + exists = domicile.domicile_culture + culture = domicile.domicile_culture + } + domicile = { set_domicile_culture = $CULTURE$ } + } + set_culture = $CULTURE$ + hidden_effect = { + add_character_flag = converted_culture_this_lifetime + } + } + if = { + limit = { + exists = $CONVERTEE$.capital_province + } + every_pool_character = { + province = $CONVERTEE$.capital_province + limit = { + NOT = { culture = $CULTURE$ } + is_ai = yes + has_no_particular_noble_roots_trigger = yes + save_temporary_scope_as = family_check + $CULTURE$ = { + any_parent_culture = { + this = scope:family_check.culture + } + } + } + if = { + limit = { + exists = domicile.domicile_culture + culture = domicile.domicile_culture + } + domicile = { set_domicile_culture = $CULTURE$ } + } + set_culture = $CULTURE$ + hidden_effect = { + add_character_flag = converted_culture_this_lifetime + } + } + } + } + } + $CONVERTEE$ = { + if = { + limit = { + exists = domicile.domicile_culture + culture = domicile.domicile_culture + } + domicile = { set_domicile_culture = $CULTURE$ } + } + set_culture = $CULTURE$ + hidden_effect = { + add_character_flag = converted_culture_this_lifetime + } + } + + $CONVERTEE$ = { + every_vassal = { + limit = { + is_playable_character = yes + is_ai = yes + save_temporary_scope_as = vassal_check + $CULTURE$ = { + any_parent_culture = { + this = scope:vassal_check.culture + } + } + } + + run_interaction = { + interaction = request_culture_conversion_interaction + actor = $CONVERTEE$ + recipient = this + execute_threshold = accept + } + } + } +} + +inspired_by_tradition_effect = { + save_scope_as = tradition_scope + custom_tooltip = inspire_by_culture_tt + $CHARACTER$ = { + add_to_variable_list = { + name = culture_tradition_reduction + target = prev + } + } +} diff --git a/N3OW/common/scripted_effects/00_custom_loc_effects.txt b/N3OW/common/scripted_effects/00_custom_loc_effects.txt new file mode 100644 index 00000000..9346f5e1 --- /dev/null +++ b/N3OW/common/scripted_effects/00_custom_loc_effects.txt @@ -0,0 +1,122 @@ +#Custom Loc scripted effects +# all date calculations are done in DAYS +# to be run in the root character scope +get_period_of_time_word_setup_effect = { + set_variable = { + name = start_date + value = $START_DATE$ + } + set_variable = { + name = current_date + value = current_date + } + set_variable = { + name = period_of_time + value = { + value = var:current_date + subtract = var:start_date + } + } +} + +# To be called in the after block of the event where this is used so the variables get cleaned up +clean_up_period_of_time_word_effect = { + remove_variable = start_date + remove_variable = current_date + remove_variable = period_of_time +} + +set_raunchy_compliment_noun_effect = { + random_list = { + #Vixen + 10 = { + trigger = { is_female = yes } + set_variable = { + name = raunchy_compliment_noun + value = flag:vixen + days = 5 + } + } + #Minx + 10 = { + trigger = { is_female = yes } + set_variable = { + name = raunchy_compliment_noun + value = flag:minx + days = 5 + } + } + #Temptress + 10 = { + trigger = { is_female = yes } + set_variable = { + name = raunchy_compliment_noun + value = flag:temptress + days = 5 + } + } + #Siren + 10 = { + trigger = { is_female = yes } + set_variable = { + name = raunchy_compliment_noun + value = flag:siren + days = 5 + } + } + #Enchantress + 10 = { + trigger = { is_female = yes } + set_variable = { + name = raunchy_compliment_noun + value = flag:enchantress + days = 5 + } + } + #Lion + 10 = { + trigger = { is_male = yes } + set_variable = { + name = raunchy_compliment_noun + value = flag:lion + days = 5 + } + } + #Stallion + 10 = { + trigger = { is_male = yes } + set_variable = { + name = raunchy_compliment_noun + value = flag:stallion + days = 5 + } + } + #Stag + 10 = { + trigger = { is_male = yes } + set_variable = { + name = raunchy_compliment_noun + value = flag:stag + days = 5 + } + } + #Beast + 10 = { + trigger = { is_male = yes } + set_variable = { + name = raunchy_compliment_noun + value = flag:beast + days = 5 + } + } + #Stud + 10 = { + trigger = { is_male = yes } + set_variable = { + name = raunchy_compliment_noun + value = flag:stud + days = 5 + } + } + } +} \ No newline at end of file diff --git a/N3OW/common/scripted_effects/00_death_management_effects.txt b/N3OW/common/scripted_effects/00_death_management_effects.txt new file mode 100644 index 00000000..6efa7732 --- /dev/null +++ b/N3OW/common/scripted_effects/00_death_management_effects.txt @@ -0,0 +1,119 @@ +add_death_event_blocker_effect = { + set_variable = { + name = block_death_event_from + value = $DEAD$ + days = 3 + } + #If we get timed variables in list: +# add_to_variable_list = { +# name = block_death_event_from +# target = $DEAD$ +# days = 3 +# } +} + +silent_disappearance_effect = { + hidden_effect = { + if = { + limit = { is_alive = yes } + + death = { + death_reason = death_disappearance + } + } + } +} + +silent_disappearance_ai_effect = { + hidden_effect = { + if = { + limit = { + is_alive = yes + root = { is_ai = yes } + } + + death = { + death_reason = death_disappearance + } + } + } +} + +silent_disappearance_ai_if_created_effect = { + hidden_effect = { + if = { + limit = { + is_alive = yes + root = { is_ai = yes } + has_character_flag = created + } + + death = { + death_reason = death_disappearance + } + } + } +} + +silent_disappear_ai_if_not_hired = { + hidden_effect = { + if = { + limit = { + is_alive = yes + root = { is_ai = yes } + employer != root + } + + death = { + death_reason = death_disappearance + } + } + else_if = { + limit = { + is_alive = yes + employer != root + } + move_to_pool = yes + } + } +} + +silent_disappear_ai_if_not_hired_with_flag = { + hidden_effect = { + if = { + limit = { + is_alive = yes + root = { is_ai = yes } + employer != root + has_character_flag = created + } + + death = { + death_reason = death_disappearance + } + } + else_if = { + limit = { + is_alive = yes + employer != root + has_character_flag = created + } + move_to_pool = yes + } + } +} + +save_died_in_battle_variables_effect = { + set_variable = { + name = battle_death_enemy + value = $ENEMY$ + } + set_variable = { + name = battle_death_leader + value = $LEADER$ + } + set_variable = { + name = battle_death_location + value = $LOCATION$ + } +} diff --git a/N3OW/common/scripted_effects/00_debug_and_shortcut_effects.txt b/N3OW/common/scripted_effects/00_debug_and_shortcut_effects.txt new file mode 100644 index 00000000..3016cc75 --- /dev/null +++ b/N3OW/common/scripted_effects/00_debug_and_shortcut_effects.txt @@ -0,0 +1,72 @@ +################################################## +# Shortcuts +################################################## + +# Easily set-or-add to a variable. +increment_variable_effect = { + if = { + limit = { + NOT = { exists = var:$VAR$ } + } + set_variable = { + name = $VAR$ + value = $VAL$ + } + } + else = { + change_variable = { + name = $VAR$ + add = $VAL$ + } + } +} + +increment_variable_remove_at_zero_effect = { + if = { + limit = { exists = var:$VAR$ } + change_variable = { + name = $VAR$ + add = $VALUE$ + } + if = { + limit = { var:$VAR$ <= 0 } + remove_variable = $VAR$ + } + } +} + +# Easily set-or-add to a _global_ variable - generally only for use in logging. +increment_global_variable_effect = { + if = { + limit = { + NOT = { exists = global_var:$VAR$ } + } + set_global_variable = { + name = $VAR$ + value = $VAL$ + } + } + else = { + change_global_variable = { + name = $VAR$ + add = $VAL$ + } + } +} + +################################################## +# Debug +################################################## + +log_debug_variable_for_persian_struggle_effect = { + if = { + limit = { + gather_debug_variables_for_persian_struggle_trigger = yes + is_struggle_type = persian_struggle + } + increment_global_variable_effect = { + VAR = sp_$VAR$ + VAL = 1 + } + } +} diff --git a/N3OW/common/scripted_effects/00_decisions_effects.txt b/N3OW/common/scripted_effects/00_decisions_effects.txt new file mode 100644 index 00000000..87fb7242 --- /dev/null +++ b/N3OW/common/scripted_effects/00_decisions_effects.txt @@ -0,0 +1,3444 @@ +reclaim_britannia_decision_effect = { + every_sub_realm_county = { + limit = { + NOR = { + culture = { has_cultural_pillar = heritage_goidelic } + culture = { has_cultural_pillar = heritage_brythonic } + } + title_province = { geographical_region = world_europe_west_britannia } + } + custom = british_isles.0001.custom + add_county_modifier = { + modifier = reclaim_britannia_culture_modifier + days = 3650 + } + } + capital_county = { + set_county_culture = root.culture + } + if = { + limit = { + culture = { has_cultural_pillar = heritage_goidelic } + } + give_nickname = nick_the_tuatha_de_danann + } + else = { + give_nickname = nick_pendragon + } +} + +restore_the_danelaw_effect = { + hidden_effect = { #Should shift all dejure of all Empires owned at the time. + title:k_england = { + every_in_de_jure_hierarchy = { + limit = { tier = tier_duchy } + set_de_jure_liege_title = title:k_danelaw + } + } + title:k_danelaw = { + set_de_jure_liege_title = title:k_england.de_jure_liege + } + } + give_nickname = nick_the_dane + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + title:k_danelaw = { + change_title_holder = { + holder = root + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + title:k_danelaw = { + add_title_law = scandinavian_elective_succession_law + } + + if = { + limit = { + NOT = { highest_held_title_tier = tier_empire } + NOT = { has_primary_title = title:k_danelaw } + } + set_primary_title_to = title:k_danelaw + } + + #Destroy england + destroy_title = title:k_england +} + +create_holy_order_effect = { + hidden_effect = { + if = { # set up currencies for the HO leader, has to be saved as scope:leader + limit = { + exists = scope:leader + } + scope:leader = { + add_gold = 100 #So that they have some money to lend out + add_piety_level = 2 + add_gold = holy_order_starting_gold + every_courtier = { + add_trait = order_member + } + } + + # send messages + send_interface_toast = { + type = holy_order_founded_message + desc = i_created_holy_order_message + left_icon = scope:leader + right_icon = scope:new_holy_order.title + } + } + # send messages to relevant characters that HO got created + save_scope_as = holy_order_creator + every_player = { + limit = { + faith = scope:holy_order_creator.faith + this != scope:holy_order_creator + } + send_interface_message = { + type = holy_order_founded_message + desc = someone_created_holy_order_message + left_icon = scope:holy_order_creator + right_icon = scope:new_holy_order.title + } + } + every_neighboring_top_liege_realm_owner = { + limit = { + faith != scope:holy_order_creator.faith + } + send_interface_message = { + type = enemy_holy_order_founded_message + desc = other_faith_neighbor_created_holy_order_message + left_icon = scope:holy_order_creator + right_icon = scope:new_holy_order.title + } + } + # get the achievements for creating a HO + add_achievement_flag_effect = { FLAG = achievement_non_nobis_domine_flag } + if = { + limit = { exists = global_var:started_give_a_dog_a_bone_achievement } + add_achievement_global_variable_effect = { + VARIABLE = holy_order_give_a_dog_a_bone_achievement + VALUE = yes + } + } + } + # gain opinion with your HoF, if you have one and it's not you + if = { + limit = { + exists = faith.religious_head + faith.religious_head != root + } + faith.religious_head = { + add_opinion = { + target = root + modifier = founded_holy_order_opinion + } + } + } + # get a nice modifier + if = { + limit = { + NOT = { has_character_modifier = founded_holy_order_modifier } + } + add_character_modifier = { + modifier = founded_holy_order_modifier + years = 5 + } + } + # and boost the fervor + faith = { + change_fervor = { + value = 10 + desc = fervor_gain_holy_order_founded + } + } +} + +embrace_english_culture_effect = { + # Scopes saves for localization + root = { + save_scope_as = embracer + } + + # Prestige Bonus + add_prestige = medium_prestige_gain + + #Convert your, and your whole family's, culture + set_culture = culture:english + if = { + limit = { any_spouse = { is_playable_character = no } } + every_spouse = { + limit = { + is_playable_character = no + OR = { + culture = culture:norman + culture = culture:french + } + } + set_culture = culture:english + } + } + if = { + limit = { + any_close_family_member = { + is_playable_character = no + NOT = { is_spouse_of = root } + } + } + every_close_family_member = { + limit = { + is_playable_character = no + NOT = { is_spouse_of = root } + } + custom = all_unlanded_family_members + set_culture = culture:english + } + } + if = { + limit = { + any_child = { + NOT = { is_spouse_of = root } + } + } + every_child = { + limit = { + NOT = { is_spouse_of = root } + } + custom = all_children_custom + set_culture = culture:english + } + } + + #Convert appropriate vassals, and their family + if = { + limit = { + any_vassal_or_below = { + is_ai = yes + OR = { + culture = culture:norman + culture = culture:french + } + primary_title = { + OR = { + de_jure_liege = title:k_england + de_jure_liege.de_jure_liege = title:k_england + de_jure_liege.de_jure_liege.de_jure_liege = title:k_england + } + } + } + } + every_vassal_or_below = { + custom = embrace_english_culture_vassals_custom + limit = { + is_ai = yes + OR = { + culture = culture:norman + culture = culture:french + } + primary_title = { + OR = { + de_jure_liege = title:k_england + de_jure_liege.de_jure_liege = title:k_england + de_jure_liege.de_jure_liege.de_jure_liege = title:k_england + } + } + } + set_culture = culture:english + hidden_effect = { + if = { + limit = { any_spouse = { is_playable_character = no } } + every_spouse = { + limit = { + is_playable_character = no + OR = { + culture = culture:norman + culture = culture:french + } + } + set_culture = culture:english + } + } + if = { + limit = { + any_close_family_member = { + is_playable_character = no + NOT = { is_spouse_of = prev } + } + } + every_close_family_member = { + limit = { + is_playable_character = no + NOT = { is_spouse_of = prev } + } + custom = all_unlanded_family_members + set_culture = culture:english + } + } + if = { + limit = { + any_child = { + NOT = { is_spouse_of = prev } + } + } + every_child = { + limit = { + NOT = { is_spouse_of = prev } + } + custom = all_children_custom + set_culture = culture:english + } + } + if = { + limit = { + any_vassal_or_below = { + is_ai = yes + OR = { + culture = culture:norman + culture = culture:french + } + primary_title = { + OR = { + de_jure_liege = title:k_england + de_jure_liege.de_jure_liege = title:k_england + de_jure_liege.de_jure_liege.de_jure_liege = title:k_england + } + } + } + } + every_vassal_or_below = { + custom = embrace_english_culture_vassals_custom + limit = { + is_ai = yes + OR = { + culture = culture:norman + culture = culture:french + } + primary_title = { + OR = { + de_jure_liege = title:k_england + de_jure_liege.de_jure_liege = title:k_england + de_jure_liege.de_jure_liege.de_jure_liege = title:k_england + } + } + } + set_culture = culture:english + hidden_effect = { + if = { + limit = { any_spouse = { is_playable_character = no } } + every_spouse = { + limit = { + is_playable_character = no + OR = { + culture = culture:norman + culture = culture:french + } + } + set_culture = culture:english + } + } + if = { + limit = { + any_close_family_member = { + is_playable_character = no + NOT = { is_spouse_of = prev } + } + } + every_close_family_member = { + limit = { + is_playable_character = no + NOT = { is_spouse_of = prev } + } + custom = all_unlanded_family_members + set_culture = culture:english + } + } + if = { + limit = { + any_child = { + NOT = { is_spouse_of = prev } + } + } + every_child = { + limit = { + NOT = { is_spouse_of = prev } + } + custom = all_children_custom + set_culture = culture:english + } + } + } + } + } + } + } + } + + #Flip Counties + every_county_in_region = { + region = custom_england + custom = embrace_english_culture_counties_custom + limit = { + target_is_de_facto_liege_or_above = root.primary_title + } + random = { + chance = 40 + set_county_culture = culture:english + } + } + + culture:english = { + custom_tooltip = decision_embrace_english_culture_get_innovations + hidden_effect = { + reset_culture_creation_date = yes + get_all_innovations_from = culture:norman + get_all_innovations_from = culture:anglo_saxon + } + } + + remove_global_variable = harrying_of_the_north + every_player = { + limit = { + capital_province = { + geographical_region = world_europe_west_britannia + } + } + trigger_event = ep3_story_cycle_harrying.0004 + } + global_var:harrying_of_the_north = { end_story = yes } +} + +form_portugal_decision_effects = { + #Create the title and set proper de jure + hidden_effect = { + title:d_porto = { + save_scope_as = title_d_porto + set_de_jure_liege_title = title:k_portugal + } + title:d_coimbra = { + save_scope_as = title_d_coimbra + set_de_jure_liege_title = title:k_portugal + } + title:d_beja = { + save_scope_as = title_d_beja + set_de_jure_liege_title = title:k_portugal + } + title:d_algarve = { + save_scope_as = title_d_algarve + set_de_jure_liege_title = title:k_portugal + } + title:k_portugal = { + save_scope_as = title_k_portugal + } + } + custom_tooltip = form_portugal_decision_effects_de_jure_tt + + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:k_portugal = { + change_title_holder = { + holder = root + change = scope:title_change + } + save_scope_as = title_k_portugal + } + resolve_title_and_vassal_change = scope:title_change + + if = { + limit = { + NOR = { + primary_title = { this = title:k_portugal } + highest_held_title_tier = tier_empire + } + } + set_primary_title_to = title:k_portugal + } + + hidden_effect = { + if = { + limit = { has_global_variable = fp2_struggle_compromise_ending } + title:k_portugal = { fp2_struggle_compromise_create_new_empire_effect = yes } + } + } + + #Covert self & court to portuguese culture + if = { + limit = { NOT = { has_culture = culture:portuguese } } + + every_courtier = { + limit = { has_same_culture_as = scope:portugal_former } + add_to_list = convert_list + } + #transfer over innovations from previous culture. + culture:portuguese = { + hidden_effect = { reset_culture_creation_date = yes } + get_all_innovations_from = scope:portugal_former.culture + } + set_culture = culture:portuguese + + every_in_list = { + list = convert_list + custom = portguese_convert_list #This says "every subject in the realm" even though vassals and their courts only covert later, through event + set_culture = culture:portuguese + } + } + + # Convert Iberian counties to Portugese culture + every_sub_realm_county = { + limit = { + tier = tier_county + culture = { has_cultural_pillar = heritage_iberian } + OR = { + de_jure_liege = title:d_porto + de_jure_liege = title:d_coimbra + de_jure_liege = title:d_beja + de_jure_liege = title:d_algarve + } + } + custom = portugese_convert_iberian_counties + set_county_culture = culture:portuguese + } + every_sub_realm_county = { + limit = { + tier = tier_county + NOT = { culture = { has_cultural_pillar = heritage_iberian } } + OR = { + de_jure_liege = title:d_porto + de_jure_liege = title:d_coimbra + de_jure_liege = title:d_beja + de_jure_liege = title:d_algarve + } + } + custom = portugese_convert_non_iberian_counties + random = { + chance = 50 + set_county_culture = culture:portuguese + } + } + + #Innovations + culture:portuguese = { + add_random_innovation = culture_group_military + add_random_innovation = culture_group_civic + } + + #Prestige + add_prestige = massive_prestige_gain +} + + +declare_canarias_decision_effects = { + #Create the title and set proper de jure + title:d_canarias = { + save_scope_as = d_canarias + set_de_jure_liege_title = title:k_canarias + } + title:k_canarias = { + save_scope_as = title_k_canarias + } + + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:k_canarias = { + change_title_holder = { + holder = root + change = scope:title_change + } + save_scope_as = title_k_canarias + } + resolve_title_and_vassal_change = scope:title_change + + if = { + limit = { + NOR = { + primary_title = { this = title:k_canarias } + highest_held_title_tier = tier_empire + } + } + set_primary_title_to = title:k_canarias + } + + #Prestige + add_prestige = massive_prestige_gain +} + + + +unite_the_spanish_thrones_decision_effects = { + #Prestige + add_prestige = massive_prestige_gain + + #Laws + if = { + limit = { has_realm_law = crown_authority_0 } + add_realm_law_skip_effects = crown_authority_2 + } + else_if = { + limit = { + OR = { + has_realm_law = crown_authority_1 + has_realm_law = crown_authority_2 + } + } + add_realm_law_skip_effects = crown_authority_3 + } + + # Coat of Arms + if = { + limit = { scope:spain_uniter.primary_title = title:k_castille } + primary_title = { set_coa = k_castille_leon } + } + else_if = { + limit = { scope:spain_uniter.primary_title = title:k_leon } + primary_title = { set_coa = k_leon_castille } + } + + #Handle other Kingdom titles + title:k_castille = { add_to_list = spanish_kingdoms } + title:k_leon = { add_to_list = spanish_kingdoms } + title:k_spanish_galicia = { add_to_list = spanish_kingdoms } + title:k_portugal = { add_to_list = spanish_kingdoms } + title:k_aragon = { add_to_list = spanish_kingdoms } + title:k_navarra = { add_to_list = spanish_kingdoms } + title:k_andalusia = { add_to_list = spanish_kingdoms } + title:k_badajoz = { add_to_list = spanish_kingdoms } + title:k_valencia = { add_to_list = spanish_kingdoms } + title:k_toledo = { add_to_list = spanish_kingdoms } + + custom_tooltip = unite_the_spanish_thrones_decision_titles_tt + hidden_effect = { + every_in_list = { + list = spanish_kingdoms + limit = { + this != scope:spain_uniter.primary_title + scope:spain_uniter = { completely_controls = prev } + } + + #De jure shift all held spanish titles into your primary title + every_in_de_jure_hierarchy = { + limit = { tier = tier_duchy } + set_de_jure_liege_title = scope:spain_uniter.primary_title + } + + #Destroys them all! + scope:spain_uniter = { destroy_title = prev } + } + } +} + +unite_africa_decision_effects = { + #Prestige + add_prestige = massive_prestige_gain + + #Religion bonuses + if = { + limit = { + faith = { + OR = { + religion_tag = islam_religion + religion_tag = west_african_roog_religion + religion_tag = west_african_religion + religion_tag = west_african_bori_religion + this = faith:coptic + + } + } + } + add_piety = massive_piety_gain + faith = { + change_fervor = { + value = medium_fervor_gain + desc = fervor_gain_united_africa + } + } + + if = { + limit = { + any_vassal_or_below = { + faith != scope:africa_uniter.faith + is_ai = yes + capital_province ?= { geographical_region = world_africa } + } + } + every_vassal_or_below = { + custom = every_non_root_faith_vassal_africa + limit = { + faith != scope:africa_uniter.faith + is_ai = yes + capital_province ?= { geographical_region = world_africa } + } + random = { + chance = 33 + set_character_faith = scope:africa_uniter.faith + } + } + } + + if = { + limit = { + any_realm_province = { + faith != scope:africa_uniter.faith + geographical_region = world_africa + } + } + every_realm_province = { + limit = { + faith != scope:africa_uniter.faith + geographical_region = world_africa + } + county = { add_to_list = every_realm_county } + } + + every_in_list = { + list = every_realm_county + custom = every_non_root_faith_county_africa + random = { + chance = 33 + custom_tooltip = every_non_africa_uniter_faith_convert + hidden_effect = { set_county_faith = scope:africa_uniter.faith } + } + } + } + } +} + +avenge_the_battle_of_tours_decision_effects = { + + give_nickname = nick_the_avenger + add_character_modifier = { + modifier = avenger_of_the_martyrs + } + + add_prestige = massive_prestige_gain + + #Religious bonuses + add_piety = massive_piety_gain + faith = { + change_fervor = { + value = medium_fervor_gain + desc = fervor_gain_avenged_battle_of_tours + } + } + + add_achievement_flag_effect = { FLAG = achievement_al_andalus_flag } + + if = { + limit = { + any_vassal_or_below = { + faith != scope:avenger.faith + is_ai = yes + capital_province ?= { geographical_region = world_europe_west } + } + } + every_vassal_or_below = { + custom = every_non_root_faith_vassal_west_europe + limit = { + faith != scope:avenger.faith + is_ai = yes + capital_province ?= { geographical_region = world_europe_west } + } + random = { + chance = 33 + set_character_faith = scope:avenger.faith + } + } + } + + if = { + limit = { + any_realm_province = { + faith != scope:avenger.faith + geographical_region = world_europe_west + } + } + every_realm_province = { + limit = { + faith != scope:avenger.faith + geographical_region = world_europe_west + } + county = { + add_to_list = every_realm_county + } + } + + every_in_list = { + list = every_realm_county + custom = every_non_root_faith_county_west_europe + random = { + chance = 33 + custom_tooltip = every_non_avenger_faith_convert + hidden_effect = { set_county_faith = scope:avenger.faith } + } + } + } + + #Christian penalty + if = { + limit = { exists = scope:frankish_christian_faith } + scope:frankish_christian_faith = { + change_fervor = { + value = medium_fervor_loss + desc = fervor_loss_avenged_battle_of_tours + } + } + } + + # Rattach south of France to the e_hispania + title:e_france = { + every_in_de_jure_hierarchy = { + limit = { + tier = tier_kingdom + any_in_de_jure_hierarchy = { + tier = tier_county + title_province = { geographical_region = custom_south_francia } + } + } + set_de_jure_liege_title = title:e_spain + } + } +} + +unite_the_western_slavs_decision_effects = { + #Prestige + add_prestige = massive_prestige_gain + + #Innovations + culture = { + add_random_innovation = culture_group_military + add_random_innovation = culture_group_civic + } + + #Laws + if = { + limit = { has_realm_law = crown_authority_0 } + add_realm_law_skip_effects = crown_authority_2 + } + else_if = { + limit = { + OR = { + has_realm_law = crown_authority_1 + has_realm_law = crown_authority_2 + } + } + add_realm_law_skip_effects = crown_authority_3 + } + + #Handle de jure drift & destructions of other kingdom titles + title:k_poland = { add_to_list = west_slavic_kingdoms } + title:k_pomerania = { add_to_list = west_slavic_kingdoms } + title:k_bohemia = { add_to_list = west_slavic_kingdoms } + title:k_sorbia = { add_to_list = west_slavic_kingdoms } + title:k_moravia = { add_to_list = west_slavic_kingdoms } + + if = { + limit = { highest_held_title_tier = tier_kingdom } + custom_tooltip = unite_the_western_slavs_decision_titles_tt + } + custom_tooltip = unite_the_western_slavs_decision_titles_empire_tt + # If Saxony has been created, shift everything back into Polabia + if = { + limit = { + is_target_in_global_variable_list = { + name = unavailable_unique_decisions + target = flag:flag_formed_saxony + } + } + title:k_saxony = { + every_in_de_jure_hierarchy = { + limit = { tier = tier_duchy } + set_de_jure_liege_title = title:k_sorbia + } + } + } + hidden_effect = { + scope:western_slav_uniter = { + #If king-tier, give them the West-Slavia title + if = { + limit = { highest_held_title_tier = tier_kingdom } + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:e_west_slavia = { + change_title_holder = { + holder = scope:western_slav_uniter + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + } + # Drift kingdoms to empire + every_in_list = { + list = west_slavic_kingdoms + set_de_jure_liege_title = scope:western_slav_uniter.primary_title + } + } + } +} + +unite_the_southern_slavs_decision_effects = { + #Prestige + add_prestige = massive_prestige_gain + + #Innovations + culture = { + add_random_innovation = culture_group_military + add_random_innovation = culture_group_civic + } + + #Handle de jure drift & destructions of other kingdom titles + title:k_croatia = { add_to_list = south_slavic_kingdoms } + title:k_serbia = { add_to_list = south_slavic_kingdoms } + title:k_bulgaria = { add_to_list = south_slavic_kingdoms } + title:k_dacia = { add_to_list = south_slavic_kingdoms } + title:k_moldavia = { add_to_list = south_slavic_kingdoms } + + custom_tooltip = unite_the_southern_slavs_decision_titles_tt + hidden_effect = { + every_in_list = { + list = south_slavic_kingdoms + limit = { + this != scope:southern_slav_uniter.primary_title + scope:southern_slav_uniter = { completely_controls = prev } + } + + #De jure shift all held west slavic titles into your primary title + every_in_de_jure_hierarchy = { + limit = { tier = tier_duchy } + set_de_jure_liege_title = scope:southern_slav_uniter.primary_title + } + + #Destroys them all! + scope:southern_slav_uniter = { destroy_title = prev } + } + } +} + +unite_the_slavs_decision_effects = { + #Prestige + add_prestige = massive_prestige_gain + + #Innovations + custom_tooltip = unite_the_slavs_decision_effects_innovations_tt + hidden_effect = { + #Add all Slavic cultures in the realm in a list + every_vassal_or_below = { + limit = { + OR = { + culture = { has_cultural_pillar = heritage_west_slavic } + culture = { has_cultural_pillar = heritage_east_slavic } + culture = { has_cultural_pillar = heritage_south_slavic } + } + save_temporary_scope_as = slavic_vassal + NOT = { + any_in_list = { + list = slavic_cultures + this = scope:slavic_vassal.culture + } + } + } + culture = { + add_to_list = slavic_cultures + } + } + #Add innovations from 3 random cultures + every_in_list = { + list = slavic_cultures + save_scope_as = culture_getting_innovations + + set_while_counter_variable_effect = yes + while = { + limit = { var:while_counter < 3 } + random_in_list = { + limit = { scope:culture_getting_innovations = { can_get_innovation_from = prev } } + list = slavic_cultures + scope:culture_getting_innovations = { get_random_innovation_from = prev } + } + increase_while_counter_variable_effect = yes + } + remove_while_counter_variable_effect = yes + } + } + + #Create the title and make it primary + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:e_slavia = { + change_title_holder = { + holder = root + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + + set_primary_title_to = title:e_slavia + title:e_slavia = { save_scope_as = slavia } #For localisation + + #Destroy the other three empires if I have them + if = { + limit = { has_title = title:e_russia } + destroy_title = title:e_russia + } + if = { + limit = { has_title = title:e_wendish_empire } + destroy_title = title:e_wendish_empire + } + if = { + limit = { has_title = title:e_carpathia } + destroy_title = title:e_carpathia + } + + ###Handle de jure drift and empire destruction### + + #First: add all the kingdoms + title:k_poland = { add_to_list = slavic_kingdoms } + title:k_pomerania = { add_to_list = slavic_kingdoms } + title:k_bohemia = { add_to_list = slavic_kingdoms } + title:k_moravia = { add_to_list = slavic_kingdoms } + title:k_croatia = { add_to_list = slavic_kingdoms } + title:k_serbia = { add_to_list = slavic_kingdoms } + title:k_bulgaria = { add_to_list = slavic_kingdoms } + title:k_dacia = { add_to_list = slavic_kingdoms } + title:k_moldavia = { add_to_list = slavic_kingdoms } + title:k_white_rus = { add_to_list = slavic_kingdoms } + title:k_galicia-volhynia = { add_to_list = slavic_kingdoms } + title:k_ruthenia = { add_to_list = slavic_kingdoms } + title:k_novgorod = { add_to_list = slavic_kingdoms } + title:k_opolye = { add_to_list = slavic_kingdoms } + title:k_hungary = { add_to_list = slavic_kingdoms } + + # Inform players of the de jure drift + title:e_slavia = { custom_tooltip = unite_the_slavs_decision_titles_tt } #Scope change for tooltip formatting. + + if = { + limit = { has_dlc_feature = legends } + create_legend_seed = { + type = legitimizing + quality = illustrious + chronicle = new_title + properties = { + title = title:e_slavia + founder = root + } + } + } + # Actually do the de jure drift + hidden_effect = { + every_in_list = { + list = slavic_kingdoms + + set_de_jure_liege_title = scope:slav_uniter.primary_title + } + } +} + +unite_india_decision_effect = { + #Create the title and make it primary + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:h_india = { + change_title_holder = { + holder = root + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + set_primary_title_to = title:h_india + + title:e_rajastan = { set_de_jure_liege_title = title:h_india } + title:e_deccan = { set_de_jure_liege_title = title:h_india } + title:e_bengal = { set_de_jure_liege_title = title:h_india } + + hidden_effect = { + if = { + limit = { has_title = title:e_rajastan } + destroy_title = title:e_rajastan + } + if = { + limit = { has_title = title:e_deccan } + destroy_title = title:e_deccan + } + if = { + limit = { has_title = title:e_bengal } + destroy_title = title:e_bengal + } + } +} + +become_saoshyant_decision_effect = { + set_nickname_effect = { NICKNAME = nick_the_saoshyant } + add_trait = saoshyant + custom_tooltip = become_saoshyant_decision_decendant_trait_tooltip + dynasty = { + add_dynasty_modifier = { + modifier = resurging_saoshyant + years = 25 + } + } + if = { + limit = { + any_held_title = { + title_tier = county + faith != root.faith + } + } + every_held_title = { + custom = all_held_counties + title_tier = county + limit = { + faith != root.faith + } + random = { + chance = 35 + set_county_faith = root.faith + } + } + } + faith = { + change_fervor = { + value = 15 + desc = fervor_gain_saoshyant + } + } +} + +build_grand_church_decision_effect = { + #faith = { activate_holy_site = segrada_familia } + if = { + limit = { + prestige_level < 5 + } + add_prestige_level = 1 + } +} + +accept_cannibalism_decision_effect = { + custom_tooltip = faith_accept_cannibalism + root.faith = { + set_variable = { + name = accepted_cannibalism + value = yes + } + } + root = { + if = { + limit = { + any_spouse = { + is_cannibal_trigger = no + is_ai = yes + } + } + every_spouse = { + limit = { + is_cannibal_trigger = no + is_ai = yes + } + add_trait = cannibal + } + } + if = { + limit = { + any_close_family_member = { + is_cannibal_trigger = no + is_playable_character = no + is_ai = yes + } + } + every_close_family_member = { + limit = { + is_cannibal_trigger = no + is_playable_character = no + is_ai = yes + } + custom = all_my_family_members + add_trait = cannibal + } + } + if = { + limit = { + any_vassal = { + is_cannibal_trigger = no + is_ai = yes + dread_modified_ai_boldness = { #all vassals that are intimidated + dreaded_character = root + value <= -50 + } + } + } + every_vassal = { + limit = { + is_cannibal_trigger = no + is_ai = yes + dread_modified_ai_boldness = { + dreaded_character = root + value <= -50 + } + } + custom = all_my_intimidated_vassals + add_trait = cannibal + } + } + } + give_nickname = nick_the_devourer +} + +found_university_decision_event_effect = { + if = { + limit = { + OR = { + has_bad_nickname = yes + has_any_nickname = no + } + } + give_nickname = nick_the_scholar + } + + hidden_effect = { + #Event that gives you highly skilled courtier + trigger_event = { + id = major_decisions.2011 + days = { 50 365 } + } + } +} + +found_university_decision_effect = { + found_university_decision_event_effect = yes + + if = { + limit = { + NOT = { has_variable = university } + } + show_as_tooltip = { + every_held_title = { + custom = decision_found_university_custom + title_tier = barony + title_capital_county.title_province = { + add_special_building_slot = generic_university + } + } + } + } +} + +lunatic_building_decision_effect = { + capital_province = { + set_variable = { #To unlock the building + name = variable_greenhouse + value = yes + } + add_special_building_slot = special_greenhouse_01 + add_special_building = special_greenhouse_01 + #add_province_modifier = extra_building_slot + #add_building = special_greenhouse_01 + } + + give_nickname = nick_the_glass +} + +found_witch_coven_decision_effects = { + save_scope_as = founder + custom_tooltip = found_witch_coven_decision_effects.children.tt + custom_tooltip = found_witch_coven_decision_effects.convert.tt + custom_tooltip = found_witch_coven_decision_effects.grand_rite.tt + house = { + add_house_modifier = { + modifier = witch_coven + } + } + # Check for the Volva achievement. + if = { + limit = { + # DLC check. + has_fp1_dlc_trigger = yes + fp1_achievement_religious_norse_trigger = yes + } + add_achievement_flag_effect = { FLAG = volva_achievement_flag } + } +} + +convert_whole_realm_to_feudalism_effect = { + #TOOLTIP INFO + #PLAYER EFFECTS + + hidden_effect = { + ## Spawn holdings in tribal counties + + every_sub_realm_county = { # Spawn temples in your holy sites + limit = { + any_county_province = { + has_holding_type = tribal_holding + } + NOT = { + any_county_province = { + has_holding_type = church_holding + } + } + any_county_province = { + has_holding = no + barony = { + is_holy_site_of = root.faith + } + } + } + random_county_province = { + limit = { + has_holding = no + barony_cannot_construct_holding = no + barony = { + is_holy_site_of = root.faith + } + } + set_holding_type = church_holding + } + } + + every_sub_realm_county = { # Spawn a City + limit = { + any_county_province = { + has_holding_type = tribal_holding + } + any_county_province = { + has_holding = no + } + NOT = { + any_county_province = { + has_holding_type = city_holding + } + } + } + random_county_province = { + limit = { + has_holding = no + OR = { + terrain = floodplains + terrain = oasis + terrain = farmlands + terrain = terraced_hills + } + is_coastal = yes + has_special_building_slot = no + barony_cannot_construct_holding = no + } + alternative_limit = { + has_holding = no + OR = { + terrain = floodplains + terrain = oasis + terrain = farmlands + terrain = terraced_hills + } + has_special_building_slot = no + barony_cannot_construct_holding = no + } + alternative_limit = { + has_holding = no + OR = { + terrain = floodplains + terrain = oasis + terrain = farmlands + terrain = terraced_hills + } + barony_cannot_construct_holding = no + } + alternative_limit = { + has_holding = no + barony_cannot_construct_holding = no + } + random = { + chance = 60 + modifier = { + add = county.development_level + } + modifier = { + add = 50 + this.county = root.capital_county + } + modifier = { + add = 20 + OR = { + terrain = floodplains + terrain = oasis + terrain = farmlands + terrain = terraced_hills + } + } + set_holding_type = city_holding + } + } + } + + every_sub_realm_county = { # Spawn a Temple + limit = { + any_county_province = { + has_holding_type = tribal_holding + } + any_county_province = { + has_holding = no + } + NOT = { + any_county_province = { + has_holding_type = church_holding + } + } + } + random_county_province = { + limit = { + has_holding = no + OR = { + terrain = floodplains + terrain = oasis + terrain = farmlands + terrain = terraced_hills + } + is_coastal = yes + has_special_building_slot = no + barony_cannot_construct_holding = no + } + alternative_limit = { + has_holding = no + OR = { + terrain = floodplains + terrain = oasis + terrain = farmlands + terrain = terraced_hills + } + has_special_building_slot = no + barony_cannot_construct_holding = no + } + alternative_limit = { + has_holding = no + OR = { + terrain = floodplains + terrain = oasis + terrain = farmlands + terrain = terraced_hills + } + barony_cannot_construct_holding = no + } + alternative_limit = { + has_holding = no + barony_cannot_construct_holding = no + } + random = { + chance = 50 + modifier = { + add = county.development_level + } + modifier = { + add = 50 + this.county = root.capital_county + } + modifier = { + add = 20 + OR = { + terrain = floodplains + terrain = oasis + terrain = farmlands + terrain = terraced_hills + } + } + set_holding_type = church_holding + } + } + } + + ##Sort out new buildings for liege and all vassals + every_realm_province = { + limit = { + has_holding_type = tribal_holding + NOT = { is_in_list = feudal_conversion } + } + add_to_list = feudal_conversion + } + every_vassal_or_below = { + every_realm_province = { + limit = { + has_holding_type = tribal_holding + NOT = { is_in_list = feudal_conversion } + } + add_to_list = feudal_conversion + + } + } + every_in_list = { + list = feudal_conversion + set_variable = { + name = tribal_to_feudal_building_level + value = combined_building_level + days = 1 + } + set_holding_type = castle_holding + while = { + limit = { + var:tribal_to_feudal_building_level > 1 + } + generate_building = yes + change_variable = { + name = tribal_to_feudal_building_level + subtract = 1 + } + } + remove_variable = tribal_to_feudal_building_level + remove_from_list = feudal_conversion + } + } + + ##Liege has Soryo? Convert to Soryo! + if = { + limit = { + has_tgp_dlc_trigger = yes + top_liege != this + liege = { government_has_flag = government_is_japan_feudal } + } + change_government = japan_feudal_government + if = { + limit = { + is_house_head = yes + } + save_scope_as = new_head + house = { + set_house_name = japanese_dynasty_name + save_scope_as = new_house + } + create_noble_family_effect = { GOVERNMENT_GIVER = this } + scope:new_title = { + #set_title_name_dynamic = japanese_noble_family_name + set_coa = scope:new_house + } + } + } + ##Liege has clan? Convert to clan! + else_if = { + limit = { + top_liege != this + OR = { + liege = { government_has_flag = government_is_clan } + AND = { + liege = { government_has_flag = government_is_tribal } + religion = religion:islam_religion + } + } + } + change_government = clan_government + } + ##Liege has feudal? Convert to feudal! + else_if = { + limit = { + top_liege != this + OR = { + liege = { government_has_flag = government_is_feudal } + AND = { + liege = { government_has_flag = government_is_tribal } + NOT = { religion = religion:islam_religion } + } + } + } + change_government = feudal_government + } + ##You're an independent Japanese Heritage Character? Convert to Soryo! + else_if = { + limit = { + has_tgp_dlc_trigger = yes + top_liege = this + culture = { has_cultural_pillar = heritage_japonic } + } + change_government = japan_feudal_government + if = { + limit = { + is_house_head = yes + } + save_scope_as = new_head + house = { + set_house_name = japanese_dynasty_name + save_scope_as = new_house + } + create_noble_family_effect = { GOVERNMENT_GIVER = this } + scope:new_title = { + #set_title_name_dynamic = japanese_noble_family_name + set_coa = scope:new_house + } + } + } + ##You're an independent Muslim? Convert to clan! + else_if = { + limit = { + top_liege = this + faith = { religion_tag = islam_religion } + } + change_government = clan_government + } + ##You're an independent anything else? Convert to feudal! + else = { change_government = feudal_government } + if = { + limit = { + government_has_flag = government_is_tribal + } + ##General + custom_tooltip = all_holding_will_change + ##Liege has clan? Convert to clan! + if = { + limit = { + top_liege != this + liege = { government_has_flag = government_is_clan } + } + custom_tooltip = clan_liege_vassals_will_convert + } + #Liege has feudal? Convert to feudal! + if = { + limit = { + top_liege != this + liege = { government_has_flag = government_is_feudal } + } + custom_tooltip = feudal_liege_vassals_will_convert + } + ##If I am Islamic, we will become clan. + if = { + limit = { + top_liege = this + faith = { religion_tag = islam_religion } + } + custom_tooltip = islamic_vassals_will_convert + } + ##If I am not Islamic, we will become feudal. + else_if = { + limit = { top_liege = this } + custom_tooltip = other_vassals_will_convert + } + } + + hidden_effect = { + #Nuke tribal authorities. + if = { + limit = { has_realm_law = tribal_authority_0 } + remove_realm_law = tribal_authority_0 + } + if = { + limit = { has_realm_law = tribal_authority_1 } + remove_realm_law = tribal_authority_1 + } + if = { + limit = { has_realm_law = tribal_authority_2 } + remove_realm_law = tribal_authority_2 + } + if = { + limit = { has_realm_law = tribal_authority_3 } + remove_realm_law = tribal_authority_3 + } + #Start off crown authorities. + if = { + limit = { + NOT = { has_realm_law = crown_authority_0 } + } + add_realm_law_skip_effects = crown_authority_0 + } + + #Also convert every vassal. + #Liege has taken soryo, so become soryo. + if = { + limit = { + government_has_flag = government_is_japan_feudal + } + every_vassal_or_below = { + limit = { government_has_flag = government_is_tribal } + change_government = japan_feudal_government + if = { + limit = { + is_house_head = yes + } + save_scope_as = new_head + house = { + set_house_name = japanese_dynasty_name + save_scope_as = new_house + } + create_noble_family_effect = { GOVERNMENT_GIVER = this } + scope:new_title = { + #set_title_name_dynamic = japanese_noble_family_name + set_coa = scope:new_house + } + } + #Nuke tribal authorities. + if = { + limit = { has_realm_law = tribal_authority_0 } + remove_realm_law = tribal_authority_0 + } + if = { + limit = { has_realm_law = tribal_authority_1 } + remove_realm_law = tribal_authority_1 + } + if = { + limit = { has_realm_law = tribal_authority_2 } + remove_realm_law = tribal_authority_2 + } + if = { + limit = { has_realm_law = tribal_authority_3 } + remove_realm_law = tribal_authority_3 + } + if = { + limit = { + NOT = { has_realm_law = japanese_bureaucracy_0 } + } + add_realm_law_skip_effects = japanese_bureaucracy_0 + } + } + } + #Liege has taken clan, so become clan. + else_if = { + limit = { + government_has_flag = government_is_clan + } + every_vassal_or_below = { + limit = { government_has_flag = government_is_tribal } + change_government = clan_government + #Nuke tribal authorities. + if = { + limit = { has_realm_law = tribal_authority_0 } + remove_realm_law = tribal_authority_0 + } + if = { + limit = { has_realm_law = tribal_authority_1 } + remove_realm_law = tribal_authority_1 + } + if = { + limit = { has_realm_law = tribal_authority_2 } + remove_realm_law = tribal_authority_2 + } + if = { + limit = { has_realm_law = tribal_authority_3 } + remove_realm_law = tribal_authority_3 + } + if = { + limit = { + NOT = { has_realm_law = crown_authority_0 } + } + add_realm_law_skip_effects = crown_authority_0 + } + } + } + #Liege is not clan, become feudal. + else = { + every_vassal_or_below = { + limit = { government_has_flag = government_is_tribal } + change_government = feudal_government + #Nuke tribal authorities. + if = { + limit = { has_realm_law = tribal_authority_0 } + remove_realm_law = tribal_authority_0 + } + if = { + limit = { has_realm_law = tribal_authority_1 } + remove_realm_law = tribal_authority_1 + } + if = { + limit = { has_realm_law = tribal_authority_2 } + remove_realm_law = tribal_authority_2 + } + if = { + limit = { has_realm_law = tribal_authority_3 } + remove_realm_law = tribal_authority_3 + } + if = { + limit = { + NOT = { has_realm_law = crown_authority_0 } + } + add_realm_law_skip_effects = crown_authority_0 + } + } + } + } +} + +################################################## +# Add Special Succession Effects + +special_succession_witengamot_effect = { + if = { + limit = { highest_held_title_tier = tier_empire } + every_held_title = { + title_tier = empire + limit = { + NOR = { + has_title_law_flag = advanced_succession_law + has_title_law_flag = elective_succession_law + } + } + add_title_law = saxon_elective_succession_law + } + every_vassal = { + limit = { special_succession_witengamot_trigger = yes } + add_opinion = { + modifier = implemented_traditional_succession_law_opinion + years = 20 + target = root + } + custom = major_decisions.3100.tt_opinion_witengamot + } + } + else = { + every_held_title = { + title_tier = kingdom + limit = { + NOR = { + has_title_law_flag = advanced_succession_law + has_title_law_flag = elective_succession_law + } + } + add_title_law = saxon_elective_succession_law + } + every_vassal = { + limit = { special_succession_witengamot_trigger = yes } + add_opinion = { + modifier = implemented_traditional_succession_law_opinion + years = 20 + target = root + } + custom = major_decisions.3100.tt_opinion_witengamot + } + } +} + +special_succession_thing_effect = { + if = { + limit = { highest_held_title_tier = tier_empire } + every_held_title = { + title_tier = empire + limit = { + NOR = { + has_title_law_flag = advanced_succession_law + has_title_law_flag = elective_succession_law + } + } + add_title_law = scandinavian_elective_succession_law + } + every_vassal = { + limit = { special_succession_thing_trigger = yes } + add_opinion = { + modifier = implemented_traditional_succession_law_opinion + years = 20 + target = root + } + custom = major_decisions.3100.tt_opinion_thing + } + } + else = { + every_held_title = { + title_tier = kingdom + limit = { + NOR = { + has_title_law_flag = advanced_succession_law + has_title_law_flag = elective_succession_law + } + } + add_title_law = scandinavian_elective_succession_law + } + every_vassal = { + limit = { special_succession_thing_trigger = yes } + add_opinion = { + modifier = implemented_traditional_succession_law_opinion + years = 20 + target = root + } + custom = major_decisions.3100.tt_opinion_thing + } + } +} + +special_succession_tanistry_effect = { + if = { + limit = { highest_held_title_tier = tier_empire } + every_held_title = { + title_tier = empire + limit = { + NOR = { + has_title_law_flag = advanced_succession_law + has_title_law_flag = elective_succession_law + } + } + add_title_law = gaelic_elective_succession_law + } + every_vassal = { + limit = { special_succession_tanistry_trigger = yes } + add_opinion = { + modifier = implemented_traditional_succession_law_opinion + years = 20 + target = root + } + custom = major_decisions.3100.tt_opinion_tanistry + } + } + else = { + every_held_title = { + title_tier = kingdom + limit = { + NOR = { + has_title_law_flag = advanced_succession_law + has_title_law_flag = elective_succession_law + } + } + add_title_law = gaelic_elective_succession_law + } + every_vassal = { + limit = { special_succession_tanistry_trigger = yes } + add_opinion = { + modifier = implemented_traditional_succession_law_opinion + years = 20 + target = root + } + custom = major_decisions.3100.tt_opinion_tanistry + } + } +} + +special_succession_jirga_effect = { + if = { + limit = { highest_held_title_tier = tier_empire } + every_held_title = { + title_tier = empire + limit = { + NOR = { + has_title_law_flag = advanced_succession_law + has_title_law_flag = elective_succession_law + } + } + add_title_law = tribal_elective_succession_law + } + every_vassal = { + limit = { special_succession_jirga_trigger = yes } + add_opinion = { + modifier = implemented_traditional_succession_law_opinion + years = 20 + target = root + } + custom = major_decisions.3100.tt_opinion_thing + } + } + else = { + every_held_title = { + title_tier = kingdom + limit = { + NOR = { + has_title_law_flag = advanced_succession_law + has_title_law_flag = elective_succession_law + } + } + add_title_law = tribal_elective_succession_law + } + every_vassal = { + limit = { special_succession_jirga_trigger = yes } + add_opinion = { + modifier = implemented_traditional_succession_law_opinion + years = 20 + target = root + } + custom = major_decisions.3100.tt_opinion_jirga + } + } +} + +################################################## +# Launch Hungarian Migration Effects + +launch_hungarian_migration_scripted_effect = { + $INVADER$ = { + #If Hungary already exists, just tell us it's getting a name change. + if = { + limit = { + title:k_hungary = { is_title_created = yes } + } + custom_tooltip = launch_hungarian_migration_scripted_effect.tt.pannonia_renamed + title:k_hungary = { set_title_name = k_hungary } + } + #Otherwise, if Hungary doesn't exist, create & acquire it _whilst_ giving it a name change. + else_if = { + limit = { + title:k_hungary = { is_title_created = no } + } + custom_tooltip = launch_hungarian_migration_scripted_effect.tt.pannonia_renamed_and_usurped + hidden_effect = { + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + title:k_hungary = { + change_title_holder = { + holder = $INVADER$ + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + title:k_hungary = { set_title_name = k_hungary } + } + } + + #If $INVADER$ has both k_hungary & any other kingdom-tier title, destroy the excess titles. + custom_tooltip = launch_hungarian_migration_scripted_effect.tt.destroy_other_kingdoms + hidden_effect = { + if = { + limit = { + has_title = title:k_hungary + any_held_title = { + title_tier >= kingdom + count >= 2 + } + } + every_held_title = { + title_tier >= kingdom + limit = { + NOT = { this = title:k_hungary } + } + save_temporary_scope_as = excess_kingdom + $INVADER$ = { destroy_title = scope:excess_kingdom } + } + } + } + + #Replace all Avar territories within Pannonia with Mogyer, excepting Keve & Krasso. + custom_tooltip = launch_hungarian_migration_scripted_effect.tt.mogyers_move_to_pannonia + hidden_effect = { + every_sub_realm_county = { + limit = { + title_capital_county.title_province = { geographical_region = custom_hungary } + culture = culture:avar + NOR = { + this = title:c_keve + this = title:c_krasso + holder = { + AND = { + is_ai = no + has_culture = prev.culture + } + } + } + } + set_county_culture = culture:mogyer + #Switch 'em to $INVADER$'s faith if unreformed & $INVADER$ is any Magyar pagan. + if = { + limit = { + $INVADER$.faith.religion = religion:magyar_religion + faith = { has_doctrine_parameter = unreformed } + } + set_county_faith = $INVADER$.faith + } + } + } + + #Replace all Mogyer territories outside of the Pannonian Basin + custom_tooltip = launch_hungarian_migration_scripted_effect.tt.mogyers_outside_pannonia + hidden_effect = { + every_sub_realm_county = { + limit = { + NOT = { + title_capital_county.title_province = { geographical_region = custom_hungary } + } + culture = culture:mogyer + } + set_county_culture = culture:pecheneg + } + #Switch 'em to Tengri if Magyar pagan. + every_sub_realm_county = { + limit = { + NOT = { + title_capital_county.title_province = { geographical_region = custom_hungary } + } + culture = culture:pecheneg + religion = religion:magyar_religion + } + set_county_faith = faith:tengri_pagan + } + } + + #All territory outside Pannonia is given to new holders and/or made independent. + custom_tooltip = launch_hungarian_migration_scripted_effect.tt.territory_outside_pannonia.non_mogyer_vassals + custom_tooltip = launch_hungarian_migration_scripted_effect.tt.territory_outside_pannonia.mogyer_vassals + custom_tooltip = launch_hungarian_migration_scripted_effect.tt.territory_outside_pannonia.former_territories + hidden_effect = { + #All direct vassal non-Mogyers are given their independence, unless they hold land within Pannonia. + every_vassal = { + limit = { + NOT = { culture = culture:mogyer } + highest_held_title_tier >= tier_county + any_held_title = { + count = all + NOT = { + title_capital_county.title_province = { geographical_region = custom_hungary } + } + } + } + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = no + } + becomes_independent = { change = scope:change } + resolve_title_and_vassal_change = scope:change + } + #... And catch the stragglers. Has to be a separate effect block, or we'll ruin the de facto structure. + every_vassal_or_below = { + limit = { + NOT = { culture = culture:mogyer } + highest_held_title_tier >= tier_county + any_held_title = { + count = all + NOT = { + title_capital_county.title_province = { geographical_region = custom_hungary } + } + } + } + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = no + } + becomes_independent = { change = scope:change } + resolve_title_and_vassal_change = scope:change + } + #Reserve a duchy, preferring the capital, for $INVADER$. + if = { + limit = { title:k_hungary.title_capital_county.duchy.holder = $INVADER$ } + title:k_hungary.title_capital_county.duchy = { save_scope_as = reserved_title } + } + #... Of course, if we can't have the capital for some reason, grab any random duchy in Pannonia. + else = { + random_held_title = { + title_tier = duchy + #Filter out Syrmia, because Syrmia sucks. + limit = { + title_capital_county.title_province = { geographical_region = custom_hungary } + NOT = { this = title:d_syrmia } + } + #But if we have no other choice, Syrmia is better than no duchy. + alternative_limit = { + title_capital_county.title_province = { geographical_region = custom_hungary } + tier = tier_duchy + } + #If we have no possible duchy, make sure to reserve at least *one* county within Pannonia. + alternative_limit = { + title_capital_county.title_province = { geographical_region = custom_hungary } + } + save_scope_as = reserved_title + } + } + #Find all Mogyer vassals outside of Pannonia. + every_vassal_or_below = { + limit = { + culture = culture:mogyer + highest_held_title_tier >= tier_county + } + add_to_list = mogyer_vassals_list + } + #Find all Pannonian titles held by $INVADER$ that aren't reserved. + every_held_title = { + limit = { + title_capital_county.title_province = { geographical_region = custom_hungary } + #Technically we could use any_this_title_or_de_jure_above for the following two checks, but it was being problematic and this does the same thing (just more cumbersomely). + OR = { + tier = tier_county + tier = tier_duchy + } + this != scope:reserved_title + } + add_to_list = spare_pannonian_titles_list + } + #Attempt to give out Pannonian holdings to the vassals who are about to lose land, prioritising players by tier, then NPCs by tier. + ##Now, process duchy title assignment. + every_in_list = { + list = mogyer_vassals_list + #Players first. + limit = { + is_ai = no + launch_hungarian_migration_ducal_processing_trigger = yes + } + #NPCs after that. + alternative_limit = { + is_ai = yes + launch_hungarian_migration_ducal_processing_trigger = yes + } + #Grab the appropriate vassal. + save_temporary_scope_as = receiving_vassal + #If $INVADER$ has a suitable spare ducal title, hand it over. + if = { + limit = { + any_in_list = { + list = spare_pannonian_titles_list + tier = tier_duchy + holder = $INVADER$ + } + } + #Save the suitable title. + random_in_list = { + list = spare_pannonian_titles_list + limit = { + tier = tier_duchy + holder = $INVADER$ + } + every_in_de_jure_hierarchy = { + limit = { + holder = $INVADER$ + tier >= tier_county + } + add_to_list = multiple_donated_titles + } + } + #Hand it to the receiving vassal. + create_title_and_vassal_change = { + type = granted + save_scope_as = change + add_claim_on_loss = no + } + every_in_list = { + list = multiple_donated_titles + save_temporary_scope_as = donated_title + scope:donated_title = { + change_title_holder = { + holder = scope:receiving_vassal + change = scope:change + } + } + remove_from_list = multiple_donated_titles + } + resolve_title_and_vassal_change = scope:change + } + } + ##Finally, process county title assignment. + ###First, attempt to pair de facto sub-vassals to their lieges. + every_in_list = { + list = mogyer_vassals_list + #Players first. + limit = { + is_ai = no + launch_hungarian_migration_count_processing_trigger = yes + } + #NPCs after that. + alternative_limit = { + is_ai = yes + launch_hungarian_migration_count_processing_trigger = yes + } + #Grab the appropriate vassal. + save_temporary_scope_as = receiving_vassal + #If $INVADER$ has a suitable spare county title, hand it over. + if = { + #Try to pair vassals with their lieges first. + limit = { + #Direct vassals shouldn't bother to try pairing. + NOT = { liege = $INVADER$ } + any_in_list = { + list = spare_pannonian_titles_list + launch_hungarian_migration_sub_vassal_liege_pairing_trigger = yes + } + } + #Save the suitable title. + random_in_list = { + list = spare_pannonian_titles_list + limit = { + #Direct vassals shouldn't bother to try pairing. + NOT = { scope:receiving_vassal.liege = $INVADER$ } + #Run the stock trigger. + launch_hungarian_migration_sub_vassal_liege_pairing_trigger = yes + #Don't give away the new liege's primary title's capital county. + this != holder.primary_title.title_capital_county + } + save_temporary_scope_as = donated_title + } + #Hand it to the receiving vassal. + create_title_and_vassal_change = { + type = granted + save_scope_as = change + add_claim_on_loss = no + } + scope:donated_title = { + change_title_holder = { + holder = scope:receiving_vassal + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + } + } + ###Then, filter through any remaining direct vassals. + every_in_list = { + list = mogyer_vassals_list + #Players first. + limit = { + is_ai = no + launch_hungarian_migration_count_processing_trigger = yes + } + #NPCs after that. + alternative_limit = { + is_ai = yes + launch_hungarian_migration_count_processing_trigger = yes + } + #Grab the appropriate vassal. + save_temporary_scope_as = receiving_vassal + #If $INVADER$ has a suitable spare county title, hand it over. + if = { + #Otherwise, grab any spare valid title that $INVADER$ has lying around. + limit = { + any_in_list = { + list = spare_pannonian_titles_list + launch_hungarian_migration_direct_vassal_requirements_trigger = { INVADER = $INVADER$ } + } + } + #Save the suitable title. + random_in_list = { + list = spare_pannonian_titles_list + limit = { + launch_hungarian_migration_direct_vassal_requirements_trigger = { INVADER = $INVADER$ } + } + save_temporary_scope_as = donated_title + } + #Hand it to the receiving vassal. + create_title_and_vassal_change = { + type = granted + save_scope_as = change + add_claim_on_loss = no + } + scope:donated_title = { + change_title_holder = { + holder = scope:receiving_vassal + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + } + } + ##Clean-up: any landless characters should move to $INVADER$'s court. + every_in_list = { + list = mogyer_vassals_list + limit = { is_ruler = no} + save_temporary_scope_as = landless_mogyer_vassal + $INVADER$ = { add_courtier = scope:landless_mogyer_vassal } + } + #Sum all remaining territory outside of Pannonia & give that territory to created local characters. + ##Start by trying to group duchies. + every_sub_realm_title = { + #First we try to make duchy power blocks. + if = { + #Grab duchies outside of Pannonia. + limit = { + NOT = { + title_capital_county.title_province = { geographical_region = custom_hungary } + } + tier = tier_duchy + } + save_temporary_scope_as = seceding_duchy + #Now grab the duchy & any sub-realm counties beneath it outside of Pannonia, and filter them to a list for processing. + scope:seceding_duchy = { + every_in_de_jure_hierarchy = { + limit = { + tier >= tier_county + OR = { + holder = $INVADER$ + holder = { + any_liege_or_above = { this = $INVADER$ } + } + } + } + add_to_temporary_list = seceding_duchy_list + } + } + #Create a local peasant warlord for the duchy & counties. + create_character = { + location = scope:seceding_duchy.title_capital_county.title_province + template = post_migration_local_warlord_template + save_scope_as = local_warlord + } + #Assign the seceding titles to the new peasant warlord. + create_title_and_vassal_change = { + type = usurped + save_scope_as = change + add_claim_on_loss = no + } + every_in_list = { + list = seceding_duchy_list + limit = { + NAND = { + tier = tier_county + title_province = { geographical_region = custom_hungary } + } + } + change_title_holder = { + holder = scope:local_warlord + change = scope:change + take_baronies = yes + } + remove_from_list = seceding_duchy_list + } + resolve_title_and_vassal_change = scope:change + #And give the warlord their independence. + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = no + } + scope:local_warlord = { + becomes_independent = { change = scope:change } + } + resolve_title_and_vassal_change = scope:change + #If any vassals within Pannonia have gotten mixed up, shunt them back to $INVADER$, and try to find a suitable duke. + ##Start off by assembling a suitable list of affected vassals (should only ever be the one, but you never know). + scope:local_warlord = { + every_vassal = { + limit = { + #We're only interested in counts... + highest_held_title_tier = tier_county + #... Within Panonnia. + any_held_title = { launch_hungarian_migration_county_is_within_custom_hungary_trigger = yes } + } + add_to_list = vassals_to_shunt + } + } + ##Sort through the list, see who should be the new liege of the misplaced vassals. + every_in_list = { + list = vassals_to_shunt + #First off, check if there's a valid duke to hand 'em over to. + if = { + limit = { + any_held_title = { + launch_hungarian_migration_misplaced_count_suitable_liege_trigger = { INVADER = $INVADER$ } + } + } + #If there is, we make a note of them for liege determination. + random_held_title = { + limit = { + launch_hungarian_migration_misplaced_count_suitable_liege_trigger = { INVADER = $INVADER$ } + } + duchy.holder = { save_scope_as = appropriate_liege } + } + } + #Otherwise, we just grab $INVADER$ as a solid fallback. + else = { + $INVADER$ = { save_scope_as = appropriate_liege } + } + #Reassign the errant vassal back to their rightful Pannonian realm. + create_title_and_vassal_change = { + type = conquest + save_scope_as = change + add_claim_on_loss = no + } + change_liege = { + liege = scope:appropriate_liege + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + } + ##... Then we catch the straggler counties. + every_sub_realm_title = { + #First we try to make duchy power blocks. + if = { + #Grab duchies outside of Pannonia. + limit = { + NOT = { + title_capital_county.title_province = { geographical_region = custom_hungary } + } + tier = tier_county + } + save_temporary_scope_as = seceding_county + #Create a local peasant warlord for the county. + create_character = { + location = scope:seceding_county.title_province + template = post_migration_minor_warlord_template + save_scope_as = minor_warlord + } + #Assign the seceding title to the new peasant warlord. + create_title_and_vassal_change = { + type = usurped + save_scope_as = change + add_claim_on_loss = no + } + scope:seceding_county = { + change_title_holder = { + holder = scope:minor_warlord + change = scope:change + take_baronies = yes + } + } + resolve_title_and_vassal_change = scope:change + #And give the warlord their independence. + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = no + } + scope:minor_warlord = { + becomes_independent = { change = scope:change } + } + resolve_title_and_vassal_change = scope:change + } + } + } + } +} + +tribal_transfer_liege_title_effect = { + create_title_and_vassal_change = { + type = usurped + save_scope_as = change + add_claim_on_loss = no + } + scope:title_being_fought_over = { + change_title_holder = { + holder = scope:challenger + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + if = { + limit = { + root = scope:challenger + } + scope:liege_to_challenge = { + add_opinion = { + target = scope:challenger + modifier = usurped_title + } + } + } + else = { + hidden_effect = { + scope:liege_to_challenge = { + add_opinion = { + target = scope:challenger + modifier = usurped_title + } + } + } + } +} + +tribal_challenger_lost_effect = { + if = { + limit = { + root = scope:liege_to_challenge + } + scope:liege_to_challenge = { + add_prestige = medium_prestige_gain + } + } + else = { + hidden_effect = { + scope:liege_to_challenge = { + add_prestige = medium_prestige_gain + } + } + } + add_prestige_level = -1 + if = { + limit = { + root = scope:challenger + } + scope:liege_to_challenge = { + add_opinion = { + target = scope:challenger + modifier = tried_to_usurped_title + } + } + } + else = { + hidden_effect = { + scope:liege_to_challenge = { + add_opinion = { + target = scope:challenger + modifier = tried_to_usurped_title + } + } + } + } +} + +################################################## +# Negotiate the Danelaw Effects + +negotiate_the_danelaw_accept_effect = { + # Mark the partition as being active. + custom_tooltip = negotiate_the_danelaw_accept_effect.partition_active.tt + set_global_variable = { + name = partition_active_danelaw + value = title:k_england + } + # Kingdoms for all! + ## Scope:ntd_brit receives k_england. + scope:ntd_brit = { + create_title_and_vassal_change = { + type = created + save_scope_as = change + } + title:k_england = { + change_title_holder = { + holder = scope:ntd_brit + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + title:k_england = { add_title_law = saxon_elective_succession_law } + } + ## Whilst scope:ntd_nord receives k_danelaw. + scope:ntd_nord = { + create_title_and_vassal_change = { + type = created + save_scope_as = change + } + title:k_danelaw = { + change_title_holder = { + holder = scope:ntd_nord + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + title:k_danelaw = { + add_title_law = scandinavian_elective_succession_law + # And make sure it follows appropriate de jures. + hidden_effect = { set_de_jure_liege_title = title:k_england.de_jure_liege } + } + } + # Give k_danelaw various de jures. + ## Firstly, any duchy that it has at least one county in which isn't scope:ntd_brit's capital duchy. + custom_tooltip = negotiate_the_danelaw_accept_effect.de_jure_holdings_recognised.tt + hidden_effect = { + scope:ntd_nord = { + every_sub_realm_county = { + limit = { + kingdom = title:k_england + duchy != scope:ntd_brit.capital_county.duchy + } + duchy = { set_de_jure_liege_title = title:k_danelaw } + } + } + } + ## Then, any independent duchy held by a Scandi-side ruler (again exempting scope:ntd_brit's capital, just in case). + custom_tooltip = negotiate_the_danelaw_accept_effect.independent_holdings_recognised.tt + hidden_effect = { + every_county_in_region = { + region = world_europe_west_britannia + limit = { + kingdom = title:k_england + exists = duchy.holder + duchy.holder = { negotiate_the_danelaw_norse_side_trigger = yes } + duchy != scope:ntd_brit.capital_county.duchy + } + duchy = { set_de_jure_liege_title = title:k_danelaw } + } + } + # Set up a ceasefire & some opinion gain between the two rulers. + scope:ntd_brit = { + add_truce_both_ways = { + character = scope:ntd_nord + years = 25 + name = TRUCE_SIGNED_PARTITION + } + add_opinion = { + target = scope:ntd_nord + modifier = respect_opinion + opinion = 50 + } + reverse_add_opinion = { + target = scope:ntd_nord + modifier = respect_opinion + opinion = 50 + } + } + # Independent rulers on both sides are extremely unimpressed with this divvying. + ## First, grab everyone applicable. + title:k_england = { + every_in_de_jure_hierarchy = { + limit = { + holder ?= { + top_liege = this + NOR = { + this = scope:ntd_actor + this = scope:ntd_recipient + } + } + } + holder = { add_to_list = riled_danelaw_independents_list } + } + } + ## Then, apply opinion & hidden rivalry effects. + every_in_list = { + list = riled_danelaw_independents_list + custom = negotiate_the_danelaw_accept_effect.riled_independents_list + add_opinion = { + target = scope:ntd_brit + modifier = weak_opinion + opinion = -40 + } + add_opinion = { + target = scope:ntd_nord + modifier = weak_opinion + opinion = -40 + } + # We hide the rivalry stuff, both to make it seem less unappealing, and to encourage valid-feeling drama without deliberately signalling it. + hidden_effect = { + if = { + limit = { + can_set_relation_potential_rival_trigger = { CHARACTER = scope:ntd_brit } + } + set_relation_potential_rival = scope:ntd_brit + } + if = { + limit = { + can_set_relation_potential_rival_trigger = { CHARACTER = scope:ntd_nord } + } + set_relation_potential_rival = scope:ntd_nord + } + } + } +} + +negotiate_the_danelaw_reject_effect = { + scope:ntd_actor = { + # If possible, scope:ntd_actor & scope:ntd_recipient immediately become nemeses. + if = { + limit = { + can_set_relation_nemesis_trigger = { CHARACTER = scope:ntd_recipient } + } + set_relation_nemesis = { + reason = nemesis_danelaw_rejection + copy_reason = rival + target = scope:ntd_recipient + } + } + else = { + add_opinion = { + target = scope:ntd_recipient + modifier = humiliated_opinion + opinion = -75 + } + } + # Scope:ntd_actor loses a huge amount of prestige. + add_prestige = massive_prestige_loss + # Scope:ntd_actor gets a derrogatory nickname. + give_nickname = nick_the_weak + } +} + +negotiate_the_danelaw_each_way_effect = { + random_list = { + # The offer is accepted. + 100 = { + show_chance = no + desc = negotiate_the_danelaw_each_way_effect.accepted + negotiate_the_danelaw_accept_effect = yes + } + # The offier is rejected. + 100 = { + show_chance = no + desc = negotiate_the_danelaw_each-way_effect.rejected + negotiate_the_danelaw_reject_effect = yes + } + } +} + +resolve_danelaw_partition_effect = { + # Drift all k_danelaw cores into England. + custom_tooltip = resolve_danelaw_partition_effect.adjust_de_jures.tt + hidden_effect = { + title:k_danelaw = { + every_in_de_jure_hierarchy = { + limit = { tier = tier_duchy } + set_de_jure_liege_title = title:k_england + } + } + } + # If k_danelaw is victorious, take care of various bits'n'pieces. + if = { + limit = { scope:partition_winner = title:k_danelaw } + # If appropriate, create k_england. + if = { + limit = { + NOT = { exists = title:k_england.holder } + } + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + } + title:k_england = { + change_title_holder = { + holder = scope:victor + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + } + # Else usurp k_england. + else_if = { + limit = { + NOT = { title:k_england.holder = scope:victor } + } + create_title_and_vassal_change = { + type = usurped + save_scope_as = title_change + add_claim_on_loss = yes + } + title:k_england = { + change_title_holder = { + holder = scope:victor + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + } + # Sundry cosmetic changes. + title:k_england = { + if = { # Only do Scandinavian things for Scandinavians + limit = { + holder.culture = { has_cultural_pillar = heritage_north_germanic } + } + # Set k_england's CoA to k_danelaw's. + custom_tooltip = resolve_danelaw_partition_effect.coa_changed.tt + title:k_england = { set_coa = title:k_danelaw } + # Give k_england the appropriate succession law. + add_title_law = scandinavian_elective_succession_law + } + # Use k_danelaw's title history, as they won the cold war. + copy_title_history = title:k_danelaw + # And make York the de jure capital. + set_capital_county = title:c_north_riding + } + # Remove k_danelaw. + destroy_title = title:k_danelaw + # All claims on k_danelaw become claims on k_england. + title:k_danelaw = { + every_claimant = { + custom = resolve_danelaw_partition_effect.all_claimants + remove_claim = title:k_danelaw + add_unpressed_claim = title:k_england + } + } + # Finally, mark that this has happened for HKotNS purposes. + set_global_variable = { + name = danelaw_became_england + value = yes + } + } + # If k_england is victorious, we also have a few little things to do. + if = { + limit = { scope:partition_winner = title:k_england } + # If it still exists, destroy k_danelaw. + if = { + limit = { exists = title:k_danelaw.holder } + destroy_title = title:k_danelaw + } + # All claims on k_danelaw are removed. + title:k_danelaw = { + every_claimant = { + custom = resolve_danelaw_partition_effect.all_claimants + remove_claim = title:k_danelaw + } + } + } +} + +formalise_the_daneland_effect = { + # To start with, remove the partition variable (so that we don't calculate partition resolution whilst taking the alternate route). + remove_global_variable = partition_active_danelaw + # Clarify the status of the partition for the player. + custom_tooltip = formalise_the_daneland_effect.partition_status.tt + # Sort the title swap. + ## First, flip everything in k_danelaw to k_daneland. + custom_tooltip = formalise_the_daneland_effect.adjust_de_jures.tt + hidden_effect = { + title:k_danelaw = { + every_in_de_jure_hierarchy = { + limit = { tier = tier_duchy } + set_de_jure_liege_title = title:k_daneland + } + } + # Add k_daneland to whatever empire k_danelaw is part of. + title:k_daneland = { set_de_jure_liege_title = title:k_danelaw.de_jure_liege } + } + ## Then, swap the two titles out. + ### Give k_daneland to scope:founder. + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + } + title:k_daneland = { + change_title_holder = { + holder = scope:founder + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + ### Do some assorted aesthetic prep-work on k_daneland. + hidden_effect = { + title:k_daneland = { + # Give them k_danelaw's CoA. + set_coa = title:k_danelaw + # & title history. + copy_title_history = title:k_danelaw + } + } + ### Destroy k_danelaw. + destroy_title = title:k_danelaw + # All claims on k_danelaw become claims on k_daneland + title:k_danelaw = { + every_claimant = { + custom = formalise_the_daneland_effect.all_claimants + remove_claim = title:k_danelaw + add_unpressed_claim = title:k_daneland + } + } + # Step a rivalry with scope:england. + scope:founder = { + progress_towards_rival_effect = { + CHARACTER = scope:england + OPINION = -75 + REASON = rival_daneland + } + } +} + +################################################## +# Found Cadet House Effects +found_cadet_house_decision_effect = { + $CHARACTER$ = { + save_scope_as = new_head + save_scope_as = new_house_head # don't ask + hidden_effect = { + house.house_head = { + save_scope_as = former_house_head + } + house = { + save_scope_as = former_house + } + add_achievement_flag_effect = { FLAG = achievement_a_house_of_my_own_flag } + + #Cultural variation for Cadet Branch Naming: + + if = { # Prefixed Primary Title - (PREFIX) (TITLE) + limit = { + is_landed = yes + highest_held_title_tier <= tier_duchy + OR = { + culture = { has_cultural_pillar = heritage_frankish } + top_liege = { + has_title = title:k_france + culture = { has_cultural_pillar = heritage_frankish } + } + } + } + create_cadet_branch = { + prefix = dynnp_de + name = cadet_name_style_primary_title + save_scope_as = new_house + } + } + else_if = { # Barony Dynasty - (BARONY) (DYNASTY) + limit = { + is_landed = yes + culture = { + OR = { + # India + has_cultural_pillar = heritage_indo_aryan + has_cultural_pillar = heritage_dravidian + # Vietnam + has_cultural_pillar = heritage_viet + has_name_list = name_list_vietnamese + # Khmer + has_name_list = name_list_khmer + # Mon + has_name_list = name_list_mon + # Cham + has_name_list = name_list_cham + # Tai + has_name_list = name_list_tai + # China + has_cultural_pillar = heritage_chinese + has_name_list = name_list_han + # Korea + has_cultural_pillar = heritage_korean + has_name_list = name_list_korean + # Buyeo + has_cultural_pillar = heritage_buyeo + has_name_list = name_list_balhae + } + } + NOT = { faith.religion = religion:islam_religion } + } + create_cadet_branch = { + name = cadet_name_style_barony_dynasty + save_scope_as = new_house + } + scope:new_house = { generate_coa = yes } # Avoid western style cadet CoA + } + else_if = { # County Dynasty - (COUNTY) (DYNASTY) + limit = { + is_landed = yes + culture = { + OR = { + # Malaysia + has_name_list = name_list_malay + } + } + } + create_cadet_branch = { + name = cadet_name_style_county_dynasty + save_scope_as = new_house + } + scope:new_house = { generate_coa = yes } # Avoid western style cadet CoA + } + else_if = { # Japanese - (PLACE) + limit = { + exists = var:new_japanese_house_name + culture = { + # Japan + OR = { + has_cultural_pillar = heritage_japonic + has_name_list = name_list_yamato + } + } + } + create_cadet_branch = { + name = { + first_valid = { + triggered_desc = { + trigger = { scope:new_head.var:new_japanese_house_name ?= flag:japanese_house_random_barony } + desc = japanese_house_random_barony + } + triggered_desc = { + trigger = { scope:new_head.var:new_japanese_house_name ?= flag:japanese_house_primary_county } + desc = japanese_house_primary_county + } + triggered_desc = { + trigger = { scope:new_head.var:new_japanese_house_name ?= flag:japanese_house_domicile_barony } + desc = japanese_house_domicile_barony + } + triggered_desc = { + trigger = { scope:new_head.var:new_japanese_house_name ?= flag:japanese_house_domicile_county } + desc = japanese_house_domicile_county + } + triggered_desc = { + trigger = { scope:new_head.var:new_japanese_house_name ?= flag:japanese_house_first_name } + desc = japanese_house_first_name + } + triggered_desc = { + trigger = { scope:new_head.var:new_japanese_house_name ?= flag:custom } + desc = japanese_house_name_custom + } + triggered_desc = { + trigger = { exists = scope:new_head.var:new_japanese_house_name } + desc = japanese_house_name_flag + } + desc = japanese_house_name_fallback + } + } + save_scope_as = new_house + } + scope:new_house = { generate_coa = yes } # Avoid western style cadet CoA + } + else = { #Standard Name Generation + create_cadet_branch = { save_scope_as = new_house } + } + } + + add_prestige = $PRESTIGE$ + + hidden_effect_new_object = { + save_scope_as = new_head + every_player = { + limit = { + exists = house + scope:new_house ?= house + NOT = { this = $CHARACTER$ } + } + send_interface_toast = { + type = msg_created_new_house + title = created_cadet_branch_toast_new_house_desc + left_icon = scope:new_head + desc = created_cadet_branch_toast_new_house_other_tt + } + } + send_interface_toast = { + type = msg_created_new_house + title = created_cadet_branch_toast_new_house_desc + left_icon = scope:new_head + right_icon = scope:former_house_head + desc = created_cadet_branch_toast_new_house_other_tt + } + } + + random_artifact = { + limit = { + var:banner_dynasty ?= $CHARACTER$.dynasty + artifact_owner = { + NOT = { this = $CHARACTER$ } + in_diplomatic_range = $CHARACTER$ + } + NOT = { + any_artifact_house_claimant = { + scope:new_house ?= this + } + } + } + save_scope_as = new_branch_dynasty_banner + scope:new_house ?= { + add_house_artifact_claim = scope:new_branch_dynasty_banner + } + } + + # Struggle Catalysts + if = { + limit = { + $CHARACTER$ = { + exists = house.house_head + any_character_struggle = { + involvement = involved + phase_has_catalyst = catalyst_cadet_branch_created + } + } + } + every_character_struggle = { + involvement = involved + activate_struggle_catalyst = { + catalyst = catalyst_cadet_branch_created + character = $CHARACTER$ + } + log_debug_variable_for_persian_struggle_effect = { VAR = unrest_catalyst_cadet_branch_created } + } + } + + every_child = { + limit = { + has_trait = bastard + is_lowborn = no + dynasty = scope:new_head.dynasty + NOT = { house = scope:new_house } + } + set_house = scope:new_house + } + + # If eligible, create a cadet branch for admin type governments + if = { + limit = { + government_allows = noble_families + OR = { + highest_held_title_tier >= main_administrative_tier + AND = { + government_has_flag = government_has_county_tier_noble_families + highest_held_title_tier >= tier_county + } + } + } + create_noble_family_effect = { GOVERNMENT_GIVER = this } + change_influence = major_influence_gain + } + } +} + +learn_language_linguist_effect = { + hidden_effect = { add_courtier = $LINGUIST$ } + $LINGUIST$ = { save_scope_as = selected_linguist } + custom_tooltip = ep1_decision.0201.tt.aptitude + send_interface_toast = { + title = learn_court_language_toast_title + left_icon = root + right_icon = $LINGUIST$ + court_position_grant_effect = { + EMPLOYER = root + POS = court_tutor + CANDIDATE = $LINGUIST$ + } + if = { + limit = { + NOT = { knows_language_of_culture = $LINGUIST$.culture } + } + start_scheme = { + type = learn_language + target_character = $LINGUIST$ + } + } + } +} + +linguist_bonus_culture_effect = { + if = { + limit = { exists = scope:$CULTURE$ } + if = { + limit = { + any_culture_global = { + exists = culture_head + has_same_culture_heritage = scope:$CULTURE$ + NOR = { + has_same_culture_language = scope:$CULTURE$ + has_same_culture_language = root.culture + AND = { + exists = scope:target_court_language.culture + has_same_culture_language = scope:target_court_language.culture + } + AND = { + exists = scope:ling_cul_1_bonus + THIS = scope:ling_cul_1_bonus + } + AND = { + exists = scope:ling_cul_2_bonus + THIS = scope:ling_cul_2_bonus + } + AND = { + exists = scope:ling_cul_3_bonus + THIS = scope:ling_cul_3_bonus + } + } + } + } + random_culture_global = { # Find a culture that speaks this language natively + limit = { + exists = culture_head + has_same_culture_heritage = scope:$CULTURE$ + NOR = { + has_same_culture_language = scope:$CULTURE$ + has_same_culture_language = root.culture + AND = { + exists = scope:target_court_language.culture + has_same_culture_language = scope:target_court_language.culture + } + AND = { + exists = scope:ling_cul_1_bonus + THIS = scope:ling_cul_1_bonus + } + AND = { + exists = scope:ling_cul_2_bonus + THIS = scope:ling_cul_2_bonus + } + AND = { + exists = scope:ling_cul_3_bonus + THIS = scope:ling_cul_3_bonus + } + } + } + save_scope_as = $CULTURE$_bonus + } + } + else = { + random_kingdom = { + limit = { + exists = holder + NOR = { + holder = root + AND = { + exists = scope:target_court_language + holder = scope:target_court_language + } + } + holder = { + in_diplomatic_range = root + culture = { + NOR = { + has_same_culture_language = scope:$CULTURE$ + has_same_culture_language = root.culture + AND = { + exists = scope:target_court_language + has_same_culture_language = scope:target_court_language.culture + } + AND = { + exists = scope:ling_cul_1_bonus + this = scope:ling_cul_1_bonus + } + AND = { + exists = scope:ling_cul_2_bonus + this = scope:ling_cul_2_bonus + } + AND = { + exists = scope:ling_cul_3_bonus + this = scope:ling_cul_3_bonus + } + } + } + } + } + holder.culture = { save_scope_as = $CULTURE$_bonus } + } + } + } +} + +linguist_random_realm_effect = { + # Save random culture realm to fetch faith + if = { + limit = { + any_independent_ruler = { culture = scope:$CULTURE$ } + } + ordered_independent_ruler = { + limit = { culture = scope:$CULTURE$ } + order_by = primary_title.tier + save_scope_as = $CULTURE$_ruler + } + } + # Save fallback to fetch faith + else = { + scope:target_court_language = { save_scope_as = $CULTURE$_ruler } + } +} + +isolate_family_decision_effect = { + show_as_tooltip = { + every_close_family_member = { + custom = every_close_family_member_at_court + limit = { + is_courtier_of = root + } + add_character_modifier = { + modifier = isolating_modifier + years = 5 + } + } + add_character_modifier = { + modifier = isolating_modifier + years = 5 + } + } + custom_tooltip = travelling_will_break_isolation_tt + hidden_effect = { + every_close_family_member = { + custom = every_close_family_member_at_court + limit = { + is_courtier_of = root + } + root = { + add_to_variable_list = { + name = isolating_relatives + target = prev + } + } + add_character_flag = { + flag = blocked_from_leaving + years = 5 + } + add_character_modifier = { + modifier = isolating_modifier + years = 5 + } + } + every_consort = { + limit = { + is_courtier_of = root + } + root = { + add_to_variable_list = { + name = isolating_relatives + target = prev + } + } + add_character_flag = { + flag = blocked_from_leaving + years = 5 + } + add_character_modifier = { + modifier = isolating_modifier + years = 5 + } + } + add_character_modifier = { + modifier = isolating_modifier + years = 5 + } + set_variable = { + name = isolating_cooldown_var + years = 1 + } + add_character_flag = { # Prevent the AI from constantly coming in and out of isolation + flag = ai_unisolate_cooldown + years = 1 + } + } + stress_impact = { + brave = minor_stress_impact_gain + gregarious = minor_stress_impact_gain + } +} + +unisolate_family_decision_effect = { + show_as_tooltip = { + every_close_family_member = { + custom = every_close_family_member_at_court + limit = { + is_courtier_of = root + } + remove_character_modifier = isolating_modifier + } + } + hidden_effect = { + every_in_list = { + variable = isolating_relatives + limit = { is_alive = yes } + remove_character_modifier = isolating_modifier + remove_character_flag = blocked_from_leaving + } + clear_variable_list = isolating_relatives + } + remove_character_modifier = isolating_modifier + stress_impact = { + paranoid = minor_stress_impact_gain + shy = minor_stress_impact_gain + } +} + + +#Whippy whippy +flagellation_decision_effect = { + #Get both rewards + if = { + limit = { + has_trait = flagellant + faith = { has_doctrine_parameter = self_mutilation_active } + } + add_stress = major_stress_loss + add_piety = medium_piety_value + } + #Only Piety + else_if = { + limit = { + faith = { has_doctrine_parameter = self_mutilation_active } + } + add_piety = medium_piety_value + } + #Only Stress-loss + else = { add_stress = major_stress_loss } + + #Be kind to the AI + if = { + limit = { is_ai = yes } + random_list = { + 75 = { + #No increase + } + 25 = { + increase_wounds_effect = { REASON = whipping } + } + } + } + else = { + increase_wounds_effect = { REASON = whipping } + } + + #Not already flagellant? + if = { + limit = { + NOT = { has_trait = flagellant } + } + random = { + chance = 20 + add_trait = flagellant + add_stress = major_stress_loss + } + } + +} diff --git a/N3OW/common/scripted_effects/00_diarchy_scripted_effects.txt b/N3OW/common/scripted_effects/00_diarchy_scripted_effects.txt new file mode 100644 index 00000000..9e8b23d6 --- /dev/null +++ b/N3OW/common/scripted_effects/00_diarchy_scripted_effects.txt @@ -0,0 +1,2577 @@ +############# +# Diarchy Scripted Effects +############# + +################################################## +# Debug Effects + +log_diarch_send_interaction_as_variable_effect = { + if = { + limit = { always = no } + # Did a landless diarch send this? + if = { + limit = { + scope:actor = { is_ruler = no } + } + if = { + limit = { + NOT = { exists = global_var:landless_diarch_tried_$INTERACTION$ } + } + set_global_variable = { + name = landless_diarch_tried_$INTERACTION$ + value = 1 + } + } + else = { + change_global_variable = { + name = landless_diarch_tried_$INTERACTION$ + add = 1 + } + } + } + } +} + +# These two effects exist to allow quantitative tracking of how many characters in the world are actually using diarch interactions & in what numbers mid-game — left in case Design needs to do more frequency checking & doesn't want to re-script everything. +diarch_interaction_set_or_update_global_variable_effect = { + if = { + limit = { always = no } + if = { + limit = { + NOT = { exists = global_var:$VARIABLE$ } + } + set_global_variable = { + name = $VARIABLE$ + value = 1 + } + } + else = { + change_global_variable = { + name = $VARIABLE$ + add = 1 + } + } + } +} +diarch_interaction_add_to_global_list_effect = { + if = { + limit = { always = no } + add_to_global_variable_list = { + name = $VARIABLE_LIST$ + target = this + } + } +} + +################################################## +# Historical Effects + +remove_generated_diarch_consequences_effect = { + $NEW_DIARCH$ = { + remove_opinion = { + target = $LIEGE$ + modifier = designated_me_regent_opinion + } + } + $LIEGE$ = { + every_diarchy_succession_character = { + remove_opinion = { + target = $LIEGE$ + modifier = passed_me_over_for_regent_opinion + } + } + every_vassal = { + vassal_stance = courtly + remove_opinion = { + target = $LIEGE$ + modifier = designated_bad_regent_opinion + } + } + } +} + +################################################## +# Decision Effects + +ai_diarch_check_to_see_if_should_launch_coup_effect = { + scope:actor = { + if = { + limit = { + # Robots only, please. + is_ai = yes + # Check that this is the diarch. + is_diarch_of_target = scope:recipient + # Plus a few checks for scope:recipient. + scope:recipient = { + # Then, we look to see if we've hit that magic number. + has_diarchy_active_parameter = regents_can_try_to_overthrow_present_lieges + # Finally, make sure that scope:recipient doesn't have a sensibility cooldown on 'em. + NOT = { has_character_flag = immune_ai_coups } + } + # Only disloyal diarchs will even consider this. It's really not for casuals. + diarch_loyalty <= diarch_loyalty_visibly_disloyal_threshold + } + # Right, lets try for some treason, then! + trigger_event = diarchy.9031 + } + } +} + +diarch_finalise_conspirators_for_overthrow_list_effect = { + # The list we know we have. + every_in_list = { + variable = coup_pv_supporters_list + limit = { + diarch_coup_valid_conspiracy_culmination_vassals_trigger = { LIEGE = prev.liege } + } + add_to_list = coup_pv_supporters_final_list + } + # & the lists we only might have. + ## Hooks. + if = { + limit = { has_variable_list = coup_promise_list_weak_hook } + every_in_list = { + variable = coup_promise_list_weak_hook + limit = { + diarch_coup_valid_conspiracy_culmination_vassals_trigger = { LIEGE = prev.liege } + } + add_to_list = coup_promise_list_weak_hook_final + } + } + ## Strong hooks. + if = { + limit = { has_variable_list = coup_promise_list_strong_hook } + every_in_list = { + variable = coup_promise_list_strong_hook + limit = { + diarch_coup_valid_conspiracy_culmination_vassals_trigger = { LIEGE = prev.liege } + } + add_to_list = coup_promise_list_strong_hook_final + } + } + ## Gold. + if = { + limit = { has_variable_list = coup_promise_list_gold } + every_in_list = { + variable = coup_promise_list_gold + limit = { + diarch_coup_valid_conspiracy_culmination_vassals_trigger = { LIEGE = prev.liege } + } + add_to_list = coup_promise_list_gold_final + } + } + ## Big gold. + if = { + limit = { has_variable_list = coup_promise_list_big_gold } + every_in_list = { + variable = coup_promise_list_big_gold + limit = { + diarch_coup_valid_conspiracy_culmination_vassals_trigger = { LIEGE = prev.liege } + } + add_to_list = coup_promise_list_big_gold_final + } + } +} + +diarch_clean_up_conspiracy_variables_effect = { + if = { + limit = { is_alive = yes } + remove_variable = coup_pv_supporters_list + remove_variable = coup_promise_list_weak_hook + remove_variable = coup_promise_list_strong_hook + remove_variable = coup_promise_list_gold + remove_variable = coup_promise_list_big_gold + } +} + +diarch_coup_preamble_effects_effect = { + # Note that we don't want a list when it comes to the coup event. + save_scope_value_as = { + name = disable_display_rightful_imprisonment_tooltip + value = yes + } + # If there's an alliance, it's pretty decisively broken. + if = { + limit = { is_allied_to = scope:liege } + break_alliance_due_to_attack_effect = { TARGET = scope:liege } + } + # And don't forget stress! + stress_impact = { + base = major_stress_impact_gain + disloyal = medium_stress_impact_loss + ambitious = minor_stress_impact_loss + arrogant = minor_stress_impact_loss + callous = miniscule_stress_impact_loss + arbitrary = miniscule_stress_impact_loss + just = minor_stress_impact_gain + humble = medium_stress_impact_gain + content = medium_stress_impact_gain + loyal = major_stress_impact_gain + } + # Register that the AI shouldn't try to coup liege again for a *while*. + scope:liege = { + add_character_flag = { + flag = immune_ai_coups + years = 50 + } + } +} + +################################################## +# Activities + +remove_strife_per_invited_powerful_vassal_effect = { + scope:activity = { + if = { + limit = { + # Does scope:host have any strife to take care of? + scope:host = { + exists = liege + strife_opinion >= 1 + } + any_attending_character = { + this != scope:host + is_powerful_vassal_of = scope:host.liege + } + } + # Save a variable for the loc key so that we don't need to parse a million scopes _into_ the key. + ## We do it this way because the custom_tooltip otherwise gets real finnicky about having + scope:host = { + set_variable = { + name = strife_loss_total + value = { + value = scope:activity.diarch_reduced_strife_for_inviting_powerful_covassals_value + # Invert it for UX purposes. + multiply = -1 + } + } + } + custom_tooltip = remove_strife_per_invited_powerful_vassal_effect.tt + ## Don't forget to remove the variable! + # Now, change the actual strife. + hidden_effect = { + scope:host = { change_strife_opinion = scope:activity.diarch_reduced_strife_for_inviting_powerful_covassals_value } + } + } + } +} + +################################################## +# Character Interactions + +diarch_changed_own_contract_effect = { + if = { + limit = { always = scope:diarch } + scope:recipient = { + custom_tooltip = liege_modify_vassal_contract_interaction.tt.diarch_powers_used + # Co-rulers lose a fair bit less & can change multiple times. + if = { + limit = { + diarch ?= scope:actor + has_diarchy_active_parameter = diarchy_is_co_rulership + } + add_opinion = { + target = scope:actor + modifier = abused_position_of_trust_opinion + opinion = -10 + } + } + # Everyone else loses much more. + else = { + add_to_variable_list = { + name = diarch_contract_rights_used_list + target = scope:actor + } + add_opinion = { + target = scope:actor + modifier = abused_position_of_trust_opinion + opinion = -40 + } + } + } + } +} + +diarch_revoke_title_interaction_intermediary_fail_opinions_effect = { + # Scope:actor dislikes scope:intermediary. + scope:actor = { + if = { + limit = { is_ai = yes } + add_opinion = { + target = scope:intermediary + modifier = disappointed_opinion + opinion = -20 + } + } + } + # Scope:recipient has mixed feelings. + scope:recipient = { + # Specifically, they're now happy with scope:intermediary... + if = { + limit = { is_ai = yes } + add_opinion = { + target = scope:intermediary + modifier = protected_me_opinion + opinion = 20 + } + # ... but upset with scope:actor. + add_opinion = { + target = scope:actor + modifier = revoked_title + } + } + } +} + +diarch_retract_vassal_interaction_intermediary_fail_opinions_effect = { + # Scope:actor dislikes scope:intermediary. + scope:actor = { + if = { + limit = { is_ai = yes } + add_opinion = { + target = scope:intermediary + modifier = disappointed_opinion + opinion = -20 + } + } + } + # Scope:recipient has mixed feelings. + scope:recipient = { + # Specifically, they're now happy with scope:intermediary... + if = { + limit = { is_ai = yes } + add_opinion = { + target = scope:intermediary + modifier = protected_me_opinion + opinion = 20 + } + # ... but upset with scope:actor. + add_opinion = { + target = scope:actor + modifier = retracted_vassal + } + } + } +} + +diarch_imprison_interaction_intermediary_fail_opinions_effect = { + # Scope:actor dislikes scope:intermediary. + scope:actor = { + if = { + limit = { is_ai = yes } + add_opinion = { + target = scope:intermediary + modifier = disappointed_opinion + opinion = -20 + } + } + } + # Scope:recipient has mixed feelings. + scope:recipient = { + # Specifically, they're now happy with scope:intermediary... + if = { + limit = { is_ai = yes } + add_opinion = { + target = scope:intermediary + modifier = protected_me_opinion + opinion = 20 + } + # ... but upset with scope:actor. + add_opinion = { + target = scope:actor + modifier = imprisoned_me_past + } + } + } +} + +diarch_legal_meddling_interaction_success_effect = { + scope:actor = { + # Nab the claim. + add_unpressed_claim = scope:target + # We nest this so that scope:recipient doesn't have to see their own opinion effects. + if = { + limit = { + this != scope:recipient + } + # Add some opinion loss. + ## Counties are worrying. + if = { + limit = { scope:target.tier = tier_county } + reverse_add_opinion = { + target = scope:recipient + modifier = annoyed_opinion + opinion = -20 + } + change_strife_opinion = minor_strife_gain + } + ## Duchies are troublesome. + else_if = { + limit = { scope:target.tier = tier_duchy } + reverse_add_opinion = { + target = scope:recipient + modifier = angry_opinion + opinion = -40 + } + change_strife_opinion = medium_strife_gain + } + ## Kingdoms are hateful. + else_if = { + limit = { scope:target.tier = tier_kingdom } + reverse_add_opinion = { + target = scope:recipient + modifier = hate_opinion + opinion = -60 + } + change_strife_opinion = major_strife_gain + } + } + } + # Object explorer logging. + scope:actor = { + diarch_interaction_set_or_update_global_variable_effect = { VARIABLE = di_track_legmed_success } + diarch_interaction_add_to_global_list_effect = { VARIABLE_LIST = di_track_legmed_success_actor_list } + } + scope:recipient = { + diarch_interaction_add_to_global_list_effect = { VARIABLE_LIST = di_track_legmed_success_recipient_list } + } +} + +diarch_legal_meddling_interaction_fail_effect = { + scope:actor = { + # Gain some stress. + add_stress = minor_stress_gain + # We nest this so that scope:recipient doesn't have to see their own opinion effects. + if = { + limit = { + this != scope:recipient + } + # Add some opinion loss. + ## Counties are worrying. + if = { + limit = { scope:target.tier = tier_county } + reverse_add_opinion = { + target = scope:recipient + modifier = respect_opinion + opinion = -10 + } + } + ## Duchies are troublesome. + else_if = { + limit = { scope:target.tier = tier_duchy } + reverse_add_opinion = { + target = scope:recipient + modifier = annoyed_opinion + opinion = -20 + } + } + ## Kingdoms are hateful. + else_if = { + limit = { scope:target.tier = tier_kingdom } + reverse_add_opinion = { + target = scope:recipient + modifier = angry_opinion + opinion = -30 + } + } + } + } + # Object explorer logging. + scope:actor = { + diarch_interaction_set_or_update_global_variable_effect = { VARIABLE = di_track_legmed_failure } + diarch_interaction_add_to_global_list_effect = { VARIABLE_LIST = di_track_legmed_failure_actor_list } + } + scope:recipient = { + diarch_interaction_add_to_global_list_effect = { VARIABLE_LIST = di_track_legmed_failure_recipient_list } + } +} + +diarch_legal_meddling_interaction_apply_success_effect = { + # Notify other parties. + hidden_effect = { + # Inform the liege. + scope:actor.liege = { + send_interface_message = { + type = msg_diarch_acting_effect + title = diarch_using_powers.t + right_icon = scope:recipient + left_icon = scope:actor + show_as_tooltip = { diarch_legal_meddling_interaction_success_effect = yes } + } + } + # Inform scope:recipient. + scope:recipient = { + send_interface_toast = { + type = event_toast_effect_bad + title = diarch_legal_meddling_interaction.tt.success + left_icon = scope:actor + show_as_tooltip = { diarch_legal_meddling_interaction_success_effect = yes } + } + } + } + # Finally, fire off the actual effect. + send_interface_toast = { + type = event_toast_effect_good + title = diarch_legal_meddling_interaction.tt.success + left_icon = scope:recipient + # Prestige costs. + ## Point out the lack of cost. + if = { + limit = { scope:diarch_legal_meddling_interaction_duel_learning = yes } + custom_tooltip = diarch_interaction_pay_prestige_none + } + ## Point out the discount. + else_if = { + limit = { scope:diarch_legal_meddling_interaction_pay_prestige_partial = yes } + add_prestige = legal_meddling_interaction_title_discounted_cost_value + } + ## Soz mate, yerr payin' full price. + else = { add_prestige = legal_meddling_interaction_title_cost_value } + # Gib claim & opinion loss. + diarch_legal_meddling_interaction_success_effect = yes + } +} + +diarch_legal_meddling_interaction_apply_fail_effect = { + # Notify other parties. + hidden_effect = { + # Inform scope:secondary_recipient. + scope:secondary_recipient = { + send_interface_message = { + type = msg_diarch_acting_text_and_effect + title = diarch_using_powers.t + desc = diarch_legal_meddling_interaction.tt.failure.liege + right_icon = scope:recipient + left_icon = scope:actor + show_as_tooltip = { diarch_legal_meddling_interaction_fail_effect = yes } + } + } + # Inform scope:recipient. + scope:recipient = { + send_interface_toast = { + type = event_toast_effect_good + title = diarch_legal_meddling_interaction.tt.failure + left_icon = scope:actor + show_as_tooltip = { diarch_legal_meddling_interaction_fail_effect = yes } + } + } + } + # Finally, fire off the actual effect. + send_interface_toast = { + type = event_toast_effect_bad + title = diarch_legal_meddling_interaction.tt.failure + left_icon = scope:recipient + diarch_legal_meddling_interaction_fail_effect = yes + } +} + +diarch_syphon_treasury_interaction_syphon_development_growth_effect = { + # First, configure the development growth loss to be divided. + save_scope_value_as = { + name = county_attribute_loss + value = $LOSS$ + } + if = { + limit = { scope:county_attribute_loss = massive_development_progress_loss } + custom_tooltip = diarch_syphon_treasury_interaction_syphon_development_growth_massive_tt + } + else_if = { + limit = { scope:county_attribute_loss = major_development_progress_loss } + custom_tooltip = diarch_syphon_treasury_interaction_syphon_development_growth_major_tt + } + else_if = { + limit = { scope:county_attribute_loss = medium_development_progress_loss } + custom_tooltip = diarch_syphon_treasury_interaction_syphon_development_growth_medium_tt + } + else = { custom_tooltip = diarch_syphon_treasury_interaction_syphon_development_growth_minor_tt } + # Now, execute our general effects. + hidden_effect = { + while = { + count = syphon_treasury_recipient_county_tally + random_held_county = { + limit = { + NOT = { + save_temporary_scope_as = current_county + any_in_list = { + list = syphon_treasury_affected_counties + this = scope:current_county + } + } + } + change_development_progress = syphon_treasury_county_attribute_loss_fraction + add_to_list = syphon_treasury_affected_counties + } + } + } +} + +diarch_syphon_treasury_interaction_syphon_control_effect = { + # First, configure the control loss to be divided. + save_scope_value_as = { + name = county_attribute_loss + value = $LOSS$ + } + # Now, execute our general effects. + while = { + count = syphon_treasury_recipient_county_tally + random_held_county = { + limit = { + NOT = { + save_temporary_scope_as = current_county + any_in_list = { + list = syphon_treasury_affected_counties + this = scope:current_county + } + } + } + change_county_control = syphon_treasury_county_attribute_loss_fraction + add_to_list = syphon_treasury_affected_counties + } + } +} + +diarch_syphon_treasury_interaction_caught_embezzling_effect = { + scope:actor = { + # Variable results depending on embezzlement level. + ## Very high. + if = { + limit = { always = scope:diarch_syphon_treasury_sum_huge } + # Apply strife. + change_strife_opinion = monumental_strife_gain + # Negative opinion. + scope:recipient = { + # Greedy characters will not forgive this slight if they can help it. + if = { + limit = { + has_trait = greedy + can_set_relation_nemesis_trigger = { CHARACTER = scope:actor } + } + set_relation_nemesis = { + target = scope:actor + reason = rival_tried_to_embezzle + } + } + # Forgiving characters lose a little less. + else_if = { + limit = { has_trait = forgiving } + add_opinion = { + target = scope:actor + modifier = disappointed_opinion + opinion = -10 + } + } + # Otherwise, folks do be mad. + else = { + add_opinion = { + target = scope:actor + modifier = trust_opinion + opinion = -45 + } + } + } + } + ## High. + else_if = { + limit = { always = scope:diarch_syphon_treasury_sum_large } + # Apply strife. + change_strife_opinion = massive_strife_gain + # Negative opinion. + scope:recipient = { + # Greedy characters will not forgive this slight if they can help it. + if = { + limit = { + has_trait = greedy + can_set_relation_rival_trigger = { CHARACTER = scope:actor } + } + set_relation_rival = { + target = scope:actor + reason = rival_tried_to_embezzle + } + } + # Forgiving characters lose a little less. + else_if = { + limit = { has_trait = forgiving } + add_opinion = { + target = scope:actor + modifier = disappointed_opinion + opinion = -5 + } + } + # Otherwise, folks are still somewhat mad. + else = { + add_opinion = { + target = scope:actor + modifier = trust_opinion + opinion = -20 + } + } + } + } + ## Medium. + else_if = { + limit = { always = scope:diarch_syphon_treasury_sum_medium } + # Apply strife. + change_strife_opinion = major_strife_gain + # Negative opinion. + ## Covered by embezzlement. + ## Greedy characters do still have a bit more room for hate. + scope:recipient = { + if = { + limit = { + scope:recipient = { has_trait = greedy } + } + progress_towards_rival_effect = { + REASON = rival_tried_to_embezzle + CHARACTER = scope:actor + OPINION = 0 + } + } + } + } + ## Low. + else_if = { + limit = { always = scope:diarch_syphon_treasury_sum_small } + # Apply strife. + change_strife_opinion = medium_strife_gain + # Negative opinion. + ## Covered by embezzlement. + ## Greedy characters do still have a bit more room for hate. + scope:recipient = { + if = { + limit = { + scope:recipient = { has_trait = greedy } + } + progress_towards_rival_effect = { + REASON = rival_tried_to_embezzle + CHARACTER = scope:actor + OPINION = 0 + } + } + } + } + # Crime opinion. + reverse_add_opinion = { + target = scope:recipient + modifier = embezzled_opinion + } + } +} + +diarch_shift_privileges_interaction_success_apply_modifiers_vague_effect = { + scope:recipient = { + # We obfuscate at this stage for neater UX. + custom_tooltip = diarch_shift_privileges_interaction.tt.success.random_negative_effect + } +} + +diarch_shift_privileges_interaction_success_apply_modifiers_actual_effect = { + # Add a randomised negative modifier. + random_list = { + # Target cash. + 100 = { + ordered_held_title = { + title_tier = county + limit = { + diarch_shift_privileges_valid_target_title_trigger = yes + } + order_by = { + value = title_province.monthly_income + # Weight down the capital to be the last selected, if we can. + if = { + limit = { this = scope:recipient.capital_county } + add = -1000 + } + } + add_county_modifier = { + modifier = shift_privileges_monopolies_sold_modifier + years = shift_privileges_modifier_duration_value + } + change_county_control = medium_county_control_loss + } + } + # Target levies. + 100 = { + ordered_held_title = { + title_tier = county + limit = { + diarch_shift_privileges_valid_target_title_trigger = yes + } + order_by = { + value = building_levies + # Weight down the capital to be the last selected, if we can. + if = { + limit = { this = scope:recipient.capital_county } + add = -1000 + } + } + add_county_modifier = { + modifier = shift_privileges_scutage_exemptions_modifier + years = shift_privileges_modifier_duration_value + } + change_county_control = medium_county_control_loss + } + } + # Target development growth. + 100 = { + ordered_held_title = { + title_tier = county + limit = { + diarch_shift_privileges_valid_target_title_trigger = yes + } + order_by = { + value = development_rate + # Weight down the capital to be the last selected, if we can. + if = { + limit = { this = scope:recipient.capital_county } + add = -1000 + } + } + add_county_modifier = { + modifier = shift_privileges_conflicting_deeds_modifier + years = shift_privileges_modifier_duration_value + } + change_county_control = medium_county_control_loss + } + } + } + # Object explorer logging. + scope:actor = { + diarch_interaction_set_or_update_global_variable_effect = { VARIABLE = di_track_shiftpriv_success } + diarch_interaction_add_to_global_list_effect = { VARIABLE_LIST = di_track_shiftpriv_success_actor_list } + } + scope:recipient = { + diarch_interaction_add_to_global_list_effect = { VARIABLE_LIST = di_track_shiftpriv_success_recipient_list } + } +} + +diarch_shift_privileges_interaction_success_apply_opinion_effect = { + scope:actor = { + # Plus opinion loss. + reverse_add_opinion = { + target = scope:recipient + modifier = hate_opinion + opinion = -30 + } + # And some strife. + change_strife_opinion = minor_strife_gain + } +} + +diarch_shift_privileges_interaction_success_apply_other_effect = { + scope:actor = { + # Now we dole out some cash. + add_gold = major_gold_value + } +} + +diarch_shift_privileges_interaction_fail_effect = { + scope:actor = { + # Gain some stress, proportional to the size of the realm you're harassing. + ## Counties are a bit of stress. + if = { + limit = { scope:recipient.highest_held_title_tier >= tier_county } + add_stress = minor_stress_gain + } + ## Duchies are troublesome. + else_if = { + limit = { scope:recipient.highest_held_title_tier >= tier_duchy } + add_stress = medium_stress_gain + } + ## Kingdoms are a big deal. + else_if = { + limit = { scope:recipient.highest_held_title_tier >= tier_kingdom } + add_stress = major_stress_gain + } + # We nest this so that scope:recipient doesn't have to see their own opinion effects. + if = { + limit = { + this != scope:recipient + } + # Add some opinion loss. + reverse_add_opinion = { + target = scope:recipient + modifier = angry_opinion + opinion = -20 + } + } + } + # Object explorer logging. + scope:actor = { + diarch_interaction_set_or_update_global_variable_effect = { VARIABLE = di_track_shiftpriv_failure } + diarch_interaction_add_to_global_list_effect = { VARIABLE_LIST = di_track_shiftpriv_failure_actor_list } + } + scope:recipient = { + diarch_interaction_add_to_global_list_effect = { VARIABLE_LIST = di_track_shiftpriv_failure_recipient_list } + } +} + +diarch_shift_privileges_interaction_apply_success_effect = { + # Notify other parties. + hidden_effect = { + # Inform the liege. + scope:actor.liege = { + send_interface_message = { + type = msg_diarch_acting_effect + title = diarch_using_powers.t + right_icon = scope:recipient + left_icon = scope:actor + show_as_tooltip = { + diarch_shift_privileges_interaction_success_apply_modifiers_vague_effect = yes + diarch_shift_privileges_interaction_success_apply_other_effect = yes + } + } + } + # Inform scope:recipient. + scope:recipient = { + send_interface_toast = { + title = diarch_shift_privileges_interaction.tt.success + left_icon = scope:actor + # We apply the actual modifier here, so that scope:recipient can see it. + diarch_shift_privileges_interaction_success_apply_modifiers_actual_effect = yes + show_as_tooltip = { diarch_shift_privileges_interaction_success_apply_other_effect = yes } + } + } + } + # Finally, fire off the actual effect. + send_interface_toast = { + title = diarch_shift_privileges_interaction.tt.success + left_icon = scope:recipient + # Gib actual gold here. + diarch_shift_privileges_interaction_success_apply_other_effect = yes + # Plus talk about a county modifier. + diarch_shift_privileges_interaction_success_apply_modifiers_vague_effect = yes + } + # Finally, apply opinion loss. + diarch_shift_privileges_interaction_success_apply_opinion_effect = yes +} + +diarch_shift_privileges_interaction_apply_fail_effect = { + # Notify other parties. + hidden_effect = { + # Inform scope:secondary_recipient. + scope:secondary_recipient = { + send_interface_message = { + type = msg_diarch_acting_text_and_effect + title = diarch_using_powers.t + desc = diarch_shift_privileges_interaction.tt.failure.liege + right_icon = scope:recipient + left_icon = scope:actor + show_as_tooltip = { diarch_shift_privileges_interaction_fail_effect = yes } + } + } + # Inform scope:recipient. + scope:recipient = { + send_interface_toast = { + title = diarch_shift_privileges_interaction.tt.failure + left_icon = scope:actor + show_as_tooltip = { diarch_shift_privileges_interaction_fail_effect = yes } + } + } + } + # Finally, fire off the actual effect. + send_interface_toast = { + title = diarch_shift_privileges_interaction.tt.failure + left_icon = scope:recipient + diarch_shift_privileges_interaction_fail_effect = yes + } +} + +diarch_swing_scales_guts_effect = { + # Influence. + switch = { + trigger = yes + scope:swing_influence = { + show_as_tooltip = { + change_influence = { + value = swing_scales_influence_cost_value + # LEGITIMACY OF RULER AFFECTS COSTS FOR REGENTS + multiply = legitimacy_regent_swing_scale_multipler_value + multiply = -1 + round = yes + } + } + } + # Movement Power. + scope:swing_movement_power = { + custom_tooltip = { + text = swing_scales_decrease_movement_power + if = { + limit = { + exists = var:movement_power_decreased_diarchy + } + set_variable = { + name = movement_power_decreased_diarchy + value = { + value = var:movement_power_decreased_diarchy + add = { + value = movement_power_decreased_diarchy_value + multiply = legitimacy_regent_swing_scale_multipler_value + } + } + } + } + else = { + set_variable = { + name = movement_power_decreased_diarchy + value = { + value = movement_power_decreased_diarchy_value + multiply = legitimacy_regent_swing_scale_multipler_value + } + } + } + #force the update of variables to immediately show changes + update_character_movement_power_effect = yes + top_participant_group:dynastic_cycle ?= { + update_movement_power_effect = yes + } + } + } + # Prestige. + scope:swing_prestige = { + show_as_tooltip = { + add_prestige = { + value = swing_scales_prestige_cost_value + # LEGITIMACY OF RULER AFFECTS COSTS FOR REGENTS + multiply = legitimacy_regent_swing_scale_multipler_value + multiply = -1 + round = yes + } + } + } + # Piety. + scope:swing_piety = { + show_as_tooltip = { + add_piety = { + value = swing_scales_piety_cost_value + # LEGITIMACY OF RULER AFFECTS COSTS FOR REGENTS + multiply = legitimacy_regent_swing_scale_multipler_value + multiply = -1 + round = yes + } + } + } + # Cash. + scope:swing_gold = { + save_scope_value_as = { + name = swing_gold_value + value = { + value = swing_scales_cash_cost_value + # LEGITIMACY OF RULER AFFECTS COSTS FOR REGENTS + multiply = legitimacy_regent_swing_scale_multipler_value + round = yes + } + } + show_as_tooltip = { + pay_short_term_gold = { + target = scope:recipient + gold = scope:swing_gold_value + } + } + # Scope:actor actually loses their gold when paying the admission price for the interaction, so we silently give scope:recipient gold from nowhere instead. + hidden_effect = { + scope:recipient = { add_gold = scope:swing_gold_value } + } + } + # Hook. + scope:swing_hook = { + use_hook = scope:recipient + } + # HoF. + scope:swing_hof = { + show_as_tooltip = { + add_piety = { + value = swing_scales_piety_cost_value + multiply = -1 + } + pay_short_term_gold = { + target = scope:actor.faith.religious_head + gold = swing_scales_cash_cost_value + } + } + # The HoF doesn't need *another* source of cash unless they're fairly minor, so we only actually pay this if they're already very low on cash. + hidden_effect = { + scope:actor.faith.religious_head = { + if = { + limit = { gold <= 1000 } + add_gold = scope:actor.swing_scales_cash_cost_value + } + } + } + } + } + if = { + limit = { + scope:actor = { is_diarch_of_target = scope:recipient } + OR = { + scope:swing_influence = yes + scope:swing_prestige = yes + scope:swing_piety = yes + scope:swing_gold = yes + } + } + if = { + limit = { scope:recipient.legitimacy_level <= 2 } + custom_tooltip = legitimacy_swing_scales_cheaper_tt + } + else = { custom_tooltip = legitimacy_swing_scales_dearer_tt } + } +} + +overthrow_regent_scheme_interaction_actor_stress_effect = { + # Loyal stress. + ## Gain stress if current diarch is loyal. + if = { + limit = { + scope:recipient = { diarch_loyalty >= diarch_loyalty_visibly_loyal_threshold } + } + stress_impact = { + honest = medium_stress_impact_gain + compassionate = major_stress_impact_gain + just = major_stress_impact_gain + loyal = major_stress_impact_gain + } + if = { + limit = { has_trait = loyal } + custom_tooltip = overthrow_regent_scheme_interaction_actor_stress_effect.tt.loyal.remove_loyal + } + } + ## Lose stress if current diarch is disloyal. + else_if = { + limit = { + scope:recipient = { diarch_loyalty <= diarch_loyalty_visibly_disloyal_threshold } + } + stress_impact = { + loyal = major_stress_impact_loss + honest = medium_stress_impact_loss + compassionate = major_stress_impact_loss + just = major_stress_impact_loss + } + if = { + limit = { has_trait = loyal } + custom_tooltip = overthrow_regent_scheme_interaction_actor_stress_effect.tt.loyal.remove_disloyal + } + } + # Disloyal stress. + ## Disloyals don't care if they unseat another disloyal character enough to stress about it, even if they're a bit less likely to do it. + ## Lose stress if current diarch is loyal. + else_if = { + limit = { + scope:recipient = { diarch_loyalty >= diarch_loyalty_visibly_loyal_threshold } + } + stress_impact = { + disloyal = major_stress_impact_loss + honest = medium_stress_impact_loss + compassionate = major_stress_impact_loss + just = major_stress_impact_loss + } + if = { + limit = { has_trait = disloyal } + custom_tooltip = overthrow_regent_scheme_interaction_actor_stress_effect.tt.disloyal.remove_loyal + } + } + # Else, standard. + else = { + stress_impact = { + honest = medium_stress_impact_gain + compassionate = major_stress_impact_gain + just = major_stress_impact_gain + } + } +} + +invalidate_diarch_grand_wedding_effect = { + # Invalidate grand weddings + diarch = { + if = { + limit = { + # scope:diarch is currently an active Diarch + exists = liege + is_diarch = yes + liege = { + diarch = scope:diarch + has_active_diarchy = yes + } + # scope:diarch was promised a Grand Wedding + has_variable = promised_grand_wedding_by + } + betrothed = { save_scope_as = betrothed } + # Save scopes of spouses, and organizers from variables + scope:diarch = { + add_to_list = informee + var:promised_grand_wedding_by ?= { + add_to_list = informee + var:promised_grand_wedding_to ?= { add_to_list = informee } + } + } + scope:betrothed = { + add_to_list = informee + var:promised_grand_wedding_by ?= { + add_to_list = informee + var:promised_grand_wedding_to ?= { add_to_list = informee } + } + } + # Clean up variables and inform relevant characters of invalidation + every_in_list = { + list = informee + if = { + limit = { exists = var:promised_grand_wedding_marriage_countdown } + remove_variable = promised_grand_wedding_marriage_countdown + } + if = { + limit = { exists = var:promised_grand_wedding_by } + remove_variable = promised_grand_wedding_by + } + if = { + limit = { exists = var:promised_grand_wedding_to } + remove_variable = promised_grand_wedding_to + } + send_interface_message = { + type = msg_betrothal_invalidated + title = grand_wedding_cancelled_by_regency_title + left_icon = scope:diarch + right_icon = scope:betrothed + desc = grand_wedding_cancelled_by_regency_desc + } + } + } + } +} + +sort_vizier_candidates_to_list_effect = { + scope:actor = { + every_courtier = { + limit = { is_valid_basic_candidate_for_vizier_trigger = yes } + add_to_list = characters_pre_filter + } + every_vassal = { + limit = { + is_valid_basic_candidate_for_vizier_trigger = yes + highest_held_title_tier <= tier_barony + } + add_to_list = characters_pre_filter + } + } + hidden_effect = { + while = { + count = 6 + ordered_in_list = { + list = characters_pre_filter + order_by = diarchy_vizier_succession_score_value + limit = { + NOT = { is_in_list = characters } + } + add_to_list = characters + } + } + } +} + +mulct_vizier_for_cash_effect = { + $VIZIER$ = { + # How much cash are we getting? + ## Miniscule + if = { + limit = { scope:mulct_vizier_interaction_minimal = yes } + if = { + limit = { + NOT = { exists = scope:free_mulct } + } + update_diarchy_swing_with_perspective_effect = { + SWING = vizier_mulct_swing_gain_miniscule_value + LIEGE = $VIZIER$.liege + } + } + hidden_effect = { add_short_term_gold = liege.minor_gold_value } + pay_short_term_gold = { + target = $VIZIER$.liege + gold = liege.minor_gold_value + } + } + ## Minor + else_if = { + limit = { scope:mulct_vizier_interaction_minor = yes } + if = { + limit = { + NOT = { exists = scope:free_mulct } + } + update_diarchy_swing_with_perspective_effect = { + SWING = vizier_mulct_swing_gain_minor_value + LIEGE = $VIZIER$.liege + } + } + hidden_effect = { add_short_term_gold = liege.medium_gold_value } + pay_short_term_gold = { + target = $VIZIER$.liege + gold = liege.medium_gold_value + } + } + ## Medium + else_if = { + limit = { scope:mulct_vizier_interaction_medium = yes } + if = { + limit = { + NOT = { exists = scope:free_mulct } + } + update_diarchy_swing_with_perspective_effect = { + SWING = vizier_mulct_swing_gain_medium_value + LIEGE = $VIZIER$.liege + } + } + hidden_effect = { add_short_term_gold = liege.major_gold_value } + pay_short_term_gold = { + target = $VIZIER$.liege + gold = liege.major_gold_value + } + } + ## Major + else_if = { + limit = { scope:mulct_vizier_interaction_major = yes } + if = { + limit = { + NOT = { exists = scope:free_mulct } + } + update_diarchy_swing_with_perspective_effect = { + SWING = vizier_mulct_swing_gain_major_value + LIEGE = $VIZIER$.liege + } + } + hidden_effect = { add_short_term_gold = liege.massive_gold_value } + pay_short_term_gold = { + target = $VIZIER$.liege + gold = liege.massive_gold_value + } + } + ## Massive + else_if = { + limit = { scope:mulct_vizier_interaction_massive = yes } + if = { + limit = { + NOT = { exists = scope:free_mulct } + } + update_diarchy_swing_with_perspective_effect = { + SWING = vizier_mulct_swing_gain_massive_value + LIEGE = $VIZIER$.liege + } + } + hidden_effect = { add_short_term_gold = liege.monumental_gold_value } + pay_short_term_gold = { + target = $VIZIER$.liege + gold = liege.monumental_gold_value + } + } + # Now we pawn everything they have at the relevant level. + ## T1 + if = { + limit = { + NOT = { exists = scope:free_mulct } + scope:mulct_vizier_interaction_minor = yes + } + custom_tooltip = mulct_vizier_interaction.vizier_loses_extravagance_t1_modifiers + hidden_effect = { + remove_character_modifier = vizier_extravagance_t1_treasure_modifier + remove_character_modifier = vizier_extravagance_t1_activities_modifier + remove_character_modifier = vizier_extravagance_t1_property_modifier + remove_character_modifier = vizier_extravagance_t1_charity_modifier + } + } + ## T2 + else_if = { + limit = { + NOT = { exists = scope:free_mulct } + scope:mulct_vizier_interaction_medium = yes + } + custom_tooltip = mulct_vizier_interaction.vizier_loses_extravagance_t2_modifiers + hidden_effect = { + remove_character_modifier = vizier_extravagance_t2_treasure_modifier + remove_character_modifier = vizier_extravagance_t2_activities_modifier + remove_character_modifier = vizier_extravagance_t2_property_modifier + remove_character_modifier = vizier_extravagance_t2_charity_modifier + } + } + ## T3 + else_if = { + limit = { + NOT = { exists = scope:free_mulct } + scope:mulct_vizier_interaction_major = yes + } + custom_tooltip = mulct_vizier_interaction.vizier_loses_extravagance_t3_modifiers + hidden_effect = { + remove_character_modifier = vizier_extravagance_t3_treasure_modifier + remove_character_modifier = vizier_extravagance_t3_activities_modifier + remove_character_modifier = vizier_extravagance_t3_property_modifier + remove_character_modifier = vizier_extravagance_t3_charity_modifier + } + } + ## T4 + else_if = { + limit = { + NOT = { exists = scope:free_mulct } + scope:mulct_vizier_interaction_massive = yes + } + custom_tooltip = mulct_vizier_interaction.vizier_loses_extravagance_t4_modifiers + # But first: do we need to flag an achievement? + if = { + limit = { + liege = { is_ai = no } + has_character_modifier = vizier_extravagance_t4_treasure_modifier + has_character_modifier = vizier_extravagance_t4_activities_modifier + has_character_modifier = vizier_extravagance_t4_property_modifier + has_character_modifier = vizier_extravagance_t4_charity_modifier + } + liege = { add_character_flag = fp3_mulct_them_dry_achievement_flag } + } + hidden_effect = { + remove_character_modifier = vizier_extravagance_t4_treasure_modifier + remove_character_modifier = vizier_extravagance_t4_activities_modifier + remove_character_modifier = vizier_extravagance_t4_property_modifier + remove_character_modifier = vizier_extravagance_t4_charity_modifier + } + } + } +} + +mulct_vizier_for_cash_opinion_reaction_effect = { + # Greedy viziers hate this. + if = { + limit = { has_trait = greedy } + save_scope_value_as = { + name = opinion_val + value = { + value = -15 + multiply = $MULT$ + } + } + add_opinion = { + modifier = goldlust_opinion + target = scope:actor + opinion = scope:opinion_val + } + } + # Generous & most profligate viziers are sorta _eh_ about it. + else_if = { + limit = { + OR = { + has_trait = generous + has_trait = profligate + } + } + save_scope_value_as = { + name = opinion_val + value = { + value = -5 + multiply = $MULT$ + } + } + add_opinion = { + modifier = resigned_opinion + target = scope:actor + opinion = scope:opinion_val + } + } + # Loyal viziers consider it their duty & forgiving viziers accept it. + else_if = { + limit = { + OR = { + has_trait = loyal + has_trait = forgiving + } + } + save_scope_value_as = { + name = opinion_val + value = { + value = -7 + multiply = $MULT$ + } + } + add_opinion = { + modifier = resigned_opinion + target = scope:actor + opinion = scope:opinion_val + } + } + # Disloyal viziers think your duty can go stuff itself & vengeful viziers are irate. + else_if = { + limit = { + OR = { + has_trait = disloyal + has_trait = vengeful + } + } + save_scope_value_as = { + name = opinion_val + value = { + value = -12 + multiply = $MULT$ + } + } + add_opinion = { + modifier = took_my_coin_opinion + target = scope:actor + opinion = scope:opinion_val + } + } + # Everyone else is annoyed. + else = { + save_scope_value_as = { + name = opinion_val + value = { + value = -10 + multiply = $MULT$ + } + } + add_opinion = { + modifier = took_my_coin_opinion + target = scope:actor + opinion = scope:opinion_val + } + } +} + +diarch_request_imperial_expedition_accepted_effect = { + # Explain what's up. + custom_tooltip = diarch_request_imperial_expedition_interaction.tt.access_to_cb + custom_tooltip = diarch_request_imperial_expedition_interaction.tt.governors_as_allies + custom_tooltip = diarch_request_imperial_expedition_interaction.tt.target_behaviour_explanation + custom_tooltip = diarch_request_imperial_expedition_interaction.tt.post_war + # Give us our charge so we can actually use the CB. + set_variable = { + name = imperial_expedition_charged + value = yes + } + # If you used a hook, calc some extra stuff. + if = { + limit = { + scope:hook = yes + has_usable_hook = scope:recipient + } + # Use the hook up. + use_hook = scope:recipient + # Plus scope:recipient is concerned. + reverse_add_opinion = { + target = scope:recipient + modifier = suspicion_opinion + opinion = -20 + } + } + # Otherwise you didn't, so you should be happy. + else_if = { + limit = { + scope:recipient = { is_ai = yes } + } + reverse_add_opinion = { + target = scope:recipient + modifier = trust_opinion + opinion = 20 + } + } +} + +diarch_request_imperial_expedition_rejected_effect = { + scope:recipient = { + # We have to put up the same amount of influence they do to veto them. + if = { + limit = { + # Prevent weird +0 influence tooltip. + scope:hook = no + } + change_influence = { + if = { + limit = { scope:influence_major = yes } + add = request_imperial_expedition_influence_stake_major_value + } + else_if = { + limit = { scope:influence_medium = yes } + add = request_imperial_expedition_influence_stake_medium_value + } + else_if = { + limit = { scope:influence_minor = yes } + add = request_imperial_expedition_influence_stake_minor_value + } + multiply = -1 + } + } + # Plus they get annoyed with us. + add_opinion = { + target = scope:actor + modifier = angry_opinion + opinion = -40 + } + } +} + +diarch_promoted_as_administrative_candidate_get_best_tooltip_effect = { + if = { + limit = { + scope:actor.top_liege = { has_diarchy_active_parameter = diarch_more_efficient_administrative_emperor_promotion_candidate_massive } + } + custom_tooltip = diarch_more_efficient_administrative_emperor_promotion_candidate_massive.tt.interaction_explanation + } + else_if = { + limit = { + scope:actor.top_liege = { has_diarchy_active_parameter = diarch_more_efficient_administrative_emperor_promotion_candidate_major } + } + custom_tooltip = diarch_more_efficient_administrative_emperor_promotion_candidate_major.tt.interaction_explanation + } + else_if = { + limit = { + scope:actor.top_liege = { has_diarchy_active_parameter = diarch_more_efficient_administrative_emperor_promotion_candidate_medium } + } + custom_tooltip = diarch_more_efficient_administrative_emperor_promotion_candidate_medium.tt.interaction_explanation + } + else_if = { + limit = { + scope:actor.top_liege = { has_diarchy_active_parameter = diarch_more_efficient_administrative_emperor_promotion_candidate_mild } + } + custom_tooltip = diarch_more_efficient_administrative_emperor_promotion_candidate_mild.tt.interaction_explanation + } +} + +maiming_destroy_diarchy_effect = { + if = { + limit = { exists = scope:destroy_diarchy } + # Liege maims co-emperor. + if = { + limit = { scope:actor.diarch = scope:recipient } + scope:actor = { + clear_designated_heir = yes + end_diarchy = yes + } + every_player = { + limit = { + NOR = { + this = scope:actor + this = scope:recipient + } + top_liege = scope:actor.top_liege + } + trigger_event = diarchy.8022 + } + } + # Co-emperor maims liege. + else = { + # We do this in two batches so that we don't produce an error when the emperor is usurped by their old co-emperor. + ## First the empire. + create_title_and_vassal_change = { + type = usurped + save_scope_as = change + } + scope:recipient = { + every_held_title = { + limit = { + OR = { + this = scope:recipient.capital_county + this = scope:recipient.capital_county.duchy + AND = { + tier = tier_county + this.duchy = scope:recipient.capital_county.duchy + } + tier >= scope:recipient.highest_held_title_tier + } + } + change_title_holder = { + holder = scope:actor + change = scope:change + } + } + every_vassal = { + custom = custom.recipient_every_vassal + change_liege = { + LIEGE = scope:actor + CHANGE = scope:change + } + } + } + resolve_title_and_vassal_change = scope:change + ## Then the former emperor. + create_title_and_vassal_change = { + type = usurped + save_scope_as = change2 + } + scope:recipient = { + change_liege = { + LIEGE = scope:actor + CHANGE = scope:change2 + } + } + resolve_title_and_vassal_change = scope:change2 + # Plus, end the diarchy. + hidden_effect = { + scope:recipient = { end_diarchy = yes } + } + every_player = { + limit = { + NOR = { + this = scope:actor + this = scope:recipient + } + top_liege = scope:actor.top_liege + } + trigger_event = diarchy.8023 + } + } + } +} + +diarch_demand_despotate_interaction_accepted_effect = { + create_title_and_vassal_change = { + type = granted + save_scope_as = change + } + scope:target = { + # First, we try to give them lands we hold. + every_in_de_jure_hierarchy = { + limit = { + holder = scope:recipient + tier >= tier_county + } + change_title_holder = { + holder = scope:actor + change = scope:change + } + } + # If they're not now landed, try to give them a random county — we do this so that we can keep them administrative. + if = { + limit = { + scope:actor = { is_landed = no } + } + scope:target = { + ordered_de_jure_county = { + limit = { + holder = { + is_ai = yes + any_liege_or_above = { this = scope:recipient } + } + } + limit = { + holder = { + any_liege_or_above = { this = scope:recipient } + } + } + order_by = development_level + change_title_holder = { + holder = scope:actor + change = scope:change + } + } + } + } + # If we haven't managed that, pick a random county not owned by a player and give them that. + change_title_holder = { + holder = scope:actor + change = scope:change + } + every_dejure_vassal_title_holder = { + limit = { + liege = scope:recipient + NOR = { + this = scope:actor + this = scope:recipient + } + } + custom = custom.every_target_de_jure_vassal + change_liege = { + liege = scope:actor + change = scope:change + } + } + } + resolve_title_and_vassal_change = scope:change + if = { + limit = { + NOT = { + scope:actor = { is_vassal_of = scope:recipient } + } + } + hidden_effect = { + create_title_and_vassal_change = { + type = swear_fealty + save_scope_as = change + } + scope:actor = { + change_liege = { + liege = scope:recipient + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + } + } + # If you used a hook, calc some extra stuff. + if = { + limit = { + scope:hook = yes + has_usable_hook = scope:recipient + } + # Use the hook up. + use_hook = scope:recipient + # Plus scope:recipient is concerned. + reverse_add_opinion = { + target = scope:recipient + modifier = frustrated_opinion + opinion = -40 + } + } + # Otherwise you didn't, so you should be happy. + else_if = { + limit = { is_ai = yes } + add_opinion = { + target = scope:recipient + modifier = grateful_opinion + opinion = 40 + } + } +} + +diarch_demand_despotate_interaction_rejected_effect = { + scope:recipient = { + # We have to put up the same amount of influence they do to veto them. + if = { + limit = { + # Prevent weird +0 influence tooltip. + scope:hook = no + } + change_influence = { + if = { + limit = { scope:influence_major = yes } + add = diarch_demand_despotate_interaction_stake_to_raise_major_value + } + else_if = { + limit = { scope:influence_medium = yes } + add = diarch_demand_despotate_interaction_stake_to_raise_medium_value + } + else_if = { + limit = { scope:influence_minor = yes } + add = diarch_demand_despotate_interaction_stake_to_raise_minor_value + } + } + custom_tooltip = diarch_demand_despotate_interaction.tt.double_stake + } + # Plus they get annoyed with us. + add_opinion = { + target = scope:actor + modifier = angry_opinion + opinion = -40 + } + } +} + +scapegoat_counterpart_interaction_process_results_effect = { + if = { + limit = { scope:diplomacy_small = yes } + scope:actor = { + save_scope_value_as = { + name = multiplied_diff + value = { + value = diplomacy + subtract = scope:recipient.diplomacy + multiply = 20 + max = 400 + } + } + change_influence = scope:multiplied_diff + $REALM_OPINION_ACTOR$ = { + value = scope:multiplied_diff + divide = 40 + min = 3 + } + } + scope:recipient = { + $REALM_OPINION_RECIPIENT$ = { + value = scope:multiplied_diff + divide = 30 + min = 5 + } + } + } + else_if = { + limit = { scope:diplomacy_large = yes } + scope:actor = { + save_scope_value_as = { + name = multiplied_diff + value = { + value = diplomacy + subtract = scope:recipient.diplomacy + multiply = 40 + max = 800 + } + } + change_influence = scope:multiplied_diff + $REALM_OPINION_ACTOR$ = { + value = scope:multiplied_diff + divide = 40 + min = 5 + } + } + scope:recipient = { + $REALM_OPINION_RECIPIENT$ = { + value = scope:multiplied_diff + divide = 30 + min = 10 + } + } + } + else_if = { + limit = { scope:intrigue_small = yes } + scope:actor = { + save_scope_value_as = { + name = multiplied_diff + value = { + value = intrigue + subtract = scope:recipient.intrigue + multiply = 20 + max = 400 + } + } + change_influence = scope:multiplied_diff + $REALM_OPINION_ACTOR$ = { + value = scope:multiplied_diff + divide = 40 + min = 3 + } + } + scope:recipient = { + $REALM_OPINION_RECIPIENT$ = { + value = scope:multiplied_diff + divide = 30 + min = 5 + } + } + } + else_if = { + limit = { scope:intrigue_large = yes } + scope:actor = { + save_scope_value_as = { + name = multiplied_diff + value = { + value = intrigue + subtract = scope:recipient.intrigue + multiply = 40 + max = 800 + } + } + change_influence = scope:multiplied_diff + $REALM_OPINION_ACTOR$ = { + value = scope:multiplied_diff + divide = 40 + min = 5 + } + } + scope:recipient = { + $REALM_OPINION_RECIPIENT$ = { + value = scope:multiplied_diff + divide = 30 + min = 10 + } + } + } +} + +################################################## +# Events + +# Fire a tooltip saying what effect this'll have on regent opinion. +## We don't need to use this _every_where, as otherwise it'd have to supplant the opinion effect entirely, but it's cool to use it in any specific regency events where flat opinion might be a nicer gain than usual. +raise_diarch_opinion_with_loyalty_update_effect = { + # Check the current opinion. + diarch = { + save_opinion_value_as = { + name = diarch_old_opinion + target = prev + } + } + # Plus, save $OPINION_AMOUNT$ so that we can use it in subsequent script values. + save_scope_value_as = { + name = opinion_amount + value = $OPINION_AMOUNT$ + } + # Process the loyalty update tooltip. + diarch = { + # Self-interested. + ## Hates you too much to be able to tell. + if = { + limit = { + diarch_loyalty <= diarch_loyalty_visibly_disloyal_threshold + scope:diarch_old_opinion <= -100 + scope:opinion_amount >= 1 + } + liege = { custom_tooltip = raise_diarch_opinion_with_loyalty_update_effect.tt.self_interested.overflow_edgecase } + } + ### Since save_opinion_value_as doesn't account for overspill past -100, and as we've got some special conditions that make the move from -100 to -99 very dramatic under certain circumstances, we need to have this vague option to cover up systemic inaccuracies. + ## Self-interested remains static. + else_if = { + limit = { + diarch_loyalty <= diarch_loyalty_visibly_disloyal_threshold + raise_diarch_opinion_with_loyalty_update_value <= diarch_loyalty_visibly_disloyal_threshold + } + liege = { custom_tooltip = raise_diarch_opinion_with_loyalty_update_effect.tt.self_interested.remains_static } + } + ## Self-interested to selfless. + else_if = { + limit = { + diarch_loyalty <= diarch_loyalty_visibly_disloyal_threshold + raise_diarch_opinion_with_loyalty_update_value >= diarch_loyalty_visibly_loyal_threshold + } + liege = { custom_tooltip = raise_diarch_opinion_with_loyalty_update_effect.tt.self_interested.to_selfless } + } + ## Self-interested to situational. + else_if = { + limit = { diarch_loyalty <= diarch_loyalty_visibly_disloyal_threshold } + liege = { custom_tooltip = raise_diarch_opinion_with_loyalty_update_effect.tt.self_interested.to_situational } + } + # Situational. + ## Situational to selfless. + else_if = { + limit = { + diarch_has_situational_loyalty_trigger = yes + raise_diarch_opinion_with_loyalty_update_value >= diarch_loyalty_visibly_loyal_threshold + } + liege = { custom_tooltip = raise_diarch_opinion_with_loyalty_update_effect.tt.situational.to_selfless } + } + ## Situational to self-interested. + else_if = { + limit = { + diarch_has_situational_loyalty_trigger = yes + raise_diarch_opinion_with_loyalty_update_value <= diarch_loyalty_visibly_disloyal_threshold + } + liege = { custom_tooltip = raise_diarch_opinion_with_loyalty_update_effect.tt.situational.to_self_interested } + } + ## Situational remains static. + else_if = { + limit = { diarch_has_situational_loyalty_trigger = yes } + liege = { custom_tooltip = raise_diarch_opinion_with_loyalty_update_effect.tt.situational.remains_static } + } + # Selfless. + ## Is too loyal to be able to tell. + else_if = { + limit = { + diarch_loyalty >= diarch_loyalty_visibly_loyal_threshold + scope:diarch_old_opinion >= 100 + scope:opinion_amount <= -1 + } + liege = { custom_tooltip = raise_diarch_opinion_with_loyalty_update_effect.tt.selfless.overflow_edgecase } + } + ### As above, we need this vague option to account for overspill. + ## Selfless remains static. + else_if = { + limit = { + diarch_loyalty >= diarch_loyalty_visibly_loyal_threshold + raise_diarch_opinion_with_loyalty_update_value >= diarch_loyalty_visibly_loyal_threshold + } + liege = { custom_tooltip = raise_diarch_opinion_with_loyalty_update_effect.tt.selfless.remains_static } + } + ## Selfless to self-interested. + else_if = { + limit = { + diarch_loyalty >= diarch_loyalty_visibly_loyal_threshold + raise_diarch_opinion_with_loyalty_update_value <= diarch_loyalty_visibly_disloyal_threshold + } + liege = { custom_tooltip = raise_diarch_opinion_with_loyalty_update_effect.tt.selfless.to_self_interested } + } + ## Selfless to situational. + else_if = { + limit = { diarch_loyalty >= diarch_loyalty_visibly_loyal_threshold } + liege = { custom_tooltip = raise_diarch_opinion_with_loyalty_update_effect.tt.selfless.to_situational } + } + } + # Now, add the new opinion. + reverse_add_opinion = { + target = diarch + modifier = $OPINION_TYPE$ + opinion = scope:opinion_amount + } +} + +# Diarchy swing can be good or bad for you depending on whether you're the liege, the diarch, or neutral, so we need different tooltips accordingly. +## Please note: for technical reasons this'll break if you don't use the pre-set script values or update it to include whatever new value you want to use. +update_diarchy_swing_with_perspective_effect = { + $LIEGE$ = { + # Sort the effect. + hidden_effect = { change_diarchy_swing = $SWING$ } + # Grab $LIEGE$'s scope for loc. + ## We save a weirdy scope name so we don't accidentally overwrite common scopes. + save_scope_as = liege_loc + } + # Right, now flick out the correct tooltips. + ## We can't easily access a number that doesn't yet exist as a variable within a custom tooltip, so this is gon' get _real_ gross and I'm sorry you have to watch it happen. + ## We also don't contain this in the above $LIEGE$ block because otherwise unusual (but valid) uses of the effect cause asserts. + ## Is the diarch gaining? + if = { + limit = { $SWING$ >= 1 } + ## Miniscule swing. + if = { + limit = { $SWING$ = miniscule_sop_swing_diarch_gain } + # For the liege. + if = { + limit = { this = $LIEGE$ } + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.liege_perspective.miniscule_sop_swing_diarch_gain.tt } + } + # For the diarch. + else_if = { + limit = { this = $LIEGE$.diarch } + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.diarch_perspective.miniscule_sop_swing_diarch_gain.tt } + } + # For everyone else. + else = { + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.neutral_perspective.miniscule_sop_swing_diarch_gain.tt } + } + } + ## Minor swing. + else_if = { + limit = { $SWING$ = minor_sop_swing_diarch_gain } + # For the liege. + if = { + limit = { this = $LIEGE$ } + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.liege_perspective.minor_sop_swing_diarch_gain.tt } + } + # For the diarch. + else_if = { + limit = { this = $LIEGE$.diarch } + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.diarch_perspective.minor_sop_swing_diarch_gain.tt } + } + # For everyone else. + else = { + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.neutral_perspective.minor_sop_swing_diarch_gain.tt } + } + } + ## Medium swing. + else_if = { + limit = { $SWING$ = medium_sop_swing_diarch_gain } + # For the liege. + if = { + limit = { this = $LIEGE$ } + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.liege_perspective.medium_sop_swing_diarch_gain.tt } + } + # For the diarch. + else_if = { + limit = { this = $LIEGE$.diarch } + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.diarch_perspective.medium_sop_swing_diarch_gain.tt } + } + # For everyone else. + else = { + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.neutral_perspective.medium_sop_swing_diarch_gain.tt } + } + } + ## Major swing. + else_if = { + limit = { $SWING$ = major_sop_swing_diarch_gain } + # For the liege. + if = { + limit = { this = $LIEGE$ } + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.liege_perspective.major_sop_swing_diarch_gain.tt } + } + # For the diarch. + else_if = { + limit = { this = $LIEGE$.diarch } + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.diarch_perspective.major_sop_swing_diarch_gain.tt } + } + # For everyone else. + else = { + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.neutral_perspective.major_sop_swing_diarch_gain.tt } + } + } + ## Massive swing. + else_if = { + limit = { $SWING$ = massive_sop_swing_diarch_gain } + # For the liege. + if = { + limit = { this = $LIEGE$ } + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.liege_perspective.massive_sop_swing_diarch_gain.tt } + } + # For the diarch. + else_if = { + limit = { this = $LIEGE$.diarch } + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.diarch_perspective.massive_sop_swing_diarch_gain.tt } + } + # For everyone else. + else = { + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.neutral_perspective.massive_sop_swing_diarch_gain.tt } + } + } + ## Monumental swing. + else_if = { + limit = { $SWING$ = monumental_sop_swing_diarch_gain } + # For the liege. + if = { + limit = { this = $LIEGE$ } + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.liege_perspective.monumental_sop_swing_diarch_gain.tt } + } + # For the diarch. + else_if = { + limit = { this = $LIEGE$.diarch } + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.diarch_perspective.monumental_sop_swing_diarch_gain.tt } + } + # For everyone else. + else = { + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.neutral_perspective.monumental_sop_swing_diarch_gain.tt } + } + } + } + ## Is the liege gaining? + else_if = { + limit = { $SWING$ <= -1 } + ## Miniscule swing. + if = { + limit = { $SWING$ = miniscule_sop_swing_liege_gain } + # For the liege. + if = { + limit = { this = $LIEGE$ } + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.liege_perspective.miniscule_sop_swing_liege_gain.tt } + } + # For the diarch. + else_if = { + limit = { this = $LIEGE$.diarch } + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.diarch_perspective.miniscule_sop_swing_liege_gain.tt } + } + # For everyone else. + else = { + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.neutral_perspective.miniscule_sop_swing_liege_gain.tt } + } + } + ## Minor swing. + else_if = { + limit = { $SWING$ = minor_sop_swing_liege_gain } + # For the liege. + if = { + limit = { this = $LIEGE$ } + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.liege_perspective.minor_sop_swing_liege_gain.tt } + } + # For the diarch. + else_if = { + limit = { this = $LIEGE$.diarch } + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.diarch_perspective.minor_sop_swing_liege_gain.tt } + } + # For everyone else. + else = { + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.neutral_perspective.minor_sop_swing_liege_gain.tt } + } + } + ## Medium swing. + else_if = { + limit = { $SWING$ = medium_sop_swing_liege_gain } + # For the liege. + if = { + limit = { this = $LIEGE$ } + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.liege_perspective.medium_sop_swing_liege_gain.tt } + } + # For the diarch. + else_if = { + limit = { this = $LIEGE$.diarch } + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.diarch_perspective.medium_sop_swing_liege_gain.tt } + } + # For everyone else. + else = { + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.neutral_perspective.medium_sop_swing_liege_gain.tt } + } + } + ## Major swing. + else_if = { + limit = { $SWING$ = major_sop_swing_liege_gain } + # For the liege. + if = { + limit = { this = $LIEGE$ } + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.liege_perspective.major_sop_swing_liege_gain.tt } + } + # For the diarch. + else_if = { + limit = { this = $LIEGE$.diarch } + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.diarch_perspective.major_sop_swing_liege_gain.tt } + } + # For everyone else. + else = { + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.neutral_perspective.major_sop_swing_liege_gain.tt } + } + } + ## Massive swing. + else_if = { + limit = { $SWING$ = massive_sop_swing_liege_gain } + # For the liege. + if = { + limit = { this = $LIEGE$ } + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.liege_perspective.massive_sop_swing_liege_gain.tt } + } + # For the diarch. + else_if = { + limit = { this = $LIEGE$.diarch } + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.diarch_perspective.massive_sop_swing_liege_gain.tt } + } + # For everyone else. + else = { + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.neutral_perspective.massive_sop_swing_liege_gain.tt } + } + } + ## Monumental swing. + else_if = { + limit = { $SWING$ = monumental_sop_swing_liege_gain } + # For the liege. + if = { + limit = { this = $LIEGE$ } + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.liege_perspective.monumental_sop_swing_liege_gain.tt } + } + # For the diarch. + else_if = { + limit = { this = $LIEGE$.diarch } + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.diarch_perspective.monumental_sop_swing_liege_gain.tt } + } + # For everyone else. + else = { + $LIEGE$ = { custom_tooltip = update_diarchy_swing_with_perspective_effect.neutral_perspective.monumental_sop_swing_liege_gain.tt } + } + } + } + ## No gain not accounted for: you should never be swinging by 0. +} + +################################################## +# Primeministerships + +vizierate_remove_extravagance_modifiers_effect = { + remove_character_modifier = vizier_extravagance_t1_treasure_modifier + remove_character_modifier = vizier_extravagance_t1_activities_modifier + remove_character_modifier = vizier_extravagance_t1_property_modifier + remove_character_modifier = vizier_extravagance_t1_charity_modifier + remove_character_modifier = vizier_extravagance_t2_treasure_modifier + remove_character_modifier = vizier_extravagance_t2_activities_modifier + remove_character_modifier = vizier_extravagance_t2_property_modifier + remove_character_modifier = vizier_extravagance_t2_charity_modifier + remove_character_modifier = vizier_extravagance_t3_treasure_modifier + remove_character_modifier = vizier_extravagance_t3_activities_modifier + remove_character_modifier = vizier_extravagance_t3_property_modifier + remove_character_modifier = vizier_extravagance_t3_charity_modifier + remove_character_modifier = vizier_extravagance_t4_treasure_modifier + remove_character_modifier = vizier_extravagance_t4_activities_modifier + remove_character_modifier = vizier_extravagance_t4_property_modifier + remove_character_modifier = vizier_extravagance_t4_charity_modifier +} + +################################################## +# Co-Rulerships + +sort_junior_emperor_candidates_to_list_effect = { + scope:actor = { + every_close_or_extended_family_member = { + limit = { valid_junior_emperor_candidate_trigger = { LIEGE = scope:actor } } + add_to_list = characters + } + } +} + +sort_co_emperor_candidates_to_list_effect = { + scope:actor = { + every_close_or_extended_family_member = { + limit = { + valid_co_emperor_candidate_trigger = { LIEGE = scope:actor } + } + add_to_list = characters + } + every_vassal = { + limit = { + valid_co_emperor_candidate_trigger = { LIEGE = scope:actor } + } + add_to_list = characters + } + } +} + +sort_co_monarch_candidates_to_list_effect = { + scope:actor = { + every_child = { + limit = { + valid_co_monarch_candidate_trigger = { LIEGE = scope:actor } + } + add_to_list = characters + } + } +} + +grateful_for_appointment_as_co_emperor_effect = { + if = { + limit = { exists = scope:ai_recipient } + scope:ai_recipient = { + set_variable = { + name = co_emp_appointer + value = scope:actor + } + add_opinion = { + target = scope:actor + modifier = made_co_ruler_opinion + opinion = 50 + } + } + } + else = { + scope:secondary_recipient ?= { + set_variable = { + name = co_emp_appointer + value = scope:actor + } + add_opinion = { + target = scope:actor + modifier = made_co_ruler_opinion + opinion = 50 + } + } + } +} + +diarch_overwrites_old_designated_heir_apply_opinions_effect = { + scope:old_heir ?= { + # Humble or content characters accept this for what it is. + if = { + limit = { + OR = { + AND = { + has_trait = humble + # ... cancelled out by... + NOT = { has_trait = ambitious } + } + AND = { + has_trait = content + # ... cancelled out by... + NOT = { has_trait = arrogant } + } + } + } + # Annoyance with you. + add_opinion = { + target = $LIEGE$ + modifier = disappointed_opinion + opinion = -20 + } + # Annoyance with the new co-ruler. + ## Vs. player. + if = { + limit = { + # Rationale for this heinous crime at the top of this block. + NOT = { exists = scope:ai_recipient } + } + add_opinion = { + target = $CO_RULER$ + modifier = insult_opinion + opinion = -30 + } + } + ## Vs. AI. + else = { + add_opinion = { + target = scope:ai_recipient + modifier = insult_opinion + opinion = -30 + } + } + } + # Everyone else is outraged. + else = { + # Annoyance with you. + add_opinion = { + target = $LIEGE$ + modifier = betrayal_opinion + opinion = -50 + } + # Annoyance with the new co-ruler. + ## Vs. player. + if = { + limit = { + # Rationale for this heinous crime at the top of this block. + NOT = { exists = scope:ai_recipient } + } + add_opinion = { + target = $CO_RULER$ + modifier = hate_opinion + opinion = -75 + } + } + ## Vs. AI. + else = { + add_opinion = { + target = scope:ai_recipient + modifier = hate_opinion + opinion = -75 + } + } + } + } +} + +designated_diarch_overwridden_by_co_ruler_effect = { + $LIEGE$.designated_diarch ?= { + if = { + limit = { + NOT = { this = $CO_RULER$ } + } + # Humble or content characters accept this for what it is. + if = { + limit = { + OR = { + AND = { + has_trait = humble + # ... cancelled out by... + NOT = { has_trait = ambitious } + } + AND = { + has_trait = content + # ... cancelled out by... + NOT = { has_trait = arrogant } + } + } + } + # Annoyance with you. + add_opinion = { + target = $LIEGE$ + modifier = disappointed_opinion + opinion = -10 + } + # Annoyance with the new co-ruler. + ## Vs. player. + if = { + limit = { + # Rationale for this heinous crime at the top of this block. + NOT = { exists = scope:ai_recipient } + } + add_opinion = { + target = $CO_RULER$ + modifier = insult_opinion + opinion = -15 + } + } + ## Vs. AI. + else = { + add_opinion = { + target = scope:ai_recipient + modifier = insult_opinion + opinion = -15 + } + } + } + # Everyone else is outraged. + else = { + # Annoyance with you. + add_opinion = { + target = $LIEGE$ + modifier = appointed_co_ruler_over_designated_regent_opinion + opinion = -30 + } + # Annoyance with the new co-ruler. + ## Vs. player. + if = { + limit = { + # Rationale for this heinous crime at the top of this block. + NOT = { exists = scope:ai_recipient } + } + add_opinion = { + target = $CO_RULER$ + modifier = appointed_co_ruler_over_designated_regent_opinion + opinion = -50 + } + } + ## Vs. AI. + else = { + add_opinion = { + target = scope:ai_recipient + modifier = appointed_co_ruler_over_designated_regent_opinion + opinion = -50 + } + } + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_diplomacy_lifestyle_effects.txt b/N3OW/common/scripted_effects/00_diplomacy_lifestyle_effects.txt new file mode 100644 index 00000000..e490b396 --- /dev/null +++ b/N3OW/common/scripted_effects/00_diplomacy_lifestyle_effects.txt @@ -0,0 +1,471 @@ +#Effects used in Statecraft Lifestyle Focus events + + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! +# +# A Flaw of Character: +# diplomacy_family_0008_appropriate_lesson_effect Used to evaluate if the lesson the player picked was suitable for their heir. +# +# The Power of Words: Outcome for complimenting somebody +# diplomacy_majesty_0004_outcome_effect +# +# Manipulating a Vassal: +# diplomacy_generic_0012_good_outcome_effect Successful Manipulation, gain Hook and Opinion +# diplomacy_generic_0012_bad_outcome_effect Failed Manipulation, lose Opinion +# diplomacy_generic_0012_terrible_outcome_effect Failed Manipulation, lose Hook and Prestige +# diplomacy_generic_0012_tooltip_effect Tooltip-Only Summary of Possible Outcomes +# +# Court Visit +# diplomacy_foreign_special_1010_court_visit_outcome_preview_effect Non-executing effect used to show the player a preview of possible event outcomes in a tooltip. +# diplomacy_foreign_special_1010_court_visit_outcome_great_effect The best possible outcome from this event chain +# diplomacy_foreign_special_1010_court_visit_outcome_good_effect The standard outcome from this event chain +# diplomacy_foreign_special_1010_court_visit_outcome_bad_effect The worst possible outcome from this event chain +# diplomacy_foreign_special_1010_clean_up_court_visit_effect Clears all flags and variables after the event chain has concluded. +# diplomacy_foreign_special_1010_court_visit_interesting_relation_okay_effect One of several effects for what your visitor does to your courtier behind closed doors. This one is neutral. +# diplomacy_foreign_special_1010_court_visit_interesting_relation_befriend_effect One of several effects for what your visitor does to your courtier behind closed doors. This one they become friends. +# diplomacy_foreign_special_1010_court_visit_interesting_relation_manipulate_effect One of several effects for what your visitor does to your courtier behind closed doors. This one they turn them against you. +# diplomacy_foreign_special_1010_court_visit_interesting_relation_seduce_effect One of several effects for what your visitor does to your courtier behind closed doors. This one they seduce them. +# diplomacy_foreign_special_1010_court_visit_join_seduction_successfully_effect If your visitor tried to seduce your courtier, and you're spying on them, you have the chance of joining in! +# diplomacy_foreign_special_1010_court_visit_interesting_relation_outcome_effect Finalized the closed door relationship effect. + + +diplomacy_majesty_0004_outcome_effect = { + random_list = { + 1 = { + desc = diplomacy_majesty.0004.success.tt + show_chance = no + + show_as_tooltip = { + add_diplomacy_lifestyle_xp = medium_lifestyle_xp + reverse_add_opinion = { + target = scope:compliment_receiver + modifier = kindness_opinion + opinion = 25 + } + } + } + 1 = { + desc = diplomacy_majesty.0004.neutral.tt + show_chance = no + show_as_tooltip = { + add_diplomacy_lifestyle_xp = minor_lifestyle_xp + } + } + 1 = { + desc = diplomacy_majesty.0004.failure.tt + show_chance = no + + show_as_tooltip = { + reverse_add_opinion = { + target = scope:compliment_receiver + modifier = cruelty_opinion + opinion = -25 + } + } + } + } + + hidden_effect = { + if = { + limit = { + exists = scope:compliment_outcome + scope:compliment_outcome = flag:good + } + trigger_event = { id = diplomacy_majesty.0005 days = 7 } + } + + else_if = { + limit = { + exists = scope:compliment_outcome + scope:compliment_outcome = flag:neutral + } + send_interface_toast = { + left_icon = scope:compliment_receiver + title = diplomacy_majesty.0004.neutral_outcome.desc + + add_diplomacy_lifestyle_xp = minor_lifestyle_xp + } + } + + else_if = { + limit = { + exists = scope:compliment_outcome + scope:compliment_outcome = flag:bad + } + trigger_event = { id = diplomacy_majesty.0006 days = 7 } + } + } +} + + + +# Court Visit Effects + +diplomacy_foreign_special_1010_court_visit_outcome_preview_effect = { + show_as_tooltip = { + $CHARACTER$ = { + random_list = { + 1 = { + show_chance = no + desc = diplomacy_foreign_special.1017.great + + root = { + reverse_add_opinion = { + target = $CHARACTER$ + modifier = friendliness_opinion + opinion = 30 + } + if = { + limit = { $CHARACTER$ = scope:target_list_member_a } + custom_tooltip = diplomacy_foreign_special.1017.friends_a + } + else_if = { + limit = { $CHARACTER$ = scope:target_list_member_b } + custom_tooltip = diplomacy_foreign_special.1017.friends_b + } + else = { + custom_tooltip = diplomacy_foreign_special.1017.friends_c + } + add_diplomacy_lifestyle_perk_points = 1 + } + } + 1 = { + show_chance = no + desc = diplomacy_foreign_special.1017.good + + root = { + diplomacy_foreign_special_1010_court_visit_outcome_good_effect = { CHARACTER = $CHARACTER$ } + } + } + 1 = { + show_chance = no + desc = diplomacy_foreign_special.1017.bad + + root = { + diplomacy_foreign_special_1010_court_visit_outcome_bad_effect = { CHARACTER = $CHARACTER$ } + } + } + } + } + } + +} + +diplomacy_foreign_special_1010_court_visit_outcome_great_effect = { + reverse_add_opinion = { + target = $CHARACTER$ + modifier = friendliness_opinion + opinion = 30 + } + hidden_effect = { + add_opinion = { + target = $CHARACTER$ + modifier = friendliness_opinion + opinion = 30 + } + } + progress_towards_friend_effect = { + CHARACTER = $CHARACTER$ + OPINION = 0 + REASON = friend_court_visit + } + add_diplomacy_lifestyle_perk_points = 1 +} + +diplomacy_foreign_special_1010_court_visit_outcome_good_effect = { + reverse_add_opinion = { + target = $CHARACTER$ + modifier = respect_opinion + opinion = 15 + } + hidden_effect = { + add_opinion = { + target = $CHARACTER$ + modifier = friendliness_opinion + opinion = 15 + } + } + add_diplomacy_lifestyle_perk_points = 1 +} + +diplomacy_foreign_special_1010_court_visit_outcome_bad_effect = { + reverse_add_opinion = { + target = $CHARACTER$ + modifier = disappointed_opinion + opinion = -15 + } +} + + +diplomacy_foreign_special_1010_clean_up_court_visit_effect = { + remove_variable = court_visit_points + remove_variable = no_of_court_visit_events + remove_character_flag = is_in_diplomacy_foreign_special_event + remove_character_flag = court_visit_hunt_or_dance + remove_character_flag = court_visit_dance_or_holy_place + remove_character_flag = private_dinner + remove_character_flag = compliment + remove_character_flag = in_success_event + remove_character_flag = in_failure_event +} + +diplomacy_foreign_special_1010_court_visit_interesting_relation_okay_effect = { + scope:foreign_guest = { + add_opinion = { + target = scope:interesting_relation + modifier = friendliness_opinion + opinion = 15 + } + reverse_add_opinion = { + target = scope:interesting_relation + modifier = friendliness_opinion + opinion = 15 + } + } +} + +diplomacy_foreign_special_1010_court_visit_interesting_relation_befriend_effect = { + scope:interesting_relation = { + set_relation_friend = { reason = friend_court_visit target = scope:foreign_guest } + } + scope:foreign_guest = { + hidden_effect = { + add_opinion = { + target = scope:interesting_relation + modifier = friendliness_opinion + opinion = 30 + } + reverse_add_opinion = { + target = scope:interesting_relation + modifier = friendliness_opinion + opinion = 30 + } + } + } +} + +diplomacy_foreign_special_1010_court_visit_interesting_relation_manipulate_effect = { + scope:foreign_guest = { + if = { + limit = { + can_add_hook = { + target = scope:interesting_relation + type = manipulation_hook + } + } + add_hook = { + target = scope:interesting_relation + type = manipulation_hook + } + } + } + scope:interesting_relation = { + add_opinion = { + target = scope:foreign_guest + modifier = trust_opinion + opinion = 30 + } + add_opinion = { + target = scope:host_ruler + modifier = suspicion_opinion + opinion = -20 + } + hidden_effect = { if = { limit = { NOT = { has_relation_potential_rival = scope:host_ruler } } set_relation_potential_rival = scope:host_ruler } } + } +} + +diplomacy_foreign_special_1010_court_visit_interesting_relation_seduce_effect = { + scope:foreign_guest = { + set_relation_lover = { reason = lover_court_visit_seduction target = scope:interesting_relation involved_character = root } + + hidden_effect = { + intercourse_with_character_effect = { INTERCOURSE_CHARACTER = scope:interesting_relation } + add_opinion = { + target = scope:interesting_relation + modifier = romance_opinion + opinion = 30 + } + reverse_add_opinion = { + target = scope:interesting_relation + modifier = romance_opinion + opinion = 30 + } + } + } +} + +diplomacy_foreign_special_1010_court_visit_join_seduction_successfully_effect = { + $CHARACTER$ = { + if = { + limit = { + matching_gender_and_sexuality_trigger = { + CHARACTER_1 = $CHARACTER$ + CHARACTER_2 = root + } + NOR = { + has_relation_lover = root + is_consort_of = root + } + } + set_relation_lover = { reason = lover_court_visit_seduction target = root } + } + add_opinion = { + target = root + modifier = pleased_opinion + opinion = 30 + } + hidden_effect = { + reverse_add_opinion = { + target = $CHARACTER$ + modifier = pleased_opinion + opinion = 30 + } + } + } +} + +diplomacy_foreign_special_1010_court_visit_interesting_relation_outcome_effect = { + if = { + limit = { scope:private_dinner_outcome = flag:okay } + diplomacy_foreign_special_1010_court_visit_interesting_relation_okay_effect = yes + } + else_if = { + limit = { scope:private_dinner_outcome = flag:befriend } + diplomacy_foreign_special_1010_court_visit_interesting_relation_befriend_effect = yes + } + else_if = { + limit = { scope:private_dinner_outcome = flag:manipulate } + diplomacy_foreign_special_1010_court_visit_interesting_relation_manipulate_effect = yes + } + else_if = { + limit = { scope:private_dinner_outcome = flag:seduce } + diplomacy_foreign_special_1010_court_visit_interesting_relation_seduce_effect = yes + } +} + +diplomacy_foreign_1150_successful_county_switch_effect = { + # Give your county/vassal to the neighbor + if = { + limit = { + scope:county.holder = scope:neighbor + } + create_title_and_vassal_change = { + type = returned + save_scope_as = change + add_claim_on_loss = no + } + scope:county = { + change_title_holder = { + holder = scope:ruler + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + } + else_if = { + limit = { + scope:ruler_vassal = { + highest_held_title_tier = tier_county + } + } + create_title_and_vassal_change = { + type = returned + save_scope_as = change + add_claim_on_loss = no + } + scope:ruler_vassal = { + change_liege = { + liege = scope:ruler + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + } + else = { + create_title_and_vassal_change = { + type = returned + save_scope_as = change + add_claim_on_loss = no + } + scope:county = { + change_title_holder = { + holder = scope:ruler + change = scope:change + } + } + } + # The neighbor gives his county/vassal to you. + if = { + limit = { + scope:neighbor_county.holder = scope:ruler + } + create_title_and_vassal_change = { + type = returned + save_scope_as = change + add_claim_on_loss = no + } + scope:neighbor_county = { + change_title_holder = { + holder = scope:neighbor + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + } + else = { + create_title_and_vassal_change = { + type = returned + save_scope_as = change + add_claim_on_loss = no + } + scope:neighbor_vassal = { + change_liege = { + liege = scope:neighbor + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + } + # Add xp + scope:ruler = { add_diplomacy_lifestyle_xp = major_lifestyle_experience } + # Add positive opinion + scope:neighbor = { + add_opinion = { + modifier = respect_opinion + target = scope:ruler + opinion = low_positive_opinion + } + } +} + +diplomacy_foreign_1150_failed_county_switch_effect = { + # Add xp + scope:ruler = { add_diplomacy_lifestyle_xp = miniscule_lifestyle_experience } + # Add negative opinion (both neighbor and possible vassal) + scope:neighbor = { + add_opinion = { + modifier = respect_opinion + target = scope:ruler + opinion = low_negative_opinion + } + } + if = { + limit = { + exists = scope:neighbor_vassal + } + scope:neighbor_vassal = { + add_opinion = { + modifier = respect_opinion + target = scope:ruler + opinion = medium_negative_opinion + } + } + } + # Reduce control in your county (...sell-out) + scope:neighbor_county = { + change_county_control = major_county_control_loss + } +} diff --git a/N3OW/common/scripted_effects/00_diplomacy_perk_effects.txt b/N3OW/common/scripted_effects/00_diplomacy_perk_effects.txt new file mode 100644 index 00000000..31308af5 --- /dev/null +++ b/N3OW/common/scripted_effects/00_diplomacy_perk_effects.txt @@ -0,0 +1,980 @@ + +### Effects for handling Diplomacy Lifestyle Perks + +# sound_foundations_skill_gain_effect: Randomly gain a skill point because of your child +# sound_foundations_random_removal_effect: Removes a random one of the modifiers added by Sound Foundations + +sound_foundations_skill_gain_effect = { + if = { + limit = { + NOT = { has_variable = current_sound_foundations_value } + } + set_variable = { + name = current_sound_foundations_value # Number of applied modifiers + value = 0 + } + } + every_child = { + add_to_temporary_list = current_amount_of_children + } + + if = { + limit = { + exists = var:current_sound_foundations_value + save_temporary_scope_as = affected_parent + var:current_sound_foundations_value < sound_foundations_max + any_in_list = { + list = current_amount_of_children + count > scope:affected_parent.var:current_sound_foundations_value + } + } + if = { + limit = { government_has_flag = government_is_mandala } + random_list = { + 1 = { + add_character_modifier = { + modifier = mandala_sound_foundations_martial_gain + } + } + 1 = { + add_character_modifier = { + modifier = mandala_sound_foundations_diplomacy_gain + } + } + 1 = { + add_character_modifier = { + modifier = mandala_sound_foundations_intrigue_gain + } + } + 1 = { + add_character_modifier = { + modifier = mandala_sound_foundations_stewardship_gain + } + } + 1 = { + add_character_modifier = { + modifier = mandala_sound_foundations_learning_gain + } + } + } + change_variable = { + name = current_sound_foundations_value + add = 1 + } + } + else = { + random_list = { + 1 = { + add_character_modifier = { + modifier = sound_foundations_martial_gain + } + } + 1 = { + add_character_modifier = { + modifier = sound_foundations_diplomacy_gain + } + } + 1 = { + add_character_modifier = { + modifier = sound_foundations_intrigue_gain + } + } + 1 = { + add_character_modifier = { + modifier = sound_foundations_stewardship_gain + } + } + 1 = { + add_character_modifier = { + modifier = sound_foundations_learning_gain + } + } + } + change_variable = { + name = current_sound_foundations_value + add = 1 + } + } + + } +} + +sound_foundations_random_removal_effect = { + if = { + limit = { + has_perk = sound_foundations_perk + } + every_child = { + add_to_temporary_list = current_amount_of_children + } + + if = { + limit = { + exists = var:current_sound_foundations_value + save_temporary_scope_as = affected_parent + var:current_sound_foundations_value <= sound_foundations_max + var:current_sound_foundations_value > 0 + any_in_list = { + list = current_amount_of_children + count > scope:affected_parent.var:current_sound_foundations_value + NOT = { has_character_flag = about_to_die_but_not_dead_yet_flag } # Applied from on action death; called before imminent death + } + } + + random_list = { + 1 = { + trigger = { + has_character_modifier = sound_foundations_martial_gain + } + remove_character_modifier = sound_foundations_martial_gain + } + 1 = { + trigger = { + has_character_modifier = sound_foundations_diplomacy_gain + } + remove_character_modifier = sound_foundations_diplomacy_gain + } + 1 = { + trigger = { + has_character_modifier = sound_foundations_intrigue_gain + } + remove_character_modifier = sound_foundations_intrigue_gain + } + 1 = { + trigger = { + has_character_modifier = sound_foundations_stewardship_gain + } + remove_character_modifier = sound_foundations_stewardship_gain + } + 1 = { + trigger = { + has_character_modifier = sound_foundations_learning_gain + } + remove_character_modifier = sound_foundations_learning_gain + } + } + + change_variable = { + name = current_sound_foundations_value + subtract = 1 + } + } + } +} + + + +groomed_to_rule_random_skills_effect = { + save_scope_as = child + if = { + limit = { + trigger_if = { + limit = { age <= childhood_education_start_age } + has_trait = rowdy # Default trait for martial ed + } + trigger_else_if = { + limit = { age < adulthood_start_age } + has_focus = education_martial + } + trigger_else = { + has_trait = education_martial + } + } + save_temporary_scope_value_as = { + name = skill_to_increase + value = flag:martial + } + } + else_if = { + limit = { + trigger_if = { + limit = { age <= childhood_education_start_age } + has_trait = charming # Default trait for intrigue ed + } + trigger_else_if = { + limit = { age < adulthood_start_age } + has_focus = education_intrigue + } + trigger_else = { + has_trait = education_intrigue + } + } + save_temporary_scope_value_as = { + name = skill_to_increase + value = flag:intrigue + } + } + else_if = { + limit = { + trigger_if = { + limit = { age <= childhood_education_start_age } + has_trait = curious # Default trait for diplomacy ed + } + trigger_else_if = { + limit = { age < adulthood_start_age } + has_focus = education_diplomacy + } + trigger_else = { + has_trait = education_diplomacy + } + } + save_temporary_scope_value_as = { + name = skill_to_increase + value = flag:diplomacy + } + } + else_if = { + limit = { + trigger_if = { + limit = { age <= childhood_education_start_age } + has_trait = bossy # Default trait for stewardship ed + } + trigger_else_if = { + limit = { age < adulthood_start_age } + has_focus = education_stewardship + } + trigger_else = { + has_trait = education_stewardship + } + } + save_temporary_scope_value_as = { + name = skill_to_increase + value = flag:stewardship + } + } + else_if = { + limit = { + trigger_if = { + limit = { age <= childhood_education_start_age } + has_trait = pensive # Default trait for learning ed + } + trigger_else_if = { + limit = { age < adulthood_start_age } + has_focus = education_learning + } + trigger_else = { + has_trait = education_learning + } + } + save_temporary_scope_value_as = { + name = skill_to_increase + value = flag:learning + } + } + else = { # Fallback in case something goes wrong + random_list = { + 1 = { + save_temporary_scope_value_as = { + name = skill_to_increase + value = flag:martial + } + } + 1 = { + save_temporary_scope_value_as = { + name = skill_to_increase + value = flag:diplomacy + } + } + 1 = { + save_temporary_scope_value_as = { + name = skill_to_increase + value = flag:intrigue + } + } + 1 = { + save_temporary_scope_value_as = { + name = skill_to_increase + value = flag:stewardship + } + } + 1 = { + save_temporary_scope_value_as = { + name = skill_to_increase + value = flag:learning + } + } + } + } + if = { + limit = { + scope:skill_to_increase = flag:martial + } + random_list = { + 1 = { + send_interface_message = { + type = event_martial_good + title = groomed_to_rule_msg_title + left_icon = scope:parent + + add_martial_skill = 1 + } + scope:parent = { + send_interface_message = { + type = event_martial_good + title = groomed_to_rule_msg_title + left_icon = scope:child + + show_as_tooltip = { + scope:child = { + add_martial_skill = 1 + } + } + } + } + } + 1 = { + send_interface_message = { + type = event_martial_good + title = groomed_to_rule_msg_title + left_icon = scope:parent + + add_martial_skill = 2 + } + scope:parent = { + send_interface_message = { + type = event_martial_good + title = groomed_to_rule_msg_title + left_icon = scope:child + + show_as_tooltip = { + scope:child = { + add_martial_skill = 2 + } + } + } + } + } + 1 = { + send_interface_message = { + type = event_martial_good + title = groomed_to_rule_msg_title + left_icon = scope:parent + + add_martial_skill = 3 + } + scope:parent = { + send_interface_message = { + type = event_martial_good + title = groomed_to_rule_msg_title + left_icon = scope:child + + show_as_tooltip = { + scope:child = { + add_martial_skill = 3 + } + } + } + } + } + } + } + else_if = { + limit = { + scope:skill_to_increase = flag:intrigue + } + random_list = { + 1 = { + send_interface_message = { + type = event_intrigue_good + title = groomed_to_rule_msg_title + left_icon = scope:parent + + add_intrigue_skill = 1 + } + scope:parent = { + send_interface_message = { + type = event_intrigue_good + title = groomed_to_rule_msg_title + left_icon = scope:child + + show_as_tooltip = { + scope:child = { + add_intrigue_skill = 1 + } + } + } + } + } + 1 = { + send_interface_message = { + type = event_intrigue_good + title = groomed_to_rule_msg_title + left_icon = scope:parent + + add_intrigue_skill = 2 + } + scope:parent = { + send_interface_message = { + type = event_intrigue_good + title = groomed_to_rule_msg_title + left_icon = scope:child + + show_as_tooltip = { + scope:child = { + add_intrigue_skill = 2 + } + } + } + } + } + 1 = { + send_interface_message = { + type = event_intrigue_good + title = groomed_to_rule_msg_title + left_icon = scope:parent + + add_intrigue_skill = 3 + } + scope:parent = { + send_interface_message = { + type = event_intrigue_good + title = groomed_to_rule_msg_title + left_icon = scope:child + + show_as_tooltip = { + scope:child = { + add_intrigue_skill = 3 + } + } + } + } + } + } + } + else_if = { + limit = { + scope:skill_to_increase = flag:diplomacy + } + random_list = { + 1 = { + send_interface_message = { + type = event_diplomacy_good + title = groomed_to_rule_msg_title + left_icon = scope:parent + + add_diplomacy_skill = 1 + } + scope:parent = { + send_interface_message = { + type = event_diplomacy_good + title = groomed_to_rule_msg_title + left_icon = scope:child + + show_as_tooltip = { + scope:child = { + add_diplomacy_skill = 1 + } + } + } + } + } + 1 = { + send_interface_message = { + type = event_diplomacy_good + title = groomed_to_rule_msg_title + left_icon = scope:parent + + add_diplomacy_skill = 2 + } + scope:parent = { + send_interface_message = { + type = event_diplomacy_good + title = groomed_to_rule_msg_title + left_icon = scope:child + + show_as_tooltip = { + scope:child = { + add_diplomacy_skill = 2 + } + } + } + } + } + 1 = { + send_interface_message = { + type = event_diplomacy_good + title = groomed_to_rule_msg_title + left_icon = scope:parent + + add_diplomacy_skill = 3 + } + scope:parent = { + send_interface_message = { + type = event_diplomacy_good + title = groomed_to_rule_msg_title + left_icon = scope:child + + show_as_tooltip = { + scope:child = { + add_diplomacy_skill = 3 + } + } + } + } + } + } + } + else_if = { + limit = { + scope:skill_to_increase = flag:stewardship + } + random_list = { + 1 = { + send_interface_message = { + type = event_stewardship_good + title = groomed_to_rule_msg_title + left_icon = scope:parent + + add_stewardship_skill = 1 + } + scope:parent = { + send_interface_message = { + type = event_stewardship_good + title = groomed_to_rule_msg_title + left_icon = scope:child + + show_as_tooltip = { + scope:child = { + add_stewardship_skill = 1 + } + } + } + } + } + 1 = { + send_interface_message = { + type = event_stewardship_good + title = groomed_to_rule_msg_title + left_icon = scope:parent + + add_stewardship_skill = 2 + } + scope:parent = { + send_interface_message = { + type = event_stewardship_good + title = groomed_to_rule_msg_title + left_icon = scope:child + + show_as_tooltip = { + scope:child = { + add_stewardship_skill = 2 + } + } + } + } + } + 1 = { + send_interface_message = { + type = event_stewardship_good + title = groomed_to_rule_msg_title + left_icon = scope:parent + + add_stewardship_skill = 3 + } + scope:parent = { + send_interface_message = { + type = event_stewardship_good + title = groomed_to_rule_msg_title + left_icon = scope:child + + show_as_tooltip = { + scope:child = { + add_stewardship_skill = 3 + } + } + } + } + } + } + } + else_if = { + limit = { + scope:skill_to_increase = flag:learning + } + random_list = { + 1 = { + send_interface_message = { + type = event_learning_good + title = groomed_to_rule_msg_title + left_icon = scope:parent + + add_learning_skill = 1 + } + scope:parent = { + send_interface_message = { + type = event_learning_good + title = groomed_to_rule_msg_title + left_icon = scope:child + + show_as_tooltip = { + scope:child = { + add_learning_skill = 1 + } + } + } + } + } + 1 = { + send_interface_message = { + type = event_learning_good + title = groomed_to_rule_msg_title + left_icon = scope:parent + + add_learning_skill = 2 + } + scope:parent = { + send_interface_message = { + type = event_learning_good + title = groomed_to_rule_msg_title + left_icon = scope:child + + show_as_tooltip = { + scope:child = { + add_learning_skill = 2 + } + } + } + } + } + 1 = { + send_interface_message = { + type = event_learning_good + title = groomed_to_rule_msg_title + left_icon = scope:parent + + add_learning_skill = 3 + } + scope:parent = { + send_interface_message = { + type = event_learning_good + title = groomed_to_rule_msg_title + left_icon = scope:child + + show_as_tooltip = { + scope:child = { + add_learning_skill = 3 + } + } + } + } + } + } + } +} + +childhood_groomed_to_rule_skill_gain_effect = { + every_parent = { + limit = { + is_alive = yes + has_perk = groomed_to_rule_perk + } + save_scope_as = parent + root = { + groomed_to_rule_random_skills_effect = yes + } + } +} + + +save_commission_epic_loc_variables = { + story_owner = { + set_variable = { + name = composition_type + value = scope:story.var:composition_type + } + set_variable = { + name = composition_detail + value = scope:story.var:composition_detail + } + if = { + limit = { + exists = scope:story.var:composer + } + set_variable = { + name = composer_exists + value = yes + } + scope:story.var:composer = { + save_scope_as = composer + } + } + } +} + +clear_commission_epic_loc_variables = { + remove_variable = composition_type + remove_variable = composition_detail + remove_variable = composer_exists +} + +update_embassies_effect = { + if = { + limit = { + has_perk = embassies_perk + is_landless_adventurer = no + } + remove_all_character_modifier_instances = embassies_perk_modifier + + set_variable = { + name = current_embassies_perk_value + value = 0 + } + set_variable = { + name = previous_current_embassies_perk_value + value = 0 + } + + if = { + limit = { + exists = var:previous_current_embassies_perk_value + exists = var:current_embassies_perk_value + } + + every_ally = { + prev = { + change_variable = { + name = previous_current_embassies_perk_value + add = 1 + } + if = { + limit = { + exists = var:current_embassies_perk_value + var:current_embassies_perk_value < embassies_max + } + change_variable = { + name = current_embassies_perk_value + add = 1 + } + add_character_modifier = { + modifier = embassies_perk_modifier + } + } + } + } + + # For players that were over the cap before the change so that they don't feel like they've "lost progress" + save_temporary_scope_as = variable_check + if = { + limit = { + var:current_embassies_perk_value < scope:variable_check.var:previous_current_embassies_perk_value + } + set_variable = { + name = current_embassies_perk_value + value = var:previous_current_embassies_perk_value + } + } + } + } +} + +try_remove_perk_alliance_opinion_effect = { + if = { + limit = { + has_opinion_modifier = { + modifier = perk_negotiated_alliance_opinion + target = $TARGET$ + } + } + remove_opinion = { + modifier = perk_negotiated_alliance_opinion + target = $TARGET$ + } + } +} + +# friendly_counsel_skill_gain_effect: Randomly gain a skill point because of your friend +# friendly_counsel_random_removal_effect: Removes a random one of the modifiers added by Friendly Counsel +friendly_counsel_skill_gain_effect = { + if = { + limit = { + has_perk = friendly_counsel_perk + } + if = { + limit = { + NOT = { has_variable = current_friendly_counsel_perk_value } + } + set_variable = { + name = current_friendly_counsel_perk_value + value = 0 + } + } + + every_relation = { + type = friend + add_to_temporary_list = friendly_counsel_friends + } + every_relation = { + type = best_friend + add_to_temporary_list = friendly_counsel_friends + } + every_relation = { + type = blood_brother + add_to_temporary_list = friendly_counsel_friends + } + + if = { + limit = { + exists = var:current_friendly_counsel_perk_value + save_temporary_scope_as = affected_friend + OR = { + var:current_friendly_counsel_perk_value < friendly_counsel_max + AND = { # If you have a Blood Brother you get one extra skill + government_has_flag = government_is_nomadic + var:current_friendly_counsel_perk_value < 6 + any_in_list = { + list = friendly_counsel_friends + has_relation_blood_brother = root + } + } + } + any_in_list = { + list = friendly_counsel_friends + count > scope:affected_friend.var:current_friendly_counsel_perk_value + } + } + random_list = { + 1 = { + add_character_modifier = { + modifier = friendly_counsel_martial_gain + } + } + 1 = { + add_character_modifier = { + modifier = friendly_counsel_diplomacy_gain + } + } + 1 = { + add_character_modifier = { + modifier = friendly_counsel_intrigue_gain + } + } + 1 = { + add_character_modifier = { + modifier = friendly_counsel_stewardship_gain + } + } + 1 = { + add_character_modifier = { + modifier = friendly_counsel_learning_gain + } + } + } + change_variable = { + name = current_friendly_counsel_perk_value + add = 1 + } + } + } +} + +friendly_counsel_random_removal_effect = { + if = { + limit = { + has_perk = friendly_counsel_perk + } + + every_relation = { + type = friend + add_to_temporary_list = friendly_counsel_friends + } + every_relation = { + type = best_friend + add_to_temporary_list = friendly_counsel_friends + } + + if = { + limit = { + exists = var:current_friendly_counsel_perk_value + save_temporary_scope_as = affected_friend + var:current_friendly_counsel_perk_value <= friendly_counsel_max + var:current_friendly_counsel_perk_value > 0 + any_in_list = { + list = friendly_counsel_friends + count > scope:affected_friend.var:current_friendly_counsel_perk_value + NOT = { has_character_flag = about_to_die_but_not_dead_yet_flag } + } + } + random_list = { + 1 = { + trigger = { + has_character_modifier = friendly_counsel_martial_gain + } + remove_character_modifier = friendly_counsel_martial_gain + } + 1 = { + trigger = { + has_character_modifier = friendly_counsel_diplomacy_gain + } + remove_character_modifier = friendly_counsel_diplomacy_gain + } + 1 = { + trigger = { + has_character_modifier = friendly_counsel_intrigue_gain + } + remove_character_modifier = friendly_counsel_intrigue_gain + } + 1 = { + trigger = { + has_character_modifier = friendly_counsel_stewardship_gain + } + remove_character_modifier = friendly_counsel_stewardship_gain + } + 1 = { + trigger = { + has_character_modifier = friendly_counsel_learning_gain + } + remove_character_modifier = friendly_counsel_learning_gain + } + } + + change_variable = { + name = current_friendly_counsel_perk_value + subtract = 1 + } + } + } +} + +update_confidants_effect = { + if = { + limit = { + has_perk = confidants_perk + } + remove_all_character_modifier_instances = confidants_perk_modifier + save_temporary_scope_as = confidant_scope + + set_variable = { + name = current_confidants_perk_value + value = 0 + } + + if = { + limit = { + exists = var:current_confidants_perk_value + } + every_relation = { + type = friend + add_to_temporary_list = confidant_friend_list + } + every_in_list = { + list = confidant_friend_list + scope:confidant_scope = { + if = { + limit = { + exists = var:current_confidants_perk_value + var:current_confidants_perk_value < confidants_max + } + change_variable = { + name = current_confidants_perk_value + add = 1 + } + add_character_modifier = { + modifier = confidants_perk_modifier + } + } + } + } + remove_variable = current_confidants_perk_value + } + } +} diff --git a/N3OW/common/scripted_effects/00_dummy_gender_effects.txt b/N3OW/common/scripted_effects/00_dummy_gender_effects.txt new file mode 100644 index 00000000..b23e92f9 --- /dev/null +++ b/N3OW/common/scripted_effects/00_dummy_gender_effects.txt @@ -0,0 +1,472 @@ +#Effects used in Lifestyle Focus events + + +##################################################################### +# EFFECT LIST +##################################################################### +# random_dummy_gender_effect - saves event target dummy_gender as female or female (50/50 chance) +# random_dummy_gender_soldier_effect - saves a random soldier gender as event target dummy_gender +# dummy_opposite_gender_effect - saves the dummy character of the opposite sex compared to TARGET + +random_dummy_gender_effect = { + hidden_effect = { + random_list = { + 1 = { dummy_female = { save_scope_as = dummy_gender } } + 1 = { dummy_male = { save_scope_as = dummy_gender } } + } + } +} + +romance_target_gender_effect = { + hidden_effect = { + if = { + limit = { NOT = { has_sexuality = asexual } } + random_list = { + 50 = { + trigger = { is_attracted_to_women = yes } + dummy_female = { save_scope_as = $SCOPE_NAME$ } + } + 50 = { + trigger = { is_attracted_to_men = yes } + dummy_male = { save_scope_as = $SCOPE_NAME$ } + } + } + } + else = { + #If this effect is used for content not blocked for asexual characters, we assume this effect is used to find out what gender society expects us to prefer. + save_temporary_scope_as = asexual_char + + #If homosexuality seems to be accepted, there is a change of same gender attraction target + if = { + limit = { + NOR = { + trait_is_shunned_or_criminal_in_faith_trigger = { + FAITH = scope:asexual_char.faith + TRAIT = sodomite + GENDER_CHARACTER = dummy_female + } + trait_is_shunned_or_criminal_in_faith_trigger = { + FAITH = scope:asexual_char.faith + TRAIT = sodomite + GENDER_CHARACTER = dummy_male + } + } + } + random_list = { + 10 = { + modifier = { + is_female = yes + add = 80 + } + dummy_male = { save_scope_as = $SCOPE_NAME$ } + } + 10 = { + modifier = { + is_male = yes + add = 80 + } + dummy_female = { save_scope_as = $SCOPE_NAME$ } + } + } + } + #If homosexuality isn't accepted, we 100% go with opposite sex + else = { + if = { + limit = { is_female = yes } + dummy_male = { save_scope_as = $SCOPE_NAME$ } + } + else = { + dummy_female = { save_scope_as = $SCOPE_NAME$ } + } + } + } + } +} + +random_dummy_gender_soldier_effect = { + save_temporary_scope_as = root_character + hidden_effect = { + random_list = { + 1 = { + trigger = { + dummy_female = { + can_be_combatant_based_on_gender_trigger = { + ARMY_OWNER = scope:root_character + } + } + } + dummy_female = { save_scope_as = $SCOPE_NAME$ } + } + 1 = { + trigger = { + dummy_male = { + can_be_combatant_based_on_gender_trigger = { + ARMY_OWNER = scope:root_character + } + } + } + dummy_male = { save_scope_as = $SCOPE_NAME$ } + } + } + } +} + +random_dummy_gender_non_combatant_effect = { + save_temporary_scope_as = root_character + hidden_effect = { + random_list = { + 1 = { + trigger = { + dummy_female = { + NOT = { + can_be_combatant_based_on_gender_trigger = { + ARMY_OWNER = scope:root_character + } + } + } + } + dummy_female = { save_scope_as = $SCOPE_NAME$ } + } + 1 = { + trigger = { + dummy_male = { + NOT = { + can_be_combatant_based_on_gender_trigger = { + ARMY_OWNER = scope:root_character + } + } + } + } + dummy_male = { save_scope_as = $SCOPE_NAME$ } + } + } + } +} + +random_dummy_gender_spy_effect = { + hidden_effect = { + random_list = { + 1 = { dummy_female = { save_scope_as = dummy_gender } } + 1 = { dummy_male = { save_scope_as = dummy_gender } } + } + } +} + +random_dummy_gender_musician_effect = { + hidden_effect = { + random_list = { + 1 = { dummy_female = { save_scope_as = dummy_musician_gender } } + 1 = { dummy_male = { save_scope_as = dummy_musician_gender } } + } + } +} + +random_dummy_gender_servant_effect = { + hidden_effect = { + random_list = { + 1 = { dummy_female = { save_scope_as = dummy_servant_gender } } + 1 = { dummy_male = { save_scope_as = dummy_servant_gender } } + } + } +} + +random_dummy_gender_assassin_effect = { + hidden_effect = { + random_list = { + 50 = { + modifier = { + add = 50 + exists = scope:owner + scope:owner.faith = { has_doctrine = doctrine_gender_female_dominated } + } + dummy_female = { save_scope_as = dummy_assassin_gender } + } + 50 = { + modifier = { + add = 50 + exists = scope:owner + scope:owner.faith = { has_doctrine = doctrine_gender_male_dominated } + } + dummy_male = { save_scope_as = dummy_assassin_gender } + } + } + } +} + +random_dummy_gender_scholar_effect = { + hidden_effect = { + random_list = { + 1 = { dummy_female = { save_scope_as = dummy_scholar_gender } } + 25 = { dummy_male = { save_scope_as = dummy_scholar_gender } } + } + } +} + +random_dummy_gender_mystic_effect = { + hidden_effect = { + random_list = { + 4 = { dummy_female = { save_scope_as = dummy_mystic_gender } } + 1 = { dummy_male = { save_scope_as = dummy_mystic_gender } } + } + } +} + +random_dummy_gender_physician_effect = { + hidden_effect = { + random_list = { + 1 = { dummy_female = { save_scope_as = dummy_physician_gender } } + 1 = { dummy_male = { save_scope_as = dummy_physician_gender } } + } + } +} + +random_dummy_gender_chancellor_effect = { + hidden_effect = { + random_list = { + 1 = { dummy_female = { save_scope_as = dummy_gender } } + 1 = { dummy_male = { save_scope_as = dummy_gender } } + } + } +} + + +random_dummy_gender_marshal_effect = { + hidden_effect = { + random_list = { + 1 = { dummy_female = { save_scope_as = dummy_gender } } + 1 = { dummy_male = { save_scope_as = dummy_gender } } + } + } +} + + +random_dummy_gender_steward_effect = { + hidden_effect = { + random_list = { + 1 = { dummy_female = { save_scope_as = dummy_gender } } + 1 = { dummy_male = { save_scope_as = dummy_gender } } + } + } +} + + +random_dummy_gender_spymaster_effect = { + hidden_effect = { + random_list = { + 1 = { dummy_female = { save_scope_as = dummy_gender } } + 1 = { dummy_male = { save_scope_as = dummy_gender } } + } + } +} + + +random_dummy_gender_landholder_effect = { + hidden_effect = { + random_list = { + ################################## + # Female Chance (adds up to 50%) # + ################################## + + 25 = { # Female Landowners Common (50-50) + trigger = { + OR = { + has_realm_law = equal_law + has_realm_law = female_preference_law + has_realm_law = female_only_law + + # These cultures historically granted equal property rights to women. + culture = { + OR = { + has_cultural_pillar = heritage_north_germanic + has_cultural_parameter = gender_equal_inheritance + } + } + } + } + dummy_female = { save_scope_as = dummy_gender } + } + + 15 = { # Female Landowners Uncommon (33-67) + trigger = { + OR = { + has_realm_law = male_preference_law + has_realm_law = equal_law + has_realm_law = female_preference_law + has_realm_law = female_only_law + + # These religions historically granted more property rights to women. + faith = { + religion_tag = islam_religion # Based on the Early Islamic Reforms. + religion_tag = hinduism_religion # Based on the Dharmasatras. + religion_tag = judaism_religion # Based on Mosaic Law. + } + + # These cultures historically granted more property rights to women. + has_culture = culture:english + has_culture = culture:norman + culture = { has_cultural_pillar = heritage_north_germanic } # Scandanavian women often managed households and had full property rights. + culture = { has_cultural_pillar = heritage_iberian } # Granted by the Liber Judiciorum ca 642/642. Includes Basque. + culture = { has_cultural_pillar = heritage_indo_aryan } # Based on the Dharmasatras. + + } + } + dummy_female = { save_scope_as = dummy_gender } + } + + 10 = { # Female Landowners Rare (17-83) + trigger = { + OR = { + # These cultures historically prevented women from owning/inheriting land. + NOT = { + culture = { has_cultural_pillar = heritage_goidelic } # Patriarchical society which made women subordinate to men. + culture = { has_cultural_pillar = heritage_east_slavic } # Patriarchical society which made women subordinate to men. + culture = { has_cultural_pillar = heritage_south_slavic } + culture = { has_cultural_pillar = heritage_byzantine } # Based on Roman Law + culture = { has_cultural_pillar = heritage_latin } # Based on Roman Law + } + # But if their legal system changes to allow it, women should gain full ownership/inheritance rights. + has_realm_law = equal_law + has_realm_law = female_preference_law + has_realm_law = female_only_law + } + } + dummy_female = { save_scope_as = dummy_gender } + } + + + ################################ + # Male Chance (adds up to 50%) # + ################################ + + 25 = { # Male Landowners Common (50-50) + trigger = { + OR = { + has_realm_law = equal_law + has_realm_law = male_preference_law + has_realm_law = male_only_law + } + } + dummy_male = { save_scope_as = dummy_gender } + } + + 15 = { # Male Landowners Uncommon (33-67) + trigger = { + OR = { + has_realm_law = female_preference_law + has_realm_law = equal_law + has_realm_law = male_preference_law + has_realm_law = male_only_law + } + } + dummy_male = { save_scope_as = dummy_gender } + } + + 10 = { # Male Landowners Rare (17-83) + trigger = { + + } + dummy_male = { save_scope_as = dummy_gender } + } + } + } +} + + + + +random_dummy_gender_clergy_effect = { + hidden_effect = { + random_list = { + 50 = { + trigger = { + faith = { + NOR = { + has_doctrine = doctrine_clerical_gender_male_only + AND = { + has_doctrine = doctrine_clerical_gender_either + has_doctrine = doctrine_gender_male_dominated + } + } + } + } + dummy_female = { save_scope_as = dummy_clergy_gender } + } + 50 = { + trigger = { + faith = { + NOR = { + has_doctrine = doctrine_clerical_gender_female_only + AND = { + has_doctrine = doctrine_clerical_gender_either + has_doctrine = doctrine_gender_female_dominated + } + } + } + } + dummy_male = { save_scope_as = dummy_clergy_gender } + } + } + } +} + +dummy_opposite_gender_effect = { + if = { + limit = { $TARGET$ = { is_female = yes } } + dummy_male = { save_scope_as = dummy_opposite_gender } + } + else = { + dummy_female = { save_scope_as = dummy_opposite_gender } + } +} + +dummy_attracted_gender_effect = { + if = { + limit = { + $TARGET$ = { + is_attracted_to_men = yes + is_attracted_to_women = yes + } + } + dummy_male = { save_scope_as = dummy_attracted_gender } + } + else_if = { + limit = { $TARGET$ = { is_attracted_to_men = yes } } + dummy_male = { save_scope_as = dummy_attracted_gender } + } + else = { + dummy_female = { save_scope_as = dummy_attracted_gender } + } +} + +random_dummy_gender_peasant_effect = { + hidden_effect = { + random_list = { + 50 = { + modifier = { # 3 times as likely if faith is male dominated + add = 150 + faith = { + has_doctrine_parameter = male_dominated_law + } + } + modifier = { + add = 50 + has_realm_law = male_preference_law + } + dummy_male = { save_scope_as = dummy_peasant_gender } + } + 50 = { + modifier = { # 3 times as likely if faith is female dominated + add = 150 + faith = { + has_doctrine_parameter = female_dominated_law + } + } + modifier = { + add = 50 + has_realm_law = female_preference_law + } + dummy_female = { save_scope_as = dummy_peasant_gender } + } + } + } +} \ No newline at end of file diff --git a/N3OW/common/scripted_effects/00_education_effects.txt b/N3OW/common/scripted_effects/00_education_effects.txt new file mode 100644 index 00000000..85c5a964 --- /dev/null +++ b/N3OW/common/scripted_effects/00_education_effects.txt @@ -0,0 +1,3468 @@ +#Scripted effects relating to education + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! + +#education_point_acquisition_effect - Rolls a random chance for assigning education points based on a number of factors. Run in a pulse event every half year of childhood. + +#education_point_acquisition_additional_points_effect - Effect to award more education points through one-offs like events etc. + +#education_complete_notification_effect - Identifies characters for the "Education Completed" notification events and sends the events. + +#save_childhood_trait_as_variable_effect - Saves childhood trait as a variable flag + +#assign_commander_trait_effect - To assign a commander trait to a child with a martial education + +#wrap_up_education_effect - Additional effects run to wrap up education + +#rank_up_education_effect - Increases your education by 1 rank unless it's at 4 (or you don't have any) + +###################################################################### +# EFFECTS +###################################################################### + + +#Education point acquisition + +education_point_acquisition_effect = { + if = { + limit = { has_focus = education_diplomacy } + education_point_acquisition_support_effect = { SKILL = diplomacy } + } + else_if = { + limit = { has_focus = education_martial } + education_point_acquisition_support_effect = { SKILL = martial } + } + else_if = { + limit = { has_focus = education_stewardship } + education_point_acquisition_support_effect = { SKILL = stewardship } + } + else_if = { + limit = { has_focus = education_intrigue } + education_point_acquisition_support_effect = { SKILL = intrigue } + } + else_if = { + limit = { has_focus = education_learning } + education_point_acquisition_support_effect = { SKILL = learning } + } +} + +#Effect to award more education points through one-offs like events etc +#Takes argument LEVEL low/mid +education_point_acquisition_additional_points_effect = { + save_temporary_scope_value_as = { + name = point_level + value = flag:$LEVEL$ + } + #Mid + if = { + limit = { scope:point_level = flag:mid } + if = { + limit = { has_focus = education_diplomacy } + #Set variables if they don't exist + if = { + limit = { + NOT = { has_variable = education_diplomacy_variable } + } + set_variable = { + name = education_diplomacy_variable + value = 0 + } + } + #Award more points + change_variable = { + name = education_diplomacy_variable + add = 6 + } + } + else_if = { + limit = { has_focus = education_martial } + #Set variables if they don't exist + if = { + limit = { + NOT = { has_variable = education_martial_variable } + } + set_variable = { + name = education_martial_variable + value = 0 + } + } + #Award more points + change_variable = { + name = education_martial_variable + add = 6 + } + } + else_if = { + limit = { has_focus = education_stewardship } + #Set variables if they don't exist + if = { + limit = { + NOT = { has_variable = education_stewardship_variable } + } + set_variable = { + name = education_stewardship_variable + value = 0 + } + } + #Award more points + change_variable = { + name = education_stewardship_variable + add = 6 + } + } + else_if = { + limit = { has_focus = education_intrigue } + #Set variables if they don't exist + if = { + limit = { + NOT = { has_variable = education_intrigue_variable } + } + set_variable = { + name = education_intrigue_variable + value = 0 + } + } + #Award more points + change_variable = { + name = education_intrigue_variable + add = 6 + } + } + else_if = { + limit = { has_focus = education_learning } + #Set variables if they don't exist + if = { + limit = { + NOT = { has_variable = education_learning_variable } + } + set_variable = { + name = education_learning_variable + value = 0 + } + } + #Award more points + change_variable = { + name = education_learning_variable + add = 6 + } + } + } + #Low + else_if = { + limit = { scope:point_level = flag:low } + if = { + limit = { has_focus = education_diplomacy } + #Set variables if they don't exist + if = { + limit = { + NOT = { has_variable = education_diplomacy_variable } + } + set_variable = { + name = education_diplomacy_variable + value = 0 + } + } + #Award more points + change_variable = { + name = education_diplomacy_variable + add = 4 + } + } + else_if = { + limit = { has_focus = education_martial } + #Set variables if they don't exist + if = { + limit = { + NOT = { has_variable = education_martial_variable } + } + set_variable = { + name = education_martial_variable + value = 0 + } + } + #Award more points + change_variable = { + name = education_martial_variable + add = 4 + } + } + else_if = { + limit = { has_focus = education_stewardship } + #Set variables if they don't exist + if = { + limit = { + NOT = { has_variable = education_stewardship_variable } + } + set_variable = { + name = education_stewardship_variable + value = 0 + } + } + #Award more points + change_variable = { + name = education_stewardship_variable + add = 4 + } + } + else_if = { + limit = { has_focus = education_intrigue } + #Set variables if they don't exist + if = { + limit = { + NOT = { has_variable = education_intrigue_variable } + } + set_variable = { + name = education_intrigue_variable + value = 0 + } + } + #Award more points + change_variable = { + name = education_intrigue_variable + add = 4 + } + } + else_if = { + limit = { has_focus = education_learning } + #Set variables if they don't exist + if = { + limit = { + NOT = { has_variable = education_learning_variable } + } + set_variable = { + name = education_learning_variable + value = 0 + } + } + #Award more points + change_variable = { + name = education_learning_variable + add = 4 + } + } + } +} + +education_point_acquisition_support_effect = { + #Save educator + if = { + limit = { + any_relation = { + type = guardian + always = yes + } + } + random_relation = { + type = guardian + save_scope_as = educator + } + } + else_if = { + limit = { + court_owner ?= { employs_court_position = court_tutor_court_position } + } + court_owner = { + random_court_position_holder = { + type = court_tutor_court_position + save_scope_as = educator + } + } + } + else_if = { + limit = { + court_owner ?= { employs_court_position = court_guru_court_position } + } + court_owner = { + random_court_position_holder = { + type = court_guru_court_position + save_scope_as = educator + } + } + } + + #Set variables if they don't exist + if = { + limit = { + NOT = { has_variable = education_$SKILL$_variable } + } + set_variable = { + name = education_$SKILL$_variable + value = 0 + } + } + + #Randomize success or failure + random_list = { + #Success + 60 = { + #Child intelligence + modifier = { + has_trait = intellect_good_3 + add = 20 + } + modifier = { + has_trait = intellect_good_2 + add = 15 + } + modifier = { + OR = { + has_trait = intellect_good_1 + has_trait = shrewd + } + add = 10 + } + #Educator intelligence & skill + modifier = { + exists = scope:educator + add = { + scope:educator = { + #Intelligence + if = { + limit = { has_trait = intellect_good_3 } + value = 15 + } + else_if = { + limit = { has_trait = intellect_good_2 } + value = 10 + } + else_if = { + limit = { + OR = { + has_trait = intellect_good_1 + has_trait = shrewd + } + } + value = 5 + } + #Specific skill + add = { + value = $SKILL$ + multiply = educator_skill_modifier_factor + } + #Learning skill + add = { + value = learning + multiply = educator_learning_skill_modifier_factor + } + #Storyteller tradition + if = { + limit = { culture = { has_cultural_parameter = better_ward_education } } + value = 10 + } + } + } + } + + #Affinity + modifier = { + has_$SKILL$_education_affinity_childhood_trait_trigger = yes + add = matching_childhood_trait_modifier_value + } + + #Disaffinity + modifier = { + has_$SKILL$_education_disaffinity_childhood_trait_trigger = yes + add = mismatching_childhood_trait_modifier_value + } + + modifier = { + scope:educator.house ?= { has_house_power_parameter = service_house_improved_educator_outcome_chance } + add = 5 + } + + change_variable = { + name = education_$SKILL$_variable + add = 2 + } + } + #Failure + 40 = { + #Child intelligence + modifier = { + OR = { + has_trait = intellect_bad_3 + has_trait = inbred + } + add = 20 + } + modifier = { + has_trait = intellect_bad_2 + add = 15 + } + modifier = { + OR = { + has_trait = intellect_bad_1 + has_trait = dull + } + add = 10 + } + + #Educator intelligence & skill + modifier = { + exists = scope:educator + add = { + value = 0 + scope:educator = { + #Intelligence + if = { + limit = { has_trait = intellect_bad_3 } + value = 15 + } + else_if = { + limit = { has_trait = intellect_bad_2 } + value = 10 + } + else_if = { + limit = { + OR = { + has_trait = intellect_bad_1 + has_trait = dull + } + } + value = 5 + } + } + } + } + modifier = { + add = 20 + NOT = { + exists = scope:educator + } + } + } + } +} + +education_point_add_general_effect = { + switch = { + trigger = has_focus + education_diplomacy = { + education_point_add_point_effect = { SKILL = diplomacy VALUE = $VALUE$ } + } + education_martial = { + education_point_add_point_effect = { SKILL = martial VALUE = $VALUE$ } + } + education_stewardship = { + education_point_add_point_effect = { SKILL = stewardship VALUE = $VALUE$ } + } + education_intrigue = { + education_point_add_point_effect = { SKILL = intrigue VALUE = $VALUE$ } + } + education_learning = { + education_point_add_point_effect = { SKILL = learning VALUE = $VALUE$ } + } + } +} + +education_point_add_point_effect = { + #Set variables if they don't exist + if = { + limit = { + NOT = { has_variable = education_$SKILL$_variable } + } + set_variable = { + name = education_$SKILL$_variable + value = 0 + } + } + # Change variable + change_variable = { + name = education_$SKILL$_variable + add = $VALUE$ + } +} + +#Effect to identify characters for the "Education Completed" notification events +education_complete_notification_effect = { + save_scope_as = educated_child + if = { + limit = { + any_relation = { type = guardian } + } + random_relation = { + type = guardian + if = { + limit = { this = { is_parent_of = root } } + save_scope_as = parent_guardian + trigger_event = coming_of_age.1001 + } + else = { + save_scope_as = guardian + if = { + limit = { + scope:educated_child = { + any_parent = { is_alive = no } + any_parent = { is_alive = yes } + } + } + random_parent = { + limit = { is_alive = yes } + save_scope_as = living_parent + } + random_parent = { + limit = { is_alive = no } + save_scope_as = dead_parent + } + trigger_event = coming_of_age.1003 #Event for non-parent guardian when one parent of the child is dead + } + else_if = { + limit = { + scope:educated_child = { + any_parent = { + is_alive = yes + count = 2 + } + } + } + scope:educated_child.father = { save_scope_as = father } + scope:educated_child.mother = { save_scope_as = mother } + trigger_event = coming_of_age.1004 #Event for non-parent guardian when both parents are alive + } + else_if = { + limit = { + OR = { + NOT = { exists = scope:educated_child.father } + NOT = { exists = scope:educated_child.mother } + } + } + if = { + limit = { + exists = scope:educated_child.father + } + scope:educated_child.father = { + save_scope_as = parent + } + } + if = { + limit = { + exists = scope:educated_child.mother + } + scope:educated_child.mother = { + save_scope_as = parent + } + } + if = { + limit = { + NOT = { exists = scope:parent } + } + trigger_event = coming_of_age.1005 + } + else = { + trigger_event = coming_of_age.1003 + } + } + else = { + scope:educated_child.father = { save_scope_as = father } + scope:educated_child.mother = { save_scope_as = mother } + trigger_event = coming_of_age.1005 #Event for non-parent guardian when both parents are dead + } + } + hidden_effect = { # Hidden to avoid duplicate effect messages + #Relationship back-up clean-up + remove_guardian_effect = { + GUARDIAN = this + WARD = scope:educated_child + RETURN_WARD = no + HIDE_OPINION = no + } + } + } + } + every_parent = { + limit = { + OR = { + NOT = { exists = scope:parent_guardian } + AND = { + exists = scope:parent_guardian + this != scope:parent_guardian + } + } + } + trigger_event = coming_of_age.1002 + } + # Inform non-parent dynasty member players they are in the court of + if = { + limit = { is_lowborn = no } + every_player = { + limit = { + scope:educated_child.dynasty ?= dynasty + NOR = { + is_parent_of = scope:educated_child + scope:parent_guardian ?= this + } + OR = { + scope:educated_child.liege ?= this + scope:educated_child.employer ?= this + scope:educated_child.court_owner ?= this + } + } + save_scope_as = relative + send_interface_message = { + type = msg_dynasty_child_of_age + title = msg_dynasty_child_of_age_title + desc = msg_dynasty_child_of_age_desc + left_icon = scope:educated_child + scope:educated_child = { display_correct_education_trait_gain_tooltip_effect = yes } + } + } + } + liege ?= { + if = { + limit = { + is_ai = no + is_employer_of = scope:educated_child + NOR = { + scope:educated_child.dynasty ?= dynasty + is_parent_of = scope:educated_child + scope:parent_guardian ?= this + } + } + save_scope_as = relative + send_interface_message = { + type = msg_courtier_child_of_age + title = msg_courtier_child_of_age_title + desc = msg_dynasty_child_of_age_desc + left_icon = scope:educated_child + scope:educated_child = { display_correct_education_trait_gain_tooltip_effect = yes } + } + } + } +} + +#To extract and save event_targets to use in coming_of_age notification event +save_event_targets_from_childhood_effect = { + if = { + limit = { + any_relation = { type = friend always = yes } + } + random_relation = { + type = friend + save_scope_as = friend + } + } + if = { + limit = { + exists = var:had_childhood_crush_variable + } + var:had_childhood_crush_variable = { + save_scope_as = crush + } + } + if = { + limit = { + exists = var:had_childhood_bully_variable + } + var:had_childhood_bully_variable = { + save_scope_as = bully + } + } + if = { + limit = { + exists = var:had_childhood_victim_variable + } + var:had_childhood_victim_variable = { + save_scope_as = victim + } + } +} + +#To assign a commander trait (based on culture, faith, etc.) to a child with a martial education +assign_commander_trait_effect = { + random_list = { + 100 = { + trigger = { NOT = { has_trait = logistician } } + add_trait = logistician + } + 100 = { + trigger = { NOT = { has_trait = military_engineer } } + add_trait = military_engineer + } + 100 = { + trigger = { NOT = { has_trait = aggressive_attacker } } + add_trait = aggressive_attacker + } + 100 = { + trigger = { NOT = { has_trait = unyielding_defender } } + add_trait = unyielding_defender + } + 100 = { + trigger = { NOT = { has_trait = forder } } + add_trait = forder + } + 100 = { + trigger = { NOT = { has_trait = flexible_leader } } + add_trait = flexible_leader + } + 100 = { + trigger = { + NOT = { has_trait = desert_warrior } + OR = { + any_directly_owned_province = { + terrain = desert + } + AND = { + exists = scope:educator + scope:educator = { + any_directly_owned_province = { + terrain = desert + } + } + } + AND = { + NOT = { exists = scope:educator } + liege ?= { + any_directly_owned_province = { + terrain = desert + } + } + } + } + } + modifier = { + culture = { + has_cultural_parameter = desert_warrior_trait_more_common + } + factor = 2 + } + add_trait = desert_warrior + } + 100 = { + trigger = { + NOT = { has_trait = jungle_stalker } + OR = { + any_directly_owned_province = { + terrain = jungle + } + AND = { + exists = scope:educator + scope:educator = { + any_directly_owned_province = { + terrain = jungle + } + } + } + AND = { + NOT = { exists = scope:educator } + liege ?= { + any_directly_owned_province = { + terrain = jungle + } + } + } + } + } + modifier = { + culture = { + has_cultural_parameter = jungle_stalker_trait_more_common + } + factor = 2 + } + add_trait = jungle_stalker + } + 100 = { + trigger = { + NOT = { has_trait = winter_soldier } + OR = { + any_directly_owned_province = { + OR = { + terrain = taiga + geographical_region = world_tibet + geographical_region = world_europe_north + geographical_region = world_europe_east + geographical_region = world_steppe + } + } + AND = { + exists = scope:educator + scope:educator = { + any_directly_owned_province = { + OR = { + terrain = taiga + geographical_region = world_tibet + geographical_region = world_europe_north + geographical_region = world_europe_east + geographical_region = world_steppe + } + } + } + } + AND = { + NOT = { exists = scope:educator } + liege ?= { + any_directly_owned_province = { + OR = { + terrain = taiga + geographical_region = world_tibet + geographical_region = world_europe_north + geographical_region = world_europe_east + geographical_region = world_steppe + } + } + } + } + } + } + modifier = { + culture = { + has_cultural_parameter = winter_soldier_trait_more_common + } + factor = 2 + } + add_trait = winter_soldier + } + 100 = { + trigger = { NOT = { has_trait = reaver } } + add_trait = reaver + } + 100 = { + trigger = { NOT = { has_trait = reckless } } + add_trait = reckless + } + 100 = { + trigger = { NOT = { has_trait = holy_warrior } } + add_trait = holy_warrior + } + 100 = { + trigger = { + culture = { + has_cultural_parameter = forest_fighter_trait_more_common + } + NOT = { has_trait = forest_fighter } + OR = { + any_directly_owned_province = { + OR = { + terrain = forest + terrain = taiga + } + } + AND = { + exists = scope:educator + scope:educator = { + any_directly_owned_province = { + OR = { + terrain = forest + terrain = taiga + } + } + } + } + AND = { + NOT = { exists = scope:educator } + liege ?= { + any_directly_owned_province = { + OR = { + terrain = forest + terrain = taiga + } + } + } + } + } + } + modifier = { + culture = { + has_cultural_parameter = forest_fighter_trait_more_common + } + factor = 2 + } + add_trait = forest_fighter + } + 100 = { + trigger = { + culture = { + has_cultural_parameter = rough_terrain_expert_trait_more_common + } + NOT = { has_trait = rough_terrain_expert } + OR = { + any_directly_owned_province = { + OR = { + terrain = mountains + terrain = hills + terrain = wetlands + } + } + AND = { + exists = scope:educator + scope:educator = { + any_directly_owned_province = { + OR = { + terrain = mountains + terrain = hills + terrain = wetlands + } + } + } + } + AND = { + NOT = { exists = scope:educator } + liege ?= { + any_directly_owned_province = { + OR = { + terrain = mountains + terrain = hills + terrain = wetlands + } + } + } + } + } + } + modifier = { + culture = { + has_cultural_parameter = rough_terrain_expert_trait_more_common + } + factor = 2 + } + add_trait = rough_terrain_expert + } + } +} + + + +custom_tooltip_learning_coming_of_age_effect = { + if = { + limit = { + has_trait = education_learning_1 + } + custom_tooltip = coming_of_age.0001.tt.1 + } + else_if = { + limit = { + has_trait = education_learning_2 + } + custom_tooltip = coming_of_age.0001.tt.2 + } + else_if = { + limit = { + has_trait = education_learning_3 + } + custom_tooltip = coming_of_age.0001.tt.3 + } + else_if = { + limit = { + has_trait = education_learning_4 + } + custom_tooltip = coming_of_age.0001.tt.4 + } + if = { + limit = { + exists = scope:crush + } + custom_tooltip = coming_of_age.0001.tt.5 + } + if = { + limit = { + exists = scope:victim + } + custom_tooltip = coming_of_age.0001.tt.7 + } + if = { + limit = { + exists = scope:bully + } + custom_tooltip = coming_of_age.0001.tt.9 + } +} + +custom_tooltip_stewardship_coming_of_age_effect = { + if = { + limit = { + has_trait = education_stewardship_1 + } + custom_tooltip = coming_of_age.0001.tt.1 + } + else_if = { + limit = { + has_trait = education_stewardship_2 + } + custom_tooltip = coming_of_age.0001.tt.2 + } + else_if = { + limit = { + has_trait = education_stewardship_3 + } + custom_tooltip = coming_of_age.0001.tt.3 + } + else_if = { + limit = { + has_trait = education_stewardship_4 + } + custom_tooltip = coming_of_age.0001.tt.4 + } + if = { + limit = { + exists = scope:crush + } + custom_tooltip = coming_of_age.0001.tt.5 + } + if = { + limit = { + exists = scope:victim + } + custom_tooltip = coming_of_age.0001.tt.7 + } + if = { + limit = { + exists = scope:bully + } + custom_tooltip = coming_of_age.0001.tt.9 + } +} + +custom_tooltip_martial_coming_of_age_effect = { + if = { + limit = { + has_trait = education_martial_1 + } + custom_tooltip = coming_of_age.0001.tt.1 + } + else_if = { + limit = { + has_trait = education_martial_2 + } + custom_tooltip = coming_of_age.0001.tt.2 + } + else_if = { + limit = { + has_trait = education_martial_3 + } + custom_tooltip = coming_of_age.0001.tt.3 + } + else_if = { + limit = { + has_trait = education_martial_4 + } + custom_tooltip = coming_of_age.0001.tt.4 + } + if = { + limit = { + exists = scope:crush + } + custom_tooltip = coming_of_age.0001.tt.5 + } + if = { + limit = { + exists = scope:victim + } + custom_tooltip = coming_of_age.0001.tt.7 + } + if = { + limit = { + exists = scope:bully + } + custom_tooltip = coming_of_age.0001.tt.9 + } +} + +custom_tooltip_intrigue_coming_of_age_effect = { + if = { + limit = { + has_trait = education_intrigue_1 + } + custom_tooltip = coming_of_age.0001.tt.1 + } + else_if = { + limit = { + has_trait = education_intrigue_2 + } + custom_tooltip = coming_of_age.0001.tt.2 + } + else_if = { + limit = { + has_trait = education_intrigue_3 + } + custom_tooltip = coming_of_age.0001.tt.3 + } + else_if = { + limit = { + has_trait = education_intrigue_4 + } + custom_tooltip = coming_of_age.0001.tt.4 + } + if = { + limit = { + exists = scope:crush + } + custom_tooltip = coming_of_age.0001.tt.5 + } + if = { + limit = { + exists = scope:victim + } + custom_tooltip = coming_of_age.0001.tt.7 + } + if = { + limit = { + exists = scope:bully + } + custom_tooltip = coming_of_age.0001.tt.9 + } +} + +custom_tooltip_diplomacy_coming_of_age_effect = { + if = { + limit = { + has_trait = education_diplomacy_1 + } + custom_tooltip = coming_of_age.0001.tt.1 + } + else_if = { + limit = { + has_trait = education_diplomacy_2 + } + custom_tooltip = coming_of_age.0001.tt.2 + } + else_if = { + limit = { + has_trait = education_diplomacy_3 + } + custom_tooltip = coming_of_age.0001.tt.3 + } + else_if = { + limit = { + has_trait = education_diplomacy_4 + } + custom_tooltip = coming_of_age.0001.tt.4 + } + if = { + limit = { + exists = scope:crush + } + custom_tooltip = coming_of_age.0001.tt.5 + } + if = { + limit = { + exists = scope:victim + } + custom_tooltip = coming_of_age.0001.tt.7 + } + if = { + limit = { + exists = scope:bully + } + custom_tooltip = coming_of_age.0001.tt.9 + } +} + + +remove_variables_and_trait_coming_of_age_effect = { + if = { + limit = { + exists = var:had_childhood_crush_variable + } + remove_variable = had_childhood_crush_variable + } + if = { + limit = { + exists = var:unrequited_crush + } + remove_variable = unrequited_crush + } + if = { + limit = { + exists = var:had_childhood_victim_variable + } + remove_variable = had_childhood_victim_variable + } + if = { + limit = { + exists = var:had_childhood_bully_variable + } + remove_variable = had_childhood_bully_variable + } + if = { + limit = { has_trait = curious } + remove_trait = curious + } + if = { + limit = { has_trait = rowdy } + remove_trait = rowdy + } + if = { + limit = { has_trait = bossy } + remove_trait = bossy + } + if = { + limit = { has_trait = charming } + remove_trait = charming + } + if = { + limit = { has_trait = pensive } + remove_trait = pensive + } + if = { + limit = { + has_character_flag = bully_destroyed_toy + } + remove_character_flag = bully_destroyed_toy + } + if = { + limit = { + has_character_flag = natural_education_progression + } + remove_character_flag = natural_education_progression + } + if = { + limit = { + has_variable = education_point_gain_variable + } + remove_variable = education_point_gain_variable + } + if = { + limit = { + has_variable = childhood_trait_type + } + remove_variable = childhood_trait_type + } + if = { + limit = { + exists = var:education_diplomacy_variable + } + remove_variable = education_diplomacy_variable + } + if = { + limit = { + exists = var:education_martial_variable + } + remove_variable = education_martial_variable + } + if = { + limit = { + exists = var:education_stewardship_variable + } + remove_variable = education_stewardship_variable + } + if = { + limit = { + exists = var:education_intrigue_variable + } + remove_variable = education_intrigue_variable + } + if = { + limit = { + exists = var:education_learning_variable + } + remove_variable = education_learning_variable + } +} + +remove_childhoood_traits_effect = { + if = { + limit = { has_trait = curious } + remove_trait = curious + } + if = { + limit = { has_trait = rowdy } + remove_trait = rowdy + } + if = { + limit = { has_trait = bossy } + remove_trait = bossy + } + if = { + limit = { has_trait = charming } + remove_trait = charming + } + if = { + limit = { has_trait = pensive } + remove_trait = pensive + } +} + +#Save childhood trait as a variable flag +save_childhood_trait_as_variable_effect = { + if = { + limit = { has_trait = rowdy } + set_variable = { + name = childhood_trait_type + value = flag:rowdy + } + } + else_if = { + limit = { has_trait = curious } + set_variable = { + name = childhood_trait_type + value = flag:curious + } + } + else_if = { + limit = { has_trait = bossy } + set_variable = { + name = childhood_trait_type + value = flag:bossy + } + } + else_if = { + limit = { has_trait = charming } + set_variable = { + name = childhood_trait_type + value = flag:charming + } + } + else_if = { + limit = { has_trait = pensive } + set_variable = { + name = childhood_trait_type + value = flag:pensive + } + } +} + + +#Display correct trait tooltip +display_correct_education_trait_gain_tooltip_effect = { + if = { + limit = { has_trait = education_diplomacy_1 } + show_as_tooltip = { + add_trait_force_tooltip = education_diplomacy_1 + } + } + if = { + limit = { has_trait = education_diplomacy_2 } + show_as_tooltip = { + add_trait_force_tooltip = education_diplomacy_2 + } + } + if = { + limit = { has_trait = education_diplomacy_3 } + show_as_tooltip = { + add_trait_force_tooltip = education_diplomacy_3 + } + } + if = { + limit = { has_trait = education_diplomacy_4 } + show_as_tooltip = { + add_trait_force_tooltip = education_diplomacy_4 + } + } + if = { + limit = { has_trait = education_diplomacy_5 } + show_as_tooltip = { + add_trait_force_tooltip = education_diplomacy_5 + } + } + if = { + limit = { has_trait = education_martial_1 } + show_as_tooltip = { + add_trait_force_tooltip = education_martial_1 + } + } + if = { + limit = { has_trait = education_martial_2 } + show_as_tooltip = { + add_trait_force_tooltip = education_martial_2 + } + } + if = { + limit = { has_trait = education_martial_3 } + show_as_tooltip = { + add_trait_force_tooltip = education_martial_3 + } + } + if = { + limit = { has_trait = education_martial_4 } + show_as_tooltip = { + add_trait_force_tooltip = education_martial_4 + } + } + if = { + limit = { has_trait = education_martial_5 } + show_as_tooltip = { + add_trait_force_tooltip = education_martial_5 + } + } + if = { + limit = { has_trait = education_stewardship_1 } + show_as_tooltip = { + add_trait_force_tooltip = education_stewardship_1 + } + } + if = { + limit = { has_trait = education_stewardship_2 } + show_as_tooltip = { + add_trait_force_tooltip = education_stewardship_2 + } + } + if = { + limit = { has_trait = education_stewardship_3 } + show_as_tooltip = { + add_trait_force_tooltip = education_stewardship_3 + } + } + if = { + limit = { has_trait = education_stewardship_4 } + show_as_tooltip = { + add_trait_force_tooltip = education_stewardship_4 + } + } + if = { + limit = { has_trait = education_stewardship_5 } + show_as_tooltip = { + add_trait_force_tooltip = education_stewardship_5 + } + } + if = { + limit = { has_trait = education_intrigue_1 } + show_as_tooltip = { + add_trait_force_tooltip = education_intrigue_1 + } + } + if = { + limit = { has_trait = education_intrigue_2 } + show_as_tooltip = { + add_trait_force_tooltip = education_intrigue_2 + } + } + if = { + limit = { has_trait = education_intrigue_3 } + show_as_tooltip = { + add_trait_force_tooltip = education_intrigue_3 + } + } + if = { + limit = { has_trait = education_intrigue_4 } + show_as_tooltip = { + add_trait_force_tooltip = education_intrigue_4 + } + } + if = { + limit = { has_trait = education_intrigue_5 } + show_as_tooltip = { + add_trait_force_tooltip = education_intrigue_5 + } + } + if = { + limit = { has_trait = education_learning_1 } + show_as_tooltip = { + add_trait_force_tooltip = education_learning_1 + } + } + if = { + limit = { has_trait = education_learning_2 } + show_as_tooltip = { + add_trait_force_tooltip = education_learning_2 + } + } + if = { + limit = { has_trait = education_learning_3 } + show_as_tooltip = { + add_trait_force_tooltip = education_learning_3 + } + } + if = { + limit = { has_trait = education_learning_4 } + show_as_tooltip = { + add_trait_force_tooltip = education_learning_4 + } + } + if = { + limit = { has_trait = education_learning_5 } + show_as_tooltip = { + add_trait_force_tooltip = education_learning_5 + } + } + if = { # Knighthood innovation + limit = { has_trait = education_martial_prowess_1 } + show_as_tooltip = { + add_trait_force_tooltip = education_martial_prowess_1 + } + } + if = { + limit = { has_trait = education_martial_prowess_2 } + show_as_tooltip = { + add_trait_force_tooltip = education_martial_prowess_2 + } + } + if = { + limit = { has_trait = education_martial_prowess_3 } + show_as_tooltip = { + add_trait_force_tooltip = education_martial_prowess_3 + } + } + if = { + limit = { has_trait = education_martial_prowess_4 } + show_as_tooltip = { + add_trait_force_tooltip = education_martial_prowess_4 + } + } + if = { # Esotericism Tenet + limit = { has_trait = lifestyle_mystic } + show_as_tooltip = { + add_trait_force_tooltip = lifestyle_mystic + } + } + if = { + limit = { + has_trait = logistician + } + show_as_tooltip = { + add_trait_force_tooltip = logistician + } + } + if = { + limit = { + has_trait = military_engineer + } + show_as_tooltip = { + add_trait_force_tooltip = military_engineer + } + } + if = { + limit = { + has_trait = aggressive_attacker + } + show_as_tooltip = { + add_trait_force_tooltip = aggressive_attacker + } + } + if = { + limit = { + has_trait = unyielding_defender + } + show_as_tooltip = { + add_trait_force_tooltip = unyielding_defender + } + } + if = { + limit = { + has_trait = forder + } + show_as_tooltip = { + add_trait_force_tooltip = forder + } + } + if = { + limit = { + has_trait = flexible_leader + } + show_as_tooltip = { + add_trait_force_tooltip = flexible_leader + } + } + if = { + limit = { + has_trait = desert_warrior + } + show_as_tooltip = { + add_trait_force_tooltip = desert_warrior + } + } + if = { + limit = { + has_trait = jungle_stalker + } + show_as_tooltip = { + add_trait_force_tooltip = jungle_stalker + } + } + if = { + limit = { + has_trait = winter_soldier + } + show_as_tooltip = { + add_trait_force_tooltip = winter_soldier + } + } + if = { + limit = { + has_trait = reaver + } + show_as_tooltip = { + add_trait_force_tooltip = reaver + } + } + if = { + limit = { + has_trait = reckless + } + show_as_tooltip = { + add_trait_force_tooltip = reckless + } + } + if = { + limit = { + has_trait = holy_warrior + } + show_as_tooltip = { + add_trait_force_tooltip = holy_warrior + } + } + if = { + limit = { + has_trait = rough_terrain_expert + } + show_as_tooltip = { + add_trait_force_tooltip = rough_terrain_expert + } + } + if = { + limit = { has_trait = organizer } + show_as_tooltip = { add_trait_force_tooltip = organizer } + } + if = { + limit = { has_trait = forest_fighter } + show_as_tooltip = { add_trait_force_tooltip = forest_fighter } + } + if = { + limit = { has_trait = cautious_leader } + show_as_tooltip = { add_trait_force_tooltip = cautious_leader } + } + if = { + limit = { has_trait = open_terrain_expert } + show_as_tooltip = { add_trait_force_tooltip = open_terrain_expert } + } + if = { + limit = { has_trait = education_republican_knowledge_1 } + show_as_tooltip = { add_trait_force_tooltip = education_republican_knowledge_1 } + } + if = { + limit = { has_trait = education_republican_knowledge_2 } + show_as_tooltip = { add_trait_force_tooltip = education_republican_knowledge_2 } + } + if = { + limit = { has_trait = education_republican_knowledge_3 } + show_as_tooltip = { add_trait_force_tooltip = education_republican_knowledge_3 } + } + if = { + limit = { has_trait = education_republican_knowledge_4 } + show_as_tooltip = { add_trait_force_tooltip = education_republican_knowledge_4 } + } +} + + +#To run every time a guardian/ward relationship is set +guardian_add_opinion_effect = { + $GUARDIAN$ = { + if = { + limit = { + NOT = { this = $WARD_LIEGE$ } + $WARD_LIEGE$ = { is_alive = yes } + is_ai = yes + } + + #For educator + if = { + limit = { + $WARD_LIEGE$ = { player_heir = $WARD$ } + liege ?= $WARD_LIEGE$ + is_ruler = yes + has_vassal_stance = parochial + } + add_opinion = { + target = $WARD_LIEGE$ + modifier = guardian_of_heir_parochial_opinion + } + } + else_if = { + limit = { $WARD_LIEGE$ = { player_heir = $WARD$ } } + add_opinion = { + target = $WARD_LIEGE$ + modifier = guardian_of_heir_opinion + } + } + else_if = { + limit = { + $WARD_LIEGE$ = { is_close_family_of = $WARD$ } + liege ?= $WARD_LIEGE$ + is_ruler = yes + has_vassal_stance = parochial + } + add_opinion = { + target = $WARD_LIEGE$ + modifier = guardian_of_relative_parochial_opinion + } + } + else_if = { + limit = { $WARD_LIEGE$ = { is_close_family_of = $WARD$ } } + add_opinion = { + target = $WARD_LIEGE$ + modifier = guardian_of_relative_opinion + } + } + + #For educator liege, if educator is courtier + if = { + limit = { + liege ?= { + is_ai = yes + is_alive = yes + } + is_ruler = no + NOT = { liege = $WARD_LIEGE$ } + } + liege = { + if = { + limit = { + $WARD_LIEGE$ = { player_heir = $WARD$ } + liege ?= $WARD_LIEGE$ + is_ruler = yes + has_vassal_stance = parochial + } + add_opinion = { + target = $WARD_LIEGE$ + modifier = guardian_of_heir_parochial_opinion + } + } + else_if = { + limit = { $WARD_LIEGE$ = { player_heir = $WARD$ } } + add_opinion = { + target = $WARD_LIEGE$ + modifier = guardian_of_heir_opinion + } + } + else_if = { + limit = { + $WARD_LIEGE$ = { is_close_family_of = $WARD$ } + liege ?= $WARD_LIEGE$ + is_ruler = yes + has_vassal_stance = parochial + } + add_opinion = { + target = $WARD_LIEGE$ + modifier = guardian_of_relative_parochial_opinion + } + } + else_if = { + limit = { $WARD_LIEGE$ = { is_close_family_of = $WARD$ } } + add_opinion = { + target = $WARD_LIEGE$ + modifier = guardian_of_relative_opinion + } + } + save_scope_as = guardian_liege + $WARD$ = { + set_variable = { + name = guardian_liege + value = scope:guardian_liege + } + } + } + } + } + } +} + +#To run every time a guardian/ward relationship is ended (should be in all decisions/event options etc. where the relation is removed, but is also run through the on_remove_relation_guardian on_action just in case) +guardian_remove_opinion_effect = { + if = { + limit = { + exists = $GUARDIAN$ + exists = $WARD$ + exists = $WARD_LIEGE$ + } + $GUARDIAN$ = { + if = { + limit = { + has_opinion_modifier = { + modifier = guardian_of_heir_opinion + target = $WARD_LIEGE$ + } + } + remove_opinion = { + modifier = guardian_of_heir_opinion + target = $WARD_LIEGE$ + } + } + else_if = { + limit = { + has_opinion_modifier = { + modifier = guardian_of_relative_opinion + target = $WARD_LIEGE$ + } + NOT = { # They're not still guardian of a relative + any_relation = { + type = ward + is_close_family_of = $WARD_LIEGE$ + } + } + } + remove_opinion = { + modifier = guardian_of_relative_opinion + target = $WARD_LIEGE$ + } + } + if = { + limit = { + has_opinion_modifier = { + modifier = guardian_of_heir_parochial_opinion + target = $WARD_LIEGE$ + } + } + remove_opinion = { + modifier = guardian_of_heir_parochial_opinion + target = $WARD_LIEGE$ + } + } + else_if = { + limit = { + has_opinion_modifier = { + modifier = guardian_of_relative_parochial_opinion + target = $WARD_LIEGE$ + } + NOT = { # They're not still guardian of a relative + any_relation = { + type = ward + is_close_family_of = $WARD_LIEGE$ + } + } + } + remove_opinion = { + modifier = guardian_of_relative_parochial_opinion + target = $WARD_LIEGE$ + } + } + } + $WARD$ = { + if = { + limit = { + exists = var:guardian_liege + var:guardian_liege = { is_alive = yes } + } + var:guardian_liege = { + if = { + limit = { + has_opinion_modifier = { + modifier = guardian_of_heir_opinion + target = $WARD_LIEGE$ + } + } + remove_opinion = { + modifier = guardian_of_heir_opinion + target = $WARD_LIEGE$ + } + } + else_if = { + limit = { + has_opinion_modifier = { + modifier = guardian_of_relative_opinion + target = $WARD_LIEGE$ + } + NOT = { # They're not still guardian of a relative + any_relation = { + type = ward + is_close_family_of = $WARD_LIEGE$ + } + } + } + remove_opinion = { + modifier = guardian_of_relative_opinion + target = $WARD_LIEGE$ + } + } + if = { + limit = { + has_opinion_modifier = { + modifier = guardian_of_heir_parochial_opinion + target = $WARD_LIEGE$ + } + } + remove_opinion = { + modifier = guardian_of_heir_parochial_opinion + target = $WARD_LIEGE$ + } + } + else_if = { + limit = { + has_opinion_modifier = { + modifier = guardian_of_relative_parochial_opinion + target = $WARD_LIEGE$ + } + NOT = { # They're not still guardian of a relative + any_relation = { + type = ward + is_close_family_of = $WARD_LIEGE$ + } + } + } + remove_opinion = { + modifier = guardian_of_relative_parochial_opinion + target = $WARD_LIEGE$ + } + } + } + remove_variable = guardian_liege + } + } + #if = { + # limit = { + # exists = liege + # liege = $WARD_LIEGE$ + # has_vassal_stance = parochial + # } + # add_opinion = { + # target = $WARD_LIEGE$ + # modifier = insult_opinion + # opinion = -30 + # } + #} + } +} + +#Additional effects run to wrap up education +wrap_up_education_effect = { + #no educator memory creation + if = { + limit = { + NOT = { exists = scope:educator } + exists = root.court_owner.capital_province + } + create_character_memory = { + type = childhood_education_no_guardian + } + scope:new_memory = { + save_scope_as = education_memory + set_variable = { + name = education_realm + value = root.court_owner.primary_title + } + if = { + limit = { + root.court_owner = { is_landed = no } + } + set_variable = { + name = education_landless + value = yes + } + } + set_variable = { + name = education_location + value = root.court_owner.capital_province + } + set_variable = { + name = education_location_culture + value = root.court_owner.capital_province.culture + } + set_variable = { + name = education_host_faith + value = root.court_owner.faith + } + set_variable = { + name = education_host_culture + value = root.court_owner.culture + } + } + } + #has educator memory creation + else_if = { + limit = { + exists = root.court_owner.capital_province + } + create_character_memory = { + type = childhood_education_guardian + participants = { + guardian = scope:educator + } + } + scope:new_memory = { + save_scope_as = education_memory + set_variable = { + name = education_realm + value = root.court_owner.primary_title + } + set_variable = { + name = education_location + value = root.court_owner.capital_province + } + set_variable = { + name = education_location_culture + value = root.court_owner.capital_province.culture + } + set_variable = { + name = education_host_faith + value = root.court_owner.faith + } + set_variable = { + name = education_host_culture + value = root.court_owner.culture + } + } + } + + if = { + limit = { exists = scope:educator } + scope:educator = { + create_character_memory = { + type = ward_education_completed + participants = { + ward = root + } + } + } + remove_guardian_effect = { + GUARDIAN = scope:educator + WARD = root + RETURN_WARD = yes + HIDE_OPINION = no + } + if = { + limit = { + exists = root.house + exists = scope:educator.house + } + root.house = { + change_house_relation_effect = { + HOUSE = scope:educator.house + VALUE = house_relation_improve_minor_value + REASON = educated + CHAR = root + TARGET_CHAR = scope:educator + TITLE = scope:dummy_gender + } + } + } + } + else = { return_ward_travel_effect = yes } +} + +return_guardian_travel_effect = { + if = { + limit = { + is_foreign_court_guest = yes + NOR = { + host = liege + is_playable_character = yes + any_relation = { #They're not at another ward's court + type = ward + is_playable_character = yes + this = $GUARDIAN$.host + } + } + } + show_as_tooltip = { return_to_court = yes } + location ?= { save_scope_as = starting_location } + set_variable = { + name = ward_educated + value = $WARD$ + years = 3 + } + set_variable = { + name = ward_educated_realm + value = host.primary_title + years = 3 + } + # Actually return guardian last + hidden_effect = { + set_location = scope:starting_location + start_travel_plan = { + destination = liege.capital_province + on_start_on_action = on_guardian_depart_for_home + on_travel_planner_cancel_on_action = on_guardian_depart_travel_planner_exit + on_arrival_on_action = on_guardian_arrive_at_home + on_arrival_destinations = last + return_trip = no # One way + } + } + } +} + +return_ward_travel_effect = { + if = { + limit = { + is_foreign_court_guest = yes + exists = liege + host != liege + } + show_as_tooltip = { return_to_court = yes } + location ?= { save_scope_as = starting_location } + if = { + limit = { exists = scope:educator } + set_variable = { + name = guardian_educated + value = scope:educator + years = 3 + } + set_variable = { + name = guardian_educated_realm + value = host.primary_title + years = 3 + } + } + # Actually return guardian last + hidden_effect = { + set_location = scope:starting_location + start_travel_plan = { + destination = liege.capital_province + on_start_on_action = on_ward_depart_for_home + on_travel_planner_cancel_on_action = on_ward_depart_travel_planner_exit + on_arrival_on_action = on_ward_arrive_at_home + on_arrival_destinations = last + return_trip = no # One way + } + } + } +} + +rank_up_education_effect = { + if = { + limit = { has_education_rank_4_trigger = no } + if = { + limit = { has_trait = education_diplomacy } + change_trait_rank = { + trait = education_diplomacy + rank = 1 + } + } + else_if = { + limit = { has_trait = education_martial } + change_trait_rank = { + trait = education_martial + rank = 1 + } + } + else_if = { + limit = { has_trait = education_stewardship } + change_trait_rank = { + trait = education_stewardship + rank = 1 + } + } + else_if = { + limit = { has_trait = education_intrigue } + change_trait_rank = { + trait = education_intrigue + rank = 1 + } + } + else_if = { + limit = { has_trait = education_learning } + change_trait_rank = { + trait = education_learning + rank = 1 + } + } + } +} + +results_of_university_education_points_effect = { + if = { + limit = { + has_character_flag = studying_at_university + } + #Adding the points to the current education + if = { + limit = { has_focus = education_diplomacy } + random_list = { + 60 = { + change_variable = { + name = education_diplomacy_variable + add = 2 + } + } + 40 = { + change_variable = { + name = education_diplomacy_variable + add = 3 + } + } + } + } + else_if = { + limit = { has_focus = education_martial } + random_list = { + 60 = { + change_variable = { + name = education_martial_variable + add = 2 + } + } + 40 = { + change_variable = { + name = education_martial_variable + add = 3 + } + } + } + } + else_if = { + limit = { has_focus = education_stewardship } + random_list = { + 60 = { + change_variable = { + name = education_stewardship_variable + add = 2 + } + } + 40 = { + change_variable = { + name = education_stewardship_variable + add = 3 + } + } + } + } + else_if = { + limit = { has_focus = education_intrigue } + random_list = { + 60 = { + change_variable = { + name = education_intrigue_variable + add = 2 + } + } + 40 = { + change_variable = { + name = education_intrigue_variable + add = 3 + } + } + } + } + else_if = { + limit = { has_focus = education_learning } + random_list = { + 60 = { + change_variable = { + name = education_learning_variable + add = 2 + } + } + 40 = { + change_variable = { + name = education_learning_variable + add = 3 + } + } + } + } + remove_character_flag = studying_at_university + add_character_flag = studied_at_university + + if = { + limit = { + NOT = { + has_trait = drunkard + } + } + hidden_effect = { + random = { + chance = 2 + add_trait = drunkard + } + } + } + if = { + limit = { + NOT = { has_character_flag = studying_confucian_education } + } + #Adding the points to the current education + if = { + limit = { has_trait = confucian_education } + add_trait_xp = { + trait = confucian_education + value = { + value = 20 + add = { + value = "scope:educator.has_trait_xp(confucian_education)" + multiply = 0.25 + } + if = { + limit = { + has_religion = religion:confucianism_religion + } + add = 20 + } + round = yes + } + } + } + else = { + add_trait = confucian_education + add_trait_xp = { + trait = confucian_education + value = { + value = 20 + add = { + value = "scope:educator.has_trait_xp(confucian_education)" + multiply = 0.1 + } + if = { + limit = { + has_religion = religion:confucianism_religion + } + add = 10 + } + round = yes + } + } + } + } + } +} +#Ward learned from a Confucian scholar +results_of_confucian_education_effect = { + if = { + limit = { + has_character_flag = studying_confucian_education + } + #Adding the points to the current education + if = { + limit = { has_trait = confucian_education } + add_trait_xp = { + trait = confucian_education + value = { + value = 0 + if = { + limit = { + exists = scope:educator + } + add = { + value = "scope:educator.has_trait_xp(confucian_education)" + multiply = 0.25 + } + } + if = { + limit = { + has_religion = religion:confucianism_religion + } + add = 20 + } + if = { + limit = { + has_character_flag = studied_at_university + } + add = 20 + } + } + } + } + else = { + add_trait = confucian_education + add_trait_xp = { + trait = confucian_education + value = { + value = 0 + if = { + limit = { + exists = scope:educator + } + add = { + value = "scope:educator.has_trait_xp(confucian_education)" + multiply = 0.1 + } + } + if = { + limit = { + has_religion = religion:confucianism_religion + } + add = 10 + } + if = { + limit = { + has_character_flag = studied_at_university + } + add = 20 + } + round = yes + } + } + } + if = { + limit = { + exists = scope:educator + } + save_scope_as = educated_child + random = { + chance = 10 + set_elder_relation_effect = { + ELDER = scope:educator + DISCIPLE = scope:educated_child + MERIT = minor_merit_gain + } + } + } + remove_character_flag = studying_confucian_education + add_character_flag = studied_confucian_education + } +} + +dynasty_legacy_education_boost_effect = { + if = { + limit = { + has_dynasty = yes + dynasty = { has_dynasty_perk = kin_legacy_2 } + } + + if = { + limit = { has_focus = education_diplomacy } + random_list = { + 60 = { + change_variable = { + name = education_diplomacy_variable + add = 2 + } + } + 40 = { + change_variable = { + name = education_diplomacy_variable + add = 3 + } + } + } + } + else_if = { + limit = { has_focus = education_martial } + random_list = { + 60 = { + change_variable = { + name = education_martial_variable + add = 2 + } + } + 40 = { + change_variable = { + name = education_martial_variable + add = 3 + } + } + } + } + else_if = { + limit = { has_focus = education_stewardship } + random_list = { + 60 = { + change_variable = { + name = education_stewardship_variable + add = 2 + } + } + 40 = { + change_variable = { + name = education_stewardship_variable + add = 3 + } + } + } + } + else_if = { + limit = { has_focus = education_intrigue } + random_list = { + 60 = { + change_variable = { + name = education_intrigue_variable + add = 2 + } + } + 40 = { + change_variable = { + name = education_intrigue_variable + add = 3 + } + } + } + } + else_if = { + limit = { has_focus = education_learning } + random_list = { + 60 = { + change_variable = { + name = education_learning_variable + add = 2 + } + } + 40 = { + change_variable = { + name = education_learning_variable + add = 3 + } + } + } + } + } +} + +cultural_traditions_education_boost_effect = { + # FP3 Beacon of Learning + if = { + limit = { + any_relation = { + type = guardian + culture = { has_cultural_parameter = guardian_education_better_outcomes } + } + } + if = { + limit = { exists = var:education_diplomacy_variable } + change_variable = { + name = education_diplomacy_variable + add = { + value = var:education_diplomacy_variable + divide = 4 + round = yes + max = 3 # This effect shouldn't be better than a good court tutor + } + } + } + else_if = { + limit = { exists = var:education_martial_variable } + change_variable = { + name = education_martial_variable + add = { + value = var:education_martial_variable + divide = 4 + round = yes + max = 3 + } + } + } + else_if = { + limit = { exists = var:education_intrigue_variable } + change_variable = { + name = education_intrigue_variable + add = { + value = var:education_intrigue_variable + divide = 4 + round = yes + max = 3 + } + } + } + else_if = { + limit = { exists = var:education_stewardship_variable } + change_variable = { + name = education_stewardship_variable + add = { + value = var:education_stewardship_variable + divide = 4 + round = yes + max = 3 + } + } + } + else_if = { + limit = { exists = var:education_learning_variable } + change_variable = { + name = education_learning_variable + add = { + value = var:education_learning_variable + divide = 4 + round = yes + max = 3 + } + } + } + } + if = { + limit = { + culture = { + has_cultural_parameter = diplomacy_education_better_outcomes + } + has_focus = education_diplomacy + } + + random_list = { + 60 = { + change_variable = { + name = education_diplomacy_variable + add = 1 + } + } + 40 = { + change_variable = { + name = education_diplomacy_variable + add = 0 + } + } + } + } + if = { + limit = { + culture = { + has_cultural_parameter = martial_education_worse_outcomes + } + has_focus = education_martial + exists = var:education_martial_variable + var:education_martial_variable > 0 + } + + change_variable = { + name = education_martial_variable + add = -1 + } + } +} + +court_tutor_education_boost_effect = { + if = { + limit = { + court_owner ?= { + OR = { + AND = { + employs_court_position = court_tutor_court_position + any_court_position_holder = { + type = court_tutor_court_position + } + } + AND = { + employs_court_position = court_guru_court_position + any_court_position_holder = { + type = court_guru_court_position + } + } + } + } + } + # Let's save the court tutor or guru with the highest aptitude + # we can use the court tutor aptitude checks for Gurus because they are nearly identical for what matters in these calculations + court_owner = { + if = { + limit = { + employs_court_position = court_tutor_court_position + } + random_court_position_holder = { + type = court_tutor_court_position + limit = { + var:booner_target ?= root + } + alternative_limit = { aptitude:court_tutor_court_position >= 4 } + alternative_limit = { aptitude:court_tutor_court_position >= 3 } + alternative_limit = { aptitude:court_tutor_court_position >= 2 } + alternative_limit = { aptitude:court_tutor_court_position >= 1 } + alternative_limit = { always = yes } + save_scope_as = court_tutor + } + } + else = { + random_court_position_holder = { + type = court_guru_court_position + limit = { + var:booner_target ?= root + } + alternative_limit = { aptitude:court_guru_court_position >= 4 } + alternative_limit = { aptitude:court_guru_court_position >= 3 } + alternative_limit = { aptitude:court_guru_court_position >= 2 } + alternative_limit = { aptitude:court_guru_court_position >= 1 } + alternative_limit = { always = yes } + save_scope_as = court_tutor + } + } + } + + if = { + limit = { has_focus = education_diplomacy } + random_list = { + 10 = { # Small chance for a GREAT boost + trigger = { + OR = { + scope:court_tutor.aptitude:court_tutor_court_position = 4 + scope:court_tutor.var:booner_target ?= root + } + } + change_variable = { + name = education_diplomacy_variable + add = 4 + } + } + 40 = { + modifier = { + add = 20 + scope:court_tutor.aptitude:court_tutor_court_position = 4 + } + modifier = { + add = 10 + scope:court_tutor.aptitude:court_tutor_court_position = 3 + } + modifier = { + add = 10 + scope:court_tutor.var:booner_target ?= root + } + change_variable = { + name = education_diplomacy_variable + add = 3 + } + } + 50 = { + modifier = { + add = 10 + scope:court_tutor.aptitude:court_tutor_court_position = 2 + } + modifier = { + add = 20 + scope:court_tutor.aptitude:court_tutor_court_position = 1 + } + change_variable = { + name = education_diplomacy_variable + add = 2 + } + } + } + } + else_if = { + limit = { has_focus = education_martial } + random_list = { + 10 = { # Small chance for a GREAT boost + trigger = { + scope:court_tutor.aptitude:court_tutor_court_position = 4 + scope:court_tutor.var:booner_target ?= root + } + change_variable = { + name = education_martial_variable + add = 4 + } + } + 40 = { + modifier = { + add = 20 + scope:court_tutor.aptitude:court_tutor_court_position = 4 + } + modifier = { + add = 10 + scope:court_tutor.aptitude:court_tutor_court_position = 3 + } + modifier = { + add = 10 + scope:court_tutor.var:booner_target ?= root + } + change_variable = { + name = education_martial_variable + add = 3 + } + } + 50 = { + modifier = { + add = 10 + scope:court_tutor.aptitude:court_tutor_court_position = 2 + } + modifier = { + add = 20 + scope:court_tutor.aptitude:court_tutor_court_position = 1 + } + change_variable = { + name = education_martial_variable + add = 2 + } + } + } + } + else_if = { + limit = { has_focus = education_stewardship } + random_list = { + 10 = { # Small chance for a GREAT boost + trigger = { + scope:court_tutor.aptitude:court_tutor_court_position = 4 + scope:court_tutor.var:booner_target ?= root + scope:court_tutor = { has_trait = confucian_education } + } + change_variable = { + name = education_stewardship_variable + add = 4 + } + } + 40 = { + modifier = { + add = 20 + scope:court_tutor = { has_trait = confucian_education } + } + modifier = { + add = 20 + scope:court_tutor.aptitude:court_tutor_court_position = 4 + } + modifier = { + add = 10 + scope:court_tutor.aptitude:court_tutor_court_position = 3 + } + modifier = { + add = 10 + scope:court_tutor.var:booner_target ?= root + } + change_variable = { + name = education_stewardship_variable + add = 3 + } + } + 50 = { + trigger = { + NOT = { + scope:court_tutor = { has_trait = confucian_education } + } + } + modifier = { + add = 10 + scope:court_tutor.aptitude:court_tutor_court_position = 2 + } + modifier = { + add = 20 + scope:court_tutor.aptitude:court_tutor_court_position = 1 + } + change_variable = { + name = education_stewardship_variable + add = 2 + } + } + } + } + else_if = { + limit = { has_focus = education_intrigue } + random_list = { + 10 = { # Small chance for a GREAT boost + trigger = { + scope:court_tutor.aptitude:court_tutor_court_position = 4 + scope:court_tutor.var:booner_target ?= root + } + change_variable = { + name = education_intrigue_variable + add = 4 + } + } + 40 = { + modifier = { + add = 20 + scope:court_tutor.aptitude:court_tutor_court_position = 4 + } + modifier = { + add = 10 + scope:court_tutor.aptitude:court_tutor_court_position = 3 + } + modifier = { + add = 10 + scope:court_tutor.var:booner_target ?= root + } + change_variable = { + name = education_intrigue_variable + add = 3 + } + } + 50 = { + modifier = { + add = 10 + scope:court_tutor.aptitude:court_tutor_court_position = 2 + } + modifier = { + add = 20 + scope:court_tutor.aptitude:court_tutor_court_position = 1 + } + change_variable = { + name = education_intrigue_variable + add = 2 + } + } + } + } + else_if = { + limit = { has_focus = education_learning } + random_list = { + 10 = { # Small chance for a GREAT boost + trigger = { + scope:court_tutor.aptitude:court_tutor_court_position = 4 + scope:court_tutor.var:booner_target ?= root + scope:court_tutor = { has_trait = confucian_education } + } + change_variable = { + name = education_learning_variable + add = 4 + } + } + 40 = { + modifier = { + add = 20 + scope:court_tutor = { has_trait = confucian_education } + } + modifier = { + add = 20 + scope:court_tutor.aptitude:court_tutor_court_position = 4 + } + modifier = { + add = 10 + scope:court_tutor.aptitude:court_tutor_court_position = 3 + } + modifier = { + add = 10 + scope:court_tutor.var:booner_target ?= root + } + change_variable = { + name = education_learning_variable + add = 3 + } + } + 50 = { + trigger = { + NOT = { + scope:court_tutor = { has_trait = confucian_education } + } + } + modifier = { + add = 10 + scope:court_tutor.aptitude:court_tutor_court_position = 2 + } + modifier = { + add = 20 + scope:court_tutor.aptitude:court_tutor_court_position = 1 + } + change_variable = { + name = education_learning_variable + add = 2 + } + } + } + } + } +} + +huntperson_camp_officer_education_boost_effect = { + if = { + limit = { + court_owner ?= { + employs_court_position = huntperson_camp_officer + any_court_position_holder = { + type = huntperson_camp_officer + } + } + } + #Let's save the huntperson with the highest aptitude + court_owner = { + random_court_position_holder = { + type = huntperson_camp_officer + limit = { aptitude:huntperson_camp_officer >= 5 } + alternative_limit = { aptitude:huntperson_camp_officer >= 4 } + alternative_limit = { aptitude:huntperson_camp_officer >= 3 } + alternative_limit = { aptitude:huntperson_camp_officer >= 2 } + alternative_limit = { always = yes } + save_scope_as = huntperson + } + } + if = { + limit = { has_focus = education_martial } + random_list = { + 10 = { # Small chance for a GREAT boost + trigger = { + scope:huntperson.aptitude:huntperson_camp_officer = 5 + } + change_variable = { + name = education_martial_variable + add = 4 + } + } + 40 = { + modifier = { + add = 20 + scope:huntperson.aptitude:huntperson_camp_officer = 5 + } + modifier = { + add = 10 + scope:huntperson.aptitude:huntperson_camp_officer = 4 + } + change_variable = { + name = education_martial_variable + add = 3 + } + } + 50 = { + modifier = { + add = 10 + scope:huntperson.aptitude:huntperson_camp_officer = 2 + } + modifier = { + add = 20 + scope:huntperson.aptitude:huntperson_camp_officer = 1 + } + change_variable = { + name = education_martial_variable + add = 2 + } + } + } + } + } +} + +post_education_bonuses_effect = { + if = { + limit = { + exists = scope:educator + character_has_commander_trait_scope_does_not = scope:educator + scope:educator = { + culture = { + has_cultural_parameter = guardians_can_transfer_commander_traits + } + } + } + culture_randomize_commander_trait_effect = yes + } +} + +culture_randomize_commander_trait_effect = { + random_list = { + 100 = { + trigger = { + NOT = { has_trait = rough_terrain_expert } + scope:educator = { + has_trait = rough_terrain_expert + } + } + add_trait = rough_terrain_expert + } + 100 = { + trigger = { + NOT = { has_trait = logistician } + scope:educator = { + has_trait = logistician + } + } + add_trait = logistician + } + 100 = { + trigger = { + NOT = { has_trait = military_engineer } + scope:educator = { + has_trait = military_engineer + } + } + add_trait = military_engineer + } + 100 = { + trigger = { + NOT = { has_trait = aggressive_attacker } + scope:educator = { + has_trait = aggressive_attacker + } + } + add_trait = aggressive_attacker + } + 100 = { + trigger = { + NOT = { has_trait = unyielding_defender } + scope:educator = { + has_trait = unyielding_defender + } + } + add_trait = unyielding_defender + } + 100 = { + trigger = { + NOT = { has_trait = forder } + scope:educator = { + has_trait = forder + } + } + add_trait = forder + } + 100 = { + trigger = { + NOT = { has_trait = flexible_leader } + scope:educator = { + has_trait = flexible_leader + } + } + add_trait = flexible_leader + } + 100 = { + trigger = { + NOT = { has_trait = desert_warrior } + scope:educator = { + has_trait = desert_warrior + } + } + add_trait = desert_warrior + } + 100 = { + trigger = { + NOT = { has_trait = jungle_stalker } + scope:educator = { + has_trait = jungle_stalker + } + } + add_trait = jungle_stalker + } + 100 = { + trigger = { + NOT = { has_trait = winter_soldier } + scope:educator = { + has_trait = winter_soldier + } + } + add_trait = winter_soldier + } + 100 = { + trigger = { + NOT = { has_trait = reaver } + scope:educator = { + has_trait = reaver + } + } + add_trait = reaver + } + 100 = { + trigger = { + NOT = { has_trait = reckless } + scope:educator = { + has_trait = reckless + } + } + add_trait = reckless + } + 100 = { + trigger = { + NOT = { has_trait = holy_warrior } + scope:educator = { + has_trait = holy_warrior + } + } + add_trait = holy_warrior + } + 100 = { + trigger = { + NOT = { has_trait = organizer } + scope:educator = { + has_trait = organizer + } + } + add_trait = organizer + } + 100 = { + trigger = { + NOT = { has_trait = forest_fighter } + scope:educator = { + has_trait = forest_fighter + } + } + add_trait = forest_fighter + } + 100 = { + trigger = { + NOT = { has_trait = cautious_leader } + scope:educator = { + has_trait = cautious_leader + } + } + add_trait = cautious_leader + } + 100 = { + trigger = { + NOT = { has_trait = open_terrain_expert } + scope:educator = { + has_trait = open_terrain_expert + } + } + add_trait = open_terrain_expert + } + } +} + + +dynasty_perk_secondary_education_trait_effect = { + if = { + limit = { + OR = { + dynasty ?= { has_dynasty_perk = fp2_urbanism_legacy_2 } + AND = { + exists = scope:educator + scope:educator = { + dynasty ?= { has_dynasty_perk = fp2_urbanism_legacy_2 } + } + } + } + } + + # Assign a trait, chance based on the development of the location + set_variable = { + name = chance_for_extra_trait + value = location.county.development_level + } + + random_list = { + # Success + 0 = { + modifier = { + exists = var:chance_for_extra_trait + add = var:chance_for_extra_trait + } + + # Select trait now + random_list = { + # Level 1: from 50% to 0% + 50 = { + modifier = { + add = { + value = var:chance_for_extra_trait + multiply = -0.5 + } + } + add_trait = education_republican_knowledge_1 + } + + # Level 2: from 35% to 50% + 35 = { + modifier = { + add = { + value = var:chance_for_extra_trait + multiply = 0.05 + } + } + add_trait = education_republican_knowledge_2 + } + + # Level 3: from 15% to 30% + 15 = { + modifier = { + add = { + value = var:chance_for_extra_trait + multiply = 0.5 + } + } + add_trait = education_republican_knowledge_3 + } + + # Level 4: from 0 to 20% chance + 0 = { + modifier = { + add = { + value = var:chance_for_extra_trait + multiply = 0.5 + } + } + add_trait = education_republican_knowledge_4 + } + } + } + + # Failing - There will be a: + # 84% chance at development 5 + # 66% chance at development 10 + # 50% chance at development 15 + # 0% chance once development level 30 is reached + 30 = { + modifier = { + exists = var:chance_for_extra_trait + add = { + value = var:chance_for_extra_trait + multiply = -1 + } + } + #nothing happens + } + } + # remove the variable now that it has been used + remove_variable = chance_for_extra_trait + } +} + +ward_depart_effect = { + scope:guardian = { add_to_list = toast_list } + scope:ward = { add_to_list = toast_list } + scope:guardian_liege = { add_to_list = toast_list } + scope:ward_liege = { add_to_list = toast_list } + # Set variables + scope:ward = { + set_variable = { + name = character_making_education_request + value = scope:actor + years = 10 + } + # Remove existing guardian if relevant + if = { + limit = { + exists = scope:offer_guardianship_interaction + any_relation = { type = guardian } + } + random_relation = { + type = guardian + save_scope_as = guardian_to_remove + } + remove_guardian_effect = { + GUARDIAN = scope:guardian_to_remove + WARD = scope:ward + RETURN_WARD = no + HIDE_OPINION = no + } + } + remove_character_flag = under_offer_as_ward_flag + } + if = { # No travel necessary + limit = { + OR = { + scope:ward = scope:guardian.host + scope:guardian = scope:ward.host + scope:ward.host = scope:guardian.host + #allow landed ruler to landed ruler education + AND = { + scope:ward = { + is_landed_or_landless_administrative = yes + } + scope:guardian = { + is_landed_or_landless_administrative = yes + } + } + } + } + hidden_effect = { #to prevent doubling of "becomes guardian of x" effect in the interaction confirmation window + if = { + limit = { + NOT = { + scope:guardian = { has_relation_ward = scope:ward } + } + } + scope:guardian = { set_relation_ward = scope:ward } + } + } + #Opinions + guardian_add_opinion_effect = { + GUARDIAN = scope:guardian + WARD_LIEGE = scope:ward_liege + WARD = scope:ward + } + # Convert culture setup + scope:ward = { + if = { + limit = { has_character_flag = convert_culture } + scope:guardian = { + add_relation_flag = { + relation = ward + target = scope:ward + flag = convert_culture + } + } + remove_character_flag = convert_culture + } + # Convert faith setup + if = { + limit = { has_character_flag = convert_faith } + scope:guardian = { + add_relation_flag = { + relation = ward + target = scope:ward + flag = convert_faith + } + } + remove_character_flag = convert_faith + } + } + } + else = { + if = { # Guardian heads to landed Ward + limit = { + scope:ward = { is_playable_character = yes } + } + scope:guardian = { + set_variable = { + name = guardian_travelling_to_ward + years = 2 + value = scope:ward + } + start_travel_plan = { + destination = scope:ward.capital_province + on_start_on_action = on_guardian_depart_for_ward + on_travel_planner_cancel_on_action = on_guardian_depart_travel_planner_exit + on_arrival_on_action = on_guardian_arrive_at_ward + on_arrival_destinations = last + return_trip = no # One way + } + } + hidden_effect = { + every_in_list = { + list = toast_list + send_interface_toast = { + title = guardian_departs_title + left_icon = scope:guardian + right_icon = scope:ward + custom_tooltip = guardian_departs_tt + } + } + } + custom_tooltip = guardian_leaves_for_ward_tt + scope:ward = { + set_variable = { + name = ward_waiting_for_guardian + years = 2 + value = scope:guardian + } + } + } + else = { + scope:ward = { + if = { + limit = { # Ward heads to landed Guardian + is_playable_character = no + scope:guardian = { is_playable_character = yes } + scope:guardian != host + } + scope:guardian.capital_province = { save_scope_as = destination_province } + } + else_if = { # Ward heads to Guardian's host + limit = { exists = scope:guardian.host.capital_province } + scope:guardian.host.capital_province = { save_scope_as = destination_province } + } + else = { + scope:guardian.location = { save_scope_as = destination_province } + } + set_variable = { + name = ward_travelling_to_guardian + years = 2 + value = scope:guardian + } + start_travel_plan = { + destination = scope:destination_province + on_start_on_action = on_ward_depart_for_guardian + on_travel_planner_cancel_on_action = on_ward_depart_travel_planner_exit + on_arrival_on_action = on_ward_arrive_at_guardian + on_arrival_destinations = last + return_trip = no # One way + } + } + hidden_effect = { + every_in_list = { + list = toast_list + send_interface_toast = { + title = ward_departs_title + left_icon = scope:ward + right_icon = scope:guardian + custom_tooltip = ward_departs_tt + } + } + } + custom_tooltip = ward_leaves_for_guardian_tt + scope:guardian = { + set_variable = { + name = guardian_waiting_for_ward + years = 2 + value = scope:ward + } + } + } + } +} + +remove_guardian_effect = { + $GUARDIAN$ = { + remove_relation_ward = $WARD$ + return_guardian_travel_effect = { + GUARDIAN = $GUARDIAN$ + WARD = $WARD$ + } + } + if = { + limit = { always = $RETURN_WARD$ } + $WARD$ = { return_ward_travel_effect = yes } + } + if = { + limit = { always = $HIDE_OPINION$ } + hidden_effect = { + guardian_remove_opinion_effect = { + GUARDIAN = $GUARDIAN$ + WARD = $WARD$ + WARD_LIEGE = $WARD$.liege + } + } + } + else = { + guardian_remove_opinion_effect = { + GUARDIAN = $GUARDIAN$ + WARD = $WARD$ + WARD_LIEGE = $WARD$.liege + } + } +} + +knight_teacher_effect = { + if = { + limit = { + scope:educator = { has_character_modifier = knight_teacher_modifier } + } + change_variable = { + name = education_martial_variable + add = { integer_range = { min = 1 max = 3 } } + } + } +} diff --git a/N3OW/common/scripted_effects/00_ep1_artifact_creation_effects.txt b/N3OW/common/scripted_effects/00_ep1_artifact_creation_effects.txt new file mode 100644 index 00000000..0e85cbcf --- /dev/null +++ b/N3OW/common/scripted_effects/00_ep1_artifact_creation_effects.txt @@ -0,0 +1,15698 @@ + +################################################# +# # +# ASSORTED BASIC EFFECTS # +# # +################################################# + +get_artifact_quality_effect = { + if = { + limit = { + NOT = { exists = scope:quality } + } + # Some random variance is added so artifact quality isn't completely deterministic + if = { + limit = { + NOR = { + exists = scope:inspiration_owner + exists = scope:random_quality_bonus + } + } + random_list = { + 20 = { + save_scope_value_as = { + name = random_quality_bonus + value = 4 + } + } + 20 = { + save_scope_value_as = { + name = random_quality_bonus + value = 8 + } + } + 20 = { + save_scope_value_as = { + name = random_quality_bonus + value = 12 + } + } + 20 = { + save_scope_value_as = { + name = random_quality_bonus + value = 16 + } + } + 20 = { + save_scope_value_as = { + name = random_quality_bonus + value = 20 + } + } + } + } + else_if = { + limit = { + NOT = { exists = scope:random_inspired_skill_quality_bonus } + } + random_list = { + 20 = { + save_scope_value_as = { + name = random_inspired_skill_quality_bonus + value = 0.5 + } + } + 20 = { + save_scope_value_as = { + name = random_inspired_skill_quality_bonus + value = 1 + } + } + 20 = { + save_scope_value_as = { + name = random_inspired_skill_quality_bonus + value = 2 + } + } + 20 = { + save_scope_value_as = { + name = random_inspired_skill_quality_bonus + value = 2.5 + } + } + 20 = { + save_scope_value_as = { + name = random_inspired_skill_quality_bonus + value = 3 + } + } + } + save_scope_value_as = { + name = random_quality_bonus + value = 0 + } + } + + # Calculate the final quality of the artifact + save_scope_value_as = { + name = quality + value = { + value = scope:random_quality_bonus + + # Cultural tradition for piety level boosting artifacts + if = { + limit = { + court_owner.culture ?= { + has_cultural_parameter = piety_level_affect_artifact_quality + } + } + add = { + value = court_owner.piety_level + multiply = 5 + } + } + + # Bonus Quality from the Court Owner's Amenities + if = { + limit = { + court_owner ?= { + has_royal_court = yes + has_dlc_feature = royal_court + amenity_level = { target = court_lodging_standards value > low_amenity_level } + } + } + if = { + limit = { court_owner = { amenity_level = { target = court_lodging_standards value >= max_amenity_level } } } + add = 10 + } + else_if = { + limit = { court_owner = { amenity_level = { target = court_lodging_standards value >= very_high_amenity_level } } } + add = 8 + } + else_if = { + limit = { court_owner = { amenity_level = { target = court_lodging_standards value >= high_amenity_level } } } + add = 6 + } + else_if = { + limit = { court_owner = { amenity_level = { target = court_lodging_standards value >= medium_amenity_level } } } + add = 4 + } + else = { + add = 2 + } + } + + # Bonus quality from Inspiration Owner + if = { + limit = { exists = scope:inspiration_owner } + scope:inspiration_owner = { + # Bonus quality from high skills, depending on inspiration type. + add = { + if = { + limit = { ep1_character_had_or_has_inspiration_type_trigger = { TYPE = armor } } + value = armor_inspiration_average_skill_value + } + else_if = { + limit = { ep1_character_had_or_has_inspiration_type_trigger = { TYPE = weapon } } + value = weapon_inspiration_average_skill_value + } + else_if = { + limit = { ep1_character_had_or_has_inspiration_type_trigger = { TYPE = adventure } } + value = adventure_inspiration_average_skill_value + } + else_if = { + limit = { ep1_character_had_or_has_inspiration_type_trigger = { TYPE = smith } } + value = smith_inspiration_average_skill_value + } + else_if = { + limit = { ep1_character_had_or_has_inspiration_type_trigger = { TYPE = book } } + value = book_inspiration_average_skill_value + } + else_if = { + limit = { ep1_character_had_or_has_inspiration_type_trigger = { TYPE = weaver } } + value = weaver_inspiration_average_skill_value + } + else_if = { + limit = { ep1_character_had_or_has_inspiration_type_trigger = { TYPE = artisan } } + value = artisan_inspiration_average_skill_value + } + else_if = { + limit = { ep1_character_had_or_has_inspiration_type_trigger = { TYPE = alchemy } } + value = alchemy_inspiration_average_skill_value + } + multiply = { + value = quality_bonus_per_skill_level_value + add = scope:random_inspired_skill_quality_bonus # Replaces the random_quality_bonus when an artifact is created by a character so that skill matters more + } + } + # Adventurer Bonuses + if = { + limit = { + OR = { + ep1_character_had_or_has_inspiration_type_trigger = { TYPE = weapon } + ep1_character_had_or_has_inspiration_type_trigger = { TYPE = smith } + ep1_character_had_or_has_inspiration_type_trigger = { TYPE = armor } + } + court_owner ?= { + has_government = landless_adventurer_government + has_perk = divided_attention_perk + } + } + add = 40 + } + if = { + limit = { + ep1_character_had_or_has_inspiration_type_trigger = { TYPE = book } + court_owner ?= { + has_government = landless_adventurer_government + has_perk = divided_attention_perk + } + } + add = 80 + } + # Bonus quality from Cultural Traditions + if = { + limit = { + ep1_character_had_or_has_inspiration_type_trigger = { TYPE = weapon } + culture = { has_cultural_parameter = improved_weapon_inspiration } + } + add = 20 + } + if = { + limit = { + ep1_character_had_or_has_inspiration_type_trigger = { TYPE = artisan } + culture = { has_cultural_parameter = improved_artisan_inspiration } + } + add = 20 + } + if = { + limit = { + ep1_character_had_or_has_inspiration_type_trigger = { TYPE = weaver } + culture = { has_cultural_parameter = improved_weaver_inspiration } + } + add = 20 + } + + # Bonus quality from event outcomes involving the Inspiration Owner + if = { + limit = { exists = var:artifact_quality } + add = { + value = var:artifact_quality + multiply = 3 + } + } + + # Bonus quality from the Mind Without Mind tenet + if = { + limit = { + faith = { has_doctrine_parameter = better_artifacts } + } + add = 10 + } + + # Reduction on quality for 'local artisans', who should produce lower quality artifacts + if = { + limit = { + has_character_flag = local_artisan + } + add = -10 + } + # Other inspiration owners get a small bonus in quality to help distinguish them from 'local artisans' + else = { + add = 20 + } + } + + # Bonuses from Buildings + if = { #Smiths line + limit = { + court_owner ?= { + any_directly_owned_province = { + has_building_or_higher = smiths_05 + } + } + } + court_owner = { + every_directly_owned_province = { + limit = { + has_building_or_higher = smiths_05 + } + add = 2 + } + every_directly_owned_province = { + limit = { + has_building_or_higher = smiths_06 + } + add = 2 + } + every_directly_owned_province = { + limit = { + has_building_or_higher = smiths_07 + } + add = 2 + } + every_directly_owned_province = { + limit = { + has_building_or_higher = smiths_08 + } + add = 2 + } + } + } + if = { #blacksmiths duchy building + limit = { + court_owner ?= { + any_directly_owned_province = { + has_building_or_higher = blacksmiths_01 + } + } + } + court_owner = { + every_directly_owned_province = { + limit = { + has_building_or_higher = blacksmiths_01 + } + add = 4 + } + every_directly_owned_province = { + limit = { + has_building_or_higher = blacksmiths_02 + } + add = 8 + } + every_directly_owned_province = { + limit = { + has_building_or_higher = blacksmiths_03 + } + add = 12 + } + } + } + if = { #caravanserai line + limit = { + court_owner ?= { + any_directly_owned_province = { + has_building_or_higher = caravanserai_04 + } + } + } + court_owner = { + every_directly_owned_province = { + limit = { + has_building_or_higher = caravanserai_04 + } + add = 2 + } + every_directly_owned_province = { + limit = { + has_building_or_higher = caravanserai_05 + } + add = 2 + } + every_directly_owned_province = { + limit = { + has_building_or_higher = caravanserai_06 + } + add = 2 + } + every_directly_owned_province = { + limit = { + has_building_or_higher = caravanserai_07 + } + add = 2 + } + every_directly_owned_province = { + limit = { + has_building_or_higher = caravanserai_08 + } + add = 2 + } + } + } + if = { #Wind Furnaces line + limit = { + court_owner ?= { + any_directly_owned_province = { + has_building_or_higher = wind_furnace_04 + } + } + OR = { + ep1_character_had_or_has_inspiration_type_trigger = { TYPE = armor } + ep1_character_had_or_has_inspiration_type_trigger = { TYPE = weapon } + } + } + court_owner = { + every_directly_owned_province = { + limit = { + has_building_or_higher = wind_furnace_04 + } + add = 6 + } + every_directly_owned_province = { + limit = { + has_building_or_higher = wind_furnace_05 + } + add = 4 + } + every_directly_owned_province = { + limit = { + has_building_or_higher = wind_furnace_06 + } + add = 4 + } + every_directly_owned_province = { + limit = { + has_building_or_higher = wind_furnace_07 + } + add = 4 + } + every_directly_owned_province = { + limit = { + has_building_or_higher = wind_furnace_08 + } + add = 4 + } + } + } + if = { # Universities boost Book Inspirations + limit = { + court_owner ?= { + any_directly_owned_province = { + has_university_building_trigger = yes + } + } + ep1_character_had_or_has_inspiration_type_trigger = { TYPE = book } + } + add = 20 + } + if = { # Special Mines boost things significantly + limit = { + court_owner ?= { + any_directly_owned_province = { + has_any_special_mine_trigger = yes + } + } + OR = { + ep1_character_had_or_has_inspiration_type_trigger = { TYPE = armor } + ep1_character_had_or_has_inspiration_type_trigger = { TYPE = weapon } + ep1_character_had_or_has_inspiration_type_trigger = { TYPE = smith } + ep1_character_had_or_has_inspiration_type_trigger = { TYPE = artisan } + } + } + add = 20 + } + + # Bonus from Estates + if = { + limit = { + court_owner ?= { + domicile ?= { + has_domicile_parameter = estate_improved_inspirations_2 + } + } + } + add = 10 + } + else_if = { + limit = { + court_owner ?= { + domicile ?= { + has_domicile_parameter = estate_improved_inspirations_1 + } + } + } + add = 5 + } + } + + #If it is worth bringing home from an adventure it is not common. + if = { + limit = { + exists = scope:adventurer + } + add = 20 + } + + + # Family Epic base quality + if = { + limit = { + exists = scope:owner + scope:owner = { has_variable = commission_epic_quality } + } + add = scope:owner.var:commission_epic_quality + } + # Old Ledger should not be too fancy (stewardship_wealth.1061) + if = { + limit = { + exists = scope:low_quality + } + max = 20 + } + + # Exotic Arms event + if = { + limit = { exists = scope:exotic_blade_quality } + if = { + limit = { scope:exotic_blade_quality = no } + max = 20 + } + else = { max = 60 } + } + + if = { + limit = { + exists = scope:owner + scope:owner = { has_character_modifier = mpo_artifact_material_modifier } + } + add = 20 + } + + # Encouraging Words BP4 event + if = { + limit = { exists = scope:encouraging_words_quality_boost } + add = 100 + } + + # Can't have negative quality + min = 1 + } + } + } +} + +get_artifact_wealth_effect = { + if = { + limit = { + NOT = { exists = scope:wealth } + } + save_scope_value_as = { + name = wealth + value = { + if = { + # If our artifact already has a quality, set base wealth equal to 1/4th quality value. + limit = { exists = scope:quality } + add = scope:quality + multiply = 0.25 + round = yes + + } + else = { + add = 10 # Otherwise, set base wealth value to 10. + } + + if = { + limit = { + exists = scope:owner + scope:owner.highest_held_title_tier >= 0 + } + add = { + # Add 10 wealth per character tier (up to a max of 50 wealth for emperors) + value = scope:owner.highest_held_title_tier + multiply = 10 + } + + # Add up to 25 wealth, scaling with capital's development + if = { + limit = { + exists = scope:owner.capital_county + } + scope:owner.capital_county = { + add = { + value = development_level + multiply = 0.25 + } + } + } + + # Tribal rulers get a final 50% penalty of all wealth modifiers for crafted artifacts. + if = { + limit = { scope:owner = { government_has_flag = government_is_tribal } } + multiply = 0.50 + } + } + + if = { + limit = { + exists = scope:inspiration_owner + } + scope:inspiration_owner = { + # Bonuses from Buildings + if = { + limit = { + court_owner ?= { + any_directly_owned_province = { + has_building_or_higher = smiths_05 + } + } + } + court_owner = { + every_directly_owned_province = { + limit = { + has_building_or_higher = smiths_05 + } + add = 2 + } + every_directly_owned_province = { + limit = { + has_building_or_higher = smiths_06 + } + add = 2 + } + every_directly_owned_province = { + limit = { + has_building_or_higher = smiths_07 + } + add = 2 + } + every_directly_owned_province = { + limit = { + has_building_or_higher = smiths_08 + } + add = 2 + } + every_directly_owned_province = { + limit = { + has_building_or_higher = blacksmiths_01 + } + add = 4 + } + every_directly_owned_province = { + limit = { + has_building_or_higher = blacksmiths_02 + } + add = 8 + } + every_directly_owned_province = { + limit = { + has_building_or_higher = blacksmiths_03 + } + add = 12 + } + } + } + if = { # Special Mines boost things significantly + limit = { + court_owner ?= { + any_directly_owned_province = { + has_any_special_mine_trigger = yes + } + } + OR = { + ep1_character_had_or_has_inspiration_type_trigger = { TYPE = armor } + ep1_character_had_or_has_inspiration_type_trigger = { TYPE = weapon } + ep1_character_had_or_has_inspiration_type_trigger = { TYPE = smith } + ep1_character_had_or_has_inspiration_type_trigger = { TYPE = artisan } + } + } + add = 20 + } + if = { # Universities boost Book Inspirations + limit = { + court_owner ?= { + any_directly_owned_province = { + has_university_building_trigger = yes + } + } + ep1_character_had_or_has_inspiration_type_trigger = { TYPE = book } + } + add = 20 + } + } + } + + #If it is worth bringing home from an adventure it is not common. + if = { + limit = { + exists = scope:adventurer + } + add = 20 + } + + # Lower wealth for 'local artisans', who should produce lower-quality artifacts. + if = { + limit = { + exists = scope:inspiration_owner + scope:inspiration_owner = { + has_character_flag = local_artisan + } + } + add = -20 + } + # Cultural tradition for piety level boosting artifacts + if = { + limit = { + court_owner.culture ?= { + has_cultural_parameter = piety_level_affect_artifact_quality + } + } + add = { + value = court_owner.piety_level + multiply = 5 + } + } + # Lacquered Armor + if = { + limit = { + scope:inspiration_owner.inspiration ?= { + has_inspiration_type = armor_inspiration + inspiration_sponsor.culture ?= { has_cultural_parameter = higher_quality_armor_artifacts_parameter } + } + } + add = 20 + } + # Old Ledger should not be too fancy (stewardship_wealth.1061) + if = { + limit = { + exists = scope:low_quality + } + max = 20 + } + + # Exotic Arms event + if = { + limit = { exists = scope:exotic_blade_quality } + if = { + limit = { scope:exotic_blade_quality = no } + max = 20 + } + else = { max = 60 } + } + min = 1 #Can't have negative Wealth + } + } + } +} + +#Effect used to influence the artifact's quality +change_artifact_quality_effect = { + save_scope_as = artifact_quality_scope + inspiration = { save_scope_as = inspiration } + if = { + limit = { + inspiration = { has_inspiration_type = research_inspiration } + } + if = { + limit = { + $AMOUNT$ > 3 + } + custom_tooltip = fp3_scholarship_research_success_gain_effect + } + else_if = { + limit = { + $AMOUNT$ < -3 + } + custom_tooltip = fp3_scholarship_research_success_loss_effect + } + else_if = { + limit = { + $AMOUNT$ > 0 + } + custom_tooltip = fp3_scholarship_research_success_slight_gain_effect + } + else_if = { + limit = { + $AMOUNT$ < 0 + } + custom_tooltip = fp3_scholarship_research_success_slight_loss_effect + } + scope:inspiration_owner = { + change_variable = { + name = research_success_chance + add = $AMOUNT$ + } + } + } + else = { + if = { + limit = { + $AMOUNT$ > 3 + } + custom_tooltip = change_artifact_quality_effect_gain + } + else_if = { + limit = { + $AMOUNT$ > 0 + } + custom_tooltip = change_artifact_quality_effect_slight_gain + } + else_if = { + limit = { + $AMOUNT$ > -3 + } + custom_tooltip = change_artifact_quality_effect_slight_loss + } + else_if = { + limit = { + $AMOUNT$ <= -3 + } + custom_tooltip = change_artifact_quality_effect_loss + } + hidden_effect = { + if = { + limit = { + NOT = { + exists = var:artifact_quality + } + } + set_variable = { + name = artifact_quality + value = $AMOUNT$ + } + } + else = { + change_variable = { + name = artifact_quality + add = $AMOUNT$ + } + } + } + } +} + +# Effect run to generate all required 'sub-features' for any existing features on an artifact. +get_artifact_feature_references_effect = { + if = { + limit = { + artifact_needs_pattern_trigger = yes + } + set_artifact_feature_group = decoration_pattern + } + if = { + limit = { + artifact_needs_material_inlay_trigger = yes + } + set_artifact_feature_group = decoration_material_inlay + } + if = { + limit = { + artifact_needs_material_wire_trigger = yes + } + set_artifact_feature_group = decoration_material_wire + } + if = { + limit = { + artifact_needs_material_cloth_trigger = yes + } + set_artifact_feature_group = generic_material_cloth + } + if = { + limit = { + artifact_needs_material_gem_trigger = yes + } + set_artifact_feature_group = decoration_material_gem + } + if = { + limit = { + artifact_needs_material_hsb_trigger = yes + } + set_artifact_feature_group = decoration_material_inlay_HSB + } + if = { + limit = { + artifact_needs_material_wood_trigger = yes + } + set_artifact_feature_group = generic_material_wood + } + if = { + limit = { + has_artifact_feature = decoration_pattern_local_animal + } + scope:owner = { + select_local_animal_effect = { TYPE = any } # Save scope to limit possible animals: any/big/small/dangerous/harmless/prowling + } + } + if = { + limit = { + has_artifact_feature = icon_decoration_pattern_saint + } + set_artifact_feature_group = icon_decoration + scope:owner = { + select_random_saint_effect = yes + } + } +} + + +# A pared-down list of cloth with most purely decorative cloths removed. Used for cordage and structurally-important constructions. +get_cloth_type_sturdy_effect = { + + if = { + limit = { + NOT = { exists = scope:$SCOPE_NAME$ } + } + random_list = { + # Wool + # - Found literally everywhere + 30 = { # Simple wool fabric, can vary wildly in quality and appearance depending on the yarn used to wave it as well as the weaver's skill. + trigger = { artifact_value_trigger = { VALUE = scope:wealth MIN = 0 MAX = 70 } } + save_scope_value_as = { name = $SCOPE_NAME$ value = flag:wool } + } + 10 = { # Wool from the very first shearing of a sheep. Soft, elastic, and slippery, used in high-grade textiles. + trigger = { artifact_value_trigger = { VALUE = scope:wealth MIN = 70 MAX = 999 } } + save_scope_value_as = { name = $SCOPE_NAME$ value = flag:lambswool } + } + + # Silk + # - Found pretty much everywhere but subsaharan Africa. + 30 = { # Plain silk weave. Average quality, but carries some statue and value simply due to its material. + trigger = { + artifact_value_trigger = { VALUE = scope:wealth MIN = 30 MAX = 999 } + NOT = { artifact_region_trigger = { CHARACTER = scope:owner REGION = material_cloth_no_silk } } + } + save_scope_value_as = { name = $SCOPE_NAME$ value = flag:silk } + } + + # Linen + # - Modern Germany was a major producer of linen, which was exported throughout all of Europe (but not really beyond that) + 40 = { # Plain weave flax fibers. Consistently average in quality and price, saw widespread use throughout the medieval era. + trigger = { + artifact_value_trigger = { VALUE = scope:wealth MIN = 0 MAX = 999 } + artifact_region_trigger = { CHARACTER = scope:owner REGION = material_cloth_linen } + } + save_scope_value_as = { name = $SCOPE_NAME$ value = flag:linen } + } + 30 = { # Twill cotton-linen blend. As it a mixed fabric, practicing Jews are forbidden to wear it. + trigger = { + artifact_value_trigger = { VALUE = scope:wealth MIN = 40 MAX = 999 } + artifact_region_trigger = { CHARACTER = scope:owner REGION = material_cloth_cotton } + NOT = { scope:owner.religion = religion:judaism_religion } + } + save_scope_value_as = { name = $SCOPE_NAME$ value = flag:fustian } + } + + # Cotton + # - Cotton has been grown in Egypt since ancient times, spread to Etheopia early on and then in the late medieval period to Europe and India. + 50 = { # Plain weave cotton + trigger = { + artifact_value_trigger = { VALUE = scope:wealth MIN = 0 MAX = 999 } + artifact_region_trigger = { CHARACTER = scope:owner REGION = material_cloth_cotton } + } + save_scope_value_as = { name = $SCOPE_NAME$ value = flag:cotton } + } + } + } +} + +# A pared-down list of cloth containing only high-quality decorative threads. Used mostly for embroidery. +get_cloth_type_decorative_thread_effect = { + if = { + limit = { + NOT = { exists = scope:$SCOPE_NAME$ } + } + random_list = { + # Wool + # - Found literally everywhere + 10 = { # Wool from the very first shearing of a sheep. Soft, elastic, and slippery, used in high-grade textiles. + trigger = { artifact_value_trigger = { VALUE = scope:wealth MIN = 0 MAX = 999 } } + save_scope_value_as = { name = $SCOPE_NAME$ value = flag:lambswool } + } + + # Silk + # - Found pretty much everywhere but subsaharan Africa. + 30 = { # Plain silk weave. Average quality, but carries some statue and value simply due to its material. + trigger = { + artifact_value_trigger = { VALUE = scope:wealth MIN = 0 MAX = 70 } + NOT = { artifact_region_trigger = { CHARACTER = scope:owner REGION = material_cloth_no_silk } } + } + save_scope_value_as = { name = $SCOPE_NAME$ value = flag:silk } + } + 30 = { # Cloth woven from silk wrapped in silver. Similar to the cloth-of-gold below, but less expensive. + trigger = { + artifact_value_trigger = { VALUE = scope:wealth MIN = 40 MAX = 90 } + NOT = { artifact_region_trigger = { CHARACTER = scope:owner REGION = material_cloth_no_silk } } + } + save_scope_value_as = { name = $SCOPE_NAME$ value = flag:cloth_of_silver } + } + 50 = { # Cloth woven from silk wrapped in gold. In addition to being expensive, it was almost always outlawed for any non-royalty or non-clergy to wear. + trigger = { + artifact_value_trigger = { VALUE = scope:wealth MIN = 70 MAX = 999 } + NOT = { artifact_region_trigger = { CHARACTER = scope:owner REGION = material_cloth_no_silk } } + } + save_scope_value_as = { name = $SCOPE_NAME$ value = flag:cloth_of_gold } + } + + # Linen + # - Modern Germany was a major producer of linen, which was exported throughout all of Europe (but not really beyond that) + 50 = { # Plain weave flax fibers. Consistently average in quality and price, saw widespread use throughout the medieval era. + trigger = { + artifact_value_trigger = { VALUE = scope:wealth MIN = 0 MAX = 60 } + artifact_region_trigger = { CHARACTER = scope:owner REGION = material_cloth_linen } + } + save_scope_value_as = { name = $SCOPE_NAME$ value = flag:linen } + } + + # Cotton + # - Cotton has been grown in Egypt since ancient times, spread to Etheopia early on and then in the late medieval period to Europe and India. + 50 = { # Plain weave cotton + trigger = { + artifact_value_trigger = { VALUE = scope:wealth MIN = 0 MAX = 60 } + artifact_region_trigger = { CHARACTER = scope:owner REGION = world_europe_west_britannia } + } + save_scope_value_as = { name = $SCOPE_NAME$ value = flag:cotton } + } + } + } +} + +# HSB = Horn, Shell, Bone. Picks a semi-random material suitable for carving, inlay or other decorations. +# Basically animal-based materials that have a wide array of applications. +get_hsb_type_effect = { + if = { + limit = { + NOT = { exists = scope:$SCOPE_NAME$ } + } + random_list = { + # Common. All regions should have access to at least one of these. + 20 = { # Camel Bone + trigger = { + artifact_region_trigger = { CHARACTER = scope:owner REGION = material_hsb_camel_bone } + } + save_scope_value_as = { name = $SCOPE_NAME$ value = flag:hsb_camel_bone } + } + 20 = { # Deer Antler + trigger = { + artifact_region_trigger = { CHARACTER = scope:owner REGION = material_hsb_deer_antler } + } + save_scope_value_as = { name = $SCOPE_NAME$ value = flag:hsb_deer_antler } + } + 20 = { # Boar Tusk + trigger = { + artifact_region_trigger = { CHARACTER = scope:owner REGION = material_hsb_boar_tusk } + } + save_scope_value_as = { name = $SCOPE_NAME$ value = flag:hsb_boar_tusk } + } + 20 = { # Seashell + trigger = { + artifact_region_trigger = { CHARACTER = scope:owner REGION = material_hsb_seashell } + } + save_scope_value_as = { name = $SCOPE_NAME$ value = flag:hsb_seashell } + } + + # Rare, Expensive, or Region-Specifc. Not all regions will have access to these. + 80 = { # Tortoiseshell + trigger = { + AND = { + artifact_value_trigger = { VALUE = scope:wealth MIN = 50 MAX = 999 } + artifact_region_trigger = { CHARACTER = scope:owner REGION = material_hsb_tortoiseshell } + } + } + save_scope_value_as = { name = $SCOPE_NAME$ value = flag:hsb_tortoiseshell } + } + 80 = { # Mother of Pearl + trigger = { + AND = { + artifact_value_trigger = { VALUE = scope:wealth MIN = 50 MAX = 999 } + artifact_region_trigger = { CHARACTER = scope:owner REGION = material_hsb_mother_of_pearl } + } + } + save_scope_value_as = { name = $SCOPE_NAME$ value = flag:hsb_mother_of_pearl } + } + 80 = { # Ivory (Native) + trigger = { + AND = { + artifact_value_trigger = { VALUE = scope:wealth MIN = 50 MAX = 999 } + artifact_region_trigger = { CHARACTER = scope:owner REGION = material_hsb_ivory_native } + } + } + save_scope_value_as = { name = $SCOPE_NAME$ value = flag:hsb_ivory } + } + 40 = { # Ivory (Imported) + trigger = { + AND = { + artifact_value_trigger = { VALUE = scope:wealth MIN = 80 MAX = 999 } + artifact_region_trigger = { CHARACTER = scope:owner REGION = material_hsb_ivory_imported } + } + } + save_scope_value_as = { name = $SCOPE_NAME$ value = flag:hsb_ivory } + } + } + } +} + +add_scaled_artifact_modifier_prowess_effect = { + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + # Base is 1 prowess + } + 15 = { + add_artifact_modifier = artifact_prowess_1_modifier + if = { # Daggers get less Prowess + limit = { exists = scope:weapon_type scope:weapon_type = flag:artifact_weapon_type_dagger } + add_artifact_modifier = artifact_prowess_1_negative_modifier + } + } + 5 = { + add_artifact_modifier = artifact_prowess_2_modifier + if = { # Daggers get less Prowess + limit = { exists = scope:weapon_type scope:weapon_type = flag:artifact_weapon_type_dagger } + add_artifact_modifier = artifact_prowess_1_negative_modifier + } + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_prowess_3_modifier + if = { # Daggers get less Prowess + limit = { exists = scope:weapon_type scope:weapon_type = flag:artifact_weapon_type_dagger } + add_artifact_modifier = artifact_prowess_1_negative_modifier + } + } + 15 = { + add_artifact_modifier = artifact_prowess_4_modifier + if = { # Daggers get less Prowess + limit = { exists = scope:weapon_type scope:weapon_type = flag:artifact_weapon_type_dagger } + add_artifact_modifier = artifact_prowess_1_negative_modifier + } + } + 5 = { + add_artifact_modifier = artifact_prowess_5_modifier + if = { # Daggers get less Prowess + limit = { exists = scope:weapon_type scope:weapon_type = flag:artifact_weapon_type_dagger } + add_artifact_modifier = artifact_prowess_1_negative_modifier + } + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_prowess_6_modifier + if = { # Daggers get less Prowess + limit = { exists = scope:weapon_type scope:weapon_type = flag:artifact_weapon_type_dagger } + add_artifact_modifier = artifact_prowess_2_negative_modifier + } + } + 15 = { + add_artifact_modifier = artifact_prowess_7_modifier + if = { # Daggers get less Prowess + limit = { exists = scope:weapon_type scope:weapon_type = flag:artifact_weapon_type_dagger } + add_artifact_modifier = artifact_prowess_2_negative_modifier + } + } + 5 = { + add_artifact_modifier = artifact_prowess_8_modifier + if = { # Daggers get less Prowess + limit = { exists = scope:weapon_type scope:weapon_type = flag:artifact_weapon_type_dagger } + add_artifact_modifier = artifact_prowess_2_negative_modifier + } + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_prowess_9_modifier + if = { # Daggers get less Prowess + limit = { exists = scope:weapon_type scope:weapon_type = flag:artifact_weapon_type_dagger } + add_artifact_modifier = artifact_prowess_2_negative_modifier + } + } + 15 = { + add_artifact_modifier = artifact_prowess_10_modifier + if = { # Daggers get less Prowess + limit = { exists = scope:weapon_type scope:weapon_type = flag:artifact_weapon_type_dagger } + add_artifact_modifier = artifact_prowess_2_negative_modifier + } + } + 5 = { + add_artifact_modifier = artifact_prowess_11_modifier + if = { # Daggers get less Prowess + limit = { exists = scope:weapon_type scope:weapon_type = flag:artifact_weapon_type_dagger } + add_artifact_modifier = artifact_prowess_2_negative_modifier + } + } + } + } +} + +add_scaled_artifact_modifier_combat_effect = { + random_list = { + # Knight Limit + 20 = { + trigger = { + OR = { + rarity = famed + rarity = illustrious + } + } + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_knights_mod } + add = 160 + } + if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_knight_limit_1_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_knight_limit_2_modifier + } + } + + # Knight Effectiveness + 20 = { + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_knights_mod } + add = 160 + } + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_knight_effectiveness_1_modifier + } + 15 = { + add_artifact_modifier = artifact_knight_effectiveness_2_modifier + } + 5 = { + add_artifact_modifier = artifact_knight_effectiveness_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_knight_effectiveness_4_modifier + } + 15 = { + add_artifact_modifier = artifact_knight_effectiveness_5_modifier + } + 5 = { + add_artifact_modifier = artifact_knight_effectiveness_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_knight_effectiveness_7_modifier + } + 15 = { + add_artifact_modifier = artifact_knight_effectiveness_8_modifier + } + 5 = { + add_artifact_modifier = artifact_knight_effectiveness_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_knight_effectiveness_10_modifier + } + 15 = { + add_artifact_modifier = artifact_knight_effectiveness_11_modifier + } + 5 = { + add_artifact_modifier = artifact_knight_effectiveness_12_modifier + } + } + } + + modifier = { # More likely if you have any "knightly" cultural traditions + factor = 1.5 + scope:owner = { + OR = { + culture = { has_cultural_tradition = tradition_chivalry } + culture = { has_cultural_tradition = tradition_martial_admiration } + culture = { has_cultural_tradition = tradition_futuwaa } + culture = { has_cultural_tradition = tradition_druzhina } + culture = { has_cultural_tradition = tradition_chanson_de_geste } + } + } + } + } + + # negate_prowess_penalty_add + 20 = { + trigger = { + artifact_slot_type = armor + } + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_negate_prowess_penalty_add_1_modifier + } + 15 = { + add_artifact_modifier = artifact_negate_prowess_penalty_add_2_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_negate_prowess_penalty_add_3_modifier + } + 15 = { + add_artifact_modifier = artifact_negate_prowess_penalty_add_4_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_negate_prowess_penalty_add_5_modifier + } + 15 = { + add_artifact_modifier = artifact_negate_prowess_penalty_add_6_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_negate_prowess_penalty_add_7_modifier + } + 15 = { + add_artifact_modifier = artifact_negate_prowess_penalty_add_8_modifier + } + } + } + } + + # Controlled Province Advantage + 20 = { + trigger = { + artifact_slot_type = armor + } + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_controlled_province_advantage_1_modifier + } + 15 = { + add_artifact_modifier = artifact_controlled_province_advantage_2_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_controlled_province_advantage_3_modifier + } + 15 = { + add_artifact_modifier = artifact_controlled_province_advantage_4_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_controlled_province_advantage_5_modifier + } + 15 = { + add_artifact_modifier = artifact_controlled_province_advantage_6_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_controlled_province_advantage_7_modifier + } + 15 = { + add_artifact_modifier = artifact_controlled_province_advantage_8_modifier + } + } + } + } + + # Tolerance Advantage — exclusive to weapons with religious decorations + 40 = { + trigger = { artifact_has_religious_decorations_trigger = yes } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_tolerance_advantage_mod_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_tolerance_advantage_mod_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_tolerance_advantage_mod_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_tolerance_advantage_mod_4_modifier + } + } + + # Levy Reinforcement Rate Same Faith — exclusive to weapons with religious decorations + 40 = { + trigger = { artifact_has_religious_decorations_trigger = yes } + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_1_modifier + } + 15 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_2_modifier + } + 5 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_4_modifier + } + 15 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_5_modifier + } + 5 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_7_modifier + } + 15 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_8_modifier + } + 5 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_10_modifier + } + 15 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_11_modifier + } + 5 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_12_modifier + } + } + } + } + + # zealot_levy_contribution_mult — exclusive to weapons with religious decorations + 40 = { + trigger = { artifact_has_religious_decorations_trigger = yes } + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_zealot_levy_contribution_mult_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_zealot_levy_contribution_mult_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_zealot_levy_contribution_mult_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_zealot_levy_contribution_mult_4_modifier + } + } + + # glory_hound_levy_contribution_mult + 20 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_glory_hound_levy_contribution_mult_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_glory_hound_levy_contribution_mult_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_glory_hound_levy_contribution_mult_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_glory_hound_levy_contribution_mult_4_modifier + } + } + + # belligerent_levy_contribution_mult + 20 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_belligerent_levy_contribution_mult_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_belligerent_levy_contribution_mult_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_belligerent_levy_contribution_mult_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_belligerent_levy_contribution_mult_4_modifier + } + } + + # Raid Speed - exclusive to cultures that can raid + 40 = { + trigger = { + artifact_slot_type = primary_armament + scope:owner = { + can_raid_trigger = yes + } + } + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_raid_mod } + add = 120 + } + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_raid_speed_1_modifier + } + 15 = { + add_artifact_modifier = artifact_raid_speed_2_modifier + } + 5 = { + add_artifact_modifier = artifact_raid_speed_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_raid_speed_4_modifier + } + 15 = { + add_artifact_modifier = artifact_raid_speed_5_modifier + } + 5 = { + add_artifact_modifier = artifact_raid_speed_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_raid_speed_7_modifier + } + 15 = { + add_artifact_modifier = artifact_raid_speed_8_modifier + } + 5 = { + add_artifact_modifier = artifact_raid_speed_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_raid_speed_10_modifier + } + 15 = { + add_artifact_modifier = artifact_raid_speed_11_modifier + } + 5 = { + add_artifact_modifier = artifact_raid_speed_12_modifier + } + } + } + } + + # enemy_hard_casualty_modifier + 20 = { + trigger = { + artifact_slot_type = primary_armament + } + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_casualties_mod } + add = 160 + } + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_enemy_hard_casualty_modifier_1_modifier + } + 15 = { + add_artifact_modifier = artifact_enemy_hard_casualty_modifier_2_modifier + } + 5 = { + add_artifact_modifier = artifact_enemy_hard_casualty_modifier_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_enemy_hard_casualty_modifier_4_modifier + } + 15 = { + add_artifact_modifier = artifact_enemy_hard_casualty_modifier_5_modifier + } + 5 = { + add_artifact_modifier = artifact_enemy_hard_casualty_modifier_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_enemy_hard_casualty_modifier_7_modifier + } + 15 = { + add_artifact_modifier = artifact_enemy_hard_casualty_modifier_8_modifier + } + 5 = { + add_artifact_modifier = artifact_enemy_hard_casualty_modifier_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_enemy_hard_casualty_modifier_10_modifier + } + 15 = { + add_artifact_modifier = artifact_enemy_hard_casualty_modifier_11_modifier + } + 5 = { + add_artifact_modifier = artifact_enemy_hard_casualty_modifier_12_modifier + } + } + } + } + + # hard_casualty_modifier + 20 = { + trigger = { + artifact_slot_type = armor + } + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_casualties_mod } + add = 160 + } + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_hard_casualty_modifier_1_modifier + } + 15 = { + add_artifact_modifier = artifact_hard_casualty_modifier_2_modifier + } + 5 = { + add_artifact_modifier = artifact_hard_casualty_modifier_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_hard_casualty_modifier_4_modifier + } + 15 = { + add_artifact_modifier = artifact_hard_casualty_modifier_5_modifier + } + 5 = { + add_artifact_modifier = artifact_hard_casualty_modifier_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_hard_casualty_modifier_7_modifier + } + 15 = { + add_artifact_modifier = artifact_hard_casualty_modifier_8_modifier + } + 5 = { + add_artifact_modifier = artifact_hard_casualty_modifier_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_hard_casualty_modifier_10_modifier + } + 15 = { + add_artifact_modifier = artifact_hard_casualty_modifier_11_modifier + } + 5 = { + add_artifact_modifier = artifact_hard_casualty_modifier_12_modifier + } + } + } + } + + # terrain_advantage + 20 = { + trigger = { + artifact_slot_type = primary_armament + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + OR = { + terrain = plains + terrain = farmlands + terrain = hills + terrain = mountains + terrain = desert + terrain = desert_mountains + terrain = oasis + terrain = jungle + terrain = forest + terrain = taiga + terrain = wetlands + terrain = steppe + terrain = floodplains + terrain = drylands + } + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + OR = { + terrain = plains + terrain = farmlands + terrain = hills + terrain = mountains + terrain = desert + terrain = desert_mountains + terrain = oasis + terrain = jungle + terrain = forest + terrain = taiga + terrain = wetlands + terrain = steppe + terrain = floodplains + terrain = drylands + } + } + } + } + } + } + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_terrain_mod } + add = 160 + } + random_list = { + 10 = { # plains_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = plains + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = plains + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_plains_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_plains_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_plains_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_plains_advantage_4_modifier + } + } + 10 = { # farmlands_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = farmlands + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = farmlands + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_farmlands_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_farmlands_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_farmlands_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_farmlands_advantage_4_modifier + } + } + 10 = { # hills_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = hills + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = hills + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_hills_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_hills_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_hills_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_hills_advantage_4_modifier + } + } + 10 = { # mountains_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = mountains + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = mountains + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_mountains_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_mountains_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_mountains_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_mountains_advantage_4_modifier + } + } + 10 = { # desert_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = desert + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = desert + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_desert_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_desert_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_desert_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_desert_advantage_4_modifier + } + } + 10 = { # desert_mountains_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = desert_mountains + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = desert_mountains + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_desert_mountains_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_desert_mountains_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_desert_mountains_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_desert_mountains_advantage_4_modifier + } + } + 10 = { # oasis_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = oasis + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = oasis + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_oasis_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_oasis_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_oasis_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_oasis_advantage_4_modifier + } + } + 10 = { # jungle_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = jungle + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = jungle + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_jungle_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_jungle_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_jungle_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_jungle_advantage_4_modifier + } + } + 10 = { # forest_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = forest + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = forest + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_forest_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_forest_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_forest_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_forest_advantage_4_modifier + } + } + 10 = { # taiga_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = taiga + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = taiga + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_taiga_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_taiga_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_taiga_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_taiga_advantage_4_modifier + } + } + 10 = { # wetlands_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = wetlands + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = wetlands + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_wetlands_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_wetlands_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_wetlands_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_wetlands_advantage_4_modifier + } + } + 10 = { # steppe_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = steppe + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = steppe + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_steppe_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_steppe_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_steppe_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_steppe_advantage_4_modifier + } + } + 10 = { # floodplains_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = floodplains + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = floodplains + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_floodplains_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_floodplains_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_floodplains_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_floodplains_advantage_4_modifier + } + } + 10 = { # drylands_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = drylands + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = drylands + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_drylands_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_drylands_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_drylands_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_drylands_advantage_4_modifier + } + } + } + } + + # pursue_efficiency + 20 = { + trigger = { + artifact_slot_type = primary_armament + OR = { + rarity = famed + rarity = illustrious + } + } + if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_pursue_efficiency_1_modifier + } + 15 = { + add_artifact_modifier = artifact_pursue_efficiency_2_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_pursue_efficiency_3_modifier + } + 15 = { + add_artifact_modifier = artifact_pursue_efficiency_4_modifier + } + } + } + } + + # retreat_losses + 20 = { + trigger = { + artifact_slot_type = armor + OR = { + rarity = famed + rarity = illustrious + } + } + if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_retreat_losses_1_modifier + } + 15 = { + add_artifact_modifier = artifact_retreat_losses_2_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_retreat_losses_3_modifier + } + 15 = { + add_artifact_modifier = artifact_retreat_losses_4_modifier + } + } + } + } + } +} + +add_2_scaled_artifact_modifier_combat_effect = { + random_list = { + pick = 2 + unique = yes + # Knight Limit + 20 = { + trigger = { + OR = { + rarity = famed + rarity = illustrious + } + } + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_knights_mod } + add = 160 + } + if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_knight_limit_1_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_knight_limit_2_modifier + } + } + + # Knight Effectiveness + 20 = { + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_knights_mod } + add = 160 + } + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_knight_effectiveness_1_modifier + } + 15 = { + add_artifact_modifier = artifact_knight_effectiveness_2_modifier + } + 5 = { + add_artifact_modifier = artifact_knight_effectiveness_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_knight_effectiveness_4_modifier + } + 15 = { + add_artifact_modifier = artifact_knight_effectiveness_5_modifier + } + 5 = { + add_artifact_modifier = artifact_knight_effectiveness_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_knight_effectiveness_7_modifier + } + 15 = { + add_artifact_modifier = artifact_knight_effectiveness_8_modifier + } + 5 = { + add_artifact_modifier = artifact_knight_effectiveness_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_knight_effectiveness_10_modifier + } + 15 = { + add_artifact_modifier = artifact_knight_effectiveness_11_modifier + } + 5 = { + add_artifact_modifier = artifact_knight_effectiveness_12_modifier + } + } + } + + modifier = { # More likely if you have any "knightly" cultural traditions + factor = 1.5 + scope:owner = { + OR = { + culture = { has_cultural_tradition = tradition_chivalry } + culture = { has_cultural_tradition = tradition_martial_admiration } + culture = { has_cultural_tradition = tradition_futuwaa } + culture = { has_cultural_tradition = tradition_druzhina } + culture = { has_cultural_tradition = tradition_chanson_de_geste } + } + } + } + } + + # negate_prowess_penalty_add + 20 = { + trigger = { + artifact_slot_type = armor + } + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_negate_prowess_penalty_add_1_modifier + } + 15 = { + add_artifact_modifier = artifact_negate_prowess_penalty_add_2_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_negate_prowess_penalty_add_3_modifier + } + 15 = { + add_artifact_modifier = artifact_negate_prowess_penalty_add_4_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_negate_prowess_penalty_add_5_modifier + } + 15 = { + add_artifact_modifier = artifact_negate_prowess_penalty_add_6_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_negate_prowess_penalty_add_7_modifier + } + 15 = { + add_artifact_modifier = artifact_negate_prowess_penalty_add_8_modifier + } + } + } + } + + # Controlled Province Advantage + 20 = { + trigger = { + artifact_slot_type = armor + } + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_controlled_province_advantage_1_modifier + } + 15 = { + add_artifact_modifier = artifact_controlled_province_advantage_2_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_controlled_province_advantage_3_modifier + } + 15 = { + add_artifact_modifier = artifact_controlled_province_advantage_4_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_controlled_province_advantage_5_modifier + } + 15 = { + add_artifact_modifier = artifact_controlled_province_advantage_6_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_controlled_province_advantage_7_modifier + } + 15 = { + add_artifact_modifier = artifact_controlled_province_advantage_8_modifier + } + } + } + } + + # Tolerance Advantage — exclusive to weapons with religious decorations + 40 = { + trigger = { artifact_has_religious_decorations_trigger = yes } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_tolerance_advantage_mod_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_tolerance_advantage_mod_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_tolerance_advantage_mod_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_tolerance_advantage_mod_4_modifier + } + } + + # Levy Reinforcement Rate Same Faith — exclusive to weapons with religious decorations + 40 = { + trigger = { artifact_has_religious_decorations_trigger = yes } + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_1_modifier + } + 15 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_2_modifier + } + 5 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_4_modifier + } + 15 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_5_modifier + } + 5 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_7_modifier + } + 15 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_8_modifier + } + 5 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_10_modifier + } + 15 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_11_modifier + } + 5 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_same_faith_12_modifier + } + } + } + } + + # Raid Speed - exclusive to cultures that can raid + 40 = { + trigger = { + artifact_slot_type = primary_armament + scope:owner = { + can_raid_trigger = yes + } + } + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_raid_mod } + add = 120 + } + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_raid_speed_1_modifier + } + 15 = { + add_artifact_modifier = artifact_raid_speed_2_modifier + } + 5 = { + add_artifact_modifier = artifact_raid_speed_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_raid_speed_4_modifier + } + 15 = { + add_artifact_modifier = artifact_raid_speed_5_modifier + } + 5 = { + add_artifact_modifier = artifact_raid_speed_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_raid_speed_7_modifier + } + 15 = { + add_artifact_modifier = artifact_raid_speed_8_modifier + } + 5 = { + add_artifact_modifier = artifact_raid_speed_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_raid_speed_10_modifier + } + 15 = { + add_artifact_modifier = artifact_raid_speed_11_modifier + } + 5 = { + add_artifact_modifier = artifact_raid_speed_12_modifier + } + } + } + } + + # enemy_hard_casualty_modifier + 20 = { + trigger = { + artifact_slot_type = primary_armament + } + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_enemy_hard_casualty_modifier_1_modifier + } + 15 = { + add_artifact_modifier = artifact_enemy_hard_casualty_modifier_2_modifier + } + 5 = { + add_artifact_modifier = artifact_enemy_hard_casualty_modifier_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_enemy_hard_casualty_modifier_4_modifier + } + 15 = { + add_artifact_modifier = artifact_enemy_hard_casualty_modifier_5_modifier + } + 5 = { + add_artifact_modifier = artifact_enemy_hard_casualty_modifier_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_enemy_hard_casualty_modifier_7_modifier + } + 15 = { + add_artifact_modifier = artifact_enemy_hard_casualty_modifier_8_modifier + } + 5 = { + add_artifact_modifier = artifact_enemy_hard_casualty_modifier_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_enemy_hard_casualty_modifier_10_modifier + } + 15 = { + add_artifact_modifier = artifact_enemy_hard_casualty_modifier_11_modifier + } + 5 = { + add_artifact_modifier = artifact_enemy_hard_casualty_modifier_12_modifier + } + } + } + } + + # hard_casualty_modifier + 20 = { + trigger = { + artifact_slot_type = armor + } + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_hard_casualty_modifier_1_modifier + } + 15 = { + add_artifact_modifier = artifact_hard_casualty_modifier_2_modifier + } + 5 = { + add_artifact_modifier = artifact_hard_casualty_modifier_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_hard_casualty_modifier_4_modifier + } + 15 = { + add_artifact_modifier = artifact_hard_casualty_modifier_5_modifier + } + 5 = { + add_artifact_modifier = artifact_hard_casualty_modifier_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_hard_casualty_modifier_7_modifier + } + 15 = { + add_artifact_modifier = artifact_hard_casualty_modifier_8_modifier + } + 5 = { + add_artifact_modifier = artifact_hard_casualty_modifier_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_hard_casualty_modifier_10_modifier + } + 15 = { + add_artifact_modifier = artifact_hard_casualty_modifier_11_modifier + } + 5 = { + add_artifact_modifier = artifact_hard_casualty_modifier_12_modifier + } + } + } + } + + # terrain_advantage + 20 = { + trigger = { + artifact_slot_type = primary_armament + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + OR = { + terrain = plains + terrain = farmlands + terrain = hills + terrain = mountains + terrain = desert + terrain = desert_mountains + terrain = oasis + terrain = jungle + terrain = forest + terrain = taiga + terrain = wetlands + terrain = steppe + terrain = floodplains + terrain = drylands + } + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + OR = { + terrain = plains + terrain = farmlands + terrain = hills + terrain = mountains + terrain = desert + terrain = desert_mountains + terrain = oasis + terrain = jungle + terrain = forest + terrain = taiga + terrain = wetlands + terrain = steppe + terrain = floodplains + terrain = drylands + } + } + } + } + } + } + random_list = { + 10 = { # plains_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = plains + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = plains + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_plains_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_plains_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_plains_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_plains_advantage_4_modifier + } + } + 10 = { # farmlands_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = farmlands + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = farmlands + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_farmlands_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_farmlands_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_farmlands_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_farmlands_advantage_4_modifier + } + } + 10 = { # hills_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = hills + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = hills + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_hills_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_hills_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_hills_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_hills_advantage_4_modifier + } + } + 10 = { # mountains_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = mountains + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = mountains + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_mountains_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_mountains_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_mountains_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_mountains_advantage_4_modifier + } + } + 10 = { # desert_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = desert + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = desert + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_desert_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_desert_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_desert_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_desert_advantage_4_modifier + } + } + 10 = { # desert_mountains_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = desert_mountains + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = desert_mountains + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_desert_mountains_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_desert_mountains_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_desert_mountains_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_desert_mountains_advantage_4_modifier + } + } + 10 = { # oasis_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = oasis + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = oasis + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_oasis_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_oasis_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_oasis_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_oasis_advantage_4_modifier + } + } + 10 = { # jungle_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = jungle + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = jungle + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_jungle_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_jungle_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_jungle_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_jungle_advantage_4_modifier + } + } + 10 = { # forest_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = forest + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = forest + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_forest_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_forest_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_forest_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_forest_advantage_4_modifier + } + } + 10 = { # taiga_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = taiga + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = taiga + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_taiga_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_taiga_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_taiga_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_taiga_advantage_4_modifier + } + } + 10 = { # wetlands_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = wetlands + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = wetlands + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_wetlands_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_wetlands_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_wetlands_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_wetlands_advantage_4_modifier + } + } + 10 = { # steppe_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = steppe + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = steppe + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_steppe_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_steppe_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_steppe_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_steppe_advantage_4_modifier + } + } + 10 = { # floodplains_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = floodplains + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = floodplains + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_floodplains_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_floodplains_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_floodplains_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_floodplains_advantage_4_modifier + } + } + 10 = { # drylands_advantage + trigger = { + scope:owner = { + OR = { + any_sub_realm_county = { + count >= 5 + title_province = { + terrain = drylands + } + } + any_sub_realm_county = { + percent >= 0.3 + title_province = { + terrain = drylands + } + } + } + } + } + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_drylands_advantage_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_drylands_advantage_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_drylands_advantage_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_drylands_advantage_4_modifier + } + } + } + } + + # pursue_efficiency + 20 = { + trigger = { + artifact_slot_type = primary_armament + OR = { + rarity = famed + rarity = illustrious + } + } + if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_pursue_efficiency_1_modifier + } + 15 = { + add_artifact_modifier = artifact_pursue_efficiency_2_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_pursue_efficiency_3_modifier + } + 15 = { + add_artifact_modifier = artifact_pursue_efficiency_4_modifier + } + } + } + } + + # retreat_losses + 20 = { + trigger = { + artifact_slot_type = armor + OR = { + rarity = famed + rarity = illustrious + } + } + if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_retreat_losses_1_modifier + } + 15 = { + add_artifact_modifier = artifact_retreat_losses_2_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_retreat_losses_3_modifier + } + 15 = { + add_artifact_modifier = artifact_retreat_losses_4_modifier + } + } + } + } + } +} + +add_scaled_artifact_modifier_prestige_effect = { + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_prestige_1_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_prestige_2_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_prestige_3_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_prestige_4_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_prestige_5_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_prestige_6_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_prestige_7_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_prestige_8_modifier + } + } + } +} + +add_scaled_artifact_modifier_minor_prestige_effect = { + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_minor_prestige_1_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_minor_prestige_2_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_minor_prestige_3_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_minor_prestige_4_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_minor_prestige_5_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_minor_prestige_6_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_minor_prestige_7_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_minor_prestige_8_modifier + } + } + } +} + +add_scaled_artifact_modifier_grandeur_big_effect = { + if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_court_grandeur_baseline_add_5_modifier + } + 10 = { + add_artifact_modifier = artifact_court_grandeur_baseline_add_6_modifier + } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_court_grandeur_baseline_add_3_modifier + } + 10 = { + add_artifact_modifier = artifact_court_grandeur_baseline_add_4_modifier + } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { + add_artifact_modifier = artifact_court_grandeur_baseline_add_2_modifier + } + 10 = { + add_artifact_modifier = artifact_court_grandeur_baseline_add_3_modifier + } + } + } + else = { + random_list = { + 20 = { + add_artifact_modifier = artifact_court_grandeur_baseline_add_1_modifier + } + 10 = { + add_artifact_modifier = artifact_court_grandeur_baseline_add_2_modifier + } + } + } +} + +add_scaled_artifact_modifier_grandeur_small_effect = { + if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_court_grandeur_baseline_add_4_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_court_grandeur_baseline_add_3_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_court_grandeur_baseline_add_2_modifier + } + else = { + random_list = { + 10 = { + add_artifact_modifier = artifact_court_grandeur_baseline_add_1_modifier + } + 10 = {} + } + } +} + +add_scaled_artifact_modifier_piety_effect = { + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_1_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_2_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_3_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_4_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_5_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_6_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_7_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_8_modifier + } + } + } +} + +add_scaled_artifact_modifier_dynasty_prestige_effect = { + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_prestige_add_1_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_prestige_add_2_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_prestige_add_3_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_prestige_add_4_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_prestige_add_5_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_prestige_add_6_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_prestige_add_7_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_prestige_add_8_modifier + } + } + } +} + +add_scaled_artifact_modifier_merit_gain_effect = { + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_merit_mult_1_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_merit_mult_2_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_merit_mult_3_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_merit_mult_4_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_merit_mult_5_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_merit_mult_6_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_merit_mult_7_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_merit_mult_8_modifier + } + } + } +} + +add_scaled_artifact_modifier_study_confucian_classics_scheme_phase_duration_add_effect = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_study_confucian_classics_scheme_phase_duration_add_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_study_confucian_classics_scheme_phase_duration_add_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_study_confucian_classics_scheme_phase_duration_add_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_study_confucian_classics_scheme_phase_duration_add_4_modifier + } +} + +add_scaled_artifact_modifier_majesty_effect = { + random_list = { + #pick = 2 + #unique = yes + + # Short Reign Duration + 20 = { + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_reign_mod } + add = 160 + } + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_short_reign_duration_mult_1_modifier + } + 10 = { + add_artifact_modifier = artifact_short_reign_duration_mult_2_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_short_reign_duration_mult_3_modifier + } + 10 = { + add_artifact_modifier = artifact_short_reign_duration_mult_4_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_short_reign_duration_mult_5_modifier + } + 10 = { + add_artifact_modifier = artifact_short_reign_duration_mult_6_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_short_reign_duration_mult_7_modifier + } + 10 = { + add_artifact_modifier = artifact_short_reign_duration_mult_8_modifier + } + } + } + } + + # Dynasty Opinion + 20 = { + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_dynasty_mod } + add = 160 + } + if = { + limit = { rarity = common } + random_list = { + 20 = { + add_artifact_modifier = artifact_dynasty_opinion_1_modifier + } + 10 = { + add_artifact_modifier = artifact_dynasty_opinion_2_modifier + } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { + add_artifact_modifier = artifact_dynasty_opinion_3_modifier + } + 10 = { + add_artifact_modifier = artifact_dynasty_opinion_4_modifier + } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_dynasty_opinion_5_modifier + } + 10 = { + add_artifact_modifier = artifact_dynasty_opinion_6_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_dynasty_opinion_7_modifier + } + 10 = { + add_artifact_modifier = artifact_dynasty_opinion_8_modifier + } + } + } + } + + # Dynasty Prestige + 20 = { + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_dynasty_mod } + add = 160 + } + if = { + limit = { rarity = common } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_prestige_add_1_modifier + } + 10 = { + add_artifact_modifier = artifact_monthly_prestige_add_2_modifier + } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_prestige_add_3_modifier + } + 10 = { + add_artifact_modifier = artifact_monthly_prestige_add_4_modifier + } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_prestige_add_5_modifier + } + 10 = { + add_artifact_modifier = artifact_monthly_prestige_add_6_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_prestige_add_7_modifier + } + 10 = { + add_artifact_modifier = artifact_monthly_prestige_add_8_modifier + } + } + } + } + + # Dynasty Prestige Mult + 20 = { + trigger = { + OR = { + rarity = famed + rarity = illustrious + } + } + if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_dynasty_prestige_1_modifier + } + 10 = { + add_artifact_modifier = artifact_monthly_dynasty_prestige_2_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_dynasty_prestige_3_modifier + } + 10 = { + add_artifact_modifier = artifact_monthly_dynasty_prestige_4_modifier + } + } + } + } + + # Extra Prestige Gain + 20 = { + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_dread_mod } + add = 160 + } + random_list = { + 50 = { # Prestige per Dread + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { dread < 1 } + factor = 0 + } + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_dread_mod } + add = 160 + } + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_monthly_prestige_gain_per_dread_add_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_monthly_prestige_gain_per_dread_add_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_monthly_prestige_gain_per_dread_add_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_monthly_prestige_gain_per_dread_add_4_modifier + } + } + 50 = { # Prestige per Knight + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_monthly_prestige_gain_per_knight_add_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_monthly_prestige_gain_per_knight_add_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_monthly_prestige_gain_per_knight_add_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_monthly_prestige_gain_per_knight_add_4_modifier + } + } + 50 = { # Prestige per Powerful Vassal + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_monthly_prestige_gain_per_happy_powerful_vassal_add_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_monthly_prestige_gain_per_happy_powerful_vassal_add_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_monthly_prestige_gain_per_happy_powerful_vassal_add_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_monthly_prestige_gain_per_happy_powerful_vassal_add_4_modifier + } + } + } + } + + # Tyranny Decay + 20 = { + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_dread_mod } + add = 160 + } + if = { + limit = { rarity = common } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_tyranny_1_modifier + } + 10 = { + add_artifact_modifier = artifact_monthly_tyranny_2_modifier + } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_tyranny_3_modifier + } + 10 = { + add_artifact_modifier = artifact_monthly_tyranny_4_modifier + } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_tyranny_5_modifier + } + 10 = { + add_artifact_modifier = artifact_monthly_tyranny_6_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_tyranny_7_modifier + } + 10 = { + add_artifact_modifier = artifact_monthly_tyranny_8_modifier + } + } + } + } + + # happy_powerful_vassal_tax_contribution_mult + 20 = { + if = { + limit = { rarity = common } + random_list = { + 20 = { + add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_1_modifier + } + 10 = { + add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_2_modifier + } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { + add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_3_modifier + } + 10 = { + add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_4_modifier + } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_5_modifier + } + 10 = { + add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_6_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_7_modifier + } + 10 = { + add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_8_modifier + } + } + } + } + + # courtly_tax_contribution_mult + 20 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_courtly_tax_contribution_mult_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_courtly_tax_contribution_mult_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_courtly_tax_contribution_mult_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_courtly_tax_contribution_mult_4_modifier + } + } + + # glory_hound_tax_contribution_mult + 20 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_glory_hound_tax_contribution_mult_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_glory_hound_tax_contribution_mult_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_glory_hound_tax_contribution_mult_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_glory_hound_tax_contribution_mult_4_modifier + } + } + + # mercenary_hire_cost_mult + 20 = { + trigger = { + OR = { + rarity = famed + rarity = illustrious + } + } + if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_mercenary_hire_cost_mult_1_modifier + } + 10 = { + add_artifact_modifier = artifact_mercenary_hire_cost_mult_2_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_mercenary_hire_cost_mult_3_modifier + } + 10 = { + add_artifact_modifier = artifact_mercenary_hire_cost_mult_4_modifier + } + } + } + } + + # courtly_opinion + 20 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_courtly_vassal_opinion_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_courtly_vassal_opinion_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_courtly_vassal_opinion_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_courtly_vassal_opinion_4_modifier + } + } + + # glory_hound_opinion + 20 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_glory_hound_vassal_opinion_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_glory_hound_vassal_opinion_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_glory_hound_vassal_opinion_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_glory_hound_vassal_opinion_4_modifier + } + } + + # vassal_tax_contribution_mult + 20 = { + trigger = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_vassal_tax_contribution_mult_2_modifier + } + 10 = { + add_artifact_modifier = artifact_vassal_tax_contribution_mult_4_modifier + } + } + } + + # general_opinion + 20 = { + trigger = { + rarity = illustrious + } + add_artifact_modifier = artifact_general_opinion_1_modifier + } + + # Diplomacy per Prestige Level + 20 = { + trigger = { + artifact_slot_type = throne + OR = { + rarity = famed + rarity = illustrious + } + } + add_artifact_modifier = artifact_diplomacy_per_prestige_level_modifier + } + } +} + +add_2_scaled_artifact_modifier_majesty_effect = { + random_list = { + pick = 2 + unique = yes + + # Short Reign Duration + 20 = { + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_reign_mod } + add = 160 + } + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_short_reign_duration_mult_1_modifier + } + 10 = { + add_artifact_modifier = artifact_short_reign_duration_mult_2_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_short_reign_duration_mult_3_modifier + } + 10 = { + add_artifact_modifier = artifact_short_reign_duration_mult_4_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_short_reign_duration_mult_5_modifier + } + 10 = { + add_artifact_modifier = artifact_short_reign_duration_mult_6_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_short_reign_duration_mult_7_modifier + } + 10 = { + add_artifact_modifier = artifact_short_reign_duration_mult_8_modifier + } + } + } + } + + # Dynasty Opinion + 20 = { + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_dynasty_mod } + add = 160 + } + if = { + limit = { rarity = common } + random_list = { + 20 = { + add_artifact_modifier = artifact_dynasty_opinion_1_modifier + } + 10 = { + add_artifact_modifier = artifact_dynasty_opinion_2_modifier + } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { + add_artifact_modifier = artifact_dynasty_opinion_3_modifier + } + 10 = { + add_artifact_modifier = artifact_dynasty_opinion_4_modifier + } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_dynasty_opinion_5_modifier + } + 10 = { + add_artifact_modifier = artifact_dynasty_opinion_6_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_dynasty_opinion_7_modifier + } + 10 = { + add_artifact_modifier = artifact_dynasty_opinion_8_modifier + } + } + } + } + + # Dynasty Prestige + 20 = { + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_dynasty_mod } + add = 160 + } + if = { + limit = { rarity = common } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_prestige_add_1_modifier + } + 10 = { + add_artifact_modifier = artifact_monthly_prestige_add_2_modifier + } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_prestige_add_3_modifier + } + 10 = { + add_artifact_modifier = artifact_monthly_prestige_add_4_modifier + } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_prestige_add_5_modifier + } + 10 = { + add_artifact_modifier = artifact_monthly_prestige_add_6_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_prestige_add_7_modifier + } + 10 = { + add_artifact_modifier = artifact_monthly_prestige_add_8_modifier + } + } + } + } + + # Dynasty Prestige Mult + 20 = { + trigger = { + OR = { + rarity = famed + rarity = illustrious + } + } + if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_dynasty_prestige_1_modifier + } + 10 = { + add_artifact_modifier = artifact_monthly_dynasty_prestige_2_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_dynasty_prestige_3_modifier + } + 10 = { + add_artifact_modifier = artifact_monthly_dynasty_prestige_4_modifier + } + } + } + } + + # Extra Prestige Gain + 20 = { + random_list = { + 50 = { # Prestige per Dread + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_dread_mod } + add = 160 + } + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_monthly_prestige_gain_per_dread_add_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_monthly_prestige_gain_per_dread_add_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_monthly_prestige_gain_per_dread_add_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_monthly_prestige_gain_per_dread_add_4_modifier + } + } + 50 = { # Prestige per Knight + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_monthly_prestige_gain_per_knight_add_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_monthly_prestige_gain_per_knight_add_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_monthly_prestige_gain_per_knight_add_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_monthly_prestige_gain_per_knight_add_4_modifier + } + } + 50 = { # Prestige per Powerful Vassal + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_monthly_prestige_gain_per_happy_powerful_vassal_add_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_monthly_prestige_gain_per_happy_powerful_vassal_add_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_monthly_prestige_gain_per_happy_powerful_vassal_add_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_monthly_prestige_gain_per_happy_powerful_vassal_add_4_modifier + } + } + } + } + + # Tyranny Decay + 20 = { + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_dread_mod } + add = 160 + } + if = { + limit = { rarity = common } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_tyranny_1_modifier + } + 10 = { + add_artifact_modifier = artifact_monthly_tyranny_2_modifier + } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_tyranny_3_modifier + } + 10 = { + add_artifact_modifier = artifact_monthly_tyranny_4_modifier + } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_tyranny_5_modifier + } + 10 = { + add_artifact_modifier = artifact_monthly_tyranny_6_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_tyranny_7_modifier + } + 10 = { + add_artifact_modifier = artifact_monthly_tyranny_8_modifier + } + } + } + } + + # happy_powerful_vassal_tax_contribution_mult + 20 = { + if = { + limit = { rarity = common } + random_list = { + 20 = { + add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_1_modifier + } + 10 = { + add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_2_modifier + } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { + add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_3_modifier + } + 10 = { + add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_4_modifier + } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_5_modifier + } + 10 = { + add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_6_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_7_modifier + } + 10 = { + add_artifact_modifier = artifact_happy_powerful_vassal_tax_contribution_mult_8_modifier + } + } + } + } + + # courtly_tax_contribution_mult + 20 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_courtly_tax_contribution_mult_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_courtly_tax_contribution_mult_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_courtly_tax_contribution_mult_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_courtly_tax_contribution_mult_4_modifier + } + } + + # glory_hound_tax_contribution_mult + 20 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_glory_hound_tax_contribution_mult_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_glory_hound_tax_contribution_mult_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_glory_hound_tax_contribution_mult_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_glory_hound_tax_contribution_mult_4_modifier + } + } + + # mercenary_hire_cost_mult + 20 = { + trigger = { + OR = { + rarity = famed + rarity = illustrious + } + } + if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_mercenary_hire_cost_mult_1_modifier + } + 10 = { + add_artifact_modifier = artifact_mercenary_hire_cost_mult_2_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_mercenary_hire_cost_mult_3_modifier + } + 10 = { + add_artifact_modifier = artifact_mercenary_hire_cost_mult_4_modifier + } + } + } + } + + # courtly_opinion + 20 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_courtly_vassal_opinion_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_courtly_vassal_opinion_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_courtly_vassal_opinion_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_courtly_vassal_opinion_4_modifier + } + } + + # glory_hound_opinion + 20 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_glory_hound_vassal_opinion_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_glory_hound_vassal_opinion_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_glory_hound_vassal_opinion_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_glory_hound_vassal_opinion_4_modifier + } + } + + # vassal_tax_contribution_mult + 20 = { + trigger = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_vassal_tax_contribution_mult_2_modifier + } + 10 = { + add_artifact_modifier = artifact_vassal_tax_contribution_mult_4_modifier + } + } + } + + # general_opinion + 20 = { + trigger = { + rarity = illustrious + } + add_artifact_modifier = artifact_general_opinion_1_modifier + } + + # Diplomacy per Prestige Level + 20 = { + trigger = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_artifact_modifier = artifact_diplomacy_per_prestige_level_modifier + } + } +} + +add_scaled_artifact_modifier_rulership_effect = { + random_list = { + # Vassal Limit + 20 = { + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_vassals_mod } + add = 160 + } + if = { + limit = { rarity = common } + random_list = { + 20 = { + add_artifact_modifier = artifact_vassal_limit_1_modifier + } + 10 = { + add_artifact_modifier = artifact_vassal_limit_2_modifier + } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { + add_artifact_modifier = artifact_vassal_limit_3_modifier + } + 10 = { + add_artifact_modifier = artifact_vassal_limit_4_modifier + } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_vassal_limit_5_modifier + } + 10 = { + add_artifact_modifier = artifact_vassal_limit_6_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_vassal_limit_7_modifier + } + 10 = { + add_artifact_modifier = artifact_vassal_limit_8_modifier + } + } + } + } + + # Powerful Vassal Opinion + 20 = { + trigger = { + scope:inspiration_owner ?= { + NOT = { government_has_flag = no_powerful_vassals } + } + } + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_vassals_mod } + add = 160 + } + if = { + limit = { rarity = common } + random_list = { + 20 = { + add_artifact_modifier = artifact_powerful_vassal_opinion_1_modifier + } + 10 = { + add_artifact_modifier = artifact_powerful_vassal_opinion_2_modifier + } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { + add_artifact_modifier = artifact_powerful_vassal_opinion_3_modifier + } + 10 = { + add_artifact_modifier = artifact_powerful_vassal_opinion_4_modifier + } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_powerful_vassal_opinion_5_modifier + } + 10 = { + add_artifact_modifier = artifact_powerful_vassal_opinion_6_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_powerful_vassal_opinion_7_modifier + } + 10 = { + add_artifact_modifier = artifact_powerful_vassal_opinion_8_modifier + } + } + } + } + + # courtly_opinion + 20 = { + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_vassals_mod } + add = 160 + } + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_courtly_vassal_opinion_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_courtly_vassal_opinion_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_courtly_vassal_opinion_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_courtly_vassal_opinion_4_modifier + } + } + + # parochial_opinion + 20 = { + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_vassals_mod } + add = 160 + } + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_parochial_vassal_opinion_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_parochial_vassal_opinion_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_parochial_vassal_opinion_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_parochial_vassal_opinion_4_modifier + } + } + + # belligerent_opinion + 20 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_belligerent_vassal_opinion_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_belligerent_vassal_opinion_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_belligerent_vassal_opinion_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_belligerent_vassal_opinion_4_modifier + } + } + + # Independent Ruler Opinion + 20 = { + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_ind_ruler_mod } + add = 160 + } + if = { + limit = { rarity = common } + random_list = { + 20 = { + add_artifact_modifier = artifact_independent_ruler_opinion_1_modifier + } + 10 = { + add_artifact_modifier = artifact_independent_ruler_opinion_2_modifier + } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { + add_artifact_modifier = artifact_independent_ruler_opinion_3_modifier + } + 10 = { + add_artifact_modifier = artifact_independent_ruler_opinion_4_modifier + } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_independent_ruler_opinion_5_modifier + } + 10 = { + add_artifact_modifier = artifact_independent_ruler_opinion_6_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_independent_ruler_opinion_7_modifier + } + 10 = { + add_artifact_modifier = artifact_independent_ruler_opinion_8_modifier + } + } + } + } + + # Courtier and Guest Opinion + 20 = { + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_court_op_mod } + add = 160 + } + if = { + limit = { rarity = common } + random_list = { + 20 = { + add_artifact_modifier = artifact_courtier_and_guest_opinion_1_modifier + } + 10 = { + add_artifact_modifier = artifact_courtier_and_guest_opinion_2_modifier + } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { + add_artifact_modifier = artifact_courtier_and_guest_opinion_3_modifier + } + 10 = { + add_artifact_modifier = artifact_courtier_and_guest_opinion_4_modifier + } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_courtier_and_guest_opinion_5_modifier + } + 10 = { + add_artifact_modifier = artifact_courtier_and_guest_opinion_6_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_courtier_and_guest_opinion_7_modifier + } + 10 = { + add_artifact_modifier = artifact_courtier_and_guest_opinion_8_modifier + } + } + } + } + + # men_at_arms_maintenance + 20 = { + if = { + limit = { rarity = common } + random_list = { + 20 = { + add_artifact_modifier = artifact_men_at_arms_maintenance_1_modifier + } + 10 = { + add_artifact_modifier = artifact_men_at_arms_maintenance_2_modifier + } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { + add_artifact_modifier = artifact_men_at_arms_maintenance_3_modifier + } + 10 = { + add_artifact_modifier = artifact_men_at_arms_maintenance_4_modifier + } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_men_at_arms_maintenance_5_modifier + } + 10 = { + add_artifact_modifier = artifact_men_at_arms_maintenance_6_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_men_at_arms_maintenance_7_modifier + } + 10 = { + add_artifact_modifier = artifact_men_at_arms_maintenance_8_modifier + } + } + } + } + + # build_gold_cost + 20 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_build_gold_cost_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_build_gold_cost_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_build_gold_cost_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_build_gold_cost_4_modifier + } + } + + # domain_tax_mult + 20 = { + trigger = { + OR = { + rarity = famed + rarity = illustrious + } + } + if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_domain_tax_mult_1_modifier + } + 10 = { + add_artifact_modifier = artifact_domain_tax_mult_2_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_domain_tax_mult_3_modifier + } + 10 = { + add_artifact_modifier = artifact_domain_tax_mult_4_modifier + } + } + } + } + + # parochial_tax_contribution_mult + 20 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_parochial_tax_contribution_mult_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_parochial_tax_contribution_mult_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_parochial_tax_contribution_mult_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_parochial_tax_contribution_mult_4_modifier + } + } + + # belligerent_tax_contribution_mult + 20 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_belligerent_tax_contribution_mult_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_belligerent_tax_contribution_mult_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_belligerent_tax_contribution_mult_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_belligerent_tax_contribution_mult_4_modifier + } + } + + # Stewardship per Stress Level + 20 = { + trigger = { + artifact_slot_type = helmet + OR = { + rarity = famed + rarity = illustrious + } + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_stewardship_per_stress_level_2_modifier + } + else = { + add_artifact_modifier = artifact_stewardship_per_stress_level_1_modifier + } + } + + # herd_gain_mult + 20 = { + trigger = { + scope:liege ?= { government_has_flag = government_is_nomadic } + } + if = { + limit = { rarity = common } + random_list = { + 20 = { + add_artifact_modifier = artifact_herd_gain_1_modifier + } + 10 = { + add_artifact_modifier = artifact_herd_gain_2_modifier + } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { + add_artifact_modifier = artifact_herd_gain_3_modifier + } + 10 = { + add_artifact_modifier = artifact_herd_gain_4_modifier + } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_herd_gain_5_modifier + } + 10 = { + add_artifact_modifier = artifact_herd_gain_6_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_herd_gain_7_modifier + } + 10 = { + add_artifact_modifier = artifact_herd_gain_8_modifier + } + } + } + } + + # herd_conversion + 20 = { + trigger = { + scope:liege ?= { government_has_flag = government_is_nomadic } + } + if = { + limit = { rarity = common } + random_list = { + 20 = { + add_artifact_modifier = artifact_herd_conversion_1_modifier + } + 10 = { + add_artifact_modifier = artifact_herd_conversion_2_modifier + } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { + add_artifact_modifier = artifact_herd_conversion_3_modifier + } + 10 = { + add_artifact_modifier = artifact_herd_conversion_4_modifier + } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_herd_conversion_5_modifier + } + 10 = { + add_artifact_modifier = artifact_herd_conversion_6_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_herd_conversion_7_modifier + } + 10 = { + add_artifact_modifier = artifact_herd_conversion_8_modifier + } + } + } + } + + # Domain Limit + #20 = { + #trigger = { + #rarity = illustrious + #} + #add_artifact_modifier = artifact_domain_limit_1_modifier + #} + } +} + +add_2_scaled_artifact_modifier_rulership_effect = { + random_list = { + pick = 2 + unique = yes + # Vassal Limit + 20 = { + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_vassals_mod } + add = 160 + } + if = { + limit = { rarity = common } + random_list = { + 20 = { + add_artifact_modifier = artifact_vassal_limit_1_modifier + } + 10 = { + add_artifact_modifier = artifact_vassal_limit_2_modifier + } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { + add_artifact_modifier = artifact_vassal_limit_3_modifier + } + 10 = { + add_artifact_modifier = artifact_vassal_limit_4_modifier + } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_vassal_limit_5_modifier + } + 10 = { + add_artifact_modifier = artifact_vassal_limit_6_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_vassal_limit_7_modifier + } + 10 = { + add_artifact_modifier = artifact_vassal_limit_8_modifier + } + } + } + } + + # Powerful Vassal Opinion + 20 = { + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_vassals_mod } + add = 160 + } + if = { + limit = { rarity = common } + random_list = { + 20 = { + add_artifact_modifier = artifact_powerful_vassal_opinion_1_modifier + } + 10 = { + add_artifact_modifier = artifact_powerful_vassal_opinion_2_modifier + } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { + add_artifact_modifier = artifact_powerful_vassal_opinion_3_modifier + } + 10 = { + add_artifact_modifier = artifact_powerful_vassal_opinion_4_modifier + } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_powerful_vassal_opinion_5_modifier + } + 10 = { + add_artifact_modifier = artifact_powerful_vassal_opinion_6_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_powerful_vassal_opinion_7_modifier + } + 10 = { + add_artifact_modifier = artifact_powerful_vassal_opinion_8_modifier + } + } + } + } + + # courtly_opinion + 20 = { + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_vassals_mod } + add = 160 + } + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_courtly_vassal_opinion_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_courtly_vassal_opinion_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_courtly_vassal_opinion_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_courtly_vassal_opinion_4_modifier + } + } + + # parochial_opinion + 20 = { + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_vassals_mod } + add = 160 + } + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_parochial_vassal_opinion_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_parochial_vassal_opinion_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_parochial_vassal_opinion_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_parochial_vassal_opinion_4_modifier + } + } + + # belligerent_opinion + 20 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_belligerent_vassal_opinion_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_belligerent_vassal_opinion_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_belligerent_vassal_opinion_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_belligerent_vassal_opinion_4_modifier + } + } + + # Independent Ruler Opinion + 20 = { + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_ind_ruler_mod } + add = 160 + } + if = { + limit = { rarity = common } + random_list = { + 20 = { + add_artifact_modifier = artifact_independent_ruler_opinion_1_modifier + } + 10 = { + add_artifact_modifier = artifact_independent_ruler_opinion_2_modifier + } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { + add_artifact_modifier = artifact_independent_ruler_opinion_3_modifier + } + 10 = { + add_artifact_modifier = artifact_independent_ruler_opinion_4_modifier + } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_independent_ruler_opinion_5_modifier + } + 10 = { + add_artifact_modifier = artifact_independent_ruler_opinion_6_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_independent_ruler_opinion_7_modifier + } + 10 = { + add_artifact_modifier = artifact_independent_ruler_opinion_8_modifier + } + } + } + } + + # Courtier and Guest Opinion + 20 = { + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_court_op_mod } + add = 160 + } + if = { + limit = { rarity = common } + random_list = { + 20 = { + add_artifact_modifier = artifact_courtier_and_guest_opinion_1_modifier + } + 10 = { + add_artifact_modifier = artifact_courtier_and_guest_opinion_2_modifier + } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { + add_artifact_modifier = artifact_courtier_and_guest_opinion_3_modifier + } + 10 = { + add_artifact_modifier = artifact_courtier_and_guest_opinion_4_modifier + } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_courtier_and_guest_opinion_5_modifier + } + 10 = { + add_artifact_modifier = artifact_courtier_and_guest_opinion_6_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_courtier_and_guest_opinion_7_modifier + } + 10 = { + add_artifact_modifier = artifact_courtier_and_guest_opinion_8_modifier + } + } + } + } + + # men_at_arms_maintenance + 20 = { + if = { + limit = { rarity = common } + random_list = { + 20 = { + add_artifact_modifier = artifact_men_at_arms_maintenance_1_modifier + } + 10 = { + add_artifact_modifier = artifact_men_at_arms_maintenance_2_modifier + } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { + add_artifact_modifier = artifact_men_at_arms_maintenance_3_modifier + } + 10 = { + add_artifact_modifier = artifact_men_at_arms_maintenance_4_modifier + } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_men_at_arms_maintenance_5_modifier + } + 10 = { + add_artifact_modifier = artifact_men_at_arms_maintenance_6_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_men_at_arms_maintenance_7_modifier + } + 10 = { + add_artifact_modifier = artifact_men_at_arms_maintenance_8_modifier + } + } + } + } + + # build_gold_cost + 20 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_build_gold_cost_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_build_gold_cost_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_build_gold_cost_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_build_gold_cost_4_modifier + } + } + + # domain_tax_mult + 20 = { + trigger = { + OR = { + rarity = famed + rarity = illustrious + } + } + if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_domain_tax_mult_1_modifier + } + 10 = { + add_artifact_modifier = artifact_domain_tax_mult_2_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_domain_tax_mult_3_modifier + } + 10 = { + add_artifact_modifier = artifact_domain_tax_mult_4_modifier + } + } + } + } + + # parochial_tax_contribution_mult + 20 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_parochial_tax_contribution_mult_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_parochial_tax_contribution_mult_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_parochial_tax_contribution_mult_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_parochial_tax_contribution_mult_4_modifier + } + } + + # belligerent_tax_contribution_mult + 20 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_belligerent_tax_contribution_mult_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_belligerent_tax_contribution_mult_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_belligerent_tax_contribution_mult_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_belligerent_tax_contribution_mult_4_modifier + } + } + + # Stewardship per Stress Level + 20 = { + trigger = { + NOT = { rarity = common } + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_stewardship_per_stress_level_2_modifier + } + else = { + add_artifact_modifier = artifact_stewardship_per_stress_level_1_modifier + } + } + + # herd_gain_mult + 20 = { + trigger = { + scope:liege ?= { government_has_flag = government_is_nomadic } + } + if = { + limit = { rarity = common } + random_list = { + 20 = { + add_artifact_modifier = artifact_herd_gain_1_modifier + } + 10 = { + add_artifact_modifier = artifact_herd_gain_2_modifier + } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { + add_artifact_modifier = artifact_herd_gain_3_modifier + } + 10 = { + add_artifact_modifier = artifact_herd_gain_4_modifier + } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_herd_gain_5_modifier + } + 10 = { + add_artifact_modifier = artifact_herd_gain_6_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_herd_gain_7_modifier + } + 10 = { + add_artifact_modifier = artifact_herd_gain_8_modifier + } + } + } + } + + # herd_conversion + 20 = { + trigger = { + scope:liege ?= { government_has_flag = government_is_nomadic } + } + if = { + limit = { rarity = common } + random_list = { + 20 = { + add_artifact_modifier = artifact_herd_conversion_1_modifier + } + 10 = { + add_artifact_modifier = artifact_herd_conversion_2_modifier + } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { + add_artifact_modifier = artifact_herd_conversion_3_modifier + } + 10 = { + add_artifact_modifier = artifact_herd_conversion_4_modifier + } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_herd_conversion_5_modifier + } + 10 = { + add_artifact_modifier = artifact_herd_conversion_6_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_herd_conversion_7_modifier + } + 10 = { + add_artifact_modifier = artifact_herd_conversion_8_modifier + } + } + } + } + + # Domain Limit + #20 = { + #trigger = { + #rarity = illustrious + #} + #add_artifact_modifier = artifact_domain_limit_1_modifier + #} + } +} + +add_scaled_artifact_modifier_devotion_effect = { + random_list = { + # monthly_piety + 20 = { + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_1_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_2_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_3_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_4_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_5_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_6_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_7_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_8_modifier + } + } + } + } + # monthly_piety_gain_mult + 20 = { + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_1_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_2_modifier + } + 5 = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_4_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_5_modifier + } + 5 = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_7_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_8_modifier + } + 5 = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_10_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_11_modifier + } + 5 = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_12_modifier + } + } + } + } + # same_faith_opinion + 20 = { + trigger = { + rarity = illustrious + } + if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_same_faith_opinion_1_modifier + } + 10 = { + add_artifact_modifier = artifact_same_faith_opinion_2_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_same_faith_opinion_3_modifier + } + 10 = { + add_artifact_modifier = artifact_same_faith_opinion_4_modifier + } + } + } + } + # zealot_opinion + 20 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_zealot_vassal_opinion_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_zealot_vassal_opinion_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_zealot_vassal_opinion_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_zealot_vassal_opinion_4_modifier + } + } + # clergy_opinion + 20 = { + trigger = { + scope:owner.faith = { + NOT = { + has_doctrine = doctrine_theocracy_lay_clergy + } + } + } + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_clergy_opinion_1_modifier + } + 15 = { + add_artifact_modifier = artifact_clergy_opinion_2_modifier + } + 5 = { + add_artifact_modifier = artifact_clergy_opinion_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_clergy_opinion_4_modifier + } + 15 = { + add_artifact_modifier = artifact_clergy_opinion_5_modifier + } + 5 = { + add_artifact_modifier = artifact_clergy_opinion_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_clergy_opinion_7_modifier + } + 15 = { + add_artifact_modifier = artifact_clergy_opinion_8_modifier + } + 5 = { + add_artifact_modifier = artifact_clergy_opinion_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_clergy_opinion_10_modifier + } + 15 = { + add_artifact_modifier = artifact_clergy_opinion_11_modifier + } + 5 = { + add_artifact_modifier = artifact_clergy_opinion_12_modifier + } + } + } + } + # church_holding_build_gold_cost + 20 = { + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_church_holding_build_gold_cost_1_modifier + } + 15 = { + add_artifact_modifier = artifact_church_holding_build_gold_cost_2_modifier + } + 5 = { + add_artifact_modifier = artifact_church_holding_build_gold_cost_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_church_holding_build_gold_cost_4_modifier + } + 15 = { + add_artifact_modifier = artifact_church_holding_build_gold_cost_5_modifier + } + 5 = { + add_artifact_modifier = artifact_church_holding_build_gold_cost_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_church_holding_build_gold_cost_7_modifier + } + 15 = { + add_artifact_modifier = artifact_church_holding_build_gold_cost_8_modifier + } + 5 = { + add_artifact_modifier = artifact_church_holding_build_gold_cost_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_church_holding_build_gold_cost_10_modifier + } + 15 = { + add_artifact_modifier = artifact_church_holding_build_gold_cost_11_modifier + } + 5 = { + add_artifact_modifier = artifact_church_holding_build_gold_cost_12_modifier + } + } + } + } + # different_faith_opinion + 20 = { + trigger = { + scope:owner.faith = { + has_doctrine = doctrine_pluralism_pluralistic + } + } + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_different_faith_opinion_1_modifier + } + 15 = { + add_artifact_modifier = artifact_different_faith_opinion_2_modifier + } + 5 = { + add_artifact_modifier = artifact_different_faith_opinion_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_different_faith_opinion_4_modifier + } + 15 = { + add_artifact_modifier = artifact_different_faith_opinion_5_modifier + } + 5 = { + add_artifact_modifier = artifact_different_faith_opinion_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_different_faith_opinion_7_modifier + } + 15 = { + add_artifact_modifier = artifact_different_faith_opinion_8_modifier + } + 5 = { + add_artifact_modifier = artifact_different_faith_opinion_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_different_faith_opinion_10_modifier + } + 15 = { + add_artifact_modifier = artifact_different_faith_opinion_11_modifier + } + 5 = { + add_artifact_modifier = artifact_different_faith_opinion_12_modifier + } + } + } + } + # monthly_piety_from_buildings_mult + 20 = { + trigger = { + scope:owner.faith = { + has_doctrine = doctrine_theocracy_lay_clergy + } + } + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_1_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_2_modifier + } + 5 = { + add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_4_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_5_modifier + } + 5 = { + add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_7_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_8_modifier + } + 5 = { + add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_10_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_11_modifier + } + 5 = { + add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_12_modifier + } + } + } + } + # domain_tax_same_faith_mult + 20 = { + trigger = { + OR = { + rarity = famed + rarity = illustrious + } + } + if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_domain_tax_same_faith_mult_1_modifier + } + 10 = { + add_artifact_modifier = artifact_domain_tax_same_faith_mult_2_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_domain_tax_same_faith_mult_3_modifier + } + 10 = { + add_artifact_modifier = artifact_domain_tax_same_faith_mult_4_modifier + } + } + } + } + # monthly_piety_gain_per_happy_powerful_vassal_add + 20 = { + trigger = { + scope:owner = { + faith = { + has_doctrine = doctrine_pluralism_pluralistic + } + } + OR = { + rarity = famed + rarity = illustrious + } + } + if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_monthly_piety_gain_per_happy_powerful_vassal_add_1_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_monthly_piety_gain_per_happy_powerful_vassal_add_2_modifier + } + } + # monthly_piety_gain_per_happy_powerful_vassal_add + 20 = { + trigger = { + scope:owner = { + faith = { + has_doctrine = doctrine_pluralism_pluralistic + } + } + OR = { + rarity = famed + rarity = illustrious + } + } + if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_monthly_piety_gain_per_happy_powerful_vassal_add_1_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_monthly_piety_gain_per_happy_powerful_vassal_add_2_modifier + } + } + # monthly_piety_gain_per_knight_add + 20 = { + trigger = { + scope:owner = { + faith = { + NOR = { + has_doctrine = doctrine_pluralism_pluralistic + has_doctrine_parameter = pacifist_opinion_active + } + } + } + OR = { + rarity = famed + rarity = illustrious + } + } + if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_monthly_piety_gain_per_knight_add_1_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_monthly_piety_gain_per_knight_add_2_modifier + } + } + # zealot_tax_contribution_mult + 20 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_zealot_tax_contribution_mult_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_zealot_tax_contribution_mult_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_zealot_tax_contribution_mult_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_zealot_tax_contribution_mult_4_modifier + } + } + # learning_per_piety_level + 20 = { + trigger = { + rarity = illustrious + } + add_artifact_modifier = artifact_learning_per_piety_level_modifier + } + } +} + +add_2_scaled_artifact_modifier_devotion_effect = { + random_list = { + pick = 2 + unique = yes + # monthly_piety + 20 = { + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_1_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_2_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_3_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_4_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_5_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_6_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_7_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_8_modifier + } + } + } + } + # monthly_piety_gain_mult + 20 = { + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_1_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_2_modifier + } + 5 = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_4_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_5_modifier + } + 5 = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_7_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_8_modifier + } + 5 = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_10_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_11_modifier + } + 5 = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_12_modifier + } + } + } + } + # same_faith_opinion + 20 = { + trigger = { + rarity = illustrious + } + if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_same_faith_opinion_1_modifier + } + 10 = { + add_artifact_modifier = artifact_same_faith_opinion_2_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_same_faith_opinion_3_modifier + } + 10 = { + add_artifact_modifier = artifact_same_faith_opinion_4_modifier + } + } + } + } + # zealot_opinion + 20 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_zealot_vassal_opinion_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_zealot_vassal_opinion_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_zealot_vassal_opinion_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_zealot_vassal_opinion_4_modifier + } + } + # clergy_opinion + 20 = { + trigger = { + scope:owner.faith = { + NOT = { + has_doctrine = doctrine_theocracy_lay_clergy + } + } + } + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_clergy_opinion_1_modifier + } + 15 = { + add_artifact_modifier = artifact_clergy_opinion_2_modifier + } + 5 = { + add_artifact_modifier = artifact_clergy_opinion_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_clergy_opinion_4_modifier + } + 15 = { + add_artifact_modifier = artifact_clergy_opinion_5_modifier + } + 5 = { + add_artifact_modifier = artifact_clergy_opinion_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_clergy_opinion_7_modifier + } + 15 = { + add_artifact_modifier = artifact_clergy_opinion_8_modifier + } + 5 = { + add_artifact_modifier = artifact_clergy_opinion_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_clergy_opinion_10_modifier + } + 15 = { + add_artifact_modifier = artifact_clergy_opinion_11_modifier + } + 5 = { + add_artifact_modifier = artifact_clergy_opinion_12_modifier + } + } + } + } + # church_holding_build_gold_cost + 20 = { + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_church_holding_build_gold_cost_1_modifier + } + 15 = { + add_artifact_modifier = artifact_church_holding_build_gold_cost_2_modifier + } + 5 = { + add_artifact_modifier = artifact_church_holding_build_gold_cost_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_church_holding_build_gold_cost_4_modifier + } + 15 = { + add_artifact_modifier = artifact_church_holding_build_gold_cost_5_modifier + } + 5 = { + add_artifact_modifier = artifact_church_holding_build_gold_cost_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_church_holding_build_gold_cost_7_modifier + } + 15 = { + add_artifact_modifier = artifact_church_holding_build_gold_cost_8_modifier + } + 5 = { + add_artifact_modifier = artifact_church_holding_build_gold_cost_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_church_holding_build_gold_cost_10_modifier + } + 15 = { + add_artifact_modifier = artifact_church_holding_build_gold_cost_11_modifier + } + 5 = { + add_artifact_modifier = artifact_church_holding_build_gold_cost_12_modifier + } + } + } + } + # different_faith_opinion + 20 = { + trigger = { + scope:owner.faith = { + has_doctrine = doctrine_pluralism_pluralistic + } + } + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_different_faith_opinion_1_modifier + } + 15 = { + add_artifact_modifier = artifact_different_faith_opinion_2_modifier + } + 5 = { + add_artifact_modifier = artifact_different_faith_opinion_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_different_faith_opinion_4_modifier + } + 15 = { + add_artifact_modifier = artifact_different_faith_opinion_5_modifier + } + 5 = { + add_artifact_modifier = artifact_different_faith_opinion_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_different_faith_opinion_7_modifier + } + 15 = { + add_artifact_modifier = artifact_different_faith_opinion_8_modifier + } + 5 = { + add_artifact_modifier = artifact_different_faith_opinion_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_different_faith_opinion_10_modifier + } + 15 = { + add_artifact_modifier = artifact_different_faith_opinion_11_modifier + } + 5 = { + add_artifact_modifier = artifact_different_faith_opinion_12_modifier + } + } + } + } + # monthly_piety_from_buildings_mult + 20 = { + trigger = { + scope:owner.faith = { + has_doctrine = doctrine_theocracy_lay_clergy + } + } + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_1_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_2_modifier + } + 5 = { + add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_4_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_5_modifier + } + 5 = { + add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_7_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_8_modifier + } + 5 = { + add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_10_modifier + } + 15 = { + add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_11_modifier + } + 5 = { + add_artifact_modifier = artifact_monthly_piety_from_buildings_mult_12_modifier + } + } + } + } + # domain_tax_same_faith_mult + 20 = { + trigger = { + OR = { + rarity = famed + rarity = illustrious + } + } + if = { + limit = { rarity = famed } + random_list = { + 20 = { + add_artifact_modifier = artifact_domain_tax_same_faith_mult_1_modifier + } + 10 = { + add_artifact_modifier = artifact_domain_tax_same_faith_mult_2_modifier + } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { + add_artifact_modifier = artifact_domain_tax_same_faith_mult_3_modifier + } + 10 = { + add_artifact_modifier = artifact_domain_tax_same_faith_mult_4_modifier + } + } + } + } + # monthly_piety_gain_per_happy_powerful_vassal_add + 20 = { + trigger = { + scope:owner = { + faith = { + has_doctrine = doctrine_pluralism_pluralistic + } + } + OR = { + rarity = famed + rarity = illustrious + } + } + if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_monthly_piety_gain_per_happy_powerful_vassal_add_1_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_monthly_piety_gain_per_happy_powerful_vassal_add_2_modifier + } + } + # monthly_piety_gain_per_happy_powerful_vassal_add + 20 = { + trigger = { + scope:owner = { + faith = { + has_doctrine = doctrine_pluralism_pluralistic + } + } + OR = { + rarity = famed + rarity = illustrious + } + } + if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_monthly_piety_gain_per_happy_powerful_vassal_add_1_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_monthly_piety_gain_per_happy_powerful_vassal_add_2_modifier + } + } + # monthly_piety_gain_per_knight_add + 20 = { + trigger = { + scope:owner = { + faith = { + NOR = { + has_doctrine = doctrine_pluralism_pluralistic + has_doctrine_parameter = pacifist_opinion_active + } + } + } + OR = { + rarity = famed + rarity = illustrious + } + } + if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_monthly_piety_gain_per_knight_add_1_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_monthly_piety_gain_per_knight_add_2_modifier + } + } + # zealot_tax_contribution_mult + 20 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_zealot_tax_contribution_mult_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_zealot_tax_contribution_mult_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_zealot_tax_contribution_mult_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_zealot_tax_contribution_mult_4_modifier + } + } + # learning_per_piety_level + 20 = { + trigger = { + rarity = illustrious + } + add_artifact_modifier = artifact_learning_per_piety_level_modifier + } + } +} + +add_scaled_artifact_modifier_intrigue_effect = { + random_list = { + + # owned_hostile_scheme_success_chance_add + 20 = { + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_1_modifier + } + 15 = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_2_modifier + } + 5 = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_4_modifier + } + 15 = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_5_modifier + } + 5 = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_7_modifier + } + 15 = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_8_modifier + } + 5 = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_10_modifier + } + 15 = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_11_modifier + } + 5 = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_12_modifier + } + } + } + } + # owned_personal_scheme_success_chance_add + 20 = { + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_1_modifier + } + 15 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_2_modifier + } + 5 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_4_modifier + } + 15 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_5_modifier + } + 5 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_7_modifier + } + 15 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_8_modifier + } + 5 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_10_modifier + } + 15 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_11_modifier + } + 5 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_12_modifier + } + } + } + } + # owned_scheme_secrecy_add + 20 = { + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_owned_scheme_secrecy_add_1_modifier + } + 15 = { + add_artifact_modifier = artifact_owned_scheme_secrecy_add_2_modifier + } + 5 = { + add_artifact_modifier = artifact_owned_scheme_secrecy_add_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_owned_scheme_secrecy_add_4_modifier + } + 15 = { + add_artifact_modifier = artifact_owned_scheme_secrecy_add_5_modifier + } + 5 = { + add_artifact_modifier = artifact_owned_scheme_secrecy_add_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_owned_scheme_secrecy_add_7_modifier + } + 15 = { + add_artifact_modifier = artifact_owned_scheme_secrecy_add_8_modifier + } + 5 = { + add_artifact_modifier = artifact_owned_scheme_secrecy_add_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_owned_scheme_secrecy_add_10_modifier + } + 15 = { + add_artifact_modifier = artifact_owned_scheme_secrecy_add_11_modifier + } + 5 = { + add_artifact_modifier = artifact_owned_scheme_secrecy_add_12_modifier + } + } + } + } + # hostile_scheme_phase_duration_add + 20 = { + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_1_modifier + } + 15 = { + add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_2_modifier + } + 5 = { + add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_4_modifier + } + 15 = { + add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_5_modifier + } + 5 = { + add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_7_modifier + } + 15 = { + add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_8_modifier + } + 5 = { + add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_10_modifier + } + 15 = { + add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_11_modifier + } + 5 = { + add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_12_modifier + } + } + } + } + # personal_scheme_phase_duration_add + 20 = { + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_1_modifier + } + 15 = { + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_2_modifier + } + 5 = { + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_4_modifier + } + 15 = { + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_5_modifier + } + 5 = { + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_7_modifier + } + 15 = { + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_8_modifier + } + 5 = { + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_10_modifier + } + 15 = { + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_11_modifier + } + 5 = { + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_12_modifier + } + } + } + } + + # intrigue_per_stress_level + 20 = { + trigger = { + OR = { + rarity = famed + rarity = illustrious + } + } + if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_intrigue_per_stress_level_1_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_intrigue_per_stress_level_2_modifier + } + } + } +} + +add_2_scaled_artifact_modifier_intrigue_effect = { + random_list = { + pick = 2 + unique = yes + # owned_hostile_scheme_success_chance_add + 20 = { + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_1_modifier + } + 15 = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_2_modifier + } + 5 = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_4_modifier + } + 15 = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_5_modifier + } + 5 = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_7_modifier + } + 15 = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_8_modifier + } + 5 = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_10_modifier + } + 15 = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_11_modifier + } + 5 = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_12_modifier + } + } + } + } + # owned_personal_scheme_success_chance_add + 20 = { + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_1_modifier + } + 15 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_2_modifier + } + 5 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_4_modifier + } + 15 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_5_modifier + } + 5 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_7_modifier + } + 15 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_8_modifier + } + 5 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_10_modifier + } + 15 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_11_modifier + } + 5 = { + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_12_modifier + } + } + } + } + # owned_scheme_secrecy_add + 20 = { + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_owned_scheme_secrecy_add_1_modifier + } + 15 = { + add_artifact_modifier = artifact_owned_scheme_secrecy_add_2_modifier + } + 5 = { + add_artifact_modifier = artifact_owned_scheme_secrecy_add_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_owned_scheme_secrecy_add_4_modifier + } + 15 = { + add_artifact_modifier = artifact_owned_scheme_secrecy_add_5_modifier + } + 5 = { + add_artifact_modifier = artifact_owned_scheme_secrecy_add_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_owned_scheme_secrecy_add_7_modifier + } + 15 = { + add_artifact_modifier = artifact_owned_scheme_secrecy_add_8_modifier + } + 5 = { + add_artifact_modifier = artifact_owned_scheme_secrecy_add_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_owned_scheme_secrecy_add_10_modifier + } + 15 = { + add_artifact_modifier = artifact_owned_scheme_secrecy_add_11_modifier + } + 5 = { + add_artifact_modifier = artifact_owned_scheme_secrecy_add_12_modifier + } + } + } + } + # hostile_scheme_phase_duration_add + 20 = { + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_1_modifier + } + 15 = { + add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_2_modifier + } + 5 = { + add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_4_modifier + } + 15 = { + add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_5_modifier + } + 5 = { + add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_7_modifier + } + 15 = { + add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_8_modifier + } + 5 = { + add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_10_modifier + } + 15 = { + add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_11_modifier + } + 5 = { + add_artifact_modifier = artifact_hostile_scheme_phase_duration_add_12_modifier + } + } + } + } + # personal_scheme_phase_duration_add + 20 = { + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_1_modifier + } + 15 = { + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_2_modifier + } + 5 = { + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_4_modifier + } + 15 = { + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_5_modifier + } + 5 = { + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_7_modifier + } + 15 = { + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_8_modifier + } + 5 = { + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_10_modifier + } + 15 = { + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_11_modifier + } + 5 = { + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_12_modifier + } + } + } + } + + # intrigue_per_stress_level + 20 = { + trigger = { + OR = { + rarity = famed + rarity = illustrious + } + } + if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_intrigue_per_stress_level_1_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_intrigue_per_stress_level_2_modifier + } + } + } +} + +add_scaled_artifact_modifier_attractiveness_effect = { + random_list = { + # attraction_opinion + 20 = { + modifier = { + exists = scope:inspiration_owner + scope:inspiration_owner = { has_variable = chosen_attraction_mod } + add = 160 + } + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_attraction_opinion_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_attraction_opinion_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_attraction_opinion_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_attraction_opinion_4_modifier + } + } + # fertility + 20 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_fertility_gain_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_fertility_gain_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_fertility_gain_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_fertility_gain_4_modifier + } + } + # courting_scheme_phase_duration_add + 15 = { + trigger = { + scope:owner = { + diplomacy >= intrigue + } + } + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_courting_scheme_phase_duration_add_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_courting_scheme_phase_duration_add_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_courting_scheme_phase_duration_add_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_courting_scheme_phase_duration_add_4_modifier + } + } + # befriend_scheme_phase_duration_add + 5 = { + trigger = { + scope:owner = { intrigue <= low_skill_rating } + } + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_befriend_scheme_phase_duration_add_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_befriend_scheme_phase_duration_add_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_befriend_scheme_phase_duration_add_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_befriend_scheme_phase_duration_add_4_modifier + } + } + # seduce_scheme_phase_duration_add + 20 = { + trigger = { + scope:owner = { + intrigue >= diplomacy + } + } + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_seduce_scheme_phase_duration_add_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_seduce_scheme_phase_duration_add_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_seduce_scheme_phase_duration_add_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_seduce_scheme_phase_duration_add_4_modifier + } + } + # spouse_opinion + 20 = { + trigger = { + scope:owner = { + is_married = yes + } + } + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_spouse_opinion_add_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_spouse_opinion_add_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_spouse_opinion_add_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_spouse_opinion_add_4_modifier + } + } + } +} + +add_scaled_artifact_modifier_scholarship_effect = { + random_list = { + # development_growth + 20 = { + trigger = { + artifact_owner ?= { NOT = { government_has_flag = government_is_nomadic } } + } + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_development_growth_1_modifier + } + 15 = { + add_artifact_modifier = artifact_development_growth_2_modifier + } + 5 = { + add_artifact_modifier = artifact_development_growth_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_development_growth_4_modifier + } + 15 = { + add_artifact_modifier = artifact_development_growth_5_modifier + } + 5 = { + add_artifact_modifier = artifact_development_growth_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_development_growth_7_modifier + } + 15 = { + add_artifact_modifier = artifact_development_growth_8_modifier + } + 5 = { + add_artifact_modifier = artifact_development_growth_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_development_growth_10_modifier + } + 15 = { + add_artifact_modifier = artifact_development_growth_11_modifier + } + 5 = { + add_artifact_modifier = artifact_development_growth_12_modifier + } + } + } + } + # fertility_growth + 20 = { + trigger = { + artifact_owner ?= { government_has_flag = government_is_nomadic } + } + if = { + limit = { + rarity = common + } + random_list = { + 20 = { + add_artifact_modifier = artifact_fertility_growth_1_modifier + } + 15 = { + add_artifact_modifier = artifact_fertility_growth_2_modifier + } + 5 = { + add_artifact_modifier = artifact_fertility_growth_3_modifier + } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 20 = { + add_artifact_modifier = artifact_fertility_growth_4_modifier + } + 15 = { + add_artifact_modifier = artifact_fertility_growth_5_modifier + } + 5 = { + add_artifact_modifier = artifact_fertility_growth_6_modifier + } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 20 = { + add_artifact_modifier = artifact_fertility_growth_7_modifier + } + 15 = { + add_artifact_modifier = artifact_fertility_growth_8_modifier + } + 5 = { + add_artifact_modifier = artifact_fertility_growth_9_modifier + } + } + } + else_if = { + limit = { + rarity = illustrious + } + random_list = { + 20 = { + add_artifact_modifier = artifact_fertility_growth_10_modifier + } + 15 = { + add_artifact_modifier = artifact_fertility_growth_11_modifier + } + 5 = { + add_artifact_modifier = artifact_fertility_growth_12_modifier + } + } + } + } + # learn_language_scheme_phase_duration_add + 20 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_learn_language_scheme_phase_duration_add_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_learn_language_scheme_phase_duration_add_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_learn_language_scheme_phase_duration_add_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_learn_language_scheme_phase_duration_add_4_modifier + } + } + + # Learning per Prestige Level + 20 = { + trigger = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_artifact_modifier = artifact_learning_per_prestige_level_modifier + } + } +} + +add_scaled_artifact_kris_benefit_effect = { + if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_kris_1_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_kris_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_kris_3_modifier + } + else_if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_kris_4_modifier + } +} + +add_scaled_artifact_modifier_learning_lifestyle_xp_effect = { + if = { + limit = { rarity = common } + random_list = { + 20 = { add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_1_modifier } + 5 = { add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_2_modifier } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_2_modifier } + 5 = { add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_3_modifier } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_3_modifier } + 5 = { add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_4_modifier } + } + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_4_modifier + } +} + +# EP2 + +add_scaled_artifact_modifier_archers_screen_add_effect = { + if = { + limit = { rarity = common } + random_list = { + 20 = { add_artifact_modifier = artifact_archers_screen_add_1_modifier } + 5 = { add_artifact_modifier = artifact_archers_screen_add_2_modifier } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { add_artifact_modifier = artifact_archers_screen_add_2_modifier } + 5 = { add_artifact_modifier = artifact_archers_screen_add_3_modifier } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { add_artifact_modifier = artifact_archers_screen_add_3_modifier } + 5 = { add_artifact_modifier = artifact_archers_screen_add_4_modifier } + } + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_archers_screen_add_4_modifier + } +} + +add_scaled_artifact_modifier_archers_toughness_mult_effect = { + if = { + limit = { rarity = common } + random_list = { + 20 = { add_artifact_modifier = artifact_archers_toughness_mult_1_modifier } + 5 = { add_artifact_modifier = artifact_archers_toughness_mult_2_modifier } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { add_artifact_modifier = artifact_archers_toughness_mult_2_modifier } + 5 = { add_artifact_modifier = artifact_archers_toughness_mult_3_modifier } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { add_artifact_modifier = artifact_archers_toughness_mult_3_modifier } + 5 = { add_artifact_modifier = artifact_archers_toughness_mult_4_modifier } + } + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_archers_toughness_mult_4_modifier + } +} + +add_scaled_artifact_modifier_archer_cavalry_screen_add_effect = { + if = { + limit = { rarity = common } + random_list = { + 20 = { add_artifact_modifier = artifact_archer_cavalry_screen_add_1_modifier } + 5 = { add_artifact_modifier = artifact_archer_cavalry_screen_add_2_modifier } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { add_artifact_modifier = artifact_archer_cavalry_screen_add_2_modifier } + 5 = { add_artifact_modifier = artifact_archer_cavalry_screen_add_3_modifier } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { add_artifact_modifier = artifact_archer_cavalry_screen_add_3_modifier } + 5 = { add_artifact_modifier = artifact_archer_cavalry_screen_add_4_modifier } + } + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_archer_cavalry_screen_add_4_modifier + } +} + +add_scaled_artifact_modifier_archer_cavalry_damage_add_effect = { + if = { + limit = { rarity = common } + random_list = { + 20 = { add_artifact_modifier = artifact_archer_cavalry_damage_add_1_modifier } + 5 = { add_artifact_modifier = artifact_archer_cavalry_damage_add_2_modifier } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { add_artifact_modifier = artifact_archer_cavalry_damage_add_2_modifier } + 5 = { add_artifact_modifier = artifact_archer_cavalry_damage_add_3_modifier } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { add_artifact_modifier = artifact_archer_cavalry_damage_add_3_modifier } + 5 = { add_artifact_modifier = artifact_archer_cavalry_damage_add_4_modifier } + } + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_archer_cavalry_damage_add_4_modifier + } +} + +add_scaled_artifact_modifier_stress_gain_effect = { + switch = { + trigger = rarity + common = { add_artifact_modifier = artifact_stress_gain_1_modifier } + masterwork = { add_artifact_modifier = artifact_stress_gain_2_modifier } + famed = { add_artifact_modifier = artifact_stress_gain_3_modifier } + illustrious = { add_artifact_modifier = artifact_stress_gain_4_modifier } + } +} + +#EP3 + +add_scaled_artifact_modifier_terrain_advantage_effect = { + #Plains + if = { + limit = { + artifact_owner.location ?= { terrain = plains } + } + if = { + limit = { rarity = common } + random_list = { + 20 = { add_artifact_modifier = artifact_plains_advantage_1_modifier } + 5 = { add_artifact_modifier = artifact_plains_advantage_2_modifier } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { add_artifact_modifier = artifact_plains_advantage_2_modifier } + 5 = { add_artifact_modifier = artifact_plains_advantage_3_modifier } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { add_artifact_modifier = artifact_plains_advantage_3_modifier } + 5 = { add_artifact_modifier = artifact_plains_advantage_4_modifier } + } + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_plains_advantage_4_modifier + } + } + #Farmlands + if = { + limit = { + artifact_owner.location ?= { terrain = farmlands } + } + if = { + limit = { rarity = common } + random_list = { + 20 = { add_artifact_modifier = artifact_farmlands_advantage_1_modifier } + 5 = { add_artifact_modifier = artifact_farmlands_advantage_2_modifier } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { add_artifact_modifier = artifact_farmlands_advantage_2_modifier } + 5 = { add_artifact_modifier = artifact_farmlands_advantage_3_modifier } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { add_artifact_modifier = artifact_farmlands_advantage_3_modifier } + 5 = { add_artifact_modifier = artifact_farmlands_advantage_4_modifier } + } + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_farmlands_advantage_4_modifier + } + } + #Hills + if = { + limit = { + artifact_owner.location ?= { terrain = hills } + } + if = { + limit = { rarity = common } + random_list = { + 20 = { add_artifact_modifier = artifact_hills_advantage_1_modifier } + 5 = { add_artifact_modifier = artifact_hills_advantage_2_modifier } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { add_artifact_modifier = artifact_hills_advantage_2_modifier } + 5 = { add_artifact_modifier = artifact_hills_advantage_3_modifier } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { add_artifact_modifier = artifact_hills_advantage_3_modifier } + 5 = { add_artifact_modifier = artifact_hills_advantage_4_modifier } + } + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_hills_advantage_4_modifier + } + } + #Mountains + if = { + limit = { + artifact_owner.location ?= { terrain = mountains } + } + if = { + limit = { rarity = common } + random_list = { + 20 = { add_artifact_modifier = artifact_mountains_advantage_1_modifier } + 5 = { add_artifact_modifier = artifact_mountains_advantage_2_modifier } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { add_artifact_modifier = artifact_mountains_advantage_2_modifier } + 5 = { add_artifact_modifier = artifact_mountains_advantage_3_modifier } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { add_artifact_modifier = artifact_mountains_advantage_3_modifier } + 5 = { add_artifact_modifier = artifact_mountains_advantage_4_modifier } + } + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_mountains_advantage_4_modifier + } + } + #Desert + if = { + limit = { + artifact_owner.location ?= { terrain = desert } + } + if = { + limit = { rarity = common } + random_list = { + 20 = { add_artifact_modifier = artifact_desert_advantage_1_modifier } + 5 = { add_artifact_modifier = artifact_desert_advantage_2_modifier } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { add_artifact_modifier = artifact_desert_advantage_2_modifier } + 5 = { add_artifact_modifier = artifact_desert_advantage_3_modifier } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { add_artifact_modifier = artifact_desert_advantage_3_modifier } + 5 = { add_artifact_modifier = artifact_desert_advantage_4_modifier } + } + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_desert_advantage_4_modifier + } + } + #Desert Mountains + if = { + limit = { + artifact_owner.location ?= { terrain = desert_mountains } + } + if = { + limit = { rarity = common } + random_list = { + 20 = { add_artifact_modifier = artifact_desert_mountains_advantage_1_modifier } + 5 = { add_artifact_modifier = artifact_desert_mountains_advantage_2_modifier } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { add_artifact_modifier = artifact_desert_mountains_advantage_2_modifier } + 5 = { add_artifact_modifier = artifact_desert_mountains_advantage_3_modifier } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { add_artifact_modifier = artifact_desert_mountains_advantage_3_modifier } + 5 = { add_artifact_modifier = artifact_desert_mountains_advantage_4_modifier } + } + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_desert_mountains_advantage_4_modifier + } + } + #Oasis + if = { + limit = { + artifact_owner.location ?= { terrain = oasis } + } + if = { + limit = { rarity = common } + random_list = { + 20 = { add_artifact_modifier = artifact_oasis_advantage_1_modifier } + 5 = { add_artifact_modifier = artifact_oasis_advantage_2_modifier } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { add_artifact_modifier = artifact_oasis_advantage_2_modifier } + 5 = { add_artifact_modifier = artifact_oasis_advantage_3_modifier } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { add_artifact_modifier = artifact_oasis_advantage_3_modifier } + 5 = { add_artifact_modifier = artifact_oasis_advantage_4_modifier } + } + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_oasis_advantage_4_modifier + } + } + #Jungle + if = { + limit = { + artifact_owner.location ?= { terrain = jungle } + } + if = { + limit = { rarity = common } + random_list = { + 20 = { add_artifact_modifier = artifact_jungle_advantage_1_modifier } + 5 = { add_artifact_modifier = artifact_jungle_advantage_2_modifier } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { add_artifact_modifier = artifact_jungle_advantage_2_modifier } + 5 = { add_artifact_modifier = artifact_jungle_advantage_3_modifier } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { add_artifact_modifier = artifact_jungle_advantage_3_modifier } + 5 = { add_artifact_modifier = artifact_jungle_advantage_4_modifier } + } + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_jungle_advantage_4_modifier + } + } + #Forest + if = { + limit = { + artifact_owner.location ?= { terrain = forest } + } + if = { + limit = { rarity = common } + random_list = { + 20 = { add_artifact_modifier = artifact_forest_advantage_1_modifier } + 5 = { add_artifact_modifier = artifact_forest_advantage_2_modifier } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { add_artifact_modifier = artifact_forest_advantage_2_modifier } + 5 = { add_artifact_modifier = artifact_forest_advantage_3_modifier } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { add_artifact_modifier = artifact_forest_advantage_3_modifier } + 5 = { add_artifact_modifier = artifact_forest_advantage_4_modifier } + } + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_forest_advantage_4_modifier + } + } + #Taiga + if = { + limit = { + artifact_owner.location ?= { terrain = taiga } + } + if = { + limit = { rarity = common } + random_list = { + 20 = { add_artifact_modifier = artifact_taiga_advantage_1_modifier } + 5 = { add_artifact_modifier = artifact_taiga_advantage_2_modifier } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { add_artifact_modifier = artifact_taiga_advantage_2_modifier } + 5 = { add_artifact_modifier = artifact_taiga_advantage_3_modifier } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { add_artifact_modifier = artifact_taiga_advantage_3_modifier } + 5 = { add_artifact_modifier = artifact_taiga_advantage_4_modifier } + } + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_taiga_advantage_4_modifier + } + } + #Wetlands + if = { + limit = { + artifact_owner.location ?= { terrain = wetlands } + } + if = { + limit = { rarity = common } + random_list = { + 20 = { add_artifact_modifier = artifact_wetlands_advantage_1_modifier } + 5 = { add_artifact_modifier = artifact_wetlands_advantage_2_modifier } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { add_artifact_modifier = artifact_wetlands_advantage_2_modifier } + 5 = { add_artifact_modifier = artifact_wetlands_advantage_3_modifier } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { add_artifact_modifier = artifact_wetlands_advantage_3_modifier } + 5 = { add_artifact_modifier = artifact_wetlands_advantage_4_modifier } + } + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_wetlands_advantage_4_modifier + } + } + #Steppe + if = { + limit = { + artifact_owner.location ?= { terrain = steppe } + } + if = { + limit = { rarity = common } + random_list = { + 20 = { add_artifact_modifier = artifact_steppe_advantage_1_modifier } + 5 = { add_artifact_modifier = artifact_steppe_advantage_2_modifier } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { add_artifact_modifier = artifact_steppe_advantage_2_modifier } + 5 = { add_artifact_modifier = artifact_steppe_advantage_3_modifier } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { add_artifact_modifier = artifact_steppe_advantage_3_modifier } + 5 = { add_artifact_modifier = artifact_steppe_advantage_4_modifier } + } + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_steppe_advantage_4_modifier + } + } + #Floodplains + if = { + limit = { + artifact_owner.location ?= { terrain = floodplains } + } + if = { + limit = { rarity = common } + random_list = { + 20 = { add_artifact_modifier = artifact_floodplains_advantage_1_modifier } + 5 = { add_artifact_modifier = artifact_floodplains_advantage_2_modifier } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { add_artifact_modifier = artifact_floodplains_advantage_2_modifier } + 5 = { add_artifact_modifier = artifact_floodplains_advantage_3_modifier } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { add_artifact_modifier = artifact_floodplains_advantage_3_modifier } + 5 = { add_artifact_modifier = artifact_floodplains_advantage_4_modifier } + } + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_floodplains_advantage_4_modifier + } + } + #Drylands + if = { + limit = { + artifact_owner.location ?= { terrain = drylands } + } + if = { + limit = { rarity = common } + random_list = { + 20 = { add_artifact_modifier = artifact_drylands_advantage_1_modifier } + 5 = { add_artifact_modifier = artifact_drylands_advantage_2_modifier } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { add_artifact_modifier = artifact_drylands_advantage_2_modifier } + 5 = { add_artifact_modifier = artifact_drylands_advantage_3_modifier } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { add_artifact_modifier = artifact_drylands_advantage_3_modifier } + 5 = { add_artifact_modifier = artifact_drylands_advantage_4_modifier } + } + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_drylands_advantage_4_modifier + } + } +} + +add_scaled_artifact_modifier_hire_mercenary_effect = { + if = { + limit = { rarity = common } + random_list = { + 20 = { add_artifact_modifier = artifact_mercenary_hire_cost_mult_1_modifier } + 5 = { add_artifact_modifier = artifact_mercenary_hire_cost_mult_2_modifier } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { add_artifact_modifier = artifact_mercenary_hire_cost_mult_2_modifier } + 5 = { add_artifact_modifier = artifact_mercenary_hire_cost_mult_3_modifier } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { add_artifact_modifier = artifact_mercenary_hire_cost_mult_3_modifier } + 5 = { add_artifact_modifier = artifact_mercenary_hire_cost_mult_4_modifier } + } + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_mercenary_hire_cost_mult_4_modifier + } +} + +add_scaled_artifact_modifier_negate_prowess_penalty_effect = { + if = { + limit = { rarity = common } + random_list = { + 20 = { add_artifact_modifier = artifact_negate_prowess_penalty_add_1_modifier } + 15 = { add_artifact_modifier = artifact_negate_prowess_penalty_add_2_modifier } + 5 = { add_artifact_modifier = artifact_negate_prowess_penalty_add_3_modifier } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { add_artifact_modifier = artifact_negate_prowess_penalty_add_3_modifier } + 15 = { add_artifact_modifier = artifact_negate_prowess_penalty_add_4_modifier } + 5 = { add_artifact_modifier = artifact_negate_prowess_penalty_add_5_modifier } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { add_artifact_modifier = artifact_negate_prowess_penalty_add_5_modifier } + 15 = { add_artifact_modifier = artifact_negate_prowess_penalty_add_6_modifier } + 5 = { add_artifact_modifier = artifact_negate_prowess_penalty_add_7_modifier } + } + } + else_if = { + limit = { rarity = illustrious } + random_list = { + 20 = { add_artifact_modifier = artifact_negate_prowess_penalty_add_7_modifier } + 15 = { add_artifact_modifier = artifact_negate_prowess_penalty_add_8_modifier } + } + } +} + +add_scaled_artifact_modifier_scheme_resistance_effect = { + if = { + limit = { rarity = common } + random_list = { + 0 = { + #No modifier + } + 5 = { add_artifact_modifier = artifact_scheme_resistance_add_1_modifier } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { add_artifact_modifier = artifact_scheme_resistance_add_1_modifier } + 5 = { add_artifact_modifier = artifact_scheme_resistance_add_2_modifier } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { add_artifact_modifier = artifact_scheme_resistance_add_2_modifier } + 5 = { add_artifact_modifier = artifact_scheme_resistance_add_3_modifier } + } + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_scheme_resistance_add_3_modifier + } +} + +################################################# +# # +# WEAPON CREATION AND DECORATION # +# # +################################################# + +get_sword_decoration_effect = { + random_list = { + 40 = { + trigger = { ep1_extravagant_artifact_decorations_trigger = yes } + set_artifact_feature_group = blade_decoration + set_artifact_feature_group = hilt_decoration + } + 30 = { + trigger = { ep1_advanced_artifact_decorations_trigger = yes } + set_artifact_feature_group = blade_decoration + } + 20 = { + trigger = { ep1_simple_artifact_decorations_trigger = yes } + set_artifact_feature_group = hilt_decoration + } + 10 = { + trigger = { ep1_no_artifact_decorations_trigger = yes } + modifier = { + add = 30 + AND = { + exists = scope:inspiration_owner + scope:inspiration_owner = { ai_greed <= -40 } + } + } + # No decoration + } + } +} + +get_dagger_decoration_effect = { + get_sword_decoration_effect = yes # Currently identical, but we may wish to diverge these later. +} + +# Axes, Hammers, Spears, and Maces +get_axe_decoration_effect = { + random_list = { + 40 = { + trigger = { ep1_extravagant_artifact_decorations_trigger = yes } + set_artifact_feature_group = head_decoration + set_artifact_feature_group = shaft_decoration + } + 20 = { + trigger = { ep1_advanced_artifact_decorations_trigger = yes } + set_artifact_feature_group = head_decoration + } + 40 = { + trigger = { ep1_simple_artifact_decorations_trigger = yes } + set_artifact_feature_group = shaft_decoration + } + 10 = { + trigger = { ep1_no_artifact_decorations_trigger = yes } + modifier = { + add = 30 + AND = { + exists = scope:inspiration_owner + scope:inspiration_owner = { ai_greed <= -40 } + } + } + # No decoration + } + + } +} + +get_hammer_decoration_effect = { + random_list = { + 40 = { + trigger = { ep1_extravagant_artifact_decorations_trigger = yes } + set_artifact_feature_group = head_decoration + set_artifact_feature_group = shaft_decoration + } + 20 = { + trigger = { ep1_advanced_artifact_decorations_trigger = yes } + set_artifact_feature_group = head_decoration + } + 40 = { + trigger = { ep1_simple_artifact_decorations_trigger = yes } + set_artifact_feature_group = shaft_decoration + } + 10 = { + trigger = { ep1_no_artifact_decorations_trigger = yes } + modifier = { + add = 30 + AND = { + exists = scope:inspiration_owner + scope:inspiration_owner = { ai_greed <= -40 } + } + } + # No decoration + } + } +} + +get_spear_decoration_effect = { + random_list = { + 40 = { + trigger = { ep1_extravagant_artifact_decorations_trigger = yes } + set_artifact_feature_group = head_decoration + set_artifact_feature_group = shaft_decoration + } + 20 = { + trigger = { ep1_advanced_artifact_decorations_trigger = yes } + set_artifact_feature_group = head_decoration + } + 40 = { + trigger = { ep1_simple_artifact_decorations_trigger = yes } + set_artifact_feature_group = shaft_decoration + } + 10 = { + trigger = { ep1_no_artifact_decorations_trigger = yes } + modifier = { + add = 30 + AND = { + exists = scope:inspiration_owner + scope:inspiration_owner = { ai_greed <= -40 } + } + } + # No decoration + } + + } +} + +get_mace_decoration_effect = { + random_list = { + 40 = { + trigger = { ep1_extravagant_artifact_decorations_trigger = yes } + set_artifact_feature_group = head_decoration + set_artifact_feature_group = metal_handle_decoration + } + 20 = { + trigger = { ep1_advanced_artifact_decorations_trigger = yes } + set_artifact_feature_group = head_decoration + } + 20 = { + trigger = { ep1_simple_artifact_decorations_trigger = yes } + set_artifact_feature_group = metal_handle_decoration + } + 30 = { + trigger = { ep1_no_artifact_decorations_trigger = yes } + modifier = { + add = 40 + AND = { + exists = scope:inspiration_owner + scope:inspiration_owner = { ai_greed <= -40 } + } + } + # No decoration + } + + } +} + +# If the type of weapon hasn't been decided yet we set it here +set_weapon_artifact_type_effect = { + save_temporary_scope_value_as = { + name = allow_no_type_option + value = $NO_TYPE$ + } + # Historically many of these types of weapon were used in some combination, but to give a clearer portrayal to the player we have to simplify it a bit + hidden_effect = { + $BASE_SCOPE$ = { + #The type has been decided in events, when the character got inspired, or now. Let's save it! (might still leave it up to the sponsor if allow_no_type_option = yes!) + if = { + limit = { + NOT = { exists = var:artifact_weapon_type } + } + random_list = { #What weapon do they want to forge? + 10 = { + set_variable = { + name = artifact_weapon_type + value = flag:artifact_weapon_type_axe + } + } + 10 = { + set_variable = { + name = artifact_weapon_type + value = flag:artifact_weapon_type_dagger + } + } + 10 = { + set_variable = { + name = artifact_weapon_type + value = flag:artifact_weapon_type_hammer + } + } + 10 = { + set_variable = { + name = artifact_weapon_type + value = flag:artifact_weapon_type_mace + } + } + 10 = { + set_variable = { + name = artifact_weapon_type + value = flag:artifact_weapon_type_spear + } + } + 10 = { + set_variable = { + name = artifact_weapon_type + value = flag:artifact_weapon_type_sword + } + } + 50 = { #They don't care and you can decide! + trigger = { + scope:allow_no_type_option = yes + } + modifier = { + add = 30 + has_personality_submissive_trigger = yes + } + modifier = { + add = 9890 # ~1% chance of being predetermined if comissioning from a local artisan. + has_character_flag = local_artisan + } + ai_value_modifier = { + ai_boldness = -0.25 + ai_energy = -0.25 + } + # Don't set on creation so that the player has more input on what gets forged in inspiration start events, like fund_inspiration.0015 + } + } + } + } + } +} + +create_artifact_weapon_effect = { + # Get the character the artifact is being made for. + # If scope:adventurer exists this will result in the history entry reading that the weapon was discovered instead of made. + $OWNER$ = { save_scope_as = owner } + $CREATOR$ = { save_scope_as = smith } + save_temporary_scope_value_as = { + name = weapon_type_is_set + value = $SET_WEAPON_TYPE$ + } + if = { #Any existing dummy character gets turned into the smith + limit = { + exists = scope:dummy_gender + scope:smith = scope:dummy_gender + } + clear_saved_scope = smith + clear_saved_scope = dummy_gender + } + + hidden_effect_new_object = { + if = { + limit = { + scope:weapon_type_is_set = flag:no + } + if = { + limit = { + exists = scope:smith + } + set_weapon_artifact_type_effect = { + BASE_SCOPE = scope:smith + NO_TYPE = no + } + scope:smith = { + var:artifact_weapon_type = { save_scope_as = weapon_type } + remove_variable = artifact_weapon_type + } + } + else = { + set_weapon_artifact_type_effect = { + BASE_SCOPE = scope:owner + NO_TYPE = no + } + scope:owner = { + var:artifact_weapon_type = { save_scope_as = weapon_type } + remove_variable = artifact_weapon_type + } + } + } + else = { + scope:weapon_type_is_set = { save_scope_as = weapon_type } + } + # Get artifact quality and wealth. + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + # Get the type of weapon to forge. Defaults to sword if an invalid type is provided. + if = { + limit = { scope:weapon_type = flag:artifact_weapon_type_axe } + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = artifact_axe_name + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = axe + type = axe + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else_if = { + limit = { exists = scope:smith } + create_artifact = { + name = artifact_axe_name + creator = scope:smith + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = axe + type = axe + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { + scope:host ?= $OWNER$ + scope:activity ?= { has_activity_type = activity_tournament } + } + tournament_contest_weapon_prize_effect = { VISUALS = axe TYPE = axe } + } + else = { + create_artifact = { + name = artifact_axe_name + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = axe + type = axe + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + scope:newly_created_artifact = { + get_axe_decoration_effect = yes + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_axe_description + } + } + else_if = { + limit = { scope:weapon_type = flag:artifact_weapon_type_hammer } + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = artifact_hammer_name + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = hammer + type = hammer + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else_if = { + limit = { exists = scope:smith } + create_artifact = { + name = artifact_hammer_name + creator = scope:smith + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = hammer + type = hammer + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { + scope:host ?= $OWNER$ + scope:activity ?= { has_activity_type = activity_tournament } + } + tournament_contest_weapon_prize_effect = { VISUALS = hammer TYPE = hammer } + } + else = { + create_artifact = { + name = artifact_hammer_name + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = hammer + type = hammer + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + scope:newly_created_artifact = { + get_hammer_decoration_effect = yes + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_hammer_description + } + } + else_if = { + limit = { scope:weapon_type = flag:artifact_weapon_type_spear } + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = artifact_spear_name + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = spear + type = spear + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else_if = { + limit = { exists = scope:smith } + create_artifact = { + name = artifact_spear_name + creator = scope:smith + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = spear + type = spear + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { + scope:host ?= $OWNER$ + scope:activity ?= { has_activity_type = activity_tournament } + } + tournament_contest_weapon_prize_effect = { VISUALS = spear TYPE = spear } + } + else = { + create_artifact = { + name = artifact_spear_name + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = spear + type = spear + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + scope:newly_created_artifact = { + get_spear_decoration_effect = yes + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_spear_description + } + } + else_if = { + limit = { scope:weapon_type = flag:artifact_weapon_type_mace } + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = artifact_mace_name + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = mace + type = mace + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else_if = { + limit = { exists = scope:smith } + create_artifact = { + name = artifact_mace_name + creator = scope:smith + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = mace + type = mace + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { + scope:host ?= $OWNER$ + scope:activity ?= { has_activity_type = activity_tournament } + } + tournament_contest_weapon_prize_effect = { VISUALS = mace TYPE = mace } + } + else = { + create_artifact = { + name = artifact_mace_name + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = mace + type = mace + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + scope:newly_created_artifact = { + get_mace_decoration_effect = yes + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_mace_description + } + } + else_if = { + limit = { + scope:weapon_type = flag:artifact_weapon_type_dagger + scope:smith ?= { has_variable = inspiration_for_kris_dagger } + } + create_artifact = { + name = artifact_dagger_name + creator = scope:smith + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = dagger_kris + type = dagger + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + scope:newly_created_artifact = { + get_dagger_decoration_effect = yes + get_artifact_feature_references_effect = yes + set_artifact_name = artifact_kris_name + set_artifact_description = artifact_kris_description + add_scaled_artifact_kris_benefit_effect = yes + set_variable = { + name = is_kris + value = yes + } + } + scope:smith = { remove_variable = inspiration_for_kris_dagger } + } + else_if = { + limit = { scope:weapon_type = flag:artifact_weapon_type_dagger } + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = artifact_dagger_name + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = dagger + type = dagger + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else_if = { + limit = { exists = scope:smith } + create_artifact = { + name = artifact_dagger_name + creator = scope:smith + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = dagger + type = dagger + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { + scope:host ?= $OWNER$ + scope:activity ?= { has_activity_type = activity_tournament } + } + tournament_contest_weapon_prize_effect = { VISUALS = dagger TYPE = dagger } + } + else = { + create_artifact = { + name = artifact_dagger_name + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = dagger + type = dagger + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + scope:newly_created_artifact = { + get_dagger_decoration_effect = yes + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_dagger_description + } + } + else = { + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = artifact_sword_name + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = sword + type = sword + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else_if = { + limit = { + exists = scope:bowyer + } + create_artifact = { + name = artifact_sword_name + creator = scope:bowyer + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = sword + type = sword + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { + scope:host ?= $OWNER$ + scope:activity ?= { has_activity_type = activity_tournament } + NOT = { $OWNER$ = { has_character_flag = event_4500_happening } } + } + random_list = { + 1 = { + tournament_contest_weapon_prize_effect = { VISUALS = longsword TYPE = sword } + } + 1 = { + tournament_contest_weapon_prize_effect = { VISUALS = sword TYPE = sword } + } + } + } + else = { + random_list = { + 3 = { + trigger = { + has_fp3_dlc_trigger = yes + scope:smith ?= { artifact_should_use_gfx_type_trigger = { TYPE = iranian_building } } + } + create_artifact = { + name = artifact_sassanian_replica_sword_name + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = sassanian_sword + type = sword + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + scope:newly_created_artifact = { set_variable = replica_sassanian_sword } + } + 1 = { + trigger = { sword_could_be_longsword_trigger = yes } + create_artifact = { + name = artifact_longsword_name + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = longsword + type = sword + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + 1 = { + create_artifact = { + name = artifact_sword_name + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = sword + type = sword + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + } + } + if = { + limit = { scope:newly_created_artifact = { has_variable = replica_sassanian_sword } } + if = { + limit = { + scope:newly_created_artifact = { + OR = { + rarity = famed + rarity = illustrious + } + } + } + scope:newly_created_artifact = { set_artifact_description = famed_replica_sassanian_sword_description } + } + else_if = { + limit = { scope:newly_created_artifact = { rarity = masterwork } } + scope:newly_created_artifact = { set_artifact_description = masterwork_replica_sassanian_sword_description } + } + else = { + scope:newly_created_artifact = { set_artifact_description = common_replica_sassanian_sword_description } + } + } + + else = { + scope:newly_created_artifact = { + get_sword_decoration_effect = yes + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_sword_description + } + } + } + + scope:newly_created_artifact = { + # Prowess from weapon rarity + add_scaled_artifact_modifier_prowess_effect = yes + + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + OR = { + has_artifact_feature_group = blade_decoration + has_artifact_feature_group = hilt_decoration + has_artifact_feature_group = shaft_decoration + has_artifact_feature_group = head_decoration + scope:weapon_type = flag:artifact_weapon_type_dagger + } + } + if = { + limit = { scope:weapon_type = flag:artifact_weapon_type_dagger } + add_2_scaled_artifact_modifier_intrigue_effect = yes + } + else = { + add_2_scaled_artifact_modifier_combat_effect = yes + } + } + else_if = { + limit = { + OR = { + rarity = common + rarity = masterwork + } + OR = { + has_artifact_feature_group = blade_decoration + has_artifact_feature_group = hilt_decoration + has_artifact_feature_group = shaft_decoration + has_artifact_feature_group = head_decoration + scope:weapon_type = flag:artifact_weapon_type_dagger + } + } + if = { + limit = { scope:weapon_type = flag:artifact_weapon_type_dagger } + add_scaled_artifact_modifier_intrigue_effect = yes + } + else = { + add_scaled_artifact_modifier_combat_effect = yes + } + } + else_if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + # No decorations + } + if = { + limit = { scope:weapon_type = flag:artifact_weapon_type_dagger } + add_scaled_artifact_modifier_intrigue_effect = yes + add_artifact_modifier = artifact_prowess_no_decorations_high_tier_modifier + } + else = { + add_scaled_artifact_modifier_combat_effect = yes + add_artifact_modifier = artifact_prowess_no_decorations_high_tier_modifier + } + } + else_if = { + limit = { + rarity = masterwork + # No decorations + } + if = { + limit = { scope:weapon_type = flag:artifact_weapon_type_dagger } + add_scaled_artifact_modifier_intrigue_effect = yes + add_artifact_modifier = artifact_prowess_no_decorations_modifier + } + else = { + add_artifact_modifier = artifact_prowess_no_decorations_medium_tier_modifier + } + } + else = { + add_artifact_modifier = artifact_prowess_no_decorations_modifier + } + + # Save the quality and wealth of this artifact in case we need to reference it later. + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + } + } +} + +################################################# +# # +# WEARABLE CREATION AND DECORATION # +# # +################################################# + +# Armor + +# If the type of armor hasn't been decided yet we set it here +set_armor_artifact_type_effect = { + save_temporary_scope_value_as = { + name = allow_no_type_option + value = $NO_TYPE$ + } + # Historically many of these types of armor were used in some combination, but to give a clearer portrayal to the player we have to simplify it a bit + hidden_effect = { + $BASE_SCOPE$ = { + #The type has been decided in events, when the character got inspired, or now. Let's save it! (might still leave it up to the sponsor if allow_no_type_option = yes!) + if = { + limit = { + NOT = { exists = var:artifact_armor_type } + } + random_list = { #What do they want to forge? + 50 = { #Fairly common everywhere + artifact_armor_type_mail_modifier = yes + set_variable = { + name = artifact_armor_type + value = flag:armor_type_mail + } + } + 1 = { #Expensive + artifact_armor_type_plate_modifier = yes + set_variable = { + name = artifact_armor_type + value = flag:armor_type_plate + } + modifier = { + factor = 0 + culture = { + NOT = { has_innovation = innovation_plate_armor } + } + } + } + 50 = { #Fairly common everywhere + artifact_armor_type_scale_modifier = yes + set_variable = { + name = artifact_armor_type + value = flag:armor_type_scale + } + } + 5 = { #Expensive + artifact_armor_type_lamellar_modifier = yes + set_variable = { + name = artifact_armor_type + value = flag:armor_type_lamellar + } + } + 5 = { + artifact_armor_type_laminar_modifier = yes + set_variable = { + name = artifact_armor_type + value = flag:armor_type_laminar + } + } + 0 = { + artifact_armor_type_brigandine_modifier = yes + set_variable = { + name = artifact_armor_type + value = flag:armor_type_brigandine + } + } + 50 = { #They don't care and you can decide! + trigger = { + scope:allow_no_type_option = yes + } + modifier = { + add = 30 + has_personality_submissive_trigger = yes + } + modifier = { + add = 9916 # ~1% chance of being predetermined if comissioning from a local artisan. + has_character_flag = local_artisan + } + ai_value_modifier = { + ai_boldness = -0.25 + ai_energy = -0.25 + } + } + } + } + } + } +} + +# Create the armor +# -OWNER is always needed +# -CREATOR needs a scope, if you want no smith specified you can use "random_dummy_gender_effect = yes" before the armor creation effect and then scope:dummy_gender for CREATOR +# -SET_ARMOR_TYPE has to be a flag, and has to be one of the armor types used in set_armor_artifact_type_effect and ArtifactArmorFullName custom loc key. Use "flag:no" for a random type. +# If scope:adventurer exists this will result in the history entry reading that the weapon was discovered instead of made. +# +# Example: +# create_artifact_armor_effect = { +# OWNER = root +# CREATOR = scope:dummy_gender +# SET_ARMOR_TYPE = flag:armor_type_lamellar +# } +# This will give you lamellar armor with no known smith. +create_artifact_armor_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $CREATOR$ = { save_scope_as = smith } + save_temporary_scope_value_as = { + name = armor_type_is_set + value = $SET_ARMOR_TYPE$ + } + if = { + limit = { + exists = scope:dummy_gender + scope:smith = scope:dummy_gender + } + clear_saved_scope = smith + clear_saved_scope = dummy_gender + } + + hidden_effect_new_object = { + if = { + limit = { + scope:armor_type_is_set = flag:no + } + if = { + limit = { + exists = scope:smith + } + set_armor_artifact_type_effect = { + BASE_SCOPE = scope:smith + NO_TYPE = no + } + scope:smith = { + var:artifact_armor_type = { save_scope_as = armor_type } + remove_variable = artifact_armor_type + } + } + else = { + set_armor_artifact_type_effect = { + BASE_SCOPE = scope:owner + NO_TYPE = no + } + scope:owner = { + var:artifact_armor_type = { save_scope_as = armor_type } + remove_variable = artifact_armor_type + } + } + } + else = { + scope:armor_type_is_set = { save_scope_as = armor_type } + } + # Get artifact quality and wealth + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + if = { + limit = { scope:armor_type = flag:armor_type_plate } + if = { + limit = { + exists = scope:adventurer + } + create_artifact = { + name = placeholder + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + type = armor_plate + visuals = armor + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else_if = { + limit = { exists = scope:smith } + create_artifact = { + name = placeholder + creator = scope:smith + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + type = armor_plate + visuals = armor + wealth = scope:wealth + quality = scope:quality + modifier = artifact_prowess_1_modifier + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { + exists = scope:host + exists = scope:activity + } + tournament_contest_armor_prize_effect = { TYPE = plate } + } + else = { + create_artifact = { + name = placeholder + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + type = armor_plate + visuals = armor + wealth = scope:wealth + quality = scope:quality + modifier = artifact_prowess_1_modifier + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + } + else_if = { + limit = { scope:armor_type = flag:armor_type_scale } + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = placeholder + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + type = armor_scale + visuals = armor + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else_if = { + limit = { exists = scope:smith } + create_artifact = { + name = placeholder + creator = scope:smith + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + type = armor_scale + wealth = scope:wealth + quality = scope:quality + visuals = armor + modifier = artifact_prowess_1_modifier + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { + exists = scope:host + exists = scope:activity + } + tournament_contest_armor_prize_effect = { TYPE = scale } + } + else = { + create_artifact = { + name = placeholder + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + type = armor_scale + wealth = scope:wealth + quality = scope:quality + visuals = armor + modifier = artifact_prowess_1_modifier + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + } + else_if = { + limit = { scope:armor_type = flag:armor_type_lamellar } + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = placeholder + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + type = armor_lamellar + visuals = armor + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else_if = { + limit = { exists = scope:smith } + create_artifact = { + name = placeholder + creator = scope:smith + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + type = armor_lamellar + visuals = armor + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { + exists = scope:host + exists = scope:activity + } + tournament_contest_armor_prize_effect = { TYPE = lamellar } + } + else = { + create_artifact = { + name = placeholder + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + type = armor_lamellar + visuals = armor + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + } + else_if = { + limit = { scope:armor_type = flag:armor_type_laminar } + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = placeholder + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + type = armor_laminar + visuals = armor + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else_if = { + limit = { exists = scope:smith } + create_artifact = { + name = placeholder + creator = scope:smith + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + type = armor_laminar + visuals = armor + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { + exists = scope:host + exists = scope:activity + } + tournament_contest_armor_prize_effect = { TYPE = laminar } + } + else = { + create_artifact = { + name = placeholder + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + type = armor_laminar + visuals = armor + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + } + else_if = { + limit = { scope:armor_type = flag:armor_type_brigandine } + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = placeholder + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + type = armor_brigandine + visuals = armor + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else_if = { + limit = { exists = scope:smith } + create_artifact = { + name = placeholder + creator = scope:smith + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + type = armor_brigandine + visuals = armor + wealth = scope:wealth + quality = scope:quality + modifier = artifact_prowess_1_modifier + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { + exists = scope:host + exists = scope:activity + } + tournament_contest_armor_prize_effect = { TYPE = brigandine } + } + else = { + create_artifact = { + name = placeholder + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + type = armor_brigandine + visuals = armor + wealth = scope:wealth + quality = scope:quality + modifier = artifact_prowess_1_modifier + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + } + else = { + # Defaults to mail as a common, ubiquitous type of armor. + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = placeholder + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + type = armor_mail + visuals = armor + wealth = scope:wealth + quality = scope:quality + modifier = artifact_prowess_1_modifier + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else_if = { + limit = { exists = scope:smith } + create_artifact = { + name = placeholder + creator = scope:smith + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + type = armor_mail + visuals = armor + wealth = scope:wealth + quality = scope:quality + modifier = artifact_prowess_1_modifier + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { + exists = scope:host + exists = scope:activity + } + tournament_contest_armor_prize_effect = { TYPE = mail } + } + else = { + create_artifact = { + name = placeholder + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + type = armor_mail + visuals = armor + wealth = scope:wealth + quality = scope:quality + modifier = artifact_prowess_1_modifier + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + } + scope:newly_created_artifact = { + set_artifact_feature_group = armor_decoration + set_artifact_feature_group = armor_property + get_artifact_feature_references_effect = yes + set_artifact_name = artifact_armor_name + set_artifact_description = artifact_armor_description + } + + + # Let's add the modifiers! + scope:newly_created_artifact = { + # Rarity determines prowess bonus + add_scaled_artifact_modifier_prowess_effect = yes + # Rarity determines combat bonus + add_scaled_artifact_modifier_combat_effect = yes + + if = { # Chain mail gets a higher prowess due to the lack of decoration + limit = { artifact_type = armor_mail } + add_artifact_modifier = artifact_prowess_no_decorations_modifier + } + else_if = { # Fashion gets an attraction boost + limit = { + OR = { + artifact_type = armor_brigandine + artifact_type = armor_plate + } + } + add_artifact_modifier = artifact_attraction_opinion_1_modifier + } + else = { # For all other armor-types you get some prestige + add_artifact_modifier = artifact_placeholder_modifier + } + + if = { # Gold gives more prestige + limit = { + OR = { + has_artifact_feature = armor_decoration_gold_plating + has_artifact_feature = armor_material_gold + } + } + add_artifact_modifier = artifact_monthly_prestige_2_modifier + } + + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + } + } +} + +create_artifact_regalia_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $SMITH$ = { save_scope_as = goldsmith } + # Get artifact quality and wealth + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + + # Create the artifact + if = { + limit = { + exists = scope:adventurer + } + create_artifact = { + name = artifact_regalia_name + description = artifact_regalia_description + visuals = regalia + type = regalia + template = regalia_template + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = given + } + } + } + else = { + create_artifact = { + name = artifact_regalia_name + description = artifact_regalia_description + creator = scope:goldsmith + visuals = regalia + type = regalia + template = regalia_template + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + + hidden_effect_new_object = { + scope:newly_created_artifact = { + # Prestige modifier is scaled based on the Wealth of the artifact (opulence). + add_scaled_artifact_modifier_minor_prestige_effect = yes + + # If we're using the cross-bearing orb (explicit religious symbol), trade some prestige for piety. + if = { + limit = { + has_artifact_feature = regalia_accessory_orb + } + add_artifact_modifier = artifact_monthly_prestige_penalty_modifier + if = { + limit = { # Give a tiny bit more piety for high rarity artifacts. + OR = { + rarity = famed + rarity = illustrious + } + } + add_artifact_modifier = artifact_monthly_piety_5_modifier + } + else = { + add_artifact_modifier = artifact_monthly_piety_2_modifier + } + } + + # Add a Majesty-related modifier based on the Quality of the artifact. + if = { + limit = { # Add a second Majesty-related modifier for high rarity artifacts. + OR = { + rarity = famed + rarity = illustrious + } + } + add_2_scaled_artifact_modifier_majesty_effect = yes + } + else = { + add_scaled_artifact_modifier_majesty_effect = yes + } + + add_scaled_artifact_modifier_attractiveness_effect = yes + + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + } + } +} + +create_artifact_imperial_seal_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $SMITH$ = { save_scope_as = scribe } + # Get artifact quality and wealth + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + # Create the artifact + if = { + limit = { + exists = scope:adventurer + } + create_artifact = { + name = artifact_seal_of_investiture + description = seal_of_investiture.desc + creator = scope:scribe + visuals = imperial_seal + type = seal_of_investiture + wealth = scope:wealth + quality = scope:quality + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = given + } + } + } + else = { + create_artifact = { + name = artifact_seal_of_investiture + description = seal_of_investiture.desc + creator = scope:scribe + visuals = imperial_seal + type = seal_of_investiture + wealth = scope:wealth + quality = scope:quality + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + } + } + + hidden_effect_new_object = { + scope:newly_created_artifact = { + # Prestige modifier is scaled based on the Wealth of the artifact (opulence). + add_scaled_artifact_modifier_prestige_effect = yes + + # Add a rulership-related modifier based on the Quality of the artifact. + if = { + limit = { # Chance to add a second rulership-related modifier for high rarity artifacts. + OR = { + rarity = famed + rarity = illustrious + } + } + random_list = { + 50 = { + add_2_scaled_artifact_modifier_rulership_effect = yes + } + 50 = { + add_scaled_artifact_modifier_rulership_effect = yes + } + } + } + else = { + add_scaled_artifact_modifier_rulership_effect = yes + } + + # Add a majesty-related modifier based on the Quality of the artifact. + if = { + limit = { # Chance to add a second majesty-related modifier for high rarity artifacts. + OR = { + rarity = famed + rarity = illustrious + } + } + random_list = { + 50 = { + add_2_scaled_artifact_modifier_majesty_effect = yes + } + 50 = { + add_scaled_artifact_modifier_majesty_effect = yes + } + } + } + else = { + add_scaled_artifact_modifier_majesty_effect = yes + } + + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + } + } +} + +create_artifact_icon_effect = { + $OWNER$ = { save_scope_as = owner } + $CREATOR$ = { save_scope_as = creator } + + hidden_effect_new_object = { + # Get artifact quality, wealth, materials, and decorations + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + random_list = { + 50 = { + trigger = { scope:owner = { has_royal_court = yes } } + create_artifact = { + name = artifact_icon_name + creator = scope:creator + description = placeholder # Will be updated in the post-creation effects + visuals = icon_court_large + type = wall_icon_court_large + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + 50 = { + trigger = { scope:owner = { has_royal_court = yes } } + create_artifact = { + name = artifact_icon_name + creator = scope:creator + description = placeholder # Will be updated in the post-creation effects + visuals = icon_court_small + type = wall_icon_court_small + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + 50 = { + trigger = { scope:owner = { has_royal_court = no } } + create_artifact = { + name = artifact_icon_name + creator = scope:creator + description = placeholder # Will be updated in the post-creation effects + visuals = trinket_icon + type = miscellaneous_when_not_court + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + } + + scope:newly_created_artifact = { + # Get decoration type and update description + get_artifact_feature_references_effect = yes + set_artifact_name = artifact_icon_name + set_artifact_description = artifact_icon_description + + # Crowns with high rarity get more modifiers + if = { + limit = { + rarity = illustrious + } + add_2_scaled_artifact_modifier_rulership_effect = yes + add_scaled_artifact_modifier_devotion_effect = yes + add_scaled_artifact_modifier_piety_effect = yes + } + else_if = { + limit = { + rarity = famed + } + add_2_scaled_artifact_modifier_rulership_effect = yes + add_scaled_artifact_modifier_devotion_effect = yes + add_scaled_artifact_modifier_piety_effect = yes + } + else_if = { + limit= { + rarity = masterwork + } + add_scaled_artifact_modifier_piety_effect = yes + add_scaled_artifact_modifier_rulership_effect = yes + } + else_if = { + limit= { + rarity = common + } + add_scaled_artifact_modifier_piety_effect = yes + add_scaled_artifact_modifier_rulership_effect = yes + } + + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + } + } +} + +create_artifact_crown_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $SMITH$ = { save_scope_as = goldsmith } + + hidden_effect_new_object = { + # Get artifact quality, wealth, materials, and decorations + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + # Create the artifact + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = artifact_crown_name + description = placeholder # Will be updated in the post-creation effects + template = crown_wearable_template + visuals = crown + type = helmet + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = ROOT.capital_province + actor = scope:adventurer + recipient = scope:owner + type = given + } + } + } + else = { + create_artifact = { + name = artifact_crown_name + creator = scope:goldsmith + description = placeholder # Will be updated in the post-creation effects + template = crown_wearable_template + visuals = crown + type = helmet + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + + scope:newly_created_artifact = { + # Get gem type if necessary and update description + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_crown_description + + # Crowns with high rarity get more modifiers + if = { + limit = { + rarity = illustrious + } + add_2_scaled_artifact_modifier_rulership_effect = yes + add_scaled_artifact_modifier_majesty_effect = yes + add_scaled_artifact_modifier_minor_prestige_effect = yes + } + else_if = { + limit = { + rarity = famed + } + add_2_scaled_artifact_modifier_rulership_effect = yes + add_scaled_artifact_modifier_majesty_effect = yes + add_scaled_artifact_modifier_minor_prestige_effect = yes + } + else_if = { + limit= { + rarity = masterwork + } + add_scaled_artifact_modifier_minor_prestige_effect = yes + add_scaled_artifact_modifier_rulership_effect = yes + } + else_if = { + limit= { + rarity = common + } + add_scaled_artifact_modifier_minor_prestige_effect = yes + add_scaled_artifact_modifier_rulership_effect = yes + } + + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + } + } +} + +create_artifact_brooch_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $SMITH$ = { save_scope_as = goldsmith } + + hidden_effect_new_object = { + # Get artifact quality, wealth, materials, and decorations + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + if = { #Any existing dummy character gets turned into the goldsmith + limit = { + exists = scope:dummy_gender + scope:goldsmith = scope:dummy_gender + } + clear_saved_scope = goldsmith + clear_saved_scope = dummy_gender + } + # Create the artifact + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = artifact_brooch_name + description = placeholder + visuals = brooch + type = brooch + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else_if = { + limit = { + scope:host ?= $OWNER$ + scope:activity ?= { has_activity_type = activity_tournament } + } + create_artifact = { + name = artifact_brooch_name + creator = scope:host + description = placeholder # Will be updated in the post-creation effects after decorations are assigned. + visuals = brooch + type = brooch + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + history = { + type = prize_created + recipient = scope:host + } + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { + exists = scope:goldsmith + exists = scope:owner + scope:goldsmith = scope:owner + } + create_artifact = { + name = artifact_brooch_name + description = placeholder # Will be updated in the post-creation effects after decorations are assigned. + visuals = brooch + type = brooch + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + history = { + type = created + actor = scope:goldsmith + recipient = scope:goldsmith + location = scope:goldsmith.location + } + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { exists = scope:goldsmith } + create_artifact = { + name = artifact_brooch_name + creator = scope:goldsmith + description = placeholder # Will be updated in the post-creation effects after decorations are assigned. + visuals = brooch + type = brooch + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else = { + create_artifact = { + name = artifact_brooch_name + description = placeholder # Will be updated in the post-creation effects after decorations are assigned. + visuals = brooch + type = brooch + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + + scope:newly_created_artifact = { + # Finish generating decorations and update description + if = { + limit = { + OR = { + has_artifact_feature = brooch_decoration_adornment + has_artifact_feature = brooch_decoration_centerpiece_and_adornment + } + } + set_artifact_feature_group = brooch_adornment + } + if = { + limit = { + OR = { + has_artifact_feature = brooch_decoration_centerpiece + has_artifact_feature = brooch_decoration_centerpiece_and_adornment + } + } + set_artifact_feature_group = brooch_centerpiece + } + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_brooch_description + + # Add artifact modifiers + add_scaled_artifact_modifier_minor_prestige_effect = yes + add_scaled_artifact_modifier_attractiveness_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_scaled_artifact_modifier_rulership_effect = yes + } + + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + } + } +} + +create_artifact_brooch_pedestal_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $SMITH$ = { save_scope_as = goldsmith } + if = { #Any existing dummy character gets turned into the goldsmith + limit = { + exists = scope:dummy_gender + scope:goldsmith = scope:dummy_gender + } + clear_saved_scope = goldsmith + clear_saved_scope = dummy_gender + } + hidden_effect_new_object = { + # Get artifact quality, wealth, materials, and decorations + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + # Create the artifact + if = { + limit = { + scope:host ?= $OWNER$ + scope:activity ?= { has_activity_type = activity_tournament } + } + create_artifact = { + name = artifact_brooch_name + creator = scope:host + description = placeholder # Will be updated in the post-creation effects after decorations are assigned. + visuals = brooch_pedestal + type = brooch_pedestal + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + history = { + type = prize_created + recipient = scope:host + } + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { exists = scope:goldsmith } + create_artifact = { + name = artifact_brooch_name + creator = scope:goldsmith + description = placeholder # Will be updated in the post-creation effects after decorations are assigned. + visuals = brooch_pedestal + type = brooch_pedestal + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else = { + create_artifact = { + name = artifact_brooch_name + description = placeholder # Will be updated in the post-creation effects after decorations are assigned. + visuals = brooch_pedestal + type = brooch_pedestal + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + + scope:newly_created_artifact = { + # Finish generating decorations and update description + if = { + limit = { + OR = { + has_artifact_feature = brooch_decoration_adornment + has_artifact_feature = brooch_decoration_centerpiece_and_adornment + } + } + set_artifact_feature_group = brooch_adornment + } + if = { + limit = { + OR = { + has_artifact_feature = brooch_decoration_centerpiece + has_artifact_feature = brooch_decoration_centerpiece_and_adornment + } + } + set_artifact_feature_group = brooch_centerpiece + } + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_brooch_description + + # Add artifact modifiers + add_scaled_artifact_modifier_minor_prestige_effect = yes + add_scaled_artifact_modifier_attractiveness_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_scaled_artifact_modifier_rulership_effect = yes + } + + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + } + } +} + +################################################# +# # +# OBJECTS AND TRINKETS # +# # +################################################# + +create_artifact_necklace_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $SMITH$ = { save_scope_as = goldsmith } + if = { #Any existing dummy character gets turned into the goldsmith + limit = { + exists = scope:dummy_gender + scope:goldsmith = scope:dummy_gender + } + clear_saved_scope = goldsmith + clear_saved_scope = dummy_gender + } + hidden_effect_new_object = { + # Get artifact quality and wealth + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + # Create the artifact + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = artifact_necklace_name + description = placeholder #properly set later + visuals = necklace + type = necklace + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else_if = { + limit = { + scope:host ?= $OWNER$ + scope:activity ?= { has_activity_type = activity_tournament } + } + create_artifact = { + name = artifact_brooch_name + creator = scope:host + description = placeholder # Will be updated in the post-creation effects after decorations are assigned. + visuals = necklace + type = necklace + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + history = { + type = prize_created + recipient = scope:host + } + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { + exists = scope:goldsmith + exists = scope:owner + scope:goldsmith = scope:owner + } + create_artifact = { + name = artifact_necklace_name + description = placeholder #properly set later + visuals = necklace + type = necklace + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + history = { + type = created + actor = scope:goldsmith + recipient = scope:goldsmith + location = scope:goldsmith.location + } + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { exists = scope:goldsmith } + create_artifact = { + name = artifact_necklace_name + creator = scope:goldsmith + description = placeholder #properly set later + visuals = necklace + type = necklace + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else = { + create_artifact = { + name = artifact_necklace_name + description = placeholder #properly set later + visuals = necklace + type = necklace + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + scope:newly_created_artifact = { + #Loc + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_necklace_description + remove_artifact_modifier = artifact_placeholder_modifier + add_scaled_artifact_modifier_minor_prestige_effect = yes + add_scaled_artifact_modifier_attractiveness_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_scaled_artifact_modifier_majesty_effect = yes + } + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + } + } +} + +create_artifact_necklace_pedestal_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $SMITH$ = { save_scope_as = goldsmith } + if = { #Any existing dummy character gets turned into the goldsmith + limit = { + exists = scope:dummy_gender + scope:goldsmith = scope:dummy_gender + } + clear_saved_scope = goldsmith + clear_saved_scope = dummy_gender + } + hidden_effect_new_object = { + # Get artifact quality and wealth + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + # Create the artifact + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = artifact_necklace_name + creator = scope:goldsmith + description = placeholder #properly set later + visuals = necklace_pedestal + type = necklace_pedestal + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = given + } + } + } + else_if = { + limit = { + scope:host ?= $OWNER$ + scope:activity ?= { has_activity_type = activity_tournament } + } + create_artifact = { + name = artifact_brooch_name + creator = scope:host + description = placeholder # Will be updated in the post-creation effects after decorations are assigned. + visuals = brooch + type = brooch + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + history = { + type = prize_created + recipient = scope:host + } + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { exists = scope:goldsmith } + create_artifact = { + name = artifact_necklace_name + creator = scope:goldsmith + description = placeholder #properly set later + visuals = necklace_pedestal + type = necklace_pedestal + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else = { + create_artifact = { + name = artifact_necklace_name + description = placeholder #properly set later + visuals = necklace_pedestal + type = necklace_pedestal + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + scope:newly_created_artifact = { + #Loc + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_necklace_description + remove_artifact_modifier = artifact_placeholder_modifier + add_scaled_artifact_modifier_minor_prestige_effect = yes + add_scaled_artifact_modifier_attractiveness_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_scaled_artifact_modifier_majesty_effect = yes + } + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + } + } +} + +# What flower have we ruthlessly picked and pressed? +get_pressed_flower_species_effect = { + if = { #The hide hasn't been set yet, so we set it here (also works as backup) + limit = { + NOT = { exists = scope:flower_species } + } + random_list = { + 40 = { + # they're everywhere + save_scope_value_as = { + name = flower_species + value = flag:flower_type_aster + } + } + 20 = { + # they're everywhere + save_scope_value_as = { + name = flower_species + value = flag:flower_type_rose + } + } + 10 = { + # they're everywhere, but rare + save_scope_value_as = { + name = flower_species + value = flag:flower_type_orchid + } + } + 10 = { + # Europe or Asia + modifier = { + factor = 0 + $LOCATION$ = { + NOR = { + geographical_region = world_europe_south + geographical_region = world_africa_north + geographical_region = world_asia_minor + geographical_region = world_middle_east + geographical_region = world_steppe + } + } + } + save_scope_value_as = { + name = flower_species + value = flag:flower_type_poppy + } + } + 10 = { + # Asia + modifier = { + factor = 0 + $LOCATION$ = { + NOR = { + geographical_region = world_asia_minor + geographical_region = world_middle_east + geographical_region = world_steppe_west + } + } + } + save_scope_value_as = { + name = flower_species + value = flag:flower_type_tulip + } + } + 10 = { + # Mediterranean sea + arid Asia + modifier = { + factor = 0 + $LOCATION$ = { + NOR = { + geographical_region = world_europe_south + geographical_region = world_africa_north + geographical_region = world_asia_minor + geographical_region = world_middle_east + geographical_region = world_steppe + } + } + } + save_scope_value_as = { + name = flower_species + value = flag:flower_type_crocus + } + } + 10 = { + # Europe, North Africa + parts of Asia + modifier = { + factor = 0 + $LOCATION$ = { + NOR = { + geographical_region = world_europe + geographical_region = world_africa_north + geographical_region = world_asia_minor + geographical_region = world_middle_east + geographical_region = world_steppe + } + } + } + save_scope_value_as = { + name = flower_species + value = flag:flower_type_narcissus + } + } + 10 = { + # Africa + parts of Asia + modifier = { + factor = 0 + $LOCATION$ = { + NOR = { + geographical_region = world_india + geographical_region = world_middle_east + geographical_region = world_africa_west + geographical_region = world_africa_east + } + } + } + save_scope_value_as = { + name = flower_species + value = flag:flower_type_hibiscus + } + } + 10 = { + # parts of Africa + India + modifier = { + factor = 0 + $LOCATION$ = { + NOR = { + geographical_region = world_india + geographical_region = world_africa_west + geographical_region = world_africa_east + } + } + } + save_scope_value_as = { + name = flower_species + value = flag:flower_type_gardenia + } + } + 10 = { + # parts of Asia + modifier = { + factor = 0 + $LOCATION$ = { + NOR = { + geographical_region = world_steppe_east + geographical_region = world_steppe_tarim + geographical_region = world_himalaya + geographical_region = world_india + } + } + } + save_scope_value_as = { + name = flower_species + value = flag:flower_type_lotus + } + } + 10 = { + # parts of Asia + modifier = { + factor = 0 + $LOCATION$ = { + NOR = { + geographical_region = world_steppe_east + geographical_region = world_steppe_tarim + geographical_region = world_himalaya + geographical_region = world_india + } + } + } + save_scope_value_as = { + name = flower_species + value = flag:flower_type_chrysanthemum + } + } + 10 = { + # parts of Asia + modifier = { + factor = 0 + $LOCATION$ = { + NOR = { + geographical_region = world_india + geographical_region = world_middle_east + geographical_region = world_asia_minor + geographical_region = world_steppe_west + } + } + } + save_scope_value_as = { + name = flower_species + value = flag:flower_type_jasmine + } + } + 10 = { + # Europe, Africa, and parts of Asia + modifier = { + factor = 0 + $LOCATION$ = { + NOR = { + geographical_region = world_europe + geographical_region = world_middle_east + geographical_region = world_asia_minor + geographical_region = world_steppe + geographical_region = world_africa + } + } + } + save_scope_value_as = { + name = flower_species + value = flag:flower_type_delphinium + } + } + 10 = { + # Europe and Asia + modifier = { + factor = 0 + $LOCATION$ = { + NOR = { + geographical_region = world_europe + geographical_region = world_middle_east + geographical_region = world_asia_minor + geographical_region = world_steppe_west + } + } + } + save_scope_value_as = { + name = flower_species + value = flag:flower_type_violet + } + } + 10 = { + # Europe and Asia + modifier = { + factor = 0 + $LOCATION$ = { + NOR = { + geographical_region = world_europe + geographical_region = world_middle_east + geographical_region = world_asia_minor + geographical_region = world_steppe_west + } + } + } + save_scope_value_as = { + name = flower_species + value = flag:flower_type_peony + } + } + 10 = { + # Europe and Asia + modifier = { + factor = 0 + $LOCATION$ = { + NOR = { + geographical_region = world_europe + geographical_region = world_middle_east + geographical_region = world_asia_minor + geographical_region = world_steppe + } + } + } + save_scope_value_as = { + name = flower_species + value = flag:flower_type_lavender + } + } + 10 = { + # Europe and Asia + modifier = { + factor = 0 + $LOCATION$ = { + NOR = { + geographical_region = world_europe + geographical_region = world_middle_east + geographical_region = world_asia_minor + geographical_region = world_steppe + geographical_region = world_india + } + } + } + save_scope_value_as = { + name = flower_species + value = flag:flower_type_lily + } + } + 10 = { + # Europe and parts of Asia + modifier = { + factor = 0 + $LOCATION$ = { + NOR = { + geographical_region = world_europe + geographical_region = world_middle_east + geographical_region = world_asia_minor + geographical_region = world_steppe + } + } + } + save_scope_value_as = { + name = flower_species + value = flag:flower_type_geranium + } + } + 10 = { + # Europe and parts of Asia + modifier = { + factor = 0 + $LOCATION$ = { + NOR = { + geographical_region = world_europe + geographical_region = world_middle_east + geographical_region = world_asia_minor + geographical_region = world_steppe + } + } + } + save_scope_value_as = { + name = flower_species + value = flag:flower_type_iris + } + } + 10 = { + # Europe and parts of Asia + modifier = { + factor = 0 + $LOCATION$ = { + NOR = { + geographical_region = world_europe + geographical_region = world_middle_east + geographical_region = world_asia_minor + geographical_region = world_steppe_west + geographical_region = world_africa_north + } + } + } + save_scope_value_as = { + name = flower_species + value = flag:flower_type_foxglove + } + } + 10 = { + # Southern Europe and Northen Africa + modifier = { + factor = 0 + $LOCATION$ = { + NOR = { + geographical_region = world_europe_south + geographical_region = world_africa_north + } + } + } + save_scope_value_as = { + name = flower_species + value = flag:flower_type_carnation + } + } + 10 = { + # Southern Europe and Northen Africa + modifier = { + factor = 0 + $LOCATION$ = { + NOR = { + geographical_region = world_europe_south + geographical_region = world_africa_north + } + } + } + save_scope_value_as = { + name = flower_species + value = flag:flower_type_snapdragon + } + } + } + } +} + +create_artifact_pressed_flower_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + scope:owner = { save_scope_as = creator } + hidden_effect = { + # Get artifact quality and wealth + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + #Get flower + get_animal_hunt_location_effect = yes #not hunting, but need the location in a similar way + } + + # Create the artifact + scope:owner = { + if = { + limit = { + exists = scope:flower_picker + } + hidden_effect = { + get_pressed_flower_species_effect = { LOCATION = scope:flower_picker.location } + } + # Create the artifact + create_artifact = { + name = artifact_pressed_flower_name + description = placeholder #properly set later + creator = scope:flower_picker + visuals = flowers + type = miscellaneous + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else = { + hidden_effect = { + get_pressed_flower_species_effect = { LOCATION = scope:owner.location } + } + # Create the artifact + create_artifact = { + name = artifact_pressed_flower_name + description = placeholder #properly set later + creator = scope:owner + visuals = flowers + type = miscellaneous + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + } + + + + + hidden_effect_new_object = { + scope:newly_created_artifact = { + #Loc + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_pressed_flower_description + remove_artifact_modifier = artifact_placeholder_modifier + add_scaled_artifact_modifier_minor_prestige_effect = yes + + # If the average wealth/quality of the artifact is above 75, add 2nd tier fertility bonus + + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_fertility_gain_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_fertility_gain_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_fertility_gain_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_fertility_gain_1_modifier + } + + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + set_variable = { + name = flower_species + value = scope:flower_species + } + } + } +} + +# Currently just armillary spheres, but can be added to in future. +roll_scientific_apparatus_effect = { + random_list = { + 100 = { + trigger = { + eligible_for_scientific_apparatus_armillary_sphere_trigger = { CHARACTER = $CHARACTER$ } + } + save_scope_value_as = { + name = artefact_scientific_apparatus_type + value = flag:artisan_type_scientific_apparatus + } + } + } +} + +#### HOW TO generate_trinket_effect #### +#Use this template to make the generate_trinket_effect work +# generate_trinket_effect = { +# TRINKET_RECEIVER = scope:your_receiving_character +# TRINKET_GIVER = scope:your_giving_character +# GRAB_ALL_TRINKETS = yes/no +# HISTORY_TYPE = given_unknown/given/discovered_for/stolen_unknown/stolen/created_unknown/created/inherited_unknown/inherited/reforged/conquest/taken_in_siege +# } +#==================================== +#TRINKET_RECEIVER/TRINKET_GIVER - if you don't have a giver and/or receiver, set the same character as both +#GRAB_ALL_TRINKETS - if you are not discerned with what trinkets you generate, put this as a "yes". Otherwise put it as a "no" and set your own flags. +#If you _are_ discerning and you want to choose which trinkets you want to be able to generate: +# > Set an add_character_flag = { flag = used_in_stewardship_general.2001 } on your TRINKET_RECEIVER-character +# > Refer to this flag in the trigger of the trinket below +# > Remember to remove_character_flag = used_in_stewardship_general.2001 in your after = { ... } +#HISTORY_TYPE - pick one that fits the interaction in which you get the trinket +#==================================== +generate_trinket_effect = { + $TRINKET_RECEIVER$ = { save_scope_as = trinket_receiver } + $TRINKET_GIVER$ = { save_scope_as = trinket_giver } + scope:trinket_receiver = { + set_variable = { + name = grab_all_trinkets + value = flag:$GRAB_ALL_TRINKETS$ + } + } + random_list = { + #BAD + ##Bad 01 + ###Gilded Rat's Tail + 80 = { + #TRIGGERS + trigger = { + scope:trinket_receiver = { + OR = { + ##If we are flagged to grab all trinkets + var:grab_all_trinkets ?= flag:yes + ##stewardship_general.2001 + ###Let's not get trash if we outwitted the merchant + AND = { + has_character_flag = used_in_stewardship_general.2001 + NOT = { has_character_flag = free_outcome_stewardship_general.2001 } + } + ##^^Add more/other trigger flags above^^## + } + } + } + #MODIFIERS + ##stewardship_general.2001 + ###We didn't choose the CHEAP option + modifier = { + scope:trinket_receiver = { + OR = { + has_character_flag = expensive_option_stewardship_general.2001 + has_character_flag = helpful_option_stewardship_general.2001 + } + } + add = -25 + } + ###We have extremely high stewardship skill + modifier = { + scope:trinket_receiver = { has_character_flag = has_extremely_high_stewardship_skill_stewardship_general.2001 } + add = -25 + } + ##^^Add more/other modifier flags above^^## + #DO NOT edit this part## + create_artifact = { + name = gilded_rats_tail + description = gilded_rats_tail.desc + type = miscellaneous + visuals = ring + modifier = artifact_monthly_prestige_penalty_modifier + modifier = artifact_child_opinion_1_modifier + save_scope_as = new_trinket + wealth = 5 + quality = 5 + max_durability = 10 + generate_history = no + } + scope:new_trinket = { + flag_as_trash_artifact = yes + #The AI probably shouldn't want this bad trinket + flag_as_unwanted_artifact = yes + } + } + ##Bad 02 + ###Quail's Eggshell 'Gem' + 80 = { + #TRIGGERS + trigger = { + scope:trinket_receiver = { + OR = { + ##If we are flagged to grab all trinkets + var:grab_all_trinkets ?= flag:yes + ##stewardship_general.2001 + ###Let's not get trash if we outwitted the merchant + AND = { + has_character_flag = used_in_stewardship_general.2001 + NOT = { has_character_flag = free_outcome_stewardship_general.2001 } + } + has_character_flag = used_in_mpo_events_ariana_0070 + ##^^Add more/other trigger flags above^^## + } + } + } + #MODIFIERS + ##stewardship_general.2001 + ###We didn't choose the CHEAP option + modifier = { + scope:trinket_receiver = { + OR = { + has_character_flag = expensive_option_stewardship_general.2001 + has_character_flag = helpful_option_stewardship_general.2001 + } + } + add = -25 + } + ###We have extremely high stewardship skill + modifier = { + scope:trinket_receiver = { has_character_flag = has_extremely_high_stewardship_skill_stewardship_general.2001 } + add = -25 + } + ##^^Add more/other modifier flags above^^## + #DO NOT edit this part## + create_artifact = { + name = quail_eggshell_gem + description = quail_eggshell_gem.desc + type = miscellaneous + visuals = diamond + modifier = artifact_monthly_prestige_penalty_modifier + modifier = artifact_fertility_gain_1_modifier + save_scope_as = new_trinket + wealth = 5 + quality = 5 + max_durability = 10 + generate_history = no + } + scope:new_trinket = { + flag_as_trash_artifact = yes + #The AI probably shouldn't want this bad trinket + flag_as_unwanted_artifact = yes + } + } + ##Bad 03 + ###Sanctified 'Stained' Glass Shard + 80 = { + #TRIGGERS + trigger = { + scope:trinket_receiver = { + OR = { + ##If we are flagged to grab all trinkets + var:grab_all_trinkets ?= flag:yes + ##stewardship_general.2001 + ###Let's not get trash if we outwitted the merchant + AND = { + has_character_flag = used_in_stewardship_general.2001 + NOT = { has_character_flag = free_outcome_stewardship_general.2001 } + } + ##^^Add more/other trigger flags above^^## + } + } + } + #MODIFIERS + ##stewardship_general.2001 + ###We didn't choose the CHEAP option + modifier = { + scope:trinket_receiver = { + OR = { + has_character_flag = expensive_option_stewardship_general.2001 + has_character_flag = helpful_option_stewardship_general.2001 + } + } + add = -25 + } + ###We have extremely high stewardship skill + modifier = { + scope:trinket_receiver = { has_character_flag = has_extremely_high_stewardship_skill_stewardship_general.2001 } + add = -25 + } + ##^^Add more/other modifier flags above^^## + #DO NOT edit this part## + create_artifact = { + name = stained_glass_shard + description = stained_glass_shard.desc + type = miscellaneous + visuals = pocket_pouch + modifier = desecrated_artifact_modifier + modifier = artifact_dread_gain_mult_1_modifier + save_scope_as = new_trinket + wealth = 5 + quality = 5 + max_durability = 10 + generate_history = no + } + scope:new_trinket = { + flag_as_trash_artifact = yes + #The AI probably shouldn't want this bad trinket + flag_as_unwanted_artifact = yes + } + } + ##Bad 04 + ###Xylospongium + 80 = { + #TRIGGERS + trigger = { + scope:trinket_receiver = { + OR = { + ##If we are flagged to grab all trinkets + var:grab_all_trinkets ?= flag:yes + ##stewardship_general.2001 + ###Let's not get trash if we outwitted the merchant + AND = { + has_character_flag = used_in_stewardship_general.2001 + NOT = { has_character_flag = free_outcome_stewardship_general.2001 } + } + ##^^Add more/other trigger flags above^^## + } + } + } + #MODIFIERS + ##stewardship_general.2001 + ###We didn't choose the CHEAP option + modifier = { + scope:trinket_receiver = { + OR = { + has_character_flag = expensive_option_stewardship_general.2001 + has_character_flag = helpful_option_stewardship_general.2001 + } + } + add = -25 + } + ###We have extremely high stewardship skill + modifier = { + scope:trinket_receiver = { has_character_flag = has_extremely_high_stewardship_skill_stewardship_general.2001 } + add = -25 + } + ##^^Add more/other modifier flags above^^## + #DO NOT edit this part## + create_artifact = { + name = xylospongium + description = xylospongium.desc + type = miscellaneous + visuals = pocket_basic_case + modifier = artifact_health_penalty_1_modifier + modifier = artifact_child_opinion_2_modifier + save_scope_as = new_trinket + wealth = 5 + quality = 5 + max_durability = 10 + generate_history = no + } + scope:new_trinket = { + flag_as_trash_artifact = yes + #The AI probably shouldn't want this bad trinket + flag_as_unwanted_artifact = yes + } + } + #COMMON + ##Common 01 + ###St David's Morsel + 45 = { + #TRIGGERS + trigger = { + scope:trinket_receiver = { + OR = { + ##If we are flagged to grab all trinkets + var:grab_all_trinkets ?= flag:yes + ##stewardship_general.2001 + has_character_flag = used_in_stewardship_general.2001 + ##bp1_yearly.1021 + has_character_flag = 1021_token + + ##^^Add more/other trigger flags above^^## + } + } + } + #MODIFIERS + ##stewardship_general.2001 + ###More likely if we have our chaplain to help and chose the helpful option + modifier = { + scope:trinket_receiver = { + has_character_flag = helpful_option_stewardship_general.2001 + has_character_flag = has_helpful_chaplain_stewardship_general.2001 + } + add = 20 + } + ###Less likely if we already have a morsel + modifier = { + scope:trinket_receiver = { + any_character_artifact = { has_variable = st_davids_morsel_trinket } + } + add = -40 + } + ##^^Add more/other trigger flags above^^## + #DO NOT edit this part## + create_artifact = { + name = st_davids_morsel + description = st_davids_morsel.desc + type = miscellaneous + visuals = pocket_fancy_case + modifier = artifact_clergy_opinion_1_modifier + modifier = artifact_zealot_vassal_opinion_2_modifier + save_scope_as = new_trinket + wealth = 15 + quality = 15 + max_durability = 30 + generate_history = no + } + scope:new_trinket = { + set_variable = st_davids_morsel_trinket + flag_as_trash_artifact = yes + } + } + ##Common 02 + ###Platypus Figurine + 35 = { + #TRIGGERS + trigger = { + scope:trinket_receiver = { + ##If we don't already have a platypus figurine in our inventory + NOT = { + any_character_artifact = { has_variable = platypus_trinket } + } + OR = { + ##If we are flagged to grab all trinkets + var:grab_all_trinkets ?= flag:yes + ##stewardship_general.2001 + has_character_flag = used_in_stewardship_general.2001 + + ##^^Add more/other trigger flags above^^## + } + } + } + #MODIFIERS + ##^^Add more/other modifier flags above^^## + #DO NOT edit this part## + create_artifact = { + name = platypus_figurine + description = platypus_figurine.desc + type = miscellaneous + visuals = pocket_figurine + modifier = artifact_stress_gain_2_modifier + modifier = artifact_scheme_resistance_add_2_modifier + save_scope_as = new_trinket + wealth = 25 + quality = 25 + max_durability = 30 + history = { + type = created_before_history + } + } + scope:new_trinket = { + set_variable = platypus_trinket + } + } + ##Common 03 + ###Terracotta Toy Fowl + 55 = { + #TRIGGERS + trigger = { + scope:trinket_receiver = { + OR = { + ##If we are flagged to grab all trinkets + var:grab_all_trinkets ?= flag:yes + ##stewardship_general.2001 + has_character_flag = used_in_stewardship_general.2001 + ##bp1_yearly.1021 + has_character_flag = 1021_token + + ##Add more/other trigger flags below + } + } + } + #MODIFIERS + ##stewardship_general.2001 + ###Less likely if we have our steward to help and chose the helpful option + modifier = { + scope:trinket_receiver = { + has_character_flag = helpful_option_stewardship_general.2001 + has_character_flag = has_helpful_steward_stewardship_general.2001 + } + add = -25 + } + ###Less likely if we already have a Terracotta Toy Fowl + modifier = { + scope:trinket_receiver = { + any_character_artifact = { has_variable = terracotta_toy_fowl_trinket } + } + add = -50 + } + ##^^Add more/other modifier flags above^^## + #DO NOT edit this part## + create_artifact = { + name = terracotta_toy_fowl + description = terracotta_toy_fowl.desc + type = miscellaneous + visuals = pocket_figurine + modifier = artifact_monthly_prestige_1_modifier + modifier = artifact_learning_1_modifier + save_scope_as = new_trinket + wealth = 15 + quality = 15 + max_durability = 30 + generate_history = no + } + scope:new_trinket = { + set_variable = terracotta_toy_fowl_trinket + flag_as_trash_artifact = yes + } + } + ##Common 04 + ###Potsherd + 65 = { + #TRIGGERS + trigger = { + scope:trinket_receiver = { + OR = { + ##If we are flagged to grab all trinkets + var:grab_all_trinkets ?= flag:yes + ##stewardship_general.2001 + has_character_flag = used_in_stewardship_general.2001 + ##bp1_yearly.1021 + has_character_flag = 1021_token + + ##Add more/other trigger flags below + } + } + } + #MODIFIERS + ##stewardship_general.2001 + ###More likely if we have our chaplain to help and chose the helpful option + modifier = { + scope:trinket_receiver = { + has_character_flag = helpful_option_stewardship_general.2001 + has_character_flag = has_helpful_chaplain_stewardship_general.2001 + } + add = 20 + } + ###Less likely if we already have a Potsherd + modifier = { + scope:trinket_receiver = { + any_character_artifact = { has_variable = potsherd_trinket } + } + add = -60 + } + ##^^Add more/other modifier flags above^^## + #DO NOT edit this part## + faith = { + random_holy_site = { save_scope_as = trinket_holy_site } + } + create_artifact = { + name = stewardship_general.2001.artifact.potsherd_holy + description = stewardship_general.2001.artifact.potsherd_holy.desc + type = miscellaneous + visuals = rock + modifier = artifact_clergy_opinion_1_modifier + modifier = artifact_zealot_vassal_opinion_2_modifier + save_scope_as = new_trinket + wealth = 15 + quality = 15 + max_durability = 30 + generate_history = no + } + scope:new_trinket = { + set_variable = potsherd_trinket + flag_as_trash_artifact = yes + } + } + ##Common 05 + ###Small Bell Beaker + 45 = { + #TRIGGERS + trigger = { + scope:trinket_receiver = { + OR = { + ##If we are flagged to grab all trinkets + var:grab_all_trinkets ?= flag:yes + ##stewardship_general.2001 + has_character_flag = used_in_stewardship_general.2001 + ##bp1_yearly.1021 + has_character_flag = 1021_token + has_character_flag = used_in_mpo_events_ariana_0070 + ##^^Add more/other trigger flags above^^## + } + } + } + #MODIFIERS + ##stewardship_general.2001 + ###Less likely if we have extremely high stewardship or took the helpful councillor option + modifier = { + scope:trinket_receiver = { + OR = { + has_character_flag = helpful_option_stewardship_general.2001 + has_character_flag = has_extremely_high_stewardship_skill_stewardship_general.2001 + } + } + add = -25 + } + ###Less likely if we already have a Small Bell Beaker + modifier = { + scope:trinket_receiver = { + any_character_artifact = { has_variable = small_bell_beaker_trinket } + } + add = -40 + } + ##^^Add more/other modifier flags above^^## + #DO NOT edit this part## + create_artifact = { + name = small_bell_beaker + description = small_bell_beaker.desc + type = miscellaneous + visuals = pocket_goblet + modifier = artifact_monthly_prestige_1_modifier + modifier = artifact_learning_1_modifier + save_scope_as = new_trinket + wealth = 15 + quality = 15 + max_durability = 30 + generate_history = no + } + scope:new_trinket = { + set_variable = small_bell_beaker_trinket + flag_as_trash_artifact = yes + } + } + ##Common 06 + ###Serpentine Budai + 45 = { + #TRIGGERS + trigger = { + scope:trinket_receiver = { + OR = { + ##If we are flagged to grab all trinkets + var:grab_all_trinkets ?= flag:yes + ##stewardship_general.2001 + has_character_flag = used_in_stewardship_general.2001 + ##bp1_yearly.1021 + has_character_flag = 1021_token + + ##^^Add more/other trigger flags above^^## + } + } + } + #MODIFIERS + ##stewardship_general.2001 + ###Less likely if we have extremely high stewardship or took the helpful councillor option + modifier = { + scope:trinket_receiver = { + OR = { + has_character_flag = helpful_option_stewardship_general.2001 + has_character_flag = has_extremely_high_stewardship_skill_stewardship_general.2001 + } + } + add = -25 + } + ###Less likely if we already have a Serpentine Budai + modifier = { + scope:trinket_receiver = { + any_character_artifact = { has_variable = serpentine_budai_trinket } + } + add = -40 + } + ##^^Add more/other modifier flags above^^## + #DO NOT edit this part## + create_artifact = { + name = serpentine_budai + description = serpentine_budai.desc + type = miscellaneous + visuals = pocket_figurine + modifier = artifact_stress_gain_1_modifier + modifier = artifact_different_faith_opinion_4_modifier + save_scope_as = new_trinket + wealth = 15 + quality = 15 + max_durability = 30 + generate_history = no + } + scope:new_trinket = { + set_variable = serpentine_budai_trinket + flag_as_trash_artifact = yes + } + } + #UNCOMMON + ##Uncommon 01 + ###'s Horn + 40 = { + #TRIGGERS + trigger = { + scope:trinket_receiver = { + OR = { + ##If we are flagged to grab all trinkets + var:grab_all_trinkets ?= flag:yes + ##stewardship_general.2001 + has_character_flag = used_in_stewardship_general.2001 + ##feast_default.1016 + has_character_flag = used_in_feast_default.1016 + ##bp1_yearly.1021 + has_character_flag = 1021_token + + ##^^Add more/other trigger flags above^^## + } + } + } + #MODIFIERS + ##stewardship_general.2001 + ###More likely if we have our steward to help and chose the helpful option + modifier = { + scope:trinket_receiver = { + has_character_flag = helpful_option_stewardship_general.2001 + has_character_flag = has_helpful_steward_stewardship_general.2001 + } + add = 30 + } + ###Less likely if we already have a Mythical Horn + modifier = { + scope:trinket_receiver = { + any_character_artifact = { has_variable = mythical_horn_trinket } + } + add = -35 + } + ##^^Add more/other modifier flags above^^## + #DO NOT edit this part## + set_up_horned_mythical_creature_effect = yes + create_artifact = { + name = mythical_creature_horn + description = mythical_creature_horn.desc + type = miscellaneous + visuals = pocket_tusk + modifier = artifact_fertility_gain_2_modifier + modifier = artifact_spouse_opinion_add_2_modifier + save_scope_as = new_trinket + wealth = 45 + quality = 45 + max_durability = 60 + generate_history = no + } + scope:new_trinket = { + set_variable = mythical_horn_trinket + } + } + ##Uncommon 02 + ### Figurine + 40 = { + #TRIGGERS + trigger = { + scope:trinket_receiver = { + OR = { + ##If we are flagged to grab all trinkets + var:grab_all_trinkets ?= flag:yes + ##stewardship_general.2001 + has_character_flag = used_in_stewardship_general.2001 + ##feast_default.1016 + has_character_flag = used_in_feast_default.1016 + ##bp1_yearly.1021 + has_character_flag = 1021_token + + ##^^Add more/other trigger flags above^^## + } + } + } + #MODIFIERS + ###Less likely if we already have a Mythical Figurine + modifier = { + scope:trinket_receiver = { + any_character_artifact = { has_variable = mythical_creature_figurine_trinket } + } + add = -35 + } + ##^^Add more/other modifier flags above^^## + #DO NOT edit this part## + set_up_trinket_adjective_effect = yes + set_up_regional_mythical_creature_effect = yes + create_artifact = { + name = mythical_creature_figurine + description = mythical_creature_figurine.desc + type = miscellaneous + visuals = pocket_figurine + modifier = artifact_monthly_learning_lifestyle_xp_1_modifier + modifier = artifact_learning_1_modifier + modifier = artifact_health_gain_1_modifier + save_scope_as = new_trinket + wealth = 45 + quality = 45 + max_durability = 60 + generate_history = no + } + scope:new_trinket = { + set_variable = mythical_creature_figurine_trinket + } + } + ##Uncommon 03 + ###St David's Taper + 30 = { + #TRIGGERS + trigger = { + scope:trinket_receiver = { + ##If we don't already have a St David's Taper in our inventory + NOT = { + any_character_artifact = { has_variable = st_davids_taper_trinket } + } + OR = { + ##If we are flagged to grab all trinkets + var:grab_all_trinkets ?= flag:yes + ##stewardship_general.2001 + AND = { + ###Only if we have our chaplain to help and chose the helpful option + has_character_flag = has_helpful_chaplain_stewardship_general.2001 + has_character_flag = helpful_option_stewardship_general.2001 + } + ##feast_default.1016 + has_character_flag = used_in_feast_default.1016 + + ##^^Add more/other trigger flags above^^## + } + } + } + #MODIFIERS + ##^^Add more/other modifier flags above^^## + #DO NOT edit this part## + create_artifact = { + name = st_davids_taper + description = st_davids_taper.desc + type = miscellaneous + visuals = pocket_basic_case + modifier = artifact_monthly_piety_1_modifier + modifier = artifact_health_gain_1_modifier + modifier = artifact_zealot_vassal_opinion_2_modifier + save_scope_as = new_trinket + wealth = 45 + quality = 45 + max_durability = 60 + generate_history = no + } + scope:new_trinket = { + set_variable = st_davids_taper_trinket + } + } + ##Uncommon 04 + ###Marble Stick of J'Ira + 30 = { + #TRIGGERS + trigger = { + scope:trinket_receiver = { + ##If we don't already have a Jira poking stick in our inventory + NOT = { + any_character_artifact = { has_variable = jira_stick_trinket } + } + OR = { + ##If we are flagged to grab all trinkets + var:grab_all_trinkets ?= flag:yes + ##stewardship_general.2001 + has_character_flag = used_in_stewardship_general.2001 + ##feast_default.1016 + has_character_flag = used_in_feast_default.1016 + ##bp1_yearly.1021 + has_character_flag = 1021_token + + ##^^Add more/other trigger flags above^^## + } + } + } + #MODIFIERS + modifier = { + scope:trinket_receiver = { has_character_flag = less_than_decent_learning_stewardship_general.2001 } + add = 30 + } + ##^^Add more/other modifier flags above^^## + #DO NOT edit this part## + create_artifact = { + name = jira_stick + description = jira_stick.desc + type = miscellaneous + visuals = regalia + template = regalia_template + modifier = artifact_monthly_learning_lifestyle_xp_1_modifier + modifier = artifact_learning_1_modifier + modifier = artifact_prowess_2_modifier + save_scope_as = new_trinket + wealth = 45 + quality = 45 + max_durability = 60 + generate_history = no + } + scope:new_trinket = { + set_variable = jira_stick_trinket + } + } + ##Uncommon 05 + ###Lucky Coin + 40 = { + #TRIGGERS + trigger = { + scope:trinket_receiver = { + OR = { + ##If we are flagged to grab all trinkets + var:grab_all_trinkets ?= flag:yes + ##stewardship_general.2001 + has_character_flag = used_in_stewardship_general.2001 + ##feast_default.1016 + has_character_flag = used_in_feast_default.1016 + ##bp1_yearly.1021 + has_character_flag = 1021_token + has_character_flag = used_in_mpo_events_ariana_0070 + ##^^Add more/other trigger flags above^^## + } + } + } + #MODIFIERS + ##stewardship_general.2001 + ###More likely if we have extremely high stewardship or took the expensive option + modifier = { + scope:trinket_receiver = { + OR = { + has_character_flag = expensive_option_stewardship_general.2001 + has_character_flag = has_extremely_high_stewardship_skill_stewardship_general.2001 + } + } + add = 25 + } + ###More likely if we have our steward to help and chose the helpful option + modifier = { + scope:trinket_receiver = { + has_character_flag = helpful_option_stewardship_general.2001 + has_character_flag = has_helpful_steward_stewardship_general.2001 + } + add = 30 + } + ###Less likely if we already have a lucky coin + modifier = { + scope:trinket_receiver = { + any_character_artifact = { has_variable = lucky_coin_trinket } + } + add = -35 + } + ##^^Add more/other modifier flags above^^## + #DO NOT edit this part## + create_artifact = { + name = lucky_coin + description = lucky_coin.desc + type = miscellaneous + visuals = medallion + modifier = artifact_monthly_stewardship_lifestyle_xp_1_modifier + modifier = artifact_domain_tax_mult_2_modifier + modifier = artifact_stewardship_per_stress_level_1_modifier + save_scope_as = new_trinket + wealth = 45 + quality = 45 + max_durability = 60 + generate_history = no + } + scope:new_trinket = { + set_variable = lucky_coin_trinket + } + } + ##Uncommon 06 + ###Lavender Jade Pendant + 40 = { + #TRIGGERS + trigger = { + scope:trinket_receiver = { + ##If we don't already have a Lavender Jade Pendant in our inventory + NOT = { + any_character_artifact = { has_variable = lavender_jade_pendant_trinket } + } + OR = { + ##If we are flagged to grab all trinkets + var:grab_all_trinkets ?= flag:yes + ##stewardship_general.2001 + has_character_flag = used_in_stewardship_general.2001 + ##feast_default.1016 + has_character_flag = used_in_feast_default.1016 + ##bp1_yearly.1021 + has_character_flag = 1021_token + has_character_flag = used_in_mpo_events_ariana_0070 + ##^^Add more/other trigger flags above^^## + } + } + } + #MODIFIERS + ##^^Add more/other modifier flags above^^## + #DO NOT edit this part## + create_artifact = { + name = lavender_jade_pendant + description = lavender_jade_pendant.desc + type = miscellaneous + visuals = necklace + modifier = artifact_monthly_piety_2_modifier + modifier = artifact_monthly_piety_from_buildings_mult_3_modifier + save_scope_as = new_trinket + wealth = 45 + quality = 45 + max_durability = 60 + generate_history = no + } + scope:new_trinket = { + set_variable = lavender_jade_pendant_trinket + } + } + #RARE - 1/35 with no modifiers + ##Rare 01 + ###Old Signet Ring + 20 = { + #TRIGGERS + trigger = { + scope:trinket_receiver = { + ##If we don't already have the Ring of Sekhmet in our inventory + NOT = { + any_character_artifact = { has_variable = sekhmet_ring_trinket } + } + OR = { + ##If we are flagged to grab all trinkets + var:grab_all_trinkets ?= flag:yes + ##stewardship_general.2001 + ###If we have extremely high stewardship skill + has_character_flag = has_extremely_high_stewardship_skill_stewardship_general.2001 + ##feast_default.1016 + has_character_flag = used_in_feast_default.1016 + ##bp1_yearly.1021 + has_character_flag = 1021_token + has_character_flag = used_in_mpo_events_ariana_0070 + ##^^Add more/other trigger flags above^^## + } + } + } + #MODIFIERS + ##stewardship_general.2001 + ###Less likely if we took the cheap option + modifier = { + scope:trinket_receiver = { has_character_flag = cheap_option_stewardship_general.2001 } + add = -25 + } + ##^^Add more/other modifier flags above^^## + #DO NOT edit this part## + create_artifact = { + name = sekhmet_ring + description = sekhmet_ring.desc + type = miscellaneous + visuals = ring + modifier = artifact_monthly_prestige_2_modifier + modifier = artifact_monthly_stewardship_lifestyle_xp_1_modifier + modifier = artifact_stewardship_1_modifier + modifier = artifact_monthly_dynasty_prestige_3_modifier + save_scope_as = new_trinket + wealth = 65 + quality = 65 + history = { + type = created_before_history + } + } + scope:new_trinket = { + set_variable = sekhmet_ring_trinket + } + } + ##Rare 02 + ###Ancient Scarab Brooch + 20 = { + #TRIGGERS + trigger = { + scope:trinket_receiver = { + ##If we don't already have the Ancient Scarab Brooch in our inventory + NOT = { + any_character_artifact = { has_variable = ancient_scarab_brooch_trinket } + } + OR = { + ##If we are flagged to grab all trinkets + var:grab_all_trinkets ?= flag:yes + ##stewardship_general.2001 + ###If we have extremely high stewardship skill, took the expensive option or had a helpful councillor + has_character_flag = has_extremely_high_stewardship_skill_stewardship_general.2001 + has_character_flag = expensive_option_stewardship_general.2001 + AND = { + has_character_flag = has_helpful_chaplain_stewardship_general.2001 + has_character_flag = helpful_option_stewardship_general.2001 + } + ##feast_default.1016 + has_character_flag = used_in_feast_default.1016 + ##bp1_yearly.1021 + has_character_flag = 1021_token + + ##^^Add more/other trigger flags above^^## + } + } + } + #MODIFIERS + ##^^Add more/other modifier flags above^^## + #DO NOT edit this part## + create_artifact = { + name = scarab_brooch + description = scarab_brooch.desc + type = miscellaneous + visuals = brooch + modifier = artifact_health_gain_2_modifier + modifier = artifact_fertility_gain_2_modifier + modifier = artifact_negate_health_penalty_add_2_modifier + modifier = artifact_prowess_3_modifier + save_scope_as = new_trinket + wealth = 65 + quality = 65 + history = { + type = created_before_history + } + } + scope:new_trinket = { + set_variable = ancient_scarab_brooch_trinket + } + } + } + if = { + limit = { exists = scope:new_trinket } + #Set up history + scope:new_trinket = { + #Check what our history is + save_scope_value_as = { + name = artifact_history + value = flag:$HISTORY_TYPE$ + } + ##Given to scope:trinket_receiver + if = { + limit = { + exists = scope:artifact_history + scope:artifact_history = flag:given_unknown + } + add_artifact_history = { + type = given + actor = scope:trinket_receiver #Having the receiver in both generates the CoA on the right-hand side of the entry + recipient = scope:trinket_receiver + } + } + ##Given to scope:trinket_receiver (scope:trinket_giver is the left-hand portrait) + else_if = { + limit = { + exists = scope:artifact_history + scope:artifact_history = flag:given + } + add_artifact_history = { + type = given + actor = scope:trinket_giver + recipient = scope:trinket_receiver + } + } + ##Discovered by scope:trinket_giver for scope:trinket_receiver at scope:trinket_giver.location + else_if = { + limit = { + exists = scope:artifact_history + scope:artifact_history = flag:discovered + } + add_artifact_history = { + type = discovered + actor = scope:trinket_giver + recipient = scope:trinket_receiver + location = scope:trinket_giver.location + } + } + ##Stolen by scope:trinket_receiver (scope:trinket_receiver's Coat of Arms is the right-hand portrait) + else_if = { + limit = { + exists = scope:artifact_history + scope:artifact_history = flag:stolen_unknown + } + add_artifact_history = { + type = stolen + actor = scope:trinket_receiver + recipient = scope:trinket_receiver + } + } + ##Stolen by scope:trinket_receiver (scope:trinket_giver is the right-hand portrait) + else_if = { + limit = { + exists = scope:artifact_history + scope:artifact_history = flag:stolen + } + add_artifact_history = { + type = stolen + actor = scope:trinket_giver + recipient = scope:trinket_receiver + } + } + ##Created by an unknown benefactor for scope:trinket_receiver at scope:trinket_receiver.location + else_if = { + limit = { + exists = scope:artifact_history + scope:artifact_history = flag:created_unknown + } + add_artifact_history = { + type = created + recipient = scope:trinket_receiver + location = scope:trinket_receiver.location + } + } + ##Created by scope:trinket_giver for scope:trinket_receiver at scope:trinket_receiver.location + else_if = { + limit = { + exists = scope:artifact_history + scope:artifact_history = flag:created + } + add_artifact_history = { + type = created + actor = scope:trinket_giver + recipient = scope:trinket_receiver + location = scope:trinket_receiver.location + } + } + ##Inherited by scope:trinket_receiver + else_if = { + limit = { + exists = scope:artifact_history + scope:artifact_history = flag:inherited_unknown + } + add_artifact_history = { + type = inherited + actor = scope:trinket_receiver + recipient = scope:trinket_receiver + } + } + #Inherited by scope:trinket_receiver + else_if = { + limit = { + exists = scope:artifact_history + scope:artifact_history = flag:inherited + } + add_artifact_history = { + type = inherited + actor = scope:trinket_giver + recipient = scope:trinket_receiver + } + } + ##Reforged by scope:trinket_receiver in scope:trinket_receiver.location + else_if = { + limit = { + exists = scope:artifact_history + scope:artifact_history = flag:reforged + } + add_artifact_history = { + type = reforged + recipient = scope:trinket_receiver + location = scope:trinket_receiver.location + } + } + ##Conquered by scope:trinket_receiver in a war against scope:trinket_giver + else_if = { + limit = { + exists = scope:artifact_history + scope:artifact_history = flag:conquest + } + add_artifact_history = { + type = conquest + actor = scope:trinket_giver + recipient = scope:trinket_receiver + } + } + ##Conquered by scope:trinket_receiver after the siege of scope:trinket_giver.location + else_if = { + limit = { + exists = scope:artifact_history + scope:artifact_history = flag:taken_in_siege + } + add_artifact_history = { + type = taken_in_siege + actor = scope:trinket_giver + recipient = scope:trinket_receiver + location = scope:trinket_giver.location + } + } + } + } + #Clean up the grab all flag, in case it was used + scope:trinket_receiver = { + if = { + limit = { exists = var:grab_all_trinkets } + remove_variable = grab_all_trinkets + } + } + #Clean up trinket variables + if = { + limit = { exists = var:horned_mythical_creature } + remove_variable = horned_mythical_creature + } + if = { + limit = { exists = var:regional_mythical_creature_trinket } + remove_variable = regional_mythical_creature_trinket + } + if = { + limit = { exists = var:trinket_adjective_followup } + remove_variable = trinket_adjective_followup + } +} + + +# EP2 +# If the type of weapon hasn't been decided yet we set it here +set_bow_artifact_type_effect = { + save_temporary_scope_value_as = { + name = allow_no_type_option + value = $NO_TYPE$ + } + # Historically many of these types of weapon were used in some combination, but to give a clearer portrayal to the player we have to simplify it a bit + hidden_effect = { + $BASE_SCOPE$ = { + #The type has been decided in events, when the character got inspired, or now. Let's save it! (might still leave it up to the sponsor if allow_no_type_option = yes!) + if = { + limit = { + NOT = { exists = var:artifact_bow_type } + } + random_list = { #What weapon do they want to forge? + 25 = { + trigger = { + culture = { has_cultural_tradition = tradition_longbow_competitions } + } + set_variable = { + name = artifact_bow_type + value = flag:artifact_bow_type_longbow + } + } + 10 = { + trigger = { + culture = { has_innovation = innovation_advanced_bowmaking } + } + set_variable = { + name = artifact_bow_type + value = flag:artifact_bow_type_crossbow + } + } + 5 = { + set_variable = { + name = artifact_bow_type + value = flag:artifact_bow_type_bow + } + } + 25 = { + trigger = { + culture = { is_composite_bow_culture_trigger = yes } + } + set_variable = { + name = artifact_bow_type + value = flag:artifact_bow_type_composite + } + } + 50 = { #They don't care and you can decide! + trigger = { scope:allow_no_type_option = yes } + modifier = { + add = 30 + has_personality_submissive_trigger = yes + } + modifier = { + add = 9890 # ~1% chance of being predetermined if comissioning from a local artisan. + has_character_flag = local_artisan + } + ai_value_modifier = { + ai_boldness = -0.25 + ai_energy = -0.25 + } + # Don't set on creation so that the player has more input on what gets forged in inspiration start events, like fund_inspiration.0015 + } + } + } + } + } +} + +create_artifact_bow_effect = { + # Get the character the artifact is being made for. + # If scope:adventurer exists this will result in the history entry reading that the weapon was discovered instead of made. + $OWNER$ = { save_scope_as = owner } + $CREATOR$ = { save_scope_as = bowyer } + save_temporary_scope_value_as = { + name = bow_type_is_set + value = $SET_BOW_TYPE$ + } + if = { #Any existing dummy character gets turned into the bowyer + limit = { + exists = scope:dummy_gender + scope:bowyer = scope:dummy_gender + } + clear_saved_scope = bowyer + clear_saved_scope = dummy_gender + } + hidden_effect_new_object = { + if = { + limit = { scope:bow_type_is_set = flag:no } + if = { + limit = { exists = scope:bowyer } + set_bow_artifact_type_effect = { + BASE_SCOPE = scope:bowyer + NO_TYPE = no + } + scope:bowyer = { + var:artifact_bow_type = { save_scope_as = bow_type } + remove_variable = artifact_bow_type + } + } + else = { + set_bow_artifact_type_effect = { + BASE_SCOPE = scope:owner + NO_TYPE = no + } + scope:owner = { + var:artifact_bow_type = { save_scope_as = bow_type } + remove_variable = artifact_bow_type + } + } + } + else = { + scope:bow_type_is_set = { save_scope_as = bow_type } + } + # Get artifact quality and wealth. + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + # Get the type of weapon to forge. Defaults to bow if an invalid type is provided. + if = { # Longbow + limit = { scope:bow_type = flag:artifact_bow_type_longbow } + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = artifact_longbow_name + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = longbow + type = longbow + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else_if = { + limit = { + scope:host ?= $OWNER$ + scope:activity ?= { has_activity_type = activity_tournament } + } + tournament_contest_bow_prize_effect = { TYPE = longbow } + } + else_if = { + limit = { exists = scope:bowyer } + create_artifact = { + name = artifact_longbow_name + creator = scope:bowyer + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = longbow + type = longbow + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else = { + create_artifact = { + name = artifact_longbow_name + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = longbow + type = longbow + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + scope:newly_created_artifact = { + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_longbow_description + } + } + else_if = { # Composite + limit = { scope:bow_type = flag:artifact_bow_type_composite } + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = artifact_composite_name + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = composite + type = composite + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else_if = { + limit = { + scope:host ?= $OWNER$ + scope:activity ?= { has_activity_type = activity_tournament } + } + tournament_contest_bow_prize_effect = { TYPE = composite } + } + else_if = { + limit = { exists = scope:bowyer } + create_artifact = { + name = artifact_composite_name + creator = scope:bowyer + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = composite + type = composite + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else = { + create_artifact = { + name = artifact_composite_name + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = composite + type = composite + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + scope:newly_created_artifact = { + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_composite_description + } + } + else_if = { # Crossbow + limit = { scope:bow_type = flag:artifact_bow_type_crossbow } + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = artifact_crossbow_name + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = crossbow + type = crossbow + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else_if = { + limit = { + scope:host ?= $OWNER$ + scope:activity ?= { has_activity_type = activity_tournament } + } + tournament_contest_bow_prize_effect = { TYPE = crossbow } + } + else_if = { + limit = { exists = scope:bowyer } + create_artifact = { + name = artifact_crossbow_name + creator = scope:bowyer + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = crossbow + type = crossbow + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else = { + create_artifact = { + name = artifact_crossbow_name + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = crossbow + type = crossbow + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + scope:newly_created_artifact = { + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_crossbow_description + } + } + else_if = { # Standard + limit = { scope:bow_type = flag:artifact_bow_type_bow } + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = artifact_bow_name + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = bow + type = bow + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else_if = { + limit = { + scope:host ?= $OWNER$ + scope:activity ?= { has_activity_type = activity_tournament } + } + tournament_contest_bow_prize_effect = { TYPE = bow } + } + else_if = { + limit = { exists = scope:smith } + create_artifact = { + name = artifact_bow_name + creator = scope:smith + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = bow + type = bow + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else = { + create_artifact = { + name = artifact_bow_name + description = placeholder # Will be re-generated once decorations are added in the post-creation effects. + visuals = bow + type = bow + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + scope:newly_created_artifact = { + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_bow_description + } + } + scope:newly_created_artifact = { + # Prowess from weapon rarity + add_scaled_artifact_modifier_prowess_effect = yes + add_scaled_artifact_modifier_trait_track_hunter_xp_gain_mult_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + if = { + limit = { scope:bow_type = flag:artifact_bow_type_composite } + add_scaled_artifact_modifier_archer_cavalry_screen_add_effect = yes + } + else_if = { + limit = { scope:bow_type = flag:artifact_bow_type_longbow } + add_scaled_artifact_modifier_archers_screen_add_effect = yes + } + else = { add_2_scaled_artifact_modifier_combat_effect = yes } + } + else_if = { + limit = { + OR = { + rarity = common + rarity = masterwork + } + } + if = { + limit = { scope:bow_type = flag:artifact_bow_type_composite } + add_scaled_artifact_modifier_archer_cavalry_screen_add_effect = yes + } + else_if = { + limit = { scope:bow_type = flag:artifact_bow_type_longbow } + add_scaled_artifact_modifier_archers_screen_add_effect = yes + } + else = { add_2_scaled_artifact_modifier_combat_effect = yes } + } + else_if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + # No decorations + } + if = { + limit = { scope:bow_type = flag:artifact_bow_type_composite } + add_scaled_artifact_modifier_archer_cavalry_screen_add_effect = yes + } + else_if = { + limit = { scope:bow_type = flag:artifact_bow_type_longbow } + add_scaled_artifact_modifier_archers_screen_add_effect = yes + } + else = { add_2_scaled_artifact_modifier_combat_effect = yes } + } + else_if = { + limit = { + rarity = masterwork + # No decorations + } + if = { + limit = { scope:bow_type = flag:artifact_bow_type_composite } + add_scaled_artifact_modifier_archer_cavalry_screen_add_effect = yes + } + else_if = { + limit = { scope:bow_type = flag:artifact_bow_type_longbow } + add_scaled_artifact_modifier_archers_screen_add_effect = yes + } + else = { add_2_scaled_artifact_modifier_combat_effect = yes } + } + else = { add_artifact_modifier = artifact_prowess_no_decorations_modifier } + # Save the quality and wealth of this artifact in case we need to reference it later. + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + } + } +} + +create_artifact_ring_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $SMITH$ = { save_scope_as = goldsmith } + if = { #Any existing dummy character gets turned into the goldsmith + limit = { + exists = scope:dummy_gender + scope:goldsmith = scope:dummy_gender + } + clear_saved_scope = goldsmith + clear_saved_scope = dummy_gender + } + hidden_effect_new_object = { + # Get artifact quality, wealth, materials, and decorations + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + # Create the artifact + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = artifact_ring_name + description = placeholder + visuals = ring + type = ring + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else_if = { + limit = { + scope:host ?= $OWNER$ + scope:activity ?= { has_activity_type = activity_tournament } + } + create_artifact = { + name = artifact_ring_name + creator = scope:host + description = placeholder # Will be updated in the post-creation effects after decorations are assigned. + visuals = ring + type = ring + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + type = prize_created + recipient = scope:host + } + } + } + else_if = { + limit = { + exists = scope:goldsmith + exists = scope:owner + scope:goldsmith = scope:owner + } + create_artifact = { + name = artifact_ring_name + description = placeholder # Will be updated in the post-creation effects after decorations are assigned. + visuals = ring + type = ring + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + history = { + type = created + actor = scope:goldsmith + recipient = scope:goldsmith + location = scope:goldsmith.location + } + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { exists = scope:norman_noble } + create_artifact = { + name = artifact_ring_name + creator = scope:host + description = placeholder # Will be updated in the post-creation effects after decorations are assigned. + visuals = ring + type = ring + modifier = artifact_placeholder_modifier + wealth = 120 + quality = 120 + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { exists = scope:goldsmith } + create_artifact = { + name = artifact_ring_name + creator = scope:goldsmith + description = placeholder # Will be updated in the post-creation effects after decorations are assigned. + visuals = ring + type = ring + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else = { + create_artifact = { + name = artifact_ring_name + description = placeholder # Will be updated in the post-creation effects after decorations are assigned. + visuals = ring + type = ring + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + scope:newly_created_artifact = { + # Finish generating decorations and update description + if = { + limit = { + OR = { + has_artifact_feature = ring_decoration_adornment + has_artifact_feature = ring_decoration_centerpiece_and_adornment + } + } + set_artifact_feature_group = ring_adornment + } + if = { + limit = { + OR = { + has_artifact_feature = ring_decoration_centerpiece + has_artifact_feature = ring_decoration_centerpiece_and_adornment + } + } + set_artifact_feature_group = ring_centerpiece + } + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_ring_description + + # Add artifact modifiers + add_scaled_artifact_modifier_minor_prestige_effect = yes + if = { + limit = { + OR = { + has_artifact_feature = ring_adornment_motto + has_artifact_feature = ring_centerpiece_signet + } + } + add_scaled_artifact_modifier_majesty_effect = yes + } + else = { add_scaled_artifact_modifier_attractiveness_effect = yes } + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_scaled_artifact_modifier_rulership_effect = yes + } + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + } + } +} + +create_artifact_bowl_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $SMITH$ = { save_scope_as = goldsmith } + if = { #Any existing dummy character gets turned into the goldsmith + limit = { + exists = scope:dummy_gender + scope:goldsmith = scope:dummy_gender + } + clear_saved_scope = goldsmith + clear_saved_scope = dummy_gender + } + hidden_effect_new_object = { + # Get artifact quality, wealth, materials, and decorations + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + # Create the artifact + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = artifact_bowl_name + description = placeholder + visuals = bowl + type = bowl + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else_if = { + limit = { + scope:host ?= $OWNER$ + scope:activity ?= { has_activity_type = activity_tournament } + } + create_artifact = { + name = artifact_bowl_name + creator = scope:host + description = placeholder # Will be updated in the post-creation effects after decorations are assigned. + visuals = bowl + type = bowl + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + history = { + type = prize_created + recipient = scope:host + } + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { exists = scope:goldsmith } + create_artifact = { + name = artifact_bowl_name + creator = scope:goldsmith + description = placeholder # Will be updated in the post-creation effects after decorations are assigned. + visuals = bowl + type = bowl + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else = { + create_artifact = { + name = artifact_bowl_name + description = placeholder # Will be updated in the post-creation effects after decorations are assigned. + visuals = bowl + type = bowl + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + + scope:newly_created_artifact = { + # Finish generating decorations and update description + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_bowl_description + # Add artifact modifiers + add_scaled_artifact_modifier_minor_prestige_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_scaled_artifact_modifier_rulership_effect = yes + } + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + } + } +} + +create_artifact_plate_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $SMITH$ = { save_scope_as = goldsmith } + if = { #Any existing dummy character gets turned into the goldsmith + limit = { + exists = scope:dummy_gender + scope:goldsmith = scope:dummy_gender + } + clear_saved_scope = goldsmith + clear_saved_scope = dummy_gender + } + hidden_effect_new_object = { + # Get artifact quality, wealth, materials, and decorations + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + # Create the artifact + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = artifact_plate_name + description = placeholder + visuals = plate + type = plate + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else_if = { + limit = { + scope:host ?= $OWNER$ + scope:activity ?= { has_activity_type = activity_tournament } + } + create_artifact = { + name = artifact_plate_name + creator = scope:host + description = placeholder # Will be updated in the post-creation effects after decorations are assigned. + visuals = plate + type = plate + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + history = { + type = prize_created + recipient = scope:host + } + save_scope_as = newly_created_artifact + } + } + else_if = { + trigger = { exists = scope:goldsmith } + create_artifact = { + name = artifact_plate_name + creator = scope:goldsmith + description = placeholder # Will be updated in the post-creation effects after decorations are assigned. + visuals = plate + type = plate + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else = { + create_artifact = { + name = artifact_plate_name + description = placeholder # Will be updated in the post-creation effects after decorations are assigned. + visuals = plate + type = plate + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + scope:newly_created_artifact = { + # Finish generating decorations and update description + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_plate_description + # Add artifact modifiers + add_scaled_artifact_modifier_minor_prestige_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_scaled_artifact_modifier_rulership_effect = yes + } + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + } + } +} + +create_artifact_urn_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $POTTER$ = { save_scope_as = potter } + if = { #Any existing dummy character gets turned into the potter + limit = { + exists = scope:dummy_gender + scope:potter = scope:dummy_gender + } + clear_saved_scope = potter + clear_saved_scope = dummy_gender + } + hidden_effect_new_object = { + # Get artifact quality, wealth, materials, and decorations + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + # Create the artifact + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = artifact_urn_name + description = placeholder + visuals = urn + type = urn + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else_if = { + limit = { + scope:host ?= $OWNER$ + scope:activity ?= { has_activity_type = activity_tournament } + } + create_artifact = { + name = artifact_urn_name + creator = scope:host + description = placeholder # Will be updated in the post-creation effects after decorations are assigned. + visuals = urn + type = urn + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + history = { + type = prize_created + recipient = scope:host + } + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { exists = scope:potter } + create_artifact = { + name = artifact_urn_name + creator = scope:potter + description = placeholder # Will be updated in the post-creation effects after decorations are assigned. + visuals = urn + type = urn + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else = { + create_artifact = { + name = artifact_urn_name + description = placeholder # Will be updated in the post-creation effects after decorations are assigned. + visuals = urn + type = urn + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + scope:newly_created_artifact = { + # Finish generating decorations and update description + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_urn_description + # Add artifact modifiers + add_scaled_artifact_modifier_grandeur_small_effect = yes + add_scaled_artifact_modifier_minor_prestige_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_scaled_artifact_modifier_majesty_effect = yes + } + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + } + } +} + +hunt_animal_artifact_modifier_selection_effect = { + if = { + limit = { + OR = { + rarity = masterwork + rarity = famed + rarity = illustrious + } + } + if = { + limit = { + scope:owner.var:animal_type ?= flag:hare + } + add_scaled_artifact_modifier_attractiveness_effect = yes + if = { + limit = { + rarity = illustrious + } + add_scaled_artifact_modifier_intrigue_effect = yes + } + } + else_if = { + limit = { + OR = { + scope:owner.var:animal_type ?= flag:roe + scope:owner.var:animal_type ?= flag:reindeer + scope:owner.var:animal_type ?= flag:stag + scope:owner.var:animal_type ?= flag:antelope + scope:owner.var:animal_type ?= flag:saiga + scope:owner.var:animal_type ?= flag:hart + scope:owner.var:animal_type ?= flag:elk + scope:owner.var:animal_type ?= flag:horse + } + } + add_scaled_artifact_modifier_majesty_effect = yes + if = { + limit = { + rarity = illustrious + } + add_scaled_artifact_modifier_minor_prestige_effect = yes + } + } + else_if = { + limit = { + OR = { + scope:owner.var:animal_type ?= flag:aurochs + scope:owner.var:animal_type ?= flag:bison + scope:owner.var:animal_type ?= flag:boar + } + } + add_scaled_artifact_modifier_rulership_effect = yes + if = { + limit = { + rarity = illustrious + } + add_scaled_artifact_modifier_majesty_effect = yes + } + } + else_if = { + limit = { + OR = { + scope:owner.var:animal_type ?= flag:bear + scope:owner.var:animal_type ?= flag:leopard + scope:owner.var:animal_type ?= flag:lion + scope:owner.var:animal_type ?= flag:tiger + scope:owner.var:animal_type ?= flag:wolf + scope:owner.var:animal_type ?= flag:lynx + scope:owner.var:animal_type ?= flag:wolf + scope:owner.var:animal_type ?= flag:dog + } + } + add_scaled_artifact_modifier_combat_effect = yes + if = { + limit = { + rarity = illustrious + } + add_scaled_artifact_modifier_majesty_effect = yes + } + } + else_if = { + limit = { + OR = { + scope:owner.var:animal_type ?= flag:hyena + scope:owner.var:animal_type ?= flag:unicorn + scope:owner.var:animal_type ?= flag:fox + scope:owner.var:animal_type ?= flag:dragon + scope:owner.var:animal_type ?= flag:cat + } + } + add_scaled_artifact_modifier_intrigue_effect = yes + if = { + limit = { + rarity = illustrious + } + add_scaled_artifact_modifier_scholarship_effect = yes + } + } + else = { + add_scaled_artifact_modifier_majesty_effect = yes + if = { + limit = { + rarity = illustrious + } + add_scaled_artifact_modifier_rulership_effect = yes + } + } + } +} + +generate_health_trinket_effect = { + #Get artifact quality and wealth + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + #Generate the trinket + hidden_effect_new_object = { + random_list = { + 25 = { + create_artifact = { + name = medicine_jar + description = medicine_jar_desc + type = miscellaneous + visuals = glazed_jar + modifier = artifact_epidemic_resistance_3_modifier + save_scope_as = newly_created_health_artifact + wealth = scope:wealth + quality = scope:quality + } + scope:newly_created_health_artifact = { set_variable = health_jar } + } + 25 = { + create_artifact = { + name = lapidary_tourmaline + description = lapidary_tourmaline.desc + type = miscellaneous + visuals = diamond + modifier = artifact_negate_health_penalty_add_2_modifier + save_scope_as = newly_created_health_artifact + wealth = scope:wealth + quality = scope:quality + generate_history = no + } + scope:newly_created_health_artifact = { set_variable = health_jewel } + } + 25 = { + create_artifact = { + name = scented_herb_pouch + description = scented_herb_pouch.desc + type = miscellaneous + visuals = pocket_pouch + modifier = artifact_health_gain_2_modifier + save_scope_as = newly_created_health_artifact + wealth = scope:wealth + quality = scope:quality + } + scope:newly_created_health_artifact = { set_variable = health_pouch } + } + 25 = { + set_up_horned_mythical_creature_effect = yes + create_artifact = { + name = mythical_creature_horn + description = mythical_creature_horn.desc + type = miscellaneous + visuals = pocket_tusk + modifier = artifact_fertility_gain_2_modifier + save_scope_as = newly_created_health_artifact + wealth = scope:wealth + quality = scope:quality + generate_history = no + } + scope:newly_created_health_artifact = { set_variable = health_horn } + remove_variable ?= horned_mythical_creature + } + } + #Tweak the trinket modifiers, depending on rarity + scope:newly_created_health_artifact = { + if = { #Famed + limit = { + OR = { + rarity = illustrious #Bit of a cop-out, but I only need up to Famed atm + rarity = famed + } + } + clear_artifact_modifiers = yes + switch = { + trigger = has_variable + health_jar = { + set_artifact_name = aged_medicine_jar + add_artifact_modifier = artifact_epidemic_resistance_7_modifier + add_artifact_modifier = artifact_negate_health_penalty_add_2_modifier + } + health_jewel = { + random_list = { + 75 = { + set_artifact_name = lapidary_sapphire + set_artifact_description = lapidary_sapphire.desc + } + 25 = { + modifier = { + root.location = { geographical_region = world_india } + factor = 2 + } + set_artifact_name = lapidary_ruby + set_artifact_description = lapidary_ruby.desc + } + } + add_artifact_modifier = artifact_negate_health_penalty_add_3_modifier + add_artifact_modifier = artifact_fertility_gain_2_modifier + } + health_pouch = { + set_artifact_name = pomander + set_artifact_description = pomander.desc + add_artifact_modifier = artifact_health_gain_4_modifier + add_artifact_modifier = artifact_epidemic_resistance_5_modifier + } + health_horn = { + add_artifact_modifier = artifact_fertility_gain_4_modifier + add_artifact_modifier = artifact_health_gain_2_modifier + } + } + } + else_if = { #Masterwork + limit = { rarity = masterwork } + clear_artifact_modifiers = yes + switch = { + trigger = has_variable + health_jar = { + set_artifact_name = potent_medicine_jar + add_artifact_modifier = artifact_epidemic_resistance_5_modifier + add_artifact_modifier = artifact_negate_health_penalty_add_1_modifier + } + health_jewel = { + random_list = { + 50 = { + set_artifact_name = lapidary_jasper + set_artifact_description = lapidary_jasper.desc + } + 50 = { + set_artifact_name = lapidary_garnet + set_artifact_description = lapidary_garnet.desc + } + } + add_artifact_modifier = artifact_negate_health_penalty_add_2_modifier + add_artifact_modifier = artifact_fertility_gain_1_modifier + } + health_pouch = { + add_artifact_modifier = artifact_health_gain_3_modifier + add_artifact_modifier = artifact_epidemic_resistance_3_modifier + } + health_horn = { + add_artifact_modifier = artifact_fertility_gain_3_modifier + add_artifact_modifier = artifact_health_gain_1_modifier + } + } + } + #Mix up the gems a bit + else_if = { + limit = { + rarity = common + has_variable = health_jewel + } + random_list = { + 50 = { + set_artifact_name = lapidary_turquoise + set_artifact_description = lapidary_turquoise.desc + } + 50 = { + set_artifact_name = lapidary_tigerseye + set_artifact_description = lapidary_tigerseye.desc + } + 50 = { + #Keep Tourmaline + } + } + } + } + } +} + +generate_historical_artifact_based_on_location_effect = { + random_list = { + 2 = { #Ark of the covenant + trigger = { + NOT = { + any_artifact = { has_variable = ark_of_the_covenant } + } + $LOCATION$ ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_africa_north_east + geographical_region = world_africa_east + } + } + } + create_artifact_sculpture_ark_of_covenant_effect = { OWNER = root } + } + 2 = { #Babr E Bayan + trigger = { + NOT = { + any_artifact = { has_variable = babr_e_bayan } + } + $LOCATION$ ?= { + OR = { + geographical_region = world_middle_east_persia + #geographical_region = world_steppe + culture = { has_cultural_pillar = heritage_iranian } + } + } + } + create_artifact_sculpture_babr_e_bayan_effect = { OWNER = root } + } + 10 = { #Crown of Justinian + trigger = { + NOT = { + any_artifact = { has_variable = crown_of_justinian } + } + $LOCATION$ ?= { + OR = { + geographical_region = custom_eastern_roman_empire + culture = { has_cultural_pillar = heritage_byzantine } + } + } + } + create_artifact_pedestal_justinian_effect = { OWNER = root } + } + 10 = { #Cup of Jamshid + trigger = { + NOT = { + any_artifact = { has_variable = cup_jamshid } + } + $LOCATION$ ?= { + OR = { + geographical_region = world_middle_east_persia + culture = { has_cultural_pillar = heritage_iranian } + } + } + } + create_artifact_pedestal_cup_jamshid_effect = { OWNER = root } + } + 10 = { #Harp of David + trigger = { + NOT = { + any_artifact = { has_variable = david_harp } + } + $LOCATION$ ?= { + OR = { + geographical_region = world_middle_east_jerusalem + culture = { has_cultural_pillar = heritage_israelite } + faith.religion = religion:judaism_religion + } + } + } + create_artifact_pedestal_david_harp_effect = { OWNER = root } + } + 10 = { #Iron Crown - Recreate if lost + trigger = { + NOT = { + any_artifact = { has_variable = iron_crown } + } + $LOCATION$ ?= { + OR = { + geographical_region = custom_northern_italy + culture = { has_cultural_pillar = heritage_latin } + } + } + } + create_artifact_pedestal_crown_iron_effect = { OWNER = root } + } + 10 = { #Kaviani Banner + trigger = { + NOT = { + any_artifact = { has_variable = banner_kaviani } + } + $LOCATION$ ?= { + OR = { + geographical_region = world_middle_east_persia + #geographical_region = world_steppe + culture = { has_cultural_pillar = heritage_iranian } + } + } + } + create_artifact_wall_banner_kaviani_effect = { OWNER = root } + } + 10 = { #Edessa Banner + trigger = { + NOT = { + any_artifact = { has_variable = banner_edessa } + } + $LOCATION$ ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_asia_minor + } + } + } + create_artifact_wall_banner_edessa_effect = { OWNER = root } + } + 10 = { #El Cid's Sword + trigger = { + current_year >= 1097 + NOT = { + any_artifact = { has_variable = sword_cid } + } + $LOCATION$ ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_asia_minor + } + } + } + create_artifact_wall_cid_sword_effect = { OWNER = root } + } + 10 = { #Muhammad's Sword + trigger = { + any_artifact = { + count < 9 + has_variable = sword_of_muhammad + } + $LOCATION$ ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_asia_minor + geographical_region = world_africa_north_east + religion = religion:islam_religion + } + } + } + create_artifact_wall_muhammad_sword_effect = { OWNER = root } + } + 10 = { #Attila's Sword + trigger = { + NOT = { + any_artifact = { has_variable = sword_attila } + } + $LOCATION$ ?= { + OR = { + geographical_region = custom_south_slavia + geographical_region = custom_carpathia + geographical_region = ghw_region_crimea + geographical_region = custom_bavaria + } + } + } + create_artifact_wall_sword_attila_effect = { OWNER = root } + } + 10 = { #Throne of Scone + trigger = { + NOT = { + any_artifact = { has_variable = throne_scone } + } + $LOCATION$ ?= { geographical_region = world_europe_west_britannia } + } + create_artifact_throne_scone_effect = { OWNER = root } + } + 10 = { #Throne of Solomon + trigger = { + NOT = { + any_artifact = { has_variable = throne_of_solomon } + } + $LOCATION$ ?= { + OR = { + geographical_region = world_middle_east_jerusalem + culture = { has_cultural_pillar = heritage_israelite } + faith.religion = religion:judaism_religion + } + } + } + create_artifact_throne_solomon_effect = { OWNER = root } + } + 10 = { #Throne of Charlemagne - Recreate if lost + trigger = { + NOT = { + any_artifact = { has_variable = charlamagne_throne } + } + $LOCATION$ ?= { + OR = { + geographical_region = custom_carolingian_francia + geographical_region = custom_carolingian_germany + geographical_region = custom_lotharingia + geographical_region = custom_northern_italy + } + } + } + create_artifact_throne_charlemagne_effect = { OWNER = root } + } + 15 = { #Excalibur + trigger = { + any_artifact = { + count < 6 + has_variable = excalibur + } + $LOCATION$ ?= { + geographical_region = world_europe_west_britannia + } + } + create_artifact_excalibur_effect = { OWNER = root } + } + 10 = { #Head of St Edmund + trigger = { + NOT = { + any_artifact = { + has_variable = edmund_head + } + } + $LOCATION$ ?= { + OR = { + geographical_region = world_europe_west_britannia + geographical_region = world_europe_north + } + } + } + create_artifact_edmund_head_effect = { OWNER = root } + } + 10 = { #Dhammapada + trigger = { + any_artifact = { + count < 10 + has_variable = dhammapada + } + $LOCATION$ ?= { + OR = { + geographical_region = world_india + geographical_region = world_tibet + geographical_region = ghw_region_afghanistan + geographical_region = world_asia_china + geographical_region = world_asia_japan + geographical_region = world_asia_korea + geographical_region = world_asia_southeast + religion = religion:buddhism_religion + } + } + } + create_artifact_dhammapada_effect = { OWNER = root } + } + 10 = { #Sutta Pitaka + trigger = { + any_artifact = { + count < 10 + has_variable = vinaya_pitaka + } + $LOCATION$ ?= { + OR = { + geographical_region = world_india + geographical_region = world_tibet + geographical_region = ghw_region_afghanistan + geographical_region = world_asia_china + geographical_region = world_asia_japan + geographical_region = world_asia_korea + geographical_region = world_asia_southeast + religion = religion:buddhism_religion + } + } + } + create_artifact_sutta_pitaka_effect = { OWNER = root } + } + 10 = { #Vinaya Pitaka + trigger = { + any_artifact = { + count < 10 + has_variable = sutta_pitaka + } + $LOCATION$ ?= { + OR = { + geographical_region = world_india + geographical_region = world_tibet + geographical_region = ghw_region_afghanistan + geographical_region = world_asia_china + geographical_region = world_asia_japan + geographical_region = world_asia_korea + geographical_region = world_asia_southeast + religion = religion:buddhism_religion + } + } + } + create_artifact_vinaya_pitaka_effect = { OWNER = root } + } + 10 = { #Abhidhamma + trigger = { + any_artifact = { + count < 10 + has_variable = abhidhamma + } + $LOCATION$ ?= { + OR = { + geographical_region = world_india + geographical_region = world_tibet + geographical_region = ghw_region_afghanistan + geographical_region = world_asia_china + geographical_region = world_asia_japan + geographical_region = world_asia_korea + geographical_region = world_asia_southeast + religion = religion:buddhism_religion + } + } + } + create_artifact_abhidhamma_pitaka_effect = { OWNER = root } + } + 15 = { #Jewelled Danda + trigger = { + any_artifact = { + count < 10 + has_variable = danda + } + $LOCATION$ ?= { + OR = { + geographical_region = world_india + geographical_region = world_tibet + geographical_region = ghw_region_afghanistan + geographical_region = world_asia_china + geographical_region = world_asia_southeast + } + } + } + create_artifact_jewelled_danda_effect = { OWNER = ROOT } + } + 5 = { #Mountain of Light + trigger = { + any_artifact = { + count < 1 + has_variable = koh_i_noor + } + $LOCATION$ ?= { + OR = { + geographical_region = world_india + geographical_region = world_tibet + geographical_region = ghw_region_afghanistan + } + } + } + create_artifact_pedestal_koh_i_noor_effect = { OWNER = ROOT } + } + 10 = { #Makarakundala + trigger = { + any_artifact = { + count < 10 + has_variable = makarakundala + } + $LOCATION$ ?= { + OR = { + geographical_region = world_india + geographical_region = world_tibet + geographical_region = ghw_region_afghanistan + } + } + } + create_artifact_makarakundala_effect = { OWNER = ROOT } + } + 10 = { #Great Diamond + trigger = { + any_artifact = { + count < 1 + has_variable = great_diamond + } + $LOCATION$ ?= { + OR = { + geographical_region = world_india + geographical_region = world_tibet + geographical_region = ghw_region_afghanistan + } + } + } + create_artifact_pedestal_great_diamond_effect = { OWNER = ROOT } + } + 10 = { #Al Taj + trigger = { + any_artifact = { + count < 1 + has_variable = al_taj + } + $LOCATION$ ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_africa_north_east + } + } + } + create_artifact_al_taj_crown_effect = { OWNER = ROOT } + } + 10 = { #al-Sayf al-Khass + trigger = { + any_artifact = { + count < 1 + has_variable = al_sayf_al_khass + } + $LOCATION$ ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_africa_north_east + } + } + } + create_artifact_al_sayf_al_khass_effect = { OWNER = ROOT } + } + 10 = { #Qadib al-Mulk + trigger = { + any_artifact = { + count < 1 + has_variable = qadib_al_mulk + } + $LOCATION$ ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_africa_north_east + } + } + } + create_artifact_qadib_al_mulk_effect = { OWNER = ROOT } + } + 10 = { #Al Dawat + trigger = { + any_artifact = { + count < 1 + has_variable = al_dawat + } + $LOCATION$ ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_africa_north_east + } + } + } + create_artifact_al_dawat_effect = { OWNER = ROOT } + } + 10 = { #Al Hafir + trigger = { + any_artifact = { + count < 1 + has_variable = al_hafir + } + $LOCATION$ ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_africa_north_east + } + } + } + create_artifact_al_hafir_effect = { OWNER = ROOT } + } + 2 = { #Banner of thankfulness + trigger = { + any_artifact = { + count < 2 + has_variable = banner_thankfulness + } + $LOCATION$ ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_africa_north_east + } + } + } + create_artifact_wall_banner_thankfulness_effect = { OWNER = ROOT } + } + 5 = { #Al Jabal + trigger = { + any_artifact = { + count < 1 + has_variable = al_jabal + } + $LOCATION$ ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_middle_east_persia + } + } + } + create_artifact_pedestal_al_jabal_effect = { OWNER = ROOT } + } + 5 = { #Al Yatima + trigger = { + any_artifact = { + count < 1 + has_variable = al_yatima + } + $LOCATION$ ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_africa_north_east + } + } + } + create_artifact_pedestal_al_yatima_effect = { OWNER = ROOT } + } + 10 = { #Dagger of Rostam + trigger = { + any_artifact = { + count < 1 + has_variable = dagger_of_rostam + } + $LOCATION$ ?= { + OR = { + geographical_region = world_asia_minor + geographical_region = world_middle_east + geographical_region = world_middle_east_persia + } + } + } + create_artifact_dagger_of_rostam_effect = { OWNER = ROOT } + } + 10 = { #Ascalon + trigger = { + any_artifact = { + count < 1 + has_variable = ascalon + } + $LOCATION$ ?= { + OR = { + geographical_region = world_asia_minor + geographical_region = world_middle_east + geographical_region = world_middle_east_persia + } + } + } + create_artifact_ascalon_effect = { OWNER = ROOT } + } + 10 = { #Shamshir-e Zomorrodnegar + trigger = { + any_artifact = { + count < 1 + has_variable = zomorrodnegar + } + $LOCATION$ ?= { + OR = { + geographical_region = world_asia_minor + geographical_region = world_middle_east + geographical_region = world_middle_east_persia + } + } + } + create_artifact_zomorrodnegar_effect = { OWNER = ROOT } + } + 15 = { #Muhammads epistles + trigger = { + any_artifact = { + count < 12 + has_variable = muhammads_epistles + } + $LOCATION$ ?= { + OR = { + geographical_region = world_asia_minor + geographical_region = world_middle_east + geographical_region = world_middle_east_persia + } + } + } + create_artifact_muhammads_epistles_effect = { OWNER = ROOT } + } + 10 = { #Kave's Apron + trigger = { + any_artifact = { + count < 1 + has_variable = kaves_apron + } + $LOCATION$ ?= { + OR = { + geographical_region = world_asia_minor + geographical_region = world_middle_east + geographical_region = world_middle_east_persia + } + } + } + create_artifact_kaves_apron_effect = { OWNER = ROOT } + } + 2 = { #Armor of Alexander the Great + trigger = { + any_artifact = { + count < 1 + has_variable = arms_of_alex + } + $LOCATION$ ?= { + OR = { + geographical_region = world_india + geographical_region = world_asia_minor + geographical_region = world_middle_east + geographical_region = world_middle_east_persia + } + } + } + create_artifact_arms_of_alexander_effect = { OWNER = ROOT } + } + 10 = { #Olifant + trigger = { + any_artifact = { + count < 1 + has_variable = olifant + } + $LOCATION$ ?= { + OR = { + geographical_region = world_europe_west + geographical_region = world_europe_south + } + } + } + create_artifact_olifant_effect = { OWNER = ROOT } + } + 10 = { #Angelicas Ring + trigger = { + any_artifact = { + count < 1 + has_variable = angelica_ring + } + $LOCATION$ ?= { + OR = { + geographical_region = world_europe_west + geographical_region = world_europe_south + } + } + } + create_artifact_angelicas_ring_effect = { OWNER = ROOT } + } + 10 = { #Colada + trigger = { + any_artifact = { + count < 1 + has_variable = colada + } + $LOCATION$ ?= { + OR = { + geographical_region = world_europe_west + geographical_region = world_europe_south + } + } + } + create_colada_effect = { OWNER = ROOT } + } + 10 = { #Curtana + trigger = { + any_artifact = { + count < 1 + has_variable = curtana + } + $LOCATION$ ?= { + OR = { + geographical_region = world_europe_west + geographical_region = world_europe_south + } + } + } + create_artifact_curtana_effect = { OWNER = ROOT } + } + 10 = { #Durendal + trigger = { + any_artifact = { + count < 1 + has_variable = durendal + } + $LOCATION$ ?= { + OR = { + geographical_region = world_europe_west + geographical_region = world_europe_south + } + } + } + create_artifact_durendal_effect = { OWNER = ROOT } + } + 10 = { #Joyeuse + trigger = { + any_artifact = { + count < 1 + has_variable = joyeuse + } + $LOCATION$ ?= { + OR = { + geographical_region = world_europe_west + geographical_region = world_europe_south + } + } + } + create_artifact_joyeuse_effect = { OWNER = ROOT } + } + 10 = { #Aram + trigger = { + any_artifact = { + count < 1 + has_variable = aram + } + $LOCATION$ ?= { geographical_region = world_steppe } + } + create_artifact_aram_effect = { OWNER = ROOT } + } + 10 = { #Mmaagha Kamalu + trigger = { + any_artifact = { + count < 1 + has_variable = mmaagha_kamalu + } + $LOCATION$ ?= { geographical_region = world_africa_west } + } + create_artifact_sword_mmaagha_kamalu_effect = { OWNER = ROOT } + } + 15 = { #Ikenga + trigger = { + any_artifact = { + count < 15 + has_variable = ikenga + } + $LOCATION$ ?= { geographical_region = world_africa_west } + } + create_artifact_pedestal_ikenga_effect = { OWNER = ROOT } + } + 15 = { #Ibeji + trigger = { + any_artifact = { + count < 15 + has_variable = ibeji + } + $LOCATION$ ?= { geographical_region = world_africa_west } + } + create_artifact_ibeji_effect = { OWNER = ROOT } + } + 10 = { #Nagelring + trigger = { + any_artifact = { + count < 1 + has_variable = nagelring + } + $LOCATION$ ?= { geographical_region = world_europe_west_germania } + } + create_artifact_nagelring_effect = { OWNER = ROOT } + } + 10 = { #szczerbiec + trigger = { + current_date > 1080.1.1 + any_artifact = { + count < 1 + has_variable = szczerbiec + } + $LOCATION$ ?= { geographical_region = world_europe_east } + } + create_artifact_szczerbiec_effect = { OWNER = ROOT } + } + 10 = { #Kladenets + trigger = { + any_artifact = { + count < 1 + has_variable = kladenets + } + $LOCATION$ ?= { geographical_region = world_europe_east } + } + create_artifact_kladenets_effect = { OWNER = ROOT } + } + 10 = { #Legbiter + trigger = { + current_date > 1120.1.1 + any_artifact = { + count < 1 + has_variable = legbiter + } + $LOCATION$ ?= { geographical_region = world_europe_north } + } + create_artifact_legbiter_effect = { OWNER = ROOT } + } + 10 = { #Quern-Biter + trigger = { + current_date > 920.1.1 + any_artifact = { + count < 1 + has_variable = quernbiter + } + $LOCATION$ ?= { geographical_region = world_europe_north } + } + create_artifact_quernbiter_effect = { OWNER = ROOT } + } + 15 = { #Navaratna + trigger = { + $LOCATION$ ?= { geographical_region = world_india } + any_artifact = { + count < 3 + has_variable = navaratna + } + } + create_artifact_navaratna_effect = { OWNER = ROOT } + } + 10 = { #Dragvandil + trigger = { + current_date > 920.1.1 + any_artifact = { + count < 1 + has_variable = dragvandil + } + $LOCATION$ ?= { geographical_region = world_europe_north } + } + create_artifact_dragvandil_effect = { OWNER = ROOT } + } + 5 = { #Ruyi + trigger = { + any_artifact = { + count < 15 + has_variable = ruyi + } + $LOCATION$ ?= { + OR = { + geographical_region = world_india + geographical_region = world_burma + geographical_region = world_tibet + geographical_region = world_asia_china + geographical_region = world_asia_japan + geographical_region = world_asia_korea + geographical_region = world_asia_southeast + } + } + } + create_artifact_ruyi_effect = { OWNER = ROOT } + } + 5 = { #Turquoise Throne + trigger = { + any_artifact = { + count < 1 + has_variable = turquoise_throne + } + $LOCATION$ ?= { + OR = { + geographical_region = world_india + geographical_region = world_burma + geographical_region = world_middle_east_persia + } + } + } + create_artifact_turquoise_throne_effect = { OWNER = ROOT } + } + 5 = { #Peacock Throne + trigger = { + any_artifact = { + count < 1 + has_variable = peacock_throne + } + $LOCATION$ ?= { + OR = { + geographical_region = world_india + geographical_region = world_burma + geographical_region = world_middle_east_persia + } + } + } + create_artifact_peacock_throne_effect = { OWNER = ROOT } + } + 5 = { #Mantle of the Prophet + trigger = { + any_artifact = { + count < 1 + has_variable = mantle_of_prophet + } + $LOCATION$ ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_middle_east_persia + } + } + } + create_artifact_mantle_of_the_prophet_effect = { OWNER = ROOT } + } + 5 = { #Spear of the Prophet + trigger = { + any_artifact = { + count < 1 + has_variable = spear_of_the_prophet + } + $LOCATION$ ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_middle_east_persia + } + } + } + create_artifact_spear_of_the_prophet_effect = { OWNER = ROOT } + } + 10 = { #FP3 Sassanian Sword + trigger = { + any_artifact = { + count < 15 + has_variable = sassanian_sword + } + $LOCATION$ ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_middle_east_persia + } + } + } + create_artifact_illustrious_sassanian_sword_effect = { OWNER = ROOT } + } + 2 = { #Narwhal Horn + trigger = { + $LOCATION$ ?= { geographical_region = world_europe_north } + } + create_artifact_wall_narwhal_horn_effect = { + OWNER = scope:owner + HUNTER = scope:inspiration_owner + } + } + 1 = { #Fallback Relic + create_artifact_pedestal_branch_relic_general_effect = { + OWNER = root + RELIGION = $LOCATION$.religion + } + } + } +} + +select_random_saint_effect = { + save_scope_as = owner + random_list = { + 1 = { + trigger = { + OR = { + faith = faith:catholic + faith = faith:orthodox + faith = faith:nestorian + } + } + set_variable = { + name = saint + value = flag:brigid + days = 5 + } + } + + 1 = { + trigger = { + OR = { + faith = faith:catholic + faith = faith:orthodox + faith = faith:nestorian + } + } + set_variable = { + name = saint + value = flag:matthew + days = 5 + } + } + + 1 = { + trigger = { + OR = { + faith = faith:catholic + faith = faith:orthodox + faith = faith:nestorian + } + } + set_variable = { + name = saint + value = flag:joseph + days = 5 + } + } + + 1 = { + trigger = { + OR = { + faith = faith:catholic + faith = faith:orthodox + faith = faith:nestorian + } + } + set_variable = { + name = saint + value = flag:catherine + days = 5 + } + } + + 1 = { + trigger = { + OR = { + faith = faith:catholic + faith = faith:orthodox + faith = faith:nestorian + } + } + set_variable = { + name = saint + value = flag:george + days = 5 + } + } + + 1 = { + trigger = { + OR = { + faith = faith:catholic + faith = faith:orthodox + faith = faith:nestorian + } + } + set_variable = { + name = saint + value = flag:nicholas + days = 5 + } + } + + 1 = { + trigger = { + OR = { + faith = faith:coptic + faith = faith:armenian_apostolic + } + } + set_variable = { + name = saint + value = flag:marina + days = 5 + } + } + + 1 = { + trigger = { + OR = { + faith = faith:coptic + faith = faith:armenian_apostolic + } + } + set_variable = { + name = saint + value = flag:matthew + days = 5 + } + } + + 1 = { + trigger = { + OR = { + faith = faith:coptic + faith = faith:armenian_apostolic + } + } + set_variable = { + name = saint + value = flag:joseph + days = 5 + } + } + + 1 = { + trigger = { + OR = { + faith = faith:coptic + faith = faith:armenian_apostolic + } + } + set_variable = { + name = saint + value = flag:mark + days = 5 + } + } + + 1 = { + trigger = { + OR = { + faith = faith:coptic + faith = faith:armenian_apostolic + } + } + set_variable = { + name = saint + value = flag:maurice + days = 5 + } + } + } + #fallback + if = { + limit = { NOT = { exists = var:saint } } + set_variable = { + name = saint + value = flag:fallback + days = 5 + } + } +} + +add_scaled_artifact_modifier_trait_track_hunter_xp_gain_mult_effect = { + if = { + limit = { rarity = common } + random_list = { + 20 = { add_artifact_modifier = artifact_trait_track_hunter_xp_gain_mult_1_modifier } + 5 = { add_artifact_modifier = artifact_trait_track_hunter_xp_gain_mult_2_modifier } + } + } + else_if = { + limit = { rarity = masterwork } + random_list = { + 20 = { add_artifact_modifier = artifact_trait_track_hunter_xp_gain_mult_2_modifier } + 5 = { add_artifact_modifier = artifact_trait_track_hunter_xp_gain_mult_3_modifier } + } + } + else_if = { + limit = { rarity = famed } + random_list = { + 20 = { add_artifact_modifier = artifact_trait_track_hunter_xp_gain_mult_3_modifier } + 5 = { add_artifact_modifier = artifact_trait_track_hunter_xp_gain_mult_4_modifier } + } + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_trait_track_hunter_xp_gain_mult_4_modifier + } +} diff --git a/N3OW/common/scripted_effects/00_ep1_artifact_effects.txt b/N3OW/common/scripted_effects/00_ep1_artifact_effects.txt new file mode 100644 index 00000000..e73c1643 --- /dev/null +++ b/N3OW/common/scripted_effects/00_ep1_artifact_effects.txt @@ -0,0 +1,660 @@ +steal_artifact_in_siege_effect = { + # Save scopes for localization + $LOCATION$ = { save_scope_as = SAISE_location } + $ATTACKER$ = { save_scope_as = SAISE_attacker } + $DEFENDER$ = { save_scope_as = SAISE_defender } + $ARTIFACT$ = { save_scope_as = this_artifact } + + scope:this_artifact = { + # Suppress generic notifications, as we will send custom ones + set_variable = { + name = suppress_artifact_notifications + value = yes + days = 1 + } + if = { + limit = { + NOT = { has_variable = stolen_artifact } + } + set_variable = { + name = stolen_artifact + value = 1 + } + } + else = { + change_variable = { + name = stolen_artifact + add = 1 + } + } + + # Transfer the artifact to its new owner + if = { + limit = { + has_variable = ai_to_ai_destroy_in_sieges + scope:SAISE_attacker = { + is_ai = yes + } + scope:SAISE_defender = { + is_ai = yes + } + } + destroy_artifact = this + } + else = { + set_owner = { + target = scope:SAISE_attacker + history = { + location = scope:SAISE_location + actor = scope:SAISE_defender + recipient = scope:SAISE_attacker + type = taken_in_siege + } + } + scope:SAISE_defender = { add_personal_artifact_claim = scope:this_artifact } + if = { + limit = { + scope:SAISE_attacker = { + has_ep3_dlc_trigger = yes + is_roman_emperor_trigger = yes + culture = { has_cultural_parameter = holds_triumphs } + } + } + scope:SAISE_attacker = { + set_variable = { + name = byz_valid_for_trophy + value = scope:this_artifact + years = 9 + } + } + } + + # Send notifications to the relevant parties + scope:SAISE_defender = { + send_interface_toast = { + type = msg_artifact_lost + title = artifact_lost_toast + left_icon = scope:this_artifact + right_icon = scope:SAISE_attacker + if = { + limit = { $IS_RAID$ = yes } + custom_tooltip = artifact_lost_in_raid + } + else = { + custom_tooltip = artifact_lost_in_siege + } + } + } + scope:SAISE_attacker = { + send_interface_toast = { + type = msg_artifact_gained + right_icon = scope:this_artifact + } + if = { + limit = { + NOT = { any_claimed_artifact = { this = scope:this_artifact } } + } + scope:this_artifact = { + set_variable = { + name = last_person_to_steal + value = scope:SAISE_attacker + } + } + } + } + } + } +} + +steal_artifact_in_event_effect = { + if = { + limit = { exists = $VICTIM$.capital_province } + set_local_variable = { + name = location + value = $VICTIM$.capital_province + } + } + else_if = { + limit = { exists = $VICTIM$.location } + set_local_variable = { + name = location + value = $VICTIM$.location + } + } + + $ARTIFACT$ = { + save_scope_as = artifact_to_steal + hidden_effect = { + if = { + limit = { + exists = local_var:location + } + set_owner = { + target = $THIEF$ + history = { + type = stolen + actor = $VICTIM$ #stolen from + recipient = $THIEF$ #stealer + location = local_var:location + } + } + } + else = { #If no location exists it is "conquered" + set_owner = { + target = $THIEF$ + history = { + type = conquest + actor = $THIEF$ #stealer + recipient = $VICTIM$ #stolen from + } + } + } + if = { + limit = { + NOT = { has_variable = stolen_artifact } + } + set_variable = { + name = stolen_artifact + value = 1 + } + } + else = { + change_variable = { + name = stolen_artifact + add = 1 + } + } + } + } + $VICTIM$ = { + add_personal_artifact_claim = scope:artifact_to_steal + } +} + +damage_artifact_in_battle_effect = { + # Save scopes for localization + $OWNER$ = { + save_scope_as = DAIBE_owner + } + $OPPONENT$ = { save_scope_as = DAIBE_opponent } + $LOCATION$ = { save_scope_as = DAIBE_location } + $ARTIFACT$ = { + save_scope_as = DAIBE_artifact + + # Suppress generic notifications, as we will send custom ones + set_variable = { + name = suppress_artifact_notifications + value = yes + days = 1 + } + + set_variable = { + name = DAIBE_damage + value = $DURABILITY_LOSS$ + days = 1 + } + + # Damage the artifact by the specified amount + add_durability = { + value = 0 + subtract = var:DAIBE_damage + } + } + + # Transformed into an if / else as I found the following note somewhere else: + # NOTE: We must not run ANY script after we destroy an artifact, or we will cause errors + if = { + # If the artifact has no durability left, destroy it now. + limit = { scope:DAIBE_artifact.artifact_durability <= 0 } + destroy_artifact = scope:DAIBE_artifact + } + # Send notifications to the relevant party IF the artifact was not destroyed + else = { + $OWNER$ = { + # Send the toast + send_interface_toast = { + title = artifact_damaged_toast + left_icon = scope:DAIBE_artifact + right_icon = scope:DAIBE_opponent + if = { + limit = { + $IS_DUEL$ = yes + } + custom_tooltip = artifact_damaged_in_duel + } + else = { + custom_tooltip = artifact_damaged_in_siege + } + } + } + } +} + +flag_as_trash_artifact = { + set_variable = { + name = ai_to_ai_destroy_in_sieges + value = yes + } +} + +flag_as_unwanted_artifact = { + set_variable = { + name = unwanted_artifact + value = yes + } +} + +flag_as_cursed_artifact = { + set_variable = { + name = cursed_artifact + value = yes + } +} + +#For use with trinket looks / call this effect (set_up_trinket_adjective_effect = yes) in the line before creating the trinket +#Use this in the trinket's name/description in the loc-file [ROOT.Char.Custom('TrinketLookAdjective')] /and/ [ROOT.Char.Custom('TrinketLookAdverbFollowup')] +#Remember to clear the var:trinket_adjective_followup in your after = { ... } +set_up_trinket_adjective_effect = { + random_list = { + 50 = { + set_variable = { + name = trinket_adjective_followup + value = flag:adorned + } + } + 50 = { + set_variable = { + name = trinket_adjective_followup + value = flag:decorated + } + } + 50 = { + set_variable = { + name = trinket_adjective_followup + value = flag:embellished + } + } + 50 = { + set_variable = { + name = trinket_adjective_followup + value = flag:ornamented + } + } + + } +} + +# Grant claims on familial banners +grant_banner_house_claim_effect = { + save_scope_as = familial_banner + hidden_effect = { + if = { # Dynasty banner not owned or claimed by all child house's already + limit = { + exists = var:banner_dynasty + var:banner_dynasty = { + any_dynasty_member = { + this = house.house_head + house = { artifact_house_not_owns_or_claims_trigger = yes } # House not owns or claims already + } + } + } + var:banner_dynasty = { + every_dynasty_member = { + limit = { + this = house.house_head + house = { artifact_house_not_owns_or_claims_trigger = yes } # House not owns or claims already + } + house = { add_house_artifact_claim = scope:familial_banner } + } + } + } + else_if = { # House banner not owned or claimed by creating house already + limit = { + exists = var:banner_house + var:banner_house = { artifact_house_not_owns_or_claims_trigger = yes } # House not owns or claims already + } + var:banner_house = { add_house_artifact_claim = scope:familial_banner } + } + } +} + +#Determine what type of artifact a court artifact is, for defacement +determine_artifact_damage_type_effect = { + $ARTIFACT$ = { save_scope_as = artifact_to_determine } + scope:artifact_to_determine = { + random_list = { + 10 = { + trigger = { + OR = { + artifact_type = chest + artifact_type = box + artifact_type = cabinet + artifact_type = pedestal + artifact_type = tapestry + artifact_type = animal_hide + artifact_type = animal_hide_big + artifact_type = wall_big + artifact_type = wall_shield + artifact_type = throne + artifact_type = throne_special + artifact_type = book + } + } + set_variable = artifact_burned + } + 10 = { + trigger = { + OR = { + artifact_type = sculpture + artifact_type = box + artifact_type = goblet + artifact_type = pedestal + artifact_type = book + artifact_type = elixir + artifact_type = panacea + artifact_type = philosophers_stone + } + } + set_variable = artifact_knocked_over + } + 10 = { + trigger = { + OR = { + artifact_type = sculpture + artifact_type = chest + artifact_type = box + artifact_type = cabinet + artifact_type = goblet + artifact_type = pedestal + artifact_type = tapestry #cloth + artifact_type = animal_skull + artifact_type = animal_hide + artifact_type = animal_hide_big + artifact_type = wall_big #shields, banners + artifact_type = wall_small #animal trophy + artifact_type = wall_shield + artifact_type = wall_shield_special #kite shields + artifact_type = throne + artifact_type = throne_special + artifact_type = book + artifact_type = elixir + artifact_type = panacea + artifact_type = philosophers_stone #box + } + } + set_variable = artifact_smeared_food + } + 10 = { + trigger = { + OR = { + artifact_type = chest + artifact_type = box + artifact_type = cabinet + artifact_type = pedestal + artifact_type = tapestry + artifact_type = animal_hide + artifact_type = animal_hide_big + artifact_type = wall_big + artifact_type = wall_small + artifact_type = throne + artifact_type = throne_special + artifact_type = book + } + } + set_variable = artifact_spilled_drink + } + 10 = { + trigger = { + OR = { + artifact_type = tapestry + artifact_type = animal_hide + artifact_type = animal_hide_big + artifact_type = book + } + } + set_variable = artifact_tear + } + 10 = { + trigger = { + OR = { + artifact_type = tapestry + artifact_type = animal_skull + artifact_type = animal_hide + artifact_type = animal_hide_big + artifact_type = wall_big + artifact_type = wall_small + artifact_type = wall_shield + artifact_type = wall_shield_special + } + } + set_variable = artifact_tear_down + } + 10 = { + trigger = { + OR = { + artifact_type = chest + artifact_type = box + artifact_type = pedestal + artifact_type = tapestry + artifact_type = animal_hide + artifact_type = animal_hide_big + artifact_type = wall_big + artifact_type = wall_small + artifact_type = wall_shield + artifact_type = wall_shield_special + artifact_type = throne + artifact_type = throne_special + artifact_type = book + } + } + set_variable = artifact_threw_up + } + 10 = { + trigger = { + OR = { + artifact_type = sculpture + artifact_type = chest + artifact_type = box + artifact_type = cabinet + artifact_type = goblet + artifact_type = pedestal + artifact_type = tapestry #cloth + artifact_type = animal_skull + artifact_type = animal_hide + artifact_type = animal_hide_big + artifact_type = wall_big #shields, banners + artifact_type = wall_small #animal trophy + artifact_type = wall_shield + artifact_type = wall_shield_special #kite shields + artifact_type = throne + artifact_type = throne_special + artifact_type = book + artifact_type = elixir + artifact_type = panacea + artifact_type = philosophers_stone #box + } + } + set_variable = artifact_unspeakable + } + 10 = { + trigger = { + NOR = { + artifact_type = sculpture + artifact_type = chest + artifact_type = box + artifact_type = cabinet + artifact_type = goblet + artifact_type = pedestal + artifact_type = tapestry #cloth + artifact_type = animal_skull + artifact_type = animal_hide + artifact_type = animal_hide_big + artifact_type = wall_big #shields, banners + artifact_type = wall_small #animal trophy + artifact_type = wall_shield + artifact_type = wall_shield_special #kite shields + artifact_type = throne + artifact_type = throne_special + artifact_type = book + artifact_type = elixir + artifact_type = panacea + artifact_type = philosophers_stone #box + } + } + set_variable = artifact_damage_fallback + } + } + } +} + +# Destroy Artifact effect +# DESTROYER = Character destroying the artifact +# ARTIFACT = The artifact to destroy +destroy_artifact_aniconist_effect = { + $ARTIFACT$ = { + save_temporary_scope_as = artifact + } + + $DESTROYER$ = { + if = { + limit = { + OR = { + $DESTROYER$.faith = { has_doctrine_parameter = destroying_artifacts_is_pious } + $PIETY_BY_DEFAULT$ = yes + } + } + give_destroyed_artifact_piety = yes + } + if = { + limit = { + $GIVE_GOLD$ = yes + } + add_gold = { + if = { + limit = { + scope:artifact = { rarity = illustrious } + } + add = { + value = 25 + } + } + else_if = { + limit = { + scope:artifact = { rarity = famed } + } + add = { + value = 15 + } + } + else_if = { + limit = { + scope:artifact = { rarity = masterwork } + } + add = { + value = 8 + } + } + else = { + add = { + value = 4 + } + } + + # Boost the value up to something meaningful + multiply = { + value = 10 + } + + # multiply by durability percentage + multiply = { + add = scope:artifact.artifact_durability + divide = scope:artifact.artifact_max_durability + divide = 2 + add = 0.5 + } + + #Nerf it to bits for LAAMPs + if = { + limit = { + $DESTROYER$ = { has_government = landless_adventurer_government } + } + multiply = { + value = 0.1 + round = yes + } + } + if = { + limit = { + exists = scope:artifact.var:ai_to_ai_destroy_in_sieges # Trash artifact + } + max = { + value = $DESTROYER$.tiny_gold_value + multiply = 0.5 + } + } + + min = 1 + } + } + destroy_owned_artifact = scope:artifact + } +} + +give_destroyed_artifact_piety = { + add_piety = { + # Base value + value = 5 + # Add the artifact's quality + if = { + limit = { exists = scope:artifact.var:quality } + add = scope:artifact.var:quality + } + # If none can be found, add its wealth + else_if = { + limit = { exists = scope:artifact.var:wealth } + add = scope:artifact.var:wealth + } + # Artifact has no quality or wealth (typical for court artifacts), add something based on rarity + else_if = { + limit = { + scope:artifact = { rarity = illustrious } + } + add = { + value = 20 + } + } + else_if = { + limit = { + scope:artifact = { rarity = famed } + } + add = { + value = 12 + } + } + else_if = { + limit = { + scope:artifact = { rarity = masterwork } + } + add = { + value = 8 + } + } + else = { + add = { + value = 4 + } + } + # Boost the value up to something meaningful + multiply = 20 + # Relics are way cooler to burn, double the final value + if = { + limit = { + scope:artifact = { exists = var:relic } + } + multiply = { + value = 2 + desc = aniconist_destroying_relic + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_ep1_court_type_effects.txt b/N3OW/common/scripted_effects/00_ep1_court_type_effects.txt new file mode 100644 index 00000000..f72df84d --- /dev/null +++ b/N3OW/common/scripted_effects/00_ep1_court_type_effects.txt @@ -0,0 +1,254 @@ + +# EFFECTS RELATONG TO THE DIFFERENT COURT TYPES + +#court_trait_handle_multiple_scopes_effect +#court_trait_save_scopes_and_send_interface_message_effect +#assign_court_type_traits_to_courtiers_effect + + +# Effect to save down the multiple scopes needed to send interface messages about courtiers gaining/leveling court type traits +court_trait_handle_multiple_scopes_effect = { + #Save down two scopes for the gathered message + random_courtier = { + limit = { + ep1_courtier_valid_for_court_trait_$TRAIT_LEVEL$_trigger = { TYPE = $COURT_TYPE$ } + is_of_major_interest_to_root_trigger = yes + } + alternative_limit = { + ep1_courtier_valid_for_court_trait_$TRAIT_LEVEL$_trigger = { TYPE = $COURT_TYPE$ } + is_of_minor_interest_to_root_trigger = yes + } + alternative_limit = { + ep1_courtier_valid_for_court_trait_$TRAIT_LEVEL$_trigger = { TYPE = $COURT_TYPE$ } + } + save_scope_as = courtier_1 + } + random_courtier = { + limit = { + ep1_courtier_valid_for_court_trait_$TRAIT_LEVEL$_trigger = { TYPE = $COURT_TYPE$ } + is_of_major_interest_to_root_trigger = yes + this != scope:courtier_1 + } + alternative_limit = { + ep1_courtier_valid_for_court_trait_$TRAIT_LEVEL$_trigger = { TYPE = $COURT_TYPE$ } + is_of_minor_interest_to_root_trigger = yes + this != scope:courtier_1 + } + alternative_limit = { + ep1_courtier_valid_for_court_trait_$TRAIT_LEVEL$_trigger = { TYPE = $COURT_TYPE$ } + this != scope:courtier_1 + } + save_scope_as = courtier_2 + } + set_variable = { + name = num_other_relevant_courtiers + value = 1 + } + every_courtier = { + limit = { + ep1_courtier_valid_for_court_trait_$TRAIT_LEVEL$_trigger = { TYPE = $COURT_TYPE$ } + } + change_trait_rank = { + trait = $COURT_TYPE$_court + rank = 1 + } + root = { + change_variable = { + name = num_other_relevant_courtiers + add = 1 + } + } + } +} + +# Effect to send interface messages about courtiers gaining/leveling court specific traits +court_trait_save_scopes_and_send_interface_message_effect = { + # Second trait level at CG level 8 + if = { + limit = { + any_courtier = { + ep1_courtier_valid_for_court_trait_2_trigger = { TYPE = $COURT_TYPE$ } + } + } + # If it's more than two we send a gathered message + if = { + limit = { + any_courtier = { + ep1_courtier_valid_for_court_trait_2_trigger = { TYPE = $COURT_TYPE$ } + count > 2 + } + } + court_trait_handle_multiple_scopes_effect = { + COURT_TYPE = $COURT_TYPE$ + TRAIT_LEVEL = 2 + } + send_interface_message = { + type = msg_courtiers_gain_court_traits + title = multiple_courtiers_gained_court_type_trait_title + left_icon = scope:courtier_1 + right_icon = scope:courtier_2 + custom_tooltip = multiple_courtiers_gained_$COURT_TYPE$_2_trait_desc + } + remove_variable = num_other_relevant_courtiers + } + # Else we send one message per courtier + else = { + every_courtier = { + limit = { + ep1_courtier_valid_for_court_trait_2_trigger = { TYPE = $COURT_TYPE$ } + } + save_scope_as = courtier + root = { + send_interface_message = { + type = msg_courtiers_gain_court_traits + title = courtier_gained_court_type_trait_title + right_icon = scope:courtier + scope:courtier = { + change_trait_rank = { + trait = $COURT_TYPE$_court + rank = 1 + } + } + } + } + } + } + } + # First trait level at CG level 5 + if = { + limit = { + any_courtier = { + ep1_courtier_valid_for_court_trait_1_trigger = { TYPE = $COURT_TYPE$ } + } + } + # If it's more than two we send a gathered message + if = { + limit = { + any_courtier = { + ep1_courtier_valid_for_court_trait_1_trigger = { TYPE = $COURT_TYPE$ } + count > 2 + } + } + court_trait_handle_multiple_scopes_effect = { + COURT_TYPE = $COURT_TYPE$ + TRAIT_LEVEL = 1 + } + send_interface_message = { + type = msg_courtiers_gain_court_traits + title = multiple_courtiers_gained_court_type_trait_title + left_icon = scope:courtier_1 + right_icon = scope:courtier_2 + custom_tooltip = multiple_courtiers_gained_$COURT_TYPE$_1_trait_desc + } + } + # Else we send one message per courtier + else = { + every_courtier = { + limit = { + ep1_courtier_valid_for_court_trait_1_trigger = { TYPE = $COURT_TYPE$ } + } + save_scope_as = courtier + root = { + send_interface_message = { + type = msg_courtiers_gain_court_traits + title = courtier_gained_court_type_trait_title + right_icon = scope:courtier + scope:courtier = { + change_trait_rank = { + trait = $COURT_TYPE$_court + rank = 1 + } + } + #custom_tooltip = courtier_gained_$COURT_TYPE$_1_trait_desc + } + } + } + } + } +} + +# Main effect for handling courtiers gaining/leveling court type traits +assign_court_type_traits_to_courtiers_effect = { + save_scope_value_as = { + name = cgv_value + value = root.court_grandeur_current_level + } + # Diplomatic Court + if = { + limit = { + has_court_type = court_diplomatic + any_courtier = { + days_since_joined_court >= days_to_gain_court_type_trait + OR = { #Either they have no trait, or they have one we can level + ep1_courtier_valid_for_court_trait_1_trigger = { TYPE = diplomatic } + ep1_courtier_valid_for_court_trait_2_trigger = { TYPE = diplomatic } + } + } + } + court_trait_save_scopes_and_send_interface_message_effect = { COURT_TYPE = diplomatic } + } + # Warlike Court + if = { + limit = { + OR = { + has_court_type = court_warlike + has_court_type = court_tribal + has_court_type = court_nomadic + } + any_courtier = { + days_since_joined_court >= days_to_gain_court_type_trait + OR = { #Either they have no trait, or they have one we can level + ep1_courtier_valid_for_court_trait_1_trigger = { TYPE = warlike } + ep1_courtier_valid_for_court_trait_2_trigger = { TYPE = warlike } + } + } + } + court_trait_save_scopes_and_send_interface_message_effect = { COURT_TYPE = warlike } + } + + # Administrative Court + if = { + limit = { + has_court_type = court_administrative + any_courtier = { + days_since_joined_court >= days_to_gain_court_type_trait + OR = { #Either they have no trait, or they have one we can level + ep1_courtier_valid_for_court_trait_1_trigger = { TYPE = administrative } + ep1_courtier_valid_for_court_trait_2_trigger = { TYPE = administrative } + } + } + } + court_trait_save_scopes_and_send_interface_message_effect = { COURT_TYPE = administrative } + } + + # Intrigue Court + if = { + limit = { + has_court_type = court_intrigue + any_courtier = { + days_since_joined_court >= days_to_gain_court_type_trait + OR = { #Either they have no trait, or they have one we can level + ep1_courtier_valid_for_court_trait_1_trigger = { TYPE = intrigue } + ep1_courtier_valid_for_court_trait_2_trigger = { TYPE = intrigue } + } + } + } + court_trait_save_scopes_and_send_interface_message_effect = { COURT_TYPE = intrigue } + } + + # Scholarly Court + if = { + limit = { + has_court_type = court_scholarly + any_courtier = { + days_since_joined_court >= days_to_gain_court_type_trait + OR = { #Either they have no trait, or they have one we can level + ep1_courtier_valid_for_court_trait_1_trigger = { TYPE = scholarly } + ep1_courtier_valid_for_court_trait_2_trigger = { TYPE = scholarly } + } + } + } + court_trait_save_scopes_and_send_interface_message_effect = { COURT_TYPE = scholarly } + } +} + diff --git a/N3OW/common/scripted_effects/00_ep1_hold_court_effects.txt b/N3OW/common/scripted_effects/00_ep1_hold_court_effects.txt new file mode 100644 index 00000000..1e2ae945 --- /dev/null +++ b/N3OW/common/scripted_effects/00_ep1_hold_court_effects.txt @@ -0,0 +1,1671 @@ + +# EFFECTS RELATING TO HOLD COURT + +clear_court_event_participation = { + if ={ + limit = { + is_alive = yes + has_character_flag = in_court_event + } + remove_character_flag = in_court_event + } +} + +apply_hold_court_grace_effect = { + if = { + limit = { + has_dlc_feature = royal_court + has_royal_court = yes + + #Character fulfills the pre-reqs + is_playable_character = yes + highest_held_title_tier >= tier_kingdom + OR = { + government_has_flag = government_is_feudal + government_has_flag = government_is_clan + } + is_available_adult = yes + court_grandeur_current_level >= 1 + } + if = { + limit = { has_variable = last_hold_court_date } + remove_variable = last_hold_court_date + } + set_variable = { + name = last_hold_court_date + value = current_year + } + } +} + +# hire scope as position +employ_character_as_position_in_current_scope_court_effect = { + save_scope_as = current_scope + if = { + limit = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = $POSITION$_court_position + } + } + #If character isn't already in your court, but a wandering guest, you recruit them + if = { + limit = { + $CHARACTER$ = { is_pool_guest = yes } + } + add_courtier = $CHARACTER$ + } + court_position_grant_effect = { + EMPLOYER = scope:current_scope + POS = $POSITION$ + CANDIDATE = $CHARACTER$ + } + } +} + +# hire scope as position but for laamps +employ_character_as_position_in_current_scope_camp_effect = { + save_scope_as = current_scope + if = { + limit = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = $POSITION$_camp_officer + } + } + #If character isn't already in your court, but a wandering guest, you recruit them + if = { + limit = { + $CHARACTER$ = { is_pool_guest = yes } + } + add_courtier = $CHARACTER$ + } + camp_officer_grant_effect = { + EMPLOYER = scope:current_scope + POS = $POSITION$ + CANDIDATE = $CHARACTER$ + } + } +} + +# Hire scope in any available position. You must have checked that one exists first!, for example by using can_be_employed_in_any_court_position_trigger! +employ_character_as_any_free_position_effect = { + save_scope_as = hiring_character + hidden_effect = { + random_list = { + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = court_physician_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = court_physician + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = master_of_horse_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = master_of_horse + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = master_of_hunt_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = master_of_hunt + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = keeper_of_swans_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = keeper_of_swans + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = travel_leader_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = travel_leader + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = court_jester_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = court_jester + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = high_almoner_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = high_almoner + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = seneschal_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = seneschal + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = court_tutor_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = court_tutor + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = court_guru_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = court_guru + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = cupbearer_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = cupbearer + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = chief_eunuch_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = chief_eunuch + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = antiquarian_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = antiquarian + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = royal_architect_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = royal_architect + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = lady_in_waiting_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = lady_in_waiting + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = court_poet_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = court_poet + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = court_musician_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = court_musician + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = bodyguard_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = bodyguard + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = champion_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = champion + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = food_taster_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = food_taster + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = executioner_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = executioner + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = garuda_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = garuda + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = akolouthos_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = akolouthos + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = court_astrologer_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = court_astrologer + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = grand_preceptor_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = grand_preceptor + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = grand_guardian_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = grand_guardian + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = fire_dragon_engineer_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = fire_dragon_engineer + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = grand_mentor_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = grand_mentor + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = keeper_of_the_harem_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = keeper_of_the_harem + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = boyan_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = boyan + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = siege_engineer_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = siege_engineer + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = yurtchi_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = yurtchi + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = cherbi_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = cherbi + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = yeke_jarquchi_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = yeke_jarquchi + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = foreign_emissary_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = foreign_emissary + CANDIDATE = $CHARACTER$ + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = keeper_of_the_horses_court_position + } + } + court_position_grant_effect = { + EMPLOYER = scope:hiring_character + POS = keeper_of_the_horses + CANDIDATE = $CHARACTER$ + } + } + } + } +} + +# Mark a random court position to hire a person in. Use this in the immediate and then employ_character_as_marked_court_position_effect in the option to give proper tooltips about what position you're filling. +mark_court_position_for_employment_effect = { + hidden_effect = { + random_list = { + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = court_physician_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:court_physician_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = master_of_horse_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:master_of_horse_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = master_of_hunt_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:master_of_hunt_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = keeper_of_swans_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:keeper_of_swans_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = travel_leader_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:travel_leader_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = court_jester_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:court_jester_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = high_almoner_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:high_almoner_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = seneschal_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:seneschal_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = court_tutor_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:court_tutor_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = court_guru_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:court_guru_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = cupbearer_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:cupbearer_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = chief_eunuch_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:chief_eunuch_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = antiquarian_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:antiquarian_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = royal_architect_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:royal_architect_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = lady_in_waiting_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:lady_in_waiting_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = court_poet_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:court_poet_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = court_musician_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:court_musician_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = bodyguard_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:bodyguard_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = champion_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:champion_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = food_taster_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:food_taster_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = executioner_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:executioner_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = garuda_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:garuda_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = akolouthos_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:akolouthos_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = court_astrologer_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:court_astrologer_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = grand_preceptor_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:grand_preceptor_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = grand_guardian_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:grand_guardian_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = grand_mentor_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:grand_mentor_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = fire_dragon_engineer_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:fire_dragon_engineer_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = keeper_of_the_harem_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:keeper_of_the_harem_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = boyan_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:boyan_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = siege_engineer_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:siege_engineer_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = yurtchi_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:yurtchi_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = cherbi_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:cherbi_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = yeke_jarquchi_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:yeke_jarquchi_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = foreign_emissary_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:foreign_emissary_court_position + } + } + 10 = { + trigger = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = keeper_of_the_horses_court_position + } + } + save_scope_value_as = { + name = court_position_to_fill + value = flag:keeper_of_the_horses_court_position + } + } + } + } +} + +# To be used after mark_court_position_for_employment_effect to fill the position marked in that effect. +employ_character_as_marked_court_position_effect = { + if = { + limit = { + $POSITION$ = flag:court_physician_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = court_physician_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = court_physician_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:master_of_horse_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = master_of_horse_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = master_of_horse_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:master_of_hunt_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = master_of_hunt_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = master_of_hunt_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:keeper_of_swans_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = keeper_of_swans_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = keeper_of_swans_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:travel_leader_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = travel_leader_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = travel_leader_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:court_jester_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = court_jester_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = court_jester_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:high_almoner_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = high_almoner_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = high_almoner_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:seneschal_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = seneschal_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = seneschal_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:court_tutor_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = court_tutor_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = court_tutor_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:court_guru_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = court_guru_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = court_guru_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:cupbearer_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = cupbearer_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = cupbearer_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:chief_eunuch_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = chief_eunuch_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = chief_eunuch_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:antiquarian_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = antiquarian_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = antiquarian_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:royal_architect_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = royal_architect_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = royal_architect_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:lady_in_waiting_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = lady_in_waiting_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = lady_in_waiting_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:court_poet_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = court_poet_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = court_poet_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:court_musician_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = court_musician_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = court_musician_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:bodyguard_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = bodyguard_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = bodyguard_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:champion_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = champion_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = champion_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:food_taster_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = food_taster_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = food_taster_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:executioner_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = executioner_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = executioner_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:garuda_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = garuda_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = garuda_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:akolouthos_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = akolouthos_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = akolouthos_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:court_astrologer_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = court_astrologer_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = court_astrologer_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:grand_preceptor_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = grand_preceptor_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = grand_preceptor_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:grand_guardian_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = grand_guardian_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = grand_guardian_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:grand_mentor_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = grand_mentor_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = grand_mentor_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:fire_dragon_engineer_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = fire_dragon_engineer_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = fire_dragon_engineer_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:keeper_of_the_harem_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = keeper_of_the_harem_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = keeper_of_the_harem_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:boyan_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = boyan_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = boyan_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:siege_engineer_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = siege_engineer_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = siege_engineer_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:yurtchi_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = yurtchi_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = yurtchi_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:cherbi_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = cherbi_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = cherbi_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:yeke_jarquchi_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = yeke_jarquchi_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = yeke_jarquchi_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:foreign_emissary_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = foreign_emissary_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = foreign_emissary_court_position + } + } + else_if = { + limit = { + $POSITION$ = flag:keeper_of_the_horses_court_position + #Making sure they still can be employed in the position + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = keeper_of_the_horses_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = keeper_of_the_horses_court_position + } + } + + #If character isn't already in your court, but a wandering guest, you recruit them + if = { + limit = { + $CHARACTER$ = { is_pool_guest = yes } + } + add_courtier = $CHARACTER$ + } +} + +replace_existing_position_with_character_in_current_scope_court_effect = { + if = { + limit = { + can_appoint_char_to_court_position = { + CHAR = $CHARACTER$ + COURT_POS = $POSITION$ + } + } + + if = { + limit = { + any_courtier = { + has_court_position = $POSITION$ + } + } + random_courtier = { + limit = { + has_court_position = $POSITION$ + } + replace_court_position = { + recipient = $CHARACTER$ + holder = PREV + court_position = $POSITION$ + } + } + } + else = { + appoint_court_position = { + recipient = $CHARACTER$ + court_position = $POSITION$ + } + } + } +} + +hold_court_queue_next_event_effect = { + # Sort the widget for next time. + change_variable = { + name = petitioner_current_progress + add = 1 + } + # Update the widget. + save_scope_value_as = { + name = event_chain_progress + value = var:petitioner_current_progress + } + # Trigger the next event along. + if = { + limit = { var:num_petitioners >= 1 } + # Reduce the tracking variable by one. + change_variable = { + name = num_petitioners + add = -1 + } + # Then, trigger an event. + trigger_event = { on_action = hold_court_event_selection } + } + # Or else remove the empty variable. + else = { remove_variable = num_petitioners } +} + +hold_court_queue_post_event_effect = { + # Sort the ending counter. + ## If there's no ending counter, create one. + if = { + limit = { + NOT = { has_variable = petitioners_dealt_with_count } + } + set_variable = { + name = petitioners_dealt_with_count + value = 1 + } + } + ## Else if there is a counter below the total petitioner tally, increment it. + else_if = { + limit = { var:petitioners_dealt_with_count < initial_petitioners_value } + change_variable = { + name = petitioners_dealt_with_count + add = 1 + } + } + ## If appropriate, run the end stuff. + if = { + limit = { + exists = var:petitioners_dealt_with_count + var:petitioners_dealt_with_count >= initial_petitioners_value + } + # Remove the counter. + remove_variable = petitioners_dealt_with_count + # Launch into cleanup. + trigger_event = hold_court.0021 + } +} + +# Adds a character flag that is used for all court events so they don't steal characters from each other +court_event_character_flag_effect = { + add_character_flag = { + flag = in_court_event + days = 180 + } +} + +# Petition Liege Variable Cleanup +petition_liege_variable_cleanup_effect = { + if = { + limit = { has_variable = petition_liege_scope } + remove_variable = petition_liege_scope + } + if = { + limit = { has_variable = petition_type } + remove_variable = petition_type + } + if = { + limit = { has_character_flag = petition_liege_character_flag } + remove_character_flag = petition_liege_character_flag + } + if = { + limit = { has_variable_list = available_petitions } + clear_variable_list = available_petitions + } + if = { + limit = { has_variable_list = petitions_to_show } + clear_variable_list = petitions_to_show + } +} + +petition_ceremonial_liege_variable_cleanup_effect = { + if = { + limit = { has_variable = petition_ceremonial_liege_scope } + remove_variable = petition_ceremonial_liege_scope + } + if = { + limit = { has_variable = petition_type } + remove_variable = petition_type + } + if = { + limit = { has_character_flag = petition_ceremonial_liege_character_flag } + remove_character_flag = petition_ceremonial_liege_character_flag + } + if = { + limit = { has_variable_list = available_petitions } + clear_variable_list = available_petitions + } + if = { + limit = { has_variable_list = petitions_to_show } + clear_variable_list = petitions_to_show + } +} diff --git a/N3OW/common/scripted_effects/00_ep1_inspiration_effects.txt b/N3OW/common/scripted_effects/00_ep1_inspiration_effects.txt new file mode 100644 index 00000000..c3d3926a --- /dev/null +++ b/N3OW/common/scripted_effects/00_ep1_inspiration_effects.txt @@ -0,0 +1,3109 @@ + +fund_inspiration_effect = { + scope:recipient = { + if = { + limit = { + NOT = { is_courtier_of = scope:actor } + } + if = { + limit = { + any_traveling_family_member = { + can_any_traveling_family_members_travel_trigger = yes + } + } + every_traveling_family_member = { + custom = fund_inspiration_interaction_reqruit_family_tooltip + limit = { + can_any_traveling_family_members_travel_trigger = yes + } + scope:actor = { + add_courtier = prev + } + } + } + scope:actor = { + add_courtier = scope:recipient + } + } + add_opinion = { + target = scope:actor + modifier = grateful_opinion + opinion = 40 + } + } + scope:actor = { + sponsor_inspiration = scope:recipient.inspiration + } + if = { + limit = { + scope:actor = { + is_ai = no + } + NOT = { + exists = global_var:ep1_07_achievement_inspiration_count_tracker + } + } + set_global_variable = { + name = ep1_07_achievement_inspiration_count_tracker + value = 1 + } + } + else_if = { + limit = { + scope:actor = { + is_ai = no + } + exists = global_var:ep1_07_achievement_inspiration_count_tracker + } + change_global_variable = { + name = ep1_07_achievement_inspiration_count_tracker + add = 1 + } + } +} + +grant_inspiration_reward_effect = { + add_gold = { + value = root.inspiration_gold_invested + multiply = 0.25 + } + add_prestige_level = 1 + add_prestige = { + value = root.inspiration_gold_invested + multiply = 0.75 + } +} + +set_alchemy_inspiration_type_effect = { + save_temporary_scope_value_as = { + name = allow_no_type_option + value = $NO_TYPE$ + } + hidden_effect = { + $BASE_SCOPE$ = { + #The type has been decided in events, when the character got inspired, or now. Let's save it! (might still leave it up to the sponsor if allow_no_type_option = yes!) + if = { + limit = { + NOT = { exists = var:artifact_alchemy_type } + } + random_list = { #What do they want to do? + 5 = { #Elixirs + modifier = { + add = 5 + has_trait = arrogant + } + set_variable = { + name = artifact_alchemy_type + value = flag:alchemy_type_elixirs + } + } + 10 = { #Metals + set_variable = { + name = artifact_alchemy_type + value = flag:alchemy_type_metals + } + } + 10 = { #Panacea: a cure-all for all disease + modifier = { + add = 10 + has_trait = lifestyle_physician + } + set_variable = { + name = artifact_alchemy_type + value = flag:alchemy_type_panacea + } + } + 5 = { #Immortality + modifier = { + add = 5 + has_trait = arrogant + } + set_variable = { + name = artifact_alchemy_type + value = flag:alchemy_type_immortality + } + } + 50 = { #They don't care and you can decide! + trigger = { + scope:allow_no_type_option = yes + } + modifier = { + add = 30 + has_personality_submissive_trigger = yes + } + ai_value_modifier = { + ai_boldness = -0.25 + ai_energy = -0.25 + } + } + } + } + } + } +} + + +################ +# Adventurer Inspiration effects +################ +# The Adventurer Inspiration is a bit special since it can result in many different types of artifacts, so we handle the generation here + +# Where is the adventurer going? +set_adventure_location_effect = { + save_temporary_scope_value_as = { + name = allow_no_destination_option + value = $NO_DESTINATION$ + } + hidden_effect = { #If they haven't specified where they're going we decide it here (might still leave it up to the sponsor if allow_no_destination_option = yes!) + $BASE_SCOPE$ = { + if = { + limit = { + NOT = { exists = var:adventure_destination } + } + random_list = { + 10 = { + # Africa + trigger = { + trigger_if = { + limit = { exists = location } + location = { + NOT = { geographical_region = world_africa } + } + adventurer_potential_destination_distance_check = { + REGION = world_africa + } + } + } + set_variable = { + name = adventure_destination + value = flag:africa + } + } + 10 = { + # West Africa + trigger = { + trigger_if = { + limit = { exists = location } + adventurer_potential_destination_distance_check = { + REGION = world_africa_west + } + } + } + set_variable = { + name = adventure_destination + value = flag:africa_west + } + } + 10 = { + # North Africa + trigger = { + trigger_if = { + limit = { exists = location } + adventurer_potential_destination_distance_check = { + REGION = world_africa_north + } + } + } + set_variable = { + name = adventure_destination + value = flag:africa_north + } + } + 10 = { + # East Africa + trigger = { + trigger_if = { + limit = { exists = location } + adventurer_potential_destination_distance_check = { + REGION = world_africa_east + } + } + } + set_variable = { + name = adventure_destination + value = flag:africa_east + } + } + 10 = { + # Europe + trigger = { + trigger_if = { + limit = { exists = location } + location = { + NOT = { geographical_region = world_europe } + } + adventurer_potential_destination_distance_check = { + REGION = world_europe + } + } + } + set_variable = { + name = adventure_destination + value = flag:europe + } + } + 5 = { + # North Europe + trigger = { + trigger_if = { + limit = { exists = location } + adventurer_potential_destination_distance_check = { + REGION = world_europe_north + } + } + } + set_variable = { + name = adventure_destination + value = flag:europe_north + } + } + 10 = { + # South Europe + trigger = { + trigger_if = { + limit = { exists = location } + adventurer_potential_destination_distance_check = { + REGION = world_europe_south + } + } + } + set_variable = { + name = adventure_destination + value = flag:europe_south + } + } + 10 = { + # West Europe + trigger = { + trigger_if = { + limit = { exists = location } + adventurer_potential_destination_distance_check = { + REGION = world_europe_west + } + } + } + set_variable = { + name = adventure_destination + value = flag:europe_west + } + } + 10 = { + # East Europe + trigger = { + trigger_if = { + limit = { exists = location } + adventurer_potential_destination_distance_check = { + REGION = world_europe_east + } + } + } + set_variable = { + name = adventure_destination + value = flag:europe_east + } + } + 10 = { + # Middle East + trigger = { + trigger_if = { + limit = { exists = location } + location = { + NOT = { geographical_region = world_middle_east } + } + adventurer_potential_destination_distance_check = { + REGION = world_middle_east + } + } + } + set_variable = { + name = adventure_destination + value = flag:middle_east + } + } + 10 = { + # Middle East - Jerusalem + trigger = { + trigger_if = { + limit = { exists = location } + adventurer_potential_destination_distance_check = { + REGION = world_middle_east_jerusalem + } + } + } + set_variable = { + name = adventure_destination + value = flag:middle_east_jerusalem + } + } + 10 = { + # Middle East - Arabia + trigger = { + trigger_if = { + limit = { exists = location } + adventurer_potential_destination_distance_check = { + REGION = world_middle_east_arabia + } + } + } + set_variable = { + name = adventure_destination + value = flag:middle_east_arabia + } + } + 10 = { + # Middle East - Persia + trigger = { + trigger_if = { + limit = { exists = location } + adventurer_potential_destination_distance_check = { + REGION = world_middle_east_persia + } + } + } + set_variable = { + name = adventure_destination + value = flag:middle_east_persia + } + } + 10 = { + # India + trigger = { + trigger_if = { + limit = { exists = location } + location = { + NOT = { geographical_region = world_india } + } + adventurer_potential_destination_distance_check = { + REGION = world_india + } + } + } + set_variable = { + name = adventure_destination + value = flag:india + } + } + 10 = { + # India - Deccan + trigger = { + trigger_if = { + limit = { exists = location } + adventurer_potential_destination_distance_check = { + REGION = world_india_deccan + } + } + } + set_variable = { + name = adventure_destination + value = flag:india_deccan + } + } + 10 = { + # India - Bengal + trigger = { + trigger_if = { + limit = { exists = location } + adventurer_potential_destination_distance_check = { + REGION = world_india_bengal + } + } + } + set_variable = { + name = adventure_destination + value = flag:india_bengal + } + } + 10 = { + # India - Rajastan + trigger = { + trigger_if = { + limit = { exists = location } + adventurer_potential_destination_distance_check = { + REGION = world_india_rajastan + } + } + } + set_variable = { + name = adventure_destination + value = flag:india_rajastan + } + } + 5 = { + # The Steppe + trigger = { + trigger_if = { + limit = { exists = location } + location = { + NOT = { geographical_region = world_steppe } + } + adventurer_potential_destination_distance_check = { + REGION = world_steppe + } + } + } + set_variable = { + name = adventure_destination + value = flag:steppe + } + } + 5 = { + # The Steppe - West + trigger = { + trigger_if = { + limit = { exists = location } + adventurer_potential_destination_distance_check = { + REGION = world_steppe_west + } + } + } + set_variable = { + name = adventure_destination + value = flag:steppe_west + } + } + 5 = { + # The Steppe - East + trigger = { + trigger_if = { + limit = { exists = location } + adventurer_potential_destination_distance_check = { + REGION = world_steppe_east + } + } + } + set_variable = { + name = adventure_destination + value = flag:steppe_east + } + } + 5 = { + # The Steppe - Tarim + trigger = { + trigger_if = { + limit = { exists = location } + adventurer_potential_destination_distance_check = { + REGION = world_steppe_tarim + } + } + } + set_variable = { + name = adventure_destination + value = flag:steppe_tarim + } + } + 10 = { + # Asia - Minor + trigger = { + trigger_if = { + limit = { exists = location } + adventurer_potential_destination_distance_check = { + REGION = world_asia_minor + } + } + } + set_variable = { + name = adventure_destination + value = flag:asia_minor + } + } + 10 = { + # Burma + trigger = { + trigger_if = { + limit = { exists = location } + adventurer_potential_destination_distance_check = { + REGION = world_burma + } + } + } + set_variable = { + name = adventure_destination + value = flag:burma + } + } + 10 = { + # Tibet + trigger = { + trigger_if = { + limit = { exists = location } + adventurer_potential_destination_distance_check = { + REGION = world_tibet + } + } + } + set_variable = { + name = adventure_destination + value = flag:tibet + } + } + 85 = { #Very skillde adventurers are often going to let you decide! + trigger = { + scope:allow_no_destination_option = yes + } + modifier = { + add = 40 + has_personality_submissive_trigger = yes + } + ai_value_modifier = { + ai_boldness = -0.25 + ai_energy = -0.25 + } + } + } + } + } + } +} + +get_adventure_inspiration_start_location = { + $ADVENTURER$ = { save_scope_as = adventurer } + scope:adventurer = { + if = { + limit = { exists = var:adventure_destination } + switch = { + trigger = var:adventure_destination + flag:africa = { # Africa + random_county_in_region = { + region = world_africa + title_province = { save_scope_as = location } + } + } + flag:africa_west = { # West Africa + random_county_in_region = { + region = world_africa_west + title_province = { save_scope_as = location } + } + } + flag:africa_north = { # North Africa + random_county_in_region = { + region = world_africa_north + title_province = { save_scope_as = location } + } + } + flag:africa_east = { # East Africa + random_county_in_region = { + region = world_africa_east + title_province = { save_scope_as = location } + } + } + flag:europe = { # Europe + random_county_in_region = { + region = world_europe + title_province = { save_scope_as = location } + } + } + flag:europe_north = { # North Europe + random_county_in_region = { + region = world_europe_north + title_province = { save_scope_as = location } + } + } + flag:europe_south = { # South Europe + random_county_in_region = { + region = world_europe_south + title_province = { save_scope_as = location } + } + } + flag:europe_west = { # West Europe + random_county_in_region = { + region = world_europe_west + title_province = { save_scope_as = location } + } + } + flag:europe_east = { # East Europe + random_county_in_region = { + region = world_europe_east + title_province = { save_scope_as = location } + } + } + flag:middle_east = { # Middle East + random_county_in_region = { + region = world_middle_east + title_province = { save_scope_as = location } + } + } + flag:middle_east_jerusalem = { # Middle East - Jerusalem + random_county_in_region = { + region = world_middle_east_jerusalem + title_province = { save_scope_as = location } + } + } + flag:middle_east_arabia = { # Middle East - Arabia + random_county_in_region = { + region = world_middle_east_arabia + title_province = { save_scope_as = location } + } + } + flag:middle_east_persia = { # Middle East - Persia + random_county_in_region = { + region = world_middle_east_persia + title_province = { save_scope_as = location } + } + } + flag:india = { # India + random_county_in_region = { + region = world_india + title_province = { save_scope_as = location } + } + } + flag:india_deccan = { # India - Deccan + random_county_in_region = { + region = world_india_deccan + title_province = { save_scope_as = location } + } + } + flag:india_bengal = { # India - Bengal + random_county_in_region = { + region = world_india_bengal + title_province = { save_scope_as = location } + } + } + flag:india_rajastan = { # India - Rajastan + random_county_in_region = { + region = world_india_rajastan + title_province = { save_scope_as = location } + } + } + flag:steppe = { # The Steppe + random_county_in_region = { + region = world_steppe + title_province = { save_scope_as = location } + } + } + flag:steppe_west = { # The Steppe - West + random_county_in_region = { + region = world_steppe_west + title_province = { save_scope_as = location } + } + } + flag:steppe_east = { # The Steppe - East + random_county_in_region = { + region = world_steppe_east + title_province = { save_scope_as = location } + } + } + flag:steppe_tarim = { # The Steppe - Tarim + random_county_in_region = { + region = world_steppe_tarim + title_province = { save_scope_as = location } + } + } + flag:asia_minor = { # Asia - Minor + random_county_in_region = { + region = world_asia_minor + title_province = { save_scope_as = location } + } + } + flag:burma = { # Burma + random_county_in_region = { + region = world_burma + title_province = { save_scope_as = location } + } + } + flag:tibet = { # Tibet + random_county_in_region = { + region = world_tibet + title_province = { save_scope_as = location } + } + } + } + } + } +} + +inspiration_adventure_create_artifact_effect = { + $OWNER$ = { save_scope_as = owner } #Will always exist! + $CREATOR$ = { save_scope_as = adventurer } #Will always exist in an adventure inspiration! + + #If you've somehow managed to not set a destination by now we generate one here + if = { + limit = { + NOT = { exists = scope:adventurer.var:adventure_destination } + } + set_adventure_location_effect = { + BASE_SCOPE = scope:adventurer + NO_DESTINATION = no + } + get_adventure_inspiration_start_location = { ADVENTURER = scope:adventurer } + } + else = { + #To save the location and make sure materials can access it + scope:adventurer.location = { save_scope_as = location } # To save the location scope based on the destination + } + + #Creating the artifact based on the previous choice and outcome + scope:adventurer = { + hidden_effect = { + if = { + limit = { exists = scope:location } + scope:location = { add_to_list = artifact_material_sources } #Used for artifact creation + } + create_character = { + location = root.location + template = local_artisan_template + culture = scope:location.culture + faith = scope:location.faith + gender = scope:adventurer + dynasty = none + save_scope_as = artifact_origin #Fictional maker of artifact + } + + random_list = { + 25 = { + trigger = { #Epic Artifact + trigger_if = { + limit = { exists = var:adventure_type } + OR = { + var:adventure_type = flag:epic_quest + var:adventure_type = flag:free_reign + } + } + } + modifier = { + scope:adventurer.adventure_inspiration_average_skill_value <= low_inspiration_skill + add = -10 + } + modifier = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + add = 25 + } + root = { + random_list = { + 10 = { #Chance of Relic + modifier = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + add = -5 #More likely to find something better. + } + modifier = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + add = -4 #High inspiration skill adventurers will only find relics if there is nothing else to find. + } + random_list = { #This is a list inside an item in the other list because we need _one_ chance for relic and the relic types must be able to have overlapping triggers. + 100 = { #Christian + trigger = { + scope:location ?= { + OR = { + faith.religion = religion:christianity_religion + geographical_region = world_europe + geographical_region = world_middle_east_jerusalem + } + } + } + modifier = { + NOT = { scope:location.religion = religion:christianity_religion } + add = -75 + } + random_list = { + 75 = { + create_artifact_pedestal_christian_relic_effect_hist = { + OWNER = root + } + } + 10 = { + create_artifact_pedestal_crucifix_effect = { OWNER = root } + } + 10 = { + create_artifact_pedestal_cross_effect = { OWNER = root } + } + } + } + 100 = { #Islamic + trigger = { + scope:location ?= { + OR = { + religion = religion:islam_religion + geographical_region = world_africa_north + geographical_region = world_middle_east + } + } + } + modifier = { + NOT = { scope:location.religion = religion:islam_religion } + add = -75 + } + create_artifact_pedestal_islamic_relic_effect_hist = { OWNER = root } + } + 100 = { #Buddhist + trigger = { + scope:location ?= { + OR = { + religion = religion:buddhism_religion + geographical_region = world_india + geographical_region = world_tibet + geographical_region = world_burma + geographical_region = world_himalaya + geographical_region = world_asia_china + geographical_region = world_asia_japan + geographical_region = world_asia_korea + geographical_region = world_asia_southeast + } + } + } + modifier = { + NOT = { scope:location.religion = religion:buddhism_religion } + add = -75 + } + random_list = { + 50 = { + create_artifact_pedestal_buddhism_relic_effect_hist = { OWNER = root } + } + 10 = { + trigger = { + any_artifact = { + count < 3 + has_variable = cintamani_buddhist + } + } + create_artifact_cintamani_buddhist_effect = { OWNER = root } + } + 10 = { + trigger = { + any_artifact = { + count < 1 + has_variable = staff_kakusandha + } + } + create_artifact_staff_kakusandha_effect = { OWNER = root } + } + 10 = { + trigger = { + any_artifact = { + count < 1 + has_variable = konagamana + } + } + create_artifact_konagamana_effect = { OWNER = root } + } + 10 = { + trigger = { + any_artifact = { + count < 1 + has_variable = kassapa + } + } + create_artifact_robe_kassapa_effect = { OWNER = root } + } + } + } + 85 = { #Jainist + trigger = { + scope:location ?= { + OR = { + religion = religion:jainism_religion + geographical_region = world_india + geographical_region = world_tibet + geographical_region = world_burma + geographical_region = world_himalaya + } + } + } + modifier = { + NOT = { scope:location.religion = religion:jainism_religion } + add = -75 + } + create_artifact_siddhachakra_effect = { OWNER = root } + } + 100 = { #Zoroastrian + trigger = { + scope:location ?= { + OR = { + religion = religion:zoroastrianism_religion + geographical_region = world_middle_east_persia + } + } + } + modifier = { + NOT = { scope:location.religion = religion:zoroastrianism_religion } + add = -75 + } + random_list = { + 50 = { + create_artifact_pedestal_branch_relic_zoroastr_effect = { + OWNER = root + } + } + 50 = { + create_artifact_afarganyu_effect = { + OWNER = root + } + } + } + } + 100 = { #Germanic + trigger = { + scope:location ?= { + OR = { + religion = religion:germanic_religion + geographical_region = world_europe_north + } + } + } + modifier = { + NOT = { scope:location.religion = religion:germanic_religion } + add = -75 + } + create_artifact_pedestal_branch_relic_germanic_effect = { + OWNER = root + } + } + 100 = { #Roog + trigger = { + scope:location ?= { + OR = { + religion = religion:west_african_roog_religion + geographical_region = world_africa_west + } + } + } + modifier = { + NOT = { scope:location.religion = religion:west_african_roog_religion } + add = -75 + } + create_artifact_pedestal_branch_relic_boog_effect = { + OWNER = root + } + } + 100 = { #Slavic + trigger = { + scope:location ?= { + OR = { + religion = religion:slavic_religion + geographical_region = world_europe_east + geographical_region = world_europe_south_east + } + } + } + modifier = { + NOT = { scope:location.religion = religion:slavic_religion } + add = -75 + } + create_artifact_pedestal_branch_relic_slavic_effect = { + OWNER = root + } + } + 100 = { #Hinduism + trigger = { + scope:location ?= { + OR = { + religion = religion:hinduism_religion + geographical_region = world_india + geographical_region = world_himalaya + } + } + } + modifier = { + NOT = { scope:location.religion = religion:hinduism_religion } + add = -75 + } + random_list = { + 10 = { + trigger = { + any_artifact = { + count < 8 + has_variable = aruval + } + scope:location ?= { + OR = { + geographical_region = world_india + geographical_region = world_tibet + geographical_region = ghw_region_afghanistan + religion = religion:hinduism_religion + } + } + } + create_artifact_aruval_effect = { OWNER = root } + } + 10 = { + trigger = { + any_artifact = { + count < 12 + has_variable = conch + } + scope:location ?= { + OR = { + geographical_region = world_india + geographical_region = world_tibet + geographical_region = world_asia_southeast + religion = religion:hinduism_religion + } + } + } + create_artifact_pedestal_shankha_conch_effect = { OWNER = root } + } + 10 = { #Ancient Khanda + trigger = { + any_artifact = { + count < 8 + has_variable = khanda + } + scope:location ?= { + OR = { + geographical_region = world_india + geographical_region = world_tibet + geographical_region = ghw_region_afghanistan + religion = religion:hinduism_religion + } + } + } + create_artifact_khanda_effect = { OWNER = root } + } + 10 = { #Cintamani stone + trigger = { + any_artifact = { + count < 3 + has_variable = cintamani_hindu + } + scope:location ?= { + OR = { + geographical_region = world_india + geographical_region = world_tibet + geographical_region = ghw_region_afghanistan + religion = religion:hinduism_religion + } + } + } + create_artifact_cintamani_hindu_effect = { OWNER = root } + } + 25 = { + create_artifact_pedestal_branch_relic_hinduism_effect = { OWNER = root } + } + } + } + 100 = { #Judaism + trigger = { + scope:location ?= { + OR = { + religion = religion:judaism_religion + geographical_region = world_europe + geographical_region = world_middle_east + } + } + } + modifier = { + NOT = { scope:location.religion = religion:judaism_religion } + add = -75 + } + create_artifact_pedestal_reliquary_judaism_effect = { + OWNER = root + } + } + 100 = { #Finno-Ugric + trigger = { + scope:location ?= { + OR = { + religion = religion:finno_ugric_religion + geographical_region = world_europe_north + } + } + } + modifier = { + NOT = { scope:location.religion = religion:finno_ugric_religion } + add = -75 + } + random_list = { + 90 = { + create_artifact_sledovik_effect = { + OWNER = root + } + } + 10 = { + trigger = { + any_artifact = { + count < 3 + has_variable = kantele + } + } + create_artifact_kantele_effect = { + OWNER = root + } + } + } + } + 1 = { #Fallback Relic + create_artifact_pedestal_branch_relic_general_effect = { + OWNER = root + RELIGION = scope:location.religion + } + } + } + } + 2 = { #Ark of the covenant + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + NOT = { + any_artifact = { + has_variable = ark_of_the_covenant + } + } + scope:location ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_africa_north_east + geographical_region = world_africa_east + } + } + } + create_artifact_sculpture_ark_of_covenant_effect = { OWNER = root } + } + 2 = { #Babr E Bayan + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + NOT = { + any_artifact = { + has_variable = babr_e_bayan + } + } + scope:location ?= { + OR = { + geographical_region = world_middle_east_persia + #geographical_region = world_steppe + culture = { has_cultural_pillar = heritage_iranian } + } + } + } + create_artifact_sculpture_babr_e_bayan_effect = { OWNER = root } + } + 10 = { + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + NOT = { + any_artifact = { + has_variable = crown_of_justinian + } + } + scope:location ?= { + OR = { + geographical_region = custom_eastern_roman_empire + culture = { has_cultural_pillar = heritage_byzantine } + } + } + } + create_artifact_pedestal_justinian_effect = { OWNER = root } + } + 10 = { #Cup of Jamshid + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + NOT = { + any_artifact = { + has_variable = cup_jamshid + } + } + scope:location ?= { + OR = { + geographical_region = world_middle_east_persia + #geographical_region = world_steppe + culture = { has_cultural_pillar = heritage_iranian } + } + } + } + create_artifact_pedestal_cup_jamshid_effect = { OWNER = root } + } + 10 = { + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + NOT = { + any_artifact = { + has_variable = david_harp + } + } + scope:location ?= { + OR = { + geographical_region = world_middle_east_jerusalem + culture = { has_cultural_pillar = heritage_israelite } + faith.religion = religion:judaism_religion + } + } + } + create_artifact_pedestal_david_harp_effect = { OWNER = root } + } + 10 = { #Recreate if lost + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + NOT = { + any_artifact = { + has_variable = iron_crown + } + } + scope:location ?= { + OR = { + geographical_region = custom_northern_italy + culture = { has_cultural_pillar = heritage_latin } + } + } + } + create_artifact_pedestal_crown_iron_effect = { OWNER = root } + } + 10 = { + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + NOT = { + any_artifact = { + has_variable = banner_kaviani + } + } + scope:location ?= { + OR = { + geographical_region = world_middle_east_persia + #geographical_region = world_steppe + culture = { has_cultural_pillar = heritage_iranian } + } + } + } + create_artifact_wall_banner_kaviani_effect = { OWNER = root } + } + 10 = { + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + NOT = { + any_artifact = { + has_variable = banner_edessa + } + } + scope:location ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_asia_minor + } + } + } + create_artifact_wall_banner_edessa_effect = { OWNER = root } + } + 10 = { + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + current_year >= 1097 + character:107590 ?= { is_alive = no } #El Cid is not around + NOT = { + any_artifact = { + has_variable = sword_cid + } + } + scope:location ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_asia_minor + } + } + } + create_artifact_wall_cid_sword_effect = { OWNER = root } + } + 10 = { + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 9 + has_variable = sword_of_muhammad + } + scope:location ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_asia_minor + geographical_region = world_africa_north_east + religion = religion:islam_religion + } + } + } + create_artifact_wall_muhammad_sword_effect = { OWNER = root } + } + 10 = { + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + NOT = { + any_artifact = { + has_variable = sword_attila + } + } + scope:location ?= { + OR = { + geographical_region = custom_south_slavia + geographical_region = custom_carpathia + geographical_region = ghw_region_crimea + geographical_region = custom_bavaria + } + } + } + create_artifact_wall_sword_attila_effect = { OWNER = root } + } + 10 = { + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + NOT = { + any_artifact = { + has_variable = throne_scone + } + } + scope:location ?= { + geographical_region = world_europe_west_britannia + } + } + create_artifact_throne_scone_effect = { OWNER = root } + } + 10 = { + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + NOT = { + any_artifact = { + has_variable = throne_of_solomon + } + } + scope:location ?= { + OR = { + geographical_region = world_middle_east_jerusalem + culture = { has_cultural_pillar = heritage_israelite } + faith.religion = religion:judaism_religion + } + } + } + create_artifact_throne_solomon_effect = { OWNER = root } + } + 10 = { #Recreate if lost + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + NOT = { + any_artifact = { + has_variable = charlamagne_throne + } + } + scope:location ?= { + OR = { + geographical_region = custom_carolingian_francia + geographical_region = custom_carolingian_germany + geographical_region = custom_lotharingia + geographical_region = custom_northern_italy + } + } + } + create_artifact_throne_charlemagne_effect = { OWNER = root } + } + 15 = { #Excalibur + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = -10 #If the adventurer is of medium or above skill they will avoid mass produced swords. + } + trigger = { + any_artifact = { + count < 6 + has_variable = excalibur + } + scope:location ?= { + geographical_region = world_europe_west_britannia + } + } + create_artifact_excalibur_effect = { OWNER = root } + } + 10 = { #Head of St Edmund + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + NOT = { + any_artifact = { + has_variable = edmund_head + } + } + scope:location ?= { + OR = { + geographical_region = world_europe_west_britannia + geographical_region = world_europe_north + } + } + } + create_artifact_edmund_head_effect = { OWNER = root } + } + 10 = { #Dhammapada + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 10 + has_variable = dhammapada + } + scope:location ?= { + OR = { + geographical_region = world_india + geographical_region = world_tibet + geographical_region = ghw_region_afghanistan + religion = religion:buddhism_religion + geographical_region = world_asia_china + geographical_region = world_asia_japan + geographical_region = world_asia_korea + geographical_region = world_asia_southeast + } + } + } + create_artifact_dhammapada_effect = { OWNER = root } + } + 10 = { #Sutta Pitaka + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 10 + has_variable = vinaya_pitaka + } + scope:location ?= { + OR = { + geographical_region = world_india + geographical_region = world_tibet + geographical_region = ghw_region_afghanistan + religion = religion:buddhism_religion + geographical_region = world_asia_china + geographical_region = world_asia_japan + geographical_region = world_asia_korea + geographical_region = world_asia_southeast + } + } + } + create_artifact_sutta_pitaka_effect = { OWNER = root } + } + 10 = { #Vinaya Pitaka + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 10 + has_variable = sutta_pitaka + } + scope:location ?= { + OR = { + geographical_region = world_india + geographical_region = world_tibet + geographical_region = ghw_region_afghanistan + religion = religion:buddhism_religion + geographical_region = world_asia_china + geographical_region = world_asia_japan + geographical_region = world_asia_korea + geographical_region = world_asia_southeast + } + } + } + create_artifact_vinaya_pitaka_effect = { OWNER = root } + } + 10 = { #Abhidhamma + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 10 + has_variable = abhidhamma + } + scope:location ?= { + OR = { + geographical_region = world_india + geographical_region = world_tibet + geographical_region = ghw_region_afghanistan + religion = religion:buddhism_religion + geographical_region = world_asia_china + geographical_region = world_asia_japan + geographical_region = world_asia_korea + geographical_region = world_asia_southeast + } + } + } + create_artifact_abhidhamma_pitaka_effect = { OWNER = root } + } + 15 = { #Jewelled Danda + trigger = { + any_artifact = { + count < 10 + has_variable = danda + } + scope:location ?= { + OR = { + geographical_region = world_india + geographical_region = world_tibet + geographical_region = ghw_region_afghanistan + } + } + } + create_artifact_jewelled_danda_effect = { OWNER = ROOT } + } + 5 = { #Mountain of Light + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = koh_i_noor + } + scope:location ?= { + OR = { + geographical_region = world_india + geographical_region = world_tibet + geographical_region = ghw_region_afghanistan + } + } + } + create_artifact_pedestal_koh_i_noor_effect = { OWNER = ROOT } + } + 10 = { #Makarakundala + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 10 + has_variable = makarakundala + } + scope:location ?= { + OR = { + geographical_region = world_india + geographical_region = world_tibet + geographical_region = ghw_region_afghanistan + } + } + } + create_artifact_makarakundala_effect = { OWNER = ROOT } + } + 10 = { #Great Diamond + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = great_diamond + } + scope:location ?= { + OR = { + geographical_region = world_india + geographical_region = world_tibet + geographical_region = ghw_region_afghanistan + } + } + } + create_artifact_pedestal_great_diamond_effect = { OWNER = ROOT } + } + 10 = { #Al Taj + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = al_taj + } + scope:location ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_africa_north_east + } + } + } + create_artifact_al_taj_crown_effect = { OWNER = ROOT } + } + 10 = { #al-Sayf al-Khass + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = al_sayf_al_khass + } + scope:location ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_africa_north_east + } + } + } + create_artifact_al_sayf_al_khass_effect = { OWNER = ROOT } + } + 10 = { #Qadib al-Mulk + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = qadib_al_mulk + } + scope:location ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_africa_north_east + } + } + } + create_artifact_qadib_al_mulk_effect = { OWNER = ROOT } + } + 10 = { #Al Dawat + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = al_dawat + } + scope:location ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_africa_north_east + } + } + } + create_artifact_al_dawat_effect = { OWNER = ROOT } + } + 10 = { #Al Hafir + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = al_hafir + } + scope:location ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_africa_north_east + } + } + } + create_artifact_al_hafir_effect = { OWNER = ROOT } + } + 2 = { #Banner of thankfulness + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 2 + has_variable = banner_thankfulness + } + scope:location ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_africa_north_east + } + } + } + create_artifact_wall_banner_thankfulness_effect = { OWNER = ROOT } + } + 5 = { #Al Jabal + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = al_jabal + } + scope:location ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_middle_east_persia + } + } + } + create_artifact_pedestal_al_jabal_effect = { OWNER = ROOT } + } + 5 = { #Al Yatima + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = al_yatima + } + scope:location ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_africa_north_east + } + } + } + create_artifact_pedestal_al_yatima_effect = { OWNER = ROOT } + } + 10 = { #Dagger of Rostam + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = dagger_of_rostam + } + scope:location ?= { + OR = { + geographical_region = world_asia_minor + geographical_region = world_middle_east + geographical_region = world_middle_east_persia + } + } + } + create_artifact_dagger_of_rostam_effect = { OWNER = ROOT } + } + 10 = { #Ascalon + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = ascalon + } + scope:location ?= { + OR = { + geographical_region = world_asia_minor + geographical_region = world_middle_east + geographical_region = world_middle_east_persia + } + } + } + create_artifact_ascalon_effect = { OWNER = ROOT } + } + 10 = { #Shamshir-e Zomorrodnegar + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = zomorrodnegar + } + scope:location ?= { + OR = { + geographical_region = world_asia_minor + geographical_region = world_middle_east + geographical_region = world_middle_east_persia + } + } + } + create_artifact_zomorrodnegar_effect = { OWNER = ROOT } + } + 15 = { #Muhammads epistles + trigger = { + any_artifact = { + count < 12 + has_variable = muhammads_epistles + } + scope:location ?= { + OR = { + geographical_region = world_asia_minor + geographical_region = world_middle_east + geographical_region = world_middle_east_persia + } + } + } + create_artifact_muhammads_epistles_effect = { OWNER = ROOT } + } + 10 = { #Kave's Apron + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = kaves_apron + } + scope:location ?= { + OR = { + geographical_region = world_asia_minor + geographical_region = world_middle_east + geographical_region = world_middle_east_persia + } + } + } + create_artifact_kaves_apron_effect = { OWNER = ROOT } + } + 2 = { #Armor of Alexander the Great + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = arms_of_alex + } + scope:location ?= { + OR = { + geographical_region = world_india + geographical_region = world_asia_minor + geographical_region = world_middle_east + geographical_region = world_middle_east_persia + } + } + } + create_artifact_arms_of_alexander_effect = { OWNER = ROOT } + } + 10 = { #Olifant + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = olifant + } + scope:location ?= { + OR = { + geographical_region = world_europe_west + geographical_region = world_europe_south + } + } + } + create_artifact_olifant_effect = { OWNER = ROOT } + } + 10 = { #Angelicas Ring + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = angelica_ring + } + scope:location ?= { + OR = { + geographical_region = world_europe_west + geographical_region = world_europe_south + } + } + } + create_artifact_angelicas_ring_effect = { OWNER = ROOT } + } + 10 = { #Colada + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = colada + } + scope:location ?= { + OR = { + geographical_region = world_europe_west + geographical_region = world_europe_south + } + } + } + create_colada_effect = { OWNER = ROOT } + } + 10 = { #Curtana + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = curtana + } + scope:location ?= { + OR = { + geographical_region = world_europe_west + geographical_region = world_europe_south + } + } + } + create_artifact_curtana_effect = { OWNER = ROOT } + } + 10 = { #Durendal + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = durendal + } + scope:location ?= { + OR = { + geographical_region = world_europe_west + geographical_region = world_europe_south + } + } + } + create_artifact_durendal_effect = { OWNER = ROOT } + } + 10 = { #Joyeuse + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = joyeuse + } + scope:location ?= { + OR = { + geographical_region = world_europe_west + geographical_region = world_europe_south + } + } + } + create_artifact_joyeuse_effect = { OWNER = ROOT } + } + 10 = { #Aram + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = aram + } + scope:location ?= { + geographical_region = world_steppe + } + } + create_artifact_aram_effect = { OWNER = ROOT } + } + 10 = { #Mmaagha Kamalu + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = mmaagha_kamalu + } + scope:location ?= { + geographical_region = world_africa_west + } + } + create_artifact_sword_mmaagha_kamalu_effect = { OWNER = ROOT } + } + 15 = { #Ikenga + trigger = { + any_artifact = { + count < 15 + has_variable = ikenga + } + scope:location ?= { + geographical_region = world_africa_west + } + } + create_artifact_pedestal_ikenga_effect = { OWNER = ROOT } + } + 10 = { #Bronze head + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 5 + has_variable = bronze_head + } + scope:location ?= { + geographical_region = world_africa_west + } + } + create_artifact_bronze_head_effect = { OWNER = ROOT } + } + 15 = { #Ibeji + trigger = { + any_artifact = { + count < 15 + has_variable = ibeji + } + scope:location ?= { + geographical_region = world_africa_west + } + } + create_artifact_ibeji_effect = { OWNER = ROOT } + } + 10 = { #Rock Crystal Carving + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 3 + has_variable = crystal_carving + } + scope:location ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_middle_east_persia + } + } + } + create_artifact_crystal_carving_effect = { OWNER = ROOT } + } + 10 = { #Nagelring + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = nagelring + } + scope:location ?= { + geographical_region = world_europe_west_germania + } + } + create_artifact_nagelring_effect = { OWNER = ROOT } + } + 10 = { #szczerbiec + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + current_date > 1080.1.1 + any_artifact = { + count < 1 + has_variable = szczerbiec + } + scope:location ?= { + geographical_region = world_europe_east + } + } + create_artifact_szczerbiec_effect = { OWNER = ROOT } + } + 10 = { #Kladenets + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = kladenets + } + scope:location ?= { + geographical_region = world_europe_east + } + } + create_artifact_kladenets_effect = { OWNER = ROOT } + } + 10 = { #Legbiter + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + current_date > 1120.1.1 + any_artifact = { + count < 1 + has_variable = legbiter + } + scope:location ?= { + geographical_region = world_europe_north + } + } + create_artifact_legbiter_effect = { OWNER = ROOT } + } + 10 = { #Quern-Biter + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + current_date > 920.1.1 + any_artifact = { + count < 1 + has_variable = quernbiter + } + scope:location ?= { + geographical_region = world_europe_north + } + } + create_artifact_quernbiter_effect = { OWNER = ROOT } + } + 15 = { #Navaratna + trigger = { + scope:location ?= { + geographical_region = world_india + } + any_artifact = { + count < 3 + has_variable = navaratna + } + } + create_artifact_navaratna_effect = { OWNER = ROOT } + } + 10 = { #Dragvandil + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + current_date > 920.1.1 + any_artifact = { + count < 1 + has_variable = dragvandil + } + scope:location ?= { + geographical_region = world_europe_north + } + } + create_artifact_dragvandil_effect = { OWNER = ROOT } + } + 2 = { #Chinese Caligraphy + trigger = { + any_artifact = { + count < 15 + has_variable = chinese_caligraphy + } + scope:location ?= { + OR = { + geographical_region = world_india + geographical_region = world_burma + geographical_region = world_tibet + geographical_region = world_asia_china + geographical_region = world_asia_japan + geographical_region = world_asia_korea + geographical_region = world_asia_southeast + } + } + } + create_artifact_chinese_caligraphy_effect = { OWNER = ROOT } + } + 5 = { #Ruyi + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 15 + has_variable = ruyi + } + scope:location ?= { + OR = { + geographical_region = world_india + geographical_region = world_burma + geographical_region = world_tibet + geographical_region = world_asia_china + geographical_region = world_asia_japan + geographical_region = world_asia_korea + geographical_region = world_asia_southeast + } + } + } + create_artifact_ruyi_effect = { OWNER = ROOT } + } + 5 = { #Turquoise Throne + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = turquoise_throne + } + scope:location ?= { + OR = { + geographical_region = world_india + geographical_region = world_burma + geographical_region = world_middle_east_persia + } + } + } + create_artifact_turquoise_throne_effect = { OWNER = ROOT } + } + 5 = { #Peacock Throne + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = peacock_throne + } + scope:location ?= { + OR = { + geographical_region = world_india + geographical_region = world_burma + geographical_region = world_middle_east_persia + } + } + } + create_artifact_peacock_throne_effect = { OWNER = ROOT } + } + 5 = { #Mantle of the Prophet + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = mantle_of_prophet + } + scope:location ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_middle_east_persia + } + } + } + create_artifact_mantle_of_the_prophet_effect = { OWNER = ROOT } + } + 5 = { #Spear of the Prophet + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 1 + has_variable = spear_of_the_prophet + } + scope:location ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_middle_east_persia + } + } + } + create_artifact_spear_of_the_prophet_effect = { OWNER = ROOT } + } + 10 = { #FP3 Sassanian Sword + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 15 + has_variable = sassanian_sword + } + scope:location ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_middle_east_persia + } + } + } + create_artifact_illustrious_sassanian_sword_effect = { OWNER = ROOT } + } + 2 = { # + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { #Narwhal Horn + scope:location ?= { + geographical_region = world_europe_north + } + } + create_artifact_wall_narwhal_horn_effect = { + OWNER = scope:owner + HUNTER = scope:inspiration_owner + } + } + 10 = { #Constantine statue + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = 5 + } + trigger = { + any_artifact = { + count < 3 + has_variable = statue_constantine + } + scope:location ?= { + OR = { + geographical_region = world_europe_south_italy #Rome + geographical_region = world_asia_minor #Constantinople + } + } + } + create_artifact_statue_constantine_effect = { OWNER = root } + } + } + } + } + + 10 = { + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = -5 + } + trigger = { #A Weapon + trigger_if = { + limit = { exists = var:adventure_type } + OR = { + var:adventure_type = flag:epic_quest + var:adventure_type = flag:free_reign + } + } + } + scope:owner = { + create_artifact_weapon_effect = { + OWNER = scope:artifact_origin + CREATOR = scope:artifact_origin + SET_WEAPON_TYPE = flag:no + } + } + save_scope_value_as = { #We save the type here for tooltips in fund_inspiration.1051 + name = weapon_artifact + value = yes + } + } + + 5 = { + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = -2 + } + trigger = { #An armor + trigger_if = { + limit = { exists = var:adventure_type } + OR = { + var:adventure_type = flag:epic_quest + var:adventure_type = flag:free_reign + } + } + } + scope:owner = { + create_artifact_armor_effect = { + OWNER = scope:artifact_origin + CREATOR = scope:artifact_origin + SET_ARMOR_TYPE = flag:no + } + } + save_scope_value_as = { #We save the type here for tooltips in fund_inspiration.1051 + name = armor_artifact + value = yes + } + } + 5 = { + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = -2 + } + trigger = { # Necklace + trigger_if = { + limit = { exists = var:adventure_type } + OR = { + var:adventure_type = flag:trinket + var:adventure_type = flag:free_reign + } + } + } + scope:owner = { + create_artifact_necklace_effect = { + OWNER = scope:artifact_origin + SMITH = scope:artifact_origin + } + } + scope:newly_created_artifact = { save_scope_as = necklace } + save_scope_value_as = { #We save the type here for tooltips in fund_inspiration.1051 + name = necklace_artifact + value = yes + } + } + + 5 = { + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = -2 + } + trigger = { + trigger_if = { + limit = { exists = var:adventure_type } + OR = { + var:adventure_type = flag:trinket + var:adventure_type = flag:free_reign + var:adventure_type = flag:epic_quest + } + } + } + scope:owner = { + create_artifact_regalia_effect = { + OWNER = scope:artifact_origin + SMITH = scope:artifact_origin + } + } + scope:owner = { + save_scope_value_as = { #We save the type here for tooltips in fund_inspiration.1051 + name = regalia_artifact + value = yes + } + } + } + + 10 = { + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = -5 + } + trigger = { #Skull + trigger_if = { + limit = { exists = var:adventure_type } + OR = { + var:adventure_type = flag:skull_or_hide + var:adventure_type = flag:free_reign + } + } + } + scope:owner = { + create_artifact_wall_skull_effect = { + OWNER = scope:owner + HUNTER = scope:adventurer + LEGENDARY = no + ANIMAL = flag:none + } + } + save_scope_value_as = { #We save the type here for tooltips in fund_inspiration.1051 + name = skull + value = yes + } + } + 30 = { + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = -5 + } + trigger = { #Hide - big + trigger_if = { + limit = { exists = var:adventure_type } + OR = { + var:adventure_type = flag:skull_or_hide + var:adventure_type = flag:free_reign + } + } + } + scope:owner = { + create_artifact_animal_hide_effect = { + OWNER = scope:owner + HUNTER = scope:adventurer + LEGENDARY = no + ANIMAL = flag:none + } + } + } + 10 = { + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= high_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > high_adventurer_epic_quality_level #Cumulative event choices + } + } + add = -5 + } + trigger = { #Trinket, box small + trigger_if = { + limit = { exists = var:adventure_type } + OR = { + var:adventure_type = flag:trinket + var:adventure_type = flag:free_reign + } + } + } + scope:owner = { + create_artifact_box_small_effect = { + OWNER = scope:owner + CARPENTER = scope:inspiration_owner + } + } + save_scope_value_as = { #We save the type here for tooltips in fund_inspiration.1051 + name = box + value = yes + } + } + 10 = { + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = -5 + } + trigger = { #Trinket, goblet + trigger_if = { + limit = { exists = var:adventure_type } + OR = { + var:adventure_type = flag:trinket + var:adventure_type = flag:free_reign + } + } + } + scope:owner = { + create_artifact_goblet_effect = { + OWNER = scope:owner + SMITH = scope:inspiration_owner + } + } + save_scope_value_as = { #We save the type here for tooltips in fund_inspiration.1051 + name = goblet + value = yes + } + } + 10 = { + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = -2 + } + trigger = { #Tapestry + trigger_if = { + limit = { exists = var:adventure_type } + OR = { + var:adventure_type = flag:tapestry_or_fabric + var:adventure_type = flag:free_reign + } + } + } + scope:owner = { + create_artifact_tapestry_effect = { + OWNER = scope:owner + WEAVER = scope:inspiration_owner + } + } + save_scope_value_as = { #We save the type here for tooltips in fund_inspiration.1051 + name = tapestry + value = yes + } + } + 10 = { + modifier = { + OR = { + scope:adventurer.adventure_inspiration_average_skill_value >= medium_inspiration_skill + AND = { + exists = scope:inspiration_owner.var:artifact_quality + scope:inspiration_owner.var:artifact_quality > medium_adventurer_epic_quality_level #Cumulative event choices + } + } + add = -2 + } + trigger = { #Persian Drinking Vessel (goblet) + has_fp3_dlc_trigger = yes + trigger_if = { + limit = { exists = var:adventure_type } + OR = { + var:adventure_type = flag:trinket + var:adventure_type = flag:free_reign + } + } + scope:location = { geographical_region = world_middle_east_persia } + } + scope:owner = { + create_artifact_persian_drinking_vessel_effect = { + OWNER = scope:owner + SMITH = scope:inspiration_owner + } + } + save_scope_value_as = { #We save the type here for tooltips in fund_inspiration.1051 + name = goblet + value = yes + } + } + } + if = { + limit = { + exists = scope:epic + NOT = { exists = scope:task_contract_taker } + } + scope:epic = { + add_artifact_history = { + location = root.capital_province + actor = scope:adventurer + recipient = root + type = given + } + } + } + else_if = { + limit = { + exists = scope:newly_created_artifact + NOT = { exists = scope:task_contract_taker } + } + scope:newly_created_artifact = { + add_artifact_history = { + location = root.capital_province + actor = scope:adventurer + recipient = root + type = given + } + } + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_ep1_inspiration_effects_sean.txt b/N3OW/common/scripted_effects/00_ep1_inspiration_effects_sean.txt new file mode 100644 index 00000000..bd6fc5a0 --- /dev/null +++ b/N3OW/common/scripted_effects/00_ep1_inspiration_effects_sean.txt @@ -0,0 +1,955 @@ +################################################# +# EFFECT LIST # +################################################# +# +# Inspiration Generation Effects +# grant_inspiration_to_character_effect - Creates a new Inspiration and gives it to the scope character. Type of inspiration is weighted based on character skills and personality. +# grant_new_inspiration_in_character_realm_effect - Selects a random Pool character from the scope character's realm, then runs the above effect on them. Afterwards, move to visit the scope character's court. +# grant_new_inspiration_in_region_effect - Selects a random Royal Court in a given $GEOLOGICAL_REGION$. The Court's owner then has the above effect run on them. +# grant_new_inspiration_in_world_effect - Selects a random geological region in the world. The selected region then has the above effect run on it. +# +# Inspired Character Movement Effects +# inspired_character_travel_to_court_effect - Moves $INSPIRED_CHARACTER$ to the court of $NEW_HOST$. +# inspired_character_seek_out_new_royal_court_effect - Forces the scope character to look for a new, different Royal Court to visit as a guest. If one is found, uses the above effect to move there. + +################################################# +# Inspiration Generation Effects # +################################################# + +grant_inspiration_to_character_effect = { + $CHARACTER$ = { + if = { + limit = { NOT = { exists = inspiration } } + # More likely to get an certain Inspiration type if we will produce higher quality Artifacts of that type. + random_list = { + 10 = { + compare_modifier = { + value = weapon_inspiration_average_skill_value + multiplier = 6 + } + modifier = { #Some cultures are more likely to pick this vocation than others + add = 5 + culture = { + has_cultural_tradition = tradition_metal_craftsmanship + } + } + create_inspiration = weapon_inspiration + } + 10 = { # =Slightly increased weight due to a low number of Armorers appearing in the world. + compare_modifier = { + value = armor_inspiration_average_skill_value + multiplier = 7.2 # A character with an average of 20 in relevant skills will receive a +120 bonus + } + modifier = { #Some cultures are more likely to pick this vocation than others + add = 5 + culture = { + has_cultural_tradition = tradition_frugal_armorsmiths + } + } + create_inspiration = armor_inspiration + } + 10 = { #Adventurers will on average produce better quality items, handle with care. + compare_modifier = { + value = adventure_inspiration_average_skill_value + multiplier = 9 + } + modifier = { + add = 5 + culture = { #Some cultures are more likely to pick this vocation than others + OR = { + has_cultural_parameter = more_likely_to_leave_court #Swords for Hire & Caravaneers + has_cultural_tradition = tradition_chivalry + } + } + } + create_inspiration = adventure_inspiration + } + 12 = { # Significantly increased weight due to the wide variety of artifact types this inspiration can produce (regalia, crown, trinket). + compare_modifier = { + value = smith_inspiration_average_skill_value + multiplier = 15 + } + modifier = { #Some cultures are more likely to pick this vocation than others + add = 10 + culture = { + OR = { + has_cultural_tradition = tradition_metal_craftsmanship + has_cultural_tradition = tradition_ancient_miners + } + } + } + create_inspiration = smith_inspiration + } + 10 = { + compare_modifier = { + value = book_inspiration_average_skill_value + multiplier = 6 + } + modifier = { + has_court_position = court_poet_court_position + add = 15 + } + modifier = { + culture = { #Some cultures are more likely to pick this vocation than others + OR = { + has_cultural_tradition = tradition_language_scholars + has_cultural_tradition = tradition_philosopher_culture + has_cultural_tradition = tradition_legalistic + } + } + add = 5 + } + create_inspiration = book_inspiration + } + 11 = { # Increased weight due to a low number of Weavers appearing in the world (probably a lack of high-diplomacy courtiers). + compare_modifier = { + value = weaver_inspiration_average_skill_value + multiplier = 8.4 + } + modifier = { + culture = { #Some cultures are more likely to pick this vocation than others + has_cultural_parameter = improved_weaver_inspiration + } + add = 10 + } + create_inspiration = weaver_inspiration + } + 14 = { # Moderately increased weight due to the variety of artifact types this inspiration can produce (throne, sculpture). + compare_modifier = { + value = artisan_inspiration_average_skill_value + multiplier = 12 + } + modifier = { + has_court_position = court_poet_court_position + add = 5 + } + modifier = { + culture = { #Some cultures are more likely to pick this vocation than others + has_cultural_parameter = improved_artisan_inspiration + } + add = 15 + } + create_inspiration = artisan_inspiration + } + 1 = { + modifier = { + add = 30 + has_trait = lifestyle_mystic + } + modifier = { #Alchemy arrived to Europe in the 13th century, but existed basically everywhere else before that + add = -20 + culture_has_european_heritage_pillar_trigger = yes + } + compare_modifier = { + value = learning + multiplier = 2 + } + create_inspiration = alchemy_inspiration + } + 5 = { + compare_modifier = { + value = weapon_inspiration_average_skill_value + multiplier = 6 + } + modifier = { #Some cultures are more likely to pick this vocation than others + add = 5 + culture = { + has_cultural_tradition = tradition_longbow_competitions + } + } + create_inspiration = bow_inspiration + } + } + } + } +} + +grant_stewardship_inspiration_to_character_effect = { + $CHARACTER$ = { + if = { + limit = { NOT = { exists = inspiration } } + # More likely to get an certain Inspiration type if we will produce higher quality Artifacts of that type. + random_list = { + 12 = { # Significantly increased weight due to the wide variety of artifact types this inspiration can produce (regalia, crown, trinket). + compare_modifier = { + value = smith_inspiration_average_skill_value + multiplier = 15 + } + modifier = { #Some cultures are more likely to pick this vocation than others + add = 10 + culture = { + OR = { + has_cultural_tradition = tradition_metal_craftsmanship + has_cultural_tradition = tradition_ancient_miners + } + } + } + create_inspiration = smith_inspiration + } + 14 = { # Moderately increased weight due to the variety of artifact types this inspiration can produce (throne, sculpture). + compare_modifier = { + value = artisan_inspiration_average_skill_value + multiplier = 12 + } + modifier = { + has_court_position = court_poet_court_position + add = 5 + } + modifier = { + culture = { #Some cultures are more likely to pick this vocation than others + has_cultural_parameter = improved_artisan_inspiration + } + add = 15 + } + create_inspiration = artisan_inspiration + } + } + } + } +} + +grant_learning_inspiration_to_character_effect = { + $CHARACTER$ = { + if = { + limit = { NOT = { exists = inspiration } } + # More likely to get an certain Inspiration type if we will produce higher quality Artifacts of that type. + random_list = { + 10 = { + compare_modifier = { + value = book_inspiration_average_skill_value + multiplier = 6 + } + modifier = { + has_court_position = court_poet_court_position + add = 15 + } + modifier = { + culture = { #Some cultures are more likely to pick this vocation than others + OR = { + has_cultural_tradition = tradition_language_scholars + has_cultural_tradition = tradition_philosopher_culture + has_cultural_tradition = tradition_legalistic + } + } + add = 5 + } + modifier = { + factor = 0.5 + liege ?= { + any_equipped_character_artifact = { + count >= 2 + artifact_slot_type = book + } + } + } + create_inspiration = book_inspiration + } + 10 = { # Increased weight due to a low number of Weavers appearing in the world (probably a lack of high-diplomacy courtiers). + trigger = { + diplomacy >= 10 + } + compare_modifier = { + value = weaver_inspiration_average_skill_value + multiplier = 8.4 + } + modifier = { + culture = { #Some cultures are more likely to pick this vocation than others + has_cultural_parameter = improved_weaver_inspiration + } + add = 10 + } + modifier = { + factor = 0.1 + liege ?= { + any_equipped_character_artifact = { + count >= 3 + artifact_slot_type = wall_big + } + } + } + create_inspiration = weaver_inspiration + } + 1 = { + modifier = { + add = 30 + has_trait = lifestyle_mystic + } + compare_modifier = { + value = learning + multiplier = 2 + } + modifier = { #Alchemy arrived to Europe in the 13th century, but existed basically everywhere else before that + factor = 0.1 + culture_has_european_heritage_pillar_trigger = yes + current_year < 1300 + } + create_inspiration = alchemy_inspiration + } + } + } + } +} + +grant_martial_inspiration_to_character_effect = { + $CHARACTER$ = { + if = { + limit = { NOT = { exists = inspiration } } + # More likely to get an certain Inspiration type if we will produce higher quality Artifacts of that type. + random_list = { + 1 = { #Adventurers will on average produce better quality items, handle with care. + compare_modifier = { + value = adventure_inspiration_average_skill_value + multiplier = 9 + } + modifier = { + add = 5 + culture = { #Some cultures are more likely to pick this vocation than others + OR = { + has_cultural_parameter = more_likely_to_leave_court #Swords for Hire & Caravaneers + has_cultural_tradition = tradition_chivalry + } + } + } + create_inspiration = adventure_inspiration + } + 10 = { + compare_modifier = { + value = weapon_inspiration_average_skill_value + multiplier = 6 + } + modifier = { #Some cultures are more likely to pick this vocation than others + add = 5 + culture = { + has_cultural_tradition = tradition_metal_craftsmanship + } + } + modifier = { + factor = 0.1 + liege ?= { + any_equipped_character_artifact = { + artifact_slot_type = primary_armament + } + } + } + create_inspiration = weapon_inspiration + } + 10 = { # =Slightly increased weight due to a low number of Armorers appearing in the world. + compare_modifier = { + value = armor_inspiration_average_skill_value + multiplier = 7.2 # A character with an average of 20 in relevant skills will receive a +120 bonus + } + modifier = { #Some cultures are more likely to pick this vocation than others + add = 5 + culture = { + has_cultural_tradition = tradition_frugal_armorsmiths + } + } + modifier = { + factor = 0.1 + liege ?= { + any_equipped_character_artifact = { + artifact_slot_type = armor + } + } + } + create_inspiration = armor_inspiration + } + 5 = { + compare_modifier = { + value = weapon_inspiration_average_skill_value + multiplier = 6 + } + modifier = { #Some cultures are more likely to pick this vocation than others + add = 5 + culture = { + has_cultural_tradition = tradition_longbow_competitions + } + } + create_inspiration = bow_inspiration + } + } + } + } +} + +grant_inspiration_to_character_no_court_artifacts_effect = { + save_scope_as = court_owner + $CHARACTER$ = { + if = { + limit = { NOT = { exists = inspiration } } + # More likely to get an certain Inspiration type if we will produce higher quality Artifacts of that type. + random_list = { + 10 = { + compare_modifier = { + value = weapon_inspiration_average_skill_value + multiplier = { + value = 5 + #Lower the military inspirations for Advancement Movement + if = { + limit = { + scope:court_owner = { + top_participant_group:dynastic_cycle ?= { + participant_group_type = advancement_movement + } + } + } + multiply = 0 + } + } + } + modifier = { #Some cultures are more likely to pick this vocation than others + add = 5 + culture = { + has_cultural_tradition = tradition_metal_craftsmanship + } + } + create_inspiration = weapon_inspiration + } + 10 = { + compare_modifier = { + value = armor_inspiration_average_skill_value + multiplier = { + value = 5 + #Lower the military inspirations for Advancement Movement + if = { + limit = { + scope:court_owner = { + top_participant_group:dynastic_cycle ?= { + participant_group_type = advancement_movement + } + } + } + multiply = 0 + } + } + } + modifier = { #Some cultures are more likely to pick this vocation than others + add = 5 + culture = { + has_cultural_tradition = tradition_frugal_armorsmiths + } + } + create_inspiration = armor_inspiration + } + 5 = { + compare_modifier = { + value = smith_inspiration_average_skill_value + multiplier = 5 + } + modifier = { #Some cultures are more likely to pick this vocation than others + add = 10 + culture = { + OR = { + has_cultural_tradition = tradition_metal_craftsmanship + has_cultural_tradition = tradition_ancient_miners + } + } + } + create_inspiration = smith_inspiration + } + 5 = { + compare_modifier = { + value = book_inspiration_average_skill_value + multiplier = 5 + } + modifier = { + has_court_position = court_poet_court_position + add = 15 + } + modifier = { + culture = { #Some cultures are more likely to pick this vocation than others + OR = { + has_cultural_tradition = tradition_language_scholars + has_cultural_tradition = tradition_philosopher_culture + has_cultural_tradition = tradition_legalistic + } + } + add = 5 + } + create_inspiration = book_inspiration + } + 1 = { + modifier = { + add = 30 + has_trait = lifestyle_mystic + } + modifier = { #Alchemy arrived to Europe in the 13th century, but existed basically everywhere else before that + add = -20 + culture_has_european_heritage_pillar_trigger = yes + } + compare_modifier = { + value = learning + multiplier = 2 + } + create_inspiration = alchemy_inspiration + } + 5 = { + compare_modifier = { + value = weapon_inspiration_average_skill_value + multiplier = { + value = 6 + #Lower the military inspirations for Advancement Movement + if = { + limit = { + scope:court_owner = { + top_participant_group:dynastic_cycle ?= { + participant_group_type = advancement_movement + } + } + } + multiply = 0 + } + } + } + modifier = { #Some cultures are more likely to pick this vocation than others + add = 5 + culture = { + has_cultural_tradition = tradition_longbow_competitions + } + } + create_inspiration = bow_inspiration + } + } + } + } +} + +grant_new_inspiration_in_character_realm_effect = { + save_scope_as = royal_court_owner + every_sub_realm_barony = { + title_province = { + every_pool_character = { + province = this + limit = { + ep1_is_valid_character_for_inspiration_trigger = yes + } + add_to_list = potential_inspired_people + } + } + } + + random_in_list = { + list = potential_inspired_people + weight = { + base = 1 + + modifier = { #Poets are more likely to become inspired + add = 40 + has_trait = lifestyle_poet + } + + # More learned characters have a greater pool to draw from for their inspirations. + compare_modifier = { + value = learning + multiplier = 5 + } + + # Older characters are more likely to be inspired from their life's experience. + compare_modifier = { + value = age + } + + # We don't want character dropping dead from old age, injuries, or disease right after they begin work on a project! + compare_modifier = { + value = health + multiplier = 20 + } + + # 'Ambitious' characters are more likely to get an inspiration/seek patronage + ai_value_modifier = { + ai_greed = 0.25 + ai_boldness = 0.25 + ai_sociability = 0.10 + ai_rationality = 0.10 + } + } + save_scope_as = inspired_person + } + + # If we were unable to find a valid pool character, create one. + if = { + limit = { + NOT = { exists = scope:inspired_person } + } + create_character = { + template = inspired_template + location = scope:royal_court_owner.capital_province + faith = scope:royal_court_owner.faith + culture = scope:royal_court_owner.culture + gender_female_chance = 50 + save_scope_as = inspired_person + } + } + # Clear the list in case this effect gets re-used in the same scope. + every_in_list = { + list = potential_inspired_people + remove_from_list = potential_inspired_people + } + + scope:inspired_person = { + grant_inspiration_to_character_effect = { CHARACTER = this } + # Travel to the new host's court. + inspired_character_travel_to_court_effect = { + INSPIRED_CHARACTER = scope:inspired_person + NEW_HOST = scope:royal_court_owner + } + } + +} + +grant_new_inspiration_in_region_effect = { + random_character_with_royal_court = { + limit = { + capital_province ?= { + geographical_region = $GEOGRAPHICAL_REGION$ + } + save_temporary_scope_as = tmp_royal_court_owner # Used in 'inspiration_kingdom_modifier' to calculate draw towards this specific court in the region. + } + + weight = { + base = 1 + inspiration_royal_court_grandeur_attraction_modifier = yes + inspiration_royal_court_oversaturation_penalty_modifier = yes + } + + grant_new_inspiration_in_character_realm_effect = yes + } +} + +grant_new_inspiration_in_world_effect = { + # When generating new inspired characters, the following criteria are taken into account: + # - The specified region *must* be the home of at least 1 royal court to be eligible. + # - Increased chance for regions which have multiple royal courts. + # - Increased chance for regions which have incredibly prestigious royal courts. + # - Greatly reduced chance for regions which already have multiple inspired people wandering around within them. + + random_list = { + # Europe + 1 = { + trigger = { any_character_with_royal_court = { exists = capital_province capital_province = { geographical_region = world_europe_west } } } + inspiration_region_court_grandeur_attraction_modifier = { GEOGRAPHICAL_REGION = world_europe_west } + inspiration_region_oversaturation_penalty_modifier = { GEOGRAPHICAL_REGION = world_europe_west } + grant_new_inspiration_in_region_effect = { GEOGRAPHICAL_REGION = world_europe_west } + } + 1 = { + trigger = { any_character_with_royal_court = { exists = capital_province capital_province = { geographical_region = world_europe_north } } } + inspiration_region_court_grandeur_attraction_modifier = { GEOGRAPHICAL_REGION = world_europe_north } + inspiration_region_oversaturation_penalty_modifier = { GEOGRAPHICAL_REGION = world_europe_north } + grant_new_inspiration_in_region_effect = { GEOGRAPHICAL_REGION = world_europe_north } + } + 1 = { + trigger = { any_character_with_royal_court = { exists = capital_province capital_province = { geographical_region = world_europe_south } } } + inspiration_region_court_grandeur_attraction_modifier = { GEOGRAPHICAL_REGION = world_europe_south } + inspiration_region_oversaturation_penalty_modifier = { GEOGRAPHICAL_REGION = world_europe_south } + grant_new_inspiration_in_region_effect = { GEOGRAPHICAL_REGION = world_europe_south } + } + 1 = { + trigger = { any_character_with_royal_court = { exists = capital_province capital_province = { geographical_region = world_europe_east } } } + inspiration_region_court_grandeur_attraction_modifier = { GEOGRAPHICAL_REGION = world_europe_east } + inspiration_region_oversaturation_penalty_modifier = { GEOGRAPHICAL_REGION = world_europe_east } + grant_new_inspiration_in_region_effect = { GEOGRAPHICAL_REGION = world_europe_east } + } + # Middle East/Asia Minor + 1 = { + trigger = { any_character_with_royal_court = { exists = capital_province capital_province = { geographical_region = world_asia_minor } } } + inspiration_region_court_grandeur_attraction_modifier = { GEOGRAPHICAL_REGION = world_asia_minor } + inspiration_region_oversaturation_penalty_modifier = { GEOGRAPHICAL_REGION = world_asia_minor } + grant_new_inspiration_in_region_effect = { GEOGRAPHICAL_REGION = world_asia_minor } + } + 1 = { + trigger = { any_character_with_royal_court = { exists = capital_province capital_province = { geographical_region = world_middle_east_jerusalem } } } + inspiration_region_court_grandeur_attraction_modifier = { GEOGRAPHICAL_REGION = world_middle_east_jerusalem } + inspiration_region_oversaturation_penalty_modifier = { GEOGRAPHICAL_REGION = world_middle_east_jerusalem } + grant_new_inspiration_in_region_effect = { GEOGRAPHICAL_REGION = world_middle_east_jerusalem } + } + 1 = { + trigger = { any_character_with_royal_court = { exists = capital_province capital_province = { geographical_region = world_middle_east_arabia } } } + inspiration_region_court_grandeur_attraction_modifier = { GEOGRAPHICAL_REGION = world_middle_east_arabia } + inspiration_region_oversaturation_penalty_modifier = { GEOGRAPHICAL_REGION = world_middle_east_arabia } + grant_new_inspiration_in_region_effect = { GEOGRAPHICAL_REGION = world_middle_east_arabia } + } + 1 = { + trigger = { any_character_with_royal_court = { exists = capital_province capital_province = { geographical_region = world_middle_east_persia } } } + inspiration_region_court_grandeur_attraction_modifier = { GEOGRAPHICAL_REGION = world_middle_east_persia } + inspiration_region_oversaturation_penalty_modifier = { GEOGRAPHICAL_REGION = world_middle_east_persia } + grant_new_inspiration_in_region_effect = { GEOGRAPHICAL_REGION = world_middle_east_persia } + } + + # India + 1 = { + trigger = { any_character_with_royal_court = { exists = capital_province capital_province = { geographical_region = world_india_deccan } } } + inspiration_region_court_grandeur_attraction_modifier = { GEOGRAPHICAL_REGION = world_india_deccan } + inspiration_region_oversaturation_penalty_modifier = { GEOGRAPHICAL_REGION = world_india_deccan } + grant_new_inspiration_in_region_effect = { GEOGRAPHICAL_REGION = world_india_deccan } + } + 1 = { + trigger = { any_character_with_royal_court = { exists = capital_province capital_province = { geographical_region = world_india_bengal } } } + inspiration_region_court_grandeur_attraction_modifier = { GEOGRAPHICAL_REGION = world_india_bengal } + inspiration_region_oversaturation_penalty_modifier = { GEOGRAPHICAL_REGION = world_india_bengal } + grant_new_inspiration_in_region_effect = { GEOGRAPHICAL_REGION = world_india_bengal } + } + 1 = { + trigger = { any_character_with_royal_court = { exists = capital_province capital_province = { geographical_region = world_india_rajastan } } } + inspiration_region_court_grandeur_attraction_modifier = { GEOGRAPHICAL_REGION = world_india_rajastan } + inspiration_region_oversaturation_penalty_modifier = { GEOGRAPHICAL_REGION = world_india_rajastan } + grant_new_inspiration_in_region_effect = { GEOGRAPHICAL_REGION = world_india_rajastan } + } + + # Africa + 1 = { + trigger = { any_character_with_royal_court = { exists = capital_province capital_province = { geographical_region = world_africa_north } } } + inspiration_region_court_grandeur_attraction_modifier = { GEOGRAPHICAL_REGION = world_africa_north } + inspiration_region_oversaturation_penalty_modifier = { GEOGRAPHICAL_REGION = world_africa_north } + grant_new_inspiration_in_region_effect = { GEOGRAPHICAL_REGION = world_africa_north } + } + 1 = { + trigger = { any_character_with_royal_court = { exists = capital_province capital_province = { geographical_region = world_africa_west } } } + inspiration_region_court_grandeur_attraction_modifier = { GEOGRAPHICAL_REGION = world_africa_west } + inspiration_region_oversaturation_penalty_modifier = { GEOGRAPHICAL_REGION = world_africa_west } + grant_new_inspiration_in_region_effect = { GEOGRAPHICAL_REGION = world_africa_west } + } + 1 = { + trigger = { any_character_with_royal_court = { exists = capital_province capital_province = { geographical_region = world_africa_east } } } + inspiration_region_court_grandeur_attraction_modifier = { GEOGRAPHICAL_REGION = world_africa_east } + inspiration_region_oversaturation_penalty_modifier = { GEOGRAPHICAL_REGION = world_africa_east } + grant_new_inspiration_in_region_effect = { GEOGRAPHICAL_REGION = world_africa_east } + } + + # Steppe + 1 = { + trigger = { any_character_with_royal_court = { exists = capital_province capital_province = { geographical_region = world_steppe } } } + inspiration_region_court_grandeur_attraction_modifier = { GEOGRAPHICAL_REGION = world_steppe } + inspiration_region_oversaturation_penalty_modifier = { GEOGRAPHICAL_REGION = world_steppe } + grant_new_inspiration_in_region_effect = { GEOGRAPHICAL_REGION = world_steppe } + } + + # Tibet + 1 = { + trigger = { any_character_with_royal_court = { exists = capital_province capital_province = { geographical_region = world_tibet } } } + inspiration_region_court_grandeur_attraction_modifier = { GEOGRAPHICAL_REGION = world_tibet } + inspiration_region_oversaturation_penalty_modifier = { GEOGRAPHICAL_REGION = world_tibet } + grant_new_inspiration_in_region_effect = { GEOGRAPHICAL_REGION = world_tibet } + } + + # Burma + 1 = { + trigger = { any_character_with_royal_court = { exists = capital_province capital_province = { geographical_region = world_burma } } } + inspiration_region_court_grandeur_attraction_modifier = { GEOGRAPHICAL_REGION = world_burma } + inspiration_region_oversaturation_penalty_modifier = { GEOGRAPHICAL_REGION = world_burma } + grant_new_inspiration_in_region_effect = { GEOGRAPHICAL_REGION = world_burma } + } + + # China + 1 = { + trigger = { any_character_with_royal_court = { exists = capital_province capital_province = { geographical_region = world_asia_china } } } + inspiration_region_court_grandeur_attraction_modifier = { GEOGRAPHICAL_REGION = world_asia_china } + inspiration_region_oversaturation_penalty_modifier = { GEOGRAPHICAL_REGION = world_asia_china } + grant_new_inspiration_in_region_effect = { GEOGRAPHICAL_REGION = world_asia_china } + } + + # Japan + 1 = { + trigger = { any_character_with_royal_court = { exists = capital_province capital_province = { geographical_region = world_asia_japan } } } + inspiration_region_court_grandeur_attraction_modifier = { GEOGRAPHICAL_REGION = world_asia_japan } + inspiration_region_oversaturation_penalty_modifier = { GEOGRAPHICAL_REGION = world_asia_japan } + grant_new_inspiration_in_region_effect = { GEOGRAPHICAL_REGION = world_asia_japan } + } + + # Korea + 1 = { + trigger = { any_character_with_royal_court = { exists = capital_province capital_province = { geographical_region = world_asia_korea } } } + inspiration_region_court_grandeur_attraction_modifier = { GEOGRAPHICAL_REGION = world_asia_korea } + inspiration_region_oversaturation_penalty_modifier = { GEOGRAPHICAL_REGION = world_asia_korea } + grant_new_inspiration_in_region_effect = { GEOGRAPHICAL_REGION = world_asia_korea } + } + # Southeast Asia + 1 = { + trigger = { any_character_with_royal_court = { exists = capital_province capital_province = { geographical_region = world_asia_southeast } } } + inspiration_region_court_grandeur_attraction_modifier = { GEOGRAPHICAL_REGION = world_asia_southeast } + inspiration_region_oversaturation_penalty_modifier = { GEOGRAPHICAL_REGION = world_asia_southeast } + grant_new_inspiration_in_region_effect = { GEOGRAPHICAL_REGION = world_asia_southeast } + } + } +} + +################################################# +# Inspired Character Movement Effects # +################################################# + +inspired_character_travel_to_court_effect = { + $INSPIRED_CHARACTER$ = { + save_scope_as = ttc_inspired_character + inspiration = { save_scope_as = ttc_inspiration } + #Save our current host (so we don't return to their court too quickly!). + if = { + limit = { exists = host } + set_variable = { + name = last_visited_ruler + value = this.host + days = 1825 + } + } + # If no current host, save as dummy character so we at least have something to compare to. + else = { + set_variable = { + name = last_visited_ruler + value = dummy_female + days = 1825 + } + } + + visit_court_of = $NEW_HOST$ + add_character_flag = { + flag = inspired_character_recent_arrival + months = inspired_character_recent_arrival_duration_value + } + } +} + +inspired_character_seek_out_new_royal_court_effect = { + save_scope_as = inspired_character + + # Look to see if there is a nearby court we can visit that might fund our inspiration. + random_character_with_royal_court = { + limit = { + # Do not travel outside of diplomatic range in a single 'jump' + in_diplomatic_range = scope:inspired_character + + # Do not visit the ruler we had just left, unless at least 5 years have passed. + trigger_if = { + limit = { scope:inspired_character = { has_variable = last_visited_ruler } } + scope:inspired_character.var:last_visited_ruler != this + } + + # Only visit rulers who do not consider our faith to be hostile, if possible. + faith = { + faith_hostility_level = { + target = scope:inspired_character.faith + value <= faith_hostile_level + } + } + exists = capital_province + save_temporary_scope_as = tmp_royal_court_owner # Used in 'inspiration_kingdom_modifier' to calculate draw towards this specific court in the region. + } + alternative_limit = { + in_diplomatic_range = scope:inspired_character + trigger_if = { + limit = { scope:inspired_character = { has_variable = last_visited_ruler } } + scope:inspired_character.var:last_visited_ruler != this + } + # Failing that, if possible do not visit rulers who consider our faith to be outright evil. + faith = { + faith_hostility_level = { + target = scope:inspired_character.faith + value <= faith_evil_level + } + } + exists = capital_province + save_temporary_scope_as = tmp_royal_court_owner + } + alternative_limit = { + # Failing that, we can visit anyone else in range. + in_diplomatic_range = scope:inspired_character + trigger_if = { + limit = { scope:inspired_character = { has_variable = last_visited_ruler } } + scope:inspired_character.var:last_visited_ruler != this + } + exists = capital_province + save_temporary_scope_as = tmp_royal_court_owner + } + + weight = { + base = 10 + inspiration_royal_court_grandeur_attraction_modifier = yes + + # Prefer visiting royal courts which are physically closer to us + modifier = { + factor = 0.9 # Total 90.0% weight + capital_province = { + squared_distance = { + target = scope:inspired_character.location + value >= squared_distance_small #150 map-pixels. Roughly one Wales away (top to bottom). + } + } + } + modifier = { + factor = 0.8 # Total 72.0% weight + capital_province = { + squared_distance = { + target = scope:inspired_character.location + value >= squared_distance_medium #250 map-pixels. Roughly one Ireland away (top to bottom). + } + } + } + modifier = { + factor = 0.6 # Total 43.2% weight + capital_province = { + squared_distance = { + target = scope:inspired_character.location + value >= squared_distance_large #650 map-pixels. Roughly one France away (top to bottom). + } + } + } + modifier = { + factor = 0.3 # Total 12.9% weight + capital_province = { + squared_distance = { + target = scope:inspired_character.location + value >= squared_distance_huge #850 map-pixels. Roughly one Holy Roman Empire away (left to right). + } + } + } + + # Down-prioritize courts with a lot of inspired people already + modifier = { + factor = 0.9 + any_courtier_or_guest = { + count >= 2 + exists = inspiration + } + } + modifier = { + factor = 0.8 + any_courtier_or_guest = { + count >= 3 + exists = inspiration + } + } + modifier = { + factor = 0.7 + any_courtier_or_guest = { + count >= 4 + exists = inspiration + } + } + modifier = { + factor = 0.6 + any_courtier_or_guest = { + count >= 5 + exists = inspiration + } + } + modifier = { + factor = 0.001 + any_courtier_or_guest = { + count >= 6 + exists = inspiration + } + } + } + save_scope_as = new_host + } + + # If we have successfully located a new host... + if = { + limit = { + exists = scope:new_host + } + + # ...travel to the new host's court. + inspired_character_travel_to_court_effect = { + INSPIRED_CHARACTER = scope:inspired_character + NEW_HOST = scope:new_host + } + } +} diff --git a/N3OW/common/scripted_effects/00_ep3_decision_effects.txt b/N3OW/common/scripted_effects/00_ep3_decision_effects.txt new file mode 100644 index 00000000..36b10187 --- /dev/null +++ b/N3OW/common/scripted_effects/00_ep3_decision_effects.txt @@ -0,0 +1,581 @@ + +convert_to_administrative_from_feudalism_effect = { + save_scope_as = administrative_liege + + change_to_administrative_effect = yes + + #Direct Vassals who fulfill the ep3_vassal_will_become_admin criteria are converted. Vassals above 25 opinion always accept + #Vassals are converted as a hierarchy. If a king is converted we convert all who are valid below that king (so his dukes, their counts, and their barons) are all converted. + #If a vassal does not convert (because of not accepting or because they are outside of the de jure empire, etc) then the vassals below them are _not_ converted either. + + #Human vassals are given a choice to convert or not in the ping event, even if powerful or having very good relation. + + hidden_effect = { + save_scope_as = actor + every_powerful_vassal = { #All valid powerful vassals auto convert - their support was required to take the decision. + limit = { + ep3_vassal_will_become_admin = yes + is_ai = yes + } + save_scope_as = recipient + change_to_administrative_effect = yes + every_vassal = { #Everyone below also converts + limit = { + ep3_vassal_will_become_admin = yes #We still don't want mayors and bishops + is_ai = yes + } + save_scope_as = recipient + change_to_administrative_effect = yes + every_vassal = { #Everyone below also converts (could be Counts, could be Barons) + limit = { + ep3_vassal_will_become_admin = yes #We still don't want mayors and bishops + is_ai = yes + } + save_scope_as = recipient + change_to_administrative_effect = yes + every_vassal = { #Everyone below also converts could be Barons) + limit = { + ep3_vassal_will_become_admin = yes #We still don't want mayors and bishops + is_ai = yes + } + save_scope_as = recipient + change_to_administrative_effect = yes + } + } + } + } + every_vassal = { + limit = { + ep3_vassal_will_become_admin = yes + trigger_if = { #Dukes and above can say no + limit = { + primary_title.tier >= tier_duchy + is_ai = yes + } + opinion = { + target = scope:administrative_liege + value > 25 + } + } + } + save_scope_as = recipient + change_to_administrative_effect = yes + every_vassal = { #Everyone below also converts (could be Counts, could be Dukes) + limit = { + ep3_vassal_will_become_admin = yes #We still don't want mayors and bishops + is_ai = yes + } + save_scope_as = recipient + change_to_administrative_effect = yes + every_vassal = { #Everyone below also converts (Could be Counts, could be Barons) + limit = { + ep3_vassal_will_become_admin = yes #We still don't want mayors and bishops + is_ai = yes + } + save_scope_as = recipient + change_to_administrative_effect = yes + every_vassal = { #Everyone below also converts (could be Barons) + limit = { + ep3_vassal_will_become_admin = yes #We still don't want mayors and bishops + is_ai = yes + } + save_scope_as = recipient + change_to_administrative_effect = yes + } + } + } + } + every_vassal = { + limit = { + ep3_vassal_will_become_admin = yes + trigger_if = { #Dukes and above can say no + limit = { + primary_title.tier >= tier_duchy + is_ai = yes + } + opinion = { + target = scope:administrative_liege + value > 0 + } + } + } + random_list = { + 10 = { } #10% of the vassals that like us less than 25 but more than 0 still convert. + 90 = { + save_scope_as = recipient + change_to_administrative_effect = yes + every_vassal = { #Everyone below also converts (could be Counts, could be Dukes) + limit = { + ep3_vassal_will_become_admin = yes #We still don't want mayors and bishops + is_ai = yes + } + save_scope_as = recipient + change_to_administrative_effect = yes + every_vassal = { #Everyone below also converts (Could be Counts, could be Barons) + limit = { + ep3_vassal_will_become_admin = yes #We still don't want mayors and bishops + is_ai = yes + } + save_scope_as = recipient + change_to_administrative_effect = yes + every_vassal = { #Everyone below also converts (could be Barons) + limit = { + ep3_vassal_will_become_admin = yes #We still don't want mayors and bishops + is_ai = yes + } + save_scope_as = recipient + change_to_administrative_effect = yes + } + } + } + } + } + } + every_vassal = { + limit = { + highest_held_title_tier >= tier_duchy + house.house_head ?= this + government_has_flag = government_is_administrative + NOT = { + any_held_title = { is_noble_family_title = yes } + } + } + create_noble_family_effect = { GOVERNMENT_GIVER = this } + } + } + + if = { + limit = { + NOT = { + has_character_flag = latin_emp_force_admin_flag + } + top_liege = this + } + add_character_modifier = { + modifier = first_admin_emperor + } + } + + change_influence = admin_convert_influence_value + + custom_description_no_bullet = { + text = vassals_can_become_administrative + } + custom_tooltip = powerful_vassals_become_administrative + custom_tooltip = vassals_become_administrative + custom_tooltip = vassals_who_may_switch_to_administrative +} + +convert_to_administrative_from_feudalism_game_start_effect = { + if = { + limit = { has_dlc_feature = roads_to_power } + # Because we run this twice, since folks can change in the lobby. + if = { + limit = { + NOT = { government_has_flag = government_is_administrative } + } + change_government = administrative_government + create_noble_family_effect = { GOVERNMENT_GIVER = this } + add_to_list = estatified_list + } + + every_vassal_or_below = { + limit = { + highest_held_title_tier >= tier_county + OR = { + government_has_flag = government_is_feudal + government_has_flag = government_is_clan + government_has_flag = government_is_tribal + } + NOR = { + faith.religious_head ?= this + liege = { + faith.religious_head ?= this + top_liege != this + } + AND = { + exists = scope:ignore_culture + culture = scope:ignore_culture + } + } + } + change_to_administrative_effect = yes + } + } +} + +apply_historic_administrative_game_rule_effect = { + # We'll be doing some excessive triggers below in a bid to lightly future-proof + error-spam mods less, don't worry about it. + ## We also do player-specific realms separately — we need to know what their realm is so we do it after the lobby exclusively. + # Egypt. + if = { + limit = { + NOT = { has_game_rule = historicity_extra_admin_egypt_gameplay_not_administrative } + exists = title:k_egypt + } + if = { + limit = { has_game_rule = historicity_extra_admin_egypt_historic_always } + title:k_egypt.holder ?= { convert_to_administrative_from_feudalism_game_start_effect = yes } + } + } + # Arabia. + if = { + limit = { + NOT = { has_game_rule = historicity_extra_admin_arabia_gameplay_not_administrative } + exists = title:e_arabia + } + if = { + limit = { has_game_rule = historicity_extra_admin_arabia_historic_867 } + # Give the Armenians a fighting chance. + culture:armenian = { save_scope_as = ignore_culture } + title:e_arabia.holder ?= { convert_to_administrative_from_feudalism_game_start_effect = yes } + } + } + # Ghana. + if = { + limit = { + NOT = { has_game_rule = historicity_extra_admin_ghana_gameplay_not_administrative } + exists = title:k_ghana + } + if = { + limit = { has_game_rule = historicity_extra_admin_ghana_historic_always } + title:k_ghana.holder ?= { convert_to_administrative_from_feudalism_game_start_effect = yes } + } + } + # Kabulistan/the Ghaznivids. + if = { + limit = { + NOT = { has_game_rule = historicity_extra_admin_kabulistan_gameplay_not_administrative } + exists = title:k_kabulistan + } + if = { + limit = { has_game_rule = historicity_extra_admin_kabulistan_historic_always } + title:k_kabulistan.holder ?= { convert_to_administrative_from_feudalism_game_start_effect = yes } + } + } + # Persia. + if = { + limit = { + NOT = { has_game_rule = historicity_extra_admin_persia_gameplay_not_administrative } + exists = title:e_persia + exists = title:k_persia + } + if = { + limit = { + game_start_date = 1178.10.1 + has_game_rule = historicity_extra_admin_persia_historic_1178 + } + title:k_persia.holder ?= { convert_to_administrative_from_feudalism_game_start_effect = yes } + } + else_if = { + limit = { has_game_rule = historicity_extra_admin_persia_alt_historic_always } + # Independent k_persia. + if = { + limit = { + title:k_persia.holder ?= { top_liege = this } + } + title:k_persia.holder ?= { convert_to_administrative_from_feudalism_game_start_effect = yes } + } + # Else, the empire. + else = { + title:e_persia.holder ?= { convert_to_administrative_from_feudalism_game_start_effect = yes } + } + } + } + # Maghreb. + if = { + limit = { + NOT = { has_game_rule = historicity_extra_admin_maghreb_gameplay_not_administrative } + exists = title:k_maghreb + } + if = { + limit = { + game_start_date >= 1066.9.15 + has_game_rule = historicity_extra_admin_maghreb_historic_post_1066 + } + title:k_maghreb.holder ?= { convert_to_administrative_from_feudalism_game_start_effect = yes } + } + else_if = { + limit = { has_game_rule = historicity_extra_admin_maghreb_alt_historic_always } + title:k_maghreb.holder ?= { convert_to_administrative_from_feudalism_game_start_effect = yes } + } + } + # Tamilakam/the Cholas. + if = { + limit = { + NOT = { has_game_rule = historicity_extra_admin_tamilakam_gameplay_not_administrative } + exists = title:k_tamilakam + } + if = { + limit = { + game_start_date = 1066.9.15 + has_game_rule = historicity_extra_admin_tamilakam_historic_1066 + } + title:k_tamilakam.holder ?= { convert_to_administrative_from_feudalism_game_start_effect = yes } + } + else_if = { + limit = { has_game_rule = historicity_extra_admin_tamilakam_alt_historic_always } + title:k_tamilakam.holder ?= { convert_to_administrative_from_feudalism_game_start_effect = yes } + } + } + # The Carolingians. + if = { + limit = { + NOT = { has_game_rule = historicity_extra_admin_carolingians_gameplay_not_administrative } + game_start_date = 867.1.1 + exists = title:k_france + exists = title:k_lotharingia + exists = title:k_east_francia + exists = title:k_italy + } + if = { + limit = { has_game_rule = historicity_extra_admin_carolingians_alt_historic_all_administrative } + title:k_france.holder ?= { convert_to_administrative_from_feudalism_game_start_effect = yes } + title:k_lotharingia.holder ?= { convert_to_administrative_from_feudalism_game_start_effect = yes } + title:k_east_francia.holder ?= { convert_to_administrative_from_feudalism_game_start_effect = yes } + title:k_italy.holder ?= { convert_to_administrative_from_feudalism_game_start_effect = yes } + } + if = { + limit = { has_game_rule = historicity_extra_admin_carolingians_alt_historic_west_francia_administrative } + title:k_france.holder ?= { convert_to_administrative_from_feudalism_game_start_effect = yes } + } + if = { + limit = { has_game_rule = historicity_extra_admin_carolingians_alt_historic_lotharingia_administrative } + title:k_lotharingia.holder ?= { convert_to_administrative_from_feudalism_game_start_effect = yes } + } + if = { + limit = { has_game_rule = historicity_extra_admin_carolingians_alt_historic_east_francia_administrative } + title:k_east_francia.holder ?= { convert_to_administrative_from_feudalism_game_start_effect = yes } + } + if = { + limit = { has_game_rule = historicity_extra_admin_carolingians_alt_historic_italy_administrative } + title:k_italy.holder ?= { convert_to_administrative_from_feudalism_game_start_effect = yes } + } + } +} + +convert_to_feudalism_from_administrative_effect = { + #Gain some gold for selling off your estates + if = { + limit = { + any_vassal = { + any_held_title = { is_noble_family_title = yes } + exists = domicile + } + } + custom_tooltip = estates_get_bought + every_vassal = { + limit = { + any_held_title = { is_noble_family_title = yes } + exists = domicile + } + hidden_effect = { + add_gold = { + value = { + value = major_gold_value + switch = { + trigger = domicile.num_domicile_buildings + 7 = { multiply = 7 } + 6 = { multiply = 6 } + 5 = { multiply = 5 } + 4 = { multiply = 4 } + 3 = { multiply = 3 } + 2 = { multiply = 2 } + } + } + } + } + } + } + + #Then change government + if = { + limit = { ep3_is_clan_inclined_trigger = yes } + change_government = clan_government + + #Duchies automatically transfer, need to poke the kingdoms + if = { + limit = { + any_vassal = { + primary_title.tier >= tier_kingdom + NOR = { + government_has_flag = government_is_clan + government_has_flag = government_is_theocracy + } + } + } + custom_tooltip = kings_become_clan + every_vassal = { + limit = { + primary_title.tier >= tier_kingdom + NOR = { + government_has_flag = government_is_clan + government_has_flag = government_is_theocracy + } + } + hidden_effect = { change_government = clan_government } + } + } + } + else = { + change_government = feudal_government + + #Duchies automatically transfer, need to poke the kingdoms + if = { + limit = { + any_vassal = { + primary_title.tier >= tier_kingdom + NOR = { + government_has_flag = government_is_feudal + government_has_flag = government_is_theocracy + } + } + } + custom_tooltip = kings_become_feudal + every_vassal = { + limit = { + primary_title.tier >= tier_kingdom + NOR = { + government_has_flag = government_is_feudal + government_has_flag = government_is_theocracy + } + } + hidden_effect = { change_government = feudal_government } + } + } + } + + #Governors become Dukes tooltip + if = { + limit = { + any_vassal = { + primary_title.tier = tier_duchy + NOT = { government_has_flag = government_is_clan } + } + } + custom_tooltip = governors_become_dukes + } +} + +humiliate_stooge_counter_effect = { + if = { + limit = { + NOT = { has_variable = humiliated_stooge_counter_var } + } + set_variable = { + name = humiliated_stooge_counter_var + value = 1 + } + } + else = { + change_variable = { + name = humiliated_stooge_counter_var + add = 1 + } + } +} + +humiliate_stooge_reward_effect = { + hidden_effect = { + scope:stooge ?= { + add_opinion = { + target = root + opinion = -25 + modifier = humiliated_opinion + } + } + if = { + limit = { + scope:stooge.var:humiliated_stooge_counter_var ?= 1 + } + # First time, it's fine + send_interface_toast = { + type = event_toast_effect_good + title = humiliate_the_stooge_decision_tt + left_icon = root + right_icon = scope:stooge + add_stress = major_stress_impact_loss + add_dread = minor_dread_gain + add_character_modifier = { + modifier = stooge_humiliated_modifier + years = 2 + } + } + } + else_if = { + limit = { + scope:stooge.var:humiliated_stooge_counter_var ?= 2 + } + send_interface_toast = { + type = event_toast_effect_good + title = humiliate_the_stooge_decision_2_tt + left_icon = root + right_icon = scope:stooge + add_stress = medium_stress_impact_loss + add_dread = medium_dread_gain + add_character_modifier = { + modifier = stooge_humiliated_modifier + years = 2 + } + } + } + else_if = { + limit = { + scope:stooge.var:humiliated_stooge_counter_var ?= 3 + } + # Third time, crying + send_interface_toast = { + type = event_toast_effect_good + title = humiliate_the_stooge_decision_3_tt + left_icon = root + right_icon = scope:stooge + add_stress = minor_stress_impact_loss + add_dread = major_dread_gain + add_character_modifier = { + modifier = stooge_humiliated_modifier + years = 2 + } + } + } + else_if = { + limit = { + scope:stooge.var:humiliated_stooge_counter_var ?= 4 + } + # Fourth time, it's over + send_interface_toast = { + type = event_toast_effect_neutral + title = humiliate_the_stooge_decision_4_tt + left_icon = root + right_icon = scope:stooge + add_dread = major_dread_gain + add_character_modifier = { + modifier = stooge_humiliated_fourth_time_modifier + years = 2 + } + remove_courtier_or_guest = scope:stooge + scope:stooge = { # They won't join your court + set_variable = { + name = non_recruitable_var + value = root + } + } + } + } + } +} + +admin_confirmation_vassal_reward_guts_effect = { + dynasty ?= { add_dynasty_prestige = minor_dynasty_prestige_gain } + if = { + limit = { + scope:confirmation_liege = { is_ai = yes } + } + reverse_add_opinion = { + target = scope:confirmation_liege + modifier = respect_opinion + opinion = 20 + } + } + add_prestige = major_prestige_gain + change_influence = major_influence_gain +} diff --git a/N3OW/common/scripted_effects/00_experience_effects.txt b/N3OW/common/scripted_effects/00_experience_effects.txt new file mode 100644 index 00000000..bb10b2df --- /dev/null +++ b/N3OW/common/scripted_effects/00_experience_effects.txt @@ -0,0 +1,66 @@ +gain_trait_or_experience_effect = { + if = { + limit = { has_trait = $TRAIT$ } + add_trait_xp = { + trait = $TRAIT$ + value = $AMOUNT$ + } + } + else = { + add_trait = $TRAIT$ + } +} + +gain_appropriate_lifestyle_medium_xp_effect = { + if = { + limit = { has_any_lifestyle_focus_trigger = yes } + switch = { + trigger = has_lifestyle + diplomacy_lifestyle = { + add_diplomacy_lifestyle_xp = medium_lifestyle_xp + } + martial_lifestyle = { + add_martial_lifestyle_xp = medium_lifestyle_xp + } + stewardship_lifestyle = { + add_stewardship_lifestyle_xp = medium_lifestyle_xp + } + intrigue_lifestyle = { + add_intrigue_lifestyle_xp = medium_lifestyle_xp + } + learning_lifestyle = { + add_learning_lifestyle_xp = medium_lifestyle_xp + } + } + } + else = { # Fallback + add_diplomacy_lifestyle_xp = medium_lifestyle_xp + } +} + +gain_appropriate_lifestyle_major_xp_effect = { + if = { + limit = { has_any_lifestyle_focus_trigger = yes } + switch = { + trigger = has_lifestyle + diplomacy_lifestyle = { + add_diplomacy_lifestyle_xp = major_lifestyle_xp + } + martial_lifestyle = { + add_martial_lifestyle_xp = major_lifestyle_xp + } + stewardship_lifestyle = { + add_stewardship_lifestyle_xp = major_lifestyle_xp + } + intrigue_lifestyle = { + add_intrigue_lifestyle_xp = major_lifestyle_xp + } + learning_lifestyle = { + add_learning_lifestyle_xp = major_lifestyle_xp + } + } + } + else = { # Fallback + add_diplomacy_lifestyle_xp = major_lifestyle_xp + } +} \ No newline at end of file diff --git a/N3OW/common/scripted_effects/00_faction_effects.txt b/N3OW/common/scripted_effects/00_faction_effects.txt new file mode 100644 index 00000000..b58186fb --- /dev/null +++ b/N3OW/common/scripted_effects/00_faction_effects.txt @@ -0,0 +1,2319 @@ + + +##################################################################### +# EFFECT LIST +##################################################################### + +# join_faction_with_leave_blocker_effect - make a character join a faction, and prevent them from leaving +# leave_faction_with_cooldown_effect - makes a character leave a FACTION and not rejoin another faction for YEARS years +# get_popular_revolt_target_effect - looks for a valid title for a popular revolt to target (may not be the title the revolt gets if successful, just determines the 'region' the revolt is supposed to occur within), +# successful_popular_revolt_outcome_effect - handles all of the title changes necessary for a successful popular revolt to break away as an independent realm. +# get_popular_revolt_title_name - Script logic to check what the new name of dynamically-created peasant titles should be (e.g., Kingdom of Isma'ili Arabia). + +join_faction_with_leave_blocker_effect = { + join_faction = $FACTION$ + hidden_effect = { + save_temporary_scope_value_as = { + name = join_faction_with_leave_blocker_effect_number + value = flag:$YEARS$ + } + add_character_flag = { + flag = leaving_faction_block + years = $YEARS$ + } + } + if = { + limit = { this = root } + custom_tooltip = join_faction_with_leave_blocker_effect_first.tt + } + else = { + custom_tooltip = join_faction_with_leave_blocker_effect_third.tt + } + + #and to prevent angry error messages :D:D:D:D + if = { + limit = { + scope:join_faction_with_leave_blocker_effect_number = flag:1 + } + } +} + +add_faction_cooldown_effect = { + if = { + limit = { is_landless_adventurer = no } + custom_description = { + text = faction_cooldown_effect + value = $YEARS$ + add_character_flag = { + flag = joining_faction_block + years = $YEARS$ + } + } + } +} + +leave_faction_with_cooldown_effect = { + leave_faction = $FACTION$ + add_faction_cooldown_effect = { YEARS = $YEARS$ } +} + +imprisonment_retribution_start_faction_war_if_valid = { + scope:recipient = { + custom_tooltip = FACTION_IMPRISONMENT_RETALIATION_WARNING + } + hidden_effect = { + if = { + limit = { + faction_power > faction_power_threshold + NOT = { faction_is_type = populist_faction } + } + + if = { + limit = { + faction_is_type = claimant_faction + } + special_title = { + save_scope_as = target_title + } + faction_start_war = { + title = scope:target_title + } + } + else = { + faction_start_war = {} + } + every_faction_member = { + trigger_event = faction_demand.9001 + } + } + } +} + +# Get the most appropriate 'target title' we can for a popular revolt (determines the de jure area the war will target, not final titles granted). +get_popular_revolt_target_effect = { + $FACTION$ = { + save_scope_as = faction + faction_target = { + save_scope_as = faction_target + } + + # First check if there are any valid kingdoms to target. + if = { + limit = { + # Only large revolts in large realms are eligible to target an entire kingdom. + any_faction_county_member = { + count >= 11 + } + scope:faction_target.primary_title.tier >= tier_kingdom + } + every_faction_county_member = { + kingdom = { + if = { + # Do not target titles held by rulers outside of our realm. + limit = { + NOT = { exists = holder } + holder.top_liege = scope:faction_target + } + } + add_to_list = tmp_potential_kingdoms + } + } + + # Out of the valid kingdoms (if any), pick the 'best' one + ordered_in_list = { + list = tmp_potential_kingdoms + + order_by = { + # First look at the total number of rebels within the kingdom's de jure territory. + value = 0 + add = { + value = 0 + every_in_de_jure_hierarchy = { + limit = { + tier = tier_county + any_title_joined_faction = { + this = $FACTION$ + } + } + add = total_county_levies + } + } + + if = { + limit = { + exists = holder + } + if = { + # Prefer targeting titles held by the faction target... + limit = { + holder != scope:faction_target + } + multiply = 0.5 + } + else_if = { + #...but not the target's primary title (we don't want to usurp them if we can help it!) + limit = { + this = scope:faction_target.primary_title + } + multiply = 0.5 + } + } + + } + save_scope_as = tmp_target_title + } + } + + # If we were ineligible for kingdom-tier or failed to find a valid one, look for duchies. + if = { + limit = { + NOT = { exists = scope:tmp_target_title} + + # Mid-sized or larger revolts in medium realms are eligible for duchy titles. + any_faction_county_member = { + count >= 5 + } + faction_target.primary_title.tier >= tier_duchy + } + every_faction_county_member = { + duchy = { + if = { + # Do not target titles held by rulers outside of our realm. + limit = { + NOT = { exists = holder } + holder.top_liege = scope:faction_target + } + } + add_to_list = tmp_potential_duchies + } + } + + # Out of the valid duchies (if any), pick the 'best' one + ordered_in_list = { + list = tmp_potential_duchies + + order_by = { + value = 0 + # First look at the total number of rebels within the duchy's de jure territory. + add = { + value = 0 + every_in_de_jure_hierarchy = { + limit = { + tier = tier_county + any_title_joined_faction = { + this = $FACTION$ + } + } + add = total_county_levies + } + } + + if = { + limit = { + exists = holder + } + if = { + # Prefer targeting titles held by the faction target... + limit = { + holder != scope:faction_target + } + multiply = 0.5 + } + else_if = { + #...but not the target's primary title (we don't want to usurp them if we can help it!) + limit = { + this = scope:faction_target.primary_title + } + multiply = 0.5 + } + } + } + save_scope_as = tmp_target_title + } + } + + # If we still don't have a target title, pick the largest county. + if = { + limit = { + NOT = { exists = scope:tmp_target_title} + } + ordered_faction_county_member = { + order_by = total_county_levies + + save_scope_as = tmp_target_title + } + } + + # Re-save our temporary scope as the 'official' target scope, then clear all temporary scopes. + if = { + limit = { + exists = scope:tmp_target_title + } + scope:tmp_target_title = { + save_scope_as = target_title + } + set_special_title = scope:target_title + clear_saved_scope = tmp_target_title + } + every_in_list = { + list = tmp_potential_kingdoms + remove_from_list = tmp_potential_kingdoms + } + every_in_list = { + list = tmp_potential_duchies + remove_from_list = tmp_potential_duchies + } + } +} + +add_adjacent_valid_counties_to_list = { + every_neighboring_county = { + limit = { + faith = $FAITH$ + holder = { + is_ai = yes # Without this, successful Populist Revolts can lead to suprise Game Overs for players without any warning. + top_liege = $TOP_LIEGE$ + } + NOT = { is_in_list = $LIST$ } + } + add_to_list = $LIST$ + } +} + +split_noncontiguous_counties_from_revolt_effect = { + # Start off by making a list of all disconnected Counties + every_connected_county = { + invert = yes + max_naval_distance = 2000 + add_to_list = disconnected_counties + } + + # Then release contiguous disconnected areas. + every_in_list = { + list = disconnected_counties + + if = { + limit = { + holder.top_liege = $FACTION_LEADER$ + } + save_scope_as = county_of_origin + + create_character = { + location = scope:county_of_origin.title_province + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + gender_female_chance = 50 + age = 32 + save_scope_as = new_county_holder + } + + create_title_and_vassal_change = { + type = independency + save_scope_as = exclave_change + add_claim_on_loss = no + } + every_in_list = { + list = disconnected_counties + limit = { + holder.top_liege = $FACTION_LEADER$ + is_connected_to = { target = scope:county_of_origin } + } + change_title_holder = { + holder = scope:new_county_holder + change = scope:exclave_change + } + } + scope:new_county_holder = { + becomes_independent = { + change = scope:exclave_change + } + } + resolve_title_and_vassal_change = scope:exclave_change + + scope:new_county_holder = { + if = { # Just in case they need to create a duchy + limit = { + gold < 500 + } + add_gold = 500 + } + } + } + } +} + +# Shared effect between the Popular Faction's demand event and victory outcome. +# +# Parameters: +# $FACTION_LEADER$ +# $TARGET_TITLE$ +# $SOURCE_GOVERNMENT$ +# +successful_popular_revolt_outcome_effect = { + # Save scopes for later usage. + $FACTION_LEADER$ = { + joined_faction = { + save_scope_as = popular_faction + every_faction_member = { + add_to_list = faction_members + } + faction_target = { + save_scope_as = faction_target + } + } + } + + if = { # Populists factions in an admin realm should aim to change state faith, if they are of the capital culture + limit = { + $SOURCE_GOVERNMENT$ = { government_allows = state_faith } + $FACTION_LEADER$.culture = scope:faction_target.capital_county.culture + $FACTION_LEADER$.faith != scope:faction_target.primary_title.state_faith + } + + $SOURCE_GOVERNMENT$.primary_title = { + # Change the state faith + set_state_faith = $FACTION_LEADER$.faith + + # Try grabbing someone from the line of succession who practices the State Faith + if = { + limit = { + any_title_heir = { + faith = $FACTION_LEADER$.faith + } + } + ordered_title_heir = { + order_by = "appointment_candidate_score(prev)" + limit = { + faith = $FACTION_LEADER$.faith + } + save_scope_as = new_ruler + } + } + # Otherwise, make the peasant leader the new emperor + else = { $FACTION_LEADER$ = { save_scope_as = new_ruler } } + + # Actually make the switch + create_title_and_vassal_change = { + type = conquest_populist + save_scope_as = change + } + # Transfer all titles to heir of primary title if only one governorship is held + hidden_effect = { + $SOURCE_GOVERNMENT$ = { + every_held_title = { + title_tier >= county + limit = { + is_landless_type_title = no + is_noble_family_title = no + } + change_title_holder_include_vassals = { + holder = scope:new_ruler + change = scope:change + take_baronies = no + } + } + } + } + resolve_title_and_vassal_change = scope:change + } + } + else_if = { # Populists factions of the state faith in an admin realm where the emperor is of a heretical faith simply take the empire + limit = { + $SOURCE_GOVERNMENT$ = { government_allows = state_faith } + $FACTION_LEADER$.faith = scope:faction_target.primary_title.state_faith + $FACTION_LEADER$.faith != scope:faction_target.faith + } + + $SOURCE_GOVERNMENT$.primary_title = { + + $FACTION_LEADER$ = { save_scope_as = new_ruler } + + # Actually make the switch + create_title_and_vassal_change = { + type = conquest_populist + save_scope_as = change + } + # Transfer all titles to heir of primary title if only one governorship is held + hidden_effect = { + $SOURCE_GOVERNMENT$ = { + every_held_title = { + title_tier >= county + limit = { + is_landless_type_title = no + is_noble_family_title = no + } + change_title_holder_include_vassals = { + holder = scope:new_ruler + change = scope:change + take_baronies = no + } + } + } + } + resolve_title_and_vassal_change = scope:change + } + } + else = { # Otherwise we run the normal script + + # Compile a list of all counties belonging to the faction. + scope:popular_faction = { + every_faction_county_member = { + add_to_list = siezed_counties + } + } + # Additionally, if we're at war (and not just pressing demands)... + if = { + limit = { + $FACTION_LEADER$ = { + is_at_war_with = scope:faction_target + } + } + # Add all occupied counties of the correct culture/faith. + scope:faction_target = { + every_sub_realm_county = { + limit = { + county_controller = $FACTION_LEADER$ + faith = $FACTION_LEADER$.faith + } + add_to_list = siezed_counties + } + } + + # And add any war members that aren't already in the faction. + $FACTION_LEADER$ = { + every_character_war = { + limit = { + is_defender = scope:faction_target + } + every_war_attacker = { + limit = { + NOT = { is_in_list = faction_members } + } + add_to_list = faction_members + } + } + } + } + + # Select a 'capital' county for the faction leader. + scope:popular_faction = { + ordered_faction_county_member = { + order_by = { + value = total_county_levies + + multiply = { + value = 1 + + # Up to 50% bonus points for counties of the correct culture/faith. + if = { + limit = { culture = $FACTION_LEADER$.culture } + add = 0.25 + } + if = { + limit = { faith = $FACTION_LEADER$.faith } + add = 0.25 + } + + # Additional 50% bonus points for counties located in the de jure area of the liege title we want to sieze. + if = { + limit = { + target_is_de_jure_liege_or_above = $TARGET_TITLE$ + } + add = 0.50 + } + + # Remove 75% for counties owned by a player. + if = { + limit = { + holder = { is_ai = no } + } + subtract = 0.75 + } + } + } + + #remove_from_list = siezed_counties + save_scope_as = capital_county + } + } + + # CHANGE ZERO: Give the leader a county to stop landless characters from screwing up the hierarchy. + hidden_effect = { + create_title_and_vassal_change = { + type = conquest_populist + save_scope_as = change_zero + add_claim_on_loss = yes + } + scope:capital_county = { + change_title_holder = { + holder = $FACTION_LEADER$ + change = scope:change_zero + take_baronies = no + } + } + resolve_title_and_vassal_change = scope:change_zero + } + + # Let's add in any additional counties belonging to other participants, which isn't part of the faction already, so that we can assign a kingdom/duchy tier title properly. + # (We'll remove these again further down.) + if = { + limit = { + any_in_list = { + list = faction_members + NOT = { this = $FACTION_LEADER$ } + } + } + every_in_list = { + list = faction_members + limit = { + NOT = { this = $FACTION_LEADER$ } + } + every_sub_realm_county = { + limit = { + NOT = { is_in_list = siezed_counties } + } + add_to_list = siezed_counties + } + } + } + # CHANGE ONE: Give the leader an appropriately-ranked title. + create_title_and_vassal_change = { + type = conquest_populist + save_scope_as = change_one + add_claim_on_loss = yes + } + if = { + # Check if we can give them a kingdom. + limit = { + OR = { + any_in_list = { # If the realm is large enough to make a duchy unfeasible. + list = siezed_counties + count >= 20 + } + any_in_list = { # If there is a kingdom title available for creation/usurpation. + list = siezed_counties + kingdom = { + any_de_jure_county = { + percent >= 0.5 + is_in_list = siezed_counties + } + OR = { + NOT = { exists = holder } + trigger_if = { + limit = { exists = holder } + holder.top_liege = scope:faction_target + + # Don't usurp the primary title from independent rulers if they don't have an equal-tier title to replace it with. + trigger_if = { + limit = { + this = holder.primary_title + holder = holder.top_liege + } + holder = { + any_held_title = { + title_tier = kingdom + count >= 2 + } + } + } + + # Don't usurp the primary title from vassal players if they don't have an equal-tier title to replace it with + trigger_if = { + limit = { + holder = { is_ai = no } + holder != holder.top_liege + } + holder = { + any_held_title = { + title_tier = kingdom + count >= 2 + } + } + } + } + } + # Special block to stop populist factions from creating Germany if the HRE is still alive and kicking. + NAND = { + this = title:k_east_francia + exists = title:e_hre.holder + } + } + } + } + } + + # Check if we can create or usurp a De Jure Kingdom from the map + every_in_list = { + list = siezed_counties + kingdom = { + if = { + limit = { + any_de_jure_county = { + percent >= 0.5 + is_in_list = siezed_counties + } + OR = { + NOT = { exists = holder } + trigger_if = { + limit = { exists = holder } + holder.top_liege = scope:faction_target + + # Don't usurp the primary title from independent rulers if they don't have an equal-tier title to replace it with. + trigger_if = { + limit = { + this = holder.primary_title + holder = holder.top_liege + } + holder = { + any_held_title = { + title_tier = kingdom + count >= 2 + } + } + } + + # Don't usurp the primary title from vassal players if they don't have an equal-tier title to replace it with + trigger_if = { + limit = { + holder = { is_ai = no } + holder != holder.top_liege + } + holder = { + any_held_title = { + title_tier = kingdom + count >= 2 + } + } + } + } + } + # Special block to stop populist factions from creating Germany if the HRE is still alive and kicking. + NAND = { + this = title:k_east_francia + exists = title:e_hre.holder + } + } + add_to_list = potential_kingdoms + } + } + } + + # If we found one or more valid De Jure Kingdoms, pick the best one for us to take. + if = { + limit = { + any_in_list = { + list = potential_kingdoms + count >= 1 + NAND = { + this = title:k_east_francia + exists = title:e_hre.holder + } + } + } + ordered_in_list = { + list = potential_kingdoms + limit = { + NAND = { + this = title:k_east_francia + exists = title:e_hre.holder + } + } + + order_by = { + value = 1 + every_in_list = { + list = siezed_counties + limit = { kingdom = prev } + add = 1 + } + } + + change_title_holder = { + holder = $FACTION_LEADER$ + change = scope:change_one + } + } + } + # Otherwise, create a new titular Kingdom title. + else = { + create_popular_revolt_title_effect = { + FACTION = scope:popular_faction + FACTION_LEADER = $FACTION_LEADER$ + TIER = kingdom + } + scope:new_title = { + change_title_holder = { + holder = $FACTION_LEADER$ + change = scope:change_one + } + } + } + } + else_if = { + # Check if we can give them a duchy. + limit = { + OR = { + any_in_list = { # If the realm is large enough to make a county as the highest tier unfeasible. + list = siezed_counties + count >= 8 + } + any_in_list = { # If there is a duchy title available for creation/usurpation. + list = siezed_counties + duchy = { + any_de_jure_county = { + percent >= 0.5 + is_in_list = siezed_counties + } + OR = { + NOT = { exists = holder } + trigger_if = { + limit = { exists = holder } + holder.top_liege = scope:faction_target + + # Don't usurp the primary title from independent rulers if they don't have an equal-tier title to replace it with. + trigger_if = { + limit = { + this = holder.primary_title + holder = holder.top_liege + } + holder = { + any_held_title = { + title_tier = duchy + count >= 2 + } + } + } + + # Don't usurp the primary title from vassal players if they don't have an equal-tier title to replace it with + trigger_if = { + limit = { + holder = { is_ai = no } + holder != holder.top_liege + } + holder = { + any_held_title = { + title_tier = duchy + count >= 2 + } + } + } + } + } + } + } + } + } + + # Check if we can create or usurp a De Jure Duchy from the map + every_in_list = { + list = siezed_counties + duchy = { + if = { + limit = { + any_de_jure_county = { + percent >= 0.4 + is_in_list = siezed_counties + } + OR = { + NOT = { exists = holder } + trigger_if = { + limit = { exists = holder } + holder.top_liege = scope:faction_target + + # Don't usurp the primary title from independent rulers if they don't have an equal-tier title to replace it with. + trigger_if = { + limit = { + this = holder.primary_title + holder = holder.top_liege + } + holder = { + any_held_title = { + title_tier = duchy + count >= 2 + } + } + } + + # Don't usurp the primary title from vassal players if they don't have an equal-tier title to replace it with + trigger_if = { + limit = { + holder = { is_ai = no } + holder != holder.top_liege + } + holder = { + any_held_title = { + title_tier = duchy + count >= 2 + } + } + } + } + } + } + add_to_list = potential_duchies + } + } + } + + # If we found one or more valid De Jure Duchies, pick the best one for us to take. + if = { + limit = { + any_in_list = { + list = potential_duchies + count >= 1 + } + } + ordered_in_list = { + list = potential_duchies + + order_by = { + value = 1 + every_in_list = { + list = siezed_counties + limit = { duchy = prev } + add = 1 + } + } + + change_title_holder = { + holder = $FACTION_LEADER$ + change = scope:change_one + } + } + } + # Otherwise, create a new titular Duchy title. + else = { + create_popular_revolt_title_effect = { + FACTION = scope:popular_faction + FACTION_LEADER = $FACTION_LEADER$ + TIER = duchy + } + scope:new_title = { + change_title_holder = { + holder = $FACTION_LEADER$ + change = scope:change_one + } + } + } + } + + # If the new realm is too small, or is unable to take/create a higher tier title, the populist leader only gets the county titles themselves. + resolve_title_and_vassal_change = scope:change_one + + # If the title we gave our leader is a new dynamic title, generate a CoA for it. + if = { + limit = { + exists = scope:new_title + } + scope:new_title = { + set_capital_county = scope:capital_county + generate_coa = yes + } + } + + # CHANGE TWO: Transfer the siezed counties to the leader. + create_title_and_vassal_change = { + type = conquest_populist + save_scope_as = change_two + add_claim_on_loss = yes + } + if = { # But remove counties from any faction/war member first. + limit = { + any_in_list = { + list = faction_members + NOT = { this = $FACTION_LEADER$ } + } + } + every_in_list = { + list = faction_members + limit = { + NOT = { this = $FACTION_LEADER$ } + } + every_sub_realm_county = { + remove_from_list = siezed_counties + } + } + } + every_in_list = { + list = siezed_counties + + change_title_holder = { + holder = $FACTION_LEADER$ + change = scope:change_two + take_baronies = no + } + } + resolve_title_and_vassal_change = scope:change_two + + # CHANGE THREE: Split the leader off into an independent realm. Then make all faction members vassals of the populist leader. + create_title_and_vassal_change = { + type = conquest_populist + save_scope_as = change_three + add_claim_on_loss = yes + } + every_in_list = { + list = faction_members + + # Lower-ranked vassals switch lieges to the faction leader. + if = { + limit = { + this.primary_title.tier < $FACTION_LEADER$.primary_title.tier + this.primary_title.tier >= tier_county + NOT = { this = $FACTION_LEADER$ } + is_landless_adventurer = no + } + change_liege = { + liege = $FACTION_LEADER$ + change = scope:change_three + } + } + # Same or higher-ranked vassal get independence. + else_if = { + limit = { + NOT = { this = $FACTION_LEADER$ } + is_landless_adventurer = no + } + hidden_effect = { + becomes_independent = { + change = scope:change_three + } + send_interface_toast = { + type = event_toast_effect_good + title = POPULIST_FACTION_INDEPENDENCE_TITLE + custom_tooltip = POPULIST_FACTION_INDEPENDENCE_DESC + left_icon = $FACTION_LEADER$ + right_icon = scope:faction_target + } + } + } + } + + resolve_title_and_vassal_change = scope:change_three + + # Sub-change: if any counties have been offended by HumSac'ing, since they're revolting, and tempers have hit fever pitch, remove their county opinion malus. + $FACTION_LEADER$ = { fp1_remove_humsac_offended_counties_effect = yes } + + # CHANGE FOUR: If there are any disconnected counties, split them off via exclave independence rules. + # However. We don't do this if there is a player in the faction, since it can remove land from the player, or in worst case, make the player game over. + if = { + limit = { + NOT = { + any_in_list = { + list = faction_members + is_ai = no + } + } + } + scope:capital_county = { + split_noncontiguous_counties_from_revolt_effect = { + FACTION_LEADER = $FACTION_LEADER$ + } + } + } + + # If the faction still exists, dissolve it (it's no longer relevant). + hidden_effect = { + if = { + limit = { + exists = scope:popular_faction + } + scope:popular_faction = { + destroy_faction = yes + } + } + } + + # Set up government type correctly. + hidden_effect = { + $FACTION_LEADER$ = { + #If sourced from tribal, make tribal. + if = { + limit = { + $SOURCE_GOVERNMENT$ = { government_has_flag = government_is_tribal } + } + change_government = tribal_government + add_realm_law = tribal_authority_0 + if = { limit = { has_realm_law = crown_authority_0 } remove_realm_law = crown_authority_0 } + if = { limit = { has_realm_law = crown_authority_1 } remove_realm_law = crown_authority_1 } + if = { limit = { has_realm_law = crown_authority_2 } remove_realm_law = crown_authority_2 } + if = { limit = { has_realm_law = crown_authority_3 } remove_realm_law = crown_authority_3 } + } + } + } + + # Give the leader some gold if they don't have any - We do this at the very end to make sure the gold is applied correctly. + hidden_effect = { + if = { + limit = { + $FACTION_LEADER$ = { + gold < 10 + } + } + every_in_list = { # Scale the amount on the number of counties taken. + list = siezed_counties + $FACTION_LEADER$ = { + add_gold = 50 + } + } + } + } + } +} + +create_popular_revolt_title_effect = { + $FACTION$ = { + ordered_faction_county_member = { + limit = { + faith = $FACTION_LEADER$.faith + culture = $FACTION_LEADER$.culture + } + alternative_limit = { + always = yes + } + + order_by = total_county_levies + + save_scope_as = base_county + } + $FACTION_LEADER$.culture = { save_scope_as = founder_culture } + create_dynamic_title = { + tier = $TIER$ + name = FACTION_POPULIST_CREATED_TITLE_NAME + } + scope:new_title = { + set_variable = { + name = faction + value = $FACTION$ + } + set_color_from_title = scope:base_county + } + } +} + +successful_nomadic_revolt_outcome_effect = { + hidden_effect = { + # Save scopes for later usage. + $FACTION_LEADER$ = { + add_character_flag = successful_nomad_revolt_leader + joined_faction = { + save_scope_as = nomadic_faction + every_faction_member = { + add_to_list = faction_members + } + faction_target = { + save_scope_as = faction_target + } + } + if = { + limit = { + has_variable = peasant_title + exists = this.var:peasant_title.holder + } + destroy_title = this.var:peasant_title + } + } + # Compile a list of all duchies and counties belonging to the faction. + scope:nomadic_faction = { + every_faction_county_member = { + add_to_list = siezed_counties + duchy = { + every_de_jure_county = { # Seize entire duchies + limit = { + holder.top_liege = scope:faction_target + NOT = { is_in_list = siezed_counties } + } + add_to_list = siezed_counties + } + if = { + limit = { + NOT = { is_in_list = siezed_duchies } + } + add_to_list = siezed_duchies + } + } + } + } + + # Select a 'capital' county for the faction leader. + scope:nomadic_faction = { + ordered_in_list = { + list = siezed_counties + order_by = { + value = county_fertility + + multiply = { + value = 1 + if = { + limit = { culture = $FACTION_LEADER$.culture } + add = 200 + } + if = { + limit = { faith = $FACTION_LEADER$.faith } + add = 50 + } + } + } + save_scope_as = capital_county + } + } + + # Give the leader the counties they should have and make them a nomad. + $FACTION_LEADER$ = { + add_to_list = independent_nomads + change_government = nomad_government + } + create_title_and_vassal_change = { + type = conquest_populist + save_scope_as = change + add_claim_on_loss = yes + } + scope:capital_county = { + change_title_holder = { + holder = $FACTION_LEADER$ + change = scope:change + take_baronies = no + } + add_to_list = divided_titles + duchy = { + every_de_jure_county = { # Seize entire duchies + limit = { + is_in_list = siezed_counties + NOT = { is_in_list = divided_titles } + } + change_title_holder = { + holder = $FACTION_LEADER$ + change = scope:change + take_baronies = no + } + add_to_list = divided_titles + } + if = { + limit = { + OR = { + NOT = { exists = holder } + trigger_if = { + limit = { exists = holder } + holder.top_liege = scope:faction_target + } + } + NOT = { is_in_list = divided_titles } + } + change_title_holder = { + holder = $FACTION_LEADER$ + change = scope:change + } + add_to_list = divided_titles + } + } + } + resolve_title_and_vassal_change = scope:change + + while = { + limit = { + any_in_list = { + list = siezed_counties + NOT = { + is_in_list = divided_titles + } + } + } + random_in_list = { + list = siezed_counties + limit = { + NOT = { + is_in_list = divided_titles + } + } + save_scope_as = handout_county + hidden_effect = { + create_character = { + location = scope:handout_county.title_province + template = nomadic_faction_leader_template + faith = scope:handout_county.faith + culture = scope:handout_county.culture + dynasty = generate + gender_female_chance = { + if = { + limit = { scope:handout_county.faith = { has_doctrine = doctrine_gender_male_dominated } } + add = 0 + } + else_if = { + limit = { scope:handout_county.faith = { has_doctrine = doctrine_gender_female_dominated } } + add = 100 + } + else = { + add = 50 + } + } + save_scope_as = new_nomad + } + scope:new_nomad = { + add_to_list = independent_nomads + } + } + create_title_and_vassal_change = { + type = conquest_populist + save_scope_as = change + add_claim_on_loss = yes + } + scope:handout_county = { + change_title_holder = { + holder = scope:new_nomad + change = scope:change + take_baronies = no + } + add_to_list = divided_titles + duchy = { + every_de_jure_county = { # Seize entire duchies + limit = { + is_in_list = siezed_counties + NOT = { is_in_list = divided_titles } + } + change_title_holder = { + holder = scope:new_nomad + change = scope:change + take_baronies = no + } + add_to_list = divided_titles + } + if = { + limit = { + OR = { + NOT = { exists = holder } + trigger_if = { + limit = { exists = holder } + holder.top_liege = scope:faction_target + } + } + NOT = { is_in_list = divided_titles } + } + change_title_holder = { + holder = scope:new_nomad + change = scope:change + } + add_to_list = divided_titles + } + } + } + resolve_title_and_vassal_change = scope:change + } + } + + # Make sure everyone is independent + create_title_and_vassal_change = { + type = conquest_populist + save_scope_as = change + add_claim_on_loss = yes + } + every_in_list = { + list = independent_nomads + limit = { + is_independent_ruler = no + } + hidden_effect = { + becomes_independent = { + change = scope:change + } + } + } + resolve_title_and_vassal_change = scope:change + + # Set them up for success + every_in_list = { + list = independent_nomads + + hidden_effect = { + save_temporary_scope_as = nomad_becoming_independent + every_held_title = { + limit = { + tier = tier_county + } + if = { + limit = { + title_province = { + has_holding_type = herder_holding + } + } + title_province = { + set_holding_type = nomad_holding + } + } + add_county_modifier = { + modifier = county_increased_opinion_modifier + years = 25 + } + if = { + limit = { + has_county_modifier = peasant_war_lost_county_modifier + } + remove_county_modifier = peasant_war_lost_county_modifier + } + } + if = { + limit = { + gold < 50 + } + add_gold = 150 + } + if = { + limit = { + is_ruler = yes + NOT = { + government_has_flag = government_is_nomadic + } + } + change_government = nomad_government + } + if = { + limit = { + NOT = { + any_held_title = { + is_nomad_title = yes + } + } + } + save_scope_as = holder + create_nomad_title = { + name = nomad_title_name + holder = scope:holder + government = nomad_government + save_scope_as = new_nomad_title + } + } + if = { + limit = { + NOT = { has_realm_law = nomadic_authority_1 } + } + add_realm_law_skip_effects = nomadic_authority_1 + } + if = { + limit = { + highest_held_title_tier >= tier_duchy + NOT = { has_realm_law = nomadic_authority_2 } + } + if = { + limit = { + has_realm_law = nomadic_authority_1 + } + remove_realm_law = nomadic_authority_1 + add_realm_law_skip_effects = nomadic_authority_2 + } + } + if = { limit = { has_realm_law = crown_authority_0 } remove_realm_law = crown_authority_0 } + if = { limit = { has_realm_law = crown_authority_1 } remove_realm_law = crown_authority_1 } + if = { limit = { has_realm_law = crown_authority_2 } remove_realm_law = crown_authority_2 } + if = { limit = { has_realm_law = crown_authority_3 } remove_realm_law = crown_authority_3 } + domicile ?= { + change_herd = { + value = scope:nomad_becoming_independent.capital_county.county_fertility + min = 20 + multiply = 150 + } + } + } + } + + # If the faction still exists, dissolve it (it's no longer relevant). + hidden_effect = { + if = { + limit = { + exists = scope:nomadic_faction + } + scope:nomadic_faction = { + destroy_faction = yes + } + } + } + } + show_as_tooltip = { + $FACTION_LEADER$ = { + save_scope_as = tooltip_leader + custom_tooltip = nomads_take_everything_tt + } + create_title_and_vassal_change = { + type = conquest_populist + save_scope_as = change + add_claim_on_loss = yes + } + every_in_list = { + list = siezed_duchies + change_title_holder = { + holder = $FACTION_LEADER$ + change = scope:change + take_baronies = no + } + } + every_in_list = { + list = siezed_counties + change_title_holder = { + holder = $FACTION_LEADER$ + change = scope:change + take_baronies = no + } + } + resolve_title_and_vassal_change = scope:change + } +} + +spawn_popular_revolt_troops = { + # Spawn Levies + spawn_army = { + levies = { + value = 0 + joined_faction = { + every_faction_county_member = { + limit = { + duchy = scope:local_center_of_rebellion.duchy + } + add = county_levies_to_raise + } + } + } + location = scope:local_center_of_rebellion + war = root.faction_war + name = populist_faction_event_troops + } + + # Spawn MAAs - An appropriate amount of troops dependent on the terrain type they spawn in + if = { + limit = { + scope:local_center_of_rebellion = { + OR = { + terrain = forest + terrain = taiga + terrain = jungle + terrain = plains + terrain = drylands + terrain = oasis + terrain = desert + terrain = wetlands + terrain = steppe + } + } + } + spawn_army = { + men_at_arms = { + type = light_footmen + stacks = { + value = 0 + joined_faction = { + every_faction_county_member = { + limit = { + duchy = scope:local_center_of_rebellion.duchy + } + add = county_maa_to_raise + } + } + } + } + location = scope:local_center_of_rebellion + war = root.faction_war + name = populist_faction_event_troops + } + } + else_if = { + limit = { + scope:local_center_of_rebellion = { + OR = { + terrain = mountains + terrain = desert_mountains + } + } + } + spawn_army = { + men_at_arms = { + type = pikemen_unit + stacks = { + value = 0 + joined_faction = { + every_faction_county_member = { + limit = { + duchy = scope:local_center_of_rebellion.duchy + } + add = county_maa_to_raise + } + } + } + } + location = scope:local_center_of_rebellion + war = root.faction_war + name = populist_faction_event_troops + } + } + else_if = { + limit = { + scope:local_center_of_rebellion = { + OR = { + terrain = hills + terrain = farmlands + terrain = floodplains + } + } + } + spawn_army = { + men_at_arms = { + type = bowmen + stacks = { + value = 0 + joined_faction = { + every_faction_county_member = { + limit = { + duchy = scope:local_center_of_rebellion.duchy + } + add = county_maa_to_raise + } + } + } + } + location = scope:local_center_of_rebellion + war = root.faction_war + name = populist_faction_event_troops + } + } + + # Spawn Siege Weapons depending on discovered innovations + if = { + limit = { + culture = { has_innovation = innovation_gunpowder } + } + spawn_army = { + men_at_arms = { + type = bombard + stacks = 1 + } + location = scope:local_center_of_rebellion + war = root.faction_war + name = populist_faction_event_troops + } + } + else_if = { + limit = { + culture = { has_innovation = innovation_trebuchet } + } + spawn_army = { + men_at_arms = { + type = trebuchet + stacks = 1 + } + location = scope:local_center_of_rebellion + war = root.faction_war + name = populist_faction_event_troops + } + + } + else_if = { + limit = { + culture = { has_innovation = innovation_mangonel } + } + spawn_army = { + men_at_arms = { + type = mangonel + stacks = 1 + } + location = scope:local_center_of_rebellion + war = root.faction_war + name = populist_faction_event_troops + } + } + else_if = { + limit = { + culture = { has_innovation = innovation_catapult } + } + spawn_army = { + men_at_arms = { + type = onager + stacks = 1 + } + location = scope:local_center_of_rebellion + war = root.faction_war + name = populist_faction_event_troops + } + } + + if = { + limit = { has_variable = ep3_governor_yearly_8150_ignored } + root.faction_leader = { + spawn_army = { + name = ep3_governor_yearly_8150_troop_name + men_at_arms = { + type = light_footmen + stacks = 2 + } + war = root.faction_war + location = scope:local_center_of_rebellion + origin = scope:local_center_of_rebellion + inheritable = no + } + } + remove_variable = ep3_governor_yearly_8150_ignored + } +} + +spawn_nomadic_revolt_troops = { + # Spawn Horde Riders + spawn_army = { + men_at_arms = { + type = nomadic_riders + men = { + value = 0 + joined_faction = { + every_faction_county_member = { + limit = { + duchy = scope:local_center_of_rebellion.duchy + } + add = county_horde_riders_to_raise + } + } + } + } + location = scope:local_center_of_rebellion + war = root.faction_war + name = nomadic_faction_event_troops + } + + spawn_army = { + men_at_arms = { + type = steppe_raiders + men = { + value = 0 + joined_faction = { + every_faction_county_member = { + limit = { + duchy = scope:local_center_of_rebellion.duchy + } + add = { + value = county_horde_riders_to_raise + divide = 2 + } + } + } + } + } + location = scope:local_center_of_rebellion + war = root.faction_war + name = nomadic_faction_event_troops + } + + spawn_army = { + men_at_arms = { + type = horse_archers + men = { + value = 0 + joined_faction = { + every_faction_county_member = { + limit = { + duchy = scope:local_center_of_rebellion.duchy + } + add = { + value = county_horde_riders_to_raise + divide = 2 + } + } + } + } + } + location = scope:local_center_of_rebellion + war = root.faction_war + name = nomadic_faction_event_troops + } + + # Spawn Siege Weapons depending on discovered innovations + if = { + limit = { + culture = { has_innovation = innovation_gunpowder } + } + spawn_army = { + men_at_arms = { + type = bombard + stacks = 1 + } + location = scope:local_center_of_rebellion + war = root.faction_war + name = populist_faction_event_troops + } + } + else_if = { + limit = { + culture = { has_innovation = innovation_trebuchet } + } + spawn_army = { + men_at_arms = { + type = trebuchet + stacks = 1 + } + location = scope:local_center_of_rebellion + war = root.faction_war + name = populist_faction_event_troops + } + + } + else_if = { + limit = { + culture = { has_innovation = innovation_mangonel } + } + spawn_army = { + men_at_arms = { + type = mangonel + stacks = 1 + } + location = scope:local_center_of_rebellion + war = root.faction_war + name = populist_faction_event_troops + } + } + else_if = { + limit = { + culture = { has_innovation = innovation_catapult } + } + spawn_army = { + men_at_arms = { + type = onager + stacks = 1 + } + location = scope:local_center_of_rebellion + war = root.faction_war + name = populist_faction_event_troops + } + } + else = { + spawn_army = { + men_at_arms = { + type = torch_bearers + stacks = 5 + } + location = scope:local_center_of_rebellion + war = root.faction_war + name = populist_faction_event_troops + } + } +} + +peasant_faction_demands_enforced = { + # escalate if in the Cycle + if = { + limit = { + NOT = { exists = scope:defender } + } + save_scope_as = defender + } + if = { + limit = { + scope:defender != scope:defender.top_liege + #only in Dynastic Cycle + scope:defender.top_liege.top_participant_group:dynastic_cycle ?= { + participant_group_type = hegemon_ruler + } + } + scope:defender.top_liege = { + set_variable = { + name = peasant_war_escalates + days = 365 + } + } + $FACTION$ = { + faction_leader = { + save_scope_as = attacker + add_character_flag = peasant_revolt_do_not_kill + set_variable = { + name = peasant_war_escalates + days = 365 + } + add_trait_xp = { + trait = peasant_leader + value = 20 + } + } + every_faction_county_member = { + add_to_list = faction_counties + add_county_modifier = { + modifier = peasant_war_lost_county_modifier + years = 10 + } + } + destroy_faction = yes + } + if = { + limit = { + NOT = { exists = scope:attacker } + } + scope:peasant_leader = { + save_scope_as = attacker + } + } + if = { + limit = { + scope:defender.top_liege = { + any_targeting_faction = { + faction_type = escalated_peasant_faction + save_temporary_scope_as = escalated_faction + } + } + } + scope:defender.top_liege = { + send_interface_message = { + type = msg_faction_grows + left_icon = scope:attacker + right_icon = scope:defender + every_in_list = { + list = faction_counties + title_join_faction = scope:escalated_faction + } + scope:attacker = { + join_faction_skip_check = scope:escalated_faction + } + } + } + } + else = { + scope:attacker = { + create_faction = { + type = escalated_peasant_faction + target = scope:defender.top_liege + } + } + scope:defender.top_liege = { + random_targeting_faction = { + faction_type = escalated_peasant_faction + save_scope_as = escalated_faction + set_special_character = scope:attacker + } + } + custom_tooltip = { + text = county_and_leader_join_faction_against_top_liege + if = { + limit = { + exists = scope:escalated_faction + } + every_in_list = { + list = faction_counties + limit = { + title_is_a_faction_member = no + } + title_join_faction = scope:escalated_faction + } + scope:attacker = { + set_variable = { + name = rebel_leader_peasants + value = scope:escalated_faction + } + join_faction_skip_check = scope:escalated_faction + primary_title = { + set_title_name_dynamic = peasant_leader_title_name + } + } + } + } + } + } + # otherwise finish the faction as usual + else = { + $FACTION$ = { + every_faction_county_member = { + custom = peasant_faction_every_county + change_county_control = peasant_war_victory_county_control_loss + add_county_modifier = { + modifier = peasant_war_lost_county_modifier + years = 10 + } + } + hidden_effect = { + clean_revolt_county_modifiers_from_faction_members_effect = yes + destroy_faction = yes + } + } + } +} + +invalidate_claimant_factions_on_death_effect = { + every_in_list = { + variable = claimant_factions + if = { + limit = { + exists = faction_war + } + faction_war = { + clear_claimant = yes + set_casus_belli = depose_war + } + faction_remove_war = yes # else the war gets invalidated when we destroy the faction + } + destroy_faction = yes + } + clear_variable_list = claimant_factions +} + +invalidate_ceremonial_claimant_factions_on_death_effect = { + every_in_list = { + variable = ceremonial_claimant_factions + if = { + limit = { + exists = faction_war + } + faction_war = { + clear_claimant = yes + set_casus_belli = depose_war + } + faction_remove_war = yes # else the war gets invalidated when we destroy the faction + } + destroy_faction = yes + } + clear_variable_list = ceremonial_claimant_factions +} + +setup_nomadic_leader_effect = { + save_scope_as = faction + + random_faction_county_member = { + save_scope_as = peasant_county + } + + # Create a leader for the nomadic faction. + create_character = { + location = scope:peasant_county.title_province + template = nomadic_faction_leader_template + faith = scope:peasant_county.faith + culture = scope:peasant_county.culture + gender_female_chance = { + if = { + limit = { scope:peasant_county.faith = { has_doctrine = doctrine_gender_male_dominated } } + add = 0 + } + else_if = { + limit = { scope:peasant_county.faith = { has_doctrine = doctrine_gender_female_dominated } } + add = 100 + } + else = { + add = 50 + } + } + save_scope_as = peasant_leader + } + scope:peasant_leader = { + add_character_flag = peasant_faction_random_peasant + } + + # Create a new title for the peasant. + create_dynamic_title = { + tier = duchy + name = FACTION_NOMADIC_REVOLT_TITLE_NAME + } + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + scope:new_title = { + set_capital_county = scope:peasant_county + set_landless_title = yes + set_destroy_on_succession = yes + set_delete_on_destroy = yes + set_no_automatic_claims = yes + set_definitive_form = yes + set_can_be_named_after_dynasty = no + change_title_holder = { + holder = scope:peasant_leader + change = scope:change + } + set_variable = { + name = faction + value = scope:faction + } + } + resolve_title_and_vassal_change = scope:change + scope:peasant_leader = { + set_variable = { + name = peasant_title + value = scope:new_title + } + if = { + limit = { + is_ruler = yes + NOT = { + government_has_flag = government_is_nomadic + } + } + change_government = nomad_government + } + } + scope:new_title = { generate_coa = factions } + + # Set the peasant leader as the head of the faction. + scope:peasant_leader = { + set_variable = { + name = rebel_leader_peasants + value = scope:faction + } + join_faction_skip_check = scope:faction + } + set_special_character = scope:peasant_leader +} + +setup_populist_leader_effect = { + save_scope_as = faction + + random_faction_county_member = { + save_scope_as = peasant_county + } + + # Runs the scripted effect to find the best title to target for the rebellion. + get_popular_revolt_target_effect = { FACTION = this } + + # Find or create a leader for the populist faction. + scope:target_title = { + # Look to see if there are any displaced characters who are legitimate claimants to the target title that the populists might support. + random_claimant = { + limit = { + # Checks the 'is_character_valid' and 'can_character_join' triggers above, plus the faction hard/soft blocks in 00_rules.txt + can_join_faction = scope:faction + can_join_or_create_faction_against = scope:faction.faction_target + + # Must share a faith & culture with the revolting county. + faith = scope:peasant_county.faith + culture = scope:peasant_county.culture + + # Must be allowed to rule in their faith. + trigger_if = { + limit = { + faith = { has_doctrine = doctrine_gender_male_dominated } + } + is_male = yes + } + trigger_else_if = { + limit = { + faith = { has_doctrine = doctrine_gender_female_dominated } + } + is_female = yes + } + trigger_else = { + always = yes + } + + # Must not already be a landed ruler, or set to inheirit a landed title. + AND = { + is_ruler = no + is_playable_character = no + NOT = { + any_heir_title = { + exists = this + } + } + } + } + + save_scope_as = peasant_leader + add_character_flag = peasant_faction_claimant_without_title + add_trait = populist_leader + } + } + if = { + limit = { + NOT = { exists = scope:peasant_leader } + exists = special_character + } + special_character = { + save_scope_as = peasant_leader + } + } + # If we can't find any, then generate a new character to be the populist leader of the revolt. + else = { + create_character = { + location = scope:peasant_county.title_province + template = populist_faction_leader_template + faith = scope:peasant_county.faith + culture = scope:peasant_county.culture + gender_female_chance = { + if = { + limit = { scope:peasant_county.faith = { has_doctrine = doctrine_gender_male_dominated } } + add = 0 + } + else_if = { + limit = { scope:peasant_county.faith = { has_doctrine = doctrine_gender_female_dominated } } + add = 100 + } + else = { + add = 50 + } + } + trait = populist_leader + save_scope_as = peasant_leader + } + scope:peasant_leader = { + add_character_flag = peasant_faction_random_peasant + } + } + if = { + limit = { + NOT = { exists = scope:peasant_leader.primary_title } + } + # Create a new title for the peasant. + create_dynamic_title = { + tier = duchy + name = FACTION_POPULIST_REVOLT_TITLE_NAME + } + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + scope:new_title = { + set_capital_county = scope:peasant_county + set_landless_title = yes + set_destroy_on_succession = yes + set_delete_on_destroy = yes + set_no_automatic_claims = yes + set_definitive_form = yes + set_can_be_named_after_dynasty = no + set_can_use_nomadic_naming = no + change_title_holder = { + holder = scope:peasant_leader + change = scope:change + } + set_variable = { + name = faction + value = scope:faction + } + } + resolve_title_and_vassal_change = scope:change + scope:peasant_leader = { + set_variable = { + name = peasant_title + value = scope:new_title + } + } + scope:new_title = { generate_coa = factions } + + # Set the peasant leader as the head of the faction. + scope:peasant_leader = { + set_variable = { + name = rebel_leader_peasants + value = scope:faction + } + join_faction_skip_check = scope:faction + } + set_special_character = scope:peasant_leader + } +} + +setup_peasant_leader_effect = { + save_scope_as = faction + # Does a peasant capital county already exist? + if = { + limit = { + NOT = { exists = scope:peasant_county } + } + random_faction_county_member = { save_scope_as = peasant_county } + } + # Does a peasant leader already exist? + if = { + limit = { + NOT = { exists = scope:peasant_leader } + } + create_character = { + location = scope:peasant_county.title_province + template = peasant_faction_leader_template + faith = scope:peasant_county.faith + culture = scope:peasant_county.culture + gender_female_chance = { + if = { + limit = { scope:peasant_county.faith = { has_doctrine = doctrine_gender_male_dominated } } + add = 0 + } + else_if = { + limit = { scope:peasant_county.faith = { has_doctrine = doctrine_gender_female_dominated } } + add = 100 + } + else = { + add = 50 + } + } + save_scope_as = peasant_leader + } + } + scope:peasant_leader = { + add_character_flag = peasant_faction_random_peasant + } + + + create_dynamic_title = { + tier = duchy + name = FACTION_PEASANT_TITLE_NAME + } + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + + scope:new_title = { + set_capital_county = scope:peasant_county + set_landless_title = yes + set_destroy_on_succession = yes + set_delete_on_destroy = yes + set_no_automatic_claims = yes + set_definitive_form = yes + set_can_be_named_after_dynasty = no + set_can_use_nomadic_naming = no + change_title_holder = { + holder = scope:peasant_leader + change = scope:change + } + + set_variable = { + name = faction + value = scope:faction + } + + # avoid unused variable error. This variable is referenced in code + var:faction = {} + } + resolve_title_and_vassal_change = scope:change + scope:peasant_leader = { + set_variable = { + name = peasant_title + value = scope:new_title + } + } + scope:new_title = { generate_coa = factions } + + scope:peasant_leader = { + set_variable = { + name = rebel_leader_peasants + value = scope:faction + } + join_faction_skip_check = scope:faction + add_trait_xp = { + trait = peasant_leader + value = peasant_leader_xp_value + } + } + + set_special_character = scope:peasant_leader +} + +faction_spawn_member_county_armies_effect = { + every_faction_county_member = { + custom = peasant_faction_every_county + hidden_effect = { + save_scope_as = county + title_province = { + save_scope_as = county_location + } + } + + # Reduce county control in faction member counties + change_county_control = peasant_war_starts_county_control_loss + + # Spawn an army in each faction member county + custom_tooltip = peasant_faction_spawn_county_levies + hidden_effect = { + $ARMY_OWNER$ = { + spawn_army = { + levies = scope:county.county_levies_to_raise + location = scope:county_location + war = $FACTION$.faction_war + name = $PEASANT_ARMY_NAME$ + } + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_feast_scripted_effects.txt b/N3OW/common/scripted_effects/00_feast_scripted_effects.txt new file mode 100644 index 00000000..439bdecf --- /dev/null +++ b/N3OW/common/scripted_effects/00_feast_scripted_effects.txt @@ -0,0 +1,247 @@ + +#Effects used in Feasts + +#feast_end_guest_effect - Effect run for all guests when they leave feasts + +feast_fire_correct_default_event_effect = { + if = { + limit = { + this = scope:activity.activity_host + } + trigger_event = { + on_action = feast_default_host_event_selection + days = { min_feast_event_spacing max_feast_event_spacing } + } + } + else = { + trigger_event = { + on_action = feast_default_event_selection + days = { min_feast_event_spacing max_feast_event_spacing } + } + } +} + +feast_end_guest_effect = { + # Only called on the end of a *successful* feast. Feasts which are interrupted due to death, imprisonment, etc., don't get this, so put critical clean-up stuff in the activity itself. + reveler_lifestyle_rank_up_check_effect = yes + stress_impact = { + base = medium_stress_loss + gluttonous = medium_stress_impact_loss + gregarious = medium_stress_impact_loss + shy = medium_stress_impact_gain + } +} + +add_hosted_feast_modifier_towards_character = { + if = { + limit = { + $CHARACTER$ = { + employs_court_position = court_musician_court_position + any_court_position_holder = { + type = court_musician_court_position + is_physically_able = yes + } + } + } + if = { + limit = { # Increase the bonus slightly if musician's culture has Musicical Theorists + $CHARACTER$ = { + any_court_position_holder = { + type = court_musician_court_position + culture = { has_cultural_parameter = characters_are_better_court_musicians } + } + } + } + add_opinion = { + target = $CHARACTER$ + modifier = feast_hosted_successful_feast_with_music + opinion = 35 + } + } + else = { + add_opinion = { + target = $CHARACTER$ + modifier = feast_hosted_successful_feast_with_music + } + } + } + else = { + add_opinion = { + target = $CHARACTER$ + modifier = feast_hosted_successful_feast + } + } +} +# Deprecated. +hosted_successful_feast_effect = { + if = { + limit = { + culture = { + has_cultural_parameter = renown_from_feasts + } + exists = dynasty + } + dynasty = { + add_dynasty_prestige = minor_dynasty_prestige_value + } + } + scope:activity = { + every_attending_character = { + limit = { this != root } + custom = every_guest_scope_tt + add_hosted_feast_modifier_towards_character = { CHARACTER = root } + } + } + reveler_lifestyle_rank_up_check_effect = yes + hidden_effect = { + if = { + limit = { exists = scope:spouse } + add_opinion = { #Your opinion of your Spouse increases, considering they did most of the work + target = scope:spouse + modifier = feast_spouse_hosted_successful_feast_opinion + } + } + } +} + +hosted_successful_feast_new_effect = { + # Renown gain from Tradition. + if = { + limit = { + culture = { has_cultural_parameter = renown_from_feasts } + } + dynasty ?= { add_dynasty_prestige = minor_dynasty_prestige_value } + } + # Piety gain from Tenets. + if = { + limit = { + faith = { + OR = { + has_doctrine_parameter = piety_from_feasts_active + AND = { + has_doctrine_parameter = summer_festivals_active + # Only during 'summer' (May 1st through July 31st). + current_month >= 5 + current_month <= 7 + } + } + } + } + add_piety = { + value = 0 + + if = { + limit = { + faith = { has_doctrine_parameter = summer_festivals_active } + # Only during 'summer' (May 1st through July 31st). + current_month >= 5 + current_month <= 7 + } + add = major_piety_value + } + if = { + limit = { + faith = { has_doctrine = tenet_ritual_celebrations } + } + add = medium_piety_value + } + if = { + limit = { + faith = { has_doctrine = tenet_hedonistic } + } + add = medium_piety_value + } + if = { + limit = { + has_royal_court = yes + has_dlc_feature = royal_court + amenity_level = { target = court_food_quality value >= 5 } + } + multiply = 2.5 + } + else_if = { + limit = { + has_royal_court = yes + has_dlc_feature = royal_court + amenity_level = { target = court_food_quality value >= 4 } + } + multiply = 2 + } + else_if = { + limit = { + has_royal_court = yes + has_dlc_feature = royal_court + amenity_level = { target = court_food_quality value >= 3 } + } + multiply = 1.5 + } + else_if = { + limit = { + has_royal_court = yes + has_dlc_feature = royal_court + amenity_level = { target = court_food_quality value >= 2 } + } + multiply = 1 + } + else_if = { + limit = { + has_royal_court = yes + has_dlc_feature = royal_court + amenity_level = { target = court_food_quality value <= 1 } + } + multiply = 0.5 + } + + # Always give some piety, even if you completely cheaped out. + min = medium_piety_value + } + } + # County development + scope:activity_location.county = { + add_county_modifier = { + modifier = feast_recent_fest_modifier + years = 5 + } + } + # Opinion with spouse (various other opinions handled elsewhere). + hidden_effect = { + if = { + limit = { exists = scope:spouse } + add_opinion = { #Your opinion of your Spouse increases, considering they did most of the work + target = scope:spouse + modifier = feast_spouse_hosted_successful_feast_opinion + } + } + } + + # tgp_ceremonial_liege_events.0020 + if = { + limit = { + var:tgp_ceremonial_liege_events_0020_discount ?= flag:feast + } + tgp_one_up_activity_effect = yes + } +} + +hosted_successful_feast_interrupted_effect = { + add_prestige = medium_prestige_gain + scope:activity = { + every_attending_character = { + limit = { + this != scope:host + } + custom = every_guest_scope_tt + add_hosted_feast_modifier_towards_character = { CHARACTER = scope:host } + } + } + reveler_lifestyle_rank_up_check_effect = yes + hidden_effect = { + if = { + limit = { exists = scope:spouse } + add_opinion = { #Your opinion of your Spouse increases, considering they did most of the work + target = scope:spouse + modifier = feast_spouse_hosted_successful_feast_opinion + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_flavorization_effects.txt b/N3OW/common/scripted_effects/00_flavorization_effects.txt new file mode 100644 index 00000000..c76c21f7 --- /dev/null +++ b/N3OW/common/scripted_effects/00_flavorization_effects.txt @@ -0,0 +1,250 @@ +additional_flavor_check_effect = { + if = { + limit = { + is_alive = yes + } + if = { # March / Margrave + limit = { + OR = { + AND = { + vassal_contract_has_flag = has_march_contract + highest_held_title_tier = tier_duchy + } + primary_title ?= { + has_variable = margrave_flag + } + } + } + add_character_flag = margrave_flag + } + else_if = { + limit = { + has_character_flag = margrave_flag + } + remove_character_flag = margrave_flag + } + if = { + limit = { + primary_title ?= title:e_hindustan + } + add_character_flag = e_hindustan + } + else_if = { + limit = { + has_character_flag = e_hindustan + } + remove_character_flag = e_hindustan + } + if = { # Palatinate (Duchy Tier) + limit = { + OR = { + AND = { + vassal_contract_has_flag = has_palatinate_contract + highest_held_title_tier = tier_duchy + } + primary_title ?= { + has_variable = duchy_palatinate_flag + } + } + } + add_character_flag = duchy_palatinate_flag + } + else_if = { + limit = { + has_character_flag = duchy_palatinate_flag + } + remove_character_flag = duchy_palatinate_flag + } + if = { # Palatinate (County Tier) + limit = { + OR = { + AND = { + vassal_contract_has_flag = has_palatinate_contract + highest_held_title_tier = tier_county + } + primary_title ?= { + has_variable = county_palatinate_flag + } + } + } + add_character_flag = county_palatinate_flag + } + else_if = { + limit = { + has_character_flag = county_palatinate_flag + } + remove_character_flag = county_palatinate_flag + } + if = { # Castellan / Burgrave + limit = { + OR = { + AND = { + vassal_contract_has_flag = has_castellan_contract + highest_held_title_tier = tier_county + } + primary_title ?= { + has_variable = castellan_flag + } + } + } + add_character_flag = castellan_flag + } + else_if = { + limit = { + has_character_flag = castellan_flag + } + remove_character_flag = castellan_flag + } + if = { # Tenno + limit = { + primary_title ?= { has_variable = ceremonial_liege_flag } + } + add_character_flag = ceremonial_liege_flag + } + else_if = { + limit = { + has_character_flag = ceremonial_liege_flag + } + remove_character_flag = ceremonial_liege_flag + } + } +} + +additional_flavor_check_death_effect = { + if = { + limit = { + OR = { + has_character_flag = margrave_flag + vassal_contract_has_flag = has_march_contract + } + highest_held_title_tier = tier_duchy + } + primary_title ?= { + set_variable = { + name = margrave_flag + days = 1 + } + } + } + else_if = { + limit = { + OR = { + has_character_flag = duchy_palatinate_flag + vassal_contract_has_flag = has_palatinate_contract + } + highest_held_title_tier = tier_duchy + } + primary_title ?= { + set_variable = { + name = duchy_palatinate_flag + days = 1 + } + } + } + else_if = { + limit = { + OR = { + has_character_flag = county_palatinate_flag + vassal_contract_has_flag = has_palatinate_contract + } + highest_held_title_tier = tier_county + } + primary_title ?= { + set_variable = { + name = county_palatinate_flag + days = 1 + } + } + } + else_if = { + limit = { + OR = { + has_character_flag = castellan_flag + vassal_contract_has_flag = has_castellan_contract + } + highest_held_title_tier = tier_county + } + primary_title ?= { + set_variable = { + name = castellan_flag + days = 1 + } + } + } + else_if = { + limit = { + has_character_flag = ceremonial_liege_flag + highest_held_title_tier = tier_kingdom + } + primary_title ?= { + set_variable = { + name = ceremonial_liege_flag + days = 1 + } + } + } +} + +hre_margraves_effect = { + if = { + limit = { + game_start_date = 1066.9.15 + } + title:e_hre.holder = { + every_vassal = { + limit = { + primary_title = { + OR = { + this = title:d_steyermark + this = title:d_osterreich + this = title:d_lausitz + this = title:d_meissen + this = title:d_nordgau + } + } + } + primary_title = { + set_variable = { + name = historical_margrave + days = 1 + } + } + vassal_contract_set_obligation_level = { + type = special_contract + level = 2 + } + additional_flavor_check_effect = yes + } + } + } + else_if = { + limit = { + game_start_date = 1178.10.1 + } + title:e_hre.holder = { + every_vassal = { + limit = { + primary_title = { + OR = { + this = title:d_steyermark + this = title:d_lausitz + this = title:d_ostmark + this = title:d_meissen + } + } + } + primary_title = { + set_variable = { + name = historical_margrave + days = 1 + } + } + vassal_contract_set_obligation_level = { + type = special_contract + level = 2 + } + additional_flavor_check_effect = yes + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_funeral_scripted_effects.txt b/N3OW/common/scripted_effects/00_funeral_scripted_effects.txt new file mode 100644 index 00000000..d96d6fd2 --- /dev/null +++ b/N3OW/common/scripted_effects/00_funeral_scripted_effects.txt @@ -0,0 +1,86 @@ +#Effects used in Funerals + +#funeral_add_funeral_targets_to_list - Effect fills target list with available funeral target characters + +funeral_add_funeral_targets_to_list = { + clear_variable_list = $LIST_NAME$ + save_scope_as = list_scope + + primary_title ?= { + every_past_holder = { + limit = { + body_is_available = yes + } + scope:list_scope = { + add_to_variable_list = { + name = $LIST_NAME$ + target = prev + } + } + } + } + every_close_or_extended_family_member = { + even_if_dead = yes + limit = { + body_is_available = yes + } + scope:list_scope = { + add_to_variable_list = { + name = $LIST_NAME$ + target = prev + } + } + } + every_spouse = { + even_if_dead = yes + limit = { + body_is_available = yes + } + scope:list_scope = { + add_to_variable_list = { + name = $LIST_NAME$ + target = prev + } + } + } + every_memory = { + limit = { + OR = { + has_memory_type = friend_died + has_memory_type = lover_died + has_memory_type = soulmate_died + } + trigger_if = { + limit = { exists = memory_participant:dead_relation } + memory_participant:dead_relation = { body_is_available = yes } + } + trigger_else = { always = no } + } + memory_participant:dead_relation = { + scope:list_scope = { + add_to_variable_list = { + name = $LIST_NAME$ + target = prev + } + } + } + } + + + # ACH dead officiator + + if = { + limit = { + var:dead_officiator_funeral ?= { + body_is_available = yes + } + } + scope:list_scope = { + add_to_variable_list = { + name = $LIST_NAME$ + target = var:dead_officiator_funeral + } + } + } + +} diff --git a/N3OW/common/scripted_effects/00_game_rule_effects.txt b/N3OW/common/scripted_effects/00_game_rule_effects.txt new file mode 100644 index 00000000..43e4d03e --- /dev/null +++ b/N3OW/common/scripted_effects/00_game_rule_effects.txt @@ -0,0 +1,3198 @@ +###################### +# GENERATED FAMILIES # +###################### + +game_rule_create_spouse_and_children = { + $CHARACTER$ = { + #If not married, create spouse + if = { + limit = { + is_married = no + } + create_character = { + location = $LOCATION$.location + culture = $CHARACTER$.culture + faith = $CHARACTER$.faith + gender_female_chance = $CHARACTER$.marriage_gender_adjusted_female_chance + age = $CHARACTER$.age + save_scope_as = spouse + } + + if = { + limit = { is_male = yes } + marry = scope:spouse + } + else = { + marry_matrilineal = scope:spouse + } + if = { + limit = { + has_trait = nomadic_philosophy + } + scope:spouse = { + add_trait = nomadic_philosophy + } + } + if = { + limit = { + NOT = { exists = scope:spouse.employer } + $LOCATION$ = { is_ruler = yes } + } + $LOCATION$ = { add_courtier = scope:spouse } + } + } + else = { + primary_spouse = { save_scope_as = spouse } + } + + if = { + limit = { is_male = yes } + save_scope_as = father + scope:spouse = { + if = { + limit = { + is_female = yes + } + save_scope_as = mother + } + } + } + else = { + save_scope_as = mother + scope:spouse = { + if = { + limit = { + is_male = yes + } + save_scope_as = father + } + } + } + + #Create child 1 (mother age 17+) + if = { + limit = { + exists = scope:mother + scope:mother.age >= 17 + } + if = { #Do we have a father saved? + limit = { + exists = scope:father + } + create_character = { + location = $LOCATION$.location + culture = $CHARACTER$.culture + faith = $CHARACTER$.faith + gender_female_chance = { + if = { + limit = { + is_ruler = yes + $CHARACTER$ = { has_realm_law = male_only_law } + } + value = 0 + } + else_if = { + limit = { + is_ruler = yes + $CHARACTER$ = { has_realm_law = female_only_law } + } + value = 100 + } + else = { + value = 50 + } + } + age = { + value = scope:mother.age + subtract = 17 + } + father = scope:father + mother = scope:mother + dynasty = inherit + save_scope_as = child_1 + } + } + else = { #If we don't have a father we generate a child without + create_character = { + location = $LOCATION$.location + culture = $CHARACTER$.culture + faith = $CHARACTER$.faith + gender_female_chance = { + if = { + limit = { + is_ruler = yes + $CHARACTER$ = { has_realm_law = male_only_law } + } + value = 0 + } + else_if = { + limit = { + is_ruler = yes + $CHARACTER$ = { has_realm_law = female_only_law } + } + value = 100 + } + else = { + value = 50 + } + } + age = { + value = scope:mother.age + subtract = 17 + } + mother = scope:mother + dynasty = inherit + save_scope_as = child_1 + } + } + } + #Create child 1 (no mother) + else_if = { + limit = { + NOT = { exists = scope:mother } + } + create_character = { + location = $LOCATION$.location + culture = $CHARACTER$.culture + faith = $CHARACTER$.faith + gender_female_chance = { + if = { + limit = { + is_ruler = yes + $CHARACTER$ = { has_realm_law = male_only_law } + } + value = 0 + } + else_if = { + limit = { + is_ruler = yes + $CHARACTER$ = { has_realm_law = female_only_law } + } + value = 100 + } + else = { + value = 50 + } + } + age = { + value = scope:mother.age + subtract = 17 + } + father = scope:father + dynasty = inherit + save_scope_as = child_1 + } + } + + #Create child 2 (mother age 25+) + if = { + limit = { + exists = scope:mother + scope:mother.age >= 25 + } + + if = { #Do we have a father saved? + limit = { + exists = scope:father + } + create_character = { + location = $LOCATION$.location + culture = $CHARACTER$.culture + faith = $CHARACTER$.faith + gender_female_chance = { + value = 50 + } + age = { + value = scope:mother.age + subtract = 25 + } + father = scope:father + mother = scope:mother + dynasty = inherit + save_scope_as = child_2 + } + } + else = { #If we don't have a father we generate a child without + create_character = { + location = $LOCATION$.location + culture = $CHARACTER$.culture + faith = $CHARACTER$.faith + gender_female_chance = { + value = 50 + } + age = { + value = scope:mother.age + subtract = 25 + } + mother = scope:mother + dynasty = inherit + save_scope_as = child_2 + } + } + } + + #Create child 3 (mother age 33+) + if = { + limit = { + exists = scope:mother + scope:mother.age >= 33 + } + + if = { #Do we have a father saved? + limit = { + exists = scope:father + } + create_character = { + location = $LOCATION$.location + culture = $CHARACTER$.culture + faith = $CHARACTER$.faith + gender_female_chance = { + value = 50 + } + age = { + value = scope:mother.age + subtract = 33 + } + father = scope:father + mother = scope:mother + dynasty = inherit + save_scope_as = child_3 + } + } + else = { #If we don't have a father we generate a child without + create_character = { + location = $LOCATION$.location + culture = $CHARACTER$.culture + faith = $CHARACTER$.faith + gender_female_chance = { + value = 50 + } + age = { + value = scope:mother.age + subtract = 33 + } + mother = scope:mother + dynasty = inherit + save_scope_as = child_3 + } + } + } + + if = { + limit = { + exists = scope:child_1 + NOT = { exists = scope:child_1.employer } + $LOCATION$ = { is_ruler = yes } + } + $LOCATION$ = { add_courtier = scope:child_1 } + } + if = { + limit = { + exists = scope:child_2 + NOT = { exists = scope:child_2.employer } + $LOCATION$ = { is_ruler = yes } + } + $LOCATION$ = { add_courtier = scope:child_2 } + } + if = { + limit = { + exists = scope:child_3 + NOT = { exists = scope:child_3.employer } + $LOCATION$ = { is_ruler = yes } + } + $LOCATION$ = { add_courtier = scope:child_3 } + } + if = { + limit = { + has_trait = nomadic_philosophy + } + scope:child_1 ?= { + if = { + limit = { + NOT = { has_trait = nomadic_philosophy } + } + add_trait = nomadic_philosophy + } + } + scope:child_2 ?= { + if = { + limit = { + NOT = { has_trait = nomadic_philosophy } + } + add_trait = nomadic_philosophy + } + } + scope:child_3 ?= { + if = { + limit = { + NOT = { has_trait = nomadic_philosophy } + } + add_trait = nomadic_philosophy + } + } + } + } +} + + +################### +# GENDER EQUALITY # +################### + +#Full equality +game_rule_full_gender_equality_effect = { + every_religion_global = { + every_faith = { + ## DOCTRINE_GENDER + if = { + limit = { has_doctrine = doctrine_gender_male_dominated } + remove_doctrine = doctrine_gender_male_dominated + } + else_if = { + limit = { has_doctrine = doctrine_gender_female_dominated } + remove_doctrine = doctrine_gender_female_dominated + } + + if = { + limit = { NOT = { has_doctrine = doctrine_gender_equal } } + add_doctrine = doctrine_gender_equal + } + + ## DOCTRINE_CLERICAL_GENDER + if = { + limit = { has_doctrine = doctrine_clerical_gender_male_only } + remove_doctrine = doctrine_clerical_gender_male_only + } + else_if = { + limit = { has_doctrine = doctrine_clerical_gender_female_only } + remove_doctrine = doctrine_clerical_gender_female_only + } + + if = { + limit = { NOT = { has_doctrine = doctrine_clerical_gender_either } } + add_doctrine = doctrine_clerical_gender_either + } + + + ## DOCTRINE_ADULTERY_MEN & DOCTRINE_ADULTERY_WOMEN + #Makes the adultery doctrine same for both genders (picks lesser version) + + #Any of them accepted? Both should be accepted + if = { + limit = { + OR = { + has_doctrine = doctrine_adultery_men_accepted + has_doctrine = doctrine_adultery_women_accepted + } + } + + #Is male wrong? + if = { + limit = { NOT = { has_doctrine = doctrine_adultery_men_accepted } } + + if = { + limit = { has_doctrine = doctrine_adultery_men_crime } + remove_doctrine = doctrine_adultery_men_crime + } + else_if = { + limit = { has_doctrine = doctrine_adultery_men_shunned } + remove_doctrine = doctrine_adultery_men_shunned + } + add_doctrine = doctrine_adultery_men_accepted + } + + #Is female wrong? + if = { + limit = { NOT = { has_doctrine = doctrine_adultery_women_accepted } } + + if = { + limit = { has_doctrine = doctrine_adultery_women_crime } + remove_doctrine = doctrine_adultery_women_crime + } + else_if = { + limit = { has_doctrine = doctrine_adultery_women_shunned } + remove_doctrine = doctrine_adultery_women_shunned + } + add_doctrine = doctrine_adultery_women_accepted + } + } + ##Any of them shunned? Both should be shunned + else_if = { + limit = { + OR = { + has_doctrine = doctrine_adultery_men_shunned + has_doctrine = doctrine_adultery_women_shunned + } + } + + #Is male wrong? + if = { + limit = { NOT = { has_doctrine = doctrine_adultery_men_shunned } } + remove_doctrine = doctrine_adultery_men_crime + add_doctrine = doctrine_adultery_men_shunned + } + + #Is female wrong? + if = { + limit = { NOT = { has_doctrine = doctrine_adultery_women_shunned } } + remove_doctrine = doctrine_adultery_women_crime + add_doctrine = doctrine_adultery_women_shunned + } + } + ##Else: they're both criminal, nothing to do here + } + } + + ## REALM LAW + every_ruler = { + if = { + limit = { + OR = { + has_realm_law = male_preference_law + has_realm_law = female_preference_law + has_realm_law = female_only_law + has_realm_law = male_only_law + } + } + add_realm_law = equal_law + } + } + + ## CULTURES - MARTIAL CUSTOM + every_culture_global = { + if = { + limit = { + OR = { + has_cultural_pillar = martial_custom_male_only + has_cultural_pillar = martial_custom_female_only + } + } + set_culture_pillar = martial_custom_equal + } + } + + #Specific titles' law +} + + + +game_rule_inversed_gender_equality_effect = { + every_religion_global = { + every_faith = { + + ## DOCTRINE_GENDER + if = { + limit = { has_doctrine = doctrine_gender_male_dominated } + remove_doctrine = doctrine_gender_male_dominated + add_doctrine = doctrine_gender_female_dominated + } + else_if = { + limit = { has_doctrine = doctrine_gender_female_dominated } + remove_doctrine = doctrine_gender_female_dominated + add_doctrine = doctrine_gender_male_dominated + } + #Else: equal, do nothing + + ## DOCTRINE_CLERICAL_GENDER + if = { + limit = { has_doctrine = doctrine_clerical_gender_male_only } + remove_doctrine = doctrine_clerical_gender_male_only + add_doctrine = doctrine_clerical_gender_female_only + } + else_if = { + limit = { has_doctrine = doctrine_clerical_gender_female_only } + remove_doctrine = doctrine_clerical_gender_female_only + add_doctrine = doctrine_clerical_gender_male_only + } + #Else: either, do nothing + + ## DOCTRINE_ADULTERY_MEN & DOCTRINE_ADULTERY_WOMEN + # Men and women swap doctrine + if = { + limit = { + NOR = { + AND = { + has_doctrine = doctrine_adultery_women_accepted + has_doctrine = doctrine_adultery_men_accepted + } + AND = { + has_doctrine = doctrine_adultery_women_shunned + has_doctrine = doctrine_adultery_men_shunned + } + AND = { + has_doctrine = doctrine_adultery_women_crime + has_doctrine = doctrine_adultery_men_crime + } + } + } + # Save women's doctrine + if = { + limit = { has_doctrine = doctrine_adultery_women_accepted } + save_scope_value_as = { + name = doctrine_adultery_women + value = flag:doctrine_adultery_women_accepted + } + } + else_if = { + limit = { has_doctrine = doctrine_adultery_women_shunned } + save_scope_value_as = { + name = doctrine_adultery_women + value = flag:doctrine_adultery_women_shunned + } + } + else_if = { + limit = { has_doctrine = doctrine_adultery_women_crime } + save_scope_value_as = { + name = doctrine_adultery_women + value = flag:doctrine_adultery_women_crime + } + } + + # Give women mens' doctrine + if = { + limit = { has_doctrine = doctrine_adultery_men_accepted } + if = { + limit = { has_doctrine = doctrine_adultery_women_shunned } + remove_doctrine = doctrine_adultery_women_shunned + } + else_if = { + limit = { has_doctrine = doctrine_adultery_women_crime } + remove_doctrine = doctrine_adultery_women_crime + } + add_doctrine = doctrine_adultery_women_accepted + } + else_if = { + limit = { has_doctrine = doctrine_adultery_men_shunned } + if = { + limit = { has_doctrine = doctrine_adultery_women_accepted } + remove_doctrine = doctrine_adultery_women_accepted + } + else_if = { + limit = { has_doctrine = doctrine_adultery_women_crime } + remove_doctrine = doctrine_adultery_women_crime + } + add_doctrine = doctrine_adultery_women_shunned + } + else_if = { + limit = { has_doctrine = doctrine_adultery_men_crime } + if = { + limit = { has_doctrine = doctrine_adultery_women_accepted } + remove_doctrine = doctrine_adultery_women_accepted + } + else_if = { + limit = { has_doctrine = doctrine_adultery_women_shunned } + remove_doctrine = doctrine_adultery_women_shunned + } + add_doctrine = doctrine_adultery_women_crime + } + + # Give men women' doctrine + if = { + limit = { scope:doctrine_adultery_women = flag:doctrine_adultery_women_accepted } + if = { + limit = { has_doctrine = doctrine_adultery_men_shunned } + remove_doctrine = doctrine_adultery_men_shunned + } + else_if = { + limit = { has_doctrine = doctrine_adultery_men_crime } + remove_doctrine = doctrine_adultery_men_crime + } + add_doctrine = doctrine_adultery_men_accepted + } + else_if = { + limit = { scope:doctrine_adultery_women = flag:doctrine_adultery_women_shunned } + if = { + limit = { has_doctrine = doctrine_adultery_men_accepted } + remove_doctrine = doctrine_adultery_men_accepted + } + else_if = { + limit = { has_doctrine = doctrine_adultery_men_crime } + remove_doctrine = doctrine_adultery_men_crime + } + add_doctrine = doctrine_adultery_men_shunned + } + else_if = { + limit = { scope:doctrine_adultery_women = flag:doctrine_adultery_women_crime } + if = { + limit = { has_doctrine = doctrine_adultery_men_accepted } + remove_doctrine = doctrine_adultery_men_accepted + } + else_if = { + limit = { has_doctrine = doctrine_adultery_men_shunned } + remove_doctrine = doctrine_adultery_men_shunned + } + add_doctrine = doctrine_adultery_men_crime + } + } + } + } + + ## REALM LAW + every_ruler = { + # Take care of any titles with their own title laws. + every_held_title = { + limit = { can_title_have_law_general_trigger = yes } + # Invert male-only. + if = { + limit = { has_title_law = male_only_law } + remove_title_law = male_only_law + add_title_law = female_only_law + } + # Invert female-only. + else_if = { + limit = { has_title_law = female_only_law } + remove_title_law = female_only_law + add_title_law = male_only_law + } + } + # Now realm law. + if = { + limit = { has_realm_law = male_only_law } + add_realm_law = female_only_law + if = { + limit = { + highest_held_title_tier >= tier_county + is_male = yes + is_ai = yes + any_heir = { is_female = yes } + } + depose = yes + } + } + else_if = { + limit = { has_realm_law = male_preference_law } + add_realm_law = female_preference_law + if = { + limit = { + highest_held_title_tier >= tier_county + is_male = yes + is_ai = yes + any_heir = { is_female = yes } + } + depose = yes + } + } + else_if = { + limit = { has_realm_law = female_preference_law } + add_realm_law = male_preference_law + if = { + limit = { + highest_held_title_tier >= tier_county + is_female = yes + is_ai = yes + any_heir = { is_male = yes } + } + depose = yes + } + } + else_if = { + limit = { has_realm_law = female_only_law } + add_realm_law = male_only_law + if = { + limit = { + highest_held_title_tier >= tier_county + is_female = yes + is_ai = yes + any_heir = { is_male = yes } + } + depose = yes + } + } + #Else: equal, nothing changes + } + + # We handle religious titles here because title law overlaps with faith law in weird ways otherwise. + ## Take care of first-generation HoFs. + every_religion_global = { + every_faith = { + if = { + limit = { + has_doctrine = doctrine_clerical_gender_male_only + religious_head ?= { is_female = yes } + } + religious_head = { depose = yes } + } + else_if = { + limit = { + has_doctrine = doctrine_clerical_gender_female_only + religious_head ?= { is_male = yes } + } + religious_head = { depose = yes } + } + } + } + + ## CULTURES - MARTIAL CUSTOM + every_culture_global = { + if = { + limit = { has_cultural_pillar = martial_custom_male_only } + set_culture_pillar = martial_custom_female_only + } + else_if = { + limit = { has_cultural_pillar = martial_custom_female_only } + set_culture_pillar = martial_custom_male_only + } + } +} + +game_rule_accepted_same_sex_relations_effect = { + every_religion_global = { + every_faith = { + if = { + limit = { has_doctrine = doctrine_homosexuality_crime } + remove_doctrine = doctrine_homosexuality_crime + } + else_if = { + limit = { has_doctrine = doctrine_homosexuality_shunned } + remove_doctrine = doctrine_homosexuality_shunned + } + + if = { + limit = { NOT = { has_doctrine = doctrine_homosexuality_accepted } } + add_doctrine = doctrine_homosexuality_accepted + } + #Else: equal, do nothing + } + } +} + +game_rule_lenient_gender_equality_effect = { + ## REALM LAW + every_ruler = { + # Take care of any titles with their own title laws. + every_held_title = { + limit = { can_title_have_law_general_trigger = yes } + # Make male only -> male preference. + if = { + limit = { has_title_law = male_only_law } + remove_title_law = male_only_law + add_title_law = male_preference_law + } + } + # Now realm law. + if = { + limit = { has_realm_law = male_only_law } + add_realm_law = male_preference_law + } + } +} + +########################## +# RANDOM RULER PLACEMENT # +########################## + +game_rule_random_ruler_placement_shuffle_list_effect = { + random_in_list = { + list = $LIST_NAME$ + save_scope_as = previous_ruler + remove_from_list = $LIST_NAME$ + } #First ruler will get stuff and not give away anything, lucky them + + while = { + limit = { + any_in_list = { + list = $LIST_NAME$ + NOT = { has_character_flag = already_swapped } + } + } + random_in_list = { + limit = { NOT = { has_character_flag = already_swapped } } + list = $LIST_NAME$ + + #Create change + create_title_and_vassal_change = { + type = conquest + save_scope_as = change + add_claim_on_loss = no + } + every_held_title = { + title_tier >= county + change_title_holder_include_vassals = { + holder = scope:previous_ruler + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + + #Convert if needed + if = { + limit = { has_game_rule = random_ruler_placement_on_conversion } + set_character_faith_with_conversion = scope:previous_ruler.faith + } + + #Saved to take titles next + blocked from being stolen from again + save_scope_as = previous_ruler + add_character_flag = { + flag = already_swapped + days = 3 + } + } + } +} + +game_rule_random_ruler_placement_effect = { + every_ruler = { + limit = { + save_temporary_scope_as = ruler_for_list + NOR = { + is_ai = no + any_liege_or_above = { + is_ai = no + dynasty = scope:ruler_for_list.dynasty + } + } + } + + if = { + limit = { highest_held_title_tier = tier_barony } + add_to_list = random_placement_barons + } + else_if = { + limit = { highest_held_title_tier = tier_county } + add_to_list = random_placement_counts + } + else_if = { + limit = { highest_held_title_tier = tier_duchy } + add_to_list = random_placement_dukes + } + else = { + add_to_list = random_placement_emperors_kings + } + } + + + ### BARONS SHUFFLE ### + game_rule_random_ruler_placement_shuffle_list_effect = { LIST_NAME = random_placement_barons } + + ### COUNTS SHUFFLE ### + game_rule_random_ruler_placement_shuffle_list_effect = { LIST_NAME = random_placement_counts } + + ### DUKES SHUFFLE ### + game_rule_random_ruler_placement_shuffle_list_effect = { LIST_NAME = random_placement_dukes } + + ### EMPERORS AND KINGS SHUFFLE ### + game_rule_random_ruler_placement_shuffle_list_effect = { LIST_NAME = random_placement_emperors_kings } + + ### MAKE EXCLAVES INDEPENDENT ### + every_ruler = { + limit = { + top_liege != this + save_temporary_scope_as = exclave_check + NOT = { + any_held_title = { + title_tier = county + any_neighboring_county = { + holder = { + NOR = { + this = scope:exclave_check + target_is_liege_or_above = scope:exclave_check + } + top_liege = scope:exclave_check.top_liege + } + } + } + } + } + + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = no + } + becomes_independent = { + change = scope:change + } + + resolve_title_and_vassal_change = scope:change + } +} + +#################### +# FAITH ACCEPTANCE # +#################### + +game_rule_randomize_faith_randomization_effect = { + if = { + limit = { + trigger_if = { + limit = { top_liege != this } + faith != liege.faith #We don't want to override faiths which "trickled down" via conversion effect + } + trigger_else = { + always = yes + } + } + + + + #Randomize faith + random_in_list = { + list = faiths_list + save_temporary_scope_as = randomized_faith + } + + #Covert all courtiers, guests, pool characters of same faith + if = { + limit = { + exists = capital_province + } + save_temporary_scope_as = this_ruler + every_pool_character = { + province = scope:this_ruler.capital_province + limit = { faith = scope:this_ruler.faith } + set_character_faith = scope:randomized_faith + } + } + every_courtier_or_guest = { + limit = { faith = prev.faith } + set_character_faith = scope:randomized_faith + } + + #Change faith with conversion for chance of trickling down to vassals + set_character_faith_with_conversion = scope:randomized_faith + + #Convert every held county + every_held_title = { + title_tier = county + set_county_faith = scope:randomized_faith + } + } +} + +game_rule_randomize_faith_effect = { + #Build faith list + every_religion_global = { + every_faith = { + add_to_list = faiths_list + } + } + + #Save all rulers in tiered lists + every_ruler = { + if = { + limit = { highest_held_title_tier = tier_barony } + add_to_list = random_faith_barony_list + } + else_if = { + limit = { highest_held_title_tier = tier_county } + add_to_list = random_faith_county_list + } + else_if = { + limit = { highest_held_title_tier = tier_duchy } + add_to_list = random_faith_duchy_list + } + else_if = { + limit = { highest_held_title_tier = tier_kingdom } + add_to_list = random_faith_kingdom_list + } + else_if = { + limit = { highest_held_title_tier = tier_empire } + add_to_list = random_faith_empire_list + } + } + + #Apply random faiths top-down (for conversion trickle down) + every_in_list = { + list = random_faith_empire_list + game_rule_randomize_faith_randomization_effect = yes + } + every_in_list = { + list = random_faith_kingdom_list + game_rule_randomize_faith_randomization_effect = yes + } + every_in_list = { + list = random_faith_duchy_list + game_rule_randomize_faith_randomization_effect = yes + } + every_in_list = { + list = random_faith_county_list + game_rule_randomize_faith_randomization_effect = yes + } + every_in_list = { + list = random_faith_barony_list + set_character_faith = scope:liege.faith + } +} + +#################### +# FAITH ACCEPTANCE # +#################### + +game_rule_faith_acceptance_effect = { + every_religion_global = { + every_faith = { + #Set to pluralist, not because it matters but because it looks good + if = { + limit = { has_doctrine = doctrine_pluralism_fundamentalist } + remove_doctrine = doctrine_pluralism_fundamentalist + add_doctrine = doctrine_pluralism_pluralistic + } + else_if = { + limit = { has_doctrine = doctrine_pluralism_righteous } + remove_doctrine = doctrine_pluralism_righteous + add_doctrine = doctrine_pluralism_pluralistic + } + + #Add special doctrine + add_doctrine = special_doctrine_full_tolerance + } + } +} + + +########################## +# SEXUALITY DISTRIBUTION # +########################## + +game_rule_sexuality_distribution_reroll_effect = { + if = { + limit = { age >= 10 } + random_list = { + 0 = { + modifier = { add = heterosexuality_chance } + set_sexuality = heterosexual + } + 0 = { + modifier = { add = bisexuality_chance } + set_sexuality = bisexual + } + 0 = { + modifier = { add = homosexuality_chance } + set_sexuality = homosexual + } + 0 = { + modifier = { add = asexuality_chance } + set_sexuality = asexual + } + } + } +} + +game_rule_sexuality_distribution_effect = { + every_ruler = { + game_rule_sexuality_distribution_reroll_effect = yes + + every_courtier_or_guest = { + game_rule_sexuality_distribution_reroll_effect = yes + } + + every_held_title = { + title_tier = county + title_province = { save_scope_as = pool_province } + every_pool_character = { + limit = { NOT = { is_in_list = pool_characters } } + province = scope:pool_province + add_to_list = pool_characters + } + } + } + + every_in_list = { + list = pool_characters + game_rule_sexuality_distribution_reroll_effect = yes + } + + # Sets the values for future generated characters + set_generated_homosexuality_chance = homosexuality_chance + set_generated_bisexuality_chance = bisexuality_chance + set_generated_asexuality_chance = asexuality_chance +} + +child_sexuality_distribution_effect = { + every_ruler = { + if = { + limit = { + is_adult = no + age >= 10 + } + game_rule_sexuality_distribution_reroll_effect = yes + } + + every_courtier_or_guest = { + if = { + limit = { + is_adult = no + age >= 10 + } + game_rule_sexuality_distribution_reroll_effect = yes + } + } + + every_held_title = { + title_tier = county + title_province = { save_scope_as = pool_province } + every_pool_character = { + limit = { NOT = { is_in_list = pool_characters } } + province = scope:pool_province + add_to_list = pool_characters + } + } + } + + every_in_list = { + list = pool_characters + if = { + limit = { + is_adult = no + age >= 10 + } + game_rule_sexuality_distribution_reroll_effect = yes + } + } +} + + +######################## +# EXCLAVE INDEPENDENCE # +######################## + +game_rule_exclave_independence_effect = { + if = { # Limited, AI only + limit = { + has_game_rule = ai_limited_exclave_independence + is_ai = yes + NOT = { + any_vassal_or_below = { + is_ai = no + } + } + } + + remove_character_flag = delayed_cleanse + + root.capital_province.county = { + every_connected_county = { # Start off by making a list of all disconnected Counties + invert = yes + max_naval_distance = 2000 + allow_one_county_land_gap = yes + add_to_list = disconnected_counties + } + } + + every_in_list = { + list = disconnected_counties + + limit = { + any_connected_county = { + NOT = { is_in_list = disconnected_counties } + max_naval_distance = 2000 + } + } + add_to_list = cull_naval_connection_counties + } + + while = { + limit = { + any_in_list = { + list = cull_naval_connection_counties + } + } + random_in_list = { + list = cull_naval_connection_counties + + save_scope_as = cull_origin_county + + every_connected_county = { + remove_from_list = cull_naval_connection_counties + remove_from_list = disconnected_counties + } + remove_from_list = cull_naval_connection_counties + remove_from_list = disconnected_counties + } + } + + every_in_list = { + list = disconnected_counties + + limit = { + target_is_de_jure_liege_or_above = root.primary_title + } + add_to_list = cull_de_jure_connection_counties + } + + while = { + limit = { + any_in_list = { + list = cull_de_jure_connection_counties + } + } + random_in_list = { + list = cull_de_jure_connection_counties + + save_scope_as = cull_origin_county + + every_connected_county = { + remove_from_list = cull_de_jure_connection_counties + remove_from_list = disconnected_counties + } + remove_from_list = cull_de_jure_connection_counties + remove_from_list = disconnected_counties + } + } + + every_in_list = { # Release Kings first + list = disconnected_counties + + limit = { + holder.primary_title.tier = tier_kingdom + NOR = { + holder = root + holder = { + any_sub_realm_title = { + tier = tier_county + NOT = { is_in_list = disconnected_counties } + } + } + } + } + holder = { + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + + every_in_list = { # Release Dukes second + list = disconnected_counties + + limit = { + holder.primary_title.tier = tier_duchy + NOR = { + holder = root + holder = { + any_sub_realm_title = { + tier = tier_county + NOT = { is_in_list = disconnected_counties } + } + } + } + } + holder = { + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + + every_in_list = { # Release Counts last + list = disconnected_counties + + limit = { + holder.primary_title.tier = tier_county + NOR = { + holder = root + holder = { + any_sub_realm_title = { + tier = tier_county + NOT = { is_in_list = disconnected_counties } + } + } + } + } + holder = { + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + + every_in_list = { # Finally, release contiguous areas under someone from the pool + list = disconnected_counties + + limit = { + OR = { + holder.top_liege = root + holder = root + } + } + + save_scope_as = county_of_origin + + every_pool_character = { + province = scope:county_of_origin.title_province + limit = { + is_available_adult = yes + } + add_to_list = potential_holders + } + + every_pool_character = { + province = scope:county_of_origin.holder.capital_province + limit = { + is_available_adult = yes + } + add_to_list = potential_holders + } + + if = { + limit = { + NOT = { + any_in_list = { + list = potential_holders + is_available_adult = yes + } + } + } + create_character = { + location = scope:county_of_origin.title_province + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + gender_female_chance = 50 + age = 32 + save_scope_as = backup_character + } + scope:backup_character = { + add_to_list = potential_holders + } + } + + random_in_list = { + list = potential_holders + limit = { + is_available_adult = yes + has_claim_on = scope:county_of_origin + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + faith = scope:county_of_origin.faith + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + has_claim_on = scope:county_of_origin + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + } + alternative_limit = { + is_available_adult = yes + faith = scope:county_of_origin.faith + } + alternative_limit = { + is_available_adult = yes + } + + save_scope_as = new_county_holder + add_character_flag = { + flag = domicile_culture_and_faith_check + days = 1 + } + #get_title = scope:county_of_origin + + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + every_in_list = { + list = disconnected_counties + limit = { + OR = { + holder.top_liege = root + holder = root + } + is_connected_to = { + target = scope:county_of_origin + } + NOT ={ + is_connected_to = { + target = root.capital_province.county + } + } + } + change_title_holder = { + holder = scope:new_county_holder + change = scope:change + } + #scope:new_county_holder = { get_title = prev } + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + + # This system should not generate strange-culture nomads + if = { + limit = { + government_has_flag = government_is_nomadic + domicile.domicile_culture != scope:new_county_holder.capital_county.culture + } + domicile = { + set_domicile_culture = scope:new_county_holder.capital_county.culture + } + } + if = { + limit = { + government_has_flag = government_is_nomadic + domicile.domicile_faith != scope:new_county_holder.capital_county.faith + } + domicile = { + set_domicile_faith = scope:new_county_holder.capital_county.faith + } + } + if = { # Just in case they need to create a duchy + limit = { + gold < 500 + } + add_gold = 500 + } + } + } + } + else_if = { # Significant, AI Only + limit = { + has_game_rule = ai_significant_exclave_independence + is_ai = yes + NOT = { + any_vassal_or_below = { + is_ai = no + } + } + } + + remove_character_flag = delayed_cleanse + + root.capital_province.county = { + every_connected_county = { # Start off by making a list of all disconnected Counties + invert = yes + max_naval_distance = 2000 + add_to_list = disconnected_counties + } + } + + every_in_list = { + list = disconnected_counties + + limit = { + target_is_de_jure_liege_or_above = root.primary_title + } + add_to_list = cull_de_jure_connection_counties + } + + while = { + limit = { + any_in_list = { + list = cull_de_jure_connection_counties + } + } + random_in_list = { + list = cull_de_jure_connection_counties + + save_scope_as = cull_origin_county + + every_connected_county = { + remove_from_list = cull_de_jure_connection_counties + remove_from_list = disconnected_counties + } + remove_from_list = cull_de_jure_connection_counties + remove_from_list = disconnected_counties + } + } + + every_in_list = { + list = disconnected_counties + + limit = { + any_connected_county = { + NOT = { is_in_list = disconnected_counties } + max_naval_distance = 2000 + } + } + add_to_list = cull_naval_connection_counties + } + + while = { + limit = { + any_in_list = { + list = cull_naval_connection_counties + } + } + random_in_list = { + list = cull_naval_connection_counties + + save_scope_as = cull_origin_county + + every_connected_county = { + remove_from_list = cull_naval_connection_counties + remove_from_list = disconnected_counties + } + remove_from_list = cull_naval_connection_counties + remove_from_list = disconnected_counties + } + } + + every_in_list = { # Release Kings first + list = disconnected_counties + + limit = { + holder.primary_title.tier = tier_kingdom + NOR = { + holder = root + holder = { + any_sub_realm_title = { + tier = tier_county + NOT = { is_in_list = disconnected_counties } + } + } + } + } + holder = { + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + + every_in_list = { # Release Dukes second + list = disconnected_counties + + limit = { + holder.primary_title.tier = tier_duchy + NOR = { + holder = root + holder = { + any_sub_realm_title = { + tier = tier_county + NOT = { is_in_list = disconnected_counties } + } + } + } + } + holder = { + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + + every_in_list = { # Release Counts last + list = disconnected_counties + + limit = { + holder.primary_title.tier = tier_county + NOR = { + holder = root + holder = { + any_sub_realm_title = { + tier = tier_county + NOT = { is_in_list = disconnected_counties } + } + } + } + } + holder = { + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + + every_in_list = { # Finally, release contiguous areas under someone from the pool + list = disconnected_counties + + limit = { + OR = { + holder.top_liege = root + holder = root + } + } + + save_scope_as = county_of_origin + + every_pool_character = { + province = scope:county_of_origin.title_province + limit = { + is_available_adult = yes + } + add_to_list = potential_holders + } + + every_pool_character = { + province = scope:county_of_origin.holder.capital_province + limit = { + is_available_adult = yes + } + add_to_list = potential_holders + } + + if = { + limit = { + NOT = { + any_in_list = { + list = potential_holders + is_available_adult = yes + } + } + } + create_character = { + location = scope:county_of_origin.title_province + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + gender_female_chance = 50 + age = 32 + save_scope_as = backup_character + } + scope:backup_character = { + add_to_list = potential_holders + } + } + + random_in_list = { + list = potential_holders + limit = { + is_available_adult = yes + has_claim_on = scope:county_of_origin + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + faith = scope:county_of_origin.faith + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + has_claim_on = scope:county_of_origin + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + } + alternative_limit = { + is_available_adult = yes + faith = scope:county_of_origin.faith + } + alternative_limit = { + is_available_adult = yes + } + + save_scope_as = new_county_holder + add_character_flag = { + flag = domicile_culture_and_faith_check + days = 1 + } + #get_title = scope:county_of_origin + + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + every_in_list = { + list = disconnected_counties + limit = { + OR = { + holder.top_liege = root + holder = root + } + is_connected_to = { + target = scope:county_of_origin + } + NOT ={ + is_connected_to = { + target = root.capital_province.county + } + } + } + change_title_holder = { + holder = scope:new_county_holder + change = scope:change + } + #scope:new_county_holder = { get_title = prev } + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + # This system should not generate strange-culture nomads + if = { + limit = { + government_has_flag = government_is_nomadic + domicile.domicile_culture != scope:new_county_holder.capital_county.culture + } + domicile = { + set_domicile_culture = scope:new_county_holder.capital_county.culture + } + } + if = { + limit = { + government_has_flag = government_is_nomadic + domicile.domicile_faith != scope:new_county_holder.capital_county.faith + } + domicile = { + set_domicile_faith = scope:new_county_holder.capital_county.faith + } + } + if = { # Just in case they need to create a duchy + limit = { + gold < 500 + } + add_gold = 500 + } + } + } + } + else_if = { # Total, AI only + limit = { + has_game_rule = ai_total_exclave_independence + is_ai = yes + NOT = { + any_vassal_or_below = { + is_ai = no + } + } + } + + remove_character_flag = delayed_cleanse + + root.capital_province.county = { + every_connected_county = { # Start off by making a list of all disconnected Counties + invert = yes + max_naval_distance = 2000 + add_to_list = disconnected_counties + } + } + + every_in_list = { + list = disconnected_counties + + limit = { + any_connected_county = { + NOT = { is_in_list = disconnected_counties } + max_naval_distance = 2000 + } + } + add_to_list = cull_naval_connection_counties + } + + while = { + limit = { + any_in_list = { + list = cull_naval_connection_counties + } + } + random_in_list = { + list = cull_naval_connection_counties + + save_scope_as = cull_origin_county + + every_connected_county = { + remove_from_list = cull_naval_connection_counties + remove_from_list = disconnected_counties + } + remove_from_list = cull_naval_connection_counties + remove_from_list = disconnected_counties + } + } + + every_in_list = { # Release Kings first + list = disconnected_counties + + limit = { + holder.primary_title.tier = tier_kingdom + NOR = { + holder = root + holder = { + any_sub_realm_title = { + tier = tier_county + NOT = { is_in_list = disconnected_counties } + } + } + } + } + holder = { + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + + every_in_list = { # Release Dukes second + list = disconnected_counties + + limit = { + holder.primary_title.tier = tier_duchy + NOR = { + holder = root + holder = { + any_sub_realm_title = { + tier = tier_county + NOT = { is_in_list = disconnected_counties } + } + } + } + } + holder = { + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + + every_in_list = { # Release Counts last + list = disconnected_counties + + limit = { + holder.primary_title.tier = tier_county + NOR = { + holder = root + holder = { + any_sub_realm_title = { + tier = tier_county + NOT = { is_in_list = disconnected_counties } + } + } + } + } + holder = { + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + + every_in_list = { # Finally, release contiguous areas under someone from the pool + list = disconnected_counties + + limit = { + OR = { + holder.top_liege = root + holder = root + } + } + + save_scope_as = county_of_origin + + every_pool_character = { + province = scope:county_of_origin.title_province + limit = { + is_available_adult = yes + } + add_to_list = potential_holders + } + + every_pool_character = { + province = scope:county_of_origin.holder.capital_province + limit = { + is_available_adult = yes + } + add_to_list = potential_holders + } + + if = { + limit = { + NOT = { + any_in_list = { + list = potential_holders + is_available_adult = yes + } + } + } + create_character = { + location = scope:county_of_origin.title_province + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + gender_female_chance = 50 + age = 32 + save_scope_as = backup_character + } + scope:backup_character = { + add_to_list = potential_holders + } + } + + random_in_list = { + list = potential_holders + limit = { + is_available_adult = yes + has_claim_on = scope:county_of_origin + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + faith = scope:county_of_origin.faith + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + has_claim_on = scope:county_of_origin + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + } + alternative_limit = { + is_available_adult = yes + faith = scope:county_of_origin.faith + } + alternative_limit = { + is_available_adult = yes + } + + save_scope_as = new_county_holder + add_character_flag = { + flag = domicile_culture_and_faith_check + days = 1 + } + #get_title = scope:county_of_origin + + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + every_in_list = { + list = disconnected_counties + limit = { + OR = { + holder.top_liege = root + holder = root + } + is_connected_to = { + target = scope:county_of_origin + } + NOT ={ + is_connected_to = { + target = root.capital_province.county + } + } + } + change_title_holder = { + holder = scope:new_county_holder + change = scope:change + } + #scope:new_county_holder = { get_title = prev } + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + # This system should not generate strange-culture nomads + if = { + limit = { + government_has_flag = government_is_nomadic + domicile.domicile_culture != scope:new_county_holder.capital_county.culture + } + domicile = { + set_domicile_culture = scope:new_county_holder.capital_county.culture + } + } + if = { + limit = { + government_has_flag = government_is_nomadic + domicile.domicile_faith != scope:new_county_holder.capital_county.faith + } + domicile = { + set_domicile_faith = scope:new_county_holder.capital_county.faith + } + } + if = { # Just in case they need to create a duchy + limit = { + gold < 500 + } + add_gold = 500 + } + } + } + } + else_if = { # Limited: Land connected to Capital, De Jure of Primary Title, or one gap away, as well as coastal + limit = { + has_game_rule = limited_exclave_independence + } + + remove_character_flag = delayed_cleanse + + root.capital_province.county = { + every_connected_county = { # Start off by making a list of all disconnected Counties + invert = yes + max_naval_distance = 2000 + allow_one_county_land_gap = yes + add_to_list = disconnected_counties + } + } + + every_in_list = { + list = disconnected_counties + + limit = { + any_connected_county = { + NOT = { is_in_list = disconnected_counties } + max_naval_distance = 2000 + } + } + add_to_list = cull_naval_connection_counties + } + + while = { + limit = { + any_in_list = { + list = cull_naval_connection_counties + } + } + random_in_list = { + list = cull_naval_connection_counties + + save_scope_as = cull_origin_county + + every_connected_county = { + remove_from_list = cull_naval_connection_counties + remove_from_list = disconnected_counties + } + remove_from_list = cull_naval_connection_counties + remove_from_list = disconnected_counties + } + } + + every_in_list = { + list = disconnected_counties + + limit = { + target_is_de_jure_liege_or_above = root.primary_title + } + add_to_list = cull_de_jure_connection_counties + } + + while = { + limit = { + any_in_list = { + list = cull_de_jure_connection_counties + } + } + random_in_list = { + list = cull_de_jure_connection_counties + + save_scope_as = cull_origin_county + + every_connected_county = { + remove_from_list = cull_de_jure_connection_counties + remove_from_list = disconnected_counties + } + remove_from_list = cull_de_jure_connection_counties + remove_from_list = disconnected_counties + } + } + + every_in_list = { # Release Kings first + list = disconnected_counties + + limit = { + holder.primary_title.tier = tier_kingdom + NOR = { + holder = root + holder = { + any_sub_realm_title = { + tier = tier_county + NOT = { is_in_list = disconnected_counties } + } + } + } + } + holder = { + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + + every_in_list = { # Release Dukes second + list = disconnected_counties + + limit = { + holder.primary_title.tier = tier_duchy + NOR = { + holder = root + holder = { + any_sub_realm_title = { + tier = tier_county + NOT = { is_in_list = disconnected_counties } + } + } + } + } + holder = { + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + + every_in_list = { # Release Counts last + list = disconnected_counties + + limit = { + holder.primary_title.tier = tier_county + NOR = { + holder = root + holder = { + any_sub_realm_title = { + tier = tier_county + NOT = { is_in_list = disconnected_counties } + } + } + } + } + holder = { + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + + every_in_list = { # Finally, release contiguous areas under someone from the pool + list = disconnected_counties + + limit = { + OR = { + holder.top_liege = root + holder = root + } + } + + save_scope_as = county_of_origin + + every_pool_character = { + province = scope:county_of_origin.title_province + limit = { + is_available_adult = yes + } + add_to_list = potential_holders + } + + every_pool_character = { + province = scope:county_of_origin.holder.capital_province + limit = { + is_available_adult = yes + } + add_to_list = potential_holders + } + + if = { + limit = { + NOT = { + any_in_list = { + list = potential_holders + is_available_adult = yes + } + } + } + create_character = { + location = scope:county_of_origin.title_province + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + gender_female_chance = 50 + age = 32 + save_scope_as = backup_character + } + scope:backup_character = { + add_to_list = potential_holders + } + } + + random_in_list = { + list = potential_holders + limit = { + is_available_adult = yes + has_claim_on = scope:county_of_origin + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + faith = scope:county_of_origin.faith + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + has_claim_on = scope:county_of_origin + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + } + alternative_limit = { + is_available_adult = yes + faith = scope:county_of_origin.faith + } + alternative_limit = { + is_available_adult = yes + } + + save_scope_as = new_county_holder + add_character_flag = { + flag = domicile_culture_and_faith_check + days = 1 + } + #get_title = scope:county_of_origin + + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + every_in_list = { + list = disconnected_counties + limit = { + OR = { + holder.top_liege = root + holder = root + } + is_connected_to = { + target = scope:county_of_origin + } + NOT ={ + is_connected_to = { + target = root.capital_province.county + } + } + } + change_title_holder = { + holder = scope:new_county_holder + change = scope:change + } + #scope:new_county_holder = { get_title = prev } + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + # This system should not generate strange-culture nomads + if = { + limit = { + government_has_flag = government_is_nomadic + domicile.domicile_culture != scope:new_county_holder.capital_county.culture + } + domicile = { + set_domicile_culture = scope:new_county_holder.capital_county.culture + } + } + if = { + limit = { + government_has_flag = government_is_nomadic + domicile.domicile_faith != scope:new_county_holder.capital_county.faith + } + domicile = { + set_domicile_faith = scope:new_county_holder.capital_county.faith + } + } + if = { # Just in case they need to create a duchy + limit = { + gold < 500 + } + add_gold = 500 + } + } + } + } + else_if = { # Significant: Land connected to Capital or De Jure of Primary Title, and coastal + limit = { + has_game_rule = significant_exclave_independence + } + + remove_character_flag = delayed_cleanse + + root.capital_province.county = { + every_connected_county = { # Start off by making a list of all disconnected Counties + invert = yes + max_naval_distance = 2000 + add_to_list = disconnected_counties + } + } + + every_in_list = { + list = disconnected_counties + + limit = { + target_is_de_jure_liege_or_above = root.primary_title + } + add_to_list = cull_de_jure_connection_counties + } + + while = { + limit = { + any_in_list = { + list = cull_de_jure_connection_counties + } + } + random_in_list = { + list = cull_de_jure_connection_counties + + save_scope_as = cull_origin_county + + every_connected_county = { + remove_from_list = cull_de_jure_connection_counties + remove_from_list = disconnected_counties + } + remove_from_list = cull_de_jure_connection_counties + remove_from_list = disconnected_counties + } + } + + while = { + limit = { + any_in_list = { + list = disconnected_counties + + any_connected_county = { + NOT = { is_in_list = disconnected_counties } + max_naval_distance = 2000 + } + } + } + random_in_list = { + list = disconnected_counties + + limit = { + any_connected_county = { + NOT = { is_in_list = disconnected_counties } + max_naval_distance = 2000 + } + } + + remove_from_list = disconnected_counties + } + } + + every_in_list = { # Release Kings first + list = disconnected_counties + + limit = { + holder.primary_title.tier = tier_kingdom + NOR = { + holder = root + holder = { + any_sub_realm_title = { + tier = tier_county + NOT = { is_in_list = disconnected_counties } + } + } + } + } + holder = { + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + + every_in_list = { # Release Dukes second + list = disconnected_counties + + limit = { + holder.primary_title.tier = tier_duchy + NOR = { + holder = root + holder = { + any_sub_realm_title = { + tier = tier_county + NOT = { is_in_list = disconnected_counties } + } + } + } + } + holder = { + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + + every_in_list = { # Release Counts last + list = disconnected_counties + + limit = { + holder.primary_title.tier = tier_county + NOR = { + holder = root + holder = { + any_sub_realm_title = { + tier = tier_county + NOT = { is_in_list = disconnected_counties } + } + } + } + } + holder = { + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + + every_in_list = { # Finally, release contiguous areas under someone from the pool + list = disconnected_counties + + limit = { + OR = { + holder.top_liege = root + holder = root + } + } + + save_scope_as = county_of_origin + + every_pool_character = { + province = scope:county_of_origin.title_province + limit = { + is_available_adult = yes + } + add_to_list = potential_holders + } + + every_pool_character = { + province = scope:county_of_origin.holder.capital_province + limit = { + is_available_adult = yes + } + add_to_list = potential_holders + } + + if = { + limit = { + NOT = { + any_in_list = { + list = potential_holders + is_available_adult = yes + } + } + } + create_character = { + location = scope:county_of_origin.title_province + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + gender_female_chance = 50 + age = 32 + save_scope_as = backup_character + } + scope:backup_character = { + add_to_list = potential_holders + } + } + + random_in_list = { + list = potential_holders + limit = { + is_available_adult = yes + has_claim_on = scope:county_of_origin + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + faith = scope:county_of_origin.faith + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + has_claim_on = scope:county_of_origin + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + } + alternative_limit = { + is_available_adult = yes + faith = scope:county_of_origin.faith + } + alternative_limit = { + is_available_adult = yes + } + + save_scope_as = new_county_holder + add_character_flag = { + flag = domicile_culture_and_faith_check + days = 1 + } + #get_title = scope:county_of_origin + + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + every_in_list = { + list = disconnected_counties + limit = { + OR = { + holder.top_liege = root + holder = root + } + is_connected_to = { + target = scope:county_of_origin + } + NOT ={ + is_connected_to = { + target = root.capital_province.county + } + } + } + change_title_holder = { + holder = scope:new_county_holder + change = scope:change + } + #scope:new_county_holder = { get_title = prev } + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + # This system should not generate strange-culture nomads + if = { + limit = { + government_has_flag = government_is_nomadic + domicile.domicile_culture != scope:new_county_holder.capital_county.culture + } + domicile = { + set_domicile_culture = scope:new_county_holder.capital_county.culture + } + } + if = { + limit = { + government_has_flag = government_is_nomadic + domicile.domicile_faith != scope:new_county_holder.capital_county.faith + } + domicile = { + set_domicile_faith = scope:new_county_holder.capital_county.faith + } + } + if = { # Just in case they need to create a duchy + limit = { + gold < 500 + } + add_gold = 500 + } + } + } + } + else_if = { # Total: Only keep things connected to your capital, or coastal + limit = { + has_game_rule = total_exclave_independence + } + + remove_character_flag = delayed_cleanse + + root.capital_province.county = { + every_connected_county = { # Start off by making a list of all disconnected Counties + invert = yes + max_naval_distance = 2000 + add_to_list = disconnected_counties + } + } + + every_in_list = { + list = disconnected_counties + + limit = { + any_connected_county = { + NOT = { is_in_list = disconnected_counties } + max_naval_distance = 2000 + } + } + add_to_list = cull_naval_connection_counties + } + + while = { + limit = { + any_in_list = { + list = cull_naval_connection_counties + } + } + random_in_list = { + list = cull_naval_connection_counties + + save_scope_as = cull_origin_county + + every_connected_county = { + remove_from_list = cull_naval_connection_counties + remove_from_list = disconnected_counties + } + remove_from_list = cull_naval_connection_counties + remove_from_list = disconnected_counties + } + } + + every_in_list = { # Release Kings first + list = disconnected_counties + + limit = { + holder.primary_title.tier = tier_kingdom + NOR = { + holder = root + holder = { + any_sub_realm_title = { + tier = tier_county + NOT = { is_in_list = disconnected_counties } + } + } + } + } + holder = { + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + + every_in_list = { # Release Dukes second + list = disconnected_counties + + limit = { + holder.primary_title.tier = tier_duchy + NOR = { + holder = root + holder = { + any_sub_realm_title = { + tier = tier_county + NOT = { is_in_list = disconnected_counties } + } + } + } + } + holder = { + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + + every_in_list = { # Release Counts last + list = disconnected_counties + + limit = { + holder.primary_title.tier = tier_county + NOR = { + holder = root + holder = { + any_sub_realm_title = { + tier = tier_county + NOT = { is_in_list = disconnected_counties } + } + } + } + } + holder = { + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + + every_in_list = { # Finally, release contiguous areas under someone from the pool + list = disconnected_counties + + limit = { + OR = { + holder.top_liege = root + holder = root + } + } + + save_scope_as = county_of_origin + + every_pool_character = { + province = scope:county_of_origin.title_province + limit = { + is_available_adult = yes + } + add_to_list = potential_holders + } + + every_pool_character = { + province = scope:county_of_origin.holder.capital_province + limit = { + is_available_adult = yes + } + add_to_list = potential_holders + } + + if = { + limit = { + NOT = { + any_in_list = { + list = potential_holders + is_available_adult = yes + } + } + } + create_character = { + location = scope:county_of_origin.title_province + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + gender_female_chance = 50 + age = 32 + save_scope_as = backup_character + } + scope:backup_character = { + add_to_list = potential_holders + } + } + + random_in_list = { + list = potential_holders + limit = { + is_available_adult = yes + has_claim_on = scope:county_of_origin + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + faith = scope:county_of_origin.faith + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + has_claim_on = scope:county_of_origin + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + } + alternative_limit = { + is_available_adult = yes + faith = scope:county_of_origin.faith + } + alternative_limit = { + is_available_adult = yes + } + + save_scope_as = new_county_holder + add_character_flag = { + flag = domicile_culture_and_faith_check + days = 1 + } + #get_title = scope:county_of_origin + + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + every_in_list = { + list = disconnected_counties + limit = { + OR = { + holder.top_liege = root + holder = root + } + is_connected_to = { + target = scope:county_of_origin + } + NOT ={ + is_connected_to = { + target = root.capital_province.county + } + } + } + change_title_holder = { + holder = scope:new_county_holder + change = scope:change + } + #scope:new_county_holder = { get_title = prev } + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + # This system should not generate strange-culture nomads + if = { + limit = { + government_has_flag = government_is_nomadic + domicile.domicile_culture != scope:new_county_holder.capital_county.culture + } + domicile = { + set_domicile_culture = scope:new_county_holder.capital_county.culture + } + } + if = { + limit = { + government_has_flag = government_is_nomadic + domicile.domicile_faith != scope:new_county_holder.capital_county.faith + } + domicile = { + set_domicile_faith = scope:new_county_holder.capital_county.faith + } + } + if = { # Just in case they need to create a duchy + limit = { + gold < 500 + } + add_gold = 500 + } + } + } + } +} + +############### +# HARM EVENTS # +############### + +# Controls logging for harm events where the character is killed. +## Unless you're specifically looking to gather easy death metrics whilst run testing, this should always be toggled off. +log_harm_event_death_as_variable_effect = { + if = { + limit = { always = no } + if = { + # Only track noteworthy characters. + limit = { harm_game_rule_valid_for_logging_trigger = yes } + add_to_global_variable_list = { + name = harm_deaths_list + target = root + } + } + } + # And, for error suppression. + if = { + limit = { always = no } + if = { + limit = { + global_variable_list_size = { + name = harm_deaths_list + value >= 1 + } + } + } + } +} + +# Controls logging for harm events where the character is rendered incapable. +## Unless you're specifically looking to gather easy death metrics whilst run testing, this should always be toggled off. +log_harm_event_incapability_as_variable_effect = { + if = { + limit = { always = no } + if = { + # Only track noteworthy characters. + limit = { harm_game_rule_valid_for_logging_trigger = yes } + add_to_global_variable_list = { + name = harm_incapables_list + target = root + } + } + } + # And, for error suppression. + if = { + limit = { always = no } + if = { + limit = { + global_variable_list_size = { + name = harm_incapables_list + value >= 1 + } + } + } + } +} + +# Controls logging for harm events where the character survives. +## Unless you're specifically looking to gather easy death metrics whilst run testing, this should always be toggled off. +log_harm_event_spared_as_variable_effect = { + if = { + limit = { always = no } + if = { + # Only track noteworthy characters. + limit = { harm_game_rule_valid_for_logging_trigger = yes } + add_to_global_variable_list = { + name = harm_spared_list + target = root + } + } + } + # And, for error suppression. + if = { + limit = { always = no } + if = { + limit = { + global_variable_list_size = { + name = harm_spared_list + value >= 1 + } + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_governance_lifestyle_effects.txt b/N3OW/common/scripted_effects/00_governance_lifestyle_effects.txt new file mode 100644 index 00000000..5f282702 --- /dev/null +++ b/N3OW/common/scripted_effects/00_governance_lifestyle_effects.txt @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/N3OW/common/scripted_effects/00_historical_characters_scripted_effects.txt b/N3OW/common/scripted_effects/00_historical_characters_scripted_effects.txt new file mode 100644 index 00000000..5c82887a --- /dev/null +++ b/N3OW/common/scripted_effects/00_historical_characters_scripted_effects.txt @@ -0,0 +1,6083 @@ +spawn_historical_characters_effect = { + + if = { # Karunakara Tondaiman + limit = { + current_year >= 1067 + current_year <= 1070 + NOT = { exists = global_var:hchar_karunakara } + } + set_global_variable = { name = hchar_karunakara value = yes } + title:b_nagapattinam = { + save_scope_as = birth_location + create_character = { + age = 20 + name = Karunakara + dynasty_house = house:house_tondaiman + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:vaishnavism + culture = scope:birth_location.title_province.culture + trait = education_martial_4 + trait = loyal + random_traits_list = { + count = 3 + brave = {} + vengeful = {} + ambitious = {} + wrathful = {} + zealous = {} + } + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_high_skill max_template_high_skill } + stewardship = { min_template_decent_skill max_template_decent_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_low_skill max_template_low_skill } + prowess = { min_template_high_skill max_template_high_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = karunakara + add_character_flag = ai_will_not_convert + } + if = { limit = { has_variable = karunakara } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Sekkilhar + limit = { + current_year >= 1140 + current_year <= 1150 + NOT = { exists = global_var:hchar_sekkilhar } + } + set_global_variable = { name = hchar_sekkilhar value = yes } + title:b_kanchipuram = { + save_scope_as = birth_location + create_character = { + age = 20 + name = Sekkilhar + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:shaivism + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = theologian + trait = intellect_good_3 + random_traits_list = { + count = 3 + lustful = {} + zealous = {} + diligent = {} + humble = {} + } + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_high_skill } + intrigue = { min_template_decent_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = sekkilhar + set_variable = legendary_author + create_inspiration = book_inspiration + add_character_flag = ai_will_not_convert + save_scope_as = major + } + if = { limit = { has_variable = sekkilhar } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Omar Khayyam + limit = { + current_year >= 1068 + current_year <= 1070 + NOT = { exists = global_var:hchar_omar_khayyam } + } + set_global_variable = { name = hchar_omar_khayyam value = yes } + title:b_nishapur = { + save_scope_as = birth_location + create_character = { + age = 20 + name = Omar + dynasty_house = house:house_khayyam + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:maturidi + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = lifestyle_poet + trait = lifestyle_reveler + trait = shrewd + random_traits_list = { + count = 3 + cynical = {} + compassionate = {} + patient = {} + gregarious = {} + } + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_high_skill } + intrigue = { min_template_decent_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = omar_khayyam + set_variable = legendary_author + create_inspiration = book_inspiration + add_character_flag = ai_will_not_convert + save_scope_as = major + hidden_effect = { + learn_language_of_culture = culture:bedouin + add_trait_xp = { + trait = lifestyle_reveler + value = 75 + } + } + } + if = { limit = { has_variable = omar_khayyam } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Bhaskaracharya + limit = { + current_year >= 1134 + current_year <= 1150 + NOT = { exists = global_var:hchar_bhaskaracharya } + } + set_global_variable = { name = hchar_bhaskaracharya value = yes } + title:b_vijayapura_bis = { + save_scope_as = birth_location + create_character = { + age = 20 + name = Bhaskaracharya + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:vaishnavism + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = scholar + random_traits_list = { + count = 3 + diligent = {} + humble = {} + patient = {} + ambitious = {} + } + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_high_skill } + intrigue = { min_template_decent_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = bhaskaracharya + set_variable = legendary_author + add_piety = 5000 + create_inspiration = book_inspiration + add_character_flag = ai_will_not_convert + } + if = { limit = { has_variable = bhaskaracharya } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Joseph Rabban + limit = { + current_year >= 970 + current_year <= 1000 + NOT = { exists = global_var:hchar_joseph_rabban } + } + set_global_variable = { name = hchar_joseph_rabban value = yes } + title:b_mahoyadapuram = { + save_scope_as = birth_location + create_character = { + age = 20 + name = Joseph + dynasty_house = house:house_rabban + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:malabarism + culture = scope:birth_location.title_province.culture + trait = education_stewardship_4 + random_traits_list = { + count = 3 + honest = {} + ambitious = {} + diligent = {} + brave = {} + } + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_high_skill } + intrigue = { min_template_decent_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = joseph_rabban + add_character_flag = ai_will_not_convert + } + if = { limit = { has_variable = joseph_rabban } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Atisha + limit = { + current_year >= 1040 + current_year <= 1045 + NOT = { exists = global_var:hchar_atisha } + } + set_global_variable = { name = hchar_atisha value = yes } + title:b_bikrampur = { + save_scope_as = birth_location + create_character = { + age = 50 + name = Atisha + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:vajrayana + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = theologian + trait = devoted + trait = lifestyle_mystic + random_traits_list = { + count = 3 + zealous = {} + calm = {} + diligent = {} + honest = {} + } + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_high_skill } + intrigue = { min_template_decent_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = atisha + hidden_effect = { + add_trait_xp = { + trait = lifestyle_mystic + value = 100 + } + } + add_piety = 5000 + create_inspiration = religious_inspiration + add_character_flag = ai_will_not_convert + save_scope_as = major + } + if = { limit = { has_variable = atisha } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Hemachandra + limit = { + current_year >= 1109 + current_year <= 1130 + NOT = { exists = global_var:hchar_hemachandra } + } + set_global_variable = { name = hchar_hemachandra value = yes } + title:b_dhandhuka = { + save_scope_as = birth_location + create_character = { + age = 20 + name = Hemachandra + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:svetambara + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = lifestyle_poet + trait = scholar + trait = devoted + trait = lifestyle_mystic + trait = intellect_good_3 + random_traits_list = { + count = 3 + zealous = {} + ambitious = {} + diligent = {} + honest = {} + } + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_high_skill } + intrigue = { min_template_decent_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = hemachandra + set_variable = legendary_author + hidden_effect = { + add_trait_xp = { + trait = lifestyle_mystic + value = 100 + } + } + add_piety = 5000 + create_inspiration = book_inspiration + } + if = { limit = { has_variable = hemachandra } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Kshemendra + limit = { + current_year >= 1037 + current_year <= 1070 + NOT = { exists = global_var:hchar_kshemendra } + } + set_global_variable = { name = hchar_kshemendra value = yes } + title:b_srinagara = { + save_scope_as = birth_location + create_character = { + age = 47 + name = Kshemendra + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:shaivism + culture = scope:birth_location.title_province.culture + trait = education_diplomacy_4 + trait = journaller + trait = scholar + random_traits_list = { + count = 3 + gregarious = {} + ambitious = {} + diligent = {} + honest = {} + } + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_high_skill } + intrigue = { min_template_decent_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = kshemendra + set_variable = legendary_author + add_piety = 5000 + create_inspiration = book_inspiration + } + if = { limit = { has_variable = kshemendra } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Akka Mahadevi + limit = { + current_year >= 1150 + current_year <= 1155 + NOT = { exists = global_var:hchar_akka_mahadevi } + } + set_global_variable = { name = hchar_akka_mahadevi value = yes } + title:b_vaijayanti = { + save_scope_as = birth_location + create_character = { + age = 20 + name = Akka_Mahadevi + dynasty = none + gender_female_chance = 100 + random_traits = no + location = scope:birth_location.title_province + faith = faith:shaivism + culture = scope:birth_location.title_province.culture + trait = education_diplomacy_3 + trait = lifestyle_poet + trait = lifestyle_mystic + random_traits_list = { + count = 3 + compassionate = {} + zealous = {} + generous = {} + honest = {} + } + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_high_skill } + intrigue = { min_template_decent_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = akka_mahadevi + set_variable = legendary_author + add_piety = 5000 + create_inspiration = book_inspiration + } + if = { limit = { has_variable = akka_mahadevi } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Namdev + limit = { + current_year >= 1290 + current_year <= 1295 + NOT = { exists = global_var:hchar_namdev } + } + set_global_variable = { name = hchar_namdev value = yes } + title:b_nanded = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Namdev" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:vaishnavism + culture = scope:birth_location.title_province.culture + trait = education_learning_3 + trait = lifestyle_poet + trait = lifestyle_mystic + random_traits_list = { + count = 3 + humble = {} + calm = {} + generous = {} + honest = {} + } + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_high_skill } + intrigue = { min_template_decent_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = namdev + hidden_effect = { + add_trait_xp = { + trait = lifestyle_mystic + value = 100 + } + } + add_piety = 10000 + create_inspiration = religious_inspiration + add_character_flag = ai_will_not_convert + save_scope_as = major + } + if = { limit = { has_variable = namdev } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Madhvacharya + limit = { + current_year >= 1258 + current_year <= 1260 + NOT = { exists = global_var:hchar_madhvacharya } + } + set_global_variable = { name = hchar_madhvacharya value = yes } + title:b_udayavara = { #Udupi + save_scope_as = birth_location + create_character = { + age = 20 + name = "Madhvacharya" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:vaishnavism + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = theologian + trait = devoted + random_traits_list = { + count = 3 + zealous = {} + calm = {} + stubborn = {} + diligent = {} + } + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_high_skill } + intrigue = { min_template_decent_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = madhvacharya + add_piety = 10000 + create_inspiration = religious_inspiration + add_character_flag = ai_will_not_convert + save_scope_as = major + } + if = { limit = { has_variable = madhvacharya } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Vidyapati + limit = { + current_year >= 1372 + current_year <= 1381 + NOT = { exists = global_var:hchar_vidyapati } + } + set_global_variable = { name = hchar_vidyapati value = yes } + title:b_darbhanga = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Vidyapati" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:shaivism + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = scholar + trait = lifestyle_poet + random_traits_list = { + count = 3 + gregarious = {} + generous = {} + compassionate = {} + diligent = {} + } + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_high_skill } + intrigue = { min_template_decent_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = vidyapati + set_variable = legendary_author + add_piety = 5000 + create_inspiration = book_inspiration + add_character_flag = ai_will_not_convert + save_scope_as = major + } + if = { limit = { has_variable = vidyapati } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Abhinavagupta + limit = { + current_year >= 980 + current_year <= 990 + NOT = { exists = global_var:hchar_abhinavagupta } + } + set_global_variable = { name = hchar_abhinavagupta value = yes } + title:b_srinagara = { + save_scope_as = birth_location + create_character = { + age = 30 + name = "Abhinavagupta" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:shaivism + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = lifestyle_mystic + trait = scholar + trait = devoted + random_traits_list = { + count = 3 + zealous = {} + diligent = {} + calm = {} + just = {} + } + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_high_skill } + intrigue = { min_template_decent_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = abhinavagupta + add_piety = 10000 + hidden_effect = { + add_trait_xp = { + trait = lifestyle_mystic + value = 100 + } + } + create_inspiration = religious_inspiration + add_character_flag = ai_will_not_convert + save_scope_as = major + } + if = { limit = { has_variable = abhinavagupta } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Basava + limit = { + current_year >= 1131 + current_year <= 1137 + NOT = { exists = global_var:hchar_basava } + } + set_global_variable = { name = hchar_basava value = yes } + title:b_basavapattana = { + save_scope_as = birth_location + create_character = { + age = 26 + name = "Basava" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:shaivism + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = theologian + random_traits_list = { + count = 3 + zealous = {} + humble = {} + patient = {} + compassionate = {} + } + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_high_skill } + intrigue = { min_template_decent_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = basava + add_piety = 10000 + create_inspiration = religious_inspiration + } + if = { limit = { has_variable = basava } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Hildegard von Bingen + limit = { + current_year >= 1121 + current_year <= 1127 + NOT = { exists = global_var:hchar_hildegard } + } + set_global_variable = { name = hchar_hildegard value = yes } + title:b_worms = { + save_scope_as = birth_location + create_character = { + age = 23 + name = "Hildegard" + dynasty_house = house:house_von_bingen + gender_female_chance = 100 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = theologian + trait = zealous + trait = compassionate + trait = eccentric + trait = possessed_1 + trait = lifestyle_mystic + trait = devoted + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = hildegard + hidden_effect = { + add_trait_xp = { + trait = lifestyle_mystic + value = 100 + } + } + set_variable = legendary_author + add_piety = 5000 + create_inspiration = book_inspiration + add_character_flag = ai_will_not_convert + save_scope_as = major + } + if = { limit = { has_variable = hildegard } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Thomas Aquinas + limit = { + current_year >= 1245 + current_year <= 1251 + NOT = { exists = global_var:hchar_thomas_aquinas } + } + set_global_variable = { name = hchar_thomas_aquinas value = yes } + title:b_cassino = { + save_scope_as = birth_location + create_character = { + age = ep3_thomas_aquinas_age_value # This is just a scripted value that takes the current year and subtracts 1225 from it, so if Tommy spawns in 1245 then his age will be calculated as 1245-1225, or 20. + name = "Thomas" + dynasty_house = house:house_aquinas + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = theologian + trait = zealous + trait = compassionate + trait = patient + trait = devoted + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { 20 24 } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = thomas_aquinas + set_variable = legendary_author + add_piety = 5000 + create_inspiration = book_inspiration + add_character_flag = ai_will_not_convert + add_character_flag = no_beard + if = { limit = { has_character_flag = no_beard } } # Error suppression + save_scope_as = major + } + if = { limit = { has_variable = thomas_aquinas } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Dante Alighieri + limit = { + current_year >= 1285 + current_year <= 1291 + NOT = { exists = global_var:hchar_dante_alighieri } + } + set_global_variable = { name = hchar_dante_alighieri value = yes } + title:b_firenze = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Dante" + dynasty_house = house:house_alighieri + gender_female_chance = 0 + random_traits = yes + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_diplomacy_4 + trait = lifestyle_poet + trait = irritable + trait = ambitious + diplomacy = { 16 20 } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = dante_alighieri + set_variable = legendary_author + create_inspiration = book_inspiration + add_character_flag = no_beard + save_scope_as = major + } + if = { limit = { has_variable = dante_alighieri } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Thomas Becket + limit = { + current_year >= 1149 + current_year <= 1155 + NOT = { exists = global_var:hchar_thomas_becket } + } + set_global_variable = { name = hchar_thomas_becket value = yes } + title:b_london = { + save_scope_as = birth_location + create_character = { + age = 30 + name = "Thomas" + dynasty_house = house:house_becket + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_diplomacy_3 + trait = zealous + trait = stubborn + trait = brave + trait = theologian + trait = devoted + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_low_skill max_template_low_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = thomas_becket + set_variable = legendary_author + add_piety = 5000 + create_inspiration = book_inspiration + save_scope_as = major + } + if = { limit = { has_variable = thomas_becket } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Maimonides (Moses ben Maimon) + limit = { + current_year >= 1155 + current_year <= 1161 + NOT = { exists = global_var:hchar_maimonides } + } + set_global_variable = { name = hchar_maimonides value = yes } + title:b_cordoba = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Moses" + dynasty_house = house:house_maimon + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:rabbinism + culture = culture:sephardi + trait = education_learning_5 + trait = zealous + trait = humble + trait = diligent + trait = scholar + trait = lifestyle_physician + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = maimonides + set_variable = legendary_author + give_nickname = nick_maimonides + add_piety = 10000 + create_inspiration = book_inspiration + hidden_effect = { + add_trait_xp = { + trait = lifestyle_physician + value = 100 + } + } + save_scope_as = major + } + if = { limit = { has_variable = maimonides } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Chrétien de Troyes + limit = { + current_year >= 1150 + current_year <= 1156 + NOT = { exists = global_var:hchar_chretien_de_troyes } + } + set_global_variable = { name = hchar_chretien_de_troyes value = yes } + title:b_troyes = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Chretien" + dynasty_house = house:house_de_troyes + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_diplomacy_3 + trait = lifestyle_poet + trait = gregarious + trait = diligent + trait = brave + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = chretien_de_troyes + } + if = { limit = { has_variable = chretien_de_troyes } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Egil Skallagrímsson + limit = { + current_year >= 930 + current_year <= 936 + NOT = { exists = global_var:hchar_egil_skallagrimrsson } + } + set_global_variable = { name = hchar_egil_skallagrimrsson value = yes } + title:b_olafsvik = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Egil" + dynasty_house = house:house_skallagrimsson + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_diplomacy_2 + trait = lifestyle_poet + trait = gregarious + trait = wrathful + trait = brave + trait = berserker + trait = viking + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_high_skill max_template_high_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_high_skill max_template_high_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = egil_skallagrimrsson + save_scope_as = major + change_current_weight = 75 + } + if = { limit = { has_variable = egil_skallagrimrsson } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Gunnlaug Ormstunga + limit = { + current_year >= 1000 + current_year <= 1006 + NOT = { exists = global_var:hchar_gunnlaug_ormstunga } + } + set_global_variable = { name = hchar_gunnlaug_ormstunga value = yes } + title:b_reykjavik = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Gunnlaug" + dynasty_house = house:house_ormstunga + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_diplomacy_2 + trait = lifestyle_poet + trait = deceitful + trait = lustful + trait = ambitious + trait = viking + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_high_skill max_template_high_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_high_skill max_template_high_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + save_scope_as = explorer + historical_character_finalization_effect = yes + set_variable = gunnlaug_ormstunga + } + if = { limit = { has_variable = gunnlaug_ormstunga } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Þorbjörg the Seeress + limit = { + current_year >= 970 + current_year <= 976 + NOT = { exists = global_var:hchar_torbjorg_the_seeress } + } + set_global_variable = { name = hchar_torbjorg_the_seeress value = yes } + title:b_reydarfjall= { + save_scope_as = birth_location + create_character = { + age = 20 + name = "T_orbjO_rg" + dynasty = none + gender_female_chance = 100 + random_traits = no + location = scope:birth_location.title_province + faith = faith:norse_pagan + culture = scope:birth_location.title_province.culture + trait = education_learning_3 + trait = patient + trait = zealous + trait = humble + trait = lifestyle_mystic + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = torbjorg_the_seeress + hidden_effect = { + add_trait_xp = { + trait = lifestyle_mystic + value = 100 + } + } + give_nickname = nick_the_seeress + add_piety = 5000 + add_character_flag = ai_will_not_convert + } + if = { limit = { has_variable = torbjorg_the_seeress } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Erik Röde + limit = { + current_year >= 972 + current_year <= 978 + NOT = { exists = global_var:hchar_erik_rode } + } + set_global_variable = { name = hchar_erik_rode value = yes } + title:b_oslosyslar = { + save_scope_as = birth_location + create_character = { + age = 22 + name = "Erik" + dynasty_house = house:house_rode + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_martial_3 + trait = ambitious + trait = brave + trait = diligent + trait = viking + trait = organizer + trait = lifestyle_traveler + trait = adventurer + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_high_skill max_template_high_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_high_skill max_template_high_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = erik_rode + save_scope_as = major + save_scope_as = explorer + add_trait_xp = { + trait = lifestyle_traveler + track = travel + value = 100 + } + add_trait_xp = { + trait = lifestyle_traveler + track = danger + value = 100 + } + if = { + limit = { + has_ep1_dlc_trigger = yes + } + create_inspiration = adventure_inspiration + } + } + if = { limit = { has_variable = erik_rode } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Ibn al-Haytham (Alhazen) + limit = { + current_year >= 985 + current_year <= 991 + NOT = { exists = global_var:hchar_alhazen } + } + set_global_variable = { name = hchar_alhazen value = yes } + title:b_basra = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Hasan" + dynasty_house = house:house_al_haytham + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_intrigue_5 + trait = patient + trait = diligent + trait = shy + trait = scholar + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + give_nickname = nick_alhazen + set_variable = alhazen + add_character_flag = has_reading_glasses + create_inspiration = book_inspiration + } + if = { limit = { has_variable = alhazen } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Ibn Battuta + limit = { + current_year >= 1322 + current_year <= 1328 + NOT = { exists = global_var:hchar_ibn_battuta } + } + set_global_variable = { name = hchar_ibn_battuta value = yes } + title:b_tangiers = { + save_scope_as = birth_location + create_character = { + age = 18 + name = "Muhammad" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_diplomacy_4 + trait = gregarious + trait = diligent + trait = impatient + trait = pilgrim + trait = lifestyle_traveler + trait = journaller + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_decent_skill max_template_decent_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = ibn_battuta + give_nickname = nick_ibn_battuta + save_scope_as = explorer + if = { + limit = { + has_ep1_dlc_trigger = yes + } + create_inspiration = adventure_inspiration + } + save_scope_as = major + add_trait_xp = { + trait = lifestyle_traveler + track = travel + value = 100 + } + add_trait_xp = { + trait = lifestyle_traveler + track = danger + value = 100 + } + } + if = { limit = { has_variable = ibn_battuta } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # William of Ockham + limit = { + current_year >= 1307 + current_year <= 1313 + NOT = { exists = global_var:hchar_william_of_ockham } + } + set_global_variable = { name = hchar_william_of_ockham value = yes } + title:b_basingstoke = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "William" + dynasty_house = house:house_of_ockham + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = cynical + trait = diligent + trait = humble + trait = stubborn + trait = scholar + trait = devoted + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_low_skill max_template_low_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = william_of_ockham + save_scope_as = major + add_piety = 5000 + } + if = { limit = { has_variable = william_of_ockham } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Geoffrey Chaucer + limit = { + current_year >= 1363 + current_year <= 1369 + NOT = { exists = global_var:hchar_geoffrey_chaucer } + } + set_global_variable = { name = hchar_geoffrey_chaucer value = yes } + title:b_london = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Geoffrey" + dynasty_house = house:house_chaucer + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_diplomacy_3 + trait = gregarious + trait = lustful + trait = diligent + trait = pilgrim + trait = lifestyle_poet + trait = journaller + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_low_skill max_template_low_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = geoffrey_chaucer + save_scope_as = major + set_variable = legendary_author + create_inspiration = book_inspiration + } + if = { limit = { has_variable = geoffrey_chaucer } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Roger Bacon + limit = { + current_year >= 1239 + current_year <= 1245 + NOT = { exists = global_var:hchar_roger_bacon } + } + set_global_variable = { name = hchar_roger_bacon value = yes } + title:b_ilchester = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Roger" + dynasty_house = house:house_bacon + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = shy + trait = diligent + trait = stubborn + trait = devoted + trait = lifestyle_mystic + trait = scholar + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_low_skill max_template_low_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = roger_bacon + save_scope_as = major + add_piety = 5000 + create_inspiration = book_inspiration + } + if = { limit = { has_variable = roger_bacon } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Aaron of Lincoln + limit = { + current_year >= 1145 + current_year <= 1151 + NOT = { exists = global_var:hchar_aaron_of_lincoln } + } + set_global_variable = { name = hchar_aaron_of_lincoln value = yes } + title:b_lincoln = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Aaron" + dynasty_house = house:house_of_lincoln + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:rabbinism + culture = scope:birth_location.title_province.culture + trait = education_stewardship_5 + trait = generous + trait = ambitious + trait = temperate + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_low_skill max_template_low_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = aaron_of_lincoln + add_gold = 1500 + } + if = { limit = { has_variable = aaron_of_lincoln } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # John Wycliffe + limit = { + current_year >= 1340 + current_year <= 1346 + NOT = { exists = global_var:hchar_john_wycliffe } + } + set_global_variable = { name = hchar_john_wycliffe value = yes } + title:b_yarlestre = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "John" + dynasty_house = house:house_wycliffe + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:lollard + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = zealous + trait = brave + trait = stubborn + trait = theologian + trait = devoted + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_low_skill max_template_low_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = john_wycliffe + save_scope_as = major + create_inspiration = religious_inspiration + add_character_flag = ai_will_not_convert + add_piety = 5000 + add_character_modifier = { + modifier = vow_of_poverty_modifier + } + } + if = { limit = { has_variable = john_wycliffe } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Héloïse d'Argenteuil & Peter Abelard + limit = { + current_year >= 1110 + current_year <= 1116 + NOT = { exists = global_var:hchar_heloise_and_abelard } + } + set_global_variable = { name = hchar_heloise_and_abelard value = yes } + title:b_rais = { + save_scope_as = birth_location + create_character = { + age = 31 + name = "Peter" + dynasty_house = house:house_abelard + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:catholic + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = lustful + trait = ambitious + trait = stubborn + trait = scholar + trait = devoted + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_low_skill max_template_low_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character_2 + } + scope:historical_character_2 ?= { + add_trait = historical_character + set_sexuality = heterosexual + set_variable = peter_abelard + save_scope_as = major + add_piety = 2500 + house ?= { + generate_coa = yes + } + dynasty ?= { + set_coa = scope:historical_character_2.house + } + set_variable = { + name = show_historical_gui + value = 1 + } + } + if = { limit = { has_variable = peter_abelard } } # Error suppression + } + title:b_paris = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "HE_loise" + dynasty_house = house:house_dargenteuil + gender_female_chance = 100 + random_traits = no + location = scope:birth_location.title_province + faith = faith:catholic + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = compassionate + trait = lustful + trait = diligent + trait = scholar + trait = lifestyle_poet + trait = devoted + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_low_skill max_template_low_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_sexuality = heterosexual + set_variable = heloise_dargenteuil + save_scope_as = major + add_piety = 2500 + set_random_lover_reason = { TARGET = scope:historical_character_2 } + } + scope:historical_character_2 = { + set_location = scope:historical_character.location + } + if = { limit = { has_variable = heloise_dargenteuil } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Petrarch (Francesco Petrarca) + limit = { + current_year >= 1324 + current_year <= 1344 + NOT = { exists = global_var:hchar_petrarch } + } + set_global_variable = { name = hchar_petrarch value = yes } + title:b_arezzo = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Francesco" + dynasty_house = house:house_petrarca + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_diplomacy_4 + trait = ambitious + trait = gregarious + trait = diligent + trait = lifestyle_poet + trait = scholar + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + give_nickname = nick_petrarch + set_variable = petrarch + save_scope_as = major + create_inspiration = book_inspiration + } + if = { limit = { has_variable = petrarch } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Giotto di Bondone + limit = { + current_year >= 1287 + current_year <= 1293 + NOT = { exists = global_var:hchar_giotto_di_bondone } + } + set_global_variable = { name = hchar_giotto_di_bondone value = yes } + title:b_firenze = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Giotto" + dynasty_house = house:house_bondone + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_3 + trait = patient + trait = diligent + trait = humble + trait = architect + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = giotto_di_bondone + save_scope_as = major + create_inspiration = book_inspiration + } + if = { limit = { has_variable = giotto_di_bondone } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Leonardo Fibonacci + limit = { + current_year >= 1190 + current_year <= 1196 + NOT = { exists = global_var:hchar_fibonacci } + } + set_global_variable = { name = hchar_fibonacci value = yes } + title:b_pisa = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Leonardo" + dynasty_house = house:house_fibonacci + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = patient + trait = diligent + trait = humble + trait = administrator + trait = scholar + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = fibonacci + save_scope_as = major + create_inspiration = book_inspiration + } + if = { limit = { has_variable = fibonacci } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Giovanni Boccaccio + limit = { + current_year >= 1333 + current_year <= 1339 + NOT = { exists = global_var:hchar_giovanni_boccaccio } + } + set_global_variable = { name = hchar_giovanni_boccaccio value = yes } + title:b_firenze = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Giovanni" + dynasty_house = house:house_boccaccio + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_diplomacy_3 + trait = gregarious + trait = diligent + trait = lustful + trait = lifestyle_poet + trait = journaller + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = giovanni_boccaccio + save_scope_as = major + create_inspiration = book_inspiration + } + if = { limit = { has_variable = giovanni_boccaccio } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Christine de Pizan + limit = { + current_year >= 1384 + current_year <= 1390 + NOT = { exists = global_var:hchar_christine_pizan } + } + set_global_variable = { name = hchar_christine_pizan value = yes } + title:b_venezia = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Christine" + dynasty_house = house:house_de_pizan + gender_female_chance = 100 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = title:b_paris.title_province.culture + trait = education_diplomacy_3 + trait = brave + trait = diligent + trait = compassionate + trait = lifestyle_poet + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = christine_pizan + save_scope_as = major + create_inspiration = book_inspiration + } + if = { limit = { has_variable = christine_pizan } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Snorri Sturluson + limit = { + current_year >= 1199 + current_year <= 1205 + NOT = { exists = global_var:hchar_snorri_sturluson } + } + set_global_variable = { name = hchar_snorri_sturluson value = yes } + title:b_reykjavik = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Snorri" + dynasty_house = house:house_sturluson + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_3 + trait = ambitious + trait = diligent + trait = gregarious + trait = lifestyle_poet + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = snorri_sturluson + save_scope_as = major + create_inspiration = book_inspiration + } + if = { limit = { has_variable = snorri_sturluson } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Hrotsvitha + limit = { + current_year >= 955 + current_year <= 961 + NOT = { exists = global_var:hchar_hrotsvitha } + } + set_global_variable = { name = hchar_hrotsvitha value = yes } + title:b_hildesheim = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Hrotsvitha" + dynasty = none + gender_female_chance = 100 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_3 + trait = brave + trait = ambitious + trait = zealous + trait = lifestyle_poet + trait = devoted + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = hrotsvitha + } + if = { limit = { has_variable = hrotsvitha } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Ramanuja + limit = { + current_year >= 1037 + current_year <= 1043 + NOT = { exists = global_var:hchar_ramanuja } + } + set_global_variable = { name = hchar_ramanuja value = yes } + title:b_kanchipuram = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Ramanuja" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = zealous + trait = diligent + trait = forgiving + trait = theologian + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = ramanuja + save_scope_as = major + add_piety = 5000 + create_inspiration = religious_inspiration + } + if = { limit = { has_variable = ramanuja } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Arnaldus de Villa Nova + limit = { + current_year >= 1260 + current_year <= 1266 + NOT = { exists = global_var:hchar_arnaldus_de_villa_nova } + } + set_global_variable = { name = hchar_arnaldus_de_villa_nova value = yes } + title:b_valencia = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Arnaldus" + dynasty_house = house:house_de_villa_nova + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = title:b_barcelona.title_province.faith + culture = title:b_barcelona.title_province.culture + trait = education_learning_4 + trait = cynical + trait = diligent + trait = calm + trait = lifestyle_physician + trait = scholar + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = arnaldus_de_villa_nova + hidden_effect = { + add_trait_xp = { + trait = lifestyle_physician + value = 100 + } + } + } + if = { limit = { has_variable = arnaldus_de_villa_nova } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Ibn Khaldun + limit = { + current_year >= 1352 + current_year <= 1358 + NOT = { exists = global_var:hchar_ibn_khaldun } + } + set_global_variable = { name = hchar_ibn_khaldun value = yes } + title:b_tunis = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Abd-ar-Rahman" + dynasty_house = house:house_khalduni + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = patient + trait = diligent + trait = generous + trait = journaller + trait = scholar + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + save_scope_as = major + set_variable = ibn_khaldun + set_variable = legendary_author + create_inspiration = book_inspiration + } + if = { limit = { has_variable = ibn_khaldun } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Jalaluddin Rumi + limit = { + current_year >= 1227 + current_year <= 1233 + NOT = { exists = global_var:hchar_rumi } + } + set_global_variable = { name = hchar_rumi value = yes } + title:b_ikonion = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Jalaluddin" + dynasty_house = house:house_rumi + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = title:b_balkh.title_province.faith + culture = title:b_balkh.title_province.culture + trait = education_learning_4 + trait = compassionate + trait = diligent + trait = generous + trait = lifestyle_poet + trait = theologian + trait = lifestyle_mystic + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + save_scope_as = major + set_variable = rumi + set_variable = legendary_author + create_inspiration = book_inspiration + hidden_effect = { + add_trait_xp = { + trait = lifestyle_mystic + value = 100 + } + } + } + if = { limit = { has_variable = rumi } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Avicenna + limit = { + current_year >= 1000 + current_year <= 1006 + NOT = { exists = global_var:hchar_avicenna } + } + set_global_variable = { name = hchar_avicenna value = yes } + title:b_bukhara = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Hussein" + dynasty_house = house:house_sina + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = compassionate + trait = diligent + trait = patient + trait = shrewd + trait = scholar + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + save_scope_as = major + set_variable = avicenna + give_nickname = nick_avicenna + set_variable = legendary_author + create_inspiration = book_inspiration + } + if = { limit = { has_variable = avicenna } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Averroes + limit = { + current_year >= 1146 + current_year <= 1152 + NOT = { exists = global_var:hchar_averroes } + } + set_global_variable = { name = hchar_averroes value = yes } + title:b_cordoba = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Abu_al-Walid" + dynasty_house = house:house_rushdi + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = just + trait = diligent + trait = patient + trait = shrewd + trait = scholar + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + save_scope_as = major + set_variable = averroes + give_nickname = nick_averroes + set_variable = legendary_author + create_inspiration = book_inspiration + } + if = { limit = { has_variable = averroes } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Al-Biruni + limit = { + current_year >= 993 + current_year <= 999 + NOT = { exists = global_var:hchar_al_biruni } + } + set_global_variable = { name = hchar_al_biruni value = yes } + title:b_kath = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Abu_Rayhan" + dynasty_house = house:house_biruni + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = patient + trait = diligent + trait = humble + trait = scholar + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + save_scope_as = major + set_variable = al_biruni + set_variable = legendary_author + create_inspiration = book_inspiration + } + if = { limit = { has_variable = al_biruni } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Rashi (Shlomo Yitzchaki) + limit = { + current_year >= 1066 + current_year <= 1072 + NOT = { exists = global_var:hchar_rashi } + } + set_global_variable = { name = hchar_rashi value = yes } + title:b_troyes = { + save_scope_as = birth_location + create_character = { + age = 26 + name = "Shlomo" + dynasty_house = house:house_yitzchaki + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:rabbinism + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = patient + trait = humble + trait = just + trait = scholar + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = rashi + give_nickname = nick_rashi + add_piety = 10000 + create_inspiration = book_inspiration + add_character_flag = ai_will_not_convert + save_scope_as = major + } + if = { limit = { has_variable = rashi } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Yehuda Halevi + limit = { + current_year >= 1095 + current_year <= 1101 + NOT = { exists = global_var:hchar_yehuda_halevi } + } + set_global_variable = { name = hchar_yehuda_halevi value = yes } + title:b_toledo = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Yehuda" + dynasty_house = house:house_halevi + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:rabbinism + culture = culture:sephardi + trait = education_diplomacy_3 + trait = zealous + trait = gregarious + trait = content + trait = lifestyle_poet + trait = lifestyle_mystic + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = yehuda_halevi + create_inspiration = book_inspiration + add_character_flag = ai_will_not_convert + } + if = { limit = { has_variable = yehuda_halevi } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Hasdai ibn Shaprut + limit = { + current_year >= 935 + current_year <= 941 + NOT = { exists = global_var:hchar_shaprut } + } + set_global_variable = { name = hchar_shaprut value = yes } + title:b_jaen = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Hasdai" + dynasty_house = house:house_shaprut + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:rabbinism + culture = culture:sephardi + trait = education_learning_5 + trait = patient + trait = just + trait = diligent + trait = scholar + trait = lifestyle_physician + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = shaprut + create_inspiration = book_inspiration + add_character_flag = ai_will_not_convert + } + if = { limit = { has_variable = shaprut } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Levi ben Gershon (Gersonides) + limit = { + current_year >= 1308 + current_year <= 1314 + NOT = { exists = global_var:hchar_gersonides } + } + set_global_variable = { name = hchar_gersonides value = yes } + title:b_montlaur = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Levi" + dynasty_house = house:house_gershon + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:rabbinism + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = diligent + trait = patient + trait = cynical + trait = shrewd + trait = scholar + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = gersonides + give_nickname = nick_gersonides + create_inspiration = book_inspiration + add_character_flag = ai_will_not_convert + } + if = { limit = { has_variable = gersonides } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Abraham ibn Ezra + limit = { + current_year >= 1109 + current_year <= 1115 + NOT = { exists = global_var:hchar_ezra } + } + set_global_variable = { name = hchar_ezra value = yes } + title:b_tudela = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Abraham" + dynasty_house = house:house_ezra + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:rabbinism + culture = culture:sephardi + trait = education_learning_5 + trait = patient + trait = humble + trait = brave + trait = scholar + trait = adventurer + trait = lifestyle_mystic + trait = lifestyle_traveler + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + save_scope_as = explorer + historical_character_finalization_effect = yes + set_variable = ezra + create_inspiration = book_inspiration + add_character_flag = ai_will_not_convert + } + if = { limit = { has_variable = ezra } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Solomon ibn Gabirol + limit = { + current_year >= 1041 + current_year <= 1047 + NOT = { exists = global_var:hchar_gabriol } + } + set_global_variable = { name = hchar_gabriol value = yes } + title:b_malaga = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Solomon" + dynasty_house = house:house_gabirol + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:rabbinism + culture = culture:sephardi + trait = education_diplomacy_3 + trait = humble + trait = diligent + trait = content + trait = reclusive + trait = lifestyle_poet + trait = weak + trait = lifestyle_mystic + trait = irritable + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = gabriol + create_inspiration = book_inspiration + add_character_flag = ai_will_not_convert + } + if = { limit = { has_variable = gabriol } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Nachmanides (Moses ben Nahman) + limit = { + current_year >= 1214 + current_year <= 1220 + NOT = { exists = global_var:hchar_nachmanides} + } + set_global_variable = { name = hchar_nachmanides value = yes } + title:b_girona = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Moses" + dynasty_house = house:house_nahman + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:rabbinism + culture = culture:sephardi + trait = education_learning_4 + trait = zealous + trait = brave + trait = just + trait = theologian + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = nachmanides + give_nickname = nick_nachmanides + create_inspiration = book_inspiration + add_piety = 10000 + add_character_flag = ai_will_not_convert + } + if = { limit = { has_variable = nachmanides } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Hasdai Crescas + limit = { + current_year >= 1360 + current_year <= 1366 + NOT = { exists = global_var:hchar_crescas } + } + set_global_variable = { name = hchar_crescas value = yes } + title:b_barcelona = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Hasdai" + dynasty_house = house:house_crescas + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:rabbinism + culture = culture:sephardi + trait = education_learning_5 + trait = just + trait = diligent + trait = patient + trait = scholar + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = crescas + create_inspiration = book_inspiration + add_character_flag = ai_will_not_convert + } + if = { limit = { has_variable = crescas } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Saadia Gaon + limit = { + current_year >= 902 + current_year <= 908 + NOT = { exists = global_var:hchar_saadia } + } + set_global_variable = { name = hchar_saadia value = yes } + title:b_al-fayyum = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Saadia" + dynasty_house = house:house_gaon + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:rabbinism + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = diligent + trait = just + trait = zealous + trait = scholar + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = saadia + create_inspiration = book_inspiration + add_character_flag = ai_will_not_convert + } + if = { limit = { has_variable = saadia } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Yusuf ibn 'Awkal + limit = { + current_year >= 990 + current_year <= 996 + NOT = { exists = global_var:hchar_awkal } + } + set_global_variable = { name = hchar_awkal value = yes } + title:b_cairo = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Yusuf" + dynasty_house = house:house_awkal + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:rabbinism + culture = scope:birth_location.title_province.culture + trait = education_stewardship_5 + trait = impatient + trait = gregarious + trait = temperate + trait = lifestyle_traveler + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + save_scope_as = explorer + historical_character_finalization_effect = yes + set_variable = awkal + create_inspiration = book_inspiration + add_character_flag = ai_will_not_convert + } + if = { limit = { has_variable = awkal } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Benjamin of Tudela + limit = { + current_year >= 1150 + current_year <= 1156 + NOT = { exists = global_var:hchar_benjamin_of_tudela } + } + set_global_variable = { name = hchar_benjamin_of_tudela value = yes } + title:b_tudela = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Benjamin" + dynasty_house = house:house_tudela + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:rabbinism + culture = culture:sephardi + trait = education_diplomacy_3 + trait = diligent + trait = fickle + trait = brave + trait = journaller + trait = lifestyle_traveler + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + save_scope_as = explorer + historical_character_finalization_effect = yes + set_variable = benjamin_of_tudela + create_inspiration = book_inspiration + add_character_flag = ai_will_not_convert + } + if = { limit = { has_variable = benjamin_of_tudela } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Marco Polo + limit = { + current_year >= 1270 + current_year <= 1276 + NOT = { exists = global_var:hchar_marco_polo } + } + set_global_variable = { name = hchar_marco_polo value = yes } + title:b_venezia = { + save_scope_as = birth_location + create_character = { + age = 22 + name = "Marco" + dynasty_house = house:house_polo + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_stewardship_5 + trait = ambitious + trait = brave + trait = gregarious + trait = organizer + trait = lifestyle_traveler + trait = adventurer + trait = journaller + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_high_skill max_template_high_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_high_skill max_template_high_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = marco_polo + save_scope_as = major + save_scope_as = explorer + add_trait_xp = { + trait = lifestyle_traveler + track = travel + value = 100 + } + add_trait_xp = { + trait = lifestyle_traveler + track = danger + value = 100 + } + if = { + limit = { + has_ep1_dlc_trigger = yes + } + create_inspiration = adventure_inspiration + } + } + if = { limit = { has_variable = marco_polo } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Bridget of Sweden + limit = { + current_year >= 1323 + current_year <= 1329 + NOT = { exists = global_var:hchar_bridget_of_sweden } + } + set_global_variable = { name = hchar_bridget_of_sweden value = yes } + title:b_sigtuna = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Birgitta" + dynasty = none + gender_female_chance = 100 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_diplomacy_3 + trait = zealous + trait = humble + trait = compassionate + trait = possessed_1 + trait = devoted + trait = lifestyle_mystic + trait = pilgrim + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = bridget_of_sweden + save_scope_as = major + give_nickname = nick_heliga + create_inspiration = religious_inspiration + hidden_effect = { + add_trait_xp = { + trait = lifestyle_mystic + value = 100 + } + } + add_piety = 5000 + add_character_flag = ai_will_not_convert + } + if = { limit = { has_variable = bridget_of_sweden } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Johannes Eckhart (Meister Eckhart) + limit = { + current_year >= 1280 + current_year <= 1286 + NOT = { exists = global_var:hchar_meister_eckhart } + } + set_global_variable = { name = hchar_meister_eckhart value = yes } + title:b_schmalkalden = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Johannes" + dynasty_house = house:house_eckhart + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = zealous + trait = patient + trait = humble + trait = lifestyle_mystic + trait = devoted + trait = theologian + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_low_skill max_template_low_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = meister_eckhart + give_nickname = nick_meister + add_piety = 5000 + create_inspiration = book_inspiration + save_scope_as = major + hidden_effect = { + add_trait_xp = { + trait = lifestyle_mystic + value = 100 + } + } + } + if = { limit = { has_variable = meister_eckhart } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Jangar + limit = { + current_year >= 1100 + current_year <= 1106 + NOT = { exists = global_var:hchar_jangar } + } + set_global_variable = { name = hchar_jangar value = yes } + title:b_darkhad = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Jangar" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_martial_5 + trait = brave + trait = just + trait = ambitious + trait = strong + trait = athletic + trait = shrewd + trait = legend + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_high_skill max_template_high_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_high_skill max_template_high_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = jangar + change_current_weight = 50 + give_nickname = nick_the_wild + save_scope_as = major + add_character_flag = need_military_outfit + } + if = { limit = { has_variable = jangar } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Zawisza Czarny + limit = { + current_year >= 1390 + current_year <= 1396 + NOT = { exists = global_var:hchar_zawisza } + } + set_global_variable = { name = hchar_zawisza value = yes } + title:b_sandomierz = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Zawisza" + dynasty_house = house:house_czarny + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_diplomacy_5 + trait = brave + trait = gregarious + trait = ambitious + trait = strong + trait = legend + trait = gallant + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_high_skill max_template_high_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_high_skill max_template_high_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = zawisza + give_nickname = nick_the_black + save_scope_as = major + } + if = { limit = { has_variable = zawisza } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Theophanes the Greek + limit = { + current_year >= 1360 + current_year <= 1366 + NOT = { exists = global_var:hchar_theophanes_the_greek } + } + set_global_variable = { name = hchar_theophanes_the_greek value = yes } + title:b_moskva = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Theophanes" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = title:b_constantinople.title_province.faith + culture = title:b_constantinople.title_province.culture + trait = education_learning_2 + trait = patient + trait = diligent + trait = humble + trait = lifestyle_mystic + trait = architect + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_decent_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_decent_skill max_template_decent_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = theophanes_the_greek + give_nickname = nick_the_greek + } + if = { limit = { has_variable = theophanes_the_greek } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Nicetas Choniates + limit = { + current_year >= 1175 + current_year <= 1181 + NOT = { exists = global_var:hchar_nicetas_choniates } + } + set_global_variable = { name = hchar_nicetas_choniates value = yes } + title:b_chonae = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Nicetas" + dynasty_house = house:house_choniates + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = patient + trait = diligent + trait = just + trait = scholar + trait = journaller + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_decent_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = nicetas_choniates + save_scope_as = major + create_inspiration = book_inspiration + } + if = { limit = { has_variable = nicetas_choniates } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Michael Psellos + limit = { + current_year >= 1037 + current_year <= 1067 + NOT = { exists = global_var:hchar_michael_psellos } + } + set_global_variable = { name = hchar_michael_psellos value = yes } + if = { + limit = { + game_start_date >= 1066.1.1 + game_start_date < 1178.10.1 + } + title:b_constantinople = { + save_scope_as = birth_location + create_character = { + age = 49 + name = "Michael" + dynasty_house = house:house_psellos + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_3 + trait = arrogant + trait = fickle + trait = cynical + trait = devoted + trait = scholar + trait = lifestyle_poet + trait = stuttering + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_decent_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = michael_psellos + set_variable = alternative_origin_courtier + save_scope_as = major + create_inspiration = book_inspiration + give_nickname = nick_the_stammerer + } + if = { limit = { has_variable = michael_psellos } } # Error suppression + if = { limit = { has_variable = alternative_origin_courtier } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + else = { + title:b_constantinople = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Michael" + dynasty_house = house:house_psellos + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_3 + trait = arrogant + trait = fickle + trait = cynical + trait = devoted + trait = scholar + trait = lifestyle_poet + trait = stuttering + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_decent_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = michael_psellos + save_scope_as = major + create_inspiration = book_inspiration + give_nickname = nick_the_stammerer + } + if = { limit = { has_variable = michael_psellos } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + } + if = { # John Tzetzes + limit = { + current_year >= 1130 + current_year <= 1136 + NOT = { exists = global_var:hchar_john_tzetzes } + } + set_global_variable = { name = hchar_john_tzetzes value = yes } + title:b_constantinople = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "John" + dynasty_house = house:house_tzetzes + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = stubborn + trait = diligent + trait = shy + trait = scholar + trait = lifestyle_poet + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_decent_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = john_tzetzes + create_inspiration = book_inspiration + } + if = { limit = { has_variable = john_tzetzes } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Theophylact of Ohrid + limit = { + current_year >= 1075 + current_year <= 1081 + NOT = { exists = global_var:hchar_theophylact_of_ohrid } + } + set_global_variable = { name = hchar_theophylact_of_ohrid value = yes } + title:b_chalkis = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Theophylact" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = zealous + trait = diligent + trait = patient + trait = scholar + trait = theologian + trait = devoted + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_decent_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = theophylact_of_ohrid + give_nickname = nick_of_ohrid + create_inspiration = book_inspiration + } + if = { limit = { has_variable = theophylact_of_ohrid } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Eustathius of Thessalonica + limit = { + current_year >= 1125 + current_year <= 1131 + NOT = { exists = global_var:hchar_eustathius_of_thessalonica } + } + set_global_variable = { name = hchar_eustathius_of_thessalonica value = yes } + title:b_thessaloniki = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Eustathius" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = humble + trait = diligent + trait = patient + trait = scholar + trait = theologian + trait = devoted + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_decent_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = eustathius_of_thessalonica + give_nickname = nick_of_thessalonica + create_inspiration = book_inspiration + } + if = { limit = { has_variable = eustathius_of_thessalonica } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Nicephorus Blemmydes + limit = { + current_year >= 1217 + current_year <= 1223 + NOT = { exists = global_var:hchar_nicephorus_blemmydes } + } + set_global_variable = { name = hchar_nicephorus_blemmydes value = yes } + title:b_constantinople = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Nicephorus" + dynasty_house = house:house_blemmydes + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = humble + trait = diligent + trait = zealous + trait = scholar + trait = theologian + trait = devoted + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = nicephorus_blemmydes + create_inspiration = book_inspiration + } + if = { limit = { has_variable = nicephorus_blemmydes } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Georgius Pachymeres + limit = { + current_year >= 1262 + current_year <= 1268 + NOT = { exists = global_var:hchar_georgius_pachymeres } + } + set_global_variable = { name = hchar_georgius_pachymeres value = yes } + title:b_nikaea = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Georgius" + dynasty_house = house:house_pachymeres + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = arrogant + trait = diligent + trait = patient + trait = scholar + trait = journaller + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_decent_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = georgius_pachymeres + create_inspiration = book_inspiration + } + if = { limit = { has_variable = georgius_pachymeres } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Manuel Moschopoulos + limit = { + current_year >= 1285 + current_year <= 1291 + NOT = { exists = global_var:hchar_manuel_moschopoulos } + } + set_global_variable = { name = hchar_manuel_moschopoulos value = yes } + title:b_constantinople = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Manuel" + dynasty_house = house:house_moschopoulos + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = patient + trait = diligent + trait = shy + trait = scholar + trait = journaller + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = manuel_moschopoulos + create_inspiration = book_inspiration + } + if = { limit = { has_variable = manuel_moschopoulos } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Theodore Metochites + limit = { + current_year >= 1290 + current_year <= 1296 + NOT = { exists = global_var:hchar_theodore_metochites } + } + set_global_variable = { name = hchar_theodore_metochites value = yes } + title:b_constantinople = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Theodore" + dynasty_house = house:house_metochites + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_stewardship_5 + trait = ambitious + trait = diligent + trait = stubborn + trait = scholar + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = theodore_metochites + add_gold = 1000 + } + if = { limit = { has_variable = theodore_metochites } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Michael Choniates + limit = { + current_year >= 1160 + current_year <= 1166 + NOT = { exists = global_var:hchar_michael_choniates } + } + set_global_variable = { name = hchar_michael_choniates value = yes } + title:b_chonae = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Michael" + dynasty_house = house:house_choniates_2 + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = humble + trait = zealous + trait = stubborn + trait = theologian + trait = devoted + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_decent_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = michael_choniates + } + if = { limit = { has_variable = michael_choniates } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Joseph Tarchaneiotes + limit = { + current_year >= 1063 + current_year <= 1069 + NOT = { exists = global_var:hchar_joseph_tarchaneiotes } + } + set_global_variable = { name = hchar_joseph_tarchaneiotes value = yes } + title:b_constantinople = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Joseph" + dynasty_house = house:house_tarchaneiotes + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_martial_5 + trait = ambitious + trait = just + trait = deceitful + trait = organizer + trait = strategist + trait = strong + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_high_skill max_template_high_skill } + stewardship = { min_template_decent_skill max_template_decent_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_low_skill max_template_low_skill } + prowess = { min_template_high_skill max_template_high_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = joseph_tarchaneiotes + add_gold = 1000 + add_character_flag = need_military_outfit + } + if = { limit = { has_variable = joseph_tarchaneiotes } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Gemistus Pletho + limit = { + current_year >= 1375 + current_year <= 1381 + NOT = { exists = global_var:hchar_gemistus_pletho } + } + set_global_variable = { name = hchar_gemistus_pletho value = yes } + title:b_constantinople = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Gemistus" + dynasty_house = house:house_pletho + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = eccentric + trait = diligent + trait = stubborn + trait = scholar + trait = scholar + trait = intellect_good_2 + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = gemistus_pletho + save_scope_as = major + create_inspiration = book_inspiration + } + if = { limit = { has_variable = gemistus_pletho } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Arethas of Caesarea + limit = { + current_year >= 880 + current_year <= 886 + NOT = { exists = global_var:hchar_arethas_of_caesarea } + } + set_global_variable = { name = hchar_arethas_of_caesarea value = yes } + title:b_patras = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Arethas" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = zealous + trait = diligent + trait = patient + trait = scholar + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_decent_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = arethas_of_caesarea + give_nickname = nick_of_caesarea + create_inspiration = book_inspiration + } + if = { limit = { has_variable = arethas_of_caesarea } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Basil Lekapenos + limit = { + current_year >= 945 + current_year <= 951 + NOT = { exists = global_var:hchar_basil_lekapenos } + } + set_global_variable = { name = hchar_basil_lekapenos value = yes } + title:b_constantinople = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Basil" + dynasty_house = house:house_lekapenos + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_stewardship_5 + trait = ambitious + trait = diligent + trait = patient + trait = beardless_eunuch + trait = bastard + trait = administrator + trait = intellect_good_1 + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_decent_skill max_template_decent_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = basil_lekapenos + change_current_weight = 75 + } + if = { limit = { has_variable = basil_lekapenos } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # John the Orphanotrophos AKA totally who Varys is based on + limit = { + current_year >= 985 + current_year <= 991 + NOT = { exists = global_var:hchar_john_the_orphanotrophos } + } + set_global_variable = { name = hchar_john_the_orphanotrophos value = yes } + title:b_patras = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "John" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_intrigue_5 + trait = ambitious + trait = compassionate + trait = deceitful + trait = schemer + trait = beardless_eunuch + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = john_the_orphanotrophos + give_nickname = nick_the_orphanotrophos + change_current_weight = 125 + add_character_flag = bald_head + add_character_flag = no_hat + if = { limit = { has_character_flag = bald_head } } # Error suppression + } + if = { limit = { has_variable = john_the_orphanotrophos } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Samonas + limit = { + current_year >= 895 + current_year <= 901 + NOT = { exists = global_var:hchar_samonas } + } + set_global_variable = { name = hchar_samonas value = yes } + title:b_samosata = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Samonas" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = title:b_constantinople.title_province.faith + culture = title:b_constantinople.title_province.culture + trait = education_intrigue_5 + trait = gregarious + trait = ambitious + trait = deceitful + trait = schemer + trait = loyal + trait = beardless_eunuch + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_decent_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = samonas + } + if = { limit = { has_variable = samonas } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Peter the Eunuch + limit = { + current_year >= 1020 + current_year <= 1026 + NOT = { exists = global_var:hchar_peter_the_eunuch } + } + set_global_variable = { name = hchar_peter_the_eunuch value = yes } + title:b_constantinople = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Peter" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = title:b_constantinople.title_province.faith + culture = title:b_constantinople.title_province.culture + trait = education_diplomacy_4 + trait = zealous + trait = patient + trait = diligent + trait = lifestyle_mystic + trait = loyal + trait = beardless_eunuch + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_decent_skill max_template_decent_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = peter_the_eunuch + give_nickname = nick_the_eunuch + } + if = { limit = { has_variable = peter_the_eunuch } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Constantine the Paphlagonian + limit = { + current_year >= 867 + current_year <= 873 + NOT = { exists = global_var:hchar_constantine_the_paphlagonian } + } + set_global_variable = { name = hchar_constantine_the_paphlagonian value = yes } + title:b_amastris = { + save_scope_as = birth_location + create_character = { + age = 40 + name = "Constantine" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_stewardship_3 + trait = calm + trait = patient + trait = diligent + trait = loyal + trait = administrator + trait = beardless_eunuch + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_decent_skill max_template_decent_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = constantine_the_paphlagonian + give_nickname = nick_the_paphlagonian + } + if = { limit = { has_variable = constantine_the_paphlagonian } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Peter the Stratopedarches + limit = { + current_year >= 950 + current_year <= 956 + NOT = { exists = global_var:hchar_peter_the_stratopedarches } + } + set_global_variable = { name = hchar_peter_the_stratopedarches value = yes } + title:b_tyana = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Peter" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_martial_5 + trait = calm + trait = patient + trait = brave + trait = loyal + trait = physique_good_3 + trait = strong + trait = strategist + trait = beardless_eunuch + diplomacy = { min_template_low_skill max_template_low_skill } + martial = { min_template_high_skill max_template_high_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_low_skill max_template_low_skill } + prowess = { min_template_high_skill max_template_high_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = peter_the_stratopedarches + give_nickname = nick_the_stratopedarches + save_scope_as = major + } + if = { limit = { has_variable = peter_the_stratopedarches } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Basilios Bessarion + limit = { + current_year >= 1423 + current_year <= 1429 + NOT = { exists = global_var:hchar_basilios_bessarion } + } + set_global_variable = { name = hchar_basilios_bessarion value = yes } + title:b_trebizond = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Basilios" + dynasty_house = house:house_bessarion + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:catholic + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = diligent + trait = patient + trait = cynical + trait = scholar + trait = theologian + trait = diplomat + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = basilios_bessarion + save_scope_as = major + add_character_flag = ai_will_not_convert + } + if = { limit = { has_variable = basilios_bessarion } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Demetrios Kydones + limit = { + current_year >= 1344 + current_year <= 1350 + NOT = { exists = global_var:hchar_demetrios_kydones } + } + set_global_variable = { name = hchar_demetrios_kydones value = yes } + title:b_larissa = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Demetrios" + dynasty_house = house:house_kydones + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_diplomacy_5 + trait = honest + trait = just + trait = forgiving + trait = scholar + trait = theologian + trait = diplomat + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_decent_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = demetrios_kydones + } + if = { limit = { has_variable = demetrios_kydones } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Manuel Holobolos + limit = { + current_year >= 1240 + current_year <= 1246 + NOT = { exists = global_var:hchar_manuel_holobolos } + } + set_global_variable = { name = hchar_manuel_holobolos value = yes } + title:b_constantinople = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Manuel" + dynasty_house = house:house_holobolos + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = craven + trait = humble + trait = gregarious + trait = scholar + trait = disfigured + trait = administrator + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = manuel_holobolos + } + if = { limit = { has_variable = manuel_holobolos } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # John Axuch + limit = { + current_year >= 1107 + current_year <= 1113 + NOT = { exists = global_var:hchar_john_axuch } + } + set_global_variable = { name = hchar_john_axuch value = yes } + title:b_satala = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "John" + dynasty_house = house:house_axuch + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = title:b_constantinople.title_province.faith + culture = title:b_maragha.title_province.culture + trait = education_martial_5 + trait = brave + trait = trusting + trait = content + trait = loyal + trait = strong + trait = strategist + trait = overseer + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_high_skill max_template_high_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_low_skill max_template_low_skill } + prowess = { min_template_high_skill max_template_high_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = john_axuch + save_scope_as = major + add_character_flag = need_military_outfit + learn_language_of_culture = scope:birth_location.title_province.culture + } + if = { limit = { has_variable = john_axuch } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Mkhitar Gosh + limit = { + current_year >= 1150 + current_year <= 1156 + NOT = { exists = global_var:hchar_mkhitar_gosh } + } + set_global_variable = { name = hchar_mkhitar_gosh value = yes } + title:b_kayan = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Mkhitar" + dynasty_house = house:house_gosh + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = zealous + trait = just + trait = diligent + trait = scholar + trait = theologian + trait = administrator + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_decent_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = mkhitar_gosh + create_inspiration = book_inspiration + } + if = { limit = { has_variable = mkhitar_gosh } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Shota Rustaveli + limit = { + current_year >= 1192 + current_year <= 1198 + NOT = { exists = global_var:hchar_shota_rustaveli } + } + set_global_variable = { name = hchar_shota_rustaveli value = yes } + title:b_batumi = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Shota" + dynasty_house = house:house_rustaveli + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_3 + trait = compassionate + trait = humble + trait = diligent + trait = lifestyle_poet + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_decent_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = shota_rustaveli + create_inspiration = book_inspiration + } + if = { limit = { has_variable = shota_rustaveli } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Grigor Tatevatsi + limit = { + current_year >= 1366 + current_year <= 1372 + NOT = { exists = global_var:hchar_grigor_tatevatsi } + } + set_global_variable = { name = hchar_grigor_tatevatsi value = yes } + title:b_kayan = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Grigor" + dynasty_house = house:house_tatevatsi + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = zealous + trait = humble + trait = diligent + trait = theologian + trait = scholar + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_decent_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = grigor_tatevatsi + } + if = { limit = { has_variable = grigor_tatevatsi } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Sargis Pitsak + limit = { + current_year >= 1310 + current_year <= 1316 + NOT = { exists = global_var:hchar_sargis_pitsak } + } + set_global_variable = { name = hchar_sargis_pitsak value = yes } + title:b_tarsus = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Sargis" + dynasty_house = house:house_pitsak + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_2 + trait = patient + trait = calm + trait = diligent + trait = architect + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_decent_skill max_template_decent_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = sargis_pitsak + } + if = { limit = { has_variable = sargis_pitsak } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Averardo de' Medici + limit = { + current_year >= 1336 + current_year <= 1342 + NOT = { exists = global_var:hchar_medici } + } + set_global_variable = { name = hchar_medici value = yes } + title:b_firenze = { + save_scope_as = birth_location + create_character = { + age = 16 + name = "Averardo" + dynasty_house = house:house_medici + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_stewardship_5 + trait = ambitious + trait = greedy + trait = diligent + trait = avaricious + trait = lifestyle_traveler + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_low_skill max_template_low_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = medici + add_gold = 1000 + save_scope_as = major + } + if = { limit = { has_variable = medici } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Alfonso de Borgia + limit = { + current_year >= 1398 + current_year <= 1404 + NOT = { exists = global_var:hchar_borgia } + } + set_global_variable = { name = hchar_borgia value = yes } + title:b_almansa = { + save_scope_as = birth_location + create_character = { + age = 16 + name = "Alfonso" + dynasty_house = house:house_borgia + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_diplomacy_5 + trait = ambitious + trait = greedy + trait = deceitful + trait = diplomat + trait = administrator + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = borgia + save_scope_as = major + } + if = { limit = { has_variable = borgia } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # William Wallace + limit = { + current_year >= 1290 + current_year <= 1296 + NOT = { exists = global_var:hchar_william_wallace } + } + set_global_variable = { name = hchar_william_wallace value = yes } + title:b_glasgow = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "William" + dynasty_house = house:house_wallace + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_martial_5 + trait = brave + trait = stubborn + trait = vengeful + trait = strong + trait = gallant + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_high_skill max_template_high_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_low_skill max_template_low_skill } + prowess = { min_template_high_skill max_template_high_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = william_wallace + save_scope_as = major + add_character_flag = need_military_outfit + } + if = { limit = { has_variable = william_wallace } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # La Hire (Étienne de Vignolles) + limit = { + current_year >= 1406 + current_year <= 1412 + NOT = { exists = global_var:hchar_la_hire } + } + set_global_variable = { name = hchar_la_hire value = yes } + title:b_dax = { + save_scope_as = birth_location + create_character = { + age = 16 + name = "Étienne" + dynasty_house = house:house_vignolles + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_martial_5 + trait = brave + trait = wrathful + trait = patient + trait = strong + trait = gallant + trait = loyal + trait = strategist + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_high_skill max_template_high_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_low_skill max_template_low_skill } + prowess = { min_template_high_skill max_template_high_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = la_hire + give_nickname = nick_la_hire + add_character_flag = need_military_outfit + } + if = { limit = { has_variable = la_hire } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Rabban Bar Sauma + limit = { + current_year >= 1240 + current_year <= 1246 + NOT = { exists = global_var:hchar_bar_sauma } + } + set_global_variable = { name = hchar_bar_sauma value = yes } + title:b_baghdad = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Bar_Sawma" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:nestorian + culture = culture:uyghur + trait = education_diplomacy_4 + trait = diplomat + trait = calm + trait = diligent + trait = patient + trait = devoted + trait = adventurer + trait = lifestyle_traveler + trait = scholar + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = bar_sauma + add_character_flag = ai_will_not_convert + add_trait_xp = { + trait = lifestyle_traveler + track = travel + value = 100 + } + add_trait_xp = { + trait = lifestyle_traveler + track = danger + value = 100 + } + } + if = { limit = { has_variable = bar_sauma } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Nasreddin Hodja + limit = { + current_year >= 1228 + current_year <= 1234 + NOT = { exists = global_var:hchar_hodja } + } + set_global_variable = { name = hchar_hodja value = yes } + title:b_bukhara = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Nasreddin" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_intrigue_5 + trait = eccentric + trait = just + trait = arrogant + trait = shrewd + trait = hajjaj + trait = lifestyle_mystic + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = hodja + give_nickname = nick_the_hodja + hidden_effect = { + add_trait_xp = { + trait = lifestyle_mystic + value = 100 + } + } + } + if = { limit = { has_variable = hodja } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Widukind of Corvey + limit = { + current_year >= 945 + current_year <= 951 + NOT = { exists = global_var:hchar_widukind_of_corvey } + } + set_global_variable = { name = hchar_widukind_of_corvey value = yes } + title:b_everstein = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Widukind" + dynasty_house = house:house_corvey + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = zealous + trait = diligent + trait = humble + trait = lifestyle_mystic + trait = devoted + trait = journaller + trait = lifestyle_poet + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_low_skill max_template_low_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = widukind_of_corvey + create_inspiration = book_inspiration + hidden_effect = { + add_trait_xp = { + trait = lifestyle_mystic + value = 100 + } + } + } + if = { limit = { has_variable = widukind_of_corvey } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Roger de Flor + limit = { + current_year >= 1291 + current_year <= 1296 + NOT = { exists = global_var:hchar_roger_de_flor } + } + set_global_variable = { name = hchar_roger_de_flor value = yes } + title:b_brindisi = { + save_scope_as = birth_location + create_character = { + age = 24 + name = "Roger" + dynasty_house = house:house_flor + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = title:b_roma.title_province.faith + culture = title:b_roma.title_province.culture + trait = education_martial_5 + trait = greedy + trait = ambitious + trait = stubborn + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_high_skill max_template_high_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_low_skill max_template_low_skill } + prowess = { min_template_high_skill max_template_high_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = roger_de_flor + add_gold = 1000 + add_character_modifier = { + modifier = holy_order_experience_modifier + } + add_character_flag = need_military_outfit + } + if = { limit = { has_variable = roger_de_flor } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Regino of Prüm + limit = { + current_year >= 860 + current_year <= 870 + NOT = { exists = global_var:hchar_regino_of_prum } + } + set_global_variable = { name = hchar_regino_of_prum value = yes } + title:b_speyer = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Regino" + dynasty_house = house:house_prum + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_3 + trait = calm + trait = diligent + trait = humble + trait = devoted + trait = journaller + trait = lifestyle_poet + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_low_skill max_template_low_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = regino_of_prum + create_inspiration = book_inspiration + } + if = { limit = { has_variable = regino_of_prum } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + if = { # Geoffrey of Monmouth + limit = { + current_year >= 1120 + current_year <= 1126 + NOT = { exists = global_var:hchar_geoffrey_of_monmouth } + } + set_global_variable = { name = hchar_geoffrey_of_monmouth value = yes } + title:b_monmouth = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Geoffrey" + dynasty_house = house:house_monmouth + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_2 + trait = ambitious + trait = diligent + trait = eccentric + trait = devoted + trait = lifestyle_poet + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_low_skill max_template_low_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = geoffrey_of_monmouth + create_inspiration = book_inspiration + } + if = { limit = { has_variable = geoffrey_of_monmouth } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + # Start of All Under Heaven Characters + + if = { # Nichiren (日蓮) + limit = { + current_year >= 1242 + current_year <= 1248 + NOT = { exists = global_var:hchar_nichiren } + } + set_global_variable = { name = hchar_nichiren value = yes } + title:b_chiba = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Nichiren" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:pundarika + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = zealous + trait = brave + trait = stubborn + trait = devoted + trait = lifestyle_mystic + diplomacy = { min_template_low_skill max_template_low_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_decent_skill max_template_decent_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = nichiren + add_character_flag = ai_will_not_convert + } + if = { limit = { has_variable = nichiren } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Dōgen (道元) + limit = { + current_year >= 1220 + current_year <= 1226 + NOT = { exists = global_var:hchar_dogen } + } + set_global_variable = { name = hchar_dogen value = yes } + title:b_kyo = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "DO_gen" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:dhyana + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = zealous + trait = patient + trait = temperate + trait = devoted + trait = theologian + trait = lifestyle_mystic + diplomacy = { min_template_low_skill max_template_low_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_low_skill max_template_low_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_decent_skill max_template_decent_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = dogen + create_inspiration = religious_inspiration + } + if = { limit = { has_variable = dogen } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Shiren (师仁) + limit = { + current_year >= 1298 + current_year <= 1304 + NOT = { exists = global_var:hchar_kokan_shiren } + } + set_global_variable = { name = hchar_kokan_shiren value = yes } + title:b_kamakura = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Shiren_5E08_4EC1" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:dhyana + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = zealous + trait = humble + trait = patient + trait = devoted + trait = lifestyle_mystic + trait = lifestyle_poet + trait = theologian + diplomacy = { min_template_low_skill max_template_low_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_low_skill max_template_low_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_decent_skill max_template_decent_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = kokan_shiren + create_inspiration = book_inspiration + } + if = { limit = { has_variable = kokan_shiren } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Jeong Mong-ju (鄭夢周) + limit = { + current_year >= 1366 + current_year <= 1374 + NOT = { exists = global_var:hchar_jeong_mong_ju } + } + set_global_variable = { name = hchar_jeong_mong_ju value = yes } + title:b_Goryeo_Gaeseong_Gaeseong = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Mong_ju" + dynasty_house = house:house_hchar_jeong + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:daoxue + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = just + trait = honest + trait = brave + trait = lifestyle_poet + trait = scholar + diplomacy = { min_template_low_skill max_template_low_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_low_skill max_template_low_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = jeong_mong_ju + } + if = { limit = { has_variable = jeong_mong_ju } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Yi Saek (李穡) + limit = { + current_year >= 1351 + current_year <= 1357 + NOT = { exists = global_var:hchar_yi_saek } + } + set_global_variable = { name = hchar_yi_saek value = yes } + title:b_Goryeo_Gaeseong_Gaeseong = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Saek_7A61" + dynasty_house = house:house_hchar_yi + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:daoxue + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = diligent + trait = temperate + trait = patient + trait = scholar + trait = theologian + diplomacy = { min_template_low_skill max_template_low_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_low_skill max_template_low_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_decent_skill max_template_decent_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = yi_saek + } + if = { limit = { has_variable = yi_saek } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Ji-nul (知訥) + limit = { + current_year >= 1183 + current_year <= 1189 + NOT = { exists = global_var:hchar_jinul } + } + set_global_variable = { name = hchar_jinul value = yes } + title:b_Goryeo_Gaeseong_Gaeseong = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Ji_nul" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:vinaya + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = zealous + trait = calm + trait = diligent + trait = devoted + trait = lifestyle_mystic + trait = theologian + diplomacy = { min_template_low_skill max_template_low_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_low_skill max_template_low_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_decent_skill max_template_decent_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = jinul + create_inspiration = religious_inspiration + } + if = { limit = { has_variable = jinul } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Mpu Prapanca + limit = { + current_year >= 1365 + current_year <= 1371 + NOT = { exists = global_var:hchar_prapanca } + } + set_global_variable = { name = hchar_prapanca value = yes } + title:b_SUM_Palembang = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Prapanca" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = zealous + trait = arrogant + trait = diligent + trait = devoted + trait = lifestyle_mystic + trait = lifestyle_poet + trait = scholar + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = prapanca + give_nickname = nick_mpu + } + if = { limit = { has_variable = prapanca } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Mpu Tantular + limit = { + current_year >= 1320 + current_year <= 1326 + NOT = { exists = global_var:hchar_tantular } + } + set_global_variable = { name = hchar_tantular value = yes } + title:b_JAV_Kahuripan = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Tantular" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = zealous + trait = patient + trait = diligent + trait = devoted + trait = lifestyle_mystic + trait = lifestyle_poet + trait = scholar + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = tantular + give_nickname = nick_mpu + } + if = { limit = { has_variable = tantular } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Mpu Kanwa + limit = { + current_year >= 990 + current_year <= 996 + NOT = { exists = global_var:hchar_kanwa } + } + set_global_variable = { name = hchar_kanwa value = yes } + title:b_JAV_Kahuripan = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Kanwa" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = zealous + trait = calm + trait = diligent + trait = devoted + trait = lifestyle_mystic + trait = lifestyle_poet + trait = scholar + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = kanwa + give_nickname = nick_mpu + } + if = { limit = { has_variable = kanwa } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Mpu Sedah + limit = { + current_year >= 1120 + current_year <= 1126 + NOT = { exists = global_var:hchar_sedah } + } + set_global_variable = { name = hchar_sedah value = yes } + title:b_JAV_Kahuripan = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Sedah" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = zealous + trait = compassionate + trait = diligent + trait = devoted + trait = lifestyle_mystic + trait = lifestyle_poet + trait = scholar + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = sedah + give_nickname = nick_mpu + create_inspiration = book_inspiration + } + if = { limit = { has_variable = sedah } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Mpu Panuluh + limit = { + current_year >= 1140 + current_year <= 1146 + NOT = { exists = global_var:hchar_panuluh } + } + set_global_variable = { name = hchar_panuluh value = yes } + title:b_JAV_Kahuripan = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Panuluh" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = zealous + trait = stubborn + trait = diligent + trait = devoted + trait = lifestyle_mystic + trait = lifestyle_poet + trait = scholar + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = panuluh + give_nickname = nick_mpu + create_inspiration = book_inspiration + } + if = { limit = { has_variable = panuluh } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Mpu Dharmaja + limit = { + current_year >= 1010 + current_year <= 1016 + NOT = { exists = global_var:hchar_dharmaja } + } + set_global_variable = { name = hchar_dharmaja value = yes } + title:b_JAV_Kahuripan = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Dharmaja" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = zealous + trait = forgiving + trait = humble + trait = devoted + trait = lifestyle_mystic + trait = lifestyle_poet + trait = scholar + trait = loyal + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = dharmaja + give_nickname = nick_mpu + create_inspiration = book_inspiration + } + if = { limit = { has_variable = dharmaja } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Mpu Monaguna + limit = { + current_year >= 1220 + current_year <= 1226 + NOT = { exists = global_var:hchar_monaguna } + } + set_global_variable = { name = hchar_monaguna value = yes } + title:b_JAV_Kahuripan = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Monaguna" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = humble + trait = calm + trait = diligent + trait = devoted + trait = lifestyle_mystic + trait = lifestyle_poet + trait = scholar + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = monaguna + give_nickname = nick_mpu + } + if = { limit = { has_variable = monaguna } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Mpu Kuturan + limit = { + current_year >= 990 + current_year <= 996 + NOT = { exists = global_var:hchar_kuturan } + } + set_global_variable = { name = hchar_kuturan value = yes } + title:b_IDO_Bedulu = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Kuturan" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = zealous + trait = patient + trait = diligent + trait = devoted + trait = lifestyle_mystic + trait = lifestyle_poet + trait = scholar + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = kuturan + give_nickname = nick_mpu + } + if = { limit = { has_variable = kuturan } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Mpu Dwijendra + limit = { + current_year >= 1020 + current_year <= 1026 + NOT = { exists = global_var:hchar_dwijendra } + } + set_global_variable = { name = hchar_dwijendra value = yes } + title:b_IDO_Lombok = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Dwijendra" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = zealous + trait = temperate + trait = patient + trait = devoted + trait = lifestyle_mystic + trait = lifestyle_poet + trait = scholar + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = dwijendra + give_nickname = nick_mpu + } + if = { limit = { has_variable = dwijendra } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Kavindrarimathana + limit = { + current_year >= 940 + current_year <= 946 + NOT = { exists = global_var:hchar_kavindrarimathana } + } + set_global_variable = { name = hchar_kavindrarimathana value = yes } + title:b_angkor = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Kavindrarimathana" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_stewardship_5 + trait = diligent + trait = ambitious + trait = patient + trait = architect + diplomacy = { min_template_low_skill max_template_low_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_low_skill max_template_low_skill } + learning = { min_template_low_skill max_template_low_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = kavindrarimathana + } + if = { limit = { has_variable = kavindrarimathana } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Daun Penh + limit = { + current_year >= 1320 + current_year <= 1326 + NOT = { exists = global_var:hchar_daun_penh } + } + set_global_variable = { name = hchar_daun_penh value = yes } + title:b_angkor = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Daun" + dynasty_house = house:house_penh + gender_female_chance = 100 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_stewardship_3 + trait = zealous + trait = generous + trait = patient + trait = theologian + diplomacy = { min_template_low_skill max_template_low_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = daun_penh + add_gold = 1000 + } + if = { limit = { has_variable = daun_penh } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Yue Fei (岳飛) + limit = { + current_year >= 1123 + current_year <= 1129 + NOT = { exists = global_var:hchar_yue_fei } + } + set_global_variable = { name = hchar_yue_fei value = yes } + title:b_xindu = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Fei_98DB" + dynasty_house = house:house_hchar_yue + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_martial_5 + trait = zealous + trait = brave + trait = just + trait = strategist + trait = loyal + trait = lifestyle_poet + trait = lifestyle_blademaster + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_high_skill max_template_high_skill } + stewardship = { min_template_decent_skill max_template_decent_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_decent_skill max_template_decent_skill } + prowess = { min_template_high_skill max_template_high_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = yue_fei + add_character_flag = need_military_outfit + } + if = { limit = { has_variable = yue_fei } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Wen Tianxiang + limit = { + current_year >= 1256 + current_year <= 1262 + NOT = { exists = global_var:hchar_wen_tianxiang } + } + set_global_variable = { name = hchar_wen_tianxiang value = yes } + title:b_luling = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Tianxiang" + dynasty_house = house:house_hchar_wen + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_martial_3 + trait = zealous + trait = just + trait = stubborn + trait = scholar + trait = lifestyle_poet + diplomacy = { min_template_low_skill max_template_low_skill } + martial = { min_template_high_skill max_template_high_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_low_skill max_template_low_skill } + learning = { min_template_decent_skill max_template_decent_skill } + prowess = { min_template_high_skill max_template_high_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = wen_tianxiang + add_character_flag = need_military_outfit + } + if = { limit = { has_variable = wen_tianxiang } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Fan Zhongyan + limit = { + current_year >= 1013 + current_year <= 1019 + NOT = { exists = global_var:hchar_fan_zhongyan } + } + set_global_variable = { name = hchar_fan_zhongyan value = yes } + title:b_wu = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Zhongyan_4EF2_6DF9" + dynasty_house = house:house_hchar_fan + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = just + trait = diligent + trait = generous + trait = administrator + trait = scholar + diplomacy = { min_template_low_skill max_template_low_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_high_skill max_template_high_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = fan_zhongyan + } + if = { limit = { has_variable = fan_zhongyan } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Li Qingzhao + limit = { + current_year >= 1100 + current_year <= 1106 + NOT = { exists = global_var:hchar_li_qingzhao } + } + set_global_variable = { name = hchar_li_qingzhao value = yes } + title:b_zhangqiu = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Qingzhao_6E05_7167" + dynasty_house = house:house_hchar_li + gender_female_chance = 100 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_diplomacy_4 + trait = calm + trait = diligent + trait = humble + trait = lifestyle_poet + trait = journaller + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_low_skill max_template_low_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = li_qingzhao + } + if = { limit = { has_variable = li_qingzhao } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Qiu Chuji + limit = { + current_year >= 1199 + current_year <= 1205 + NOT = { exists = global_var:hchar_qiu_chuji } + } + set_global_variable = { name = hchar_qiu_chuji value = yes } + title:b_linji = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Chuji_8655_6A5F" + dynasty_house = house:house_hchar_qiu + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:quanzhen + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = zealous + trait = temperate + trait = calm + trait = theologian + trait = lifestyle_mystic + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = qiu_chuji + } + if = { limit = { has_variable = qiu_chuji } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Chu Van An + limit = { + current_year >= 1300 + current_year <= 1306 + NOT = { exists = global_var:hchar_chu_van_an } + } + set_global_variable = { name = hchar_chu_van_an value = yes } + title:b_thang_long = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "van_an" + dynasty_house = house:house_hchar_chu + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:daoxue + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = honest + trait = temperate + trait = just + trait = theologian + trait = scholar + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = chu_van_an + } + if = { limit = { has_variable = chu_van_an } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Nguyen Thuyen + limit = { + current_year >= 1270 + current_year <= 1276 + NOT = { exists = global_var:hchar_nguyen_thuyen } + } + set_global_variable = { name = hchar_nguyen_thuyen value = yes } + title:b_thang_long = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "thuyen" + dynasty_house = house:house_hchar_nguyen + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_learning_3 + trait = patient + trait = honest + trait = calm + trait = lifestyle_poet + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_low_skill max_template_low_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = nguyen_thuyen + } + if = { limit = { has_variable = nguyen_thuyen } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Pham Ngu Lao + limit = { + current_year >= 1281 + current_year <= 1287 + NOT = { exists = global_var:hchar_pham_ngu_lao } + } + set_global_variable = { name = hchar_pham_ngu_lao value = yes } + title:b_thang_long = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "ngu_lao" + dynasty_house = house:house_hchar_pham + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_martial_4 + trait = brave + trait = diligent + trait = calm + trait = strategist + trait = lifestyle_poet + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_high_skill max_template_high_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_decent_skill max_template_decent_skill } + learning = { min_template_low_skill max_template_low_skill } + prowess = { min_template_high_skill max_template_high_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = pham_ngu_lao + } + if = { limit = { has_variable = pham_ngu_lao } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Sakata Kintoki (坂田公時) + limit = { + current_year >= 1000 + current_year <= 1006 + NOT = { exists = global_var:hchar_sakata_kintoki } + } + set_global_variable = { name = hchar_sakata_kintoki value = yes } + title:b_kamakura = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Kin_toki" + dynasty_house = house:house_hchar_sakata + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_martial_3 + trait = brave + trait = lustful + trait = trusting + trait = strong + trait = loyal + trait = giant + trait = athletic + trait = physique_good_3 + diplomacy = { min_template_low_skill max_template_low_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_low_skill max_template_low_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_decent_skill max_template_decent_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = sakata_kintoki + give_nickname = nick_kintaro + } + if = { limit = { has_variable = sakata_kintoki } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Takezaki Suenaga (竹崎季長) + limit = { + current_year >= 1266 + current_year <= 1272 + NOT = { exists = global_var:hchar_takezaki_suenaga } + } + set_global_variable = { name = hchar_takezaki_suenaga value = yes } + title:b_mashiki = { + save_scope_as = birth_location + create_character = { + age = 20 + name = "Suenaga" + dynasty_house = house:house_hchar_takezaki + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = scope:birth_location.title_province.faith + culture = scope:birth_location.title_province.culture + trait = education_martial_4 + trait = ambitious + trait = brave + trait = arrogant + trait = gallant + trait = lifestyle_blademaster + trait = loyal + diplomacy = { min_template_low_skill max_template_low_skill } + martial = { min_template_high_skill max_template_high_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_low_skill max_template_low_skill } + learning = { min_template_low_skill max_template_low_skill } + prowess = { min_template_high_skill max_template_high_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = takezaki_suenaga + } + if = { limit = { has_variable = takezaki_suenaga } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Eisai (栄西) + limit = { + current_year >= 1185 + current_year <= 1195 + NOT = { exists = global_var:hchar_eisai } + } + set_global_variable = { name = hchar_eisai value = yes } + title:b_hakata = { + save_scope_as = birth_location + create_character = { + age = 50 + name = "Eisai" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:dhyana + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = zealous + trait = calm + trait = diligent + trait = devoted + trait = theologian + diplomacy = { min_template_low_skill max_template_low_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_decent_skill max_template_decent_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = eisai + add_character_flag = ai_will_not_convert + } + if = { limit = { has_variable = eisai } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Ippen Shōnin (一遍上人) + limit = { + current_year >= 1271 + current_year <= 1281 + NOT = { exists = global_var:hchar_ippen } + } + set_global_variable = { name = hchar_ippen value = yes } + title:b_saku = { + save_scope_as = birth_location + create_character = { + age = 38 + name = "Ippen" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:sukhavati + culture = scope:birth_location.title_province.culture + trait = education_learning_4 + trait = zealous + trait = compassionate + trait = diligent + trait = devoted + trait = lifestyle_mystic + trait = lifestyle_traveler + diplomacy = { min_template_low_skill max_template_low_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_decent_skill max_template_decent_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = ippen + add_character_flag = ai_will_not_convert + } + if = { limit = { has_variable = ippen } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Myōe (明恵) + limit = { + current_year >= 1200 + current_year <= 1210 + NOT = { exists = global_var:hchar_myoe } + } + set_global_variable = { name = hchar_myoe value = yes } + title:b_nagusa = { + save_scope_as = birth_location + create_character = { + age = 30 + name = "MyO_e" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:avatamsaka # Kegon, also Shingon (Mantrayana) + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = zealous + trait = just + trait = stubborn + trait = devoted + trait = lifestyle_poet + trait = theologian + diplomacy = { min_template_low_skill max_template_low_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_decent_skill max_template_decent_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = myoe + add_character_flag = ai_will_not_convert + } + if = { limit = { has_variable = myoe } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Hōnen (法然) + limit = { + current_year >= 1178 + current_year <= 1188 + NOT = { exists = global_var:hchar_honen } + } + set_global_variable = { name = hchar_honen value = yes } + title:b_kyo = { + save_scope_as = birth_location + create_character = { + age = 55 + name = "HO_nen" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:sukhavati + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = zealous + trait = just + trait = compassionate + trait = devoted + trait = theologian + diplomacy = { min_template_low_skill max_template_low_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_decent_skill max_template_decent_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = honen + add_character_flag = ai_will_not_convert + } + if = { limit = { has_variable = honen } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Shinran (親鸞) + limit = { + current_year >= 1218 + current_year <= 1228 + NOT = { exists = global_var:hchar_shinran } + } + set_global_variable = { name = hchar_shinran value = yes } + title:b_toshima = { + save_scope_as = birth_location + create_character = { + age = 50 + name = "Shinran" + dynasty = none + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:sukhavati + culture = scope:birth_location.title_province.culture + trait = education_learning_5 + trait = zealous + trait = just + trait = compassionate + trait = devoted + trait = theologian + diplomacy = { min_template_low_skill max_template_low_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_decent_skill max_template_decent_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = shinran + add_character_flag = ai_will_not_convert + } + if = { limit = { has_variable = shinran } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Mibu Tadamine (壬生忠岑) + limit = { + current_year >= 885 + current_year <= 895 + NOT = { exists = global_var:hchar_mibu_tadamine } + } + set_global_variable = { name = hchar_mibu_tadamine value = yes } + title:b_kyo = { + save_scope_as = birth_location + create_character = { + age = 30 + name = "Tadamine" + dynasty_house = house:house_hchar_mibu + gender_female_chance = 0 + random_traits = no + location = scope:birth_location.title_province + faith = faith:pundarika + culture = scope:birth_location.title_province.culture + trait = education_diplomacy_4 + trait = gregarious + trait = cynical + trait = diligent + trait = lifestyle_poet + diplomacy = { min_template_high_skill max_template_high_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_high_skill max_template_high_skill } + prowess = { min_template_decent_skill max_template_decent_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + historical_character_finalization_effect = yes + set_variable = mibu_tadamine + } + if = { limit = { has_variable = mibu_tadamine } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } + + if = { # Murasaki Shikibu (紫式部) + limit = { + current_year >= 990 + current_year <= 1000 + NOT = { exists = global_var:hchar_murasaki } + } + set_global_variable = { name = hchar_murasaki value = yes } + title:b_kyo = { + save_scope_as = birth_location + create_character = { + age = 25 + name = "Kaoruko" + dynasty = none + gender_female_chance = 100 + random_traits = no + location = scope:birth_location.title_province + faith = faith:pundarika + culture = scope:birth_location.title_province.culture + trait = education_diplomacy_4 + trait = journaller + trait = lifestyle_poet + trait = gregarious + trait = honest + trait = compassionate + trait = beauty_good_1 + diplomacy = { min_template_decent_skill max_template_decent_skill } + martial = { min_template_low_skill max_template_low_skill } + stewardship = { min_template_low_skill max_template_low_skill } + intrigue = { min_template_high_skill max_template_high_skill } + learning = { min_template_low_skill max_template_low_skill } + prowess = { min_template_decent_skill max_template_decent_skill } + save_scope_as = historical_character + } + scope:historical_character ?= { + give_nickname = "nick_murasaki_shikibu" + historical_character_finalization_effect = yes + set_variable = murasaki + } + if = { limit = { has_variable = murasaki } } # Error suppression + spawn_historical_characters_boilerplate_effect = yes + } + } +} + +historical_character_finalization_effect = { + add_trait = historical_character + house ?= { + generate_coa = yes + } + dynasty ?= { + set_coa = scope:historical_character.house + } + set_variable = { + name = show_historical_gui + value = 1 + } +} + +spawn_historical_characters_boilerplate_effect = { + county = { save_scope_as = county_scope } + county.holder = { + if = { + limit = { + is_ai = no + } + trigger_event = historical_char_creation_events.1 + } + else_if = { + limit = { + OR = { + exists = scope:major + has_game_rule = all_historical_characters + } + any_liege_or_above = { + is_ai = no + } + } + random_liege_or_above = { + limit = { + is_ai = no + } + trigger_event = historical_char_creation_events.1 + } + } + else_if = { + limit = { + exists = scope:county_scope.duchy.holder + } + scope:county_scope.duchy.holder = { + trigger_event = historical_char_creation_events.1 + } + } + else = { + top_liege = { + trigger_event = historical_char_creation_events.1 + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_history_effects.txt b/N3OW/common/scripted_effects/00_history_effects.txt new file mode 100644 index 00000000..62ad0377 --- /dev/null +++ b/N3OW/common/scripted_effects/00_history_effects.txt @@ -0,0 +1,32 @@ +eliminate_&_replace_faith_effect = { + if = { + limit = { + exists = $TARGET_FAITH$.religious_head_title + exists = $TARGET_FAITH$.religious_head_title.holder + NOT = { $TARGET_FAITH$.religious_head_title = $REPLACEMENT_FAITH$.religious_head_title } + } + + $TARGET_FAITH$.religious_head_title.holder = { + destroy_title = $TARGET_FAITH$.religious_head_title + } + } + every_county = { + limit = { faith = $TARGET_FAITH$ } + set_variable = { + name = forbid_crypto_reconversion + value = yes + days = 30 + } + set_county_faith = $REPLACEMENT_FAITH$ + } + $TARGET_FAITH$ = { + every_faith_character = { + set_variable = { + name = forbid_crypto_reconversion + value = yes + days = 30 + } + set_character_faith = $REPLACEMENT_FAITH$ + } + } +} diff --git a/N3OW/common/scripted_effects/00_holy_order_effects.txt b/N3OW/common/scripted_effects/00_holy_order_effects.txt new file mode 100644 index 00000000..8f60536c --- /dev/null +++ b/N3OW/common/scripted_effects/00_holy_order_effects.txt @@ -0,0 +1,187 @@ + + +send_child_to_holy_order_tooltip_effect = { + scope:recipient = { + add_trait = order_member + add_piety_level = 1 + custom_tooltip = character_will_leave_court_holy_order + if = { + limit = { + is_married = yes + } + every_spouse = { + divorce = scope:recipient + } + } + if = { + limit = { + exists = betrothed + } + break_betrothal = betrothed + if = { + limit = { + has_been_promised_grand_wedding = yes + } + break_grand_wedding_betrothal_effect = yes + } + } + if = { + limit = { + is_concubine = yes + } + this.concubinist = { + remove_concubine = scope:recipient + } + } + if = { + limit = { + number_of_concubines > 0 + } + every_concubine = { + scope:recipient = { + remove_concubine = prev + } + } + } + } +} + +send_child_to_holy_order_effect = { + scope:$GRANDMASTER$ = { + add_courtier = scope:recipient + if = { + limit = { + scope:recipient = { + is_close_family_of = scope:actor + } + } + add_opinion = { + target = scope:actor + modifier = pleased_opinion + opinion = 20 + } + } + } + scope:recipient = { + add_trait = order_member + add_piety_level = 1 + if = { + limit = { is_ruler = yes } + depose = yes + } + if = { + limit = { + faith != scope:$GRANDMASTER$.faith + } + set_character_faith = scope:$GRANDMASTER$.faith + } + if = { + limit = { + is_married = yes + } + every_spouse = { + divorce = scope:recipient + } + } + if = { + limit = { + exists = betrothed + } + break_betrothal = betrothed + if = { + limit = { + has_been_promised_grand_wedding = yes + } + break_grand_wedding_betrothal_effect = yes + } + } + if = { + limit = { + is_concubine = yes + } + this.concubinist = { + remove_concubine = scope:recipient + } + } + if = { + limit = { + number_of_concubines > 0 + } + every_concubine = { + scope:recipient = { + remove_concubine = prev + } + } + } + } +} + +send_child_to_clergy_effect = { + scope:recipient = { + add_opinion = { + modifier = demanded_taking_vows + target = scope:actor + } + simplified_clergy_effect = { RECIPIENT = scope:recipient } + } +} + +simplified_clergy_effect = { + $RECIPIENT$ = { + add_trait = devoted + add_piety_level = 1 + if = { + limit = { is_ruler = yes } + depose = yes + } + if = { + limit = { + is_married = yes + } + every_spouse = { + divorce = $RECIPIENT$ + } + } + if = { + limit = { + exists = betrothed + } + break_betrothal = betrothed + if = { + limit = { + has_been_promised_grand_wedding = yes + } + break_grand_wedding_betrothal_effect = yes + } + } + if = { + limit = { + is_concubine = yes + } + this.concubinist = { + remove_concubine = $RECIPIENT$ + } + } + if = { + limit = { + number_of_concubines > 0 + } + every_concubine = { + $RECIPIENT$ = { + remove_concubine = prev + } + } + } + } +} + +release_as_executioner_effect = { + scope:actor = { + court_position_grant_effect = { + EMPLOYER = scope:actor + POS = executioner + CANDIDATE = scope:recipient + } + save_scope_as = liege + } +} diff --git a/N3OW/common/scripted_effects/00_hook_effects.txt b/N3OW/common/scripted_effects/00_hook_effects.txt new file mode 100644 index 00000000..c8b5a89d --- /dev/null +++ b/N3OW/common/scripted_effects/00_hook_effects.txt @@ -0,0 +1,96 @@ +######################################################################### +# EFFECT LIST # +######################################################################### +# !!! Remember to add all new effects with a short description here !!! # +######################################################################### + + +######################################################################### +# EFFECTS # +######################################################################### + +add_hook_if_possible_effect = { + if = { + limit = { + can_add_hook = { + target = $TARGET$ + type = $TYPE$ + } + } + add_hook = { + target = $TARGET$ + type = $TYPE$ + years = $YEARS$ + } + } +} + +add_hook_if_possible_default_length_effect = { + if = { + limit = { + can_add_hook = { + target = $TARGET$ + type = $TYPE$ + } + } + add_hook = { + target = $TARGET$ + type = $TYPE$ + } + } +} + +add_favour_hook_if_possible_simple_effect = { + if = { + limit = { + can_add_hook = { + target = $TARGET$ + type = favor_hook + } + } + add_hook = { + target = $TARGET$ + type = favor_hook + } + } +} + +add_mutual_gendered_blood_sibling_hook_effect = { + # First we do current scope. + if = { + limit = { + $TARGET$ = { is_female = yes } + } + add_hook = { + target = $TARGET$ + type = blood_sister_hook + } + } + else = { + add_hook = { + target = $TARGET$ + type = blood_brother_hook + } + } + # Then set target's. + save_scope_as = blood_sibling_self + $TARGET$ = { + if = { + limit = { + scope:blood_sibling_self = { is_female = yes } + } + add_hook = { + target = scope:blood_sibling_self + type = blood_sister_hook + } + } + else = { + add_hook = { + target = scope:blood_sibling_self + type = blood_brother_hook + } + } + } + # Clean up after ourselves. + clear_saved_scope = blood_sibling_self +} diff --git a/N3OW/common/scripted_effects/00_hunt_effects.txt b/N3OW/common/scripted_effects/00_hunt_effects.txt new file mode 100644 index 00000000..40903d8c --- /dev/null +++ b/N3OW/common/scripted_effects/00_hunt_effects.txt @@ -0,0 +1,4433 @@ +#Effects used in hunt events + + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! +# + +#hunt_end_pulse_effect +#select_local_animal_effect + +###################################################################### +# EFFECTS +###################################################################### + + +#Used to find a local animal to hunt +#Note: Don't add more here without also revisiting artifact creation for Skulls and hides. +#Note: May save any of below scopes before running the effect to limit possible animals: +## big_local_game +## small_local_game +## dangerous_local_game +## harmless_local_game +## prowling_local_game +select_local_animal_effect = { + save_scope_as = $TYPE$_local_game + location = { save_scope_as = animal_location } + hidden_effect = { + if = { + limit = { + NOT = { exists = var:animal_type } + } + random_list = { + 60 = { # Deer, Antelope, Gazelle, etc. + trigger = { + scope:animal_location = { hunt_animal_deer_antelope_trigger = yes } + NOT = { exists = scope:dangerous_local_game } + NOT = { exists = scope:prowling_local_game } + } + hunt_activity_deer_game_effect = { PROVINCE = scope:animal_location } + } + 20 = { # Boar + trigger = { + scope:animal_location = { hunt_animal_boar_trigger = yes } + NOT = { exists = scope:small_local_game } + NOT = { exists = scope:harmless_local_game } + NOT = { exists = scope:prowling_local_game } + } + # they're everywhere, but Muslims and Jews wouldn't hunt them + modifier = { + factor = 0 + faith = { + OR = { + religion_tag = islam_religion + religion_tag = judaism_religion + } + } + } + set_variable = { name = animal_type value = flag:boar years = 3 } + } + 10 = { # Fox + trigger = { + scope:animal_location = { hunt_animal_fox_trigger = yes } + NOT = { exists = scope:big_local_game } + NOT = { exists = scope:dangerous_local_game } + NOT = { exists = scope:prowling_local_game } + } + # they're everywhere + set_variable = { name = animal_type value = flag:fox years = 3 } + } + 1 = { # Aurochs + trigger = { + scope:animal_location = { hunt_animal_aurochs_trigger = yes } + NOT = { religion = religion:hinduism_religion } + NOT = { exists = scope:small_local_game } + NOT = { exists = scope:dangerous_local_game } + NOT = { exists = scope:prowling_local_game } + } + set_variable = { name = animal_type value = flag:aurochs } + } + 10 = { # Bison + trigger = { + scope:animal_location = { hunt_animal_bison_trigger = yes } + NOT = { exists = scope:small_local_game } + NOT = { exists = scope:dangerous_local_game } + NOT = { exists = scope:prowling_local_game } + } + set_variable = { name = animal_type value = flag:bison } + } + 10 = { # Wolf, Hyena, Lynx + trigger = { + NOT = { exists = scope:harmless_local_game } + scope:animal_location = { + OR = { + hunt_animal_wolf_trigger = yes + hunt_animal_hyena_trigger = yes + hunt_animal_lynx_trigger = yes + } + } + } + random_list = { + 10 = { # Wolf + trigger = { + scope:animal_location = { hunt_animal_wolf_trigger = yes } + } + set_variable = { name = animal_type value = flag:wolf years = 3 } + } + 20 = { # Hyena + trigger = { + scope:animal_location = { hunt_animal_hyena_trigger = yes } + } + set_variable = { name = animal_type value = flag:hyena years = 3 } + } + 5 = { # Lynx + trigger = { + scope:animal_location = { hunt_animal_lynx_trigger = yes } + } + set_variable = { name = animal_type value = flag:lynx years = 3 } + } + } + } + 1 = { # Hare + trigger = { + NOT = { exists = scope:dangerous_local_game } + NOT = { exists = scope:prowling_local_game } + } + modifier = { + exists = scope:big_local_game + add = -5 + } + modifier = { + add = 10 #A really poor hunter or a child has a higher chance of focusing on hunting a hare + OR = { + is_adult = no + adventure_inspiration_average_skill_value < 2 + } + } + set_variable = { name = animal_type value = flag:hare years = 3 } + } + 5 = { # Bear + trigger = { + NOT = { exists = scope:small_local_game } + NOT = { exists = scope:harmless_local_game } + NOT = { exists = scope:prowling_local_game } + scope:animal_location = { hunt_animal_bear_trigger = yes } + } + set_variable = { name = animal_type value = flag:bear years = 3 } + } + 5 = { # Big Cat + trigger = { + NOT = { exists = scope:small_local_game } + NOT = { exists = scope:harmless_local_game } + scope:animal_location = { + hunt_animal_big_cat_trigger = yes + OR = { + hunt_animal_lion_trigger = yes + hunt_animal_tiger_trigger = yes + hunt_animal_leopard_trigger = yes + } + } + } + random_list = { + 5 = { # Lion + trigger = { + scope:animal_location = { hunt_animal_lion_trigger = yes } + } + modifier = { + factor = 5 + scope:animal_location = { + OR = { + terrain = desert + terrain = forest + } + } + } + set_variable = { name = animal_type value = flag:lion years = 3 } + } + 5 = { # Tiger + trigger = { + scope:animal_location = { hunt_animal_tiger_trigger = yes } + } + modifier = { + factor = 5 + scope:animal_location = { terrain = jungle } + } + set_variable = { name = animal_type value = flag:tiger years = 3 } + } + 5 = { # Leopard + trigger = { + scope:animal_location = { hunt_animal_leopard_trigger = yes } + } + modifier = { + factor = 0.5 + scope:animal_location = { + OR = { + terrain = desert + terrain = mountains + } + } + } + set_variable = { name = animal_type value = flag:leopard years = 3 } + } + } + } + 1 = { # Unicorn + # they're nowhere + trigger = { + NOT = { exists = scope:small_local_game } + NOT = { exists = scope:dangerous_local_game } + NOT = { exists = scope:prowling_local_game } + } + modifier = { + factor = 0 + NOT = { has_trait = lunatic } + } + set_variable = { + name = animal_type + value = flag:unicorn + years = 3 + } + } + 1 = { # Dragon + trigger = { + NOT = { exists = scope:small_local_game } + NOT = { exists = scope:harmless_local_game } + NOT = { exists = scope:prowling_local_game } + } + # they're nowhere + modifier = { + factor = 0 + NOT = { has_trait = lunatic } + } + set_variable = { + name = animal_type + value = flag:dragon + years = 3 + } + } + } + } + } + # Fallback + if = { + limit = { NOT = { exists = var:animal_type } } + set_variable = { name = animal_type value = flag:stag years = 3 } + } +} + +#Effect to start the story and show the right tooltip +start_hunt_mystical_animal_story_cycle_effect = { + #Only for players, fake it for ai + if = { + limit = { is_ai = no } + hidden_effect = { create_story = story_cycle_hunt_mystical_animal } + random_owned_story = { + type = story_cycle_hunt_mystical_animal + set_variable = { + name = legendary_county + value = scope:activity.activity_location.county + } + save_scope_as = story + } + custom_tooltip = hunt.4013.a.tt + } + else = { + hidden_effect = { + random_list = { + 5 = { #The ai got the animal, wow! + add_prestige = major_prestige_gain + add_character_modifier = { + modifier = hunt_mystical_animal_modifier + years = 20 + } + } + 95 = { + #Nothing happens for them + } + } + } + } +} + +#Effect to end the story and apply everything - You got the animal! +end_hunt_mystical_animal_story_cycle_effect = { + if = { + limit = { + has_dlc_feature = legends + NOT = { has_game_rule = historical_legends_only } + } + create_legend_seed = { + type = heroic + quality = famed + chronicle = beast_slayer + properties = { + beast = scope:activity.var:animal_type + location = root.location + } + } + } + add_prestige = major_prestige_gain + give_nickname = nick_the_venator + add_trait_xp = { + trait = lifestyle_hunter + track = hunter + value = 20 + } + add_character_modifier = { + modifier = hunt_mystical_animal_modifier + years = 20 + } + set_variable = { + name = hunted_mystical_animal + value = scope:activity.var:animal_type + } + hidden_effect = { + if = { + limit = { + can_animal_produce_skull_trigger = { VARIABLE = scope:activity.var:animal_type } + } + random = { + chance = 50 + create_artifact_wall_skull_effect = { + OWNER = root + HUNTER = root + LEGENDARY = yes + ANIMAL = scope:activity.var:animal_type + } + } + } + } + create_artifact_animal_hide_effect = { + OWNER = root + HUNTER = root + LEGENDARY = yes + ANIMAL = scope:activity.var:animal_type + } + add_stress = medium_stress_loss + scope:story = { + hidden_effect = { end_story = yes } + } + # Achievement tracking. + ## Ahab. + if = { + limit = { + is_ai = no + exists = global_var:started_ahab_achievement + } + set_global_variable = { + name = achieved_ahab_achievement + value = yes + } + } +} + +hunt_activity_standard_game_effect = { + random_list = { + 10 = { # Boar + trigger = { + $PROVINCE$ = { hunt_animal_boar_trigger = yes } + NOT = { exists = scope:small_local_game } + } + # Master of Hunt aptitude affects chance of managed game + activity_court_position_aptitude_positive_modifier = { LIEGE = root POS = master_of_hunt } + # Increase larger deer chance with management buildings + hunt_activity_game_building_modifier = { PROVINCE = $PROVINCE$ } + set_variable = { name = animal_type value = flag:boar years = 3 } + } + 30 = { # Deer/Antelope + trigger = { + $PROVINCE$ = { hunt_animal_deer_antelope_trigger = yes } + } + # Master of Hunt aptitude affects chance of managed game + activity_court_position_aptitude_positive_modifier = { LIEGE = root POS = master_of_hunt } + # Increase larger deer chance with management buildings + hunt_activity_game_building_modifier = { PROVINCE = $PROVINCE$ } + hunt_activity_deer_game_effect = { PROVINCE = $PROVINCE$ } + } + 1 = { # Aurochs + trigger = { + $PROVINCE$ = { hunt_animal_aurochs_trigger = yes } + NOT = { $HUNTER$.religion = religion:hinduism_religion } + NOT = { exists = scope:small_local_game } + } + set_variable = { name = animal_type value = flag:aurochs } + } + 10 = { # Bison + trigger = { + $PROVINCE$ = { hunt_animal_bison_trigger = yes } + NOT = { exists = scope:small_local_game } + } + set_variable = { name = animal_type value = flag:bison } + } + 5 = { # Fox + trigger = { + $PROVINCE$ = { hunt_animal_fox_trigger = yes } + NOT = { exists = scope:big_local_game } + } + set_variable = { name = animal_type value = flag:fox } + } + 5 = { # Hare + modifier = { + exists = scope:big_local_game + add = -5 + } + set_variable = { name = animal_type value = flag:hare } + } + } + # Fallback + if = { + limit = { NOT = { exists = var:animal_type } } + set_variable = { name = animal_type value = flag:stag years = 3 } + } +} + +hunt_activity_deer_game_effect = { + random_list = { + 5 = { # Deer - Europe, Middle East, India, Steppe + trigger = { + $PROVINCE$ = { hunt_animal_deer_trigger = yes } + } + random_list = { + 4 = { # Roe - Small deer + trigger = { + $PROVINCE$ = { hunt_animal_roe_trigger = yes } + } + modifier = { + add = -4 + exists = scope:big_local_game + } + set_variable = { name = animal_type value = flag:roe } # Roe + } + 4 = { # Stag - Standard deer + # Increase larger deer chance with management buildings + hunt_activity_game_building_modifier = { PROVINCE = $PROVINCE$ } + # Master of Hunt aptitude affects chance of managed game + activity_court_position_aptitude_positive_modifier = { LIEGE = root POS = master_of_hunt } + if = { + limit = { + $PROVINCE$ = { + geographical_region = hunt_animal_reindeer_region + OR = { + terrain = taiga + terrain = forest + } + } + } + set_variable = { name = animal_type value = flag:reindeer } + } + else = { + set_variable = { name = animal_type value = flag:stag } + } + } + 2 = { # Hart - Prestigious deer + trigger = { + NOT = { exists = scope:small_local_game } + } + # Offset lack of Roe chance + modifier = { + factor = 0.5 + $PROVINCE$ = { hunt_animal_roe_trigger = yes } + } + # Increase larger deer chance with management buildings + hunt_activity_game_building_modifier = { PROVINCE = $PROVINCE$ } + # Master of Hunt aptitude affects chance of managed game + activity_court_position_aptitude_positive_modifier = { LIEGE = root POS = master_of_hunt } + if = { + limit = { + $PROVINCE$ = { + geographical_region = hunt_animal_elk_region + OR = { + terrain = taiga + terrain = forest + } + } + } + set_variable = { name = animal_type value = flag:elk } + } + else = { + set_variable = { name = animal_type value = flag:hart } + } + } + } + } + 5 = { # Antelope - Africa, Middle East, India, Steppe + trigger = { + $PROVINCE$ = { hunt_animal_antelope_trigger = yes } + } + random_list = { + 4 = { # Gazelle - Small antelope + trigger = { + $PROVINCE$ = { hunt_animal_gazelle_trigger = yes } + } + modifier = { + add = -4 + exists = scope:big_local_game + } + set_variable = { name = animal_type value = flag:gazelle } + } + 4 = { # Antelope - Standard antelope + # Increase larger deer chance with management buildings + hunt_activity_game_building_modifier = { PROVINCE = $PROVINCE$ } + # Master of Hunt aptitude affects chance of managed game + activity_court_position_aptitude_positive_modifier = { LIEGE = root POS = master_of_hunt } + if = { + limit = { + $PROVINCE$ = { hunt_animal_steppe_trigger = yes } + } + set_variable = { name = animal_type value = flag:saiga } + } + else = { + set_variable = { name = animal_type value = flag:antelope } + } + } + } + } + } + # Fallback + if = { + limit = { NOT = { exists = var:animal_type } } + set_variable = { name = animal_type value = flag:stag years = 3 } + } +} + +hunt_activity_dangerous_game_effect = { + random_list = { + 15 = { # Wolf/Hyena/Lynx - Common + modifier = { + exists = scope:big_local_game + factor = 0 + } + random_list = { + 10 = { # Wolf + trigger = { + $PROVINCE$ = { hunt_animal_wolf_trigger = yes } + } + set_variable = { name = animal_type value = flag:wolf years = 3 } + } + 20 = { # Hyena + trigger = { + $PROVINCE$ = { hunt_animal_hyena_trigger = yes } + } + set_variable = { name = animal_type value = flag:hyena years = 3 } + } + 5 = { # Lynx + trigger = { + $PROVINCE$ = { hunt_animal_lynx_trigger = yes } + } + set_variable = { name = animal_type value = flag:lynx years = 3 } + } + } + } + 5 = { # Lion/Tiger/Leopard - Occasional (outside Europe) + trigger = { + $PROVINCE$ = { + hunt_animal_big_cat_trigger = yes + OR = { + hunt_animal_lion_trigger = yes + hunt_animal_tiger_trigger = yes + hunt_animal_leopard_trigger = yes + } + } + } + modifier = { + exists = scope:small_local_game + factor = 0 + } + random_list = { + 5 = { # Lion + trigger = { + $PROVINCE$ = { hunt_animal_lion_trigger = yes } + } + modifier = { + factor = 5 + $PROVINCE$ = { + OR = { + terrain = desert + terrain = forest + } + } + } + set_variable = { name = animal_type value = flag:lion years = 3 } + } + 5 = { # Tiger + trigger = { + $PROVINCE$ = { hunt_animal_tiger_trigger = yes } + } + modifier = { + factor = 5 + $PROVINCE$ = { terrain = jungle } + } + set_variable = { name = animal_type value = flag:tiger years = 3 } + } + 5 = { # Leopard + trigger = { + $PROVINCE$ = { hunt_animal_leopard_trigger = yes } + } + modifier = { + factor = 0.5 + $PROVINCE$ = { + OR = { + terrain = desert + terrain = mountains + } + } + } + set_variable = { name = animal_type value = flag:leopard years = 3 } + } + } + } + 5 = { # Bear - Occasional (outside Europe) + trigger = { + $PROVINCE$ = { hunt_animal_bear_trigger = yes } + } + modifier = { + exists = scope:small_local_game + factor = 0 + } + set_variable = { name = animal_type value = flag:bear years = 3 } + } + 10 = { # Boar + trigger = { + $PROVINCE$ = { hunt_animal_boar_trigger = yes } + } + modifier = { + exists = scope:small_local_game + factor = 0 + } + set_variable = { name = animal_type value = flag:boar years = 3 } + } + } + # Fallback + if = { + limit = { NOT = { exists = var:animal_type } } + set_variable = { name = animal_type value = flag:wolf years = 3 } + } +} + +hunt_activity_falconry_game_effect = { + random_list = { + 15 = { ### WATERFOWL ### + trigger = { + $PROVINCE$ = { + NOR = { + terrain = desert + terrain = desert_mountains + terrain = jungle + terrain = drylands + } + } + } + hunt_falconry_select_waterfowl_effect = { VAR = animal_type PROVINCE = $PROVINCE$ } + } + 10 = { ### GROUND ### + hunt_falconry_select_gamebird_effect = { VAR = animal_type PROVINCE = $PROVINCE$ } + } + 5 = { ### EXOTIC ### + random_list = { + 5 = { # Egret + trigger = { + $PROVINCE$ = { + OR = { + geographical_region = world_africa_north + geographical_region = world_africa_east + geographical_region = world_africa_west + geographical_region = world_middle_east_persia + geographical_region = world_europe_south_east + geographical_region = world_asia_minor + geographical_region = world_steppe + } + } + } + modifier = { + factor = 2 + $PROVINCE$ = { + OR = { + terrain = wetlands + terrain = floodplains + terrain = oasis + is_riverside_province = yes + } + } + } + set_variable = { name = animal_type value = flag:egret years = 3 } + } + 5 = { # Crane + trigger = { + $PROVINCE$ = { + OR = { + geographical_region = world_africa_north + geographical_region = world_africa_east + geographical_region = world_europe_north + geographical_region = world_europe_east + geographical_region = world_asia_minor + geographical_region = world_steppe + } + } + } + modifier = { + factor = 2 + $PROVINCE$ = { + OR = { + terrain = wetlands + terrain = floodplains + terrain = oasis + is_riverside_province = yes + } + } + } + set_variable = { name = animal_type value = flag:crane years = 3 } + } + 5 = { # Stork + modifier = { + factor = 2 + $PROVINCE$ = { + OR = { + terrain = wetlands + terrain = floodplains + terrain = oasis + is_riverside_province = yes + } + } + } + set_variable = { name = animal_type value = flag:stork years = 3 } + } + 5 = { # Heron + modifier = { + factor = 2 + $PROVINCE$ = { + OR = { + terrain = wetlands + terrain = floodplains + terrain = oasis + is_riverside_province = yes + } + } + } + set_variable = { name = animal_type value = flag:heron years = 3 } + } + 5 = { # Pelican + trigger = { + $PROVINCE$ = { + OR = { + geographical_region = world_africa_east + geographical_region = world_africa_west + geographical_region = world_india + geographical_region = world_middle_east_persia + geographical_region = world_asia_minor + geographical_region = world_europe_south_east + geographical_region = world_steppe_west + } + } + } + modifier = { + factor = 2 + $PROVINCE$ = { is_coastal = yes } + } + set_variable = { name = animal_type value = flag:pelican years = 3 } + } + 5 = { # Flamingo + trigger = { + $PROVINCE$ = { + OR = { + geographical_region = world_africa_east + geographical_region = world_africa_west + geographical_region = world_india + geographical_region = world_middle_east_persia + geographical_region = dlc_fp2_mediterranean_shoreline + } + is_coastal = yes + } + } + set_variable = { name = animal_type value = flag:flamingo years = 3 } + } + } + } + } +} + +hunt_falconry_select_waterfowl_effect = { + random_list = { + 5 = { # Swan + trigger = { + $PROVINCE$ = { + NOT = { geographical_region = world_africa } + } + } + modifier = { + factor = 2 + $PROVINCE$ = { + OR = { + terrain = oasis + terrain = wetlands + terrain = floodplains + is_riverside_province = yes + } + } + + } + modifier = { + factor = 2 + $PROVINCE$.county.holder.top_liege = { employs_court_position = keeper_of_swans_court_position } + } + set_variable = { name = $VAR$ value = flag:swan years = 3 } + } + 10 = { # Goose + modifier = { + factor = 0.5 + $PROVINCE$ = { + OR = { + terrain = desert + terrain = desert_mountains + terrain = jungle + terrain = drylands + } + } + } + set_variable = { name = $VAR$ value = flag:goose years = 3 } + } + 10 = { # Duck + modifier = { + factor = 2 + $PROVINCE$ = { + OR = { + terrain = oasis + terrain = wetlands + terrain = floodplains + is_riverside_province = yes + } + } + } + set_variable = { name = $VAR$ value = flag:duck years = 3 } + } + } +} + +hunt_falconry_select_gamebird_effect = { + random_list = { + 5 = { # Pheasant + modifier = { + factor = 2 + $PROVINCE$ = { + OR = { + terrain = farmlands + terrain = plains + terrain = hills + } + } + } + set_variable = { name = $VAR$ value = flag:pheasant years = 3 } + } + 5 = { # Bustard + modifier = { + factor = 2 + $PROVINCE$ = { + OR = { + terrain = steppe + terrain = plains + terrain = drylands + terrain = desert + terrain = oasis + } + } + } + set_variable = { name = $VAR$ value = flag:bustard years = 3 } + } + 5 = { # Grouse + trigger = { + $PROVINCE$ = { + OR = { + geographical_region = world_europe_north + geographical_region = world_europe_west_britannia + } + } + } + modifier = { + factor = 2 + $PROVINCE$ = { + OR = { + terrain = mountains + terrain = hills + terrain = taiga + terrain = forest + terrain = plains + } + } + } + set_variable = { name = $VAR$ value = flag:grouse years = 3 } + } + 5 = { # Quail + modifier = { + factor = 2 + $PROVINCE$ = { + OR = { + terrain = mountains + terrain = hills + terrain = steppe + terrain = plains + } + } + } + set_variable = { name = $VAR$ value = flag:quail years = 3 } + } + } +} + +hunt_activity_success_change_effect = { + scope:activity = { + if = { + limit = { + NOT = { exists = var:hunt_success_chance_event } + } + set_variable = { name = hunt_success_chance_event value = 0 } + } + change_variable = { + name = hunt_success_chance_event + add = hunt_activity_success_$CHANGE$_value + } + set_variable = { + name = hunt_success_chance + value = hunt_success_chance_value + } + } + custom_tooltip = hunt_activity_success_$CHANGE$_tt +} + +hunt_activity_success_outcome_effect = { + scope:activity = { + hidden_effect = { + random = { + chance = var:hunt_success_chance + set_variable = { + name = hunt_success + value = flag:yes + } + } + } + } +} + +hunt_individual_guest_awards_effect = { + # If character had the reduce stress intent, give them stress loss + if = { # Hosts + limit = { this = scope:host } + if = { # To hide hunter tooltip for guests + limit = { has_character_flag = host_existing_hunter } + if = { + limit = { scope:activity.var:hunt_success ?= flag:yes } + stress_impact = { + base = major_stress_loss + lazy = medium_stress_impact_loss + gregarious = medium_stress_impact_loss + lifestyle_hunter = major_stress_loss + shy = medium_stress_impact_gain + } + } + else = { + stress_impact = { + base = medium_stress_impact_loss + lazy = minor_stress_impact_loss + gregarious = minor_stress_impact_loss + lifestyle_hunter = medium_stress_impact_loss + shy = medium_stress_impact_gain + } + } + } + else = { + if = { + limit = { scope:activity.var:hunt_success ?= flag:yes } + stress_impact = { + base = major_stress_loss + lazy = medium_stress_impact_loss + gregarious = medium_stress_impact_loss + shy = medium_stress_impact_gain + } + } + else = { + stress_impact = { + base = medium_stress_impact_loss + lazy = minor_stress_impact_loss + gregarious = minor_stress_impact_loss + shy = medium_stress_impact_gain + } + } + } + } + else = { # Guests + if = { + limit = { scope:activity.var:hunt_success ?= flag:yes } + stress_impact = { + base = medium_stress_impact_loss + lazy = minor_stress_impact_loss + gregarious = minor_stress_impact_loss + lifestyle_hunter = medium_stress_impact_loss + shy = minor_stress_impact_gain + } + } + else = { + stress_impact = { + base = minor_stress_impact_loss + lazy = miniscule_stress_impact_loss + gregarious = miniscule_stress_impact_loss + lifestyle_hunter = minor_stress_impact_loss + shy = minor_stress_impact_gain + } + } + } + # Prestige/piety + if = { + limit = { + this != scope:host + is_adult = yes + trigger_if = { + limit = { + scope:activity = { + NOT = { + has_activity_option = { category = special_type option = hunt_type_falconry } + } + } + } + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:host } + } + trigger_if = { + limit = { is_clergy = yes } + OR = { + faith = { has_doctrine_parameter = clergy_can_fight } + culture = { has_cultural_parameter = culture_clergy_can_fight } + } + } + } + if = { + limit = { + culture = { has_cultural_parameter = sacred_hunts } + } + add_prestige = hunt_prestige_with_piety_guest_gain_value + add_piety = hunt_piety_guest_gain_value + } + else = { add_prestige = hunt_prestige_guest_gain_value } + } + # Nomads gain prowess from dangerous animal kills + if = { + limit = { + NOT = { this = scope:host } + government_has_flag = government_is_nomadic + scope:activity = { + var:hunt_success ?= flag:yes + NOT = { exists = var:animal_spared } + hunt_animal_type_dangerous_trigger = { VAR = var:animal_type } + } + } + add_prowess_skill = 1 + } + # Trait XP + # Only called on the end of a *successful* hunt. Hunts which are interrupted due to death, imprisonment, etc., don't get this, so put critical clean-up stuff in the activity itself. + if = { + limit = { + scope:activity = { + has_activity_option = { category = special_type option = hunt_type_falconry } + } + } + hunter_lifestyle_rank_up_check_effect = { FALCONRY = yes } + } + else = { + hunter_lifestyle_rank_up_check_effect = { FALCONRY = no } + } + # Tourney + if = { + limit = { has_trait = tourney_participant } + if = { + limit = { + scope:activity = { + NOT = { + has_activity_option = { category = special_type option = hunt_type_falconry } + } + NOT = { + hunt_story_trigger = { STORY = chase } + } + } + } + add_trait_xp = { + trait = tourney_participant + track = horse + value = { 1 3 } + } + } + if = { + limit = { + OR = { + hunt_story_trigger = { STORY = ambush } + hunt_story_trigger = { STORY = stealth } + } + } + add_trait_xp = { + trait = tourney_participant + track = bow + value = { 1 3 } + } + } + } + accolades_activity_complete_hunt_glory_effect = yes + # LEGITIMACY GAIN FOR ACTIVITY PARTICIPATION - HUNT + if = { + limit = { + scope:activity = { # Special gain for Legendary Hunt + has_activity_option = { category = special_type option = hunt_type_legendary } + } + } + legendary_hunt_participation_legitimacy_effect = yes + } + else = { + standard_activity_participation_legitimacy_effect = yes + } + # Memories + if = { + limit = { + save_temporary_scope_as = hunter_temp + NOT = { + any_memory = { + has_memory_type = hunt_animal_slayer_memory + memory_participant:animal_slayer = scope:hunter_temp + memory_participant:host = scope:host + memory_age_years < 1 + } + } + exists = scope:activity.var:kill_animal_type + } + create_character_memory = { + type = hunt_success_memory + participants = { + host = scope:host + } + } + ordered_memory = { + limit = { has_memory_type = hunt_success_memory } + order_by = memory_creation_date + save_scope_as = new_memory + set_variable = { + name = animal_type + value = scope:activity.var:kill_animal_type + } + set_variable = { + name = location + value = scope:activity.activity_location + } + } + } +} + +hunt_animal_wound_effect = { + if = { + limit = { exists = $VARIABLE$ } + if = { + limit = { $VARIABLE$ = flag:elk } + increase_wounds_effect = { REASON = moose } + } + else_if = { + limit = { $VARIABLE$ = flag:hart } + increase_wounds_effect = { REASON = hart } + } + else_if = { + limit = { + OR = { + $VARIABLE$ = flag:stag + $VARIABLE$ = flag:reindeer + } + } + increase_wounds_effect = { REASON = deer } + } + else_if = { + limit = { $VARIABLE$ = flag:roe } + increase_wounds_effect = { REASON = roe } + } + else_if = { + limit = { + OR = { + $VARIABLE$ = flag:antelope + $VARIABLE$ = flag:saiga + } + } + increase_wounds_effect = { REASON = antelope } + } + else_if = { + limit = { $VARIABLE$ = flag:gazelle } + increase_wounds_effect = { REASON = gazelle } + } + else_if = { + limit = { $VARIABLE$ = flag:bison } + increase_wounds_effect = { REASON = bison } + } + else_if = { + limit = { $VARIABLE$ = flag:aurochs } + increase_wounds_effect = { REASON = aurochs } + } + else_if = { + limit = { $VARIABLE$ = flag:boar } + increase_wounds_effect = { REASON = boar } + } + else_if = { + limit = { $VARIABLE$ = flag:bear } + increase_wounds_effect = { REASON = bear } + } + else_if = { + limit = { $VARIABLE$ = flag:wolf } + increase_wounds_effect = { REASON = wolf } + } + else_if = { + limit = { $VARIABLE$ = flag:hyena } + increase_wounds_effect = { REASON = hyena } + } + else_if = { + limit = { $VARIABLE$ = flag:lynx } + increase_wounds_effect = { REASON = lynx } + } + else_if = { + limit = { $VARIABLE$ = flag:lion } + increase_wounds_effect = { REASON = lion } + } + else_if = { + limit = { $VARIABLE$ = flag:tiger } + increase_wounds_effect = { REASON = tiger } + } + else_if = { + limit = { $VARIABLE$ = flag:leopard } + increase_wounds_effect = { REASON = leopard } + } + else = { + increase_wounds_effect = { REASON = maimed_by_wild_beast } + } + } + else = { + increase_wounds_effect = { REASON = maimed_by_wild_beast } + } +} + +hunt_animal_death_effect = { + if = { + limit = { exists = $VAR$ } + if = { + limit = { $VAR$ = flag:elk } + death = { death_reason = death_moose } + } + else_if = { + limit = { $VAR$ = flag:hart } + death = { death_reason = death_hart } + } + else_if = { + limit = { + OR = { + $VAR$ = flag:stag + $VAR$ = flag:reindeer + } + } + death = { death_reason = death_deer } + } + else_if = { + limit = { $VAR$ = flag:roe } + death = { death_reason = death_roe } + } + else_if = { + limit = { + OR = { + $VAR$ = flag:antelope + $VAR$ = flag:saiga + } + } + death = { death_reason = death_antelope } + } + else_if = { + limit = { $VAR$ = flag:gazelle } + death = { death_reason = death_gazelle } + } + else_if = { + limit = { $VAR$ = flag:bison } + death = { death_reason = death_bison } + } + else_if = { + limit = { $VAR$ = flag:aurochs } + death = { death_reason = death_aurochs } + } + else_if = { + limit = { $VAR$ = flag:boar } + death = { death_reason = death_boar } + } + else_if = { + limit = { $VAR$ = flag:bear } + death = { death_reason = death_bear } + } + else_if = { + limit = { $VAR$ = flag:wolf } + death = { death_reason = death_wolf } + } + else_if = { + limit = { $VAR$ = flag:hyena } + death = { death_reason = death_hyena } + } + else_if = { + limit = { $VAR$ = flag:lynx } + death = { death_reason = death_lynx } + } + else_if = { + limit = { $VAR$ = flag:lion } + death = { death_reason = death_lion } + } + else_if = { + limit = { $VAR$ = flag:tiger } + death = { death_reason = death_tiger } + } + else_if = { + limit = { $VAR$ = flag:leopard } + death = { death_reason = death_leopard } + } + else = { + death = { death_reason = death_maimed_by_wild_beast } + } + } + else = { + death = { death_reason = death_maimed_by_wild_beast } + } +} + +hunt_activity_random_subordinate_participant_effect = { + save_scope_value_as = { + name = hunt_participant_archetype + value = flag:$ARCHETYPE$ + } + save_scope_value_as = { + name = hunt_participant_martial_gender + value = flag:$COMBATANT$ + } + scope:activity = { + random_attending_character = { + limit = { + trigger_if = { + limit = { scope:hunt_participant_martial_gender = flag:yes } + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:host } + } + hunt_is_valid_subordinate_trigger = { LIEGE = scope:host } + } + weight = { + base = 10 + hunt_relevant_participant_modifiers = yes + } + save_scope_as = $SCOPE$ + } + } +} + +hunt_activity_random_interest_participant_effect = { + save_scope_value_as = { + name = hunt_participant_archetype + value = flag:$ARCHETYPE$ + } + save_scope_value_as = { + name = hunt_participant_martial_gender + value = flag:$COMBATANT$ + } + scope:activity = { + random_attending_character = { + # Major + limit = { + is_adult = yes + is_of_major_interest_trigger = { CHARACTER = root } + trigger_if = { + limit = { scope:hunt_participant_martial_gender = flag:yes } + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:host } + } + NAND = { + exists = scope:murder_target + this = scope:murder_target + } + } + # Minor + alternative_limit = { + is_adult = yes + is_of_minor_interest_trigger = { CHARACTER = root } + trigger_if = { + limit = { scope:hunt_participant_martial_gender = flag:yes } + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:host } + } + NAND = { + exists = scope:murder_target + this = scope:murder_target + } + } + weight = { + base = 10 + hunt_relevant_participant_modifiers = yes + } + save_scope_as = $SCOPE$ + } + } +} + +hunt_activity_chose_smaller_game_effect = { + save_scope_as = chose_smaller_game + if = { + limit = { exists = scope:hunt_participant } + scope:hunt_participant = { + add_opinion = { + modifier = hunt_disappointed_opinion + target = root + opinion = -10 + } + } + } + scope:activity = { + if = { + limit = { + any_attending_character = { + NOR = { + this = root + AND = { + exists = scope:hunt_participant + this = scope:hunt_participant + } + } + has_trait = lifestyle_hunter + } + } + every_attending_character = { + limit = { + NOR = { + this = root + AND = { + exists = scope:hunt_participant + this = scope:hunt_participant + } + } + has_trait = lifestyle_hunter + } + custom = hunt_every_hunter_attendee_tt + add_opinion = { + modifier = hunt_disappointed_opinion + target = root + opinion = -10 + } + } + } + } +} + +hunt_animal_kill_effect = { + save_scope_as = animal_slayer + play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Hunts/ConstructionKits/ep2_event_grand_hunt_ck_spear_impact" + # Is it possible to die? + save_scope_value_as = { + name = hunt_kill_death_chance + value = flag:$DEATH$ + } + + # Determine what is slayed + scope:activity = { + set_variable = { + name = kill_animal_type + value = $VAR$ + } + set_variable = { + name = animal_slayer + value = scope:animal_slayer + } + } +} + +hunt_animal_melee_kill_effect = { + save_scope_as = melee_kill + play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Hunts/ConstructionKits/ep2_event_grand_hunt_ck_spear_impact" + hunt_animal_kill_effect = { DEATH = $DEATH$ VAR = $VAR$ } + hunter_progress_point_gain_effect = { CHANGE = 3 RANDOM_CHANGE = 1 } #Gives Hunter Lifestyle XP + # Determine who could be wounded + scope:activity ?= { + random_attending_character = { + limit = { is_alive = yes } + save_scope_as = injury_target + hunt_wound_select_effect = yes + } + } + save_scope_as = injury_target + hunt_wound_select_effect = yes + duel = { + skill = prowess + value = hunt_melee_kill_prowess_value + 50 = { + desc = hunt_kill_success_melee + hunt_kill_melee_modifiers = yes # SPEAR + hunt_kill_hunter_modifiers = yes # HUNTER + if = { #chance_to_gain_prowess_during_bear_hunts parameter check + limit = { + faith = { has_doctrine_parameter = chance_to_gain_prowess_during_bear_hunts } + scope:activity.var:animal_type = flag:bear + } + add_prowess_skill = 1 + add_martial_skill = 1 + } + send_interface_toast = { + title = { + first_valid = { + triggered_desc = { + trigger = { scope:animal_slayer ?= root } + desc = hunt_kill_success_melee_root + } + desc = hunt_kill_success_melee_guest + } + } + left_icon = scope:animal_slayer + scope:activity ?= { + add_activity_log_entry = { + key = hunt_melee_log + tags = { kill } + score = 100 + + character = scope:animal_slayer + + #Effect + scope:animal_slayer ?= { + add_prestige = hunt_prestige_melee_value + # Complete activity intent if relevant + if = { + limit = { + AND = { + scope:hunt_kill_death_chance = flag:yes + NOT = { + hunt_small_game_trigger = { VAR = $VAR$ } + } + } + } + hunt_animal_slayer_memory_effect = yes + } + } + } + } + } + save_scope_as = melee_success + } + 1 = { # Injury + desc = hunt_kill_failure_melee + compare_modifier = { + value = scope:duel_value + multiplier = -3.5 + min = 5 + } + modifier = { + hunt_small_game_trigger = { VAR = $VAR$ } + factor = 0.05 + } + modifier = { add = hunt_melee_danger_value } + # Effect + hidden_effect = { + scope:injury_target = { + if = { + limit = { + hunt_animal_type_dangerous_trigger = { VAR = $VAR$ } + } + hunt_wound_apply_effect = { SEVERE = yes } + } + else = { + hunt_wound_apply_effect = { SEVERE = no } + } + } + } + scope:activity ?= { + add_activity_log_entry = { + key = hunt_melee_log + tags = { kill } + score = 100 + + character = scope:animal_slayer + + #Effects + scope:animal_slayer ?= { + add_prestige = hunt_prestige_melee_wound_value + # Complete activity intent if relevant + if = { + limit = { + AND = { + scope:hunt_kill_death_chance = flag:yes + NOT = { + hunt_small_game_trigger = { VAR = $VAR$ } + } + } + } + hunt_animal_slayer_memory_effect = yes + } + } + } + hidden_effect = { + add_activity_log_entry = { + key = hunt_melee_wounded_log + score = 75 + tags = { kill } + character = scope:injury_target + scope:injury_target = { hunt_wound_tooltip_effect = yes } + } + } + } + if = { + limit = { scope:severe ?= yes } + custom_tooltip = hunt_character_wound_tt + } + else = { + show_as_tooltip = { + increase_wounds_no_death_effect = { REASON = fight } + } + } + save_scope_as = melee_failure + } + 1 = { # Death + desc = hunt_kill_critical_failure_melee + trigger = { + scope:hunt_kill_death_chance = flag:yes + NOT = { + hunt_small_game_trigger = { VAR = $VAR$ } + } + } + compare_modifier = { + value = scope:duel_value + multiplier = -3.5 + min = 5 + } + modifier = { add = hunt_melee_kill_prowess_value } + scope:activity ?= { + add_activity_log_entry = { + key = hunt_melee_killed_log + score = 75 + tags = { kill } + character = scope:animal_slayer + + # Effect + scope:animal_slayer = { + hunt_animal_death_effect = { VAR = $VAR$ } + } + } + } + save_scope_as = melee_critical + } + } + # Outcome + scope:animal_slayer ?= { + if = { + limit = { has_activity_intent = slay_beast_intent } + show_as_tooltip = { complete_activity_intent = yes } + } + hunt_complete_slay_beast_intent_effect = yes # Complete activity intent if relevant + } + scope:activity ?= { + every_attending_character = { + limit = { is_ai = no } + trigger_event = hunt.1201 + } + } +} + +hunt_animal_melee_kill_group_effect = { + save_scope_as = group_kill + hunt_animal_kill_effect = { DEATH = $DEATH$ VAR = $VAR$ } + scope:activity ?= { + # Determine who is slaying + every_attending_character = { + limit = { + is_alive = yes + NOT = { has_character_flag = not_slaying } + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:host } + trigger_if = { + limit = { exists = scope:group_craven } + this != scope:host + } + } + custom = hunt_every_hunter_tt + add_to_list = animal_slayers + hunter_progress_point_gain_effect = { CHANGE = 1 RANDOM_CHANGE = 1 } #Gives Hunter Lifestyle XP + } + } + # Determine who could be wounded + random_in_list = { + list = animal_slayers + weight = { + base = 20 + hunt_likely_injured_modifiers = yes + } + save_scope_as = injury_target + hunt_wound_select_effect = yes + } + # Outcome + random_list = { + 50 = { # Animal is captured + trigger = { exists = scope:group_capture } + desc = hunt_kill_success_capture + scope:activity ?= { + add_activity_log_entry = { + key = hunt_melee_capture_log + score = 75 + tags = { kill } + character = scope:animal_slayer + + # Effect + every_in_list = { + list = animal_slayers + custom = hunt_every_hunter_tt + add_prestige = hunt_prestige_melee_group_value + } + } + } + save_scope_as = group_success + } + 50 = { # Animal is slain + trigger = { + NOT = { exists = scope:group_capture } + } + desc = hunt_kill_success_melee + scope:activity ?= { + add_activity_log_entry = { + key = hunt_melee_group_log + score = 75 + tags = { kill } + character = scope:animal_slayer + + # Effect + every_in_list = { + list = animal_slayers + custom = hunt_every_hunter_tt + add_prestige = hunt_prestige_melee_group_value + } + } + } + save_scope_as = group_success + } + 25 = { # ...but someone is injured + desc = hunt_kill_failure_melee_group + modifier = { add = hunt_melee_kill_prowess_value } + modifier = { + hunt_small_game_trigger = { VAR = $VAR$ } + factor = 0.1 + } + modifier = { add = hunt_melee_danger_value } + # Effect + hidden_effect = { + scope:injury_target = { + if = { # Big animal injure big + limit = { + hunt_animal_type_dangerous_trigger = { VAR = $VAR$ } + } + hunt_wound_apply_effect = { SEVERE = yes } + } + else = { # Smol animal injure smol + hunt_wound_apply_effect = { SEVERE = no } + } + } + } + scope:activity ?= { + add_activity_log_entry = { + key = hunt_melee_group_log + score = 75 + tags = { kill } + character = scope:animal_slayer + + # Effect + every_in_list = { + list = animal_slayers + custom = hunt_every_hunter_tt + add_prestige = hunt_prestige_melee_wound_group_value + } + } + hidden_effect = { + add_activity_log_entry = { + key = hunt_melee_group_wounded_log + score = 75 + tags = { kill } + character = scope:injury_target + scope:injury_target = { hunt_wound_tooltip_effect = yes } + } + } + } + custom_tooltip = hunt_random_attendee_injured_tt + save_scope_as = group_failure + } + 10 = { # ...but someone is killed + desc = hunt_kill_critical_failure_melee_group + trigger = { + scope:hunt_kill_death_chance = flag:yes + NOT = { + hunt_small_game_trigger = { VAR = $VAR$ } + } + } + modifier = { add = hunt_melee_kill_prowess_value } + custom_tooltip = hunt_random_attendee_killed_tt + scope:activity ?= { + add_activity_log_entry = { + key = hunt_melee_group_log + score = 75 + tags = { kill } + character = scope:animal_slayer + } + hidden_effect = { + add_activity_log_entry = { + key = hunt_melee_group_killed_log + score = 75 + tags = { kill } + character = scope:injury_target + + # Effect + scope:injury_target = { + hunt_animal_death_effect = { VAR = $VAR$ } + } + } + } + } + save_scope_as = group_critical + } + } + if = { + limit = { + NOT = { exists = scope:group_capture } + } + hidden_effect = { + every_in_list = { + list = animal_slayers + custom = hunt_every_slay_beast_hunter_tt + # Complete activity intent if relevant + hunt_complete_slay_beast_intent_effect = yes + } + } + } + scope:activity ?= { + every_attending_character = { + limit = { is_ai = no } + trigger_event = hunt.1202 + } + } +} + +hunt_animal_bow_kill_effect = { + save_scope_as = bow_kill + hunt_animal_kill_effect = { DEATH = $DEATH$ VAR = $VAR$ } + if = { + limit = { has_trait = tourney_participant } + add_trait_xp = { + trait = tourney_participant + track = bow + value = { 1 3 } + } + hunter_progress_point_gain_effect = { CHANGE = 1 RANDOM_CHANGE = 1 } #Gives Hunter Lifestyle XP + } + else = { + hunter_progress_point_gain_effect = { CHANGE = 2 RANDOM_CHANGE = 1 } #Gives Hunter Lifestyle XP + } + # Determine who could be wounded + scope:activity ?= { + random_attending_character = { + limit = { is_alive = yes } + save_scope_as = injury_target + hunt_wound_select_effect = yes + } + } + if = { # Separate win option to avoid Duel tooltips if very easy + limit = { + scope:hunt_kill_death_chance = flag:no + exists = scope:hunt_ending + scope:activity = { + hunt_story_trigger = { STORY = chase } + } + } + scope:activity ?= { + add_activity_log_entry = { + key = hunt_bow_log + score = 75 + tags = { kill } + character = scope:animal_slayer + + # Effect + scope:animal_slayer = { + # Complete activity intent if relevant + if = { + limit = { has_activity_intent = slay_beast_intent } + show_as_tooltip = { complete_activity_intent = yes } + } + hunt_complete_slay_beast_intent_effect = yes + add_prestige = hunt_prestige_bow_value + } + } + } + save_scope_as = bow_success + play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Hunts/ConstructionKits/ep2_event_grand_hunt_ck_arrow_shoot" + } + else = { + duel = { + skill = prowess + value = hunt_melee_kill_prowess_value + 50 = { # Success + desc = hunt_kill_success_bow_tt + hunt_kill_bow_modifiers = yes # BOW + hunt_kill_hunter_modifiers = yes # HUNTER + compare_modifier = { + value = scope:duel_value + multiplier = 3.5 + min = -25 + } + scope:activity ?= { + add_activity_log_entry = { + key = hunt_bow_log + score = 75 + tags = { kill } + character = scope:animal_slayer + + # Effect + scope:animal_slayer = { + add_prestige = hunt_prestige_bow_value + # Complete activity intent if relevant + if = { + limit = { has_activity_intent = slay_beast_intent } + show_as_tooltip = { complete_activity_intent = yes } + } + hunt_complete_slay_beast_intent_effect = yes + if = { + limit = { + has_activity_intent = impose_obedience_intent + scope:host.intent_target = { + NOT = { is_obedient_to = scope:host } + } + } + scope:host.intent_target = { + add_opinion = { + target = scope:host + modifier = obedience_opinion + } + } + } + hunt_animal_slayer_memory_effect = yes + if = { #chance_to_gain_prowess_during_bear_hunts parameter check + limit = { + faith = { has_doctrine_parameter = chance_to_gain_prowess_during_bear_hunts } + scope:activity.var:animal_type = flag:bear + } + random = { + chance = 10 + add_prowess_skill = 1 + } + } + } + } + } + save_scope_as = bow_success + play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Hunts/ConstructionKits/ep2_event_grand_hunt_ck_arrow_impact_hit" + } + 5 = { # Failure + desc = hunt_kill_failure_melee_group + trigger = { scope:hunt_kill_death_chance = flag:yes } + compare_modifier = { + value = scope:duel_value + multiplier = -1.5 + min = 1 + } + modifier = { + hunt_small_game_trigger = { VAR = $VAR$ } + factor = 0.1 + } + modifier = { add = hunt_bow_danger_value } + custom_tooltip = hunt_random_attendee_injured_tt + hidden_effect = { + scope:host ?= { + send_interface_toast = { + title = hunt_kill_failure_melee_group + left_icon = scope:animal_slayer + right_icon = scope:injury_target + scope:activity = { + add_activity_log_entry = { + key = hunt_bow_log + score = 75 + tags = { kill } + character = scope:animal_slayer + target = scope:injury_target + + # Effect + scope:animal_slayer = { + custom_tooltip = hunt_kill_failure_bow + # Complete activity intent if relevant + hunt_complete_slay_beast_intent_effect = yes + } + if = { + limit = { exists = scope:injury_target } + scope:injury_target = { hunt_wound_tooltip_effect = yes } + } + } + } + } + } + } + save_scope_as = bow_failure + play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Hunts/ConstructionKits/ep2_event_grand_hunt_ck_arrow_impact_miss" + } + 50 = { # Critical Failure + desc = hunt_kill_critical_failure_bow_tt + trigger = { + NAND = { + exists = scope:hunt_ending + scope:activity ?= { + hunt_story_trigger = { STORY = chase } + } + } + } + compare_modifier = { + value = scope:duel_value + multiplier = -3.5 + min = 5 + } + send_interface_toast = { + title = hunt_kill_miss_bow_tt + left_icon = scope:animal_slayer + scope:activity ?= { + add_activity_log_entry = { + key = hunt_bow_miss_log + score = 75 + tags = { kill } + character = scope:animal_slayer + } + } + } + save_scope_as = bow_critical + play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Hunts/ConstructionKits/ep2_event_grand_hunt_ck_arrow_impact_miss" + } + } + } + scope:activity = { + every_attending_character = { + limit = { is_ai = no } + trigger_event = hunt.1200 + } + } +} + +animal_artifact_wealth_quality_effect = { + save_scope_value_as = { + name = quality + value = { + value = 0 + if = { + limit = { + exists = scope:excellent_animal_artifacts + } + add = 500 + } + if = { + limit = { + OR = { + scope:owner.var:animal_type ?= flag:hare + AND = { + hunt_activity_bird_trigger = { VAR = scope:owner.var:animal_type } + NOR = { + hunt_activity_ground_bird_trigger = { VAR = scope:owner.var:animal_type } + hunt_activity_exotic_bird_trigger = { VAR = scope:owner.var:animal_type } + } + } + } + } + add = { 0 30 } + } + else_if = { + limit = { + OR = { + scope:owner.var:animal_type ?= flag:fox + hunt_activity_ground_bird_trigger = { VAR = scope:owner.var:animal_type } + } + } + add = { 15 45 } + } + else_if = { + limit = { + OR = { + scope:owner.var:animal_type ?= flag:roe + scope:owner.var:animal_type ?= flag:gazelle + # Pets + scope:owner.var:animal_type ?= flag:cat + scope:owner.var:animal_type ?= flag:dog + scope:owner.var:animal_type ?= flag:eagle + } + } + add = { 30 60 } + } + else_if = { + limit = { + OR = { + scope:owner.var:animal_type ?= flag:wolf + scope:owner.var:animal_type ?= flag:hyena + scope:owner.var:animal_type ?= flag:lynx + # Exotic Birds + hunt_activity_exotic_bird_trigger = { VAR = scope:owner.var:animal_type } + } + } + add = { 45 75 } + } + else_if = { + limit = { + OR = { + scope:owner.var:animal_type ?= flag:bison + scope:owner.var:animal_type ?= flag:aurochs + scope:owner.var:animal_type ?= flag:stag + scope:owner.var:animal_type ?= flag:reindeer + scope:owner.var:animal_type ?= flag:antelope + } + } + add = { 60 90 } + } + else_if = { + limit = { + OR = { + scope:owner.var:animal_type ?= flag:lion + scope:owner.var:animal_type ?= flag:tiger + scope:owner.var:animal_type ?= flag:bear + scope:owner.var:animal_type ?= flag:leopard + } + } + add = { 75 105 } + } + else_if = { + limit = { + OR = { + scope:owner.var:animal_type ?= flag:boar + scope:owner.var:animal_type ?= flag:hart + scope:owner.var:animal_type ?= flag:elk + } + } + add = { 90 120 } + } + if = { + limit = { scope:legendary ?= yes } + multiply = 2 + } + if = { + limit = { exists = scope:impressive_trophy } + multiply = 1.5 + } + if = { + limit = { exists = var:pet_name } + multiply = 2 + } + } + } + save_scope_value_as = { + name = wealth + value = { + if = { + limit = { + exists = scope:excellent_animal_artifacts + } + add = 500 + } + if = { + # If our artifact already has a quality, set base wealth equal to 1/4th quality value. + limit = { exists = scope:quality } + add = scope:quality + multiply = 0.5 + round = yes + } + else = { + add = 10 # Otherwise, set base wealth value to 10. + } + scope:creator = { + if = { + limit = { has_trait = lifestyle_hunter } + add = 10 + } + } + if = { # Falconry Exp + limit = { + exists = scope:activity + scope:activity = { + has_activity_type = activity_hunt + has_activity_option = { category = special_type option = hunt_type_falconry } + } + } + if = { + limit = { + scope:creator = { + hunt_lifestyle_track_greater_equal_trigger = { TRACK = falconer GREATER_EQUAL = 50 } + } + } + add = 10 + } + if = { + limit = { + scope:creator = { + hunt_lifestyle_track_greater_equal_trigger = { TRACK = falconer GREATER_EQUAL = 100 } + } + } + add = 10 + } + } + else = { # Hunter Exp + if = { + limit = { + scope:creator = { + hunt_lifestyle_track_greater_equal_trigger = { TRACK = hunter GREATER_EQUAL = 50 } + } + } + add = 10 + } + if = { + limit = { + scope:creator = { + hunt_lifestyle_track_greater_equal_trigger = { TRACK = hunter GREATER_EQUAL = 100 } + } + } + add = 10 + } + } + } + } +} + +hunt_animal_slayer_bow_opinion_effect = { + if = { + limit = { hunt_dharmic_pacificist_trigger = yes } + add_opinion = { + target = scope:host + modifier = hunt_dharmic_mercy_opinion + opinion = -15 + } + stress_impact = { base = minor_stress_impact_gain } + add_character_flag = { + flag = dharmic_mercy_flag + weeks = 1 + } + } + else_if = { + limit = { + scope:host = { + exists = intent_target + OR = { + has_activity_intent = befriend_attendee_intent + has_activity_intent = woo_attendee_intent + AND = { + has_activity_intent = impose_obedience_intent + scope:host.intent_target = { # They're not obedient to you already + NOT = { is_obedient_to = scope:host } + } + } + } + } + this = scope:host.intent_target + } + save_scope_as = opinion_target + scope:host = { + switch = { + trigger = has_activity_intent + befriend_attendee_intent = { + progress_towards_friend_effect = { + REASON = friend_gave_hunt_kill_reason + CHARACTER = scope:opinion_target + OPINION = default_friend_opinion + } + } + woo_attendee_intent = { + progress_towards_lover_effect = { + REASON = friend_gave_hunt_kill_reason + CHARACTER = scope:opinion_target + OPINION = default_lover_opinion + } + } + impose_obedience_intent = { + scope:opinion_target = { + add_opinion = { + target = scope:host + modifier = obedience_opinion + } + } + } + } + } + } + else_if = { + limit = { + OR = { + $VAR$ = flag:hart + $VAR$ = flag:boar + } + } + add_opinion = { + target = scope:host + modifier = hunt_honored_with_kill_opinion + opinion = 15 + } + } + else_if = { + limit = { + OR = { + $VAR$ = flag:fox + $VAR$ = flag:hare + } + } + add_opinion = { + target = scope:host + modifier = hunt_honored_with_kill_opinion + opinion = 5 + } + } + else = { + add_opinion = { + target = scope:host + modifier = hunt_honored_with_kill_opinion + opinion = 10 + } + } +} + +hunt_animal_slayer_melee_opinion_effect = { + if = { + limit = { + OR = { + has_trait = craven + AND = { + NOT = { has_trait = lifestyle_hunter } + OR = { + scope:activity.var:animal_type = flag:hart + scope:activity.var:animal_type = flag:boar + } + } + hunt_dharmic_pacificist_trigger = yes + } + } + add_opinion = { + target = scope:host + modifier = hunt_forced_to_kill_opinion + opinion = -10 + } + } + else_if = { + limit = { + scope:host = { + exists = intent_target + OR = { + has_activity_intent = befriend_attendee_intent + has_activity_intent = woo_attendee_intent + AND = { + has_activity_intent = impose_obedience_intent + scope:host.intent_target = { # They're not obedient to you already + NOT = { is_obedient_to = scope:host } + } + } + } + } + this = scope:host.intent_target + } + save_scope_as = opinion_target + scope:host = { + switch = { + trigger = has_activity_intent + befriend_attendee_intent = { + progress_towards_friend_effect = { + REASON = friend_gave_hunt_kill_reason + CHARACTER = scope:opinion_target + OPINION = default_friend_opinion + } + } + woo_attendee_intent = { + progress_towards_lover_effect = { + REASON = friend_gave_hunt_kill_reason + CHARACTER = scope:opinion_target + OPINION = default_lover_opinion + } + } + impose_obedience_intent = { + scope:opinion_target = { + add_opinion = { + target = scope:host + modifier = obedience_opinion + } + } + } + } + } + } + else_if = { + limit = { + OR = { + has_trait = lifestyle_hunter + has_trait = ambitious + has_trait = arrogant + has_trait = brave + } + } + add_opinion = { + target = scope:host + modifier = hunt_honored_with_kill_opinion + opinion = 10 + } + } +} + +hunt_activity_method_effect = { + custom_tooltip = hunt_activity_$STORY$_tt + scope:activity = { + if = { + limit = { exists = var:hunt_activity_story } + remove_variable = hunt_activity_story + } + set_variable = { + name = hunt_activity_story + value = flag:$STORY$ + } + add_activity_log_entry = { + key = hunt_$STORY$_method_selected_log + score = 25 + tags = { method } + character = scope:host + } + } +} + +activity_improve_relations_intent_effect = { + if = { + limit = { + intent_target ?= $CHARACTER$ + OR = { + has_activity_intent = befriend_attendee_intent + has_activity_intent = woo_attendee_intent + AND = { + has_activity_intent = impose_obedience_intent + scope:host.intent_target = { # They're not obedient to you already + NOT = { is_obedient_to = scope:host } + } + } + } + } + switch = { + trigger = has_activity_intent + befriend_attendee_intent = { + progress_towards_friend_effect = { + REASON = $REASON$ + CHARACTER = $CHARACTER$ + OPINION = default_friend_opinion + } + } + woo_attendee_intent = { + progress_towards_lover_effect = { + REASON = $REASON$ + CHARACTER = $CHARACTER$ + OPINION = default_lover_opinion + } + } + impose_obedience_intent = { + scope:opinion_target = { + add_opinion = { + target = scope:host + modifier = obedience_opinion + } + } + } + } + } + else_if = { + limit = { + NOT = { this = $CHARACTER$ } + } + reverse_add_opinion = { + modifier = $MODIFIER$ + opinion = $OPINION$ + target = $CHARACTER$ + } + } +} + +# Save master of the hunt or a fallback +hunt_activity_sighting_master_effect = { + add_character_flag = { + flag = recent_hunt_sighting + years = 3 + } + save_scope_value_as = { + name = lifestyle + value = flag:$TYPE$ + } + if = { + limit = { + employs_court_position = master_of_hunt_court_position + court_position:master_of_hunt_court_position = { is_available_adult = yes } + } + court_position:master_of_hunt_court_position = { save_scope_as = sighting_character } + } + else_if = { + limit = { + employs_court_position = huntperson_camp_officer + court_position:huntperson_camp_officer = { is_available_adult = yes } + } + court_position:huntperson_camp_officer = { save_scope_as = sighting_character } + } + else = { + every_vassal_or_below = { + limit = { + is_available_adult = yes + has_trait = lifestyle_hunter + } + add_to_list = potential_sighting_givers + } + every_courtier = { + limit = { + is_available_adult = yes + has_trait = lifestyle_hunter + } + add_to_list = potential_sighting_givers + } + random_in_list = { + list = potential_sighting_givers + weight = { + base = 1 + modifier = { + factor = 2 + scope:lifestyle = flag:hunter + has_trait_xp = { + trait = lifestyle_hunter + track = hunter + value >= 25 + } + } + modifier = { + factor = 2 + scope:lifestyle = flag:falconer + has_trait_xp = { + trait = lifestyle_hunter + track = falconer + value >= 25 + } + } + modifier = { + factor = 0 + # Exclude clergy who don't fight + is_clergy = yes + NOR = { + faith = { has_doctrine_parameter = clergy_can_fight } + culture = { has_cultural_parameter = culture_clergy_can_fight } + } + } + modifier = { + factor = 0.1 + scope:lifestyle = flag:hunter + NOT = { + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } + } + } + } + save_scope_as = sighting_character + } + } + scope:sighting_character ?= { save_scope_as = portrait_character } + if = { + limit = { + NOT = { exists = scope:sighting_character } + is_ai = no + } + create_character = { + location = root.location + template = hunter_template + culture = root.location.culture + faith = root.location.faith + dynasty = none + save_scope_as = new_hunter + } + scope:new_hunter = { save_scope_as = portrait_character } + } +} + +hunt_dharmic_pacificism_effect = { + scope:activity ?= { + if = { + limit = { + any_attending_character = { + NOT = { scope:host ?= this } + hunt_dharmic_pacificist_trigger = yes + NOT = { has_character_flag = dharmic_mercy_flag } + } + } + every_attending_character = { + limit = { + NOT = { scope:host ?= this } + hunt_dharmic_pacificist_trigger = yes + NOT = { has_character_flag = dharmic_mercy_flag } + } + custom = every_non_cynical_dharmic_attendee_tt + add_opinion = { + target = root + modifier = hunt_dharmic_mercy_opinion + opinion = -10 + } + } + } + } + scope:host ?= { hunt_dharmic_pacificism_stress_effect = yes } +} + +hunt_dharmic_pacificism_stress_effect = { + if = { + limit = { + is_alive = yes + hunt_dharmic_pacificist_trigger = yes + } + if = { + limit = { + NOT = { scope:host ?= this } + } + add_opinion = { + target = scope:host + modifier = hunt_dharmic_mercy_opinion + opinion = -15 + } + } + stress_impact = { base = minor_stress_impact_gain } + add_character_flag = { + flag = dharmic_mercy_flag + weeks = 1 + } + } +} + +hunt_humble_hunter_stress_effect = { + if = { + limit = { is_alive = yes } + stress_impact = { + lazy = miniscule_stress_impact_gain + humble = miniscule_stress_impact_gain + shy = miniscule_stress_impact_gain + generous = miniscule_stress_impact_gain + lifestyle_hunter = minor_stress_impact_loss + } + } +} + +hunt_jealous_hunter_stress_effect = { + if = { + limit = { is_alive = yes } + stress_impact = { + diligent = miniscule_stress_impact_gain + arrogant = miniscule_stress_impact_gain + arbitrary = miniscule_stress_impact_gain + greedy = miniscule_stress_impact_gain + lifestyle_hunter = minor_stress_impact_gain + } + } +} + +hunt_remove_variables_effect = { + scope:host = { + if = { + limit = { is_alive = yes } + if = { + limit = { has_character_flag = dangerous_road } + remove_character_flag = dangerous_road + } + if = { + limit = { exists = var:animal_type } + remove_variable = animal_type + } + if = { + limit = { has_variable = strife_loss_total } + remove_variable = strife_loss_total + } + } + } + scope:activity = { + every_attending_character = { + if = { + limit = { exists = var:animal_type } + remove_variable = animal_type + } + } + } +} + +hunt_wound_select_effect = { + hidden_effect = { + random_list = { + 50 = { + save_scope_value_as = { + name = wound + value = flag:wound + } + } + 5 = { + trigger = { + NOT = { has_trait = incapable } + } + modifier = { + has_trait = wounded + add = 1 + } + save_scope_value_as = { + name = wound + value = flag:incapable + } + } + 5 = { + trigger = { + NOT = { has_trait = maimed } + } + modifier = { + has_trait = wounded + add = 1 + } + save_scope_value_as = { + name = wound + value = flag:maimed + } + } + 5 = { + trigger = { + NOT = { has_trait = one_eyed } + } + modifier = { + has_trait = wounded + add = 1 + } + save_scope_value_as = { + name = wound + value = flag:one_eyed + } + } + 5 = { + trigger = { + NOT = { has_trait = one_legged } + } + modifier = { + has_trait = wounded + add = 1 + } + save_scope_value_as = { + name = wound + value = flag:one_legged + } + } + 5 = { + trigger = { + NOT = { has_trait = disfigured } + } + modifier = { + has_trait = wounded + add = 1 + } + save_scope_value_as = { + name = wound + value = flag:disfigured + } + } + 5 = { + save_scope_value_as = { + name = wound + value = flag:none + } + } + } + } +} + +hunt_wound_apply_effect = { + if = { + limit = { has_character_flag = hunt_wound_ignored } + remove_character_flag = hunt_wound_ignored + } + save_scope_value_as = { + name = severe + value = $SEVERE$ + } + if = { + limit = { scope:severe = yes } + if = { + limit = { + NOT = { scope:wound = flag:wound } + } + hidden_effect = { + change_trait_rank = { + trait = wounded + rank = 1 + max = 3 + } + } + } + switch = { + trigger = scope:wound + flag:wound = { + hidden_effect = { + change_trait_rank = { + trait = wounded + rank = 2 + max = 3 + } + } + } + flag:incapable = { add_trait_force_tooltip = incapable } + flag:maimed = { apply_maimed_trait_and_modifier_effect = yes } + flag:one_eyed = { add_trait_force_tooltip = one_eyed } + flag:one_legged = { add_trait_force_tooltip = one_legged } + flag:disfigured = { add_trait_force_tooltip = disfigured } + flag:none = {} + } + } + else = { + hidden_effect = { + change_trait_rank = { + trait = wounded + rank = 1 + max = 3 + } + } + } + if = { + limit = { has_trait = wounded_1 } + add_trait_force_tooltip = wounded_1 + } + else_if = { + limit = { has_trait = wounded_2 } + add_trait_force_tooltip = wounded_2 + } + else = { add_trait_force_tooltip = wounded_3 } + add_character_flag = { + flag = recent_hunt_wound + weeks = 1 + } +} + +hunt_wound_tooltip_effect = { + show_as_tooltip = { + if = { + limit = { has_trait = wounded_3 } + add_trait_force_tooltip = wounded_3 + } + else_if = { + limit = { has_trait = wounded_2 } + add_trait_force_tooltip = wounded_2 + } + else_if = { + limit = { has_trait = wounded_1 } + add_trait_force_tooltip = wounded_1 + } + if = { + limit = { scope:severe = yes } + switch = { + trigger = scope:wound + flag:wound = {} + flag:incapable = { add_trait_force_tooltip = incapable } + flag:maimed = { apply_maimed_trait_and_modifier_effect = yes } + flag:one_eyed = { add_trait_force_tooltip = one_eyed } + flag:one_legged = { add_trait_force_tooltip = one_legged } + flag:disfigured = { add_trait_force_tooltip = disfigured } + flag:none = {} + } + } + } +} + +hunt_story_tooltip_effect = { + if = { + limit = { + hunt_story_trigger = { STORY = chase } + } + custom_tooltip = hunt_activity_chase_tt + } + else_if = { + limit = { + hunt_story_trigger = { STORY = stealth } + } + custom_tooltip = hunt_activity_stealth_tt + } + else_if = { + limit = { + hunt_story_trigger = { STORY = ambush } + } + custom_tooltip = hunt_activity_ambush_tt + } +} + +hunt_save_murder_target_effect = { + hidden_effect = { + if = { + limit = { hunt_murder_intent_target_trigger = yes } + intent_target = { save_scope_as = murder_target } + } + else_if = { + limit = { + var:hunt_murder_attempt ?= { + is_alive = yes + is_participant_in_activity = scope:activity + } + } + var:hunt_murder_attempt = { + save_scope_as = murder_target + random_targeting_scheme = { + limit = { + scheme_type = murder + OR = { + scheme_owner = root + any_scheme_agent_character = { this = root } + } + } + save_scope_as = scheme + every_scheme_agent_character = { add_to_list = murder_agents } + scheme_owner = { save_scope_as = murder_schemer } + hunt_save_hostile_accomplice_effect = { + SCHEME = murder + VICTIM = scope:murder_target + } + } + } + } + else_if = { + limit = { hunt_1012_hated_participant_trigger = yes } + var:participant_to_use_1011 = { save_scope_as = murder_target } + } + else = { + scope:activity = { + random_attending_character = { + limit = { has_relation_nemesis = root } + alternative_limit = { has_relation_rival = root } + save_scope_as = murder_target + } + } + } + if = { + limit = { + NOT = { exists = scope:accomplice } + } + random_list = { + 10 = { + trigger = { + primary_title = { + has_order_of_succession = election + any_election_candidate = { this = scope:murder_target } + any_elector = { + hunt_elective_accomplice_trigger = { + MURDERER = scope:murder_target + TARGET = root + } + } + } + } + primary_title = { + ordered_elector = { + limit = { + hunt_elective_accomplice_trigger = { + MURDERER = scope:murder_target + TARGET = root + } + } + order_by = intrigue + save_scope_as = accomplice + save_scope_as = elective_accomplice + } + } + } + 10 = { + trigger = { + any_targeting_faction = { + hunt_claimant_faction_trigger = { + MURDERER = scope:murder_target + TARGET = root + } + any_faction_member = { + hunt_accomplice_general_trigger = { + MURDERER = scope:murder_target + TARGET = root + } + } + } + } + random_targeting_faction = { + limit = { + hunt_claimant_faction_trigger = { + MURDERER = scope:murder_target + TARGET = root + } + any_faction_member = { + hunt_accomplice_general_trigger = { + MURDERER = scope:murder_target + TARGET = root + } + } + } + ordered_faction_member = { + limit = { + hunt_accomplice_general_trigger = { + MURDERER = scope:murder_target + TARGET = root + } + } + order_by = intrigue + save_scope_as = accomplice + save_scope_as = claimant_accomplice + } + } + } + 10 = { + trigger = { + scope:murder_target = { + any_relation = { + type = lover + type = friend + hunt_accomplice_general_trigger = { + MURDERER = scope:murder_target + TARGET = root + } + } + } + } + scope:murder_target = { + ordered_relation = { + type = lover + type = friend + limit = { + hunt_accomplice_general_trigger = { + MURDERER = scope:murder_target + TARGET = root + } + } + order_by = intrigue + save_scope_as = accomplice + save_scope_as = relation_accomplice + } + } + } + 0 = {} + } + } + } +} + +hunt_save_physician_effect = { + if = { + limit = { + exists = court_position:court_physician_court_position + court_position:court_physician_court_position = { + is_participant_in_activity = scope:activity + is_alive = yes + } + } + court_position:court_physician_court_position = { save_scope_as = physician } + } +} + +hunt_physician_treatment_effect = { + scope:physician = { + duel = { + skill = learning + value = medium_skill_rating + 20 = { + compare_modifier = { + value = scope:duel_value + multiplier = 3.5 + min = -25 + } + min = 5 + desc = hunt.4014.c.success + scope:host = { + send_interface_toast = { + title = hunt.4014.c.success + left_icon = scope:patient + right_icon = scope:physician + scope:patient = { + change_trait_rank = { + trait = wounded + rank = -1 + max = 1 + } + if = { + limit = { + this != scope:host + } + add_opinion = { + target = scope:host + modifier = grateful_opinion + opinion = 10 + } + } + add_opinion = { + target = scope:physician + modifier = grateful_opinion + opinion = 10 + } + } + } + } + } + 15 = { + compare_modifier = { + value = scope:duel_value + multiplier = -3.5 + min = -25 + } + modifier = { + factor = 0.5 + has_trait = lifestyle_physician + } + min = 5 + desc = hunt.4014.c.failure + scope:host = { + send_interface_toast = { + title = hunt.4014.c.failure + left_icon = scope:patient + right_icon = scope:physician + scope:patient = { + add_character_modifier = { modifier = infected_wound_modifier } + add_opinion = { + target = scope:physician + modifier = failed_to_treat_me_opinion + opinion = -15 + } + } + } + } + } + } + } +} + +hunt_friendly_intent_effect = { + if = { + limit = { + has_activity_intent = woo_attendee_intent + intent_target ?= $TARGET$ + } + progress_towards_lover_effect = { + REASON = $REASON$ + CHARACTER = $TARGET$ + OPINION = default_lover_opinion + } + } + else_if = { + limit = { + has_activity_intent = befriend_attendee_intent + intent_target ?= $TARGET$ + } + progress_towards_friend_effect = { + REASON = $REASON$ + CHARACTER = $TARGET$ + OPINION = default_friend_opinion + } + } + else = { + if = { + limit = { + can_add_hook = { target = $TARGET$ type = favor_hook } + } + add_hook = { type = favor_hook target = $TARGET$ } + } + } +} + +# Give hunt xp to every attending character +hunt_all_attendee_xp_effect = { + hidden_effect = { + scope:activity = { + every_attending_character = { + limit = { + is_alive = yes + NOT = { has_character_flag = not_slaying } + trigger_if = { + limit = { + NOT = { + scope:activity = { + has_activity_option = { category = special_type option = hunt_type_falconry } + } + } + } + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:host } + } + } + add_to_list = animal_slayers + } + activity_host = { add_to_list = animal_slayers } + } + every_in_list = { + list = animal_slayers + if = { + limit = { has_trait = lifestyle_hunter } + send_interface_toast = { + title = hunter_xp_gain_message + hunter_progress_point_gain_effect = { CHANGE = $CHANGE$ RANDOM_CHANGE = $RANDOM$ } #Gives points towards ranking up the Hunter Lifestyle + } + } + else = { + hunter_progress_point_gain_effect = { CHANGE = $CHANGE$ RANDOM_CHANGE = $RANDOM$ } #Gives points towards ranking up the Hunter Lifestyle + } + } + } +} + +hunt_intent_outcome_tooltip_effect = { + if = { # Murder + limit = { has_activity_intent = murder_attendee_intent } + if = { + limit = { + exists = intent_target.killer + intent_target.killer = root + } + custom_tooltip = intent_murder_success_tt + } + else_if = { + limit = { + exists = intent_target.killer + intent_target.killer = { is_alive = no } + } + custom_tooltip = intent_murder_dead_tt + } + else = { custom_tooltip = intent_murder_fail_tt } + } + if = { # Impose Obedience + limit = { has_activity_intent = impose_obedience_intent } + if = { + limit = { + intent_target = { is_obedient_to = root } + } + custom_tooltip = intent_obedience_success_tt + } + else = { custom_tooltip = intent_obedience_fail_tt } + } + else_if = { # Woo + limit = { has_activity_intent = woo_attendee_intent } + if = { + limit = { has_relation_lover = intent_target } + custom_tooltip = intent_woo_success_tt + } + else_if = { + limit = { has_relation_potential_friend = intent_target } + custom_tooltip = intent_woo_potential_tt + } + else = { custom_tooltip = intent_woo_fail_tt } + } + else_if = { # Befriend + limit = { has_activity_intent = befriend_attendee_intent } + if = { + limit = { has_relation_friend = intent_target } + custom_tooltip = intent_befriend_success_tt + } + else_if = { + limit = { has_relation_potential_friend = intent_target } + custom_tooltip = intent_befriend_potential_tt + } + else = { custom_tooltip = intent_befriend_fail_tt } + } +} + +hunt_participant_to_blame_effect = { + scope:activity = { + if = { + limit = { + any_attending_character = { + NOR = { + this = root + this = scope:murder_target + } + is_alive = yes + } + } + every_attending_character = { + limit = { + NOR = { + this = root + this = scope:murder_target + } + is_alive = yes + } + add_to_list = potential_blamees + } + random_in_list = { + list = potential_blamees + limit = { #Blame someone you don't like! + OR = { + has_relation_rival = root + has_relation_potential_rival = root + reverse_opinion = { + target = root + value <= -30 + } + } + } + alternative_limit = { + reverse_opinion = { + target = root + value <= -10 + } + } + alternative_limit = { always = yes } #Just pick whomever at this stage + weight = { + base = 10 + modifier = { + add = -9 + OR = { + has_relation_friend = root + has_relation_potential_friend = root + has_relation_lover = root + } + } + } + save_scope_as = participant_to_blame + } + } + } +} + +hunt_murder_confession_opinion_effect = { + scope:activity = { + every_attending_character = { #All honorable participants lose opinion + limit = { + this != root + this != scope:murder_target + is_alive = yes + ai_honor >= high_positive_honor + } + custom = hunt.1014.all_honorable_hunt_participants + add_opinion = { + modifier = opinion_acting_strange + target = root + } + } + every_attending_character = { #All evil participants gain opinion + limit = { + this != root + this != scope:murder_target + is_alive = yes + OR = { + has_trait = sadistic + opinion = { + target = scope:murder_target + value <= -30 + } + } + } + custom = hunt.1014.all_who_dislike_or_are_evil + add_opinion = { + modifier = cruelty_opinion + target = root + opinion = 10 + } + } + } +} + +hunt_increment_murder_accident_attempt = { + if = { + limit = { exists = var:hunt_murder_accident_attempt } + change_variable = { + name = hunt_murder_accident_attempt + add = 1 + } + set_variable = { + name = hunt_murder_accident_attempt + value = var:hunt_murder_accident_attempt + years = 10 + } + custom_tooltip = hunt_attempted_accident_murder_tt + } + else = { + set_variable = { + name = hunt_murder_accident_attempt + value = 1 + years = 10 + } + } +} + +hunt_animal_from_death_effect = { + $DEAD$ = { + switch = { + trigger = death_reason + death_deer = { + $TARGET$ = { set_variable = { name = animal_type value = flag:stag } } + } + death_moose = { + $TARGET$ = { set_variable = { name = animal_type value = flag:elk } } + } + death_bear = { + $TARGET$ = { set_variable = { name = animal_type value = flag:bear } } + } + death_boar = { + $TARGET$ = { set_variable = { name = animal_type value = flag:boar } } + } + death_antelope = { + $TARGET$ = { set_variable = { name = animal_type value = flag:antelope } } + } + death_gazelle = { + $TARGET$ = { set_variable = { name = animal_type value = flag:gazelle } } + } + death_bison = { + $TARGET$ = { set_variable = { name = animal_type value = flag:bison } } + } + death_aurochs = { + $TARGET$ = { set_variable = { name = animal_type value = flag:aurochs } } + } + death_wolf = { + $TARGET$ = { set_variable = { name = animal_type value = flag:wolf } } + } + death_hyena = { + $TARGET$ = { set_variable = { name = animal_type value = flag:hyena } } + } + death_lion = { + $TARGET$ = { set_variable = { name = animal_type value = flag:lion } } + } + death_tiger = { + $TARGET$ = { set_variable = { name = animal_type value = flag:tiger } } + } + death_leopard = { + $TARGET$ = { set_variable = { name = animal_type value = flag:leopard } } + } + death_lynx = { + $TARGET$ = { set_variable = { name = animal_type value = flag:lynx } } + } + death_roe = { + $TARGET$ = { set_variable = { name = animal_type value = flag:roe } } + } + death_hart = { + $TARGET$ = { set_variable = { name = animal_type value = flag:hart } } + } + } + } +} + +hunt_chance_for_no_pelt_effect = { + # Chance for no pelt reward + if = { + limit = { has_royal_court = yes } + random = { + chance = 50 + custom_tooltip = hunt_pelt_damaged_tt + scope:activity = { set_variable = pelt_damaged } + } + } +} + +hunt_no_pelt_effect = { + if = { + limit = { has_royal_court = yes } + custom_tooltip = hunt_pelt_damaged_tt + scope:activity = { set_variable = pelt_damaged } + } +} + +hunt_no_skull_effect = { + if = { + limit = { has_royal_court = yes } + custom_tooltip = hunt_skull_damaged_tt + scope:activity = { set_variable = skull_damaged } + } +} + +hunt_save_master_or_hunter_courtier_effect = { + if = { + limit = { + employs_court_position = master_of_hunt_court_position + court_position:master_of_hunt_court_position = { is_available = yes } + } + court_position:master_of_hunt_court_position = { save_scope_as = m_hunt } + } + else = { + random_courtier = { + limit = { + is_adult = yes + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } + } + weight = { + base = 10 + modifier = { + factor = 2 + has_trait = lifestyle_hunter + } + # Not priest + modifier = { + factor = 0 + is_clergy = yes + } + modifier = { + factor = 0 + hunt_dharmic_pacificist_trigger = yes + } + } + save_scope_as = m_hunt + } + } +} + +hunt_murder_add_and_reveal_attempted_murder = { + if = { + limit = { is_alive = yes } + hidden_effect = { + add_secret = { + type = secret_murder_attempt + target = root + } + } + random_secret = { + type = secret_murder_attempt + limit = { + secret_target = root + } + reveal_to_without_events_effect = { CHARACTER = root } + if = { + limit = { + exists = scope:bodyguard_appears + exists = scope:bodyguard + scope:bodyguard = { is_alive = yes } + } + reveal_to_without_events_effect = { CHARACTER = scope:bodyguard } + } + } + } +} + +hunt_gift_trophy_opinion_effect = { + if = { + limit = { + $RECIPIENT$ != scope:host + } + if = { + limit = { + hunt_dharmic_pacificist_trigger = yes + } + add_opinion = { + target = scope:host + modifier = hunt_dharmic_mercy_opinion + opinion = -10 + } + } + else_if = { + limit = { + scope:activity = { + has_activity_option = { category = special_type option = hunt_type_legendary } + } + } + activity_improve_relations_intent_effect = { + CHARACTER = scope:host + REASON = friend_gave_hunt_trophy_reason + OPINION = 20 + MODIFIER = hunt_gifted_trophy_opinion + } + } + else_if = { + limit = { + $RECIPIENT$ = { is_adult = yes } + scope:newly_created_artifact = { + OR = { + artifact_type = animal_trinket + artifact_type = bird_feather + } + } + NOT = { + hunt_animal_type_predator_trigger = { VAR = scope:activity.var:animal_type } + } + } + activity_improve_relations_intent_effect = { + CHARACTER = scope:host + REASON = friend_gave_hunt_trophy_reason + OPINION = 5 + MODIFIER = hunt_gifted_trophy_opinion + } + } + else_if = { + limit = { + $RECIPIENT$ = { is_adult = yes } + scope:newly_created_artifact = { + hunt_activity_large_game_trigger = { VAR = var:animal_type } + } + } + activity_improve_relations_intent_effect = { + CHARACTER = scope:host + REASON = friend_gave_hunt_trophy_reason + OPINION = 15 + MODIFIER = hunt_gifted_trophy_opinion + } + } + else = { + activity_improve_relations_intent_effect = { + CHARACTER = scope:host + REASON = friend_gave_hunt_trophy_reason + OPINION = 10 + MODIFIER = hunt_gifted_trophy_opinion + } + } + } +} + +hunt_complete_remove_sightings_effect = { # Remove sightings + scope:activity = { + if = { + limit = { + activity_location.county.var:sighting_owner ?= scope:host + OR = { + # Standard/dangerous + AND = { + has_activity_option = { category = special_type option = hunt_type_standard } + activity_location.county = { + OR = { + has_county_modifier = hunt_sighting_standard_modifier + has_county_modifier = hunt_sighting_dangerous_modifier + } + } + } + # Falconry + AND = { + has_activity_option = { category = special_type option = hunt_type_falconry } + activity_location.county = { has_county_modifier = hunt_sighting_falconry_modifier } + } + } + } + # Remove sighting and trackers + activity_location.county = { hunt_remove_sighting_effect = yes } + } + else_if = { + limit = { + has_activity_option = { category = special_type option = hunt_type_legendary } + NOT = { exists = var:hunt_4013 } # Sighting already created + } + # Create new sighting + activity_location.county = { + hunt_create_sighting_effect = { + TYPE = legendary + ANIMAL = scope:activity.var:animal_type + OWNER = scope:host + } + } + } + } +} + +hunt_outcome_scope_effect = { + # Scopes + if = { + limit = { + exists = scope:activity.var:accident_target + scope:activity.var:accident_target != scope:host + } + scope:activity.var:accident_target = { save_scope_as = wounded_courtier } + } + if = { + limit = { exists = scope:activity.var:participant_to_use } + scope:activity.var:participant_to_use = { save_scope_as = hunt_participant } + } + else = { + hunt_activity_random_subordinate_participant_effect = { + ARCHETYPE = hunter + COMBATANT = yes + SCOPE = hunt_participant + } + } + if = { + limit = { + exists = intent_target + this != intent_target + } + intent_target = { + save_scope_as = intentee + save_scope_as = pertinent + } + } + else_if = { + limit = { exists = scope:hunt_participant } + save_scope_as = pertinent + } +} + +hunt_complete_slay_beast_intent_effect = { + if = { + limit = { + exists = involved_activity + has_activity_intent = slay_beast_intent + is_alive = yes + } + save_scope_as = intent_completer + hidden_effect = { + send_interface_toast = { + title = activity_intent_complete_toast + left_icon = scope:intent_completer + complete_activity_intent = yes + if = { + limit = { exists = scope:group_kill } + if = { + limit = { + OR = { + involved_activity.var:animal_type ?= flag:hare + involved_activity.var:animal_type ?= flag:fox + } + } + stress_impact = { base = miniscule_stress_impact_loss } + } + else = { + stress_impact = { base = minor_stress_impact_loss } + } + } + else = { + if = { + limit = { + OR = { + involved_activity.var:animal_type ?= flag:hare + involved_activity.var:animal_type ?= flag:fox + } + } + stress_impact = { base = minor_stress_impact_loss } + } + else = { + stress_impact = { base = major_stress_impact_loss } + } + } + } + } + show_as_tooltip = { + if = { + limit = { exists = scope:group_kill } + stress_impact = { base = minor_stress_impact_loss } + } + else = { + stress_impact = { base = major_stress_impact_loss } + } + } + } +} + +hunt_animal_slayer_memory_effect = { + if = { + limit = { + is_alive = yes + scope:activity.var:hunt_success ?= flag:yes + exists = scope:activity.var:kill_animal_type + } + create_character_memory = { + type = hunt_animal_slayer_memory + + participants = { + animal_slayer = scope:animal_slayer + host = scope:host + } + } + ordered_memory = { + memory_type = hunt_animal_slayer_memory + order_by = memory_creation_date + save_scope_as = new_memory + set_variable = { + name = animal_type + value = scope:activity.var:kill_animal_type + } + set_variable = { + name = location + value = scope:activity.activity_location + } + } + } +} + +hunt_trophy_recipient_scope_effect = { + # Save potential gift recipient + if = { + limit = { + intent_target ?= { is_alive = yes } + OR = { + has_activity_intent = woo_attendee_intent + has_activity_intent = befriend_attendee_intent + AND = { + has_activity_intent = impose_obedience_intent + scope:host.intent_target = { # They're not obedient to you already + NOT = { is_obedient_to = scope:host } + } + } + } + } + intent_target = { save_scope_as = trophy_recipient } + } + else = { + every_child = { + limit = { hunt_trophy_recipient_trigger = yes } + add_to_list = trophy_recipients + } + every_consort = { + limit = { hunt_trophy_recipient_trigger = yes } + add_to_list = trophy_recipients + } + every_close_family_member = { + limit = { hunt_trophy_recipient_trigger = yes } + add_to_list = trophy_recipients + } + every_relation = { + type = friend + type = lover + type = potential_friend + type = potential_lover + add_to_list = trophy_recipients + } + random_in_list = { + list = trophy_recipients + limit = { + trigger_if = { + limit = { + exists = scope:newly_created_artifact + scope:newly_created_artifact = { + OR = { + artifact_type = animal_hide_big + artifact_type = animal_hide + artifact_type = animal_skull + } + } + } + has_royal_court = yes + } + NOR = { + scope:animal_slayer ?= this + hunt_dharmic_pacificist_trigger = yes + } + this != root + } + alternative_limit = { + NOT = { scope:animal_slayer ?= this } + this != root + } + weight = { + base = 1 + modifier = { + add = 10 + OR = { + has_relation_potential_friend = root + has_relation_potential_lover = root + } + } + } + save_scope_as = trophy_recipient + } + } +} + +hunt_create_trophy_effect = { + # Scopes for artifact loc + if = { + limit = { + NOT = { exists = scope:animal_slayer } + } + if = { + limit = { exists = scope:credit_taker } + scope:credit_taker = { save_scope_as = animal_slayer } + } + else = { + scope:host = { save_scope_as = animal_slayer } + } + } + # Create trophy artifact + hidden_effect = { + random_list = { + 100 = { # Create Skull + trigger = { + has_royal_court = yes + exists = scope:activity.var:animal_type + can_animal_produce_skull_trigger = { VARIABLE = scope:activity.var:animal_type } + scope:activity = { + NOR = { + AND = { + hunt_activity_deer_game_trigger = { VAR = var:animal_type } + exists = scope:activity.var:female_quarry + } + exists = var:skull_damaged + has_activity_option = { category = special_type option = hunt_type_falconry } + } + } + } + modifier = { # Already have one of the same + factor = 0.5 + any_character_artifact = { + artifact_type = animal_skull + exists = var:animal_type + var:animal_type = scope:activity.var:animal_type + } + } + create_artifact_wall_skull_effect = { + OWNER = root + HUNTER = scope:animal_slayer + LEGENDARY = no + ANIMAL = scope:activity.var:animal_type + } + } + 100 = { # Create Hide + trigger = { + has_royal_court = yes + exists = scope:activity.var:animal_type + scope:activity = { + NOR = { + exists = scope:activity.var:pelt_damaged + has_activity_option = { category = special_type option = hunt_type_falconry } + } + } + } + modifier = { # Already have one + factor = 0.5 + trigger_if = { + limit = { + hunt_hide_big_trigger = { VARIABLE = scope:activity.var:animal_type } + } + any_character_artifact = { + artifact_type = animal_hide_big + exists = var:animal_type + var:animal_type = scope:activity.var:animal_type + } + } + trigger_else = { + any_character_artifact = { + artifact_type = animal_hide + exists = var:animal_type + var:animal_type = scope:activity.var:animal_type + } + } + } + create_artifact_animal_hide_effect = { + OWNER = root + HUNTER = scope:animal_slayer + LEGENDARY = no + ANIMAL = scope:activity.var:animal_type + } + } + 5 = { # Create Trinket + trigger = { + scope:activity = { # Must be hare if Falconry + trigger_if = { + limit = { + has_activity_option = { category = special_type option = hunt_type_falconry } + } + var:animal_type = flag:hare + } + NAND = { + hunt_activity_deer_game_trigger = { VAR = var:animal_type } + exists = scope:activity.var:female_quarry + } + NOT = { + has_activity_option = { category = special_type option = hunt_type_falconry } + } + } + } + create_artifact_animal_trinket_effect = { + OWNER = root + HUNTER = scope:animal_slayer + LEGENDARY = no + ANIMAL = scope:activity.var:animal_type + } + } + 5 = { # Create Feather + trigger = { + scope:activity = { + has_activity_option = { category = special_type option = hunt_type_falconry } + } + NOT = { scope:activity.var:animal_type = flag:hare } + } + create_artifact_bird_feather_effect = { + OWNER = root + HUNTER = root + ANIMAL = scope:activity.var:animal_type + } + } + } + if = { + limit = { exists = scope:newly_created_artifact } + scope:activity = { + add_to_variable_list = { + name = artifact_rewards + target = scope:newly_created_artifact + } + } + } + } +} + +hunt_save_hostile_accomplice_effect = { + if = { + limit = { + any_in_list = { + list = $SCHEME$_agents + is_ai = yes + is_participant_in_activity = scope:activity + NOR = { + this = root + trigger_if = { + limit = { exists = scope:accomplice } + this = scope:accomplice + } + } + } + } + random_in_list = { + list = $SCHEME$_agents + limit = { + is_ai = yes + is_participant_in_activity = scope:activity + NOR = { + this = root + trigger_if = { + limit = { exists = scope:accomplice } + this = scope:accomplice + } + } + save_temporary_scope_as = $SCHEME$er_temp + } + weight = { + base = 1 + hunt_murderer_modifier = { MURDERER = scope:$SCHEME$er_temp TARGET = $VICTIM$ } + } + save_scope_as = accomplice + } + } + if = { + limit = { + any_in_list = { + list = $SCHEME$_agents + is_ai = yes + is_participant_in_activity = scope:activity + NOR = { + this = root + trigger_if = { + limit = { exists = scope:accomplice } + this = scope:accomplice + } + } + } + } + random_in_list = { + list = $SCHEME$_agents + limit = { + is_ai = yes + is_participant_in_activity = scope:activity + NOR = { + this = root + trigger_if = { + limit = { exists = scope:accomplice } + this = scope:accomplice + } + } + save_temporary_scope_as = $SCHEME$er_temp + } + weight = { + base = 1 + hunt_murderer_modifier = { MURDERER = scope:$SCHEME$er_temp TARGET = $VICTIM$ } + } + save_scope_as = accomplice_2 + } + } +} + +hunt_invalidation_event_effect = { + if = { + limit = { is_in_list = attendees } + if = { + limit = { + scope:activity = { + has_activity_option = { category = special_type option = hunt_type_falconry } + } + } + hunter_lifestyle_rank_up_check_effect = { FALCONRY = yes } + } + else = { + hunter_lifestyle_rank_up_check_effect = { FALCONRY = no } + } + } + if = { + limit = { exists = scope:activity } + custom_tooltip = hunt_ends_tt + } + custom_tooltip = hunt_invalidated_warning_tt +} + +# Unified effect for adding sightings to counties +hunt_create_sighting_effect = { + if = { + limit = { NOT = { exists = scope:sighting_county } } + save_scope_as = sighting_county + } + # Track who can use the sighting + set_variable = { + name = animal_type + years = 3 + value = $ANIMAL$ + } + # Track who can use the sighting + set_variable = { + name = sighting_owner + years = 3 + value = $OWNER$ + } + # Stop sightings in the same place too regularly + set_variable = { + name = recent_sighting + years = 10 + } + # Add sighting modifier + add_county_modifier = { + modifier = hunt_sighting_$TYPE$_modifier + years = 3 + desc = hunt_sighting_$TYPE$_modifier_custom_desc + } +} + +hunt_remove_sighting_effect = { + # Remove sighting modifier + if = { + limit = { has_county_modifier = hunt_sighting_standard_modifier } + remove_county_modifier = hunt_sighting_standard_modifier + } + if = { + limit = { has_county_modifier = hunt_sighting_dangerous_modifier } + remove_county_modifier = hunt_sighting_dangerous_modifier + } + if = { + limit = { has_county_modifier = hunt_sighting_legendary_modifier } + remove_county_modifier = hunt_sighting_legendary_modifier + } + if = { + limit = { has_county_modifier = hunt_sighting_falconry_modifier } + remove_county_modifier = hunt_sighting_falconry_modifier + } + # Remove sightings + remove_variable = animal_type + remove_variable = sighting_owner +} + +### Nerge +nerge_rewards_effect = { + if = { + limit = { + scope:activity.var:activity_special_type_progression < 25 + } + scope:host = { + add_dread = unimpressive_nerge_dread_value + } + } + else_if = { + limit = { + scope:activity.var:activity_special_type_progression < 50 + } + scope:host = { + add_dread = regular_nerge_dread_value + add_prestige = regular_nerge_prestige_value + add_gold = regular_nerge_gold_value + add_legitimacy = regular_nerge_legitimacy_value + } + scope:activity = { + every_attending_character = { + custom = every_nerge_character + limit = { + NOT = { this = scope:host } + } + add_prestige = regular_nerge_guest_prestige_value + } + } + } + else_if = { + limit = { + scope:activity.var:activity_special_type_progression < 75 + } + scope:host = { + add_dread = impressive_nerge_dread_value + add_prestige = impressive_nerge_prestige_value + add_gold = impressive_nerge_gold_value + add_legitimacy = impressive_nerge_legitimacy_value + } + scope:activity = { + every_attending_character = { + custom = every_nerge_character + limit = { + NOT = { this = scope:host } + } + add_prestige = impressive_nerge_guest_prestige_value + } + } + } + else_if = { + limit = { + scope:activity.var:activity_special_type_progression < 100 + } + scope:host = { + add_dread = great_nerge_dread_value + add_prestige = great_nerge_prestige_value + add_gold = great_nerge_gold_value + add_legitimacy = great_nerge_legitimacy_value + } + scope:activity = { + every_attending_character = { + custom = every_nerge_character + limit = { + NOT = { this = scope:host } + } + custom_tooltip = nerge_commander_trait_tt + add_prestige = great_nerge_guest_prestige_value + } + } + } + else_if = { + limit = { + scope:activity.var:activity_special_type_progression >= 100 + } + scope:host = { + add_dread = fantastic_nerge_dread_value + add_prestige = fantastic_nerge_prestige_value + add_gold = fantastic_nerge_gold_value + add_legitimacy = fantastic_nerge_legitimacy_value + add_martial_skill = fantastic_nerge_martial_value + # MPO ACHIEVEMENT Shut up, Nerge + if = { + limit = { is_ai = no } + add_achievement_global_variable_effect = { + VARIABLE = mpo_shut_up_nerge_achievement_unlocked + VALUE = yes + } + } + } + scope:activity = { + every_attending_character = { + custom = every_nerge_character + limit = { + NOT = { this = scope:host } + } + custom_tooltip = nerge_commander_trait_tt + add_prestige = fantastic_nerge_guest_prestige_value + add_martial_skill = fantastic_nerge_guest_martial_value + } + } + } +} + +hand_out_nerge_rewards = { + if = { + limit = { + this = scope:host + } + scope:activity = { + add_activity_log_entry = { + key = finished_nerge_$OUTCOME$ + character = scope:host + show_in_conclusion = yes + scope:host = { nerge_rewards_effect = yes } + } + } + } + else = { + show_as_tooltip = { + nerge_rewards_effect = yes + } + } +} + +nerge_check_commander_trait_effect = { + prev = { + if = { + limit = { + NOT = { has_trait = $TRAIT$ } + } + add_trait_force_tooltip = $TRAIT$ + } + } +} + +nerge_check_commander_trait_xp_effect = { + prev = { + if = { + limit = { + has_trait = $TRAIT$ + } + add_trait_xp = { + trait = $TRAIT$ + value = 10 + } + } + } +} + +nerge_commander_trait_effect = { + scope:nerge_location = { + switch = { + trigger = terrain + plains = { + nerge_check_commander_trait_xp_effect = { TRAIT = open_terrain_expert } + } + farmlands = { + nerge_check_commander_trait_xp_effect = { TRAIT = open_terrain_expert } + } + steppe = { + nerge_check_commander_trait_xp_effect = { TRAIT = open_terrain_expert } + } + wetlands = { + nerge_check_commander_trait_xp_effect = { TRAIT = rough_terrain_expert } + } + hills = { + nerge_check_commander_trait_xp_effect = { TRAIT = rough_terrain_expert } + } + mountains = { + nerge_check_commander_trait_xp_effect = { TRAIT = rough_terrain_expert } + } + desert = { + nerge_check_commander_trait_xp_effect = { TRAIT = rough_terrain_expert } + } + desert_mountains = { + nerge_check_commander_trait_xp_effect = { TRAIT = desert_warrior } + } + oasis = { + nerge_check_commander_trait_xp_effect = { TRAIT = desert_warrior } + } + drylands = { + nerge_check_commander_trait_xp_effect = { TRAIT = desert_warrior } + } + jungle = { + nerge_check_commander_trait_xp_effect = { TRAIT = jungle_stalker } + } + forest = { + nerge_check_commander_trait_xp_effect = { TRAIT = forest_fighter } + } + taiga = { + nerge_check_commander_trait_xp_effect = { TRAIT = forest_fighter } + } + floodplains = { + nerge_check_commander_trait_xp_effect = { TRAIT = forder } + } + } + } + if = { + limit = { + number_of_commander_traits < 3 + } + scope:nerge_location = { + switch = { + trigger = terrain + plains = { + nerge_check_commander_trait_effect = { TRAIT = open_terrain_expert } + } + farmlands = { + nerge_check_commander_trait_effect = { TRAIT = open_terrain_expert } + } + steppe = { + nerge_check_commander_trait_effect = { TRAIT = open_terrain_expert } + } + wetlands = { + nerge_check_commander_trait_effect = { TRAIT = rough_terrain_expert } + } + hills = { + nerge_check_commander_trait_effect = { TRAIT = rough_terrain_expert } + } + mountains = { + nerge_check_commander_trait_effect = { TRAIT = rough_terrain_expert } + } + desert = { + nerge_check_commander_trait_effect = { TRAIT = rough_terrain_expert } + } + desert_mountains = { + nerge_check_commander_trait_effect = { TRAIT = desert_warrior } + } + oasis = { + nerge_check_commander_trait_effect = { TRAIT = desert_warrior } + } + drylands = { + nerge_check_commander_trait_effect = { TRAIT = desert_warrior } + } + jungle = { + nerge_check_commander_trait_effect = { TRAIT = jungle_stalker } + } + forest = { + nerge_check_commander_trait_effect = { TRAIT = forest_fighter } + } + taiga = { + nerge_check_commander_trait_effect = { TRAIT = forest_fighter } + } + floodplains = { + nerge_check_commander_trait_effect = { TRAIT = forder } + } + } + } + } +} + +nerge_progression_effect = { + save_temporary_scope_as = root_scope + save_scope_value_as = { + name = amount_of_players + value = { + value = 1 + scope:activity = { + every_attending_character = { + limit = { + is_ai = no + } + add = 1 + } + subtract = 1 + } + min = 1 + } + } + if = { + limit = { + OR = { + is_ai = no + AND = { + NOT = { + involved_activity = { any_attending_character = { is_ai = no } } + } + scope:root_scope = involved_activity.activity_host + } + } + } + scope:activity ?= { + if = { + limit = { + exists = var:activity_special_type_progression + } + change_variable = { + name = activity_special_type_progression + add = { + value = $VALUE$ + multiply = nerge_score_multiplier_value + divide = scope:amount_of_players + } + } + } + } + if = { + limit = { + $VALUE$ <= 2 + } + custom_tooltip = nerge_outcome_boost_tiny + } + else_if = { + limit = { + $VALUE$ <= 5 + } + custom_tooltip = nerge_outcome_boost_small + } + else_if = { + limit = { + $VALUE$ <= 9 + } + custom_tooltip = nerge_outcome_boost_medium + } + else_if = { + limit = { + $VALUE$ >= 13 + } + custom_tooltip = nerge_outcome_boost_large + } + } +} + +nerge_progression_tiny_effect = { nerge_progression_effect = { VALUE = 2 } } +nerge_progression_small_effect = { nerge_progression_effect = { VALUE = 5 } } +nerge_progression_medium_effect = { nerge_progression_effect = { VALUE = 9 } } +nerge_progression_large_effect = { nerge_progression_effect = { VALUE = 13 } } diff --git a/N3OW/common/scripted_effects/00_interaction_effects.txt b/N3OW/common/scripted_effects/00_interaction_effects.txt new file mode 100644 index 00000000..f95def06 --- /dev/null +++ b/N3OW/common/scripted_effects/00_interaction_effects.txt @@ -0,0 +1,4761 @@ + +####################################################################### +# EFFECT LIST +####################################################################### +# !!! Remember to add all new effects with a short description here !!! +####################################################################### + +blackmail_interaction_effect = { + scope:actor = { + if = { + limit = { exists = scope:target } + blackmail_target_with_secret_effect = { SECRET = scope:target TARGET = scope:recipient } + reverse_add_opinion = { + modifier = blackmailing_me_opinion + target = scope:recipient + } + } + if = { + limit = { has_government = administrative_government } + if = { + limit = { + scope:target = { is_criminal_for = scope:recipient } + } + change_influence = medium_influence_gain + } + else_if = { + limit = { + scope:target = { is_shunned_for = scope:recipient } + } + change_influence = minor_influence_gain + } + else = { change_influence = miniscule_influence_gain } + } + stress_impact = { + compassionate = medium_stress_impact_gain + trusting = medium_stress_impact_gain + honest = minor_stress_impact_gain + just = minor_stress_impact_gain + forgiving = minor_stress_impact_gain + } + } + scope:target = { + if = { + limit = { + exists = var:promised_not_to_reveal + var:promised_not_to_reveal = scope:actor + } + scope:recipient = { + add_opinion = { + target = scope:actor + modifier = broke_promise + } + } + } + } + scope:recipient = { #Nudge towards rivalry + if = { + limit = { + NOR = { + has_relation_rival = scope:actor + has_relation_potential_rival = scope:actor + } + } + set_relation_potential_rival = scope:actor + } + } +} + +torture_blind_castrate_disfigure_opinion_effect = { + scope:recipient = { + add_opinion = { + modifier = $VERB$_me + target = scope:actor + } + if = { + limit = { + has_opinion_modifier = { + modifier = grateful_opinion + target = scope:actor + } + } + remove_opinion = { + modifier = grateful_opinion + target = scope:actor + } + } + + if = { + limit = { + primary_spouse ?= { is_alive = yes } + NOT = { primary_spouse = { this = scope:actor } } + } + primary_spouse = { add_to_list = family_of_tortured } + } + every_close_family_member = { + limit = { this != scope:actor } + add_to_list = family_of_tortured + } + if = { + limit = { + any_in_list = { + list = family_of_tortured + count = 1 + always = yes + } + } + every_in_list = { + list = family_of_tortured + add_opinion = { + target = scope:actor + modifier = $VERB$_family_member + } + } + } + else_if = { + limit = { + any_in_list = { + list = family_of_tortured + count > 1 + always = yes + } + } + every_in_list = { + list = family_of_tortured + custom = all_close_family_and_spouses + add_opinion = { + target = scope:actor + modifier = $VERB$_family_member + } + } + } + } +} + + +torture_interaction_actor_effect = { + scope:actor = { + ###SECRETS### + custom_tooltip = torture_interaction_actor_effects.secrets.tt + + + ###STRESS### + + #Stress loss if they are my rival I hate them + if = { + limit = { has_relation_rival = scope:recipient } + + if = { + limit = { + NOR = { + has_trait = sadistic + has_trait = vengeful + has_trait = compassionate + has_trait = forgiving + } + } + add_stress = medium_stress_loss + } + else = { + stress_impact = { + sadistic = major_stress_impact_loss + vengeful = massive_stress_impact_loss + compassionate = minor_stress_impact_gain + forgiving = minor_stress_impact_gain + } + } + } + else_if = { # Torturing infidels is relaxing + limit = { + has_trait = zealous + scope:actor.faith != scope:recipient.faith + } + + if = { + limit = { + NOR = { + has_trait = sadistic + has_trait = compassionate + has_trait = forgiving + } + } + add_stress = medium_stress_loss + } + else = { + stress_impact = { + sadistic = major_stress_impact_loss + compassionate = minor_stress_impact_gain + forgiving = minor_stress_impact_gain + } + } + } + else_if = { + limit = { + NOT = { + has_trait = sadistic + } + scope:recipient = { + OR = { + is_child_of = scope:actor + is_grandchild_of = scope:actor + is_great_grandchild_of = scope:actor + } + } + } + stress_impact = { + base = medium_stress_impact_loss + compassionate = massive_stress_impact_gain + craven = major_stress_impact_gain + just = medium_stress_impact_gain + forgiving = major_stress_impact_gain + generous = medium_stress_impact_gain + trusting = minor_stress_impact_gain + content = minor_stress_impact_gain + family_first = minor_stress_impact_gain + } + } + else = { + stress_impact = { + sadistic = medium_stress_impact_loss + compassionate = major_stress_impact_gain + craven = major_stress_impact_gain + just = medium_stress_impact_gain + forgiving = medium_stress_impact_gain + generous = medium_stress_impact_gain + trusting = minor_stress_impact_gain + content = minor_stress_impact_gain + } + } + + ###DREAD### + if = { + limit = { + scope:recipient = { + OR = { + is_powerful_vassal_of = scope:actor # Is your powerful vassal + AND = { # Is an Emperor + exists = primary_title + primary_title.tier >= tier_empire + } + target_is_vassal_or_below = scope:actor # Your liege/s + scope:actor.faith.religious_head = scope:recipient # Your head of faith + } + } + } + add_dread = torture_interaction_massive_dread_gain + } + else_if = { + limit = { + scope:recipient = { + OR = { + AND = { # Is your vassal, and higher than Baron + is_vassal_of = scope:actor + primary_title.tier > tier_barony + } + AND = { # Is a King + exists = primary_title + primary_title.tier >= tier_kingdom + } + } + } + } + add_dread = torture_interaction_major_dread_gain + } + else_if = { + limit = { + scope:recipient = { + OR = { + scope:actor = { # Torturing close family of your vassals is dreadful... + any_vassal = { + is_close_family_of = scope:recipient + } + } + scope:actor = { # Torturing close family of your liege/s is the same... + any_liege_or_above = { + is_close_family_of = scope:recipient + } + } + AND = { # Peer Vassals + exists = primary_title + primary_title.tier > tier_barony + liege ?= scope:actor.liege + } + AND = { # Is a Duke + exists = primary_title + primary_title.tier >= tier_duchy + } + } + } + } + add_dread = torture_interaction_medium_dread_gain + } + else_if = { + limit = { + scope:recipient = { + OR = { + is_spouse_of = scope:actor # Your own spouse + is_close_or_extended_family_of = scope:actor # Your own family + AND = { + exists = primary_title + primary_title.tier >= tier_county # Is a Count + } + scope:actor = { # Torturing extended family of your vassals is dreadful... + any_vassal = { + is_extended_family_of = scope:recipient + } + } + scope:actor = { # Torturing extended family of your liege/s is the same... + any_liege_or_above = { + is_extended_family_of = scope:recipient + } + } + } + } + } + add_dread = torture_interaction_minor_dread_gain + } + + + ###OPINIONS### + torture_blind_castrate_disfigure_opinion_effect = { VERB = tortured } + + ###CHURCH OPINION & PIETY### + if = { + limit = { + NOR = { + faith = { has_doctrine = tenet_exaltation_of_pain } + + # Divine Retribution cancels out faith-based penalties + has_perk = divine_retribution_perk + } + } + add_piety = medium_piety_loss + + if = { + limit = { + any_learning_councillor = { + opinion = { + target = scope:recipient + value >= neutral_opinion + } + } + } + random_learning_councillor = { + add_opinion = { + modifier = impious_opinion + opinion = -10 + target = scope:actor + } + } + } + } + else_if = { + limit = { + faith = { has_doctrine = tenet_exaltation_of_pain } + } + add_piety = medium_piety_gain + } + } +} + +torturer_interaction_recipient_effect = { + scope:recipient = { + add_character_modifier = { + modifier = recently_tortured + years = 5 + } + + # Poetry does not cause lunacy. + if = { + limit = { + NOT = { scope:torture_method = flag:poetry } + } + random = { + chance = 5 + modifier = { + scope:actor = { has_trait = torturer } + add = 10 + } + add_trait = lunatic_1 + } + } + + if = { + limit = { + NOR = { + has_trait = craven + has_trait = brave + } + } + add_stress = massive_stress_impact_gain + } + else = { + stress_impact = { + craven = monumental_stress_gain + brave = medium_stress_impact_gain + } + } + + if = { # Remove the flag blocking other prison interactions + limit = { has_character_flag = is_being_tortured } + remove_character_flag = is_being_tortured + } + + torture_memory_effect = { + VICTIM = scope:recipient + TORTURER = scope:actor + TYPE = torture + } + } +} + +illegal_imprisonment_dread_effect = { + ###DREAD### + scope:actor = { + if = { + limit = { + NOT = { + has_imprisonment_reason = scope:recipient + } + } + if = { + limit = { + OR = { + is_spouse_of = scope:recipient + is_close_family_of = scope:recipient + scope:recipient = { tier_or_related_liege_tier_greater_or_equal_trigger = { TIER = tier_kingdom } } + } + } + add_dread = medium_dread_gain + } + else_if = { + limit = { + OR = { + scope:recipient = { tier_or_related_liege_tier_equal_trigger = { TIER = tier_duchy } } + scope:recipient = { tier_or_related_liege_tier_equal_trigger = { TIER = tier_county } } + } + } + add_dread = minor_dread_gain + } + } + } +} + +blind_castrate_and_disfigure_effect = { + ###STRESS## + scope:actor = { + if = { + limit = { has_relation_rival = scope:recipient } + + if = { + limit = { + NOR = { + has_trait = sadistic #Extra stress + has_trait = vengeful #Extra stress + has_trait = compassionate #Lessened impact + has_trait = forgiving #Lessened impact + } + } + add_stress = medium_stress_loss + } + else = { + stress_impact = { + sadistic = major_stress_impact_loss + vengeful = major_stress_impact_loss + compassionate = minor_stress_impact_gain + forgiving = minor_stress_impact_gain + } + } + } + #Regular stress + else = { + stress_impact = { + sadistic = minor_stress_impact_loss + compassionate = massive_stress_impact_gain + craven = major_stress_impact_gain + just = medium_stress_impact_gain + forgiving = medium_stress_impact_gain + generous = medium_stress_impact_gain + trusting = minor_stress_impact_gain + gregarious = minor_stress_impact_gain + calm = minor_stress_impact_gain + content = minor_stress_impact_gain + honest = minor_stress_impact_gain + } + } + + ###DREAD### + if = { + limit = { + OR = { + is_spouse_of = scope:recipient + is_close_family_of = scope:recipient + scope:recipient = { tier_or_related_liege_tier_greater_or_equal_trigger = { TIER = tier_kingdom } } #Kingdom & empire + } + } + add_dread = major_dread_gain + } + else_if = { + limit = { + OR = { + scope:recipient = { tier_or_related_liege_tier_equal_trigger = { TIER = tier_duchy } } + scope:recipient = { tier_or_related_liege_tier_equal_trigger = { TIER = tier_county } } + } + } + add_dread = medium_dread_gain + } + else = { + add_dread = minor_dread_gain + } + } +} + +blind_opinion_effect = { + ###OPINIONS### + scope:recipient = { + add_opinion = { + modifier = blinded_me + target = scope:actor + } + + if = { + limit = { + exists = primary_spouse + NOT = { primary_spouse = { this = scope:actor } } + } + primary_spouse = { add_to_list = family_of_blinded } + } + every_close_family_member = { + limit = { this != scope:actor } + add_to_list = family_of_blinded + } + if = { + limit = { + any_in_list = { + list = family_of_blinded + count = 1 + always = yes + } + } + every_in_list = { + list = family_of_blinded + add_opinion = { + target = scope:actor + modifier = blinded_family_member + } + } + } + else_if = { + limit = { + any_in_list = { + list = family_of_blinded + count > 1 + always = yes + } + } + every_in_list = { + list = family_of_blinded + custom = all_close_family_and_spouses + add_opinion = { + target = scope:actor + modifier = blinded_family_member + } + } + } + } +} + +blind_castrated_disfigured_recipient_support_effect = { #To be used in other effects + random = { + chance = 5 + add_trait = lunatic_1 + } + + if = { + limit = { + NOR = { + has_trait = craven + has_trait = brave + } + } + add_stress = major_stress_impact_gain + } + else = { + stress_impact = { + craven = massive_stress_gain + brave = medium_stress_impact_gain + } + } + add_character_flag = { #TO make sure that they don't get spammed about the release + flag = block_for_prison_release_notification + days = 2 + } + + release_from_prison = yes + + if = { # Remove the flag blocking other prison interactions + limit = { has_character_flag = is_being_tortured } + remove_character_flag = is_being_tortured + } +} + +blind_recipient_effect = { + scope:recipient = { + if = { + limit = { scope:actor = { is_ai = no } } + add_trait_force_tooltip = blind #This is because we want to show a blinded portrait it prison.1020 for players, then we add the trait in the immediate but we still want a tooltip + } + else = { + add_trait = blind + } + torture_memory_effect = { + VICTIM = scope:recipient + TORTURER = scope:actor + TYPE = blind + } + add_character_modifier = { + modifier = recently_blinded + years = 1 + } + blind_castrated_disfigured_recipient_support_effect = yes + } +} + +castrate_recipient_effect = { + scope:recipient = { + if = { + limit = { + age < 12 + } + ep3_child_castration_effect = yes + } + else = { + ep3_youth_castration_effect = yes + } + blind_castrated_disfigured_recipient_support_effect = yes + } +} + +disfigure_recipient_effect = { + scope:recipient = { + if = { + limit = { scope:actor = { is_ai = no } } + #This is because we want to show a blinded portrait it prison.1030 for players, then we add the trait in the immediate but we still want a tooltip + add_trait_force_tooltip = disfigured + } + else = { + add_trait = disfigured + } + torture_memory_effect = { + VICTIM = scope:recipient + TORTURER = scope:actor + TYPE = disfigured + } + add_character_modifier = { + modifier = recently_disfigured + years = 1 + } + blind_castrated_disfigured_recipient_support_effect = yes + } +} + +maimed_recipient_effect = { + scope:recipient = { + if = { + limit = { scope:maim_type = flag:arm } + if = { + limit = { scope:actor = { is_ai = no } } + #This is because we want to show a blinded portrait it prison.1030 for players, then we add the trait in the immediate but we still want a tooltip + apply_maimed_trait_and_modifier_effect = yes + } + else = { apply_maimed_trait_and_modifier_effect = yes } + torture_memory_effect = { + VICTIM = scope:recipient + TORTURER = scope:actor + TYPE = maim_arm + } + } + else_if = { + limit = { scope:maim_type = flag:leg } + if = { + limit = { scope:actor = { is_ai = no } } + #This is because we want to show a blinded portrait it prison.1030 for players, then we add the trait in the immediate but we still want a tooltip + add_trait_force_tooltip = one_legged + } + else = { add_trait = one_legged } + torture_memory_effect = { + VICTIM = scope:recipient + TORTURER = scope:actor + TYPE = maim_leg + } + add_character_modifier = { + modifier = recently_maimed_modifier + years = 1 + } + } + blind_castrated_disfigured_recipient_support_effect = yes + } +} + + +war_for_imprison_effect = { + scope:recipient = { + save_scope_value_as = { + name = war_for_imprisonment_flavour + value = yes + } + start_war = { + casus_belli = refused_liege_demand_war + target = scope:actor + } + } + # Disgruntled vassals + if = { + limit = { + scope:actor = { NOT = { has_imprisonment_reason = scope:recipient } } + } + scope:actor = { + every_vassal = { #Vassals joining the rebel. + limit = { + NOR = { + this = scope:recipient + is_ai = no + has_trait = incapable + is_imprisoned = yes + dread_modified_ai_boldness = { #Too scared to do anything. + dreaded_character = scope:actor + value <= -50 + } + is_at_war_with = scope:recipient + is_at_war_with = scope:actor + } + highest_held_title_tier > tier_barony + OR = { + #Lovers and friends always back rebel (unless also lovers/friends of the liege) + AND = { + OR = { + has_relation_lover = scope:recipient + has_relation_friend = scope:recipient + } + NOR = { + has_relation_lover = scope:actor + has_relation_friend = scope:actor + } + } + #Vassals that either like recipient or have high honor will rally if the liege is being tyrannical. + AND = { + OR = { + ai_honor >= 25 + opinion = { + target = scope:recipient + value >= 40 + } + AND = { + has_game_rule = hard_difficulty + scope:actor = { is_ai = no } + opinion = { + target = scope:recipient + value >= 20 + } + } + AND = { + has_game_rule = very_hard_difficulty + scope:actor = { is_ai = no } + opinion = { + target = scope:recipient + value >= 0 + } + } + } + NOT = { + scope:actor = { + has_imprisonment_reason = scope:recipient + } + } + } + #And finally, vassals that really hate their liege will join regardless (provided that they also do not hate recipient). + AND = { + OR = { + opinion = { + target = scope:recipient + value >= -25 + } + AND = { + has_game_rule = hard_difficulty + scope:actor = { is_ai = no } + opinion = { + target = scope:recipient + value >= -50 + } + } + AND = { + has_game_rule = very_hard_difficulty + scope:actor = { is_ai = no } + opinion = { + target = scope:recipient + value >= -75 + } + } + } + OR = { + opinion = { + target = scope:actor + value <= -40 + } + AND = { + has_game_rule = hard_difficulty + scope:actor = { is_ai = no } + opinion = { + target = scope:actor + value <= -20 + } + } + AND = { + has_game_rule = very_hard_difficulty + scope:actor = { is_ai = no } + opinion = { + target = scope:actor + value <= 0 + } + } + } + } + } + } + add_to_list = joining_vassals + } + } + } + # Bloc members join despite legality + if = { + limit = { + exists = scope:recipient.house.house_confederation + trigger_if = { + limit = { exists = scope:actor.house.house_confederation } + NOT = { scope:recipient = scope:actor.house.house_confederation.leading_house.house_head } + } + } + scope:recipient.top_liege ?= { + every_vassal = { + limit = { + highest_held_title_tier > tier_barony + house.house_confederation ?= scope:recipient.house.house_confederation + } + add_to_list = joining_vassals + } + } + } + every_in_list = { + list = joining_vassals + save_scope_as = joining_vassal + custom_tooltip = tooltip_fellow_vassal_joins_war #The war has not started when viewing the interaction screen. + hidden_effect = { + scope:recipient = { + every_character_war = { + limit = { + using_cb = refused_liege_demand_war + casus_belli = { + primary_attacker = scope:recipient + primary_defender = scope:actor + } + } + add_to_list = war_to_join + } + } + every_in_list = { + list = war_to_join + limit = { + NOT = { is_defender = prev } + } + hidden_effect = { + set_called_to = prev + } + add_attacker = prev + } + } + hidden_effect = { + scope:actor = { + add_opinion = { + target = prev + modifier = rebellious_vassal_opinion + } + } + } + } + every_player = { + limit = { is_vassal_of = scope:actor } + trigger_event = char_interaction.0232 + } + scope:recipient = { + add_opinion = { + target = scope:actor + modifier = attempted_arrest_opinion + } + } +} + +vassal_revocation_tyranny_effect = { #Despite its name this is referenced when _retracting_ vassals. + if = { + limit = { exists = scope:use_strife_not_tyranny } + # If you have revocation reason, we allow that. + if = { + limit = { has_revoke_title_reason = scope:recipient } + consume_revoke_title_reason = scope:recipient + } + else_if = { #Admin liege revoking from admin vassal + limit = { + government_allows = administrative + scope:recipient = { + government_allows = administrative + } + } + } + else = { change_strife_opinion = major_strife_gain } + } + else_if = { + limit = { + vassal_revocation_is_tyrannical_trigger = { VASSAL = scope:recipient } + } + # Special Legitimacy loss if you're revoking without a reason + if = { + limit = { has_legitimacy = yes } + add_legitimacy = minor_legitimacy_loss + } + add_tyranny = { + value = revoke_vassal_tyranny_gain + if = { + limit = { + scope:recipient = { + is_imprisoned = yes + NOT = { is_imprisoned_by = scope:actor } + } + NOT = { + scope:actor = { has_revoke_title_reason = scope:recipient } + } + } + multiply = 2 + } + } + } + else_if = { + limit = { + has_revoke_title_reason = scope:recipient + } + custom_tooltip = IS_ALLOWED_TO_REVOKE_VASSAL_DESC + } + else_if = { + limit = { + faith = { + OR = { + has_doctrine_parameter = pluralism_righteous_revocation_tyranny_reduced + has_doctrine_parameter = pluralism_fundamentalist_revocation_tyranny_minimal + } + faith_hostility_level = { + target = scope:recipient.faith + value >= faith_hostile_level + } + } + } + if = { + limit = { + faith = { + has_doctrine_parameter = pluralism_fundamentalist_revocation_tyranny_minimal + faith_hostility_level = { + target = scope:recipient.faith + value = faith_hostile_level + } + } + } + custom_tooltip = IS_ALLOWED_TO_REVOKE_HOSTILE_INFIDEL_VASSAL + } + else = { + custom_tooltip = IS_ALLOWED_TO_REVOKE_EVIL_INFIDEL_VASSAL + } + every_vassal = { + limit = { + faith = scope:recipient.faith + } + custom = INFIDEL_REVOCATION_OPINION + add_opinion = { + modifier = angry_opinion + target = scope:actor + opinion = { + value = revoke_vassal_tyranny_gain + multiply = -1 + } + } + } + } +} + +revocation_tyranny_effect = { + save_scope_as = liege_temp_scope + if = { + limit = { exists = scope:use_strife_not_tyranny } + # If you have revocation reason, we allow that. + if = { + limit = { has_revoke_title_reason = $VASSAL$ } + consume_revoke_title_reason = $VASSAL$ + } + else = { change_strife_opinion = major_strife_gain } + } + else_if = { + limit = { + title_revocation_is_tyrannical_trigger = { VASSAL = $VASSAL$ } + } + add_tyranny = revoke_title_tyranny_gain + # Special Legitimacy loss if you're revoking without a reason + if = { + limit = { + has_legitimacy = yes + NOT = { + scope:landed_title ?= { + duchy = scope:liege_temp_scope.capital_county.duchy + } + } + } + add_legitimacy = medium_legitimacy_loss + } + + #If my culture is different from the recipients + if = { + limit = { + NOT = { culture = $VASSAL$.culture } + } + $VASSAL$.culture = { + change_cultural_acceptance = { + target = scope:liege_temp_scope.culture + value = revoke_title_culture_acceptance_impact + desc = cultural_acceptance_loss_revokation + } + } + } + } + else = { + if = { + limit = { + title_revocation_is_admin_governor_trigger = { VASSAL = $VASSAL$ } + } + custom_description = { + text = IS_ALLOWED_TO_REVOKE_ADMIN_GOVERNMENT + subject = scope:liege_temp_scope + object = $VASSAL$ + } + } + else_if = { + limit = { + exists = scope:landed_title + has_claim_on = scope:landed_title + } + custom_tooltip = IS_ALLOWED_TO_REVOKE_TITLE_FOR_CLAIM_DESC + } + else_if = { + limit = { + has_revoke_title_reason = scope:recipient + } + custom_tooltip = IS_ALLOWED_TO_REVOKE_TITLE_DESC + } + else_if = { + limit = { + faith = { + OR = { + has_doctrine_parameter = pluralism_righteous_revocation_tyranny_reduced + has_doctrine_parameter = pluralism_fundamentalist_revocation_tyranny_minimal + } + faith_hostility_level = { + target = scope:recipient.faith + value >= faith_hostile_level + } + } + } + if = { + limit = { + faith = { + has_doctrine_parameter = pluralism_fundamentalist_revocation_tyranny_minimal + faith_hostility_level = { + target = scope:recipient.faith + value = faith_hostile_level + } + } + } + custom_tooltip = IS_ALLOWED_TO_REVOKE_HOSTILE_INFIDEL_TITLE + } + else = { + custom_tooltip = IS_ALLOWED_TO_REVOKE_EVIL_INFIDEL_TITLE + } + every_vassal = { + limit = { + faith = scope:recipient.faith + } + custom = INFIDEL_REVOCATION_OPINION + add_opinion = { + modifier = angry_opinion + target = scope:actor + opinion = { + value = revoke_title_tyranny_gain + multiply = -1 + } + } + } + } + } +} + +war_for_revoke_effect = { + $LIEGE$ = { save_temporary_scope_as = liege_temp } + $REBEL$ = { + save_temporary_scope_as = rebel_temp + save_scope_value_as = { + name = war_for_revocation_flavour + value = yes + } + start_war = { + casus_belli = refused_liege_demand_war + target = scope:liege_temp + } + } + scope:liege_temp = { + # Disgruntled vassals + if = { + limit = { + NOT = { has_revoke_title_reason = scope:rebel_temp } + } + every_vassal = { #Vassals joining the rebel. + custom = vassals_joining_war_tt + limit = { + NOR = { + this = scope:rebel_temp + is_ai = no + has_trait = incapable + is_imprisoned = yes + dread_modified_ai_boldness = { #Too scared to do anything. + dreaded_character = scope:liege_temp + value <= -50 + } + opinion = { # People who really, really like you will still back you + target = scope:liege_temp + value >= 80 + } + is_at_war_with = scope:rebel_temp + is_at_war_with = scope:liege_temp + } + highest_held_title_tier > tier_barony + OR = { + #Lovers and friends always back rebel (unless also lovers/friends of the liege) + AND = { + OR = { + has_relation_lover = scope:rebel_temp + has_relation_friend = scope:rebel_temp + } + NOR = { + has_relation_lover = scope:liege_temp + has_relation_friend = scope:liege_temp + } + } + #Vassals that either like recipient or have high honor will rally if the liege is being tyrannical. + AND = { + # If they can't join a faction against the liege they should not revolt + NOR = { + has_relation_lover = scope:liege_temp + has_relation_friend = scope:liege_temp + is_allied_to = scope:liege_temp + is_primary_heir_of = scope:liege_temp + scope:liege_temp = { has_strong_hook = prev } + has_dread_level_towards = { + target = scope:liege_temp + level = 2 + } + } + OR = { + ai_honor >= 25 + opinion = { + target = scope:rebel_temp + value >= 40 + } + AND = { + has_game_rule = hard_difficulty + scope:liege_temp = { is_ai = no } + opinion = { + target = scope:rebel_temp + value >= 20 + } + } + AND = { + has_game_rule = very_hard_difficulty + scope:liege_temp = { is_ai = no } + opinion = { + target = scope:rebel_temp + value >= 0 + } + } + } + NOR = { + scope:liege_temp = { has_revoke_title_reason = scope:rebel_temp } + trigger_if = { + limit = { exists = scope:landed_title } + scope:liege_temp = { has_claim_on = scope:landed_title } + } + faith = { + faith_hostility_level = { + target = scope:rebel_temp.faith + value >= faith_hostile_level + } + } + } + } + #And finally, vassals that really hate their liege will join regardless (provided that they also do not hate recipient). + AND = { + OR = { + opinion = { + target = scope:rebel_temp + value >= -25 + } + AND = { + has_game_rule = hard_difficulty + scope:liege_temp = { is_ai = no } + opinion = { + target = scope:rebel_temp + value >= -50 + } + } + AND = { + has_game_rule = very_hard_difficulty + scope:liege_temp = { is_ai = no } + opinion = { + target = scope:rebel_temp + value >= -75 + } + } + } + OR = { + #default threshold + opinion = { + target = scope:liege_temp + value <= -50 + } + AND = { + has_game_rule = hard_difficulty + scope:liege_temp = { is_ai = no } + opinion = { + target = scope:liege_temp + value <= -25 + } + } + AND = { + has_game_rule = very_hard_difficulty + scope:liege_temp = { is_ai = no } + opinion = { + target = scope:liege_temp + value <= 0 + } + } + #If tyrannical, the default threshold will be reached if at this level + AND = { + scope:liege_temp = { + title_revocation_is_tyrannical_trigger = { VASSAL = scope:rebel_temp } + } + OR = { + opinion = { + target = scope:liege_temp + value <= -30 #revoke_title_tyranny_gain adds -20 + } + AND = { + has_game_rule = hard_difficulty + scope:liege_temp = { is_ai = no } + opinion = { + target = scope:liege_temp + value <= -10 + } + } + AND = { + has_game_rule = very_hard_difficulty + scope:liege_temp = { is_ai = no } + opinion = { + target = scope:liege_temp + value <= 10 + } + } + } + } + } + } + } + # TGP bloc members follow their leader + trigger_if = { + limit = { exists = house.house_confederation.leading_house.house_head } + house.house_confederation.leading_house.house_head = this + } + } + add_to_list = joining_vassals + } + } + # Bloc members join despite legality + if = { + limit = { + exists = scope:rebel_temp.house.house_confederation + trigger_if = { + limit = { exists = scope:liege_temp.house.house_confederation } + NOT = { scope:rebel_temp = scope:liege_temp.house.house_confederation.leading_house.house_head } + } + } + scope:recipient.top_liege = { + every_vassal = { + limit = { + highest_held_title_tier > tier_barony + house.house_confederation ?= scope:recipient.house.house_confederation + NOT = { this = scope:actor } + } + add_to_list = joining_vassals + } + } + } + } + every_in_list = { + list = joining_vassals + save_scope_as = joining_vassal + custom_tooltip = tooltip_fellow_vassal_joins_war #The war has not started when viewing the interaction + hidden_effect = { + scope:rebel_temp = { + every_character_war = { + limit = { + using_cb = refused_liege_demand_war + casus_belli = { + primary_attacker = scope:rebel_temp + primary_defender = scope:liege_temp + } + } + add_to_list = war_to_join + } + } + every_in_list = { + list = war_to_join + limit = { + NOT = { is_defender = prev } + } + hidden_effect = { + set_called_to = prev + } + add_attacker = prev + } + } + hidden_effect = { + scope:liege_temp = { + add_opinion = { + target = prev + modifier = rebellious_vassal_opinion + } + } + } + } + every_player = { + limit = { is_vassal_of = scope:liege_temp } + scope:rebel_temp = { save_scope_as = recipient } + scope:liege_temp = { save_scope_as = actor } + trigger_event = char_interaction.0232 + } + scope:rebel_temp = { + add_opinion = { + target = scope:liege_temp + modifier = attempted_arrest_opinion + } + } +} + +war_for_retraction_effect = { + scope:recipient = { + save_scope_value_as = { + name = war_for_retraction_flavour + value = yes + } + start_war = { + casus_belli = refused_liege_demand_war + target = scope:actor + } + } + scope:actor = { + every_vassal = { #Vassals joining the rebel. + limit = { + NOR = { + this = scope:recipient + is_ai = no + has_trait = incapable + is_imprisoned = yes + dread_modified_ai_boldness = { #Too scared to do anything. + dreaded_character = scope:actor + value <= -50 + } + is_at_war_with = scope:recipient + is_at_war_with = scope:actor + } + highest_held_title_tier > tier_barony + OR = { + #Lovers and friends always back rebel (unless also lovers/friends of the liege) + AND = { + OR = { + has_relation_lover = scope:recipient + has_relation_friend = scope:recipient + } + NOR = { + has_relation_lover = scope:actor + has_relation_friend = scope:actor + } + } + #Vassals that either like recipient or have high honor will rally if the liege is being tyrannical (taking away de jure vassal). + AND = { + OR = { + ai_honor >= 25 + opinion = { + target = scope:recipient + value >= 40 + } + AND = { + has_game_rule = hard_difficulty + scope:actor = { is_ai = no } + opinion = { + target = scope:recipient + value >= 20 + } + } + AND = { + has_game_rule = very_hard_difficulty + scope:actor = { is_ai = no } + opinion = { + target = scope:recipient + value >= 0 + } + } + } + scope:recipient = { + any_held_title = { + is_de_jure_liege_or_above_target = scope:secondary_recipient.primary_title + } + } + } + #And finally, vassals that really hate their liege will join regardless (provided that they also do not hate recipient). + AND = { + OR = { + opinion = { + target = scope:recipient + value >= -25 + } + AND = { + has_game_rule = hard_difficulty + scope:actor = { is_ai = no } + opinion = { + target = scope:recipient + value >= -50 + } + } + AND = { + has_game_rule = very_hard_difficulty + scope:actor = { is_ai = no } + opinion = { + target = scope:recipient + value >= -75 + } + } + } + OR = { + opinion = { + target = scope:actor + value <= -40 + } + AND = { + has_game_rule = hard_difficulty + scope:actor = { is_ai = no } + opinion = { + target = scope:actor + value <= -20 + } + } + AND = { + has_game_rule = very_hard_difficulty + scope:actor = { is_ai = no } + opinion = { + target = scope:actor + value <= 0 + } + } + } + } + } + } + save_scope_as = joining_vassal + custom_tooltip = tooltip_fellow_vassal_joins_war #The war has not started when viewing the interaction screen. + hidden_effect = { + scope:recipient = { + every_character_war = { + limit = { + using_cb = refused_liege_demand_war + casus_belli = { + primary_attacker = scope:recipient + primary_defender = scope:actor + } + } + add_to_list = war_to_join + } + } + every_in_list = { + list = war_to_join + limit = { + NOT = { is_defender = prev } + } + hidden_effect = { + set_called_to = prev + } + add_attacker = prev + } + } + hidden_effect = { + scope:actor = { + add_opinion = { + target = prev + modifier = rebellious_vassal_opinion + } + } + } + } + every_player = { + limit = { is_vassal_of = scope:actor } + trigger_event = char_interaction.0232 + } + } + scope:recipient = { + add_opinion = { + target = scope:actor + modifier = attempted_arrest_opinion + } + } +} + +kick_from_court_interaction_warning_tooltip_effect = { + save_temporary_scope_as = kicked + if = { + limit = { is_councillor_of = scope:actor } + custom_tooltip = kick_from_court_councillor_warning_tt + } + if = { + limit = { + any_claim = { + useful_courtier_or_guest_claim_trigger = { RULER = scope:actor } + } + } + random_claim = { + limit = { + useful_courtier_or_guest_claim_trigger = { RULER = scope:actor } + tier = tier_kingdom + } + alternative_limit = { + useful_courtier_or_guest_claim_trigger = { RULER = scope:actor } + tier = tier_duchy + } + alternative_limit = { + useful_courtier_or_guest_claim_trigger = { RULER = scope:actor } + tier = tier_county + } + save_scope_as = kicked_claim + } + custom_tooltip = kick_from_court_claimant_warning_tt + } + if = { + limit = { is_commanding_army = yes } + custom_tooltip = kick_from_court_commander_warning_tt + } + if = { + limit = { is_knight_of = scope:actor } + custom_tooltip = kick_from_court_knight_warning_tt + } + if = { + limit = { + scope:kicked = { + has_any_court_position = yes + any_court_position_employer = { this = scope:actor } + } + } + custom_tooltip = kick_from_court_holds_court_title_warning_tt + } +} + +kick_from_court_interaction_effect = { + select_and_move_to_pool_effect = yes + + add_opinion = { + modifier = kicked_me_from_court + target = scope:actor + } + kick_from_court_interaction_warning_tooltip_effect = yes + + every_close_family_member = { + limit = { NOT = { any_in_list = { list = kicked_relatives_list this = prev } } } + add_to_list = kicked_relatives_list + } + + scope:actor = { + if = { + limit = { has_government = landless_adventurer_government } + every_courtier = { + limit = { + is_adult = yes + NOR = { + is_close_family_of = scope:recipient + has_any_moderate_bad_relationship_with_character_trigger = { CHARACTER = scope:recipient } + } + } + custom = custom.every_adult_follower + add_opinion = { + target = scope:actor + modifier = kicked_follower_from_camp_opinion + opinion = -5 + } + } + scope:recipient = { + every_relation = { + type = rival + limit = { is_courtier_of = scope:actor } + add_opinion = { + target = scope:actor + modifier = kicked_rival_from_camp_opinion + opinion = 30 + } + } + } + } + } +} + +disinherit_effect = { + if = { + limit = { + is_heir_of = $DISINHERITOR$ + NOT = { + has_trait = disputed_heritage + } + $DISINHERITOR$ = { + any_vassal = { + vassal_stance = courtly + } + } + } + $DISINHERITOR$ = { + custom_tooltip = courtly_vassal_disapproves_disinheriting + hidden_effect = { + every_vassal = { + vassal_stance = courtly + add_opinion = { + target = $DISINHERITOR$ + modifier = courtly_disinherit_opinion + } + } + } + } + } + add_trait = disinherited + add_opinion = { + modifier = disinherited_opinion + target = $DISINHERITOR$ + } + house = { + every_house_member = { + limit = { + NOT = { house = $DISINHERITOR$.house } + } + custom = all_house_members + add_opinion = { + modifier = disinherited_house_member_opinion + target = $DISINHERITOR$ + } + } + } + if = { + limit = { + exists = dynasty + NOT = { $DISINHERITOR$ = dynasty.dynast } + } + $DISINHERITOR$.dynasty.dynast = { + add_opinion = { + target = $DISINHERITOR$ + modifier = fp1_usurped_my_authority_opinion + years = 20 + } + } + } + hidden_effect = { #Nudge towards rivalry + if = { + limit = { + NOR = { + has_relation_rival = $DISINHERITOR$ + has_relation_potential_rival = $DISINHERITOR$ + } + } + set_relation_potential_rival = $DISINHERITOR$ + } + } +} + +restore_inheritance_effect = { + remove_trait = disinherited + if = { + limit = { + has_opinion_modifier = { + modifier = disinherited_opinion + target = scope:actor + } + } + remove_opinion = { + modifier = disinherited_opinion + target = scope:actor + } + house = { + if = { + limit = { + NOT = { + any_house_member = { + this != scope:recipient + has_opinion_modifier = { + modifier = disinherited_opinion + target = scope:actor + } + } + } + } + every_house_member = { + custom = all_house_members + remove_opinion = { + modifier = disinherited_house_member_opinion + target = scope:actor + single = yes + } + } + } + } + } + else = { + if = { + limit = { + this != scope:actor + } + add_opinion = { + modifier = restored_inheritance_opinion + target = scope:actor + } + } + house = { + every_house_member = { + limit = { + this != scope:recipient + this != scope:actor + } + custom = all_house_members + add_opinion = { + modifier = restored_house_member_inheritance_opinion + target = scope:actor + } + } + } + } + #Remove nithing status, if applicable. + hidden_effect = { + if = { + limit = { has_character_modifier = nithing_fp1_modifier } + remove_character_modifier = nithing_fp1_modifier + } + } +} + +denounce_effect = { + add_trait = denounced + if = { + limit = { + $ACTOR$ = { + has_hook_of_type = { + target = $RECIPIENT$ + type = house_head_hook + } + } + } + $ACTOR$ = { + remove_hook = { + target = $RECIPIENT$ + type = house_head_hook + } + } + } + if = { + limit = { + has_opinion_modifier = { + target = $ACTOR$ + modifier = forgave_denounced_opinion + } + } + custom_tooltip = forgiven_changed_to_denounced + hidden_effect = { + remove_opinion = { + target = $ACTOR$ + modifier = forgave_denounced_opinion + } + add_opinion = { + modifier = denounced_opinion + target = $ACTOR$ + } + } + } + else = { + add_opinion = { + modifier = denounced_opinion + target = $ACTOR$ + } + } + if = { + limit = { + NOT = { is_close_family_of = $ACTOR$ } + } + house = { + every_house_member = { + limit = { + NOT = { house = $ACTOR$.house } + } + custom = all_house_members + add_opinion = { + modifier = denounced_house_member_opinion + target = $ACTOR$ + } + } + } + + } +} + +forgive_effect = { + remove_trait = denounced + custom_tooltip = denounced_change_to_forgiven + hidden_effect = { + remove_opinion = { + target = scope:actor + modifier = denounced_opinion + } + add_opinion = { + modifier = forgave_denounced_opinion + target = scope:actor + opinion = -25 + } + } + if = { + limit = { + NOT = { is_close_family_of = scope:actor } + } + house = { + every_house_member = { + limit = { + house != scope:actor.house + } + custom = all_house_members + add_opinion = { + modifier = forgave_house_member_opinion + target = scope:actor + } + } + } + + } +} + +dynast_claim_title_effect = { + scope:actor = { + add_unpressed_claim = scope:target + stress_impact = { + content = minor_stress_impact_gain + generous = minor_stress_impact_gain + } + } + scope:recipient = { + add_opinion = { + target = scope:actor + modifier = claimed_my_title_opinion + opinion = -50 + } + } +} + +dynast_end_dynasty_wars_effect = { + scope:actor.dynasty = { + add_dynasty_prestige = medium_dynasty_prestige_loss + } + + scope:recipient = { + every_character_war = { + limit = { + primary_defender != scope:actor + primary_attacker = scope:recipient + primary_defender.dynasty = scope:recipient.dynasty + } + primary_defender = { + trigger_event = char_interaction.0071 + } + end_war = white_peace + } + } +} + +educate_child_interaction_effect = { + scope:ward = { + # Culture/faith conversion + university gold/tooltips + education_flags_tooltips_effect = yes + } + # Travel setup + ward_depart_effect = yes +} + +education_flags_tooltips_effect = { + #Convert culture + if = { + limit = { always = scope:convert_culture } + scope:ward = { + add_character_flag = { + flag = convert_culture + years = 10 + } + } + if = { + limit = { scope:ward.age < 11 } + custom_description = { + text = "educate_child_option_convert_culture_effect" + subject = scope:ward + object = scope:guardian.culture + } + } + else_if = { + limit = { + scope:ward.age >= 11 + scope:ward.age < 14 + } + custom_description = { + text = "educate_child_option_convert_culture_likely_effect" + subject = scope:ward + object = scope:guardian.culture + } + } + else_if = { + limit = { scope:ward.age >= 14 } + custom_description = { + text = "educate_child_option_convert_culture_unlikely_effect" + subject = scope:ward + object = scope:guardian.culture + } + } + } + #Convert faith + if = { + limit = { always = scope:convert_faith } + scope:ward = { + add_character_flag = { + flag = convert_faith + years = 10 + } + } + if = { + limit = { scope:ward.age < 11 } + custom_description = { + text = "educate_child_option_convert_faith_effect" + subject = scope:ward + object = scope:guardian.faith + } + } + else_if = { + limit = { + scope:ward.age >= 11 + scope:ward.age < 14 + } + custom_description = { + text = "educate_child_option_convert_faith_likely_effect" + subject = scope:ward + object = scope:guardian.faith + } + } + else_if = { + limit = { scope:ward.age >= 14 } + custom_description = { + text = "educate_child_option_convert_faith_unlikely_effect" + subject = scope:ward + object = scope:guardian.faith + } + } + } + + # Knowledge + if = { + limit = { + always = scope:send_to_university + OR = { + scope:recipient = { + OR = { + any_realm_province = { + is_higher_studies_location = yes + save_temporary_scope_as = university + } + any_realm_county = { + has_county_modifier = pandidakterion_university_modifier + save_temporary_scope_as = university + } + } + } + scope:actor = { + this = scope:secondary_actor + any_realm_province = { + is_higher_studies_location = yes + save_temporary_scope_as = university + } + } + } + } + scope:actor = { + remove_short_term_gold = { + value = monumental_gold_value + if = { + limit = { house = { has_house_modifier = ep3_eparch_university_influence_modifier } } + multiply = { + value = 1 + subtract = university_cost_reduction_value + } + } + } + } + custom_tooltip = is_sent_to_university + if = { + limit = { + scope:university ?= { + is_province_valid_confucian_education_trigger = yes + } + } + custom_tooltip = studying_confucian_education_trait + } + add_character_flag = { + flag = studying_at_university + years = 17 + } + } + # Confucian Education trait + if = { + limit = { + scope:guardian = { + has_trait = confucian_education + } + } + custom_tooltip = studying_confucian_education_trait + custom_tooltip = studying_confucian_education_disciple + add_character_flag = { + flag = studying_confucian_education + years = 17 + } + } +} + +educate_child_event_effect = { + scope:ward = { + #Set relation and move character + set_relation_guardian = scope:guardian + + if = { + limit = { + scope:guardian = { is_playable_character = yes } + scope:ward = { is_playable_character = no } + scope:guardian != scope:ward.host + } + visit_court_of = scope:guardian + } + else_if = { + limit = { + scope:guardian = { is_playable_character = no } + scope:ward = { is_playable_character = yes } + scope:ward != scope:guardian.host + } + scope:guardian = { + visit_court_of = scope:ward + } + } + else_if = { + limit = { + scope:guardian = { is_playable_character = no } + scope:ward = { is_playable_character = no } + exists = scope:guardian.host + scope:guardian.host != scope:ward.host + } + visit_court_of = scope:guardian.host + } + } + + #Opinions + guardian_add_opinion_effect = { GUARDIAN = scope:guardian WARD_LIEGE = scope:ward_liege WARD = scope:ward } +} + +call_dynasty_member_to_war_interaction_effect = { + if = { + limit = { + exists = scope:target + } + + scope:target = { + hidden_effect = { + set_called_to = scope:recipient + } + if = { + limit = { + is_attacker = scope:actor + } + add_attacker = scope:recipient + } + else = { + add_defender = scope:recipient + } + } + + scope:actor.dynasty = { + add_dynasty_prestige = medium_dynasty_prestige_loss + } + } + + if = { + limit = { always = scope:hook } + scope:actor = { + use_hook = scope:recipient + } + } +} + +offer_vassalization_interaction_effect = { + create_title_and_vassal_change = { + type = swear_fealty + save_scope_as = change + } + scope:recipient = { + change_liege = { + liege = scope:actor + change = scope:change + } + add_opinion = { + modifier = became_vassal + target = scope:actor + opinion = 10 + } + } + resolve_title_and_vassal_change = scope:change + + # Special terms for feudal contracts + scope:recipient = { + if = { + limit = { + government_has_flag = government_is_feudal + } + if = { + limit = { scope:high_obligations = yes } + hidden_effect = { + if = { + limit = { top_liege != this } # To avoid errors during tooltip generation (prior to the contract being generated) + vassal_contract_set_obligation_level = { type = feudal_government_taxes level = 3 } + vassal_contract_set_obligation_level = { type = feudal_government_levies level = 3 } + } + } + custom_tooltip = high_obligations_taxes + custom_tooltip = high_obligations_levies + } + else_if = { + limit = { scope:low_obligations = yes } + hidden_effect = { + if = { + limit = { top_liege != this } # To avoid errors during tooltip generation (prior to the contract being generated) + vassal_contract_set_obligation_level = { type = feudal_government_taxes level = 1 } + vassal_contract_set_obligation_level = { type = feudal_government_levies level = 1 } + } + } + custom_tooltip = low_obligations_taxes + custom_tooltip = low_obligations_levies + } + else_if = { + limit = { scope:religious_exemption = yes } + hidden_effect = { + if = { + limit = { top_liege != this } # To avoid errors during tooltip generation (prior to the contract being generated) + vassal_contract_set_obligation_level = { type = feudal_government_taxes level = 2 } + vassal_contract_set_obligation_level = { type = feudal_government_levies level = 1 } + vassal_contract_set_obligation_level = { type = religious_rights level = 1 } + } + } + custom_tooltip = normal_obligations_taxes + custom_tooltip = low_obligations_levies + custom_tooltip = religious_protection_tt + } + else = { + hidden_effect = { + if = { + limit = { top_liege != this } # To avoid errors during tooltip generation (prior to the contract being generated) + vassal_contract_set_obligation_level = { type = feudal_government_taxes level = 2 } + vassal_contract_set_obligation_level = { type = feudal_government_levies level = 2 } + } + } + custom_tooltip = normal_obligations_taxes + custom_tooltip = normal_obligations_levies + } + } + else_if = { + limit = { + government_has_flag = government_is_clan + scope:religious_exemption_clan = yes + } + hidden_effect = { + if = { + limit = { top_liege != this } # To avoid errors during tooltip generation (prior to the contract being generated) + vassal_contract_set_obligation_level = { type = religious_rights level = 1 } + } + } + custom_tooltip = religious_protection_tt + } + } + + # Struggle catalysts. + hidden_effect = { + fp3_struggle_apply_independent_vassalage_catalyst_effect = { + NEW_LIEGE = scope:actor + NEW_VASSAL = scope:recipient + } + } +} + +# Effect to start a tributary relationship from a war +# root-scope is the Suzerain +# $TRIBUTARY$ = the new tributary +# $SUZERAIN$ = their suzerain +# $WAR$ = required war scope +start_tributary_from_war_effect = { + $WAR$ ?= { save_scope_as = tributary_war } + if = { + limit = { NOT = { exists = $WAR$ } } + error_log = "Tried to call start_tributary_from_war_effect without a valid war scope!" + } + save_scope_value_as = { + name = high_obligations + value = yes + } + start_tributary_interaction_effect = { + TRIBUTARY = $TRIBUTARY$ + SUZERAIN = $SUZERAIN$ + } +} + +# Effect to start a tributary relationship, can be called directly without a war or from start_tributary_from_war_effect +# $TRIBUTARY$ = the new tributary +# $SUZERAIN$ = their suzerain +start_tributary_interaction_effect = { + # Setup truces depending on how the tributary relationship was created + $TRIBUTARY$ = { save_scope_as = tributary_loc } + $SUZERAIN$ = { save_scope_as = suzerain_loc } + + #Mandala Tributaries + if = { + limit = { + should_be_mandala_tributary_trigger = { + SUZERAIN = $SUZERAIN$ + TRIBUTARY = $TRIBUTARY$ + } + trigger_if = { + limit = { exists = scope:tributary_war } + $SUZERAIN$ = { + AND = { + house = { has_house_head_parameter = can_make_mandala_tributaries_via_war } + is_house_head = yes + } + } + } + } + $TRIBUTARY$ = { + if = { + limit = { government_has_flag = government_is_tribal } + start_tributary = { + contract_group = tributary_mandala_tribal + suzerain = $SUZERAIN$ + } + if = { + limit = { + OR = { + scope:high_obligations ?= yes + exists = scope:tributary_war + } + } + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { + type = mandala_government_taxes + level = 3 + } + tributary_contract_set_obligation_level = { + type = mandala_government_prestige + level = 2 + } + tributary_contract_set_obligation_level = { + type = mandala_government_levies + level = 3 + } + } + } + custom_tooltip = high_mandala_tribute_taxes + custom_tooltip = high_mandala_tribute_prestige + custom_tooltip = high_mandala_tribute_levies + } + else_if = { + limit = { scope:low_obligations ?= yes } + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { + type = mandala_government_taxes + level = 0 + } + tributary_contract_set_obligation_level = { + type = mandala_government_prestige + level = 0 + } + tributary_contract_set_obligation_level = { + type = mandala_government_levies + level = 0 + } + } + } + custom_tooltip = exempt_mandala_tribute_taxes + custom_tooltip = low_mandala_tribute_prestige + custom_tooltip = exempt_mandala_tribute_levies + } + else = { + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { + type = mandala_government_taxes + level = 2 + } + tributary_contract_set_obligation_level = { + type = mandala_government_prestige + level = 2 + } + tributary_contract_set_obligation_level = { + type = mandala_government_levies + level = 1 + } + } + } + custom_tooltip = normal_mandala_tribute_taxes + custom_tooltip = normal_mandala_tribute_prestige + custom_tooltip = low_mandala_tribute_levies + } + + if = { + limit = { is_tributary = yes } # suppress error logging + tributary_contract_set_obligation_level = { + type = mandala_suzerain_war_participation_guarantee + level = 1 + } + } + } + else = { + start_tributary = { + contract_group = tributary_mandala + suzerain = $SUZERAIN$ + } + if = { + limit = { + OR = { + scope:high_obligations ?= yes + exists = scope:tributary_war + } + } + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { + type = mandala_government_taxes + level = 3 + } + tributary_contract_set_obligation_level = { + type = mandala_government_piety + level = 2 + } + tributary_contract_set_obligation_level = { + type = mandala_government_levies + level = 3 + } + } + } + custom_tooltip = high_mandala_tribute_taxes + custom_tooltip = high_mandala_tribute_piety + custom_tooltip = high_mandala_tribute_levies + } + else_if = { + limit = { scope:low_obligations ?= yes } + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { + type = mandala_government_taxes + level = 0 + } + tributary_contract_set_obligation_level = { + type = mandala_government_piety + level = 0 + } + tributary_contract_set_obligation_level = { + type = mandala_government_levies + level = 0 + } + } + } + custom_tooltip = exempt_mandala_tribute_taxes + custom_tooltip = low_mandala_tribute_piety + custom_tooltip = exempt_mandala_tribute_levies + } + else = { + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { + type = mandala_government_taxes + level = 2 + } + tributary_contract_set_obligation_level = { + type = mandala_government_piety + level = 2 + } + tributary_contract_set_obligation_level = { + type = mandala_government_levies + level = 1 + } + } + } + custom_tooltip = normal_mandala_tribute_taxes + custom_tooltip = normal_mandala_tribute_piety + custom_tooltip = low_mandala_tribute_levies + } + if = { + limit = { is_tributary = yes } # suppress error logging + tributary_contract_set_obligation_level = { + type = mandala_suzerain_war_participation_guarantee + level = 1 + } + } + } + } + } + # Wanua Tributaries + else_if = { + limit = { + should_be_wanua_tributary_trigger = { + SUZERAIN = $SUZERAIN$ + TRIBUTARY = $TRIBUTARY$ + } + } + $TRIBUTARY$ = { + start_tributary = { + contract_group = tributary_wanua + suzerain = $SUZERAIN$ + } + if = { + limit = { + OR = { + scope:high_obligations ?= yes + exists = scope:tributary_war + } + } + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { + type = barter_goods_obligations + level = 3 + } + tributary_contract_set_obligation_level = { type = default_tributary_taxes level = 2 } + tributary_contract_set_obligation_level = { type = default_tributary_prestige level = 1 } + } + } + custom_tooltip = high_wanua_tribute_barter_goods + custom_tooltip = high_subjugated_tribute_taxes + custom_tooltip = normal_subjugated_tribute_prestige + } + else_if = { + limit = { scope:low_obligations ?= yes } + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { + type = barter_goods_obligations + level = 1 + } + tributary_contract_set_obligation_level = { type = default_tributary_taxes level = 1 } + tributary_contract_set_obligation_level = { type = default_tributary_prestige level = 1 } + } + } + custom_tooltip = low_wanua_tribute_barter_goods + custom_tooltip = low_subjugated_tribute_taxes + custom_tooltip = none_subjugated_tribute_prestige + } + else = { + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { + type = barter_goods_obligations + level = 2 + } + tributary_contract_set_obligation_level = { type = default_tributary_taxes level = 1 } + tributary_contract_set_obligation_level = { type = default_tributary_prestige level = 1 } + } + } + custom_tooltip = medium_wanua_tribute_barter_goods + custom_tooltip = low_subjugated_tribute_taxes + } + } + } + # Nomadic Tributaries + else_if = { + limit = { + $SUZERAIN$ = { has_government = nomad_government } + } + $TRIBUTARY$ = { + if = { + limit = { + OR = { + has_government = nomad_government + has_government = herder_government + } + } + start_tributary = { + contract_group = tributary_nomadic + suzerain = $SUZERAIN$ + } + } + else = { + start_tributary = { + contract_group = tributary_settled + suzerain = $SUZERAIN$ + } + } + + # Special terms depending on which options were set + if = { # settled tributary + limit = { + NOR = { + has_government = nomad_government + has_government = herder_government + } + } + if = { + limit = { + OR = { + scope:high_obligations ?= yes + exists = scope:tributary_war + } + } + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { type = default_tributary_taxes level = 2 } + tributary_contract_set_obligation_level = { type = default_tributary_levies level = 2 } + tributary_contract_set_obligation_level = { type = default_tributary_prestige level = 2 } + } + } + custom_tooltip = high_feudal_tribute_taxes + custom_tooltip = high_feudal_tribute_levies + custom_tooltip = high_nomad_tribute_prestige + } + else_if = { + limit = { scope:low_obligations ?= yes } + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { type = default_tributary_taxes level = 0 } + tributary_contract_set_obligation_level = { type = default_tributary_levies level = 0 } + tributary_contract_set_obligation_level = { type = default_tributary_prestige level = 0 } + } + } + custom_tooltip = low_feudal_tribute_taxes + custom_tooltip = low_feudal_tribute_levies + custom_tooltip = none_nomad_tribute_prestige + } + else = { + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { type = default_tributary_taxes level = 1 } + tributary_contract_set_obligation_level = { type = default_tributary_levies level = 1 } + tributary_contract_set_obligation_level = { type = default_tributary_prestige level = 1 } + } + } + custom_tooltip = normal_feudal_tribute_taxes + custom_tooltip = normal_feudal_tribute_levies + custom_tooltip = normal_nomad_tribute_prestige + } + } + else = { # nomadic tributary + if = { + limit = { + OR = { + scope:high_obligations ?= yes + exists = scope:tributary_war + } + } + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { type = nomad_government_herd level = 3 } #herd_tax_high + tributary_contract_set_obligation_level = { type = nomad_government_prestige level = 2 } + } + } + custom_tooltip = high_nomad_tribute_herd + custom_tooltip = high_nomad_tribute_prestige + } + else_if = { + limit = { scope:low_obligations ?= yes } + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { type = nomad_government_herd level = 1 } #herd_tax_low + tributary_contract_set_obligation_level = { type = nomad_government_prestige level = 0 } + } + } + custom_tooltip = low_nomad_tribute_herd + custom_tooltip = none_nomad_tribute_prestige + } + else = { + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { type = nomad_government_herd level = 2 } #herd_tax_normal + tributary_contract_set_obligation_level = { type = nomad_government_prestige level = 1 } + } + } + custom_tooltip = normal_nomad_tribute_herd + custom_tooltip = normal_nomad_tribute_prestige + } + } + if = { + limit = { is_tributary = yes } # suppress error logging + tributary_contract_set_obligation_level = { type = suzerain_war_participation_guarantee level = 0 } + tributary_contract_set_obligation_level = { type = tributary_war_participation_obligation level = 0 } + custom_tooltip = no_tributary_war_obligations + custom_tooltip = no_suzerain_guarantee + } + } + } + else_if = { + limit = { + $SUZERAIN$ = { has_government = steppe_admin_government } + } + $TRIBUTARY$ = { + if = { + limit = { + OR = { + has_government = nomad_government + has_government = herder_government + } + } + start_tributary = { + contract_group = tributary_steppe + suzerain = $SUZERAIN$ + } + } + else = { + start_tributary = { + contract_group = tributary_settled + suzerain = $SUZERAIN$ + } + } + + # Special terms depending on which options were set + if = { # settled tributary + limit = { + NOR = { + has_government = nomad_government + has_government = herder_government + } + } + if = { + limit = { + OR = { + scope:high_obligations ?= yes + exists = scope:tributary_war + } + } + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { type = default_tributary_taxes level = 2 } + tributary_contract_set_obligation_level = { type = default_tributary_levies level = 2 } + tributary_contract_set_obligation_level = { type = default_tributary_prestige level = 2 } + } + } + custom_tooltip = high_feudal_tribute_taxes + custom_tooltip = high_feudal_tribute_levies + custom_tooltip = high_nomad_tribute_prestige + } + else_if = { + limit = { scope:low_obligations ?= yes } + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { type = default_tributary_taxes level = 0 } + tributary_contract_set_obligation_level = { type = default_tributary_levies level = 0 } + tributary_contract_set_obligation_level = { type = default_tributary_prestige level = 0 } + } + } + custom_tooltip = low_feudal_tribute_taxes + custom_tooltip = low_feudal_tribute_levies + custom_tooltip = none_nomad_tribute_prestige + } + else = { + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { type = default_tributary_taxes level = 1 } + tributary_contract_set_obligation_level = { type = default_tributary_levies level = 1 } + tributary_contract_set_obligation_level = { type = default_tributary_prestige level = 1 } + } + } + custom_tooltip = normal_feudal_tribute_taxes + custom_tooltip = normal_feudal_tribute_levies + custom_tooltip = normal_nomad_tribute_prestige + } + } + else = { # steppe tributary + if = { + limit = { + OR = { + scope:high_obligations ?= yes + exists = scope:tributary_war + } + } + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { type = default_tributary_taxes level = 2 } + tributary_contract_set_obligation_level = { type = nomad_government_prestige level = 2 } + } + } + custom_tooltip = high_nomad_tribute_herd + custom_tooltip = high_nomad_tribute_prestige + } + else_if = { + limit = { scope:low_obligations ?= yes } + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { type = default_tributary_taxes level = 1 } + tributary_contract_set_obligation_level = { type = nomad_government_prestige level = 0 } + } + } + custom_tooltip = low_nomad_tribute_herd + custom_tooltip = none_nomad_tribute_prestige + } + else = { + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { type = default_tributary_taxes level = 2 } + tributary_contract_set_obligation_level = { type = nomad_government_prestige level = 1 } + } + } + custom_tooltip = normal_nomad_tribute_herd + custom_tooltip = normal_nomad_tribute_prestige + } + } + if = { + limit = { + is_tributary = yes # suppress error logging + government_has_flag = government_is_nomadic + NOT = { government_has_flag = government_is_herder } + } + tributary_contract_set_obligation_level = { type = suzerain_war_participation_guarantee level = 0 } + tributary_contract_set_obligation_level = { type = tributary_war_participation_obligation level = 1 } + custom_tooltip = tributary_war_obligations + custom_tooltip = no_suzerain_guarantee + } + else_if = { + limit = { + is_tributary = yes # suppress error logging + } + tributary_contract_set_obligation_level = { type = suzerain_war_participation_guarantee level = 0 } + tributary_contract_set_obligation_level = { type = tributary_war_participation_obligation level = 0 } + custom_tooltip = no_tributary_war_obligations + custom_tooltip = no_suzerain_guarantee + } + } + } + else_if = { + limit = { + $SUZERAIN$ = { + has_government = celestial_government + highest_held_title_tier >= tier_hegemony + } + } + $TRIBUTARY$ = { + start_tributary = { + contract_group = tributary_celestial + suzerain = $SUZERAIN$ + } + + if = { + limit = { + OR = { + scope:high_obligations ?= yes + exists = scope:tributary_war + } + } + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { type = celestial_tribute_gold level = 2 } + tributary_contract_set_obligation_level = { type = celestial_tribute_prestige level = 2 } + } + } + custom_tooltip = normal_celestial_tribute_taxes + custom_tooltip = normal_celestial_tribute_prestige + } + else_if = { + limit = { scope:low_obligations ?= yes } + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { type = celestial_tribute_gold level = 0 } + tributary_contract_set_obligation_level = { type = celestial_tribute_prestige level = 0 } + } + } + custom_tooltip = no_celestial_tribute_taxes + custom_tooltip = no_celestial_tribute_prestige + } + else = { + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { type = celestial_tribute_gold level = 1 } + tributary_contract_set_obligation_level = { type = celestial_tribute_prestige level = 1 } + } + } + custom_tooltip = low_celestial_tribute_taxes + custom_tooltip = low_celestial_tribute_prestige + } + + add_subject_standing = 25 + custom_tooltip = expected_to_pay_tribute + } + } + else = { # subjugated tributary + $TRIBUTARY$ = { + start_tributary = { + contract_group = tributary_subjugated + suzerain = $SUZERAIN$ + } + if = { + limit = { scope:low_obligations ?= yes } + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { type = default_tributary_taxes level = 1 } + tributary_contract_set_obligation_level = { type = default_tributary_prestige level = 0 } + } + } + custom_tooltip = low_subjugated_tribute_taxes + custom_tooltip = none_subjugated_tribute_prestige + } + else = { + if = { + limit = { is_tributary = yes } # suppress error logging + hidden_effect = { + tributary_contract_set_obligation_level = { type = default_tributary_taxes level = 2 } + tributary_contract_set_obligation_level = { type = default_tributary_prestige level = 1 } + tributary_contract_set_obligation_level = { type = suzerain_war_participation_guarantee level = 1 } + tributary_contract_set_obligation_level = { type = tributary_war_participation_obligation level = 0 } + } + } + custom_tooltip = high_subjugated_tribute_taxes + custom_tooltip = normal_subjugated_tribute_prestige + } + custom_tooltip = suzerain_guarantee + custom_tooltip = no_tributary_war_obligations + } + } + setup_tributary_truces_effect = { SUZERAIN = $SUZERAIN$ TRIBUTARY = $TRIBUTARY$ } +} + +@truce_duration_war_default = 15 +@truce_duration_war_mandala = 5 +@truce_duration_negotiated_default = 5 +@truce_duration_negotiated_celestial = 25 + +setup_tributary_truces_effect = { + # Setup truces depending on how the tributary relationship was created + $TRIBUTARY$ = { save_scope_as = tributary_loc } + $SUZERAIN$ = { save_scope_as = suzerain_loc } + + if = { + limit = { exists = scope:tributary_war } # this will exist if invoked from start_tributary_from_war_effect + $TRIBUTARY$ = { + if = { + limit = { should_be_mandala_tributary_trigger = { SUZERAIN = $SUZERAIN$ TRIBUTARY = $TRIBUTARY$ } } + add_truce_one_way = { + character = $SUZERAIN$ + years = @truce_duration_war_mandala + war = scope:tributary_war + result = defeat + } + } + else = { + add_truce_one_way = { + character = $SUZERAIN$ + years = @truce_duration_war_default + war = scope:tributary_war + result = defeat + } + } + } + } + else = { + $TRIBUTARY$ = { + if = { + limit = { $SUZERAIN$ = { has_government = celestial_government } } + add_truce_both_ways = { + character = $SUZERAIN$ + years = @truce_duration_negotiated_celestial + name = TRUCE_TRIBUTARY + } + } + else = { + add_truce_both_ways = { + character = $SUZERAIN$ + years = @truce_duration_negotiated_default + name = TRUCE_TRIBUTARY + } + } + } + } +} + +offer_fealty_interaction_effect = { + create_title_and_vassal_change = { + type = swear_fealty + save_scope_as = change + } + scope:actor = { + change_liege = { + liege = scope:recipient + change = scope:change + } + + stress_impact = { + ambitious = medium_stress_impact_gain + arrogant = medium_stress_impact_gain + } + } + resolve_title_and_vassal_change = scope:change + + scope:actor = { + # Special terms for feudal contracts + if = { + limit = { + government_has_flag = government_is_feudal + } + if = { + limit = { scope:high_obligations = yes } + hidden_effect = { + if = { + limit = { top_liege != this } # To avoid errors during tooltip generation (prior to the contract being generated) + vassal_contract_set_obligation_level = { type = feudal_government_taxes level = 3 } + vassal_contract_set_obligation_level = { type = feudal_government_levies level = 3 } + } + } + custom_tooltip = high_obligations_taxes + custom_tooltip = high_obligations_levies + } + else_if = { + limit = { scope:low_obligations = yes } + hidden_effect = { + if = { + limit = { top_liege != this } # To avoid errors during tooltip generation (prior to the contract being generated) + vassal_contract_set_obligation_level = { type = feudal_government_taxes level = 1 } + vassal_contract_set_obligation_level = { type = feudal_government_levies level = 1 } + } + } + custom_tooltip = low_obligations_taxes + custom_tooltip = low_obligations_levies + } + else_if = { + limit = { scope:religious_taxation = yes } + hidden_effect = { + if = { + limit = { top_liege != this } # To avoid errors during tooltip generation (prior to the contract being generated) + vassal_contract_set_obligation_level = { type = feudal_government_taxes level = 3 } + vassal_contract_set_obligation_level = { type = feudal_government_levies level = 2 } + vassal_contract_set_obligation_level = { type = religious_rights level = 1 } + } + } + custom_tooltip = high_obligations_taxes + custom_tooltip = normal_obligations_levies + if = { + limit = { scope:recipient.faith = { has_doctrine_parameter = unlock_jizya_contract } } + custom_tooltip = jizya_religious_protection_tt + } + else = { custom_tooltip = religious_protection_tt } + } + else = { + hidden_effect = { + if = { + limit = { top_liege != this } # To avoid errors during tooltip generation (prior to the contract being generated) + vassal_contract_set_obligation_level = { type = feudal_government_taxes level = 2 } + vassal_contract_set_obligation_level = { type = feudal_government_levies level = 2 } + } + } + custom_tooltip = normal_obligations_taxes + custom_tooltip = normal_obligations_levies + } + } + else_if = { + limit = { + government_has_flag = government_is_clan + scope:religious_exemption_clan = yes + } + hidden_effect = { + if = { + limit = { top_liege != this } # To avoid errors during tooltip generation (prior to the contract being generated) + vassal_contract_set_obligation_level = { type = religious_rights level = 1 } + } + } + custom_tooltip = religious_protection_tt + } + } + + # Struggle catalysts. + hidden_effect = { + fp3_struggle_apply_independent_vassalage_catalyst_effect = { + NEW_LIEGE = scope:recipient + NEW_VASSAL = scope:actor + } + } +} + + +call_ally_interaction_effect = { + if = { + limit = { + exists = scope:target + scope:recipient = { + NOR = { + is_at_war_with = scope:target.primary_defender + is_at_war_with = scope:target.primary_attacker + } + } + } + call_ally_interaction_event_effect = yes + + } +} + +#So that we can show a tooltip in the event about them responding +call_ally_interaction_event_effect = { + scope:target = { + hidden_effect = { + set_called_to = scope:recipient + } + if = { + limit = { + is_attacker = scope:actor + } + add_attacker = scope:recipient + scope:actor = { + #Check for Mandala first + if = { + limit = { + government_has_flag = government_is_mandala + scope:recipient = { is_tributary_of = scope:actor } + } + if = { + limit = { + scope:recipient.primary_title.tier = tier_barony + } + add_piety = { + add = minor_piety_loss + multiply = 2 + } + } + else_if = { + limit = { + scope:recipient.primary_title.tier = tier_county + } + add_piety = { + add = medium_piety_loss + multiply = 2 + } + } + else_if = { + limit = { + scope:recipient.primary_title.tier = tier_duchy + } + add_piety = { + add = major_piety_loss + multiply = 2 + } + } + else_if = { + limit = { + scope:recipient.primary_title.tier = tier_kingdom + } + add_piety = { + add = massive_piety_loss + multiply = 1.5 + } + } + else_if = { + limit = { + scope:recipient.primary_title.tier = tier_empire + } + add_piety = { + add = monumental_piety_loss + multiply = 1.5 + } + } + else_if = { + limit = { + scope:recipient.primary_title.tier = tier_hegemony + } + add_piety = { + add = monumental_piety_loss + multiply = 2.5 + } + } + } + #Then do everything else + else = { + if = { + limit = { + NOT = { + has_relation_blood_brother = scope:recipient + } + } + if = { + limit = { + scope:recipient.primary_title.tier = tier_barony + } + add_prestige = -10 + } + else_if = { + limit = { + scope:recipient.primary_title.tier = tier_county + } + add_prestige = minor_prestige_loss + } + else_if = { + limit = { + scope:recipient.primary_title.tier = tier_duchy + } + add_prestige = medium_prestige_loss + } + else_if = { + limit = { + scope:recipient.primary_title.tier = tier_kingdom + } + add_prestige = major_prestige_loss + } + else_if = { + limit = { + scope:recipient.primary_title.tier = tier_empire + } + add_prestige = massive_prestige_loss + } + } + } + + } + } + else = { + add_defender = scope:recipient + } + } +} + +seduce_interaction_stress_effect = { + if = { + limit = { + NOT = { + scope:recipient = { + is_consort_of = scope:actor + } + } + OR = { + scope:actor = { + is_male = yes + faith = { NOT = { has_doctrine_parameter = adultery_male_accepted } } + } + scope:actor = { + is_female = yes + faith = { NOT = { has_doctrine_parameter = adultery_female_accepted } } + } + } + } + scope:actor = { + stress_impact = { + chaste = medium_stress_impact_gain + zealous = minor_stress_impact_gain + honest = minor_stress_impact_gain + just = minor_stress_impact_gain + } + } + } + else = { + scope:actor = { + stress_impact = { + chaste = medium_stress_impact_gain + } + } + } +} + +retract_vassal_interaction_effect = { + scope:actor = { + vassal_revocation_tyranny_effect = yes + if = { + limit = { + vassal_revocation_is_tyrannical_trigger = { VASSAL = scope:recipient } + } + stress_impact = { + generous = medium_stress_impact_gain + just = medium_stress_impact_gain + } + } + else = { + stress_impact = { + generous = medium_stress_impact_gain + forgiving = minor_stress_impact_gain + } + } + consume_revoke_title_reason = scope:recipient + } + create_title_and_vassal_change = { + type = revoked + save_scope_as = change + add_claim_on_loss = no + } + + scope:secondary_recipient = { + change_liege = { + liege = scope:actor + change = scope:change + } + } + + resolve_title_and_vassal_change = scope:change + + scope:recipient = { + add_opinion = { + target = scope:actor + modifier = retracted_vassal + } + } + if = { + limit = { + always = scope:hook + scope:actor ?= { has_hook = scope:recipient } + } + scope:actor = { use_hook = scope:recipient } + } +} + +ask_for_pardon_interaction_effect = { + scope:actor = { + every_liege_or_above = { + if = { + limit = { has_imprisonment_reason = scope:actor } + send_interface_toast = { + title = ask_for_pardon_interaction_accept_toast + left_icon = scope:recipient + consume_imprisonment_reasons = scope:actor + } + } + if = { + limit = { has_banish_reason = scope:actor } + send_interface_toast = { + title = ask_for_pardon_interaction_accept_toast + left_icon = scope:recipient + consume_banish_reasons = scope:actor + } + } + if = { + limit = { has_execute_reason = scope:actor } + send_interface_toast = { + title = ask_for_pardon_interaction_accept_toast + left_icon = scope:recipient + consume_execute_reasons = scope:actor + } + } + if = { + limit = { has_revoke_title_reason = scope:actor } + send_interface_toast = { + title = ask_for_pardon_interaction_accept_toast + left_icon = scope:recipient + consume_revoke_title_reason = scope:actor + } + } + } + stress_impact = { + stubborn = minor_stress_impact_gain + } + } + if = { + limit = { + always = scope:hook + scope:actor = { # TO make sure you still have a hook on them + has_usable_hook = scope:recipient + } + } + scope:actor = { + use_hook = scope:recipient + } + } +} + +revoke_title_interaction_effect = { + if = { + limit = { + scope:recipient = { + faith = scope:actor.faith + government_has_flag = government_is_theocracy + } + scope:actor != scope:actor.faith.religious_head #No loss if actor is head of faith themselves + } + scope:actor = { + add_piety = major_piety_loss + } + if = { + limit = { + exists = scope:actor.faith.religious_head + } + scope:actor.faith.religious_head = { + add_opinion = { + target = scope:actor + modifier = impious_opinion + opinion = -20 + } + } + } + } + if = { + limit = { + exists = scope:actor.faith.religious_head + scope:recipient = scope:actor.faith.religious_head + } + scope:actor = { + add_piety_level = -2 + } + } + if = { + limit = { + scope:landed_title.tier != tier_barony + scope:recipient = { + NOT = { government_has_flag = government_is_herder } + } + } + scope:actor = { + revocation_tyranny_effect = { VASSAL = scope:recipient } + title_revocation_stress_effect = { VASSAL = scope:recipient } + consume_revoke_title_reason = scope:recipient + } + scope:recipient = { + if = { + limit = { + NOT = { exists = scope:administrative_revocation } + is_landed_or_landless_administrative = no + } + add_pressed_claim = scope:landed_title + } + if = { + limit = { + is_a_faction_member = yes + } + add_joined_faction_discontent = 25 + } + } + + if = { + limit = { scope:landed_title.tier = tier_county } + scope:landed_title = { + change_county_control = { + value = -30 + if = { + limit = { + scope:recipient.culture != scope:actor.culture + scope:recipient.culture = this.culture + } + multiply = 1.5 + } + if = { + limit = { + scope:recipient.faith != scope:actor.faith + scope:recipient.faith = this.faith + } + multiply = 1.5 + } + } + } + } + + if = { + limit = { + scope:actor.culture = { has_cultural_parameter = penalty_for_revoking_titles_from_house_members } + exists = scope:actor.house + exists = scope:recipient.house + scope:actor.house = scope:recipient.house + } + if = { + limit = { + scope:landed_title.tier = tier_county + } + scope:actor = { + add_prestige = medium_prestige_loss + } + } + else_if = { + limit = { + scope:landed_title.tier = tier_duchy + } + scope:actor = { + add_prestige = major_prestige_loss + } + } + else_if = { #Empire + limit = { + scope:landed_title.tier = tier_kingdom + } + scope:actor = { + add_prestige = massive_prestige_loss + } + } + } + + if = { + limit = { + scope:actor.culture = { has_cultural_parameter = penalty_for_revoking_titles_from_close_family } + exists = scope:actor + exists = scope:recipient + scope:actor = { + is_close_family_of = scope:recipient + } + } + if = { + limit = { + scope:landed_title.tier = tier_county + } + scope:actor = { + add_prestige = medium_prestige_loss + } + } + else_if = { + limit = { + scope:landed_title.tier = tier_duchy + } + scope:actor = { + add_prestige = major_prestige_loss + } + } + else_if = { #Empire + limit = { + scope:landed_title.tier = tier_kingdom + } + scope:actor = { + add_prestige = massive_prestige_loss + } + } + } + + if = { + limit = { + scope:actor.culture = { has_cultural_parameter = piety_penalty_for_revoking_titles_from_house_members } + exists = scope:actor.house + exists = scope:recipient.house + scope:actor.house = scope:recipient.house + } + if = { + limit = { + scope:landed_title.tier = tier_county + } + scope:actor = { + add_piety = medium_piety_loss + } + } + else_if = { + limit = { + scope:landed_title.tier = tier_duchy + } + scope:actor = { + add_piety = major_piety_loss + } + } + else = { #Can't revoke empire titles anyway + limit = { + scope:landed_title.tier = tier_kingdom + } + scope:actor = { + add_piety = massive_piety_loss + } + } + } + + # If we're a clan this interaction affects unity + if = { + limit = { + scope:actor = { government_has_flag = government_is_clan } + scope:recipient = { government_has_flag = government_is_clan } + exists = scope:actor.house + exists = scope:recipient.house + scope:actor.house = scope:recipient.house + scope:landed_title.tier >= tier_county + } + scope:actor.house = { + if = { + limit = { + scope:landed_title.tier = tier_county + } + save_scope_value_as = { + name = revoke_title_unity_loss + value = minor_unity_loss + } + } + if = { + limit = { + scope:landed_title.tier = tier_duchy + } + save_scope_value_as = { + name = revoke_title_unity_loss + value = medium_unity_loss + } + } + else_if = { + limit = { + scope:landed_title.tier = tier_kingdom + } + save_scope_value_as = { + name = revoke_title_unity_loss + value = major_unity_loss + } + } + if = { + limit = { exists = scope:revoke_title_unity_loss } + add_clan_unity_interaction_effect = { + CHARACTER = scope:actor + TARGET = scope:recipient + VALUE = scope:revoke_title_unity_loss + DESC = clan_unity_title_revoked.desc + REVERSE_NON_HOUSE_TARGET = no + } + } + } + } + + # EP3 - Become Adventurer - Revocation + scope:recipient = { + if = { + limit = { + has_ep3_dlc_trigger = yes + is_valid_for_laampdom = yes + } + # Plus for our memory variable. + primary_title = { save_scope_as = lost_primary_title } + custom_tooltip = { + text = laamp_may_become_adventurer_tt + trigger_event = { + id = ep3_laamps.0041 + delayed = yes + } + } + } + } + } + else = { + if = { + limit = { + NOT = { exists = scope:revoke_title_interaction } + } + custom_tooltip = IS_ALLOWED_TO_REVOKE_TITLE_BARONY_DESC + scope:actor = { + if = { + limit = { + any_vassal = { + vassal_stance = barons_and_minor_landholders + } + } + custom_tooltip = barons_and_minor_landholders_disapproves_baron_revocations + hidden_effect = { + every_vassal = { + vassal_stance = barons_and_minor_landholders + add_opinion = { + target = scope:actor + modifier = barons_and_minor_landholders_disapproves_baron_revocations_opinion + } + } + } + } + } + } + } + + + scope:actor = { + if = { + limit = { + scope:hook = yes + scope:recipient = { is_alive = yes } + } + use_hook = scope:recipient + } + if = { + limit = { + scope:hook_liege ?= yes + scope:intermediary = { is_alive = yes } + } + use_hook = scope:intermediary + } + } + if = { + limit = { + scope:recipient = { government_has_flag = government_is_herder } + } + scope:recipient = { + add_opinion = { + target = scope:actor + opinion = -10 # Herders don't care much + modifier = revoked_title + } + } + } + else = { + scope:recipient = { + add_opinion = { + target = scope:actor + modifier = revoked_title + } + if = { #If they recently imprisoned you, or asked for your excommunication, they become your rival + limit = { + OR = { + has_opinion_modifier = { + target = scope:actor + modifier = released_from_prison + } + AND = { + exists = var:requested_my_excommunication + var:requested_my_excommunication = scope:actor + } + } + NOT = { + has_relation_rival = scope:actor + } + } + if = { + limit = { + has_relation_potential_rival = scope:actor + } + remove_relation_potential_rival = scope:actor + } + set_relation_rival = { + target = scope:actor + reason = rival_revoked_title_reversed + } + } + else = { + progress_towards_rival_effect = { + CHARACTER = scope:actor + REASON = rival_revoked_title_progress + OPINION = 0 + } + } + # HOUSE RELATION + house ?= { + if = { + limit = { NOT = { this = scope:actor.house } } + change_house_relation_effect = { + HOUSE = scope:actor.house + VALUE = house_relation_damage_medium_value + REASON = title_revocation + CHAR = scope:actor + TARGET_CHAR = scope:recipient + TITLE = scope:landed_title + } + } + } + } + } + + # Penalty for taking the Party Baron's last title. I mean, come on... + if = { + limit = { + scope:recipient = { + has_character_flag = is_party_baron + NOT = { + any_held_title = { + this != scope:landed_title + } + } + } + } + scope:actor = { + add_character_modifier = { + modifier = party_baron_ended_the_party_modifier + years = 10 + } + random_owned_story = { + type = story_party_baron + end_story = yes + } + } + } +} + +call_house_member_to_war_interaction_effect = { + if = { + limit = { + exists = scope:target + } + + scope:target = { + hidden_effect = { + set_called_to = scope:recipient + } + if = { + limit = { + is_attacker = scope:actor + } + add_attacker = scope:recipient + } + else = { + add_defender = scope:recipient + } + } + } + + if = { + limit = { always = scope:hook } + scope:actor = { + use_hook = scope:recipient + } + } +} + +sun_trial_interaction_piety_effect = { + #Imprisoner gets piety + add_piety = { + value = minor_piety_value + if = { + limit = { has_execute_reason = scope:recipient } + add = minor_piety_value + } + if = { + limit = { has_banish_reason = scope:recipient } + add = miniscule_piety_value + } + if = { + limit = { has_revoke_title_reason = scope:recipient } + add = miniscule_piety_value + } + } +} + +declaration_of_repentance_interaction_effect = { + if = { + limit = { scope:declaration_hook = yes } + scope:actor = { + use_hook = scope:recipient + } + } + + scope:actor = { + if = { + limit = { + scope:declaration_hook = no + } + #Lose a ton of prestige (e.g., Henry's Walk to Canossa) + add_prestige = massive_prestige_loss + add_prestige_level = -1 + } + + #Character cannot be excommunicated again for 10 years. + remove_trait = excommunicated + add_character_modifier = { + modifier = excommunication_recently_lifted + years = 10 + } + + stress_impact = { + cynical = minor_stress_impact_gain + } + } + scope:recipient = { + add_prestige = major_prestige_gain + add_opinion = { + modifier = repentant_opinion + target = scope:actor + opinion = 10 + } + } +} + +seek_indulgences_interaction_effect = { + scope:actor = { + if = { + limit = { + OR = { + has_character_flag = seek_indulgences_removed_kinslayer_3 # For the post-interaction letter event + AND = { + has_trait = kinslayer_3 + trait_is_shunned_or_criminal_in_faith_trigger = { FAITH = faith TRAIT = kinslayer_3 GENDER_CHARACTER = scope:actor } + } + } + } + pay_short_term_gold = { + target = scope:recipient + gold = seek_indulgences_major_criminal_trait_value + } + remove_trait_force_tooltip = kinslayer_3 + add_character_flag = { + flag = seek_indulgences_removed_kinslayer_3 + days = 30 + } + } + else_if = { + limit = { + OR = { + has_character_flag = seek_indulgences_removed_kinslayer_2 # For the post-interaction letter event + AND = { + has_trait = kinslayer_2 + trait_is_shunned_or_criminal_in_faith_trigger = { FAITH = faith TRAIT = kinslayer_2 GENDER_CHARACTER = scope:actor } + } + } + } + pay_short_term_gold = { + target = scope:recipient + gold = seek_indulgences_medium_criminal_trait_value + } + remove_trait_force_tooltip = kinslayer_2 + add_character_flag = { + flag = seek_indulgences_removed_kinslayer_2 + days = 30 + } + } + else_if = { + limit = { + OR = { + has_character_flag = seek_indulgences_removed_witch # For the post-interaction letter event + AND = { + has_trait = witch + trait_is_shunned_or_criminal_in_faith_trigger = { FAITH = faith TRAIT = witch GENDER_CHARACTER = scope:actor } + } + } + } + pay_short_term_gold = { + target = scope:recipient + gold = seek_indulgences_medium_criminal_trait_value + } + remove_trait_force_tooltip = witch + add_character_flag = { + flag = seek_indulgences_removed_witch + days = 30 + } + } + else_if = { + limit = { + OR = { + has_character_flag = seek_indulgences_removed_deviant # For the post-interaction letter event + AND = { + has_trait = deviant + trait_is_shunned_or_criminal_in_faith_trigger = { FAITH = faith TRAIT = deviant GENDER_CHARACTER = scope:actor } + } + } + } + pay_short_term_gold = { + target = scope:recipient + gold = seek_indulgences_medium_criminal_trait_value + } + remove_trait_force_tooltip = deviant + add_character_flag = { + flag = seek_indulgences_removed_deviant + days = 30 + } + } + else_if = { + limit = { + OR = { + has_character_flag = seek_indulgences_removed_sodomite # For the post-interaction letter event + AND = { + has_trait = sodomite + trait_is_shunned_or_criminal_in_faith_trigger = { FAITH = faith TRAIT = sodomite GENDER_CHARACTER = scope:actor } + } + } + } + pay_short_term_gold = { + target = scope:recipient + gold = seek_indulgences_medium_criminal_trait_value + } + remove_trait_force_tooltip = sodomite + add_character_flag = { + flag = seek_indulgences_removed_sodomite + days = 30 + } + } + else_if = { + limit = { + OR = { + has_character_flag = seek_indulgences_removed_kinslayer_1 # For the post-interaction letter event + AND = { + has_trait = kinslayer_1 + trait_is_shunned_or_criminal_in_faith_trigger = { FAITH = faith TRAIT = kinslayer_1 GENDER_CHARACTER = scope:actor } + } + } + } + pay_short_term_gold = { + target = scope:recipient + gold = seek_indulgences_minor_criminal_trait_value + } + remove_trait_force_tooltip = kinslayer_1 + add_character_flag = { + flag = seek_indulgences_removed_kinslayer_1 + days = 30 + } + } + else_if = { + limit = { + OR = { + has_character_flag = seek_indulgences_removed_adulterer # For the post-interaction letter event + AND = { + has_trait = adulterer + trait_is_shunned_or_criminal_in_faith_trigger = { FAITH = faith TRAIT = adulterer GENDER_CHARACTER = scope:actor } + } + } + } + pay_short_term_gold = { + target = scope:recipient + gold = seek_indulgences_minor_criminal_trait_value + } + remove_trait_force_tooltip = adulterer + add_character_flag = { + flag = seek_indulgences_removed_adulterer + days = 30 + } + } + else_if = { + limit = { + OR = { + has_character_flag = seek_indulgences_removed_fornicator # For the post-interaction letter event + AND = { + has_trait = fornicator + trait_is_shunned_or_criminal_in_faith_trigger = { FAITH = faith TRAIT = fornicator GENDER_CHARACTER = scope:actor } + } + } + } + pay_short_term_gold = { + target = scope:recipient + gold = seek_indulgences_minor_criminal_trait_value + } + remove_trait_force_tooltip = fornicator + add_character_flag = { + flag = seek_indulgences_removed_fornicator + days = 30 + } + } + else_if = { + limit = { has_trait = gallowsbait } + pay_short_term_gold = { + target = scope:recipient + gold = seek_indulgences_minor_criminal_trait_value + } + if = { + limit = { + has_trait_xp = { + trait = gallowsbait + track = bandit + value >= wipe_slate_min_xp_to_remove_trait_value + } + } + add_trait_xp = { + trait = gallowsbait + track = bandit + value = -40 + } + } + else_if = { + limit = { + has_trait_xp = { + trait = gallowsbait + track = trickster + value >= wipe_slate_min_xp_to_remove_trait_value + } + } + add_trait_xp = { + trait = gallowsbait + track = trickster + value = -40 + } + } + else_if = { + limit = { + has_trait_xp = { + trait = gallowsbait + track = thief + value >= wipe_slate_min_xp_to_remove_trait_value + } + } + add_trait_xp = { + trait = gallowsbait + track = thief + value = -40 + } + } + else_if = { + limit = { + has_trait_xp = { + trait = gallowsbait + track = poacher + value >= wipe_slate_min_xp_to_remove_trait_value + } + } + add_trait_xp = { + trait = gallowsbait + track = poacher + value = -40 + } + } + else_if = { + limit = { + has_trait_xp = { + trait = gallowsbait + track = marauder + value >= wipe_slate_min_xp_to_remove_trait_value + } + } + add_trait_xp = { + trait = gallowsbait + track = marauder + value = -40 + } + } + else = { remove_trait = gallowsbait } + } + else = { + pay_short_term_gold = { + target = scope:recipient + gold = seek_indulgences_buy_piety_value + } + add_piety = medium_piety_gain + } + + reverse_add_opinion = { + target = scope:recipient + modifier = pleased_opinion + opinion = 25 + } + stress_impact = { + greedy = minor_stress_impact_gain + cynical = minor_stress_impact_gain + } + } +} + +hof_ask_for_gold_interaction_effect = { + scope:recipient = { + pay_short_term_gold = { + target = scope:actor + gold = scope:actor.head_of_faith_gold_value + } + add_opinion = { + target = scope:actor + modifier = requested_money_opinion + opinion = -20 + } + } + scope:actor = { + if = { + limit = { + scope:hook = no + } + add_piety = major_piety_loss + } + if = { + limit = { always = scope:hook } + use_hook = scope:recipient + } + if = { + limit = { + any_vassal = { + vassal_stance = zealot + } + } + custom_tooltip = zealot_vassal_disapproves_asking_hof_for_gold + hidden_effect = { + every_vassal = { + vassal_stance = zealot + add_opinion = { + target = scope:actor + modifier = zealot_disapproves_of_asking_hof_for_gold_opinion + } + } + } + } + } +} + +hof_ask_for_claim_interaction_effect = { + scope:secondary_recipient = { + add_opinion = { + target = scope:actor + modifier = claimed_my_title_opinion + opinion = -50 + } + } + scope:actor = { + add_piety = { + value = claim_piety_value + multiply = -1 + } + if = { + limit = { always = scope:claim_hook } + use_hook = scope:recipient + } + add_pressed_claim = scope:target + } +} + +vassal_claim_liege_title_interaction_effect = { + scope:actor = { + add_unpressed_claim = scope:target + } + scope:recipient = { + add_opinion = { + target = scope:actor + modifier = claimed_my_title_opinion + opinion = -50 + } + } +} + +convert_at_war_interaction_effect = { + scope:actor = { + every_character_war = { + limit = { + primary_defender = scope:actor + primary_attacker = scope:recipient + using_non_ghw_holy_war_cb_trigger = yes + } + set_variable = { + name = invalidate_defender_faith_change #This variable will invalidate the war and send proper invalidation message + value = yes + } + show_as_tooltip = { end_war = invalidated } + } + + set_character_faith_with_conversion = scope:recipient.faith + + add_piety = medium_piety_loss + if = { + limit = { NOT = { scope:recipient.faith = { has_doctrine_parameter = unreformed } } } + add_piety_level = -3 + } + stress_impact = { + zealous = medium_stress_impact_gain + } + } + scope:recipient = { + add_piety_experience = major_piety_value + } +} + +demand_conversion_vassal_ruler_interaction_effect = { + demand_conversion_interaction_effect = yes + hidden_effect = { + if = { + limit = { + exists = scope:recipient.capital_county + scope:recipient.capital_county.faith = scope:recipient.faith + } + save_scope_value_as = { + name = convert_capital + value = yes + } + } + } + if = { + limit = { + scope:hook = yes + scope:actor = { has_usable_hook = scope:recipient } + } + scope:actor = { + use_hook = scope:recipient + } + } + else_if = { + limit = { scope:recipient = { is_imprisoned_by = scope:actor } } + scope:recipient = { release_from_prison = yes } + } + #Negative opinions + scope:recipient = { + add_opinion = { + modifier = demanded_my_conversion_opinion + target = scope:actor + opinion = -10 + } + } +} + +demand_conversion_player_ruler_interaction_effect = { + demand_conversion_interaction_effect = yes + + if = { + limit = { + scope:demand_conversion_hook = yes + } + scope:actor = { + use_hook = scope:recipient + } + } +} + +title_revocation_stress_effect = { + if = { + limit = { + title_revocation_is_tyrannical_trigger = { VASSAL = $VASSAL$ } + } + stress_impact = { + generous = medium_stress_impact_gain + just = medium_stress_impact_gain + } + } + else_if = { + limit = { + NOT = { has_revoke_title_reason = $VASSAL$ } + } + stress_impact = { + generous = minor_stress_impact_gain + forgiving = minor_stress_impact_gain + } + } + else = { + # No stress gain if you have a reason + } +} + +revoke_holy_order_lease_effect = { + if = { + limit = { + $TARGET$.faith = { + any_faith_holy_order = { + num_leased_titles = 1 + title = $BARONY$.lessee_title + } + } + } + custom_tooltip = destroy_holy_order_warning + } + + $TARGET$ = { + hidden_effect = { #Nudge towards rivalry + if = { + limit = { + NOR = { + has_relation_rival = $CHARACTER$ + has_relation_potential_rival = $CHARACTER$ + } + } + set_relation_potential_rival = $CHARACTER$ + } + } + + if = { + limit = { + NOT = { this = $CHARACTER$ } + } + add_opinion = { + target = $CHARACTER$ + modifier = angry_opinion + opinion = -40 + } + } + + faith = { + if = { + limit = { + exists = religious_head + NOT = { religious_head = $CHARACTER$ } + } + religious_head = { + add_opinion = { + modifier = angry_opinion + target = $CHARACTER$ + opinion = -20 + } + if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER$ + modifier = founded_holy_order_opinion + } + } + remove_opinion = { + target = $CHARACTER$ + modifier = founded_holy_order_opinion + } + } + } + } + } + } + + $CHARACTER$ = { + send_interface_message = { + type = holy_order_lease_revoked_message + title = revoke_leased_title_interaction_notification + right_icon = $TARGET$ + + # Zealous costs stress if same-faith. + if = { + limit = { $CHARACTER$.faith = $TARGET$.faith } + stress_impact = { + zealous = massive_stress_impact_gain + generous = medium_stress_impact_gain + order_member = minor_stress_impact_gain + } + + add_piety = { + value = 0 + subtract = cancel_holy_order_piety_cost + } + } + else_if = { + # Bit less but still some if you view the other faith as astray. + limit = { + $CHARACTER$.faith = { + faith_hostility_level = { + target = $TARGET$.faith + value <= faith_astray_level + } + } + } + stress_impact = { + zealous = major_stress_impact_gain + generous = medium_stress_impact_gain + } + + add_piety = { + value = -100 + } + } + else = { + + if = { + limit = { exists = $CHARACTER$.faith.religious_head } + $CHARACTER$.faith.religious_head = { + add_opinion = { + modifier = pleased_opinion + target = $CHARACTER$ + opinion = 20 + } + } + } + + add_piety = { + value = 250 + } + + $TARGET$.faith = { + # Fervor impact: big as it's rare + change_fervor = { + value = 10 + desc = fervor_gain_holy_order_expelled_by_force + } + } + + # If the county has the same faith than the HO, locals are unhappy + $BARONY$ = { + if = { + limit = { title_province.county.faith = $TARGET$.faith } + title_province.county = { + add_county_modifier = { + modifier = lost_holy_order_modifier + years = 10 + } + } + } + } + } + + $BARONY$ = { + revoke_lease = yes + } + } + } +} + +revoke_holy_order_duel_victor_apply_effects_effect = { + scope:sc_victor = { + add_stress = major_stress_loss + add_prestige = major_prestige_gain + } +} + +add_clan_unity_interaction_effect = { + if = { + limit = { # Check if unity is relevant + $CHARACTER$ = { government_has_flag = government_is_clan } + $TARGET$ = { government_has_flag = government_is_clan } + exists = $CHARACTER$.house + exists = $TARGET$.house + $CHARACTER$.house = $TARGET$.house + trigger_if = { + limit = { + exists = scope:actor + exists = scope:recipient + scope:actor != scope:recipient + } + NOT = { $CHARACTER$ = $TARGET$ } # As a safety, let's make sure that we are not interacting with ourselves + } + } + + apply_clan_unity_interaction_effect = { + CHARACTER = $CHARACTER$ + TARGET = $TARGET$ + DESC = $DESC$ + VALUE = $VALUE$ + VALUE_REVERSED = no + } + } + else_if = { + limit = { # Only apply reversed effect for the house head to keep the gauge in check + $REVERSE_NON_HOUSE_TARGET$ = yes + + $CHARACTER$ = { government_has_flag = government_is_clan } + $CHARACTER$.house ?= { + house_head = $CHARACTER$ + } + OR = { + AND = { + exists = $TARGET$.house + NOT = { $CHARACTER$.house = $TARGET$.house } + } + $TARGET$ = { is_lowborn = yes } + } + } + apply_clan_unity_interaction_effect = { + CHARACTER = $CHARACTER$ + TARGET = $TARGET$ + DESC = $DESC$ + VALUE = $VALUE$ + VALUE_REVERSED = yes + } + } +} + +apply_clan_unity_interaction_effect = { + # Save scopes for localisation + $CHARACTER$ = { save_scope_as = unity_character } + $TARGET$ = { save_scope_as = unity_target } + + $CHARACTER$.house = { + save_scope_as = character_house + + add_unity_value = { + value = { + value = $VALUE$ + if = { # House heads have a larger impact on unity + limit = { house_head = $CHARACTER$ } + multiply = unity_house_head_multiplier_value + } + if = { + limit = { $VALUE_REVERSED$ = yes } + multiply = -1 + } + } + character = $CHARACTER$ + desc = $DESC$ + } + } + + # Notify human players if they are not involved! + if = { + limit = { + trigger_if = { + limit = { $VALUE$ >= 0 } + $VALUE$ >= major_unity_value + } + trigger_else = { + $VALUE$ <= major_unity_value + } + } + # Notify human players if they are not involved! + notify_players_about_unity_change_effect = { + CHARACTER = $CHARACTER$ + TARGET = $TARGET$ + DESC = $DESC$ + } + } +} + +diarch_declare_recipient_criminal_effect = { + scope:actor = { + # First we process the diarch. + ## Players get a different tooltip, since they don't want to see opinion. + if = { + limit = { is_ai = no } + custom_tooltip = diarch_imprison_reason_for_player.tt + hidden_effect = { + add_opinion = { + target = scope:recipient + modifier = treasonous_disobeyed_diarch + } + } + } + ## AI use the standard opinion flow. + else = { + add_opinion = { + target = scope:recipient + modifier = treasonous_disobeyed_diarch + } + } + # Then their liege. + liege = { + # Same flow: players get a different tooltip so that they don't see opinion. + if = { + limit = { is_ai = no } + custom_tooltip = ADD_OPINION_EFFECT_I_HAVE_IMPRISONMENT_REASON_UNUSABLE + hidden_effect = { + add_opinion = { + target = scope:recipient + modifier = treasonous_disobeyed_diarch + } + } + } + # But AI just get opinion. + else = { + add_opinion = { + target = scope:recipient + modifier = treasonous_disobeyed_diarch + } + } + } + } +} + +diarch_declare_claim_war_effect = { + start_war = { + casus_belli = claim_cb + target = scope:recipient + claimant = scope:actor + target_title = scope:landed_title + } +} + +diarch_declare_vassalisation_war_effect = { + start_war = { + casus_belli = diarch_vassalisation_cb + target = scope:recipient + target_title = scope:secondary_recipient.primary_title + } +} + +make_criminal_effect = { + random_list = { + 10 = { + trigger = { + trait_is_criminal_in_faith_trigger = { + TRAIT = adulterer + GENDER_CHARACTER = root + FAITH = root.faith + } + NOT = { has_trait = adulterer } + } + add_trait = adulterer + } + 10 = { + trigger = { + trait_is_criminal_in_faith_trigger = { + TRAIT = kinslayer_3 + GENDER_CHARACTER = root + FAITH = root.faith + } + NOT = { has_trait = kinslayer_3 } + } + add_trait = kinslayer_3 + } + 10 = { + trigger = { + trait_is_criminal_in_faith_trigger = { + TRAIT = witch + GENDER_CHARACTER = root + FAITH = root.faith + } + NOT = { has_trait = witch } + } + add_trait = witch + } + 10 = { + trigger = { + trait_is_criminal_in_faith_trigger = { + TRAIT = cannibal + GENDER_CHARACTER = root + FAITH = root.faith + } + NOT = { has_trait = cannibal } + } + add_trait = cannibal + } + 10 = { + trigger = { + trait_is_criminal_in_faith_trigger = { + TRAIT = deviant + GENDER_CHARACTER = root + FAITH = root.faith + } + NOT = { has_trait = deviant } + } + add_trait = deviant + } + 10 = { + trigger = { + trait_is_criminal_in_faith_trigger = { + TRAIT = fornicator + GENDER_CHARACTER = root + FAITH = root.faith + } + NOT = { has_trait = fornicator } + } + add_trait = fornicator + } + } +} + +clear_hostile_actions_lock_flag_effect = { + if = { + limit = { has_character_flag = flag_hostile_actions_disabled_delay } + remove_character_flag = flag_hostile_actions_disabled_delay + } +} + +ep3_hof_ask_for_influence_interaction_effect = { + scope:actor = { + if = { + limit = { + domicile ?= { + has_domicile_parameter = influence_gain_from_hof_support_6 + } + } + change_influence = ep3_requested_faith_support_6_value + custom_tooltip = requested_faith_support_domicile_tt + } + else_if = { + limit = { + domicile ?= { + has_domicile_parameter = influence_gain_from_hof_support_5 + } + } + change_influence = ep3_requested_faith_support_5_value + custom_tooltip = requested_faith_support_domicile_tt + } + else_if = { + limit = { + domicile ?= { + has_domicile_parameter = influence_gain_from_hof_support_4 + } + } + change_influence = ep3_requested_faith_support_4_value + custom_tooltip = requested_faith_support_domicile_tt + } + else_if = { + limit = { + domicile ?= { + has_domicile_parameter = influence_gain_from_hof_support_3 + } + } + change_influence = ep3_requested_faith_support_3_value + custom_tooltip = requested_faith_support_domicile_tt + } + else_if = { + limit = { + domicile ?= { + has_domicile_parameter = influence_gain_from_hof_support_2 + } + } + change_influence = ep3_requested_faith_support_2_value + custom_tooltip = requested_faith_support_domicile_tt + } + else_if = { + limit = { + domicile ?= { + has_domicile_parameter = influence_gain_from_hof_support_1 + } + } + change_influence = ep3_requested_faith_support_1_value + custom_tooltip = requested_faith_support_domicile_tt + } + else = { + change_influence = ep3_requested_faith_support_0_value + } + house = { + add_house_modifier = { + modifier = ep3_requested_faith_support_modifier + years = 10 + } + } + + reverse_add_opinion = { + target = scope:recipient + modifier = requested_influence_opinion + opinion = -30 + } + } + scope:actor = { + if = { + limit = { + scope:hook = no + } + add_piety = massive_piety_loss + } + if = { + limit = { always = scope:hook } + use_hook = scope:recipient + } + } +} + +torture_memory_effect = { + $VICTIM$ = { + create_character_memory = { + type = tortured_memory + participants = { torturer = $TORTURER$ } + } + ordered_memory = { + memory_type = tortured_memory + limit = { + any_memory_participant = { this = $TORTURER$ } + } + order_by = memory_creation_date + save_scope_as = tortured_memory + set_variable = { + name = type + value = flag:$TYPE$ + } + } + } + $TORTURER$ = { + create_character_memory = { + type = torturer_memory + participants = { victim = $VICTIM$ } + } + ordered_memory = { + memory_type = torturer_memory + limit = { + any_memory_participant = { this = $VICTIM$ } + } + order_by = memory_creation_date + save_scope_as = torturer_memory + set_variable = { + name = type + value = flag:$TYPE$ + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_intercourse_effects.txt b/N3OW/common/scripted_effects/00_intercourse_effects.txt new file mode 100644 index 00000000..4fbc38d4 --- /dev/null +++ b/N3OW/common/scripted_effects/00_intercourse_effects.txt @@ -0,0 +1,30 @@ + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! + + +#Effects to run in events when intercourse takes place (pregnancy and SDT chance) +#intercourse_with_scope_effect - with a known, existing character +#intercourse_with_dummy_effect - with a dummy character +#intercourse_with_unknown_effect - when the gender(s) of the other character(s) is unclear + +##################################################################### +# EFFECTS +##################################################################### + +#Needs argument intercourse_character +intercourse_with_character_effect = { + $INTERCOURSE_CHARACTER$ = { add_gold = 1 } +} + +intercourse_with_dummy_effect = { + +} + +intercourse_with_unknown_effect = { + +} + + diff --git a/N3OW/common/scripted_effects/00_intrigue_lifestyle_effects.txt b/N3OW/common/scripted_effects/00_intrigue_lifestyle_effects.txt new file mode 100644 index 00000000..31520353 --- /dev/null +++ b/N3OW/common/scripted_effects/00_intrigue_lifestyle_effects.txt @@ -0,0 +1,1004 @@ +#Effects used in Lifestyle Focus events + + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! + +#intrigue_dread_4001_torture_increase_effectiveness_with_trait_effect - Used in event to check torture methods against target's personality. +#intrigue_dread_4001_torture_increase_effectiveness_remove_trait_effect - Used in event to check torture methods against target's personality, then remove those personality traits. +#intrigue_scheming_4050_display_player_response_effect - Used in event to display a special tooltip if the secret buyer is a player. + + + +#Find one personality trigger that the character has, and two that they do not. +decide_what_options_to_present_effect = { + hidden_effect = { + random_list = { + 1 = { + modifier = { + add = 2 + scope:courtier_spy = { + has_trait_malicious_trigger = yes + } + } + ai_value_modifier = { + ai_vengefulness = medium_chance_impact_positive_vengefulness + } + set_variable = { + name = option_to_present + value = flag:malicious + days = 800 + } + } + 1 = { + modifier = { + add = 2 + scope:courtier_spy = { + has_trait_benevolent_trigger = yes + } + } + ai_value_modifier = { + ai_compassion = medium_chance_impact_positive_compassion + ai_rationality = low_chance_impact_positive_rationality + } + set_variable = { + name = option_to_present + value = flag:benevolent + days = 800 + } + } + 1 = { + modifier = { + add = 2 + scope:courtier_spy = { + has_trait_dominant_trigger = yes + } + } + ai_value_modifier = { + ai_boldness = medium_chance_impact_positive_boldness + } + set_variable = { + name = option_to_present + value = flag:dominant + days = 800 + } + } + 1 = { + modifier = { + add = 2 + scope:courtier_spy = { + has_trait_submissive_trigger = yes + } + } + ai_value_modifier = { + ai_boldness = medium_chance_impact_negative_boldness + ai_energy = low_chance_impact_negative_energy + } + set_variable = { + name = option_to_present + value = flag:submissive + days = 800 + } + } + 1 = { + modifier = { + add = 2 + scope:courtier_spy = { + has_trait_extroverted_trigger = yes + } + } + ai_value_modifier = { + ai_boldness = medium_chance_impact_positive_boldness + ai_compassion = low_chance_impact_positive_boldness + } + set_variable = { + name = option_to_present + value = flag:extroverted + days = 800 + } + } + 1 = { + modifier = { + add = 2 + scope:courtier_spy = { + has_trait_introverted_trigger = yes + } + } + ai_value_modifier = { + ai_boldness = medium_chance_impact_negative_boldness + } + set_variable = { + name = option_to_present + value = flag:introverted + days = 800 + } + } + 1 = { + modifier = { + add = 2 + scope:courtier_spy = { + has_trait_emotional_trigger = yes + } + } + ai_value_modifier = { + ai_energy = medium_chance_impact_positive_energy + } + set_variable = { + name = option_to_present + value = flag:emotional + days = 800 + } + } + 1 = { + modifier = { + add = 2 + scope:courtier_spy = { + has_trait_levelheaded_trigger = yes + } + } + ai_value_modifier = { + ai_rationality = medium_chance_impact_positive_rationality + } + set_variable = { + name = option_to_present + value = flag:levelheaded + days = 800 + } + } + } + #Fallback + if = { + limit = { + NOT = { + exists = var:option_to_present + } + } + random_list = { + 1 = { + set_variable = { + name = option_to_present + value = flag:malicious + days = 800 + } + } + 1 = { + set_variable = { + name = option_to_present + value = flag:benevolent + days = 800 + } + } + 1 = { + set_variable = { + name = option_to_present + value = flag:dominant + days = 800 + } + } + 1 = { + set_variable = { + name = option_to_present + value = flag:submissive + days = 800 + } + } + 1 = { + set_variable = { + name = option_to_present + value = flag:extroverted + days = 800 + } + } + 1 = { + set_variable = { + name = option_to_present + value = flag:introverted + days = 800 + } + } + 1 = { + set_variable = { + name = option_to_present + value = flag:emotional + days = 800 + } + } + 1 = { + set_variable = { + name = option_to_present + value = flag:levelheaded + days = 800 + } + } + } + } + #Bad option 1 + random_list = { + 1 = { + trigger = { + NOT = { var:option_to_present = flag:malicious } + } + modifier = { + add = 2 + scope:courtier_spy = { + has_trait_malicious_trigger = yes + } + } + ai_value_modifier = { + ai_vengefulness = medium_chance_impact_positive_vengefulness + } + set_variable = { + name = option_1_fail_to_present + value = flag:malicious + days = 800 + } + } + 1 = { + trigger = { + NOT = { var:option_to_present = flag:benevolent } + } + modifier = { + add = 2 + scope:courtier_spy = { + has_trait_benevolent_trigger = yes + } + } + ai_value_modifier = { + ai_compassion = medium_chance_impact_positive_compassion + ai_rationality = low_chance_impact_positive_rationality + } + set_variable = { + name = option_1_fail_to_present + value = flag:benevolent + days = 800 + } + } + 1 = { + trigger = { + NOT = { var:option_to_present = flag:dominant } + } + modifier = { + add = 2 + scope:courtier_spy = { + has_trait_dominant_trigger = yes + } + } + ai_value_modifier = { + ai_boldness = medium_chance_impact_positive_boldness + } + set_variable = { + name = option_1_fail_to_present + value = flag:dominant + days = 800 + } + } + 1 = { + trigger = { + NOT = { var:option_to_present = flag:submissive } + } + modifier = { + add = 2 + scope:courtier_spy = { + has_trait_submissive_trigger = yes + } + } + ai_value_modifier = { + ai_boldness = medium_chance_impact_negative_boldness + ai_energy = low_chance_impact_negative_energy + } + set_variable = { + name = option_1_fail_to_present + value = flag:submissive + days = 800 + } + } + 1 = { + trigger = { + NOT = { var:option_to_present = flag:extroverted } + } + modifier = { + add = 2 + scope:courtier_spy = { + has_trait_extroverted_trigger = yes + } + } + ai_value_modifier = { + ai_boldness = medium_chance_impact_positive_boldness + ai_compassion = low_chance_impact_positive_boldness + } + set_variable = { + name = option_1_fail_to_present + value = flag:extroverted + days = 800 + } + } + 1 = { + trigger = { + NOT = { var:option_to_present = flag:introverted } + } + modifier = { + add = 2 + scope:courtier_spy = { + has_trait_introverted_trigger = yes + } + } + ai_value_modifier = { + ai_boldness = medium_chance_impact_negative_boldness + } + set_variable = { + name = option_1_fail_to_present + value = flag:introverted + days = 800 + } + } + 1 = { + trigger = { + NOT = { var:option_to_present = flag:emotional } + } + modifier = { + add = 2 + scope:courtier_spy = { + has_trait_emotional_trigger = yes + } + } + ai_value_modifier = { + ai_energy = medium_chance_impact_positive_energy + } + set_variable = { + name = option_1_fail_to_present + value = flag:emotional + days = 800 + } + } + 1 = { + trigger = { + NOT = { var:option_to_present = flag:levelheaded } + } + modifier = { + add = 2 + scope:courtier_spy = { + has_trait_levelheaded_trigger = yes + } + } + ai_value_modifier = { + ai_rationality = medium_chance_impact_positive_rationality + } + set_variable = { + name = option_1_fail_to_present + value = flag:levelheaded + days = 800 + } + } + } + #Fallback + if = { + limit = { + NOT = { + exists = var:option_1_fail_to_present + } + } + random_list = { + 1 = { + trigger = { + NOT = { var:option_to_present = flag:malicious } + } + set_variable = { + name = option_1_fail_to_present + value = flag:malicious + days = 800 + } + } + 1 = { + trigger = { + NOT = { var:option_to_present = flag:benevolent } + } + set_variable = { + name = option_1_fail_to_present + value = flag:benevolent + days = 800 + } + } + 1 = { + trigger = { + NOT = { var:option_to_present = flag:dominant } + } + set_variable = { + name = option_1_fail_to_present + value = flag:dominant + days = 800 + } + } + 1 = { + trigger = { + NOT = { var:option_to_present = flag:submissive } + } + set_variable = { + name = option_1_fail_to_present + value = flag:submissive + days = 800 + } + } + 1 = { + trigger = { + NOT = { var:option_to_present = flag:extroverted } + } + set_variable = { + name = option_1_fail_to_present + value = flag:extroverted + days = 800 + } + } + 1 = { + trigger = { + NOT = { var:option_to_present = flag:introverted } + } + set_variable = { + name = option_1_fail_to_present + value = flag:introverted + days = 800 + } + } + 1 = { + trigger = { + NOT = { var:option_to_present = flag:emotional } + } + set_variable = { + name = option_1_fail_to_present + value = flag:emotional + days = 800 + } + } + 1 = { + trigger = { + NOT = { var:option_to_present = flag:levelheaded } + } + set_variable = { + name = option_1_fail_to_present + value = flag:levelheaded + days = 800 + } + } + } + } + #Bad option 2 + random_list = { + 1 = { + trigger = { + NOR = { + var:option_to_present = flag:malicious + var:option_1_fail_to_present = flag:malicious + } + } + modifier = { + add = 2 + scope:courtier_spy = { + has_trait_malicious_trigger = yes + } + } + ai_value_modifier = { + ai_vengefulness = medium_chance_impact_positive_vengefulness + } + set_variable = { + name = option_2_fail_to_present + value = flag:malicious + days = 800 + } + } + 1 = { + trigger = { + NOR = { + var:option_to_present = flag:benevolent + var:option_1_fail_to_present = flag:benevolent + } + } + modifier = { + add = 2 + scope:courtier_spy = { + has_trait_benevolent_trigger = yes + } + } + ai_value_modifier = { + ai_compassion = medium_chance_impact_positive_compassion + ai_rationality = low_chance_impact_positive_rationality + } + set_variable = { + name = option_2_fail_to_present + value = flag:benevolent + days = 800 + } + } + 1 = { + trigger = { + NOR = { + var:option_to_present = flag:dominant + var:option_1_fail_to_present = flag:dominant + } + } + modifier = { + add = 2 + scope:courtier_spy = { + has_trait_dominant_trigger = yes + } + } + ai_value_modifier = { + ai_boldness = medium_chance_impact_positive_boldness + } + set_variable = { + name = option_2_fail_to_present + value = flag:dominant + days = 800 + } + } + 1 = { + trigger = { + NOR = { + var:option_to_present = flag:submissive + var:option_1_fail_to_present = flag:submissive + } + } + modifier = { + add = 2 + scope:courtier_spy = { + has_trait_submissive_trigger = yes + } + } + ai_value_modifier = { + ai_boldness = medium_chance_impact_negative_boldness + ai_energy = low_chance_impact_negative_energy + } + set_variable = { + name = option_2_fail_to_present + value = flag:submissive + days = 800 + } + } + 1 = { + trigger = { + NOR = { + var:option_to_present = flag:extroverted + var:option_1_fail_to_present = flag:extroverted + } + } + modifier = { + add = 2 + scope:courtier_spy = { + has_trait_extroverted_trigger = yes + } + } + ai_value_modifier = { + ai_boldness = medium_chance_impact_positive_boldness + ai_compassion = low_chance_impact_positive_boldness + } + set_variable = { + name = option_2_fail_to_present + value = flag:extroverted + days = 800 + } + } + 1 = { + trigger = { + NOR = { + var:option_to_present = flag:introverted + var:option_1_fail_to_present = flag:introverted + } + } + modifier = { + add = 2 + scope:courtier_spy = { + has_trait_introverted_trigger = yes + } + } + ai_value_modifier = { + ai_boldness = medium_chance_impact_negative_boldness + } + set_variable = { + name = option_2_fail_to_present + value = flag:introverted + days = 800 + } + } + 1 = { + trigger = { + NOR = { + var:option_to_present = flag:emotional + var:option_1_fail_to_present = flag:emotional + } + } + modifier = { + add = 2 + scope:courtier_spy = { + has_trait_emotional_trigger = yes + } + } + ai_value_modifier = { + ai_energy = medium_chance_impact_positive_energy + } + set_variable = { + name = option_2_fail_to_present + value = flag:emotional + days = 800 + } + } + 1 = { + trigger = { + NOR = { + var:option_to_present = flag:levelheaded + var:option_1_fail_to_present = flag:levelheaded + } + } + modifier = { + add = 2 + scope:courtier_spy = { + has_trait_levelheaded_trigger = yes + } + } + ai_value_modifier = { + ai_rationality = medium_chance_impact_positive_rationality + } + set_variable = { + name = option_2_fail_to_present + value = flag:levelheaded + days = 800 + } + } + } + #Fallback + if = { + limit = { + NOT = { + exists = var:option_2_fail_to_present + } + } + random_list = { + 1 = { + trigger = { + NOR = { + var:option_to_present = flag:malicious + var:option_1_fail_to_present = flag:malicious + } + } + set_variable = { + name = option_2_fail_to_present + value = flag:malicious + days = 800 + } + } + 1 = { + trigger = { + NOR = { + var:option_to_present = flag:benevolent + var:option_1_fail_to_present = flag:benevolent + } + } + set_variable = { + name = option_2_fail_to_present + value = flag:benevolent + days = 800 + } + } + 1 = { + trigger = { + NOR = { + var:option_to_present = flag:dominant + var:option_1_fail_to_present = flag:dominant + } + } + set_variable = { + name = option_2_fail_to_present + value = flag:dominant + days = 800 + } + } + 1 = { + trigger = { + NOR = { + var:option_to_present = flag:submissive + var:option_1_fail_to_present = flag:submissive + } + } + set_variable = { + name = option_2_fail_to_present + value = flag:submissive + days = 800 + } + } + 1 = { + trigger = { + NOR = { + var:option_to_present = flag:extroverted + var:option_1_fail_to_present = flag:extroverted + } + } + set_variable = { + name = option_2_fail_to_present + value = flag:extroverted + days = 800 + } + } + 1 = { + trigger = { + NOR = { + var:option_to_present = flag:introverted + var:option_1_fail_to_present = flag:introverted + } + } + set_variable = { + name = option_2_fail_to_present + value = flag:introverted + days = 800 + } + } + 1 = { + trigger = { + NOR = { + var:option_to_present = flag:emotional + var:option_1_fail_to_present = flag:emotional + } + } + set_variable = { + name = option_2_fail_to_present + value = flag:emotional + days = 800 + } + } + 1 = { + trigger = { + NOR = { + var:option_to_present = flag:levelheaded + var:option_1_fail_to_present = flag:levelheaded + } + } + set_variable = { + name = option_2_fail_to_present + value = flag:levelheaded + days = 800 + } + } + } + } + } +} + + +intrigue_dread_4001_select_prisoner_effect = { + $PRISONER$ = { + custom_tooltip = intrigue_dread.4001.a-c.tt + add_character_flag = intrigue_dread_4001_victim_flag + + if = { + limit = { + is_close_or_extended_family_of = root + } + custom_tooltip = intrigue_dread.4001.kinslayer + } + if = { + limit = { + NOT = { is_in_prison_type = dungeon } + } + change_prison_type = dungeon + } + save_scope_as = victim + } + + trigger_event = { + id = intrigue_dread.4002 + days = { 3 5 } + } +} + +intrigue_dread_4001_torture_increase_effectiveness_with_trait_effect = { + if = { + limit = { + scope:victim = { + has_trait = $TRAIT$ + } + } + change_variable = { + name = break_value + subtract = 1 + } + } +} + +intrigue_dread_4001_torture_increase_effectiveness_remove_trait_effect = { + if = { + limit = { + scope:victim = { + has_trait = $TRAIT$ + } + } + change_variable = { + name = break_value + subtract = 1 + } + scope:victim = { + remove_trait = $TRAIT$ + } + } +} + +intrigue_scheming_4050_display_player_response_effect = { + save_scope_value_as = { + name = payment + value = $PAYMENT$ + } + if = { + limit = { + scope:payment = flag:gold + } + random_list = { + 1 = { + desc = intrigue_scheming.4050.success + show_chance = no + show_as_tooltip = { + scope:buyer = { + pay_short_term_gold = { + target = scope:seller + gold = scope:saved_gold_amount + } + } + scope:secret = { + reveal_to = scope:buyer + } + custom_tooltip = intrigue_scheming_focus_point_clear_gain + hidden_effect = { add_focus_progress = standard_lifestyle_focus_progress } + } + } + 1 = { + desc = intrigue_scheming.4050.failure + show_chance = no + } + } + } + else_if = { + limit = { + scope:payment = flag:secret + } + random_list = { + 1 = { + desc = intrigue_scheming.4050.success + show_chance = no + show_as_tooltip = { + custom_tooltip = intrigue_scheming.4050.b.tt + scope:secret = { + reveal_to = scope:buyer + } + custom_tooltip = intrigue_scheming_focus_point_clear_gain + hidden_effect = { add_focus_progress = standard_lifestyle_focus_progress } + } + } + 1 = { + desc = intrigue_scheming.4050.failure + show_chance = no + } + } + } + else_if = { + limit = { + scope:payment = flag:favor + } + random_list = { + 1 = { + desc = intrigue_scheming.4050.success + show_chance = no + show_as_tooltip = { + scope:seller = { + add_hook = { + target = scope:buyer + type = favor_hook + } + } + scope:secret = { + reveal_to = scope:buyer + } + custom_tooltip = intrigue_scheming_focus_point_clear_gain + hidden_effect = { add_focus_progress = standard_lifestyle_focus_progress } + } + } + 1 = { + desc = intrigue_scheming.4050.failure + show_chance = no + } + } + } + else_if = { + limit = { + scope:payment = flag:reconciliation + } + random_list = { + 1 = { + desc = intrigue_scheming.4050.success + show_chance = no + show_as_tooltip = { + scope:buyer = { + remove_relation_rival = scope:seller + } + scope:secret = { + reveal_to = scope:buyer + } + custom_tooltip = intrigue_scheming_focus_point_clear_gain + hidden_effect = { add_focus_progress = standard_lifestyle_focus_progress } + } + } + 1 = { + desc = intrigue_scheming.4050.failure + show_chance = no + } + } + } + else_if = { + limit = { + scope:payment = flag:opinion + } + random_list = { + 1 = { + desc = intrigue_scheming.4050.success + show_chance = no + show_as_tooltip = { + scope:buyer = { + add_opinion = { + modifier = grateful_opinion + target = scope:seller + opinion = 30 + } + } + scope:secret = { + reveal_to = scope:buyer + } + custom_tooltip = intrigue_scheming_focus_point_clear_gain + hidden_effect = { add_focus_progress = standard_lifestyle_focus_progress } + } + } + 1 = { + desc = intrigue_scheming.4050.failure + show_chance = no + } + } + } + + scope:buyer = { + trigger_event = intrigue_scheming.4051 + } +} + +intrigue_scheming_4050_offer_refused_effect = { + show_as_tooltip = { + scope:buyer = { + add_opinion = { + modifier = insult_opinion + target = scope:seller + opinion = -10 + } + } + } + trigger_event = { + id = intrigue_scheming.4053 + days = { 5 7 } + } +} + +intrigue_temptation_3010_a_success_effect = { + if = { + limit = { + NOT = { has_relation_friend = scope:wingman } + } + set_relation_friend = { reason = friend_seduction_tips target = scope:wingman involved_character = scope:bar_servant } + } + add_intrigue_lifestyle_xp = minor_lifestyle_xp +} + +intrigue_temptation_3010_b_success_effect = { + add_intrigue_lifestyle_xp = major_lifestyle_xp +} + + + + + + + + + + diff --git a/N3OW/common/scripted_effects/00_intrigue_perk_effects.txt b/N3OW/common/scripted_effects/00_intrigue_perk_effects.txt new file mode 100644 index 00000000..c4f09600 --- /dev/null +++ b/N3OW/common/scripted_effects/00_intrigue_perk_effects.txt @@ -0,0 +1,114 @@ + +### Effects for handling Intrigue Lifestyle Perks + +# dark_insights_skill_gain_roll_effect: Randomly rolls for whether the character should get a bonus Intrigue or Prowess point + +dark_insights_skill_gain_roll_effect = { + #Backup check in case something has gone wrong + if = { + limit = { + has_perk = dark_insights_perk + } + + # Backup for the variables + if = { + limit = { + NOT = { has_variable = dark_insights_prowess_increases } + } + set_variable = { + name = dark_insights_prowess_increases + value = 0 + } + } + if = { + limit = { + NOT = { has_variable = dark_insights_intrigue_increases } + } + set_variable = { + name = dark_insights_intrigue_increases + value = 0 + } + } + + # Roll to see if we get a skill increase. + if = { + # For tooltip generation, we need to check if we have the variable yet (the backups above won't create the variables until after the effect is actually run). + limit = { + NOR = { + has_variable = dark_insights_prowess_increases + has_variable = dark_insights_intrigue_increases + } + } + custom_tooltip = dark_insight_gain_stats_tt + } + else_if = { + limit = { + + OR = { + var:dark_insights_prowess_increases < dark_insights_prowess_increase_maximum + var:dark_insights_intrigue_increases < dark_insights_intrigue_increase_maximum + } + } + + custom_tooltip = dark_insight_gain_stats_tt + + hidden_effect = { + random = { + chance = dark_insights_stat_increase_chance + scope:actor = { + + } + random_list = { + 50 = { + trigger = { + var:dark_insights_prowess_increases < dark_insights_prowess_increase_maximum + } + + send_interface_toast = { + title = dark_insights_gain_message + left_icon = scope:actor + right_icon = scope:recipient + + add_character_modifier = { + modifier = dark_insights_prowess_modifier + } + } + + change_variable = { + name = dark_insights_prowess_increases + add = 1 + } + } + 50 = { + trigger = { + var:dark_insights_intrigue_increases < dark_insights_intrigue_increase_maximum + } + + send_interface_toast = { + title = dark_insights_gain_message + left_icon = scope:actor + right_icon = scope:recipient + + add_character_modifier = { + modifier = dark_insights_intrigue_modifier + } + } + + change_variable = { + name = dark_insights_intrigue_increases + add = 1 + } + } + } + } + } + } + else_if = { + limit = { + var:dark_insights_prowess_increases >= dark_insights_prowess_increase_maximum + var:dark_insights_intrigue_increases >= dark_insights_intrigue_increase_maximum + } + custom_tooltip = dark_insights_maximum_insight_tt + } + } +} diff --git a/N3OW/common/scripted_effects/00_journey_effects.txt b/N3OW/common/scripted_effects/00_journey_effects.txt new file mode 100644 index 00000000..05d51693 --- /dev/null +++ b/N3OW/common/scripted_effects/00_journey_effects.txt @@ -0,0 +1,225 @@ + +journey_knowledge_hoarding_skill_effect = { + scope:activity = { + if = { + limit = { has_variable = skill_chance } + change_variable = { + name = skill_chance + add = $VALUE$ + } + } + else = { + set_variable = { + name = skill_chance + value = $VALUE$ + } + } + if = { + limit = { + $VALUE$ == 25 + } + custom_tooltip = increase_skill_chance_25 + } + if = { + limit = { + $VALUE$ == 20 + } + custom_tooltip = increase_skill_chance_20 + } + else_if = { + limit = { + $VALUE$ == 15 + } + custom_tooltip = increase_skill_chance_15 + } + else_if = { + limit = { + $VALUE$ == 10 + } + custom_tooltip = increase_skill_chance_10 + } + else_if = { + limit = { + $VALUE$ == 5 + } + custom_tooltip = increase_skill_chance_5 + } + else_if = { + limit = { + $VALUE$ == 30 + } + custom_tooltip = increase_skill_chance_30 + } + else_if = { + limit = { + $VALUE$ == 35 + } + custom_tooltip = increase_skill_chance_35 + } + else_if = { + limit = { + $VALUE$ == 50 + } + custom_tooltip = increase_skill_chance_50 + } + else_if = { + limit = { + $VALUE$ == 2 + } + custom_tooltip = increase_skill_chance_2 + } + if = { + limit = { + has_variable = skill_chance + var:skill_chance > 100 + } + set_variable = { + name = skill_chance + value = 100 + } + } + } +} + +journey_find_or_create_excellent_court_position_effect = { + #if = { + # limit = { + # any_pool_character = { + # province = $LOCATION$ + # culture = $LOCATION$.culture + # aptitude = { + # court_position = $COURT_POSITION$ + # value >= 4 + # } + # is_available_healthy_ai_adult = yes + # $COURT_POSITION$_validity_trigger = { EMPLOYER = root } + # } + # } + # random_pool_character = { + # province = $LOCATION$ + # limit = { + # culture = $LOCATION$.culture + # aptitude = { + # court_position = $COURT_POSITION$ + # value >= 4 + # } + # is_available_healthy_ai_adult = yes + # $COURT_POSITION$_validity_trigger = { EMPLOYER = root } + # } + # save_scope_as = local_character + # } + #} + #else = { + create_character = { + template = $COURT_POSITION$_template + location = $LOCATION$ + culture = $LOCATION$.culture + faith = $LOCATION$.faith + save_scope_as = local_character + } + scope:local_character = { + add_character_flag = { + flag = silently_disappear_me + years = 1 + } + } + #} + if = { + limit = { + any_court_position_holder = { + type = $COURT_POSITION$ + } + } + random_court_position_holder = { + type = $COURT_POSITION$ + save_scope_as = current_holder + } + } + add_character_flag = $COURT_POSITION$ +} + +journey_employ_in_court_position = { + show_as_tooltip = { + if = { + limit = { + is_valid_to_hire_court_position_type = $COURT_POSITION$_court_position + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = $COURT_POSITION$_court_position + } + } + } + custom_tooltip = will_have_excellent_aptitude + + hidden_effect = { + $CHARACTER$ = { + add_to_court_and_entourage_effect = yes + } + } + + if = { + limit = { + is_valid_to_hire_court_position_type = $COURT_POSITION$_court_position + NOT = { exists = scope:current_holder } + } + employ_character_as_position_in_current_scope_court_effect = { + CHARACTER = $CHARACTER$ + POSITION = $COURT_POSITION$ + } + } + else_if = { + limit = { + exists = scope:current_holder + scope:local_character.aptitude:$COURT_POSITION$_court_position > scope:current_holder.aptitude:$COURT_POSITION$_court_position + } + replace_court_position = { + recipient = $CHARACTER$ + holder = scope:current_holder + court_position = $COURT_POSITION$_court_position + } + } +} + +journey_employ_in_camp_position = { + show_as_tooltip = { + if = { + limit = { + is_valid_to_hire_court_position_type = $COURT_POSITION$_camp_officer + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = $COURT_POSITION$_camp_officer + } + } + } + custom_tooltip = will_have_excellent_aptitude + + hidden_effect = { + $CHARACTER$ = { + add_to_court_and_entourage_effect = yes + } + } + + if = { + limit = { + is_valid_to_hire_court_position_type = $COURT_POSITION$_camp_officer + NOT = { exists = scope:current_holder } + } + employ_character_as_position_in_current_scope_camp_effect = { + CHARACTER = $CHARACTER$ + POSITION = $COURT_POSITION$ + } + } + else_if = { + limit = { + exists = scope:current_holder + scope:local_character.aptitude:$COURT_POSITION$_camp_officer > scope:current_holder.aptitude:$COURT_POSITION$_camp_officer + } + replace_court_position = { + recipient = $CHARACTER$ + holder = scope:current_holder + court_position = $COURT_POSITION$_camp_officer + } + } +} diff --git a/N3OW/common/scripted_effects/00_laamp_effects.txt b/N3OW/common/scripted_effects/00_laamp_effects.txt new file mode 100644 index 00000000..9e9749c3 --- /dev/null +++ b/N3OW/common/scripted_effects/00_laamp_effects.txt @@ -0,0 +1,1638 @@ +################################################## +# Landless Adventurer Camp Scripted Effects +################################################## + +################################################## +# Misc Effects + +apply_saharan_provisions_debuff_effect = { + if = { + limit = { + geographical_region = custom_sahara_proper + OR = { + terrain = desert + terrain = desert_mountains + } + } + add_province_modifier = world_africa_sahara_provisions_usage_multiplier_modifier + } +} + +become_bandit_king_decision_effect = { + add_character_modifier = bandit_king_modifier + bandit_king_maa_spawn_effect = yes + add_prestige_level = -3 + remove_trait = knight_errant +} + +################################################## +# Flavourisation Effects + +remove_camp_purpose_flavourisation_variables_effect = { + remove_variable = flavourise_camp_purpose_mercenaries + remove_variable = flavourise_camp_purpose_wanderers + remove_variable = flavourise_camp_purpose_scholars + remove_variable = flavourise_camp_purpose_explorers + remove_variable = flavourise_camp_purpose_brigands + remove_variable = flavourise_camp_purpose_legitimists +} + +################################################## +# Contract Effects + +populate_location_with_contracts_effect = { + if = { + limit = { + # The AI have their own system for getting contracts. + trigger_if = { + limit = { has_government = landless_adventurer_government } + is_ai = no + } + lock_contracts_from_spawning_in_sahara_trigger = yes + } + # Flag our pre-existing contracts if necessary. + if = { + limit = { exists = scope:toggle_distance_ignore } + every_character_task_contract = { add_to_list = pre_existing_contracts_list } + } + # Now populate. + populate_task_contracts_for_area = { + location = $AREA_CHAR$.capital_province + amount = $AMOUNT$ + group = { + laamp_contracts_transport_group + laamp_contracts_criminal_group + laamp_contracts_diplomacy_group + laamp_contracts_hireling_group + laamp_contracts_hunting_group + laamp_contracts_intrigue_group + laamp_contracts_learning_group + laamp_contracts_martial_group + laamp_contracts_stewardship_group + laamp_contracts_justicar_group + } + } + # Then flag our new contracts (again, if necessary). + if = { + limit = { exists = scope:toggle_distance_ignore } + every_character_task_contract = { + limit = { + NOT = { is_in_list = pre_existing_contracts_list } + } + set_variable = { + name = retain_despite_distance + value = yes + } + } + } + } +} + +populate_location_with_special_contracts_effect = { + if = { + limit = { + # The AI have their own system for getting contracts. + trigger_if = { + limit = { has_government = landless_adventurer_government } + is_ai = no + } + lock_contracts_from_spawning_in_sahara_trigger = yes + } + # Flag our pre-existing contracts if necessary. + if = { + limit = { exists = scope:toggle_distance_ignore } + every_character_task_contract = { add_to_list = pre_existing_contracts_list } + } + populate_task_contracts_for_area = { + location = $AREA_CHAR$.capital_province + amount = $AMOUNT$ + group = { + laamp_contracts_transport_group + laamp_contracts_war_group + laamp_contracts_hireling_group + laamp_contracts_intrigue_group + laamp_contracts_legitimist_group + } + } + # Then flag our new contracts (again, if necessary). + if = { + limit = { exists = scope:toggle_distance_ignore } + every_character_task_contract = { + limit = { + NOT = { is_in_list = pre_existing_contracts_list } + } + set_variable = { + name = retain_despite_distance + value = yes + } + } + } + } +} + +fire_generic_contract_scheme_on_going_events_effect = { + save_scope_as = scheme + if = { + limit = { + is_scheme_target_type = character + } + scheme_target_character = { save_scope_as = target } + } + else = { + scheme_target_title.holder = { save_scope_as = target } + } + + scheme_owner = { + save_scope_as = owner + trigger_event = { on_action = laamp_base_contract_scheme_on_going_events } + } +} + +spawn_join_war_contracts_effect = { + $WAR$ = { save_scope_as = war } + $ATTACKER$ = { save_scope_as = attacker } + $DEFENDER$ = { save_scope_as = defender } + $LAAMP$ = { + #spawn a defensive join war contract, if defender is weaker than attacker or in a civil war + if = { + limit = { + OR = { + task_contract_join_war_attacker_strength_ratio_value > 1 + scope:war = { + using_civil_war_cb_trigger = yes + } + } + can_create_task_contract = { + type_name = laamp_join_war_contract + employer = scope:defender + } + } + send_interface_message = { + type = msg_task_contract_created + title = join_war_contract_spawn.t + desc = join_war_contract_spawn.desc_defender + left_icon = scope:attacker + right_icon = scope:defender + create_task_contract = { + task_contract_employer = scope:defender + task_contract_type = laamp_join_war_contract + task_contract_tier = scope:defender.task_contract_tier_value + location = scope:defender.location + save_scope_as = new_contract_defender + } + } + scope:new_contract_defender = { + set_variable = { + name = retain_despite_distance + value = yes + } + set_variable = { + name = task_contract_war + value = scope:war + } + set_variable = { + name = task_contract_employer + value = scope:defender + } + set_variable = { + name = task_contract_target + value = scope:war.primary_attacker + } + } + } + #spawn an offensive join war contract for the same war, if attacker has +/- 60% the strength of defender + if = { + limit = { + task_contract_join_war_attacker_strength_ratio_value >= 0.4 + task_contract_join_war_attacker_strength_ratio_value <= 1.6 + can_create_task_contract = { + type_name = laamp_join_war_contract + employer = scope:attacker + } + } + send_interface_message = { + type = msg_task_contract_created + title = join_war_contract_spawn.t + desc = join_war_contract_spawn.desc_attacker + left_icon = scope:attacker + right_icon = scope:defender + create_task_contract = { + task_contract_employer = scope:attacker + task_contract_type = laamp_join_war_contract + task_contract_tier = scope:attacker.task_contract_tier_value + location = scope:attacker.location + save_scope_as = new_contract_attacker + } + } + scope:new_contract_attacker = { + set_variable = { + name = retain_despite_distance + value = yes + } + set_variable = { + name = task_contract_war + value = scope:war + } + set_variable = { + name = task_contract_employer + value = scope:attacker + } + set_variable = { + name = task_contract_target + value = scope:war.primary_defender + } + } + } + #else spawn contracts for both sides if their strength difference is +/- 100% + if = { + limit = { + NOR = { + exists = scope:new_contract_defender + exists = scope:new_contract_attacker + } + task_contract_join_war_attacker_strength_ratio_value >= 0 + task_contract_join_war_attacker_strength_ratio_value <= 2 + } + if = { + limit = { + can_create_task_contract = { + type_name = laamp_join_war_contract + employer = scope:attacker + } + } + send_interface_message = { + type = msg_task_contract_created + title = join_war_contract_spawn.t + desc = join_war_contract_spawn.desc_attacker + left_icon = scope:attacker + right_icon = scope:defender + create_task_contract = { + task_contract_employer = scope:attacker + task_contract_type = laamp_join_war_contract + task_contract_tier = scope:attacker.task_contract_tier_value + location = scope:attacker.location + save_scope_as = new_contract_attacker + } + } + scope:new_contract_attacker = { + set_variable = { + name = retain_despite_distance + value = yes + } + set_variable = { + name = task_contract_war + value = scope:war + } + set_variable = { + name = task_contract_employer + value = scope:attacker + } + set_variable = { + name = task_contract_target + value = scope:war.primary_defender + } + } + } + if = { + limit = { + can_create_task_contract = { + type_name = laamp_join_war_contract + employer = scope:defender + } + } + send_interface_message = { + type = msg_task_contract_created + title = join_war_contract_spawn.t + desc = join_war_contract_spawn.desc_defender + left_icon = scope:attacker + right_icon = scope:defender + create_task_contract = { + task_contract_employer = scope:defender + task_contract_type = laamp_join_war_contract + task_contract_tier = scope:defender.task_contract_tier_value + location = scope:defender.location + save_scope_as = new_contract_defender + } + } + scope:new_contract_defender = { + set_variable = { + name = retain_despite_distance + value = yes + } + set_variable = { + name = task_contract_war + value = scope:war + } + set_variable = { + name = task_contract_employer + value = scope:defender + } + set_variable = { + name = task_contract_target + value = scope:war.primary_attacker + } + } + } + } + } + debug_log = "spawn_join_war_contracts_effect" + debug_log_scopes = yes +} + +# used in task contracts triggered from council tasks, assumes you already saved root as task_contract +# COUNCILLOR_TYPE = councillor type name +# COUNCIL_TASK_TYPE = council task type name +assign_council_task_scopes_in_contract_effect = { + if = { + limit = { + scope:task_contract.task_contract_employer.cp:$COUNCILLOR_TYPE$ ?= { + is_performing_council_task = $COUNCIL_TASK_TYPE$ + } + } + set_task_contract_target = scope:task_contract.task_contract_employer.cp:$COUNCILLOR_TYPE$ + task_contract_target = { + save_scope_as = task_contract_councillor + liege = { + save_scope_as = task_contract_councillor_liege + } + } + } + else = { + set_task_contract_target = scope:task_contract.task_contract_employer.liege + scope:task_contract.task_contract_employer = { + save_scope_as = task_contract_councillor + liege = { + save_scope_as = task_contract_councillor_liege + } + } + } + set_variable = { + name = task_contract_target + value = scope:task_contract.task_contract_target + } + set_variable = { + name = task_contract_councillor + value = scope:task_contract_councillor + } + set_variable = { + name = task_contract_councillor_liege + value = scope:task_contract_councillor_liege + } +} + +# We have to sort our randomisation here because otherwise we get oodles of false positives from trying to do it inside the subsequent value. +grab_gold_fuzz_number_effect = { + save_scope_value_as = { + name = gold_fuzz + value = { + integer_range = { + min = 0 + max = 9 + } + } + } +} + +################################################## +# Reward Effects + +# General logic for giving out the appropriate amount of currencies to a laamp upon contract completion. +laamp_rewards_disburse_ordinary_currency_effect = { + # Grab some scope for ease of access. + save_scope_as = task_contract + task_contract_employer = { save_scope_as = employer } + task_contract_taker = { save_scope_as = taker } + # Gold. + scope:employer = { + # Yes, this is necessary. We get boot errors if we compare a direct script value vs. zero: maths works out, it's just Jomini Magic doin' its thing. + save_scope_value_as = { + name = gold + value = { + value = $GOLD$ + if = { + limit = { $EXTRA_REWARD$ = flag:yes } + multiply = task_contract_extra_reward_multiplier_value + } + round = yes + } + } + if = { + limit = { scope:gold != 0 } + # We pay players directly. + if = { + limit = { + scope:taker = { is_ai = no } + } + if = { + limit = { + scope:task_contract = { + is_criminal = yes + } + } + pay_short_term_gold = { + target = scope:taker + gold = scope:gold + } + } + else = { + pay_treasury_or_gold = { + target = scope:taker + value = scope:gold + } + } + } + # Otherwise only deduct gold if the AI can afford it. + else_if = { + limit = { short_term_treasury_or_gold >= $GOLD$ } + if = { + limit = { + scope:task_contract = { + is_criminal = yes + } + } + pay_short_term_gold = { + target = scope:taker + gold = scope:gold + } + } + else = { + pay_treasury_or_gold = { + target = scope:taker + value = scope:gold + } + } + } + # Else we magic the gold up so we don't bankrupt people foolishly. + else = { + scope:taker = { add_gold = scope:gold } + } + } + } + # Everything else. + scope:taker = { + # Prestige. + if = { + limit = { $PRESTIGE$ != 0 } + add_prestige = { + value = { + value = $PRESTIGE$ + if = { + limit = { $EXTRA_REWARD$ = flag:yes } + multiply = task_contract_extra_reward_multiplier_value + } + round = yes + } + } + } + # Piety. + if = { + limit = { $PIETY$ != 0 } + add_piety = { + value = { + value = $PIETY$ + if = { + limit = { $EXTRA_REWARD$ = flag:yes } + multiply = task_contract_extra_reward_multiplier_value + } + round = yes + } + } + } + # Provisions. + if = { + limit = { + $PROVISIONS$ != 0 + exists = domicile + } + domicile = { + change_provisions = { + value = { + value = $PROVISIONS$ + if = { + limit = { $EXTRA_REWARD$ = flag:yes } + multiply = task_contract_extra_reward_multiplier_value + } + round = yes + } + } + } + } + # Opinion. + if = { + limit = { $OPINION$ != 0 } + reverse_add_opinion = { + modifier = $OPINION_TYPE$ + target = scope:employer + opinion = $OPINION$ + } + } + # Contact. + save_scope_value_as = { + name = add_contact_toggle + value = flag:$CONTACT$ + } + save_scope_value_as = { + name = add_contact_hook_toggle + value =flag:$CONTACT_HOOK$ + } + if = { + limit = { scope:add_contact_toggle != flag:no } + # Huck 'em into our contact list. + add_contact = scope:employer + # Give hook as well as contact? + if = { + limit = { scope:add_contact_hook_toggle = flag:yes } + add_hook_if_possible_default_length_effect = { + TARGET = scope:employer + TYPE = contact_list_weak_hook + } + } + } + } +} + +# Dish out XP in the gallowsbait trait. +laamp_rewards_apply_criminal_xp_effect = { + save_scope_as = xp_gainer + save_scope_value_as = { + name = xp_change_min + value = $XP_MIN$ + } + if = { + limit = { + NOT = { has_trait = gallowsbait } + } + add_trait = gallowsbait + } + add_trait_xp = { + trait = gallowsbait + track = $TRACK$ + value = { + # Always use the gallowsbait_xp_minor_gain and related values for positive gains to ensure proper multipliers are applied! + integer_range = { + min = $XP_MIN$ + max = $XP_MAX$ + } + if = { + limit = { + scope:xp_change_min > 0 # Do not multiply reductions + scope:xp_gainer.domicile ?= { has_domicile_parameter = camp_reduced_criminal_contract_xp_gain } + } + multiply = reduced_criminal_contract_xp_gain_value + } + floor = yes # Round numbers down when modified + } + } +} + +# Dish out XP in the Knight-Errant trait. +laamp_rewards_apply_knight_errant_xp_effect = { + if = { + limit = { has_trait = knight_errant } + save_scope_as = xp_gainer + save_scope_value_as = { + name = xp_change_min + value = $XP_MIN$ + } + add_trait_xp = { + trait = knight_errant + value = { + # Always use the gallowsbait_xp_minor_gain and related values for positive gains to ensure proper multipliers are applied! + integer_range = { + min = $XP_MIN$ + max = $XP_MAX$ + } + floor = yes # Round numbers down when modified + } + } + } +} + +lower_gallowsbait_xp_effect = { + if = { + limit = { has_trait = gallowsbait } + if = { + limit = { + has_trait = gallowsbait + has_trait_xp = { + trait = gallowsbait + track = bandit + value >= 1 + } + } + add_trait_xp = { + trait = gallowsbait + track = bandit + VALUE = $VALUE$ + } + } + else_if = { + limit = { + has_trait = gallowsbait + has_trait_xp = { + trait = gallowsbait + track = trickster + value >= 1 + } + } + add_trait_xp = { + trait = gallowsbait + track = trickster + VALUE = $VALUE$ + } + } + else_if = { + limit = { + has_trait = gallowsbait + has_trait_xp = { + trait = gallowsbait + track = marauder + value >= 1 + } + } + add_trait_xp = { + trait = gallowsbait + track = marauder + VALUE = $VALUE$ + } + } + else_if = { + limit = { + has_trait = gallowsbait + has_trait_xp = { + trait = gallowsbait + track = poacher + value >= 1 + } + } + add_trait_xp = { + trait = gallowsbait + track = poacher + VALUE = $VALUE$ + } + } + else = { # Thief + add_trait_xp = { + trait = gallowsbait + track = thief + VALUE = $VALUE$ + } + } + } +} + +# grants hook and patronage from the councillor or liege of the employer in council task contracts, assumes you saved root as task_contract before +gain_patron_and_hook_from_council_task_contract_effect = { + task_contract_taker = { + if = { + limit = { + scope:task_contract.task_contract_employer = scope:task_contract.var:task_contract_councillor + scope:task_contract.var:task_contract_councillor_liege = { is_ai = yes } + } + add_contact = scope:task_contract.var:task_contract_councillor_liege + add_hook_if_possible_default_length_effect = { + TARGET = scope:task_contract.var:task_contract_councillor_liege + TYPE = contact_list_weak_hook + } + } + else = { + add_contact = scope:task_contract.var:task_contract_councillor + add_hook_if_possible_default_length_effect = { + TARGET = scope:task_contract.var:task_contract_councillor + TYPE = contact_list_weak_hook + } + } + } +} + +task_contract_justicar_contract_tracker_effect = { + custom_tooltip = task_contract_justicar_contract_tracker_effect.tt + increment_variable_effect = { + VAR = justicar_contracts_succeeded_counter + VAL = 1 + } +} + +task_successful_noncrim_contract_count_effect = { + custom_tooltip = task_successful_noncrim_contract_count_effect_tt + increment_variable_effect = { + VAR = laamp_total_noncrim_contracts_successfully_completed + VAL = 1 + } +} + +################################################## +# Camp Effects + +# Remove any inappropriate building upgrades on camp purpose changing. +laamp_clear_inappropriate_buildings_effect = { + # Warn that purpose-specific buildings will be demolished. + if = { + limit = { + domicile = { + OR = { + has_domicile_building = supply_tent_reserve_provisions + has_domicile_building = supply_tent_reserve_water + has_domicile_building = supply_tent_climbing_gear + has_domicile_building = supply_tent_subdued_gear + has_domicile_building = barber_tent_reference_corpus + has_domicile_building = barber_tent_morticians_tools + has_domicile_building = baggage_train_siege_engineers + has_domicile_building = baggage_train_scribes + has_domicile_building = baggage_train_proof_of_claims + has_domicile_building = baggage_train_ransom_cages + has_domicile_building = baggage_train_negotiators + has_domicile_building = baggage_train_ascetics + has_domicile_building = camp_fire_local_hangers_on + has_domicile_building = camp_fire_future_dreams + has_domicile_building = camp_fire_nightly_debates + has_domicile_building = camp_fire_juicy_rumors + has_domicile_building = proving_grounds_lockwagon + has_domicile_building = proving_grounds_martial_study + has_domicile_building = proving_grounds_the_stick_game + has_domicile_building = proving_grounds_bodyguard_drills + has_domicile_building = camp_perimeter_extra_watch + has_domicile_building = camp_perimeter_palisade + has_domicile_building = camp_perimeter_ditch + } + } + } + custom_tooltip = laamp_clear_inappropriate_buildings_effect.tt.buildings_may_be_lost + } + # Aaaand then queue our demolition. + trigger_event = { + id = ep3_laamps.1021 + delayed = yes + } +} + +# Liquidate a camp to refund a portion of all its buildings. +laamp_clear_domicile_buildings_effect = { + domicile ?= { + if = { + limit = { has_domicile_building = camp_main_04 } + remove_domicile_building = camp_main_04 + } + if = { + limit = { has_domicile_building = camp_main_03 } + remove_domicile_building = camp_main_03 + } + if = { + limit = { has_domicile_building = camp_main_02 } + remove_domicile_building = camp_main_02 + } + if = { + limit = { has_domicile_building = camp_main_01 } + remove_domicile_building = camp_main_01 + } + if = { + limit = { has_domicile_building = supply_tent_sutler } + remove_domicile_building = supply_tent_sutler + } + if = { + limit = { has_domicile_building = supply_tent_mender } + remove_domicile_building = supply_tent_mender + } + if = { + limit = { has_domicile_building = supply_tent_smithy } + remove_domicile_building = supply_tent_smithy + } + if = { + limit = { has_domicile_building = supply_tent_arsenal } + remove_domicile_building = supply_tent_arsenal + } + if = { + limit = { has_domicile_building = supply_tent_reserve_provisions } + remove_domicile_building = supply_tent_reserve_provisions + } + if = { + limit = { has_domicile_building = supply_tent_reserve_water } + remove_domicile_building = supply_tent_reserve_water + } + if = { + limit = { has_domicile_building = supply_tent_climbing_gear } + remove_domicile_building = supply_tent_climbing_gear + } + if = { + limit = { has_domicile_building = supply_tent_subdued_gear } + remove_domicile_building = supply_tent_subdued_gear + } + if = { + limit = { has_domicile_building = supply_tent_06 } + remove_domicile_building = supply_tent_06 + } + if = { + limit = { has_domicile_building = supply_tent_05 } + remove_domicile_building = supply_tent_05 + } + if = { + limit = { has_domicile_building = supply_tent_04 } + remove_domicile_building = supply_tent_04 + } + if = { + limit = { has_domicile_building = supply_tent_03 } + remove_domicile_building = supply_tent_03 + } + if = { + limit = { has_domicile_building = supply_tent_02 } + remove_domicile_building = supply_tent_02 + } + if = { + limit = { has_domicile_building = supply_tent_01 } + remove_domicile_building = supply_tent_01 + } + if = { + limit = { has_domicile_building = barber_tent_surgeons_tools } + remove_domicile_building = barber_tent_surgeons_tools + } + if = { + limit = { has_domicile_building = barber_tent_dentists_tools } + remove_domicile_building = barber_tent_dentists_tools + } + if = { + limit = { has_domicile_building = barber_tent_torturers_tools } + remove_domicile_building = barber_tent_torturers_tools + } + if = { + limit = { has_domicile_building = barber_tent_reference_corpus } + remove_domicile_building = barber_tent_reference_corpus + } + if = { + limit = { has_domicile_building = barber_tent_morticians_tools } + remove_domicile_building = barber_tent_morticians_tools + } + if = { + limit = { has_domicile_building = barber_tent_06 } + remove_domicile_building = barber_tent_06 + } + if = { + limit = { has_domicile_building = barber_tent_05 } + remove_domicile_building = barber_tent_05 + } + if = { + limit = { has_domicile_building = barber_tent_04 } + remove_domicile_building = barber_tent_04 + } + if = { + limit = { has_domicile_building = barber_tent_03 } + remove_domicile_building = barber_tent_03 + } + if = { + limit = { has_domicile_building = barber_tent_02 } + remove_domicile_building = barber_tent_02 + } + if = { + limit = { has_domicile_building = barber_tent_01 } + remove_domicile_building = barber_tent_01 + } + if = { + limit = { has_domicile_building = baggage_train_ample_steeds } + remove_domicile_building = baggage_train_ample_steeds + } + if = { + limit = { has_domicile_building = baggage_train_porters } + remove_domicile_building = baggage_train_porters + } + if = { + limit = { has_domicile_building = baggage_train_trackers } + remove_domicile_building = baggage_train_trackers + } + if = { + limit = { has_domicile_building = baggage_train_kennel } + remove_domicile_building = baggage_train_kennel + } + if = { + limit = { has_domicile_building = baggage_train_siege_engineers } + remove_domicile_building = baggage_train_siege_engineers + } + if = { + limit = { has_domicile_building = baggage_train_shrine } + remove_domicile_building = baggage_train_shrine + } + if = { + limit = { has_domicile_building = baggage_train_scribes } + remove_domicile_building = baggage_train_scribes + } + if = { + limit = { has_domicile_building = baggage_train_bartering_grounds } + remove_domicile_building = baggage_train_bartering_grounds + } + if = { + limit = { has_domicile_building = baggage_train_proof_of_claims } + remove_domicile_building = baggage_train_proof_of_claims + } + if = { + limit = { has_domicile_building = baggage_train_ransom_cages } + remove_domicile_building = baggage_train_ransom_cages + } + if = { + limit = { has_domicile_building = baggage_train_negotiators } + remove_domicile_building = baggage_train_negotiators + } + if = { + limit = { has_domicile_building = baggage_train_ascetics } + remove_domicile_building = baggage_train_ascetics + } + if = { + limit = { has_domicile_building = baggage_train_pleasure_tents } + remove_domicile_building = baggage_train_pleasure_tents + } + if = { + limit = { has_domicile_building = baggage_train_06 } + remove_domicile_building = baggage_train_06 + } + if = { + limit = { has_domicile_building = baggage_train_05 } + remove_domicile_building = baggage_train_05 + } + if = { + limit = { has_domicile_building = baggage_train_04 } + remove_domicile_building = baggage_train_04 + } + if = { + limit = { has_domicile_building = baggage_train_03 } + remove_domicile_building = baggage_train_03 + } + if = { + limit = { has_domicile_building = baggage_train_02 } + remove_domicile_building = baggage_train_02 + } + if = { + limit = { has_domicile_building = baggage_train_01 } + remove_domicile_building = baggage_train_01 + } + if = { + limit = { has_domicile_building = mess_tent_herbalists } + remove_domicile_building = mess_tent_herbalists + } + if = { + limit = { has_domicile_building = mess_tent_brewers } + remove_domicile_building = mess_tent_brewers + } + if = { + limit = { has_domicile_building = mess_tent_curers } + remove_domicile_building = mess_tent_curers + } + if = { + limit = { has_domicile_building = mess_tent_bakers } + remove_domicile_building = mess_tent_bakers + } + if = { + limit = { has_domicile_building = mess_tent_cooks } + remove_domicile_building = mess_tent_cooks + } + if = { + limit = { has_domicile_building = mess_tent_06 } + remove_domicile_building = mess_tent_06 + } + if = { + limit = { has_domicile_building = mess_tent_05 } + remove_domicile_building = mess_tent_05 + } + if = { + limit = { has_domicile_building = mess_tent_04 } + remove_domicile_building = mess_tent_04 + } + if = { + limit = { has_domicile_building = mess_tent_03 } + remove_domicile_building = mess_tent_03 + } + if = { + limit = { has_domicile_building = mess_tent_02 } + remove_domicile_building = mess_tent_02 + } + if = { + limit = { has_domicile_building = mess_tent_01 } + remove_domicile_building = mess_tent_01 + } + if = { + limit = { has_domicile_building = camp_fire_trailing_musicians } + remove_domicile_building = camp_fire_trailing_musicians + } + if = { + limit = { has_domicile_building = camp_fire_wandering_poets } + remove_domicile_building = camp_fire_wandering_poets + } + if = { + limit = { has_domicile_building = camp_fire_capering_fools } + remove_domicile_building = camp_fire_capering_fools + } + if = { + limit = { has_domicile_building = camp_fire_libations_for_the_lost } + remove_domicile_building = camp_fire_libations_for_the_lost + } + if = { + limit = { has_domicile_building = camp_fire_local_hangers_on } + remove_domicile_building = camp_fire_local_hangers_on + } + if = { + limit = { has_domicile_building = camp_fire_future_dreams } + remove_domicile_building = camp_fire_future_dreams + } + if = { + limit = { has_domicile_building = camp_fire_nightly_debates } + remove_domicile_building = camp_fire_nightly_debates + } + if = { + limit = { has_domicile_building = camp_fire_juicy_rumors } + remove_domicile_building = camp_fire_juicy_rumors + } + if = { + limit = { has_domicile_building = camp_fire_06 } + remove_domicile_building = camp_fire_06 + } + if = { + limit = { has_domicile_building = camp_fire_05 } + remove_domicile_building = camp_fire_05 + } + if = { + limit = { has_domicile_building = camp_fire_04 } + remove_domicile_building = camp_fire_04 + } + if = { + limit = { has_domicile_building = camp_fire_03 } + remove_domicile_building = camp_fire_03 + } + if = { + limit = { has_domicile_building = camp_fire_02 } + remove_domicile_building = camp_fire_02 + } + if = { + limit = { has_domicile_building = camp_fire_01 } + remove_domicile_building = camp_fire_01 + } + if = { + limit = { has_domicile_building = proving_grounds_horse_run } + remove_domicile_building = proving_grounds_horse_run + } + if = { + limit = { has_domicile_building = proving_grounds_camel_run } + remove_domicile_building = proving_grounds_camel_run + } + if = { + limit = { has_domicile_building = proving_grounds_elephantry_reserve } + remove_domicile_building = proving_grounds_elephantry_reserve + } + if = { + limit = { has_domicile_building = proving_grounds_nightly_barding_drills } + remove_domicile_building = proving_grounds_nightly_barding_drills + } + if = { + limit = { has_domicile_building = proving_grounds_life_in_the_saddle } + remove_domicile_building = proving_grounds_life_in_the_saddle + } + if = { + limit = { has_domicile_building = proving_grounds_the_stump } + remove_domicile_building = proving_grounds_the_stump + } + if = { + limit = { has_domicile_building = proving_grounds_personal_bouts } + remove_domicile_building = proving_grounds_personal_bouts + } + if = { + limit = { has_domicile_building = proving_grounds_training_circle } + remove_domicile_building = proving_grounds_training_circle + } + if = { + limit = { has_domicile_building = proving_grounds_mock_battle_drills } + remove_domicile_building = proving_grounds_mock_battle_drills + } + if = { + limit = { has_domicile_building = proving_grounds_lockwagon } + remove_domicile_building = proving_grounds_lockwagon + } + if = { + limit = { has_domicile_building = proving_grounds_martial_study } + remove_domicile_building = proving_grounds_martial_study + } + if = { + limit = { has_domicile_building = proving_grounds_the_stick_game } + remove_domicile_building = proving_grounds_the_stick_game + } + if = { + limit = { has_domicile_building = proving_grounds_bodyguard_drills } + remove_domicile_building = proving_grounds_bodyguard_drills + } + if = { + limit = { has_domicile_building = proving_grounds_06 } + remove_domicile_building = proving_grounds_06 + } + if = { + limit = { has_domicile_building = proving_grounds_05 } + remove_domicile_building = proving_grounds_05 + } + if = { + limit = { has_domicile_building = proving_grounds_04 } + remove_domicile_building = proving_grounds_04 + } + if = { + limit = { has_domicile_building = proving_grounds_03 } + remove_domicile_building = proving_grounds_03 + } + if = { + limit = { has_domicile_building = proving_grounds_02 } + remove_domicile_building = proving_grounds_02 + } + if = { + limit = { has_domicile_building = proving_grounds_01 } + remove_domicile_building = proving_grounds_01 + } + if = { + limit = { has_domicile_building = camp_perimeter_good_siting } + remove_domicile_building = camp_perimeter_good_siting + } + if = { + limit = { has_domicile_building = camp_perimeter_fixed_layout } + remove_domicile_building = camp_perimeter_fixed_layout + } + if = { + limit = { has_domicile_building = camp_perimeter_extra_watch } + remove_domicile_building = camp_perimeter_extra_watch + } + if = { + limit = { has_domicile_building = camp_perimeter_palisade } + remove_domicile_building = camp_perimeter_palisade + } + if = { + limit = { has_domicile_building = camp_perimeter_ditch } + remove_domicile_building = camp_perimeter_ditch + } + if = { + limit = { has_domicile_building = camp_perimeter_camp_hygiene } + remove_domicile_building = camp_perimeter_camp_hygiene + } + if = { + limit = { has_domicile_building = camp_perimeter_06 } + remove_domicile_building = camp_perimeter_06 + } + if = { + limit = { has_domicile_building = camp_perimeter_05 } + remove_domicile_building = camp_perimeter_05 + } + if = { + limit = { has_domicile_building = camp_perimeter_04 } + remove_domicile_building = camp_perimeter_04 + } + if = { + limit = { has_domicile_building = camp_perimeter_03 } + remove_domicile_building = camp_perimeter_03 + } + if = { + limit = { has_domicile_building = camp_perimeter_02 } + remove_domicile_building = camp_perimeter_02 + } + if = { + limit = { has_domicile_building = camp_perimeter_01 } + remove_domicile_building = camp_perimeter_01 + } + } +} + +################################################## +# Travel Effects + +remove_laamp_from_exiled_county_automatically_effect = { + $PROVINCE$ = { save_scope_as = province_effect } + $LAAMP$ = { save_scope_as = laamp_effect } + if = { + limit = { + exists = domicile.domicile_location.county.holder # Safety check + is_laamp_exiled_from_province_trigger = { + PROVINCE = scope:province_effect + LAAMP = scope:laamp_effect + } + } + scope:laamp_effect = { + # Grab any valid destination to shift to. + ## Try somewhere more sensible if we're a player (which is less performant). + domicile.domicile_location.county.holder = { # (is_laamp_exiled_from_province_trigger actually checks county holder) + every_neighboring_and_across_water_top_liege_realm_owner = { + limit = { + this != scope:laamp_effect + } + every_realm_border_county = { + limit = { + exists = holder + NOT = { + holder = { + is_laamp_exiled_from_holder_or_liege_trigger = { LAAMP = scope:laamp_effect } + } + } + } + add_to_list = reroute_counties_list + } + } + ordered_in_list = { + list = reroute_counties_list + order_by = { + value = "title_province.squared_distance(scope:laamp_effect.location)" + multiply = -1 + } + save_scope_as = exile_reroute + } + } + ## Otherwise, try to grab anywhere valid. + if = { + limit = { + NOT = { exists = scope:exile_reroute } + } + domicile.domicile_location.county.holder = { # (is_laamp_exiled_from_province_trigger actually checks county holder) + random_neighboring_and_across_water_top_liege_realm_owner = { + random_realm_county = { + limit = { + exists = holder + NOT = { + holder = { + is_laamp_exiled_from_holder_or_liege_trigger = { LAAMP = scope:laamp_effect } + } + } + } + save_scope_as = exile_reroute + } + } + } + } + ## If we got nothing (which is very unlikely), prep a backup. + if = { + limit = { + NOT = { exists = scope:exile_reroute } + } + scope:province_effect = { save_scope_as = province_to_exit } + ordered_empire = { + limit = { + any_de_jure_county = { + exists = holder + NOT = { + holder = { + is_laamp_exiled_from_holder_or_liege_trigger = { LAAMP = scope:laamp_effect } + } + } + } + } + order_by = { + title_capital_county = { add = "squared_distance(scope:province_to_exit)" } + multiply = -1 + } + random_de_jure_county = { + limit = { + exists = holder + NOT = { + holder = { + is_laamp_exiled_from_holder_or_liege_trigger = { LAAMP = scope:laamp_effect } + } + } + } + save_scope_as = exile_reroute + } + } + } + # If we're an AI, give us some relief for our (likely) poor choice of destination. + if = { + limit = { is_ai = yes } + add_character_modifier = laamp_provisions_forgiveness_travel_modifier + } + # Begin travelling. + start_travel_plan = { + destination = scope:exile_reroute.title_province + travel_with_domicile = yes + return_trip = no + players_use_planner = no + } + } + } +} + +################################################## +# Event Effects + +try_to_set_event_recurrer_relationship_effect = { + if = { + limit = { + save_scope_as = liege_temp + any_relation = { + type = event_recurrer + # Only count recurrers that are still useful: if they've been demoted or incapacitated, someone should fill the gap. + is_valid_active_event_recurrer_trigger = { LIEGE = scope:liege_temp } + # We don't want too few, don't want too many. + count < 5 + } + } + set_relation_event_recurrer = $TARGET$ + } +} + +laamp_contract_grab_suitable_rival_for_disposal_effect = { + # Used in valid_laamp_contract_foe_trigger. + save_scope_as = employer_ref + # First, try to grab suitable rivals. + ordered_relation = { + type = rival + limit = { valid_laamp_contract_foe_trigger = yes } + order_by = "opinion(scope:employer_ref)" + save_scope_as = target + } + # Then we try for potential rivals. + ## Non-if-else_if chaining here is deliberate: we iterate over each list once then look to see whether we came up with anything. If we didn't, we move on to the next list. + ### This saves us doubling up on checks for the same outcome. + if = { + limit = { + NOT = { exists = scope:target } + } + ordered_relation = { + type = potential_rival + order_by = "opinion(scope:employer_ref)" + limit = { valid_laamp_contract_foe_trigger = yes } + save_scope_as = target + } + } + # Then get peer vassals (if we're not independent). + if = { + limit = { + NOT = { exists = scope:target } + top_liege != this + } + liege = { + ordered_vassal = { + limit = { valid_laamp_contract_foe_trigger = yes } + order_by = "opinion(scope:employer_ref)" + save_scope_as = target + } + } + } + # Or neighbouring rulers otherwise. + if = { + limit = { + NOT = { exists = scope:target } + } + ordered_neighboring_and_across_water_top_liege_realm_owner = { + limit = { + valid_laamp_contract_foe_trigger = yes + # Make sure that we don't have barons putting out hits on emperors. + highest_held_title_tier <= { + value = scope:employer.highest_held_title_tier + add = 2 + } + } + order_by = "opinion(scope:employer_ref)" + save_scope_as = target + } + } + # For the AI we grab a pool character + if = { + limit = { + NOT = { exists = scope:target } + any_pool_character = { + province = location + is_physically_able_ai_adult = yes + } + } + save_scope_as = value_target + random_pool_character = { + province = location + limit = { + is_physically_able_ai_adult = yes + } + save_scope_as = target + } + } + # Then we just spawn someone. + if = { + limit = { + NOT = { exists = scope:target } + } + save_scope_as = value_target + create_character = { + template = bandit_character_generic + faith = scope:employer_ref.capital_county.faith + culture = scope:employer_ref.capital_county.culture + location = scope:employer_ref.capital_county.title_province + gender_female_chance = scope_value_target_soldier_female_chance + dynasty = none + save_scope_as = target + after_creation = { + add_opinion = { + target = scope:employer_ref + modifier = hate_opinion + opinion = -50 + } + reverse_add_opinion = { + target = scope:employer_ref + modifier = hate_opinion + opinion = -50 + } + } + } + } + # Plus, set up a grudge from our employer. + scope:employer_ref = { + set_random_rivalry_reason = { + TARGET = scope:target + RELATION = grudge + } + } + # Finally, log them to the contract. + scope:task_contract = { + set_variable = { + name = target + value = scope:target + } + } +} + +select_thriving_predator_animal_effect = { + random_list = { + # Boar + 20 = { + trigger = { + $LOCATION$ = { hunt_animal_boar_trigger = yes } + } + # We don't mind hunting them for pest control, regardless of faith. + set_variable = { + name = animal_type_event + value = flag:boar + } + } + # Wolf, Hyena, Lynx + 10 = { + random_list = { + # Wolf + 10 = { + trigger = { + $LOCATION$ = { + NAND = { + geographical_region = world_africa_west + OR = { + terrain = hills + terrain = forest + terrain = jungle + terrain = mountains + } + } + } + } + set_variable = { + name = animal_type_event + value = flag:wolf + } + } + # Hyena + 20 = { + trigger = { + $LOCATION$ = { hunt_animal_hyena_trigger = yes } + } + set_variable = { + name = animal_type_event + value = flag:hyena + } + } + # Lynx + 5 = { + trigger = { + $LOCATION$ = { hunt_animal_lynx_trigger = yes } + } + set_variable = { + name = animal_type_event + value = flag:lynx + } + } + } + } + # Bear + 5 = { + trigger = { + $LOCATION$ = { hunt_animal_bear_trigger = yes } + } + set_variable = { + name = animal_type_event + value = flag:bear + } + } + # Big Cat + 5 = { + trigger = { + $LOCATION$ = { + hunt_animal_big_cat_trigger = yes + OR = { + hunt_animal_lion_trigger = yes + hunt_animal_tiger_trigger = yes + hunt_animal_leopard_trigger = yes + } + } + } + random_list = { + # Lion + 5 = { + trigger = { + $LOCATION$ = { hunt_animal_lion_trigger = yes } + } + modifier = { + factor = 5 + $LOCATION$ = { + OR = { + terrain = desert + terrain = forest + } + } + } + set_variable = { + name = animal_type_event + value = flag:lion + } + } + # Tiger + 5 = { + trigger = { + $LOCATION$ = { hunt_animal_tiger_trigger = yes } + } + modifier = { + factor = 5 + $LOCATION$ = { terrain = jungle } + } + set_variable = { + name = animal_type_event + value = flag:tiger + } + } + # Leopard + 5 = { + trigger = { + $LOCATION$ = { hunt_animal_leopard_trigger = yes } + } + modifier = { + factor = 0.5 + $LOCATION$ = { + OR = { + terrain = desert + terrain = mountains + } + } + } + set_variable = { + name = animal_type_event + value = flag:leopard + } + } + } + } + } + if = { + limit = { + NOT = { has_variable = animal_type_event } + } + set_variable = { + name = animal_type_event + value = flag:dog + } + } +} + +relation_increase_harrying_stats_effect = { + # Harrying logic. + if = { + limit = { + character_is_valid_for_harrying_of_the_north_trigger = yes + scope:target = { + character_is_valid_for_harrying_of_the_north_trigger = yes + is_important_or_vip_struggle_character = yes + } + culture != scope:target.culture + } + global_var:harrying_of_the_north = { save_scope_as = story } + if = { + limit = { + OR = { + AND = { + character_is_valid_norman_for_harrying_of_the_north_trigger = yes + scope:target = { character_is_valid_anglo_saxon_for_harrying_of_the_north_trigger = yes } + } + AND = { + character_is_valid_anglo_saxon_for_harrying_of_the_north_trigger = yes + scope:target = { character_is_valid_norman_for_harrying_of_the_north_trigger = yes } + } + } + } + ep3_increase_$STAT$_effect = { AMOUNT = harrying_miniscule_increase_value } + } + } +} + +########################### +# City Construction Effects +laamp_city_builder_construction_effect = { + if = { + limit = { + has_character_flag = laamp_city_builder_$FLAG$_upgrade + } + scope:city_location = { + add_building = $BUILDING$_03 + } + } + else_if = { + limit = { + has_character_flag = laamp_city_builder_$FLAG$ + } + scope:city_location = { + add_building = $BUILDING$_02 + } + } +} diff --git a/N3OW/common/scripted_effects/00_learning_lifestyle_effects.txt b/N3OW/common/scripted_effects/00_learning_lifestyle_effects.txt new file mode 100644 index 00000000..103ddf73 --- /dev/null +++ b/N3OW/common/scripted_effects/00_learning_lifestyle_effects.txt @@ -0,0 +1,1436 @@ +#Effects used in Lifestyle Focus events + + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! +# +# zealous_progression_effect +# cynical_progression_effect +# pick_translation_book_effect +# set_up_translation_story_effect +# + +#Scholarship Zealous Progression +zealous_progression_effect = { + if = { + limit = { + NOT = { has_trait = zealous } + } + custom_tooltip = learning_zealous_path_tt + if = { + limit = { NOT = { has_variable = scholarship_zealous_cynical_value } } + if = { + limit = { + has_trait = cynical + } + set_variable = { + name = scholarship_zealous_cynical_value + value = 3 + } + } + set_variable = { + name = scholarship_zealous_cynical_value + value = -1 + } + } + else_if = { + limit = { + has_trait = cynical + var:scholarship_zealous_cynical_value <= 1 + } + remove_trait = cynical + set_variable = { + name = scholarship_zealous_cynical_value + value = 0 + } + } + else_if = { + limit = { + var:scholarship_zealous_cynical_value < scholarship_zealous_threshold + } + add_trait = zealous + } + else = { + change_variable = { + name = scholarship_zealous_cynical_value + subtract = 1 + } + } + } + stress_impact = { + cynical = minor_stress_impact_gain + } +} + + +#Scholarship Progression +cynical_progression_effect = { + if = { + limit = { NOT = { has_trait = cynical } } + custom_tooltip = learning_cynical_path_tt + if = { + limit = {NOT = { has_variable = scholarship_zealous_cynical_value } } + if = { + limit = { + has_trait = zealous + } + set_variable = { + name = scholarship_zealous_cynical_value + value = -3 + } + } + set_variable = { + name = scholarship_zealous_cynical_value + value = 1 + } + } + else_if = { + limit = { + has_trait = zealous + var:scholarship_zealous_cynical_value >= -1 + } + remove_trait = zealous + set_variable = { + name = scholarship_zealous_cynical_value + value = 0 + } + } + else_if = { + limit = { + NOT = { has_trait = cynical } + var:scholarship_zealous_cynical_value > scholarsip_cynical_threshold + } + add_trait = cynical + } + else = { + change_variable = { + name = scholarship_zealous_cynical_value + add = 1 + } + } + } + stress_impact = { + zealous = minor_stress_impact_gain + } +} + + +set_up_translation_story_effect = { + add_character_modifier = { + modifier = book_translation_ongoing_modifier + } + set_variable = { + name = book_to_translate + value = flag:$BOOK$ + } + create_story = book_translation_story +} + + +pick_translation_book_effect = { + random_list = { + 100 = { #Regula Pastoralis + trigger = { + trigger_if = { + limit = { + exists = scope:option_1 + } + NOT = { scope:option_1 = flag:regula_pastoralis } + } + capital_province = { + OR = { + geographical_region = world_europe + geographical_region = world_middle_east + geographical_region = world_africa_north + } + } + } + + save_scope_value_as = { + name = $OPTION$ + value = flag:regula_pastoralis + } + } + 100 = { #Physica Elementa + trigger = { + trigger_if = { + limit = { + exists = scope:option_1 + } + NOT = { scope:option_1 = flag:physica_elementa } + } + capital_province = { + OR = { + geographical_region = world_europe + geographical_region = world_middle_east + geographical_region = world_africa_north + geographical_region = world_persian_empire + } + } + } + + save_scope_value_as = { + name = $OPTION$ + value = flag:physica_elementa + } + } + 100 = { #Almagest + trigger = { + trigger_if = { + limit = { + exists = scope:option_1 + } + NOT = { scope:option_1 = flag:almagest } + } + capital_province = { + OR = { + geographical_region = world_europe + geographical_region = world_middle_east + geographical_region = world_africa_north + geographical_region = world_persian_empire + } + } + } + + save_scope_value_as = { + name = $OPTION$ + value = flag:almagest + } + } + 100 = { #The Elements + trigger = { + trigger_if = { + limit = { + exists = scope:option_1 + } + NOT = { scope:option_1 = flag:elements } + } + capital_province = { + OR = { + geographical_region = world_europe + geographical_region = world_middle_east + geographical_region = world_africa_north + geographical_region = world_persian_empire + } + } + } + + save_scope_value_as = { + name = $OPTION$ + value = flag:elements + } + } + 100 = { #Corpus Hermeticus + trigger = { + trigger_if = { + limit = { + exists = scope:option_1 + } + NOT = { scope:option_1 = flag:corpus_hermeticus } + } + capital_province = { + OR = { + geographical_region = world_europe + geographical_region = world_middle_east + geographical_region = world_africa_north + geographical_region = world_persian_empire + } + } + } + + save_scope_value_as = { + name = $OPTION$ + value = flag:corpus_hermeticus + } + } + 100 = { #Treatises of Hippocrates + trigger = { + trigger_if = { + limit = { + exists = scope:option_1 + } + NOT = { scope:option_1 = flag:treatises_of_hippocrates } + } + capital_province = { + OR = { + geographical_region = world_europe + geographical_region = world_middle_east + geographical_region = world_africa_north + geographical_region = world_persian_empire + } + } + } + + save_scope_value_as = { + name = $OPTION$ + value = flag:treatises_of_hippocrates + } + } + 100 = { #Peri Psyches + trigger = { + trigger_if = { + limit = { + exists = scope:option_1 + } + NOT = { scope:option_1 = flag:peri_psyches } + } + capital_province = { + OR = { + geographical_region = world_europe + geographical_region = world_middle_east + geographical_region = world_africa_north + geographical_region = world_persian_empire + } + } + } + + save_scope_value_as = { + name = $OPTION$ + value = flag:peri_psyches + } + } + 100 = { #Kategoriai + trigger = { + trigger_if = { + limit = { + exists = scope:option_1 + } + NOT = { scope:option_1 = flag:kategoriai } + } + capital_province = { + OR = { + geographical_region = world_europe + geographical_region = world_middle_east + geographical_region = world_africa_north + geographical_region = world_persian_empire + } + } + } + + save_scope_value_as = { + name = $OPTION$ + value = flag:kategoriai + } + } + 100 = { #Avesta + trigger = { + trigger_if = { + limit = { + exists = scope:option_1 + } + NOT = { scope:option_1 = flag:avesta } + } + capital_province = { + OR = { + geographical_region = world_middle_east + geographical_region = world_persian_empire + geographical_region = world_steppe + geographical_region = world_india_rajastan + } + } + } + + save_scope_value_as = { + name = $OPTION$ + value = flag:avesta + } + } + 100 = { #Avesta + trigger = { + trigger_if = { + limit = { + exists = scope:option_1 + } + NOT = { scope:option_1 = flag:avesta } + } + capital_province = { + OR = { + geographical_region = world_middle_east + geographical_region = world_persian_empire + geographical_region = world_steppe + geographical_region = world_india_rajastan + } + } + } + + save_scope_value_as = { + name = $OPTION$ + value = flag:avesta + } + } + 100 = { #De Oratore + trigger = { + trigger_if = { + limit = { + exists = scope:option_1 + } + NOT = { scope:option_1 = flag:de_oratore } + } + capital_province = { + OR = { + geographical_region = world_middle_east + geographical_region = world_persian_empire + geographical_region = world_europe_north + } + } + } + + save_scope_value_as = { + name = $OPTION$ + value = flag:de_oratore + } + } + 100 = { #Book of Arda Viraf + trigger = { + trigger_if = { + limit = { + exists = scope:option_1 + } + NOT = { scope:option_1 = flag:book_of_arda_viraf } + } + capital_province = { + OR = { + geographical_region = world_middle_east + geographical_region = world_persian_empire + geographical_region = world_india + geographical_region = world_steppe + } + } + } + + save_scope_value_as = { + name = $OPTION$ + value = flag:book_of_arda_viraf + } + } + 100 = { #The Upanishads + trigger = { + trigger_if = { + limit = { + exists = scope:option_1 + } + NOT = { scope:option_1 = flag:upanishads } + } + capital_province = { + OR = { + geographical_region = world_persian_empire + geographical_region = world_india + geographical_region = world_steppe_east + geographical_region = world_steppe_tarim + } + } + } + + save_scope_value_as = { + name = $OPTION$ + value = flag:upanishads + } + } + 100 = { #Rigveda + trigger = { + trigger_if = { + limit = { + exists = scope:option_1 + } + NOT = { scope:option_1 = flag:rigveda } + } + capital_province = { + OR = { + geographical_region = world_persian_empire + geographical_region = world_india + geographical_region = world_steppe_east + geographical_region = world_steppe_tarim + } + } + } + + save_scope_value_as = { + name = $OPTION$ + value = flag:rigveda + } + } + 100 = { #The Books of the Balances + trigger = { + trigger_if = { + limit = { + exists = scope:option_1 + } + NOT = { scope:option_1 = flag:books_of_the_balances } + } + capital_province = { + OR = { + geographical_region = world_persian_empire + geographical_region = world_asia_minor + geographical_region = world_india + geographical_region = world_steppe_east + geographical_region = world_steppe_tarim + geographical_region = world_europe + } + } + } + + save_scope_value_as = { + name = $OPTION$ + value = flag:books_of_the_balances + } + } + 100 = { #Secret of Secrets + trigger = { + trigger_if = { + limit = { + exists = scope:option_1 + } + NOT = { scope:option_1 = flag:secret_of_secrets } + } + capital_province = { + OR = { + geographical_region = world_persian_empire + geographical_region = world_asia_minor + geographical_region = world_india + geographical_region = world_steppe_east + geographical_region = world_steppe_tarim + geographical_region = world_europe + } + } + } + + save_scope_value_as = { + name = $OPTION$ + value = flag:secret_of_secrets + } + } + 100 = { #The Court of Agriculture + trigger = { + trigger_if = { + limit = { + exists = scope:option_1 + } + NOT = { scope:option_1 = flag:court_of_agriculture } + } + capital_province = { + OR = { + geographical_region = world_persian_empire + geographical_region = world_asia_minor + geographical_region = world_india + geographical_region = world_steppe_east + geographical_region = world_steppe_tarim + geographical_region = world_europe + } + } + } + + save_scope_value_as = { + name = $OPTION$ + value = flag:court_of_agriculture + } + } + 100 = { #The Lanterns of Wisdom + trigger = { + trigger_if = { + limit = { + exists = scope:option_1 + } + NOT = { scope:option_1 = flag:lanterns_of_wisdom } + } + capital_province = { + OR = { + geographical_region = world_persian_empire + geographical_region = world_asia_minor + geographical_region = world_india + geographical_region = world_steppe_east + geographical_region = world_steppe_tarim + geographical_region = world_europe + } + } + } + + save_scope_value_as = { + name = $OPTION$ + value = flag:lanterns_of_wisdom + } + } + 100 = { #The Shahnameh + trigger = { + trigger_if = { + limit = { + exists = scope:option_1 + } + NOT = { scope:option_1 = flag:shahnameh } + } + capital_province = { + OR = { + geographical_region = world_mesopotamia + geographical_region = world_asia_minor + geographical_region = world_middle_east_jerusalem + geographical_region = world_middle_east_arabia + geographical_region = world_africa_north + geographical_region = world_india + geographical_region = world_steppe_east + geographical_region = world_steppe_tarim + } + } + } + + save_scope_value_as = { + name = $OPTION$ + value = flag:shahnameh + } + } + 100 = { #The Arithmetica + trigger = { + trigger_if = { + limit = { + exists = scope:option_1 + } + NOT = { scope:option_1 = flag:arithmetica } + } + capital_province = { + OR = { + geographical_region = world_persian_empire + geographical_region = world_asia_minor + geographical_region = world_middle_east_jerusalem + geographical_region = world_middle_east_arabia + geographical_region = world_africa_north + geographical_region = world_india + geographical_region = world_steppe_east + geographical_region = world_steppe_west + geographical_region = world_steppe_tarim + geographical_region = world_europe + } + } + } + + save_scope_value_as = { + name = $OPTION$ + value = flag:arithmetica + } + } + 100 = { #The Pali Canon + trigger = { + trigger_if = { + limit = { + exists = scope:option_1 + } + NOT = { scope:option_1 = flag:pali_canon } + } + capital_province = { + OR = { + geographical_region = world_persian_empire + geographical_region = world_middle_east_jerusalem + geographical_region = world_middle_east_arabia + geographical_region = world_india + geographical_region = world_steppe_tarim + geographical_region = world_steppe_east + } + } + } + + save_scope_value_as = { + name = $OPTION$ + value = flag:pali_canon + } + } + 100 = { #The Sagas + trigger = { + trigger_if = { + limit = { + exists = scope:option_1 + } + NOT = { scope:option_1 = flag:the_norse_sagas } + } + OR = { + AND = { + religion = religion:christianity_religion + current_date > 1000.1.1 + capital_province = { + geographical_region = world_europe_north + } + } + AND = { + current_date > 1200.1.1 + OR = { + capital_province = { + geographical_region = world_europe_north + } + religion = religion:germanic_religion + } + } + } + } + + save_scope_value_as = { + name = $OPTION$ + value = flag:the_norse_sagas + } + } + 1 = { #Fallback: Family History + trigger = { + trigger_if = { + limit = { + exists = scope:option_1 + } + NOT = { scope:option_1 = flag:family_history } + } + } + + save_scope_value_as = { + name = $OPTION$ + value = flag:family_history + } + } + 1 = { #Fallback: Ancient Myths + trigger = { + trigger_if = { + limit = { + exists = scope:option_1 + } + NOT = { scope:option_1 = flag:ancient_myths } + } + } + + save_scope_value_as = { + name = $OPTION$ + value = flag:ancient_myths + } + } + } +} + + +learning_scholarship_special_2011_significantly_improve_translation_effect = { + custom_tooltip = book_translation_tooltip.more_good + hidden_effect = { + scope:story = { + change_variable = { + name = translation_quality + add = 2 + } + } + } +} + +learning_scholarship_special_2011_somewhat_improve_translation_effect = { + custom_tooltip = book_translation_tooltip.less_good + hidden_effect = { + scope:story = { + change_variable = { + name = translation_quality + add = 1 + } + } + } +} + +speed_up_translation_effect = { + custom_tooltip = book_translation_tooltip.finish_faster + hidden_effect = { + scope:story = { + change_variable = { + name = duration_left + add = -1 + } + } + } +} + +learning_theology_2020_randomize_virtue_options_effect = { + random_list = { + 1 = { + trigger = { + faith = { trait_is_virtue = brave } + NOT = { has_character_flag = virtue_brave } + } + modifier = { + scope:court_chaplain = { has_trait = brave } + factor = 10 + } + add_character_flag = virtue_brave + } + 1 = { + trigger = { + faith = { trait_is_virtue = just } + NOT = { has_character_flag = virtue_just } + } + modifier = { + scope:court_chaplain = { has_trait = just } + factor = 10 + } + add_character_flag = virtue_just + } + 1 = { + trigger = { + faith = { trait_is_virtue = temperate } + NOT = { has_character_flag = virtue_temperate } + } + modifier = { + scope:court_chaplain = { has_trait = temperate } + factor = 10 + } + add_character_flag = virtue_temperate + } + 1 = { + trigger = { + faith = { trait_is_virtue = chaste } + NOT = { has_character_flag = virtue_chaste } + } + modifier = { + scope:court_chaplain = { has_trait = chaste } + factor = 10 + } + add_character_flag = virtue_chaste + } + 1 = { + trigger = { + faith = { trait_is_virtue = compassionate } + NOT = { has_character_flag = virtue_compassionate } + } + modifier = { + scope:court_chaplain = { has_trait = compassionate } + factor = 10 + } + add_character_flag = virtue_compassionate + } + 1 = { + trigger = { + faith = { trait_is_virtue = honest } + NOT = { has_character_flag = virtue_honest } + } + modifier = { + scope:court_chaplain = { has_trait = honest } + factor = 10 + } + add_character_flag = virtue_honest + } + 1 = { + trigger = { + faith = { trait_is_virtue = forgiving } + NOT = { has_character_flag = virtue_forgiving } + } + modifier = { + scope:court_chaplain = { has_trait = forgiving } + factor = 10 + } + add_character_flag = virtue_forgiving + } + 1 = { + trigger = { + faith = { trait_is_virtue = wrathful } + NOT = { has_character_flag = virtue_wrathful } + } + modifier = { + scope:court_chaplain = { has_trait = wrathful } + factor = 10 + } + add_character_flag = virtue_wrathful + } + 1 = { + trigger = { + faith = { trait_is_virtue = vengeful } + NOT = { has_character_flag = virtue_vengeful } + } + modifier = { + scope:court_chaplain = { has_trait = vengeful } + factor = 10 + } + add_character_flag = virtue_vengeful + } + 1 = { + trigger = { + faith = { trait_is_virtue = content } + NOT = { has_character_flag = virtue_content } + } + modifier = { + scope:court_chaplain = { has_trait = content } + factor = 10 + } + add_character_flag = virtue_content + } + 1 = { + trigger = { + faith = { trait_is_virtue = patient } + NOT = { has_character_flag = virtue_patient } + } + modifier = { + scope:court_chaplain = { has_trait = patient } + factor = 10 + } + add_character_flag = virtue_patient + } + 1 = { + trigger = { + faith = { trait_is_virtue = calm } + NOT = { has_character_flag = virtue_calm } + } + modifier = { + scope:court_chaplain = { has_trait = calm } + factor = 10 + } + add_character_flag = virtue_calm + } + 1 = { + trigger = { + faith = { trait_is_virtue = humble } + NOT = { has_character_flag = virtue_humble } + } + modifier = { + scope:court_chaplain = { has_trait = humble } + factor = 10 + } + add_character_flag = virtue_humble + } + 1 = { + trigger = { + faith = { trait_is_virtue = diligent } + NOT = { has_character_flag = virtue_diligent } + } + modifier = { + scope:court_chaplain = { has_trait = diligent } + factor = 10 + } + add_character_flag = virtue_diligent + } + 1 = { + trigger = { + faith = { trait_is_virtue = generous } + NOT = { has_character_flag = virtue_generous } + } + modifier = { + scope:court_chaplain = { has_trait = generous } + factor = 10 + } + add_character_flag = virtue_generous + } + } +} + +learning_theology_2020_randomize_bad_virtue_options_effect = { + random_list = { + 1 = { + trigger = { + faith = { NOT = { trait_is_virtue = brave } } + NOT = { has_character_flag = virtue_brave } + } + add_character_flag = virtue_brave + } + 1 = { + trigger = { + faith = { NOT = { trait_is_virtue = just } } + NOT = { has_character_flag = virtue_just } + } + add_character_flag = virtue_just + } + 1 = { + trigger = { + faith = { NOT = { trait_is_virtue = temperate } } + NOT = { has_character_flag = virtue_temperate } + } + add_character_flag = virtue_temperate + } + 1 = { + trigger = { + faith = { NOT = { trait_is_virtue = chaste } } + NOT = { has_character_flag = virtue_chaste } + } + add_character_flag = virtue_chaste + } + 1 = { + trigger = { + faith = { NOT = { trait_is_virtue = compassionate } } + NOT = { has_character_flag = virtue_compassionate } + } + add_character_flag = virtue_compassionate + } + 1 = { + trigger = { + faith = { NOT = { trait_is_virtue = honest } } + NOT = { has_character_flag = virtue_honest } + } + add_character_flag = virtue_honest + } + 1 = { + trigger = { + faith = { NOT = { trait_is_virtue = forgiving } } + NOT = { has_character_flag = virtue_forgiving } + } + add_character_flag = virtue_forgiving + } + 1 = { + trigger = { + faith = { NOT = { trait_is_virtue = wrathful } } + NOT = { has_character_flag = virtue_wrathful } + } + add_character_flag = virtue_wrathful + } + 1 = { + trigger = { + faith = { NOT = { trait_is_virtue = vengeful } } + NOT = { has_character_flag = virtue_vengeful } + } + add_character_flag = virtue_vengeful + } + 1 = { + trigger = { + faith = { NOT = { trait_is_virtue = content } } + NOT = { has_character_flag = virtue_content } + } + add_character_flag = virtue_content + } + 1 = { + trigger = { + faith = { NOT = { trait_is_virtue = patient } } + NOT = { has_character_flag = virtue_patient } + } + add_character_flag = virtue_patient + } + 1 = { + trigger = { + faith = { NOT = { trait_is_virtue = calm } } + NOT = { has_character_flag = virtue_calm } + } + add_character_flag = virtue_calm + } + 1 = { + trigger = { + faith = { NOT = { trait_is_virtue = humble } } + NOT = { has_character_flag = virtue_humble } + } + add_character_flag = virtue_humble + } + 1 = { + trigger = { + faith = { NOT = { trait_is_virtue = diligent } } + NOT = { has_character_flag = virtue_diligent } + } + add_character_flag = virtue_diligent + } + 1 = { + trigger = { + faith = { NOT = { trait_is_virtue = generous } } + NOT = { has_character_flag = virtue_generous } + } + add_character_flag = virtue_generous + } + 1 = { + trigger = { + faith = { NOT = { trait_is_virtue = greedy } } + NOT = { has_character_flag = virtue_greedy } + } + add_character_flag = virtue_greedy + } + 1 = { + trigger = { + faith = { NOT = { trait_is_virtue = lustful } } + NOT = { has_character_flag = virtue_lustful } + } + add_character_flag = virtue_lustful + } + 1 = { + trigger = { + faith = { NOT = { trait_is_virtue = ambitious } } + NOT = { has_character_flag = virtue_ambitious } + } + add_character_flag = virtue_ambitious + } + 1 = { + trigger = { + faith = { NOT = { trait_is_virtue = gluttonous } } + NOT = { has_character_flag = virtue_gluttonous } + } + add_character_flag = virtue_gluttonous + } + } +} + +learning_theology_2020_tooltip_effect = { + show_as_tooltip = { + random_list = { + 1 = { #GREAT + desc = learning_theology.2020.success.desc + show_chance = no + add_piety = medium_piety_gain + reverse_add_opinion = { + target = scope:court_chaplain + modifier = kindness_opinion + opinion = 30 + } + } + 1 = { #GOOD + desc = learning_theology.2020.neutral.desc + show_chance = no + add_piety = medium_piety_gain + } + 1 = { #BAD + desc = learning_theology.2020.failure.desc + show_chance = no + reverse_add_opinion = { + target = scope:court_chaplain + modifier = insulted_opinion + opinion = -15 + } + } + } + } +} + +learning_theology_special_1001_doctrine_effect = { + if = { + limit = { + exists = scope:female_adultery_doctrine + } + faith = { + if = { + limit = { + has_doctrine = doctrine_adultery_women_crime + } + remove_doctrine = doctrine_adultery_women_crime + } + else_if = { + limit = { + has_doctrine = doctrine_adultery_women_shunned + } + remove_doctrine = doctrine_adultery_women_shunned + } + + add_doctrine = doctrine_adultery_women_accepted + } + } + else_if = { + limit = { + exists = scope:male_adultery_doctrine + } + faith = { + if = { + limit = { + has_doctrine = doctrine_adultery_men_crime + } + remove_doctrine = doctrine_adultery_men_crime + } + else_if = { + limit = { + has_doctrine = doctrine_adultery_men_shunned + } + remove_doctrine = doctrine_adultery_men_shunned + } + + add_doctrine = doctrine_adultery_men_accepted + } + } + else_if = { + limit = { + exists = scope:homosexuality_doctrine + } + faith = { + if = { + limit = { + has_doctrine = doctrine_homosexuality_crime + } + remove_doctrine = doctrine_homosexuality_crime + } + else_if = { + limit = { + has_doctrine = doctrine_homosexuality_shunned + } + remove_doctrine = doctrine_homosexuality_shunned + } + + add_doctrine = doctrine_homosexuality_accepted + } + } + else_if = { + limit = { + exists = scope:kinslyaing_doctrine + } + faith = { + if = { + limit = { + has_doctrine = doctrine_kinslaying_any_dynasty_member_crime + } + remove_doctrine = doctrine_kinslaying_any_dynasty_member_crime + } + else_if = { + limit = { + has_doctrine = doctrine_kinslaying_extended_family_crime + } + remove_doctrine = doctrine_kinslaying_extended_family_crime + } + else_if = { + limit = { + has_doctrine = doctrine_kinslaying_close_kin_crime + } + remove_doctrine = doctrine_kinslaying_close_kin_crime + } + else_if = { + limit = { + has_doctrine = doctrine_kinslaying_shunned + } + remove_doctrine = doctrine_kinslaying_shunned + } + + add_doctrine = doctrine_kinslaying_accepted + } + } + else_if = { + limit = { + exists = scope:witchcraft_doctrine + } + faith = { + if = { + limit = { + has_doctrine = doctrine_witchcraft_crime + } + remove_doctrine = doctrine_witchcraft_crime + } + else_if = { + limit = { + has_doctrine = doctrine_witchcraft_shunned + } + remove_doctrine = doctrine_witchcraft_shunned + } + + add_doctrine = doctrine_witchcraft_accepted + } + } + else_if = { + limit = { + exists = scope:consanguinity_doctrine + } + faith = { + if = { + limit = { + has_doctrine = doctrine_consanguinity_restricted + } + remove_doctrine = doctrine_consanguinity_restricted + } + else_if = { + limit = { + has_doctrine = doctrine_consanguinity_cousins + } + remove_doctrine = doctrine_consanguinity_cousins + } + else_if = { + limit = { + has_doctrine = doctrine_consanguinity_aunt_nephew_and_uncle_niece + } + remove_doctrine = doctrine_consanguinity_aunt_nephew_and_uncle_niece + } + + add_doctrine = doctrine_consanguinity_unrestricted + } + } + faith = { + change_fervor = { + value = medium_fervor_loss + desc = fervor_loss_theology_doctrine_change + } + set_variable = { + name = variable_changed_doctrine_learning_theology_special_1001 + value = yes + years = 250 + } + } +} + + +medicine_2050_soldier_saving_effect = { + add_courtier = scope:soldier + add_hook = { + target = scope:soldier + type = loyalty_hook + } + hidden_effect = { + scope:soldier = { + change_trait_rank = { + trait = wounded + rank = -1 + } + add_character_modifier = { + modifier = risky_wound_treatment_success_modifier + days = wound_treatment_success_duration + } + trigger_event = { + id = health.4999 #Sends health.4001 to me or 4002 to liege + days = wound_treatment_success_duration_plus_1 + } + } + } +} + +medicine_2050_a_success_effect = { + if = { + limit = { NOT = { has_relation_friend = scope:helper } } + set_relation_friend = { reason = friend_saved_life_together target = scope:helper } + } + add_learning_lifestyle_xp = minor_lifestyle_xp + medicine_2050_soldier_saving_effect = yes +} + +medicine_2050_a_failure_effect = { + scope:soldier = { + death = { + death_reason = death_wounds + } + } + if = { + limit = { ai_compassion >= 0 } + stress_impact = { + base = minor_stress_impact_gain + compassionate = minor_stress_impact_gain + } + } +} + +medicine_2050_b_failure_effect = { + scope:soldier = { + death = { + death_reason = death_treatment + killer = root + } + } + if = { + limit = { ai_compassion > 0 } + stress_impact = { + base = minor_stress_impact_gain + compassionate = minor_stress_impact_gain + } + } +} + +medicine_2050_b_success_effect = { + add_learning_lifestyle_xp = major_lifestyle_xp + medicine_2050_soldier_saving_effect = yes +} + + +theology_3011_a_success_effect = { + if = { + limit = { NOT = { has_relation_friend = scope:believer } } + set_relation_friend = { reason = friend_convinced_merchants_to_invest_in_church target = scope:believer } + } + add_learning_lifestyle_xp = minor_lifestyle_xp + scope:temple_county = { + if = { + limit = { + has_building = temple_01 + } + add_building = temple_02 + } + else_if = { + limit = { + has_building = temple_02 + } + add_building = temple_03 + } + else_if = { + limit = { + has_building = temple_03 + } + add_building = temple_04 + } + } +} + +theology_3011_a_failure_effect = { + scope:temple_county = { + county = { #temple_county is in fact not a county but a province. + add_county_modifier = { + modifier = modifier_dusgruntled_church + years = 25 + } + } + } +} + +theology_3021_a_success_effect = { + if = { + limit = { + exists = scope:believer + NOT = { has_relation_friend = scope:believer } + } + set_relation_friend = { reason = friend_wrote_letter_together target = scope:believer } + } + add_learning_lifestyle_xp = minor_lifestyle_xp + scope:compliment_receiver = { + add_opinion = { + target = root + modifier = respect_opinion + opinion = 20 + } + } +} + +theology_3021_a_failure_effect = { + scope:compliment_receiver = { + add_opinion = { + target = root + modifier = respect_opinion + opinion = -10 + } + } + if = { + limit = { ai_zeal >= 0 } + stress_impact = { + base = minor_stress_impact_gain + zealous = minor_stress_impact_gain + } + } +} + + +learning_theology_3021_outcome_effect = { + if = { + limit = { + exists = scope:believer + has_relation_friend = scope:believer + } + show_as_tooltip = { theology_3021_a_success_effect = yes } + } + else = { + random_list = { + 1 = { + desc = diplomacy_majesty.0004.success.tt + show_chance = no + show_as_tooltip = { theology_3021_a_success_effect = yes } + } + 1 = { + desc = diplomacy_majesty.0004.neutral.tt + show_chance = no + show_as_tooltip = { + add_diplomacy_lifestyle_xp = minor_lifestyle_xp + } + } + 1 = { + desc = diplomacy_majesty.0004.failure.tt + show_chance = no + show_as_tooltip = { theology_3021_a_failure_effect = yes } + } + } + } + + hidden_effect = { + if = { + limit = { + exists = scope:compliment_outcome + scope:compliment_outcome = flag:good + } + trigger_event = { id = learning_theology.3022 days = { 7 14 } } + } + + else_if = { + limit = { + exists = scope:compliment_outcome + scope:compliment_outcome = flag:neutral + } + trigger_event = { id = learning_theology.3023 days = { 7 14 } } + } + + else_if = { + limit = { + exists = scope:compliment_outcome + scope:compliment_outcome = flag:bad + } + trigger_event = { id = learning_theology.3024 days = { 7 14 } } + } + } +} diff --git a/N3OW/common/scripted_effects/00_lifestyle_focus_effects.txt b/N3OW/common/scripted_effects/00_lifestyle_focus_effects.txt new file mode 100644 index 00000000..56659583 --- /dev/null +++ b/N3OW/common/scripted_effects/00_lifestyle_focus_effects.txt @@ -0,0 +1,1066 @@ +#Effects used in Lifestyle Focus events + + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! + +#LIFESTYLE FRIEND EFFECTS +# save_potential_lifestyle_friend_effect + + +#SECONDARY LIFESTYLE EFFECTS +# reveler_lifestyle_rank_up_check_effect +# hunter_lifestyle_rank_up_check_effect +# hunter_progress_point_gain_effect +# physician_lifestyle_rank_up_effect +# mystic_lifestyle_rank_up_effect +# ai_mystic_lifestyle_rank_up_effect + +###################################################################### + + +####################### +# LIFESTYLE FRIEND EFFECTS +####################### + +#Needs FOCUS and SCOPE_NAME +potential_lifestyle_friend_saving_effect = { + hidden_effect = { + save_temporary_scope_as = friend_checker + save_temporary_scope_value_as = { + name = friend_saving_focus + value = flag:$FOCUS$ + } + + #PLAYERS + if = { + limit = { is_ai = no } + + #Add major characters to list + get_characters_of_major_interest_effect = { LISTNAME = lifestyle_friend_list } + + #Step 1: Add characters of minor interest + if = { + limit = { + any_in_list = { + list = lifestyle_friend_list + potential_lifestyle_friend_availability_trigger = { CHARACTER = scope:friend_checker FOCUS = $FOCUS$ } + count = 0 + } + } + + + get_characters_of_minor_interest_effect = { LISTNAME = lifestyle_friend_list } + } + + #Step 2: Randomize if we now have someone suitable + if = { + limit = { + any_in_list = { + list = lifestyle_friend_list + potential_lifestyle_friend_availability_trigger = { CHARACTER = scope:friend_checker FOCUS = $FOCUS$ } + } + } + #Randomize! + random_in_list = { + list = lifestyle_friend_list + limit = { potential_lifestyle_friend_availability_trigger = { CHARACTER = scope:friend_checker FOCUS = $FOCUS$ } } + weight = { + base = 1 + modifier = { + add = $FOCUS$_friend_points + } + modifier = { + has_relation_potential_friend = scope:friend_checker + add = 10 + } + opinion_modifier = { + opinion_target = scope:friend_checker + multiplier = 0.2 + } + } + if = { + limit = { is_ruler = yes } + set_focus = $FOCUS$ + } + save_scope_as = $SCOPE_NAME$ + } + } + #Step 3: Ok, there still was none. Try to force someone to switch focus + else = { + random_in_list = { + list = lifestyle_friend_list + limit = { + is_ruler = yes + opinion = { + target = scope:friend_checker + value >= 0 + } + this != root + trigger_if = { + limit = { + scope:friend_saving_focus = flag:diplomacy_foreign_affairs_focus + scope:friend_saving_focus = flag:diplomacy_majesty_focus + scope:friend_saving_focus = flag:diplomacy_family_focus + } + diplomacy >= decent_skill_rating + } + trigger_else_if = { + limit = { + scope:friend_saving_focus = flag:martial_strategy_focus + scope:friend_saving_focus = flag:martial_authority_focus + } + martial >= decent_skill_rating + } + trigger_else_if = { + limit = { + scope:friend_saving_focus = flag:martial_chivalry_focus + } + prowess >= decent_skill_rating + } + trigger_else_if = { + limit = { + scope:friend_saving_focus = flag:stewardship_wealth_focus + scope:friend_saving_focus = flag:stewardship_domain_focus + scope:friend_saving_focus = flag:stewardship_duty_focus + } + stewardship >= decent_skill_rating + } + trigger_else_if = { + limit = { + scope:friend_saving_focus = flag:intrigue_skulduggery_focus + scope:friend_saving_focus = flag:intrigue_temptation_focus + scope:friend_saving_focus = flag:intrigue_intimidation_focus + } + intrigue >= decent_skill_rating + } + trigger_else_if = { + limit = { + scope:friend_saving_focus = flag:learning_medicine_focus + scope:friend_saving_focus = flag:learning_scholarship_focus + scope:friend_saving_focus = flag:learning_theology_focus + } + learning >= decent_skill_rating + } + # making the default behavior explicit if no other trigger_(else_)ifs are valid + trigger_else = { + always = yes + } + } + weight = { + base = 1 + modifier = { + has_relation_potential_friend = scope:friend_checker + add = 10 + } + opinion_modifier = { + opinion_target = scope:friend_checker + multiplier = 0.2 + } + } + set_focus = $FOCUS$ + save_scope_as = $SCOPE_NAME$ + } + } + } + + #AI + else = { + every_vassal = { + limit = { potential_lifestyle_friend_availability_trigger = { CHARACTER = scope:friend_checker FOCUS = $FOCUS$ } } + add_to_temporary_list = lifestyle_friend_list + } + every_liege_or_above = { + limit = { potential_lifestyle_friend_availability_trigger = { CHARACTER = scope:friend_checker FOCUS = $FOCUS$ } } + add_to_temporary_list = lifestyle_friend_list + } + every_courtier = { + limit = { potential_lifestyle_friend_availability_trigger = { CHARACTER = scope:friend_checker FOCUS = $FOCUS$ } } + add_to_temporary_list = lifestyle_friend_list + } + random_in_list = { + list = lifestyle_friend_list + save_scope_as = $SCOPE_NAME$ + } + } + + #FALLBACK GENERATION + if = { + limit = { NOT = { exists = scope:$SCOPE_NAME$ } } + + if = { + limit = { exists = scope:friend_checker.capital_province } + create_character = { + location = scope:friend_checker.capital_province + template = $FOCUS$_friend_template + save_scope_as = $SCOPE_NAME$ + after_creation = { + add_character_flag = created + } + } + } + else = { + create_character = { + location = scope:friend_checker.location + template = $FOCUS$_friend_template + save_scope_as = $SCOPE_NAME$ + after_creation = { + add_character_flag = created + } + } + } + scope:$SCOPE_NAME$ = { visit_court_of = scope:friend_checker } + } + } +} + + +######################## +# SECONDARY LIFESTYLE EFFECTS +######################## +#Reveler (gained by feasts) +reveler_points_gain_effect = { + if = { + limit = { NOT = { has_variable = reveler_lifestyle_progress } } + set_variable = { + name = reveler_lifestyle_progress + value = $CHANGE$ + } + } + else = { + change_variable = { + name = reveler_lifestyle_progress + add = $CHANGE$ + } + } + #Random chance of additional increase to increase unpredictability + random = { + chance = 50 + change_variable = { + name = reveler_lifestyle_progress + add = $RANDOM_CHANGE$ + } + } + #Extra Random chance with the Festivities Tradition + if = { + limit = { + culture = { has_cultural_parameter = reveler_traits_more_common } + } + random = { + chance = 75 + change_variable = { + name = reveler_lifestyle_progress + add = 1 + } + } + } +} + +reveler_lifestyle_rank_up_check_effect = { + if = { + limit = { + NOT = { has_trait = lifestyle_reveler } + } + random = { + chance = 15 + modifier = { + add = -10 + faith = { trait_is_sin = lifestyle_reveler } + } + modifier = { + add = -10 + has_trait = temperate + } + modifier = { + add = -10 + has_trait = inappetetic + } + modifier = { + add = 10 + culture = { has_cultural_parameter = reveler_traits_more_valued } + } + modifier = { + add = 5 + has_trait = gluttonous + } + modifier = { + add = 5 + has_trait = drunkard + } + modifier = { + add = 5 + has_trait = comfort_eater + } + modifier = { + add = 15 + exists = var:reveler_lifestyle_progress + var:reveler_lifestyle_progress >= reveler_rank_up_3_threshold + } + modifier = { + add = 15 + exists = var:reveler_lifestyle_progress + var:reveler_lifestyle_progress >= reveler_rank_up_2_threshold + } + modifier = { + add = 15 + exists = var:reveler_lifestyle_progress + var:reveler_lifestyle_progress >= reveler_rank_up_1_threshold + } + trigger_event = feast.0050 + show_as_tooltip = { + add_trait = lifestyle_reveler + } + } + } + else = { + if = { + limit = { + NOT = { has_trait = lifestyle_reveler } + exists = var:reveler_lifestyle_progress + var:reveler_lifestyle_progress >= reveler_rank_up_3_threshold + } + add_trait_xp = { + trait = lifestyle_reveler + value = 10 + } + } + else_if = { + limit = { + exists = var:reveler_lifestyle_progress + var:reveler_lifestyle_progress >= reveler_rank_up_2_threshold + } + add_trait_xp = { + trait = lifestyle_reveler + value = 5 + } + } + else_if = { + limit = { + exists = var:reveler_lifestyle_progress + var:reveler_lifestyle_progress >= reveler_rank_up_1_threshold + } + add_trait_xp = { + trait = lifestyle_reveler + value = 3 + } + } + else = { + add_trait_xp = { + trait = lifestyle_reveler + value = 1 + } + } + set_variable = { + name = reveler_lifestyle_progress + value = 0 + } + } +} + +#Hunter (gained by hunting) +hunter_progress_point_gain_effect = { + if = { + limit = { is_alive = yes } + if = { + limit = { + NOT = { exists = var:hunter_lifestyle_progress } + } + set_variable = { + name = hunter_lifestyle_progress + value = $CHANGE$ + } + } + else = { + change_variable = { + name = hunter_lifestyle_progress + add = $CHANGE$ + } + } + save_scope_value_as = { + name = hunt_base_increase + value = $CHANGE$ + } + # Tooltips + if = { + limit = { scope:hunt_base_increase <= 1 } + custom_tooltip = hunt_progress_towards_trait_1_tt + } + else_if = { + limit = { scope:hunt_base_increase = 2 } + custom_tooltip = hunt_progress_towards_trait_2_tt + } + else = { custom_tooltip = hunt_progress_towards_trait_3_tt } + #Random chance of additional point to increase unpredictability + hidden_effect = { + random = { + chance = 50 + change_variable = { + name = hunter_lifestyle_progress + add = $RANDOM_CHANGE$ + } + } + } + #Extra Random chance with the Hunters Tradition + if = { + limit = { + culture = { has_cultural_parameter = hunting_traits_more_common } + involved_activity = { + NOT = { + has_activity_option = { category = special_type option = hunt_type_falconry } + } + } + } + random = { + chance = 75 + change_variable = { + name = hunter_lifestyle_progress + add = 1 + } + } + } + else_if = { + limit = { + culture = { has_cultural_parameter = falconer_traits_more_common } + involved_activity = { + has_activity_option = { category = special_type option = hunt_type_falconry } + } + } + random = { + chance = 75 + change_variable = { + name = hunter_lifestyle_progress + add = 1 + } + } + } + } +} + +hunter_lifestyle_rank_up_check_effect = { + save_scope_value_as = { + name = falconry + value = $FALCONRY$ + } + if = { + limit = { + is_alive = yes + NOT = { has_trait = lifestyle_hunter } + exists = var:hunter_lifestyle_progress + } + add_trait = lifestyle_hunter + } + else_if = { # To show host trait gain for guests + limit = { + is_alive = yes + exists = var:hunter_lifestyle_progress + NOT = { has_character_flag = host_existing_hunter } + } + add_trait_force_tooltip = lifestyle_hunter + } + if = { + limit = { + is_alive = yes + exists = var:hunter_lifestyle_progress + has_trait = lifestyle_hunter + scope:falconry = yes + } + send_interface_toast = { + title = hunter_xp_gain_message + if = { + limit = { var:hunter_lifestyle_progress >= hunter_rank_up_3_threshold } + add_trait_xp = { + trait = lifestyle_hunter + track = falconer + value = 15 + } + } + else_if = { + limit = { var:hunter_lifestyle_progress >= hunter_rank_up_2_threshold } + add_trait_xp = { + trait = lifestyle_hunter + track = falconer + value = 10 + } + } + else_if = { + limit = { var:hunter_lifestyle_progress >= hunter_rank_up_1_threshold } + add_trait_xp = { + trait = lifestyle_hunter + track = falconer + value = 5 + } + } + else = { + add_trait_xp = { + trait = lifestyle_hunter + track = falconer + value = 3 + } + } + } + } + else_if = { + limit = { + is_alive = yes + exists = var:hunter_lifestyle_progress + has_trait = lifestyle_hunter + } + send_interface_toast = { + title = hunter_xp_gain_message + if = { + limit = { var:hunter_lifestyle_progress >= hunter_rank_up_3_threshold } + add_trait_xp = { + trait = lifestyle_hunter + track = hunter + value = 15 + } + } + else_if = { + limit = { var:hunter_lifestyle_progress >= hunter_rank_up_2_threshold } + add_trait_xp = { + trait = lifestyle_hunter + track = hunter + value = 10 + } + } + else_if = { + limit = { var:hunter_lifestyle_progress >= hunter_rank_up_1_threshold } + add_trait_xp = { + trait = lifestyle_hunter + track = hunter + value = 5 + } + } + else = { + add_trait_xp = { + trait = lifestyle_hunter + track = hunter + value = 3 + } + } + } + } + set_variable = { + name = hunter_lifestyle_progress + value = 0 + } +} + +#Physician (for AI, gained through treatment events) +physician_lifestyle_rank_up_effect = { + if = { + limit = { + NOT = { has_trait = lifestyle_physician } + } + add_trait = lifestyle_physician + } + else_if = { + limit = { + has_trait_xp = { + trait = lifestyle_physician + value < 100 + } + } + add_trait_xp = { + trait = lifestyle_physician + value = 10 + } + } +} + + +#Blademaster (for AI, gained through knight events) +blademaster_lifestyle_rank_up_effect = { + if = { + limit = { + NOT = { has_trait = lifestyle_blademaster } + } + add_trait = lifestyle_blademaster + } + else_if = { + limit = { + has_trait_xp = { + trait = lifestyle_blademaster + value < 100 + } + } + add_trait_xp = { + trait = lifestyle_blademaster + value = 10 + } + } +} + +# Mystic +mystic_lifestyle_rank_up_effect = { + if = { + limit = { + NOT = { has_trait = lifestyle_mystic } + } + add_trait = lifestyle_mystic + } + else = { + add_trait_xp = { + trait = lifestyle_mystic + value = 10 + } + } +} + +mystic_lifestyle_point_gain_effect = { + # Expects VALUE + + # Tooltip stuff first: + show_as_tooltip = { + if = { + limit = { # No further rank ups if you're already at max + NAND = { + has_trait = lifestyle_mystic + has_trait_xp = { + trait = lifestyle_mystic + value >= 100 + } + } + exists = var:mystic_lifestyle_progress # This assumes you can never progress the lifestyle on the first point gain + } + # Show rank-up tooltip if relevant + if = { + limit = { + has_trait = lifestyle_mystic + has_trait_xp = { + trait = lifestyle_mystic + value >= 100 + } + } + set_local_variable = { + name = mystic_check_tooltip_value + value = mystic_second_rank_up_threshold + } + } + else = { + set_local_variable = { + name = mystic_check_tooltip_value + value = mystic_first_rank_up_threshold + } + } + change_local_variable = { + name = mystic_check_tooltip_value + subtract = $VALUE$ + } + if = { + limit = { + trigger_if = { # If Mystic 2, use the higher threshold + limit = { + AND = { + has_trait = lifestyle_mystic + has_trait_xp = { + trait = lifestyle_mystic + value >= 50 + } + has_trait_xp = { + trait = lifestyle_mystic + value < 100 + } + } + } + var:mystic_lifestyle_progress >= local_var:mystic_check_tooltip_value + } + trigger_else = { + var:mystic_lifestyle_progress >= mystic_first_rank_up_threshold + } + } + mystic_lifestyle_rank_up_effect = yes + } + } + } + # Actually run the lifestyle experience/rank-up gain effect: + hidden_effect = { + if = { + limit = { # No further rank ups if you're already at max + NAND = { + has_trait = lifestyle_mystic + has_trait_xp = { + trait = lifestyle_mystic + value >= 100 + } + } + } + if = { + limit = { + NOT = { exists = var:mystic_lifestyle_progress } + } + set_variable = { + name = mystic_lifestyle_progress + value = $VALUE$ + } + } + else = { + change_variable = { + name = mystic_lifestyle_progress + add = $VALUE$ + } + } + + # Rank up if relevant + if = { + limit = { + trigger_if = { # If Mystic 2, use the higher threshold + limit = { + has_trait = lifestyle_mystic + has_trait_xp = { + trait = lifestyle_mystic + value >= 50 + } + } + var:mystic_lifestyle_progress >= mystic_second_rank_up_threshold + } + trigger_else = { + var:mystic_lifestyle_progress >= mystic_first_rank_up_threshold + } + } + mystic_lifestyle_rank_up_effect = yes + # Remove the variable if you reach max rank + if = { + limit = { + has_trait = lifestyle_mystic + has_trait_xp = { + trait = lifestyle_mystic + value >= 100 + } + } + remove_variable = mystic_lifestyle_progress + } + # Set the variable back to 0 if you've ranked up + else = { + set_variable = { + name = mystic_lifestyle_progress + value = 0 + } + } + } + } + } +} + +mystical_communion_outcome_effect = { + # Limited to 2 effect lines due to showing up in a toast + add_learning_lifestyle_xp = major_lifestyle_xp + add_character_modifier = { + modifier = divine_guidance_modifier + years = 5 + } + if = { + limit = { + has_trait = lifestyle_mystic + } + add_trait_xp = { + trait = lifestyle_mystic + value = lifestyle_mystic_xp_gain_minor_value + } + } +} + +#Mystic (for AI, gained through treatment events) +ai_mystic_lifestyle_rank_up_effect = { + if = { + limit = { + NOT = { has_trait = lifestyle_mystic } + } + add_trait = lifestyle_mystic + } + else = { + add_trait_xp = { + trait = lifestyle_mystic + value = 10 + } + } +} + +# Remove all perk-unlocked traits when resetting +remove_all_perk_lifestyle_traits_effect = { + if = { + limit = { + has_trait = diplomat + } + remove_trait = diplomat + } + if = { + limit = { + has_trait = family_first + } + remove_trait = family_first + } + if = { + limit = { + has_trait = august + } + remove_trait = august + } + if = { + limit = { + has_trait = strategist + } + remove_trait = strategist + } + if = { + limit = { + has_trait = overseer + } + remove_trait = overseer + } + if = { + limit = { + has_trait = gallant + } + remove_trait = gallant + } + if = { + limit = { + has_trait = architect + } + remove_trait = architect + } + if = { + limit = { + has_trait = administrator + } + remove_trait = administrator + } + if = { + limit = { + has_trait = avaricious + } + remove_trait = avaricious + } + if = { + limit = { + has_trait = schemer + } + remove_trait = schemer + } + if = { + limit = { + has_trait = seducer + } + remove_trait = seducer + } + if = { + limit = { + has_trait = torturer + } + remove_trait = torturer + } + if = { + limit = { + has_trait = whole_of_body + } + remove_trait = whole_of_body + } + if = { + limit = { + has_trait = scholar + } + remove_trait = scholar + } + if = { + limit = { + has_trait = theologian + } + remove_trait = theologian + } + if = { + limit = { + has_trait = lifestyle_surveyor + } + remove_trait = lifestyle_surveyor + } + if = { + limit = { + has_trait = lifestyle_wayfarer + } + remove_trait = lifestyle_wayfarer + } + if = { + limit = { + has_trait = lifestyle_voyager + } + remove_trait = lifestyle_voyager + } + hidden_effect = { + set_absolute_country_control = no + } +} + +#If you don't have a lifestyle focus, this will yield xp in a random lifestyle +##Takes the amount of _lifestyle_xp you want to hand out as an argument, from the scripted values +add_focused_lifestyle_xp_effect = { + if = { + limit = { has_lifestyle = diplomacy_lifestyle } + add_diplomacy_lifestyle_xp = $AMOUNT$_lifestyle_xp + } + else_if = { + limit = { has_lifestyle = martial_lifestyle } + add_martial_lifestyle_xp = $AMOUNT$_lifestyle_xp + } + else_if = { + limit = { has_lifestyle = stewardship_lifestyle } + add_stewardship_lifestyle_xp = $AMOUNT$_lifestyle_xp + } + else_if = { + limit = { has_lifestyle = intrigue_lifestyle } + add_intrigue_lifestyle_xp = $AMOUNT$_lifestyle_xp + } + else_if = { + limit = { has_lifestyle = learning_lifestyle } + add_learning_lifestyle_xp = $AMOUNT$_lifestyle_xp + } + else_if = { + limit = { has_lifestyle = wanderer_lifestyle } + add_wanderer_lifestyle_xp = $AMOUNT$_lifestyle_xp + } + else = { + random_list = { + 10 = { add_diplomacy_lifestyle_xp = $AMOUNT$_lifestyle_xp } + 10 = { add_martial_lifestyle_xp = $AMOUNT$_lifestyle_xp } + 10 = { add_stewardship_lifestyle_xp = $AMOUNT$_lifestyle_xp } + 10 = { add_intrigue_lifestyle_xp = $AMOUNT$_lifestyle_xp } + 10 = { add_learning_lifestyle_xp = $AMOUNT$_lifestyle_xp } + # Excludes wanderer since it's picked less often + } + } +} + +ai_chance_to_switch_to_travel_focus_effect = { + if = { + limit = { + is_ai = yes + is_adult = yes + is_at_war = no + is_landed = yes + has_bp3_dlc_trigger = yes + gold >= minor_gold_value + highest_held_title_tier >= tier_county + has_completed_one_tree_in_current_lifestyle_trigger = yes + NOR = { + has_focus = wanderer_internal_affairs_focus + has_focus = wanderer_journey_focus + has_focus = wanderer_destination_focus + has_trait = reclusive + is_incapable = yes + has_character_modifier = isolating_modifier + } + } + random = { + chance = { + value = 5 + if = { + limit = { + has_completed_current_lifestyle_trigger = yes # No good reason to stick with your lifestyle + } + add = 75 + } + if = { + limit = { + has_trait_xp = { + trait = lifestyle_traveler + track = travel + value >= 25 + } + } + add = 20 + } + if = { + limit = { + has_trait_xp = { + trait = lifestyle_traveler + track = travel + value >= 50 + } + } + add = 20 + } + if = { # Busy doing.. other things + limit = { + has_focus = intrigue_temptation_focus + } + add = -20 + } + if = { # Wants to get away + limit = { + has_trait = shy + } + add = { + value = root.perk_points_assigned + multiply = 3 + } + } + if = { # Very stressed + limit = { + stress >= 150 + } + add = { + value = root.perk_points_assigned + multiply = 3 + } + } + if = { # Has an adventurous sort of personality + limit = { + ai_sociability >= 50 + ai_boldness >= 0 + } + add = { + value = root.perk_points_assigned + multiply = 3 + } + } + } + random_list = { + 1 = { # Stewards and realm-focused character + modifier = { + add = 99 + OR = { + ai_has_economical_boom_personality = yes + has_focus_stewardship = yes + has_trait = greedy + } + } + set_focus = wanderer_internal_affairs_focus + } + 1 = { # Stressed or asocial characters + modifier = { + add = 99 + OR = { + stress >= 50 + ai_sociability <= -25 + } + NOT = { + has_trait = impatient + } + } + modifier = { + add = 100 + stress >= 150 + NOT = { + has_trait = impatient + } + } + set_focus = wanderer_journey_focus + } + 1 = { # Learning focused self-improvement characters + modifier = { + add = 99 + OR = { + has_focus_learning = yes + has_trait = impatient + has_trait = ambitious + } + } + set_focus = wanderer_destination_focus + } + } + } + } +} + diff --git a/N3OW/common/scripted_effects/00_lover_effects.txt b/N3OW/common/scripted_effects/00_lover_effects.txt new file mode 100644 index 00000000..d3850902 --- /dev/null +++ b/N3OW/common/scripted_effects/00_lover_effects.txt @@ -0,0 +1,148 @@ + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! + + +##################################################################### +# EFFECTS +##################################################################### + + +lover_breakup_rivalry_chance_effect = { + random = { + chance = 1 + compare_modifier = { + value = ai_vengefulness + multiplier = 0.5 + } + modifier = { + add = 25 + scope:breaker = { + any_secret = { + type = secret_lover + secret_target != scope:lover + is_known_by = scope:lover + } + } + } + modifier = { + add = 20 + has_trait = paranoid + } + modifier = { + add = 15 + has_trait = stubborn + } + + scope:breaker = { + every_consort = { + limit = { + this != scope:lover + NOR = { + has_relation_rival = scope:lover + has_relation_friend = scope:lover + } + } + add_to_list = other_lovers + } + every_relation = { + type = lover + limit = { + this != scope:lover + NOR = { + has_relation_rival = scope:lover + has_relation_friend = scope:lover + } + } + add_to_list = other_lovers + } + } + random_in_list = { + list = other_lovers + weight = { + base = 1 + #More likely to pick another known Lover + modifier = { + add = 3 + has_relation_lover = scope:breaker + save_temporary_scope_as = lover_check + scope:breaker = { + OR = { + NOT = { + any_secret = { + type = secret_lover + secret_target = scope:lover_check + NOT = { is_known_by = scope:lover } + } + } + any_secret = { + type = secret_lover + secret_target = scope:lover_check + is_known_by = scope:lover + } + } + } + } + } + save_scope_as = other_lover + } + } +} + + +remove_lover_or_soulmate_relation_effect = { + if = { + limit = { has_relation_soulmate = $CHARACTER$ } + remove_relation_soulmate = $CHARACTER$ + } + else_if = { + limit = { has_relation_lover = $CHARACTER$ } + remove_relation_lover = $CHARACTER$ + } +} + +lover_breakup_effect = { + $BREAKER$ = { + save_scope_as = breaker + } + $LOVER$ = { + save_scope_as = lover + } + + show_as_tooltip = { + $BREAKER$ = { + remove_lover_or_soulmate_relation_effect = { CHARACTER = $LOVER$ } + } + $LOVER$ = { + add_opinion = { + target = $BREAKER$ + modifier = lover_breakup_opinion + } + } + } + + hidden_effect = { + $LOVER$ = { + if = { + limit = { + is_consort_of = $BREAKER$ + } + trigger_event = lover.0202 #Spouse breakup + } + else_if = { + limit = { + opinion = { + target = $BREAKER$ + value > 0 + } + } + trigger_event = lover.0201 #Normal + } + else = { + trigger_event = lover.0203 #Relieved + } + } + } +} \ No newline at end of file diff --git a/N3OW/common/scripted_effects/00_major_decisions_scripted_effects.txt b/N3OW/common/scripted_effects/00_major_decisions_scripted_effects.txt new file mode 100644 index 00000000..692a9391 --- /dev/null +++ b/N3OW/common/scripted_effects/00_major_decisions_scripted_effects.txt @@ -0,0 +1,3697 @@ +create_roman_empire_scripted_effect = { + primary_title = { save_scope_as = old_primary_title } + add_trait = augustus + if = { + limit = { has_dlc_feature = legends } + create_legend_seed = { + type = legitimizing + quality = illustrious + chronicle = new_title + properties = { + title = title:h_roman_empire + founder = root + } + } + } + #Create Roman Empire, shift dejure/history/laws, destroy e_byzantium. + + if = { + limit = { capital_county = { this = title:c_byzantion } } + title:h_roman_empire = { + set_capital_county = title:c_byzantion + } + } + + hidden_effect = { + every_held_title = { #Should shift all dejure of all Empires owned at the time. + title_tier = empire + + set_de_jure_liege_title = title:h_roman_empire + } + every_empire = { + limit = { + NOT = { exists = hegemony } + any_de_jure_county = { + percent >= 0.6 + holder = { + OR = { + this = root + any_liege_or_above = { this = root } + } + } + } + } + set_de_jure_liege_title = title:h_roman_empire + } + } + split_byzantine_empire_effect = yes + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + title:h_roman_empire = { + change_title_holder = { + holder = root + change = scope:change + } + copy_title_history = title:e_byzantium + } + resolve_title_and_vassal_change = scope:change + if = { # Move your Title MaAs to your new title if you have any + limit = { + government_allows = administrative + primary_title = { + any_title_maa_regiment = { } + } + } + hidden_effect = { + primary_title = { transfer_title_maa_ownership = title:h_roman_empire } + } + } + if = { # If you have founded the Varangian Guard, you get to keep the benefits + limit = { + scope:old_primary_title = { has_variable = founded_varangian_guard } + } + hidden_effect = { + title:h_roman_empire = { set_variable = founded_varangian_guard } + } + } + hidden_effect = { set_primary_title_to = title:h_roman_empire } + every_held_title = { #Should destroy all other Empires owned at the time. + title_tier = empire + + root = { destroy_title = prev } + } + + if = { #Automatically move capital to Constantinople, unless it's been set to Rome. + limit = { + NOT = { capital_county = { this = title:c_roma } } + NOT = { capital_county = { this = title:c_byzantion } } + culture = { has_cultural_pillar = heritage_byzantine } + } + hidden_effect = { + if = { #Usurp if not held personally. + limit = { + NOT = { this = title:c_byzantion.holder } + } + create_title_and_vassal_change = { + type = returned + save_scope_as = change + add_claim_on_loss = no + } + title:c_byzantion = { + change_title_holder = { + holder = root + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + } + } + root = { set_realm_capital = title:c_byzantion } + } + else_if = { + limit = { + NOT = { capital_county = { this = title:c_roma } } + NOT = { capital_county = { this = title:c_byzantion } } + NOT = { culture = { has_cultural_pillar = heritage_byzantine } } + exists = title:h_roman_empire.holder + } + hidden_effect = { + if = { #Usurp if not held personally. + limit = { + NOT = { this = title:c_roma.holder } + } + create_title_and_vassal_change = { + type = returned + save_scope_as = change + add_claim_on_loss = no + } + title:c_roma = { + change_title_holder = { + holder = root + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + } + } + root = { set_realm_capital = title:c_roma } + } + hidden_effect = { + add_character_flag = flag_restorer_of_rome #used for Eulogy. + title:h_roman_empire = { + set_variable = rome_was_restored_by_byzantium + } + } +} + +create_roman_empire_holy_scripted_effect = { + add_trait = augustus + #Create Roman Empire, shift dejure/history/laws, destroy e_hre. + hidden_effect = { + every_held_title = { #Should shift all dejure of all Empires owned at the time. + title_tier = empire + + set_de_jure_liege_title = title:h_roman_empire + } + primary_title = { + if = { + limit = { + any_in_de_jure_hierarchy = { + tier = tier_kingdom + OR = { + title:k_france ?= this + title:k_aquitaine ?= this + title:k_brittany ?= this + } + } + } + every_in_de_jure_hierarchy = { + limit = { + tier = tier_kingdom + OR = { + title:k_france ?= this + title:k_aquitaine ?= this + title:k_brittany ?= this + } + } + set_de_jure_liege_title = title:e_france + title:e_france = { set_de_jure_liege_title = title:h_roman_empire } + } + } + every_in_de_jure_hierarchy = { + limit = { + tier = tier_kingdom + } + set_de_jure_liege_title = title:e_germany + title:e_germany = { set_de_jure_liege_title = title:h_roman_empire } + } + } + every_empire = { + limit = { + NOT = { exists = hegemony } + any_de_jure_county = { + percent >= 0.6 + holder = { + OR = { + this = root + any_liege_or_above = { this = root } + } + } + } + } + set_de_jure_liege_title = title:h_roman_empire + } + } + split_byzantine_empire_effect = yes + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + title:h_roman_empire = { + change_title_holder = { + holder = root + change = scope:change + } + set_variable = { + name = variable_restored_hre #Used for flavor later. + value = yes + } + copy_title_history = title:e_hre + } + resolve_title_and_vassal_change = scope:change + if = { # Move your Title MaAs to your new title if you have any + limit = { + government_allows = administrative + primary_title = { + any_title_maa_regiment = { } + } + } + hidden_effect = { + primary_title = { transfer_title_maa_ownership = title:h_roman_empire } + } + } + if = { # If you have founded the Varangian Guard, you get to keep the benefits (you are not likely to have done it here, but better safe than sorry) + limit = { + primary_title = { has_variable = founded_varangian_guard } + } + hidden_effect = { + title:h_roman_empire = { set_variable = founded_varangian_guard } + } + } + hidden_effect = { set_primary_title_to = title:h_roman_empire } + every_held_title = { #Should destroy all other Empires owned at the time. + title_tier = empire + + root = { destroy_title = prev } + } + hidden_effect = { + title:h_roman_empire = { + set_coa = e_hre_roman + set_title_color = { 255 255 255 } + } + } + + if = { #Automatically move capital to Rome. + limit = { + NOT = { capital_county = { this = title:c_roma } } + exists = title:h_roman_empire.holder + } + hidden_effect = { + if = { #Usurp if not held personally. + limit = { + NOT = { title:c_roma.holder = { this = root } } + } + create_title_and_vassal_change = { + type = returned + save_scope_as = change + add_claim_on_loss = no + } + title:c_roma = { + change_title_holder = { + holder = root + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + } + } + title:h_roman_empire.holder = { set_realm_capital = title:c_roma } + } + hidden_effect = { + create_story = restoring_roman_provinces_story + add_character_flag = flag_restorer_of_rome #used for Eulogy. + } +} + +create_roman_empire_italy_scripted_effect = { + add_trait = augustus + #Create Roman Empire, shift dejure/history/laws, destroy e_italy. + hidden_effect = { + every_held_title = { #Should shift all dejure of all Empires owned at the time. + title_tier = empire + + set_de_jure_liege_title = title:h_roman_empire + } + every_empire = { + limit = { + NOT = { exists = hegemony } + any_de_jure_county = { + percent >= 0.6 + holder = { + OR = { + this = root + any_liege_or_above = { this = root } + } + } + } + } + set_de_jure_liege_title = title:h_roman_empire + } + } + split_byzantine_empire_effect = yes + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + title:h_roman_empire = { + change_title_holder = { + holder = root + change = scope:change + } + set_variable = { + name = variable_restored_italy #Used for flavor later. + value = yes + } + copy_title_history = title:e_italy + } + resolve_title_and_vassal_change = scope:change + if = { # Move your Title MaAs to your new title if you have any + limit = { + government_allows = administrative + primary_title = { + any_title_maa_regiment = { } + } + } + hidden_effect = { + primary_title = { transfer_title_maa_ownership = title:h_roman_empire } + } + } + if = { # If you have founded the Varangian Guard, you get to keep the benefits (you are not likely to have done it here, but better safe than sorry) + limit = { + primary_title = { has_variable = founded_varangian_guard } + } + hidden_effect = { + title:h_roman_empire = { set_variable = founded_varangian_guard } + } + } + hidden_effect = { set_primary_title_to = title:h_roman_empire } + every_held_title = { #Should destroy all other Empires owned at the time. + title_tier = empire + + root = { destroy_title = prev } + } + if = { #Automatically move capital to Rome. + limit = { + NOT = { capital_county = { this = title:c_roma } } + exists = title:h_roman_empire.holder + } + hidden_effect = { + if = { #Usurp if not held personally. + limit = { + NOT = { title:c_roma.holder = { this = root } } + } + create_title_and_vassal_change = { + type = returned + save_scope_as = change + add_claim_on_loss = no + } + title:c_roma = { + change_title_holder = { + holder = root + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + } + } + title:h_roman_empire.holder = { set_realm_capital = title:c_roma } + } + hidden_effect = { + create_story = restoring_roman_provinces_story + add_character_flag = flag_restorer_of_rome #used for Eulogy. + } +} + +split_byzantine_empire_effect = { + hidden_effect = { + title:e_byzantium = { + if = { + limit = { + OR = { + NOT = { exists = holder } + holder ?= root + } + } + every_in_de_jure_hierarchy = { + limit = { + title:e_italy ?= { is_titular = no } + tier = tier_kingdom + OR = { + title:k_trinacria ?= this + title:k_sicily ?= this + title:k_naples ?= this + title:k_venice ?= this + } + } + set_de_jure_liege_title = title:e_italy + title:e_italy = { set_de_jure_liege_title = title:h_roman_empire } + } + every_in_de_jure_hierarchy = { + limit = { + tier = tier_kingdom + OR = { + title:k_trinacria ?= this + title:k_epirus ?= this + title:k_croatia ?= this + title:k_serbia ?= this + title:k_bosnia ?= this + title:k_sicily ?= this + title:k_venice ?= this + title:k_naples ?= this + } + } + set_de_jure_liege_title = title:e_illyria + title:e_illyria = { set_de_jure_liege_title = title:h_roman_empire } + } + every_in_de_jure_hierarchy = { + limit = { + tier = tier_kingdom + OR = { + title:k_thessalonika ?= this + title:k_hellas ?= this + title:k_krete ?= this + title:k_bulgaria ?= this + } + } + set_de_jure_liege_title = title:e_macedonia + title:e_macedonia = { set_de_jure_liege_title = title:h_roman_empire } + } + every_in_de_jure_hierarchy = { + limit = { + tier = tier_kingdom + OR = { + title:k_saruhan ?= this + title:k_tekke ?= this + title:k_trebizond ?= this + title:k_ottoman ?= this + title:k_rum ?= this + title:k_mentese ?= this + title:k_karaman ?= this + title:k_germiyan ?= this + title:k_cyprus ?= this + title:k_eretnid ?= this + title:k_candar ?= this + title:k_nikaea ?= this + title:k_pontus ?= this + title:k_armenia ?= this + title:k_georgia ?= this + title:k_armenian_principality ?= this + title:k_old_armenia ?= this + title:k_anatolia ?= this + title:k_aydin ?= this + } + } + set_de_jure_liege_title = title:e_anatolia + title:e_anatolia = { set_de_jure_liege_title = title:h_roman_empire } + } + every_in_de_jure_hierarchy = { + limit = { + tier = tier_kingdom + } + if = { + limit = { + any_title_to_title_neighboring_and_across_water_empire = { + count >= 1 + } + } + random_title_to_title_neighboring_and_across_water_empire = { + save_scope_as = new_empire_de_jure + } + set_de_jure_liege_title = scope:new_empire_de_jure + } + } + } + } + } +} + +create_eastern_roman_empire_scripted_effect = { + if = { # First we move the domicile of root, if necessary + limit = { + exists = domicile + domicile.domicile_location = { + geographical_region = custom_ep3_restore_rome_eastern_empire + } + } + domicile = { + move_domicile = root.capital_province + } + } + scope:new_holder = { # Secondly, we handle the new liege + add_trait = augustus + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + if = { # We ensure they get Byzantion + limit = { + scope:new_holder != title:c_byzantion.holder + } + title:c_byzantion = { + change_title_holder = { + holder = scope:new_holder + change = scope:change + } + } + } + # We move over the De Jure for all the basic titles + title:e_byzantium ?= { set_de_jure_liege_title = title:h_eastern_roman_empire } + title:e_illyria ?= { set_de_jure_liege_title = title:h_eastern_roman_empire } + title:e_macedonia ?= { set_de_jure_liege_title = title:h_eastern_roman_empire } + title:e_anatolia ?= { set_de_jure_liege_title = title:h_eastern_roman_empire } + title:h_eastern_roman_empire = { # They get the new Roman Empire title + change_title_holder = { + holder = scope:new_holder + change = scope:change + } + } + root = { # They get every held title from current root in the greater region + every_held_title = { + limit = { + tier = tier_county + is_landless_type_title = no + title_province = { geographical_region = custom_ep3_restore_rome_eastern_empire } + } + change_title_holder = { + holder = scope:new_holder + change = scope:change + } + } + } + resolve_title_and_vassal_change = scope:change + set_primary_title_to = title:h_eastern_roman_empire + set_realm_capital = title:c_byzantion + } + + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + # Then all the direct vassals who should move over + every_vassal = { + limit = { + highest_held_title_tier >= tier_county + capital_province = { geographical_region = custom_ep3_restore_rome_eastern_empire } + } + change_liege = { + liege = scope:new_holder + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + # Then vassals who are not directly in line + every_vassal_or_below = { + limit = { + highest_held_title_tier >= tier_county + capital_province = { geographical_region = custom_ep3_restore_rome_eastern_empire } + } + change_liege = { + liege = scope:new_holder + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + + # Then change the de_jure for empires that are de jure part of the Roman Empire, but who has mostly broken free + every_empire = { + limit = { + hegemony ?= title:h_roman_empire + any_de_jure_county = { + percent >= 0.51 + title_province = { + geographical_region = custom_ep3_restore_rome_eastern_empire + } + } + } + set_de_jure_liege_title = title:h_eastern_roman_empire + } + + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + # Then every title that aren't county title held by root, but they have a majority of the titles under their rule + every_held_title = { + limit = { + NOR = { + tier = tier_county + tier = tier_hegemony + this = root.primary_title + } + is_landless_type_title = no + any_de_jure_county = { + percent >= 0.51 + title_province = { + geographical_region = custom_ep3_restore_rome_eastern_empire + } + } + } + change_title_holder = { + holder = scope:new_holder + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + + every_empire = { + limit = { + OR = { + any_de_jure_county = { + percent >= 0.75 + holder = { + OR = { + this = scope:new_holder + any_liege_or_above = { this = scope:new_holder } + } + } + } + AND = { + de_jure_liege = title:h_eastern_roman_empire + any_de_jure_county = { + percent >= 0.51 + holder = { + OR = { + this = scope:new_holder + any_liege_or_above = { this = scope:new_holder } + } + } + } + } + } + } + set_de_jure_liege_title = title:h_eastern_roman_empire + } +} + +mend_great_schism_scripted_effect = { + root.faith = { + if = { #If from obscure branch of Christianity, make it official. + limit = { + root.faith = { NOT = { has_doctrine = special_doctrine_ecumenical_christian } } + } + add_doctrine = special_doctrine_ecumenical_christian + } + change_fervor = { + value = 25 + desc = fervor_gain_mended_schism + } + hidden_effect = { + religion = { + every_faith = { + limit = { + this != religious_head.faith + } + remove_religious_head_title = yes + } + } + } + } + every_player = { #Notify all players of the same Faith. + limit = { + this != root + faith = root.faith + } + trigger_event = roman_restoration.0103 + } + every_ruler = { #Notify rulers of other Christian branches that they are no longer valid and offer chance at conversion. + limit = { + faith.religion = root.faith.religion + faith != root.faith + NOT = { government_has_flag = government_is_theocracy } + this != this.faith.religious_head + faith = { + has_doctrine = special_doctrine_ecumenical_christian + } + } + trigger_event = roman_restoration.0101 + } + every_player = { #Then notify all infidel players that might be around. + limit = { + OR = { + AND = { #Either filthy heretics... + faith.religion = root.faith.religion + faith = { NOT = { has_doctrine = special_doctrine_ecumenical_christian } } + } + faith.religion != root.faith.religion #...Or Heathens. + } + } + trigger_event = roman_restoration.0102 + } + religion:christianity_religion = { + every_faith = { #All main branches of Christianity that were considered Ecumenical are now heresies. + custom = every_ecumenical_christian_faith.tt + limit = { + this.religion = root.faith.religion + has_doctrine = special_doctrine_ecumenical_christian + this != root.faith + } + remove_doctrine = special_doctrine_ecumenical_christian + change_fervor = { + value = -25 + desc = fervor_loss_mended_schism + } + } + } + + set_nickname_effect = { NICKNAME = nick_the_ecumenist } +} + +restore_papacy_scripted_effect = { + save_scope_as = reformer + if = { #Pick your chaplain first. + limit = { + exists = cp:councillor_court_chaplain + cp:councillor_court_chaplain = { faith = faith:catholic } + } + cp:councillor_court_chaplain = { save_scope_as = new_pope } + } + else = { + hidden_effect = { + create_character = { + employer = root + template = religious_leader_character + random_traits = no + save_scope_as = new_pope + } + } + scope:new_pope = { + add_trait = education_learning_3 + add_trait = zealous + add_trait = intellect_good_1 + random_list = { + 1 = { add_trait = lustful } + 1 = { add_trait = chaste } + 1 = { add_trait = wrathful } + 1 = { add_trait = diligent } + 1 = { add_trait = impatient } + 1 = { add_trait = arrogant } + 1 = { add_trait = humble } + 1 = { add_trait = gregarious } + } + random_list = { + 1 = { add_trait = honest } + 1 = { add_trait = ambitious } + 1 = { add_trait = just } + 1 = { add_trait = cynical } + 1 = { add_trait = zealous } + 1 = { add_trait = compassionate } + 1 = { add_trait = stubborn } + } + } + } + create_title_and_vassal_change = { + type = returned + save_scope_as = change + add_claim_on_loss = no + } + title:k_papal_state = { + change_title_holder = { + holder = scope:new_pope + change = scope:change + } + } + title:c_roma = { + change_title_holder = { + holder = scope:new_pope + change = scope:change + } + } + title:d_latium = { + change_title_holder = { + holder = scope:new_pope + change = scope:change + } + } + title:d_spoleto = { + change_title_holder = { + holder = scope:new_pope + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + faith:catholic = { + change_fervor = { + value = 15 + desc = fervor_gain_papacy_restored + } + if = { + limit = { NOT = { has_doctrine = special_doctrine_ecumenical_christian } } + add_doctrine = special_doctrine_ecumenical_christian + } + if = { + limit = { has_doctrine = doctrine_no_head } + hidden_effect = { remove_doctrine = doctrine_no_head } + add_doctrine = doctrine_spiritual_head + } + set_religious_head_title = title:k_papal_state + } +} + +destroy_papacy_scripted_effect = { + save_scope_as = scoped_destroyer + if = { + limit = { exists = title:k_papal_state.holder } + title:k_papal_state.holder = { save_scope_as = scoped_pope } + } + add_piety = massive_piety_gain + root.faith = { + change_fervor = { + value = 50 + desc = fervor_gain_papacy_destroyed + } + } + + # Destroy the papacy title if it exists. + if = { + limit = { + exists = title:k_papal_state + } + destroy_title = title:k_papal_state + } + + # If the Pope exists, they will suffer some kind of humiliating or tragic fate. + if = { + limit = { + exists = scope:scoped_pope + } + if = { + limit = { + faith = { + has_doctrine_parameter = human_sacrifice_active + } + } + scope:scoped_pope = { + death = { + death_reason = death_sacrificed_to_gods + killer = root + } + } + } + else_if = { + limit = { + faith.religion = faith:hellenic_pagan.religion + } + scope:scoped_pope = { + death = { + death_reason = death_crucified + killer = root + } + } + } + else = { + scope:scoped_pope = { set_character_faith = root.faith } + } + + if = { + limit = { scope:scoped_pope.gold > 0 } + scope:scoped_pope = { + hidden_effect = { remove_short_term_gold = scope:scoped_pope.gold } + } + } + } + + # Catholicism is now sad. + faith:catholic = { + change_fervor = { + value = -100 + desc = fervor_loss_papacy_destroyed + } + if = { + limit = { has_doctrine = special_doctrine_ecumenical_christian } + remove_doctrine = special_doctrine_ecumenical_christian + } + if = { + limit = { has_doctrine = doctrine_spiritual_head } + remove_doctrine = doctrine_spiritual_head + hidden_effect = { add_doctrine = doctrine_no_head } + } + } +} + +form_switzerland_scripted_effect = { + save_scope_as = scoped_ruler + title:e_hre.holder = { save_scope_as = scoped_emperor } + title:d_savoie = { save_scope_as = savoy } + title:k_switzerland = { save_scope_as = switzerland } + #De jure shifts. + title:d_currezia = { set_de_jure_liege_title = title:k_switzerland } + title:d_transjurania = { set_de_jure_liege_title = title:k_switzerland } + if = { + limit = { completely_controls = title:d_savoie } + title:d_savoie = { set_de_jure_liege_title = title:k_switzerland } + } + else = { custom_tooltip = form_switzerland_kingdom_decision_effect_tooltip } + title:k_switzerland = { set_de_jure_liege_title = root.top_liege.primary_title } + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + title:k_switzerland = { + change_title_holder = { + holder = root + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + hidden_effect = { set_primary_title_to = title:k_switzerland } + add_prestige = major_prestige_gain + if = { + limit = { + OR = { + has_realm_law = crown_authority_0 + has_realm_law = crown_authority_1 + has_realm_law = crown_authority_2 + } + } + add_realm_law_skip_effects = crown_authority_3 + } +} + +form_austria_scripted_effect = { + #Grab scopes for loc and such. + save_scope_as = scoped_ruler + title:e_hre.holder = { save_scope_as = scoped_emperor } + title:d_carinthia = { save_scope_as = carinthia } + title:d_krain = {save_scope_as = krain } + title:d_istria = { save_scope_as = istria } + title:k_austria = { save_scope_as = austria} + title:d_croatia.de_jure_liege = { save_scope_as = new_controller} + #Hand over k_austria. + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + title:k_austria = { + change_title_holder = { + holder = root + change = scope:change + } + copy_title_history = title:d_osterreich + } + resolve_title_and_vassal_change = scope:change + #Try to make it the primary title, unless it's the Emperor doing this. + hidden_effect = { + if = { + limit = { primary_title.tier <= tier_kingdom } + set_primary_title_to = title:k_austria + } + } + #Save d_austria's current de jure liege for future reference. + title:d_osterreich.de_jure_liege = { save_scope_as = previous_kingdom } + #Transfer custom_core_austria (d_austria & d_steyermark) to the new Archduchy. + hidden_effect = { + title:k_austria = { + set_de_jure_liege_title = scope:previous_kingdom.de_jure_liege + } + + every_county_in_region = { + region = custom_core_austria + duchy = { add_to_list = austrian_heartlands_list } + } + every_in_list = { + list = austrian_heartlands_list + limit = { + NOT = { de_jure_liege = title:k_austria } + } + set_de_jure_liege_title = title:k_austria + } + + } + #Sort Carinthia. + if = { + limit = { completely_controls = title:d_carinthia } + title:d_carinthia = { set_de_jure_liege_title = title:k_austria } + } + else = { custom_tooltip = form_austria_kingdom_decision_effect_stretch_goals_tt } + #Sort d_krain, giving it to k_austria, the de jure liege of d_croatia, or leaving it as-is, depending on if it borders any part of scope:previous_kingdom other than d_istria. + if = { + limit = { + completely_controls = title:d_krain + #d_krain must be part of d_osterreich's former kingdom. + title:d_krain.de_jure_liege = scope:previous_kingdom + } + title:d_krain = { set_de_jure_liege_title = title:k_austria } + } + else_if = { + limit = { + #Krain must be part of d_osterreich's former kingdom. + title:d_krain.de_jure_liege = scope:previous_kingdom + #Cannot border any other part of the former kingdom other than Istria. + NOR = { + title:d_slavonia.de_jure_liege = scope:previous_kingdom + title:d_croatia.de_jure_liege = scope:previous_kingdom + title:d_friuli.de_jure_liege = scope:previous_kingdom + } + #Check d_carinthia separately, since before the effect is run (i.e., in the decision tooltip) its liege will still be scope:previous_kingdom. + completely_controls = title:d_carinthia + } + hidden_effect = { + title:d_krain = { set_de_jure_liege_title = title:d_croatia.de_jure_liege } + save_scope_value_as = { + name = krain_isolated + value = yes + } + } + } + #Sort d_istria, giving it to k_austria, the de jure liege of d_croatia, or leaving it as-is, depending on if it borders any part of scope:previous_kingdom other than d_krain. + if = { + limit = { + completely_controls = title:d_istria + #d_istria must be part of d_osterreich's former kingdom. + title:d_istria.de_jure_liege = scope:previous_kingdom + } + title:d_istria = { set_de_jure_liege_title = title:k_austria } + } + else_if = { + limit = { + #d_istria must be part of d_osterreich's former kingdom. + title:d_istria.de_jure_liege = scope:previous_kingdom + #Cannot border any other part of the former kingdom. + NOR = { + title:d_croatia.de_jure_liege = scope:previous_kingdom + title:d_friuli.de_jure_liege = scope:previous_kingdom + } + #Check d_krain separately, since before the effect is run (i.e., in the decision tooltip) its liege will still be scope:previous_kingdom. + completely_controls = title:d_carinthia + } + hidden_effect = { + title:d_istria = { set_de_jure_liege_title = title:d_croatia.de_jure_liege } + save_scope_value_as = { + name = istria_isolated + value = yes + } + } + } + #Sort notice of what's happening to Istria/Krain. + if = { + limit = { + exists = scope:krain_isolated + exists = scope:istria_isolated + } + custom_tooltip = form_austria_kingdom_decision_effect_stretch_fail_both_tt + } + else_if = { + limit = { exists = scope:krain_isolated } + custom_tooltip = form_austria_kingdom_decision_effect_stretch_fail_krain_tt + } + else_if = { + limit = { exists = scope:istria_isolated} + custom_tooltip = form_austria_kingdom_decision_effect_stretch_fail_istria_tt + } + #Sundry other rewards. + add_prestige = major_prestige_gain + if = { + limit = { + NOT = { has_realm_law = single_heir_succession_law } + } + add_realm_law_skip_effects = single_heir_succession_law + } + #Check to see if we're using that strong hook! + if = { + limit = { + NOT = { dynasty = title:e_hre.holder.dynasty } + } + use_hook = title:e_hre.holder + } +} + +form_carolingian_empire_scripted_effect = { + save_scope_as = scoped_ruler + title:e_hre.holder ?= { save_scope_as = scoped_emperor } + #De jure shifts. + hidden_effect = { + title:k_france = { set_de_jure_liege_title = title:e_france } + title:k_burgundy = { set_de_jure_liege_title = title:e_france } + title:k_aquitaine = { set_de_jure_liege_title = title:e_france } + title:k_brittany = { set_de_jure_liege_title = title:e_france } + title:k_frisia = { set_de_jure_liege_title = title:e_france } + title:k_lotharingia = { set_de_jure_liege_title = title:e_france } + title:k_bavaria = { set_de_jure_liege_title = title:e_france } + title:k_east_francia = { set_de_jure_liege_title = title:e_france } + title:k_italy = { set_de_jure_liege_title = title:e_france } + title:k_navarra = { set_de_jure_liege_title = title:e_france } + title:k_aragon = { set_de_jure_liege_title = title:e_france } + if = { + limit = { + OR = { + #exists = title:k_austria.holder + title:k_austria = { is_titular = yes } + title:e_hre = { + any_in_de_jure_hierarchy = { + continue = { tier >= tier_kingdom } + this = title:k_austria + } + } + } + } + title:k_austria = { set_de_jure_liege_title = title:e_france } + } + if = { + limit = { + OR = { + #exists = title:k_switzerland.holder + title:k_switzerland = { is_titular = yes } + title:e_hre = { + any_in_de_jure_hierarchy = { + continue = { tier >= tier_kingdom } + this = title:k_switzerland + } + } + } + } + title:k_switzerland = { set_de_jure_liege_title = title:e_france } + } + } + # Prestige + add_prestige = major_prestige_gain + # Law + if = { + limit = { + NOT = { has_realm_law = single_heir_succession_law } + } + add_realm_law_skip_effects = single_heir_succession_law + } + # HRE goes bye-bye + if = { + limit = { exists = scope:scoped_emperor } + destroy_title = title:e_hre + scope:scoped_emperor ?= { + add_prestige = major_prestige_loss + add_opinion = { + target = scope:scoped_ruler + modifier = pretender_opinion + } + } + } + # Innovations + culture:french = { + if = { + limit = { + NOT = { has_innovation = innovation_knighthood } + } + add_innovation = innovation_knighthood + } + if = { + limit = { + NOT = { has_innovation = innovation_royal_prerogative } + } + add_innovation = innovation_royal_prerogative + } + if = { + limit = { + NOT = { has_innovation = innovation_heraldry } + } + add_innovation = innovation_heraldry + } + } +} + +unite_burgundies_scripted_effect = { + add_prestige = medium_prestige_gain + save_scope_as = scoped_ruler + liege = { save_scope_as = former_liege } + #De jure shifts. + hidden_effect = { + title:d_burgundy = { + set_de_jure_liege_title = title:k_burgundy + } + title:d_provence = { #Just in case they drifted in the meantime. + set_de_jure_liege_title = title:k_burgundy + } + title:d_savoie = { + set_de_jure_liege_title = title:k_burgundy + } + title:d_dauphine = { + set_de_jure_liege_title = title:k_burgundy + } + title:d_upper_burgundy = { + set_de_jure_liege_title = title:k_burgundy + } + } + if = { + limit = { + culture:occitan = { + NOT = { + has_innovation = innovation_guilds + } + } + } + culture:occitan = { + add_innovation = innovation_guilds + } + } + if = { + limit = { + culture:occitan = { + NOT = { + has_innovation = innovation_burhs + } + } + } + culture:occitan = { + add_innovation = innovation_burhs + } + } + if = { + limit = { + culture:occitan = { + NOT = { + has_innovation = innovation_baliffs + } + } + } + culture:occitan = { + add_innovation = innovation_baliffs + } + } + #Make ruler independent and give Burgundy to him. + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = no + } + change_liege_or_become_independent = { + CHANGE = scope:change + VASSAL = this + } + hidden_effect = { + add_truce_both_ways = { + character = scope:former_liege + days = 1825 + name = TRUCE_GRANT_INDEPENDENCE_ROOT + } + } + resolve_title_and_vassal_change = scope:change + create_title_and_vassal_change = { + type = created + save_scope_as = new_burgundy + add_claim_on_loss = no + } + title:k_burgundy = { + change_title_holder = { + holder = root + change = scope:new_burgundy + } + } + resolve_title_and_vassal_change = scope:new_burgundy + scope:former_liege = { + add_prestige = major_prestige_loss + add_unpressed_claim = title:k_burgundy #Give chance to retaliate + add_opinion = { + target = scope:scoped_ruler + modifier = pretender_opinion + } + } +} + +form_outremer_scripted_effect = { + add_prestige = medium_prestige_gain + add_piety = medium_piety_gain + + #Saving Scope to refer to it fervor localization + title:e_outremer = { + save_scope_as = outremer_title + } + faith = { + change_fervor = { + value = 15 + desc = fervor_gain_formed_outremer + } + } + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + title:e_outremer = { + change_title_holder = { + holder = root + change = scope:change + } + hidden_effect = { + copy_title_history = title:k_jerusalem + } + } + resolve_title_and_vassal_change = scope:change + hidden_effect = { set_primary_title_to = title:e_outremer } + if = { #The Sunni Caliphate is dismantled + limit = { + faith:ashari = { exists = religious_head } + } + root = { destroy_title = title:d_sunni } + } + culture = { save_scope_as = former_culture } + capital_county.title_province.culture = { save_scope_as = capital_culture } + + # If the player's capital is Arabic and the player is not, hybridize with the capital culture + if = { + limit = { + scope:capital_culture != scope:former_culture + NOT = { scope:former_culture = { has_cultural_pillar = heritage_arabic } } + scope:capital_culture = { has_cultural_pillar = heritage_arabic } + culture = { + OR = { + is_hybrid_culture = no + AND = { + NOT = { has_cultural_pillar = heritage_arabic } + NOT = { any_parent_culture = { has_cultural_pillar = heritage_arabic } } + } + } + } + } + scope:capital_culture = { save_scope_as = hybrid_culture } + create_hybrid_culture = scope:capital_culture + } + + # If the player has not become Arabic, hybridize with Mashiriqi (Levantine) + else_if = { + limit = { + NOT = { scope:former_culture = { has_cultural_pillar = heritage_arabic } } + culture = { + OR = { + is_hybrid_culture = no + AND = { + NOT = { has_cultural_pillar = heritage_arabic } + NOT = { any_parent_culture = { has_cultural_pillar = heritage_arabic } } + } + } + } + } + culture:levantine = { save_scope_as = hybrid_culture } + create_hybrid_culture = culture:levantine + } + + # If the player has become Arabic, hybridize with Occitan + else_if = { + limit = { + culture = { + OR = { + is_hybrid_culture = no + AND = { + NOT = { has_cultural_pillar = heritage_arabic } + NOT = { any_parent_culture = { has_cultural_pillar = heritage_arabic } } + } + } + } + } + culture:occitan = { save_scope_as = hybrid_culture } + create_hybrid_culture = culture:occitan + } + #If the player is already a European-Arabic hybrid, just save the existing culture + else = { + scope:former_culture = { save_scope_as = new_culture } + } + + if = { + limit = { exists = scope:new_culture } + capital_county = { set_county_culture = scope:new_culture } + scope:new_culture = { + if = { + limit = { + OR = { + has_cultural_pillar = heritage_frankish + any_parent_culture = { has_cultural_pillar = heritage_frankish } + } + } + set_name_list = name_list_outremer + } + if = { + limit = { + NOT = { has_innovation = innovation_men_at_arms } + } + add_innovation = innovation_men_at_arms + } + if = { + limit = { + NOT = { has_innovation = innovation_desert_tactics } + } + add_innovation = innovation_desert_tactics + } + hidden_effect = { + if = { + limit = { + NOT = { has_same_culture_language = scope:former_culture } + } + set_language_from = scope:former_culture + } + if = { + limit = { + exists = scope:hybrid_culture + NOT = { has_same_culture_heritage = scope:hybrid_culture } + } + set_heritage_from = scope:hybrid_culture + } + } + } + } + else = { + show_as_tooltip = { + if = { + limit = { exists = scope:hybrid_culture } + custom_tooltip = outremer_decision_hybrid_tt + } + } + } +} + +restore_sunni_caliphate_scripted_effect = { + add_piety = major_piety_gain + save_scope_as = reformer + create_title_and_vassal_change = { + type = returned + save_scope_as = change + add_claim_on_loss = no + } + title:d_sunni = { + save_scope_as = sunni_caliphate + change_title_holder = { + holder = scope:reformer + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + faith:ashari = { + change_fervor = { + value = 15 + desc = fervor_gain_restored_sunni_caliphate + } + } +} +create_israel_scripted_effect = { + save_scope_as = scoped_ruler + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + title:k_israel = { + change_title_holder = { + holder = scope:scoped_ruler + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + hidden_effect = { + set_primary_title_to = title:k_israel + title:d_palestine = { + set_de_jure_liege_title = title:k_israel + } + title:d_urdunn = { + set_de_jure_liege_title = title:k_israel + } + title:d_oultrejourdain = { + set_de_jure_liege_title = title:k_israel + } + title:k_israel = { + set_de_jure_liege_title = title:k_jerusalem.de_jure_liege + } + } +} +create_rum_scripted_effect = { + add_prestige = medium_prestige_gain + #If under a liege, make independent. + if = { + limit = { + top_liege != this + } + if = { + limit = { + NOT = { + exists = scope:former_liege + } + } + liege = { + save_scope_as = former_liege + } + } + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = no + } + change_liege_or_become_independent = { + CHANGE = scope:change + VASSAL = this + } + hidden_effect = { + add_truce_both_ways = { + character = scope:former_liege + days = 1825 + name = TRUCE_GRANT_INDEPENDENCE_ROOT + } + } + resolve_title_and_vassal_change = scope:change + } + create_title_and_vassal_change = { + type = created + save_scope_as = new_rum + add_claim_on_loss = no + } + title:k_rum = { + change_title_holder = { + holder = root + change = scope:new_rum + } + set_can_be_named_after_dynasty = no + set_can_use_nomadic_naming = no + } + resolve_title_and_vassal_change = scope:new_rum + if = { + limit = { + exists = scope:former_liege + } + scope:former_liege = { + add_prestige = major_prestige_loss + add_unpressed_claim = title:k_rum #Give chance to retaliate + add_opinion = { + target = root + modifier = pretender_opinion + } + } + } + hidden_effect = { set_primary_title_to = title:k_rum } +} + +declare_bloodline_holy_decision_effect = { + save_scope_as = progenitor_holy_blood + if = { + limit = { + NOT = { + has_character_flag = con_blood_leg + } + } + add_character_flag = con_blood_leg + hidden_effect = { + legend_seed_great_deed_dynasty_effect = yes + } + } + + faith = { + set_variable = { + name = variable_savior_found + value = yes + } + change_fervor = { + value = 25 + desc = fervor_gain_holy_bloodline + } + } + if = { #Temporal. + limit = { + root.faith.religious_head = root + } + add_trait = savior + root.dynasty = { + add_dynasty_prestige = 1000 + add_dynasty_prestige_level = 1 + } + } + else = { #Spiritual. + add_trait = paragon + root.dynasty = { + add_dynasty_prestige = 500 + } + } + + every_child = { + even_if_dead = yes + trigger_event = major_decisions.0101 + + every_child = { + even_if_dead = yes + limit = { + OR = { + is_grandchild_of = scope:progenitor_holy_blood + is_great_grandchild_of = scope:progenitor_holy_blood + } + } + trigger_event = major_decisions.0101 + + every_child = { + even_if_dead = yes + limit = { + OR = { + is_grandchild_of = scope:progenitor_holy_blood + is_great_grandchild_of = scope:progenitor_holy_blood + } + } + trigger_event = major_decisions.0101 + } + } + } +} + +sicilian_parliament_building_scripted_effect = { + #this is the County title. + title_province = { + set_variable = { + name = variable_sicilian_parliament_county + value = yes + } + if = { + limit = { + has_special_building_slot = no + } + add_special_building_slot = special_sicilian_parliament_01 + } + add_special_building = special_sicilian_parliament_01 + } +} +sicilian_parliament_kingdom_split_scripted_effect = { #If the decision is taken when the ruler doesn't hold the entirety of k_sicily, it results in the Naples/Trinacria split. (this is the ruler) + root = { + destroy_title = title:k_sicily + } + title:d_sicily = { + set_de_jure_liege_title = title:k_trinacria + } + title:d_benevento = { + set_de_jure_liege_title = title:k_naples + } + title:d_capua = { + set_de_jure_liege_title = title:k_naples + } + title:d_apulia = { + set_de_jure_liege_title = title:k_naples + } + title:d_salerno = { + set_de_jure_liege_title = title:k_naples + } + title:d_calabria = { + set_de_jure_liege_title = title:k_naples + } +} + +empower_sicilian_parliament_decision_scripted_effect = { + root = { + if = { + limit = { + has_realm_law = crown_authority_0 + } + add_realm_law_skip_effects = crown_authority_1 + } + else_if = { + limit = { + has_realm_law = crown_authority_1 + } + add_realm_law_skip_effects = crown_authority_2 + } + else_if = { + limit = { + has_realm_law = crown_authority_2 + } + add_realm_law_skip_effects = crown_authority_3 + } + } + if = { + limit = { has_title = title:k_sicily } + title:k_sicily = { + every_in_de_jure_hierarchy = { + custom = empower_sicilian_parliament_decision_every_province_custom + limit = { + tier = tier_county + title_province = { geographical_region = custom_sicily } + holder = { + OR = { + this = root + target_is_liege_or_above = root + } + } + } + title_province = { + add_province_modifier = { + modifier = parliamentary_bureaucracy_modifier + years = 150 + } + } + } + } + } + else_if = { + limit = { has_title = title:k_naples } + title:k_naples = { + every_in_de_jure_hierarchy = { + custom = empower_sicilian_parliament_decision_every_province_custom + limit = { + tier = tier_county + title_province = { geographical_region = custom_sicily } + holder = { + OR = { + this = root + target_is_liege_or_above = root + } + } + } + title_province = { + add_province_modifier = { + modifier = parliamentary_bureaucracy_modifier + years = 150 + } + } + } + } + } + else_if = { + limit = { has_title = title:k_trinacria } + title:k_trinacria = { + every_in_de_jure_hierarchy = { + custom = empower_sicilian_parliament_decision_every_province_custom + limit = { + tier = tier_county + title_province = { geographical_region = custom_sicily } + holder = { + OR = { + this = root + target_is_liege_or_above = root + } + } + } + title_province = { + add_province_modifier = { + modifier = parliamentary_bureaucracy_modifier + years = 150 + } + } + } + } + } +} + +promote_gothic_innovations_decision_scripted_effect = { + if = { + limit = { + has_realm_law = crown_authority_0 + } + add_realm_law_skip_effects= crown_authority_1 + } + else_if = { + limit = { + has_realm_law = crown_authority_1 + } + add_realm_law_skip_effects = crown_authority_2 + } + else_if = { + limit = { + has_realm_law = crown_authority_2 + } + add_realm_law_skip_effects = crown_authority_3 + } + culture = { + if = { + limit = { + NOT = { has_innovation = innovation_french_peerage } + } + add_innovation = innovation_french_peerage + } + } + if = { + limit = { + this = { completely_controls = title:d_valois } + } + title:c_ile_de_france = { + title_province = { + add_province_modifier = { + modifier = flourishing_culture_modifier + years = 150 + } + } + } + } + if = { + limit = { + this = { completely_controls = title:d_orleans } + } + title:c_orleans = { + title_province = { + add_province_modifier = { + modifier = flourishing_culture_modifier + years = 150 + } + } + } + } + if = { + limit = { + this = { completely_controls = title:d_provence } + } + title:c_nice = { + title_province = { + add_province_modifier = { + modifier = flourishing_culture_modifier + years = 150 + } + } + } + } + if = { + limit = { + this = { completely_controls = title:d_toulouse } + } + title:c_toulouse = { + title_province = { + add_province_modifier = { + modifier = flourishing_culture_modifier + years = 150 + } + } + } + } +} + +promote_hungarian_settlement_decision_scripted_effect = { + if = { + limit = { + culture = culture:mogyer + } + + # Convert my culture to Hungarian Culture + set_culture = culture:hungarian + culture:hungarian = { + reset_culture_creation_date = yes + get_all_innovations_from = culture:mogyer + } + + # Convert my courtiers to Hungarian + hidden_effect = { + every_courtier = { + limit = { + culture = culture:mogyer + } + set_culture = culture:hungarian + } + } + + # Convert my vassals to Hungarian + every_vassal_or_below = { + limit = { + culture = culture:mogyer + } + + custom = promote_hungarian_settlement_decision_every_vassal_custom + set_culture = culture:hungarian + + # Convert their courtiers as well + hidden_effect = { + every_courtier = { + limit = { + culture = culture:mogyer + } + set_culture = culture:hungarian + } + } + } + } + + title:k_hungary = { + every_in_de_jure_hierarchy = { + custom = promote_hungarian_settlement_decision_every_province_custom + limit = { + tier = tier_county + culture = culture:mogyer + title_province = { geographical_region = custom_hungary } + holder = { + OR = { + this = root + target_is_liege_or_above = root + } + } + } + set_county_culture = culture:hungarian + add_county_modifier = { + modifier = hungarian_resettlement_modifier + years = 100 + } + custom_tooltip = promote_hungarian_settlement_decision_increased_development + custom_tooltip = promote_hungarian_settlement_decision_convert_county + hidden_effect = { + if = { + limit = { + development_level < 5 + } + change_development_level = 1 + } + random_list = { + 30 = { + # Nothing happens + } + 30 = { + trigger = { + NOT = { + faith = { has_doctrine = special_doctrine_ecumenical_christian } + } + } + set_county_faith = root.faith + } + 30 = { + trigger = { + NOT = { + faith = { has_doctrine = special_doctrine_ecumenical_christian } + } + any_neighboring_county = { + faith = { has_doctrine = special_doctrine_ecumenical_christian } + } + } + random_neighboring_county = { + limit = { + faith = { has_doctrine = special_doctrine_ecumenical_christian } + } + save_scope_as = neighboring_county + } + set_county_faith = scope:neighboring_county.faith + } + } + } + } + } +} + +revive_magyar_paganism_decision_scripted_effect = { + #Change yourself, and any willing vassals/family, over to Magyar Paganism. + set_character_faith_with_conversion = faith:magyar_pagan + #Gain nickname for your troubles. + give_nickname = nick_the_apostate + #Magyar_group counties of your old religion may defect back to the old ways. + custom_tooltip = revive_magyar_paganism_decision_scripted_effect.county_conversions.tt + hidden_effect = { + primary_title = { + every_in_de_facto_hierarchy = { + limit = { + tier = tier_county + culture = { has_cultural_pillar = heritage_magyar } + exists = scope:old_faith + religion = scope:old_faith.religion + } + #Mogyers remember the old ways best, and have a high chance to flip. + if = { + limit = { culture = culture:mogyer } + random = { + chance = 70 + set_county_faith = faith:magyar_pagan + } + } + #Slightly up the chances for the apostate. + else_if = { + limit = { holder = root } + random = { + chance = 50 + set_county_faith = faith:magyar_pagan + } + } + #Other magyar_group cultures still have a moderate chance to flip. + else = { + random = { + chance = 30 + set_county_faith = faith:magyar_pagan + } + } + } + } + } + #Make flipping counties deliriously happy about the whole affair. + primary_title = { + every_in_de_facto_hierarchy = { + limit = { + tier = tier_county + faith = faith:magyar_pagan + } + custom = hungarian_resettlement.every_converted_province + add_county_modifier = { + modifier = magyar_appreciation_modifier + years = 25 + } + } + } + #Finally, give magyar_pagans a hefty fervour boost, just so that they don't immediately convert back. + hidden_effect = { + faith:magyar_pagan = { + save_temporary_scope_as = magyar_faith + change_fervor = { + value = 100 + desc = fervor_gain_magyar_revivalism + } + } + } +} + +restore_dumnonia_decision_scripted_effect = { + save_scope_as = founder + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:k_cornwall = { + change_title_holder = { + holder = root + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + + hidden_effect = { + title:d_somerset = { save_scope_as = cornwall_somerset } + title:d_gloucester = { save_scope_as = cornwall_gloucester } + title:d_cornwall = { set_de_jure_liege_title = title:k_cornwall } + if = { #If owned, annex Somerset/Wessex. + limit = { + title:d_somerset = { holder = root } + } + title:d_somerset = { set_de_jure_liege_title = title:k_cornwall } + } + if = { #If owned, annex Gloucestershire/Hwicce. + limit = { + title:d_gloucester = { holder = root } + } + title:d_gloucester = { set_de_jure_liege_title = title:k_cornwall } + } + } + custom_tooltip = restore_dumnonia_decision_effects_de_jure_tt +} + +revive_armenian_empire_decision_scripted_effect = { + save_scope_as = founder + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:e_armenia = { + change_title_holder = { + holder = root + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + + hidden_effect = { + title:k_armenia = { save_scope_as = armenian_armenia } + title:k_georgia = { save_scope_as = armenian_georgia } + title:k_daylam = { save_scope_as = armenian_daylam } + title:k_jazira = { save_scope_as = armenian_jazira } + title:k_syria = { save_scope_as = armenian_syria } + title:k_jerusalem = { save_scope_as = armenian_jerusalem } + title:k_anatolia = { save_scope_as = armenian_anatolia } + title:k_pontus = { save_scope_as = armenian_pontus } + title:e_armenia = { save_scope_as = armenian_armenia_empire } + title:k_armenia = { set_de_jure_liege_title = title:e_armenia } + if = { + limit = { + title:k_armenia = { is_title_created = yes } + } + create_title_and_vassal_change = { + type = usurped + save_scope_as = title_change_2 + add_claim_on_loss = no + } + title:k_armenia = { + change_title_holder = { + holder = root + change = scope:title_change_2 + } + } + resolve_title_and_vassal_change = scope:title_change_2 + } + else_if = { + limit = { + title:k_armenia = { is_title_created = no } + } + create_title_and_vassal_change = { + type = created + save_scope_as = title_change_2 + add_claim_on_loss = no + } + title:k_armenia = { + change_title_holder = { + holder = root + change = scope:title_change_2 + } + } + resolve_title_and_vassal_change = scope:title_change_2 + } + if = { #If any have drifted out, then k_armenia's constituent duchies are flipped back. + limit = { + title:d_greater_armenia = { + NOT = { target_is_de_jure_liege_or_above = title:k_armenia } + } + } + title:d_greater_armenia = { set_de_jure_liege_title = title:k_armenia } + } + if = { #If any have drifted out, then k_armenia's constituent duchies are flipped back. + limit = { + title:d_vaspurakan = { + NOT = { target_is_de_jure_liege_or_above = title:k_armenia } + } + } + title:d_vaspurakan = { set_de_jure_liege_title = title:k_armenia } + } + if = { #If any have drifted out, then k_armenia's constituent duchies are flipped back. + limit = { + title:d_mesopotamia = { + NOT = { target_is_de_jure_liege_or_above = title:k_armenia } + } + } + title:d_mesopotamia = { set_de_jure_liege_title = title:k_armenia } + } + if = { #If owned & de jure has not drifted, annex Daylam & exempt Azerbaijan from de jure flipping to Armenia. + limit = { + title:k_daylam = { holder = root } + title:d_azerbaijan = { target_is_de_jure_liege_or_above = title:k_daylam } + } + title:k_daylam = { set_de_jure_liege_title = title:e_armenia } + } + else_if = { #If owned & de jure has drifted, annex Daylam & flip Azerbaijan to Armenia. + limit = { + title:k_daylam = { holder = root } + NOT = { + title:d_azerbaijan = { target_is_de_jure_liege_or_above = title:k_daylam } + } + } + title:k_daylam = { set_de_jure_liege_title = title:e_armenia } + title:d_azerbaijan = { set_de_jure_liege_title = title:k_armenia } + } + else = { + title:d_azerbaijan = { set_de_jure_liege_title = title:k_armenia } + } + if = { #If owned & de jure has not drifted, annex Daylam & exempt Shirvan from de jure flipping to Armenia. + limit = { + title:k_daylam = { holder = root } + title:d_shirvan = { target_is_de_jure_liege_or_above = title:k_daylam } + } + title:k_daylam = { set_de_jure_liege_title = title:e_armenia } + } + else_if = { #If owned & de jure has drifted, annex Daylam & flip Shirvan to Armenia. + limit = { + title:k_daylam = { holder = root } + NOT = { + title:d_shirvan = { target_is_de_jure_liege_or_above = title:k_daylam } + } + } + title:k_daylam = { set_de_jure_liege_title = title:e_armenia } + title:d_shirvan = { set_de_jure_liege_title = title:k_armenia } + } + else = { + title:d_shirvan = { set_de_jure_liege_title = title:k_armenia } + } + if = { #If owned & de jure has not drifted, annex Georgia & exempt ducal Georgia from de jure flipping to Armenia. + limit = { + title:k_georgia = { holder = root } + title:d_georgia = { target_is_de_jure_liege_or_above = title:k_georgia } + } + title:k_georgia = { set_de_jure_liege_title = title:e_armenia } + } + else_if = { #If owned & de jure has drifted, annex Georgia & flip ducal Georgia to Armenia. + limit = { + title:k_georgia = { holder = root } + NOT = { + title:d_georgia = { target_is_de_jure_liege_or_above = title:k_georgia } + } + } + title:k_georgia = { set_de_jure_liege_title = title:e_armenia } + title:d_georgia = { set_de_jure_liege_title = title:k_armenia } + } + else = { + title:d_georgia = { set_de_jure_liege_title = title:k_armenia } + } + if = { #If owned & de jure has not drifted, annex Anatolia & exempt Cilicia from de jure flipping to Armenia. + limit = { + title:k_anatolia = { holder = root } + title:d_cilicia = { target_is_de_jure_liege_or_above = title:k_anatolia } + } + title:k_anatolia = { set_de_jure_liege_title = title:e_armenia } + } + else_if = { #If owned & de jure has drifted, annex Anatolia & flip Cilicia to Armenia. + limit = { + title:k_anatolia = { holder = root } + NOT = { + title:d_cilicia = { target_is_de_jure_liege_or_above = title:k_anatolia } + } + } + title:k_anatolia = { set_de_jure_liege_title = title:e_armenia } + title:d_cilicia = { set_de_jure_liege_title = title:k_armenia } + } + else = { + title:d_cilicia = { set_de_jure_liege_title = title:k_armenia } + } + if = { #If owned & de jure has not drifted, annex Jazira & exempt Diyarbakr from de jure flipping to Armenia. + limit = { + title:k_jazira = { holder = root } + title:d_diyarbakr = { target_is_de_jure_liege_or_above = title:k_jazira } + } + title:k_jazira = { set_de_jure_liege_title = title:e_armenia } + } + else_if = { #If owned & de jure has drifted, annex Jazira & flip Diyarbakr to Armenia. + limit = { + title:k_jazira = { holder = root } + NOT = { + title:d_diyarbakr = { target_is_de_jure_liege_or_above = title:k_jazira } + } + } + title:k_jazira = { set_de_jure_liege_title = title:e_armenia } + title:d_diyarbakr = { set_de_jure_liege_title = title:k_armenia } + } + else = { + title:d_diyarbakr = { set_de_jure_liege_title = title:k_armenia } + } + if = { #If owned & de jure has not drifted, annex Syria & exempt Edessa from de jure flipping to Armenia. + limit = { + title:k_syria = { holder = root } + title:d_edessa = { target_is_de_jure_liege_or_above = title:k_syria } + } + title:k_syria = { set_de_jure_liege_title = title:e_armenia } + } + else_if = { #If owned & de jure has drifted, annex Syria & flip Edessa to Armenia. + limit = { + title:k_syria = { holder = root } + NOT = { + title:d_edessa = { target_is_de_jure_liege_or_above = title:k_syria } + } + } + title:k_syria = { set_de_jure_liege_title = title:e_armenia } + title:d_edessa = { set_de_jure_liege_title = title:k_armenia } + } + else = { + title:d_edessa = { set_de_jure_liege_title = title:k_armenia } + } + if = { #If owned & de jure has not drifted, annex Syria & exempt Antioch from de jure flipping to Armenia. + limit = { + title:k_syria = { holder = root } + title:d_antioch = { target_is_de_jure_liege_or_above = title:k_syria } + } + title:k_syria = { set_de_jure_liege_title = title:e_armenia } + } + else_if = { #If owned & de jure has drifted, annex Syria & flip Antioch to Armenia. + limit = { + title:k_syria = { holder = root } + NOT = { + title:d_antioch = { target_is_de_jure_liege_or_above = title:k_syria } + } + } + title:k_syria = { set_de_jure_liege_title = title:e_armenia } + title:d_antioch = { set_de_jure_liege_title = title:k_armenia } + } + else = { + title:d_antioch = { set_de_jure_liege_title = title:k_armenia } + } + if = { #If owned & Kurdistan is already part of Jazira, annex Jazira & exempt Kurdistan from de jure flipping to Armenia. + limit = { + title:k_jazira = { holder = root } + title:d_kurdistan = { target_is_de_jure_liege_or_above = title:k_jazira } + } + title:k_jazira = { set_de_jure_liege_title = title:e_armenia } + } + else_if = { #If owned & Kurdistan is not part of Jazira, but Jazira is owned entirely, annex Jazira & flip Kurdistan to Jazira, because bordergore. + limit = { + title:k_jazira = { holder = root } + NOT = { + title:d_kurdistan = { target_is_de_jure_liege_or_above = title:k_jazira } + } + } + title:k_jazira = { set_de_jure_liege_title = title:e_armenia } + title:d_kurdistan = { set_de_jure_liege_title = title:k_jazira } + } + else = { + title:d_kurdistan = { set_de_jure_liege_title = title:k_armenia } + } + if = { #If owned, annex Pontus. + limit = { + title:k_pontus = { holder = root } + } + title:k_pontus = { set_de_jure_liege_title = title:e_armenia } + } + if = { #If owned, annex Jerusalem. + limit = { + title:k_jerusalem = { holder = root } + } + title:k_jerusalem = { set_de_jure_liege_title = title:e_armenia } + } + } + custom_tooltip = create_armenian_empire_decision_effects_de_jure_tt_a + custom_tooltip = create_armenian_empire_decision_effects_de_jure_tt_b +} + +form_dai_viet_empire_decision_scripted_effect = { + save_scope_as = founder + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:e_viet = { + change_title_holder = { + holder = root + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + root.dynasty = { + add_dynasty_prestige = major_dynasty_prestige_gain + } + + if = { + limit = { + title:k_viet = { + is_title_created = yes + NOT = { + holder = ROOT + } + } + } + create_title_and_vassal_change = { + type = usurped + save_scope_as = title_change_2 + add_claim_on_loss = no + } + title:k_viet = { + change_title_holder = { + holder = root + change = scope:title_change_2 + } + } + resolve_title_and_vassal_change = scope:title_change_2 + } + else_if = { + limit = { + title:k_viet = { is_title_created = no } + } + create_title_and_vassal_change = { + type = created + save_scope_as = title_change_2 + add_claim_on_loss = no + } + title:k_viet = { + change_title_holder = { + holder = root + change = scope:title_change_2 + } + } + resolve_title_and_vassal_change = scope:title_change_2 + } + #Viet controls + if = { #If owned, annex Dai Viet. + limit = { + title:k_viet = { holder = root } + } + title:k_viet = { set_de_jure_liege_title = title:e_viet } + } + if = { #If owned, annex Champa. + limit = { + title:k_champa = { holder = root } + } + title:k_champa = { set_de_jure_liege_title = title:e_viet } + } + if = { #If any have drifted out, then k_viet's constituent duchies are flipped back. + limit = { + title:d_hai_dong = { + NOT = { target_is_de_jure_liege_or_above = title:k_viet } + } + } + title:d_hai_dong = { set_de_jure_liege_title = title:k_viet } + } + if = { #If any have drifted out, then k_viet's constituent duchies are flipped back. + limit = { + title:d_lam_tay = { + NOT = { target_is_de_jure_liege_or_above = title:k_viet } + } + } + title:d_lam_tay = { set_de_jure_liege_title = title:k_viet } + } + if = { #If any have drifted out, then k_viet's constituent duchies are flipped back. + limit = { + title:d_nghe_an = { + NOT = { target_is_de_jure_liege_or_above = title:k_viet } + } + } + title:d_nghe_an = { set_de_jure_liege_title = title:k_viet } + } + if = { #If any have drifted out, then k_viet's constituent duchies are flipped back. + limit = { + title:d_hai_dong = { + NOT = { target_is_de_jure_liege_or_above = title:k_viet } + } + } + title:d_thang_long = { set_de_jure_liege_title = title:k_viet } + } + #Champa controls + if = { #If any have drifted out, then k_champa's constituent duchies are flipped back. + limit = { + title:d_indrapura = { + NOT = { target_is_de_jure_liege_or_above = title:k_champa } + } + } + title:d_indrapura = { set_de_jure_liege_title = title:k_champa } + } + if = { #If any have drifted out, then k_champa's constituent duchies are flipped back. + limit = { + title:d_vijaya = { + NOT = { target_is_de_jure_liege_or_above = title:k_champa } + } + } + title:d_vijaya = { set_de_jure_liege_title = title:k_champa } + } + if = { #If any have drifted out, then k_champa's constituent duchies are flipped back. + limit = { + title:d_baigaur = { + NOT = { target_is_de_jure_liege_or_above = title:k_champa } + } + } + title:d_baigaur = { set_de_jure_liege_title = title:k_champa } + } + + if = { + limit = { + government_has_flag = government_is_meritocratic + } + add_realm_law = single_heir_succession_law + } +} + +form_majapahit_empire_decision_scripted_effect = { + save_scope_as = founder + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:e_majapahit = { + change_title_holder = { + holder = root + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + root.dynasty = { + add_dynasty_modifier = majapahit_empire_founding_modifier + } + + hidden_effect = { + title:k_yavakadvipa = { save_scope_as = javanese_yavakadvipa } + title:d_SUM_palembang = { save_scope_as = javanese_palembang } + title:d_JAV_taruma = { save_scope_as = javanese_taruma } + title:d_JAV_mataram = { save_scope_as = javanese_mataram } + title:c_JAV_madura = { save_scope_as = javanese_madura } + title:e_majapahit = { save_scope_as = javanese_majapahit_empire } + title:k_yavakadvipa = { set_de_jure_liege_title = title:e_majapahit } + if = { + limit = { + title:k_yavakadvipa = { + is_title_created = yes + NOT = { + holder = ROOT + } + } + } + create_title_and_vassal_change = { + type = usurped + save_scope_as = title_change_2 + add_claim_on_loss = no + } + title:k_yavakadvipa = { + change_title_holder = { + holder = root + change = scope:title_change_2 + } + } + resolve_title_and_vassal_change = scope:title_change_2 + } + else_if = { + limit = { + title:k_yavakadvipa = { is_title_created = no } + } + create_title_and_vassal_change = { + type = created + save_scope_as = title_change_2 + add_claim_on_loss = no + } + title:k_yavakadvipa = { + change_title_holder = { + holder = root + change = scope:title_change_2 + } + } + resolve_title_and_vassal_change = scope:title_change_2 + } + if = { + limit = { + title:d_SUM_palembang = { + NOT = { target_is_de_jure_liege_or_above = title:k_yavakadvipa } + } + } + title:d_SUM_palembang = { set_de_jure_liege_title = title:k_yavakadvipa } + } + if = { + limit = { + title:d_JAV_taruma = { + NOT = { target_is_de_jure_liege_or_above = title:k_yavakadvipa } + } + } + title:d_JAV_taruma = { set_de_jure_liege_title = title:k_yavakadvipa } + } + if = { + limit = { + title:d_JAV_mataram = { + NOT = { target_is_de_jure_liege_or_above = title:k_yavakadvipa } + } + } + title:d_JAV_mataram = { set_de_jure_liege_title = title:k_yavakadvipa } + } + if = { + limit = { + title:c_JAV_madura = { + NOT = { target_is_de_jure_liege_or_above = title:d_JAV_mataram } + } + } + title:c_JAV_madura = { set_de_jure_liege_title = title:d_JAV_mataram } + } + if = { #If owned, annex Champa. + limit = { + title:k_yavakadvipa = { holder = root } + } + title:k_yavakadvipa = { set_de_jure_liege_title = title:e_majapahit } + } + } + custom_tooltip = form_majapahit_empire_decision_effects_de_jure_tt_a + custom_tooltip = form_majapahit_empire_decision_effects_de_jure_tt_b + custom_tooltip = form_majapahit_empire_decision_effects_de_jure_tt_c +} + +restore_holy_roman_empire_decision_scripted_effect = { + save_scope_as = founder + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:e_hre = { + change_title_holder = { + holder = root + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + set_primary_title_to = title:e_hre + + #Papal hook management. + if = { + limit = { + faith.religious_head = { + exists = this + opinion = { + target = root + value < high_positive_opinion + } + } + OR = { + has_weak_hook = faith.religious_head + has_strong_usable_hook = faith.religious_head + } + } + use_hook = faith.religious_head + } + + #Sort title laws. + if = { + limit = { + OR = { + has_title = title:k_east_francia + any_vassal = { + has_title = title:k_east_francia + } + } + } + destroy_title = title:k_east_francia #Make Germany inalienable. + } + title:e_hre = { + add_title_law = princely_elective_succession_law + if = { #Add Salic law. + limit = { + root = { + OR = { + has_realm_law = male_preference_law + has_realm_law = male_only_law + } + } + } + add_title_law = male_only_law + } + if = { #Ignore Salic law. + limit = { + root = { has_realm_law = equal_law } + } + add_title_law = equal_law + } + if = { #Invert Salic law. Take that, Clovis, y'big nerd. + limit = { + root = { + OR = { + has_realm_law = female_preference_law + has_realm_law = female_only_law + } + } + } + add_title_law = female_only_law + } + custom_tooltip = hre_elector_list_creation_tt + } + + #Add de jures. + hidden_effect = { + if = { #If Germania is nae a thing, merge it into the HRE. + limit = { + OR = { + has_title = title:k_east_francia + has_title = title:k_bavaria + has_title = title:k_lotharingia + has_title = title:k_frisia + any_vassal = { + OR = { + has_title = title:k_east_francia + has_title = title:k_bavaria + has_title = title:k_lotharingia + has_title = title:k_frisia + } + } + } + OR = { + NOT = { exists = title:e_germany.holder } + title:e_germany.holder ?= root + } + } + title:e_germany = { + every_in_de_jure_hierarchy = { + limit = { tier = tier_kingdom } + set_de_jure_liege_title = title:e_hre + } + } + } + every_held_title = { + title_tier = kingdom + limit = { + NOT = { #The Pope retains vague dibs on Italy. + any_this_title_or_de_jure_above = { this = title:e_italy } + } + save_temporary_scope_as = this_title + #root = { completely_controls = scope:this_title } + } + set_de_jure_liege_title = title:e_hre + } + every_vassal = { + every_held_title = { + title_tier = kingdom + limit = { + NOT = { #The Pope retains vague dibs on Italy. + any_this_title_or_de_jure_above = { this = title:e_italy } + } + save_temporary_scope_as = this_title + #prev = { completely_controls = scope:this_title } + } + set_de_jure_liege_title = title:e_hre + } + } + if = { # Merge Francia into the HRE under certain conditions + limit = { + OR = { + NOT = { exists = title:e_france.holder } + title:e_france.holder ?= root + } + OR = { + title:k_france = { # If core West Francia is part of the HRE + target_is_de_jure_liege_or_above = title:e_hre + } + calc_true_if = { # Or 2+ of the other francian Kingdoms + amount >= 2 + title:k_burgundy = { + target_is_de_jure_liege_or_above = title:e_hre + } + title:k_aquitaine = { + target_is_de_jure_liege_or_above = title:e_hre + } + title:k_brittany = { + target_is_de_jure_liege_or_above = title:e_hre + } + } + } + } + title:e_france = { + every_in_de_jure_hierarchy = { + limit = { tier = tier_kingdom } + set_de_jure_liege_title = title:e_hre + } + } + } + every_vassal = { + limit = { + is_ai = yes + } + every_held_title = { + title_tier = kingdom + root = { + destroy_title = prev + } + } + } + every_held_title = { + title_tier >= kingdom + limit = { + NOT = { + this = title:e_hre + } + save_temporary_scope_as = this_title + } + root = { + destroy_title = prev + } + } + } + custom_tooltip = restore_holy_roman_empire_decision_effects_de_jure.tt + + #And add a bit of prestige for the trouble. + add_prestige = massive_prestige_value +} + +found_kingdom_of_bosnia_decision_scripted_effect = { + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:k_bosnia = { + change_title_holder = { + holder = scope:founder + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + + title:d_bosna = { set_de_jure_liege_title = title:k_bosnia } + title:d_lower_bosna = { set_de_jure_liege_title = title:k_bosnia } + title:d_usora = { set_de_jure_liege_title = title:k_bosnia } +} + +found_kingdom_of_livonia_decision_scripted_effect = { + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:k_livonia = { + change_title_holder = { + holder = scope:founder + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + + title:d_latgalians = { set_de_jure_liege_title = title:k_livonia } + title:d_courland = { set_de_jure_liege_title = title:k_livonia } + title:d_livonia = { set_de_jure_liege_title = title:k_livonia } + if = { + limit = { + title:d_esthonia = { holder = root } + } + title:d_esthonia = { set_de_jure_liege_title = title:k_livonia } + } + if = { + limit = { + has_faith = faith:baltic_pagan + root.culture = { NOT = { has_innovation = innovation_longboats } } + } + root.culture = { add_innovation = innovation_longboats } + } +} + +unite_bene_israel_effect = { + add_prestige = major_prestige_gain + add_piety = major_piety_gain + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:k_bene_israel = { + change_title_holder = { + holder = scope:founder + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + + title:d_chera_nadu = { set_de_jure_liege_title = title:k_bene_israel } + title:d_konkana = { set_de_jure_liege_title = title:k_bene_israel } + if = { + limit = { + title:d_lata = { holder = root } + } + title:d_lata = { set_de_jure_liege_title = title:k_bene_israel } + } + if = { + limit = { + title:d_nasikya = { holder = root } + } + title:d_nasikya = { set_de_jure_liege_title = title:k_bene_israel } + } + random_held_title = { + title_tier = barony + limit = { + is_holy_site_of = faith:malabarism + } + county = { set_county_culture = culture:kochinim } + county = { set_county_faith = faith:malabarism } + } +} + +hre_elector_list_save_effect = { + ordered_in_global_list = { + variable = hre_elector_list + max = 7 + check_range_bounds = no + order_by = tier + save_temporary_scope_as = hre_elector_title + title:e_hre = { + if = { + limit = { NOT = { has_variable = hre_elector_1 } } + set_variable = { name = hre_elector_1 value = scope:hre_elector_title } + } + else_if = { + limit = { NOT = { has_variable = hre_elector_2 } } + set_variable = { name = hre_elector_2 value = scope:hre_elector_title } + } + else_if = { + limit = { NOT = { has_variable = hre_elector_3 } } + set_variable = { name = hre_elector_3 value = scope:hre_elector_title } + } + else_if = { + limit = { NOT = { has_variable = hre_elector_4 } } + set_variable = { name = hre_elector_4 value = scope:hre_elector_title } + } + else_if = { + limit = { NOT = { has_variable = hre_elector_5 } } + set_variable = { name = hre_elector_5 value = scope:hre_elector_title } + } + else_if = { + limit = { NOT = { has_variable = hre_elector_6 } } + set_variable = { name = hre_elector_6 value = scope:hre_elector_title } + } + else_if = { + limit = { NOT = { has_variable = hre_elector_7 } } + set_variable = { name = hre_elector_7 value = scope:hre_elector_title } + } + } + } +} + +favour_the_countryside_basques_decision_generic_effects_scripted_effect = { + scope:religious_leader = { + # If you weren't Basque, become so. + if = { + limit = { favour_the_countryside_basques_counts_as_basque_trigger = no } + # Now, we need to work out which Basque culture you should be. + ## First, we gather our candidates. + ### Going through counties. + every_sub_realm_county = { + limit = { + favour_the_countryside_basques_counts_as_basque_trigger = yes + NOT = { + culture = { is_in_list = realm_basque_cultures_list } + } + } + culture = { add_to_list = realm_basque_cultures_list } + } + ### Plus vassals. + every_vassal_or_below = { + limit = { + favour_the_countryside_basques_counts_as_basque_trigger = yes + NOT = { + culture = { is_in_list = realm_basque_cultures_list } + } + } + culture = { add_to_list = realm_basque_cultures_list } + } + ### And those close to you. + every_close_or_extended_family_member = { + limit = { + favour_the_countryside_basques_counts_as_basque_trigger = yes + NOT = { + culture = { is_in_list = realm_basque_cultures_list } + } + } + culture = { add_to_list = realm_basque_cultures_list } + } + every_consort = { + limit = { + favour_the_countryside_basques_counts_as_basque_trigger = yes + NOT = { + culture = { is_in_list = realm_basque_cultures_list } + } + } + culture = { add_to_list = realm_basque_cultures_list } + } + every_relation = { + type = friend + limit = { + favour_the_countryside_basques_counts_as_basque_trigger = yes + NOT = { + culture = { is_in_list = realm_basque_cultures_list } + } + } + culture = { add_to_list = realm_basque_cultures_list } + } + every_relation = { + type = lover + limit = { + favour_the_countryside_basques_counts_as_basque_trigger = yes + NOT = { + culture = { is_in_list = realm_basque_cultures_list } + } + } + culture = { add_to_list = realm_basque_cultures_list } + } + ## Next, we process the list. + if = { + limit = { + any_in_list = { + list = realm_basque_cultures_list + exists = this + } + } + ordered_in_list = { + list = realm_basque_cultures_list + order_by = { + value = 0 + save_temporary_scope_as = culture_temp + # Culture counties are added differently depending on whether they're inside or outside the realm + every_culture_county = { + # Every culture county in your realm adds 10. + if = { + limit = { + holder = { + OR = { + this = scope:religious_leader + any_liege_or_above = { this = scope:religious_leader } + } + } + } + add = 10 + } + # Every culture county outside your realm adds 5. + else = { add = 5 } + } + scope:religious_leader = { + # Vassals add weight depending on their rank. + every_vassal = { + if = { + limit = { culture = scope:culture_temp } + # Every king-tier vassal adds 50. + if = { + limit = { highest_held_title_tier = tier_kingdom } + add = 50 + } + # Every duke-tier vassal adds 25. + else_if = { + limit = { highest_held_title_tier = tier_duchy } + add = 25 + } + # Every count-tier vassal adds 10. + else_if = { + limit = { highest_held_title_tier = tier_county } + add = 10 + } + # Barons are unimportant. + } + } + # Every close family member adds 15. + every_close_family_member = { + limit = { culture = scope:culture_temp } + add = 15 + } + # Every extended family members adds 5. + every_extended_family_member = { + limit = { culture = scope:culture_temp } + add = 5 + } + # Every soulmate adds 50. + every_relation = { + type = soulmate + limit = { culture = scope:culture_temp } + add = 50 + } + # Every best friend adds 50. + every_relation = { + type = best_friend + limit = { culture = scope:culture_temp } + add = 50 + } + # Every lover adds 15. + every_relation = { + type = lover + limit = { + culture = scope:culture_temp + NOT = { has_relation_soulmate = scope:religious_leader } + } + add = 15 + } + # Every friend adds 15. + every_relation = { + type = friend + limit = { + culture = scope:culture_temp + NOT = { has_relation_best_friend = scope:religious_leader } + } + add = 15 + } + } + } + save_scope_as = chosen_basque_culture + } + } + ## Finally, we try to convert. + if = { + limit = { exists = scope:chosen_basque_culture } + convert_family_culture_and_notify_vassals_effect = { + CONVERTER = scope:religious_leader + OLD_CULTURE = scope:religious_leader.culture + NEW_CULTURE = scope:chosen_basque_culture + } + } + # If this hasn't worked at all, and they've got _any_ counties left, we just switch you to the regular Basque. + else_if = { + limit = { + culture:basque = { + any_culture_county = { exists = this } + } + } + convert_family_culture_and_notify_vassals_effect = { + CONVERTER = scope:religious_leader + OLD_CULTURE = scope:religious_leader.culture + NEW_CULTURE = culture:basque + } + } + # Otherwise, we presume that the Basque presence in the region is extinct or negligible (at least on the macro level), so we leave your culture alone. + } + # Assign a new nickname, if appropriate. + if = { + limit = { + OR = { + has_any_nickname = no + has_bad_nickname = yes + } + } + # If you're not already a pagan, guess what folks call you? + if = { + limit = { + NOT = { + faith = { has_doctrine = pagan_hostility_doctrine } + } + } + give_nickname = nick_the_pagan + } + # Otherwise, you're probably an invading Viking and you deserve to get memed. + else = { give_nickname = nick_the_mountain_king } + } + # Switch to the new faith. + add_character_flag = { + flag = delay_player_faith_conversion_notification_event + days = 1 + } + # Configure Basque paganism's variable set-up. + faith:basque_pagan = { + # Remove the restrictions on converting to Basque paganism. + remove_variable = block_conversion_till_decision_taken + # And, since you're inherently creating a new priestly structure + ## This is mostly done here for immersive reasons; we don't want to imply that Basque paganism already had a distinct organised religious hierarchy in 867 by just applying this on game start, even though you'll always have to have it to access the faith. + set_variable = { name = has_been_reformed } + remove_doctrine = unreformed_faith_doctrine + } + # Finally, convert. + ## We do this here so that it's reformed by the time you switch (giving you a better chance with vassal conversion rates). + set_character_faith_with_conversion = faith:basque_pagan + } +} + +favour_the_countryside_basques_decision_fundamentalist_path_scripted_effect = { + faith:basque_pagan = { + # First, we remove Christian Syncretism & replace it with Warmonger. + remove_doctrine = tenet_christian_syncretism + add_doctrine = tenet_warmonger + # Then, we switch on over from Pluralist to Fundamentalist. + ## We disguise some of these changes for neatness, as there's a lot to process. + hidden_effect = { remove_doctrine = doctrine_pluralism_pluralistic } + add_doctrine = doctrine_pluralism_fundamentalist + # No HoF becomes a spiritual HoF, so that you can make use of your Warmonger GHWs. + hidden_effect = { remove_doctrine = doctrine_no_head } + add_doctrine = doctrine_spiritual_head + # Plus, set the faith's fervour to a middling/low level, since you've messed with it. + change_fervor = { + value = -50 + desc = fervour_loss_temporal_meddling + } + } + # Create the new HoF. + hidden_effect = { + scope:religious_leader = { + set_up_dynamic_spiritual_hof_title_effect = { CREATOR = scope:religious_leader } + } + } + custom_tooltip = favour_the_countryside_basques_decision.tt.spiritual_hof_acquired + # We get a small modifier for clergy approval, since they're a bit peeved at the tenet-messing. + add_character_modifier = fp2_friend_of_the_old_ways_modifier +} + +favour_the_countryside_basques_decision_righteous_path_scripted_effect = { + faith:basque_pagan = { + # First, we remove Christian Syncretism & replace it with Sanctity of Nature. + remove_doctrine = tenet_christian_syncretism + add_doctrine = tenet_sanctity_of_nature + # Then, we switch on over from Pluralist to Righteous. + ## We disguise some of these changes for neatness, as there's a lot to process. + hidden_effect = { remove_doctrine = doctrine_pluralism_pluralistic } + add_doctrine = doctrine_pluralism_righteous + # No HoF becomes you as the temporal HoF, as you're focusing more on the non-Christian parts of the faith. + hidden_effect = { + remove_doctrine = doctrine_no_head + remove_doctrine = doctrine_theocracy_temporal + remove_doctrine = doctrine_clerical_succession_spiritual_appointment + } + add_doctrine = doctrine_temporal_head + add_doctrine = doctrine_theocracy_lay_clergy + add_doctrine = doctrine_clerical_succession_temporal_fixed_appointment + # Plus, set the faith's fervour to a middling/low level, since you've messed with it. + change_fervor = { + value = -50 + desc = fervour_loss_temporal_meddling + } + } + # Create the new HoF. + hidden_effect = { + scope:religious_leader = { + set_up_dynamic_temporal_hof_title_effect = { NEW_HOLDER = scope:religious_leader } + } + } + custom_tooltip = favour_the_countryside_basques_decision.tt.temporal_hof_acquired + # We get a small modifier for clergy approval, since they're a bit peeved at the tenet-messing. + add_character_modifier = fp2_friend_of_the_old_ways_modifier +} + +favour_the_countryside_basques_decision_pluralist_path_scripted_effect = { + faith:basque_pagan = { + # First, we mostly only need to remove Christian Syncretism & replace it with Islamic Syncretism. + remove_doctrine = tenet_christian_syncretism + add_doctrine = tenet_islamic_syncretism + # Then set the faith's fervour to a middling/low level, since you've messed with it. + change_fervor = { + value = -50 + desc = fervour_loss_temporal_meddling + } + } + # Bonus opinion with every neighbouring Islamic ruler & their vassals, who appreciate the direction you're going in. + ## Compile a list. + top_liege = { + if = { + limit = { religion = religion:islam_religion } + add_to_list = pleased_rulers + } + every_vassal_or_below = { + limit = { religion = religion:islam_religion } + add_to_list = pleased_rulers + } + } + every_neighboring_and_across_water_top_liege_realm_owner = { + if = { + limit = { religion = religion:islam_religion } + add_to_list = pleased_rulers + } + every_vassal_or_below = { + limit = { religion = religion:islam_religion } + add_to_list = pleased_rulers + } + } + ## And apply some opinions. + every_in_list = { + list = pleased_rulers + custom = favour_the_countryside_basques_decision.tt.all_neighbouring_islamic_rulers + add_opinion = { + target = scope:religious_leader + modifier = pleased_opinion + opinion = 30 + } + } + # We get a small modifier for clergy approval, since they're a bit peeved at the tenet-messing. + add_character_modifier = fp2_friend_of_the_old_ways_modifier +} + +favour_the_countryside_basques_decision_default_path_scripted_effect = { + faith:basque_pagan = { + # Here, we're not fiddling with the faith's traditions at all, so we get a chonky fervour bonus for the sudden limelight. + change_fervor = { + value = 100 + desc = fervour_gain_unexpected_resurgence + } + } + # Plus a massive chunk of piety experience... + add_piety_experience = 2000 + # ... and a more powerful clergy-approval modifier. + add_character_modifier = fp2_champion_of_the_old_ways_modifier +} + +create_kingdom_of_saxony_effect = { + if = { + limit = { + NOR = { + root = $CHARACTER$ + exists = scope:new_saxon_king + } + } + # Grant every held title in Saxony to the new holder + root = { + every_held_title = { + limit = { + OR = { + title:k_saxony = { is_de_jure_liege_or_above_target = prev } + title:k_sorbia = { is_de_jure_liege_or_above_target = prev } + } + NOT = { + holder = { capital_county = prev } + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + change_title_holder = { + holder = $CHARACTER$ + change = scope:title_change + } + resolve_title_and_vassal_change = scope:title_change + } + } + } + if = { + limit = { exists = title:k_sorbia.holder } + destroy_title = title:k_sorbia + } + title:k_sorbia = { + every_in_de_jure_hierarchy = { + limit = { tier = tier_duchy } + set_de_jure_liege_title = title:k_saxony + } + } + title:k_saxony = { set_coa = k_saxon_electorate } + title:k_saxony = { set_de_jure_liege_title = title:e_hre } + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + if = { + limit = { + has_title = title:e_hre + } + hidden_effect = { + title:k_saxony = { + change_title_holder = { + holder = $CHARACTER$ + change = scope:title_change + } + } + } + } + else = { + title:k_saxony = { + change_title_holder = { + holder = $CHARACTER$ + change = scope:title_change + } + } + } + every_vassal = { + limit = { + primary_title = { + OR = { + title:k_saxony = { is_de_jure_liege_or_above_target = prev } + title:k_sorbia = { is_de_jure_liege_or_above_target = prev } + } + } + NOT = { this = $CHARACTER$ } + NOT = { any_liege_or_above = { this = $CHARACTER$ } } + } + change_liege = { + liege = $CHARACTER$ + change = scope:title_change + } + } + hidden_effect = { + if = { + limit = { + NOR = { + $CHARACTER$ = root + $CHARACTER$ = { is_vassal_or_below_of = root } + } + } + $CHARACTER$ = { + change_liege = { + liege = root + change = scope:title_change + } + } + } + } + resolve_title_and_vassal_change = scope:title_change + hidden_effect = { + $CHARACTER$ = { save_scope_as = new_saxon_king } + every_player = { + limit = { + this != prev + or = { + is_vassal_or_below_of = title:e_hre.holder + AND = { + exists = title:e_west_slavia + is_vassal_or_below_of = title:e_west_slavia.holder + } + title:e_hre = { is_neighbor_to_realm = prev } + primary_title = { + title:e_west_slavia = { is_de_jure_liege_or_above_target = prev } + } + } + } + trigger_event = middle_europe_decisions.0018 + } + } +} + +restore_old_vasconia_decision_scripted_effect = { + save_scope_as = founder + # Give Navarra if not held + if = { + limit = { + NOT = { has_title = title:k_navarra } + } + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:k_navarra = { + change_title_holder = { + holder = root + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + } + title:k_navarra = { set_title_name = k_vasconia } + hidden_effect = { + # Transfer de jure + every_in_list = { + list = vasconia_duchies + limit = { + save_temporary_scope_as = duchy_temp + root = { completely_controls = scope:duchy_temp } + NOT = { de_jure_liege = title:k_navarra } + } + add_to_list = vasconia_transfers + set_de_jure_liege_title = title:k_navarra + } + # Destroy held superseded kingdoms (no de jure land left) + every_in_list = { + list = vasconia_kingdoms + limit = { + holder = root + any_direct_de_jure_vassal_title = { count < 1 } + } + add_to_list = superseded_kingdoms + save_scope_as = superseded_kingdom + root = { destroy_title = scope:superseded_kingdom } + } + } +} + +restore_old_vasconia_decision_tooltip_scripted_effect = { + custom_tooltip = restore_old_vasconia_decision_vasconia_past_tt + show_as_tooltip = { + every_in_list = { + list = vasconia_transfers + set_de_jure_liege_title = title:k_navarra + } + every_in_list = { + list = superseded_kingdoms + save_scope_as = superseded_kingdom + root = { destroy_title = scope:superseded_kingdom } + } + } +} + +create_beth_nahrain_scripted_effect = { + #Create Beth Nahrain + hidden_effect = { + every_held_title = { + limit = { + tier = tier_empire + } + every_in_de_jure_hierarchy = { + limit = { + tier = tier_kingdom + } + set_de_jure_liege_title = title:e_beth_nahrain + } + } + } +} + +promote_culture_beth_nahrain_scripted_effect = { + every_sub_realm_county = { + custom = promote_culture_beth_nahrain_modifier_custom_desc + limit = { + NOT = { + culture = { has_cultural_pillar = heritage_syriac } + } + title_province = { geographical_region = custom_beth_nahrain } + } + add_county_modifier = { + modifier = promote_culture_beth_nahrain_modifier + years = 50 + } + } + if = { + limit = { + faith = faith:nestorian + } + faith:nestorian = { + change_fervor = { + value = 100 + desc = middle_east_major_decisions.1020_fervor + } + } + } + else_if = { + limit = { + NOT = { + exists = scope:suppress_tooltips + } + } + custom_tooltip = middle_east_major_decisions.1020.lack_nestorian + } +} + +learning_beth_nahrain_scripted_effect = { + house ?= { + add_house_modifier = { + modifier = learning_beth_nahrain_house_modifier + years = 100 + } + } + add_piety_experience = monumental_piety_value +} + +martial_beth_nahrain_scripted_effect = { + house ?= { + add_house_modifier = { + modifier = martial_beth_nahrain_house_modifier + years = 100 + } + } + add_prestige_experience = monumental_prestige_value +} + +nestorian_faith_beth_nahrain_scripted_effect = { + add_trait = crusader_king + add_piety_experience = monumental_piety_value +} + +no_faith_beth_nahrain_scripted_effect = { + faith:nestorian = { + change_fervor = { + value = 100 + desc = middle_east_major_decisions.1020_fervor + } + } + set_character_faith_with_conversion = faith:nestorian + add_piety = monumental_piety_gain +} + +found_empire_of_hindustan_scripted_effect = { + save_scope_as = founder + + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + if = { + limit = { + completely_controls = title:k_punjab #This will always be true but it keeps the decision text easier to read before you fulfill the criteria + NOT = { has_title = title:k_punjab } + } + title:k_punjab = { + change_title_holder = { + holder = root + change = scope:title_change + } + } + } + if = { + limit = { + completely_controls = title:k_delhi #This will always be true but it keeps the decision text easier to read before you fulfill the criteria + NOT = { has_title = title:k_delhi } + } + title:k_delhi = { + change_title_holder = { + holder = root + change = scope:title_change + } + } + } + if = { + limit = { + OR = { + NOT = { title:d_kuru.holder = root } + AND = { + exists = title:d_kuru.holder + title:d_kuru.holder = { + is_ai = yes + } + } + } + } + title:d_kuru = { + change_title_holder = { + holder = root + change = scope:title_change + } + } + } + if = { + limit = { + NOT = { title:c_delhi.holder = root } + } + title:c_delhi = { + change_title_holder = { + holder = root + change = scope:title_change + } + } + } + title:e_hindustan = { + change_title_holder = { + holder = root + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + set_primary_title_to = title:e_hindustan + + hidden_effect = { + title:k_delhi = { + set_de_jure_liege_title = title:e_hindustan + } + title:k_punjab = { + set_de_jure_liege_title = title:e_hindustan + } + every_held_title = { + limit = { + tier = tier_kingdom + OR = { + de_jure_liege = title:e_bengal + de_jure_liege = title:e_deccan + de_jure_liege = title:e_rajastan + } + } + set_de_jure_liege_title = title:e_hindustan + } + #Areas that have had more muslim influence wants to avoid border gore and gets added even if not held - unless controlled by an independent Emperor of Rajastan: + if = { + limit = { + NOT = { + title:k_sindh.holder.liege = { + has_title = title:e_rajastan + } + } + } + title:k_sindh = { + set_de_jure_liege_title = title:e_hindustan + } + } + if = { + limit = { + NOT = { + title:k_kashmir.holder.liege = { + has_title = title:e_rajastan + } + } + } + title:k_kashmir = { + set_de_jure_liege_title = title:e_hindustan + } + } + add_character_flag = e_hindustan #For title flavorization + } + #If the new Emperor of Hindustan holds any of the Indian Empires these are destroyed and their kingdoms added to Hindustan too + #This is not inside the hidden block to not hide that the empires are destroyed. + if = { + limit = { + has_title = title:e_bengal + } + hidden_effect = { + title:e_bengal = { + every_in_de_jure_hierarchy = { + limit = { + tier = tier_kingdom + } + set_de_jure_liege_title = title:e_hindustan + } + } + } + destroy_title = title:e_bengal + } + if = { + limit = { + has_title = title:e_deccan + } + hidden_effect = { + title:e_deccan = { + every_in_de_jure_hierarchy = { + limit = { + tier = tier_kingdom + } + set_de_jure_liege_title = title:e_hindustan + } + } + } + destroy_title = title:e_deccan + } + if = { + limit = { + has_title = title:e_rajastan + } + hidden_effect = { + title:e_rajastan = { + every_in_de_jure_hierarchy = { + limit = { + tier = tier_kingdom + } + set_de_jure_liege_title = title:e_hindustan + } + } + } + destroy_title = title:e_rajastan + } + custom_tooltip = found_empire_of_hindustan_decision_effects_de_jure_tt + hidden_effect = { + if = { # Let's see if you have ultimo and save that if so + limit = { + has_realm_law = single_heir_succession_law_youngest + } + save_scope_as = set_ultimo_temp_scope + } + } + if = { + limit = { has_dlc_feature = admin_gov } + convert_to_administrative_from_feudalism_effect = yes + } + hidden_effect = { + if = { # If you had ultimo, you get to keep it. Otherwise, you get primo for free. + limit = { + exists = scope:set_ultimo_temp_scope + } + add_realm_law = single_heir_succession_law_youngest + } + else = { + add_realm_law = single_heir_succession_law + } + } + add_legitimacy_effect = { LEGITIMACY = massive_legitimacy_gain } + dynasty = { add_dynasty_prestige = massive_dynasty_prestige_value } +} diff --git a/N3OW/common/scripted_effects/00_major_decisions_scripted_effects_2.txt b/N3OW/common/scripted_effects/00_major_decisions_scripted_effects_2.txt new file mode 100644 index 00000000..266c5c0d --- /dev/null +++ b/N3OW/common/scripted_effects/00_major_decisions_scripted_effects_2.txt @@ -0,0 +1,326 @@ +defenders_of_highgod_decision_hall_of_heroes_effect = { + set_variable = { + name = hall_of_heroes + value = yes + } + if = { + limit = { + has_special_building_slot = no + } + add_special_building_slot = hall_of_heroes_01 + } + add_special_building = hall_of_heroes_01 +} + +defenders_of_highgod_decision_effects = { + #Holy site building + #if = { + # limit = { + # faith = { + # any_holy_site = { + # count = 1 + # county.holder = root + # } + # } + # } + # faith = { + # every_holy_site = { + # limit = { county.holder = root } + # county.title_province = { defenders_of_highgod_decision_hall_of_heroes_effect = yes } + # } + # } + #} + if = { #The scope has been saved before this effect is run + limit = { exists = scope:holy_site } + scope:holy_site = { county.title_province = { defenders_of_highgod_decision_hall_of_heroes_effect = yes } } + } + else = { + faith = { + every_holy_site = { + county.title_province = { + add_to_list = every_holy_site_province + } + } + } + + show_as_tooltip = { + every_in_list = { + list = every_holy_site_province + custom = defenders_of_highgod_decision_effects_holy_site_of_choice + defenders_of_highgod_decision_hall_of_heroes_effect = yes + } + } + } + + #Fervor, modifiers and holy_warrior traits + faith = { + save_scope_as = highgod_faith_scope + change_fervor = { + value = medium_fervor_value + desc = fervor_gain_defenders_of_highgod + } + } + add_character_modifier = { + modifier = defender_of_the_faith + } + + if = { + limit = { number_of_commander_traits < commander_trait_limit } + add_trait = holy_warrior + } + + custom_tooltip = defenders_of_highgod_decision_effects_holy_warriors_tt + hidden_effect = { + every_vassal_or_below = { + add_to_list = warriors + } + every_courtier = { + add_to_list = warriors + } + every_in_list = { + list = warriors + limit = { + is_adult = yes + is_ai = yes + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } + number_of_commander_traits < commander_trait_limit + faith = root.faith + } + random = { + chance = 50 + add_trait = holy_warrior + } + } + } +} + +strengthen_bloodline_decision_effects = { + dynasty = { + add_dynasty_modifier = { + modifier = strong_blood + } + } +} + +dynasty_of_many_crowns_effects = { + if = { + limit = { + NOT = { + has_character_flag = dyn_many_crown_leg + } + } + add_character_flag = dyn_many_crown_leg + } + if = { + limit = { + domicile ?= { + has_domicile_building_or_higher = renown_gain_yurt_01 + } + } + if = { + limit = { + domicile ?= { + has_domicile_parameter = nomad_yurt_dynasty_many_crowns_bonus + } + } + every_dynasty_member = { + limit = { + government_has_flag = government_is_nomadic + primary_title ?= { + tier >= tier_kingdom + } + } + domicile ?= { + change_herd = { + value = 1000 + multiply = prev.primary_title.tier + } + } + } + } + if = { + limit = { + domicile ?= { + has_domicile_parameter = nomad_yurt_dynasty_many_khans + } + } + dynasty = { + add_dynasty_modifier = { + modifier = dynasty_of_many_crowns_nomad + } + } + } + + } + dynasty = { + add_dynasty_modifier = { + modifier = dynasty_of_many_crowns + } + add_dynasty_prestige = monumental_dynasty_prestige_gain + } +} + +appoint_a_righteous_caliph_scripted_effect = { + # Create a HoF title & assign it appropriately. + hidden_effect = { + # Are we Muwalladis? + if = { + limit = { faith = faith:muwalladi } + # Transfer the title. + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + title:d_muwalladi = { + change_title_holder = { + holder = scope:founder + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + # Set up the remaining bits'n'bobs. + if = { + limit = { + NOT = { has_realm_law = same_faith_succession_law } + } + add_realm_law_skip_effects = same_faith_succession_law + } + title:d_muwalladi = { add_title_law = temporal_head_of_faith_succession_law } + # Make it the HoF head. + faith = { set_religious_head_title = title:d_muwalladi } + } + # If not, follow the usual flow. + else = { + set_up_dynamic_temporal_hof_title_effect = { NEW_HOLDER = scope:founder } + faith = { set_religious_head_title = scope:new_title } + } + } + custom_tooltip = appoint_a_righteous_caliph_decision.tt.you_become_caliph + # Give scope:founder an extra piety level, if possible. + if = { + limit = { piety_level < max_piety_level } + add_piety_level = 1 + } + # Try to scope:founder rivals with scope:old_caliph. + if = { + limit = { + can_set_relation_rival_trigger = { CHARACTER = scope:old_caliph } + } + set_relation_rival = { + target = scope:old_caliph + reason = rival_old_caliph_new_caliph + } + } + # If you've pulled a fast one on your HoF, they see through it. + if = { + limit = { has_character_flag = wishes_to_schism_caliphate_flag } + scope:old_caliph = { + remove_opinion = { + target = scope:founder + modifier = repentant_opinion + } + } + remove_hook = { + target = scope:old_caliph + type = indebted_hook + } + } + # And sort a bit of stress impact for the gravity of things. + stress_impact = { + base = major_stress_impact_gain + humble = major_stress_impact_gain + arrogant = medium_stress_impact_loss + } +} + +mozarabic_bind_the_faith_to_rome_decision_fundamentalist_path_scripted_effect = { + # Set the doctrinal alterations. + faith = { + # First, we remove the Rite tenet & replace it with Pursuit of Power. + remove_doctrine = tenet_rite + add_doctrine = tenet_pursuit_of_power + # Then we switch on over from Pluralist to Fundamentalist. + remove_doctrine = doctrine_pluralism_pluralistic + add_doctrine = doctrine_pluralism_fundamentalist + } +} + +mozarabic_bind_the_faith_to_rome_decision_righteous_path_scripted_effect = { + # Set the doctrinal alterations. + faith = { + # First, we remove the Rite tenet & replace it with Communal Identity. + remove_doctrine = tenet_rite + add_doctrine = tenet_communal_identity + # Then, we switch on over from Pluralist to Righteous so that we're actually receiving a net bonus. + remove_doctrine = doctrine_pluralism_pluralistic + add_doctrine = doctrine_pluralism_righteous + } +} + +mozarabic_bind_the_faith_to_rome_decision_pluralist_path_scripted_effect = { + # Set the doctrinal alterations. + faith = { + # First, we remove the Rite tenet & replace it with Religious Law. + remove_doctrine = tenet_rite + add_doctrine = tenet_religious_legal_pronouncements + # Then, since we're staying pluralist, we make the court chaplain fireable (since you're now really into the nitty-gritty of canon law). + remove_doctrine = doctrine_clerical_succession_spiritual_fixed_appointment + add_doctrine = doctrine_clerical_succession_spiritual_appointment + } +} + +mozarabic_break_with_rome_decision_hof_and_ecumenism_processing_scripted_effect = { + # Sort the HoF situation. + hidden_effect = { + # Create & swap-in the title. + set_up_dynamic_spiritual_hof_title_effect = { CREATOR = scope:religious_leader } + # & send out some visual notifications. + every_player = { + limit = { faith = scope:religious_leader.faith } + send_interface_toast = { + title = mozarabic_break_with_rome_decision.tt.new_hof_id + left_icon = scope:religious_leader.faith.religious_head + } + } + } + custom_tooltip = mozarabic_break_with_rome_decision.tt.you_gain_a_hof + # Remove ecumenism. + faith = { remove_doctrine = special_doctrine_ecumenical_christian} +} + +mozarabic_break_with_rome_decision_fundamentalist_path_scripted_effect = { + # Set the doctrinal alterations. + faith = { + # First, we remove the Rite tenet & replace it with Armed Pilgrimages. + remove_doctrine = tenet_rite + add_doctrine = tenet_armed_pilgrimages + # Then we switch on over from Pluralist to Fundamentalist. + remove_doctrine = doctrine_pluralism_pluralistic + add_doctrine = doctrine_pluralism_fundamentalist + } +} + +mozarabic_break_with_rome_decision_righteous_path_scripted_effect = { + # Set the doctrinal alterations. + faith = { + # First, we remove the Rite tenet & replace it with Pacifism. + remove_doctrine = tenet_rite + add_doctrine = tenet_pacifism + # Then, we switch on over from Pluralist to Righteous. + remove_doctrine = doctrine_pluralism_pluralistic + add_doctrine = doctrine_pluralism_righteous + } +} + +mozarabic_break_with_rome_decision_pluralist_path_scripted_effect = { + # Set the doctrinal alterations. + faith = { + # First, we remove the Rite tenet & replace it with Islamic Syncretism. + remove_doctrine = tenet_rite + add_doctrine = tenet_islamic_syncretism + # Then, since we're staying pluralist, we make the court chaplain fireable (since you've *really* localised power now). + remove_doctrine = doctrine_clerical_succession_spiritual_fixed_appointment + add_doctrine = doctrine_clerical_succession_temporal_appointment + } +} diff --git a/N3OW/common/scripted_effects/00_major_decisions_scripted_effects_3.txt b/N3OW/common/scripted_effects/00_major_decisions_scripted_effects_3.txt new file mode 100644 index 00000000..d22d65e9 --- /dev/null +++ b/N3OW/common/scripted_effects/00_major_decisions_scripted_effects_3.txt @@ -0,0 +1,919 @@ +take_stewardship_of_the_sacred_river_effect = { + give_nickname = nick_the_ladylord_of_the_ganges + add_piety_level = 1 + add_character_modifier = { + modifier = ruler_of_the_ganges_modifier + } + if = { + limit = { + exists = global_var:ruler_of_ganges + } + if = { + limit = { + NOT = { faith = global_var:ruler_of_ganges.faith} + } + faith = { + save_scope_as = ganges_faith + change_fervor = { + value = major_fervor_gain + desc = fervor_gain_stewardship_of_sacred_rivers + } + } + } + if = { + limit = { + global_var:ruler_of_ganges = { + is_alive = yes + } + } + show_as_tooltip = { + global_var:ruler_of_ganges = { + add_opinion = { + target = root + modifier = humbled_opinion + opinion = -40 + } + } + } + } + } + hidden_effect = { + set_global_variable = { + name = ruler_of_ganges + value = root + } + } +} + + +establish_bactrian_supremacy_effect = { + #Create the title and make it primary + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:e_bactria = { + change_title_holder = { + holder = root + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + set_primary_title_to = title:e_bactria + + title:c_balkh = { + add_county_modifier = { + modifier = bactria_royal_tolls_modifier + } + } + + hidden_effect = { + every_held_title = { + title_tier = empire + limit = { + NOT = { this = title:e_bactria } + } + every_in_de_jure_hierarchy = { + continue = { + tier >= tier_kingdom + } + limit = { + tier = tier_kingdom + OR = { + holder = root + holder = { target_is_liege_or_above = root } + } + NOT = { is_in_list = new_de_jure_kingdoms } + } + add_to_list = new_de_jure_kingdoms + } + add_to_list = empire_for_destruction + } + + every_held_title = { + title_tier = kingdom + limit = { + NOT = { is_in_list = new_de_jure_kingdoms } + } + add_to_list = new_de_jure_kingdoms + } + + title:k_kabulistan = { + if = { + limit = { + NOT = { is_in_list = new_de_jure_kingdoms } + } + add_to_list = new_de_jure_kingdoms + } + } + title:k_khorasan = { + if = { + limit = { + NOT = { is_in_list = new_de_jure_kingdoms } + } + add_to_list = new_de_jure_kingdoms + } + } + title:k_transoxiana = { + if = { + limit = { + NOT = { is_in_list = new_de_jure_kingdoms } + } + add_to_list = new_de_jure_kingdoms + } + } + every_in_list = { + list = new_de_jure_kingdoms + limit = { + trigger_if = { + limit = { + exists = this + root = { is_ai = yes } + exists = holder + } + NOR = { + holder.top_liege = { is_ai = no } + holder = { is_ai = no } + } + } + } + set_de_jure_liege_title = title:e_bactria + } + every_in_list = { + list = empire_for_destruction + limit = { + NOT = { this = title:e_bactria } #Just a little safeguarding + } + root = { + destroy_title = prev + } + } + + #Notifications for characters who hold land that is now claimed + title:e_bactria = { + every_in_de_jure_hierarchy = { + continue = { + tier >= tier_duchy + } + limit = { + holder ?= { + NOR = { + this = root + target_is_liege_or_above = root + } + } + } + holder = { + if = { + limit = { + NOT = { is_in_list = notification_sent } + } + add_to_temporary_list = notification_sent + trigger_event = central_asia.0013 + } + } + } + } + + every_vassal = { + limit = { + NOT = { + is_in_list = notification_sent + } + } + trigger_event = central_asia.0012 + } + } +} + +create_custom_duchy_effect = { + save_scope_as = root_scope + custom_tooltip = create_new_duchy + show_as_tooltip = { + primary_title = { + custom_tooltip = create_custom_duchy_de_jure_changes + } + } + + hidden_effect = { + save_scope_as = founder + primary_title = { + save_scope_as = old_title + } + + create_dynamic_title = { + tier = duchy + name = NEW_CREATED_TITLE_NAME + } + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + + scope:new_title = { + change_title_holder = { + holder = root + change = scope:change + } + } + + resolve_title_and_vassal_change = scope:change + + scope:new_title = { + set_de_jure_liege_title = scope:old_title.kingdom + } + scope:old_title = { + set_de_jure_liege_title = scope:new_title + } + + scope:new_title = { + set_coa = scope:old_title + set_color_from_title = scope:old_title + set_capital_county = scope:old_title.title_capital_county + } + set_primary_title_to = scope:new_title + + trigger_event = major_decisions.1101 + } +} + +create_custom_kingdom_effect = { + custom_tooltip = create_new_kingdom + show_as_tooltip = { + every_held_title = { + custom = create_title_every_held_duchy + title_tier = duchy + custom_tooltip = create_custom_kingdom_de_jure_changes + } + } + + hidden_effect = { + save_scope_as = founder + primary_title = { + save_scope_as = old_title + } + + create_dynamic_title = { + tier = kingdom + name = NEW_CREATED_TITLE_NAME + } + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + + scope:new_title = { + change_title_holder = { + holder = root + change = scope:change + } + } + + resolve_title_and_vassal_change = scope:change + + #Check if all territory is from a single Empire, and if so, make Kingdom de jure of that Empire + every_sub_realm_county = { + if = { + limit = { + exists = empire + } + empire = { + if = { + limit = { + NOT = { + is_in_list = potential_empires + } + } + add_to_list = potential_empires + } + } + } + } + if = { + limit = { + any_in_list = { + list = potential_empires + count > 0 + } + } + ordered_in_list = { + list = potential_empires + order_by = { + every_in_de_jure_hierarchy = { + continue = { + tier > tier_county + } + limit = { + tier = tier_county + holder.top_liege = root + } + add = 1 + } + } + position = 0 + save_scope_as = old_empire + } + } + if = { + limit = { + exists = scope:old_empire + } + scope:new_title = { + set_de_jure_liege_title = scope:old_empire + } + } + + every_held_title = { + title_tier = duchy + if = { + limit = { + #Check if you need to notify a player + OR = { + AND = { + kingdom ?= { + holder ?= { + this != root + is_ai = no + } + } + } + AND = { + empire ?= { + holder ?= { + this != root + is_ai = no + } + } + } + } + } + add_to_temporary_list = duchy_for_notification + root = { + save_temporary_scope_value_as = { + name = send_notifications + value = yes + } + } + } + set_de_jure_liege_title = scope:new_title + } + + every_sub_realm_county = { + limit = { + exists = duchy + NOT = { exists = duchy.holder } + holder.top_liege = root + duchy = { + save_temporary_scope_as = test_duchy + } + holder.top_liege = { + completely_controls = scope:test_duchy + } + } + if = { + limit = { + NOT = { + duchy = { + is_in_list = additional_de_jure_duchies + } + } + } + duchy = { + set_de_jure_liege_title = scope:new_title + add_to_list = additional_de_jure_duchies + } + } + } + + scope:new_title = { + set_coa = scope:old_title + set_color_from_title = scope:old_title + set_capital_county = scope:old_title.title_capital_county + } + set_primary_title_to = scope:new_title + + trigger_event = major_decisions.1101 + + every_player = { + if = { + limit = { + top_liege = scope:founder + this != root + } + trigger_event = major_decisions.1102 + } + else_if = { + limit = { + exists = scope:send_notifications + this != root + top_liege != scope:founder + any_held_title = { + any_in_de_jure_hierarchy = { + continue = { + tier > tier_duchy + } + tier = tier_duchy + is_in_list = duchy_for_notification + } + } + } + every_held_title = { + every_in_de_jure_hierarchy = { + continue = { + tier > tier_duchy + } + limit = { + tier = tier_duchy + is_in_list = duchy_for_notification + } + add_to_list = notification_titles + } + } + if = { + limit = { + any_in_list = { + list = notification_titles + count > 0 + } + } + trigger_event = major_decisions.1105 + } + } + } + } +} + +create_custom_empire_effect = { + custom_tooltip = create_new_empire + show_as_tooltip = { + every_held_title = { + custom = create_title_every_held_kingdom + title_tier = kingdom + custom_tooltip = create_custom_empire_de_jure_changes + } + } + + hidden_effect = { + save_scope_as = founder + primary_title = { + save_scope_as = old_title + } + + create_dynamic_title = { + tier = empire + name = NEW_CREATED_TITLE_NAME + } + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + + scope:new_title = { + change_title_holder = { + holder = root + change = scope:change + } + } + + resolve_title_and_vassal_change = scope:change + + every_held_title = { + title_tier = kingdom + if = { + limit = { + #Check if you need to notify a player + empire ?= { + holder ?= { + this != root + is_ai = no + } + } + } + add_to_temporary_list = kingdoms_for_notification + root = { + save_temporary_scope_value_as = { + name = send_notifications + value = yes + } + } + } + set_de_jure_liege_title = scope:new_title + } + + every_sub_realm_county = { + limit = { + exists = kingdom + NOT = { exists = kingdom.holder } + holder.top_liege = root + kingdom = { + save_temporary_scope_as = test_kingdom + } + holder.top_liege = { + completely_controls = scope:test_kingdom + } + } + if = { + limit = { + NOT = { + kingdom = { + is_in_list = additional_de_jure_kingdoms + } + } + } + kingdom = { + set_de_jure_liege_title = scope:new_title + add_to_list = additional_de_jure_kingdoms + } + } + } + + scope:new_title = { + set_coa = scope:old_title + set_color_from_title = scope:old_title + set_capital_county = scope:old_title.title_capital_county + } + set_primary_title_to = scope:new_title + + trigger_event = major_decisions.1103 + + every_player = { + if = { + limit = { + top_liege = scope:founder + this != root + } + trigger_event = major_decisions.1104 + } + else_if = { + #Notify any players who lose de jure territory + limit = { + exists = scope:send_notifications + this != root + top_liege != scope:founder + any_held_title = { + any_in_de_jure_hierarchy = { + continue = { + tier > tier_kingdom + } + tier = tier_kingdom + is_in_list = kingdoms_for_notification + } + } + } + every_held_title = { + every_in_de_jure_hierarchy = { + continue = { + tier > tier_kingdom + } + limit = { + tier = tier_kingdom + is_in_list = kingdoms_for_notification + } + add_to_list = notification_titles + } + } + if = { + limit = { + any_in_list = { + list = notification_titles + count > 0 + } + } + trigger_event = major_decisions.1105 + } + } + } + } +} + +break_with_old_ways_become_fundamentalist = { + remove_doctrine = unreformed_faith_doctrine + remove_doctrine = tenet_unreformed_syncretism + add_doctrine = tenet_armed_pilgrimages + remove_doctrine = doctrine_pluralism_pluralistic + add_doctrine = doctrine_pluralism_fundamentalist +} + +break_with_old_ways_become_righteous = { + remove_doctrine = unreformed_faith_doctrine + remove_doctrine = tenet_unreformed_syncretism + add_doctrine = tenet_esotericism + remove_doctrine = doctrine_pluralism_pluralistic + add_doctrine = doctrine_pluralism_righteous +} + +break_with_old_ways_become_chosen_people = { + remove_doctrine = unreformed_faith_doctrine + remove_doctrine = tenet_unreformed_syncretism + add_doctrine = tenet_communal_identity + remove_doctrine = doctrine_pluralism_pluralistic + add_doctrine = doctrine_pluralism_righteous +} + +#EP3 +retake_eastern_provinces_decision_effect = { + save_scope_as = root_scope + add_trait = augustus + give_nickname = nick_the_great + change_influence = { + value = massive_influence_gain + multiply = 5 + } + custom_tooltip = { + text = every_county_in_theodosian_region + title:k_bulgaria = { set_de_jure_liege_title = title:e_byzantium } + title:k_epirus = { set_de_jure_liege_title = title:e_byzantium } + title:k_hellas = { set_de_jure_liege_title = title:e_byzantium } + title:k_thessalonika = { set_de_jure_liege_title = title:e_byzantium } + title:k_krete = { set_de_jure_liege_title = title:e_byzantium } + title:k_cyprus = { set_de_jure_liege_title = title:e_byzantium } + title:k_nikaea = { set_de_jure_liege_title = title:e_byzantium } + title:k_anatolia = { set_de_jure_liege_title = title:e_byzantium } + title:k_pontus = { set_de_jure_liege_title = title:e_byzantium } + title:k_syria = { set_de_jure_liege_title = title:e_byzantium } + title:k_jerusalem = { set_de_jure_liege_title = title:e_byzantium } + title:k_egypt = { set_de_jure_liege_title = title:e_byzantium } + } + add_legitimacy = { + value = massive_legitimacy_gain + multiply = 2 + } + dynasty ?= { + add_dynasty_modifier = retaken_eastern_provinces_modifier + add_dynasty_prestige = 2500 + } + if = { + limit = { + culture = { has_cultural_parameter = holds_triumphs } + } + custom_tooltip = { + text = free_triumph_tooltip + add_character_flag = free_triumph_flag + } + } + gain_legitimizing_legend_seed_tooltip_effect = yes + hidden_effect = { legend_seed_great_deed_dynasty_effect = yes } + every_vassal = { + custom = custom.every_admin_vassal + limit = { government_allows = administrative } + add_opinion = { + target = scope:root_scope + modifier = admiration_opinion + opinion = 20 + } + } +} + +recreate_ere_decision_effect = { + if = { + limit = { + title:c_byzantion.holder = { + this != root + } + } + create_title_and_vassal_change = { + type = revoked + save_scope_as = change + add_claim_on_loss = yes + } + title:c_byzantion = { + change_title_holder = { + holder = root + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + } + # Give the ERE + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + title:e_byzantium = { + change_title_holder = { + holder = root + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + # Make it primary title + set_primary_title_to = title:e_byzantium + # Make admin + if = { + limit = { + NOT = { + government_has_flag = government_is_administrative + } + } + convert_to_administrative_from_feudalism_effect = yes + } + if = { + limit = { + NOT = { + has_realm_law = acclamation_succession_law + } + } + # Give Acclamation succession + add_realm_law_skip_effects = acclamation_succession_law + } + # Set the capital in Constantinople + if = { + limit = { + NOT = { + capital_county = { + this = title:c_byzantion + } + } + } + set_realm_capital = title:c_byzantion + } + # Get free triumph + custom_tooltip = { + text = free_triumph_tooltip + add_character_flag = free_triumph_flag + } + if = { + limit = { + title:e_latin_empire = { + any_in_de_jure_hierarchy = { + tier < tier_empire + } + } + } + title:e_latin_empire = { + every_in_de_jure_hierarchy = { + limit = { + tier = tier_kingdom + } + set_de_jure_liege_title = title:e_byzantium + } + } + + } + change_influence = massive_influence_gain + if = { + limit = { + any_held_title = { + this = title:e_latin_empire + } + } + destroy_title = title:e_latin_empire + } + hidden_effect = { + title:e_byzantium = { set_state_faith = root.faith } + } +} + +reinstitute_grain_dole_decision_effect = { + if = { + limit = { + NOT = { capital_county = { has_variable = unlocked_grain_dole } } + } + custom_tooltip = { + text = half_price_chariot_race_tooltip + add_character_flag = half_price_chariot_race_flag + } + } + every_county_in_region = { + region = custom_roman_aegyptus + limit = { + any_county_province = { + has_building_or_higher = cereal_fields_05 + } + } + add_county_modifier = { + modifier = grain_providers_county_modifier + years = 25 + } + } + capital_county = { + add_county_modifier = { + modifier = panem_et_circenses_county_modifier + years = 25 + } + } + add_legitimacy = medium_legitimacy_gain + if = { + limit = { + NOT = { capital_county = { has_variable = unlocked_grain_dole } } + } + add_prestige = { + value = massive_prestige_gain + multiply = 3 + } + change_influence = { + value = massive_influence_gain + multiply = 3 + } + capital_county = { set_variable = unlocked_grain_dole } + } + else = { + add_prestige = massive_prestige_gain + change_influence = massive_influence_gain + } +} + +create_dar_al_islam_effect = { + save_scope_as = new_hegemon + scope:new_hegemon = { + # Get the title and assorted rewards + get_title = title:h_dar_al_islam + add_prestige = 5000 + dynasty ?= { add_dynasty_prestige = 5000 } + + # Become the head of faith of all islamic faiths that aren't hostile or evil + custom_tooltip = { + text = dar_al_islam_become_head_of_faith_desc + faith.religion = { + every_faith = { + limit = { + faith_hostility_level = { + target = scope:new_hegemon.faith + value < faith_hostile_level + } + } + if = { + limit = { + has_doctrine = doctrine_no_head + } + remove_doctrine = doctrine_no_head + add_doctrine = doctrine_temporal_head + } + else_if = { + limit = { + has_doctrine = doctrine_spiritual_head + } + remove_doctrine = doctrine_spiritual_head + add_doctrine = doctrine_temporal_head + } + if = { + limit = { + has_doctrine = doctrine_theocracy_temporal + } + remove_doctrine = doctrine_theocracy_temporal + add_doctrine = doctrine_theocracy_lay_clergy + } + set_religious_head_title = title:h_dar_al_islam + } + } + } + + # Destroy the old head of faith title, but there's no need to show it + hidden_effect = { + if = { + limit = { exists = var:old_hof_title } + destroy_title = var:old_hof_title + remove_variable = old_hof_title + } + } + + # Show conversion bonus + custom_tooltip = dar_al_islam_muslim_conversion_desc # Bonus is applied in religion_demand_conversion_default_modifier + + # Enable unlimited subjugations + custom_tooltip = { + text = dar_al_islam_subjugation_expanded_desc + house = { + set_variable = { + name = subjugations_expanded + value = yes + } + } + } + + # Show faction bonus + custom_tooltip = dar_al_islam_faction_desc # Actual effect is set up in the faction itself + + # Make all held empires de jure titles + every_held_title = { + limit = { + tier = tier_empire + } + set_de_jure_liege_title = title:h_dar_al_islam + } + } + + # Let's also make all fully controlled empires de jure title, even if you don't hold them + every_empire = { + if = { + limit = { + is_titular = no + trigger_if = { + limit = { exists = holder } + holder != scope:new_hegemon + } + scope:new_hegemon = { completely_controls = prev } + } + set_de_jure_liege_title = title:h_dar_al_islam + } + } + set_global_variable = { + name = created_dar_al_islam + value = yes + } +} diff --git a/N3OW/common/scripted_effects/00_marriage_effects.txt b/N3OW/common/scripted_effects/00_marriage_effects.txt new file mode 100644 index 00000000..837d6e84 --- /dev/null +++ b/N3OW/common/scripted_effects/00_marriage_effects.txt @@ -0,0 +1,114 @@ + +##################################################################### +# EFFECT LIST +##################################################################### +# All effects below determine if a marriage should be matrilineal or not +# marry_on_realm_law - Marry two characters based on Spouse 1's realm law +# marry_spouse_1_dominant - Marry two characters and make Spouse 1 dominant +##################################################################### +# EFFECTS +##################################################################### + + +marry_on_realm_law = { + if = { + limit = { + $SPOUSE_1$ = { is_ruler = yes } + $SPOUSE_1$ = { + OR = { + has_realm_law = male_only_law + has_realm_law = male_preference_law + } + } + } + $SPOUSE_1$ = { marry = $SPOUSE_2$ } + } + else_if = { + limit = { + $SPOUSE_1$ = { is_ruler = no } + $SPOUSE_1$.liege ?= { + OR = { + has_realm_law = male_only_law + has_realm_law = male_preference_law + } + } + } + $SPOUSE_1$ = { marry = $SPOUSE_2$ } + } + else_if = { + limit = { + $SPOUSE_1$ = { is_ruler = yes } + $SPOUSE_1$ = { + OR = { + has_realm_law = female_only_law + has_realm_law = female_preference_law + } + } + } + $SPOUSE_1$ = { marry_matrilineal = $SPOUSE_2$ } + } + else_if = { + limit = { + $SPOUSE_1$ = { is_ruler = no } + $SPOUSE_1$.liege ?= { + OR = { + has_realm_law = female_only_law + has_realm_law = female_preference_law + } + } + } + $SPOUSE_1$ = { marry_matrilineal = $SPOUSE_2$ } + } + else = { + marry_spouse_1_dominant = { + SPOUSE_1 = $SPOUSE_1$ + SPOUSE_2 = $SPOUSE_2$ + } + } +} + + +marry_spouse_1_dominant = { + if = { + limit = { + $SPOUSE_1$ = { is_male = yes } + } + $SPOUSE_1$ = { marry = $SPOUSE_2$ } + } + else = { + $SPOUSE_1$ = { marry_matrilineal = $SPOUSE_2$ } + } +} + +vassals_dislike_marry_lowborn_effect = { + $RULER$ = { + if = { + limit = { + is_lowborn = no + $SPOUSE$ = { is_lowborn = yes } + OR = { + NOT = { exists = primary_spouse } + primary_spouse ?= $SPOUSE$ + } + } + every_vassal_or_below = { + limit = { has_vassal_stance = courtly } + custom = every_courtly_vassal + add_opinion = { + modifier = married_lowborn_opinion + target = $RULER$ + opinion = -50 + } + } + every_vassal_or_below = { + limit = { has_vassal_stance = glory_hound } + custom = every_glory_hound_vassal + add_opinion = { + modifier = married_lowborn_opinion + target = $RULER$ + opinion = -30 + } + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_marriage_interaction_effects.txt b/N3OW/common/scripted_effects/00_marriage_interaction_effects.txt new file mode 100644 index 00000000..627a0dba --- /dev/null +++ b/N3OW/common/scripted_effects/00_marriage_interaction_effects.txt @@ -0,0 +1,1839 @@ +marriage_interaction_on_accept_effect = { + #Use hook + if = { + limit = { always = scope:hook } + scope:actor = { + use_hook = scope:recipient + } + #To make sure betrothals can't be broken if a hook was used + if = { + limit = { + OR = { + scope:secondary_actor = { is_adult = no } + scope:secondary_recipient = { is_adult = no } + } + } + scope:secondary_actor = { + set_variable = { + name = hook_used_for_betrothal + value = scope:secondary_recipient + } + } + } + } + + #Penalties for marrying a lowborn + scope:actor = { + if = { + limit = { + this = scope:secondary_actor # We check that you're marrying them yourself + scope:secondary_recipient = { is_lowborn = yes } + } + # Vassal dispositions get aggy. + ## Actual effect applied in the on_marriage on_action. + show_as_tooltip = { + vassals_dislike_marry_lowborn_effect = { + SPOUSE = scope:secondary_recipient + RULER = scope:actor + } + } + #Legitimacy loss for marrying a lowborn + if = { + limit = { + is_valid_for_legitimacy_change = yes + NOT = { has_variable = lowborn_legitimacy_cooldown } + OR = { + NOT = { exists = primary_spouse } + primary_spouse ?= scope:secondary_recipient + } + } + if = { + limit = { is_ai = no } + send_interface_toast = { + type = event_toast_effect_good + title = married_lowborn_toast + left_icon = scope:actor + add_legitimacy = { + value = medium_legitimacy_loss + multiply = scope:actor.primary_title.tier + } + } + } + else = { # To avoid destroying polygamy AIs + send_interface_toast = { + type = event_toast_effect_good + title = married_lowborn_toast + left_icon = scope:actor + add_legitimacy = { value = minor_legitimacy_loss } + } + hidden_effect = { + set_variable = { + name = lowborn_legitimacy_cooldown + years = 10 + } + } + } + } + } + if = { + limit = { + this = scope:secondary_recipient # We check that you're marrying them yourself + scope:secondary_actor = { is_lowborn = yes } + } + # Vassal dispositions get aggy. + ## Actual effect applied in the on_marriage on_action. + show_as_tooltip = { + vassals_dislike_marry_lowborn_effect = { + SPOUSE = scope:secondary_actor + RULER = scope:actor + } + } + #Legitimacy loss for marrying a lowborn + if = { + limit = { + is_valid_for_legitimacy_change = yes + NOT = { has_variable = lowborn_legitimacy_cooldown } + OR = { + NOT = { exists = primary_spouse } + primary_spouse ?= scope:secondary_actor + } + } + if = { + limit = { is_ai = no } + send_interface_toast = { + type = event_toast_effect_good + title = married_lowborn_toast + left_icon = scope:actor + add_legitimacy = { + value = medium_legitimacy_loss + multiply = scope:actor.primary_title.tier + } + } + } + else = { # To avoid destroying polygamy AIs + send_interface_toast = { + type = event_toast_effect_good + title = married_lowborn_toast + left_icon = scope:actor + add_legitimacy = { value = minor_legitimacy_loss } + } + hidden_effect = { + set_variable = { + name = lowborn_legitimacy_cooldown + years = 10 + } + } + } + } + } + else = { # If they're not a lowborn AND you and the recipient are both Nomad we may give you some Legitimacy + if = { + limit = { + is_valid_for_nomadic_legitimacy_change = yes + scope:recipient = { government_has_flag = government_is_nomadic } + mpo_lower_nomad_authority_trigger = { CHARACTER = scope:recipient } # Only if recipient has higher Dominance than you + } + add_legitimacy = medium_legitimacy_gain + } + } + } + + #No longer Herder + if = { + limit = { + scope:secondary_recipient = { + is_landed = yes + government_has_flag = government_is_herder + } + } + scope:actor = { + switch = { + trigger = has_government + feudal_government = { + scope:secondary_recipient = { change_government = feudal_government } + } + tribal_government = { + scope:secondary_recipient = { change_government = tribal_government } + } + clan_government = { + scope:secondary_recipient = { change_government = clan_government } + } + nomad_government = { + scope:secondary_recipient = { change_government = nomad_government } + } + administrative_government = { + scope:secondary_recipient = { change_government = administrative_government } + } + landless_adventurer_government = { + scope:secondary_recipient = { change_government = landless_adventurer_government } + } + } + } + } + + #No longer concubine + if = { + limit = { + scope:secondary_recipient = { is_concubine = yes } + } + scope:secondary_recipient = { + random_consort = { + limit = { + any_concubine = { this = scope:secondary_recipient } + } + remove_concubine = scope:secondary_recipient + } + } + } + if = { + limit = { + scope:secondary_actor = { is_concubine = yes } + } + scope:secondary_actor = { + random_consort = { + limit = { + any_concubine = { this = scope:secondary_actor } + } + remove_concubine = scope:secondary_actor + } + } + } + # A Grand Wedding was promised + if = { + limit = { + scope:grand_wedding_promise = yes + } + set_grand_wedding_betrothal_variables = { + SPOUSE_1 = scope:secondary_actor + SPOUSE_2 = scope:secondary_recipient + HOST = scope:actor + PROMISEE = scope:recipient + } + } + + #Marriage notification events + hidden_effect = { + scope:actor = { + if = { + limit = { this != scope:recipient } + trigger_event = marriage_interaction.0010 + } + else = { #In my own court + if = { + limit = { #Betrothal? + OR = { + scope:secondary_actor = { is_adult = no } + scope:secondary_recipient = { is_adult = no } + scope:secondary_actor = { has_been_promised_grand_wedding = yes } + scope:secondary_recipient = { has_been_promised_grand_wedding = yes } + } + } + send_interface_toast = { + type = event_toast_effect_good + title = arrange_marriage_interaction_accept_betrothal_toast + left_icon = scope:secondary_actor + right_icon = scope:secondary_recipient + custom_tooltip = arrange_marriage_interaction_accept_betrothal_toast_desc + } + } + else = { + send_interface_toast = { + type = event_toast_effect_good + title = arrange_marriage_interaction_accept_toast + left_icon = scope:secondary_actor + right_icon = scope:secondary_recipient + custom_tooltip = arrange_marriage_interaction_accept_toast_desc + } + } + } + } + + # Apply any relevant opinion penalties for relatives of spouse. + scope:secondary_actor = { + if = { # Polygamy + limit = { + any_consort = { + count >= 2 + } + } + every_consort = { + # If the spouse themselves does not believe in polygamy... + limit = { + NOR = { + culture = { has_cultural_tradition = tradition_polygamous } + faith = { has_doctrine = doctrine_polygamy } + faith = { has_doctrine = doctrine_concubines } + } + } + + #... then family members who also do not believe in polygamy aren't happy about having a relative forced into polygamous union with you. + every_close_family_member = { + if = { + limit = { + NOR = { + culture = { has_cultural_tradition = tradition_polygamous } + faith = { has_doctrine = doctrine_polygamy } + faith = { has_doctrine = doctrine_concubines } + } + } + add_opinion = { + target = scope:secondary_actor + modifier = relative_in_blasphemous_union_opinion + } + } + } + + # NOTE: Spouse's own opinions handled in the 'on_marriage' code on_action inside of marriage_concubinage.txt, and are not included here. + } + } + } + scope:secondary_recipient = { + if = { #Same-sex relations + limit = { + allowed_to_marry_same_sex_trigger = no + sex_same_as = scope:secondary_actor + } + every_close_family_member = { + if = { + limit = { + allowed_to_marry_same_sex_trigger = no + } + add_opinion = { + target = scope:secondary_actor + modifier = relative_in_blasphemous_union_opinion + } + } + } + } + } + # Courtly vassals like grand weddings + scope:secondary_actor = { + if = { + limit = { + any_vassal = { + vassal_stance = courtly + } + } + if = { + limit = { + has_been_promised_grand_wedding = yes + } + every_vassal = { + vassal_stance = courtly + add_opinion = { + target = scope:secondary_actor + modifier = prestigious_wedding_opinion + } + } + } + } + } + scope:secondary_recipient = { + if = { + limit = { + any_vassal = { + vassal_stance = courtly + } + } + if = { + limit = { + has_been_promised_grand_wedding = yes + } + every_vassal = { + vassal_stance = courtly + add_opinion = { + target = scope:secondary_recipient + modifier = prestigious_wedding_opinion + } + } + } + } + } + } + + ###MANAGEMENT SCRIPT FOR VARIOUS EVENTS/CONTENT### + + #If your spouse councillor had boosted the chance of marriage, remove modifier + if = { + limit = { + scope:secondary_actor = { + has_character_modifier = heir_easier_to_marry_off_modifier + } + scope:actor = { player_heir = scope:secondary_actor } + } + scope:secondary_actor = { + remove_character_modifier = heir_easier_to_marry_off_modifier + } + } + if = { + limit = { + scope:secondary_actor = { + is_child_of = scope:actor + has_character_modifier = child_easier_to_marry_off_modifier + } + } + scope:secondary_actor = { + remove_character_modifier = child_easier_to_marry_off_modifier + } + } + + #AI Break up consideration after marriage + scope:secondary_recipient = { + if = { + limit = { + is_adult = yes + is_ai = yes + } + scope:secondary_actor = { save_scope_as = new_spouse_secondary_actor } + trigger_event = lover.0205 + } + } + scope:secondary_actor = { + if = { + limit = { + is_adult = yes + is_ai = yes + } + scope:secondary_recipient = { save_scope_as = new_spouse_secondary_recipient } + trigger_event = lover.0205 + } + } + + # Struggle parameters + + #interfaith wedding costs piety + if = { + limit = { + scope:secondary_actor = { + faith != scope:secondary_recipient.faith + } + scope:actor ={ + any_character_struggle = { + has_struggle_phase_parameter = interfaith_marriages_between_involved_characters_costs_piety + } + } + } + scope:actor = { + add_piety = major_piety_loss + } + } + #interfaith wedding provides piety + if = { + limit = { + scope:secondary_actor = { + faith != scope:secondary_recipient.faith + } + scope:actor ={ + any_character_struggle = { + has_struggle_phase_parameter = interfaith_marriages_between_involved_characters_gives_piety + } + } + } + scope:actor = { + add_piety = medium_piety_gain + } + } + + #other stuff + #Khurramites and Mazdakists gain piety from marrying lowborn + if = { + limit = { + scope:secondary_recipient = { + is_lowborn = yes + } + scope:actor.faith = { + has_doctrine = tenet_communal_possessions + } + } + scope:actor = { + add_piety = medium_piety_gain + } + } +} + +concubine_on_accept_effect = { + scope:recipient = { + trigger_event = marriage_interaction.0040 + if = { + # Victim is angry for being forced into concubinage. + limit = { + OR = { + has_trait = celibate + is_imprisoned = yes + } + } + release_from_prison = yes + add_opinion = { + target = scope:actor + modifier = forced_me_concubine_marriage_opinion + } + + # Family members of victim are also angry that you've forced them into concubinage. + every_close_family_member = { + if = { + limit = { + this != scope:actor # Don't hate yourself. + } + add_opinion = { + target = scope:actor + modifier = forced_family_concubine_marriage_opinion + } + hidden_effect = { + send_interface_message = { + type = msg_family_became_concubine + title = msg_close_family_member_taken_as_concubine_title + right_icon = scope:actor + left_icon = scope:secondary_actor + show_as_tooltip = { scope:actor = { make_concubine = scope:secondary_actor } } + } + } + + # Family members are even *more* angry if they don't believe in concubines/polyamory (different from polygamy). Also if they don't accept same-sex relationships + if = { + limit = { + OR = { + NOT = { faith = { has_doctrine = doctrine_concubines } } + NOT = { faith = { has_doctrine = tenet_polyamory } } + AND = { + allowed_to_marry_same_sex_trigger = no + scope:recipient = { sex_same_as = scope:secondary_actor } + } + } + } + add_opinion = { + target = scope:actor + modifier = relative_in_blasphemous_union_opinion + } + } + } + } + + # Not up to them anymore... + if = { + limit = { has_trait = celibate } + remove_trait = celibate + } + + # Spouses, if any exist, are also furious. + if = { + limit = { + is_married = yes + } + every_spouse = { + show_as_tooltip = { + add_opinion = { + target = scope:actor + modifier = forced_spouse_concubine_marriage_opinion + } + divorce = scope:recipient # no additional opinion hit, no scripted effect + } + trigger_event = marriage_interaction.0041 + } + } + + # Stealing concubines pisses the former concubinist off. + if = { + limit = { + is_concubine = yes + } + this.concubinist = { + show_as_tooltip = { + add_opinion = { + target = scope:secondary_actor + modifier = stole_concubine_opinion + } + remove_concubine = scope:recipient # no additional opinion hit, no scripted effect + } + trigger_event = marriage_interaction.0041 + } + } + + # Break any betrothals which may exist (without additional opinion penalties). + if = { + limit = { exists = betrothed } + betrothed = { trigger_event = marriage_interaction.0041 } + break_betrothal = betrothed + } + + # Having concubines means they're now no longer yours. + if = { + limit = { number_of_concubines > 0 } + every_concubine = { + scope:recipient = { + remove_concubine = prev + } + } + } + } + } + + # Send us a notification about what we just did. + scope:secondary_actor = { + hidden_effect = { + send_interface_toast = { + type = event_toast_effect_neutral + title = msg_concubine_taken_title + right_icon = scope:recipient + make_concubine = scope:recipient + } + } + } +} + + +#This effect has some small differences to the previous one since this one involves one extra person (the one you give a concubine to) +concubine_offer_on_accept_effect = { + scope:secondary_recipient = { + trigger_event = marriage_interaction.0040 + if = { + # Victim is angry for being forced into concubinage. + limit = { + is_imprisoned = yes + } + add_character_flag = { + flag = block_release_from_prison_event + days = 3 + } + release_from_prison = yes + add_opinion = { + target = scope:actor + modifier = forced_me_concubine_marriage_opinion + } + + # Family members of victim are also angry that you've forced them into concubinage. + every_close_family_member = { + if = { + limit = { + this != scope:actor # Don't hate yourself. + } + add_opinion = { + target = scope:actor + modifier = forced_family_concubine_marriage_opinion + } + hidden_effect = { + send_interface_message = { + type = msg_family_became_concubine + title = msg_close_family_member_offered_as_concubine_title + right_icon = scope:actor + left_icon = scope:secondary_actor + show_as_tooltip = { scope:actor = { make_concubine = scope:secondary_actor } } + } + } + + # Family members are even *more* angry if they don't believe in concubines/polyamory (different from polygamy). Also if they don't accept same-sex relationships + if = { + limit = { + OR = { + NOT = { faith = { has_doctrine = doctrine_concubines } } + NOT = { faith = { has_doctrine = tenet_polyamory } } + AND = { + allowed_to_marry_same_sex_trigger = no + scope:recipient = { sex_same_as = scope:secondary_recipient } + } + } + } + add_opinion = { + target = scope:actor + modifier = relative_in_blasphemous_union_opinion + } + } + } + } + + # Spouses, if any exist, are also furious. + if = { + limit = { + is_married = yes + #A check to make sure you haven't somehow married them during the consideration time + NOT = { any_spouse = { this = scope:recipient } } + } + every_spouse = { + add_opinion = { + target = scope:actor + modifier = forced_spouse_concubine_marriage_opinion + } + divorce = scope:secondary_recipient # no additional opinion hit, no scripted effect + save_scope_value_as = { # For tooltips in the coming event + name = was_spouse + value = yes + } + trigger_event = marriage_interaction.0043 + } + } + + # Stealing concubines pisses the former concubinist off. + if = { + limit = { + is_concubine = yes + #A check to make sure you haven't somehow gotten them as concubine during the consideration time + NOT = { any_consort = { this = scope:recipient } } + } + this.concubinist = { + if = { + limit = { + this != scope:actor + } + add_opinion = { + target = scope:actor + modifier = stole_concubine_opinion + } + remove_concubine = scope:secondary_recipient # no additional opinion hit, no scripted effect + save_scope_value_as = { # For tooltips in the coming event + name = was_concubine + value = yes + } + trigger_event = marriage_interaction.0043 + } + else = { + remove_concubine = scope:secondary_recipient # no additional opinion hit, no scripted effect + } + } + } + + # Break any betrothals which may exist (without additional opinion penalties). + if = { + limit = { + exists = betrothed + #A check to make sure you haven't somehow gotten betrothed to them during the consideration time + betrothed != scope:recipient + } + betrothed = { trigger_event = marriage_interaction.0043 } + break_betrothal = betrothed + } + + # Having concubines means they're now no longer yours. + if = { + limit = { number_of_concubines > 0 } + every_concubine = { + scope:secondary_recipient = { + remove_concubine = prev + } + } + } + } + if = { + limit = { + is_concubine_of = scope:actor + } + scope:actor = { + remove_concubine = scope:secondary_recipient + } + } + remove_character_flag = has_been_offered_as_concubine + } + + # Send us a notification about what we just did. If the secondary_recipient somehow ended up as a consort (spouse/concubine) or betrothed to recipient during the consideration time of this request we'll send a message about that instead (should only happen to AI tho) + if = { + limit = { #Invalidation message + scope:secondary_recipient = { + OR = { + any_consort = { } + exists = betrothed + } + } + } + scope:secondary_recipient = { + # If they've somehow already become entangled with the recipient we tell this + if = { + limit = { + OR = { + is_consort_of = scope:recipient + betrothed ?= scope:recipient + } + } + scope:recipient = { + save_scope_as = spouse + } + } + # Else, if they've married or gotten betrothed to someone else, we say this + else_if = { + limit = { + exists = betrothed + } + betrothed = { + save_scope_as = spouse + } + } + else = { + random_consort = { + limit = { + this = scope:secondary_recipient.primary_spouse + } + alternative_limit = { + always = yes + } + save_scope_as = spouse + } + } + } + scope:actor = { + send_interface_toast = { + type = event_toast_effect_neutral + title = msg_concubine_offered_invalidated_title + right_icon = scope:recipient + left_icon = scope:secondary_recipient + if = { + limit = { + scope:secondary_recipient = { is_consort_of = scope:spouse } + } + custom_tooltip = msg_concubine_offered_invalidated_consort + } + else = { + custom_tooltip = msg_concubine_offered_invalidated_betrothed + } + } + } + scope:recipient = { + send_interface_toast = { + type = event_toast_effect_neutral + title = msg_concubine_offered_invalidated_recipient_title + right_icon = scope:actor + left_icon = scope:secondary_recipient + if = { + limit = { + scope:secondary_recipient = { is_consort_of = scope:spouse } + } + custom_tooltip = msg_concubine_offered_invalidated_consort + } + else = { + custom_tooltip = msg_concubine_offered_invalidated_betrothed + } + } + } + } + else = { #Proper notification + scope:actor = { + send_interface_toast = { + type = event_toast_effect_neutral + title = msg_concubine_offered_title + right_icon = scope:recipient + left_icon = scope:secondary_recipient + scope:recipient = { + make_concubine = scope:secondary_recipient + if = { #Scale opinion gain a bit depending on how cool the concubine is + limit = { + scope:secondary_recipient = { + OR = { + has_trait = beauty_good_2 + has_trait = beauty_good_3 + num_of_good_genetic_traits > 1 + has_relation_lover = scope:recipient + has_relation_soulmate = scope:recipient + } + trigger_if = { + limit = { + is_female = yes + } + age < define:NChildbirth|MAX_FEMALE_REPRODUCTION_AGE + } + } + } + add_opinion = { + target = scope:actor + modifier = grateful_opinion + opinion = 40 + } + } + else_if = { + limit = { + scope:secondary_recipient = { + OR = { + is_lowborn = no + has_trait = beauty_good_1 + num_of_good_genetic_traits > 0 + has_relation_friend = scope:recipient + has_relation_best_friend = scope:recipient + } + trigger_if = { + limit = { + is_female = yes + } + age < define:NChildbirth|MAX_FEMALE_REPRODUCTION_AGE + } + } + } + add_opinion = { + target = scope:actor + modifier = grateful_opinion + opinion = 30 + } + } + else = { + add_opinion = { + target = scope:actor + modifier = grateful_opinion + opinion = 20 + } + } + } + } + } + } +} + +#This effect has some small differences AGAIN to the previous one since this one has some roles reversed +demand_concubine_interaction_on_accept_effect = { + scope:secondary_actor = { + trigger_event = marriage_interaction.0040 + if = { + # Victim is angry for being forced into concubinage. + limit = { + is_imprisoned = yes + } + add_character_flag = { + flag = block_release_from_prison_event + days = 3 + } + release_from_prison = yes + add_opinion = { + target = scope:actor + modifier = forced_me_concubine_marriage_opinion + } + } + + # Family members of victim are also angry that you've forced them into concubinage. + every_close_family_member = { + if = { + limit = { + NOT = { this = scope:actor } # Don't hate yourself. + } + add_opinion = { + target = scope:actor + modifier = forced_family_concubine_marriage_opinion + } + hidden_effect = { + send_interface_message = { + type = msg_family_became_concubine + title = msg_close_family_member_taken_as_concubine_title + right_icon = scope:actor + left_icon = scope:secondary_actor + show_as_tooltip = { scope:actor = { make_concubine = scope:secondary_actor } } + } + } + + # Family members are even *more* angry if they don't believe in concubines/polyamory (different from polygamy). Also if they don't accept same-sex relationships + if = { + limit = { + OR = { + NOT = { faith = { has_doctrine = doctrine_concubines } } + NOT = { faith = { has_doctrine = tenet_polyamory } } + AND = { + allowed_to_marry_same_sex_trigger = no + scope:recipient = { sex_same_as = scope:secondary_actor } + } + } + } + add_opinion = { + target = scope:actor + modifier = relative_in_blasphemous_union_opinion + } + } + } + } + + # Spouses, if any exist, are also furious. + if = { + limit = { + is_married = yes + #A check to make sure you haven't somehow married them during the consideration time + NOT = { any_spouse = { this = scope:actor } } + } + every_spouse = { + if = { + limit = { + NOT = { + this = scope:recipient + } + } + add_opinion = { + target = scope:actor + modifier = forced_spouse_concubine_marriage_opinion + } + } + divorce = scope:secondary_actor # no additional opinion hit, no scripted effect + save_scope_value_as = { # For tooltips in the coming event + name = was_spouse + value = yes + } + } + } + + # Stealing concubines pisses the former concubinist off. + if = { + limit = { + is_concubine = yes + #A check to make sure you haven't somehow gotten them as concubine during the consideration time + NOT = { any_consort = { this = scope:actor } } + } + this.concubinist = { + if = { + limit = { + NOT = { + this = scope:recipient + } + } + add_opinion = { + target = scope:actor + modifier = stole_concubine_opinion + } + } + remove_concubine = scope:secondary_actor # no additional opinion hit, no scripted effect + } + } + + # Break any betrothals which may exist (without additional opinion penalties). + if = { + limit = { + exists = betrothed + #A check to make sure you haven't somehow gotten betrothed to them during the consideration time + NOT = { betrothed = scope:actor } + } + break_betrothal = betrothed + } + + # Having concubines means they're now no longer yours. + if = { + limit = { number_of_concubines > 0 } + every_concubine = { + scope:secondary_actor = { + remove_concubine = prev + } + } + } + + if = { + limit = { + is_concubine_of = scope:recipient + } + scope:recipient = { + remove_concubine = scope:secondary_actor + } + } + remove_character_flag = has_been_offered_as_concubine + } + + # Send us a notification about what we just did. + scope:actor = { + send_interface_toast = { + type = event_toast_effect_neutral + title = msg_concubine_offered_reversed_title + right_icon = scope:recipient + left_icon = scope:secondary_actor + scope:actor = { + make_concubine = scope:secondary_actor + if = { #Scale opinion gain a bit depending on how cool the concubine is + limit = { + scope:secondary_actor = { + OR = { + has_trait = beauty_good_2 + has_trait = beauty_good_3 + num_of_good_genetic_traits > 1 + has_relation_lover = scope:actor + has_relation_soulmate = scope:actor + } + trigger_if = { + limit = { + is_female = yes + } + age < define:NChildbirth|MAX_FEMALE_REPRODUCTION_AGE + } + } + } + add_opinion = { + target = scope:recipient + modifier = grateful_opinion + opinion = 40 + } + } + else_if = { + limit = { + scope:secondary_actor = { + OR = { + is_lowborn = no + has_trait = beauty_good_1 + num_of_good_genetic_traits > 0 + has_relation_friend = scope:actor + has_relation_best_friend = scope:actor + } + trigger_if = { + limit = { + is_female = yes + } + age < define:NChildbirth|MAX_FEMALE_REPRODUCTION_AGE + } + } + } + add_opinion = { + target = scope:recipient + modifier = grateful_opinion + opinion = 30 + } + } + else = { + add_opinion = { + target = scope:recipient + modifier = grateful_opinion + opinion = 20 + } + } + } + } + } +} + +divorce_effect = { + $DIVORCER$ = { + if = { + limit = { + any_spouse = { + this = $DIVORCEE$ + } + } + divorce = $DIVORCEE$ + } + + reverse_add_opinion = { + modifier = divorced_me_opinion + target = $DIVORCEE$ + } + } + # Opinion hit + $DIVORCEE$ = { + every_close_or_extended_family_member = { + limit = { NOT = { this = $DIVORCER$ } } # don't hate yourself just because of some incest + custom = all_family_members + add_opinion = { + modifier = divorced_close_kin + target = $DIVORCER$ + } + } + } + + if = { + limit = { + $DIVORCER$ = { + has_character_modifier = rejected_from_marriage_bed_modifier + } + } + $DIVORCER$ = { remove_character_modifier = rejected_from_marriage_bed_modifier } + } + if = { + limit = { + $DIVORCEE$ = { + has_character_modifier = rejected_from_marriage_bed_modifier + } + } + $DIVORCEE$ = { remove_character_modifier = rejected_from_marriage_bed_modifier } + } + + if = { + limit = { $DIVORCER$ = { has_relation_lover = $DIVORCEE$ } } + lover_breakup_effect = { + BREAKER = $DIVORCER$ + LOVER = $DIVORCEE$ + } + } +} + +less_verbose_divorce_effect = { + $DIVORCER$ = { + if = { + limit = { + any_spouse = { + this = $DIVORCEE$ + } + } + divorce = $DIVORCEE$ + } + + hidden_effect = { + reverse_add_opinion = { + modifier = divorced_me_opinion + target = $DIVORCEE$ + } + } + } + hidden_effect = { + # Opinion hit + $DIVORCEE$ = { + every_close_or_extended_family_member = { + limit = { NOT = { this = $DIVORCER$ } } # don't hate yourself just because of some incest + custom = all_family_members + add_opinion = { + modifier = divorced_close_kin + target = $DIVORCER$ + } + } + } + + if = { + limit = { + $DIVORCER$ = { + has_character_modifier = rejected_from_marriage_bed_modifier + } + } + $DIVORCER$ = { remove_character_modifier = rejected_from_marriage_bed_modifier } + } + if = { + limit = { + $DIVORCEE$ = { + has_character_modifier = rejected_from_marriage_bed_modifier + } + } + $DIVORCEE$ = { remove_character_modifier = rejected_from_marriage_bed_modifier } + } + } + + if = { + limit = { $DIVORCER$ = { has_relation_lover = $DIVORCEE$ } } + lover_breakup_effect = { + BREAKER = $DIVORCER$ + LOVER = $DIVORCEE$ + } + } +} + +marriage_soulmate_exclusivity_confrontation_effect = { + $SPOUSE_1$ = { add_to_temporary_list = new_spouses } + $SPOUSE_2$ = { add_to_temporary_list = new_spouses } + + every_in_list = { + list = new_spouses + limit = { + any_relation = { + type = soulmate + NOT = { is_in_list = new_spouses } + } + } + add_character_flag = { + flag = can_be_confronted_about_lover_exclusivity + days = 1825 + } + } +} + +# CHARACTER = character we check for if they should send a message +# SPOUSE = the spouse in this divorce +# scope:reason = flag:script or flag:faith +send_divorce_notifications_effect = { + $CHARACTER$ = { + if = { + limit = { + is_ai = no + } + switch = { + trigger = scope:reason + flag:script = { + send_interface_message = { + type = msg_divorce + left_icon = $SPOUSE$ + } + } + flag:faith = { + send_interface_message = { + type = msg_spouse_invalidated + left_icon = $SPOUSE$ + } + } + } + } + else_if = { + limit = { + any_heir_title = { + holder ?= { is_ai = no } + } + } + every_heir_title = { + limit = { + holder ?= { is_ai = no } + } + holder = { + if = { + limit = { + NOT = { is_in_list = had_notification_sent } + } + add_to_list = had_notification_sent + switch = { + trigger = scope:reason + flag:script = { + send_interface_message = { + type = msg_divorce_player_heir + left_icon = $CHARACTER$ + right_icon = $SPOUSE$ + } + } + flag:faith = { + send_interface_message = { + type = msg_spouse_invalidated_player_heir + left_icon = $CHARACTER$ + right_icon = $SPOUSE$ + } + } + } + } + } + } + } + } +} + +# CHARACTER = character we check for if they should send a message +# BETROTHED = the other person in the betrothal +# scope:reason = flag:timeout, flag:death, flag:faith, or flag:script +send_break_betrothal_notifications_effect = { + $CHARACTER$ = { + if = { + limit = { + is_ai = no + } + switch = { + trigger = scope:reason + flag:script = { + send_interface_message = { + type = msg_break_betrothal + left_icon = $BETROTHED$ + } + } + flag:faith = { + send_interface_message = { + type = msg_betrothal_invalidated + left_icon = $BETROTHED$ + } + } + # flag:death is hanlded by normal death management events + # flag:timeout is hanlded by caller separately + } + } + else_if = { + limit = { + any_heir_title = { + holder ?= { is_ai = no } + } + } + every_heir_title = { + limit = { + holder = { is_ai = no } + } + holder = { + if = { + limit = { + NOT = { is_in_list = had_notification_sent } + } + add_to_list = had_notification_sent + switch = { + trigger = scope:reason + flag:script = { + send_interface_message = { + type = msg_break_betrothal_player_heir + left_icon = $CHARACTER$ + right_icon = $BETROTHED$ + } + } + flag:faith = { + send_interface_message = { + type = msg_betrothal_invalidated_player_heir + left_icon = $CHARACTER$ + right_icon = $BETROTHED$ + } + } + # flag:death is hanlded by normal death management events + # flag:timeout is hanlded by caller separately + } + } + } + } + } + } +} + + + +# When you take spouses/concubines whose Faith does not permit that union, they will gain opinion penalties. +# This effect adds/updates/replaces/removes those opinion penalties, as approprite to the current situation. +update_active_consort_opinion_effect = { + + # If we currently have any existing consort opinion modifiers, check if they should be downgraded from permanent modifiers to decaying modifiers. + downgrade_invalid_consort_opinions_effect = { PARTNER = $PARTNER$ } + + if = { + # If this opinion change was triggered by being divorced/set-aside, we may still technically be married/joined to PARTNER at this moment, but we won't be very shortly and should skip this step. + limit = { + NOR = { + exists = scope:is_being_divorced + exists = scope:is_being_set_aside + } + } + + # Oterwise, apply any new consort opinion effects that are applicable. + if = { + # Characters who do not believe in concubinage, but are forced into it, have the harshest opinion penalties. + limit = { + is_concubine_of = $PARTNER$ + NOT = { faith = { has_doctrine = doctrine_concubines }} + NOT = { culture = { has_cultural_tradition = tradition_concubines } } + } + if = { + # Harshest opinion penalty if they are a concubine but believe in monogamy + limit = { faith = { has_doctrine = doctrine_monogamy }} + add_opinion = { + target = $PARTNER$ + modifier = concubine_with_monogamous_faith_opinion + } + } + else_if = { + # Lesser-but-still-harsh opinion penalty if they are a concubine but believe in polygamy + limit = { + OR = { + culture = { has_cultural_tradition = tradition_polygamous } + faith = { has_doctrine = doctrine_polygamy } + } + } + add_opinion = { + target = $PARTNER$ + modifier = concubine_with_polygamous_faith_opinion + } + } + } + else_if = { + # Characters who are legitimate spouses of their partner, but do not approve of their partner's other spouses/concubines, will have milder opinion penalties. + limit = { + is_spouse_of = $PARTNER$ + $PARTNER$ = { any_consort = { count >= 2 }} + NOT = { faith = { has_doctrine = doctrine_concubines }} + NOT = { faith = { has_doctrine = tenet_polyamory }} + NOT = { culture = { has_cultural_tradition = tradition_concubines } } + } + if = { + limit = { + $PARTNER$ = { any_concubine = { }} + } + add_opinion = { + target = $PARTNER$ + modifier = spouse_does_not_believe_in_concubines_opinion + } + #Remove the opinion modifier if you flip-flop and go get concubines after getting rid of them all... + remove_opinion = { + target = $PARTNER$ + modifier = spouse_does_not_believe_in_former_concubines_opinion + } + } + else_if = { + limit = { + NOR = { + culture = { has_cultural_tradition = tradition_polygamous } + faith = { has_doctrine = doctrine_polygamy } + } + } + add_opinion = { + target = $PARTNER$ + modifier = polygamous_marriage_opinion + } + } + } + #Same-sex not accepted penalty + if = { + limit = { + allowed_to_marry_same_sex_trigger = no + sex_same_as = $PARTNER$ + } + add_opinion = { + target = $PARTNER$ + modifier = same_sex_with_no_acceptance_opinion + } + } + } +} + +# Checks if we have any permanent opinion modifiers which are no longer applicable. If so, downgrade them to decaying opinion modifiers. +downgrade_invalid_consort_opinions_effect = { + if = { + limit = { + has_opinion_modifier = { + modifier = concubine_with_monogamous_faith_opinion + target = $PARTNER$ + } + OR = { + # We are no longer a concubine of PARTNER... + NOT = { is_concubine_of = $PARTNER$ } + # ...or will no longer be a concubine of them. + trigger_if = { + limit = { exists = scope:is_being_set_aside} + scope:is_being_set_aside = this + } + + # Or, our Faith has changed to permit us being a concubine. + faith = { has_doctrine = doctrine_concubines } + } + } + remove_opinion = { + modifier = concubine_with_monogamous_faith_opinion + target = $PARTNER$ + } + add_opinion = { + modifier = formerly_concubine_with_monogamous_faith_opinion + target = $PARTNER$ + } + } + + if = { + limit = { + has_opinion_modifier = { + modifier = concubine_with_polygamous_faith_opinion + target = $PARTNER$ + } + OR = { + # We are no longer a concubine of PARTNER... + NOT = { is_concubine_of = $PARTNER$ } + # ...or will no longer be a concubine of them. + trigger_if = { + limit = { exists = scope:is_being_set_aside} + scope:is_being_set_aside = this + } + + # Or, our Faith has changed to permit us being a concubine. + faith = { has_doctrine = doctrine_concubines } + } + } + remove_opinion = { + modifier = concubine_with_polygamous_faith_opinion + target = $PARTNER$ + } + add_opinion = { + modifier = formerly_concubine_with_polygamous_faith_opinion + target = $PARTNER$ + } + } + + if = { + limit = { + has_opinion_modifier = { + modifier = spouse_does_not_believe_in_concubines_opinion + target = $PARTNER$ + } + OR = { + # We are no longer married to PARTNER... + NOT = { is_spouse_of = $PARTNER$ } + # ...or will no longer be married to them. + trigger_if = { + limit = { exists = scope:is_being_divorced} + scope:is_being_divorced = this + } + + # Or, the offending relationship no longer exists. + $PARTNER$ = { any_concubine = { count = 0 }} + AND = { + # The last remaining concubine is being set aside, leaving none. + exists = scope:is_being_set_aside + $PARTNER$ = { any_concubine = { count = 1 }} + } + + # Or, our Faith has changed to permit the relationship. + faith = { has_doctrine = doctrine_concubines } + faith = { has_doctrine = tenet_polyamory } + } + } + remove_opinion = { + modifier = spouse_does_not_believe_in_concubines_opinion + target = $PARTNER$ + } + add_opinion = { + modifier = spouse_does_not_believe_in_former_concubines_opinion + target = $PARTNER$ + } + } + + if = { + limit = { + has_opinion_modifier = { + modifier = polygamous_marriage_opinion + target = $PARTNER$ + } + OR = { + # We are no longer married to PARTNER... + NOT = { is_spouse_of = $PARTNER$ } + # ...or will no longer be married to them. + trigger_if = { + limit = { exists = scope:is_being_divorced} + scope:is_being_divorced = this + } + + # Or, the offending relationship no longer exists. + $PARTNER$ = { any_spouse = { count = 1 }} + AND = { + # One of the 2 remaining spouses will be divorced next tick, leaving only 1. + exists = scope:is_being_divorced + $PARTNER$ = { any_spouse = { count = 2 }} + } + + # Or, our Faith has changed to permit the relationship. + faith = { has_doctrine = doctrine_concubines } + culture = { has_cultural_tradition = tradition_polygamous } + faith = { has_doctrine = doctrine_polygamy } + faith = { has_doctrine = tenet_polyamory } + } + } + remove_opinion = { + modifier = polygamous_marriage_opinion + target = $PARTNER$ + } + add_opinion = { + modifier = former_polygamous_marriage_opinion + target = $PARTNER$ + } + } + + if = { + limit = { + has_opinion_modifier = { + modifier = same_sex_with_no_acceptance_opinion + target = $PARTNER$ + } + OR = { + # We are no partner of PARTNER... + NOT = { is_consort_of = $PARTNER$ } + # ...or will no longer be married to them + trigger_if = { + limit = { exists = scope:is_being_divorced} + scope:is_being_divorced = this + } + # ...or will no longer be a concubine of them + trigger_if = { + limit = { exists = scope:is_being_set_aside} + scope:is_being_set_aside = this + } + + # Or, the offending relationship no longer exists. + sex_opposite_of = $PARTNER$ + + # Or, our Faith has changed to permit the relationship. + allowed_to_marry_same_sex_trigger = yes + } + } + remove_opinion = { + modifier = same_sex_with_no_acceptance_opinion + target = $PARTNER$ + } + add_opinion = { + modifier = former_same_sex_with_no_acceptance_opinion + target = $PARTNER$ + } + } +} + +##### EP2 - You promised a Grand Wedding and failed to deliver it +break_grand_wedding_betrothal_effect = { + # Uniform the scopes between breaking a betrothal with the interaction and saying no at the altar + if = { + limit = { + exists = scope:spouse_1 + exists = scope:spouse_2 + } + scope:spouse_1 = { save_scope_as = rejecting_betrothed } + scope:spouse_2 = { save_scope_as = rejected_betrothed } + root = { save_scope_as = actor } + } + scope:rejecting_betrothed.var:promised_grand_wedding_by ?= { save_scope_as = promising_host } + # Save the offended party + scope:rejected_betrothed = { + if = { + limit = { matchmaker != scope:rejected_betrothed } + matchmaker = { save_scope_as = rejected_betrothal_owner } + } + else = { save_scope_as = rejected_betrothal_owner } #The betrothed accepted the wedding for themselves + } + # First of all, the betrothal is broken + scope:rejecting_betrothed = { break_betrothal = scope:rejected_betrothed } + # If an alliance was connected to this, the alliance is broken + if = { + limit = { + yields_alliance = { + candidate = scope:rejecting_betrothed + target = scope:rejected_betrothal_owner + target_candidate = scope:rejected_betrothed + } + } + break_alliance = scope:rejected_betrothal_owner + } + # Opinion hit if there were no legitimate reason + scope:rejected_betrothed = { + if = { + limit = { + is_eunuch_trigger = no + scope:rejecting_betrothed = { is_eunuch_trigger = no } + NOR = { + scope:rejecting_betrothed = { + allowed_to_marry_same_sex_trigger = no + sex_same_as = scope:rejected_betrothed + } + AND = { + allowed_to_marry_same_sex_trigger = no + sex_same_as = scope:rejecting_betrothed + } + } + } + add_opinion = { + target = scope:actor + modifier = broke_betrothal_grand_wedding_opinion + opinion = -50 + } + if = { + limit = { scope:rejecting_betrothed != scope:actor } + add_opinion = { + target = scope:rejecting_betrothed + modifier = broke_betrothal_grand_wedding_opinion + opinion = -50 + } + } + if = { + limit = { this != scope:rejected_betrothal_owner } + scope:rejected_betrothal_owner = { + add_opinion = { + target = scope:actor + modifier = broke_betrothal_grand_wedding_opinion + opinion = -50 + } + if = { + limit = { scope:rejecting_betrothed != scope:actor } + add_opinion = { + target = scope:rejecting_betrothed + modifier = broke_betrothal_grand_wedding_opinion + opinion = -50 + } + } + } + } + } + } + # Regular Break Betrothal has a standard loss of prestige, but we need more + add_prestige_level = -1 + if = { + limit = { + OR = { + scope:rejected_betrothed = { highest_held_title_tier = tier_empire } + scope:rejected_betrothal_owner = { highest_held_title_tier = tier_empire } + } + } + add_prestige = monumental_prestige_loss + } + + else_if = { + limit = { + OR = { + scope:rejected_betrothed = { highest_held_title_tier = tier_kingdom } + scope:rejected_betrothal_owner = { highest_held_title_tier = tier_kingdom } + } + } + add_prestige = massive_prestige_loss + } + + else_if = { + limit = { + OR = { + scope:rejected_betrothed = { highest_held_title_tier = tier_duchy } + scope:rejected_betrothal_owner = { highest_held_title_tier = tier_duchy } + } + } + add_prestige = major_prestige_loss + } + + else_if = { + limit = { + OR = { + scope:rejected_betrothed = { highest_held_title_tier = tier_county } + scope:rejected_betrothal_owner = { highest_held_title_tier = tier_county } + } + } + add_prestige = medium_prestige_loss + } + + else_if = { + limit = { + OR = { + scope:rejected_betrothed = { highest_held_title_tier = tier_barony } + scope:rejected_betrothal_owner = { highest_held_title_tier = tier_barony } + } + } + add_prestige = minor_prestige_loss + } + else = { add_prestige = miniscule_prestige_loss } + # Start a Feud, if possible! + if = { + limit = { + has_dlc_feature = friends_and_foes + exists = scope:rejected_betrothal_owner.house.house_head + exists = scope:rejecting_betrothed.house.house_head + scope:rejected_betrothal_owner.house != scope:rejecting_betrothed.house + } + scope:rejected_betrothal_owner.house.house_head = { + if = { + limit = { this = scope:rejected_betrothed } # Rejected betrothed is also House Head + house_feud_start_effect = { + # Feuding House Head + ACTOR = scope:rejected_betrothal_owner.house.house_head + # Target House Head + TARGET = scope:rejecting_betrothed.house.house_head + # Feud Reason + REASON = head_broke_gw_betrothal + # House Member attacker if relevant + ATTACKER = scope:rejecting_betrothed + # House Member victim if relevant + VICTIM = scope:rejected_betrothed + } + } + else = { + house_feud_start_effect = { + # Feuding House Head + ACTOR = scope:rejected_betrothal_owner.house.house_head + # Target House Head + TARGET = scope:rejecting_betrothed.house.house_head + # Feud Reason + REASON = family_broke_gw_betrothal + # House Member attacker if relevant + ATTACKER = scope:rejecting_betrothed + # House Member victim if relevant + VICTIM = scope:rejected_betrothed + } + } + } + } + else = { + scope:rejected_betrothal_owner.house.house_head = { + change_house_relation_effect = { + HOUSE = scope:rejecting_betrothed.house + VALUE = house_relation_damage_medium_value + REASON = broke_grand_wedding_promise + CHAR = scope:rejecting_betrothed + TARGET_CHAR = scope:rejected_betrothed + TITLE = scope:dummy_gender + } + } + } + # If you say no at the altar, there are some extra consequences + if = { + limit = { + scope:rejecting_betrothed = { has_character_flag = grand_wedding_said_no } + } + scope:rejecting_betrothed = { + give_nickname = nick_the_naysayer + if = { + limit = { + this != scope:actor + } + reverse_add_opinion = { + target = scope:actor + modifier = challenged_authority_opinion + } + } + } + } + # Finally, the promise is wiped off + scope:rejecting_betrothed = { + var:promised_grand_wedding_by = { + remove_variable = promised_grand_wedding_marriage_countdown + } + remove_variable = promised_grand_wedding_by + } + scope:rejected_betrothed = { + remove_variable = promised_grand_wedding_by + } +} diff --git a/N3OW/common/scripted_effects/00_martial_lifestyle_effects.txt b/N3OW/common/scripted_effects/00_martial_lifestyle_effects.txt new file mode 100644 index 00000000..94d4d164 --- /dev/null +++ b/N3OW/common/scripted_effects/00_martial_lifestyle_effects.txt @@ -0,0 +1,879 @@ +#Effects used in Lifestyle Focus events + + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! +# + + +#giving_up_on_commander_trait_training_effect - Effect for when you give up on your commander training + +give_random_commander_trait_effect = { + random_list = { + 100 = { + trigger = { NOT = { has_trait = logistician } } + add_trait = logistician + } + 100 = { + trigger = { NOT = { has_trait = military_engineer } } + add_trait = military_engineer + } + 100 = { + trigger = { NOT = { has_trait = aggressive_attacker } } + add_trait = aggressive_attacker + } + 100 = { + trigger = { NOT = { has_trait = unyielding_defender } } + add_trait = unyielding_defender + } + 100 = { + trigger = { NOT = { has_trait = forder } } + add_trait = forder + } + 100 = { + trigger = { NOT = { has_trait = flexible_leader } } + add_trait = flexible_leader + } + 100 = { + trigger = { + NOT = { has_trait = desert_warrior } + any_sub_realm_barony = { + title_province = { + OR = { + terrain = desert + terrain = desert_mountains + terrain = oasis + terrain = drylands + } + } + } + } + add_trait = desert_warrior + } + 100 = { + trigger = { + NOT = { has_trait = jungle_stalker } + any_sub_realm_barony = { + title_province = { + terrain = jungle + } + } + } + add_trait = jungle_stalker + } + 100 = { + trigger = { + NOT = { has_trait = winter_soldier } + any_sub_realm_barony = { + title_province = { + OR = { + terrain = taiga + geographical_region = world_tibet + geographical_region = world_europe_north + geographical_region = world_europe_east + geographical_region = world_steppe + } + } + } + } + add_trait = winter_soldier + } + 100 = { + trigger = { + NOT = { has_trait = forest_fighter } + any_sub_realm_barony = { + title_province = { + OR = { + terrain = forest + terrain = taiga + } + } + } + } + add_trait = forest_fighter + } + 100 = { + trigger = { + NOT = { has_trait = open_terrain_expert } + any_sub_realm_barony = { + title_province = { + OR = { + terrain = plains + terrain = farmlands + terrain = steppe + } + } + } + } + add_trait = open_terrain_expert + } + 100 = { + trigger = { + NOT = { has_trait = rough_terrain_expert } + any_sub_realm_barony = { + title_province = { + OR = { + terrain = hills + terrain = mountains + terrain = wetlands + } + } + } + } + add_trait = rough_terrain_expert + } + 100 = { + trigger = { NOT = { has_trait = reaver } } + add_trait = reaver + } + 100 = { + trigger = { NOT = { has_trait = reckless } } + add_trait = reckless + } + 100 = { + trigger = { NOT = { has_trait = holy_warrior } } + add_trait = holy_warrior + } + 100 = { + trigger = { NOT = { has_trait = organizer } } + add_trait = organizer + } + 100 = { + trigger = { NOT = { has_trait = cautious_leader } } + add_trait = cautious_leader + } + } +} + +# Ensure that this effect stays up-to-date with all commander traits in 00_traits.txt +select_ct_for_teacher_to_teach_student_effect = { + random_list = { + 1 = { + trigger = { + $TEACHER$ = { has_trait = logistician } + $STUDENT$ = { NOT = { has_trait = logistician } } + } + $STUDENT$ = { + set_variable = { + name = commander_trait_being_taught + value = flag:logistician + } + } + } + 1 = { + trigger = { + $TEACHER$ = { has_trait = military_engineer } + $STUDENT$ = { NOT = { has_trait = military_engineer } } + } + $STUDENT$ = { + set_variable = { + name = commander_trait_being_taught + value = flag:military_engineer + } + } + } + 1 = { + trigger = { + $TEACHER$ = { has_trait = aggressive_attacker } + $STUDENT$ = { NOT = { has_trait = aggressive_attacker } } + } + $STUDENT$ = { + set_variable = { + name = commander_trait_being_taught + value = flag:aggressive_attacker + } + } + } + 1 = { + trigger = { + $TEACHER$ = { has_trait = unyielding_defender } + $STUDENT$ = { NOT = { has_trait = unyielding_defender } } + } + $STUDENT$ = { + set_variable = { + name = commander_trait_being_taught + value = flag:unyielding_defender + } + } + } + 1 = { + trigger = { + $TEACHER$ = { has_trait = forder } + $STUDENT$ = { NOT = { has_trait = forder } } + } + $STUDENT$ = { + set_variable = { + name = commander_trait_being_taught + value = flag:forder + } + } + } + 1 = { + trigger = { + $TEACHER$ = { has_trait = flexible_leader } + $STUDENT$ = { NOT = { has_trait = flexible_leader } } + } + $STUDENT$ = { + set_variable = { + name = commander_trait_being_taught + value = flag:flexible_leader + } + } + } + 1 = { + trigger = { + $TEACHER$ = { has_trait = desert_warrior } + $STUDENT$ = { NOT = { has_trait = desert_warrior } } + } + $STUDENT$ = { + set_variable = { + name = commander_trait_being_taught + value = flag:desert_warrior + } + } + } + 1 = { + trigger = { + $TEACHER$ = { has_trait = jungle_stalker } + $STUDENT$ = { NOT = { has_trait = jungle_stalker } } + } + $STUDENT$ = { + set_variable = { + name = commander_trait_being_taught + value = flag:jungle_stalker + } + } + } + 1 = { + trigger = { + $TEACHER$ = { has_trait = winter_soldier } + $STUDENT$ = { NOT = { has_trait = winter_soldier } } + } + $STUDENT$ = { + set_variable = { + name = commander_trait_being_taught + value = flag:winter_soldier + } + } + } + 1 = { + trigger = { + $TEACHER$ = { has_trait = reaver } + $STUDENT$ = { NOT = { has_trait = reaver } } + } + $STUDENT$ = { + set_variable = { + name = commander_trait_being_taught + value = flag:reaver + } + } + } + 1 = { + trigger = { + $TEACHER$ = { has_trait = reckless } + $STUDENT$ = { NOT = { has_trait = reckless } } + } + $STUDENT$ = { + set_variable = { + name = commander_trait_being_taught + value = flag:reckless + } + } + } + 1 = { + trigger = { + $TEACHER$ = { has_trait = holy_warrior } + $STUDENT$ = { NOT = { has_trait = holy_warrior } } + } + $STUDENT$ = { + set_variable = { + name = commander_trait_being_taught + value = flag:holy_warrior + } + } + } + 1 = { + trigger = { + $TEACHER$ = { has_trait = open_terrain_expert } + $STUDENT$ = { NOT = { has_trait = open_terrain_expert } } + } + $STUDENT$ = { + set_variable = { + name = commander_trait_being_taught + value = flag:open_terrain_expert + } + } + } + 1 = { + trigger = { + $TEACHER$ = { has_trait = rough_terrain_expert } + $STUDENT$ = { NOT = { has_trait = rough_terrain_expert } } + } + $STUDENT$ = { + set_variable = { + name = commander_trait_being_taught + value = flag:rough_terrain_expert + } + } + } + 1 = { + trigger = { + $TEACHER$ = { has_trait = forest_fighter } + $STUDENT$ = { NOT = { has_trait = forest_fighter } } + } + $STUDENT$ = { + set_variable = { + name = commander_trait_being_taught + value = flag:forest_fighter + } + } + } + 1 = { + trigger = { + $TEACHER$ = { has_trait = cautious_leader } + $STUDENT$ = { NOT = { has_trait = cautious_leader } } + } + $STUDENT$ = { + set_variable = { + name = commander_trait_being_taught + value = flag:cautious_leader + } + } + } + 1 = { + trigger = { + $TEACHER$ = { has_trait = organizer } + $STUDENT$ = { NOT = { has_trait = organizer } } + } + $STUDENT$ = { + set_variable = { + name = commander_trait_being_taught + value = flag:organizer + } + } + } + } +} + +discover_new_commander_trait_to_teach = { + random_list = { + 1 = { + trigger = { NOT = { has_trait = logistician } } + set_variable = { + name = commander_trait_being_taught + value = flag:logistician + } + } + 1 = { + trigger = { NOT = { has_trait = military_engineer } } + set_variable = { + name = commander_trait_being_taught + value = flag:military_engineer + } + } + 1 = { + trigger = { NOT = { has_trait = aggressive_attacker } } + set_variable = { + name = commander_trait_being_taught + value = flag:aggressive_attacker + } + } + 1 = { + trigger = { NOT = { has_trait = unyielding_defender } } + set_variable = { + name = commander_trait_being_taught + value = flag:unyielding_defender + } + } + 1 = { + trigger = { NOT = { has_trait = forder } } + set_variable = { + name = commander_trait_being_taught + value = flag:forder + } + } + 1 = { + trigger = { NOT = { has_trait = flexible_leader } } + set_variable = { + name = commander_trait_being_taught + value = flag:flexible_leader + } + } + 1 = { + trigger = { + exists = scope:teacher.location + scope:teacher.location = { + OR = { + terrain = oasis + terrain = desert + terrain = desert_mountains + } + } + NOT = { has_trait = desert_warrior } + } + set_variable = { + name = commander_trait_being_taught + value = flag:desert_warrior + } + } + 1 = { + trigger = { + exists = scope:teacher.location + scope:teacher.location = { + terrain = jungle + } + NOT = { has_trait = jungle_stalker } + } + set_variable = { + name = commander_trait_being_taught + value = flag:jungle_stalker + } + } + 1 = { + trigger = { + exists = scope:teacher.location + scope:teacher.location = { + OR = { + terrain = taiga + geographical_region = world_tibet + geographical_region = world_europe_north + geographical_region = world_europe_east + geographical_region = world_steppe + } + } + NOT = { has_trait = winter_soldier } + } + set_variable = { + name = commander_trait_being_taught + value = flag:winter_soldier + } + } + 1 = { + trigger = { NOT = { has_trait = reaver } } + set_variable = { + name = commander_trait_being_taught + value = flag:reaver + } + } + 1 = { + trigger = { NOT = { has_trait = reckless } } + set_variable = { + name = commander_trait_being_taught + value = flag:reckless + } + } + 1 = { + trigger = { NOT = { has_trait = holy_warrior } } + set_variable = { + name = commander_trait_being_taught + value = flag:holy_warrior + } + } + 1 = { + trigger = { NOT = { has_trait = open_terrain_expert } } + set_variable = { + name = commander_trait_being_taught + value = flag:open_terrain_expert + } + } + 1 = { + trigger = { NOT = { has_trait = rough_terrain_expert } } + set_variable = { + name = commander_trait_being_taught + value = flag:rough_terrain_expert + } + } + 1 = { + trigger = { + exists = scope:teacher.location + scope:teacher.location = { + OR = { + terrain = forest + terrain = taiga + } + } + NOT = { has_trait = forest_fighter } + } + set_variable = { + name = commander_trait_being_taught + value = flag:forest_fighter + } + } + 1 = { + trigger = { NOT = { has_trait = cautious_leader } } + set_variable = { + name = commander_trait_being_taught + value = flag:cautious_leader + } + } + 1 = { + trigger = { NOT = { has_trait = organizer } } + set_variable = { + name = commander_trait_being_taught + value = flag:organizer + } + } + } +} + +randomize_commander_trait_to_be_taught_effect = { + random_list = { + 100 = { + trigger = { + NOT = { has_trait = logistician } + scope:teacher = { + has_trait = logistician + } + } + set_variable = { + name = commander_trait_being_taught + value = flag:logistician + } + } + 100 = { + trigger = { + NOT = { has_trait = military_engineer } + scope:teacher = { + has_trait = military_engineer + } + } + set_variable = { + name = commander_trait_being_taught + value = flag:military_engineer + } + } + 100 = { + trigger = { + NOT = { has_trait = aggressive_attacker } + scope:teacher = { + has_trait = aggressive_attacker + } + } + set_variable = { + name = commander_trait_being_taught + value = flag:aggressive_attacker + } + } + 100 = { + trigger = { + NOT = { has_trait = unyielding_defender } + scope:teacher = { + has_trait = unyielding_defender + } + } + set_variable = { + name = commander_trait_being_taught + value = flag:unyielding_defender + } + } + 100 = { + trigger = { + NOT = { has_trait = forder } + scope:teacher = { + has_trait = forder + } + } + set_variable = { + name = commander_trait_being_taught + value = flag:forder + } + } + 100 = { + trigger = { + NOT = { has_trait = flexible_leader } + scope:teacher = { + has_trait = flexible_leader + } + } + set_variable = { + name = commander_trait_being_taught + value = flag:flexible_leader + } + } + 100 = { + trigger = { + NOT = { has_trait = desert_warrior } + scope:teacher = { + has_trait = desert_warrior + } + } + set_variable = { + name = commander_trait_being_taught + value = flag:desert_warrior + } + } + 100 = { + trigger = { + NOT = { has_trait = jungle_stalker } + scope:teacher = { + has_trait = jungle_stalker + } + } + set_variable = { + name = commander_trait_being_taught + value = flag:jungle_stalker + } + } + 100 = { + trigger = { + NOT = { has_trait = winter_soldier } + scope:teacher = { + has_trait = winter_soldier + } + } + set_variable = { + name = commander_trait_being_taught + value = flag:winter_soldier + } + } + 100 = { + trigger = { + NOT = { has_trait = reaver } + scope:teacher = { + has_trait = reaver + } + } + set_variable = { + name = commander_trait_being_taught + value = flag:reaver + } + } + 100 = { + trigger = { + NOT = { has_trait = reckless } + scope:teacher = { + has_trait = reckless + } + } + set_variable = { + name = commander_trait_being_taught + value = flag:reckless + } + } + 100 = { + trigger = { + NOT = { has_trait = holy_warrior } + scope:teacher = { + has_trait = holy_warrior + } + } + set_variable = { + name = commander_trait_being_taught + value = flag:holy_warrior + } + } + } + if = { #Fallback + limit = { + NOT = { exists = var:commander_trait_being_taught } + } + set_variable = { + name = commander_trait_being_taught + value = flag:flexible_leader + } + } +} + + +commander_trait_teaching_setup_effect = { + hidden_effect = { + trigger_event = { + on_action = learn_commander_trait_test + days = { 200 730 } + } + } + if = { + limit = { NOT = {has_relation_mentor = scope:teacher } } + set_relation_mentor = scope:teacher + } + else = { + save_scope_value_as = { + name = long_term_mentor + value = yes + } + } +} + + +giving_up_on_commander_trait_training_effect = { + custom_tooltip = learn_commander_trait.giving_up_tt + if = { + limit = { + scope:teacher = { is_alive = yes } + } + scope:teacher = { + add_opinion = { + target = root + modifier = gave_up_on_learn_commander_trait_opinion + } + } + } + if = { + limit = { + NOT = { exists = scope:long_term_mentor } + has_relation_mentor = scope:teacher + } + remove_relation_mentor = scope:teacher + } + remove_character_flag = being_taught_commander_trait + remove_variable = commander_trait_being_taught +} + + +learn_commander_trait_success_effect = { + remove_character_flag = being_taught_commander_trait + if = { + limit = { + has_relation_mentor = scope:teacher + NOT = { exists = scope:long_term_mentor } + scope:teacher = { + is_alive = yes + } + } + remove_relation_mentor = scope:teacher + } + if = { + limit = { + scope:teacher = { + is_alive = yes + } + } + hidden_effect = { + add_opinion = { + target = scope:teacher + modifier = taught_me_commander_trait_opinion + } + } + } + if = { + limit = { var:commander_trait_being_taught = flag:logistician } + add_trait = logistician + } + else_if = { + limit = { var:commander_trait_being_taught = flag:military_engineer } + add_trait = military_engineer + } + else_if = { + limit = { var:commander_trait_being_taught = flag:aggressive_attacker } + add_trait = aggressive_attacker + } + else_if = { + limit = { var:commander_trait_being_taught = flag:unyielding_defender } + add_trait = unyielding_defender + } + else_if = { + limit = { var:commander_trait_being_taught = flag:forder } + add_trait = forder + } + else_if = { + limit = { var:commander_trait_being_taught = flag:flexible_leader } + add_trait = flexible_leader + } + else_if = { + limit = { var:commander_trait_being_taught = flag:desert_warrior } + add_trait = desert_warrior + } + else_if = { + limit = { var:commander_trait_being_taught = flag:jungle_stalker } + add_trait = jungle_stalker + } + else_if = { + limit = { var:commander_trait_being_taught = flag:winter_soldier } + add_trait = winter_soldier + } + else_if = { + limit = { var:commander_trait_being_taught = flag:reaver } + add_trait = reaver + } + else_if = { + limit = { var:commander_trait_being_taught = flag:reckless } + add_trait = reckless + } + else_if = { + limit = { var:commander_trait_being_taught = flag:holy_warrior } + add_trait = holy_warrior + } + else_if = { + limit = { var:commander_trait_being_taught = flag:open_terrain_expert } + add_trait = open_terrain_expert + } + else_if = { + limit = { var:commander_trait_being_taught = flag:rough_terrain_expert } + add_trait = rough_terrain_expert + } + else_if = { + limit = { var:commander_trait_being_taught = flag:forest_fighter } + add_trait = forest_fighter + } + else_if = { + limit = { var:commander_trait_being_taught = flag:cautious_leader } + add_trait = cautious_leader + } + else_if = { + limit = { var:commander_trait_being_taught = flag:organizer } + add_trait = organizer + } +} + + +learn_commander_trait_final_test_duel_effect = { + duel = { + skill = martial + value = 10 + 10 = { + compare_modifier = { + value = scope:duel_value + } + desc = learn_commander_trait_final_test_success + custom_tooltip = learn_commander_trait_final_test_success_tt + trigger_event = { + on_action = learn_commander_trait_success + days = 1 + } + } + 10 = { + desc = learn_commander_trait_final_test_failure + custom_tooltip = learn_commander_trait_final_test_failure_tt + trigger_event = { + on_action = learn_commander_trait_failure + days = 1 + } + } + } +} + + + +martial_authority_special_1100_a_failure_effect = { + add_character_modifier = { + modifier = fought_a_seasoned_warrior + days = 3650 + } + random = { + chance = 33 + increase_wounds_effect = { REASON = training_accident } + } +} + + + +martial_authority_special_1100_soldier_friend_effects_effect = { + hidden_effect = { + set_relation_soldier_friend = scope:soldier_friend + set_relation_potential_friend = scope:soldier_friend + } + reverse_add_opinion = { + target = scope:soldier_friend + modifier = grateful_opinion + opinion = 15 + } + + add_hook = { + type = loyalty_hook + target = scope:soldier_friend + } + + add_courtier = scope:soldier_friend +} diff --git a/N3OW/common/scripted_effects/00_men_at_arms_effects.txt b/N3OW/common/scripted_effects/00_men_at_arms_effects.txt new file mode 100644 index 00000000..3baaeddc --- /dev/null +++ b/N3OW/common/scripted_effects/00_men_at_arms_effects.txt @@ -0,0 +1,13 @@ + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! + +#spawn_heavy_infantry_army_effect - create a random fitting HI MAA army +#spawn_single_men_at_arms_army_effect - create a MAA army of a given type + +##################################################################### +# EFFECTS +##################################################################### + diff --git a/N3OW/common/scripted_effects/00_mongol_invasion_effects.txt b/N3OW/common/scripted_effects/00_mongol_invasion_effects.txt new file mode 100644 index 00000000..f1ba1d44 --- /dev/null +++ b/N3OW/common/scripted_effects/00_mongol_invasion_effects.txt @@ -0,0 +1,12646 @@ +@creatable_successor_empire_county_threshold = 15 + + +# Give a suitable County to Genghis +give_temujin_land_effect = { + if = { + limit = { + OR = { + is_landed = no + highest_held_title_tier < tier_county + } + } + save_scope_as = genghis_khan + + create_title_and_vassal_change = { + type = conquest + save_scope_as = title_change + add_claim_on_loss = no + } + title:c_khentii = { + change_title_holder = { + holder = scope:genghis_khan + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + } + capital_county = { change_county_control = 100 } +} + +# A wild Genghis Khan appears! +spawn_temujin_character_effect = { + title:c_khentii.title_province = { + save_scope_as = temujins_birthplace + } + if = { + limit = { + exists = character:125501 + character:125501 = { + is_ai = no + } + } + character:125501 = { + save_scope_as = temujin + } + if = { + limit = { + #The DLC has our own BECOME GENGHIS stuff for players + has_mpo_dlc_trigger = no + } + scope:temujin = { + give_temujin_land_effect = yes + # Make temporarily immune to disease + add_character_flag = { + flag = immune_to_disease + years = 15 + } + + add_trait = greatest_of_khans + form_the_mongol_empire_effect = yes + add_prestige = 25000 + give_nickname = nick_genghis_khan + trigger_event = conqueror.0001 + } + } + else = { + scope:temujin = { + # Make temporarily immune to disease + add_character_flag = { + flag = immune_to_disease + years = 15 + } + trigger_event = conqueror.0001 + } + } + } + else_if = { + limit = { + exists = character:125501 + character:125501 = { is_physically_able_ai_adult = yes } + } + character:125501 = { + save_scope_as = temujin + } + scope:temujin = { + # Make temporarily immune to disease + add_character_flag = { + flag = immune_to_disease + years = 15 + } + + add_trait = greatest_of_khans + give_temujin_land_effect = yes + add_gold = 5000 + add_dread = high_dread + spawn_temujins_court_effect = yes + form_the_mongol_empire_effect = yes + add_prestige = 25000 + if = { + limit = { + has_mpo_dlc_trigger = no + NOT = { has_perk = peacemaker_perk } + } + add_perk = peacemaker_perk + } + remove_trait = education_diplomacy_1 + remove_trait = education_diplomacy_2 + remove_trait = education_diplomacy_3 + remove_trait = education_diplomacy_4 + remove_trait = education_diplomacy_5 + remove_trait = education_intrigue_1 + remove_trait = education_intrigue_2 + remove_trait = education_intrigue_3 + remove_trait = education_intrigue_4 + remove_trait = education_intrigue_5 + remove_trait = education_stewardship_1 + remove_trait = education_stewardship_2 + remove_trait = education_stewardship_3 + remove_trait = education_stewardship_4 + remove_trait = education_stewardship_5 + remove_trait = education_learning_1 + remove_trait = education_learning_2 + remove_trait = education_learning_3 + remove_trait = education_learning_4 + remove_trait = education_learning_5 + remove_trait = education_martial_1 + remove_trait = education_martial_2 + remove_trait = education_martial_3 + remove_trait = education_martial_4 + add_trait = education_martial_5 + add_trait = flexible_leader + add_trait = athletic + if = { + limit = { has_dlc_feature = tours_and_tournaments } + add_trait = tourney_participant + add_random_tiered_trait_track_xp_effect = { + TRAIT = lifestyle_hunter + TRACK = hunter + LEVEL_1 = yes + LEVEL_3 = no + } + add_random_tiered_trait_track_xp_effect = { + TRAIT = tourney_participant + TRACK = horse + LEVEL_1 = yes + LEVEL_3 = yes + } + add_random_tiered_trait_track_xp_effect = { + TRAIT = tourney_participant + TRACK = bow + LEVEL_1 = yes + LEVEL_3 = yes + } + } + dynasty = { + add_dynasty_prestige_level = 5 + add_dynasty_prestige = 10000 + add_dynasty_perk = warfare_legacy_1 + add_dynasty_perk = warfare_legacy_2 + add_dynasty_perk = warfare_legacy_3 + add_dynasty_perk = warfare_legacy_4 + add_dynasty_perk = warfare_legacy_5 + if = { + limit = { + has_dlc_feature = hybridize_culture + } + add_dynasty_perk = ep1_culture_legacy_1 + } + } + give_nickname = nick_genghis_khan + } + } + else_if = { + limit = { + exists = character:125501.dynasty + character:125501.dynasty = { + any_dynasty_member = { + is_ai = no + is_landed = yes + } + } + } + character:125501.dynasty = { + random_dynasty_member = { + limit = { + is_ai = no + is_landed = yes + } + save_scope_as = temujin + } + } + if = { + limit = { has_mpo_dlc_trigger = no } + scope:temujin = { + # Make temporarily immune to disease + add_character_flag = { + flag = immune_to_disease + years = 15 + } + + add_trait = greatest_of_khans + form_the_mongol_empire_effect = yes + add_prestige = 25000 + give_nickname = nick_genghis_khan + trigger_event = conqueror.0001 + } + } + else = { + scope:temujin = { + # Make temporarily immune to disease + add_character_flag = { + flag = immune_to_disease + years = 15 + } + trigger_event = conqueror.0001 + } + } + } + else_if = { + limit = { + exists = character:125501.dynasty + character:125501.dynasty = { + any_dynasty_member = { + is_physically_able_ai_adult = yes + } + } + } + character:125501.dynasty = { + random_dynasty_member = { + limit = { + is_physically_able_ai_adult = yes + is_landed = yes + } + alternative_limit = { + is_physically_able_ai_adult = yes + } + save_scope_as = temujin + } + } + scope:temujin = { + # Make temporarily immune to disease + add_character_flag = { + flag = immune_to_disease + years = 15 + } + + add_trait = greatest_of_khans + give_temujin_land_effect = yes + add_gold = 5000 + add_dread = high_dread + spawn_temujins_court_effect = yes + form_the_mongol_empire_effect = yes + add_prestige = 25000 + if = { + limit = { + has_mpo_dlc_trigger = no + NOT = { has_perk = peacemaker_perk } + } + add_perk = peacemaker_perk + } + remove_trait = education_diplomacy_1 + remove_trait = education_diplomacy_2 + remove_trait = education_diplomacy_3 + remove_trait = education_diplomacy_4 + remove_trait = education_diplomacy_5 + remove_trait = education_intrigue_1 + remove_trait = education_intrigue_2 + remove_trait = education_intrigue_3 + remove_trait = education_intrigue_4 + remove_trait = education_intrigue_5 + remove_trait = education_stewardship_1 + remove_trait = education_stewardship_2 + remove_trait = education_stewardship_3 + remove_trait = education_stewardship_4 + remove_trait = education_stewardship_5 + remove_trait = education_learning_1 + remove_trait = education_learning_2 + remove_trait = education_learning_3 + remove_trait = education_learning_4 + remove_trait = education_learning_5 + remove_trait = education_martial_1 + remove_trait = education_martial_2 + remove_trait = education_martial_3 + remove_trait = education_martial_4 + add_trait = education_martial_5 + add_trait = flexible_leader + add_trait = athletic + if = { + limit = { has_dlc_feature = tours_and_tournaments } + add_trait = tourney_participant + add_random_tiered_trait_track_xp_effect = { + TRAIT = lifestyle_hunter + TRACK = hunter + LEVEL_1 = yes + LEVEL_3 = no + } + add_random_tiered_trait_track_xp_effect = { + TRAIT = tourney_participant + TRACK = horse + LEVEL_1 = yes + LEVEL_3 = yes + } + add_random_tiered_trait_track_xp_effect = { + TRAIT = tourney_participant + TRACK = bow + LEVEL_1 = yes + LEVEL_3 = yes + } + } + dynasty = { + add_dynasty_prestige_level = 5 + add_dynasty_prestige = 10000 + add_dynasty_perk = warfare_legacy_1 + add_dynasty_perk = warfare_legacy_2 + add_dynasty_perk = warfare_legacy_3 + add_dynasty_perk = warfare_legacy_4 + add_dynasty_perk = warfare_legacy_5 + if = { + limit = { + has_dlc_feature = hybridize_culture + } + add_dynasty_perk = ep1_culture_legacy_1 + } + } + give_nickname = nick_genghis_khan + } + } + else_if = { + limit = { + #Generate Temujin if there has BEEN NO Temujin + NOT = { + has_global_variable = temujin_was_born + } + } + if = { + limit = { has_game_rule = inversed_gender_equality } + create_character = { + name = "Borte" # AKA: Genghis Khan's wife + gender = female + location = scope:temujins_birthplace + template = borte_character_template + save_scope_as = temujin + } + scope:temujin = { + # Make temporarily immune to disease + add_character_flag = { + flag = immune_to_disease + years = 15 + } + + add_trait = greatest_of_khans + give_temujin_land_effect = yes + add_gold = 5000 + add_dread = high_dread + spawn_temujins_court_effect = yes + form_the_mongol_empire_effect = yes + add_prestige = 25000 + give_nickname = nick_genghis_khan + if = { + limit = { + has_mpo_dlc_trigger = no + NOT = { has_perk = peacemaker_perk } + } + add_perk = peacemaker_perk + } + dynasty = { + add_dynasty_prestige_level = 5 + add_dynasty_prestige = 10000 + add_dynasty_perk = warfare_legacy_1 + add_dynasty_perk = warfare_legacy_2 + add_dynasty_perk = warfare_legacy_3 + add_dynasty_perk = warfare_legacy_4 + add_dynasty_perk = warfare_legacy_5 + if = { + limit = { + has_dlc_feature = hybridize_culture + } + add_dynasty_perk = ep1_culture_legacy_1 + } + } + } + } + else_if = { + limit = { has_game_rule = full_gender_equality } + random_list = { + #Female Ghengis Khan. + 50 = { + create_character = { + name = "Borte" # AKA: Genghis Khan's wife + gender = female + location = scope:temujins_birthplace + template = borte_character_template + save_scope_as = temujin + } + scope:temujin = { + # Make temporarily immune to disease + add_character_flag = { + flag = immune_to_disease + years = 15 + } + + add_trait = greatest_of_khans + give_temujin_land_effect = yes + add_gold = 5000 + add_dread = high_dread + spawn_temujins_court_effect = yes + form_the_mongol_empire_effect = yes + add_prestige = 25000 + give_nickname = nick_genghis_khan + if = { + limit = { + has_mpo_dlc_trigger = no + NOT = { has_perk = peacemaker_perk } + } + add_perk = peacemaker_perk + } + dynasty = { + add_dynasty_prestige_level = 5 + add_dynasty_prestige = 10000 + add_dynasty_perk = warfare_legacy_1 + add_dynasty_perk = warfare_legacy_2 + add_dynasty_perk = warfare_legacy_3 + add_dynasty_perk = warfare_legacy_4 + add_dynasty_perk = warfare_legacy_5 + if = { + limit = { + has_dlc_feature = hybridize_culture + } + add_dynasty_perk = ep1_culture_legacy_1 + } + } + } + } + #Male Ghengis Khan. + 50 = { + create_character = { + name = "Temujin" # AKA: Genghis Khan + location = scope:temujins_birthplace + template = genghis_khan_character_template + save_scope_as = temujin + } + scope:temujin = { + # Make temporarily immune to disease + add_character_flag = { + flag = immune_to_disease + years = 15 + } + + add_trait = greatest_of_khans + give_temujin_land_effect = yes + add_gold = 5000 + add_dread = high_dread + spawn_temujins_court_effect = yes + form_the_mongol_empire_effect = yes + add_prestige = 25000 + give_nickname = nick_genghis_khan + if = { + limit = { + has_mpo_dlc_trigger = no + NOT = { has_perk = peacemaker_perk } + } + add_perk = peacemaker_perk + } + dynasty = { + add_dynasty_prestige_level = 5 + add_dynasty_prestige = 10000 + add_dynasty_perk = warfare_legacy_1 + add_dynasty_perk = warfare_legacy_2 + add_dynasty_perk = warfare_legacy_3 + add_dynasty_perk = warfare_legacy_4 + add_dynasty_perk = warfare_legacy_5 + if = { + limit = { + has_dlc_feature = hybridize_culture + } + add_dynasty_perk = ep1_culture_legacy_1 + } + } + } + } + } + } + else = { + create_character = { + name = "Temujin" # AKA: Genghis Khan + location = scope:temujins_birthplace + template = genghis_khan_character_template + save_scope_as = temujin + } + scope:temujin = { + # Make temporarily immune to disease + add_character_flag = { + flag = immune_to_disease + years = 15 + } + + add_trait = greatest_of_khans + give_temujin_land_effect = yes + add_gold = 5000 + add_dread = high_dread + spawn_temujins_court_effect = yes + form_the_mongol_empire_effect = yes + add_prestige = 25000 + give_nickname = nick_genghis_khan + if = { + limit = { + has_mpo_dlc_trigger = no + NOT = { has_perk = peacemaker_perk } + } + add_perk = peacemaker_perk + } + dynasty = { + add_dynasty_prestige_level = 5 + add_dynasty_prestige = 10000 + add_dynasty_perk = warfare_legacy_1 + add_dynasty_perk = warfare_legacy_2 + add_dynasty_perk = warfare_legacy_3 + add_dynasty_perk = warfare_legacy_4 + add_dynasty_perk = warfare_legacy_5 + if = { + limit = { + has_dlc_feature = hybridize_culture + } + add_dynasty_perk = ep1_culture_legacy_1 + } + } + } + } + set_global_variable = { + name = temujin_was_born + value = scope:temujin + } + } + #Create a character... but they're random, not Temujin + else = { + create_character = { + location = scope:temujins_birthplace + template = dynamic_genghis_character_template + save_scope_as = temujin + } + scope:temujin = { + # Make temporarily immune to disease + add_character_flag = { + flag = immune_to_disease + years = 15 + } + add_trait = greatest_of_khans + give_temujin_land_effect = yes + add_gold = 5000 + add_dread = high_dread + spawn_dynamic_mongol_court_effect = yes + form_the_mongol_empire_effect = yes + add_prestige = 25000 + give_nickname = nick_genghis_khan + if = { + limit = { + has_mpo_dlc_trigger = no + NOT = { has_perk = peacemaker_perk } + } + add_perk = peacemaker_perk + } + dynasty = { + add_dynasty_prestige_level = 5 + add_dynasty_prestige = 10000 + add_dynasty_perk = warfare_legacy_1 + add_dynasty_perk = warfare_legacy_2 + add_dynasty_perk = warfare_legacy_3 + add_dynasty_perk = warfare_legacy_4 + add_dynasty_perk = warfare_legacy_5 + if = { + limit = { + has_dlc_feature = hybridize_culture + } + add_dynasty_perk = ep1_culture_legacy_1 + } + } + } + } + + if = { + limit = { + scope:temujin = { + is_ai = yes + } + } + if = { + limit = { + situation:dynastic_cycle ?= { + situation_top_has_catalyst = catalyst_event_mongol_empire_appears + } + } + situation:dynastic_cycle = { + trigger_situation_catalyst = { + catalyst = catalyst_event_mongol_empire_appears + character = scope:temujin + } + } + } + #Event for MPO dlc owners + if = { + limit = { + has_mpo_dlc_trigger = yes + } + every_player = { + trigger_event = mpo_greatest_of_khans.1001 #Genghis notification event + } + } + else = { + #Normal event + every_player = { + limit = { + NOT = { + this = scope:temujin + } + } + trigger_event = mongol_invasion.1002 # Mongol Empire spawned notification + } + } + } +} + + +# Form the actual Mongol Empire... +form_the_mongol_empire_effect = { + save_scope_as = mongol_founder + + if = { + limit = { + is_tributary = yes + } + end_tributary = yes + } + if = { + limit = { + is_confederation_member = yes + } + scope:mongol_founder.confederation = { + remove_confederation_member = scope:mongol_founder + } + if = { + limit = { + government_has_flag = government_is_nomadic + } + show_as_tooltip = { + remove_character_modifier = mpo_confederation_member_modifier + } + } + } + + #Create the title + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:e_mongol_empire = { + change_title_holder = { + holder = scope:mongol_founder + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + + + if = { + limit = { + is_independent_ruler = no + } + create_title_and_vassal_change = { + type = independency + save_scope_as = indpendence_change + add_claim_on_loss = no + } + becomes_independent = { + change = scope:indpendence_change + } + resolve_title_and_vassal_change = scope:indpendence_change + } + + if = { + limit = { + capital_county = { + title_province = { + has_holding_type = herder_holding + } + } + } + capital_county = { + title_province = { + set_holding_type = nomad_holding + } + } + } + if = { + limit = { + has_mpo_dlc_trigger = yes + NOT = { + government_has_flag = government_is_nomadic + } + } + change_government = nomad_government + add_trait_force_tooltip = nomadic_philosophy + } + else_if = { + limit = { + has_mpo_dlc_trigger = no + NOT = { + government_has_flag = government_is_tribal + } + } + change_government = tribal_government + } + if = { + limit = { + government_has_flag = government_is_tribal + } + if = { + limit = { has_realm_law = tribal_authority_0 } + remove_realm_law = tribal_authority_0 + } + if = { + limit = { has_realm_law = tribal_authority_1 } + remove_realm_law = tribal_authority_1 + } + if = { + limit = { has_realm_law = tribal_authority_3 } + remove_realm_law = tribal_authority_3 + } + add_realm_law_skip_effects = tribal_authority_2 + + add_realm_law_skip_effects = high_partition_succession_law + } + if = { + limit = { + government_has_flag = government_is_nomadic + } + if = { + limit = { has_realm_law = nomadic_authority_1 } + remove_realm_law = nomadic_authority_1 + } + if = { + limit = { has_realm_law = nomadic_authority_2 } + remove_realm_law = nomadic_authority_2 + } + if = { + limit = { has_realm_law = nomadic_authority_3 } + remove_realm_law = nomadic_authority_3 + } + if = { + limit = { has_realm_law = nomadic_authority_4 } + remove_realm_law = nomadic_authority_4 + } + add_realm_law_skip_effects = nomadic_authority_5 + domicile ?= { + switch = { + trigger = has_domicile_building + yurt_main_01 = { + add_domicile_building = yurt_main_02 + add_domicile_building = yurt_main_03 + add_domicile_building = yurt_main_04 + add_domicile_building = yurt_main_05 + } + yurt_main_02 = { + add_domicile_building = yurt_main_03 + add_domicile_building = yurt_main_04 + add_domicile_building = yurt_main_05 + } + yurt_main_03 = { + add_domicile_building = yurt_main_04 + add_domicile_building = yurt_main_05 + } + yurt_main_04 = { + add_domicile_building = yurt_main_05 + } + } + } + if = { + limit = { + exists = domicile + domicile = { + free_external_domicile_building_slots >= 1 + NOT = { + has_domicile_building_or_higher = mass_warfare_yurt_01 + } + } + } + domicile = { + add_domicile_building = mass_warfare_yurt_01 + add_domicile_building = mass_warfare_yurt_02 + add_domicile_building = mass_warfare_yurt_03 + add_domicile_building = mass_warfare_yurt_04 + } + } + if = { + limit = { + exists = domicile + domicile = { + free_external_domicile_building_slots >= 1 + NOT = { + has_domicile_building_or_higher = character_warfare_yurt_03 + } + } + } + domicile = { + add_domicile_building = character_warfare_yurt_01 + add_domicile_building = character_warfare_yurt_02 + add_domicile_building = character_warfare_yurt_03 + add_domicile_building = character_warfare_yurt_04 + } + } + domicile = { + change_herd = { + add = nomadic_authority_level_5_requirement + } + } + } + + assert_if = { + limit = { NOT = { exists = title:e_mongol_empire } } + text = "Mongol Empire title was not created!" + } + + hidden_effect = { set_primary_title_to = title:e_mongol_empire } + + every_held_title = { + title_tier = empire + limit = { + NOT = { this = title:e_mongol_empire } + } + scope:mongol_founder = { + destroy_title = prev + } + } + + spawn_mongol_troops_effect = yes + + set_global_variable = { + name = mongol_empire_has_spawned + value = yes + } + + #Make sure that Genghis is crowned + #Anointed if he must be anointed + if = { + limit = { + OR = { + has_realm_law = uncrowned + has_realm_law = crowned_king + } + faith = { has_doctrine = doctrine_imperial_anointment } + } + if = { + limit = { + NOT = { + has_game_rule = coronation_laws_off + } + } + add_realm_law = crowned_emperor + } + set_variable = crowned_emperor_var + if = { + limit = { + has_variable = crowned_king_var + } + remove_variable = crowned_king_var + } + } + else_if = { + limit = { + has_realm_law = uncrowned + } + if = { + limit = { + NOT = { + has_game_rule = coronation_laws_off + } + } + add_realm_law = crowned_king + } + set_variable = crowned_king_var + } +} + +# Make sure the Empire has troops... +spawn_mongol_troops_effect = { + if = { + limit = { + has_mpo_dlc_trigger = yes + } + spawn_army = { + uses_supply = no + inheritable = yes + name = mongol_event_troops + men_at_arms = { + type = mangudai + stacks = 14 + } + men_at_arms = { + type = heavy_horse_archers + stacks = 10 + } + men_at_arms = { + type = steppe_raiders + stacks = 10 + } + men_at_arms = { + type = nomad_lancers + stacks = 5 + } + men_at_arms = { + type = trebuchet + stacks = 5 + } + men_at_arms = { + type = trebuchet + stacks = 5 + } + location = capital_province + origin = capital_province + } + spawn_army = { + uses_supply = no + inheritable = yes + name = mongol_event_troops + men_at_arms = { + type = mangudai + stacks = 10 + } + men_at_arms = { + type = horse_archers + stacks = 10 + } + men_at_arms = { + type = steppe_raiders + stacks = 10 + } + men_at_arms = { + type = steppe_raiders + stacks = 10 + } + men_at_arms = { + type = nomad_lancers + stacks = 3 + } + men_at_arms = { + type = trebuchet + stacks = 5 + } + location = capital_province + origin = capital_province + } + spawn_army = { + uses_supply = no + inheritable = yes + name = mongol_event_troops + men_at_arms = { + type = mangudai + stacks = 10 + } + men_at_arms = { + type = horse_archers + stacks = 10 + } + men_at_arms = { + type = steppe_raiders + stacks = 10 + } + men_at_arms = { + type = steppe_raiders + stacks = 10 + } + men_at_arms = { + type = nomad_lancers + stacks = 3 + } + men_at_arms = { + type = trebuchet + stacks = 5 + } + location = capital_province + origin = capital_province + } + spawn_army = { + uses_supply = no + inheritable = yes + name = mongol_event_troops + men_at_arms = { + type = mangudai + stacks = 10 + } + men_at_arms = { + type = horse_archers + stacks = 10 + } + men_at_arms = { + type = heavy_horse_archers + stacks = 10 + } + men_at_arms = { + type = steppe_raiders + stacks = 10 + } + men_at_arms = { + type = nomad_lancers + stacks = 3 + } + men_at_arms = { + type = trebuchet + stacks = 5 + } + location = capital_province + origin = capital_province + } + spawn_army = { + uses_supply = no + inheritable = yes + name = mongol_event_troops + men_at_arms = { + type = horse_archers + stacks = 5 + } + men_at_arms = { + type = steppe_raiders + stacks = 20 + } + men_at_arms = { + type = torch_bearers + stacks = 5 + } + location = capital_province + origin = capital_province + } + spawn_army = { + uses_supply = no + inheritable = yes + name = mongol_event_troops + men_at_arms = { + type = horse_archers + stacks = 5 + } + men_at_arms = { + type = steppe_raiders + stacks = 20 + } + men_at_arms = { + type = torch_bearers + stacks = 5 + } + location = capital_province + origin = capital_province + } + } + else = { + spawn_army = { + uses_supply = no + inheritable = no + name = mongol_event_troops + men_at_arms = { + type = horse_archers + stacks = 14 + } + men_at_arms = { + type = light_horsemen + stacks = 10 + } + men_at_arms = { + type = light_horsemen + stacks = 10 + } + men_at_arms = { + type = armored_horsemen + stacks = 5 + } + men_at_arms = { + type = trebuchet + stacks = 5 + } + men_at_arms = { + type = trebuchet + stacks = 5 + } + location = capital_province + origin = capital_province + } + spawn_army = { + uses_supply = no + inheritable = no + name = mongol_event_troops + levies = { + value = 5000 + } + men_at_arms = { + type = horse_archers + stacks = 10 + } + men_at_arms = { + type = horse_archers + stacks = 10 + } + men_at_arms = { + type = light_horsemen + stacks = 10 + } + men_at_arms = { + type = light_horsemen + stacks = 10 + } + men_at_arms = { + type = armored_horsemen + stacks = 3 + } + men_at_arms = { + type = trebuchet + stacks = 5 + } + location = capital_province + origin = capital_province + } + spawn_army = { + uses_supply = no + inheritable = no + name = mongol_event_troops + levies = { + value = 5000 + } + men_at_arms = { + type = horse_archers + stacks = 10 + } + men_at_arms = { + type = horse_archers + stacks = 10 + } + men_at_arms = { + type = light_horsemen + stacks = 10 + } + men_at_arms = { + type = light_horsemen + stacks = 10 + } + men_at_arms = { + type = armored_horsemen + stacks = 3 + } + men_at_arms = { + type = trebuchet + stacks = 5 + } + location = capital_province + origin = capital_province + } + spawn_army = { + uses_supply = no + inheritable = no + name = mongol_event_troops + levies = { + value = 5000 + } + men_at_arms = { + type = horse_archers + stacks = 10 + } + men_at_arms = { + type = horse_archers + stacks = 10 + } + men_at_arms = { + type = light_horsemen + stacks = 10 + } + men_at_arms = { + type = light_horsemen + stacks = 10 + } + men_at_arms = { + type = armored_horsemen + stacks = 3 + } + men_at_arms = { + type = trebuchet + stacks = 5 + } + location = capital_province + origin = capital_province + } + } +} + +spawn_mongol_troops_condensed_effect = { + if = { + limit = { + has_mpo_dlc_trigger = yes + } + spawn_army = { + uses_supply = no + inheritable = no + name = mongol_event_troops + men_at_arms = { + type = horse_archers + stacks = 40 + } + men_at_arms = { + type = steppe_raiders + stacks = 100 + } + men_at_arms = { + type = heavy_horse_archers + stacks = 20 + } + men_at_arms = { + type = mangudai + stacks = 44 + } + men_at_arms = { + type = nomad_lancers + stacks = 14 + } + men_at_arms = { + type = trebuchet + stacks = 25 + } + men_at_arms = { + type = torch_bearers + stacks = 10 + } + location = capital_province + origin = capital_province + } + } + else = { + spawn_army = { + uses_supply = no + inheritable = no + name = mongol_event_troops + levies = { + value = 15000 + } + men_at_arms = { + type = horse_archers + stacks = 74 + } + men_at_arms = { + type = light_horsemen + stacks = 70 + } + men_at_arms = { + type = light_horsemen + stacks = 10 + } + men_at_arms = { + type = armored_horsemen + stacks = 14 + } + men_at_arms = { + type = trebuchet + stacks = 25 + } + location = capital_province + origin = capital_province + } + } +} + +spawn_mongol_successor_state_troops_effect = { + if = { + limit = { + has_mpo_dlc_trigger = yes + } + spawn_army = { + uses_supply = no + inheritable = yes + name = mongol_event_troops + men_at_arms = { + type = nomadic_riders + stacks = 7 + } + men_at_arms = { + type = mangudai + stacks = 5 + } + men_at_arms = { + type = steppe_raiders + stacks = 5 + } + men_at_arms = { + type = trebuchet + stacks = 3 + } + location = capital_province + origin = capital_province + } + spawn_army = { + uses_supply = no + inheritable = yes + name = mongol_event_troops + men_at_arms = { + type = nomadic_riders + stacks = 7 + } + men_at_arms = { + type = horse_archers + stacks = 5 + } + men_at_arms = { + type = nomad_lancers + stacks = 5 + } + men_at_arms = { + type = trebuchet + stacks = 3 + } + location = capital_province + origin = capital_province + } + spawn_army = { + uses_supply = no + inheritable = yes + name = mongol_event_troops + men_at_arms = { + type = nomadic_riders + stacks = 7 + } + men_at_arms = { + type = horse_archers + stacks = 5 + } + men_at_arms = { + type = heavy_horse_archers + stacks = 5 + } + men_at_arms = { + type = trebuchet + stacks = 3 + } + location = capital_province + origin = capital_province + } + } + else = { + spawn_army = { + uses_supply = no + inheritable = yes + name = mongol_event_troops + levies = { + value = 1000 + } + men_at_arms = { + type = horse_archers + stacks = 5 + } + men_at_arms = { + type = light_horsemen + stacks = 5 + } + men_at_arms = { + type = trebuchet + stacks = 3 + } + location = capital_province + origin = capital_province + } + spawn_army = { + uses_supply = no + inheritable = yes + name = mongol_event_troops + levies = { + value = 1000 + } + men_at_arms = { + type = horse_archers + stacks = 5 + } + men_at_arms = { + type = light_horsemen + stacks = 5 + } + men_at_arms = { + type = trebuchet + stacks = 3 + } + location = capital_province + origin = capital_province + } + spawn_army = { + uses_supply = no + inheritable = yes + name = mongol_event_troops + levies = { + value = 1000 + } + men_at_arms = { + type = horse_archers + stacks = 5 + } + men_at_arms = { + type = light_horsemen + stacks = 5 + } + men_at_arms = { + type = trebuchet + stacks = 3 + } + location = capital_province + origin = capital_province + } + } + +} + +### Populating the life of Temujin... +spawn_temujins_court_effect = { + add_character_flag = is_temujin + if = { + limit = { + is_married = no + } + if = { + limit = { + scope:temujin = { is_female = yes } + } + # Create Temujin (husband)... + create_character = { + template = genghis_khan_character_template + name = "Temujin" # Husband of Temujin + employer = scope:temujin + save_scope_as = borte + } + } + else = { + # Create Borte (wife)... + create_character = { + template = borte_character_template + name = "Borte" # Wife of Temujin + gender = female + employer = scope:temujin + save_scope_as = borte + } + } + scope:borte = { + marry = scope:temujin + # Make temporarily immune to disease + add_character_flag = { + flag = immune_to_disease + years = 10 + } + } + if = { + limit = { + scope:temujin = { is_male = yes } + } + scope:temujin = { save_scope_as = great_khan_family_father } + scope:borte = { save_scope_as = great_khan_family_mother } + } + else = { + scope:temujin = { save_scope_as = great_khan_family_mother } + scope:borte = { save_scope_as = great_khan_family_father } + } + + # Create Jochi (son)... + create_character = { + template = jochi_character_template + name = "Jochi" # (Oldest son of Temujin and Borte) + employer = scope:temujin + mother = scope:great_khan_family_mother + father = scope:great_khan_family_father + save_scope_as = jochi + } + scope:jochi = { + # Make temporarily immune to disease + add_character_flag = { + flag = immune_to_disease + years = 10 + } + } + + # Create Tolui (son)... + create_character = { + template = tolui_character_template + name = "Tolui" # (Son of Temujin and Borte) + employer = scope:temujin + mother = scope:great_khan_family_mother + father = scope:great_khan_family_father + save_scope_as = tolui + } + + scope:tolui = { + # Make temporarily immune to disease + add_character_flag = { + flag = immune_to_disease + years = 10 + } + } + + # Create Chagatai (son)... + create_character = { + template = chagatai_character_template + name = "Chagatai" # (Son of Temujin and Borte) + employer = scope:temujin + mother = scope:great_khan_family_mother + father = scope:great_khan_family_father + save_scope_as = chagatai + } + + scope:chagatai = { + # Make temporarily immune to disease + add_character_flag = { + flag = immune_to_disease + years = 10 + } + + #Make it more likely that he gets a good martial education + hidden_effect = { + education_point_acquisition_effect = yes + education_point_acquisition_effect = yes + } + } + + # Create Ögedei (son)... + create_character = { + template = ogodei_character_template + name = "Ogodei" # Ögedei Khan (# Son of Temujin and Borte) + employer = scope:temujin + mother = scope:great_khan_family_mother + father = scope:great_khan_family_father + save_scope_as = ogodei + } + + scope:ogodei = { + # Make temporarily immune to disease + add_character_flag = { + flag = immune_to_disease + years = 10 + } + + #Make it more likely that he gets a good martial education + hidden_effect = { + education_point_acquisition_effect = yes + education_point_acquisition_effect = yes + } + } + + # Create Altun Begi (Daughter)... + create_character = { + template = altun_begi_character_template + name = "Altun_Begi" # (Daughter of Temujin) + employer = scope:temujin + gender = female + father = scope:great_khan_family_father + save_scope_as = altun_begi + } + + scope:altun_begi = { + # Make temporarily immune to disease + add_character_flag = { + flag = immune_to_disease + years = 10 + } + } + } + + # Create Subutai (Commander)... + create_character = { + template = subutai_character_template + name = "Subutai" # (Temujin's Commander of armies) + employer = scope:temujin + save_scope_as = subutai + } + + scope:subutai = { + # Make temporarily immune to disease + add_character_flag = { + flag = immune_to_disease + years = 10 + } + # Set friendship with Temujin + set_random_friendship_reason = { TARGET = scope:temujin } + } + + # Spawn some generic Bagathurs + create_character = { + gender_female_chance = temujin_soldier_female_chance + employer = scope:temujin + template = new_warrior_character + faith = scope:temujin.faith + culture = scope:temujin.culture + } + create_character = { + gender_female_chance = temujin_soldier_female_chance + employer = scope:temujin + template = new_warrior_character + faith = scope:temujin.faith + culture = scope:temujin.culture + } + create_character = { + gender_female_chance = temujin_soldier_female_chance + employer = scope:temujin + template = new_warrior_character + faith = scope:temujin.faith + culture = scope:temujin.culture + } + create_character = { + gender_female_chance = temujin_soldier_female_chance + employer = scope:temujin + template = new_warrior_character + faith = scope:temujin.faith + culture = scope:temujin.culture + } + create_character = { + gender_female_chance = temujin_soldier_female_chance + employer = scope:temujin + template = new_warrior_character + faith = scope:temujin.faith + culture = scope:temujin.culture + } + create_character = { + gender_female_chance = temujin_soldier_female_chance + employer = scope:temujin + template = new_warrior_character + faith = scope:temujin.faith + culture = scope:temujin.culture + } + create_character = { + gender_female_chance = temujin_soldier_female_chance + employer = scope:temujin + template = new_warrior_character + faith = scope:temujin.faith + culture = scope:temujin.culture + } + create_character = { + gender_female_chance = temujin_soldier_female_chance + employer = scope:temujin + template = new_warrior_character + faith = scope:temujin.faith + culture = scope:temujin.culture + } + + # Spawn some captured Han siege engineers + create_character = { + gender_female_chance = temujin_soldier_female_chance + employer = scope:temujin + template = new_siege_engineer + faith = faith:shangqing + culture = culture:han + } + create_character = { + gender_female_chance = temujin_soldier_female_chance + employer = scope:temujin + template = new_siege_engineer + faith = faith:shangqing + culture = culture:han + } + create_character = { + gender_female_chance = temujin_soldier_female_chance + employer = scope:temujin + template = new_siege_engineer + faith = faith:shangqing + culture = culture:han + } + create_character = { + gender_female_chance = temujin_soldier_female_chance + employer = scope:temujin + template = new_siege_engineer + faith = faith:shangqing + culture = culture:han + } +} + +### Populating the life of Temujin... +spawn_dynamic_mongol_court_effect = { + add_character_flag = is_temujin + + if = { + limit = { + scope:temujin = { + is_female = no + } + } + save_scope_as = great_khan_family_father + } + else = { + save_scope_as = great_khan_family_mother + } + if = { + limit = { + exists = scope:great_khan_family_father + } + create_character = { + template = dynamic_genghis_spouse_template + gender = female + employer = scope:temujin + save_scope_as = genghis_spouse + } + scope:genghis_spouse = { + save_scope_as = great_khan_family_mother + } + } + else = { + create_character = { + template = dynamic_genghis_spouse_template + gender = male + employer = scope:temujin + save_scope_as = genghis_spouse + } + scope:genghis_spouse = { + save_scope_as = great_khan_family_father + } + } + scope:genghis_spouse = { + marry = scope:temujin + # Make temporarily immune to disease + add_character_flag = { + flag = immune_to_disease + years = 10 + } + } + create_character = { + template = dynamic_genghis_child_template + employer = scope:temujin + father = scope:great_khan_family_father + mother = scope:great_khan_family_mother + dynasty = inherit + save_scope_as = genghis_child_1 + } + scope:genghis_child_1 = { + # Make temporarily immune to disease + add_character_flag = { + flag = immune_to_disease + years = 10 + } + } + create_character = { + template = dynamic_genghis_child_template + employer = scope:temujin + father = scope:great_khan_family_father + mother = scope:great_khan_family_mother + dynasty = inherit + save_scope_as = genghis_child_2 + } + scope:genghis_child_2 = { + # Make temporarily immune to disease + add_character_flag = { + flag = immune_to_disease + years = 10 + } + } + create_character = { + template = dynamic_genghis_child_template + employer = scope:temujin + father = scope:great_khan_family_father + mother = scope:great_khan_family_mother + dynasty = inherit + save_scope_as = genghis_child_3 + } + scope:genghis_child_3 = { + # Make temporarily immune to disease + add_character_flag = { + flag = immune_to_disease + years = 10 + } + } + create_character = { + template = dynamic_genghis_child_template + employer = scope:temujin + father = scope:great_khan_family_father + mother = scope:great_khan_family_mother + dynasty = inherit + save_scope_as = genghis_child_4 + } + scope:genghis_child_4 = { + # Make temporarily immune to disease + add_character_flag = { + flag = immune_to_disease + years = 10 + } + } + create_character = { + template = dynamic_genghis_child_template + employer = scope:temujin + father = scope:great_khan_family_father + mother = scope:great_khan_family_mother + dynasty = inherit + save_scope_as = genghis_child_5 + } + scope:genghis_child_5 = { + # Make temporarily immune to disease + add_character_flag = { + flag = immune_to_disease + years = 10 + } + } + + recruit_three_nomadic_capital_characters_effect = { + NOMAD_TEMPLATE_CHARACTER = nomadic_commander_template + } + + # Spawn some generic Bagathurs + create_character = { + gender_female_chance = temujin_soldier_female_chance + employer = scope:temujin + template = new_warrior_character + faith = scope:temujin.faith + culture = scope:temujin.culture + } + create_character = { + gender_female_chance = temujin_soldier_female_chance + employer = scope:temujin + template = new_warrior_character + faith = scope:temujin.faith + culture = scope:temujin.culture + } + create_character = { + gender_female_chance = temujin_soldier_female_chance + employer = scope:temujin + template = new_warrior_character + faith = scope:temujin.faith + culture = scope:temujin.culture + } + create_character = { + gender_female_chance = temujin_soldier_female_chance + employer = scope:temujin + template = new_warrior_character + faith = scope:temujin.faith + culture = scope:temujin.culture + } + create_character = { + gender_female_chance = temujin_soldier_female_chance + employer = scope:temujin + template = new_warrior_character + faith = scope:temujin.faith + culture = scope:temujin.culture + } + create_character = { + gender_female_chance = temujin_soldier_female_chance + employer = scope:temujin + template = new_warrior_character + faith = scope:temujin.faith + culture = scope:temujin.culture + } + create_character = { + gender_female_chance = temujin_soldier_female_chance + employer = scope:temujin + template = new_warrior_character + faith = scope:temujin.faith + culture = scope:temujin.culture + } + create_character = { + gender_female_chance = temujin_soldier_female_chance + employer = scope:temujin + template = new_warrior_character + faith = scope:temujin.faith + culture = scope:temujin.culture + } + + # Spawn some captured Han siege engineers + create_character = { + gender_female_chance = temujin_soldier_female_chance + employer = scope:temujin + template = new_siege_engineer + faith = faith:shangqing + culture = culture:han + } + create_character = { + gender_female_chance = temujin_soldier_female_chance + employer = scope:temujin + template = new_siege_engineer + faith = faith:shangqing + culture = culture:han + } + create_character = { + gender_female_chance = temujin_soldier_female_chance + employer = scope:temujin + template = new_siege_engineer + faith = faith:shangqing + culture = culture:han + } + create_character = { + gender_female_chance = temujin_soldier_female_chance + employer = scope:temujin + template = new_siege_engineer + faith = faith:shangqing + culture = culture:han + } +} + +### Start war of conquest for the Mongolian heartland +start_wars_for_mongolia_effect = { + save_temporary_scope_as = mongol_conqueror + # Build a list of potential targets + every_neighboring_top_liege_realm_owner = { + limit = { + any_sub_realm_county = { + is_landless_type_title = no + title_province = { geographical_region = special_mongol_empire_start_region } + } + is_landed = yes + } + if = { + limit = { NOT = { is_in_list = top_liege_targets } } + add_to_temporary_list = top_liege_targets + } + } + every_in_list = { + list = top_liege_targets + if = { + limit = { + government_has_flag = government_is_herder + } + create_title_and_vassal_change = { + type = swear_fealty + save_scope_as = change + add_claim_on_loss = no + } + change_liege = { + liege = scope:mongol_conqueror + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + else = { + save_temporary_scope_as = new_war_target + capital_county.empire = { save_temporary_scope_as = war_target_title } + # Declare the war + scope:mongol_conqueror = { + start_war = { + cb = mongol_realm_invasion_war + target = scope:new_war_target.top_liege + target_title = scope:war_target_title + } + } + } + } +} + +# Send subjugation demand effect +send_mongol_subjugation_demand_effect = { + if = { + limit = { + NOT = { is_allied_to = scope:mongol_emperor } + } + trigger_event = { + id = mongol_invasion.2001 + days = { 3 12 } + } + + save_temporary_scope_as = subjugation_offer_recipient + scope:mongol_emperor = { + add_to_variable_list = { + name = subjugation_offer_under_consideration + target = scope:subjugation_offer_recipient + } + } + } + else = { + if = { + limit = { + highest_held_title_tier >= tier_empire + } + trigger_event = { + id = mongol_invasion.2111 + days = { 3 12 } + } + } + else = { + trigger_event = { + id = mongol_invasion.2101 + days = { 3 12 } + } + } + } +} + + +### Mongol war target evaluation and declaration +mongol_war_target_evaluation_and_declaration_effect = { + # Set the Mongol Emperor as reference point + save_scope_as = mongol_emperor + add_character_flag = { + flag = free_mongol_cb + days = 14 + } + # Select a new target + random_neighboring_top_liege_realm_owner = { + limit = { + NOT = { is_allied_to = scope:mongol_emperor } + this != scope:mongol_emperor + top_liege != scope:mongol_emperor + save_temporary_scope_as = truce_check + NOT = { + scope:mongol_emperor = { + any_truce_target = { + this = scope:truce_check + } + } + } + trigger_if = { # We don't want the Byzantine empire to get annihilated immediately + limit = { + OR = { + has_primary_title = title:e_byzantium + has_primary_title = title:e_latin_empire + } + } + OR = { + current_year >= 1279 # Roughly when the mongols should fracture historically + scope:mongol_emperor = { + completely_controls_region = special_mongol_empire_golden_horde_region # Controls all of Russia and the Steppe + } + any_realm_county = { # Byzantium is expansionist + count >= 50 + title_province = { + OR = { + geographical_region = special_mongol_empire_conquest_region_prio_5 + geographical_region = special_mongol_empire_conquest_region_prio_4 + geographical_region = special_mongol_empire_conquest_region_prio_3 + geographical_region = special_mongol_empire_conquest_region_prio_2 + geographical_region = special_mongol_empire_conquest_region_prio_1 + geographical_region = special_mongol_empire_conquest_region_prio_1_alpha + } + } + } + } + } + } + weight = { + base = 0 + modifier = { + add = mongol_invasion_target_character_weight + always = yes + } + } + save_temporary_scope_as = next_invasion_target + primary_title = { + save_temporary_scope_as = next_invasion_title_target + } + } + if = { + limit = { + exists = scope:next_invasion_target + } + if = { + limit = { # Declare war on every same-tier count or duke in same empire + scope:next_invasion_target = { + OR = { + highest_held_title_tier = tier_county + highest_held_title_tier = tier_duchy + } + } + } + scope:next_invasion_title_target = { + add_to_temporary_list = all_titles_to_declare_on + empire = { + every_in_de_jure_hierarchy = { # Find all other same-tier titles in same de jure empire + continue = { + tier > tier_county + # Stop searching if you hit the Mongol Emperor's territory at any point + trigger_if = { + limit = { exists = holder } + holder != scope:mongol_emperor + holder.top_liege != scope:mongol_emperor + } + } + limit = { + exists = this + OR = { + tier = tier_county + tier = tier_duchy + } + holder ?= { + top_liege = this + this != scope:mongol_emperor + top_liege != scope:mongol_emperor + NOT = { is_at_war_with = scope:mongol_emperor } + NOT = { is_allied_to = scope:mongol_emperor } + save_temporary_scope_as = truce_check + NOT = { + scope:mongol_emperor = { + any_truce_target = { + this = scope:truce_check + } + } + } + } + } + add_to_temporary_list = all_titles_to_declare_on + } + } + } + every_in_list = { + list = all_titles_to_declare_on + limit = { + holder = { + # An extra check to make sure we haven't snuck any Mongol territory in + this != scope:mongol_emperor + top_liege != scope:mongol_emperor + + # Standard conditions + NOT = { is_at_war_with = scope:mongol_emperor } + NOT = { + is_in_list = has_been_sent_subjugation_offer + } + save_temporary_scope_as = truce_check + } + NOT = { + scope:mongol_emperor = { + any_truce_target = { + this = scope:truce_check + } + } + } + } + + holder = { + add_to_temporary_list = has_been_sent_subjugation_offer + send_mongol_subjugation_demand_effect = yes + } + } + } + else_if = { + limit = { + scope:next_invasion_target = { + highest_held_title_tier < tier_empire + } + } + scope:next_invasion_target = { + send_mongol_subjugation_demand_effect = yes + } + } + else = { # Emperors are not offered ways out + start_war = { + cb = mongol_realm_invasion_war + target = scope:next_invasion_target + target_title = scope:next_invasion_title_target.empire + } + } + } +} + +mongols_devastate_county_effect = { + change_development_level = { + subtract = scope:county.development_level + multiply = 0.5 + floor = yes + } + random = { + chance = 25 + random_county_province = { + limit = { + has_holding = yes + num_buildings >= 2 + } + destroy_random_building_variable_effect = yes + destroy_random_building_effect = yes + } + } + # Silk Road + scope:county = { + tgp_silk_road_mongol_devastation_effect = yes + } +} + + +### MONGOL EMPIRE BREAKUP EFFECTS ### + +### Title creation effects +assign_core_mongol_titles_to_heir_effect = { + save_temporary_scope_as = candidate + + if = { # Check whether everything is grantable + limit = { + NOT = { exists = global_var:handed_out_mongolia_in_mongol_succession } + NOT = { exists = title:e_mongolia.holder } + } + + # If the character doesn't hold any titles in the relevant + if = { + limit = { + NOT = { + any_held_title = { + title_tier = county + is_landless_type_title = no + title_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + } + } + } + scope:old_mongol_emperor = { + random_sub_realm_county = { + limit = { + is_landless_type_title = no + title_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + } + save_scope_as = county_to_transfer + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + scope:county_to_transfer = { + change_title_holder = { + holder = scope:candidate + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + } + + # Create and grant title + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + title:e_mongolia = { + change_title_holder = { + holder = scope:candidate + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + # Move de jure back from Mongol Empire to Mongolia + title:e_mongol_empire = { + every_in_de_jure_hierarchy = { + limit = { + tier = tier_kingdom + } + set_de_jure_liege_title = title:e_mongolia + } + } + # Used to check whether e_mongol_empire can be safely destroyed + set_global_variable = { + name = handed_out_mongolia_in_mongol_succession + value = yes + } + } + save_scope_as = mongolia_ruler + add_to_list = candidate_granted_title + + every_character_war = { + end_war = white_peace + } + if = { + limit = { + has_title = title:e_mongolia.title_capital_county + } + set_realm_capital = title:e_mongolia.title_capital_county + } + #The primary heir of the Mongol emperor will likely be inheriting big special armies if MPO is active + if = { + limit = { + has_mpo_dlc_trigger = no + NOT = { + is_primary_heir_of = scope:old_mongol_emperor + } + } + spawn_mongol_successor_state_troops_effect = yes + } + if = { + limit = { + government_has_flag = government_is_nomadic + } + domicile = { + change_herd = 5000 + } + } + add_gold = 1000 + add_dread = 100 + create_story = story_conqueror + if = { + limit = { + government_has_flag = government_is_nomadic + } + if = { + limit = { has_realm_law = nomadic_authority_1 } + remove_realm_law = nomadic_authority_1 + } + if = { + limit = { has_realm_law = nomadic_authority_2 } + remove_realm_law = nomadic_authority_2 + } + if = { + limit = { has_realm_law = nomadic_authority_3 } + remove_realm_law = nomadic_authority_3 + } + if = { + limit = { has_realm_law = nomadic_authority_5 } + remove_realm_law = nomadic_authority_5 + } + add_realm_law = nomadic_authority_4 + if = { + limit = { + exists = domicile + domicile = { + free_external_domicile_building_slots >= 1 + NOT = { + has_domicile_building_or_higher = mass_warfare_yurt_01 + } + } + } + domicile = { + add_domicile_building = mass_warfare_yurt_01 + add_domicile_building = mass_warfare_yurt_02 + add_domicile_building = mass_warfare_yurt_03 + } + } + if = { + limit = { + NOT = { + any_held_title = { + is_nomad_title = yes + } + } + } + save_scope_as = holder + create_nomad_title = { + name = nomad_title_name + holder = scope:holder + government = nomad_government + save_scope_as = new_nomad_title + } + } + } +} + +grant_mongol_successor_nomadic_bonuses_effect = { + if = { + limit = { + government_has_flag = government_is_nomadic + } + #They might not have a nomadic camp title, create if needed + if = { + limit = { + NOT = { + any_held_title = { + is_nomad_title = yes + } + } + } + save_scope_as = holder + create_nomad_title = { + name = nomad_title_name + holder = scope:holder + government = nomad_government + save_scope_as = new_nomad_title + } + } + if = { + limit = { + government_has_flag = government_is_nomadic + } + if = { + limit = { has_realm_law = nomadic_authority_1 } + remove_realm_law = nomadic_authority_1 + } + if = { + limit = { has_realm_law = nomadic_authority_2 } + remove_realm_law = nomadic_authority_2 + } + if = { + limit = { has_realm_law = nomadic_authority_3 } + remove_realm_law = nomadic_authority_3 + } + if = { + limit = { has_realm_law = nomadic_authority_5 } + remove_realm_law = nomadic_authority_5 + } + add_realm_law = nomadic_authority_4 + if = { + limit = { + exists = domicile + domicile = { + free_external_domicile_building_slots >= 1 + NOT = { + has_domicile_building_or_higher = mass_warfare_yurt_01 + } + } + } + domicile = { + add_domicile_building = mass_warfare_yurt_01 + add_domicile_building = mass_warfare_yurt_02 + add_domicile_building = mass_warfare_yurt_03 + } + } + domicile = { + change_herd = { + value = monumental_herd_value + multiply = 1.5 + } + } + } + } +} + +grant_ilkhanate_effect = { + # If the character doesn't hold any titles in the relevant + if = { + limit = { + NOT = { + any_held_title = { + title_tier = county + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + } + } + } + scope:old_mongol_emperor = { + random_sub_realm_county = { + limit = { + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + } + save_scope_as = county_to_transfer + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + scope:county_to_transfer = { + change_title_holder = { + holder = scope:candidate + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + } + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:e_ilkhanate = { + change_title_holder = { + holder = scope:candidate + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + + scope:candidate = { + save_scope_as = ilkhanate_ruler + } + set_global_variable = { + name = ilkhanate_handed_out + value = yes + } + + # Give the character the appropriate capital area, if possible + if = { + limit = { + scope:old_mongol_emperor = { + any_sub_realm_county = { + duchy = title:e_ilkhanate.title_capital_county.duchy + NOR = { + holder = scope:candidate + holder = { # Don't steal the player's lands + is_ai = no + } + holder = { + any_liege_or_above = { is_ai = no } + } + } + } + } + } + scope:old_mongol_emperor = { + every_sub_realm_county = { + limit = { + duchy = title:e_ilkhanate.title_capital_county.duchy + NOR = { + holder = scope:candidate + holder = { # Don't steal the player's lands + is_ai = no + } + holder = { + any_liege_or_above = { is_ai = no } + } + } + } + add_to_list = titles_taken + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + every_in_list = { + list = titles_taken + change_title_holder = { + holder = scope:candidate + change = scope:title_change + take_baronies = yes + } + } + resolve_title_and_vassal_change = scope:title_change + } + + every_character_war = { + end_war = white_peace + } + if = { + limit = { + has_title = title:e_ilkhanate.title_capital_county + } + set_realm_capital = title:e_ilkhanate.title_capital_county + } + else_if = { + limit = { + NOT = { + capital_county.title_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + } + any_held_title = { + title_tier = county + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + } + } + random_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + } + scope:candidate = { + set_realm_capital = prev + } + } + } + spawn_mongol_successor_state_troops_effect = yes + add_gold = 1000 + add_dread = 100 + create_story = story_conqueror + grant_mongol_successor_nomadic_bonuses_effect = yes +} + +grant_golden_horde_effect = { + debug_log = "Golden Horde about to be created" + debug_log_scopes = no + + # If the character doesn't hold any titles in the relevant + if = { + limit = { + NOT = { + any_held_title = { + title_tier = county + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + } + } + } + scope:old_mongol_emperor = { + random_sub_realm_county = { + limit = { + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + } + save_scope_as = county_to_transfer + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + scope:county_to_transfer = { + change_title_holder = { + holder = scope:candidate + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + } + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:e_golden_horde = { + change_title_holder = { + holder = scope:candidate + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + + scope:candidate = { + save_scope_as = golden_horde_ruler + } + + set_global_variable = { + name = golden_horde_handed_out + value = yes + } + + # Give the character the appropriate capital area, if possible + if = { + limit = { + scope:old_mongol_emperor = { + any_sub_realm_county = { + duchy = title:e_golden_horde.title_capital_county.duchy + NOR = { + holder = scope:candidate + holder = { # Don't steal the player's lands + is_ai = no + } + holder = { + any_liege_or_above = { is_ai = no } + } + } + } + } + } + scope:old_mongol_emperor = { + every_sub_realm_county = { + limit = { + duchy = title:e_golden_horde.title_capital_county.duchy + NOR = { + holder = scope:candidate + holder = { # Don't steal the player's lands + is_ai = no + } + holder = { + any_liege_or_above = { is_ai = no } + } + } + } + add_to_list = titles_taken + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + every_in_list = { + list = titles_taken + change_title_holder = { + holder = scope:candidate + change = scope:title_change + take_baronies = yes + } + } + resolve_title_and_vassal_change = scope:title_change + } + every_character_war = { + end_war = white_peace + } + if = { + limit = { + has_title = title:e_golden_horde.title_capital_county + } + set_realm_capital = title:e_golden_horde.title_capital_county + } + else_if = { + limit = { + NOT = { + capital_county.title_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + } + any_held_title = { + title_tier = county + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + } + } + random_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + } + scope:candidate = { + set_realm_capital = prev + } + } + } + spawn_mongol_successor_state_troops_effect = yes + add_gold = 1000 + add_dread = 100 + create_story = story_conqueror + grant_mongol_successor_nomadic_bonuses_effect = yes +} + +grant_chagatai_effect = { + + # If the character doesn't hold any titles in the relevant + if = { + limit = { + NOT = { + any_held_title = { + title_tier = county + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_chagatai_region + } + } + } + } + scope:old_mongol_emperor = { + random_sub_realm_county = { + limit = { + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_chagatai_region + } + } + save_scope_as = county_to_transfer + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + scope:county_to_transfer = { + change_title_holder = { + holder = scope:candidate + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + } + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:e_chagatai = { + change_title_holder = { + holder = scope:candidate + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + + scope:candidate = { + save_scope_as = chagatai_ruler + } + + set_global_variable = { + name = chagatai_handed_out + value = yes + } + + # Give the character the appropriate capital area, if possible + if = { + limit = { + scope:old_mongol_emperor = { + any_sub_realm_county = { + duchy = title:e_chagatai.title_capital_county.duchy + NOR = { + holder = scope:candidate + holder = { # Don't steal the player's lands + is_ai = no + } + holder = { + any_liege_or_above = { is_ai = no } + } + } + } + } + } + scope:old_mongol_emperor = { + every_sub_realm_county = { + limit = { + duchy = title:e_chagatai.title_capital_county.duchy + NOR = { + holder = scope:candidate + holder = { # Don't steal the player's lands + is_ai = no + } + holder = { + any_liege_or_above = { is_ai = no } + } + } + } + add_to_list = titles_taken + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + every_in_list = { + list = titles_taken + change_title_holder = { + holder = scope:candidate + change = scope:title_change + take_baronies = yes + } + } + resolve_title_and_vassal_change = scope:title_change + } + every_character_war = { + end_war = white_peace + } + if = { + limit = { + has_title = title:e_chagatai.title_capital_county + } + set_realm_capital = title:e_chagatai.title_capital_county + } + else_if = { + limit = { + NOT = { + capital_county.title_province = { + geographical_region = special_mongol_empire_chagatai_region + } + } + any_held_title = { + title_tier = county + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_chagatai_region + } + } + } + random_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_chagatai_region + } + } + scope:candidate = { + set_realm_capital = prev + } + } + } + spawn_mongol_successor_state_troops_effect = yes + add_gold = 1000 + add_dread = 100 + create_story = story_conqueror + grant_mongol_successor_nomadic_bonuses_effect = yes +} + +grant_red_horde_effect = { + + # If the character doesn't hold any titles in the relevant + if = { + limit = { + NOT = { + any_held_title = { + title_tier = county + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_red_horde_region + } + } + } + } + scope:old_mongol_emperor = { + random_sub_realm_county = { + limit = { + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_red_horde_region + } + } + save_scope_as = county_to_transfer + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + scope:county_to_transfer = { + change_title_holder = { + holder = scope:candidate + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + } + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:e_red_horde = { + change_title_holder = { + holder = scope:candidate + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + + scope:candidate = { + save_scope_as = red_horde_ruler + } + + set_global_variable = { + name = red_horde_handed_out + value = yes + } + + # Give the character the appropriate capital area, if possible + if = { + limit = { + scope:old_mongol_emperor = { + any_sub_realm_county = { + duchy = title:e_red_horde.title_capital_county.duchy + NOR = { + holder = scope:candidate + holder = { # Don't steal the player's lands + is_ai = no + } + holder = { + any_liege_or_above = { is_ai = no } + } + } + } + } + } + scope:old_mongol_emperor = { + every_sub_realm_county = { + limit = { + duchy = title:e_red_horde.title_capital_county.duchy + NOR = { + holder = scope:candidate + holder = { # Don't steal the player's lands + is_ai = no + } + holder = { + any_liege_or_above = { is_ai = no } + } + } + } + add_to_list = titles_taken + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + every_in_list = { + list = titles_taken + change_title_holder = { + holder = scope:candidate + change = scope:title_change + take_baronies = yes + } + } + resolve_title_and_vassal_change = scope:title_change + } + every_character_war = { + end_war = white_peace + } + if = { + limit = { + has_title = title:e_red_horde.title_capital_county + } + set_realm_capital = title:e_red_horde.title_capital_county + } + else_if = { + limit = { + NOT = { + capital_county.title_province = { + geographical_region = special_mongol_empire_red_horde_region + } + } + any_held_title = { + title_tier = county + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_red_horde_region + } + } + } + random_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_red_horde_region + } + } + scope:candidate = { + set_realm_capital = prev + } + } + } + spawn_mongol_successor_state_troops_effect = yes + add_gold = 1000 + add_dread = 100 + create_story = story_conqueror + grant_mongol_successor_nomadic_bonuses_effect = yes +} + +grant_white_horde_effect = { + # If the character doesn't hold any titles in the relevant + if = { + limit = { + NOT = { + any_held_title = { + title_tier = county + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_white_horde_region + } + } + } + } + scope:old_mongol_emperor = { + random_sub_realm_county = { + limit = { + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_white_horde_region + } + } + save_scope_as = county_to_transfer + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + scope:county_to_transfer = { + change_title_holder = { + holder = scope:candidate + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + } + + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:e_white_horde = { + change_title_holder = { + holder = scope:candidate + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + + scope:candidate = { + save_scope_as = white_horde_ruler + } + + set_global_variable = { + name = white_horde_handed_out + value = yes + } + + # Give the character the appropriate capital area, if possible + if = { + limit = { + scope:old_mongol_emperor = { + any_sub_realm_county = { + duchy = title:e_white_horde.title_capital_county.duchy + NOR = { + holder = scope:candidate + holder = { # Don't steal the player's lands + is_ai = no + } + holder = { + any_liege_or_above = { is_ai = no } + } + } + } + } + } + scope:old_mongol_emperor = { + every_sub_realm_county = { + limit = { + duchy = title:e_white_horde.title_capital_county.duchy + NOR = { + holder = scope:candidate + holder = { # Don't steal the player's lands + is_ai = no + } + holder = { + any_liege_or_above = { is_ai = no } + } + } + } + add_to_list = titles_taken + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + every_in_list = { + list = titles_taken + change_title_holder = { + holder = scope:candidate + change = scope:title_change + take_baronies = yes + } + } + resolve_title_and_vassal_change = scope:title_change + } + every_character_war = { + end_war = white_peace + } + if = { + limit = { + has_title = title:e_white_horde.title_capital_county + } + set_realm_capital = title:e_white_horde.title_capital_county + } + else_if = { + limit = { + NOT = { + capital_county.title_province = { + geographical_region = special_mongol_empire_white_horde_region + } + } + any_held_title = { + title_tier = county + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_white_horde_region + } + } + } + random_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_white_horde_region + } + } + scope:candidate = { + set_realm_capital = prev + } + } + } + spawn_mongol_successor_state_troops_effect = yes + add_gold = 1000 + add_dread = 100 + create_story = story_conqueror + grant_mongol_successor_nomadic_bonuses_effect = yes +} + +grant_aarlud_khanate_effect = { + + # If the character doesn't hold any titles in the relevant + if = { + limit = { + NOT = { + any_held_title = { + title_tier = county + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + } + } + } + scope:old_mongol_emperor = { + random_sub_realm_county = { + limit = { + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + } + save_scope_as = county_to_transfer + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + scope:county_to_transfer = { + change_title_holder = { + holder = scope:candidate + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + } + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:e_aarlud_khanate = { + change_title_holder = { + holder = scope:candidate + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + + scope:candidate = { + save_scope_as = aarlud_khanate_ruler + } + + set_global_variable = { + name = aarlud_khanate_handed_out + value = yes + } + + # Give the character the appropriate capital area, if possible + if = { + limit = { + scope:old_mongol_emperor = { + any_sub_realm_county = { + duchy = title:e_aarlud_khanate.title_capital_county.duchy + NOR = { + holder = scope:candidate + holder = { # Don't steal the player's lands + is_ai = no + } + holder = { + any_liege_or_above = { is_ai = no } + } + } + } + } + } + scope:old_mongol_emperor = { + every_sub_realm_county = { + limit = { + duchy = title:e_aarlud_khanate.title_capital_county.duchy + NOR = { + holder = scope:candidate + holder = { # Don't steal the player's lands + is_ai = no + } + holder = { + any_liege_or_above = { is_ai = no } + } + } + } + add_to_list = titles_taken + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + every_in_list = { + list = titles_taken + change_title_holder = { + holder = scope:candidate + change = scope:title_change + take_baronies = yes + } + } + resolve_title_and_vassal_change = scope:title_change + } + every_character_war = { + end_war = white_peace + } + if = { + limit = { + has_title = title:e_aarlud_khanate.title_capital_county + } + set_realm_capital = title:e_aarlud_khanate.title_capital_county + } + else_if = { + limit = { + NOT = { + capital_county.title_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + } + any_held_title = { + title_tier = county + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + } + } + random_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + } + scope:candidate = { + set_realm_capital = prev + } + } + } + spawn_mongol_successor_state_troops_effect = yes + add_gold = 1000 + add_dread = 100 + create_story = story_conqueror + grant_mongol_successor_nomadic_bonuses_effect = yes +} + +grant_togskol_khanate_effect = { + + # If the character doesn't hold any titles in the relevant + if = { + limit = { + NOT = { + any_held_title = { + title_tier = county + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + } + } + } + scope:old_mongol_emperor = { + random_sub_realm_county = { + limit = { + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + } + save_scope_as = county_to_transfer + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + scope:county_to_transfer = { + change_title_holder = { + holder = scope:candidate + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + } + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:e_togskol_khanate = { + change_title_holder = { + holder = scope:candidate + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + + scope:candidate = { + save_scope_as = togskol_khanate_ruler + } + + set_global_variable = { + name = togskol_khanate_handed_out + value = yes + } + + # Give the character the appropriate capital area, if possible + if = { + limit = { + scope:old_mongol_emperor = { + any_sub_realm_county = { + duchy = title:e_togskol_khanate.title_capital_county.duchy + NOR = { + holder = scope:candidate + holder = { # Don't steal the player's lands + is_ai = no + } + holder = { + any_liege_or_above = { is_ai = no } + } + } + } + } + } + scope:old_mongol_emperor = { + every_sub_realm_county = { + limit = { + duchy = title:e_togskol_khanate.title_capital_county.duchy + NOR = { + holder = scope:candidate + holder = { # Don't steal the player's lands + is_ai = no + } + holder = { + any_liege_or_above = { is_ai = no } + } + } + } + add_to_list = titles_taken + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + every_in_list = { + list = titles_taken + change_title_holder = { + holder = scope:candidate + change = scope:title_change + take_baronies = yes + } + } + resolve_title_and_vassal_change = scope:title_change + } + every_character_war = { + end_war = white_peace + } + if = { + limit = { + has_title = title:e_togskol_khanate.title_capital_county + } + set_realm_capital = title:e_togskol_khanate.title_capital_county + } + else_if = { + limit = { + NOT = { + capital_county.title_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + } + any_held_title = { + title_tier = county + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + } + } + random_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + } + scope:candidate = { + set_realm_capital = prev + } + } + } + spawn_mongol_successor_state_troops_effect = yes + add_gold = 1000 + add_dread = 100 + create_story = story_conqueror + grant_mongol_successor_nomadic_bonuses_effect = yes +} + +grant_baruun_khanate_effect = { + + # If the character doesn't hold any titles in the relevant + if = { + limit = { + NOT = { + any_held_title = { + title_tier = county + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + } + } + } + scope:old_mongol_emperor = { + random_sub_realm_county = { + limit = { + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + } + save_scope_as = county_to_transfer + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + scope:county_to_transfer = { + change_title_holder = { + holder = scope:candidate + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + } + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:e_baruun_khanate = { + change_title_holder = { + holder = scope:candidate + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + + scope:candidate = { + save_scope_as = baruun_khanate_ruler + } + + set_global_variable = { + name = baruun_khanate_handed_out + value = yes + } + + # Give the character the appropriate capital area, if possible + if = { + limit = { + scope:old_mongol_emperor = { + any_sub_realm_county = { + duchy = title:e_baruun_khanate.title_capital_county.duchy + NOR = { + holder = scope:candidate + holder = { # Don't steal the player's lands + is_ai = no + } + holder = { + any_liege_or_above = { is_ai = no } + } + } + } + } + } + scope:old_mongol_emperor = { + every_sub_realm_county = { + limit = { + duchy = title:e_baruun_khanate.title_capital_county.duchy + NOR = { + holder = scope:candidate + holder = { # Don't steal the player's lands + is_ai = no + } + holder = { + any_liege_or_above = { is_ai = no } + } + } + } + add_to_list = titles_taken + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + every_in_list = { + list = titles_taken + change_title_holder = { + holder = scope:candidate + change = scope:title_change + take_baronies = yes + } + } + resolve_title_and_vassal_change = scope:title_change + } + every_character_war = { + end_war = white_peace + } + if = { + limit = { + has_title = title:e_baruun_khanate.title_capital_county + } + set_realm_capital = title:e_baruun_khanate.title_capital_county + } + else_if = { + limit = { + NOT = { + capital_county.title_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + } + any_held_title = { + title_tier = county + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + } + } + random_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + } + scope:candidate = { + set_realm_capital = prev + } + } + } + spawn_mongol_successor_state_troops_effect = yes + add_gold = 1000 + add_dread = 100 + create_story = story_conqueror + grant_mongol_successor_nomadic_bonuses_effect = yes +} + +grant_great_yuan_effect = { + + # If the character doesn't hold any titles in the relevant + if = { + limit = { + NOT = { + any_held_title = { + title_tier = county + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + } + } + } + #Prefer biggest available chinese empire + if = { + limit = { + scope:old_mongol_emperor = { + any_sub_realm_empire = { + any_this_title_or_de_jure_above = { + this = title:h_china + } + } + } + } + scope:old_mongol_emperor = { + #Prioritize Chinese empire they have the most titles in + ordered_sub_realm_empire = { + order_by = { + every_de_jure_county = { + limit = { + is_landless_type_title = no + holder.top_liege ?= scope:old_mongol_emperor + title_province ?= { + geographical_region = special_mongol_empire_great_yuan_region + } + } + add = 1 + } + } + limit = { + any_this_title_or_de_jure_above = { + this = title:h_china + } + } + random_de_jure_county = { + limit = { + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + } + } + save_scope_as = county_to_transfer + } + } + } + #Or just any county in Great Yuan region + else = { + scope:old_mongol_emperor = { + random_sub_realm_county = { + limit = { + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + } + save_scope_as = county_to_transfer + } + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + scope:county_to_transfer = { + change_title_holder = { + holder = scope:candidate + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + } + + #First - give Hegemony of China if it's empty and Mongols have enough China! + if = { + limit = { + has_tgp_dlc_trigger = yes + NOT = { + exists = title:h_china.holder + } + title:h_china ?= { + any_de_jure_county = { + percent >= claim_mandate_china_county_percentage_value + holder.top_liege = { + OR = { + this = scope:old_mongol_emperor + is_tributary_of_suzerain_or_above = scope:old_mongol_emperor + } + } + } + } + } + title:h_china = { + save_scope_as = great_yuan_title + } + } + #Give appropriate Chinese empire so that they aren't disturbed by a weird Yuan being created + else_if = { + limit = { + scope:old_mongol_emperor = { + any_realm_de_jure_empire = { + any_this_title_or_de_jure_above = { + this = title:h_china + } + OR = { + NOT = { + exists = holder + } + holder = scope:old_mongol_emperor + } + } + } + } + scope:old_mongol_emperor = { + ordered_realm_de_jure_empire = { + order_by = { + every_de_jure_county = { + limit = { + holder.top_liege ?= scope:old_mongol_emperor + title_province ?= { + geographical_region = special_mongol_empire_great_yuan_region + } + } + add = 1 + } + } + limit = { + any_this_title_or_de_jure_above = { + this = title:h_china + } + OR = { + NOT = { + exists = holder + } + holder = scope:old_mongol_emperor + } + } + save_scope_as = great_yuan_title + } + } + } + #Give any Empire in Great Yuan region, I guess that will do + else_if = { + limit = { + scope:old_mongol_emperor = { + any_realm_de_jure_empire = { + any_de_jure_county = { + title_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + } + OR = { + NOT = { + exists = holder + } + holder = scope:old_mongol_emperor + } + } + } + } + scope:old_mongol_emperor = { + ordered_realm_de_jure_empire = { + order_by = { + every_de_jure_county = { + limit = { + holder.top_liege ?= scope:old_mongol_emperor + title_province ?= { + geographical_region = special_mongol_empire_great_yuan_region + } + } + add = 1 + } + } + limit = { + any_de_jure_county = { + title_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + } + OR = { + NOT = { + exists = holder + } + holder = scope:old_mongol_emperor + } + } + save_scope_as = great_yuan_title + } + } + } + #Give Great Yuan title + else = { + title:e_great_yuan = { + save_scope_as = great_yuan_title + } + } + + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + scope:great_yuan_title = { + change_title_holder = { + holder = scope:candidate + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + + #Put great yuan under h_china if it was just made + if = { + limit = { + scope:great_yuan_title = title:e_great_yuan + } + title:e_great_yuan = { + set_de_jure_liege_title = title:h_china + } + } + + scope:candidate = { + save_scope_as = great_yuan_ruler + } + + set_global_variable = { + name = great_yuan_handed_out + value = yes + } + + #If Hegemony or Great Yuan created, give appropriate capital for great yuan + if = { + limit = { + scope:great_yuan_title = { + OR = { + this = title:h_china + this = title:e_great_yuan + } + } + scope:old_mongol_emperor = { + any_sub_realm_county = { + duchy = title:e_great_yuan.title_capital_county.duchy + NOR = { + holder = scope:candidate + holder = { # Don't steal the player's lands + is_ai = no + } + holder = { + any_liege_or_above = { is_ai = no } + } + } + } + } + } + scope:old_mongol_emperor = { + every_sub_realm_county = { + limit = { + duchy = title:e_great_yuan.title_capital_county.duchy + NOR = { + holder = scope:candidate + holder = { # Don't steal the player's lands + is_ai = no + } + holder = { + any_liege_or_above = { is_ai = no } + } + } + } + add_to_list = titles_taken + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + every_in_list = { + list = titles_taken + change_title_holder = { + holder = scope:candidate + change = scope:title_change + take_baronies = yes + } + } + resolve_title_and_vassal_change = scope:title_change + } + # Give the character the appropriate dynamic capital area, if possible + else_if = { + limit = { + scope:old_mongol_emperor = { + any_sub_realm_county = { + duchy = scope:great_yuan_title.title_capital_county.duchy + NOR = { + holder = scope:candidate + holder = { # Don't steal the player's lands + is_ai = no + } + holder = { + any_liege_or_above = { is_ai = no } + } + } + } + } + } + scope:old_mongol_emperor = { + every_sub_realm_county = { + limit = { + duchy = scope:great_yuan_title.title_capital_county.duchy + NOR = { + holder = scope:candidate + holder = { # Don't steal the player's lands + is_ai = no + } + holder = { + any_liege_or_above = { is_ai = no } + } + } + } + add_to_list = titles_taken + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + every_in_list = { + list = titles_taken + change_title_holder = { + holder = scope:candidate + change = scope:title_change + take_baronies = yes + } + } + resolve_title_and_vassal_change = scope:title_change + } + every_character_war = { + end_war = white_peace + } + #If has Hegemony or Great Yuan, set Yuan capital as capital + if = { + limit = { + scope:great_yuan_title = { + OR = { + this = title:h_china + this = title:e_great_yuan + } + } + has_title = title:e_great_yuan.title_capital_county + } + set_realm_capital = title:e_great_yuan.title_capital_county + } + else_if = { + limit = { + has_title = scope:great_yuan_title.title_capital_county + } + set_realm_capital = scope:great_yuan_title.title_capital_county + } + else_if = { + limit = { + NOT = { + capital_county.title_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + } + any_held_title = { + title_tier = county + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + } + } + random_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + } + scope:candidate = { + set_realm_capital = prev + } + } + } + spawn_mongol_successor_state_troops_effect = yes + add_gold = 1000 + add_dread = 100 + + #The Yuan Emperor should get the story that drives him to become Celestial Hegemon, if he isn't already and it's chaos phase + if = { + limit = { + scope:great_yuan_title = { + NOT = { + this = title:h_china + } + } + any_character_situation = { + situation_type = dynastic_cycle + situation_current_phase = situation_dynastic_cycle_phase_chaos + } + } + create_story = story_take_mandate_of_heaven + if = { + limit = { + has_treasury = yes + } + add_treasury = 2000 + } + else = { + add_gold = 2000 + } + } + else = { + create_story = story_conqueror + } +} + +grant_blue_horde_effect = { + + # If the character doesn't hold any titles in the relevant + if = { + limit = { + NOT = { + any_held_title = { + title_tier = county + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + } + } + } + scope:old_mongol_emperor = { + random_sub_realm_county = { + limit = { + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + } + save_scope_as = county_to_transfer + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + scope:county_to_transfer = { + change_title_holder = { + holder = scope:candidate + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + } + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:e_blue_horde = { + change_title_holder = { + holder = scope:candidate + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + + scope:candidate = { + save_scope_as = blue_horde_ruler + } + + set_global_variable = { + name = blue_horde_handed_out + value = yes + } + + # Give the character the appropriate capital area, if possible + if = { + limit = { + scope:old_mongol_emperor = { + any_sub_realm_county = { + duchy = title:e_blue_horde.title_capital_county.duchy + NOR = { + holder = scope:candidate + holder = { # Don't steal the player's lands + is_ai = no + } + holder = { + any_liege_or_above = { is_ai = no } + } + } + } + } + } + scope:old_mongol_emperor = { + every_sub_realm_county = { + limit = { + duchy = title:e_blue_horde.title_capital_county.duchy + NOR = { + holder = scope:candidate + holder = { # Don't steal the player's lands + is_ai = no + } + holder = { + any_liege_or_above = { is_ai = no } + } + } + } + add_to_list = titles_taken + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + every_in_list = { + list = titles_taken + change_title_holder = { + holder = scope:candidate + change = scope:title_change + take_baronies = yes + } + } + resolve_title_and_vassal_change = scope:title_change + } + every_character_war = { + end_war = white_peace + } + if = { + limit = { + has_title = title:e_blue_horde.title_capital_county + } + set_realm_capital = title:e_blue_horde.title_capital_county + } + else_if = { + limit = { + NOT = { + capital_county.title_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + } + any_held_title = { + title_tier = county + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + } + } + random_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + } + scope:candidate = { + set_realm_capital = prev + } + } + } + spawn_mongol_successor_state_troops_effect = yes + add_gold = 1000 + add_dread = 100 + create_story = story_conqueror + grant_mongol_successor_nomadic_bonuses_effect = yes +} + +grant_omnod_dalai_khanate_effect = { + + # If the character doesn't hold any titles in the relevant + if = { + limit = { + NOT = { + any_held_title = { + title_tier = county + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + } + } + scope:old_mongol_emperor = { + random_sub_realm_county = { + limit = { + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + save_scope_as = county_to_transfer + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + scope:county_to_transfer = { + change_title_holder = { + holder = scope:candidate + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + } + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:e_omnod_dalai_khanate = { + change_title_holder = { + holder = scope:candidate + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + + scope:candidate = { + save_scope_as = omnod_dalai_khanate_ruler + } + + set_global_variable = { + name = omnod_dalai_khanate_handed_out + value = yes + } + + # Give the character the appropriate capital area, if possible + if = { + limit = { + scope:old_mongol_emperor = { + any_sub_realm_county = { + duchy = title:e_omnod_dalai_khanate.title_capital_county.duchy + NOR = { + holder = scope:candidate + holder = { # Don't steal the player's lands + is_ai = no + } + holder = { + any_liege_or_above = { is_ai = no } + } + } + } + } + } + scope:old_mongol_emperor = { + every_sub_realm_county = { + limit = { + duchy = title:e_omnod_dalai_khanate.title_capital_county.duchy + NOR = { + holder = scope:candidate + holder = { # Don't steal the player's lands + is_ai = no + } + holder = { + any_liege_or_above = { is_ai = no } + } + } + } + add_to_list = titles_taken + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = no + } + every_in_list = { + list = titles_taken + change_title_holder = { + holder = scope:candidate + change = scope:title_change + take_baronies = yes + } + } + resolve_title_and_vassal_change = scope:title_change + } + every_character_war = { + end_war = white_peace + } + if = { + limit = { + has_title = title:e_omnod_dalai_khanate.title_capital_county + } + set_realm_capital = title:e_omnod_dalai_khanate.title_capital_county + } + else_if = { + limit = { + NOT = { + capital_county.title_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + any_held_title = { + title_tier = county + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + } + random_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + title_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + scope:candidate = { + set_realm_capital = prev + } + } + } + spawn_mongol_successor_state_troops_effect = yes + add_gold = 1000 + add_dread = 100 + create_story = story_conqueror + grant_mongol_successor_nomadic_bonuses_effect = yes +} + +# Effect to clean up borders a little +pick_up_remaining_counties_effect = { + ### Ilkhanate + if = { + limit = { + NOT = { exists = global_var:ilkhanate_handed_out } + any_in_list = { + list = ilkhanate_counties + count > 0 + } + } + # Try giving them to Chagatai + if = { + limit = { + exists = global_var:chagatai_handed_out + } + every_in_list = { + list = ilkhanate_counties + add_to_list = chagatai_counties + } + } + # Try Red Horde + else_if = { + limit = { + exists = global_var:red_horde_handed_out + } + every_in_list = { + list = ilkhanate_counties + add_to_list = red_horde_counties + } + } + # Try Golden Horde + else_if = { + limit = { + exists = global_var:golden_horde_handed_out + } + every_in_list = { + list = ilkhanate_counties + add_to_list = golden_horde_counties + } + } + # Try Baruun + else_if = { + limit = { + exists = global_var:baruun_khanate_handed_out + } + every_in_list = { + list = ilkhanate_counties + add_to_list = baruun_khanate_counties + } + } + } + ### End Ilkhanate + + ### Golden Horde + if = { + limit = { + NOT = { exists = global_var:golden_horde_handed_out } + any_in_list = { + list = golden_horde_counties + count > 0 + } + } + # Try giving them to White Horde + if = { + limit = { + exists = global_var:white_horde_handed_out + } + every_in_list = { + list = golden_horde_counties + add_to_list = white_horde_counties + } + } + # Try Aarlud Khanate + else_if = { + limit = { + exists = global_var:aarlud_khanate_handed_out + } + every_in_list = { + list = golden_horde_counties + add_to_list = aarlud_khanate_counties + } + } + # Try Chagatai + else_if = { + limit = { + exists = global_var:chagatai_handed_out + } + every_in_list = { + list = golden_horde_counties + add_to_list = chagatai_counties + } + } + # Try Ilkhanate + else_if = { + limit = { + exists = global_var:ilkhanate_handed_out + } + every_in_list = { + list = golden_horde_counties + add_to_list = ilkhanate_counties + } + } + } + ### End Golden Horde + + ### Chagatai + if = { + limit = { + NOT = { exists = global_var:chagatai_handed_out } + any_in_list = { + list = chagatai_counties + count > 0 + } + } + # Try giving them to Golden Horde + if = { + limit = { + exists = global_var:golden_horde_handed_out + } + every_in_list = { + list = chagatai_counties + add_to_list = golden_horde_counties + } + } + # Try Ilkhanate + else_if = { + limit = { + exists = global_var:ilkhanate_handed_out + } + every_in_list = { + list = chagatai_counties + add_to_list = ilkhanate_counties + } + } + #Try Great Yuan + if = { + limit = { + exists = global_var:great_yuan_handed_out + } + every_in_list = { + list = chagatai_counties + add_to_list = great_yuan_counties + } + } + } + ### End Chagatai + + ### Great Yuan + if = { + limit = { + NOT = { exists = global_var:great_yuan_handed_out } + any_in_list = { + list = great_yuan_counties + count > 0 + } + } + # Try giving them to Chagatai + if = { + limit = { + exists = global_var:chagatai_handed_out + } + every_in_list = { + list = great_yuan_counties + add_to_list = chagatai_counties + } + } + # Try Red Horde + else_if = { + limit = { + exists = global_var:red_horde_handed_out + } + every_in_list = { + list = great_yuan_counties + add_to_list = red_horde_counties + } + } + # Try Blue Horde + else_if = { + limit = { + exists = global_var:blue_horde_handed_out + } + every_in_list = { + list = great_yuan_counties + add_to_list = blue_horde_counties + } + } + #Try Omnod Dalai Khanate + if = { + limit = { + exists = global_var:omnod_dalai_khanate_handed_out + } + every_in_list = { + list = great_yuan_counties + add_to_list = omnod_dalai_khanate_counties + } + } + # Try giving them to Golden Horde + if = { + limit = { + exists = global_var:golden_horde_handed_out + } + every_in_list = { + list = great_yuan_counties + add_to_list = golden_horde_counties + } + } + # Try giving them to Ilkhanate + if = { + limit = { + exists = global_var:ilkhanate_handed_out + } + every_in_list = { + list = great_yuan_counties + add_to_list = ilkhanate_counties + } + } + } + ### End Great Yuan + + ### Red Horde + if = { + limit = { + NOT = { exists = global_var:red_horde_handed_out } + any_in_list = { + list = red_horde_counties + count > 0 + } + } + # Try giving them to Ilkhanate + if = { + limit = { + exists = global_var:ilkhanate_handed_out + } + every_in_list = { + list = red_horde_counties + add_to_list = ilkhanate_counties + } + } + # Try Chagatai + else_if = { + limit = { + exists = global_var:chagatai_handed_out + } + every_in_list = { + list = red_horde_counties + add_to_list = chagatai_counties + } + } + #Try Great Yuan + if = { + limit = { + exists = global_var:great_yuan_handed_out + } + every_in_list = { + list = red_horde_counties + add_to_list = great_yuan_counties + } + } + #Try Omnod Dalai Khanate + if = { + limit = { + exists = global_var:omnod_dalai_khanate_handed_out + } + every_in_list = { + list = red_horde_counties + add_to_list = omnod_dalai_khanate_counties + } + } + # Try Baruun + else_if = { + limit = { + exists = global_var:baruun_khanate_handed_out + } + every_in_list = { + list = red_horde_counties + add_to_list = baruun_khanate_counties + } + } + } + ### End Red Horde + + ### White Horde + if = { + limit = { + NOT = { exists = global_var:white_horde_handed_out } + any_in_list = { + list = white_horde_counties + count > 0 + } + } + # Try giving them to Golden Horde + if = { + limit = { + exists = global_var:golden_horde_handed_out + } + every_in_list = { + list = white_horde_counties + add_to_list = golden_horde_counties + } + } + # Try Ilkhanate + else_if = { + limit = { + exists = global_var:ilkhanate_handed_out + } + every_in_list = { + list = white_horde_counties + add_to_list = ilkhanate_counties + } + } + # Try Aarlud Khanate + else_if = { + limit = { + exists = global_var:aarlud_khanate_handed_out + } + every_in_list = { + list = white_horde_counties + add_to_list = aarlud_khanate_counties + } + } + # Try Togskol + else_if = { + limit = { + exists = global_var:togskol_khanate_handed_out + } + every_in_list = { + list = white_horde_counties + add_to_list = togskol_khanate_counties + } + } + # Try Chagatai + else_if = { + limit = { + exists = global_var:chagatai_handed_out + } + every_in_list = { + list = white_horde_counties + add_to_list = chagatai_counties + } + } + } + ### End White Horde + + ### Blue Horde + if = { + limit = { + NOT = { exists = global_var:blue_horde_handed_out } + any_in_list = { + list = blue_horde_counties + count > 0 + } + } + #Try Great Yuan + if = { + limit = { + exists = global_var:great_yuan_handed_out + } + every_in_list = { + list = blue_horde_counties + add_to_list = great_yuan_counties + } + } + #Try Omnod Dalai Khanate + if = { + limit = { + exists = global_var:omnod_dalai_khanate_handed_out + } + every_in_list = { + list = blue_horde_counties + add_to_list = omnod_dalai_khanate_counties + } + } + # Try Chagatai + else_if = { + limit = { + exists = global_var:chagatai_handed_out + } + every_in_list = { + list = blue_horde_counties + add_to_list = chagatai_counties + } + } + # Try giving them to Golden Horde + if = { + limit = { + exists = global_var:golden_horde_handed_out + } + every_in_list = { + list = red_horde_counties + add_to_list = golden_horde_counties + } + } + } + ### End Blue Horde + + ### Omnod Dalai Khanate + if = { + limit = { + NOT = { exists = global_var:omnod_dalai_khanate_handed_out } + any_in_list = { + list = omnod_dalai_khanate_counties + count > 0 + } + } + #Try Great Yuan + if = { + limit = { + exists = global_var:great_yuan_handed_out + } + every_in_list = { + list = omnod_dalai_khanate_counties + add_to_list = great_yuan_counties + } + } + #Try Blue Horde + if = { + limit = { + exists = global_var:blue_horde_handed_out + } + every_in_list = { + list = omnod_dalai_khanate_counties + add_to_list = blue_horde_counties + } + } + #Try Red Horde + if = { + limit = { + exists = global_var:red_horde_handed_out + } + every_in_list = { + list = omnod_dalai_khanate_counties + add_to_list = red_horde_counties + } + } + # Try Ilkhanate + else_if = { + limit = { + exists = global_var:ilkhanate_handed_out + } + every_in_list = { + list = omnod_dalai_khanate_counties + add_to_list = ilkhanate_counties + } + } + # Try Chagatai + else_if = { + limit = { + exists = global_var:chagatai_handed_out + } + every_in_list = { + list = omnod_dalai_khanate_counties + add_to_list = chagatai_counties + } + } + } + ### End Omnod Dalai Khanate + + ### Aarlud Khanate + if = { + limit = { + NOT = { exists = global_var:aarlud_khanate_handed_out } + any_in_list = { + list = aarlud_khanate_counties + count > 0 + } + } + # Try giving them to White Horde + if = { + limit = { + exists = global_var:white_horde_handed_out + } + every_in_list = { + list = aarlud_khanate_counties + add_to_list = white_horde_counties + } + } + # Try Golden Horde + else_if = { + limit = { + exists = global_var:golden_horde_handed_out + } + every_in_list = { + list = aarlud_khanate_counties + add_to_list = golden_horde_counties + } + } + # Try Togskol + else_if = { + limit = { + exists = global_var:togskol_khanate_handed_out + } + every_in_list = { + list = aarlud_khanate_counties + add_to_list = togskol_khanate_counties + } + } + } + ### End Aarlud Khanate + + ### Togskol Khanate + if = { + limit = { + NOT = { exists = global_var:togskol_khanate_handed_out } + any_in_list = { + list = togskol_khanate_counties + count > 0 + } + } + # Try giving them to White Horde + if = { + limit = { + exists = global_var:white_horde_handed_out + } + every_in_list = { + list = togskol_khanate_counties + add_to_list = white_horde_counties + } + } + # Try Aarlud + else_if = { + limit = { + exists = global_var:aarlud_khanate_handed_out + } + every_in_list = { + list = togskol_khanate_counties + add_to_list = aarlud_khanate_counties + } + } + # Try Golden Horde + else_if = { + limit = { + exists = global_var:golden_horde_handed_out + } + every_in_list = { + list = togskol_khanate_counties + add_to_list = golden_horde_counties + } + } + # Try Baruun + else_if = { + limit = { + exists = global_var:baruun_khanate_handed_out + } + every_in_list = { + list = togskol_khanate_counties + add_to_list = baruun_khanate_counties + } + } + } + ### End Togskol Khanate + + ### Baruun Khanate + if = { + limit = { + NOT = { exists = global_var:baruun_khanate_handed_out } + any_in_list = { + list = baruun_khanate_counties + count > 0 + } + } + # Try giving them to Ilkhanate + if = { + limit = { + exists = global_var:ilkhanate_handed_out + } + every_in_list = { + list = baruun_khanate_counties + add_to_list = ilkhanate_counties + } + } + # Try Togskol + else_if = { + limit = { + exists = global_var:togskol_khanate_handed_out + } + every_in_list = { + list = baruun_khanate_counties + add_to_list = togskol_khanate_counties + } + } + # Try Red Horde + else_if = { + limit = { + exists = global_var:red_horde_handed_out + } + every_in_list = { + list = baruun_khanate_counties + add_to_list = red_horde_counties + } + } + #Try Omnod Dalai Khanate + if = { + limit = { + exists = global_var:omnod_dalai_khanate_handed_out + } + every_in_list = { + list = baruun_khanate_counties + add_to_list = omnod_dalai_khanate_counties + } + } + } + ### End Baruun Khanate +} + +# Set up all vassals and assign them flags for the "correct" Khanate +set_correct_mongol_breakup_vassalage_effect = { + scope:old_mongol_emperor = { + every_vassal = { + limit = { + NOT = { is_in_list = selected_mongol_heirs } + is_playable_character = yes + highest_held_title_tier >= tier_county + } + debug_log = "Trying to assign correct vassalage placement for:" + debug_log_scopes = no + + save_scope_as = vassal + + # Note: the variables for counting counties is set before checking whether the relevant title will be created, to prevent null-reference errors later + set_global_variable = { + name = ilkhanate_county_count + value = 0 + } + if = { # Count Ilkhanate Counties + limit = { + exists = global_var:ilkhanate_handed_out + } + every_sub_realm_county = { + limit = { + is_in_list = ilkhanate_counties + } + scope:vassal = { + change_global_variable = { + name = ilkhanate_county_count + add = 1 + } + } + } + } + set_global_variable = { + name = golden_horde_county_count + value = 0 + } + if = { # Count Golden Horde Counties + limit = { + exists = global_var:golden_horde_handed_out + } + every_sub_realm_county = { + limit = { + is_in_list = golden_horde_counties + } + scope:vassal = { + change_global_variable = { + name = golden_horde_county_count + add = 1 + } + } + } + } + set_global_variable = { + name = chagatai_county_count + value = 0 + } + if = { # Count Chagatai Counties + limit = { + exists = global_var:chagatai_handed_out + } + every_sub_realm_county = { + limit = { + is_in_list = chagatai_counties + } + scope:vassal = { + change_global_variable = { + name = chagatai_county_count + add = 1 + } + } + } + } + set_global_variable = { + name = great_yuan_county_count + value = 0 + } + if = { # Count Great Yuan Counties + limit = { + exists = global_var:great_yuan_handed_out + } + every_sub_realm_county = { + limit = { + is_in_list = great_yuan_counties + } + scope:vassal = { + change_global_variable = { + name = great_yuan_county_count + add = 1 + } + } + } + } + set_global_variable = { + name = red_horde_county_count + value = 0 + } + if = { # Count Red Horde counties + limit = { + exists = global_var:red_horde_handed_out + } + every_sub_realm_county = { + limit = { + is_in_list = red_horde_counties + } + scope:vassal = { + change_global_variable = { + name = red_horde_county_count + add = 1 + } + } + } + } + set_global_variable = { + name = white_horde_county_count + value = 0 + } + if = { # Count White Horde counties + limit = { + exists = global_var:white_horde_handed_out + } + every_sub_realm_county = { + limit = { + is_in_list = white_horde_counties + } + scope:vassal = { + change_global_variable = { + name = white_horde_county_count + add = 1 + } + } + } + } + set_global_variable = { + name = blue_horde_county_count + value = 0 + } + if = { # Count Blue Horde counties + limit = { + exists = global_var:blue_horde_handed_out + } + every_sub_realm_county = { + limit = { + is_in_list = blue_horde_counties + } + scope:vassal = { + change_global_variable = { + name = blue_horde_county_count + add = 1 + } + } + } + } + set_global_variable = { + name = omnod_dalai_khanate_county_count + value = 0 + } + if = { # Count Omnod Dalai Khanate counties + limit = { + exists = global_var:omnod_dalai_khanate_handed_out + } + every_sub_realm_county = { + limit = { + is_in_list = omnod_dalai_khanate_counties + } + scope:vassal = { + change_global_variable = { + name = omnod_dalai_khanate_county_count + add = 1 + } + } + } + } + set_global_variable = { + name = aarlud_khanate_county_count + value = 0 + } + if = { # Count Aarlud Khanate counties + limit = { + exists = global_var:aarlud_khanate_handed_out + } + every_sub_realm_county = { + limit = { + is_in_list = aarlud_khanate_counties + } + scope:vassal = { + change_global_variable = { + name = aarlud_khanate_county_count + add = 1 + } + } + } + } + set_global_variable = { + name = togskol_khanate_county_count + value = 0 + } + if = { # Count Tögsköl Khanate counties + limit = { + exists = global_var:togskol_khanate_handed_out + } + every_sub_realm_county = { + limit = { + is_in_list = togskol_khanate_counties + } + scope:vassal = { + change_global_variable = { + name = togskol_khanate_county_count + add = 1 + } + } + } + } + set_global_variable = { + name = baruun_khanate_county_count + value = 0 + } + if = { # Count Baruun Khanate counties + limit = { + exists = global_var:baruun_khanate_handed_out + } + every_sub_realm_county = { + limit = { + is_in_list = baruun_khanate_counties + } + scope:vassal = { + change_global_variable = { + name = baruun_khanate_county_count + add = 1 + } + } + } + } + # Find any counties not in any lists + set_global_variable = { + name = leftover_mongol_county_count + value = 0 + } + every_sub_realm_county = { + limit = { + trigger_if = { + limit = { exists = global_var:ilkhanate_handed_out } + NOT = { is_in_list = ilkhanate_counties } + } + trigger_if = { + limit = { exists = global_var:golden_horde_handed_out } + NOT = { is_in_list = golden_horde_counties } + } + trigger_if = { + limit = { exists = global_var:chagatai_handed_out } + NOT = { is_in_list = chagatai_counties } + } + trigger_if = { + limit = { exists = global_var:great_yuan_handed_out } + NOT = { is_in_list = great_yuan_counties } + } + trigger_if = { + limit = { exists = global_var:red_horde_handed_out } + NOT = { is_in_list = red_horde_counties } + } + trigger_if = { + limit = { exists = global_var:white_horde_handed_out } + NOT = { is_in_list = white_horde_counties } + } + trigger_if = { + limit = { exists = global_var:aarlud_khanate_handed_out } + NOT = { is_in_list = aarlud_khanate_counties } + } + trigger_if = { + limit = { exists = global_var:togskol_khanate_handed_out } + NOT = { is_in_list = togskol_khanate_counties } + } + trigger_if = { + limit = { exists = global_var:baruun_khanate_handed_out } + NOT = { is_in_list = baruun_khanate_counties } + } + trigger_if = { + limit = { exists = global_var:blue_horde_handed_out } + NOT = { is_in_list = blue_horde_counties } + } + trigger_if = { + limit = { exists = global_var:omnod_dalai_khanate_handed_out } + NOT = { is_in_list = omnod_dalai_khanate_counties } + } + } + scope:vassal = { + change_global_variable = { + name = leftover_mongol_county_count + add = 1 + } + } + } + + ### Mark vassals for the correct liege empire + if = { + limit = { + global_var:leftover_mongol_county_count >= global_var:ilkhanate_county_count + global_var:leftover_mongol_county_count >= global_var:golden_horde_county_count + global_var:leftover_mongol_county_count >= global_var:chagatai_county_count + global_var:leftover_mongol_county_count >= global_var:red_horde_county_count + global_var:leftover_mongol_county_count >= global_var:white_horde_county_count + global_var:leftover_mongol_county_count >= global_var:aarlud_khanate_county_count + global_var:leftover_mongol_county_count >= global_var:togskol_khanate_county_count + global_var:leftover_mongol_county_count >= global_var:baruun_khanate_county_count + global_var:leftover_mongol_county_count >= global_var:great_yuan_county_count + global_var:leftover_mongol_county_count >= global_var:blue_horde_county_count + global_var:leftover_mongol_county_count >= global_var:omnod_dalai_khanate_county_count + } + add_character_flag = should_be_vassalized_by_mongolia + } + else_if = { + limit = { + global_var:ilkhanate_county_count > global_var:leftover_mongol_county_count + global_var:ilkhanate_county_count > global_var:golden_horde_county_count + global_var:ilkhanate_county_count > global_var:chagatai_county_count + global_var:ilkhanate_county_count > global_var:red_horde_county_count + global_var:ilkhanate_county_count > global_var:white_horde_county_count + global_var:ilkhanate_county_count > global_var:aarlud_khanate_county_count + global_var:ilkhanate_county_count > global_var:togskol_khanate_county_count + global_var:ilkhanate_county_count > global_var:baruun_khanate_county_count + global_var:ilkhanate_county_count > global_var:great_yuan_county_count + global_var:ilkhanate_county_count > global_var:blue_horde_county_count + global_var:ilkhanate_county_count > global_var:omnod_dalai_khanate_county_count + } + add_character_flag = should_be_vassalized_by_ilkhanate + } + else_if = { + limit = { + global_var:golden_horde_county_count > global_var:leftover_mongol_county_count + global_var:golden_horde_county_count > global_var:ilkhanate_county_count + global_var:golden_horde_county_count > global_var:chagatai_county_count + global_var:golden_horde_county_count > global_var:red_horde_county_count + global_var:golden_horde_county_count > global_var:white_horde_county_count + global_var:golden_horde_county_count > global_var:aarlud_khanate_county_count + global_var:golden_horde_county_count > global_var:togskol_khanate_county_count + global_var:golden_horde_county_count > global_var:baruun_khanate_county_count + global_var:golden_horde_county_count > global_var:great_yuan_county_count + global_var:golden_horde_county_count > global_var:blue_horde_county_count + global_var:golden_horde_county_count > global_var:omnod_dalai_khanate_county_count + } + add_character_flag = should_be_vassalized_by_golden_horde + } + else_if = { + limit = { + global_var:chagatai_county_count > global_var:leftover_mongol_county_count + global_var:chagatai_county_count > global_var:ilkhanate_county_count + global_var:chagatai_county_count > global_var:golden_horde_county_count + global_var:chagatai_county_count > global_var:red_horde_county_count + global_var:chagatai_county_count > global_var:white_horde_county_count + global_var:chagatai_county_count > global_var:aarlud_khanate_county_count + global_var:chagatai_county_count > global_var:togskol_khanate_county_count + global_var:chagatai_county_count > global_var:baruun_khanate_county_count + global_var:chagatai_county_count > global_var:great_yuan_county_count + global_var:chagatai_county_count > global_var:blue_horde_county_count + global_var:chagatai_county_count > global_var:omnod_dalai_khanate_county_count + } + add_character_flag = should_be_vassalized_by_chagatai + } + else_if = { + limit = { + global_var:great_yuan_county_count > global_var:leftover_mongol_county_count + global_var:great_yuan_county_count > global_var:ilkhanate_county_count + global_var:great_yuan_county_count > global_var:chagatai_county_count + global_var:great_yuan_county_count > global_var:golden_horde_county_count + global_var:great_yuan_county_count > global_var:red_horde_county_count + global_var:great_yuan_county_count > global_var:white_horde_county_count + global_var:great_yuan_county_count > global_var:aarlud_khanate_county_count + global_var:great_yuan_county_count > global_var:togskol_khanate_county_count + global_var:great_yuan_county_count > global_var:baruun_khanate_county_count + global_var:great_yuan_county_count > global_var:blue_horde_county_count + global_var:great_yuan_county_count > global_var:omnod_dalai_khanate_county_count + } + add_character_flag = should_be_vassalized_by_great_yuan + } + else_if = { + limit = { + global_var:red_horde_county_count > global_var:leftover_mongol_county_count + global_var:red_horde_county_count > global_var:ilkhanate_county_count + global_var:red_horde_county_count > global_var:golden_horde_county_count + global_var:red_horde_county_count > global_var:chagatai_county_count + global_var:red_horde_county_count > global_var:white_horde_county_count + global_var:red_horde_county_count > global_var:aarlud_khanate_county_count + global_var:red_horde_county_count > global_var:togskol_khanate_county_count + global_var:red_horde_county_count > global_var:baruun_khanate_county_count + global_var:red_horde_county_count > global_var:great_yuan_county_count + global_var:red_horde_county_count > global_var:blue_horde_county_count + global_var:red_horde_county_count > global_var:omnod_dalai_khanate_county_count + } + add_character_flag = should_be_vassalized_by_red_horde + } + else_if = { + limit = { + global_var:white_horde_county_count > global_var:leftover_mongol_county_count + global_var:white_horde_county_count > global_var:ilkhanate_county_count + global_var:white_horde_county_count > global_var:golden_horde_county_count + global_var:white_horde_county_count > global_var:chagatai_county_count + global_var:white_horde_county_count > global_var:red_horde_county_count + global_var:white_horde_county_count > global_var:aarlud_khanate_county_count + global_var:white_horde_county_count > global_var:togskol_khanate_county_count + global_var:white_horde_county_count > global_var:baruun_khanate_county_count + global_var:white_horde_county_count > global_var:great_yuan_county_count + global_var:white_horde_county_count > global_var:blue_horde_county_count + global_var:white_horde_county_count > global_var:omnod_dalai_khanate_county_count + } + add_character_flag = should_be_vassalized_by_white_horde + } + else_if = { + limit = { + global_var:blue_horde_county_count > global_var:leftover_mongol_county_count + global_var:blue_horde_county_count > global_var:ilkhanate_county_count + global_var:blue_horde_county_count > global_var:golden_horde_county_count + global_var:blue_horde_county_count > global_var:chagatai_county_count + global_var:blue_horde_county_count > global_var:red_horde_county_count + global_var:blue_horde_county_count > global_var:white_horde_county_count + global_var:blue_horde_county_count > global_var:white_horde_county_count + global_var:blue_horde_county_count > global_var:togskol_khanate_county_count + global_var:blue_horde_county_count > global_var:baruun_khanate_county_count + global_var:blue_horde_county_count > global_var:great_yuan_county_count + global_var:blue_horde_county_count > global_var:omnod_dalai_khanate_county_count + } + add_character_flag = should_be_vassalized_by_blue_horde + } + else_if = { + limit = { + global_var:omnod_dalai_khanate_county_count > global_var:leftover_mongol_county_count + global_var:omnod_dalai_khanate_county_count > global_var:ilkhanate_county_count + global_var:omnod_dalai_khanate_county_count > global_var:golden_horde_county_count + global_var:omnod_dalai_khanate_county_count > global_var:chagatai_county_count + global_var:omnod_dalai_khanate_county_count > global_var:red_horde_county_count + global_var:omnod_dalai_khanate_county_count > global_var:white_horde_county_count + global_var:omnod_dalai_khanate_county_count > global_var:white_horde_county_count + global_var:omnod_dalai_khanate_county_count > global_var:togskol_khanate_county_count + global_var:omnod_dalai_khanate_county_count > global_var:baruun_khanate_county_count + global_var:omnod_dalai_khanate_county_count > global_var:great_yuan_county_count + global_var:omnod_dalai_khanate_county_count > global_var:blue_horde_county_count + } + add_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + else_if = { + limit = { + global_var:aarlud_khanate_county_count > global_var:leftover_mongol_county_count + global_var:aarlud_khanate_county_count > global_var:ilkhanate_county_count + global_var:aarlud_khanate_county_count > global_var:golden_horde_county_count + global_var:aarlud_khanate_county_count > global_var:chagatai_county_count + global_var:aarlud_khanate_county_count > global_var:red_horde_county_count + global_var:aarlud_khanate_county_count > global_var:white_horde_county_count + global_var:aarlud_khanate_county_count > global_var:togskol_khanate_county_count + global_var:aarlud_khanate_county_count > global_var:baruun_khanate_county_count + global_var:aarlud_khanate_county_count > global_var:great_yuan_county_count + global_var:aarlud_khanate_county_count > global_var:blue_horde_county_count + global_var:aarlud_khanate_county_count > global_var:omnod_dalai_khanate_county_count + } + add_character_flag = should_be_vassalized_by_aarlud_khanate + } + else_if = { + limit = { + global_var:aarlud_khanate_county_count > global_var:leftover_mongol_county_count + global_var:aarlud_khanate_county_count > global_var:ilkhanate_county_count + global_var:aarlud_khanate_county_count > global_var:golden_horde_county_count + global_var:aarlud_khanate_county_count > global_var:chagatai_county_count + global_var:aarlud_khanate_county_count > global_var:red_horde_county_count + global_var:aarlud_khanate_county_count > global_var:white_horde_county_count + global_var:aarlud_khanate_county_count > global_var:togskol_khanate_county_count + global_var:aarlud_khanate_county_count > global_var:baruun_khanate_county_count + global_var:aarlud_khanate_county_count > global_var:great_yuan_county_count + global_var:aarlud_khanate_county_count > global_var:blue_horde_county_count + global_var:aarlud_khanate_county_count > global_var:omnod_dalai_khanate_county_count + } + add_character_flag = should_be_vassalized_by_aarlud_khanate + } + else_if = { + limit = { + global_var:togskol_khanate_county_count > global_var:leftover_mongol_county_count + global_var:togskol_khanate_county_count > global_var:ilkhanate_county_count + global_var:togskol_khanate_county_count > global_var:golden_horde_county_count + global_var:togskol_khanate_county_count > global_var:chagatai_county_count + global_var:togskol_khanate_county_count > global_var:red_horde_county_count + global_var:togskol_khanate_county_count > global_var:white_horde_county_count + global_var:togskol_khanate_county_count > global_var:aarlud_khanate_county_count + global_var:togskol_khanate_county_count > global_var:baruun_khanate_county_count + global_var:togskol_khanate_county_count > global_var:great_yuan_county_count + global_var:togskol_khanate_county_count > global_var:blue_horde_county_count + global_var:togskol_khanate_county_count > global_var:omnod_dalai_khanate_county_count + } + add_character_flag = should_be_vassalized_by_togskol_khanate + } + else_if = { + limit = { + global_var:baruun_khanate_county_count > global_var:leftover_mongol_county_count + global_var:baruun_khanate_county_count > global_var:ilkhanate_county_count + global_var:baruun_khanate_county_count > global_var:golden_horde_county_count + global_var:baruun_khanate_county_count > global_var:chagatai_county_count + global_var:baruun_khanate_county_count > global_var:red_horde_county_count + global_var:baruun_khanate_county_count > global_var:white_horde_county_count + global_var:baruun_khanate_county_count > global_var:aarlud_khanate_county_count + global_var:baruun_khanate_county_count > global_var:togskol_khanate_county_count + global_var:baruun_khanate_county_count > global_var:great_yuan_county_count + global_var:baruun_khanate_county_count > global_var:blue_horde_county_count + global_var:baruun_khanate_county_count > global_var:omnod_dalai_khanate_county_count + } + add_character_flag = should_be_vassalized_by_baruun_khanate + } + else = { + add_character_flag = should_be_vassalized_by_mongolia + } + } + } +} + +# Forcibly shift counties around as appropriate +shift_counties_on_mongol_succession_effect = { + every_in_list = { + list = selected_mongol_heirs + every_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + } + if = { + limit = { + exists = global_var:ilkhanate_handed_out + is_in_list = ilkhanate_counties + NOT = { holder = { has_title = title:e_ilkhanate } } + } + add_to_list = ilkhanate_titles_for_transfer + # Also mark duchies for transfer if relevant + if = { + limit = { + exists = duchy.holder + holder = duchy.holder + } + duchy = { + add_to_list = ilkhanate_titles_for_transfer + } + } + } + if = { + limit = { + exists = global_var:golden_horde_handed_out + is_in_list = golden_horde_counties + NOT = { holder = { has_title = title:e_golden_horde } } + } + add_to_list = golden_horde_titles_for_transfer + # Also mark duchies for transfer if relevant + if = { + limit = { + exists = duchy.holder + holder = duchy.holder + } + duchy = { + add_to_list = golden_horde_titles_for_transfer + } + } + } + if = { + limit = { + exists = global_var:chagatai_handed_out + is_in_list = chagatai_counties + NOT = { holder = { has_title = title:e_chagatai } } + } + add_to_list = chagatai_titles_for_transfer + # Also mark duchies for transfer if relevant + if = { + limit = { + exists = duchy.holder + holder = duchy.holder + } + duchy = { + add_to_list = chagatai_titles_for_transfer + } + } + + } + if = { + limit = { + exists = global_var:great_yuan_handed_out + is_in_list = great_yuan_counties + NOT = { holder = { has_title = scope:great_yuan_title } } + } + add_to_list = great_yuan_titles_for_transfer + # Also mark duchies for transfer if relevant + if = { + limit = { + exists = duchy.holder + holder = duchy.holder + } + duchy = { + add_to_list = great_yuan_titles_for_transfer + } + } + + } + if = { + limit = { + exists = global_var:red_horde_handed_out + is_in_list = red_horde_counties + NOT = { holder = { has_title = title:e_red_horde } } + } + add_to_list = red_horde_titles_for_transfer + # Also mark duchies for transfer if relevant + if = { + limit = { + exists = duchy.holder + holder = duchy.holder + } + duchy = { + add_to_list = red_horde_titles_for_transfer + } + } + + } + if = { + limit = { + exists = global_var:white_horde_handed_out + is_in_list = white_horde_counties + NOT = { holder = { has_title = title:e_white_horde } } + } + add_to_list = white_horde_titles_for_transfer + # Also mark duchies for transfer if relevant + if = { + limit = { + exists = duchy.holder + holder = duchy.holder + } + duchy = { + add_to_list = white_horde_titles_for_transfer + } + } + + } + if = { + limit = { + exists = global_var:blue_horde_handed_out + is_in_list = blue_horde_counties + NOT = { holder = { has_title = title:e_blue_horde } } + } + add_to_list = blue_horde_titles_for_transfer + # Also mark duchies for transfer if relevant + if = { + limit = { + exists = duchy.holder + holder = duchy.holder + } + duchy = { + add_to_list = blue_horde_titles_for_transfer + } + } + + } + if = { + limit = { + exists = global_var:omnod_dalai_khanate_handed_out + is_in_list = omnod_dalai_khanate_counties + NOT = { holder = { has_title = title:e_omnod_dalai_khanate } } + } + add_to_list = omnod_dalai_khanate_titles_for_transfer + # Also mark duchies for transfer if relevant + if = { + limit = { + exists = duchy.holder + holder = duchy.holder + } + duchy = { + add_to_list = omnod_dalai_khanate_titles_for_transfer + } + } + + } + if = { + limit = { + exists = global_var:aarlud_khanate_handed_out + is_in_list = aarlud_khanate_counties + NOT = { holder = { has_title = title:e_aarlud_khanate } } + } + add_to_list = aarlud_khanate_titles_for_transfer + # Also mark duchies for transfer if relevant + if = { + limit = { + exists = duchy.holder + holder = duchy.holder + } + duchy = { + add_to_list = aarlud_khanate_titles_for_transfer + } + } + + } + if = { + limit = { + exists = global_var:togskol_khanate_handed_out + is_in_list = togskol_khanate_counties + NOT = { holder = { has_title = title:e_togskol_khanate } } + } + add_to_list = togskol_khanate_titles_for_transfer + # Also mark duchies for transfer if relevant + if = { + limit = { + exists = duchy.holder + holder = duchy.holder + } + duchy = { + add_to_list = togskol_khanate_titles_for_transfer + } + } + + } + if = { + limit = { + exists = global_var:baruun_khanate_handed_out + is_in_list = baruun_khanate_counties + NOT = { holder = { has_title = title:e_baruun_khanate } } + } + add_to_list = baruun_khanate_titles_for_transfer + # Also mark duchies for transfer if relevant + if = { + limit = { + exists = duchy.holder + holder = duchy.holder + } + duchy = { + add_to_list = baruun_khanate_titles_for_transfer + } + } + + } + } + } + scope:old_mongol_emperor = { + every_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + } + if = { + limit = { + exists = global_var:ilkhanate_handed_out + is_in_list = ilkhanate_counties + NOT = { holder = { has_title = title:e_ilkhanate } } + } + add_to_list = ilkhanate_titles_for_transfer + # Also mark duchies for transfer if relevant + if = { + limit = { + exists = duchy.holder + holder = duchy.holder + } + duchy = { + add_to_list = ilkhanate_titles_for_transfer + } + } + + } + if = { + limit = { + exists = global_var:golden_horde_handed_out + is_in_list = golden_horde_counties + NOT = { holder = { has_title = title:e_golden_horde } } + } + add_to_list = golden_horde_titles_for_transfer + # Also mark duchies for transfer if relevant + if = { + limit = { + exists = duchy.holder + holder = duchy.holder + } + duchy = { + add_to_list = golden_horde_titles_for_transfer + } + } + + } + if = { + limit = { + exists = global_var:chagatai_handed_out + is_in_list = chagatai_counties + NOT = { holder = { has_title = title:e_chagatai } } + } + add_to_list = chagatai_titles_for_transfer + # Also mark duchies for transfer if relevant + if = { + limit = { + exists = duchy.holder + holder = duchy.holder + } + duchy = { + add_to_list = chagatai_titles_for_transfer + } + } + + } + if = { + limit = { + exists = global_var:great_yuan_handed_out + is_in_list = great_yuan_counties + NOT = { holder = { has_title = scope:great_yuan_title } } + } + add_to_list = great_yuan_titles_for_transfer + # Also mark duchies for transfer if relevant + if = { + limit = { + exists = duchy.holder + holder = duchy.holder + } + duchy = { + add_to_list = great_yuan_titles_for_transfer + } + } + + } + if = { + limit = { + exists = global_var:red_horde_handed_out + is_in_list = red_horde_counties + NOT = { holder = { has_title = title:e_red_horde } } + } + add_to_list = red_horde_titles_for_transfer + # Also mark duchies for transfer if relevant + if = { + limit = { + exists = duchy.holder + holder = duchy.holder + } + duchy = { + add_to_list = red_horde_titles_for_transfer + } + } + + } + if = { + limit = { + exists = global_var:white_horde_handed_out + is_in_list = white_horde_counties + NOT = { holder = { has_title = title:e_white_horde } } + } + add_to_list = white_horde_titles_for_transfer + # Also mark duchies for transfer if relevant + if = { + limit = { + exists = duchy.holder + holder = duchy.holder + } + duchy = { + add_to_list = white_horde_titles_for_transfer + } + } + + } + if = { + limit = { + exists = global_var:blue_horde_handed_out + is_in_list = blue_horde_counties + NOT = { holder = { has_title = title:e_blue_horde } } + } + add_to_list = blue_horde_titles_for_transfer + # Also mark duchies for transfer if relevant + if = { + limit = { + exists = duchy.holder + holder = duchy.holder + } + duchy = { + add_to_list = blue_horde_titles_for_transfer + } + } + + } + if = { + limit = { + exists = global_var:omnod_dalai_khanate_handed_out + is_in_list = omnod_dalai_khanate_counties + NOT = { holder = { has_title = title:e_omnod_dalai_khanate } } + } + add_to_list = omnod_dalai_khanate_titles_for_transfer + # Also mark duchies for transfer if relevant + if = { + limit = { + exists = duchy.holder + holder = duchy.holder + } + duchy = { + add_to_list = omnod_dalai_khanate_titles_for_transfer + } + } + + } + if = { + limit = { + exists = global_var:aarlud_khanate_handed_out + is_in_list = aarlud_khanate_counties + NOT = { holder = { has_title = title:e_aarlud_khanate } } + } + add_to_list = aarlud_khanate_titles_for_transfer + # Also mark duchies for transfer if relevant + if = { + limit = { + exists = duchy.holder + holder = duchy.holder + } + duchy = { + add_to_list = aarlud_khanate_titles_for_transfer + } + } + + } + if = { + limit = { + exists = global_var:togskol_khanate_handed_out + is_in_list = togskol_khanate_counties + NOT = { holder = { has_title = title:e_togskol_khanate } } + } + add_to_list = togskol_khanate_titles_for_transfer + # Also mark duchies for transfer if relevant + if = { + limit = { + exists = duchy.holder + holder = duchy.holder + } + duchy = { + add_to_list = togskol_khanate_titles_for_transfer + } + } + + } + if = { + limit = { + exists = global_var:baruun_khanate_handed_out + is_in_list = baruun_khanate_counties + NOT = { holder = { has_title = title:e_baruun_khanate } } + } + add_to_list = baruun_khanate_titles_for_transfer + # Also mark duchies for transfer if relevant + if = { + limit = { + exists = duchy.holder + holder = duchy.holder + } + duchy = { + add_to_list = baruun_khanate_titles_for_transfer + } + } + + } + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = mongol_succession + add_claim_on_loss = no + } + + # Ilkhanate + if = { + limit = { + exists = scope:ilkhanate_ruler + } + every_in_list = { + list = ilkhanate_titles_for_transfer + change_title_holder = { + holder = scope:ilkhanate_ruler + change = scope:mongol_succession + } + } + scope:old_mongol_emperor = { + every_vassal_or_below = { + limit = { + has_character_flag = should_be_vassalized_by_ilkhanate + } + change_liege = { + liege = scope:ilkhanate_ruler + change = scope:mongol_succession + } + } + } + } + # Golden Horde + if = { + limit = { + exists = scope:golden_horde_ruler + } + every_in_list = { + list = golden_horde_titles_for_transfer + change_title_holder = { + holder = scope:golden_horde_ruler + change = scope:mongol_succession + } + } + scope:old_mongol_emperor = { + every_vassal_or_below = { + limit = { + has_character_flag = should_be_vassalized_by_golden_horde + } + change_liege = { + liege = scope:golden_horde_ruler + change = scope:mongol_succession + } + } + } + } + # Chagatai + if = { + limit = { + exists = scope:chagatai_ruler + } + every_in_list = { + list = chagatai_titles_for_transfer + change_title_holder = { + holder = scope:chagatai_ruler + change = scope:mongol_succession + } + } + scope:old_mongol_emperor = { + every_vassal_or_below = { + limit = { + has_character_flag = should_be_vassalized_by_chagatai + } + change_liege = { + liege = scope:chagatai_ruler + change = scope:mongol_succession + } + } + } + } + # Great Yuan + if = { + limit = { + exists = scope:great_yuan_ruler + } + every_in_list = { + list = great_yuan_titles_for_transfer + change_title_holder = { + holder = scope:great_yuan_ruler + change = scope:mongol_succession + } + } + scope:old_mongol_emperor = { + every_vassal_or_below = { + limit = { + has_character_flag = should_be_vassalized_by_great_yuan + } + change_liege = { + liege = scope:great_yuan_ruler + change = scope:mongol_succession + } + } + } + } + # Red Horde + if = { + limit = { + exists = scope:red_horde_ruler + } + every_in_list = { + list = red_horde_titles_for_transfer + change_title_holder = { + holder = scope:red_horde_ruler + change = scope:mongol_succession + } + } + scope:old_mongol_emperor = { + every_vassal_or_below = { + limit = { + has_character_flag = should_be_vassalized_by_red_horde + } + change_liege = { + liege = scope:red_horde_ruler + change = scope:mongol_succession + } + } + } + } + # White Horde + if = { + limit = { + exists = scope:white_horde_ruler + } + every_in_list = { + list = white_horde_titles_for_transfer + change_title_holder = { + holder = scope:white_horde_ruler + change = scope:mongol_succession + } + } + scope:old_mongol_emperor = { + every_vassal_or_below = { + limit = { + has_character_flag = should_be_vassalized_by_white_horde + } + change_liege = { + liege = scope:white_horde_ruler + change = scope:mongol_succession + } + } + } + } + # Blue Horde + if = { + limit = { + exists = scope:blue_horde_ruler + } + every_in_list = { + list = blue_horde_titles_for_transfer + change_title_holder = { + holder = scope:blue_horde_ruler + change = scope:mongol_succession + } + } + scope:old_mongol_emperor = { + every_vassal_or_below = { + limit = { + has_character_flag = should_be_vassalized_by_blue_horde + } + change_liege = { + liege = scope:blue_horde_ruler + change = scope:mongol_succession + } + } + } + } + # Omnod Dalai Khanate + if = { + limit = { + exists = scope:omnod_dalai_khanate_ruler + } + every_in_list = { + list = omnod_dalai_khanate_titles_for_transfer + change_title_holder = { + holder = scope:omnod_dalai_khanate_ruler + change = scope:mongol_succession + } + } + scope:old_mongol_emperor = { + every_vassal_or_below = { + limit = { + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + change_liege = { + liege = scope:omnod_dalai_khanate_ruler + change = scope:mongol_succession + } + } + } + } + # Aarlud Khanate + if = { + limit = { + exists = scope:aarlud_khanate_ruler + } + every_in_list = { + list = aarlud_khanate_titles_for_transfer + change_title_holder = { + holder = scope:aarlud_khanate_ruler + change = scope:mongol_succession + } + } + scope:old_mongol_emperor = { + every_vassal_or_below = { + limit = { + has_character_flag = should_be_vassalized_by_aarlud_khanate + } + change_liege = { + liege = scope:aarlud_khanate_ruler + change = scope:mongol_succession + } + } + } + } + # Togskol Khanate + if = { + limit = { + exists = scope:togskol_khanate_ruler + } + every_in_list = { + list = togskol_khanate_titles_for_transfer + change_title_holder = { + holder = scope:togskol_khanate_ruler + change = scope:mongol_succession + } + } + scope:old_mongol_emperor = { + every_vassal_or_below = { + limit = { + has_character_flag = should_be_vassalized_by_togskol_khanate + } + change_liege = { + liege = scope:togskol_khanate_ruler + change = scope:mongol_succession + } + } + } + } + # Baruun Khanate + if = { + limit = { + exists = scope:baruun_khanate_ruler + } + every_in_list = { + list = baruun_khanate_titles_for_transfer + change_title_holder = { + holder = scope:baruun_khanate_ruler + change = scope:mongol_succession + } + } + scope:old_mongol_emperor = { + every_vassal_or_below = { + limit = { + has_character_flag = should_be_vassalized_by_baruun_khanate + } + change_liege = { + liege = scope:baruun_khanate_ruler + change = scope:mongol_succession + } + } + } + } + # Mongolia + if = { + limit = { + exists = scope:mongolia_ruler + } + scope:old_mongol_emperor = { + every_vassal_or_below = { + limit = { + has_character_flag = should_be_vassalized_by_mongolia + } + change_liege = { + liege = scope:mongolia_ruler + change = scope:mongol_succession + } + } + } + } + + # Extra backup safety + # Ilkhanate + if = { + limit = { + exists = scope:ilkhanate_ruler + } + scope:old_mongol_emperor = { + every_vassal = { + limit = { + NOR = { + has_character_flag = should_be_vassalized_by_ilkhanate + has_character_flag = should_be_vassalized_by_golden_horde + has_character_flag = should_be_vassalized_by_chagatai + has_character_flag = should_be_vassalized_by_red_horde + has_character_flag = should_be_vassalized_by_white_horde + has_character_flag = should_be_vassalized_by_aarlud_khanate + has_character_flag = should_be_vassalized_by_togskol_khanate + has_character_flag = should_be_vassalized_by_baruun_khanate + has_character_flag = should_be_vassalized_by_mongolia + has_character_flag = should_be_vassalized_by_great_yuan + has_character_flag = should_be_vassalized_by_blue_horde + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + capital_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + } + change_liege = { + liege = scope:ilkhanate_ruler + change = scope:mongol_succession + } + } + } + } + # Golden Horde + if = { + limit = { + exists = scope:golden_horde_ruler + } + scope:old_mongol_emperor = { + every_vassal = { + limit = { + NOR = { + has_character_flag = should_be_vassalized_by_ilkhanate + has_character_flag = should_be_vassalized_by_golden_horde + has_character_flag = should_be_vassalized_by_chagatai + has_character_flag = should_be_vassalized_by_red_horde + has_character_flag = should_be_vassalized_by_white_horde + has_character_flag = should_be_vassalized_by_aarlud_khanate + has_character_flag = should_be_vassalized_by_togskol_khanate + has_character_flag = should_be_vassalized_by_baruun_khanate + has_character_flag = should_be_vassalized_by_mongolia + has_character_flag = should_be_vassalized_by_great_yuan + has_character_flag = should_be_vassalized_by_blue_horde + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + capital_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + } + change_liege = { + liege = scope:golden_horde_ruler + change = scope:mongol_succession + } + } + } + } + # Chagatai + if = { + limit = { + exists = scope:chagatai_ruler + } + scope:old_mongol_emperor = { + every_vassal = { + limit = { + NOR = { + has_character_flag = should_be_vassalized_by_ilkhanate + has_character_flag = should_be_vassalized_by_golden_horde + has_character_flag = should_be_vassalized_by_chagatai + has_character_flag = should_be_vassalized_by_red_horde + has_character_flag = should_be_vassalized_by_white_horde + has_character_flag = should_be_vassalized_by_aarlud_khanate + has_character_flag = should_be_vassalized_by_togskol_khanate + has_character_flag = should_be_vassalized_by_baruun_khanate + has_character_flag = should_be_vassalized_by_mongolia + has_character_flag = should_be_vassalized_by_great_yuan + has_character_flag = should_be_vassalized_by_blue_horde + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + capital_province = { + geographical_region = special_mongol_empire_chagatai_region + } + } + change_liege = { + liege = scope:chagatai_ruler + change = scope:mongol_succession + } + } + } + } + # Great Yuan + if = { + limit = { + exists = scope:great_yuan_ruler + } + scope:old_mongol_emperor = { + every_vassal = { + limit = { + NOR = { + has_character_flag = should_be_vassalized_by_ilkhanate + has_character_flag = should_be_vassalized_by_golden_horde + has_character_flag = should_be_vassalized_by_chagatai + has_character_flag = should_be_vassalized_by_red_horde + has_character_flag = should_be_vassalized_by_white_horde + has_character_flag = should_be_vassalized_by_aarlud_khanate + has_character_flag = should_be_vassalized_by_togskol_khanate + has_character_flag = should_be_vassalized_by_baruun_khanate + has_character_flag = should_be_vassalized_by_mongolia + has_character_flag = should_be_vassalized_by_great_yuan + has_character_flag = should_be_vassalized_by_blue_horde + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + capital_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + } + change_liege = { + liege = scope:great_yuan_ruler + change = scope:mongol_succession + } + } + } + } + # Red Horde + if = { + limit = { + exists = scope:red_horde_ruler + } + scope:old_mongol_emperor = { + every_vassal = { + limit = { + NOR = { + has_character_flag = should_be_vassalized_by_ilkhanate + has_character_flag = should_be_vassalized_by_golden_horde + has_character_flag = should_be_vassalized_by_chagatai + has_character_flag = should_be_vassalized_by_red_horde + has_character_flag = should_be_vassalized_by_white_horde + has_character_flag = should_be_vassalized_by_aarlud_khanate + has_character_flag = should_be_vassalized_by_togskol_khanate + has_character_flag = should_be_vassalized_by_baruun_khanate + has_character_flag = should_be_vassalized_by_mongolia + has_character_flag = should_be_vassalized_by_great_yuan + has_character_flag = should_be_vassalized_by_blue_horde + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + capital_province = { + geographical_region = special_mongol_empire_red_horde_region + } + } + change_liege = { + liege = scope:red_horde_ruler + change = scope:mongol_succession + } + } + } + } + # White Horde + if = { + limit = { + exists = scope:white_horde_ruler + } + scope:old_mongol_emperor = { + every_vassal = { + limit = { + NOR = { + has_character_flag = should_be_vassalized_by_ilkhanate + has_character_flag = should_be_vassalized_by_golden_horde + has_character_flag = should_be_vassalized_by_chagatai + has_character_flag = should_be_vassalized_by_red_horde + has_character_flag = should_be_vassalized_by_white_horde + has_character_flag = should_be_vassalized_by_aarlud_khanate + has_character_flag = should_be_vassalized_by_togskol_khanate + has_character_flag = should_be_vassalized_by_baruun_khanate + has_character_flag = should_be_vassalized_by_mongolia + has_character_flag = should_be_vassalized_by_great_yuan + has_character_flag = should_be_vassalized_by_blue_horde + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + capital_province = { + geographical_region = special_mongol_empire_white_horde_region + } + } + change_liege = { + liege = scope:white_horde_ruler + change = scope:mongol_succession + } + } + } + } + # Blue Horde + if = { + limit = { + exists = scope:blue_horde_ruler + } + scope:old_mongol_emperor = { + every_vassal = { + limit = { + NOR = { + has_character_flag = should_be_vassalized_by_ilkhanate + has_character_flag = should_be_vassalized_by_golden_horde + has_character_flag = should_be_vassalized_by_chagatai + has_character_flag = should_be_vassalized_by_red_horde + has_character_flag = should_be_vassalized_by_white_horde + has_character_flag = should_be_vassalized_by_aarlud_khanate + has_character_flag = should_be_vassalized_by_togskol_khanate + has_character_flag = should_be_vassalized_by_baruun_khanate + has_character_flag = should_be_vassalized_by_mongolia + has_character_flag = should_be_vassalized_by_great_yuan + has_character_flag = should_be_vassalized_by_blue_horde + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + capital_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + } + change_liege = { + liege = scope:blue_horde_ruler + change = scope:mongol_succession + } + } + } + } + # Omnod Dalai Khanate + if = { + limit = { + exists = scope:omnod_dalai_khanate_ruler + } + scope:old_mongol_emperor = { + every_vassal = { + limit = { + NOR = { + has_character_flag = should_be_vassalized_by_ilkhanate + has_character_flag = should_be_vassalized_by_golden_horde + has_character_flag = should_be_vassalized_by_chagatai + has_character_flag = should_be_vassalized_by_red_horde + has_character_flag = should_be_vassalized_by_white_horde + has_character_flag = should_be_vassalized_by_aarlud_khanate + has_character_flag = should_be_vassalized_by_togskol_khanate + has_character_flag = should_be_vassalized_by_baruun_khanate + has_character_flag = should_be_vassalized_by_mongolia + has_character_flag = should_be_vassalized_by_great_yuan + has_character_flag = should_be_vassalized_by_blue_horde + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + capital_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + change_liege = { + liege = scope:omnod_dalai_khanate_ruler + change = scope:mongol_succession + } + } + } + } + # Aarlud Khanate + if = { + limit = { + exists = scope:aarlud_khanate_ruler + } + scope:old_mongol_emperor = { + every_vassal = { + limit = { + NOR = { + has_character_flag = should_be_vassalized_by_ilkhanate + has_character_flag = should_be_vassalized_by_golden_horde + has_character_flag = should_be_vassalized_by_chagatai + has_character_flag = should_be_vassalized_by_red_horde + has_character_flag = should_be_vassalized_by_white_horde + has_character_flag = should_be_vassalized_by_aarlud_khanate + has_character_flag = should_be_vassalized_by_togskol_khanate + has_character_flag = should_be_vassalized_by_baruun_khanate + has_character_flag = should_be_vassalized_by_mongolia + has_character_flag = should_be_vassalized_by_great_yuan + has_character_flag = should_be_vassalized_by_blue_horde + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + capital_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + } + change_liege = { + liege = scope:aarlud_khanate_ruler + change = scope:mongol_succession + } + } + } + } + # Togskol Khanate + if = { + limit = { + exists = scope:togskol_khanate_ruler + } + scope:old_mongol_emperor = { + every_vassal = { + limit = { + NOR = { + has_character_flag = should_be_vassalized_by_ilkhanate + has_character_flag = should_be_vassalized_by_golden_horde + has_character_flag = should_be_vassalized_by_chagatai + has_character_flag = should_be_vassalized_by_red_horde + has_character_flag = should_be_vassalized_by_white_horde + has_character_flag = should_be_vassalized_by_aarlud_khanate + has_character_flag = should_be_vassalized_by_togskol_khanate + has_character_flag = should_be_vassalized_by_baruun_khanate + has_character_flag = should_be_vassalized_by_mongolia + has_character_flag = should_be_vassalized_by_great_yuan + has_character_flag = should_be_vassalized_by_blue_horde + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + capital_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + } + change_liege = { + liege = scope:togskol_khanate_ruler + change = scope:mongol_succession + } + } + } + } + # Baruun Khanate + if = { + limit = { + exists = scope:baruun_khanate_ruler + } + scope:old_mongol_emperor = { + every_vassal = { + limit = { + NOR = { + has_character_flag = should_be_vassalized_by_ilkhanate + has_character_flag = should_be_vassalized_by_golden_horde + has_character_flag = should_be_vassalized_by_chagatai + has_character_flag = should_be_vassalized_by_red_horde + has_character_flag = should_be_vassalized_by_white_horde + has_character_flag = should_be_vassalized_by_aarlud_khanate + has_character_flag = should_be_vassalized_by_togskol_khanate + has_character_flag = should_be_vassalized_by_baruun_khanate + has_character_flag = should_be_vassalized_by_mongolia + has_character_flag = should_be_vassalized_by_great_yuan + has_character_flag = should_be_vassalized_by_blue_horde + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + capital_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + } + change_liege = { + liege = scope:baruun_khanate_ruler + change = scope:mongol_succession + } + } + } + } + # Mongolia + if = { + limit = { + exists = scope:mongolia_ruler + } + scope:old_mongol_emperor = { + every_vassal = { + limit = { + NOR = { + has_character_flag = should_be_vassalized_by_ilkhanate + has_character_flag = should_be_vassalized_by_golden_horde + has_character_flag = should_be_vassalized_by_chagatai + has_character_flag = should_be_vassalized_by_red_horde + has_character_flag = should_be_vassalized_by_white_horde + has_character_flag = should_be_vassalized_by_aarlud_khanate + has_character_flag = should_be_vassalized_by_togskol_khanate + has_character_flag = should_be_vassalized_by_baruun_khanate + has_character_flag = should_be_vassalized_by_mongolia + has_character_flag = should_be_vassalized_by_great_yuan + has_character_flag = should_be_vassalized_by_blue_horde + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + capital_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + } + change_liege = { + liege = scope:mongolia_ruler + change = scope:mongol_succession + } + } + } + } + + resolve_title_and_vassal_change = scope:mongol_succession + + # Extra-extra cleanup + create_title_and_vassal_change = { + type = granted + save_scope_as = mongol_cleanup_succession + add_claim_on_loss = no + } + # Mongolia + if = { + limit = { + exists = scope:mongolia_ruler + } + scope:mongolia_ruler = { + every_vassal_or_below = { + limit = { + NOR = { + has_character_flag = should_be_vassalized_by_ilkhanate + has_character_flag = should_be_vassalized_by_golden_horde + has_character_flag = should_be_vassalized_by_chagatai + has_character_flag = should_be_vassalized_by_red_horde + has_character_flag = should_be_vassalized_by_white_horde + has_character_flag = should_be_vassalized_by_aarlud_khanate + has_character_flag = should_be_vassalized_by_togskol_khanate + has_character_flag = should_be_vassalized_by_baruun_khanate + has_character_flag = should_be_vassalized_by_mongolia + has_character_flag = should_be_vassalized_by_great_yuan + has_character_flag = should_be_vassalized_by_blue_horde + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + } + if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + exists = scope:ilkhanate_ruler + } + change_liege = { + liege = scope:ilkhanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + exists = scope:golden_horde_ruler + } + change_liege = { + liege = scope:golden_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_chagatai_region + } + exists = scope:chagatai_ruler + } + change_liege = { + liege = scope:chagatai_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + exists = scope:great_yuan_ruler + } + change_liege = { + liege = scope:great_yuan_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_red_horde_region + } + exists = scope:red_horde_ruler + } + change_liege = { + liege = scope:red_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_white_horde_region + } + exists = scope:white_horde_ruler + } + change_liege = { + liege = scope:white_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + exists = scope:blue_horde_ruler + } + change_liege = { + liege = scope:blue_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + exists = scope:omnod_dalai_khanate_ruler + } + change_liege = { + liege = scope:omnod_dalai_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + exists = scope:aarlud_khanate_ruler + } + change_liege = { + liege = scope:aarlud_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + exists = scope:togskol_khanate_ruler + } + change_liege = { + liege = scope:togskol_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + exists = scope:baruun_khanate_ruler + } + change_liege = { + liege = scope:baruun_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + } + every_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + exists = scope:ilkhanate_ruler + } + change_title_holder = { + holder = scope:ilkhanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + exists = scope:golden_horde_ruler + } + change_title_holder = { + holder = scope:golden_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_chagatai_region + } + exists = scope:chagatai_ruler + } + change_title_holder = { + holder = scope:chagatai_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + exists = scope:great_yuan_ruler + } + change_title_holder = { + holder = scope:great_yuan_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_red_horde_region + } + exists = scope:red_horde_ruler + } + change_title_holder = { + holder = scope:red_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_white_horde_region + } + exists = scope:white_horde_ruler + } + change_title_holder = { + holder = scope:white_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + exists = scope:blue_horde_ruler + } + change_title_holder = { + holder = scope:blue_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + exists = scope:omnod_dalai_khanate_ruler + } + change_title_holder = { + holder = scope:omnod_dalai_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + exists = scope:aarlud_khanate_ruler + } + change_title_holder = { + holder = scope:aarlud_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + exists = scope:togskol_khanate_ruler + } + change_title_holder = { + holder = scope:togskol_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + exists = scope:baruun_khanate_ruler + } + change_title_holder = { + holder = scope:baruun_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + } + } + } + # Ilkhanate + if = { + limit = { + exists = scope:ilkhanate_ruler + } + scope:ilkhanate_ruler = { + every_vassal_or_below = { + limit = { + NOR = { + has_character_flag = should_be_vassalized_by_ilkhanate + has_character_flag = should_be_vassalized_by_golden_horde + has_character_flag = should_be_vassalized_by_chagatai + has_character_flag = should_be_vassalized_by_red_horde + has_character_flag = should_be_vassalized_by_white_horde + has_character_flag = should_be_vassalized_by_aarlud_khanate + has_character_flag = should_be_vassalized_by_togskol_khanate + has_character_flag = should_be_vassalized_by_baruun_khanate + has_character_flag = should_be_vassalized_by_mongolia + has_character_flag = should_be_vassalized_by_great_yuan + has_character_flag = should_be_vassalized_by_blue_horde + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + } + if = { + limit = { + capital_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + exists = scope:mongolia_ruler + } + change_liege = { + liege = scope:mongolia_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + exists = scope:golden_horde_ruler + } + change_liege = { + liege = scope:golden_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_chagatai_region + } + exists = scope:chagatai_ruler + } + change_liege = { + liege = scope:chagatai_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + exists = scope:great_yuan_ruler + } + change_liege = { + liege = scope:great_yuan_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_red_horde_region + } + exists = scope:red_horde_ruler + } + change_liege = { + liege = scope:red_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_white_horde_region + } + exists = scope:white_horde_ruler + } + change_liege = { + liege = scope:white_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + exists = scope:blue_horde_ruler + } + change_liege = { + liege = scope:blue_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + exists = scope:omnod_dalai_khanate_ruler + } + change_liege = { + liege = scope:omnod_dalai_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + exists = scope:aarlud_khanate_ruler + } + change_liege = { + liege = scope:aarlud_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + exists = scope:togskol_khanate_ruler + } + change_liege = { + liege = scope:togskol_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + exists = scope:baruun_khanate_ruler + } + change_liege = { + liege = scope:baruun_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + } + every_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + } + if = { + limit = { + title_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + exists = scope:mongolia_ruler + } + change_title_holder = { + holder = scope:mongolia_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + exists = scope:golden_horde_ruler + } + change_title_holder = { + holder = scope:golden_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_chagatai_region + } + exists = scope:chagatai_ruler + } + change_title_holder = { + holder = scope:chagatai_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + exists = scope:great_yuan_ruler + } + change_title_holder = { + holder = scope:great_yuan_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_red_horde_region + } + exists = scope:red_horde_ruler + } + change_title_holder = { + holder = scope:red_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_white_horde_region + } + exists = scope:white_horde_ruler + } + change_title_holder = { + holder = scope:white_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + exists = scope:blue_horde_ruler + } + change_title_holder = { + holder = scope:blue_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + exists = scope:omnod_dalai_khanate_ruler + } + change_title_holder = { + holder = scope:omnod_dalai_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + exists = scope:aarlud_khanate_ruler + } + change_title_holder = { + holder = scope:aarlud_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + exists = scope:togskol_khanate_ruler + } + change_title_holder = { + holder = scope:togskol_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + exists = scope:baruun_khanate_ruler + } + change_title_holder = { + holder = scope:baruun_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + } + } + } + # Golden Horde + if = { + limit = { + exists = scope:golden_horde_ruler + } + scope:golden_horde_ruler = { + every_vassal_or_below = { + limit = { + NOR = { + has_character_flag = should_be_vassalized_by_ilkhanate + has_character_flag = should_be_vassalized_by_golden_horde + has_character_flag = should_be_vassalized_by_chagatai + has_character_flag = should_be_vassalized_by_red_horde + has_character_flag = should_be_vassalized_by_white_horde + has_character_flag = should_be_vassalized_by_aarlud_khanate + has_character_flag = should_be_vassalized_by_togskol_khanate + has_character_flag = should_be_vassalized_by_baruun_khanate + has_character_flag = should_be_vassalized_by_mongolia + has_character_flag = should_be_vassalized_by_great_yuan + has_character_flag = should_be_vassalized_by_blue_horde + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + } + if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + exists = scope:ilkhanate_ruler + } + change_liege = { + liege = scope:ilkhanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + exists = scope:mongolia_ruler + } + change_liege = { + liege = scope:mongolia_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_chagatai_region + } + exists = scope:chagatai_ruler + } + change_liege = { + liege = scope:chagatai_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + exists = scope:great_yuan_ruler + } + change_liege = { + liege = scope:great_yuan_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_red_horde_region + } + exists = scope:red_horde_ruler + } + change_liege = { + liege = scope:red_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_white_horde_region + } + exists = scope:white_horde_ruler + } + change_liege = { + liege = scope:white_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + exists = scope:blue_horde_ruler + } + change_liege = { + liege = scope:blue_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + exists = scope:omnod_dalai_khanate_ruler + } + change_liege = { + liege = scope:omnod_dalai_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + exists = scope:aarlud_khanate_ruler + } + change_liege = { + liege = scope:aarlud_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + exists = scope:togskol_khanate_ruler + } + change_liege = { + liege = scope:togskol_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + exists = scope:baruun_khanate_ruler + } + change_liege = { + liege = scope:baruun_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + } + every_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + exists = scope:ilkhanate_ruler + } + change_title_holder = { + holder = scope:ilkhanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + title_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + exists = scope:mongolia_ruler + } + change_title_holder = { + holder = scope:mongolia_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_chagatai_region + } + exists = scope:chagatai_ruler + } + change_title_holder = { + holder = scope:chagatai_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + exists = scope:great_yuan_ruler + } + change_title_holder = { + holder = scope:great_yuan_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_red_horde_region + } + exists = scope:red_horde_ruler + } + change_title_holder = { + holder = scope:red_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_white_horde_region + } + exists = scope:white_horde_ruler + } + change_title_holder = { + holder = scope:white_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + exists = scope:blue_horde_ruler + } + change_title_holder = { + holder = scope:blue_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + exists = scope:omnod_dalai_khanate_ruler + } + change_title_holder = { + holder = scope:omnod_dalai_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + exists = scope:aarlud_khanate_ruler + } + change_title_holder = { + holder = scope:aarlud_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + exists = scope:togskol_khanate_ruler + } + change_title_holder = { + holder = scope:togskol_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + exists = scope:baruun_khanate_ruler + } + change_title_holder = { + holder = scope:baruun_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + } + } + } + # Chagatai + if = { + limit = { + exists = scope:chagatai_ruler + } + scope:chagatai_ruler = { + every_vassal_or_below = { + limit = { + NOR = { + has_character_flag = should_be_vassalized_by_ilkhanate + has_character_flag = should_be_vassalized_by_golden_horde + has_character_flag = should_be_vassalized_by_chagatai + has_character_flag = should_be_vassalized_by_red_horde + has_character_flag = should_be_vassalized_by_white_horde + has_character_flag = should_be_vassalized_by_aarlud_khanate + has_character_flag = should_be_vassalized_by_togskol_khanate + has_character_flag = should_be_vassalized_by_baruun_khanate + has_character_flag = should_be_vassalized_by_mongolia + has_character_flag = should_be_vassalized_by_great_yuan + has_character_flag = should_be_vassalized_by_blue_horde + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + } + if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + exists = scope:ilkhanate_ruler + } + change_liege = { + liege = scope:ilkhanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + exists = scope:golden_horde_ruler + } + change_liege = { + liege = scope:golden_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + exists = scope:mongolia_ruler + } + change_liege = { + liege = scope:mongolia_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + exists = scope:great_yuan_ruler + } + change_liege = { + liege = scope:great_yuan_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_red_horde_region + } + exists = scope:red_horde_ruler + } + change_liege = { + liege = scope:red_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_white_horde_region + } + exists = scope:white_horde_ruler + } + change_liege = { + liege = scope:white_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + exists = scope:blue_horde_ruler + } + change_liege = { + liege = scope:blue_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + exists = scope:omnod_dalai_khanate_ruler + } + change_liege = { + liege = scope:omnod_dalai_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + exists = scope:aarlud_khanate_ruler + } + change_liege = { + liege = scope:aarlud_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + exists = scope:togskol_khanate_ruler + } + change_liege = { + liege = scope:togskol_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + exists = scope:baruun_khanate_ruler + } + change_liege = { + liege = scope:baruun_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + } + every_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + exists = scope:ilkhanate_ruler + } + change_title_holder = { + holder = scope:ilkhanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + exists = scope:golden_horde_ruler + } + change_title_holder = { + holder = scope:golden_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + title_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + exists = scope:mongolia_ruler + } + change_title_holder = { + holder = scope:mongolia_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + exists = scope:great_yuan_ruler + } + change_title_holder = { + holder = scope:great_yuan_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_red_horde_region + } + exists = scope:red_horde_ruler + } + change_title_holder = { + holder = scope:red_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_white_horde_region + } + exists = scope:white_horde_ruler + } + change_title_holder = { + holder = scope:white_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + exists = scope:blue_horde_ruler + } + change_title_holder = { + holder = scope:blue_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + exists = scope:omnod_dalai_khanate_ruler + } + change_title_holder = { + holder = scope:omnod_dalai_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + exists = scope:aarlud_khanate_ruler + } + change_title_holder = { + holder = scope:aarlud_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + exists = scope:togskol_khanate_ruler + } + change_title_holder = { + holder = scope:togskol_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + exists = scope:baruun_khanate_ruler + } + change_title_holder = { + holder = scope:baruun_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + } + } + } + + # Great Yuan + if = { + limit = { + exists = scope:great_yuan_ruler + } + scope:great_yuan_ruler = { + every_vassal_or_below = { + limit = { + NOR = { + has_character_flag = should_be_vassalized_by_ilkhanate + has_character_flag = should_be_vassalized_by_golden_horde + has_character_flag = should_be_vassalized_by_chagatai + has_character_flag = should_be_vassalized_by_red_horde + has_character_flag = should_be_vassalized_by_white_horde + has_character_flag = should_be_vassalized_by_aarlud_khanate + has_character_flag = should_be_vassalized_by_togskol_khanate + has_character_flag = should_be_vassalized_by_baruun_khanate + has_character_flag = should_be_vassalized_by_mongolia + has_character_flag = should_be_vassalized_by_great_yuan + has_character_flag = should_be_vassalized_by_blue_horde + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + } + if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + exists = scope:ilkhanate_ruler + } + change_liege = { + liege = scope:ilkhanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + exists = scope:golden_horde_ruler + } + change_liege = { + liege = scope:golden_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + exists = scope:mongolia_ruler + } + change_liege = { + liege = scope:mongolia_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_red_horde_region + } + exists = scope:red_horde_ruler + } + change_liege = { + liege = scope:red_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_white_horde_region + } + exists = scope:white_horde_ruler + } + change_liege = { + liege = scope:white_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + exists = scope:blue_horde_ruler + } + change_liege = { + liege = scope:blue_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + exists = scope:omnod_dalai_khanate_ruler + } + change_liege = { + liege = scope:omnod_dalai_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + exists = scope:aarlud_khanate_ruler + } + change_liege = { + liege = scope:aarlud_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + exists = scope:togskol_khanate_ruler + } + change_liege = { + liege = scope:togskol_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + exists = scope:baruun_khanate_ruler + } + change_liege = { + liege = scope:baruun_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + } + every_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + exists = scope:ilkhanate_ruler + } + change_title_holder = { + holder = scope:ilkhanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + exists = scope:golden_horde_ruler + } + change_title_holder = { + holder = scope:golden_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_chagatai_region + } + exists = scope:chagatai_ruler + } + change_title_holder = { + holder = scope:chagatai_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + title_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + exists = scope:mongolia_ruler + } + change_title_holder = { + holder = scope:mongolia_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_red_horde_region + } + exists = scope:red_horde_ruler + } + change_title_holder = { + holder = scope:red_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_white_horde_region + } + exists = scope:white_horde_ruler + } + change_title_holder = { + holder = scope:white_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + exists = scope:blue_horde_ruler + } + change_title_holder = { + holder = scope:blue_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + exists = scope:omnod_dalai_khanate_ruler + } + change_title_holder = { + holder = scope:omnod_dalai_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + exists = scope:aarlud_khanate_ruler + } + change_title_holder = { + holder = scope:aarlud_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + exists = scope:togskol_khanate_ruler + } + change_title_holder = { + holder = scope:togskol_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + exists = scope:baruun_khanate_ruler + } + change_title_holder = { + holder = scope:baruun_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + } + } + } + # Red Horde + if = { + limit = { + exists = scope:red_horde_ruler + } + scope:red_horde_ruler = { + every_vassal_or_below = { + limit = { + NOR = { + has_character_flag = should_be_vassalized_by_ilkhanate + has_character_flag = should_be_vassalized_by_golden_horde + has_character_flag = should_be_vassalized_by_chagatai + has_character_flag = should_be_vassalized_by_red_horde + has_character_flag = should_be_vassalized_by_white_horde + has_character_flag = should_be_vassalized_by_aarlud_khanate + has_character_flag = should_be_vassalized_by_togskol_khanate + has_character_flag = should_be_vassalized_by_baruun_khanate + has_character_flag = should_be_vassalized_by_mongolia + has_character_flag = should_be_vassalized_by_great_yuan + has_character_flag = should_be_vassalized_by_blue_horde + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + } + if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + exists = scope:ilkhanate_ruler + } + change_liege = { + liege = scope:ilkhanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + exists = scope:golden_horde_ruler + } + change_liege = { + liege = scope:golden_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_chagatai_region + } + exists = scope:chagatai_ruler + } + change_liege = { + liege = scope:chagatai_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + exists = scope:great_yuan_ruler + } + change_liege = { + liege = scope:great_yuan_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + exists = scope:mongolia_ruler + } + change_liege = { + liege = scope:mongolia_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_white_horde_region + } + exists = scope:white_horde_ruler + } + change_liege = { + liege = scope:white_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + exists = scope:blue_horde_ruler + } + change_liege = { + liege = scope:blue_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + exists = scope:omnod_dalai_khanate_ruler + } + change_liege = { + liege = scope:omnod_dalai_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + exists = scope:aarlud_khanate_ruler + } + change_liege = { + liege = scope:aarlud_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + exists = scope:togskol_khanate_ruler + } + change_liege = { + liege = scope:togskol_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + exists = scope:baruun_khanate_ruler + } + change_liege = { + liege = scope:baruun_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + } + every_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + exists = scope:ilkhanate_ruler + } + change_title_holder = { + holder = scope:ilkhanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + exists = scope:golden_horde_ruler + } + change_title_holder = { + holder = scope:golden_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_chagatai_region + } + exists = scope:chagatai_ruler + } + change_title_holder = { + holder = scope:chagatai_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + exists = scope:great_yuan_ruler + } + change_title_holder = { + holder = scope:great_yuan_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + title_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + exists = scope:mongolia_ruler + } + change_title_holder = { + holder = scope:mongolia_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_white_horde_region + } + exists = scope:white_horde_ruler + } + change_title_holder = { + holder = scope:white_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + exists = scope:blue_horde_ruler + } + change_title_holder = { + holder = scope:blue_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + exists = scope:omnod_dalai_khanate_ruler + } + change_title_holder = { + holder = scope:omnod_dalai_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + exists = scope:aarlud_khanate_ruler + } + change_title_holder = { + holder = scope:aarlud_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + exists = scope:togskol_khanate_ruler + } + change_title_holder = { + holder = scope:togskol_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + exists = scope:baruun_khanate_ruler + } + change_title_holder = { + holder = scope:baruun_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + } + } + } + # White Horde + if = { + limit = { + exists = scope:white_horde_ruler + } + scope:white_horde_ruler = { + every_vassal_or_below = { + limit = { + NOR = { + has_character_flag = should_be_vassalized_by_ilkhanate + has_character_flag = should_be_vassalized_by_golden_horde + has_character_flag = should_be_vassalized_by_chagatai + has_character_flag = should_be_vassalized_by_red_horde + has_character_flag = should_be_vassalized_by_white_horde + has_character_flag = should_be_vassalized_by_aarlud_khanate + has_character_flag = should_be_vassalized_by_togskol_khanate + has_character_flag = should_be_vassalized_by_baruun_khanate + has_character_flag = should_be_vassalized_by_mongolia + has_character_flag = should_be_vassalized_by_great_yuan + has_character_flag = should_be_vassalized_by_blue_horde + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + } + if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + exists = scope:ilkhanate_ruler + } + change_liege = { + liege = scope:ilkhanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + exists = scope:golden_horde_ruler + } + change_liege = { + liege = scope:golden_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_chagatai_region + } + exists = scope:chagatai_ruler + } + change_liege = { + liege = scope:chagatai_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + exists = scope:great_yuan_ruler + } + change_liege = { + liege = scope:great_yuan_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_red_horde_region + } + exists = scope:red_horde_ruler + } + change_liege = { + liege = scope:red_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + exists = scope:mongolia_ruler + } + change_liege = { + liege = scope:mongolia_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + exists = scope:blue_horde_ruler + } + change_liege = { + liege = scope:blue_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + exists = scope:omnod_dalai_khanate_ruler + } + change_liege = { + liege = scope:omnod_dalai_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + exists = scope:aarlud_khanate_ruler + } + change_liege = { + liege = scope:aarlud_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + exists = scope:togskol_khanate_ruler + } + change_liege = { + liege = scope:togskol_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + exists = scope:baruun_khanate_ruler + } + change_liege = { + liege = scope:baruun_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + } + every_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + exists = scope:ilkhanate_ruler + } + change_title_holder = { + holder = scope:ilkhanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + exists = scope:golden_horde_ruler + } + change_title_holder = { + holder = scope:golden_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_chagatai_region + } + exists = scope:chagatai_ruler + } + change_title_holder = { + holder = scope:chagatai_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + exists = scope:great_yuan_ruler + } + change_title_holder = { + holder = scope:great_yuan_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_red_horde_region + } + exists = scope:red_horde_ruler + } + change_title_holder = { + holder = scope:red_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + title_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + exists = scope:mongolia_ruler + } + change_title_holder = { + holder = scope:mongolia_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + exists = scope:blue_horde_ruler + } + change_title_holder = { + holder = scope:blue_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + exists = scope:omnod_dalai_khanate_ruler + } + change_title_holder = { + holder = scope:omnod_dalai_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + exists = scope:aarlud_khanate_ruler + } + change_title_holder = { + holder = scope:aarlud_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + exists = scope:togskol_khanate_ruler + } + change_title_holder = { + holder = scope:togskol_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + exists = scope:baruun_khanate_ruler + } + change_title_holder = { + holder = scope:baruun_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + } + } + } + + # Blue Horde + if = { + limit = { + exists = scope:blue_horde_ruler + } + scope:blue_horde_ruler = { + every_vassal_or_below = { + limit = { + NOR = { + has_character_flag = should_be_vassalized_by_ilkhanate + has_character_flag = should_be_vassalized_by_golden_horde + has_character_flag = should_be_vassalized_by_chagatai + has_character_flag = should_be_vassalized_by_red_horde + has_character_flag = should_be_vassalized_by_white_horde + has_character_flag = should_be_vassalized_by_aarlud_khanate + has_character_flag = should_be_vassalized_by_togskol_khanate + has_character_flag = should_be_vassalized_by_baruun_khanate + has_character_flag = should_be_vassalized_by_mongolia + has_character_flag = should_be_vassalized_by_great_yuan + has_character_flag = should_be_vassalized_by_blue_horde + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + } + if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + exists = scope:ilkhanate_ruler + } + change_liege = { + liege = scope:ilkhanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + exists = scope:golden_horde_ruler + } + change_liege = { + liege = scope:golden_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_chagatai_region + } + exists = scope:chagatai_ruler + } + change_liege = { + liege = scope:chagatai_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + exists = scope:great_yuan_ruler + } + change_liege = { + liege = scope:great_yuan_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_red_horde_region + } + exists = scope:red_horde_ruler + } + change_liege = { + liege = scope:red_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_white_horde_region + } + exists = scope:white_horde_ruler + } + change_liege = { + liege = scope:white_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + exists = scope:mongolia_ruler + } + change_liege = { + liege = scope:mongolia_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + exists = scope:omnod_dalai_khanate_ruler + } + change_liege = { + liege = scope:omnod_dalai_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + exists = scope:aarlud_khanate_ruler + } + change_liege = { + liege = scope:aarlud_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + exists = scope:togskol_khanate_ruler + } + change_liege = { + liege = scope:togskol_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + exists = scope:baruun_khanate_ruler + } + change_liege = { + liege = scope:baruun_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + } + every_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + exists = scope:ilkhanate_ruler + } + change_title_holder = { + holder = scope:ilkhanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + exists = scope:golden_horde_ruler + } + change_title_holder = { + holder = scope:golden_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_chagatai_region + } + exists = scope:chagatai_ruler + } + change_title_holder = { + holder = scope:chagatai_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + exists = scope:great_yuan_ruler + } + change_title_holder = { + holder = scope:great_yuan_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_red_horde_region + } + exists = scope:red_horde_ruler + } + change_title_holder = { + holder = scope:red_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_white_horde_region + } + exists = scope:white_horde_ruler + } + change_title_holder = { + holder = scope:white_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + title_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + exists = scope:mongolia_ruler + } + change_title_holder = { + holder = scope:mongolia_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + exists = scope:omnod_dalai_khanate_ruler + } + change_title_holder = { + holder = scope:omnod_dalai_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + exists = scope:aarlud_khanate_ruler + } + change_title_holder = { + holder = scope:aarlud_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + exists = scope:togskol_khanate_ruler + } + change_title_holder = { + holder = scope:togskol_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + exists = scope:baruun_khanate_ruler + } + change_title_holder = { + holder = scope:baruun_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + } + } + } + # Omnod Dalai Khanate + if = { + limit = { + exists = scope:omnod_dalai_khanate_ruler + } + scope:omnod_dalai_khanate_ruler = { + every_vassal_or_below = { + limit = { + NOR = { + has_character_flag = should_be_vassalized_by_ilkhanate + has_character_flag = should_be_vassalized_by_golden_horde + has_character_flag = should_be_vassalized_by_chagatai + has_character_flag = should_be_vassalized_by_red_horde + has_character_flag = should_be_vassalized_by_white_horde + has_character_flag = should_be_vassalized_by_aarlud_khanate + has_character_flag = should_be_vassalized_by_togskol_khanate + has_character_flag = should_be_vassalized_by_baruun_khanate + has_character_flag = should_be_vassalized_by_mongolia + has_character_flag = should_be_vassalized_by_great_yuan + has_character_flag = should_be_vassalized_by_blue_horde + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + } + if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + exists = scope:ilkhanate_ruler + } + change_liege = { + liege = scope:ilkhanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + exists = scope:golden_horde_ruler + } + change_liege = { + liege = scope:golden_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_chagatai_region + } + exists = scope:chagatai_ruler + } + change_liege = { + liege = scope:chagatai_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + exists = scope:great_yuan_ruler + } + change_liege = { + liege = scope:great_yuan_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_red_horde_region + } + exists = scope:red_horde_ruler + } + change_liege = { + liege = scope:red_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_white_horde_region + } + exists = scope:white_horde_ruler + } + change_liege = { + liege = scope:white_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + exists = scope:blue_horde_ruler + } + change_liege = { + liege = scope:blue_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + exists = scope:mongolia_ruler + } + change_liege = { + liege = scope:mongolia_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + exists = scope:aarlud_khanate_ruler + } + change_liege = { + liege = scope:aarlud_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + exists = scope:togskol_khanate_ruler + } + change_liege = { + liege = scope:togskol_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + exists = scope:baruun_khanate_ruler + } + change_liege = { + liege = scope:baruun_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + } + every_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + exists = scope:ilkhanate_ruler + } + change_title_holder = { + holder = scope:ilkhanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + exists = scope:golden_horde_ruler + } + change_title_holder = { + holder = scope:golden_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_chagatai_region + } + exists = scope:chagatai_ruler + } + change_title_holder = { + holder = scope:chagatai_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + exists = scope:great_yuan_ruler + } + change_title_holder = { + holder = scope:great_yuan_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_red_horde_region + } + exists = scope:red_horde_ruler + } + change_title_holder = { + holder = scope:red_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_white_horde_region + } + exists = scope:white_horde_ruler + } + change_title_holder = { + holder = scope:white_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + exists = scope:blue_horde_ruler + } + change_title_holder = { + holder = scope:blue_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + title_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + exists = scope:mongolia_ruler + } + change_title_holder = { + holder = scope:mongolia_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + exists = scope:aarlud_khanate_ruler + } + change_title_holder = { + holder = scope:aarlud_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + exists = scope:togskol_khanate_ruler + } + change_title_holder = { + holder = scope:togskol_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + exists = scope:baruun_khanate_ruler + } + change_title_holder = { + holder = scope:baruun_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + } + } + } + # Aarlud Khanate + if = { + limit = { + exists = scope:aarlud_khanate_ruler + } + scope:aarlud_khanate_ruler = { + every_vassal_or_below = { + limit = { + NOR = { + has_character_flag = should_be_vassalized_by_ilkhanate + has_character_flag = should_be_vassalized_by_golden_horde + has_character_flag = should_be_vassalized_by_chagatai + has_character_flag = should_be_vassalized_by_red_horde + has_character_flag = should_be_vassalized_by_white_horde + has_character_flag = should_be_vassalized_by_aarlud_khanate + has_character_flag = should_be_vassalized_by_togskol_khanate + has_character_flag = should_be_vassalized_by_baruun_khanate + has_character_flag = should_be_vassalized_by_mongolia + has_character_flag = should_be_vassalized_by_great_yuan + has_character_flag = should_be_vassalized_by_blue_horde + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + } + if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + exists = scope:ilkhanate_ruler + } + change_liege = { + liege = scope:ilkhanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + exists = scope:golden_horde_ruler + } + change_liege = { + liege = scope:golden_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_chagatai_region + } + exists = scope:chagatai_ruler + } + change_liege = { + liege = scope:chagatai_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + exists = scope:great_yuan_ruler + } + change_liege = { + liege = scope:great_yuan_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_red_horde_region + } + exists = scope:red_horde_ruler + } + change_liege = { + liege = scope:red_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_white_horde_region + } + exists = scope:white_horde_ruler + } + change_liege = { + liege = scope:white_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + exists = scope:blue_horde_ruler + } + change_liege = { + liege = scope:blue_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + exists = scope:omnod_dalai_khanate_ruler + } + change_liege = { + liege = scope:omnod_dalai_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + exists = scope:mongolia_ruler + } + change_liege = { + liege = scope:mongolia_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + exists = scope:togskol_khanate_ruler + } + change_liege = { + liege = scope:togskol_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + exists = scope:baruun_khanate_ruler + } + change_liege = { + liege = scope:baruun_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + } + every_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + exists = scope:ilkhanate_ruler + } + change_title_holder = { + holder = scope:ilkhanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + exists = scope:golden_horde_ruler + } + change_title_holder = { + holder = scope:golden_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_chagatai_region + } + exists = scope:chagatai_ruler + } + change_title_holder = { + holder = scope:chagatai_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + exists = scope:great_yuan_ruler + } + change_title_holder = { + holder = scope:great_yuan_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_red_horde_region + } + exists = scope:red_horde_ruler + } + change_title_holder = { + holder = scope:red_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_white_horde_region + } + exists = scope:white_horde_ruler + } + change_title_holder = { + holder = scope:white_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + exists = scope:blue_horde_ruler + } + change_title_holder = { + holder = scope:blue_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + exists = scope:omnod_dalai_khanate_ruler + } + change_title_holder = { + holder = scope:omnod_dalai_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + title_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + exists = scope:mongolia_ruler + } + change_title_holder = { + holder = scope:mongolia_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + exists = scope:togskol_khanate_ruler + } + change_title_holder = { + holder = scope:togskol_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + exists = scope:baruun_khanate_ruler + } + change_title_holder = { + holder = scope:baruun_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + } + } + } + # Togskol Khanate + if = { + limit = { + exists = scope:togskol_khanate_ruler + } + scope:togskol_khanate_ruler = { + every_vassal_or_below = { + limit = { + NOR = { + has_character_flag = should_be_vassalized_by_ilkhanate + has_character_flag = should_be_vassalized_by_golden_horde + has_character_flag = should_be_vassalized_by_chagatai + has_character_flag = should_be_vassalized_by_red_horde + has_character_flag = should_be_vassalized_by_white_horde + has_character_flag = should_be_vassalized_by_aarlud_khanate + has_character_flag = should_be_vassalized_by_togskol_khanate + has_character_flag = should_be_vassalized_by_baruun_khanate + has_character_flag = should_be_vassalized_by_mongolia + has_character_flag = should_be_vassalized_by_great_yuan + has_character_flag = should_be_vassalized_by_blue_horde + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + } + if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + exists = scope:ilkhanate_ruler + } + change_liege = { + liege = scope:ilkhanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + exists = scope:golden_horde_ruler + } + change_liege = { + liege = scope:golden_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_chagatai_region + } + exists = scope:chagatai_ruler + } + change_liege = { + liege = scope:chagatai_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + exists = scope:great_yuan_ruler + } + change_liege = { + liege = scope:great_yuan_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_red_horde_region + } + exists = scope:red_horde_ruler + } + change_liege = { + liege = scope:red_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_white_horde_region + } + exists = scope:white_horde_ruler + } + change_liege = { + liege = scope:white_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + exists = scope:blue_horde_ruler + } + change_liege = { + liege = scope:blue_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + exists = scope:omnod_dalai_khanate_ruler + } + change_liege = { + liege = scope:omnod_dalai_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + exists = scope:aarlud_khanate_ruler + } + change_liege = { + liege = scope:aarlud_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + exists = scope:mongolia_ruler + } + change_liege = { + liege = scope:mongolia_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + exists = scope:baruun_khanate_ruler + } + change_liege = { + liege = scope:baruun_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + } + every_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + exists = scope:ilkhanate_ruler + } + change_title_holder = { + holder = scope:ilkhanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + exists = scope:golden_horde_ruler + } + change_title_holder = { + holder = scope:golden_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_chagatai_region + } + exists = scope:chagatai_ruler + } + change_title_holder = { + holder = scope:chagatai_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + exists = scope:great_yuan_ruler + } + change_title_holder = { + holder = scope:great_yuan_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_red_horde_region + } + exists = scope:red_horde_ruler + } + change_title_holder = { + holder = scope:red_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_white_horde_region + } + exists = scope:white_horde_ruler + } + change_title_holder = { + holder = scope:white_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + exists = scope:blue_horde_ruler + } + change_title_holder = { + holder = scope:blue_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + exists = scope:omnod_dalai_khanate_ruler + } + change_title_holder = { + holder = scope:omnod_dalai_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + exists = scope:aarlud_khanate_ruler + } + change_title_holder = { + holder = scope:aarlud_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + title_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + exists = scope:mongolia_ruler + } + change_title_holder = { + holder = scope:mongolia_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + exists = scope:baruun_khanate_ruler + } + change_title_holder = { + holder = scope:baruun_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + } + } + } + # Baruun Khanate + if = { + limit = { + exists = scope:baruun_khanate_ruler + } + scope:mongolia_ruler = { + every_vassal_or_below = { + limit = { + NOR = { + has_character_flag = should_be_vassalized_by_ilkhanate + has_character_flag = should_be_vassalized_by_golden_horde + has_character_flag = should_be_vassalized_by_chagatai + has_character_flag = should_be_vassalized_by_red_horde + has_character_flag = should_be_vassalized_by_white_horde + has_character_flag = should_be_vassalized_by_aarlud_khanate + has_character_flag = should_be_vassalized_by_togskol_khanate + has_character_flag = should_be_vassalized_by_baruun_khanate + has_character_flag = should_be_vassalized_by_mongolia + has_character_flag = should_be_vassalized_by_great_yuan + has_character_flag = should_be_vassalized_by_blue_horde + has_character_flag = should_be_vassalized_by_omnod_dalai_khanate + } + } + if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + exists = scope:ilkhanate_ruler + } + change_liege = { + liege = scope:ilkhanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + exists = scope:golden_horde_ruler + } + change_liege = { + liege = scope:golden_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_chagatai_region + } + exists = scope:chagatai_ruler + } + change_liege = { + liege = scope:chagatai_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + exists = scope:great_yuan_ruler + } + change_liege = { + liege = scope:great_yuan_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_red_horde_region + } + exists = scope:red_horde_ruler + } + change_liege = { + liege = scope:red_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_white_horde_region + } + exists = scope:white_horde_ruler + } + change_liege = { + liege = scope:white_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + exists = scope:blue_horde_ruler + } + change_liege = { + liege = scope:blue_horde_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + exists = scope:omnod_dalai_khanate_ruler + } + change_liege = { + liege = scope:omnod_dalai_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + exists = scope:aarlud_khanate_ruler + } + change_liege = { + liege = scope:aarlud_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + exists = scope:togskol_khanate_ruler + } + change_liege = { + liege = scope:togskol_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + capital_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + exists = scope:mongolia_ruler + } + change_liege = { + liege = scope:mongolia_ruler + change = scope:mongol_cleanup_succession + } + } + } + every_held_title = { + title_tier = county + limit = { + is_landless_type_title = no + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + exists = scope:ilkhanate_ruler + } + change_title_holder = { + holder = scope:ilkhanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + exists = scope:golden_horde_ruler + } + change_title_holder = { + holder = scope:golden_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_chagatai_region + } + exists = scope:chagatai_ruler + } + change_title_holder = { + holder = scope:chagatai_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + exists = scope:great_yuan_ruler + } + change_title_holder = { + holder = scope:great_yuan_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_red_horde_region + } + exists = scope:red_horde_ruler + } + change_title_holder = { + holder = scope:red_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_white_horde_region + } + exists = scope:white_horde_ruler + } + change_title_holder = { + holder = scope:white_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + exists = scope:blue_horde_ruler + } + change_title_holder = { + holder = scope:blue_horde_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + exists = scope:omnod_dalai_khanate_ruler + } + change_title_holder = { + holder = scope:omnod_dalai_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + exists = scope:aarlud_khanate_ruler + } + change_title_holder = { + holder = scope:aarlud_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + if = { + limit = { + title_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + exists = scope:togskol_khanate_ruler + } + change_title_holder = { + holder = scope:togskol_khanate_ruler + change = scope:mongol_cleanup_succession + } + } + else_if = { + limit = { + title_province = { + NOR = { + geographical_region = special_mongol_empire_ilkhanate_region + geographical_region = special_mongol_empire_golden_horde_region + geographical_region = special_mongol_empire_chagatai_region + geographical_region = special_mongol_empire_red_horde_region + geographical_region = special_mongol_empire_white_horde_region + geographical_region = special_mongol_empire_aarlud_khanate_region + geographical_region = special_mongol_empire_togskol_khanate_region + geographical_region = special_mongol_empire_baruun_khanate_region + geographical_region = special_mongol_empire_great_yuan_region + geographical_region = special_mongol_empire_blue_horde_region + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + exists = scope:mongolia_ruler + } + change_title_holder = { + holder = scope:mongolia_ruler + change = scope:mongol_cleanup_succession + } + } + } + } + } + resolve_title_and_vassal_change = scope:mongol_cleanup_succession + + every_in_list = { # If tengri, switch to an organized faith in your new realm + list = selected_mongol_heirs + limit = { + primary_title.tier = tier_empire + faith = { has_doctrine_parameter = unreformed } + any_sub_realm_county = { + faith = { + NOT = { has_doctrine_parameter = unreformed } + } + } + } + save_scope_as = faith_changer + random_sub_realm_county = { + limit = { + faith = { + NOT = { has_doctrine_parameter = unreformed } + } + } + weight = { + base = 1 + modifier = { + save_temporary_scope_as = county_faith_check + add = mongol_successor_faith_chance + } + } + scope:faith_changer = { + set_character_faith = prev.faith + } + } + } +} + + +### END Title creation effects + +grant_suitable_title_to_candidate_effect = { + save_temporary_scope_as = candidate + + # Runs through available titles and grants an available one + random_list = { + # Ilkhanate + 1 = { + trigger = { + exists = global_var:creatable_ilkhanate + NOT = { exists = global_var:ilkhanate_handed_out } + NOT = { exists = title:e_ilkhanate.holder } + } + # Weight the chance by how much territory you hold there + modifier = { + add = { + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + } + add = 50 + } + } + always = yes + } + grant_ilkhanate_effect = yes + } + # Golden Horde + 1 = { + trigger = { + exists = global_var:creatable_golden_horde + NOT = { exists = global_var:golden_horde_handed_out } + NOT = { exists = title:e_golden_horde.holder } + } + # Weight the chance by how much territory you hold there + modifier = { + add = { + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + } + add = 50 + } + } + always = yes + } + grant_golden_horde_effect = yes + } + # Chagatai + 1 = { + trigger = { + exists = global_var:creatable_chagatai + NOT = { exists = global_var:chagatai_handed_out } + NOT = { exists = title:e_chagatai.holder } + } + # Weight the chance by how much territory you hold there + modifier = { + add = { + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = special_mongol_empire_chagatai_region + } + } + add = 50 + } + } + always = yes + } + grant_chagatai_effect = yes + } + # Great Yuan + 1 = { + trigger = { + exists = global_var:creatable_great_yuan + NOT = { exists = global_var:great_yuan_handed_out } + NOT = { exists = scope:great_yuan_title.holder } + } + # Weight the chance by how much territory you hold there + modifier = { + add = { + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + } + add = 50 + } + } + always = yes + } + grant_great_yuan_effect = yes + } + # Red Horde + 1 = { + trigger = { + exists = global_var:creatable_red_horde + NOT = { exists = global_var:red_horde_handed_out } + NOT = { exists = title:e_red_horde.holder } + } + # Weight the chance by how much territory you hold there + modifier = { + add = { + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = special_mongol_empire_red_horde_region + } + } + add = 50 + } + } + always = yes + } + grant_red_horde_effect = yes + } + # White Horde + 1 = { + trigger = { + exists = global_var:creatable_white_horde + NOT = { exists = global_var:white_horde_handed_out } + NOT = { exists = title:e_white_horde.holder } + } + # Weight the chance by how much territory you hold there + modifier = { + add = { + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = special_mongol_empire_white_horde_region + } + } + add = 50 + } + } + always = yes + } + grant_white_horde_effect = yes + } + # Blue Horde + 1 = { + trigger = { + exists = global_var:creatable_blue_horde + NOT = { exists = global_var:blue_horde_handed_out } + NOT = { exists = title:e_blue_horde.holder } + } + # Weight the chance by how much territory you hold there + modifier = { + add = { + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + } + add = 50 + } + } + always = yes + } + grant_blue_horde_effect = yes + } + # Omnod Dalai Khanate + 1 = { + trigger = { + exists = global_var:creatable_omnod_dalai_khanate + NOT = { exists = global_var:omnod_dalai_khanate_handed_out } + NOT = { exists = title:e_omnod_dalai_khanate.holder } + } + # Weight the chance by how much territory you hold there + modifier = { + add = { + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + add = 50 + } + } + always = yes + } + grant_omnod_dalai_khanate_effect = yes + } + # Aarlud Khanate + 1 = { + trigger = { + exists = global_var:creatable_aarlud_khanate + NOT = { exists = global_var:aarlud_khanate_handed_out } + NOT = { exists = title:e_aarlud_khanate.holder } + } + # Weight the chance by how much territory you hold there + modifier = { + add = { + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + } + add = 50 + } + } + always = yes + } + grant_aarlud_khanate_effect = yes + } + # Tögsköl Khanate + 1 = { + trigger = { + exists = global_var:creatable_togskol_khanate + NOT = { exists = global_var:togskol_khanate_handed_out } + NOT = { exists = title:e_togskol_khanate.holder } + } + # Weight the chance by how much territory you hold there + modifier = { + add = { + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + } + add = 50 + } + } + always = yes + } + grant_togskol_khanate_effect = yes + } + # Baruun Khanate + 1 = { + trigger = { + exists = global_var:creatable_baruun_khanate + NOT = { exists = global_var:baruun_khanate_handed_out } + NOT = { exists = title:e_baruun_khanate.holder } + } + # Weight the chance by how much territory you hold there + modifier = { + add = { + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + } + add = 50 + } + } + always = yes + } + grant_baruun_khanate_effect = yes + } + } + + # Add to list so we can move related titles around later + add_to_list = candidate_granted_title +} + + +break_up_mongol_empire_effect = { # Intended to run in the Mongol Emperor's scope + save_scope_as = old_mongol_emperor + + every_tributary = { + add_to_list = mongol_tributaries + } + + every_held_title = { # Clean up excess kingdoms + limit = { + is_landless_type_title = no + OR = { + tier = tier_kingdom + tier = tier_duchy + } + } + scope:old_mongol_emperor = { + destroy_title = prev + } + } + + every_character_war = { + limit = { + primary_attacker = scope:old_mongol_emperor + is_white_peace_possible = yes + } + end_war = white_peace + } + + set_global_variable = { + name = number_of_mongol_heir_candidates + value = 0 + } + # Find suitable heir candidates + dynasty = { + every_dynasty_member = { # Every potential khandidate + limit = { + character_gender_can_inherit_from_trigger = { + CHARACTER = scope:old_mongol_emperor + } + is_alive = yes + } + change_global_variable = { + name = number_of_mongol_heir_candidates + add = 1 + } + add_to_list = mongol_heir_candidates + } + } + + # Gather Ilkhanate counties + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = special_mongol_empire_ilkhanate_region + } + } + add_to_temporary_list = ilkhanate_counties + } + # Gather Golden Horde counties + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = special_mongol_empire_golden_horde_region + } + } + add_to_temporary_list = golden_horde_counties + } + # Gather Chagatai counties + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = special_mongol_empire_chagatai_region + } + } + add_to_temporary_list = chagatai_counties + } + # Gather Great Yuan counties + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = special_mongol_empire_great_yuan_region + } + } + add_to_temporary_list = great_yuan_counties + } + # Gather Red Horde counties + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = special_mongol_empire_red_horde_region + } + } + add_to_temporary_list = red_horde_counties + } + # Gather White Horde counties + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = special_mongol_empire_white_horde_region + } + } + add_to_temporary_list = white_horde_counties + } + # Gather Blue Horde counties + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = special_mongol_empire_blue_horde_region + } + } + add_to_temporary_list = blue_horde_counties + } + # Gather Omnod Dalai Khanate counties + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = special_mongol_empire_omnod_dalai_khanate_region + } + } + add_to_temporary_list = omnod_dalai_khanate_counties + } + # Gather Aarlud Khanate counties + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = special_mongol_empire_aarlud_khanate_region + } + } + add_to_temporary_list = aarlud_khanate_counties + } + # Gather Tögsköl Khanate counties + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = special_mongol_empire_togskol_khanate_region + } + } + add_to_temporary_list = togskol_khanate_counties + } + # Gather Baruun Khanate counties + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = special_mongol_empire_baruun_khanate_region + } + } + add_to_temporary_list = baruun_khanate_counties + } + + # Check which titles are creatable + set_global_variable = { + name = creatable_mongol_successor_states_number + value = 0 + } + # Ilkhanate + if = { + limit = { + any_in_list = { + list = ilkhanate_counties + count >= @creatable_successor_empire_county_threshold + } + } + debug_log = "Ilkhanate is creatable" + set_global_variable = { + name = creatable_ilkhanate + value = yes + } + change_global_variable = { + name = creatable_mongol_successor_states_number + add = 1 + } + } + # Golden Horde + if = { + limit = { + any_in_list = { + list = golden_horde_counties + count >= @creatable_successor_empire_county_threshold + } + } + debug_log = "Golden Horde is creatable" + set_global_variable = { + name = creatable_golden_horde + value = yes + } + change_global_variable = { + name = creatable_mongol_successor_states_number + add = 1 + } + } + # Chagatai + if = { + limit = { + any_in_list = { + list = chagatai_counties + count >= @creatable_successor_empire_county_threshold + } + } + debug_log = "Chagatai is creatable" + set_global_variable = { + name = creatable_chagatai + value = yes + } + change_global_variable = { + name = creatable_mongol_successor_states_number + add = 1 + } + } + # Great Yuan + if = { + limit = { + any_in_list = { + list = great_yuan_counties + count >= @creatable_successor_empire_county_threshold + } + } + debug_log = "Great Yuan is creatable" + set_global_variable = { + name = creatable_great_yuan + value = yes + } + change_global_variable = { + name = creatable_mongol_successor_states_number + add = 1 + } + } + # Red Horde + if = { + limit = { + any_in_list = { + list = red_horde_counties + count >= @creatable_successor_empire_county_threshold + } + } + debug_log = "Red Horde is creatable" + set_global_variable = { + name = creatable_red_horde + value = yes + } + change_global_variable = { + name = creatable_mongol_successor_states_number + add = 1 + } + } + # White Horde + if = { + limit = { + any_in_list = { + list = white_horde_counties + count >= @creatable_successor_empire_county_threshold + } + } + debug_log = "White Horde is creatable" + set_global_variable = { + name = creatable_white_horde + value = yes + } + change_global_variable = { + name = creatable_mongol_successor_states_number + add = 1 + } + } + # Blue Horde + if = { + limit = { + any_in_list = { + list = blue_horde_counties + count >= @creatable_successor_empire_county_threshold + } + } + debug_log = "Blue Horde is creatable" + set_global_variable = { + name = creatable_blue_horde + value = yes + } + change_global_variable = { + name = creatable_mongol_successor_states_number + add = 1 + } + } + # Omnod Dalai Khanate + if = { + limit = { + any_in_list = { + list = omnod_dalai_khanate_counties + count >= @creatable_successor_empire_county_threshold + } + } + debug_log = "Omnod Dalai Khanate is creatable" + set_global_variable = { + name = creatable_omnod_dalai_khanate + value = yes + } + change_global_variable = { + name = creatable_mongol_successor_states_number + add = 1 + } + } + # Aarlud Khanate + if = { + limit = { + any_in_list = { + list = aarlud_khanate_counties + count >= @creatable_successor_empire_county_threshold + } + } + debug_log = "Aarlud is creatable" + set_global_variable = { + name = creatable_aarlud_khanate + value = yes + } + change_global_variable = { + name = creatable_mongol_successor_states_number + add = 1 + } + } + # Tögsköl Khanate + if = { + limit = { + any_in_list = { + list = togskol_khanate_counties + count >= @creatable_successor_empire_county_threshold + } + } + debug_log = "Tögsköl is creatable" + set_global_variable = { + name = creatable_togskol_khanate + value = yes + } + change_global_variable = { + name = creatable_mongol_successor_states_number + add = 1 + } + } + # Baruun Khanate + if = { + limit = { + any_in_list = { + list = baruun_khanate_counties + count >= @creatable_successor_empire_county_threshold + } + } + debug_log = "Baruun is creatable" + set_global_variable = { + name = creatable_baruun_khanate + value = yes + } + change_global_variable = { + name = creatable_mongol_successor_states_number + add = 1 + } + } + + ordered_in_list = { + list = mongol_heir_candidates + order_by = mongol_breakup_succession_score + max = 15 + + debug_log = "Mongol succession list found:" + debug_log_scopes = yes + + add_to_list = selected_mongol_heirs + add_character_flag = { + flag = mongol_successor_flag + days = 10 + } + } + + # Find the "main" heir + + if = { + limit = { + is_ai = no + player_heir.dynasty ?= dynasty + } + player_heir = { + debug_log = "Found Mongol main heir" + debug_log_scopes = yes + + assign_core_mongol_titles_to_heir_effect = yes + + remove_from_list = selected_mongol_heirs + } + } + else = { + ordered_in_list = { + list = selected_mongol_heirs + order_by = mongol_breakup_succession_score + max = 1 + + debug_log = "Found Mongol main heir" + debug_log_scopes = yes + + assign_core_mongol_titles_to_heir_effect = yes + + remove_from_list = selected_mongol_heirs + } + } + + if = { + limit = { + is_ai = no + player_heir.dynasty ?= dynasty + player_heir = { highest_held_title_tier < tier_empire } + } + player_heir = { + grant_suitable_title_to_candidate_effect = yes + } + } + + # Assign titles to everyone else + ordered_in_list = { + list = selected_mongol_heirs + order_by = mongol_breakup_succession_score + max = global_var:creatable_mongol_successor_states_number + + debug_log = "Found another Mongol Heir" + debug_log_scopes = yes + grant_suitable_title_to_candidate_effect = yes + + debug_log = "Tried granting title to heir" + } + + pick_up_remaining_counties_effect = yes + set_correct_mongol_breakup_vassalage_effect = yes + shift_counties_on_mongol_succession_effect = yes + + # Send notification events + scope:mongolia_ruler = { + save_scope_as = successor_1 + } + + ordered_in_list = { + list = selected_mongol_heirs + order_by = mongol_breakup_succession_score + max = 3 + + if = { + limit = { + NOT = { exists = scope:successor_2 } + } + save_scope_as = successor_2 + } + else_if = { + limit = { + NOT = { exists = scope:successor_3 } + NOT = { + this = scope:successor_2 + } + } + save_scope_as = successor_3 + } + if = { + limit = { + NOT = { exists = scope:successor_4 } + NOR = { + this = scope:successor_2 + this = scope:successor_3 + } + } + save_scope_as = successor_4 + } + } + + every_player = { + trigger_event = { + id = mongol_invasion.1004 + days = 2 # Delay it a little to let effects settle + } + } + + # Cleanup + remove_global_variable = creatable_mongol_successor_states_number + remove_global_variable = number_of_mongol_heir_candidates + remove_global_variable = creatable_ilkhanate + remove_global_variable = creatable_golden_horde + remove_global_variable = creatable_chagatai + remove_global_variable = creatable_great_yuan + remove_global_variable = creatable_red_horde + remove_global_variable = creatable_white_horde + remove_global_variable = creatable_blue_horde + remove_global_variable = creatable_omnod_dalai_khanate + remove_global_variable = creatable_aarlud_khanate + remove_global_variable = creatable_togskol_khanate + remove_global_variable = creatable_baruun_khanate + + # Make sure the Mongol Empire title is destroyed as appropriate + set_global_variable = { + name = mongol_empire_was_broken_up + value = yes + } + scope:successor_1 = { + trigger_event = { + id = mongol_invasion.9999 + days = 1 + } + } + + # Assign appropriate De Jure, so that the successors do not switch away from their empires immediately + if = { + limit = { + exists = scope:chagatai_ruler + } + scope:chagatai_ruler = { + add_realm_law_skip_effects = high_partition_succession_law + save_scope_as = title_assignment + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = chagatai_de_jure_region + } + exists = kingdom + OR = { + NOT = { exists = kingdom.holder } + AND = { + exists = kingdom.holder + OR = { + kingdom.holder = scope:title_assignment + kingdom.holder = { + is_vassal_of = scope:title_assignment + } + } + } + } + holder.top_liege = scope:title_assignment + } + if = { + limit = { + NOT = { + kingdom = { + is_in_list = assigned_kingdoms + } + } + } + kingdom = { + set_de_jure_liege_title = scope:title_assignment.primary_title + add_to_list = assigned_kingdoms + } + } + } + change_mongol_successor_illegal_government = yes + } + } + if = { + limit = { + exists = scope:great_yuan_ruler + } + scope:great_yuan_ruler = { + #Should not have dejure reassignment if they got an already existing title + if = { + limit = { + scope:great_yuan_ruler.primary_title = title:e_great_yuan + } + add_realm_law_skip_effects = high_partition_succession_law + save_scope_as = title_assignment + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = great_yuan_de_jure_region + } + exists = kingdom + OR = { + NOT = { exists = kingdom.holder } + kingdom.holder = { + OR = { + this = scope:title_assignment + is_vassal_of = scope:title_assignment + } + } + } + holder.top_liege = scope:title_assignment + } + if = { + limit = { + NOT = { + kingdom = { + is_in_list = assigned_kingdoms + } + } + } + kingdom = { + set_de_jure_liege_title = scope:title_assignment.primary_title + add_to_list = assigned_kingdoms + } + } + } + } + if = { + limit = { + has_dlc_feature = admin_gov + } + convert_great_yuan_to_admin_effect = yes + } + else = { + change_mongol_successor_illegal_government = yes + } + } + } + if = { + limit = { + exists = scope:golden_horde_ruler + } + scope:golden_horde_ruler = { + add_realm_law_skip_effects = high_partition_succession_law + save_scope_as = title_assignment + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = golden_horde_de_jure_region + } + exists = kingdom + OR = { + NOT = { exists = kingdom.holder } + AND = { + exists = kingdom.holder + OR = { + kingdom.holder = scope:title_assignment + kingdom.holder = { + is_vassal_of = scope:title_assignment + } + } + } + } + holder.top_liege = scope:title_assignment + } + if = { + limit = { + NOT = { + kingdom = { + is_in_list = assigned_kingdoms + } + } + } + kingdom = { + set_de_jure_liege_title = scope:title_assignment.primary_title + add_to_list = assigned_kingdoms + } + } + } + change_mongol_successor_illegal_government = yes + } + } + if = { + limit = { + exists = scope:ilkhanate_ruler + } + scope:ilkhanate_ruler = { + add_realm_law_skip_effects = high_partition_succession_law + save_scope_as = title_assignment + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = ilkhanate_de_jure_region + } + exists = kingdom + OR = { + NOT = { exists = kingdom.holder } + AND = { + exists = kingdom.holder + OR = { + kingdom.holder = scope:title_assignment + kingdom.holder = { + is_vassal_of = scope:title_assignment + } + } + } + } + holder.top_liege = scope:title_assignment + } + if = { + limit = { + NOT = { + kingdom = { + is_in_list = assigned_kingdoms + } + } + } + kingdom = { + set_de_jure_liege_title = scope:title_assignment.primary_title + add_to_list = assigned_kingdoms + } + } + } + change_mongol_successor_illegal_government = yes + } + } + if = { + limit = { + exists = scope:red_horde_ruler + } + scope:red_horde_ruler = { + add_realm_law_skip_effects = high_partition_succession_law + save_scope_as = title_assignment + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = red_horde_de_jure_region + } + exists = kingdom + OR = { + NOT = { exists = kingdom.holder } + AND = { + exists = kingdom.holder + OR = { + kingdom.holder = scope:title_assignment + kingdom.holder = { + is_vassal_of = scope:title_assignment + } + } + } + } + holder.top_liege = scope:title_assignment + } + if = { + limit = { + NOT = { + kingdom = { + is_in_list = assigned_kingdoms + } + } + } + kingdom = { + set_de_jure_liege_title = scope:title_assignment.primary_title + add_to_list = assigned_kingdoms + } + } + } + change_mongol_successor_illegal_government = yes + } + } + if = { + limit = { + exists = scope:white_horde_ruler + } + scope:white_horde_ruler = { + add_realm_law_skip_effects = high_partition_succession_law + save_scope_as = title_assignment + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = white_horde_de_jure_region + } + exists = kingdom + OR = { + NOT = { exists = kingdom.holder } + AND = { + exists = kingdom.holder + OR = { + kingdom.holder = scope:title_assignment + kingdom.holder = { + is_vassal_of = scope:title_assignment + } + } + } + } + holder.top_liege = scope:title_assignment + } + if = { + limit = { + NOT = { + kingdom = { + is_in_list = assigned_kingdoms + } + } + } + kingdom = { + set_de_jure_liege_title = scope:title_assignment.primary_title + add_to_list = assigned_kingdoms + } + } + } + change_mongol_successor_illegal_government = yes + } + } + if = { + limit = { + exists = scope:blue_horde_ruler + } + scope:blue_horde_ruler = { + add_realm_law_skip_effects = high_partition_succession_law + save_scope_as = title_assignment + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = blue_horde_de_jure_region + } + exists = kingdom + OR = { + NOT = { exists = kingdom.holder } + AND = { + exists = kingdom.holder + OR = { + kingdom.holder = scope:title_assignment + kingdom.holder = { + is_vassal_of = scope:title_assignment + } + } + } + } + holder.top_liege = scope:title_assignment + } + if = { + limit = { + NOT = { + kingdom = { + is_in_list = assigned_kingdoms + } + } + } + kingdom = { + set_de_jure_liege_title = scope:title_assignment.primary_title + add_to_list = assigned_kingdoms + } + } + } + change_mongol_successor_illegal_government = yes + } + } + if = { + limit = { + exists = scope:omnod_dalai_khanate_ruler + } + scope:omnod_dalai_khanate_ruler = { + add_realm_law_skip_effects = high_partition_succession_law + save_scope_as = title_assignment + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = omnod_dalai_khanate_de_jure_region + } + exists = kingdom + OR = { + NOT = { exists = kingdom.holder } + AND = { + exists = kingdom.holder + OR = { + kingdom.holder = scope:title_assignment + kingdom.holder = { + is_vassal_of = scope:title_assignment + } + } + } + } + holder.top_liege = scope:title_assignment + } + if = { + limit = { + NOT = { + kingdom = { + is_in_list = assigned_kingdoms + } + } + } + kingdom = { + set_de_jure_liege_title = scope:title_assignment.primary_title + add_to_list = assigned_kingdoms + } + } + } + change_mongol_successor_illegal_government = yes + } + } + if = { + limit = { + exists = scope:aarlud_khanate_ruler + } + scope:aarlud_khanate_ruler = { + add_realm_law_skip_effects = high_partition_succession_law + save_scope_as = title_assignment + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = aarlud_khanate_de_jure_region + } + exists = kingdom + OR = { + NOT = { exists = kingdom.holder } + AND = { + exists = kingdom.holder + OR = { + kingdom.holder = scope:title_assignment + kingdom.holder = { + is_vassal_of = scope:title_assignment + } + } + } + } + holder.top_liege = scope:title_assignment + } + if = { + limit = { + NOT = { + kingdom = { + is_in_list = assigned_kingdoms + } + } + } + kingdom = { + set_de_jure_liege_title = scope:title_assignment.primary_title + add_to_list = assigned_kingdoms + } + } + } + change_mongol_successor_illegal_government = yes + } + } + if = { + limit = { + exists = scope:togskol_khanate_ruler + } + scope:togskol_khanate_ruler = { + add_realm_law_skip_effects = high_partition_succession_law + save_scope_as = title_assignment + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = togskol_khanatede_jure_region + } + exists = kingdom + OR = { + NOT = { exists = kingdom.holder } + AND = { + exists = kingdom.holder + OR = { + kingdom.holder = scope:title_assignment + kingdom.holder = { + is_vassal_of = scope:title_assignment + } + } + } + } + holder.top_liege = scope:title_assignment + } + if = { + limit = { + NOT = { + kingdom = { + is_in_list = assigned_kingdoms + } + } + } + kingdom = { + set_de_jure_liege_title = scope:title_assignment.primary_title + add_to_list = assigned_kingdoms + } + } + } + change_mongol_successor_illegal_government = yes + } + } + if = { + limit = { + exists = scope:baruun_khanate_ruler + } + scope:baruun_khanate_ruler = { + add_realm_law_skip_effects = high_partition_succession_law + save_scope_as = title_assignment + every_sub_realm_county = { + limit = { + title_province = { + geographical_region = baruun_khanate_de_jure_region + } + exists = kingdom + OR = { + NOT = { exists = kingdom.holder } + AND = { + exists = kingdom.holder + OR = { + kingdom.holder = scope:title_assignment + kingdom.holder = { + is_vassal_of = scope:title_assignment + } + } + } + } + holder.top_liege = scope:title_assignment + } + if = { + limit = { + NOT = { + kingdom = { + is_in_list = assigned_kingdoms + } + } + } + kingdom = { + set_de_jure_liege_title = scope:title_assignment.primary_title + add_to_list = assigned_kingdoms + } + } + } + change_mongol_successor_illegal_government = yes + } + } + scope:mongolia_ruler = { + #Allocate tributaries of mongol empire or give them independence + trigger_event = { + id = mongol_invasion.3000 + days = 1 + } + #Break off exclaves + trigger_event = { + id = mongol_invasion.3200 + days = 1 + } + } + every_in_list = { + list = selected_mongol_heirs + limit = { + highest_held_title_tier >= tier_empire + NOT = { + this = scope:mongolia_ruler + } + } + #Break off exclaves + trigger_event = { + id = mongol_invasion.3200 + days = 1 + } + } +} + +# Special stuff for player Temüjin, disbursed in event conqueror.0001 +temujin_conqueror_bonuses_effect = { + add_gold = 100 + add_dread = medium_dread + add_prestige = 500 + if = { + limit = { + prestige_level < 2 + } + add_prestige_level = 2 + } + else_if = { + limit = { + prestige_level < 3 + } + add_prestige_level = 1 + } + if = { + limit = { + government_has_flag = government_is_nomadic + } + if = { + limit = { + OR = { + has_realm_law = nomadic_authority_4 + has_realm_law = nomadic_authority_5 + } + } + domicile = { + change_herd = { + add = nomadic_authority_level_2_requirement + } + } + } + else = { + domicile = { + change_herd = { + value = nomadic_authority_level_4_requirement + } + } + } + + if = { + limit = { + NOR = { + has_realm_law = nomadic_authority_5 + has_realm_law = nomadic_authority_4 + } + } + hidden_effect = { + if = { + limit = { has_realm_law = nomadic_authority_1 } + remove_realm_law = nomadic_authority_1 + } + if = { + limit = { has_realm_law = nomadic_authority_2 } + remove_realm_law = nomadic_authority_2 + } + if = { + limit = { has_realm_law = nomadic_authority_3 } + remove_realm_law = nomadic_authority_3 + } + } + add_realm_law_skip_effects = nomadic_authority_4 + } + } + if = { + limit = { + is_decision_on_cooldown = nomad_higher_tier_title_decision + } + remove_decision_cooldown = nomad_higher_tier_title_decision + } + custom_tooltip = temujin_horde_gathers_tt + trigger_event = { + id = mpo_greatest_of_khans.1010 + months = { 3 9 } + } +} + +convert_great_yuan_to_admin_effect = { + save_scope_as = administrative_liege + + #Create cadet branch to ensure you have a domicile + if = { + limit = { + exists = house.house_head + NOT = { + this = house.house_head + } + } + #Create cadet branch + found_cadet_house_decision_effect = { + CHARACTER = scope:administrative_liege + PRESTIGE = 0 + } + house = { + set_coa = scope:administrative_liege.capital_province.barony + } + } + change_to_administrative_effect = yes + + #Direct Vassals who fulfill the tgp_mongol_vassal_will_become_admin criteria are converted. Vassals above 25 opinion always accept + #Vassals are converted as a hierarchy. If a king is converted we convert all who are valid below that king (so his dukes, their counts, and their barons) are all converted. + #If a vassal does not convert (because of not accepting or because they are outside of the de jure empire, etc) then the vassals below them are _not_ converted either. + + #Human vassals are given a choice to convert or not in the ping event, even if powerful or having very good relation. + + hidden_effect = { + save_scope_as = actor + every_vassal = { + limit = { + tgp_mongol_vassal_will_become_admin = yes + } + save_scope_as = recipient + change_to_administrative_effect = yes + every_vassal = { #Everyone below also converts (could be Counts, could be Dukes) + limit = { + tgp_mongol_vassal_will_become_admin = yes #We still don't want mayors and bishops + is_ai = yes + } + save_scope_as = recipient + change_to_administrative_effect = yes + every_vassal = { #Everyone below also converts (Could be Counts, could be Barons) + limit = { + tgp_mongol_vassal_will_become_admin = yes #We still don't want mayors and bishops + is_ai = yes + } + save_scope_as = recipient + change_to_administrative_effect = yes + every_vassal = { #Everyone below also converts (could be Barons) + limit = { + tgp_mongol_vassal_will_become_admin = yes #We still don't want mayors and bishops + is_ai = yes + } + save_scope_as = recipient + change_to_administrative_effect = yes + } + } + } + } + } + + if = { + limit = { + NOT = { + has_character_flag = latin_emp_force_admin_flag + } + top_liege = this + } + add_character_modifier = { + modifier = first_admin_emperor + } + } + + change_influence = 1500 + add_treasury = 2500 + + every_vassal_or_below = { + limit = { + is_ai = no + tgp_mongol_vassal_will_become_admin = yes + } + trigger_event = ep3_decisions_event.4065 + } + if = { + limit = { + exists = capital_county + NOT = { + domicile.domicile_location.county ?= capital_county + } + } + domicile = { + move_domicile = scope:administrative_liege.capital_province + } + } + if = { + limit = { + government_has_flag = government_is_celestial + highest_held_title_tier >= tier_empire + primary_title = { + has_custom_title_name = no + } + } + trigger_event = { + id = tgp_dynastic_cycle.9000 + days = 1 + } + } +} + +change_mongol_successor_illegal_government = { + trigger_event = { + id = mongol_invasion.3100 + days = 1 + } +} + +mongol_breakup_purge_mongolia_exclaves_effect = { + save_scope_as = mongol_exclaves_target + + capital_province.county = { + every_connected_county = { # Start off by making a list of all disconnected Counties + invert = yes + max_naval_distance = 2000 + allow_one_county_land_gap = yes + add_to_list = disconnected_counties + } + } + + every_in_list = { + list = disconnected_counties + + limit = { + any_connected_county = { + NOT = { is_in_list = disconnected_counties } + max_naval_distance = 2000 + } + } + add_to_list = cull_naval_connection_counties + } + + while = { + limit = { + any_in_list = { + list = cull_naval_connection_counties + } + } + random_in_list = { + list = cull_naval_connection_counties + + save_scope_as = cull_origin_county + + every_connected_county = { + remove_from_list = cull_naval_connection_counties + remove_from_list = disconnected_counties + } + remove_from_list = cull_naval_connection_counties + remove_from_list = disconnected_counties + } + } + + every_in_list = { + list = disconnected_counties + + limit = { + target_is_de_jure_liege_or_above = scope:mongol_exclaves_target.primary_title + } + add_to_list = cull_de_jure_connection_counties + } + + while = { + limit = { + any_in_list = { + list = cull_de_jure_connection_counties + } + } + random_in_list = { + list = cull_de_jure_connection_counties + + save_scope_as = cull_origin_county + + every_connected_county = { + remove_from_list = cull_de_jure_connection_counties + remove_from_list = disconnected_counties + } + remove_from_list = cull_de_jure_connection_counties + remove_from_list = disconnected_counties + } + } + #Make them vassals if they are de jure vassals of another successor + every_in_list = { # Transfer Kings first + list = disconnected_counties + + limit = { + holder.primary_title = { + tier = tier_kingdom + empire.holder ?= { + OR = { + is_in_list = selected_mongol_heirs + primary_title = title:e_mongolia + } + NOT = { + this = scope:mongol_exclaves_target + } + } + } + NOR = { + holder = scope:mongol_exclaves_target + holder = { + any_sub_realm_title = { + tier = tier_county + NOT = { is_in_list = disconnected_counties } + } + } + } + } + holder = { + create_title_and_vassal_change = { + type = swear_fealty + save_scope_as = change + add_claim_on_loss = no + } + change_liege = { + liege = primary_title.empire.holder + change = scope:change + } + resolve_title_and_vassal_change = scope:change + every_realm_county = { + limit = { + is_in_list = disconnected_counties + } + remove_from_list = disconnected_counties + } + } + } + every_in_list = { # Transfer Dukes second + list = disconnected_counties + + limit = { + holder.primary_title = { + tier = tier_duchy + empire.holder ?= { + OR = { + is_in_list = selected_mongol_heirs + primary_title = title:e_mongolia + } + NOT = { + this = scope:mongol_exclaves_target + } + } + } + NOR = { + holder = scope:mongol_exclaves_target + holder = { + any_sub_realm_title = { + tier = tier_county + NOT = { is_in_list = disconnected_counties } + } + } + } + } + holder = { + create_title_and_vassal_change = { + type = swear_fealty + save_scope_as = change + add_claim_on_loss = no + } + change_liege = { + liege = primary_title.empire.holder + change = scope:change + } + resolve_title_and_vassal_change = scope:change + every_realm_county = { + limit = { + is_in_list = disconnected_counties + } + remove_from_list = disconnected_counties + } + } + } + + every_in_list = { # transfer Counts last + list = disconnected_counties + + limit = { + holder.primary_title = { + tier = tier_county + empire.holder ?= { + OR = { + is_in_list = selected_mongol_heirs + primary_title = title:e_mongolia + } + NOT = { + this = scope:mongol_exclaves_target + } + } + } + NOR = { + holder = scope:mongol_exclaves_target + holder = { + any_sub_realm_title = { + tier = tier_county + NOT = { is_in_list = disconnected_counties } + } + } + } + } + holder = { + create_title_and_vassal_change = { + type = swear_fealty + save_scope_as = change + add_claim_on_loss = no + } + change_liege = { + liege = primary_title.empire.holder + change = scope:change + } + resolve_title_and_vassal_change = scope:change + every_realm_county = { + limit = { + is_in_list = disconnected_counties + } + remove_from_list = disconnected_counties + } + } + } + every_in_list = { # Finally, transfer contiguous areas under someone from the pool + list = disconnected_counties + + limit = { + empire.holder ?= { + OR = { + is_in_list = selected_mongol_heirs + primary_title = title:e_mongolia + } + NOT = { + this = scope:mongol_exclaves_target + } + } + OR = { + holder.top_liege = scope:mongol_exclaves_target + holder = scope:mongol_exclaves_target + } + } + + save_scope_as = county_of_origin + + every_pool_character = { + province = scope:county_of_origin.title_province + limit = { + is_available_adult = yes + } + add_to_list = potential_holders + } + + every_pool_character = { + province = scope:county_of_origin.holder.capital_province + limit = { + is_available_adult = yes + } + add_to_list = potential_holders + } + + if = { + limit = { + NOT = { + any_in_list = { + list = potential_holders + is_available_adult = yes + } + } + } + create_character = { + location = scope:county_of_origin.title_province + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + gender_female_chance = 50 + age = 32 + save_scope_as = backup_character + } + scope:backup_character = { + add_to_list = potential_holders + } + } + + random_in_list = { + list = potential_holders + limit = { + is_available_adult = yes + has_claim_on = scope:county_of_origin + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + faith = scope:county_of_origin.faith + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + has_claim_on = scope:county_of_origin + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + } + alternative_limit = { + is_available_adult = yes + faith = scope:county_of_origin.faith + } + alternative_limit = { + is_available_adult = yes + } + + save_scope_as = new_county_holder + add_character_flag = { + flag = domicile_culture_and_faith_check + days = 1 + } + + create_title_and_vassal_change = { + type = granted + save_scope_as = change + add_claim_on_loss = no + } + every_in_list = { + list = disconnected_counties + limit = { + OR = { + holder.top_liege = scope:mongol_exclaves_target + holder = scope:mongol_exclaves_target + } + is_connected_to = { + target = scope:county_of_origin + } + NOT ={ + is_connected_to = { + target = scope:mongol_exclaves_target.capital_province.county + } + } + } + change_title_holder = { + holder = scope:new_county_holder + change = scope:change + } + #scope:new_county_holder = { get_title = prev } + } + resolve_title_and_vassal_change = scope:change + + create_title_and_vassal_change = { + type = swear_fealty + save_scope_as = change + add_claim_on_loss = no + } + change_liege = { + liege = primary_title.empire.holder + change = scope:change + } + resolve_title_and_vassal_change = scope:change + # This system should not generate strange-culture nomads + if = { + limit = { + government_has_flag = government_is_nomadic + domicile.domicile_culture != scope:new_county_holder.capital_county.culture + } + domicile = { + set_domicile_culture = scope:new_county_holder.capital_county.culture + } + } + if = { + limit = { + government_has_flag = government_is_nomadic + domicile.domicile_faith != scope:new_county_holder.capital_county.faith + } + domicile = { + set_domicile_faith = scope:new_county_holder.capital_county.faith + } + } + if = { # Just in case they need to create a duchy + limit = { + gold < 500 + } + add_gold = 500 + } + } + remove_from_list = disconnected_counties + } + + #Make the rest independent + every_in_list = { # Release Kings first + list = disconnected_counties + + limit = { + holder.primary_title.tier = tier_kingdom + NOR = { + holder = scope:mongol_exclaves_target + holder = { + any_sub_realm_title = { + tier = tier_county + NOT = { is_in_list = disconnected_counties } + } + } + } + } + holder = { + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = no + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + + every_in_list = { # Release Dukes second + list = disconnected_counties + + limit = { + holder.primary_title.tier = tier_duchy + NOR = { + holder = scope:mongol_exclaves_target + holder = { + any_sub_realm_title = { + tier = tier_county + NOT = { is_in_list = disconnected_counties } + } + } + } + } + holder = { + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = no + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + + every_in_list = { # Release Counts last + list = disconnected_counties + + limit = { + holder.primary_title.tier = tier_county + NOR = { + holder = scope:mongol_exclaves_target + holder = { + any_sub_realm_title = { + tier = tier_county + NOT = { is_in_list = disconnected_counties } + } + } + } + } + holder = { + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = no + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + + every_in_list = { # Finally, release contiguous areas under someone from the pool + list = disconnected_counties + + limit = { + OR = { + holder.top_liege = scope:mongol_exclaves_target + holder = scope:mongol_exclaves_target + } + } + + save_scope_as = county_of_origin + + every_pool_character = { + province = scope:county_of_origin.title_province + limit = { + is_available_adult = yes + } + add_to_list = potential_holders + } + + every_pool_character = { + province = scope:county_of_origin.holder.capital_province + limit = { + is_available_adult = yes + } + add_to_list = potential_holders + } + + if = { + limit = { + NOT = { + any_in_list = { + list = potential_holders + is_available_adult = yes + } + } + } + create_character = { + location = scope:county_of_origin.title_province + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + gender_female_chance = 50 + age = 32 + save_scope_as = backup_character + } + scope:backup_character = { + add_to_list = potential_holders + } + } + + random_in_list = { + list = potential_holders + limit = { + is_available_adult = yes + has_claim_on = scope:county_of_origin + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + faith = scope:county_of_origin.faith + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + faith = { + has_dominant_ruling_gender = prev + } + } + alternative_limit = { + is_available_adult = yes + has_claim_on = scope:county_of_origin + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + faith = scope:county_of_origin.faith + } + alternative_limit = { + is_available_adult = yes + culture = scope:county_of_origin.culture + } + alternative_limit = { + is_available_adult = yes + faith = scope:county_of_origin.faith + } + alternative_limit = { + is_available_adult = yes + } + + save_scope_as = new_county_holder + add_character_flag = { + flag = domicile_culture_and_faith_check + days = 1 + } + #get_title = scope:county_of_origin + + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = no + } + every_in_list = { + list = disconnected_counties + limit = { + OR = { + holder.top_liege = scope:mongol_exclaves_target + holder = scope:mongol_exclaves_target + } + is_connected_to = { + target = scope:county_of_origin + } + NOT ={ + is_connected_to = { + target = scope:mongol_exclaves_target.capital_province.county + } + } + } + change_title_holder = { + holder = scope:new_county_holder + change = scope:change + } + #scope:new_county_holder = { get_title = prev } + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + # This system should not generate strange-culture nomads + if = { + limit = { + government_has_flag = government_is_nomadic + domicile.domicile_culture != scope:new_county_holder.capital_county.culture + } + domicile = { + set_domicile_culture = scope:new_county_holder.capital_county.culture + } + } + if = { + limit = { + government_has_flag = government_is_nomadic + domicile.domicile_faith != scope:new_county_holder.capital_county.faith + } + domicile = { + set_domicile_faith = scope:new_county_holder.capital_county.faith + } + } + if = { # Just in case they need to create a duchy + limit = { + gold < 500 + } + add_gold = 500 + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_murder_effects.txt b/N3OW/common/scripted_effects/00_murder_effects.txt new file mode 100644 index 00000000..0405263b --- /dev/null +++ b/N3OW/common/scripted_effects/00_murder_effects.txt @@ -0,0 +1,1036 @@ + + +murder_consequences_known_or_exposed_effect = { + $MURDERER$ = { + ###ADD TRAITS### + #Force tooltip is used for everyone but POV to make sure expose secret events looks right for everyone, even though the trait can only be added once. Kinslayer works the same way. + add_trait_only_force_tooltip_if_not_pov_effect = { TRAIT = murderer POV = $POV$ } + add_kinslayer_trait_or_nothing_effect = { VICTIM = $VICTIM$ } + + # Add piety penalty if the murder was unjust + if = { + limit = { + NOR = { + any_close_family_member = { + even_if_dead = yes + killer ?= $VICTIM$ + } + any_spouse = { + even_if_dead = yes + killer ?= $VICTIM$ + } + AND = { + faith = { has_doctrine = tenet_fp3_fedayeen } #this checks that assassins don't get piety loss for killing unbelievers + NOT = { faith = $VICTIM$.faith } + } + } + } + add_piety = medium_piety_loss + } + + # If we're a clan this affects unity + if = { + limit = { # If the victim is landed + $VICTIM$ = { is_landed = yes } + } + add_clan_unity_interaction_effect = { + CHARACTER = $MURDERER$ + TARGET = $VICTIM$ + VALUE = medium_unity_loss + DESC = clan_unity_murder.desc + REVERSE_NON_HOUSE_TARGET = no + } + } + # For unlanded characters, we don't care as much, but you still lose some unity + else = { + add_clan_unity_interaction_effect = { + CHARACTER = $MURDERER$ + TARGET = $VICTIM$ + VALUE = minor_unity_loss + DESC = clan_unity_murder.desc + REVERSE_NON_HOUSE_TARGET = no + } + } + + # Family Feud + house_feud_murder_effect = { VICTIM = $VICTIM$ MURDERER = $MURDERER$ } + + # Opinion and dread: we only show this for the murderer. + if = { + limit = { this = $POV$ } + murder_consequences_known_or_exposed_apply_dread_effect = { VICTIM = $VICTIM$ } + murder_opinion_effect = { VICTIM = $VICTIM$ MURDERER = $MURDERER$ } + } + # There are some things you just shouldn't do + show_as_tooltip = { + if = { + limit = { + $VICTIM$ = { has_character_flag = is_party_baron } + } + add_character_modifier = { modifier = party_baron_murdered_the_joy_of_life_modifier } + } + } + hidden_effect = { + if = { + limit = { + OR = { + exists = local_var:murdered_party_baron + exists = scope:secret.var:murdered_party_baron + } + } + add_character_modifier = { modifier = party_baron_murdered_the_joy_of_life_modifier } + } + } + } + + # Struggle Catalysts. + if = { + limit = { + $VICTIM$ = { is_vip_struggle_character = yes } + $MURDERER$ = { + any_character_struggle = { + involvement = involved + activate_struggle_catalyst_secondary_character_involvement_involved_trigger = { + CATALYST = catalyst_discovery_of_very_important_murder + CHAR = scope:victim + } + } + } + } + $MURDERER$ = { + every_character_struggle = { + involvement = involved + limit = { + activate_struggle_catalyst_secondary_character_involvement_involved_trigger = { + CATALYST = catalyst_discovery_of_very_important_murder + CHAR = scope:victim + } + } + activate_struggle_catalyst = { + catalyst = catalyst_discovery_of_very_important_murder + character = $MURDERER$ + } + } + } + } +} + +murder_consequences_known_or_exposed_hidden_opinion_effect = { + $MURDERER$ = { + ###ADD TRAITS### + #Force tooltip is used for everyone but POV to make sure expose secret events looks right for everyone, even though the trait can only be added once. Kinslayer works the same way. + add_trait_only_force_tooltip_if_not_pov_effect = { TRAIT = murderer POV = $POV$ } + add_kinslayer_trait_or_nothing_effect = { VICTIM = $VICTIM$ } + + if = { #Add piety penalty if the murder was unjust + limit = { + NOR = { + any_close_family_member = { + even_if_dead = yes + killer ?= $VICTIM$ + } + any_spouse = { + even_if_dead = yes + killer ?= $VICTIM$ + } + AND = { + faith = { has_doctrine = tenet_fp3_fedayeen } #this checks that assassins don't get piety loss for killing unbelievers + NOT = { faith = $VICTIM$.faith } + } + } + } + add_piety = medium_piety_loss + } + + # Family Feud + house_feud_murder_effect = { VICTIM = $VICTIM$ MURDERER = $MURDERER$ } + + ###OPINION AND DREAD### + #Hide this from POV if they're not the murderer + if = { + limit = { this = $POV$ } + add_dread = 15 + hidden_effect = { + murder_opinion_effect = { VICTIM = $VICTIM$ MURDERER = $MURDERER$ } + } + } + else = { + hidden_effect = { + add_dread = 15 + murder_opinion_effect = { VICTIM = $VICTIM$ MURDERER = $MURDERER$ } + } + } + # There are some things you just shouldn't do + show_as_tooltip = { + if = { + limit = { $VICTIM$ = { has_character_flag = is_party_baron } } + add_character_modifier = { + modifier = party_baron_murdered_the_joy_of_life_modifier + } + } + } + hidden_effect = { + if = { + limit = { + OR = { + exists = local_var:murdered_party_baron + exists = scope:secret.var:murdered_party_baron + } + } + add_character_modifier = { + modifier = party_baron_murdered_the_joy_of_life_modifier + } + } + } + } + + # Struggle Catalysts. + if = { + limit = { + $VICTIM$ = { is_vip_struggle_character = yes } + $MURDERER$ = { + any_character_struggle = { + involvement = involved + activate_struggle_catalyst_secondary_character_involvement_involved_trigger = { + CATALYST = catalyst_discovery_of_very_important_murder + CHAR = scope:victim + } + } + } + } + $MURDERER$ = { + every_character_struggle = { + involvement = involved + limit = { + activate_struggle_catalyst_secondary_character_involvement_involved_trigger = { + CATALYST = catalyst_discovery_of_very_important_murder + CHAR = scope:victim + } + } + activate_struggle_catalyst = { + catalyst = catalyst_discovery_of_very_important_murder + character = $MURDERER$ + } + } + } + } +} + +unknown_murder_effect = { + # Party Baron handling + if = { + limit = { $VICTIM$ = { has_character_flag = is_party_baron } } + set_local_variable = { + name = murdered_party_baron + value = yes + } + } + # If we're a clan this affects unity + if = { + limit = { # If the victim is landed + $VICTIM$ = { is_landed = yes } + } + add_clan_unity_interaction_effect = { + CHARACTER = $MURDERER$ + TARGET = $VICTIM$ + VALUE = minor_unity_loss + DESC = clan_unity_murder_unknown.desc + REVERSE_NON_HOUSE_TARGET = no + } + } + else = { # For unlanded characters, we don't care as much, but you still lose some unity + add_clan_unity_interaction_effect = { + CHARACTER = $MURDERER$ + TARGET = $VICTIM$ + VALUE = miniscule_unity_loss + DESC = clan_unity_murder_unknown.desc + REVERSE_NON_HOUSE_TARGET = no + } + } + $VICTIM$ = { + #Killed by murder: set this up first to keep the killer hidden. + hidden_effect = { + death = { + killer = $MURDERER$ + death_reason = $REASON$ + } + } + # Hide murderer in tooltip + show_as_tooltip = { + death = { death_reason = $REASON$ } + } + } + $MURDERER$ = { + if = { + limit = { is_alive = yes } + hidden_effect = { + add_secret = { + type = secret_murder + target = $VICTIM$ + } + } + if = { + limit = { exists = local_var:murdered_party_baron } + random_secret = { + type = secret_murder + limit = { + secret_target = $VICTIM$ + } + set_variable = { + name = murdered_party_baron + value = yes + } + } + } + } + } +} + +#If it's a cannibal eating you - so that that fact is saved for future reference +unknown_cannibal_murder_effect = { + $VICTIM$ = { + death = { + death_reason = death_mysterious + killer = $MURDERER$ + } + } + $MURDERER$ = { + add_secret = { + type = secret_murder + target = $VICTIM$ + } + random_secret = { + type = secret_murder + limit = { + secret_target = $VICTIM$ + } + set_variable = { #To set the right death reason if the secret is revealed + name = was_eaten_by_cannibal + value = yes + } + } + } +} + +#Your head is turned into a bell chime +unknown_bell_murder_effect = { + $VICTIM$ = { + death = { + death_reason = death_mysterious + killer = $MURDERER$ + } + } + $MURDERER$ = { + add_secret = { + type = secret_murder + target = $VICTIM$ + } + random_secret = { + type = secret_murder + limit = { + secret_target = $VICTIM$ + } + save_scope_as = bell_secret + set_variable = { #To set the right death reason if the secret is revealed + name = was_turned_into_bell_chime + value = yes + } + } + } +} + + +#KNOWN MURDER + +# Exposer can be another character, or the murderer themselves if no specific character makes sense +known_murder_effect = { + $VICTIM$ = { save_scope_as = victim_scope } + $MURDERER$ = { save_scope_as = murderer_scope } + hidden_effect = { + if = { + limit = { $VICTIM$ = { has_character_flag = is_party_baron } } + set_local_variable = { + name = murdered_party_baron + value = yes + } + } + } + # If we're a clan this affects unity + if = { + limit = { # If the victim is landed + $VICTIM$ = { is_landed = yes } + } + add_clan_unity_interaction_effect = { + CHARACTER = $MURDERER$ + TARGET = $VICTIM$ + VALUE = medium_unity_loss + DESC = clan_unity_murder.desc + REVERSE_NON_HOUSE_TARGET = no + } + } + else = { # For unlanded characters, we don't care as much, but you still lose some unity + add_clan_unity_interaction_effect = { + CHARACTER = $MURDERER$ + TARGET = $VICTIM$ + VALUE = minor_unity_loss + DESC = clan_unity_murder.desc + REVERSE_NON_HOUSE_TARGET = no + } + } + $VICTIM$ = { + every_close_family_member = { + limit = { + NOR = { + this = $MURDERER$ + is_scheming_against = { + target = $VICTIM$ + type = murder + } + has_any_bad_relationship_with_character_trigger = { CHARACTER = $VICTIM$ } + trigger_if = { + limit = { exists = scope:scheme } + scope:scheme = { scheme_is_character_agent = prev } + } + } + opinion = { + target = $VICTIM$ + value > -50 + } + } + hidden_effect = { + random = { + chance = 25 + modifier = { + factor = 2 + has_trait = wrathful + } + modifier = { + factor = 2 + has_trait = vengeful + } + modifier = { + factor = 2 + has_any_good_relationship_with_character_trigger = { CHARACTER = $VICTIM$ } + } + modifier = { + factor = 2 + OR = { + is_parent_of = $VICTIM$ + is_child_of = $VICTIM$ + } + } + trigger_event = { + id = bp1_yearly.8050 + days = 15 + } + } + } + } + death = { + death_reason = death_murder + killer = $MURDERER$ + } + hidden_effect = { set_killer_public = yes } + } + $MURDERER$ = { + hidden_effect = { + add_secret = { + type = secret_murder + target = $VICTIM$ + } + random_secret = { + type = secret_murder + limit = { + secret_target = $VICTIM$ + } + + set_variable = { + name = known_murder + value = yes + } + + expose_secret = $EXPOSER$ + } + } + } + show_as_tooltip = { + murder_consequences_known_or_exposed_effect = { + MURDERER = $MURDERER$ + VICTIM = $VICTIM$ + POV = root + } + } + # Family Feud + house_feud_murder_effect = { VICTIM = $VICTIM$ MURDERER = $MURDERER$ } +} + +known_murder_hidden_opinion_effect = { + $VICTIM$ = { save_scope_as = victim_scope } + $MURDERER$ = { save_scope_as = murderer_scope } + hidden_effect = { + if = { + limit = { $VICTIM$ = { has_character_flag = is_party_baron } } + set_local_variable = { + name = murdered_party_baron + value = yes + } + } + } + $VICTIM$ = { + every_close_family_member = { + limit = { + NOR = { + this = $MURDERER$ + is_scheming_against = { + target = $VICTIM$ + type = murder + } + has_any_bad_relationship_with_character_trigger = { CHARACTER = $VICTIM$ } + trigger_if = { + limit = { exists = scope:scheme } + scope:scheme = { scheme_is_character_agent = prev } + } + } + opinion = { + target = $VICTIM$ + value > -50 + } + } + hidden_effect = { + random = { + chance = 25 + modifier = { + factor = 2 + has_trait = wrathful + } + modifier = { + factor = 2 + has_trait = vengeful + } + modifier = { + factor = 2 + has_any_good_relationship_with_character_trigger = { CHARACTER = $VICTIM$ } + } + modifier = { + factor = 2 + OR = { + is_parent_of = $VICTIM$ + is_child_of = $VICTIM$ + } + } + trigger_event = { + id = bp1_yearly.8050 + days = 15 + } + } + } + } + death = { + death_reason = death_murder + killer = $MURDERER$ + } + hidden_effect = { set_killer_public = yes } + } + $MURDERER$ = { + hidden_effect = { + add_secret = { + type = secret_murder + target = $VICTIM$ + } + random_secret = { + type = secret_murder + limit = { + secret_target = $VICTIM$ + } + + set_variable = { + name = known_murder + value = yes + } + + expose_secret = $EXPOSER$ + } + } + } + show_as_tooltip = { + murder_consequences_known_or_exposed_hidden_opinion_effect = { + MURDERER = $MURDERER$ + VICTIM = $VICTIM$ + POV = root + } + } + # Family Feud + house_feud_murder_effect = { VICTIM = $VICTIM$ MURDERER = $MURDERER$ } +} + + +murder_opinion_effect = { + $VICTIM$ = { + #Victim's family + every_spouse = { + limit = { NOT = { this = $MURDERER$ } } + add_to_temporary_list = close_family_murder_opinion_list + } + every_close_family_member = { + limit = { NOT = { this = $MURDERER$ } } + add_to_temporary_list = close_family_murder_opinion_list + } + + if = { + limit = { + any_in_list = { + list = close_family_murder_opinion_list + always = yes + } + } + every_in_list = { + list = close_family_murder_opinion_list + custom = all_close_family_and_spouses + + add_opinion = { + target = $MURDERER$ + modifier = murdered_close_family_crime + } + } + } + #Victim's friends and lovers + every_relation = { + type = friend + limit = { + NOR = { + this = $MURDERER$ + this = $VICTIM$ + is_in_list = close_family_murder_opinion_list + } + } + add_to_list = victim_close_relations_list + } + every_relation = { + type = lover + limit = { + NOR = { + this = $MURDERER$ + this = $VICTIM$ + is_in_list = close_family_murder_opinion_list + is_in_list = victim_close_relations_list + } + } + add_to_list = victim_close_relations_list + } + if = { + limit = { + any_in_list = { + list = victim_close_relations_list + always = yes + } + } + every_in_list = { + list = victim_close_relations_list + custom = all_friends_and_lovers + add_opinion = { + target = $MURDERER$ + modifier = executed_close_relation_opinion + } + } + } + } +} + + +attempted_murder_opinion_effect = { + $VICTIM$ = { + if = { + limit = { is_alive = yes } + add_opinion = { + target = $MURDERER$ + modifier = attempted_murder_me_crime + } + hidden_effect = { + add_opinion = { + target = $MURDERER$ + modifier = murder_personal_grudge_opinion + years = 2 + } + } + } + + every_spouse = { + limit = { NOT = { this = $MURDERER$ } } + add_to_temporary_list = close_family_murder_opinion_list + } + every_close_family_member = { + limit = { NOT = { this = $MURDERER$ } } + add_to_temporary_list = close_family_murder_opinion_list + } + + if = { + limit = { + any_in_list = { + list = close_family_murder_opinion_list + count >= 1 + NOT = { + is_scheming_against = { + target = $VICTIM$ + type = murder + } + } + } + } + every_in_list = { + list = close_family_murder_opinion_list + limit = { + NOT = { + is_scheming_against = { + target = $VICTIM$ + type = murder + } + } + } + custom = all_close_family_and_spouses + add_opinion = { + target = $MURDERER$ + modifier = attempted_murder_close_family_crime + years = 20 + } + } + } + + if = { + limit = { + exists = house + exists = $MURDERER$.house + } + house = { + change_house_relation_effect = { + HOUSE = $MURDERER$.house + VALUE = house_relation_damage_medium_value + REASON = murder_attempt + CHAR = $MURDERER$ + TARGET_CHAR = root + TITLE = scope:dummy_gender + } + } + } + } +} + +abduct_opinion_effect = { + $VICTIM$ = { + add_opinion = { + target = $ABDUCTER$ + modifier = abducted_me_crime + } + #Victim's family + every_spouse = { + limit = { NOT = { this = $ABDUCTER$ } } + add_to_temporary_list = close_family_abduct_opinion_list + } + every_close_family_member = { + limit = { NOT = { this = $ABDUCTER$ } } + add_to_temporary_list = close_family_abduct_opinion_list + } + + if = { + limit = { + any_in_list = { + list = close_family_abduct_opinion_list + always = yes + } + } + every_in_list = { + list = close_family_abduct_opinion_list + custom = all_close_family_and_spouses + + add_opinion = { + target = $ABDUCTER$ + modifier = abducted_close_family_crime + } + } + } + #Victim's friends and lovers + every_relation = { + type = friend + limit = { + NOR = { + this = $ABDUCTER$ + is_in_list = close_family_abduct_opinion_list + } + } + add_to_list = victim_close_relations_list + } + every_relation = { + type = lover + limit = { + NOR = { + this = $VICTIM$ + is_in_list = close_family_abduct_opinion_list + is_in_list = victim_close_relations_list + } + } + add_to_list = victim_close_relations_list + } + if = { + limit = { + any_in_list = { + list = victim_close_relations_list + always = yes + } + } + every_in_list = { + list = victim_close_relations_list + custom = all_friends_and_lovers + add_opinion = { + target = $ABDUCTER$ + modifier = abducted_close_relation_opinion + } + } + } + } +} + +attempted_abduction_opinion_effect = { + $VICTIM$ = { + if = { + limit = { is_alive = yes } + add_opinion = { + target = $ABDUCTER$ + modifier = attempted_abduct_me_crime + } + hidden_effect = { + add_opinion = { + target = $ABDUCTER$ + modifier = murder_personal_grudge_opinion + years = 2 + } + } + } + every_spouse = { + limit = { NOT = { this = $ABDUCTER$ } } + add_to_temporary_list = close_family_abduct_opinion_list + } + every_close_family_member = { + limit = { NOT = { this = $ABDUCTER$ } } + add_to_temporary_list = close_family_abduct_opinion_list + } + + if = { + limit = { + any_in_list = { + list = close_family_abduct_opinion_list + always = yes + } + } + every_in_list = { + list = close_family_abduct_opinion_list + custom = all_close_family_and_spouses + + add_opinion = { + target = $ABDUCTER$ + modifier = attempted_abduct_close_family_crime + years = 20 + } + } + } + + } +} + + +#Pick a Local Creepy Crawly +set_local_venomous_creature_effect = { + random_list = { + 10 = { + save_scope_value_as = { + name = venomous_creature + value = flag:rare_spider ##Very rare, as spiders poisonous enough to kill a man would need to come from VERY far + } + } + 500 = { + save_scope_value_as = { + name = venomous_creature + value = flag:red_scorpion #India, Nepal + } + modifier = { + factor = 0 + trigger_if = { + limit = { + exists = location + } + NOT = { + location = { geographical_region = world_india } + } + } + } + } + 1000 = { + save_scope_value_as = { + name = venomous_creature + value = flag:deathstalker #North Africa or Middle East + } + modifier = { + factor = 0 + trigger_if = { + limit = { + exists = location + } + location = { + NOR = { + geographical_region = world_africa_north + geographical_region = world_middle_east_jerusalem + geographical_region = world_middle_east_persia + } + } + } + } + } + 500 = { + save_scope_value_as = { + name = venomous_creature + value = flag:fat_tail #Arabia, Middle East, Egypt + } + modifier = { + factor = 0 + trigger_if = { + limit = { + exists = location + } + location = { + NOR = { + geographical_region = world_middle_east + geographical_region = world_africa_north_east + } + } + } + } + } + 200 = { + save_scope_value_as = { + name = venomous_creature + value = flag:viper #Everywhere - fallback + } + } + 500 = { + save_scope_value_as = { + name = venomous_creature + value = flag:mamba #Sub-saharan Africa + } + modifier = { + factor = 0 + trigger_if = { + limit = { + exists = location + } + NOT = { + location = { geographical_region = world_africa_west } + } + } + } + } + 250 = { + save_scope_value_as = { + name = venomous_creature + value = flag:boomslang #Sub-saharan Africa + } + modifier = { + factor = 0 + trigger_if = { + limit = { + exists = location + } + NOT = { + location = { geographical_region = world_africa_west } + } + } + } + } + 250 = { + save_scope_value_as = { + name = venomous_creature + value = flag:king_cobra #South-east Asia + India + } + modifier = { + factor = 0 + trigger_if = { + limit = { + exists = location + } + location = { + NOR = { + geographical_region = world_india + geographical_region = world_burma + geographical_region = world_asia_southeast + } + } + } + } + } + 1000 = { + save_scope_value_as = { + name = venomous_creature + value = flag:daboia #India + } + modifier = { + factor = 0 + trigger_if = { + limit = { + exists = location + } + NOT = { + location = { geographical_region = world_india } + } + } + } + } + 500 = { + save_scope_value_as = { + name = venomous_creature + value = flag:saw_scale #North Africa, Middle East, Pakistan, India + } + modifier = { + factor = 0 + trigger_if = { + limit = { + exists = location + } + location = { + NOR = { + geographical_region = world_africa_north + geographical_region = world_middle_east + geographical_region = world_india + } + } + } + } + } + 500 = { + save_scope_value_as = { + name = venomous_creature + value = flag:krait #Pakistan, India, Southeast Asia + } + modifier = { + factor = 0 + trigger_if = { + limit = { + exists = location + } + location = { + NOR = { + geographical_region = world_india + geographical_region = world_burma + } + } + } + } + } + 1 = { + save_scope_value_as = { + name = venomous_creature + value = flag:beaked_mammal #Australia + } + modifier = { + factor = 0 + stewardship <= 35 #Errr, *amazing* trade routes, I guess? + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_music_effects.txt b/N3OW/common/scripted_effects/00_music_effects.txt new file mode 100644 index 00000000..d601821c --- /dev/null +++ b/N3OW/common/scripted_effects/00_music_effects.txt @@ -0,0 +1,14 @@ +# plays a music cue once per player character's lifetime +# example use : play_music_cue_once = { TRACK = "mx_cue_combat_stinger" } +play_music_cue_once = { + if = { + limit = { + is_ai = no + NOT = { + has_character_flag = played_$TRACK$ + } + } + add_character_flag = played_$TRACK$ + play_music_cue = $TRACK$ + } +} diff --git a/N3OW/common/scripted_effects/00_nickname_effects.txt b/N3OW/common/scripted_effects/00_nickname_effects.txt new file mode 100644 index 00000000..8e3dd22b --- /dev/null +++ b/N3OW/common/scripted_effects/00_nickname_effects.txt @@ -0,0 +1,6402 @@ +set_nickname_effect = { + if = { + limit = { + NAND = { # I cannot already have a bad nickname if the nickname I'm getting is also bad + has_bad_nickname = yes + is_bad_nickname = $NICKNAME$ + } + OR = { # Has no nickname or a bad nickname + NOT = { has_any_nickname = yes } + has_bad_nickname = yes + } + } + give_nickname = $NICKNAME$ + } +} + +chance_for_random_nickname_effect = { + random = { + chance = random_nickname_chance + #chance = 100 # For testing + save_scope_value_as = { + name = toggle_null_result + value = yes + } + assign_random_nickname_effect = yes + } +} + +flag_random_nickname_as_taken_in_batch_effect = { + save_scope_value_as = { + name = had_$NICK$ + value = yes + } +} + +assign_random_nickname_effect = { + save_scope_as = nickname_root_scope + if = { + limit = { + is_adult = yes + has_any_nickname = no + NOT = { government_has_flag = government_is_mercenary } + NOT = { has_game_rule = random_nickname_frequency_none } + } + random_list = { + 100 = { + trigger = { + exists = scope:toggle_null_result + } + # To make rare nicknames even rarer + } + 100 = { + trigger = { + is_male = yes + has_trait = stubborn + has_trait = impatient + NOR = { + prestige_level >= 3 + portrait_shared_clothing_contents_trigger = { # They have a chance to be bald normally; it's not weird or tease-worthy + CULTURE_SCOPE = culture + CULTURE_FLAG = african + } + is_bald_trigger = yes + exists = scope:had_nick_the_actually_bald + } + } + modifier = { + prestige_level < 2 + factor = 2 + } + give_nickname = nick_the_bald_ironic + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_bald_ironic } + trigger_event = lifestyle_nicknames.1000 + } + 10 = { + trigger = { + is_male = yes + age >= 30 + stress >= 100 + NOR = { + portrait_shared_clothing_contents_trigger = { # They have a chance to be bald normally; it's not weird or tease-worthy + CULTURE_SCOPE = culture + CULTURE_FLAG = african + } + is_bald_trigger = yes + exists = scope:had_nick_the_actually_bald + } + } + modifier = { + add = age + } + give_nickname = nick_the_actually_bald + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_actually_bald } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + NOR = { + has_trait = crusader_king + mpo_has_gok_mongol_empire_trigger = yes + } + has_personality_extroverted_trigger = yes + NOT = { + any_realm_county = { + culture = scope:nickname_root_scope.culture + } + } + NOT = { + primary_title ?= { + any_past_holder = { + has_nickname = nick_the_stranger + } + } + } + is_landed = yes + NOT = { exists = scope:had_nick_the_stranger } + } + modifier = { + NOT = { + any_realm_county = { + culture = { + cultural_acceptance = { target = scope:nickname_root_scope.culture value >= 40 } + } + } + } + factor = 2 + } + give_nickname = nick_the_stranger + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_stranger } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + is_playable_character = yes + NOR = { + any_sub_realm_county = { + faith = scope:nickname_root_scope.faith + } + AND = { + top_liege != this + faith = liege.faith + } + government_has_flag = government_is_theocracy + government_has_flag = government_is_landless_adventurer + } + NOT = { exists = scope:had_nick_the_faith } + } + modifier = { + has_trait = zealous + factor = 2 + } + give_nickname = nick_the_faith + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_faith } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = deceitful + has_trait = fickle + has_trait = ambitious + has_trait = greedy + } + NOR = { + has_trait = shy + has_trait = calm + } + ai_boldness >= 75 + ai_honor < -75 + NOT = { exists = scope:had_nick_troublemaker } + } + modifier = { + ai_honor <= -100 + factor = 2 + } + give_nickname = nick_troublemaker + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_troublemaker } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait_extroverted_trigger = no + has_trait_levelheaded_trigger = yes + OR = { + has_trait = calm + has_trait = patient + has_trait = content + has_trait = compassionate + } + days_of_continuous_peace >= 3650 + NOT = { exists = scope:had_nick_the_peaceful } + } + modifier = { + calc_true_if = { + amount >= 2 + has_trait = calm + has_trait = patient + has_trait = content + has_trait = compassionate + } + factor = 2 + } + give_nickname = nick_the_peaceful + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_peaceful } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + days_of_continuous_peace >= 700 + ai_has_economical_boom_personality = yes + any_held_title = { + count >= 4 + title_tier = county + title_province = { + has_ongoing_construction = yes + } + } + NOT = { exists = scope:had_nick_the_builder } + } + modifier = { + any_held_title = { + count = all + title_tier = county + title_province = { + has_ongoing_construction = yes + } + } + factor = 2 + } + give_nickname = nick_the_builder + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_builder } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + is_male = yes + has_trait = lazy + OR = { + has_trait = drunkard + has_trait = hashishiyah + } + NOT = { + prestige_level >= 3 + } + is_bald_trigger = no + NOT = { exists = scope:had_nick_the_hairy } + } + modifier = { + prestige_level < 2 + factor = 2 + } + give_nickname = nick_the_hairy + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_hairy } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + is_in_civil_war = yes + tyranny > 0 + diplomacy <= 8 + NOT = { exists = scope:had_nick_the_unready } + } + modifier = { + diplomacy <= 4 + factor = 2 + } + give_nickname = nick_the_unready + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_unready } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = wrathful + has_trait = irritable + has_trait = impatient + has_trait = ambitious + } + is_at_war = yes + any_character_war = { + primary_attacker = scope:nickname_root_scope + } + ai_boldness >= 50 + NOT = { exists = scope:had_nick_the_quarreller } + } + modifier = { + calc_true_if = { + amount >= 2 + has_trait = wrathful + has_trait = irritable + has_trait = impatient + has_trait = ambitious + } + factor = 2 + } + give_nickname = nick_the_quarreller + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_quarreller } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_personality_dominant_trigger = yes + has_trait = stubborn + is_at_war = yes + any_character_war = { + primary_attacker = scope:nickname_root_scope + OR = { + using_cb = claimant_faction_war + using_cb = claim_cb + } + } + NOT = { exists = scope:had_nick_the_determined } + } + modifier = { + ai_boldness >= 50 + factor = 2 + } + give_nickname = nick_the_determined + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_determined } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = wrathful + has_trait = irritable + has_trait = impatient + } + is_at_war = yes + any_character_war = { + primary_attacker = scope:nickname_root_scope + attacker_war_score <= -50 + } + NOT = { exists = scope:had_nick_the_rash } + } + modifier = { + calc_true_if = { + amount >= 2 + has_trait = wrathful + has_trait = irritable + has_trait = impatient + } + factor = 2 + } + give_nickname = nick_the_rash + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_rash } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = arrogant + OR = { + has_trait = wrathful + has_trait = irritable + has_trait = impatient + } + is_at_war_as_attacker = yes + NOT = { exists = scope:had_nick_the_hotspur } + } + modifier = { + calc_true_if = { + amount >= 2 + has_trait = wrathful + has_trait = irritable + has_trait = impatient + } + factor = 2 + } + give_nickname = nick_the_hotspur + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_hotspur } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = deceitful + has_trait = arbitrary + has_trait = ambitious + has_trait = callous + has_trait = sadistic + has_trait = disloyal + } + any_killed_character = { + is_close_family_of = scope:nickname_root_scope + } + NOT = { exists = scope:had_nick_the_traitor } + } + modifier = { + is_at_war_with_liege = yes + factor = 2 + } + give_nickname = nick_the_traitor + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_traitor } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_personality_malicious_trigger = yes + any_killed_character = { + count >= 10 + death_reason = death_execution + } + NOT = { exists = scope:had_nick_the_executioner } + } + give_nickname = nick_the_executioner + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_executioner } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + prestige_level >= 5 + piety_level >= 3 + realm_size >= 30 + top_liege = this + NOT = { exists = scope:had_nick_the_great } + } + modifier = { + has_trait = conqueror + factor = 20 + } + modifier = { + piety_level >= 5 + factor = 2 + } + give_nickname = nick_the_great + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_great } + trigger_event = lifestyle_nicknames.1000 + } + 50 = { + trigger = { + religion = religion:christianity_religion + has_trait = faith_warrior + NOT = { exists = scope:had_nick_the_crusader } + } + modifier = { + has_education_martial_trigger = yes + factor = 4 + } + give_nickname = nick_the_crusader + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_crusader } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + martial >= 16 + is_at_war = yes + any_character_war = { + primary_attacker = { + this = scope:nickname_root_scope + current_military_strength >= prev.primary_defender.current_military_strength + } + attacker_war_score >= 50 + } + ai_boldness >= 50 + NOT = { exists = scope:had_nick_the_hammer } + } + modifier = { + has_trait = conqueror + factor = 10 + } + modifier = { + ai_boldness >= 100 + factor = 2 + } + give_nickname = nick_the_hammer + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_hammer } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = brave + is_in_army = yes + martial >= 12 + prowess >= 12 + has_trait_submissive_trigger = no + NOT = { exists = scope:had_nick_the_lionheart } + } + modifier = { + martial >= 16 + prowess >= 16 + factor = 2 + } + modifier = { + has_trait = conqueror + factor = 10 + } + give_nickname = nick_the_lionheart + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_lionheart } + trigger_event = lifestyle_nicknames.1000 + } + 50 = { + trigger = { + learning >= 20 + has_personality_dominant_trigger = yes + has_personality_extroverted_trigger = yes + NOT = { exists = scope:had_nick_the_turbulent } + } + modifier = { + is_clergy = yes + factor = 2 + } + give_nickname = nick_the_turbulent + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_turbulent } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = witch + NOT = { faith = { has_doctrine = doctrine_witchcraft_accepted } } + NOT = { exists = scope:had_nick_the_witch } + } + modifier = { + piety_level <= 1 + factor = 2 + } + give_nickname = nick_the_witch + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_witch } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + piety_level <= 0 + ai_rationality <= -50 + NOT = { exists = scope:had_nick_the_bewitched } + } + give_nickname = nick_the_bewitched + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_bewitched } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = drunkard + prestige_level <= 2 + NOT = { exists = scope:had_nick_the_drunkard } + } + modifier = { + prestige_level <= 1 + factor = 2 + } + give_nickname = nick_the_drunkard + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_drunkard } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = drunkard + prestige_level <= 2 + faith = faith:norse_pagan + NOT = { exists = scope:had_nick_ale_lover } + } + modifier = { + prestige_level <= 1 + factor = 2 + } + give_nickname = nick_ale_lover + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_ale_lover } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + culture = { has_cultural_tradition = tradition_seafaring } + location = { is_sea_province = yes } + NOT = { exists = scope:had_nick_the_navigator } + } + modifier = { + prestige_level >= 1 + factor = 2 + } + give_nickname = nick_the_navigator + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_navigator } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = lifestyle_poet + has_trait = gregarious + NOT = { exists = scope:had_nick_the_troubadour } + } + modifier = { + has_trait_extroverted_trigger = yes + factor = 2 + } + give_nickname = nick_the_troubadour + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_troubadour } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = greedy + has_trait = avaricious + has_trait = gluttonous + } + ai_greed >= 50 + gold >= 200 + NOT = { exists = scope:had_nick_the_greedy } + } + modifier = { + has_trait = greedy + factor = 2 + } + give_nickname = nick_the_greedy + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_greedy } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + culture = culture:anglo_saxon + is_male = yes + OR = { + has_trait = greedy + has_trait = avaricious + has_trait = gluttonous + } + ai_greed >= 50 + gold >= 200 + NOT = { exists = scope:had_nick_pennyfather } + } + modifier = { + has_trait = greedy + factor = 2 + } + give_nickname = nick_pennyfather + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_pennyfather } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = comfort_eater + has_trait = gluttonous + } + has_personality_introverted_trigger = no + faith = faith:norse_pagan + NOT = { exists = scope:had_nick_foul_fart } + } + modifier = { + has_personality_extroverted_trigger = yes + factor = 2 + } + give_nickname = nick_foul_fart + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_foul_fart } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_personality_submissive_trigger = yes + has_personality_introverted_trigger = yes + is_at_war = no + NOT = { exists = scope:had_nick_the_timid } + } + modifier = { + has_trait = craven + factor = 2 + } + give_nickname = nick_the_timid + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_timid } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + prestige_level >= 1 + any_powerful_vassal = { + count >= 5 + } + any_powerful_vassal = { + count = all + opinion = { + target = scope:nickname_root_scope + value >= 25 + } + } + NOT = { exists = scope:had_nick_the_worthy } + } + modifier = { + prestige_level >= 3 + factor = 2 + } + give_nickname = nick_the_worthy + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_worthy } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + any_powerful_vassal = { + count >= 5 + } + any_powerful_vassal = { + count = all + opinion = { + target = scope:nickname_root_scope + value <= -25 + } + } + NOT = { exists = scope:had_nick_the_unworthy } + } + modifier = { + prestige_level <= 0 + factor = 2 + } + give_nickname = nick_the_unworthy + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_unworthy } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + NOT = { exists = scope:had_nick_the_unfaithful } + any_relation = { type = lover } + any_child = { + OR = { + has_trait = bastard + has_trait = legitimized_bastard + } + } + exists = primary_spouse + exposed_cheating_on_spouse_trigger = { SPOUSE = primary_spouse } + } + give_nickname = nick_the_unfaithful + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_unfaithful } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + is_male = yes + any_child = { + count >= 5 + mother ?= { + is_married = yes + NOT = { + is_consort_of = scope:nickname_root_scope + } + } + } + any_child = { + count = all + mother ?= { + is_married = yes + NOT = { + is_consort_of = scope:nickname_root_scope + } + add_to_temporary_list = cuckoo + } + } + any_in_list = { + list = cuckoo + count >= 5 + } + NOT = { exists = scope:had_nick_cuckoo } + } + give_nickname = nick_cuckoo + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_cuckoo } + trigger_event = lifestyle_nicknames.1000 + } + 50 = { + trigger = { + is_male = yes + culture = culture:anglo_saxon + any_child = { + count >= 10 + } + NOT = { exists = scope:had_nick_aurei_testiculi } + } + give_nickname = nick_aurei_testiculi + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_aurei_testiculi } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + NOT = { exists = scope:had_nick_the_unchaste } + any_relation = { type = lover } + any_child = { + OR = { + has_trait = bastard + has_trait = legitimized_bastard + } + } + exists = primary_spouse + exposed_cheating_on_spouse_trigger = { SPOUSE = primary_spouse } + } + give_nickname = nick_the_unchaste + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_unchaste } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + num_of_relation_lover >= 3 + NOT = { exists = scope:had_nick_the_beguiling } + } + modifier = { + OR = { + has_trait = beauty_good + has_trait = seducer + has_trait = rakish + } + factor = 2 + } + give_nickname = nick_the_beguiling + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_beguiling } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + is_female = yes + any_relation = { type = lover } + OR = { + has_trait = lustful + has_trait = beauty_good + attraction >= 50 + } + NOT = { exists = scope:had_nick_the_temptress } + } + modifier = { + num_of_relation_lover >= 2 + factor = 2 + } + give_nickname = nick_the_temptress + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_temptress } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + is_female = yes + any_relation = { type = lover } + attraction >= 50 + OR = { + has_trait = seducer + has_focus = intrigue_temptation_focus + } + NOT = { exists = scope:had_nick_the_seductress } + } + modifier = { + num_of_relation_lover >= 2 + factor = 2 + } + give_nickname = nick_the_seductress + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_seductress } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = lustful + OR = { + has_trait = lovers_pox + has_trait = early_great_pox + has_trait = great_pox + has_trait = deviant + } + NOT = { exists = scope:had_nick_the_lewd } + } + modifier = { + any_relation = { type = lover } + factor = 2 + } + give_nickname = nick_the_lewd + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_lewd } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + is_male = yes + any_relation = { type = lover } + OR = { + has_trait = lustful + has_trait = beauty_good + attraction >= 50 + } + NOT = { exists = scope:had_nick_the_lecher } + } + modifier = { + num_of_relation_lover >= 2 + factor = 2 + } + give_nickname = nick_the_lecher + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_lecher } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + is_male = yes + any_relation = { type = lover } + attraction >= 50 + OR = { + has_trait = seducer + has_focus = intrigue_temptation_focus + } + NOT = { exists = scope:had_nick_the_seducer } + } + modifier = { + num_of_relation_lover >= 2 + factor = 2 + } + give_nickname = nick_the_seducer + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_seducer } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = deceitful + intrigue >= 16 + NOT = { exists = scope:had_nick_the_trickster } + } + modifier = { + intrigue >= 20 + factor = 2 + } + give_nickname = nick_the_trickster + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_trickster } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + intrigue >= 10 + martial >= 10 + ai_boldness >= 25 + ai_rationality >= 50 + ai_honor < 0 + NOT = { exists = scope:had_nick_the_fox } + } + modifier = { + stewardship >= 10 + factor = 2 + } + give_nickname = nick_the_fox + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_fox } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + diplomacy >= 10 + intrigue >= 10 + learning >= 10 + martial >= 10 + stewardship >= 10 + ai_rationality >= 25 + NOT = { exists = scope:had_nick_the_shrewd } + } + modifier = { + prestige_level >= 3 + factor = 2 + } + give_nickname = nick_the_shrewd + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_shrewd } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_personality_benevolent_trigger = yes + has_personality_emotional_trigger = yes + prestige_level >= 2 + piety_level >= 2 + NOT = { exists = scope:had_nick_the_gracious } + } + modifier = { + prestige_level >= 3 + piety_level >= 3 + factor = 2 + } + give_nickname = nick_the_gracious + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_gracious } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + ai_rationality <= -25 + has_personality_emotional_trigger = yes + has_personality_extroverted_trigger = yes + prestige_level <= 1 + NOT = { exists = scope:had_nick_the_silly } + } + modifier = { + ai_rationality <= -75 + factor = 2 + } + give_nickname = nick_the_silly + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_silly } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_personality_benevolent_trigger = yes + has_personality_extroverted_trigger = yes + has_personality_levelheaded_trigger = yes + NOT = { exists = scope:had_nick_the_affable } + } + modifier = { + ai_compassion >= 100 + factor = 2 + } + give_nickname = nick_the_affable + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_affable } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = lifestyle_poet + has_trait = gregarious + NOT = { exists = scope:had_nick_the_bard } + } + modifier = { + has_trait_extroverted_trigger = yes + factor = 2 + } + give_nickname = nick_the_bard + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_bard } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_personality_benevolent_trigger = yes + OR = { + has_trait = generous + has_trait = improvident + } + tyranny <= 0 + prestige_level >= 2 + NOT = { exists = scope:had_nick_the_generous } + } + modifier = { + prestige_level >= 3 + factor = 2 + } + give_nickname = nick_the_generous + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_generous } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + ai_greed <= 0 + ai_honor >= 100 + tyranny <= 0 + prestige_level >= 2 + NOT = { exists = scope:had_nick_the_just } + } + modifier = { + prestige_level >= 3 + factor = 2 + } + give_nickname = nick_the_just + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_just } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + gold >= 1000 + ai_greed >= 100 + NOT = { exists = scope:had_nick_moneybags } + } + modifier = { + gold >= 3000 + factor = 2 + } + give_nickname = nick_moneybags + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_moneybags } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = lifestyle_poet + diplomacy >= 10 + NOT = { exists = scope:had_nick_the_poet } + } + modifier = { + prestige_level >= 2 + factor = 2 + } + give_nickname = nick_the_poet + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_poet } + trigger_event = lifestyle_nicknames.1000 + } + 500 = { + trigger = { + has_personality_dominant_trigger = yes + is_at_war = yes + any_character_war = { + primary_defender = scope:nickname_root_scope + defender_war_score >= 50 + } + prestige_level >= 2 + NOT = { exists = scope:had_nick_the_ironside } + } + modifier = { + has_trait = unyielding_defender + factor = 2 + } + give_nickname = nick_the_ironside + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_ironside } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_personality_malicious_trigger = yes + has_education_martial_trigger = yes + ai_boldness >= 50 + any_killed_character = { + count >= 1 + always = yes + } + NOT = { exists = scope:had_nick_the_ruthless } + } + modifier = { + any_killed_character = { + count >= 3 + always = yes + } + factor = 2 + } + give_nickname = nick_the_ruthless + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_ruthless } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + NOT = { exists = scope:had_nick_the_brute } + has_personality_dominant_trigger = yes + has_personality_malicious_trigger = yes + prowess >= 16 + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:nickname_root_scope } + } + give_nickname = nick_the_brute + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_brute } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + NOT = { exists = scope:had_nick_the_berserker } + has_trait = berserker + prowess >= 16 + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:nickname_root_scope } + } + give_nickname = nick_the_berserker + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_berserker } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + NOT = { exists = scope:had_nick_the_bear } + is_male = yes + has_personality_dominant_trigger = yes + has_personality_extroverted_trigger = yes + prowess >= 12 + martial >= 12 + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:nickname_root_scope } + } + give_nickname = nick_the_bear + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_bear } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + is_male = yes + ai_boldness >= 50 + OR = { + has_trait = brave + has_trait = strong + has_trait = physique_good + } + has_education_martial_trigger = yes + NOT = { exists = scope:had_nick_the_lion } + } + give_nickname = nick_the_lion + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_lion } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + martial >= 10 + intrigue >= 10 + OR = { + has_trait = shrewd + has_trait = intellect_good + has_trait = lifestyle_hunter + } + NOT = { exists = scope:had_nick_the_wolf } + } + modifier = { + prestige_level >= 3 + factor = 2 + } + give_nickname = nick_the_wolf + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_wolf } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_personality_extroverted_trigger = yes + ai_boldness >= 100 + prestige_level >= 2 + NOT = { exists = scope:had_nick_the_bold } + } + give_nickname = nick_the_bold + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_bold } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + NOT = { exists = scope:had_nick_the_brave } + has_trait = brave + has_personality_dominant_trigger = yes + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:nickname_root_scope } + } + modifier = { + prestige_level >= 3 + factor = 2 + } + give_nickname = nick_the_brave + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_brave } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait_xp = { + trait = lifestyle_hunter + track = hunter + value >= trait_second_level + } + NOT = { exists = scope:had_nick_the_hunter } + } + modifier = { + has_trait_xp = { + trait = lifestyle_hunter + track = hunter + value >= trait_third_level + } + factor = 2 + } + give_nickname = nick_the_hunter + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_hunter } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + ai_boldness >= 100 + has_personality_dominant_trigger = yes + has_personality_introverted_trigger = yes + NOT = { exists = scope:had_nick_the_fearless } + } + modifier = { + stress <= 0 + factor = 2 + } + give_nickname = nick_the_fearless + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_fearless } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait_xp = { + trait = lifestyle_hunter + track = falconer + value >= trait_second_level + } + NOT = { exists = scope:had_nick_the_fowler } + } + modifier = { + has_trait_xp = { + trait = lifestyle_hunter + track = falconer + value >= trait_third_level + } + factor = 2 + } + give_nickname = nick_the_fowler + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_fowler } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = sadistic + has_trait = torturer + has_trait = murderer + } + any_killed_character = { + count >= 3 + always = yes + } + NOT = { exists = scope:had_nick_the_butcher } + } + modifier = { + any_killed_character = { + count >= 5 + always = yes + } + factor = 2 + } + give_nickname = nick_the_butcher + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_butcher } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = lifestyle_blademaster + is_knight = yes + is_in_army = yes + } + any_killed_character = { + count >= 3 + always = yes + } + NOT = { exists = scope:had_nick_the_bloody } + } + modifier = { + any_killed_character = { + count >= 5 + always = yes + } + factor = 2 + } + give_nickname = nick_the_bloody + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_bloody } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + intrigue >= 10 + prowess >= 12 + martial >= 12 + has_education_martial_trigger = yes + NOT = { exists = scope:had_nick_the_hawk } + } + modifier = { + intrigue >= 16 + factor = 2 + } + give_nickname = nick_the_hawk + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_hawk } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = intellect_good + has_trait = shrewd + has_trait = theologian + has_trait = scholar + learning >= 16 + } + has_personality_introverted_trigger = yes + has_personality_levelheaded_trigger = yes + prestige_level >= 1 + NOT = { exists = scope:had_nick_the_wise } + } + modifier = { + prestige_level >= 3 + factor = 2 + } + give_nickname = nick_the_wise + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_wise } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_personality_submissive_trigger = yes + learning >= 16 + num_of_relation_ward >= 2 + NOT = { exists = scope:had_nick_the_sage } + } + give_nickname = nick_the_sage + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_sage } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = shy + has_trait = reclusive + has_trait = content + } + has_personality_introverted_trigger = yes + has_personality_submissive_trigger = yes + NOT = { exists = scope:had_nick_the_silent } + } + give_nickname = nick_the_silent + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_silent } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_personality_malicious_trigger = yes + has_personality_emotional_trigger = yes + OR = { + has_trait = deviant + has_trait = cannibal + has_trait = lustful + has_trait = sadistic + } + NOT = { exists = scope:had_nick_the_depraved } + } + give_nickname = nick_the_depraved + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_depraved } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_personality_malicious_trigger = yes + OR = { + any_prisoner = { + count >= 2 + always = yes + } + tyranny > 0 + dread >= 75 + } + NOT = { exists = scope:had_nick_the_cruel } + } + give_nickname = nick_the_cruel + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_cruel } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_personality_malicious_trigger = yes + OR = { + has_trait = giant + has_trait = beauty_bad_2 + has_trait = beauty_bad_3 + has_trait = scaly + } + OR = { + tyranny > 0 + dread >= 75 + } + NOT = { exists = scope:had_nick_the_abominable } + } + give_nickname = nick_the_abominable + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_abominable } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + piety_level <= 0 + has_trait = excommunicated + } + OR = { + has_personality_malicious_trigger = yes + num_sinful_traits >= 1 + } + NOT = { exists = scope:had_nick_the_wicked } + } + modifier = { + num_sinful_traits >= 2 + factor = 2 + } + give_nickname = nick_the_wicked + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_wicked } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + piety_level <= 0 + has_trait = excommunicated + } + OR = { + has_personality_malicious_trigger = yes + num_sinful_traits >= 1 + } + NOT = { exists = scope:had_nick_the_accursed } + } + modifier = { + num_sinful_traits >= 2 + factor = 2 + } + give_nickname = nick_the_accursed + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_accursed } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + exists = cp:councillor_court_chaplain + opinion = { + target = cp:councillor_court_chaplain + value <= -30 + } + OR = { + num_sinful_traits >= 1 + piety_level <= 0 + } + NOT = { exists = scope:had_nick_priest_hater } + } + modifier = { + num_sinful_traits >= 2 + factor = 2 + } + give_nickname = nick_priest_hater + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_priest_hater } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + ai_zeal >= 25 + top_liege != this + NOR = { + religion = liege.religion + faith = { has_doctrine = doctrine_pluralism_pluralistic } + } + NOT = { exists = scope:had_nick_the_heathen } + } + give_nickname = nick_the_heathen + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_heathen } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + faith.religion = { is_in_family = rf_abrahamic } + OR = { + num_sinful_traits >= 2 + piety_level <= 0 + has_trait = excommunicated + } + has_personality_malicious_trigger = yes + NOT = { exists = scope:had_nick_the_devil } + } + modifier = { + num_sinful_traits >= 3 + factor = 2 + } + give_nickname = nick_the_devil + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_devil } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + faith.religion = { is_in_family = rf_abrahamic } + OR = { + num_sinful_traits >= 2 + piety_level <= 0 + has_trait = excommunicated + } + has_personality_dominant_trigger = yes + NOT = { exists = scope:had_nick_the_black } + } + give_nickname = nick_the_black + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_black } + trigger_event = lifestyle_nicknames.1000 + } + 200 = { + trigger = { + piety_level >= 4 + has_personality_submissive_trigger = yes + num_sinful_traits <= 0 + NOT = { exists = scope:had_nick_the_pious } + } + modifier = { + piety_level >= 5 + factor = 2 + } + give_nickname = nick_the_pious + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_pious } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + piety_level >= 3 + has_trait = humble + num_sinful_traits <= 0 + ai_boldness < 0 + NOT = { exists = scope:had_nick_the_humble } + } + modifier = { + piety_level >= 4 + factor = 2 + } + give_nickname = nick_the_humble + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_humble } + trigger_event = lifestyle_nicknames.1000 + } + 200 = { + trigger = { + faith.religion = { is_in_family = rf_abrahamic } + piety_level >= 4 + has_personality_extroverted_trigger = yes + num_sinful_traits <= 0 + NOT = { exists = scope:had_nick_the_blessed } + } + modifier = { + piety_level >= 5 + factor = 2 + } + give_nickname = nick_the_blessed + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_blessed } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + faith.religion = { is_in_family = rf_abrahamic } + piety_level >= 3 + has_trait = theologian + has_trait_extroverted_trigger = no + num_sinful_traits <= 0 + NOT = { exists = scope:had_nick_the_theologian } + } + modifier = { + piety_level >= 4 + factor = 2 + } + give_nickname = nick_the_theologian + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_theologian } + trigger_event = lifestyle_nicknames.1000 + } + 200 = { + trigger = { + religion = { is_in_family = rf_eastern } + piety_level >= 4 + has_personality_extroverted_trigger = yes + num_sinful_traits <= 0 + NOT = { exists = scope:had_nick_the_enlightened } + } + modifier = { + piety_level >= 5 + factor = 2 + } + give_nickname = nick_the_enlightened + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_enlightened } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + num_virtuous_traits >= 2 + piety_level >= 4 + } + has_personality_introverted_trigger = yes + num_sinful_traits <= 0 + NOT = { exists = scope:had_nick_the_holy } + } + modifier = { + piety_level >= 5 + factor = 2 + } + give_nickname = nick_the_holy + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_holy } + trigger_event = lifestyle_nicknames.1000 + } + 200 = { + trigger = { + faith.religion = { is_in_family = rf_abrahamic } + OR = { + num_virtuous_traits >= 2 + piety_level >= 4 + } + has_personality_submissive_trigger = yes + has_personality_extroverted_trigger = yes + num_sinful_traits <= 0 + NOT = { exists = scope:had_nick_the_confessor } + } + modifier = { + top_liege = this + factor = 2 + } + give_nickname = nick_the_confessor + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_confessor } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + is_married = no + can_have_children = no + } + OR = { + has_trait = chaste + has_trait = celibate + } + NOT = { exists = scope:had_nick_the_chaste } + } + give_nickname = nick_the_chaste + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_chaste } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + is_male = yes + faith = { has_doctrine = doctrine_theocracy_temporal } + has_personality_levelheaded_trigger = yes + has_personality_introverted_trigger = yes + has_personality_submissive_trigger = yes + piety_level >= 2 + num_sinful_traits <= 0 + NOT = { exists = scope:had_nick_the_monk } + } + give_nickname = nick_the_monk + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_monk } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + piety_level >= 2 + has_trait_xp = { + trait = pilgrim + value >= trait_second_level + } + NOT = { exists = scope:had_nick_the_pilgrim } + } + modifier = { + has_trait_xp = { + trait = pilgrim + value >= trait_third_level + } + factor = 2 + } + give_nickname = nick_the_pilgrim + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_pilgrim } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = diligent + has_trait = ambitious + is_at_war = no + NOT = { exists = scope:had_nick_the_able } + } + modifier = { + prestige_level >= 3 + factor = 2 + } + give_nickname = nick_the_able + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_able } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + ai_compassion >= 100 + has_personality_benevolent_trigger = yes + has_personality_emotional_trigger = yes + NOR = { + any_prisoner = { + count >= 1 + always = yes + } + any_killed_character = { + count >= 1 + always = yes + } + } + NOT = { exists = scope:had_nick_the_compassionate } + } + give_nickname = nick_the_compassionate + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_compassionate } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_personality_levelheaded_trigger = yes + ai_honor >= 75 + ai_greed <= 0 + NOT = { exists = scope:had_nick_the_noble } + } + modifier = { + prestige_level >= 2 + factor = 2 + } + give_nickname = nick_the_noble + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_noble } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + ai_boldness <= 0 + has_personality_emotional_trigger = yes + has_personality_benevolent_trigger = yes + NOT = { exists = scope:had_nick_the_gentle } + } + give_nickname = nick_the_gentle + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_gentle } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_personality_benevolent_trigger = yes + prestige_level >= 3 + tyranny <= 0 + NOT = { exists = scope:had_nick_the_good } + } + modifier = { + prestige_level >= 2 + factor = 2 + } + give_nickname = nick_the_good + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_good } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + ai_compassion >= 75 + has_personality_benevolent_trigger = yes + has_personality_extroverted_trigger = yes + NOT = { exists = scope:had_nick_the_kind } + } + give_nickname = nick_the_kind + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_kind } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_personality_extroverted_trigger = yes + OR = { + loves_food_trigger = yes + has_trait = lifestyle_reveler + } + has_trait_malicious_trigger = no + NOT = { exists = scope:had_nick_the_merry } + } + give_nickname = nick_the_merry + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_merry } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + ai_honor >= 100 + has_personality_levelheaded_trigger = yes + has_personality_benevolent_trigger = yes + NOT = { exists = scope:had_nick_the_honorable } + } + give_nickname = nick_the_honorable + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_honorable } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = loyal + untrustworthy_trigger = no + NOT = { exists = scope:had_nick_the_loyal } + } + give_nickname = nick_the_loyal + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_loyal } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = honest + has_trait_malicious_trigger = no + NOT = { exists = scope:had_nick_the_honest } + } + give_nickname = nick_the_honest + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_honest } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_personality_malicious_trigger = yes + tyranny >= 50 + dread >= 75 + } + tyranny >= 10 + NOT = { exists = scope:had_nick_the_terrible } + } + modifier = { + tyranny >= 50 + factor = 2 + } + give_nickname = nick_the_terrible + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_terrible } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_personality_dominant_trigger = yes + tyranny >= 50 + } + tyranny >= 10 + NOT = { exists = scope:had_nick_the_tyrant } + } + modifier = { + tyranny >= 30 + factor = 2 + } + give_nickname = nick_the_tyrant + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_tyrant } + trigger_event = lifestyle_nicknames.1000 + } + 50 = { + trigger = { + age >= 60 + NOT = { exists = scope:had_nick_the_old } + } + modifier = { + age >= 80 + factor = 5 + } + give_nickname = nick_the_old + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_old } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = shy + has_trait = reclusive + } + has_personality_introverted_trigger = yes + has_trait_dominant_trigger = no + NOT = { exists = scope:had_nick_the_shy } + } + modifier = { + has_personality_submissive_trigger = yes + factor = 2 + } + give_nickname = nick_the_shy + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_shy } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + prestige_level >= 4 + age <= 23 + NOT = { exists = scope:had_nick_the_young } + } + modifier = { + prestige_level >= 5 + factor = 2 + } + give_nickname = nick_the_young + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_young } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + is_male = yes + OR = { + has_trait = bastard + has_trait = legitimized_bastard + has_trait = bastard_founder + } + NOT = { exists = scope:had_nick_the_bastard } + } + modifier = { + prestige_level <= 1 + factor = 2 + } + give_nickname = nick_the_bastard + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_bastard } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + ai_boldness >= 50 + has_personality_extroverted_trigger = yes + has_personality_dominant_trigger = yes + prestige_level >= 1 + NOT = { exists = scope:had_nick_the_proud } + } + modifier = { + prestige_level >= 2 + factor = 2 + } + give_nickname = nick_the_proud + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_proud } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + NOT = { exists = scope:had_nick_the_strong } + OR = { + has_trait = strong + has_trait = physique_good + } + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:nickname_root_scope } + } + modifier = { + OR = { + has_trait = physique_good_2 + has_trait = physique_good_3 + } + factor = 2 + } + give_nickname = nick_the_strong + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_strong } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + is_male = yes + has_conventionally_attractive_trigger = yes + NOR = { + has_trait = disfigured + has_trait = leper + has_trait = scaly + has_trait = beauty_bad + } + NOT = { exists = scope:had_nick_the_handsome } + } + modifier = { + OR = { + has_trait = beauty_good_2 + has_trait = beauty_good_3 + } + factor = 2 + } + give_nickname = nick_the_handsome + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_handsome } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + is_female = yes + has_conventionally_attractive_trigger = yes + age <= 40 + NOR = { + has_trait = disfigured + has_trait = leper + has_trait = scaly + has_trait = beauty_bad + } + NOT = { exists = scope:had_nick_the_fair } + } + modifier = { + OR = { + has_trait = beauty_good_2 + has_trait = beauty_good_3 + } + factor = 2 + } + give_nickname = nick_the_fair + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_fair } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + culture = culture:anglo_saxon + is_female = yes + has_conventionally_attractive_trigger = yes + age <= 40 + NOR = { + has_trait = disfigured + has_trait = leper + has_trait = scaly + has_trait = beauty_bad + } + NOT = { exists = scope:had_nick_swan_neck } + } + modifier = { + OR = { + has_trait = beauty_good_2 + has_trait = beauty_good_3 + } + factor = 2 + } + give_nickname = nick_swan_neck + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_swan_neck } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_conventionally_attractive_trigger = yes + has_trait = lustful + } + NOR = { + has_trait = disfigured + has_trait = leper + has_trait = scaly + has_trait = beauty_bad + } + any_targeting_scheme = { + OR = { + scheme_type = seduce + scheme_type = courting + } + } + NOT = { exists = scope:had_nick_the_desired } + } + modifier = { + OR = { + has_trait = beauty_good_2 + has_trait = beauty_good_3 + } + factor = 2 + } + give_nickname = nick_the_desired + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_desired } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = beauty_good + age <= 40 + NOR = { + has_trait = disfigured + has_trait = leper + has_trait = scaly + has_trait = beauty_bad + } + NOT = { exists = scope:had_nick_the_beautiful } + } + modifier = { + OR = { + has_trait = beauty_good_2 + has_trait = beauty_good_3 + } + factor = 2 + } + give_nickname = nick_the_beautiful + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_beautiful } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = giant + NOT = { exists = scope:had_nick_the_giant } + } + give_nickname = nick_the_giant + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_giant } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + prowess >= 10 + current_weight >= 50 + OR = { + loves_food_trigger = yes + has_trait = lifestyle_reveler + } + NOT = { exists = scope:had_nick_the_girthy } + } + modifier = { + current_weight >= 75 + factor = 2 + } + give_nickname = nick_the_girthy + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_girthy } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + ai_rationality <= -75 + has_trait = lunatic + has_trait = possessed + AND = { + tyranny >= 50 + has_personality_emotional_trigger = yes + has_personality_malicious_trigger = yes + } + } + NOT = { exists = scope:had_nick_the_mad } + } + give_nickname = nick_the_mad + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_mad } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + probably_unintelligent_trigger = yes + NOT = { exists = scope:had_nick_the_simple } + } + give_nickname = nick_the_simple + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_simple } + trigger_event = lifestyle_nicknames.1000 + } + 500 = { + trigger = { + has_trait = leper + NOT = { exists = scope:had_nick_the_leper } + } + give_nickname = nick_the_leper + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_leper } + trigger_event = lifestyle_nicknames.1000 + } + 300 = { + trigger = { + has_trait = maimed + NOT = { exists = scope:had_nick_half_hand } + } + give_nickname = nick_half_hand + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_half_hand } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = beauty_bad + has_trait = hunchbacked + has_trait = scaly + has_trait = disfigured + has_trait = inbred + scarred_trait_activation_3 = yes + } + NOT = { + has_trait = beauty_good + } + NOT = { exists = scope:had_nick_the_hideous } + } + modifier = { + OR = { + has_trait = beauty_bad_2 + has_trait = beauty_bad_3 + } + factor = 2 + } + give_nickname = nick_the_hideous + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_hideous } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = beauty_bad + has_trait = hunchbacked + has_trait = scaly + has_trait = inbred + } + NOT = { + has_trait = beauty_good + } + NOT = { exists = scope:had_nick_the_frog } + } + modifier = { + OR = { + has_trait = beauty_bad_2 + has_trait = beauty_bad_3 + } + factor = 2 + } + give_nickname = nick_the_frog + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_frog } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = beauty_bad + has_trait = hunchbacked + has_trait = scaly + has_trait = inbred + scarred_trait_activation_3 = yes + } + NOT = { + has_trait = beauty_good + } + NOT = { exists = scope:had_nick_the_repulsive } + } + modifier = { + OR = { + has_trait = beauty_bad_2 + has_trait = beauty_bad_3 + } + factor = 2 + } + give_nickname = nick_the_repulsive + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_repulsive } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = infirm + has_trait = weak + has_trait = spindly + has_trait = physique_bad + has_trait = bleeder + has_trait = inbred + } + NOT = { + has_trait = physique_good + } + NOT = { exists = scope:had_nick_the_frail } + } + modifier = { + OR = { + has_trait = physique_bad_2 + has_trait = physique_bad_3 + } + factor = 2 + } + give_nickname = nick_the_frail + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_frail } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + prowess < 8 + OR = { + has_trait = infirm + has_trait = spindly + has_trait = weak + has_trait = physique_bad + has_trait = bleeder + has_trait = inbred + } + NOT = { + has_trait = physique_good + } + NOT = { exists = scope:had_nick_the_weak } + } + modifier = { + OR = { + has_trait = physique_bad_2 + has_trait = physique_bad_3 + } + factor = 2 + } + give_nickname = nick_the_weak + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_weak } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = clubfooted + has_trait = weak + has_trait = spindly + has_trait = physique_bad + } + NOT = { + has_trait = physique_good + } + NOT = { exists = scope:had_nick_the_lame } + } + modifier = { + has_trait = clubfooted + factor = 2 + } + give_nickname = nick_the_lame + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_lame } + trigger_event = lifestyle_nicknames.1000 + } + 1000 = { + trigger = { + has_trait = lisping + has_trait = clubfooted + NOT = { exists = scope:had_nick_the_lisp_and_lame } + } + give_nickname = nick_the_lisp_and_lame + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_lisp_and_lame } + trigger_event = lifestyle_nicknames.1000 + } + 300 = { + trigger = { + has_trait = hunchbacked + NOT = { exists = scope:had_nick_the_hunchback } + } + give_nickname = nick_the_hunchback + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_hunchback } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + current_weight >= 50 + OR = { + loves_food_trigger = yes + has_trait = lifestyle_reveler + } + NOT = { exists = scope:had_nick_the_fat } + } + modifier = { + current_weight >= 75 + factor = 2 + } + give_nickname = nick_the_fat + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_fat } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + culture = culture:anglo_saxon + current_weight >= 50 + OR = { + loves_food_trigger = yes + has_trait = lifestyle_reveler + } + NOT = { exists = scope:had_nick_chubbycheeks } + } + modifier = { + current_weight >= 75 + factor = 2 + } + give_nickname = nick_chubbycheeks + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_chubbycheeks } + trigger_event = lifestyle_nicknames.1000 + } + 50 = { + trigger = { + current_weight >= 50 + OR = { + loves_food_trigger = yes + has_trait = lifestyle_reveler + } + diplomacy <= 2 + NOT = { exists = scope:had_nick_the_slobberer } + } + modifier = { + current_weight >= 75 + factor = 2 + } + give_nickname = nick_the_slobberer + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_slobberer } + trigger_event = lifestyle_nicknames.1000 + } + 50 = { + trigger = { + current_weight >= 50 + OR = { + loves_food_trigger = yes + has_trait = lifestyle_reveler + } + NOT = { exists = scope:had_nick_the_rotund } + } + modifier = { + current_weight >= 75 + factor = 2 + } + give_nickname = nick_the_rotund + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_rotund } + trigger_event = lifestyle_nicknames.1000 + } + 25 = { + trigger = { + current_weight >= 50 + OR = { + loves_food_trigger = yes + has_trait = lifestyle_reveler + } + NOT = { exists = scope:had_nick_the_plump } + } + modifier = { + current_weight >= 75 + factor = 2 + } + give_nickname = nick_the_plump + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_plump } + trigger_event = lifestyle_nicknames.1000 + } + 200 = { + trigger = { + has_trait = blind + NOT = { exists = scope:had_nick_the_blind } + } + give_nickname = nick_the_blind + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_blind } + trigger_event = lifestyle_nicknames.1000 + } + 200 = { + trigger = { + has_trait = stuttering + NOT = { exists = scope:had_nick_the_stammerer } + } + give_nickname = nick_the_stammerer + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_stammerer } + trigger_event = lifestyle_nicknames.1000 + } + 200 = { + trigger = { + has_trait = gout_ridden + NOT = { exists = scope:had_nick_the_gouty } + } + give_nickname = nick_the_gouty + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_gouty } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = consumption + has_trait = cancer + has_trait = pneumonic + has_trait = typhus + has_trait = smallpox + has_trait = measles + has_trait = dysentery + has_trait = ergotism + has_trait = bubonic_plague + } + prestige_level <= 1 + NOT = { exists = scope:had_nick_the_diseased } + } + give_nickname = nick_the_diseased + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_diseased } + trigger_event = lifestyle_nicknames.1000 + } + 25 = { + trigger = { + dynasty ?= { dynasty_prestige_level >= 5 } + prestige_level <= 1 + NOT = { exists = scope:had_nick_the_disgraceful } + } + give_nickname = nick_the_disgraceful + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_disgraceful } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + NOT = { exists = scope:had_nick_bad_hand } + has_trait = maimed + AND = { + has_trait = scarred + prowess < 8 + } + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:nickname_root_scope } + } + give_nickname = nick_bad_hand + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_bad_hand } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = one_eyed + NOT = { exists = scope:had_nick_the_one_eyed } + } + give_nickname = nick_the_one_eyed + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_one_eyed } + trigger_event = lifestyle_nicknames.1000 + } + 50 = { + trigger = { + has_trait = craven + prestige_level <= 2 + has_personality_submissive_trigger = yes + NOT = { exists = scope:had_nick_the_trembling } + } + modifier = { + prestige_level <= 1 + factor = 2 + } + give_nickname = nick_the_trembling + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_trembling } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = craven + prestige_level <= 2 + has_personality_submissive_trigger = yes + NOT = { exists = scope:had_nick_the_craven } + } + modifier = { + prestige_level <= 1 + factor = 2 + } + give_nickname = nick_the_craven + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_craven } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + ai_rationality <= -75 + has_trait = lunatic + has_trait = possessed + AND = { + tyranny >= 50 + has_personality_emotional_trigger = yes + has_personality_malicious_trigger = yes + } + } + NOT = { exists = scope:had_nick_the_insane } + } + give_nickname = nick_the_insane + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_insane } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_personality_introverted_trigger = yes + has_personality_dominant_trigger = yes + has_personality_levelheaded_trigger = yes + NOT = { exists = scope:had_nick_the_joyless } + } + give_nickname = nick_the_joyless + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_joyless } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = viking + martial >= 10 + prowess >= 10 + NOT = { exists = scope:had_nick_the_viking } + } + give_nickname = nick_the_viking + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_viking } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + culture = { has_cultural_tradition = tradition_horse_lords } + martial >= 10 + prowess >= 10 + number_maa_regiments_of_base_type = { + type = archer_cavalry + value > 1 + } + any_raid_target = { + always = yes + } + NOT = { exists = scope:had_nick_the_horse } + } + give_nickname = nick_the_horse + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_horse } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + probably_unintelligent_trigger = yes + has_personality_introverted_trigger = yes + has_personality_levelheaded_trigger = yes + NOT = { exists = scope:had_nick_the_dull } + } + give_nickname = nick_the_dull + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_dull } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_personality_dominant_trigger = yes + has_personality_extroverted_trigger = yes + prowess >= 16 + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:nickname_root_scope } + NOT = { exists = scope:had_nick_strongarm } + } + give_nickname = nick_strongarm + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_strongarm } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = one_eyed + NOT = { exists = scope:had_nick_one_eye } + } + give_nickname = nick_one_eye + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_one_eye } + trigger_event = lifestyle_nicknames.1000 + } + 300 = { + trigger = { + has_trait = maimed + NOT = { exists = scope:had_nick_one_hand } + } + give_nickname = nick_one_hand + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_one_hand } + trigger_event = lifestyle_nicknames.1000 + } + 300 = { + trigger = { + has_education_intrigue_trigger = yes + intrigue >= 16 + has_trait = disfigured + NOT = { exists = scope:had_nick_of_a_thousand_faces } + } + give_nickname = nick_of_a_thousand_faces + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_of_a_thousand_faces } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = consumption + has_trait = cancer + has_trait = pneumonic + has_trait = typhus + has_trait = smallpox + has_trait = measles + has_trait = dysentery + has_trait = ergotism + has_trait = bubonic_plague + } + prestige_level <= 1 + NOT = { exists = scope:had_nick_the_plaguebearer } + } + give_nickname = nick_the_plaguebearer + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_plaguebearer } + trigger_event = lifestyle_nicknames.1000 + } + 500 = { + trigger = { + calc_true_if = { + amount >= 2 + has_trait = maimed + has_trait = one_eyed + has_trait = one_legged + has_trait = disfigured + } + stress < 100 + health >= medium_health + NOT = { exists = scope:had_nick_the_persevering } + } + give_nickname = nick_the_persevering + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_persevering } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = physique_good_2 + has_trait = physique_good_3 + has_trait = beauty_good_2 + has_trait = beauty_good_3 + } + OR = { + has_trait = physique_bad_2 + has_trait = physique_bad_3 + has_trait = beauty_bad_2 + has_trait = beauty_bad_3 + has_trait = giant + has_trait = albino + has_trait = scaly + } + NOT = { exists = scope:had_nick_the_chimera } + } + give_nickname = nick_the_chimera + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_chimera } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + highest_held_title_tier <= tier_duchy + realm_size >= 5 + any_vassal = { + count >= 3 + } + has_personality_benevolent_trigger = yes + prestige_level >= 2 + diplomacy >= 12 + NOT = { exists = scope:had_nick_the_lord_of_realm } + } + give_nickname = nick_the_lord_of_realm + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_lord_of_realm } + trigger_event = lifestyle_nicknames.1000 + } + 50 = { + trigger = { + highest_held_title_tier <= tier_duchy + domain_size <= 2 + any_sibling = { + highest_held_title_tier >= tier_kingdom + domain_size >= 4 + prestige_level >= scope:nickname_root_scope.prestige_level + } + NOT = { exists = scope:had_nick_lackland } + } + give_nickname = nick_lackland + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_lackland } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + is_male = yes + culture = { + OR = { + this = culture:breton + any_parent_culture_or_above = { + this = culture:breton + } + } + } + is_at_war = yes + martial >= 12 + NOT = { exists = scope:had_nick_twistedbeard } + } + give_nickname = nick_twistedbeard + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_twistedbeard } + trigger_event = lifestyle_nicknames.1000 + } + 25 = { # Will make the character grow a beautiful beard + trigger = { + is_male = yes + age >= 30 + learning >= 16 + OR = { + has_trait = lifestyle_mystic + has_trait = scholar + has_trait = theologian + } + NOR = { + exists = scope:had_nick_the_bearded + has_trait = beardless_eunuch + } + } + give_nickname = nick_the_bearded + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_bearded } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = strong + has_trait = physique_good + } + OR = { + has_trait = beauty_bad + has_trait = hunchbacked + has_trait = scaly + has_trait = disfigured + } + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:nickname_root_scope } + NOT = { exists = scope:had_nick_the_boar } + } + give_nickname = nick_the_boar + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_boar } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = disfigured + has_personality_introverted_trigger = yes + NOT = { exists = scope:had_nick_the_faceless } + } + give_nickname = nick_the_faceless + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_faceless } + trigger_event = lifestyle_nicknames.1000 + } + 300 = { + trigger = { + has_trait = giant + has_trait = one_eyed + NOT = { exists = scope:had_nick_the_cyclops } + } + give_nickname = nick_the_cyclops + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_cyclops } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = giant + OR = { + has_trait = weak + has_trait = spindly + has_trait = physique_bad + } + NOT = { exists = scope:had_nick_the_beanstalk } + } + give_nickname = nick_the_beanstalk + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_beanstalk } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + is_female = yes + faith = { has_doctrine = doctrine_theocracy_temporal } + has_personality_levelheaded_trigger = yes + has_personality_introverted_trigger = yes + has_personality_submissive_trigger = yes + piety_level >= 2 + num_sinful_traits <= 0 + NOT = { exists = scope:had_nick_the_nun } + } + give_nickname = nick_the_nun + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_nun } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + is_in_civil_war = yes + tyranny > 0 + diplomacy <= 8 + NOT = { exists = scope:had_nick_the_ill_ruler } + } + modifier = { + diplomacy <= 4 + factor = 2 + } + give_nickname = nick_the_ill_ruler + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_ill_ruler } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + is_in_civil_war = yes + tyranny > 0 + diplomacy <= 8 + NOT = { exists = scope:had_nick_the_careless } + } + modifier = { + diplomacy <= 4 + factor = 2 + } + give_nickname = nick_the_careless + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_careless } + trigger_event = lifestyle_nicknames.1000 + } + 25 = { + trigger = { + age >= 60 + health >= good_health + NOT = { exists = scope:had_nick_the_undying } + } + give_nickname = nick_the_undying + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_undying } + trigger_event = lifestyle_nicknames.1000 + } + 50 = { + trigger = { + OR = { + debt_level >= 1 + treasury_debt_level >= 1 + } + NOT = { exists = scope:had_nick_of_the_empty_pockets } + } + modifier = { + factor = debt_level + } + modifier = { + factor = treasury_debt_level + } + give_nickname = nick_of_the_empty_pockets + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_of_the_empty_pockets } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = giant + prowess >= 20 + NOT = { exists = scope:had_nick_the_goliath } + } + give_nickname = nick_the_goliath + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_goliath } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_education_martial_trigger = yes + exists = capital_county + capital_county.county_opinion >= 50 + NOT = { exists = scope:had_nick_the_shield_of_capital } + } + give_nickname = nick_the_shield_of_capital + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_shield_of_capital } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = giant + religion = { is_in_family = rf_pagan } + NOT = { exists = scope:had_nick_the_ladder_legs } + } + give_nickname = nick_the_ladder_legs + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_ladder_legs } + trigger_event = lifestyle_nicknames.1000 + } + 25 = { + trigger = { + has_personality_dominant_trigger = yes + has_personality_extroverted_trigger = yes + has_trait = beauty_good + NOT = { exists = scope:had_nick_the_peacock } + } + give_nickname = nick_the_peacock + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_peacock } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + dread >= 50 + has_personality_dominant_trigger = yes + has_personality_extroverted_trigger = yes + NOT = { exists = scope:had_nick_the_bellower } + } + give_nickname = nick_the_bellower + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_bellower } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = lifestyle_physician + has_personality_benevolent_trigger = yes + piety_level >= 2 + NOT = { exists = scope:had_nick_the_healer } + } + give_nickname = nick_the_healer + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_healer } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_personality_dominant_trigger = yes + has_personality_benevolent_trigger = yes + prestige_level >= 2 + piety_level >= 2 + NOT = { exists = scope:had_nick_the_righteous } + } + modifier = { + prestige_level >= 3 + piety_level >= 3 + factor = 2 + } + give_nickname = nick_the_righteous + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_righteous } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + ai_compassion >= 75 + ai_rationality >= 75 + has_personality_benevolent_trigger = yes + NOT = { exists = scope:had_nick_the_understanding } + } + give_nickname = nick_the_understanding + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_understanding } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + age >= 75 + piety_level >= 2 + NOT = { exists = scope:had_nick_the_venerable } + } + modifier = { + piety_level >= 3 + factor = 2 + } + give_nickname = nick_the_venerable + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_venerable } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = lifestyle_mystic + has_personality_benevolent_trigger = yes + piety_level >= 2 + NOT = { exists = scope:had_nick_the_miracle_worker } + } + give_nickname = nick_the_miracle_worker + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_miracle_worker } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + ai_vengefulness <= -50 + has_personality_benevolent_trigger = yes + has_personality_levelheaded_trigger = yes + NOR = { + any_prisoner = { + count >= 1 + always = yes + } + any_killed_character = { + count >= 1 + always = yes + } + } + NOT = { exists = scope:had_nick_the_merciful } + } + give_nickname = nick_the_merciful + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_merciful } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + intrigue >= 14 + diplomacy >= 14 + has_personality_extroverted_trigger = yes + NOT = { exists = scope:had_nick_the_silver_tongue } + } + give_nickname = nick_the_silver_tongue + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_silver_tongue } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + is_male = yes + prowess >= 10 + attraction >= 30 + OR = { + has_trait = athletic + has_trait = strong + has_trait = physique_good + } + NOT = { exists = scope:had_nick_the_stallion } + } + give_nickname = nick_the_stallion + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_stallion } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = infirm + probably_unintelligent_trigger = yes + } + NOT = { exists = scope:had_nick_the_forgetful } + } + modifier = { + has_trait = fickle + factor = 2 + } + give_nickname = nick_the_forgetful + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_forgetful } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = shy + has_trait = reclusive + } + has_personality_introverted_trigger = yes + has_personality_submissive_trigger = yes + piety_level >= 1 + NOT = { exists = scope:had_nick_the_hermit } + } + give_nickname = nick_the_hermit + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_hermit } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = shy + has_trait = reclusive + } + has_personality_introverted_trigger = yes + has_personality_submissive_trigger = yes + NOT = { exists = scope:had_nick_the_recluse } + } + give_nickname = nick_the_recluse + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_recluse } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = infirm + has_trait = spindly + has_trait = weak + has_trait = physique_bad + has_trait = bleeder + has_trait = inbred + } + NOR = { + has_trait = strong + has_trait = physique_good + } + NOT = { exists = scope:had_nick_the_feeble } + } + give_nickname = nick_the_feeble + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_feeble } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_personality_dominant_trigger = yes + has_personality_extroverted_trigger = yes + has_trait = beauty_good + NOT = { exists = scope:had_nick_the_vain } + } + give_nickname = nick_the_vain + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_vain } + trigger_event = lifestyle_nicknames.1000 + } + 25 = { + trigger = { + days_of_continuous_peace >= 700 + ai_has_economical_boom_personality = yes + any_held_title = { + count >= 4 + title_tier = county + title_province = { + has_ongoing_construction = yes + } + } + NOT = { exists = scope:had_nick_the_castellan } + } + modifier = { + any_held_title = { + count = all + title_tier = county + title_province = { + has_ongoing_construction = yes + } + } + factor = 2 + } + give_nickname = nick_the_castellan + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_castellan } + trigger_event = lifestyle_nicknames.1000 + } + 25 = { + trigger = { + piety_level >= 2 + faith.religion = { is_in_family = rf_abrahamic } + days_of_continuous_peace >= 700 + ai_has_economical_boom_personality = yes + any_held_title = { + count >= 4 + title_tier = county + title_province = { + has_ongoing_construction = yes + } + } + NOT = { exists = scope:had_nick_the_carpenter } + } + modifier = { + any_held_title = { + count = all + title_tier = county + title_province = { + has_ongoing_construction = yes + } + } + factor = 2 + } + give_nickname = nick_the_carpenter + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_carpenter } + trigger_event = lifestyle_nicknames.1000 + } + 25 = { + trigger = { + intrigue >= 10 + prowess >= 12 + martial >= 12 + has_education_martial_trigger = yes + NOT = { exists = scope:had_nick_the_griffin } + } + modifier = { + intrigue >= 16 + factor = 2 + } + give_nickname = nick_the_griffin + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_griffin } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + ai_greed <= -50 + any_sponsored_inspiration = { } + prestige_level >= 2 + highest_held_title_tier >= tier_kingdom + NOT = { exists = scope:had_nick_the_patron_of_arts } + } + give_nickname = nick_the_patron_of_arts + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_patron_of_arts } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + ai_zeal >= 100 + ai_rationality <= -50 + piety_level >= 2 + NOT = { exists = scope:had_nick_the_zealot } + } + give_nickname = nick_the_zealot + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_zealot } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + age >= 75 + NOT = { exists = scope:had_nick_the_elder } + } + give_nickname = nick_the_elder + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_elder } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_personality_malicious_trigger = yes + num_sinful_traits >= 1 + OR = { + has_trait = sadistic + has_trait = callous + } + ai_zeal <= 0 + NOT = { exists = scope:had_nick_the_evil } + } + modifier = { + num_sinful_traits >= 2 + factor = 2 + } + give_nickname = nick_the_evil + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_evil } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_personality_extroverted_trigger = yes + OR = { + loves_food_trigger = yes + has_trait = lifestyle_reveler + } + diplomacy >= 8 + has_trait_malicious_trigger = no + NOT = { exists = scope:had_nick_the_jovial } + } + give_nickname = nick_the_jovial + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_jovial } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_personality_extroverted_trigger = yes + OR = { + loves_food_trigger = yes + has_trait = lifestyle_reveler + } + ai_rationality < 0 + has_trait_malicious_trigger = no + NOT = { exists = scope:had_nick_the_jolly } + } + give_nickname = nick_the_jolly + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_jolly } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = lifestyle_mystic + has_trait = lunatic + has_trait = possessed + } + has_trait_malicious_trigger = no + NOT = { exists = scope:had_nick_the_strange } + } + give_nickname = nick_the_strange + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_strange } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = possessed + stress >= 200 + NOT = { exists = scope:had_nick_the_haunted } + } + give_nickname = nick_the_haunted + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_haunted } + trigger_event = lifestyle_nicknames.1000 + } + 300 = { + trigger = { + diplomacy < 8 + stewardship < 8 + martial < 8 + intrigue < 8 + learning < 8 + is_at_war_as_defender = yes + NOT = { exists = scope:had_nick_the_unlucky } + } + give_nickname = nick_the_unlucky + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_unlucky } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + any_relation = { + type = friend + always = yes + } + any_relation = { + type = lover + always = yes + } + is_at_war = no + gold >= 500 + realm_size >= 5 + has_any_illness = no + health > poor_health + stress < 100 + NOT = { exists = scope:had_nick_the_lucky } + } + give_nickname = nick_the_lucky + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_lucky } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + is_male = yes + prowess <= 4 + martial <= 4 + has_education_learning_trigger = yes + prestige_level <= 1 + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:nickname_root_scope } + NOT = { exists = scope:had_nick_the_effeminate } + } + give_nickname = nick_the_effeminate + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_effeminate } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + is_male = yes + culture = culture:anglo_saxon + prowess <= 4 + fertility <= 0.4 + NOT = { + any_child = { + count > 1 + } + } + NOT = { exists = scope:had_nick_softsword } + } + give_nickname = nick_softsword + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_softsword } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = fickle + ai_rationality <= -50 + prestige_level <= 2 + NOT = { exists = scope:had_nick_the_clueless } + } + modifier = { + probably_unintelligent_trigger = yes + factor = 2 + } + give_nickname = nick_the_clueless + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_clueless } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + ai_vengefulness >= 35 + OR = { + has_trait = wrathful + has_trait = irritable + } + NOT = { exists = scope:had_nick_the_ill_tempered } + } + give_nickname = nick_the_ill_tempered + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_ill_tempered } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + calc_true_if = { + amount >= 2 + has_trait = maimed + has_trait = one_eyed + has_trait = one_legged + has_trait = disfigured + } + stress < 100 + health >= medium_health + NOT = { exists = scope:had_nick_the_resilient } + } + give_nickname = nick_the_resilient + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_resilient } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = lazy + AND = { + has_trait = reclusive + ai_energy <= -25 + } + } + NOT = { + has_trait = ambitious + } + days_of_continuous_peace = 3650 + NOT = { exists = scope:had_nick_do_nothing } + } + modifier = { + calc_true_if = { + amount >= 2 + prestige_level <= 2 + } + factor = 2 + } + give_nickname = nick_do_nothing + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_do_nothing } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = lazy + ai_greed <= -25 + NOT = { + has_trait = ambitious + } + days_of_continuous_peace = 3650 + NOT = { exists = scope:had_nick_the_indolent } + } + modifier = { + calc_true_if = { + amount >= 2 + prestige_level <= 2 + } + factor = 2 + } + give_nickname = nick_the_indolent + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_indolent } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = lazy + ai_boldness >= 25 + NOT = { exists = scope:had_nick_the_sluggard } + } + modifier = { + calc_true_if = { + amount >= 2 + prestige_level <= 2 + } + factor = 2 + } + give_nickname = nick_the_sluggard + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_sluggard } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = lazy + ai_boldness <= -50 + ai_energy <= -25 + days_of_continuous_peace = 3650 + NOT = { exists = scope:had_nick_the_idle } + } + modifier = { + calc_true_if = { + amount >= 2 + prestige_level <= 2 + } + factor = 2 + } + give_nickname = nick_the_idle + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_idle } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = dwarf + NOT = { exists = scope:had_nick_the_short } + } + give_nickname = nick_the_short + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_short } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = dwarf + NOT = { exists = scope:had_nick_elbow_high } + } + give_nickname = nick_elbow_high + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_elbow_high } + trigger_event = lifestyle_nicknames.1000 + } + 200 = { + trigger = { + has_trait = athletic + prowess >= 12 + NOT = { exists = scope:had_nick_longshanks } + } + give_nickname = nick_longshanks + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_longshanks } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = wrathful + ai_boldness >= 25 + ai_rationality <= -25 + num_of_relation_rival >= 2 + NOT = { exists = scope:had_nick_the_wrathful } + } + give_nickname = nick_the_wrathful + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_wrathful } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + diplomacy <= 4 + has_personality_emotional_trigger = yes + has_personality_dominant_trigger = yes + NOT = { exists = scope:had_nick_the_petulant } + } + give_nickname = nick_the_petulant + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_petulant } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_personality_emotional_trigger = yes + num_of_relation_rival >= 4 + NOT = { exists = scope:had_nick_the_quarrelsome } + } + give_nickname = nick_the_quarrelsome + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_quarrelsome } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + is_eunuch_trigger = yes + NOT = { exists = scope:had_nick_the_eunuch } + } + give_nickname = nick_the_eunuch + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_eunuch } + trigger_event = lifestyle_nicknames.1000 + } + 200 = { + trigger = { + has_trait = lifestyle_blademaster + any_equipped_character_artifact = { artifact_type = sword } + prowess >= 12 + NOT = { exists = scope:had_nick_longsword } + } + give_nickname = nick_longsword + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_longsword } + trigger_event = lifestyle_nicknames.1000 + } + 200 = { + trigger = { + has_trait = lifestyle_blademaster + any_equipped_character_artifact = { artifact_type = axe } + prowess >= 12 + NOT = { exists = scope:had_nick_greataxe } + } + give_nickname = nick_greataxe + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_greataxe } + trigger_event = lifestyle_nicknames.1000 + } + 200 = { + trigger = { + has_trait = lifestyle_blademaster + any_equipped_character_artifact = { artifact_type = mace } + prowess >= 12 + NOT = { exists = scope:had_nick_the_mace } + } + give_nickname = nick_the_mace + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_mace } + trigger_event = lifestyle_nicknames.1000 + } + 200 = { + trigger = { + has_trait = lifestyle_blademaster + any_equipped_character_artifact = { artifact_type = spear } + prowess >= 12 + NOT = { exists = scope:had_nick_the_spear_of_capital } + } + give_nickname = nick_the_spear_of_capital + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_spear_of_capital } + trigger_event = lifestyle_nicknames.1000 + } + 200 = { + trigger = { + has_trait = lifestyle_blademaster + any_equipped_character_artifact = { artifact_type = hammer } + prowess >= 12 + NOT = { exists = scope:had_nick_the_maul } + } + give_nickname = nick_the_maul + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_maul } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + capital_province ?= { geographical_region = world_india } + prestige_level >= 3 + prowess >= 12 + martial >= 12 + NOT = { exists = scope:had_nick_the_tiger_of_place } + } + give_nickname = nick_the_tiger_of_place + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_tiger_of_place } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + diplomacy >= 16 + has_personality_extroverted_trigger = yes + has_royal_court = yes + has_dlc_feature = royal_court + court_grandeur_current_level >= 9 + NOT = { exists = scope:had_nick_the_lover_of_elegance } + } + give_nickname = nick_the_lover_of_elegance + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_lover_of_elegance } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + has_trait = strong + has_trait = physique_good + } + NOR = { + has_trait = weak + has_trait = spindly + has_trait = physique_bad + } + NOT = { exists = scope:had_nick_the_stout } + } + give_nickname = nick_the_stout + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_stout } + trigger_event = lifestyle_nicknames.1000 + } + 10 = { + trigger = { + diplomacy >= 16 + intrigue >= 16 + has_personality_levelheaded_trigger = yes + NOT = { exists = scope:had_nick_the_universal_spider } + } + give_nickname = nick_the_universal_spider + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_universal_spider } + trigger_event = lifestyle_nicknames.1000 + } + 25 = { + trigger = { + any_character_artifact = { + count >= 6 + is_unique = yes + } + NOT = { exists = scope:had_nick_the_collector } + } + give_nickname = nick_the_collector + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_collector } + trigger_event = lifestyle_nicknames.1000 + } + 50 = { + trigger = { + highest_held_title_tier >= tier_kingdom + prestige_level >= 3 + has_personality_dominant_trigger = yes + max_number_maa_soldiers_of_base_type = { + type = heavy_cavalry + value >= 500 + } + any_held_title = { + title_tier = county + any_county_province = { + has_building_with_flag = special_mine + #OR = { + # has_building_or_higher = rammelsberg_mines_01 + # has_building_or_higher = kutna_hora_mines_01 + # has_building_or_higher = kremnica_mines_01 + # has_building_or_higher = falun_mines_01 + # has_building_or_higher = schwaz_mines_01 + # has_building_or_higher = argentiera_mines_01 + # has_building_or_higher = kollur_mines_01 + # has_building_or_higher = ratnapura_mines_01 + # has_building_or_higher = siderokausia_mines_01 + # has_building_or_higher = mali_mines_01 + # has_building_or_higher = zawar_mines_01 + # has_building_or_higher = pansjhir_mines_01 + # has_building_or_higher = takkeda_mines_01 + # has_building_or_higher = trepca_mines_01 + # has_building_or_higher = cevennes_mines_01 + # has_building_or_higher = taghaza_mines_01 + # has_building_or_higher = allaq_mines_01 + # has_building_or_higher = phocaea_mines_01 + # has_building_or_higher = khetri_mines_01 + # has_building_or_higher = verespatak_mines_01 + # has_building_or_higher = srebrenica_mines_01 + # has_building_or_higher = nishapur_mines_01 + # has_building_or_higher = turda_mines_01 + # has_building_or_higher = rudnik_mines_01 + # has_building_or_higher = ijil_mines_01 + # has_building_or_higher = mogok_mines_01 + # has_building_or_higher = sar_i_sang_mines_01 + #} + } + } + NOT = { exists = scope:had_nick_the_iron_and_golden_king } + } + give_nickname = nick_the_iron_and_golden_king + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_iron_and_golden_king } + trigger_event = lifestyle_nicknames.1000 + } + 2000 = { + trigger = { + has_trait = incapable + NOT = { exists = scope:had_nick_the_sleeper } + } + give_nickname = nick_the_sleeper + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_sleeper } + trigger_event = lifestyle_nicknames.1000 + } + 10000 = { + trigger = { + has_trait = incapable + NOT = { exists = scope:had_nick_the_sleeping_king } + } + give_nickname = nick_the_sleeping_king + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_sleeping_king } + trigger_event = lifestyle_nicknames.1000 + } + 1000 = { + trigger = { + exists = liege + exists = mother + liege.culture = { + OR = { + this = culture:greek + any_parent_culture_or_above = { + this = culture:greek + } + } + } + culture = { + OR = { + this = culture:greek + any_parent_culture_or_above = { + this = culture:greek + } + } + } + mother.culture = { + NOR = { + this = culture:greek + any_parent_culture_or_above = { + this = culture:greek + } + } + } + NOT = { + faith = { has_dominant_ruling_gender = dummy_male} + } + NOT = { exists = scope:had_nick_the_foreign_mother } + } + give_nickname = nick_the_foreign_mother + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_foreign_mother } + trigger_event = lifestyle_nicknames.1000 + } + 1000 = { + trigger = { + exists = liege + exists = father + liege.culture = { + OR = { + this = culture:greek + any_parent_culture_or_above = { + this = culture:greek + } + } + } + culture = { + OR = { + this = culture:greek + any_parent_culture_or_above = { + this = culture:greek + } + } + } + father.culture = { + NOR = { + this = culture:greek + any_parent_culture_or_above = { + this = culture:greek + } + } + } + NOT = { + faith = { has_dominant_ruling_gender = dummy_female} + } + NOT = { exists = scope:had_nick_the_foreign_father } + } + give_nickname = nick_the_foreign_father + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_foreign_father } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + current_weight >= 50 + OR = { + loves_food_trigger = yes + has_trait = lifestyle_reveler + } + NOT = { exists = scope:had_nick_the_corpulent } + } + modifier = { + current_weight >= 75 + factor = 2 + } + give_nickname = nick_the_corpulent + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_corpulent } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + top_liege != this + OR = { + is_a_faction_member = yes + has_trait = disloyal + } + ai_boldness >= 50 + NOT = { exists = scope:had_nick_the_insubordinate } + } + give_nickname = nick_the_insubordinate + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_insubordinate } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = disloyal + intrigue >= 15 + NOT = { exists = scope:had_nick_the_backstabber } + } + modifier = { + is_at_war_with_liege = yes + factor = 2 + } + give_nickname = nick_the_backstabber + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_backstabber } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + ai_greed >= 50 + ai_honor <= 50 + gold >= massive_gold_value + NOT = { exists = scope:had_nick_the_corrupt } + } + modifier = { + has_trait = disloyal + factor = 2 + } + give_nickname = nick_the_corrupt + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_corrupt } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + probably_unintelligent_trigger = yes + OR = { + AND = { + diplomacy <= 6 + martial <= 6 + stewardship <= 6 + intrigue <= 6 + learning <= 6 + } + AND = { + government_allows = administrative + governor_efficiency <= 0.7 + } + prestige_level <= 2 + } + NOT = { exists = scope:had_nick_the_incompetent } + } + modifier = { + government_allows = administrative + governor_efficiency <= 0.6 + factor = 2 + } + give_nickname = nick_the_incompetent + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_incompetent } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + ai_rationality <= -50 + ai_boldness >= 50 + OR = { + has_trait = profligate + has_trait = reckless + } + NOT = { exists = scope:had_nick_the_gambler } + } + give_nickname = nick_the_gambler + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_gambler } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + diplomacy <= 3 + has_personality_extroverted_trigger = yes + OR = { + has_trait = wrathful + has_trait = drunkard + has_trait = honest + has_trait = eccentric + has_trait = impatient + } + prestige_level <= 2 + NOT = { exists = scope:had_nick_the_obscene } + } + give_nickname = nick_the_obscene + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_obscene } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + has_trait = greedy + gold > massive_gold_value + NOT = { + has_trait = improvident + } + OR = { + has_royal_court = no + court_grandeur_current_level < court_grandeur_minimum_expected_level + } + NOT = { exists = scope:had_nick_the_miser } + } + give_nickname = nick_the_miser + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_miser } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + stress_level >= 3 + gold < 0 + NOT = { exists = scope:had_nick_the_unfortunate } + } + give_nickname = nick_the_unfortunate + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_the_unfortunate } + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + culture = { + OR = { + this = culture:norman + any_parent_culture_or_above = { this = culture:norman } + } + } + calc_true_if = { + amount >= 3 + has_trait = wrathful + has_trait = ambitious + has_trait = lifestyle_hunter + has_trait = education_martial + has_trait = logistician + } + NOT = { exists = scope:had_nick_curtmantle } + } + give_nickname = nick_curtmantle + # Flag this as having been spat out already, in case we're applying several nicknames in quick succession. + flag_random_nickname_as_taken_in_batch_effect = { NICK = nick_curtmantle } + trigger_event = lifestyle_nicknames.1000 + } + } + } +} + +#Chooses a random appropriate NEGATIVE nickname and sets it on the scoped character +#Much looser trigger than generic random nickname effect as it needs to get any that are relevant +set_random_negative_nickname_effect = { + save_scope_as = nick_recipient + custom_tooltip = receive_slanderous_nickname_tt + hidden_effect = { + random_list = { + 100 = { + trigger = { + is_male = yes + OR = { + has_trait = stubborn + has_trait = impatient + has_trait = ambitious + has_trait = arrogant + } + NOR = { + prestige_level >= 3 + portrait_shared_clothing_contents_trigger = { # They have a chance to be bald normally; it's not weird or tease-worthy + CULTURE_SCOPE = culture + CULTURE_FLAG = african + } + is_bald_trigger = yes + exists = scope:had_nick_the_actually_bald + } + any_claim = { + tier >= tier_kingdom + } + highest_held_title_tier < tier_kingdom + } + modifier = { + prestige_level < 2 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_bald_ironic + } + } + 10 = { + trigger = { + is_male = yes + age >= 30 + NOR = { + portrait_shared_clothing_contents_trigger = { # They have a chance to be bald normally; it's not weird or tease-worthy + CULTURE_SCOPE = culture + CULTURE_FLAG = african + } + is_bald_trigger = yes + exists = scope:had_nick_the_actually_bald + } + } + modifier = { + add = scope:nick_recipient.age + } + set_nickname_effect = { + NICKNAME = nick_the_actually_bald + } + } + 100 = { + trigger = { + NOR = { + has_trait = crusader_king + mpo_has_gok_mongol_empire_trigger = yes + } + NOT = { + any_realm_county = { + culture = scope:nick_recipient.culture + } + } + NOT = { + primary_title ?= { + any_past_holder = { + has_nickname = nick_the_stranger + } + } + } + } + modifier = { + NOT = { + any_realm_county = { + culture = { + cultural_acceptance = { target = scope:nick_recipient.culture value >= 40 } + } + } + } + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_stranger + } + } + 100 = { + trigger = { + is_playable_character = yes + NOR = { + any_sub_realm_county = { + faith = scope:nick_recipient.faith + } + AND = { + top_liege != this + faith = liege.faith + } + government_has_flag = government_is_theocracy + government_has_flag = government_is_landless_adventurer + } + } + modifier = { + has_trait = zealous + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_faith + } + } + 100 = { + trigger = { + OR = { + has_trait = deceitful + has_trait = fickle + has_trait = ambitious + has_trait = greedy + has_trait = eccentric + has_trait = gregarious + has_Trait = arbitrary + } + NOR = { + has_trait = shy + has_trait = calm + } + ai_boldness >= 75 + ai_honor < -25 + } + modifier = { + ai_honor <= -100 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_troublemaker + } + } + 100 = { + trigger = { + is_male = yes + OR = { + has_trait = lazy + has_trait = lunatic + has_trait = drunkard + has_trait = hashishiyah + has_trait = beauty_bad_1 + has_trait = beauty_bad_2 + has_trait = beauty_bad_3 + } + is_bald_trigger = no + } + modifier = { + prestige_level < 2 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_hairy + } + } + 100 = { + trigger = { + is_in_civil_war = yes + tyranny > 0 + } + modifier = { + diplomacy <= 4 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_unready + } + } + 100 = { + trigger = { + OR = { + has_trait = wrathful + has_trait = irritable + has_trait = impatient + has_trait = ambitious + has_trait = vengeful + } + is_at_war = yes + any_character_war = { + primary_attacker = scope:nick_recipient + } + } + modifier = { + calc_true_if = { + amount >= 2 + has_trait = wrathful + has_trait = irritable + has_trait = impatient + has_trait = ambitious + has_trait = vengeful + } + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_quarreller + } + } + 100 = { + trigger = { + OR = { + has_trait = wrathful + has_trait = irritable + has_trait = impatient + has_trait = fickle + } + is_at_war = yes + any_character_war = { + primary_attacker = scope:nick_recipient + attacker_war_score <= -50 + } + } + modifier = { + calc_true_if = { + amount >= 2 + has_trait = wrathful + has_trait = irritable + has_trait = impatient + has_trait = fickle + } + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_rash + } + } + 100 = { + trigger = { + OR = { + has_trait = deceitful + has_trait = arbitrary + has_trait = ambitious + has_trait = callous + has_trait = sadistic + has_trait = disloyal + has_trait = fickle + } + any_killed_character = { + is_close_family_of = scope:nick_recipient + } + } + modifier = { + is_at_war_with_liege = yes + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_traitor + } + } + 100 = { + trigger = { + has_personality_malicious_trigger = yes + any_killed_character = { + count >= 10 + death_reason = death_execution + } + } + set_nickname_effect = { + NICKNAME = nick_the_executioner + } + } + 50 = { + trigger = { + learning >= 10 + has_personality_dominant_trigger = yes + has_personality_extroverted_trigger = yes + } + modifier = { + is_clergy = yes + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_turbulent + } + } + 100 = { + trigger = { + has_trait = witch + NOT = { faith = { has_doctrine = doctrine_witchcraft_accepted } } + } + modifier = { + piety_level <= 1 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_witch + } + } + 100 = { + trigger = { + piety_level <= 1 + ai_rationality <= -25 + stress_level >= 1 + } + set_nickname_effect = { + NICKNAME = nick_the_bewitched + } + } + 100 = { + trigger = { + has_trait = drunkard + } + modifier = { + prestige_level <= 1 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_drunkard + } + } + 100 = { + trigger = { + has_trait = drunkard + faith = faith:norse_pagan + } + modifier = { + prestige_level <= 1 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_ale_lover + } + } + 100 = { + trigger = { + ai_greed >= 50 + } + modifier = { + has_trait = greedy + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_greedy + } + } + 100 = { + trigger = { + culture = culture:anglo_saxon + is_male = yes + ai_greed >= 50 + gold >= 100 + } + modifier = { + has_trait = greedy + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_pennyfather + } + } + 100 = { + trigger = { + has_trait = gluttonous + has_personality_introverted_trigger = no + } + set_nickname_effect = { + NICKNAME = nick_foul_fart + } + } + 100 = { + trigger = { + OR = { + has_personality_submissive_trigger = yes + has_personality_introverted_trigger = yes + } + } + set_nickname_effect = { + NICKNAME = nick_the_timid + } + } + 100 = { + trigger = { + any_powerful_vassal = { + count >= 3 + } + any_powerful_vassal = { + count = all + opinion = { + target = scope:nick_recipient + value <= -25 + } + } + } + modifier = { + prestige_level <= 0 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_unworthy + } + } + 100 = { + trigger = { + OR = { + has_trait = adulterer + AND = { + exists = primary_spouse + exposed_cheating_on_spouse_trigger = { SPOUSE = scope:nick_recipient.primary_spouse } + } + } + + } + set_nickname_effect = { + NICKNAME = nick_the_unfaithful + } + } + 100 = { + trigger = { + is_male = yes + any_child = { + count >= 4 + mother ?= { + is_married = yes + NOT = { + is_consort_of = scope:nick_recipient + } + } + } + any_child = { + count = all + mother ?= { + is_married = yes + NOT = { + is_consort_of = scope:nick_recipient + } + add_to_temporary_list = cuckoo + } + } + any_in_list = { + list = cuckoo + count >= 4 + } + } + set_nickname_effect = { + NICKNAME = nick_cuckoo + } + } + 100 = { + trigger = { + OR = { + has_trait = fornicator + has_trait = adulterer + AND = { + exists = primary_spouse + exposed_cheating_on_spouse_trigger = { SPOUSE = scope:nick_recipient.primary_spouse } + } + } + } + set_nickname_effect = { + NICKNAME = nick_the_unchaste + } + } + 100 = { + trigger = { + is_female = yes + any_relation = { type = lover } + OR = { + has_trait = lustful + has_trait = beauty_good + attraction >= 50 + has_trait = fornicator + has_trait = adulterer + } + } + modifier = { + num_of_relation_lover >= 2 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_temptress + } + } + 100 = { + trigger = { + is_female = yes + any_relation = { type = lover } + OR = { + has_trait = lustful + has_trait = beauty_good + attraction >= 50 + has_trait = fornicator + has_trait = adulterer + } + } + modifier = { + num_of_relation_lover >= 2 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_seductress + } + } + 100 = { + trigger = { + OR = { + has_trait = lustful + has_trait = lovers_pox + has_trait = early_great_pox + has_trait = great_pox + has_trait = deviant + } + } + modifier = { + any_relation = { type = lover } + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_lewd + } + } + 100 = { + trigger = { + is_male = yes + any_relation = { type = lover } + OR = { + has_trait = lustful + has_trait = beauty_good + attraction >= 50 + has_trait = fornicator + has_trait = adulterer + } + } + modifier = { + num_of_relation_lover >= 2 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_lecher + } + } + 100 = { + trigger = { + is_male = yes + any_relation = { type = lover } + OR = { + has_trait = lustful + has_trait = beauty_good + attraction >= 50 + has_trait = fornicator + has_trait = adulterer + } + } + modifier = { + num_of_relation_lover >= 2 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_seducer + } + } + 100 = { + trigger = { + OR = { + has_trait = deceitful + has_trait = schemer + has_trait = disloyal + } + intrigue >= 12 + } + modifier = { + intrigue >= 20 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_trickster + } + } + 100 = { + trigger = { + diplomacy >= 10 + intrigue >= 10 + learning >= 10 + martial >= 10 + stewardship >= 10 + ai_rationality >= 25 + } + modifier = { + prestige_level >= 3 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_shrewd + } + } + 100 = { + trigger = { + ai_rationality <= -50 + OR = { + has_personality_emotional_trigger = yes + has_personality_extroverted_trigger = yes + } + has_personality_dominant_trigger = no + } + modifier = { + ai_rationality <= -75 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_silly + } + } + 100 = { + trigger = { + gold >= 500 + ai_greed >= 50 + } + modifier = { + gold >= 2000 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_moneybags + } + } + 100 = { + trigger = { + has_personality_malicious_trigger = yes + ai_boldness >= 25 + any_killed_character = { + count >= 1 + always = yes + } + } + modifier = { + any_killed_character = { + count >= 3 + always = yes + } + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_ruthless + } + } + 100 = { + trigger = { + has_personality_dominant_trigger = yes + has_personality_malicious_trigger = yes + prowess >= 12 + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:nick_recipient } + } + set_nickname_effect = { + NICKNAME = nick_the_brute + } + } + 100 = { + trigger = { + OR = { + has_trait = sadistic + has_trait = torturer + has_trait = murderer + has_trait = kinslayer_1 + has_trait = kinslayer_2 + has_trait = kinslayer_3 + } + } + modifier = { + any_killed_character = { + count >= 4 + always = yes + } + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_butcher + } + } + 100 = { + trigger = { + any_killed_character = { + count >= 3 + always = yes + } + } + modifier = { + any_killed_character = { + count >= 5 + always = yes + } + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_bloody + } + } + 100 = { + trigger = { + OR = { + has_trait = shy + has_trait = reclusive + has_trait = content + } + has_personality_introverted_trigger = yes + } + set_nickname_effect = { + NICKNAME = nick_the_silent + } + } + 100 = { + trigger = { + OR = { + has_trait = deviant + has_trait = cannibal + has_trait = lunatic + has_trait = incestuous + AND = { + has_personality_malicious_trigger = yes + has_personality_emotional_trigger = yes + } + } + } + set_nickname_effect = { + NICKNAME = nick_the_depraved + } + } + 100 = { + trigger = { + has_personality_malicious_trigger = yes + OR = { + has_trait = torturer + has_trait = sadistic + has_trait = callous + has_trait = vengeful + tyranny > 0 + dread >= 50 + } + } + set_nickname_effect = { + NICKNAME = nick_the_cruel + } + } + 100 = { + trigger = { + has_personality_malicious_trigger = yes + OR = { + has_trait = giant + has_trait = beauty_bad_2 + has_trait = beauty_bad_3 + has_trait = scaly + } + OR = { + tyranny > 0 + dread >= 20 + } + } + set_nickname_effect = { + NICKNAME = nick_the_abominable + } + } + 100 = { + trigger = { + OR = { + AND = { + has_personality_malicious_trigger = yes + num_sinful_traits = 1 + } + num_sinful_traits > 1 + piety_level <= 0 + has_trait = excommunicated + } + } + modifier = { + num_sinful_traits > 2 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_wicked + } + } + 100 = { + trigger = { + OR = { + num_sinful_traits >= 1 + piety_level <= 0 + has_trait = excommunicated + } + } + modifier = { + num_sinful_traits >= 2 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_accursed + } + } + 100 = { + trigger = { + exists = cp:councillor_court_chaplain + opinion = { + target = cp:councillor_court_chaplain + value <= -50 + } + } + modifier = { + num_sinful_traits >= 1 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_priest_hater + } + } + 100 = { + trigger = { + top_liege != this + NOR = { + religion = liege.religion + faith = { has_doctrine = doctrine_pluralism_pluralistic } + } + } + set_nickname_effect = { + NICKNAME = nick_the_heathen + } + } + 100 = { + trigger = { + faith.religion = { is_in_family = rf_abrahamic } + OR = { + dread >= 25 + piety_level <= 0 + has_trait = excommunicated + } + has_personality_malicious_trigger = yes + } + modifier = { + num_sinful_traits >= 2 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_devil + } + } + 100 = { + trigger = { + faith.religion = { is_in_family = rf_abrahamic } + OR = { + num_sinful_traits >= 1 + piety_level <= 0 + has_trait = excommunicated + } + has_personality_dominant_trigger = yes + } + set_nickname_effect = { + NICKNAME = nick_the_black + } + } + 100 = { + trigger = { + OR = { + AND = { + has_personality_malicious_trigger = yes + dread > 0 + } + tyranny >= 10 + dread >= 50 + } + } + modifier = { + tyranny >= 75 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_terrible + } + } + 100 = { + trigger = { + OR = { + has_personality_dominant_trigger = yes + tyranny >= 25 + } + tyranny >= 0 + } + modifier = { + tyranny >= 50 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_tyrant + } + } + 50 = { + trigger = { + age >= 60 + } + modifier = { + age >= 80 + factor = 5 + } + set_nickname_effect = { + NICKNAME = nick_the_old + } + } + 100 = { + trigger = { + OR = { + has_trait = shy + has_trait = reclusive + } + has_personality_introverted_trigger = yes + } + modifier = { + has_personality_submissive_trigger = yes + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_shy + } + } + 100 = { + trigger = { + age <= 25 + } + modifier = { + age <= 20 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_young + } + } + 100 = { + trigger = { + is_male = yes + OR = { + has_trait = bastard + has_trait = legitimized_bastard + has_trait = bastard_founder + } + } + modifier = { + prestige_level <= 1 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_bastard + } + } + 100 = { + trigger = { + OR = { + AND = { + has_personality_dominant_trigger = yes + ai_boldness >= 50 + } + has_trait = arrogant + has_trait = ambitious + } + } + modifier = { + prestige_level >= 2 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_proud + } + } + 100 = { + trigger = { + OR = { + loves_food_trigger = yes + has_trait = lifestyle_reveler + has_trait = gluttonous + current_weight >= 50 + } + } + modifier = { + current_weight >= 75 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_girthy + } + } + 100 = { + trigger = { + OR = { + has_trait = lunatic + has_trait = possessed + has_trait = eccentric + AND = { + ai_rationality <= -50 + tyranny >= 25 + has_personality_emotional_trigger = yes + } + } + } + set_nickname_effect = { + NICKNAME = nick_the_mad + } + } + 100 = { + trigger = { + probably_unintelligent_trigger = yes + } + set_nickname_effect = { + NICKNAME = nick_the_simple + } + } + 500 = { + trigger = { + has_trait = leper + } + set_nickname_effect = { + NICKNAME = nick_the_leper + } + } + 300 = { + trigger = { + OR = { + has_trait = maimed + scarred_trait_activation_3 = yes + } + } + set_nickname_effect = { + NICKNAME = nick_half_hand + } + } + 100 = { + trigger = { + OR = { + has_trait = beauty_bad + has_trait = hunchbacked + has_trait = scaly + has_trait = disfigured + has_trait = inbred + scarred_trait_activation_3 = yes + } + NOT = { + has_trait = beauty_good + } + } + modifier = { + OR = { + has_trait = beauty_bad_2 + has_trait = beauty_bad_3 + } + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_hideous + } + } + 100 = { + trigger = { + OR = { + has_trait = beauty_bad + has_trait = hunchbacked + has_trait = scaly + has_trait = inbred + } + NOT = { + has_trait = beauty_good + } + } + modifier = { + OR = { + has_trait = beauty_bad_2 + has_trait = beauty_bad_3 + } + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_frog + } + } + 100 = { + trigger = { + OR = { + has_trait = beauty_bad + has_trait = hunchbacked + has_trait = scaly + has_trait = inbred + scarred_trait_activation_3 = yes + } + NOT = { + has_trait = beauty_good + } + } + modifier = { + OR = { + has_trait = beauty_bad_2 + has_trait = beauty_bad_3 + } + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_repulsive + } + } + 100 = { + trigger = { + OR = { + has_trait = infirm + has_trait = weak + has_trait = spindly + has_trait = physique_bad + has_trait = bleeder + has_trait = inbred + } + NOT = { + has_trait = physique_good + } + } + modifier = { + OR = { + has_trait = physique_bad_2 + has_trait = physique_bad_3 + } + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_frail + } + } + 100 = { + trigger = { + prowess < 10 + OR = { + has_trait = infirm + has_trait = spindly + has_trait = weak + has_trait = physique_bad + has_trait = bleeder + has_trait = inbred + prowess <= 2 + } + NOT = { + has_trait = physique_good + } + } + modifier = { + OR = { + has_trait = physique_bad_2 + has_trait = physique_bad_3 + } + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_weak + } + } + 100 = { + trigger = { + OR = { + has_trait = clubfooted + has_trait = weak + has_trait = spindly + has_trait = physique_bad + has_trait = infirm + } + NOT = { + has_trait = physique_good + } + } + modifier = { + has_trait = clubfooted + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_lame + } + } + 1000 = { + trigger = { + has_trait = lisping + has_trait = clubfooted + } + set_nickname_effect = { + NICKNAME = nick_the_lisp_and_lame + } + } + 300 = { + trigger = { + has_trait = hunchbacked + } + set_nickname_effect = { + NICKNAME = nick_the_hunchback + } + } + 100 = { + trigger = { + OR = { + loves_food_trigger = yes + has_trait = lifestyle_reveler + has_trait = gluttonous + current_weight >= 50 + } + } + modifier = { + current_weight >= 75 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_fat + } + } + 100 = { + trigger = { + culture = culture:anglo_saxon + OR = { + loves_food_trigger = yes + has_trait = lifestyle_reveler + current_weight >= 50 + } + } + modifier = { + current_weight >= 75 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_chubbycheeks + } + } + 50 = { + trigger = { + OR = { + current_weight >= 50 + loves_food_trigger = yes + has_trait = lifestyle_reveler + has_trait = gluttonous + } + diplomacy <= 8 + } + modifier = { + current_weight >= 75 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_slobberer + } + } + 50 = { + trigger = { + OR = { + current_weight >= 50 + loves_food_trigger = yes + has_trait = lifestyle_reveler + has_trait = gluttonous + } + } + modifier = { + current_weight >= 75 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_rotund + } + } + 25 = { + trigger = { + OR = { + current_weight >= 50 + loves_food_trigger = yes + has_trait = lifestyle_reveler + has_trait = gluttonous + } + } + modifier = { + current_weight >= 75 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_plump + } + } + 200 = { + trigger = { + has_trait = blind + } + set_nickname_effect = { + NICKNAME = nick_the_blind + } + } + 200 = { + trigger = { + has_trait = stuttering + } + set_nickname_effect = { + NICKNAME = nick_the_stammerer + } + } + 200 = { + trigger = { + has_trait = gout_ridden + } + set_nickname_effect = { + NICKNAME = nick_the_gouty + } + } + 100 = { + trigger = { + OR = { + has_trait = consumption + has_trait = cancer + has_trait = pneumonic + has_trait = typhus + has_trait = smallpox + has_trait = measles + has_trait = dysentery + has_trait = ergotism + has_trait = bubonic_plague + } + } + set_nickname_effect = { + NICKNAME = nick_the_diseased + } + } + 25 = { + trigger = { + dynasty ?= { dynasty_prestige_level >= 2 } + prestige_level <= 1 + } + set_nickname_effect = { + NICKNAME = nick_the_disgraceful + } + } + 100 = { + trigger = { + OR = { + has_trait = maimed + AND = { + has_trait = scarred + prowess < 8 + } + } + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:nick_recipient } + } + set_nickname_effect = { + NICKNAME = nick_bad_hand + } + } + 100 = { + trigger = { + has_trait = one_eyed + } + set_nickname_effect = { + NICKNAME = nick_the_one_eyed + } + } + 50 = { + trigger = { + OR = { + has_trait = craven + AND = { + has_personality_submissive_trigger = yes + dread <= 0 + } + } + } + modifier = { + prestige_level <= 1 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_trembling + } + } + 100 = { + trigger = { + has_trait = craven + has_personality_submissive_trigger = yes + } + modifier = { + prestige_level <= 1 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_craven + } + } + 100 = { + trigger = { + OR = { + has_trait = lunatic + has_trait = possessed + has_trait = eccentric + AND = { + tyranny >= 50 + ai_rationality <= -50 + has_personality_emotional_trigger = yes + } + } + } + set_nickname_effect = { + NICKNAME = nick_the_insane + } + } + 100 = { + trigger = { + OR = { + AND = { + has_personality_introverted_trigger = yes + has_personality_levelheaded_trigger = yes + } + has_trait = depressed_1 + has_trait = depressed_genetic + } + } + set_nickname_effect = { + NICKNAME = nick_the_joyless + } + } + 100 = { + trigger = { + probably_unintelligent_trigger = yes + OR = { + has_personality_introverted_trigger = yes + has_personality_levelheaded_trigger = yes + } + } + set_nickname_effect = { + NICKNAME = nick_the_dull + } + } + 100 = { + trigger = { + has_trait = one_eyed + } + set_nickname_effect = { + NICKNAME = nick_one_eye + } + } + 300 = { + trigger = { + has_trait = maimed + } + set_nickname_effect = { + NICKNAME = nick_one_hand + } + } + 300 = { + trigger = { + intrigue >= 15 + has_trait = disfigured + } + set_nickname_effect = { + NICKNAME = nick_of_a_thousand_faces + } + } + 100 = { + trigger = { + OR = { + has_trait = consumption + has_trait = cancer + has_trait = pneumonic + has_trait = typhus + has_trait = smallpox + has_trait = measles + has_trait = dysentery + has_trait = ergotism + has_trait = bubonic_plague + } + } + set_nickname_effect = { + NICKNAME = nick_the_plaguebearer + } + } + 100 = { + trigger = { + OR = { + has_trait = physique_good + has_trait = beauty_good + } + OR = { + has_trait = physique_bad_2 + has_trait = physique_bad_3 + has_trait = beauty_bad_2 + has_trait = beauty_bad_3 + has_trait = giant + has_trait = albino + has_trait = scaly + has_trait = spindly + has_trait = hunchbacked + } + } + set_nickname_effect = { + NICKNAME = nick_the_chimera + } + } + 50 = { + trigger = { + highest_held_title_tier <= tier_duchy + domain_size <= 2 + any_sibling = { + highest_held_title_tier >= tier_kingdom + domain_size >= 4 + prestige_level >= scope:nick_recipient.prestige_level + } + } + set_nickname_effect = { + NICKNAME = nick_lackland + } + } + 100 = { + trigger = { + OR = { + has_trait = strong + has_trait = physique_good + prowess >= 18 + } + OR = { + has_trait = beauty_bad + has_trait = hunchbacked + has_trait = scaly + has_trait = disfigured + scarred_trait_activation_3 = yes + } + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:nick_recipient } + } + set_nickname_effect = { + NICKNAME = nick_the_boar + } + } + 100 = { + trigger = { + has_trait = disfigured + has_personality_introverted_trigger = yes + } + set_nickname_effect = { + NICKNAME = nick_the_faceless + } + } + 300 = { + trigger = { + has_trait = giant + has_trait = one_eyed + } + set_nickname_effect = { + NICKNAME = nick_the_cyclops + } + } + 100 = { + trigger = { + has_trait = giant + OR = { + has_trait = weak + has_trait = spindly + has_trait = physique_bad + } + } + set_nickname_effect = { + NICKNAME = nick_the_beanstalk + } + } + 100 = { + trigger = { + OR = { + tyranny > 0 + stewardship <= 4 + } + diplomacy <= 8 + } + modifier = { + diplomacy <= 4 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_ill_ruler + } + } + 100 = { + trigger = { + is_in_civil_war = yes + OR = { + tyranny > 0 + diplomacy <= 8 + } + } + modifier = { + diplomacy <= 4 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_careless + } + } + 50 = { + trigger = { + gold <= 0 + } + modifier = { + factor = debt_level + } + set_nickname_effect = { + NICKNAME = nick_of_the_empty_pockets + } + } + 100 = { + trigger = { + OR = { + has_trait = infirm + probably_unintelligent_trigger = yes + } + } + modifier = { + has_trait = fickle + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_forgetful + } + } + 100 = { + trigger = { + OR = { + has_trait = shy + has_trait = reclusive + } + has_personality_introverted_trigger = yes + } + set_nickname_effect = { + NICKNAME = nick_the_hermit + } + } + 100 = { + trigger = { + OR = { + has_trait = shy + has_trait = reclusive + } + has_personality_introverted_trigger = yes + } + set_nickname_effect = { + NICKNAME = nick_the_recluse + } + } + 100 = { + trigger = { + OR = { + has_trait = infirm + has_trait = spindly + has_trait = weak + has_trait = physique_bad + has_trait = bleeder + has_trait = inbred + prowess <= 2 + } + NOR = { + has_trait = strong + has_trait = physique_good + } + } + set_nickname_effect = { + NICKNAME = nick_the_feeble + } + } + 100 = { + trigger = { + has_personality_dominant_trigger = yes + OR = { + has_trait = arrogant + has_trait = lustful + has_trait = lazy + has_personality_extroverted_trigger = yes + } + has_trait = beauty_good + } + set_nickname_effect = { + NICKNAME = nick_the_vain + } + } + 100 = { + trigger = { + ai_zeal >= 100 + ai_rationality <= -20 + } + set_nickname_effect = { + NICKNAME = nick_the_zealot + } + } + 100 = { + trigger = { + has_personality_malicious_trigger = yes + OR = { + has_trait = sadistic + has_trait = callous + num_sinful_traits >= 1 + } + } + modifier = { + num_sinful_traits >= 2 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_evil + } + } + 100 = { + trigger = { + OR = { + has_trait = lifestyle_mystic + has_trait = lunatic + has_trait = possessed + has_trait = witch + has_trait = eccentric + } + has_trait_malicious_trigger = no + } + set_nickname_effect = { + NICKNAME = nick_the_strange + } + } + 100 = { + trigger = { + has_trait = possessed + } + set_nickname_effect = { + NICKNAME = nick_the_haunted + } + } + 300 = { + trigger = { + OR = { + AND = { + diplomacy <= 6 + stewardship <= 6 + martial <= 6 + intrigue <= 6 + learning <= 6 + } + stress_level >= 3 + } + } + set_nickname_effect = { + NICKNAME = nick_the_unlucky + } + } + 100 = { + trigger = { + is_male = yes + prowess <= 4 + martial <= 4 + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:nick_recipient } + } + set_nickname_effect = { + NICKNAME = nick_the_effeminate + } + } + 100 = { + trigger = { + is_male = yes + culture = culture:anglo_saxon + prowess <= 6 + fertility <= 0.4 + NOT = { + any_child = { + count > 1 + } + } + } + set_nickname_effect = { + NICKNAME = nick_softsword + } + } + 100 = { + trigger = { + has_trait = fickle + ai_rationality <= -25 + } + modifier = { + probably_unintelligent_trigger = yes + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_clueless + } + } + 100 = { + trigger = { + ai_vengefulness >= 35 + OR = { + has_trait = wrathful + has_trait = irritable + has_trait = fickle + has_trait = stubborn + } + } + set_nickname_effect = { + NICKNAME = nick_the_ill_tempered + } + } + 100 = { + trigger = { + OR = { + has_trait = lazy + AND = { + has_trait = reclusive + ai_energy <= -20 + } + } + NOR = { + has_trait = ambitious + has_trait = diligent + } + } + modifier = { + calc_true_if = { + amount >= 2 + prestige_level <= 2 + } + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_do_nothing + } + } + 100 = { + trigger = { + has_trait = lazy + ai_greed <= -20 + NOR = { + has_trait = ambitious + } + } + modifier = { + calc_true_if = { + amount >= 2 + prestige_level <= 2 + } + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_indolent + } + } + 100 = { + trigger = { + has_trait = lazy + ai_boldness <= -20 + } + modifier = { + calc_true_if = { + amount >= 2 + prestige_level <= 2 + } + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_sluggard + } + } + 100 = { + trigger = { + has_trait = lazy + ai_boldness <= -20 + ai_energy <= -20 + } + modifier = { + calc_true_if = { + amount >= 2 + prestige_level <= 2 + } + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_idle + } + } + 100 = { + trigger = { + has_trait = dwarf + } + set_nickname_effect = { + NICKNAME = nick_the_short + } + } + 100 = { + trigger = { + has_trait = dwarf + } + set_nickname_effect = { + NICKNAME = nick_elbow_high + } + } + 100 = { + trigger = { + has_trait = wrathful + ai_rationality <= -25 + any_relation = { type = rival } + } + set_nickname_effect = { + NICKNAME = nick_the_wrathful + } + } + 100 = { + trigger = { + diplomacy <= 4 + has_personality_emotional_trigger = yes + } + set_nickname_effect = { + NICKNAME = nick_the_petulant + } + } + 100 = { + trigger = { + has_personality_emotional_trigger = yes + num_of_relation_rival >= 2 + } + set_nickname_effect = { + NICKNAME = nick_the_quarrelsome + } + } + 100 = { + trigger = { is_eunuch_trigger = yes } + set_nickname_effect = { + NICKNAME = nick_the_eunuch + } + } + 2000 = { + trigger = { + has_trait = incapable + } + set_nickname_effect = { + NICKNAME = nick_the_sleeper + } + } + 2000 = { + trigger = { + has_trait = incapable + highest_held_title_tier >= tier_kingdom + } + set_nickname_effect = { + NICKNAME = nick_the_sleeping_king + } + } + 1000 = { + trigger = { + exists = liege + exists = mother + liege.culture = { + OR = { + this = culture:greek + any_parent_culture_or_above = { + this = culture:greek + } + } + } + culture = { + OR = { + this = culture:greek + any_parent_culture_or_above = { + this = culture:greek + } + } + } + mother.culture = { + NOR = { + this = culture:greek + any_parent_culture_or_above = { + this = culture:greek + } + } + } + NOT = { + faith = { has_dominant_ruling_gender = dummy_male} + } + } + give_nickname = nick_the_foreign_mother + trigger_event = lifestyle_nicknames.1000 + } + 1000 = { + trigger = { + exists = liege + exists = father + liege.culture = { + OR = { + this = culture:greek + any_parent_culture_or_above = { + this = culture:greek + } + } + } + culture = { + OR = { + this = culture:greek + any_parent_culture_or_above = { + this = culture:greek + } + } + } + father.culture = { + NOR = { + this = culture:greek + any_parent_culture_or_above = { + this = culture:greek + } + } + } + NOT = { + faith = { has_dominant_ruling_gender = dummy_female} + } + } + give_nickname = nick_the_foreign_father + trigger_event = lifestyle_nicknames.1000 + } + 100 = { + trigger = { + OR = { + loves_food_trigger = yes + has_trait = lifestyle_reveler + has_trait = gluttonous + current_weight >= 50 + } + } + modifier = { + current_weight >= 75 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_corpulent + } + } + 100 = { + trigger = { + top_liege != this + OR = { + is_a_faction_member = yes + has_trait = disloyal + opinion = { + target = liege + value <= -60 + } + } + ai_boldness >= low_positive_ai_value + } + set_nickname_effect = { + NICKNAME = nick_the_insubordinate + } + } + 100 = { + trigger = { + has_trait = disloyal + intrigue >= 10 + } + modifier = { + is_at_war_with_liege = yes + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_backstabber + } + } + 100 = { + trigger = { + ai_greed >= 25 + ai_honor <= 25 + gold >= massive_gold_value + } + modifier = { + has_trait = disloyal + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_corrupt + } + } + 100 = { + trigger = { + probably_unintelligent_trigger = yes + OR = { + AND = { + diplomacy <= 6 + martial <= 6 + stewardship <= 6 + intrigue <= 6 + learning <= 6 + } + AND = { + government_allows = administrative + governor_efficiency <= 0.7 + } + } + } + modifier = { + government_allows = administrative + governor_efficiency <= 0.6 + factor = 2 + } + set_nickname_effect = { + NICKNAME = nick_the_incompetent + } + } + 100 = { + trigger = { + ai_rationality <= -25 + ai_boldness > 0 + OR = { + has_trait = profligate + has_trait = reckless + } + } + set_nickname_effect = { + NICKNAME = nick_the_gambler + } + } + 100 = { + trigger = { + diplomacy <= 5 + has_personality_extroverted_trigger = yes + OR = { + has_trait = wrathful + has_trait = drunkard + has_trait = honest + has_trait = eccentric + has_trait = impatient + } + } + set_nickname_effect = { + NICKNAME = nick_the_obscene + } + } + 100 = { + trigger = { + has_trait = greedy + gold >= major_gold_value + NOT = { + has_trait = improvident + } + OR = { + has_royal_court = no + court_grandeur_current_level < court_grandeur_minimum_expected_level + } + } + set_nickname_effect = { + NICKNAME = nick_the_miser + } + } + #Fallback + 1 = { + trigger = { + } + set_nickname_effect = { + NICKNAME = nick_the_unfortunate + } + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_parent_effects.txt b/N3OW/common/scripted_effects/00_parent_effects.txt new file mode 100644 index 00000000..ef3bff84 --- /dev/null +++ b/N3OW/common/scripted_effects/00_parent_effects.txt @@ -0,0 +1,84 @@ +#Effects used in parent events + + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! +# + +#increase_parent_meddling_value_effect +#decrease_parent_meddling_value_effect + + +###################################################################### +# EFFECTS +###################################################################### + +#Effects for increasing and decreasing the parent_meddling variable value used in parent_events +increase_parent_meddling_value_effect = { + hidden_effect = { + if = { + limit = { + root = { is_ai = no } + has_variable = parent_meddling + } + change_variable = { + name = parent_meddling + add = 1 + } + } + else = { + set_variable = { + name = parent_meddling + value = 1 + } + } + random = { + chance = 10 + modifier = { + trigger = { has_variable = parent_meddling } + add = { + value = var:parent_meddling + multiply = 10 + } + } + trigger_event = { + on_action = parent_meddling_outcome + days = { 180 365 } + } + } + } +} + +decrease_parent_meddling_value_effect = { + hidden_effect = { + if = { + limit = { + root = { is_ai = no } + has_variable = parent_meddling + var:parent_meddling > 1 + } + change_variable = { + name = parent_meddling + add = -1 + } + } + else_if = { + limit = { has_variable = parent_meddling } + remove_variable = parent_meddling + } + } +} + +remove_parent_meddling_value_effect = { + hidden_effect = { + if = { + limit = { + root = { is_ai = no } + has_variable = parent_meddling + } + remove_variable = parent_meddling + } + } +} \ No newline at end of file diff --git a/N3OW/common/scripted_effects/00_personal_details_effects.txt b/N3OW/common/scripted_effects/00_personal_details_effects.txt new file mode 100644 index 00000000..0fb9342c --- /dev/null +++ b/N3OW/common/scripted_effects/00_personal_details_effects.txt @@ -0,0 +1,1422 @@ +#Effects used in parent events + + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! +# + +#assign_quirk_effect +#get_quirk_character_effect = Used to make sure that a character used for a quirk has one, and utilises assign_quirk_effect if they're missing one. +#set_signature_weapon_effect +#pick_servant_romance_target_effect +#set_favorite_treat_effect +#set_favorite_toy_effect + +###################################################################### +# EFFECTS +###################################################################### + + +#Used to find a permanent quirk for a character +# Use get_quirk_character_effect for better performence as it also checks if root in an event is an AI! +assign_quirk_effect = { + if = { + limit = { + exists = var:my_quirk + var:my_quirk = flag:fallback + } + remove_variable = my_quirk #to give character's that were assigned the fallback a chance for better things + } + if = { + limit = { + NOT = { exists = var:my_quirk } + } + hidden_effect = { + random_list = { + 1 = { + trigger = { + OR = { + has_trait = shy + has_trait = pensive + } + } + set_variable = { + name = my_quirk + value = flag:shy + } + } + 1 = { + trigger = { has_trait = arrogant } + set_variable = { + name = my_quirk + value = flag:arrogant + } + } + 1 = { + trigger = { has_trait = impatient } + set_variable = { + name = my_quirk + value = flag:impatient + } + } + 1 = { + trigger = { has_trait = lustful } + set_variable = { + name = my_quirk + value = flag:lustful + } + } + 1 = { + trigger = { has_trait = chaste } + set_variable = { + name = my_quirk + value = flag:chaste + } + } + 1 = { + trigger = { has_trait = temperate } + set_variable = { + name = my_quirk + value = flag:temperate + } + } + 1 = { + trigger = { has_trait = gluttonous } + set_variable = { + name = my_quirk + value = flag:gluttonous + } + } + 1 = { + trigger = { has_trait = greedy } + set_variable = { + name = my_quirk + value = flag:greedy + } + } + 1 = { + trigger = { + OR = { + has_trait = diligent + has_trait = bossy + has_trait = curious + } + } + set_variable = { + name = my_quirk + value = flag:diligent + } + } + 1 = { + trigger = { has_trait = lazy } + set_variable = { + name = my_quirk + value = flag:lazy + } + } + 1 = { + trigger = { has_trait = wrathful } + set_variable = { + name = my_quirk + value = flag:wrathful + } + } + 1 = { + trigger = { + OR = { + has_trait = calm + has_trait = pensive + } + } + set_variable = { + name = my_quirk + value = flag:calm + } + } + 1 = { + trigger = { has_trait = impatient } + set_variable = { + name = my_quirk + value = flag:impatient + } + } + 1 = { + trigger = { has_trait = humble } + set_variable = { + name = my_quirk + value = flag:humble + } + } + 1 = { + trigger = { + OR = { + has_trait = deceitful + has_trait = charming + } + } + set_variable = { + name = my_quirk + value = flag:deceitful + } + } + 1 = { + trigger = { has_trait = honest } + set_variable = { + name = my_quirk + value = flag:honest + } + } + 1 = { + trigger = { has_trait = generous } + set_variable = { + name = my_quirk + value = flag:generous + } + } + 1 = { + trigger = { has_trait = craven } + set_variable = { + name = my_quirk + value = flag:craven + } + } + 1 = { + trigger = { + OR = { + has_trait = brave + has_trait = rowdy + } + } + set_variable = { + name = my_quirk + value = flag:brave + } + } + 1 = { + trigger = { + OR = { + has_trait = gregarious + has_trait = charming + has_trait = curious + } + } + set_variable = { + name = my_quirk + value = flag:gregarious + } + } + 1 = { + trigger = { has_trait = ambitious } + set_variable = { + name = my_quirk + value = flag:ambitious + } + } + 1 = { + trigger = { has_trait = arbitrary } + set_variable = { + name = my_quirk + value = flag:arbitrary + } + } + 1 = { + trigger = { has_trait = just } + set_variable = { + name = my_quirk + value = flag:just + } + } + 1 = { + trigger = { has_trait = cynical } + set_variable = { + name = my_quirk + value = flag:cynical + } + } + 1 = { + trigger = { has_trait = zealous } + set_variable = { + name = my_quirk + value = flag:zealous + } + } + 1 = { + trigger = { has_trait = paranoid } + set_variable = { + name = my_quirk + value = flag:paranoid + } + } + 1 = { + trigger = { has_trait = trusting } + set_variable = { + name = my_quirk + value = flag:trusting + } + } + 1 = { + trigger = { has_trait = compassionate } + set_variable = { + name = my_quirk + value = flag:compassionate + } + } + 1 = { + trigger = { has_trait = sadistic } + set_variable = { + name = my_quirk + value = flag:sadistic + } + } + 1 = { + trigger = { has_trait = vengeful } + set_variable = { + name = my_quirk + value = flag:vengeful + } + } + 1 = { + trigger = { has_trait = forgiving } + set_variable = { + name = my_quirk + value = flag:forgiving + } + } + 1 = { + trigger = { has_trait = lunatic } + set_variable = { + name = my_quirk + value = flag:lunatic + } + } + 1 = { + trigger = { has_trait = leper } + set_variable = { + name = my_quirk + value = flag:leper + } + } + 1 = { + trigger = { has_trait = gout_ridden } + set_variable = { + name = my_quirk + value = flag:gout_ridden + } + } + 1 = { + trigger = { has_trait = consumption } + set_variable = { + name = my_quirk + value = flag:consumption + } + } + 1 = { + trigger = { number_of_personality_traits = 0 } #fallback for kids etc. + set_variable = { + name = my_quirk + value = flag:fallback + } + } + } + } + } +} + + +#Used to make sure that a character used for a quirk has one +#Utilises assign_quirk_effect, and must always be placed in the same file, after that one. +get_quirk_character_effect = { + if = { + limit = { + root = { is_ai = no } + } + if = { + limit = { + has_variable = my_quirk + } + save_scope_as = quirk_character + } + else = { + assign_quirk_effect = yes + save_scope_as = quirk_character + } + } +} + + +#Sets a character's signature weapon effect, if they do not already have one. +set_signature_weapon_effect = { + save_temporary_scope_as = this_character + # If we're wielding an artifact weapon, override our signature weapon type with what we have equipped. + if = { + limit = { + NOT = { has_variable = temporary_signature_weapon } + any_equipped_character_artifact = { + artifact_slot_type = primary_armament + OR = { + artifact_type = axe + artifact_type = hammer + artifact_type = spear + artifact_type = mace + artifact_type = dagger + artifact_type = sword + } + } + } + random_equipped_character_artifact = { + limit = { + artifact_slot_type = primary_armament + OR = { + artifact_type = axe + artifact_type = hammer + artifact_type = spear + artifact_type = mace + artifact_type = dagger + artifact_type = sword + } + } + save_scope_as = equipped_signature_weapon + scope:this_character = { + set_variable = { + name = signature_weapon_scope + value = scope:equipped_signature_weapon + } + if = { + limit = { scope:equipped_signature_weapon = { artifact_type = axe } } + set_variable = { + name = signature_weapon + value = flag:axe + } + } + if = { + limit = { scope:equipped_signature_weapon = { artifact_type = hammer } } + set_variable = { + name = signature_weapon + value = flag:hammer + } + } + if = { + limit = { scope:equipped_signature_weapon = { artifact_type = spear } } + set_variable = { + name = signature_weapon + value = flag:spear + } + } + if = { + limit = { scope:equipped_signature_weapon = { artifact_type = mace } } + set_variable = { + name = signature_weapon + value = flag:mace + } + } + if = { + limit = { scope:equipped_signature_weapon = { artifact_type = dagger } } + set_variable = { + name = signature_weapon + value = flag:dagger + } + } + if = { + limit = { scope:equipped_signature_weapon = { artifact_type = sword } } + set_variable = { + name = signature_weapon + value = flag:sword + } + } + } + clear_saved_scope = equipped_signature_weapon # Clear the saved scope so we don't clone artifacts when this effect is run multiple times in sucession. + } + } + # Otherwise, if we do not have an equipped artifact AND we do not yet have a signature weapon type, pick one at random. + else_if = { + limit = { + NOR = { + has_variable = signature_weapon + has_variable = temporary_signature_weapon + } + } + hidden_effect = { + random_list = { + 30 = { + set_variable = { + name = signature_weapon + value = flag:sword + } + modifier = { + add = 150 + culture = { has_cultural_pillar = heritage_japonic } + } + } + + 10 = { + set_variable = { + name = signature_weapon + value = flag:mace + } + } + 10 = { + set_variable = { + name = signature_weapon + value = flag:axe + } + # Weight up the axe-bearing foreigners chance of bearing axes. + modifier = { + add = 150 + has_trait = varangian + } + modifier = { + add = 50 + culture = { has_cultural_pillar = heritage_north_germanic } + } + } + 5 = { + set_variable = { + name = signature_weapon + value = flag:hammer + } + } + 5 = { + set_variable = { + name = signature_weapon + value = flag:spear + } + } + 5 = { + trigger = { + intrigue > 12 + } + set_variable = { + name = signature_weapon + value = flag:dagger + } + } + } + } + + # If we had previously saved an equipped artifact scope, but no longer have that artifact equipped, remove the saved scope variable. + if = { + limit = { exists = var:signature_weapon_scope } + remove_variable = signature_weapon_scope + } + } +} + +#Sets a temporary signature weapon for a single duel. You have to assign WEAPON_TYPE parameter with a weapon type you want to use. +# Available weapon types: axe, hammer, spear, mace, dagger, sword, wooden_sword. +#Effect is removed by single_combat_clean_temp_weapon_effect triggered in combat conclusion events: single_combat.0031 and single_combat.0041 +set_temporary_signature_weapon = { + save_temporary_scope_as = wielding_character + scope:wielding_character = { + set_variable = { #save passed down weapon type to be the temp weapon for this battle + name = temporary_signature_weapon + value = flag:$WEAPON_TYPE$ + } + } + if = { + limit = { + scope:wielding_character = { + has_variable = signature_weapon + has_variable = temporary_signature_weapon + } + } + scope:wielding_character = { + set_variable = { #save the original signature_weapon if this character had one + name = og_signature_weapon + value = var:signature_weapon + } + switch = { #set the temporary weapon as a signature_weapon + trigger = var:temporary_signature_weapon + flag:axe = { + set_variable = { + name = signature_weapon + value = flag:axe + } + } + flag:hammer = { + set_variable = { + name = signature_weapon + value = flag:hammer + } + } + flag:spear = { + set_variable = { + name = signature_weapon + value = flag:spear + } + } + flag:mace = { + set_variable = { + name = signature_weapon + value = flag:mace + } + } + flag:dagger = { + set_variable = { + name = signature_weapon + value = flag:dagger + } + } + flag:sword = { + set_variable = { + name = signature_weapon + value = flag:sword + } + } + flag:wooden_sword = { + set_variable = { + name = signature_weapon + value = flag:wooden_sword + } + } + } + } + } + else_if = { + limit = { + scope:wielding_character = { + has_variable = temporary_signature_weapon + } + } + scope:wielding_character = { + set_variable = { #remember that there were no original signature_weapon + name = og_signature_weapon + value = flag:no_signature_weapon_yet + } + switch = { #set the temporary weapon as a signature_weapon + trigger = var:temporary_signature_weapon + flag:axe = { + set_variable = { + name = signature_weapon + value = flag:axe + } + } + flag:hammer = { + set_variable = { + name = signature_weapon + value = flag:hammer + } + } + flag:spear = { + set_variable = { + name = signature_weapon + value = flag:spear + } + } + flag:mace = { + set_variable = { + name = signature_weapon + value = flag:mace + } + } + flag:dagger = { + set_variable = { + name = signature_weapon + value = flag:dagger + } + } + flag:sword = { + set_variable = { + name = signature_weapon + value = flag:sword + } + } + flag:wooden_sword = { + set_variable = { + name = signature_weapon + value = flag:wooden_sword + } + } + } + } + } +} + +#Pick out "who" among the commoners a given character has a dalliance with +pick_servant_romance_target_effect = { + if = { + limit = { NOT = { has_variable = servant_romance_target } } + hidden_effect = { + random_list = { + 1 = { + trigger = { + is_attracted_to_men = yes + } + set_variable = { + name = servant_romance_target + value = flag:stable_boy + } + } + 1 = { + trigger = { + is_attracted_to_men = yes + } + set_variable = { + name = servant_romance_target + value = flag:page + } + } + 1 = { + trigger = { + is_attracted_to_women = yes + } + set_variable = { + name = servant_romance_target + value = flag:scullery_maid + } + } + 1 = { + set_variable = { + name = servant_romance_target + value = flag:chandler + } + } + 1 = { + trigger = { + is_attracted_to_women = yes + } + set_variable = { + name = servant_romance_target + value = flag:launderer + } + } + 1 = { + set_variable = { + name = servant_romance_target + value = flag:naperer + } + } + 1 = { + set_variable = { + name = servant_romance_target + value = flag:scalder + } + } + 1 = { + set_variable = { + name = servant_romance_target + value = flag:saucerer + } + } + } + } + } +} + +set_favorite_treat_effect = { + if = { + limit = { NOT = { has_variable = favorite_treat } } + hidden_effect = { + random_list = { + 10 = { + trigger = { + trigger_if = { + limit = { + exists = capital_province + is_travelling = no #Let's pick something from our location instead. + } + capital_province = { + NOT = { + geographical_region = world_europe_north + } + } + } + trigger_else_if = { + limit = { + exists = liege.capital_province + is_travelling = no #Let's pick something from our location instead. + } + liege.capital_province = { + NOT = { + geographical_region = world_europe_north + } + } + } + trigger_else_if = { + limit = { + exists = location + } + location = { + NOT = { + geographical_region = world_europe_north + } + } + } + trigger_else = { + always = no + } + } + set_variable = { + name = favorite_treat + value = flag:comfit #famous in sicily + } + } + 10 = { + set_variable = { + name = favorite_treat + value = flag:roasted_almonds + } + } + 10 = { + trigger = { + trigger_if = { + limit = { + exists = capital_province + is_travelling = no #Let's pick something from our location instead. + } + capital_province = { + OR = { + geographical_region = world_middle_east_persia + geographical_region = world_middle_east + geographical_region = world_asia_minor + geographical_region = world_india + geographical_region = world_africa_north + geographical_region = world_burma + geographical_region = world_europe_south + geographical_region = world_asia_china + geographical_region = world_asia_japan + geographical_region = world_asia_korea + geographical_region = world_asia_southeast + } + } + } + trigger_else_if = { + limit = { + exists = liege.capital_province + is_travelling = no #Let's pick something from our location instead. + } + liege.capital_province = { + OR = { + geographical_region = world_middle_east_persia + geographical_region = world_middle_east + geographical_region = world_asia_minor + geographical_region = world_india + geographical_region = world_africa_north + geographical_region = world_burma + geographical_region = world_europe_south + geographical_region = world_asia_china + geographical_region = world_asia_japan + geographical_region = world_asia_korea + geographical_region = world_asia_southeast + } + } + } + trigger_else_if = { + limit = { + exists = location + } + location = { + OR = { + geographical_region = world_middle_east_persia + geographical_region = world_middle_east + geographical_region = world_asia_minor + geographical_region = world_india + geographical_region = world_africa_north + geographical_region = world_burma + geographical_region = world_europe_south + geographical_region = world_asia_china + geographical_region = world_asia_japan + geographical_region = world_asia_korea + geographical_region = world_asia_southeast + } + } + } + trigger_else = { + always = no + } + } + set_variable = { + name = favorite_treat + value = flag:nougat + } + } + 10 = { + trigger = { + trigger_if = { + limit = { + exists = capital_province + is_travelling = no #Let's pick something from our location instead. + } + capital_province = { + NOT = { + geographical_region = world_europe_north + } + } + } + trigger_else_if = { + limit = { + exists = liege.capital_province + is_travelling = no #Let's pick something from our location instead. + } + liege.capital_province = { + NOT = { + geographical_region = world_europe_north + } + } + } + trigger_else_if = { + limit = { + exists = location + } + location = { + NOT = { + geographical_region = world_europe_north + } + } + } + trigger_else = { + always = no + } + } + set_variable = { + name = favorite_treat + value = flag:marzipan #europeans & arabs, possibly eastern asaia + } + } + 2 = { + set_variable = { + name = favorite_treat + value = flag:sweetroll #A northern delicacy + } + } + 10 = { + set_variable = { + name = favorite_treat + value = flag:poached_pear + } + } + 10 = { + set_variable = { + name = favorite_treat + value = flag:pudding + } + } + 10 = { + set_variable = { + name = favorite_treat + value = flag:apple_tart + } + } + 10 = { + set_variable = { + name = favorite_treat + value = flag:strawberry_compote + } + } + 10 = { + trigger = { + trigger_if = { + limit = { + exists = capital_province + is_travelling = no #Let's pick something from our location instead. + } + capital_province = { + OR = { + geographical_region = world_europe + geographical_region = custom_greater_armenia + } + } + } + trigger_else_if = { + limit = { + exists = liege.capital_province + is_travelling = no #Let's pick something from our location instead. + } + liege.capital_province = { + OR = { + geographical_region = world_europe + geographical_region = custom_greater_armenia + } + } + } + trigger_else_if = { + limit = { + exists = location + } + location = { + OR = { + geographical_region = world_europe + geographical_region = custom_greater_armenia + } + } + } + trigger_else = { + always = no + } + } + set_variable = { + name = favorite_treat + value = flag:gingerbread #europe, armenia + } + } + 5 = { + trigger = { + trigger_if = { + limit = { + exists = capital_province + is_travelling = no #Let's pick something from our location instead. + } + capital_province = { + geographical_region = world_europe_west + } + } + trigger_else_if = { + limit = { + exists = liege.capital_province + is_travelling = no #Let's pick something from our location instead. + } + liege.capital_province = { + geographical_region = world_europe_west + } + } + trigger_else_if = { + limit = { + exists = location + } + location = { + geographical_region = world_europe_west + } + } + trigger_else = { + always = no + } + } + set_variable = { + name = favorite_treat + value = flag:frytour_blaunched #western europe + } + } + 10 = { + trigger = { + trigger_if = { + limit = { + exists = capital_province + is_travelling = no #Let's pick something from our location instead. + } + capital_province = { + NOT = { + geographical_region = world_europe_north + } + } + } + trigger_else_if = { + limit = { + exists = liege.capital_province + is_travelling = no #Let's pick something from our location instead. + } + liege.capital_province = { + NOT = { + geographical_region = world_europe_north + } + } + } + trigger_else_if = { + limit = { + exists = location + } + location = { + NOT = { + geographical_region = world_europe_north + } + } + } + trigger_else = { + always = no + } + } + set_variable = { + name = favorite_treat + value = flag:fig_pie + } + } + 5 = { + trigger = { + trigger_if = { + limit = { + exists = capital_province + is_travelling = no #Let's pick something from our location instead. + } + capital_province = { + geographical_region = custom_england + } + } + trigger_else_if = { + limit = { + exists = liege.capital_province + is_travelling = no #Let's pick something from our location instead. + } + liege.capital_province = { + geographical_region = custom_england + } + } + trigger_else_if = { + limit = { + exists = location + } + location = { + geographical_region = custom_england + } + } + trigger_else = { + always = no + } + } + set_variable = { + name = favorite_treat + value = flag:pokerounce #england + } + } + 5 = { + trigger = { + trigger_if = { + limit = { + exists = capital_province + is_travelling = no #Let's pick something from our location instead. + } + capital_province = { + geographical_region = world_europe_west + } + } + trigger_else_if = { + limit = { + exists = liege.capital_province + is_travelling = no #Let's pick something from our location instead. + } + liege.capital_province = { + geographical_region = world_europe_west + } + } + trigger_else_if = { + limit = { + exists = location + } + location = { + geographical_region = world_europe_west + } + } + trigger_else = { + always = no + } + } + set_variable = { + name = favorite_treat + value = flag:sambocade #western europe + } + } + 5 = { + trigger = { + trigger_if = { + limit = { + exists = capital_province + is_travelling = no #Let's pick something from our location instead. + } + capital_province = { + OR = { + geographical_region = world_africa + geographical_region = world_middle_east + } + } + } + trigger_else_if = { + limit = { + exists = liege.capital_province + is_travelling = no #Let's pick something from our location instead. + } + liege.capital_province = { + OR = { + geographical_region = world_africa + geographical_region = world_middle_east + } + } + } + trigger_else_if = { + limit = { + exists = location + } + location = { + OR = { + geographical_region = world_africa + geographical_region = world_middle_east + } + } + } + trigger_else = { + always = no + } + } + set_variable = { + name = favorite_treat + value = flag:sesame_cake #africa, middle east + } + } + 2 = { + trigger = { + trigger_if = { + limit = { + exists = capital_province + is_travelling = no #Let's pick something from our location instead. + } + capital_province = { + geographical_region = world_africa + } + } + trigger_else_if = { + limit = { + exists = liege.capital_province + is_travelling = no #Let's pick something from our location instead. + } + liege.capital_province = { + geographical_region = world_africa + } + } + trigger_else_if = { + limit = { + exists = location + } + location = { + geographical_region = world_africa + } + } + trigger_else = { + always = no + } + } + set_variable = { + name = favorite_treat + value = flag:baked_banana #africa + } + } + 5 = { + trigger = { + trigger_if = { + limit = { + exists = capital_province + is_travelling = no #Let's pick something from our location instead. + } + capital_province = { + OR = { + geographical_region = world_europe_south_east + geographical_region = world_asia_minor + } + } + } + trigger_else_if = { + limit = { + exists = liege.capital_province + is_travelling = no #Let's pick something from our location instead. + } + liege.capital_province = { + OR = { + geographical_region = world_europe_south_east + geographical_region = world_asia_minor + } + } + } + trigger_else_if = { + limit = { + exists = location + } + location = { + OR = { + geographical_region = world_europe_south_east + geographical_region = world_asia_minor + } + } + } + trigger_else = { + always = no + } + } + set_variable = { + name = favorite_treat + value = flag:koptoplakous #Byzantium + } + } + 5 = { + trigger = { + trigger_if = { + limit = { + exists = capital_province + is_travelling = no #Let's pick something from our location instead. + } + capital_province = { + OR = { + geographical_region = world_europe_south_east + geographical_region = world_asia_minor + } + } + } + trigger_else_if = { + limit = { + exists = liege.capital_province + is_travelling = no #Let's pick something from our location instead. + } + liege.capital_province = { + OR = { + geographical_region = world_europe_south_east + geographical_region = world_asia_minor + } + } + } + trigger_else_if = { + limit = { + exists = location + } + location = { + OR = { + geographical_region = world_europe_south_east + geographical_region = world_asia_minor + } + } + } + trigger_else = { + always = no + } + } + set_variable = { + name = favorite_treat + value = flag:plakountas #Byzantium + } + } + } + } + } +} + +set_favorite_toy_effect = { + if = { + limit = { + NOT = { has_variable = child_toy_variable } + } + hidden_effect = { + random_list = { + 10 = { + modifier = { + has_trait = rowdy + factor = 5 + } + set_variable = { + name = child_toy_variable + value = flag:wooden_knight + } + } + 10 = { + set_variable = { + name = child_toy_variable + value = flag:toy_boat + } + } + 10 = { + modifier = { + has_trait = rowdy + factor = 5 + } + set_variable = { + name = child_toy_variable + value = flag:wooden_sword + } + } + 10 = { + modifier = { + has_trait = curious + factor = 5 + } + modifier = { + has_trait = charming + factor = 5 + } + set_variable = { + name = child_toy_variable + value = flag:ragdoll + } + } + 10 = { + modifier = { + has_trait = pensive + factor = 5 + } + set_variable = { + name = child_toy_variable + value = flag:spinning_top + } + } + 10 = { + set_variable = { + name = child_toy_variable + value = flag:rolling_hoop + } + } + 10 = { + set_variable = { + name = child_toy_variable + value = flag:scopperel + } + } + 10 = { + set_variable = { + name = child_toy_variable + value = flag:wooden_horse + } + } + 10 = { + modifier = { + has_trait = curious + factor = 5 + } + modifier = { + has_trait = charming + factor = 5 + } + set_variable = { + name = child_toy_variable + value = flag:doll + } + } + 10 = { + set_variable = { + name = child_toy_variable + value = flag:stick_horse + } + } + } + } + } +} + +#To get a creepy pet in prison +set_prison_pet_effect = { + if = { + limit = { + NOT = { exists = var:prison_pet_variable } + } + hidden_effect = { + random_list = { + 10 = { + set_variable = { + name = prison_pet_variable + value = flag:rat + } + } + 10 = { + set_variable = { + name = prison_pet_variable + value = flag:stone + } + } + 10 = { + set_variable = { + name = prison_pet_variable + value = flag:spoon + } + } + 10 = { + set_variable = { + name = prison_pet_variable + value = flag:cockroach + } + } + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_personality_trait_effects.txt b/N3OW/common/scripted_effects/00_personality_trait_effects.txt new file mode 100644 index 00000000..bdadfce7 --- /dev/null +++ b/N3OW/common/scripted_effects/00_personality_trait_effects.txt @@ -0,0 +1,1884 @@ +##################################################################### +# +# This file contains various scripted effects for comparing the personalities of different characters, in order to generate more +# believable character interactions (e.g., ensuring a Brave character would prefer to insult their rival for being Craven over +# insulting them for a non-opposing personality trait). +# +# Also see the '00_personality_trait_triggers.txt' file when using these in an event. + +##################################################################### +# +# check_if_chars_have_opposing_traits_effect: +# This scripted effect is for determining if two characters have opposing personality traits. +# If they do, it applies a parameterized flag to the 1st character for future usage in event scripts and localisation. +# +# Parameters: +# CHAR1 - The primary character we want to compare the traits of, and the one who all flags will be applied to +# CHAR2 - The secondary character we are comparing to CHAR1 +# TRAIT1 - The trait we are looking for on CHAR1 +# TRAIT2 - Should always be set to the opposite trait of TRAIT1 +# FLAG_PREFIX - The first half of the name the flag we will apply to CHAR1, i.e. "statecraft_progress_2200" +# FLAG_POSTFIX - The second half of the name the flag we will apply to CHAR1, i.e. "brave" +# SUCCESS_FLAG - A unique flag identifier indicating if this effect has successfully found a valid set of opposing traits on thew characters. +# STRICT - A boolean (yes/no) indicating if we should do the fallback check for only TRAIT1 on CHAR1 if CHAR1 and CHAR2 have no opposing traits at all +# -This is useful if you simply want to ensure the characters do not share the specified trait(i.e., one Brave char insulting another char for being Brave). +# +# By Sean Hughes + +personality_check_if_chars_have_opposing_traits_effect = { + $CHAR1$ = { + if = { + limit = { + number_of_opposing_traits = { + target = $CHAR2$ + value >= 1 + } + } + if = { + #If CHAR1 and CHAR2 have these opposite traits, CHAR1 gets the appropriate flags added to them. + limit = { + has_trait = $TRAIT1$ + $CHAR2$ = { + has_trait = $TRAIT2$ + } + } + save_scope_value_as = { + name = $FLAG_PREFIX$ + value = flag:$FLAG_POSTFIX$ + } + save_scope_value_as = { + name = $FLAG_SUCCESS$ + value = yes + } + } + } + else = { + if = { + #Fallback option if the two characters have no opposing traits at all. + limit = { + #If we are strictly looking for only opposite traits, do not do this step. + $STRICT$ = no + + #Otherwise, simply find a trait that CHAR1 has which CHAR2 does not, then add the appropriate flag to CHAR1. + has_trait = $TRAIT1$ + $CHAR2$ = { + NOT = { has_trait = $TRAIT1$ } + } + } + save_scope_value_as = { + name = $FLAG_PREFIX$ + value = flag:$FLAG_POSTFIX$ + } + save_scope_value_as = { + name = flag:$FLAG_SUCCESS$ + value = yes + } + } + } + } +} + +##################################################################### +# +# check_opposing_bad_ruler_traits_effect: +# This scripted effect uses the above effect to determine which trait a vassal would most dispise in their ruler. +# It was created for statecraft_progress.2200, but should be able to be used in any other event without an issue, +# as long as each event which uses this has NOT = {scope:opposing_trait_flag_applied = yes} in a trigger. +# +# Parameters: +# CHAR1 - The primary character we want to compare the traits of (the ruler/heir/potential ruler) +# CHAR2 - The secondary character we are comparing to CHAR1 (the vassal/potential vassal) +# TRAIT1 - The trait we are looking for on CHAR1 +# TRAIT2 - Should always be set to the opposite trait of TRAIT1 +# STRICT - A boolean (yes/no) indicating if we should do the fallback check for only TRAIT1 on CHAR1 if CHAR1 and CHAR2 have no opposing traits at all +# -This is useful if you simply want to ensure the characters do not share the specified trait(i.e., one Brave char insulting another char for being Brave). +# +# By Sean Hughes + +personality_check_opposing_bad_ruler_traits_effect = { + save_scope_value_as = { + name = opposing_trait_flag_applied + value = no + } + save_scope_value_as = { + name = has_opposing_trait + value = flag:none + } + #The first 11 trait pairings are selected from "Bad Ruler" traits, which vassals either dislike more than other traits or directly hurt diplomacy. + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = arbitrary + TRAIT2 = just + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = arbitrary + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = craven + TRAIT2 = brave + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = craven + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = sadistic + TRAIT2 = compassionate + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = sadistic + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = lazy + TRAIT2 = diligent + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = lazy + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = stubborn + TRAIT2 = fickle + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = stubborn + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = paranoid + TRAIT2 = trusting + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = paranoid + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = vengeful + TRAIT2 = forgiving + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = vengeful + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = callous + TRAIT2 = compassionate + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = callous + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = wrathful + TRAIT2 = calm + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = wrathful + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = arrogant + TRAIT2 = humble + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = arrogant + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = shy + TRAIT2 = gregarious + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = shy + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + # The next 14 traits are neutral traits, which aren't considered "Bad Ruler" traits but an individual CHAR2 may dislike. + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = cynical + TRAIT2 = zealous + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = cynical + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = zealous + TRAIT2 = cynical + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = zealous + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = deceitful + TRAIT2 = honest + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = deceitful + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = honest + TRAIT2 = deceitful + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = honest + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = generous + TRAIT2 = greedy + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = generous + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = greedy + TRAIT2 = generous + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = greedy + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = gluttonous + TRAIT2 = temperate + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = gluttonous + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = temperate + TRAIT2 = gluttonous + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = temperate + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = impatient + TRAIT2 = patient + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = impatient + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = patient + TRAIT2 = impatient + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = patient + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = lustful + TRAIT2 = chaste + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = lustful + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = chaste + TRAIT2 = lustful + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = chaste + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = content + TRAIT2 = ambitious + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = content + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = ambitious + TRAIT2 = content + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = ambitious + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + #The last 11 traits are opposites of the "Bad Ruler" traits, I.E., things the player is unlikely to want tCHAR1 CHAR1 to lose. + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = gregarious + TRAIT2 = shy + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = gregarious + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = diligent + TRAIT2 = lazy + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = diligent + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = humble + TRAIT2 = arrogant + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = humble + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = brave + TRAIT2 = craven + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = brave + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = calm + TRAIT2 = wrathful + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = calm + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = compassionate + TRAIT2 = sadistic + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = compassionate + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = compassionate + TRAIT2 = callous + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = compassionate + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = fickle + TRAIT2 = stubborn + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = fickle + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = forgiving + TRAIT2 = vengeful + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = forgiving + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = trusting + TRAIT2 = paranoid + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = trusting + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:opposing_trait_flag_applied = yes } } + personality_check_if_chars_have_opposing_traits_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = just + TRAIT2 = arbitrary + FLAG_PREFIX = has_opposing_trait + FLAG_POSTFIX = just + FLAG_SUCCESS = opposing_trait_flag_applied + STRICT = $STRICT$ + } + } +} + +##################################################################### +# +# personality_minor_shift_effect: +# Designed to be used in tandem with 'check_opposing_bad_ruler_traits_effect', but can be used with other scripts. +# Checks if a character has the specified flag and, if so, removes the corresponding personality trait. +# +# By Sean Hughes + +personality_shift_effect = { + if = { + limit = { scope:has_opposing_trait = flag:arrogant } + remove_trait = arrogant + add_trait_force_tooltip = humble + } + else_if = { + limit = { scope:has_opposing_trait = flag:humble } + remove_trait = humble + add_trait_force_tooltip = arrogant + } + else_if = { + limit = { scope:has_opposing_trait = flag:lustful } + remove_trait = lustful + add_trait_force_tooltip = chaste + } + else_if = { + limit = { scope:has_opposing_trait = flag:chaste } + remove_trait = chaste + add_trait_force_tooltip = lustful + } + else_if = { + limit = { scope:has_opposing_trait = flag:gregarious } + remove_trait = gregarious + add_trait_force_tooltip = shy + } + else_if = { + limit = { scope:has_opposing_trait = flag:shy } + remove_trait = shy + add_trait_force_tooltip = gregarious + } + else_if = { + limit = { scope:has_opposing_trait = flag:generous } + remove_trait = generous + add_trait_force_tooltip = greedy + } + else_if = { + limit = { scope:has_opposing_trait = flag:greedy } + remove_trait = greedy + add_trait_force_tooltip = generous + } + else_if = { + limit = { scope:has_opposing_trait = flag:ambitious } + remove_trait = ambitious + add_trait_force_tooltip = content + } + else_if = { + limit = { scope:has_opposing_trait = flag:content } + remove_trait = content + add_trait_force_tooltip = ambitious + } + else_if = { + limit = { scope:has_opposing_trait = flag:impatient } + remove_trait = impatient + add_trait_force_tooltip = patient + } + else_if = { + limit = { scope:has_opposing_trait = flag:patient } + remove_trait = patient + add_trait_force_tooltip = impatient + } + else_if = { + limit = { scope:has_opposing_trait = flag:temperate } + remove_trait = temperate + add_trait_force_tooltip = gluttonous + } + else_if = { + limit = { scope:has_opposing_trait = flag:gluttonous } + remove_trait = gluttonous + add_trait_force_tooltip = temperate + } + else_if = { + limit = { scope:has_opposing_trait = flag:diligent } + remove_trait = diligent + add_trait_force_tooltip = lazy + } + else_if = { + limit = { scope:has_opposing_trait = flag:lazy } + remove_trait = lazy + add_trait_force_tooltip = diligent + } + else_if = { + limit = { scope:has_opposing_trait = flag:wrathful } + remove_trait = wrathful + add_trait_force_tooltip = calm + } + else_if = { + limit = { scope:has_opposing_trait = flag:calm } + remove_trait = calm + add_trait_force_tooltip = wrathful + } + else_if = { + limit = { scope:has_opposing_trait = flag:deceitful } + remove_trait = deceitful + add_trait_force_tooltip = honest + } + else_if = { + limit = { scope:has_opposing_trait = flag:honest } + remove_trait = honest + add_trait_force_tooltip = deceitful + } + else_if = { + limit = { scope:has_opposing_trait = flag:craven } + remove_trait = craven + add_trait_force_tooltip = brave + } + else_if = { + limit = { scope:has_opposing_trait = flag:brave } + remove_trait = brave + add_trait_force_tooltip = craven + } + else_if = { + limit = { scope:has_opposing_trait = flag:arbitrary } + remove_trait = arbitrary + add_trait_force_tooltip = just + } + else_if = { + limit = { scope:has_opposing_trait = flag:just } + remove_trait = just + add_trait_force_tooltip = arbitrary + } + else_if = { + limit = { scope:has_opposing_trait = flag:cynical } + remove_trait = cynical + add_trait_force_tooltip = zealous + } + else_if = { + limit = { scope:has_opposing_trait = flag:zealous } + remove_trait = zealous + add_trait_force_tooltip = cynical + } + else_if = { + limit = { scope:has_opposing_trait = flag:paranoid } + remove_trait = paranoid + add_trait_force_tooltip = trusting + } + else_if = { + limit = { scope:has_opposing_trait = flag:trusting } + remove_trait = trusting + add_trait_force_tooltip = paranoid + } + else_if = { + limit = { scope:has_opposing_trait = flag:compassionate } + remove_trait = compassionate + add_trait_force_tooltip = callous + } + else_if = { + limit = { scope:has_opposing_trait = flag:callous } + remove_trait = callous + add_trait_force_tooltip = compassionate + } + else_if = { + limit = { scope:has_opposing_trait = flag:sadistic } + remove_trait = sadistic + add_trait_force_tooltip = compassionate + } + else_if = { + limit = { scope:has_opposing_trait = flag:forgiving } + remove_trait = forgiving + add_trait_force_tooltip = vengeful + } + else_if = { + limit = { scope:has_opposing_trait = flag:vengeful } + remove_trait = vengeful + add_trait_force_tooltip = forgiving + } + else_if = { + limit = { scope:has_opposing_trait = flag:stubborn } + remove_trait = stubborn + add_trait_force_tooltip = fickle + } + else_if = { + limit = { scope:has_opposing_trait = flag:fickle } + remove_trait = fickle + add_trait_force_tooltip = stubborn + } +} + +##################################################################### +# +# personality_check_if_chars_have_shared_trait_effect: +# This scripted effect is for determining if two characters share a personality trait. +# If they do, it applies a parameterized flag to the 1st character for future usage in event scripts and localisation. +# +# Parameters: +# CHAR1 - The primary character we want to compare the traits of, and the one who all flags will be applied to +# CHAR2 - The secondary character we are comparing to CHAR1 +# TRAIT1 - The trait we are looking for on both the characters +# TRAIT2 - The opposite trait of trait 1, in case we need to rely on our fallback. +# FLAG_PREFIX - The first half of the name the flag we will apply to CHAR1, i.e. "statecraft_progress_2200" +# FLAG_POSTFIX - The second half of the name the flag we will apply to CHAR1, i.e. "brave" +# SUCCESS_FLAG - A unique flag identifier indicating if this effect has successfully found a valid set of shared traits on the characters. +# STRICT - A boolean (yes/no) indicating if we should do the fallback check for CHAR2 not having TRAIT2 if there are no shared traits. +# +# By Sean Hughes + +personality_check_if_chars_have_shared_trait_effect = { + $CHAR1$ = { + if = { + limit = { + number_of_personality_traits_in_common = { + target = $CHAR2$ + value >= 1 + } + } + if = { + #If CHAR1 and both have this trait, set the appropriate flag. + limit = { + has_trait = $TRAIT1$ + $CHAR2$ = { + has_trait = $TRAIT1$ } + } + save_scope_value_as = { + name = $FLAG_PREFIX$ + value = flag:$FLAG_POSTFIX$ + } + save_scope_value_as = { + name = $FLAG_SUCCESS$ + value = yes + } + } + } + else = { + if = { + #Fallback option if the two characters have no shared traits at all. + limit = { + #If we are strictly looking for only shared traits, do not do this step. + $STRICT$ = no + + #Otherwise, simply find a trait that CHAR1 has which CHAR2 does not have the opposite trait for, then add the appropriate flag to CHAR1. + has_trait = $TRAIT1$ + $CHAR2$ = { + NOT = { has_trait = $TRAIT2$ } + } + } + save_scope_value_as = { + name = $FLAG_PREFIX$ + value = flag:$FLAG_POSTFIX$ + } + save_scope_value_as = { + name = $FLAG_SUCCESS$ + value = yes + } + } + } + } +} + +##################################################################### +# +# personality_check_shared_good_ruler_traits_effect: +# This scripted effect uses the above effect to determine which trait a vassal would most approve of in their ruler. +# +# Parameters: +# CHAR1 - The primary character we want to compare the traits of (the ruler/heir/potential ruler) +# CHAR2 - The secondary character we are comparing to CHAR1 (the vassal/potential vassal) +# TRAIT1 - The trait we are looking for on CHAR1 +# TRAIT2 - Should always be set to the opposite trait of TRAIT1 +# STRICT - A boolean (yes/no) indicating if we should do the fallback check for only TRAIT1 on CHAR1 if CHAR1 and CHAR2 have no opposing traits at all +# -This is useful if you simply want to ensure the characters do not share the specified trait(i.e., one Brave char insulting another char for being Brave). +# +# By Sean Hughes + +personality_check_shared_good_ruler_traits_effect = { + save_scope_value_as = { + name = shared_trait_flag_applied + value = no + } + + #The first 11 trait pairings are selected from "Good Ruler" traits, which vassals either like more than other traits or directly help diplomacy. + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = just + TRAIT2 = arbitrary + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = just + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = brave + TRAIT2 = craven + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = brave + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = compassionate + TRAIT2 = sadistic + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = compassionate + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = diligent + TRAIT2 = lazy + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = diligent + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = fickle + TRAIT2 = stubborn + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = fickle + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = trusting + TRAIT2 = paranoid + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = trusting + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = forgiving + TRAIT2 = vengeful + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = forgiving + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = compassionate + TRAIT2 = callous + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = compassionate + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = calm + TRAIT2 = wrathful + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = calm + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = humble + TRAIT2 = arrogant + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = humble + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = gregarious + TRAIT2 = shy + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = gregarious + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + # The next 14 traits are neutral traits, which aren't considered "Good Ruler" traits but an individual CHAR2 may dislike. + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = cynical + TRAIT2 = zealous + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = cynical + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = zealous + TRAIT2 = cynical + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = zealous + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = deceitful + TRAIT2 = honest + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = deceitful + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = honest + TRAIT2 = deceitful + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = honest + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = generous + TRAIT2 = greedy + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = generous + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = greedy + TRAIT2 = generous + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = greedy + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = gluttonous + TRAIT2 = temperate + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = gluttonous + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = temperate + TRAIT2 = gluttonous + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = temperate + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = impatient + TRAIT2 = patient + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = impatient + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = patient + TRAIT2 = impatient + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = patient + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = lustful + TRAIT2 = chaste + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = lustful + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = chaste + TRAIT2 = lustful + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = chaste + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = content + TRAIT2 = ambitious + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = content + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = ambitious + TRAIT2 = content + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = ambitious + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + #The last 11 traits are opposites of the "Good Ruler" traits, I.E., things CHAR2 is unlikely to appreciate unless they themselves are that way. + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = shy + TRAIT2 = gregarious + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = shy + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = lazy + TRAIT2 = diligent + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = lazy + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = arrogant + TRAIT2 = humble + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = arrogant + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = craven + TRAIT2 = brave + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = craven + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = wrathful + TRAIT2 = calm + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = wrathful + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = sadistic + TRAIT2 = compassionate + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = sadistic + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = callous + TRAIT2 = compassionate + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = callous + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = stubborn + TRAIT2 = fickle + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = stubborn + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = vengeful + TRAIT2 = forgiving + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = vengeful + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = paranoid + TRAIT2 = trusting + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = paranoid + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } + if = { + limit = { NOT = { scope:shared_trait_flag_applied = yes } } + personality_check_if_chars_have_shared_trait_effect = { + CHAR1 = $CHAR1$ + CHAR2 = $CHAR2$ + TRAIT1 = arbitrary + TRAIT2 = just + FLAG_PREFIX = has_shared_trait + FLAG_POSTFIX = arbitrary + FLAG_SUCCESS = shared_trait_flag_applied + STRICT = $STRICT$ + } + } +} + +flip_sinful_trait_effect = { + if = { + limit = { + has_trait = lustful + faith = { trait_is_sin = lustful } + } + remove_trait = lustful + add_trait_force_tooltip = chaste + } + else_if = { + limit = { + has_trait = chaste + faith = { trait_is_sin = chaste } + } + remove_trait = chaste + add_trait_force_tooltip = lustful + } + else_if = { + limit = { + has_trait = temperate + faith = { trait_is_sin = temperate } + } + remove_trait = temperate + add_trait_force_tooltip = gluttonous + } + else_if = { + limit = { + has_trait = gluttonous + faith = { trait_is_sin = gluttonous } + } + remove_trait = gluttonous + add_trait_force_tooltip = temperate + } + else_if = { + limit = { + has_trait = greedy + faith = { trait_is_sin = greedy } + } + remove_trait = greedy + add_trait_force_tooltip = generous + } + else_if = { + limit = { + has_trait = generous + faith = { trait_is_sin = generous } + } + remove_trait = generous + add_trait_force_tooltip = greedy + } + else_if = { + limit = { + has_trait = lazy + faith = { trait_is_sin = lazy } + } + remove_trait = lazy + add_trait_force_tooltip = diligent + } + else_if = { + limit = { + has_trait = diligent + faith = { trait_is_sin = diligent } + } + remove_trait = diligent + add_trait_force_tooltip = lazy + } + else_if = { + limit = { + has_trait = wrathful + faith = { trait_is_sin = wrathful } + } + remove_trait = wrathful + add_trait_force_tooltip = calm + } + else_if = { + limit = { + has_trait = calm + faith = { trait_is_sin = calm } + } + remove_trait = calm + add_trait_force_tooltip = wrathful + } + else_if = { + limit = { + has_trait = humble + faith = { trait_is_sin = humble } + } + remove_trait = humble + add_trait_force_tooltip = arrogant + } + else_if = { + limit = { + has_trait = arrogant + faith = { trait_is_sin = arrogant } + } + remove_trait = arrogant + add_trait_force_tooltip = humble + } + else_if = { + limit = { + has_trait = impatient + faith = { trait_is_sin = impatient } + } + remove_trait = impatient + add_trait_force_tooltip = patient + } + else_if = { + limit = { + has_trait = patient + faith = { trait_is_sin = patient } + } + remove_trait = patient + add_trait_force_tooltip = impatient + } + else_if = { + limit = { + has_trait = craven + faith = { trait_is_sin = craven } + } + remove_trait = craven + add_trait_force_tooltip = brave + } + else_if = { + limit = { + has_trait = brave + faith = { trait_is_sin = brave } + } + remove_trait = brave + add_trait_force_tooltip = craven + } + else_if = { + limit = { + has_trait = shy + faith = { trait_is_sin = shy } + } + remove_trait = shy + add_trait_force_tooltip = gregarious + } + else_if = { + limit = { + has_trait = gregarious + faith = { trait_is_sin = gregarious } + } + remove_trait = gregarious + add_trait_force_tooltip = shy + } + else_if = { + limit = { + has_trait = ambitious + faith = { trait_is_sin = ambitious } + } + remove_trait = ambitious + add_trait_force_tooltip = content + } + else_if = { + limit = { + has_trait = content + faith = { trait_is_sin = content } + } + remove_trait = content + add_trait_force_tooltip = ambitious + } + else_if = { + limit = { + has_trait = arbitrary + faith = { trait_is_sin = arbitrary } + } + remove_trait = arbitrary + add_trait_force_tooltip = just + } + else_if = { + limit = { + has_trait = just + faith = { trait_is_sin = just } + } + remove_trait = just + add_trait_force_tooltip = arbitrary + } + else_if = { + limit = { + has_trait = zealous + faith = { trait_is_sin = zealous } + } + remove_trait = zealous + add_trait_force_tooltip = cynical + } + else_if = { + limit = { + has_trait = cynical + faith = { trait_is_sin = cynical } + } + remove_trait = cynical + add_trait_force_tooltip = zealous + } + else_if = { + limit = { + has_trait = trusting + faith = { trait_is_sin = trusting } + } + remove_trait = trusting + add_trait_force_tooltip = paranoid + } + else_if = { + limit = { + has_trait = paranoid + faith = { trait_is_sin = paranoid } + } + remove_trait = paranoid + add_trait_force_tooltip = trusting + } + else_if = { + limit = { + has_trait = callous + faith = { trait_is_sin = callous } + } + remove_trait = callous + add_trait_force_tooltip = compassionate + } + else_if = { + limit = { + has_trait = sadistic + faith = { trait_is_sin = sadistic } + } + remove_trait = sadistic + add_trait_force_tooltip = compassionate + } + else_if = { + limit = { + has_trait = compassionate + faith = { trait_is_sin = compassionate } + } + remove_trait = compassionate + add_trait_force_tooltip = callous + } + else_if = { + limit = { + has_trait = stubborn + faith = { trait_is_sin = stubborn } + } + remove_trait = stubborn + add_trait_force_tooltip = fickle + } + else_if = { + limit = { + has_trait = fickle + faith = { trait_is_sin = fickle } + } + remove_trait = fickle + add_trait_force_tooltip = stubborn + } + else_if = { + limit = { + has_trait = vengeful + faith = { trait_is_sin = vengeful } + } + remove_trait = vengeful + add_trait_force_tooltip = forgiving + } + else_if = { + limit = { + has_trait = forgiving + faith = { trait_is_sin = forgiving } + } + remove_trait = forgiving + add_trait_force_tooltip = vengeful + } + else_if = { + limit = { + has_trait = honest + faith = { trait_is_sin = honest } + } + remove_trait = honest + add_trait_force_tooltip = deceitful + } + else_if = { + limit = { + has_trait = deceitful + faith = { trait_is_sin = deceitful } + } + remove_trait = deceitful + add_trait_force_tooltip = honest + } +} + + +# Checks if the scoped character and the target character have any diametrically opposed personality traits. +# Saves a scope with the selected trait held by CHARACTER_1 +# Should use the following trigger number_of_opposing_personality_traits to check that an opposing personality trait exists +get_diametrically_opposed_trait_trigger = { + random_list = { + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = brave } + $CHARACTER_2$ = { has_trait = craven } + } + trait:brave = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = craven } + $CHARACTER_2$ = { has_trait = brave } + } + trait:craven = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = calm } + $CHARACTER_2$ = { has_trait = wrathful } + } + trait:calm = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = wrathful } + $CHARACTER_2$ = { has_trait = calm } + } + trait:wrathful = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = lustful } + $CHARACTER_2$ = { has_trait = chaste } + } + trait:lustful = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = chaste } + $CHARACTER_2$ = { has_trait = lustful } + } + trait:chaste = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = ambitious } + $CHARACTER_2$ = { has_trait = content } + } + trait:ambitious = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = content } + $CHARACTER_2$ = { has_trait = ambitious } + } + trait:content = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = diligent } + $CHARACTER_2$ = { has_trait = lazy } + } + trait:diligent = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = lazy } + $CHARACTER_2$ = { has_trait = diligent } + } + trait:lazy = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = stubborn } + $CHARACTER_2$ = { has_trait = fickle } + } + trait:stubborn = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = fickle } + $CHARACTER_2$ = { has_trait = stubborn } + } + trait:fickle = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = vengeful } + $CHARACTER_2$ = { has_trait = forgiving } + } + trait:vengeful = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = forgiving } + $CHARACTER_2$ = { has_trait = vengeful } + } + trait:forgiving = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = greedy } + $CHARACTER_2$ = { has_trait = generous } + } + trait:greedy = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = generous } + $CHARACTER_2$ = { has_trait = greedy } + } + trait:generous = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = gregarious } + $CHARACTER_2$ = { has_trait = shy } + } + trait:gregarious = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = shy } + $CHARACTER_2$ = { has_trait = gregarious } + } + trait:shy = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = honest } + $CHARACTER_2$ = { has_trait = deceitful } + } + trait:honest = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = deceitful } + $CHARACTER_2$ = { has_trait = honest } + } + trait:deceitful = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = humble } + $CHARACTER_2$ = { has_trait = arrogant } + } + trait:humble = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = arrogant } + $CHARACTER_2$ = { has_trait = humble } + } + trait:arrogant = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = just } + $CHARACTER_2$ = { has_trait = arbitrary } + } + trait:just = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = arbitrary } + $CHARACTER_2$ = { has_trait = just } + } + trait:arbitrary = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = patient } + $CHARACTER_2$ = { has_trait = impatient } + } + trait:patient = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = impatient } + $CHARACTER_2$ = { has_trait = patient } + } + trait:impatient = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = temperate } + $CHARACTER_2$ = { has_trait = gluttonous } + } + trait:temperate = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = gluttonous } + $CHARACTER_2$ = { has_trait = temperate } + } + trait:gluttonous = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = trusting } + $CHARACTER_2$ = { has_trait = paranoid } + } + trait:trusting = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = paranoid } + $CHARACTER_2$ = { has_trait = trusting } + } + trait:paranoid = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = zealous } + $CHARACTER_2$ = { has_trait = cynical } + } + trait:zealous = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = cynical } + $CHARACTER_2$ = { has_trait = zealous } + } + trait:cynical = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = compassionate } + $CHARACTER_2$ = { + OR = { + has_trait = callous + has_trait = sadistic + } + } + } + trait:compassionate = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = callous } + $CHARACTER_2$ = { has_trait = compassionate } + } + trait:callous = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = sadistic } + $CHARACTER_2$ = { has_trait = compassionate } + } + trait:sadistic = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = loyal } + $CHARACTER_2$ = { has_trait = disloyal } + } + trait:loyal = { save_scope_as = opposed_personality_trait } + } + 1 = { + trigger = { + $CHARACTER_1$ = { has_trait = disloyal } + $CHARACTER_2$ = { has_trait = loyal } + } + trait:disloyal = { save_scope_as = opposed_personality_trait } + } + } +} diff --git a/N3OW/common/scripted_effects/00_petition_liege_effects.txt b/N3OW/common/scripted_effects/00_petition_liege_effects.txt new file mode 100644 index 00000000..ba8c488d --- /dev/null +++ b/N3OW/common/scripted_effects/00_petition_liege_effects.txt @@ -0,0 +1,1358 @@ + +#Effects used in Petitions + +### Council + +# Save most fitting council seat incumbent +petition_liege_0101_councillor_scope_first_effect = { + if = { + limit = { exists = $LIEGE$.cp:councillor_$ROLE$ } + $LIEGE$.cp:councillor_$ROLE$ = { save_scope_as = second_party } + } + $JOB_TAKER$ = { + set_variable = { + name = petition_liege_council_first + value = flag:$ROLE$ + } + } +} + +# Save 2nd most fitting council seat incumbent +petition_liege_0101_councillor_scope_second_effect = { + if = { + limit = { exists = $LIEGE$.cp:councillor_$ROLE$ } + $LIEGE$.cp:councillor_$ROLE$ = { save_scope_as = second_councillor } + } + $JOB_TAKER$ = { + set_variable = { + name = petition_liege_council_second + value = flag:$ROLE$ + } + } +} + +petition_liege_save_council_seat_effect = { + random_list = { # Pick best position, even if occupied + 2 = { + trigger = { + petition_liege_councillor_blocked_trigger = { + ROLE = chancellor + JOB_TAKER = $JOB_TAKER$ + LIEGE = $LIEGE$ + } + } + petition_liege_councillor_compare_modifier = { SKILL = diplomacy ROLE = chancellor JOB_TAKER = $JOB_TAKER$ } + petition_liege_0101_councillor_scope_first_effect = { ROLE = chancellor JOB_TAKER = $JOB_TAKER$ LIEGE = $LIEGE$ } + } + 2 = { + trigger = { + petition_liege_councillor_blocked_trigger = { + ROLE = marshal + JOB_TAKER = $JOB_TAKER$ + LIEGE = $LIEGE$ + } + } + petition_liege_councillor_compare_modifier = { SKILL = martial ROLE = marshal JOB_TAKER = $JOB_TAKER$ } + petition_liege_0101_councillor_scope_first_effect = { ROLE = marshal JOB_TAKER = $JOB_TAKER$ LIEGE = $LIEGE$ } + } + 2 = { + trigger = { + petition_liege_councillor_blocked_trigger = { + ROLE = steward + JOB_TAKER = $JOB_TAKER$ + LIEGE = $LIEGE$ + } + } + petition_liege_councillor_compare_modifier = { SKILL = stewardship ROLE = steward JOB_TAKER = $JOB_TAKER$ } + petition_liege_0101_councillor_scope_first_effect = { ROLE = steward JOB_TAKER = $JOB_TAKER$ LIEGE = $LIEGE$ } + } + 2 = { + trigger = { + petition_liege_councillor_blocked_trigger = { + ROLE = spymaster + JOB_TAKER = $JOB_TAKER$ + LIEGE = $LIEGE$ + } + } + petition_liege_councillor_compare_modifier = { SKILL = intrigue ROLE = spymaster JOB_TAKER = $JOB_TAKER$ } + petition_liege_0101_councillor_scope_first_effect = { ROLE = spymaster JOB_TAKER = $JOB_TAKER$ LIEGE = $LIEGE$ } + } + 2 = { + trigger = { + petition_liege_council_chaplain_appointable_trigger = { + JOB_TAKER = $JOB_TAKER$ + LIEGE = $LIEGE$ + } + petition_liege_councillor_blocked_trigger = { + ROLE = court_chaplain + JOB_TAKER = $JOB_TAKER$ + LIEGE = $LIEGE$ + } + } + petition_liege_councillor_compare_modifier = { SKILL = learning ROLE = court_chaplain JOB_TAKER = $JOB_TAKER$ } + petition_liege_0101_councillor_scope_first_effect = { ROLE = court_chaplain JOB_TAKER = $JOB_TAKER$ LIEGE = $LIEGE$ } + } + } + random_list = { + 2 = { + trigger = { + petition_liege_councillor_second_trigger = { + ROLE = chancellor + SKILL = diplomacy + JOB_TAKER = $JOB_TAKER$ + LIEGE = $LIEGE$ + } + } + modifier = { factor = $JOB_TAKER$.diplomacy } + petition_liege_0101_councillor_scope_second_effect = { + ROLE = chancellor + JOB_TAKER = $JOB_TAKER$ + LIEGE = $LIEGE$ + } + } + 2 = { + trigger = { + petition_liege_councillor_second_trigger = { + ROLE = marshal + SKILL = martial + JOB_TAKER = $JOB_TAKER$ + LIEGE = $LIEGE$ + } + } + modifier = { factor = $JOB_TAKER$.martial } + petition_liege_0101_councillor_scope_second_effect = { + ROLE = marshal + JOB_TAKER = $JOB_TAKER$ + LIEGE = $LIEGE$ + } + } + 2 = { + trigger = { + petition_liege_councillor_second_trigger = { + ROLE = steward + SKILL = stewardship + JOB_TAKER = $JOB_TAKER$ + LIEGE = $LIEGE$ + } + } + modifier = { factor = $JOB_TAKER$.stewardship } + petition_liege_0101_councillor_scope_second_effect = { + ROLE = steward + JOB_TAKER = $JOB_TAKER$ + LIEGE = $LIEGE$ + } + } + 2 = { + trigger = { + petition_liege_councillor_second_trigger = { + ROLE = spymaster + SKILL = intrigue + JOB_TAKER = $JOB_TAKER$ + LIEGE = $LIEGE$ + } + } + modifier = { factor = $JOB_TAKER$.intrigue } + petition_liege_0101_councillor_scope_second_effect = { + ROLE = spymaster + JOB_TAKER = $JOB_TAKER$ + LIEGE = $LIEGE$ + } + } + 2 = { + trigger = { + AND = { + petition_liege_council_chaplain_appointable_trigger = { JOB_TAKER = $JOB_TAKER$ LIEGE = $LIEGE$ } + petition_liege_councillor_second_trigger = { + ROLE = court_chaplain + SKILL = learning + JOB_TAKER = $JOB_TAKER$ + LIEGE = $LIEGE$ + } + } + } + modifier = { factor = $JOB_TAKER$.learning } + petition_liege_0101_councillor_scope_second_effect = { + ROLE = court_chaplain + JOB_TAKER = $JOB_TAKER$ + LIEGE = $LIEGE$ + } + } + } +} + +# Give most fitting council seat +petition_liege_0101_council_seat_effect = { + if = { + limit = { + exists = scope:second_party + scope:second_party = { is_councillor = yes } + } + scope:petition_liege = { fire_councillor = scope:second_party } + scope:second_party = { + progress_towards_rival_effect = { + CHARACTER = scope:petition_vassal + REASON = rival_council_seat + OPINION = 0 + } + add_opinion = { + target = scope:petition_vassal + modifier = annoyed_opinion + opinion = -10 + } + add_opinion = { + target = scope:petition_liege + modifier = annoyed_opinion + opinion = -10 + } + } + } + scope:petition_liege = { + if = { + limit = { scope:petition_vassal != $JOB_TAKER$ } + add_courtier = $JOB_TAKER$ + } + switch = { + trigger = $JOB_TAKER$.var:$VAR$ + flag:chancellor = { + assign_councillor_type = { type = councillor_chancellor target = $JOB_TAKER$ } + } + flag:marshal = { + assign_councillor_type = { type = councillor_marshal target = $JOB_TAKER$ } + } + flag:steward = { + assign_councillor_type = { type = councillor_steward target = $JOB_TAKER$ } + } + flag:spymaster = { + assign_councillor_type = { type = councillor_spymaster target = $JOB_TAKER$ } + } + flag:court_chaplain = { + assign_councillor_type = { type = councillor_court_chaplain target = $JOB_TAKER$ } + } + } + } + petition_liege_block_firing_councillor_effect = { + COURT_OWNER = scope:petition_liege + JOB_TAKER = $JOB_TAKER$ + } + scope:petition_vassal = { + hidden_effect = { + send_interface_toast = { + title = petition_liege.0101.t.council_seat + left_icon = scope:petition_liege + right_icon = $JOB_TAKER$ + $JOB_TAKER$ = { + custom_description = { text = petition_liege_block_firing_councillor_effect_tt } + custom_tooltip = council_appointment_toast_desc_vassal + } + show_as_tooltip = { + reverse_add_opinion = { + target = scope:second_party + modifier = annoyed_opinion + opinion = -10 + } + } + } + } + } + scope:petition_liege = { + hidden_effect = { + send_interface_toast = { + title = petition_liege.0101.t.council_seat + left_icon = $JOB_TAKER$ + right_icon = scope:second_party + $JOB_TAKER$ = { + custom_description = { text = petition_liege_block_firing_councillor_effect_tt } + custom_tooltip = council_appointment_toast_desc_liege + } + show_as_tooltip = { + reverse_add_opinion = { + target = scope:second_party + modifier = annoyed_opinion + opinion = -10 + } + } + } + } + } +} + +petition_liege_0101_court_position_effect = { + $JOB_TAKER$ = { + set_variable = { + name = petition_court_position_liege + value = scope:petition_liege + years = 5 + } + } + if = { + limit = { exists = scope:second_court_pos } + $JOB_TAKER$ = { + set_variable = { + name = petition_court_position_role + value = var:second_court_position + years = 5 + } + } + court_position_generator_assignment_effect = { + EMPLOYER = scope:petition_liege + CANDIDATE = $JOB_TAKER$ + VAR = second + } + } + else = { + $JOB_TAKER$ = { + set_variable = { + name = petition_court_position_role + value = var:target_court_position + years = 5 + } + } + court_position_generator_assignment_effect = { + EMPLOYER = scope:petition_liege + CANDIDATE = $JOB_TAKER$ + VAR = target + } + } + if = { + limit = { $JOB_TAKER$ != scope:petition_vassal } + scope:petition_vassal = { + hidden_effect = { + send_interface_toast = { + title = petition_liege.0101.t.court_position + left_icon = scope:petition_liege + right_icon = $JOB_TAKER$ + $JOB_TAKER$ = { + custom_tooltip = court_position_toast_desc_vassal + } + } + } + } + } +} + +# Block petitioner from being fired +petition_liege_block_firing_councillor_effect = { + $JOB_TAKER$ = { + custom_description = { text = petition_liege_block_firing_councillor_effect_tt } + set_variable = { + name = block_fire_councillor + value = $COURT_OWNER$ + years = council_position_locked_value + } + } +} + +### Gold +# Pay inverse of gold to petitioner +petition_liege_0101_gold_effect = { + scope:petition_liege = { + stress_impact = { + greedy = minor_stress_impact_gain + profligate = minor_stress_impact_loss + improvident = minor_stress_impact_loss + } + pay_short_term_gold = { + target = scope:petition_vassal + gold = medium_gold_value + } + } +} + +### Debt +# Pay inverse of gold to petitioner +petition_liege_0101_pay_debt_effect = { + scope:petition_liege = { + stress_impact = { + greedy = minor_stress_impact_gain + profligate = minor_stress_impact_loss + improvident = minor_stress_impact_loss + } + pay_short_term_gold = { + target = scope:petition_vassal + gold = petitioner_debt_positivization_value + } + } +} + +### War Aid +petition_liege_0101_war_aid_effect = { + scope:petition_liege = { + stress_impact = { + craven = minor_stress_impact_gain + shy = minor_stress_impact_gain + } + } + if = { + limit = { + scope:petition_vassal = { has_variable = petition_liege_war_aid_join } + } + if = { + limit = { + scope:petition_vassal = { is_attacker_in_war = scope:petition_war } + } + scope:petition_war = { add_attacker = scope:petition_liege } + } + else = { + scope:petition_war = { add_defender = scope:petition_liege } + } + } + else = { + scope:petition_liege = { remove_short_term_gold = petitioner_war_aid_levies_cost_value } + scope:petition_vassal = { + spawn_army = { + inheritable = no + name = petition_liege_war_aid_troops + levies = petitioner_war_aid_levies_value + location = scope:petition_vassal.capital_province + war = scope:petition_war + } + } + } +} + +### Vassal War +# End all vassal wars +petition_liege_0101_end_all_wars_effect = { + scope:petition_liege = { + stress_impact = { + craven = minor_stress_impact_gain + shy = minor_stress_impact_gain + diplomat = minor_stress_impact_loss + } + } + scope:petition_vassal = { + every_character_war = { + limit = { + OR = { + AND = { + primary_attacker = scope:petition_vassal + primary_defender = { is_vassal_of = scope:petition_liege } + } + AND = { + primary_defender = scope:petition_vassal + primary_attacker = { is_vassal_of = scope:petition_liege } + } + } + } + save_temporary_scope_as = this_war + show_as_tooltip = { end_war = white_peace } + primary_attacker = { + add_truce_both_ways = { + character = scope:this_war.primary_defender + years = 5 + war = scope:this_war + result = white_peace + } + } + hidden_effect = { end_war = white_peace } # For tooltip ordering, so that we can display the addition of a truce after the war ends instead of before. + } + } + scope:second_party = { + hidden_effect = { + send_interface_toast = { + title = petition_liege.0101.t.end_war + left_icon = scope:petition_vassal + right_icon = scope:petition_liege + custom_tooltip = vassal_war_toast_desc_second_party + } + } + } +} + +### Faction War +petition_liege_0101_faction_dismantle_effect = { + scope:petition_liege = { + stress_impact = { + shy = minor_stress_impact_gain + diplomat = minor_stress_impact_loss + } + } + scope:vassal_faction = { + faction_target = { + add_opinion = { + target = ROOT + modifier = grateful_opinion + opinion = 10 + } + } + if = { + limit = { + exists = special_character + NOT = { + any_faction_member = { THIS = scope:vassal_faction.special_character } + } + } + special_character = { + add_opinion = { + target = scope:petition_liege + modifier = angry_opinion + opinion = -10 + } + } + } + if = { + limit = { faction_is_at_war = no } + every_faction_member = { + custom = hold_court_8260_faction_member_tt + add_faction_cooldown_effect = { YEARS = faction_war_white_peace_cooldown } + add_opinion = { + target = scope:petition_liege + modifier = angry_opinion + opinion = -10 + } + } + destroy_faction = yes + } + else = { + every_faction_member = { + custom = hold_court_8260_faction_member_tt + add_faction_cooldown_effect = { YEARS = faction_war_defeat_cooldown } + add_opinion = { + target = scope:petition_liege + modifier = angry_opinion + opinion = -25 + } + } + faction_war = { end_war = defender } + } + } +} + +### Control +petition_liege_0101_county_control_effect = { + scope:petition_liege = { + stress_impact = { + lazy = minor_stress_impact_gain + greedy = minor_stress_impact_gain + } + remove_short_term_gold = medium_gold_value + } + every_in_list = { + list = petition_liege_county_control_list + limit = { holder = scope:petition_vassal } + custom = petition_liege_0101_county_control_effect_tt + change_county_control = 10 + add_county_modifier = { + modifier = petition_liege_county_control_modifier + years = 5 + } + custom_tooltip = petition_liege_county_control_modifier_tt + } +} + +### Convert +petition_liege_0101_county_convert_effect = { + scope:petition_liege = { + stress_impact = { + cynical = minor_stress_impact_gain + greedy = minor_stress_impact_gain + } + remove_short_term_gold = medium_gold_value + } + every_in_list = { + list = petition_liege_county_convert_list + limit = { + holder = scope:petition_vassal + county.faith != ROOT.faith + } + custom = petition_liege_0101_county_convert_effect_tt + add_county_modifier = { + modifier = petition_liege_county_convert_modifier + years = 5 + } + custom_tooltip = petition_liege_county_convert_modifier_tt + } +} + +### Opinion +petition_liege_0101_county_opinion_effect = { + scope:petition_liege = { + stress_impact = { + base = minor_stress_impact_gain + shy = minor_stress_impact_gain + lazy = minor_stress_impact_gain + craven = minor_stress_impact_gain + arrogant = minor_stress_impact_gain + reclusive = minor_stress_impact_gain + } + } + every_in_list = { + list = petition_liege_county_opinion_list + limit = { + holder = scope:petition_vassal + county_opinion <= -25 + } + custom = petition_liege_0101_county_opinion_effect_tt + add_county_modifier = { + modifier = petition_liege_county_opinion_modifier + years = 5 + } + } +} + +### Fortify +petition_liege_0101_fortify_border_effect = { + scope:petition_liege = { + stress_impact = { + brave = minor_stress_impact_gain + greedy = minor_stress_impact_gain + architect = minor_stress_impact_loss + } + remove_short_term_gold = medium_gold_value + } + every_in_list = { + list = petition_liege_fortify_border_list + limit = { + holder = scope:petition_vassal + } + custom = petition_liege_0101_fortify_border_effect_tt + add_county_modifier = { + modifier = petition_liege_fortify_border_modifier + years = 5 + } + } +} + +### Title Liege +petition_liege_0101_title_liege_effect = { + scope:petition_liege = { + stress_impact = { + greedy = medium_stress_impact_gain + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = change + add_claim_on_loss = no + } + scope:petition_claim = { + change_title_holder_include_vassals = { + holder = scope:petition_vassal + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + scope:petition_vassal = { + hidden_effect = { + send_interface_toast = { + title = petition_liege.0101.t.title_liege + left_icon = scope:petition_liege + show_as_tooltip = { + scope:petition_vassal = { get_title = scope:petition_claim } + } + } + } + } + scope:petition_liege = { + hidden_effect = { + send_interface_toast = { + title = petition_liege.0101.t.title_liege + left_icon = scope:petition_vassal + show_as_tooltip = { + scope:petition_vassal = { get_title = scope:petition_claim } + } + } + } + } +} + +### Title Vassal +petition_liege_0101_title_vassal_effect = { + scope:petition_liege = { + add_tyranny = minor_tyranny_gain + stress_impact = { + compassionate = minor_stress_impact_gain + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = change + add_claim_on_loss = yes + } + scope:petition_claim = { + change_title_holder = { + holder = scope:petition_vassal + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + scope:second_party = { + progress_towards_rival_effect = { + CHARACTER = scope:petition_vassal + REASON = rival_council_seat + OPINION = 0 + } + add_opinion = { + target = scope:petition_vassal + modifier = angry_opinion + opinion = -20 + } + add_opinion = { + target = scope:petition_liege + modifier = revoked_title + opinion = -20 + } + } + scope:petition_vassal = { + hidden_effect = { + send_interface_toast = { + title = petition_liege.0101.t.title_vassal + left_icon = scope:petition_liege + right_icon = scope:second_party + show_as_tooltip = { + scope:petition_vassal = { get_title = scope:petition_claim } + } + } + } + } + scope:petition_liege = { + hidden_effect = { + send_interface_toast = { + title = petition_liege.0101.t.title_vassal + left_icon = scope:petition_vassal + right_icon = scope:second_party + show_as_tooltip = { + scope:petition_vassal = { get_title = scope:petition_claim } + } + } + } + } + scope:second_party = { + hidden_effect = { + send_interface_toast = { + title = petition_liege.0101.t.title_vassal + left_icon = scope:petition_vassal + right_icon = scope:petition_liege + show_as_tooltip = { + scope:petition_vassal = { get_title = scope:petition_claim } + } + } + } + } + scope:petition_claim = { + set_variable = { + name = petition_title_cooldown + years = 5 + } + } +} + +### Construct City +petition_liege_0101_construct_city_effect = { + scope:petition_liege = { + stress_impact = { + greedy = medium_stress_impact_gain + architect = minor_stress_impact_loss + profligate = minor_stress_impact_loss + improvident = minor_stress_impact_loss + } + remove_short_term_gold = main_building_tier_1_cost + } + scope:petition_construct = { + begin_create_holding = { + type = city_holding + refund_cost = { gold = 0 } + } + } + scope:petition_vassal = { + hidden_effect = { + send_interface_toast = { + title = petition_liege.0101.t.construct_city + left_icon = scope:petition_liege + show_as_tooltip = { + scope:petition_construct = { + begin_create_holding = { + type = city_holding + refund_cost = { gold = 0 } + } + } + } + } + } + } +} + +### Construct Temple +petition_liege_0101_construct_temple_effect = { + scope:petition_liege = { + stress_impact = { + greedy = medium_stress_impact_gain + architect = minor_stress_impact_loss + profligate = minor_stress_impact_loss + improvident = minor_stress_impact_loss + } + remove_short_term_gold = main_building_tier_1_cost + } + scope:petition_construct = { + begin_create_holding = { + type = church_holding + refund_cost = { gold = 0 } + } + } + scope:petition_vassal = { + hidden_effect = { + send_interface_toast = { + title = petition_liege.0101.t.construct_temple + left_icon = scope:petition_liege + show_as_tooltip = { + scope:petition_construct = { + begin_create_holding = { + type = church_holding + refund_cost = { gold = 0 } + } + } + } + } + } + } +} + +### Development +petition_liege_0101_development_effect = { + scope:petition_liege = { + stress_impact = { + greedy = medium_stress_impact_gain + } + capital_province.county = { change_development_level = -2 } + hidden_effect = { + send_interface_toast = { + title = petition_liege.0101.t.development + left_icon = scope:petition_vassal + show_as_tooltip = { + capital_province.county = { change_development_level = -2 } + } + } + } + } + scope:petition_vassal = { + capital_province.county = { + change_development_level = 2 + add_county_modifier = { + modifier = petition_liege_development_modifier + years = 5 + } + } + hidden_effect = { + send_interface_toast = { + title = petition_liege.0101.t.development + left_icon = scope:petition_liege + show_as_tooltip = { + capital_province.county = { + change_development_level = 2 + add_county_modifier = { + modifier = petition_liege_development_modifier + years = 5 + } + } + } + } + } + } +} + +### House Fief +petition_liege_0101_house_fief_effect = { + scope:petition_liege = { + stress_impact = { + arrogant = medium_stress_impact_gain + } + hidden_effect = { + send_interface_toast = { + title = petition_liege.0101.t.house_fief + left_icon = scope:petition_vassal + custom_tooltip = petition_liege_house_fief_allowed + } + } + } + scope:petition_vassal = { + set_variable = { + name = petition_liege_house_fief_allowed_flag + value = scope:petition_liege + years = 10 + } + hidden_effect = { + send_interface_toast = { + title = petition_liege.0101.t.house_fief + left_icon = scope:petition_liege + custom_tooltip = petition_liege_house_fief_allowed + } + } + } +} + +petition_liege_0121_regent_effect = { + custom_tooltip = petition_liege_regent_support + scope:petition_liege = { + stress_impact = { + arrogant = medium_stress_impact_gain + } + hidden_effect = { + send_interface_toast = { + title = petition_liege.0121.t.regent + left_icon = scope:petition_vassal + right_icon = top_liege.primary_title + custom_tooltip = petition_liege_regent_support + } + } + } + scope:petition_vassal = { + hidden_effect = { + send_interface_toast = { + title = petition_liege.0121.t.regent + left_icon = scope:petition_liege + right_icon = top_liege.primary_title + set_variable = { + name = petition_liege_regent_support + value = scope:petition_liege + } + custom_tooltip = petition_liege_regent_support + } + } + } +} + +petition_liege_0121_appointment_effect = { + custom_tooltip = petition_liege_appointment_support + scope:petition_liege = { + stress_impact = { + arrogant = medium_stress_impact_gain + } + hidden_effect = { + send_interface_toast = { + title = petition_liege.0121.t.appointment + left_icon = scope:petition_vassal + right_icon = scope:petition_vassal.house + custom_tooltip = petition_liege_appointment_support + } + } + } + scope:petition_vassal = { + hidden_effect = { + send_interface_toast = { + title = petition_liege.0121.t.appointment + left_icon = scope:petition_liege + right_icon = house + house = { + set_variable = { + name = petition_liege_appointment_support + value = scope:petition_liege + } + } + custom_tooltip = petition_liege_appointment_support + } + } + } +} + +petition_liege_0121_wedding_effect = { + scope:petition_vassal = { custom_tooltip = petition_liege_wedding_permission } + scope:petition_liege = { + stress_impact = { + arrogant = medium_stress_impact_gain + } + hidden_effect = { + send_interface_toast = { + title = petition_liege.0121.t.wedding + left_icon = scope:petition_vassal + right_icon = house + custom_tooltip = petition_liege_wedding_permission + } + } + } + scope:petition_vassal = { + hidden_effect = { + send_interface_toast = { + title = petition_liege.0121.t.wedding + left_icon = scope:petition_liege + right_icon = scope:petition_liege.house + house = { + set_variable = { + name = petition_liege_wedding_permission_flag + value = scope:petition_liege.house + years = 5 + } + } + custom_tooltip = petition_liege_wedding_permission + } + } + } +} + +petition_liege_0121_privilege_effect = { + scope:petition_liege = { + stress_impact = { + arrogant = medium_stress_impact_gain + } + hidden_effect = { + send_interface_toast = { + title = petition_liege.0121.t.privilege + left_icon = scope:petition_vassal + show_as_tooltip = { add_prestige = major_prestige_value } + } + } + } + scope:petition_vassal = { + add_prestige = major_prestige_value + hidden_effect = { + send_interface_toast = { + title = petition_liege.0121.t.privilege + left_icon = scope:petition_liege + show_as_tooltip = { add_prestige = major_prestige_value } + } + } + } +} + +### Grandeur/Renown +petition_pos_grandeur_renown_effect = { + if = { + limit = { petition_liege_medium_cost_trigger = yes } + scope:petition_liege = { change_current_court_grandeur = minor_court_grandeur_gain } + } + else_if = { + limit = { petition_liege_high_cost_trigger = yes } + scope:petition_liege = { change_current_court_grandeur = medium_court_grandeur_gain } + } + if = { + limit = { scope:petition_liege.dynasty = scope:petition_vassal.dynasty } + scope:petition_liege.dynasty = { add_dynasty_prestige = minor_dynasty_prestige_value } + } + else = { + scope:petition_liege.dynasty = { add_dynasty_prestige = miniscule_dynasty_prestige_gain } + scope:petition_vassal.dynasty = { add_dynasty_prestige = miniscule_dynasty_prestige_gain } + } +} + +petition_neg_grandeur_renown_effect = { + scope:petition_liege = { + change_current_court_grandeur = minor_court_grandeur_loss + dynasty = { add_dynasty_prestige = miniscule_dynasty_prestige_loss } + } +} + +### Run relevant effects for request +petition_type_outcome_effect = { + switch = { + trigger = scope:petition_vassal.var:petition_type + flag:fallback = { petition_liege_0101_gold_effect = yes } + flag:gold = { petition_liege_0101_gold_effect = yes } + flag:council_seat = { + if = { + limit = { exists = scope:second_council_pos } + petition_liege_0101_council_seat_effect = { + JOB_TAKER = scope:petition_vassal + VAR = petition_liege_council_second + } + } + else = { + petition_liege_0101_council_seat_effect = { + JOB_TAKER = scope:petition_vassal + VAR = petition_liege_council_first + } + } + } + flag:council_seat_family = { + if = { + limit = { exists = scope:second_council_pos } + petition_liege_0101_council_seat_effect = { + JOB_TAKER = scope:petition_char + VAR = petition_liege_council_second + } + } + else = { + petition_liege_0101_council_seat_effect = { + JOB_TAKER = scope:petition_char + VAR = petition_liege_council_first + } + } + } + flag:court_position = { + petition_liege_0101_court_position_effect = { JOB_TAKER = scope:petition_vassal } + } + flag:court_position_family = { + petition_liege_0101_court_position_effect = { JOB_TAKER = scope:petition_char } + } + flag:governorship_family = { + petition_liege_governorship_effect = { + CHAR = scope:petition_char + TITLE = scope:governorship_title + GRANTED_FROM = scope:petition_liege + } + } + flag:house_governorship_rights = { + petition_liege_house_governorship_rights_effect = yes + } + flag:pay_debt = { petition_liege_0101_pay_debt_effect = yes } + flag:war_aid = {petition_liege_0101_war_aid_effect = yes } + flag:vassal_war = { petition_liege_0101_end_all_wars_effect = yes } + flag:faction_war = { petition_liege_0101_faction_dismantle_effect = yes } + flag:county_control = { petition_liege_0101_county_control_effect = yes } + flag:county_convert = { petition_liege_0101_county_convert_effect = yes } + flag:county_opinion = { petition_liege_0101_county_opinion_effect = yes } + flag:fortify_border = { petition_liege_0101_fortify_border_effect = yes } + flag:title_liege = { petition_liege_0101_title_liege_effect = yes } + flag:title_vassal = { + if = { + limit = { + scope:second_party = { is_ai = no } + } + scope:second_party = { trigger_event = petition_liege.0501 } + custom_description_no_bullet = { + text = petition_liege_second_if_tt + object = scope:second_party + } + scope:second_party = { + show_as_tooltip = { petition_liege_0101_title_vassal_effect = yes } + } + } + else = { petition_liege_0101_title_vassal_effect = yes } + } + flag:construct_city = { petition_liege_0101_construct_city_effect = yes } + flag:construct_temple = { petition_liege_0101_construct_temple_effect = yes } + flag:development = { petition_liege_0101_development_effect = yes } + flag:house_fief = { petition_liege_0101_house_fief_effect = yes } + flag:regent = { petition_liege_0121_regent_effect = yes } + flag:appointment = { petition_liege_0121_appointment_effect = yes } + flag:wedding = { petition_liege_0121_wedding_effect = yes } + flag:privilege = { petition_liege_0121_privilege_effect = yes } + } + petition_pos_grandeur_renown_effect = yes +} + +### Bribes +# Pay gold to liege +petition_liege_0101_petitioner_pays_gold_bribe_effect = { + scope:petition_vassal = { + pay_short_term_gold = { + target = scope:petition_liege + gold = scope:petition_vassal.medium_gold_value + } + } +} + +# Grant favor to liege +petition_liege_0101_petitioner_gives_favor_hook_effect = { + scope:petition_liege = { + add_hook = { + target = scope:petition_vassal + type = favor_hook + years = 10 + } + } +} + +# Remove petitioner from factions +petition_liege_0101_petitioner_blocked_from_factions_effect = { + scope:petition_vassal = { + leave_faction = joined_faction + add_faction_cooldown_effect = { YEARS = 10 } + } +} + +# Increase contractual obligations +petition_liege_0101_petitioner_contract_increase_effect = { + if = { + limit = { + vassal_contract_obligation_level:feudal_government_levies < vassal_contract_obligation_level:feudal_government_taxes + vassal_contract_obligation_level_can_be_increased = feudal_government_levies + } + vassal_contract_increase_obligation_level = feudal_government_levies + } + else_if = { + limit = { + vassal_contract_obligation_level:feudal_government_taxes < vassal_contract_obligation_level:feudal_government_levies + vassal_contract_obligation_level_can_be_increased = feudal_government_taxes + } + vassal_contract_increase_obligation_level = feudal_government_taxes + } + else = { + if = { + limit = { vassal_contract_obligation_level_can_be_increased = feudal_government_taxes } + vassal_contract_increase_obligation_level = feudal_government_levies + } + else = { vassal_contract_increase_obligation_level = feudal_government_taxes } + } + hidden_effect = { set_subject_contract_modification_blocked = yes } +} + +# Vows +petition_liege_0101_petitioner_vows_effect = { + scope:monk = { add_trait = devoted } +} + +# Knight +petition_liege_0101_petitioner_knight_effect = { + scope:petition_liege = { add_courtier = scope:knight } +} + +petition_skill_duel_lose_effect = { + send_interface_toast = { + title = petition_liege.0401.failure + left_icon = scope:petition_liege + #show_as_tooltip = { + # activity = { complete_activity = yes } + #} + } +} + +petition_skill_duel_effect = { + duel = { + skill = $SKILL$ + target = $TARGET$ + 8 = { + desc = petition_liege.0401.success + compare_modifier = { + value = scope:duel_value + multiplier = 0.5 + } + hidden_effect = { petition_type_outcome_effect = yes } + custom_tooltip = petition_liege_accept_tt + reverse_add_opinion = { + target = $TARGET$ + modifier = annoyed_opinion + opinion = -10 + } + } + 12 = { + desc = petition_liege.0401.failure + petition_skill_duel_lose_effect = yes + } + } +} + +petition_liege_governorship_effect = { + create_title_and_vassal_change = { + type = granted + save_scope_as = change + add_claim_on_loss = no + } + hidden_effect = { + $TITLE$ = { + $GRANTED_FROM$ = { + every_held_title = { + title_tier >= county + limit = { + OR = { + de_jure_liege = $TITLE$ + de_jure_liege.de_jure_liege = $TITLE$ + } + } + add_to_list = transfer_list + change_title_holder = { + holder = $CHAR$ + change = scope:change + take_baronies = no + } + } + } + } + } + $TITLE$ = { + change_title_holder_include_vassals = { + holder = $CHAR$ + change = scope:change + take_baronies = no + } + } + hidden_effect = { + scope:petition_vassal = { + send_interface_toast = { + title = petition_liege.0101.t.governorship + left_icon = $CHAR$ + right_icon = $TITLE$ + show_as_tooltip = { + $TITLE$ = { + change_title_holder_include_vassals = { + holder = $CHAR$ + change = scope:change + take_baronies = no + } + } + } + } + } + scope:petition_liege = { + send_interface_toast = { + title = petition_liege.0101.t.governorship + left_icon = $CHAR$ + right_icon = $TITLE$ + show_as_tooltip = { + $TITLE$ = { + change_title_holder_include_vassals = { + holder = $CHAR$ + change = scope:change + take_baronies = no + } + } + } + } + } + } + resolve_title_and_vassal_change = scope:change +} + +petition_liege_save_governorship_effect = { + if = { + limit = { + any_held_title = { + petition_liege_governorship_duchy_request = { LIEGE = scope:petition_liege } + } + } + random_held_title = { + limit = { petition_liege_governorship_duchy_request = { LIEGE = scope:petition_liege } } + save_scope_as = governorship_title + } + } + else_if = { + limit = { + any_held_title = { + petition_liege_governorship_county_request = { LIEGE = scope:petition_liege } + } + } + random_held_title = { + limit = { petition_liege_governorship_county_request = { LIEGE = scope:petition_liege } } + save_scope_as = governorship_title + } + } + else_if = { + limit = { + any_held_title = { + petition_liege_governorship_kingdom_request = { LIEGE = scope:petition_liege } + } + } + random_held_title = { + limit = { petition_liege_governorship_kingdom_request = { LIEGE = scope:petition_liege } } + save_scope_as = governorship_title + } + } +} + +petition_liege_house_governorship_rights_effect = { + scope:petition_vassal.primary_title = { + custom_tooltip = { + text = petition_liege_house_governorship_rights_tt + set_variable = { + name = petition_house_rights + value = scope:petition_vassal.house + years = 100 + } + } + } +} + +# Add petitioner to bloc +petition_liege_0121_petitioner_force_join_bloc_effect = { + scope:petition_vassal.house = { + if = { + limit = { exists = house_confederation } + tgp_leave_house_bloc_effect = { + OPINION = flag:yes + TRUCE = flag:yes + } + } + tgp_join_house_bloc_effect = { + INVITER = scope:petition_liege.house + OPINION = flag:no + } + } +} diff --git a/N3OW/common/scripted_effects/00_pilgrimage_effects.txt b/N3OW/common/scripted_effects/00_pilgrimage_effects.txt new file mode 100644 index 00000000..69b87408 --- /dev/null +++ b/N3OW/common/scripted_effects/00_pilgrimage_effects.txt @@ -0,0 +1,1325 @@ +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! + +### Reward effects +# pilgrimage_completed_log_entry_effect -- Grants you Hajj or Pilgrimage rewards, is run in the on_complete of the Pilgrimage activity +# pilgrimage_additional_reward_effect -- Gives additional rewards for going on Pilgrimage with certain tenets +# +# give_pilgrim_trait_or_xp_effect -- Grants you Pilgrimage trait as appropriate; if you already have the trait it either gives xp or piety. Also logs arrival in activity log for host +# give_hajj_trait_or_xp_effect -- Grants you Hajjaj trait as appropriate; if you already have the trait it either gives xp or piety. Also logs arrival in activity log for host +# give_pilgrim_xp_effect -- If you already have the trait, determine what kind of xp or other reward to get +# +# award_piety_reward_effect -- Determines the amount of piety to reward, takes the predetermined $LENGTH$-parameter +# give_pious_type_reward_effect -- If we have the Pious/Hajj Type, determine what reward we are getting +# give_worldly_type_reward_effect -- If we have the Worldly Type, determine what reward we are getting + + +### Activity effects +# set_pilgrimage_distance_variable_effect -- Set variables tracking the length of the Pilgrimage (See pilgrimage_values.txt) +# save_unique_holy_site_and_update_count_variable_for_tally_effect - Track unique holy sites visited for conclusion, rewards and other statistics +# pilgrimages_track_encountered_cultures_effect -- Track how many cultures you've encountered on your pilgrimage + + +### Artifact effects +# christian_saint_bone_creation_effect -- Create a bone of a random saint in a box +# christian_saint_bone_tooltip_effect -- Needed to ensure tooltip matches artifact name + + +### Event effects +# give_pilgrimage_reward_effect -- Picks the correct Pilgrimage reward to grant +# pilgrimage_arrival_stress_loss_effect -- Stress loss when arriving at the holy site +# +# pious_type_option_effect -- Checks if you have the pious type and updates the activity_special_type_progression variable +# worldly_type_option_effect -- Checks if you have the worldly type and updates the activity_special_type_progression variable +# bonus_to_all_types_effect -- Blanket effect for an option that should boost all types +# very_pious_type_option_effect -- VERY boosting - very rare - Checks if you have the pious type and updates the activity_special_type_progression variable +# very_worldly_type_option_effect - VERY boosting - very rare - Checks if you have the worldly type and updates the activity_special_type_progression variable +# +# account_for_pilgrimage_length_type_effect -- Boost short pilgrimages a bit so they don't always get shafted +# resolve_pilgrimage_type_reward_effect -- Account for the state of our variables, apply flags that are resolved in give_pilgrimage_reward_effect - run in pilgrimage.7000 +# clean_up_pilgrimage_type_reward_flags_effect -- Clean up the flags + + + + + +##################################################################### +# EFFECTS +##################################################################### + +### Reward effects ### + +#Grants you Hajj or Pilgrimage rewards, is run in the on_complete of the Pilgrimage activity +pilgrimage_completed_log_entry_effect = { + if = { + limit = { has_hajj_pilgrimage_type_trigger = yes } + involved_activity = { + add_activity_log_entry = { + key = hajj_completed_log + tags = { completed } + score = 100 + show_in_conclusion = yes + character = root + #Effects + root = { + #This effect applies traits/xp as appropriate and ALSO calls give_pilgrimage_reward_effect + give_hajj_trait_or_xp_effect = yes + } + } + } + } + else_if = { + limit = { exists = involved_activity } + involved_activity = { + add_activity_log_entry = { + key = pilgrimage_completed_log + tags = { completed } + score = 100 + show_in_conclusion = yes + character = root + #Effects + root = { + #This effect applies traits/xp as appropriate and also calls give_pilgrimage_reward_effect + give_pilgrimage_reward_effect = yes + } + } + } + } +} + +#Gives additional rewards for going on Pilgrimage with certain tenets +pilgrimage_additional_reward_effect = { + # Armed Pilgrimages + if = { + limit = { + faith = { has_doctrine = tenet_armed_pilgrimages } + } + custom_description_no_bullet = { + text = pilgrimage_because_i_have_armed_pilgrimages + } + add_character_modifier = { + modifier = pilgrimage_armed_pilgrimages_modifier + years = 10 + } + } + # Mendicant Preachers + if = { + limit = { + faith = { has_doctrine = tenet_mendicant_preachers } + } + custom_description_no_bullet = { + text = pilgrimage_because_i_have_tenet_mendicant_preachers + } + add_character_modifier = { + modifier = pilgrimage_mendicant_preachers_modifier + years = 10 + } + } + # Pentarchy + if = { + limit = { + faith = { has_doctrine = tenet_pentarchy } + } + custom_description_no_bullet = { + text = pilgrimage_because_i_have_tenet_pentarchy + } + add_character_modifier = { + modifier = pilgrimage_pentarchy_modifier + years = 10 + } + } + # Struggle and Submission + if = { + limit = { + faith = { has_doctrine = tenet_struggle_submission } + } + custom_description_no_bullet = { + text = pilgrimage_because_i_have_tenet_struggle_submission + } + add_character_modifier = { + modifier = pilgrimage_struggle_submission_modifier + years = 10 + } + } + # Ancestor Worship + if = { + limit = { + faith = { has_doctrine = tenet_ancestor_worship } + } + custom_description_no_bullet = { + text = pilgrimage_because_i_have_tenet_ancestor_worship + } + add_character_modifier = { + modifier = pilgrimage_ancestor_worship_modifier + years = 10 + } + } + # Esotericism + if = { + limit = { + faith = { has_doctrine = tenet_esotericism } + NOT = { + has_trait = lifestyle_mystic + has_trait_xp = { + trait = lifestyle_mystic + value >= 100 + } + } + } + custom_description_no_bullet = { + text = pilgrimage_because_i_have_tenet_esotericism + subject = root + } + random_list = { + desc = pilgrimage_learn_from_the_bishops + 50 = { + desc = pilgrimage_learn_from_the_bishops_success + compare_modifier = { + value = learning + multiplier = 5 + } + if = { + limit = { + NOT = { has_trait = lifestyle_mystic } + } + add_trait = lifestyle_mystic + } + else = { + add_trait_xp = { + trait = lifestyle_mystic + value = 5 + } + } + } + 50 = { + desc = pilgrimage_learn_from_the_bishops_failure + send_interface_toast = { + title = pilgrimage_learn_from_the_bishops_failure + left_icon = root + } + } + } + } +} + +#Grants you Pilgrimage trait as appropriate; if you already have the trait it either gives xp or piety. Also logs arrival in activity log for host +give_pilgrim_trait_or_xp_effect = { + if = { + limit = { has_hajj_pilgrimage_type_trigger = no } + if = { # Host + limit = { this = involved_activity.activity_host } + involved_activity = { + add_activity_log_entry = { + key = pilgrimage_arrived_log + score = 50 + tags = { arrived } + character = root + show_in_conclusion = yes + #Effects + root = { + if = { + limit = { + NOT = { has_trait = pilgrim } + } + add_trait = pilgrim + } + else_if = { + limit = { + has_trait_xp = { + trait = pilgrim + value < 100 + } + } + add_trait_xp = { + trait = pilgrim + value = 20 + } + } + else_if = { + limit = { has_lifestyle = learning_lifestyle } + add_learning_lifestyle_xp = major_lifestyle_xp + } + else = { add_character_flag = should_get_trait_piety } + } + } + } + } + else = { # Non-Host + if = { + limit = { + NOT = { has_trait = pilgrim } + } + add_trait = pilgrim + } + else_if = { + limit = { + has_trait_xp = { + trait = pilgrim + value < 100 + } + } + add_trait_xp = { + trait = pilgrim + value = 10 + } + } + else_if = { + limit = { has_lifestyle = learning_lifestyle } + add_learning_lifestyle_xp = major_lifestyle_xp + } + else = { add_character_flag = should_get_trait_piety } + } + } + #Add trait or xp for any people coming along as well + if = { + limit = { + current_travel_plan ?= { + any_entourage_character = { count > 1 } + } + } + #To get the past tense loc for the Obligatory arrival + custom_description_no_bullet = { + text = pilgrimage_entourage_gains_pilgrim_trait + hidden_effect = { + current_travel_plan = { + every_entourage_character = { + if = { + limit = { + NOT = { has_trait = pilgrim } + } + add_trait = pilgrim + } + else_if = { + limit = { has_trait = pilgrim } + add_trait_xp = { + trait = pilgrim + value = 10 + } + } + } + } + } + } + } +} + +#Grants you Hajjaj trait as appropriate; if you already have the trait it either gives xp or piety. Also logs the effect in activity log for host +give_hajj_trait_or_xp_effect = { + if = { + limit = { + NOT = { has_trait = hajjaj } + } + add_trait = hajjaj + } + else_if = { + limit = { has_lifestyle = learning_lifestyle } + add_learning_lifestyle_xp = major_lifestyle_xp + } + else = { add_character_flag = should_get_trait_piety } + give_pilgrimage_reward_effect = yes +} + +#If you already have the trait, determine what kind of xp or other reward to get +give_pilgrim_xp_effect = { + if = { + limit = { + has_trait = pilgrim + has_trait_xp = { + trait = pilgrim + value < 100 + } + } + add_trait_xp = { + trait = pilgrim + value = 5 + } + } + else_if = { + limit = { has_lifestyle = learning_lifestyle } + add_learning_lifestyle_xp = medium_lifestyle_xp + } + else_if = { + limit = { has_trait = zealous } + stress_impact = { base = medium_stress_loss } + } + else = { + stress_impact = { base = minor_stress_loss } + } +} + +#Determines the amount of piety to reward, takes the predetermined $LENGTH$-parameter +give_piety_reward_effect = { + add_piety = { + value = $LENGTH$_pilgrimage_piety_gain + # Multipliers + ## How seriously are you taking this pilgrimage? + ### Not very. + if = { + limit = { + root.involved_activity = { + has_activity_option = { + category = pilgrimage_option_fidelity + option = pilgrimage_fidelity_obligatory + } + } + } + multiply = 0.5 + } + ### Thuper theriouthe. + else_if = { + limit = { + root.involved_activity = { + has_activity_option = { + category = pilgrimage_option_fidelity + option = pilgrimage_fidelity_contemplative + } + } + } + multiply = 1.25 + } + ## Depending on how well you clung to your intent, you may get a higher reward. + if = { + limit = { has_character_flag = perfect_pious_reward } + multiply = pilgrimage_perfect_pious_multiplier + } + else_if = { + limit = { has_character_flag = high_pious_reward } + multiply = pilgrimage_high_pious_multiplier + } + else_if = { + limit = { has_character_flag = mid_pious_reward } + multiply = pilgrimage_mid_pious_multiplier + } + else_if = { + limit = { has_character_flag = low_pious_reward } + multiply = pilgrimage_low_pious_multiplier + } + # Additives + ## Experienced pilgrims may get more piety overall. + if = { + limit = { has_character_flag = should_get_trait_piety } + add = minor_piety_gain + } + ## Certain activity options may give you more piety also. + if = { + limit = { + root.involved_activity = { + OR = { + has_activity_option = { + category = pilgrimage_option_pomp + option = pilgrimage_pomp_humble + } + has_activity_option = { + category = pilgrimage_option_pomp + option = pilgrimage_pomp_ceremonial + } + } + } + } + add = minor_piety_gain + } + else_if = { + limit = { + root.involved_activity = { + has_activity_option = { + category = pilgrimage_option_pomp + option = pilgrimage_pomp_throng + } + } + } + add = medium_piety_gain + } + # Final mutlipliers + if = { + limit = { + root.confederation ?= { has_cohesion_level_parameter = any_member_increased_pilgrimage_rewards } + } + multiply = 1.1 + } + } +} + +#If we have the Pious Type, determine what reward we are getting +give_pious_type_reward_effect = { + if = { + limit = { + has_trait = pilgrim #This should be awarded upon arrival from your first pilgrimage + has_trait_xp = { + trait = pilgrim + value < 100 + } + } + if = { + limit = { has_character_flag = perfect_pious_reward } + add_trait_xp = { + trait = pilgrim + value = 40 + } + } + if = { + limit = { has_character_flag = high_pious_reward } + add_trait_xp = { + trait = pilgrim + value = 20 + } + } + if = { + limit = { has_character_flag = mid_pious_reward } + add_trait_xp = { + trait = pilgrim + value = 10 + } + } + if = { + limit = { has_character_flag = low_pious_reward } + add_trait_xp = { + trait = pilgrim + value = 5 + } + } + } +} + +#If we have the Worldly Pilgrimage, determine what reward we are getting +give_worldly_type_reward_effect = { + if = { + limit = { has_character_flag = perfect_worldly_reward } + if = { + limit = { + root.culture.culture_head = root + current_travel_plan = { + any_in_list = { + variable = visited_cultures_list + count > 0 + } + } + } + current_travel_plan = { + if = { + limit = { + any_in_list = { + variable = visited_cultures_list + count > 5 + } + } + every_in_list = { + variable = visited_cultures_list + custom = pilgrimage_cultural_acceptance_all_encountered.tt + change_cultural_acceptance = { + target = root.culture + value = pilgrimage_perfect_worldly_acceptance_value + desc = cultural_acceptance_gain_worldly_pilgrimage + } + } + } + else = { + every_in_list = { + variable = visited_cultures_list + custom = pilgrimage_cultural_acceptance_all_encountered.tt + change_cultural_acceptance = { + target = root.culture + value = pilgrimage_perfect_worldly_acceptance_value + desc = cultural_acceptance_gain_worldly_pilgrimage + } + } + } + } + } + else = { + add_character_modifier = { + modifier = pilgrimage_perfect_worldly_reward_modifier + years = 5 + } + } + } + if = { + limit = { has_character_flag = high_worldly_reward } + if = { + limit = { + root.culture.culture_head = root + current_travel_plan = { + any_in_list = { + variable = visited_cultures_list + count > 0 + } + } + } + current_travel_plan = { + if = { + limit = { + any_in_list = { + variable = visited_cultures_list + count > 5 + } + } + every_in_list = { + variable = visited_cultures_list + custom = pilgrimage_cultural_acceptance_all_encountered.tt + change_cultural_acceptance = { + target = root.culture + value = pilgrimage_high_worldly_acceptance_value + desc = cultural_acceptance_gain_worldly_pilgrimage + } + } + } + else = { + every_in_list = { + variable = visited_cultures_list + custom = pilgrimage_cultural_acceptance_all_encountered.tt + change_cultural_acceptance = { + target = root.culture + value = pilgrimage_high_worldly_acceptance_value + desc = cultural_acceptance_gain_worldly_pilgrimage + } + } + } + } + } + else = { + add_character_modifier = { + modifier = pilgrimage_high_worldly_reward_modifier + years = 5 + } + } + } + if = { + limit = { has_character_flag = mid_worldly_reward } + if = { + limit = { + root.culture.culture_head = root + current_travel_plan = { + any_in_list = { + variable = visited_cultures_list + count > 0 + } + } + } + current_travel_plan = { + if = { + limit = { + any_in_list = { + variable = visited_cultures_list + count > 3 + } + } + every_in_list = { + variable = visited_cultures_list + custom = pilgrimage_cultural_acceptance_all_encountered.tt + change_cultural_acceptance = { + target = root.culture + value = pilgrimage_mid_worldly_acceptance_value + desc = cultural_acceptance_gain_worldly_pilgrimage + } + } + } + else = { + every_in_list = { + variable = visited_cultures_list + custom = pilgrimage_cultural_acceptance_all_encountered.tt + change_cultural_acceptance = { + target = root.culture + value = pilgrimage_mid_worldly_acceptance_value + desc = cultural_acceptance_gain_worldly_pilgrimage + } + } + } + } + } + else = { + add_character_modifier = { + modifier = pilgrimage_mid_worldly_reward_modifier + years = 5 + } + } + } + if = { + limit = { has_character_flag = low_worldly_reward } + if = { + limit = { + root.culture.culture_head = root + current_travel_plan = { + any_in_list = { + variable = visited_cultures_list + count > 0 + } + } + } + current_travel_plan = { + if = { + limit = { + any_in_list = { + variable = visited_cultures_list + count > 5 + } + } + every_in_list = { + variable = visited_cultures_list + custom = pilgrimage_cultural_acceptance_all_encountered.tt + change_cultural_acceptance = { + target = root.culture + value = pilgrimage_low_worldly_acceptance_value + desc = cultural_acceptance_gain_worldly_pilgrimage + } + } + } + else = { + every_in_list = { + variable = visited_cultures_list + custom = pilgrimage_cultural_acceptance_all_encountered.tt + change_cultural_acceptance = { + target = root.culture + value = pilgrimage_low_worldly_acceptance_value + desc = cultural_acceptance_gain_worldly_pilgrimage + } + } + } + } + } + else = { + add_character_modifier = { + modifier = pilgrimage_low_worldly_reward_modifier + years = 5 + } + } + } +} + + +### Activity effects ### + +#Set variables tracking the length of the Pilgrimage (See pilgrimage_values.txt) +set_pilgrimage_distance_variable_effect = { + # Requires PILGRIM = character + # Requires HOLY_SITE = barony_title + $PILGRIM$.capital_barony = { # Only landed characters can go on regular pilgrimages + save_temporary_scope_as = start_barony + } + # Calculate distance to the target holy site + # The value set indicates how many Journey Events a character will get + if = { + limit = { + scope:start_barony = { + squared_distance = { + target = $HOLY_SITE$ + value > long_pilgrimage_max_length + } + } + } + scope:activity = { + set_variable = { + name = pilgrimage_distance + value = flag:very_long_pilgrimage_var + } + } + } + else_if = { + limit = { + scope:start_barony = { + squared_distance = { + target = $HOLY_SITE$ + value > medium_pilgrimage_max_length + } + } + } + scope:activity = { + set_variable = { + name = pilgrimage_distance + value = flag:long_pilgrimage_var + } + } + } + else_if = { + limit = { + scope:start_barony = { + squared_distance = { + target = $HOLY_SITE$ + value > short_pilgrimage_max_length + } + } + } + scope:activity = { + set_variable = { + name = pilgrimage_distance + value = flag:medium_pilgrimage_var + } + } + } + else = { + scope:activity = { + set_variable = { + name = pilgrimage_distance + value = flag:short_pilgrimage_var + } + } + } +} + +#Track unique holy sites visited for conclusion, rewards and other statistics - saves a variable_list and variable on your character +save_unique_holy_site_and_update_count_variable_for_tally_effect = { + #If this is our first holy site, set up the variable + if = { + limit = { + #These two really shouldn't exist without each other, but safe-checking + NOT = { exists = var:visited_unique_holy_sites_list } + NOT = { exists = var:visited_unique_holy_sites_count } + } + #Create variables + add_to_variable_list = { + name = visited_unique_holy_sites_list + target = $HOLY_SITE$ + } + set_variable = { + name = visited_unique_holy_sites_count + value = 1 + } + add_character_flag = added_new_holy_site + } + #Otherwise add the holy site if we don't already have it + else_if = { + limit = { + #These two really shouldn't exist without each other, but safe-checking + exists = var:visited_unique_holy_sites_count + #Does this holy site exist in the list? + any_in_list = { + variable = visited_unique_holy_sites_list + NOT = { this = $HOLY_SITE$ } + } + } + #Add the holy site to the list + add_to_variable_list = { + name = visited_unique_holy_sites_list + target = $HOLY_SITE$ + } + #Count up the variable + change_variable = { + name = visited_unique_holy_sites_count + add = 1 + } + add_character_flag = added_new_holy_site + } +} + +#Track how many cultures you've encountered on your pilgrimage - is saved on the current_travel_plan and destroyed with the travel plan +pilgrimages_track_encountered_cultures_effect = { + current_travel_plan = { + if = { + limit = { + NOT = { + exists = var:visited_cultures_list + root.location.culture = root.culture + } + } + add_to_variable_list = { + name = visited_cultures_list + target = root.location.culture + } + } + else_if = { + limit = { + NOT = { + any_in_list = { + variable = visited_cultures_list + this = root.location.culture + } + root.location.culture = root.culture + } + } + add_to_variable_list = { + name = visited_cultures_list + target = root.location.culture + } + } + } +} + + +### Artifact effects ### + +# Create a bone of a random saint in a box +christian_saint_bone_creation_effect = { + if = { + limit = { + has_royal_court = yes + OR = { + faith = faith:catholic + faith = faith:orthodox + faith = faith:nestorian + faith = faith:coptic + faith = faith:armenian_apostolic + faith = faith:insular_celtic + faith = { has_doctrine = tenet_christian_syncretism } + } + } + hidden_effect = { + random = { + chance = 10 # 10% base chance + modifier = { + add = 10 # 20% chance for medium + exists = scope:activity + exists = var:pilgrimage_distance + scope:activity.var:pilgrimage_distance = flag:medium_pilgrimage_var + } + modifier = { + add = 20 # 30% chance for long + exists = scope:activity + exists = var:pilgrimage_distance + scope:activity.var:pilgrimage_distance = flag:long_pilgrimage_var + } + modifier = { + add = 30 # 40% chance for very long + exists = scope:activity + exists = var:pilgrimage_distance + scope:activity.var:pilgrimage_distance = flag:very_long_pilgrimage_var + } + modifier = { + add = 10 + has_character_flag = mid_pious_reward + } + modifier = { + add = 20 + has_character_flag = high_pious_reward + } + modifier = { + add = 30 + has_character_flag = perfect_pious_reward + } + modifier = { # half as likely for AI + factor = 0.5 + is_ai = yes + } + save_scope_as = saint_bone_owner + create_artifact = { + name = christian_saint_bone_name + description = christian_saint_bone_description + type = pedestal + visuals = bone + template = saintly_bones_template + modifier = artifact_monthly_piety_1_modifier + save_scope_as = christian_saint_bone_scope + } + scope:christian_saint_bone_scope = { + set_variable = { # required to track usability for template + name = saint_bone_faith + value = scope:saint_bone_owner.faith + } + set_variable = { # required to track usability for template + name = holy_site + value = scope:saint_bone_owner.involved_activity.activity_location.county + } + if = { + limit = { exists = var:holy_site } + #To prevent unused variable errors :catto: + } + } + scope:activity ?= { + add_activity_log_entry = { + key = pilgrimage_completed_relic_log + score = 75 + tags = { complete } + character = scope:host + artifact = scope:christian_saint_bone_scope + show_in_conclusion = yes + # Effects + scope:christian_saint_bone_scope = { + set_owner = root + } + } + } + } + } + } +} + +# Needed to ensure tooltip matches artifact name +christian_saint_bone_tooltip_effect = { + if = { + limit = { exists = scope:christian_saint_bone_scope } + show_as_tooltip = { + scope:christian_saint_bone_scope = { set_owner = scope:host } + } + } +} + + +### Event effects ### + +#Picks the correct Pilgrimage reward to grant +give_pilgrimage_reward_effect = { + #Short Pilgrimage reward + if = { + limit = { short_pilgrimage_trigger = yes } + give_piety_reward_effect = { LENGTH = short } + give_pious_type_reward_effect = yes + give_worldly_type_reward_effect = yes + } + #Medium Pilgrimage reward + else_if = { + limit = { medium_pilgrimage_trigger = yes } + give_piety_reward_effect = { LENGTH = medium } + give_pious_type_reward_effect = yes + give_worldly_type_reward_effect = yes + } + #Long Pilgrimage reward + else_if = { + limit = { long_pilgrimage_trigger = yes } + give_piety_reward_effect = { LENGTH = long } + give_pious_type_reward_effect = yes + give_worldly_type_reward_effect = yes + } + #Very Long Pilgrimage reward + else_if = { + limit = { very_long_pilgrimage_trigger = yes } + give_piety_reward_effect = { LENGTH = very_long } + give_pious_type_reward_effect = yes + give_worldly_type_reward_effect = yes + } + christian_saint_bone_tooltip_effect = yes + pilgrimage_additional_reward_effect = yes + remove_character_flag = should_get_trait_piety + # LEGITIMACY GAIN FOR ACTIVITY PARTICIPATION - PILGRIMAGE + pilgrimage_activity_participation_legitimacy_effect = yes + # Sacred Mountains tenet + if = { + limit = { + faith = { has_doctrine_parameter = piety_from_hills_and_mountains_pilgrimages } + location = { + OR = { + terrain = hills + terrain = mountains + terrain = desert_mountains + } + } + } + custom_tooltip = { + text = piety_from_hills_and_mountains_pilgrimages_tt + add_piety = medium_piety_gain + } + } +} + +#Stress loss when arriving at the holy site +pilgrimage_arrival_stress_loss_effect = { + if = { + limit = { has_trait = zealous } + stress_impact = { base = medium_stress_loss } + } + else_if = { + limit = { has_trait = cynical } + #No stress loss for you! + } + else = { + stress_impact = { base = minor_stress_loss } + } +} + + +#Checks if you have the pious type and updates the activity_special_type_progression variable +pious_type_option_effect = { + involved_activity = { + if = { + limit = { + OR = { + activity_has_pious_pilgrimage_type_trigger = yes + #Hajj should also be considered a pious pilgrimage + activity_has_hajj_pilgrimage_type_trigger = yes + } + } + custom_tooltip = pilgrimage_pious_type_tt_positive + activity_special_type_progression_major= yes + } + } +} + +#Checks if you have the worldly type and updates the activity_special_type_progression variable +worldly_type_option_effect = { + involved_activity = { + if = { + limit = { activity_has_worldly_pilgrimage_type_trigger = yes } + custom_tooltip = pilgrimage_worldly_type_tt_positive + activity_special_type_progression_major = yes + } + } +} + +#Blanket effect for an option that should boost all types (not Hajj) +bonus_to_all_types_effect = { + pious_type_option_effect = yes + worldly_type_option_effect = yes +} + +#VERY boosting - very rare - Checks if you have the pious type and updates the activity_special_type_progression variable +very_pious_type_option_effect = { + involved_activity = { + if = { + limit = { + OR = { + activity_has_pious_pilgrimage_type_trigger = yes + #Hajj should also be considered a pious pilgrimage + activity_has_hajj_pilgrimage_type_trigger = yes + } + } + custom_tooltip = pilgrimage_pious_type_tt_very_positive + activity_special_type_progression_massive = yes + } + } +} + +#VERY boosting - very rare - Checks if you have the worldly type and updates the activity_special_type_progression variable +very_worldly_type_option_effect = { + involved_activity = { + if = { + limit = { activity_has_worldly_pilgrimage_type_trigger = yes } + custom_tooltip = pilgrimage_worldly_type_tt_very_positive + activity_special_type_progression_massive = yes + } + } +} + +#Boost short pilgrimages a bit so they don't always get shafted +account_for_pilgrimage_length_type_effect = { + #Short Pilgrimage + if = { + limit = { short_pilgrimage_trigger = yes } + involved_activity = { activity_special_type_progression_medium = yes } + } + #Medium Pilgrimage + else_if = { + limit = { medium_pilgrimage_trigger = yes } + involved_activity = { activity_special_type_progression_tiny = yes } + } +} + +#Account for the state of our variables, apply flags that are resolved in give_pilgrimage_reward_effect - run in pilgrimage.7000 +resolve_pilgrimage_type_reward_effect = { + #Pious Type + involved_activity ?= { + if = { + limit = { + #Pious and Hajj + OR = { + activity_has_pious_pilgrimage_type_trigger = yes + activity_has_hajj_pilgrimage_type_trigger = yes + } + } + #Perfect piousness - 75-100 + if = { + limit = { var:activity_special_type_progression >= 75 } + scope:host = { add_character_flag = perfect_pious_reward } + } + #High-end piousness - 50-75 + else_if = { + limit = { + var:activity_special_type_progression < 75 + var:activity_special_type_progression >= 50 + } + scope:host = { add_character_flag = high_pious_reward } + } + #OK piousness - 25-50 + else_if = { + limit = { + var:activity_special_type_progression < 50 + var:activity_special_type_progression >= 25 + } + scope:host = { add_character_flag = mid_pious_reward } + } + #Lousy piousness - 0-25 + else = { + scope:host = { add_character_flag = low_pious_reward } + } + } + #Worldly Type + if = { + limit = { activity_has_worldly_pilgrimage_type_trigger = yes } + #Perfect worldliness - 75-100 + if = { + limit = { var:activity_special_type_progression >= 75 } + scope:host = { add_character_flag = perfect_worldly_reward } + } + #High end worldliness - 50-75 + else_if = { + limit = { + var:activity_special_type_progression < 75 + var:activity_special_type_progression >= 50 + } + scope:host = { add_character_flag = high_worldly_reward } + } + #OK piousness - 25-50 + else_if = { + limit = { + var:activity_special_type_progression < 50 + var:activity_special_type_progression >= 25 + } + scope:host = { add_character_flag = mid_worldly_reward } + } + #Lousy piousness - 0-25 + else = { + scope:host = { add_character_flag = low_worldly_reward } + } + } + } + if = { + limit = { + scope:host = { + has_trait_xp = { + trait = pilgrim + value >= 50 + } + NOR = { + has_character_flag = pilgrim_legend + has_game_rule = historical_legends_only + } + has_dlc_feature = legends + } + } + scope:host = { + random = { + chance = { + value = legend_seed_chance_low #15% + if = { + limit = { + has_trait_xp = { + trait = pilgrim + value >= 75 + } + } + add = legend_seed_chance_medium #55% chance + } + else_if = { + limit = { + has_trait_xp = { + trait = pilgrim + value >= 60 + } + } + add = legend_seed_chance_low #30% chance + } + } + add_character_flag = pilgrim_legend + create_legend_seed = { + type = holy + quality = famed + chronicle = saintly_deed + properties = { + ancestor = scope:host + religion = scope:host.religion + } + } + } + } + } +} + +#Clean up the flags +clean_up_pilgrimage_type_reward_flags_effect = { + remove_character_flag = perfect_pious_reward + remove_character_flag = high_pious_reward + remove_character_flag = mid_pious_reward + remove_character_flag = low_pious_reward + remove_character_flag = perfect_worldly_reward + remove_character_flag = high_worldly_reward + remove_character_flag = mid_worldly_reward + remove_character_flag = low_worldly_reward +} + + +#Dead predecessor - turn back and bury +pilgrimage_turn_back_and_bury_effect = { + save_scope_as = root_scope + add_prestige = major_prestige_gain + add_character_modifier = { + modifier = pilgrimage_turned_back_buried_modifier + years = 5 + } + every_vassal_or_below = { + vassal_stance = zealot + custom = every_zealot_vassal + add_opinion = { + modifier = disapproving_opinion + target = root + opinion = -10 + } + } + every_vassal_or_below = { + vassal_stance = glory_hound + custom = every_glory_hound_vassal + add_opinion = { + modifier = approving_opinion + target = root + opinion = 20 + } + } + stress_impact = { + base = medium_stress_impact_loss + impatient = medium_stress_impact_loss + zealous = medium_stress_impact_gain + } +} + +#Dead predecessor - bury at destination +pilgrimage_bury_at_destination_effect = { + save_scope_as = root_scope + add_piety = major_piety_gain + add_character_modifier = { + modifier = pilgrimage_buried_at_destination_modifier + years = 10 + } + every_vassal_or_below = { + vassal_stance = zealot + custom = every_zealot_vassal + add_opinion = { + modifier = approving_opinion + target = root + opinion = 20 + } + } + every_vassal_or_below = { + vassal_stance = glory_hound + custom = every_glory_hound_vassal + add_opinion = { + modifier = disapproving_opinion + target = root + opinion = -10 + } + } + stress_impact = { + base = medium_stress_impact_loss + zealous = medium_stress_impact_loss + cynical = minor_stress_impact_gain + } +} + +#Dead predecessor - go to destination and back, then bury +pilgrimage_bury_at_home_effect = { + save_scope_as = root_scope + add_prestige = medium_prestige_gain + add_piety = medium_piety_gain + add_character_modifier = { + modifier = pilgrimage_buried_at_capital_modifier + years = 15 + } + every_vassal_or_below = { + vassal_stance = zealot + custom = every_zealot_vassal + add_opinion = { + modifier = approving_opinion + target = root + opinion = 15 + } + } + every_vassal_or_below = { + vassal_stance = glory_hound + custom = every_glory_hound_vassal + add_opinion = { + modifier = approving_opinion + target = root + opinion = 15 + } + } + stress_impact = { + base = major_stress_impact_loss + zealous = major_stress_impact_loss + cynical = medium_stress_impact_gain + } +} diff --git a/N3OW/common/scripted_effects/00_playdate_scripted_effects.txt b/N3OW/common/scripted_effects/00_playdate_scripted_effects.txt new file mode 100644 index 00000000..2994de56 --- /dev/null +++ b/N3OW/common/scripted_effects/00_playdate_scripted_effects.txt @@ -0,0 +1,42 @@ + +#Effects used in playdates + +#playdate_end_guest_effect - Effect run for all guests when they leave playdates + +playdate_concluded_my_events_effect = { + save_temporary_scope_as = finished_participant +} + +playdate_fire_correct_default_event_effect = { + trigger_event = { + on_action = playdate_event_selection + days = { min_playdate_event_spacing max_playdate_event_spacing } + } +} + +playdate_end_guest_effect = { + # Only called on the end of a *successful* playdate. Playdates which are interrupted due to death, imprisonment, etc., don't get this, so put critical clean-up stuff in the activity itself. + stress_impact = { + base = medium_stress_loss + gregarious = medium_stress_impact_loss + charming = minor_stress_impact_loss + shy = medium_stress_impact_gain + pensive = minor_stress_impact_gain + } +} + +hosted_successful_playdate_interrupted_effect = { + add_prestige = medium_prestige_gain + scope:activity = { + every_attending_character = { + limit = { + this != scope:host + } + custom = every_guest_scope_tt + add_opinion = { + target = scope:host + modifier = hosted_successful_playdate_opinion + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_poetry_effects.txt b/N3OW/common/scripted_effects/00_poetry_effects.txt new file mode 100644 index 00000000..642d1536 --- /dev/null +++ b/N3OW/common/scripted_effects/00_poetry_effects.txt @@ -0,0 +1,800 @@ +################################################## +# Generation +################################################## + +## Themes +select_poem_theme_romance_effect = { + set_variable = { + name = poetry_theme + value = flag:romance + } + # Set up a scope for gender effect checking. + save_scope_value_as = { + name = poetry_romance_target + value = yes + } +} + +select_poem_theme_mourning_effect = { + set_variable = { + name = poetry_theme + value = flag:mourning + } +} + +select_poem_theme_legacy_effect = { + set_variable = { + name = poetry_theme + value = flag:legacy + } +} + +select_poem_theme_strife_effect = { + set_variable = { + name = poetry_theme + value = flag:strife + } +} + +select_poem_theme_incompetence_effect = { + set_variable = { + name = poetry_theme + value = flag:incompetence + } +} + +select_poem_theme_random_effect = { + hidden_effect = { + random_list = { + # Romance + 100 = { select_poem_theme_romance_effect = yes } + # Mourning + 100 = { select_poem_theme_mourning_effect = yes } + # Legacy + 100 = { select_poem_theme_legacy_effect = yes } + # Strife + 100 = { select_poem_theme_strife_effect = yes } + # Incompetence + 100 = { select_poem_theme_incompetence_effect = yes } + } + } +} + +## Subject +### Used to select subject genders, taking any of the following: +#### flag:specific +#### flag:woman +#### flag:man +#### flag:random +### SUBJECT_TARGET needs to be filled out regardless to prevent errors, but is inert unless you've also set flag:specific. +#### Just stick it to root or whoever if not actively using it. +select_poem_subject_gender_effect = { + save_temporary_scope_value_as = { + name = subject + value = $SUBJECT$ + } + # If we have a $CHARACTER$ designated, select that. + if = { + limit = { scope:subject = flag:specific } + $SUBJECT_TARGET$ = { save_scope_as = subject } + } + # If we have a manually selected gender, grab that. + else_if = { + limit = { scope:subject = flag:woman } + dummy_female = { save_scope_as = subject } + } + else_if = { + limit = { scope:subject = flag:man } + dummy_male = { save_scope_as = subject } + } + # Otherwise, generate a dummy. + else = { + # Is this a romantic poem? + if = { + limit = { exists = scope:poetry_romance_target } + # If so, only target the correct gender for preference. + romance_target_gender_effect = { SCOPE_NAME = subject } + } + # Otherwise, just a random dummy is fine. + else = { + random_dummy_gender_soldier_effect = { SCOPE_NAME = subject } + } + } + # Finally, set this as a variable on root so that custom loc can access it. + set_variable = { + name = poem_subject + value = scope:subject + } +} + +################################################## +# Cleanup +################################################## + +cleanup_poem_effect = { + # Remove the generated theme. + remove_variable = poetry_theme + # And designated subject. + remove_variable = poem_subject +} + +################################################## +# Send Poem Interaction Consequences +################################################## + +@send_poem_rejected_prestige_cost = medium_prestige_loss +@send_poem_rejected_prestige_gain = minor_prestige_gain +@send_poem_accepted_prestige_regain = minor_prestige_gain + +send_poem_romance_duel_actor_victory_effect = { + scope:actor = { + if = { + limit = { + has_trait = lifestyle_poet + } + add_trait_xp = { + trait = lifestyle_poet + value = { 5 10 } + } + } + } + # Add a good amount of opinion of scope:actor. + scope:recipient = { + add_opinion = { + target = scope:actor + modifier = sent_poem_romance_opinion + } + hidden_effect = { + random = { + chance = 25 + if = { + limit = { can_set_relation_potential_lover_trigger = { CHARACTER = scope:actor } } + set_relation_potential_lover = scope:actor + } + } + } + } +} +send_poem_romance_duel_actor_failure_effect = { + # reduce their opinion of scope:recipient. + hidden_effect = { + scope:actor = { + add_opinion = { + target = scope:recipient + modifier = sent_poem_humiliated_opinion + } + } + } + # & give prestige to scope:recipient + scope:recipient = { + add_opinion = { + opinion = -20 + target = scope:actor + modifier = sent_poem_humiliated_opinion + } + hidden_effect = { + random = { + chance = 20 + if = { + limit = { can_set_relation_potential_rival_trigger = { CHARACTER = scope:actor } } + set_relation_potential_rival = scope:actor + } + } + } + add_prestige = @send_poem_rejected_prestige_gain + } +} + +send_poem_mourning_duel_actor_victory_effect = { + scope:actor = { + if = { + limit = { + has_trait = lifestyle_poet + } + add_trait_xp = { + trait = lifestyle_poet + value = { 5 10 } + } + } + } + # Add a modest amount of opinion of scope:actor & some stress loss. + scope:recipient = { + add_opinion = { + target = scope:actor + modifier = sent_poem_mourning_opinion + } + hidden_effect = { + random = { + chance = 25 + if = { + limit = { can_set_relation_potential_friend_trigger = { CHARACTER = scope:actor } } + set_relation_potential_friend = scope:actor + } + } + } + add_stress = medium_stress_loss + } +} +send_poem_mourning_duel_actor_failure_effect = { + # reduce their opinion of scope:recipient. + hidden_effect = { + scope:actor = { + add_opinion = { + target = scope:recipient + modifier = sent_poem_humiliated_opinion + } + } + } + scope:recipient = { + add_opinion = { + opinion = -20 + target = scope:actor + modifier = sent_poem_humiliated_opinion + } + hidden_effect = { + random = { + chance = 20 + if = { + limit = { can_set_relation_potential_rival_trigger = { CHARACTER = scope:actor } } + set_relation_potential_rival = scope:actor + } + } + } + add_prestige = @send_poem_rejected_prestige_gain + } +} + +send_poem_legacy_duel_actor_victory_effect = { + scope:actor = { + if = { + limit = { + has_trait = lifestyle_poet + } + add_trait_xp = { + trait = lifestyle_poet + value = { 5 10 } + } + } + } + # Add a modest amount of opinion of scope:actor & some piety. + scope:recipient = { + add_opinion = { + target = scope:actor + modifier = sent_poem_grateful_opinion + } + hidden_effect = { + random = { + chance = 25 + if = { + limit = { can_set_relation_potential_friend_trigger = { CHARACTER = scope:actor } } + set_relation_potential_friend = scope:actor + } + } + } + add_piety = minor_piety_gain + } +} +send_poem_legacy_duel_actor_failure_effect = { + # reduce their opinion of scope:recipient. + hidden_effect = { + scope:actor = { + add_opinion = { + target = scope:recipient + modifier = sent_poem_humiliated_opinion + } + } + } + # & give prestige to scope:recipient + scope:recipient = { + add_opinion = { + opinion = -20 + target = scope:actor + modifier = sent_poem_humiliated_opinion + } + hidden_effect = { + random = { + chance = 20 + if = { + limit = { can_set_relation_potential_rival_trigger = { CHARACTER = scope:actor } } + set_relation_potential_rival = scope:actor + } + } + } + add_prestige = @send_poem_rejected_prestige_gain + } +} + +send_poem_strife_duel_actor_victory_effect = { + scope:actor = { + if = { + limit = { + has_trait = lifestyle_poet + } + add_trait_xp = { + trait = lifestyle_poet + value = { 5 10 } + } + } + } + # Add a modest amount of opinion of scope:actor & some prestige. + scope:recipient = { + add_opinion = { + target = scope:actor + modifier = sent_poem_grateful_opinion + } + hidden_effect = { + random = { + chance = 25 + if = { + limit = { can_set_relation_potential_friend_trigger = { CHARACTER = scope:actor } } + set_relation_potential_friend = scope:actor + } + } + } + add_prestige = minor_prestige_gain + } +} +send_poem_strife_duel_actor_failure_effect = { + # reduce their opinion of scope:recipient. + hidden_effect = { + scope:actor = { + add_opinion = { + target = scope:recipient + modifier = sent_poem_humiliated_opinion + } + } + } + # & give prestige to scope:recipient + scope:recipient = { + add_opinion = { + opinion = -20 + target = scope:actor + modifier = sent_poem_humiliated_opinion + } + hidden_effect = { + random = { + chance = 20 + if = { + limit = { can_set_relation_potential_rival_trigger = { CHARACTER = scope:actor } } + set_relation_potential_rival = scope:actor + } + } + } + add_prestige = @send_poem_rejected_prestige_gain + } +} + +send_poem_incompetence_duel_actor_victory_effect = { + scope:actor = { + if = { + limit = { + has_trait = lifestyle_poet + } + add_trait_xp = { + trait = lifestyle_poet + value = { 5 10 } + } + } + } + # Reduce opinion of scope:actor & add stress. + scope:recipient = { + add_opinion = { + target = scope:actor + modifier = sent_poem_humiliated_opinion + } + hidden_effect = { + random = { + chance = 50 + if = { + limit = { can_set_relation_potential_rival_trigger = { CHARACTER = scope:actor } } + set_relation_potential_rival = scope:actor + } + } + } + add_stress = major_stress_gain + } +} +send_poem_incompetence_duel_actor_failure_effect = { + # reduce their opinion of scope:recipient. + hidden_effect = { + scope:actor = { + add_opinion = { + target = scope:recipient + modifier = sent_poem_humiliated_opinion + } + } + } + # & give prestige to scope:recipient + scope:recipient = { + add_opinion = { + opinion = -20 + target = scope:actor + modifier = sent_poem_humiliated_opinion + } + hidden_effect = { + random = { + chance = 20 + if = { + limit = { can_set_relation_potential_rival_trigger = { CHARACTER = scope:actor } } + set_relation_potential_rival = scope:actor + } + } + } + add_prestige = @send_poem_rejected_prestige_gain + } +} + +################################################## +# Send Poem Interaction Duels +################################################## + +send_poem_romance_duel_victory_notification_effect = { + # Send out toasts. + hidden_effect = { + # Send scope:actor-side toast + scope:actor = { + send_interface_toast = { + title = send_poem_interaction.success + left_icon = scope:recipient + show_as_tooltip = { send_poem_romance_duel_actor_victory_effect = yes } + } + } + # Send scope:recipient-side toast. + send_interface_toast = { + title = send_poem_interaction.success + left_icon = scope:actor + show_as_tooltip = { send_poem_romance_duel_actor_victory_effect = yes } + } + } + # Calculate the actual effects. + send_poem_romance_duel_actor_victory_effect = yes +} +send_poem_romance_duel_defeat_notification_effect = { + # Send out toasts. + hidden_effect = { + # Send scope:actor-side toast + scope:actor = { + send_interface_toast = { + title = send_poem_interaction.failure + left_icon = scope:recipient + show_as_tooltip = { send_poem_romance_duel_actor_failure_effect = yes } + } + } + # Send scope:recipient-side toast. + send_interface_toast = { + title = send_poem_interaction.failure + left_icon = scope:actor + show_as_tooltip = { send_poem_romance_duel_actor_failure_effect = yes } + } + } + # Calculate the actual effects. + send_poem_romance_duel_actor_failure_effect = yes +} +send_poem_romance_duel_effect = { + duel = { + skill = diplomacy + target = $POV_TARGET$ + # Scope:actor's words find their mark. + 50 = { + compare_modifier = { + value = scope:duel_value + multiplier = -3.5 + min = -49 + max = 49 + } + desc = send_poem_interaction.success + # Sort notifications & output. + send_poem_romance_duel_victory_notification_effect = yes + } + # Scope:recipient is able to publicly ridicule the poem. + 50 = { + compare_modifier = { + value = scope:duel_value + multiplier = 3.5 + min = -49 + max = 49 + } + desc = send_poem_interaction.failure + # Sort notifications & output. + send_poem_romance_duel_defeat_notification_effect = yes + } + } +} + +send_poem_mourning_duel_victory_notification_effect = { + # Send out toasts. + hidden_effect = { + # Send scope:actor-side toast + scope:actor = { + send_interface_toast = { + title = send_poem_interaction.success + left_icon = scope:recipient + show_as_tooltip = { send_poem_mourning_duel_actor_victory_effect = yes } + } + } + # Send scope:recipient-side toast. + send_interface_toast = { + title = send_poem_interaction.success + left_icon = scope:actor + show_as_tooltip = { send_poem_mourning_duel_actor_victory_effect = yes } + } + } + # Calculate the actual effects. + send_poem_mourning_duel_actor_victory_effect = yes +} +send_poem_mourning_duel_defeat_notification_effect = { + # Send out toasts. + hidden_effect = { + # Send scope:actor-side toast + scope:actor = { + send_interface_toast = { + title = send_poem_interaction.failure + left_icon = scope:recipient + show_as_tooltip = { send_poem_mourning_duel_actor_failure_effect = yes } + } + } + # Send scope:recipient-side toast. + send_interface_toast = { + title = send_poem_interaction.failure + left_icon = scope:actor + show_as_tooltip = { send_poem_mourning_duel_actor_failure_effect = yes } + } + } + # Calculate the actual effects. + send_poem_mourning_duel_actor_failure_effect = yes +} +send_poem_mourning_duel_effect = { + duel = { + skill = diplomacy + target = $POV_TARGET$ + # Scope:actor's words find their mark. + 50 = { + compare_modifier = { + value = scope:duel_value + multiplier = -3.5 + min = -49 + max = 49 + } + desc = send_poem_interaction.success + # Sort notifications & output. + send_poem_mourning_duel_victory_notification_effect = yes + } + # Scope:recipient is able to publicly ridicule the poem. + 50 = { + compare_modifier = { + value = scope:duel_value + multiplier = 3.5 + min = -49 + max = 49 + } + desc = send_poem_interaction.failure + # Sort notifications & output. + send_poem_mourning_duel_defeat_notification_effect = yes + } + } +} + +send_poem_legacy_duel_victory_notification_effect = { + # Send out toasts. + hidden_effect = { + # Send scope:actor-side toast + scope:actor = { + send_interface_toast = { + title = send_poem_interaction.success + left_icon = scope:recipient + show_as_tooltip = { send_poem_legacy_duel_actor_victory_effect = yes } + } + } + # Send scope:recipient-side toast. + send_interface_toast = { + title = send_poem_interaction.success + left_icon = scope:actor + show_as_tooltip = { send_poem_legacy_duel_actor_victory_effect = yes } + } + } + # Calculate the actual effects. + send_poem_legacy_duel_actor_victory_effect = yes +} + +send_poem_legacy_duel_defeat_notification_effect = { + # Send out toasts. + hidden_effect = { + # Send scope:actor-side toast + scope:actor = { + send_interface_toast = { + title = send_poem_interaction.failure + left_icon = scope:recipient + show_as_tooltip = { send_poem_legacy_duel_actor_failure_effect = yes } + } + } + # Send scope:recipient-side toast. + send_interface_toast = { + title = send_poem_interaction.failure + left_icon = scope:actor + show_as_tooltip = { send_poem_legacy_duel_actor_failure_effect = yes } + } + } + # Calculate the actual effects. + send_poem_legacy_duel_actor_failure_effect = yes +} + +send_poem_legacy_duel_effect = { + duel = { + skill = diplomacy + target = $POV_TARGET$ + # Scope:actor's words find their mark. + 50 = { + compare_modifier = { + value = scope:duel_value + multiplier = -3.5 + min = -49 + max = 49 + } + desc = send_poem_interaction.success + # Sort notifications & output. + send_poem_legacy_duel_victory_notification_effect = yes + } + # Scope:recipient is able to publicly ridicule the poem. + 50 = { + compare_modifier = { + value = scope:duel_value + multiplier = 3.5 + min = -49 + max = 49 + } + desc = send_poem_interaction.failure + # Sort notifications & output. + send_poem_legacy_duel_defeat_notification_effect = yes + } + } +} + +send_poem_strife_duel_victory_notification_effect = { + # Send out toasts. + hidden_effect = { + # Send scope:actor-side toast + scope:actor = { + send_interface_toast = { + title = send_poem_interaction.success + left_icon = scope:recipient + show_as_tooltip = { send_poem_strife_duel_actor_victory_effect = yes } + } + } + # Send scope:recipient-side toast. + send_interface_toast = { + title = send_poem_interaction.success + left_icon = scope:actor + show_as_tooltip = { send_poem_strife_duel_actor_victory_effect = yes } + } + } + # Calculate the actual effects. + send_poem_strife_duel_actor_victory_effect = yes +} + +send_poem_strife_duel_defeat_notification_effect = { + # Send out toasts. + hidden_effect = { + # Send scope:actor-side toast + scope:actor = { + send_interface_toast = { + title = send_poem_interaction.failure + left_icon = scope:recipient + show_as_tooltip = { send_poem_strife_duel_actor_failure_effect = yes } + } + } + # Send scope:recipient-side toast. + send_interface_toast = { + title = send_poem_interaction.failure + left_icon = scope:actor + show_as_tooltip = { send_poem_strife_duel_actor_failure_effect = yes } + } + } + # Calculate the actual effects. + send_poem_strife_duel_actor_failure_effect = yes +} + +send_poem_strife_duel_effect = { + duel = { + skill = diplomacy + target = $POV_TARGET$ + # Scope:actor's words find their mark. + 50 = { + compare_modifier = { + value = scope:duel_value + multiplier = -3.5 + min = -49 + max = 49 + } + desc = send_poem_interaction.success + # Sort notifications & output. + send_poem_strife_duel_victory_notification_effect = yes + } + # Scope:recipient is able to publicly ridicule the poem. + 50 = { + compare_modifier = { + value = scope:duel_value + multiplier = 3.5 + min = -49 + max = 49 + } + desc = send_poem_interaction.failure + # Sort notifications & output. + send_poem_strife_duel_defeat_notification_effect = yes + } + } +} + +send_poem_incompetence_duel_victory_notification_effect = { + # Send out toasts. + hidden_effect = { + # Send scope:actor-side toast + scope:actor = { + send_interface_toast = { + title = send_poem_interaction.success + left_icon = scope:recipient + show_as_tooltip = { send_poem_incompetence_duel_actor_victory_effect = yes } + } + } + # Send scope:recipient-side toast. + send_interface_toast = { + title = send_poem_interaction.success + left_icon = scope:actor + show_as_tooltip = { send_poem_incompetence_duel_actor_victory_effect = yes } + } + } + # Calculate the actual effects. + send_poem_incompetence_duel_actor_victory_effect = yes +} + +send_poem_incompetence_duel_defeat_notification_effect = { + # Send out toasts. + hidden_effect = { + # Send scope:actor-side toast + scope:actor = { + send_interface_toast = { + title = send_poem_interaction.failure + left_icon = scope:recipient + show_as_tooltip = { send_poem_incompetence_duel_actor_failure_effect = yes } + } + } + # Send scope:recipient-side toast. + send_interface_toast = { + title = send_poem_interaction.failure + left_icon = scope:actor + show_as_tooltip = { send_poem_incompetence_duel_actor_failure_effect = yes } + } + } + # Calculate the actual effects. + send_poem_incompetence_duel_actor_failure_effect = yes +} + +send_poem_incompetence_duel_effect = { + duel = { + skill = diplomacy + target = $POV_TARGET$ + # Scope:actor's words find their mark. + 50 = { + compare_modifier = { + value = scope:duel_value + multiplier = -3.5 + min = -49 + max = 49 + } + desc = send_poem_interaction.success + # Sort notifications & output. + send_poem_incompetence_duel_victory_notification_effect = yes + } + # Scope:recipient is able to publicly ridicule the poem. + 50 = { + compare_modifier = { + value = scope:duel_value + multiplier = 3.5 + min = -49 + max = 49 + } + desc = send_poem_interaction.failure + # Sort notifications & output. + send_poem_incompetence_duel_defeat_notification_effect = yes + } + } +} diff --git a/N3OW/common/scripted_effects/00_pool_effects.txt b/N3OW/common/scripted_effects/00_pool_effects.txt new file mode 100644 index 00000000..19f41a03 --- /dev/null +++ b/N3OW/common/scripted_effects/00_pool_effects.txt @@ -0,0 +1,164 @@ +set_interesting_traits_and_modifiers_effect = { + random_list = { + 50 = { + trigger = { + has_trait = gluttonous + } + change_current_weight = 150 + } + 50 = { + trigger = { + has_trait = gluttonous + } + change_current_weight = 100 + } + 10 = { + trigger = { + NOT = { has_trait = temperate } + } + change_current_weight = 50 + } + 10 = { + change_current_weight = 25 + } + 100 = { + } + 10 = { + change_current_weight = -25 + } + 5 = { + trigger = { + NOR = { + has_trait = temperate + has_trait = gluttonous + } + } + change_current_weight = -50 + } + } + random_list = { + 1 = { + modifier = { + add = 9 + culture = { + has_cultural_parameter = loyal_trait_more_common + } + } + add_trait = loyal + } + 1 = { + modifier = { + add = 9 + culture = { + has_cultural_parameter = disloyal_trait_more_common + } + } + add_trait = disloyal + } + 1 = { + modifier = { + add = 9 + culture = { + has_cultural_parameter = scholar_official_trait_bonuses + } + } + add_trait = confucian_education + } + 98 = {} + } +} + +add_random_tiered_trait_xp_effect = { + save_scope_value_as = { + name = level_1_possible + value = flag:$LEVEL_1$ + } + save_scope_value_as = { + name = level_3_possible + value = flag:$LEVEL_3$ + } + if = { + limit = { has_trait = $TRAIT$ } + random_list = { + 15 = { + trigger = { scope:level_1_possible = flag:yes } + add_trait_xp = { + trait = $TRAIT$ + value = { + integer_range = { + min = small_lifestyle_random_xp_low + max = small_lifestyle_random_xp_high + } + } + } + } + 10 = { + add_trait_xp = { + trait = $TRAIT$ + value = { + integer_range = { + min = medium_lifestyle_random_xp_low + max = medium_lifestyle_random_xp_high + } + } + } + } + 5 = { + trigger = { scope:level_3_possible = flag:yes } + add_trait_xp = { + trait = $TRAIT$ + value = 100 + } + } + } + } +} + +add_random_tiered_trait_track_xp_effect = { + save_scope_value_as = { + name = level_1_possible + value = flag:$LEVEL_1$ + } + save_scope_value_as = { + name = level_3_possible + value = flag:$LEVEL_3$ + } + if = { + limit = { has_trait = $TRAIT$ } + random_list = { + 15 = { + trigger = { scope:level_1_possible = flag:yes } + add_trait_xp = { + trait = $TRAIT$ + track = $TRACK$ + value = { + integer_range = { + min = small_lifestyle_random_xp_low + max = small_lifestyle_random_xp_high + } + } + } + } + 10 = { + add_trait_xp = { + trait = $TRAIT$ + track = $TRACK$ + value = { + integer_range = { + min = medium_lifestyle_random_xp_low + max = medium_lifestyle_random_xp_high + } + } + } + } + 5 = { + trigger = { scope:level_3_possible = flag:yes } + add_trait_xp = { + trait = $TRAIT$ + track = $TRACK$ + value = 100 + } + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_pregnancy_effects.txt b/N3OW/common/scripted_effects/00_pregnancy_effects.txt new file mode 100644 index 00000000..157941b7 --- /dev/null +++ b/N3OW/common/scripted_effects/00_pregnancy_effects.txt @@ -0,0 +1,407 @@ + + +#Effects relating to pregnancy + +#unmarried_mother_pregnancy_effect +#pregnancy_termination_attempt_effect + + + +unmarried_mother_pregnancy_effect = { + add_trait_force_tooltip = pregnant + add_fornicator_trait_or_nothing_effect = yes + hidden_effect = { + set_known_bastard_on_pregnancy = yes #The bastard status is already known since the mother is unmarried. + if = { + limit = { + NOT = { + any_owned_story = { + type = story_peasant_affair + var:peasant_character = scope:mother.pregnancy_real_father + } + } + } + trigger_event = { #This parses whether the mother is planning to confess to a real_father, and checks if there are characters out there who should suspect that they might be the real father + id = adultery.1101 + days = 20 + } + } + } +} + + +married_mother_pregnancy_effect = { + add_trait_force_tooltip = pregnant + if = { + limit = { + NOT = { exists = scope:spouse } + exists = primary_spouse + } + primary_spouse = { + save_scope_as = spouse + } + } + if = { + limit = { exists = scope:spouse } + scope:spouse = { + pregnancy_spouse_suspicion_chance_effect = yes + } + } + hidden_effect = { + if = { + limit = { + NOT = { + any_owned_story = { + type = story_peasant_affair + var:peasant_character = { + this = scope:real_father + } + } + } + } + trigger_event = { #This parses whether the mother is planning to confess to a real_father, and checks if there are characters out there who should suspect that they might be the real father + id = adultery.1101 + days = 20 + } + } + } +} + +historical_pregnancy_effect = { + if = { + limit = { exists = var:historical_pregnancy } + switch = { + trigger = var:historical_pregnancy + flag:antoku = { + save_scope_as = mother + character:japanese_yamato_54 = { save_scope_as = father } + create_character = { + name = "Tokihito" # birth name of Antoku + gender_female_chance = 0 + random_traits = no + age = 0 + dynasty_house = scope:father.house # Yamato + employer = scope:mother.employer + father = scope:father # Emperor Takakura + mother = scope:mother # Noriko + faith = scope:father.faith + culture = scope:father.culture + save_scope_as = child + } + scope:child = { add_pressed_claim = title:k_chrysanthemum_throne } + } + } + create_character_memory = { + type = child_born + participants = { child = scope:child } + } + current_travel_plan ?= { + if = { + limit = { + travel_plan_owner = { is_ruler = yes } + } + add_companion = scope:child + } + } + } +} + +#This effect is used to handle all the tings that should ALWAYS be done at birth. +pregnancy_maintainance_effect = { + hidden_effect = { + historical_pregnancy_effect = yes # Handle specific scripted historical births + + remove_trait = pregnant + + #Save twin as child_2 + scope:child = { + if = { + limit = { has_trait = twin } + random_sibling = { + limit = { is_twin_of = scope:child } + save_scope_as = child_2 + } + + #Identical twins + if = { + limit = { sex_same_as = scope:child_2 } + random = { + chance = 50 + copy_inheritable_appearance_from = scope:child_2 + } + } + } + } + + #BASTARD OR NOT? TO HANDLE NON-COMPLICATED BIRTH EVENTS + #It is a bastard! + if = { + limit = { + OR = { + has_character_flag = unmarried_bastard_pregnancy + has_character_flag = bastard_pregnancy + } + } + + #To see if the assumed father has died while pregnant with unknown bastard + if = { + limit = { + scope:mother = { + NOT = { has_character_flag = pregnancy_real_father_of_bastard_is_known_flag } + exists = var:dead_spouse + } + } + var:dead_spouse = { + save_scope_as = father + } + scope:child = { + set_father = scope:father + } + scope:mother = { + remove_variable = dead_spouse + } + } + + #To fire the right event for the mother if the child secretly is a bastard + if = { + limit = { + NOT = { has_character_flag = pregnancy_real_father_of_bastard_is_known_flag } + has_character_flag = bastard_pregnancy + secret_disputed_heritage_is_valid_trigger = { + TARGET = scope:child + } + } + add_secret = { #Set up a new secret about the child + type = secret_disputed_heritage + target = scope:child + } + random_secret = { #Find the secret + type = secret_disputed_heritage + limit = { + secret_target = scope:child + } + save_scope_as = new_secret + } + + #If the real_father knows they're the father they will get an event about the bastard being born + if = { + limit = { + has_character_flag = pregnancy_real_father_knows + } + scope:child.real_father = { + add_to_list = illegitimacy_secret_knowers + } + } + #If the spouse knows they're NOT the father they will get an event about the bastard being born + if = { + limit = { + has_character_flag = pregnancy_spouse_knows_of_bastardy + } + scope:child.father = { + add_to_list = illegitimacy_secret_knowers + } + } + every_in_list = { + list = illegitimacy_secret_knowers + #A secret bastard is born - Share the news with everyone who knew that it was a bastard + trigger_event = secret_bastard.0001 + } + } + + #Check for unmarried mother bastardy flag + else_if = { + limit = { + NOT = { has_character_flag = pregnancy_real_father_of_bastard_is_known_flag } + has_character_flag = unmarried_bastard_pregnancy + + # Must be able to have the illegitimate child secret. + secret_unmarried_illegitimate_child_is_valid_trigger = { + TARGET = scope:child + } + } + add_secret = { #Set up a new secret about the child + type = secret_unmarried_illegitimate_child + target = scope:child + } + random_secret = { #Find the secret + type = secret_unmarried_illegitimate_child + limit = { + secret_target = scope:child + } + save_scope_as = new_secret + } + #If the real father knows he is the father, let him in on the Secret + if = { + limit = { + has_character_flag = pregnancy_real_father_knows + } + scope:child.real_father = { + trigger_event = secret_bastard.0002 #Announces that a child is born, and lets the recipient learn the unmarried_illegitimate_child secret + } + } + } + } + + #Mother married real_father while pregnant - make sure he's set as the father + if = { + limit = { + scope:mother = { + NOR = { + has_character_flag = unmarried_bastard_pregnancy + has_character_flag = bastard_pregnancy + } + any_consort = { this = scope:child.real_father } + NOT = { exists = scope:child.father } + } + } + scope:child = { + set_father = scope:child.real_father + } + } + } +} + +pregnancy_cleanup_effect = { + hidden_effect = { + if = { + limit = { + has_character_flag = unmarried_bastard_pregnancy + } + remove_character_flag = unmarried_bastard_pregnancy + } + if = { + limit = { + has_character_flag = bastard_pregnancy + } + remove_character_flag = bastard_pregnancy + } + if = { + limit = { + has_character_flag = pregnancy_real_father_of_bastard_is_known_flag + } + remove_character_flag = pregnancy_real_father_of_bastard_is_known_flag + } + if = { + limit = { + has_character_flag = pregnancy_spouse_knows_of_bastardy + } + remove_character_flag = pregnancy_spouse_knows_of_bastardy + } + if = { + limit = { + has_character_flag = pregnancy_real_father_knows + } + remove_character_flag = pregnancy_real_father_knows + } + if = { + limit = { + has_character_flag = birth_will_go_smoothly + } + remove_character_flag = birth_will_go_smoothly + } + if = { + limit = { + has_character_flag = birth_child_will_become_sickly + } + remove_character_flag = birth_child_will_become_sickly + } + if = { + limit = { + has_character_flag = birth_mother_will_become_ill + } + remove_character_flag = birth_mother_will_become_ill + } + if = { + limit = { + has_variable = borte_first_child_var + } + remove_variable = borte_first_child_var + } + } + if = { + limit = { + has_trait = pregnant + } + remove_trait = pregnant + } +} + + + +pregnancy_termination_attempt_effect = { + random_list = { + 100 = { #Pregnancy ends, no negative consequence + #custom_tooltip = pregnancy_treatment_succeeds_tt + show_as_tooltip = { + end_pregnancy = yes + } + hidden_effect = { + trigger_event = { + id = pregnancy.2003 + days = { 3 10 } + } + } + } + 30 = { #Pregnancy ends, mother becomes Ill + trigger = { + NOT = { has_trait = ill } + } + show_as_tooltip = { + end_pregnancy = yes + add_trait = ill + } + #custom_tooltip = pregnancy_treatment_succeeds_tt + #custom_tooltip = pregnancy_treatment_fall_ill_tt + hidden_effect = { + trigger_event = { + id = pregnancy.2004 + days = { 3 10 } + } + } + } + 100 = { #The pregnancy continues + custom_tooltip = pregnancy_treatment_fails_tt + hidden_effect = { + trigger_event = { + id = pregnancy.2005 + days = { 3 10 } + } + } + } + 10 = { #The mother dies + show_as_tooltip = { + death = { + death_reason = death_attempted_treatment + } + } + hidden_effect = { + trigger_event = { + id = pregnancy.2007 + days = { 3 10 } + } + } + } + } +} + + +#Effects to use in birth 3001-3999 +#Requires scope:child (scope:child_2, scope:child_3, and twin_list optional) +kill_child_and_possible_twins_effect = { + scope:child = { + death = { + death_reason = death_delivery + } + } + if = { + limit = { + exists = scope:child_2 + } + scope:child_2 = { + death = { + death_reason = death_delivery + } + } + } +} + diff --git a/N3OW/common/scripted_effects/00_prison_effects.txt b/N3OW/common/scripted_effects/00_prison_effects.txt new file mode 100644 index 00000000..3c99df25 --- /dev/null +++ b/N3OW/common/scripted_effects/00_prison_effects.txt @@ -0,0 +1,2378 @@ +# the effect used in all ransom interactions +ransom_interaction_effect = { + # For mass actions where an option is not selected manually + if = { + limit = { + NOR = { + scope:influence_send_option = yes + scope:herd_send_option = yes + scope:extortionate_current_gold = yes + scope:extortionate_gold = yes + scope:gold = yes + scope:current_gold = yes + scope:favor = yes + scope:hook ?= yes + } + } + save_scope_value_as = { + name = ransom_saved_gold_value + value = scope:payer.current_gold_value + } + if = { + limit = { + scope:imprisoner.dynasty ?= { has_dynasty_perk = fp1_pillage_legacy_3 } + scope:payer.gold >= scope:prisoner.increased_ransom_cost_value + } + save_scope_value_as = { name = extortionate_gold value = yes } + } + else_if = { + limit = { + scope:imprisoner.dynasty ?= { has_dynasty_perk = fp1_pillage_legacy_3 } + scope:payer.gold < scope:prisoner.increased_ransom_cost_value + scope:payer.gold >= 1 + } + save_scope_value_as = { name = extortionate_current_gold value = yes } + } + else_if = { + limit = { scope:payer.gold >= scope:prisoner.ransom_cost_value } + save_scope_value_as = { name = gold value = yes } + } + else_if = { + limit = { + scope:payer.gold < scope:prisoner.ransom_cost_value + scope:payer.gold >= 1 + } + save_scope_value_as = { name = current_gold value = yes } + } + else = { + save_scope_value_as = { name = favor value = yes } + } + } + scope:prisoner = { + add_character_flag = { #To make sure you don't get spammed about the release + flag = block_for_prison_release_notification + days = 1 + } + if = { # no opinion if you ransomed yourself + limit = { this != scope:payer } + if = { #Only visible if a player is involved + limit = { + OR = { + scope:prisoner = { is_ai = no } + scope:payer = { is_ai = no } + } + NOT = { scope:prisoner = { is_ai = no } } + } + add_opinion = { + modifier = ransomed_from_prison + target = scope:payer + years = 1 + } + if = { + limit = { + is_ai = yes + ai_honor >= 25 + ai_greed <= 0 + } + scope:payer = { + if = { + limit = { + can_add_hook = { + target = scope:prisoner + type = favor_hook + } + } + add_hook = { + target = scope:prisoner + type = indebted_hook + } + } + } + } + else = { + scope:payer = { + progress_towards_hook_effect = { + CHARACTER = scope:prisoner + HOOK_TYPE = indebted_hook + } + } + } + } + else = { + hidden_effect = { + if = { + limit = { + is_ai = yes + ai_honor >= 25 + ai_greed <= 0 + } + scope:payer = { + if = { + limit = { + can_add_hook = { + target = scope:prisoner + type = favor_hook + } + } + add_hook = { + target = scope:prisoner + type = indebted_hook + } + } + } + } + else = { + scope:payer = { + progress_towards_hook_effect = { + CHARACTER = scope:prisoner + HOOK_TYPE = indebted_hook + } + } + } + } + } + } + } + scope:payer = { + switch = { + trigger = always + # Perk: increased ransom + bonus prestige + scope:extortionate_gold = { + pay_short_term_gold = { + gold = scope:prisoner.increased_ransom_cost_value + target = scope:imprisoner + } + scope:imprisoner = { + add_prestige = scope:prisoner.increased_ransom_cost_value + mandala_trickster_increment_gold_ransomed_effect = { GOLD_AMOUNT = scope:prisoner.increased_ransom_cost_value } + } + } + # Perk: whatever they can pay + bonus prestige + scope:extortionate_current_gold = { + pay_short_term_gold = { + gold = scope:ransom_saved_gold_value # Calculated earlier in the ransom interaction. + target = scope:imprisoner + } + scope:imprisoner = { + add_prestige = scope:ransom_saved_gold_value + mandala_trickster_increment_gold_ransomed_effect = { GOLD_AMOUNT = scope:ransom_saved_gold_value } + } + } + # Full ransom + scope:gold = { + pay_short_term_gold = { + gold = scope:prisoner.ransom_cost_value + target = scope:imprisoner + } + scope:imprisoner = { + mandala_trickster_increment_gold_ransomed_effect = { GOLD_AMOUNT = scope:prisoner.ransom_cost_value } + } + } + # Whatever they can pay + scope:current_gold = { + pay_short_term_gold = { + gold = scope:ransom_saved_gold_value # Calculated earlier in the ransom interaction. + target = scope:imprisoner + } + scope:imprisoner = { + mandala_trickster_increment_gold_ransomed_effect = { GOLD_AMOUNT = scope:ransom_saved_gold_value } + } + } + } + # Favor hook + if = { + limit = { scope:favor = yes } + if = { + limit = { scope:payer = scope:prisoner } + add_opinion = { + modifier = demanded_hook + target = scope:imprisoner + } + } + scope:imprisoner = { + add_hook = { + target = scope:payer + type = favor_hook + } + } + } + # Herd + if = { + limit = { scope:herd_send_option = yes } + scope:payer = { + pay_herd = { + target = scope:imprisoner + value = scope:payer.domicile.medium_herd_value + } + } + } + } + scope:prisoner = { release_from_prison = yes } +} + +#Used for all executions +execute_prisoner_effect = { + + $VICTIM$ = { + save_scope_as = victim + } + + $EXECUTIONER$ = { + save_scope_as = executioner + save_scope_as = imprisoner #Save this scope to show correct tyranny tooltip + } + + show_as_tooltip = { + $VICTIM$ = { + death = { + death_reason = death_execution + killer = $EXECUTIONER$ + } + } + } + + scope:executioner = { + # Dread gain + if = { + limit = { + scope:victim = { + time_in_prison = { years > 15 } # No one even remembers who they are anymore + } + } + # No dread for you + } + else_if = { # Executing Emperors/HoF is quite dreadful + limit = { + scope:victim = { + OR = { + highest_held_title_tier >= tier_empire + scope:executioner.faith.religious_head = scope:victim # Your head of faith + } + } + } + add_dread = execute_interaction_massive_dread_gain + } + else_if = { + limit = { + scope:victim = { + OR = { + highest_held_title_tier >= tier_kingdom + tier_or_related_liege_tier_greater_or_equal_trigger = { TIER = tier_empire } + is_powerful_vassal_of = scope:executioner # Is your powerful vassal + target_is_vassal_or_below = scope:executioner # Your liege/s + is_close_family_of = scope:executioner + } + } + } + add_dread = execute_interaction_major_dread_gain + } + else_if = { + limit = { + scope:victim = { + OR = { + highest_held_title_tier >= tier_duchy + tier_or_related_liege_tier_greater_or_equal_trigger = { TIER = tier_kingdom } + AND = { # Is your vassal, and higher than Baron + is_vassal_of = scope:executioner + primary_title.tier > tier_barony + } + AND = { # Peer Vassals + exists = primary_title + primary_title.tier > tier_barony + liege ?= scope:executioner.liege + } + has_trait = peasant_leader + } + } + } + add_dread = execute_interaction_medium_dread_gain + } + else_if = { + limit = { + scope:victim = { + OR = { + highest_held_title_tier >= tier_county + tier_or_related_liege_tier_greater_or_equal_trigger = { TIER = tier_duchy } + is_vassal_of = scope:executioner # Is your Baron vassal + is_close_or_extended_family_of = scope:executioner + + scope:executioner = { # Executing close family of your vassals is dreadful... + any_vassal = { + is_close_family_of = scope:victim + } + } + scope:executioner = { # Executing close family of your liege/s is the same... + any_liege_or_above = { + is_close_family_of = scope:victim + } + } + } + } + } + add_dread = execute_interaction_minor_dread_gain + } + + # Piety loss (or gain) from executions + if = { + limit = { + faith = { + has_doctrine_parameter = human_sacrifice_active + } + } + scope:victim = { + if = { + limit = { + OR = { + highest_held_title_tier >= tier_empire + any_close_family_member = { + highest_held_title_tier >= tier_empire + } + } + } + scope:executioner = { add_piety = massive_piety_gain } + } + else_if = { + limit = { + OR = { + highest_held_title_tier >= tier_kingdom + any_close_family_member = { + highest_held_title_tier >= tier_kingdom + } + } + } + scope:executioner = { add_piety = major_piety_gain } + } + else_if = { + limit = { + OR = { + highest_held_title_tier >= tier_duchy + any_close_family_member = { + highest_held_title_tier >= tier_duchy + } + } + } + scope:executioner = { add_piety = medium_piety_gain } + } + else_if = { + limit = { + OR = { + is_ruler = yes + is_lowborn = no + any_close_family_member = { + is_ruler = yes + } + } + } + scope:executioner = { add_piety = minor_piety_gain } + } + else = { + scope:executioner = { add_piety = miniscule_piety_gain } + } + } + } + else_if = { + limit = { + faith = scope:victim.faith + NOT = { has_perk = divine_retribution_perk } + scope:victim = { + has_no_particular_noble_roots_trigger = yes + } + } + add_piety = miniscule_piety_loss + } + else_if = { + limit = { + faith = scope:victim.faith + NOT = { has_perk = divine_retribution_perk } + } + add_piety = medium_piety_loss + } + + # Stress loss + if = { + limit = { has_relation_rival = scope:victim } + + if = { + limit = { + NOR = { + has_trait = sadistic + has_trait = vengeful + has_trait = compassionate + has_trait = forgiving + } + } + add_stress = medium_stress_loss + } + else = { + stress_impact = { + sadistic = major_stress_impact_loss + vengeful = massive_stress_impact_loss + compassionate = minor_stress_impact_gain + forgiving = minor_stress_impact_gain + } + } + } + else_if = { #Killing infidels is relaxing + limit = { + has_trait = zealous + scope:executioner.faith != scope:victim.faith + } + + if = { + limit = { + NOR = { + has_trait = sadistic + has_trait = compassionate + has_trait = forgiving + } + } + add_stress = medium_stress_loss + } + else = { + stress_impact = { + sadistic = major_stress_impact_loss + compassionate = minor_stress_impact_gain + forgiving = minor_stress_impact_gain + } + } + } + # Stress Gain + else_if = { + limit = { + exists = scope:victim + has_execute_reason = scope:victim + NOT = { + has_trait = sadistic + } + scope:victim = { + OR = { + is_child_of = scope:executioner + is_grandchild_of = scope:executioner + is_great_grandchild_of = scope:executioner + } + } + } + stress_impact = { + base = minor_stress_impact_gain + compassionate = massive_stress_impact_gain + forgiving = major_stress_impact_gain + generous = minor_stress_impact_gain + family_first = minor_stress_impact_gain + } + } + else_if = { + limit = { + NOT = { + has_trait = sadistic + } + scope:victim = { + OR = { + is_child_of = scope:executioner + is_grandchild_of = scope:executioner + is_great_grandchild_of = scope:executioner + } + } + } + stress_impact = { + base = medium_stress_impact_gain + compassionate = massive_stress_impact_gain + forgiving = major_stress_impact_gain + generous = medium_stress_impact_gain + trusting = minor_stress_impact_gain + content = minor_stress_impact_gain + family_first = minor_stress_impact_gain + } + if = { + limit = { + exists = scope:execution_sacrifice + NOT = { always = scope:execution_sacrifice } + } + stress_impact = { + just = medium_stress_impact_gain + } + } + } + else_if = { + limit = { + NOT = { + has_trait = sadistic + } + scope:victim = { + OR = { + has_relation_friend = scope:executioner + has_relation_lover = scope:executioner + } + } + } + stress_impact = { + base = medium_stress_impact_gain + compassionate = massive_stress_impact_gain + forgiving = major_stress_impact_gain + generous = medium_stress_impact_gain + trusting = minor_stress_impact_gain + content = minor_stress_impact_gain + } + if = { + limit = { + exists = scope:execution_sacrifice + NOT = { always = scope:execution_sacrifice } + } + stress_impact = { + just = medium_stress_impact_gain + } + } + } + else_if = { + limit = { + exists = scope:victim + has_execute_reason = scope:victim + } + stress_impact = { + sadistic = medium_stress_impact_loss + compassionate = medium_stress_impact_gain + forgiving = minor_stress_impact_gain + generous = minor_stress_impact_gain + } + } + else = { + stress_impact = { + sadistic = medium_stress_impact_loss + compassionate = major_stress_impact_gain + forgiving = medium_stress_impact_gain + generous = medium_stress_impact_gain + trusting = minor_stress_impact_gain + content = minor_stress_impact_gain + } + if = { + limit = { + exists = scope:execution_sacrifice + NOT = { always = scope:execution_sacrifice } + } + stress_impact = { + just = medium_stress_impact_gain + } + } + } + + #Kinslaying + add_kinslayer_trait_or_nothing_effect = { VICTIM = scope:victim } + + #Tyranny + if = { + limit = { + exists = scope:recipient + has_execute_reason = scope:victim + } + custom_tooltip = IS_ALLOWED_TO_EXECUTE_DESC + } + else_if = { + limit = { + OR = { + AND = { + NOT = { exists = scope:recipient } + has_execute_reason = scope:victim + } + is_at_war_with = scope:victim + } + } + custom_tooltip = IS_ALLOWED_TO_EXECUTE_NO_RECIPIENT_DESC + } + else_if = { + limit = { + scope:victim = { + OR = { + is_playable_character = no + NOT = { is_of_major_or_minor_interest_trigger = { CHARACTER = scope:executioner } } + } + } + scope:executioner.faith = { + faith_hostility_level = { + target = scope:victim.faith + value > faith_astray_level + } + } + } + custom_tooltip = IS_ALLOWED_TO_EXECUTE_HOSTILE_RELIGION_DESC + } + else_if = { + limit = { + scope:victim = { target_is_liege_or_above = prev } + NOT = { exists = scope:suppress_legitimacy_from_crime } + } + add_tyranny = execution_tyranny_gain + if = { + limit = { has_legitimacy = yes} + add_legitimacy = miniscule_legitimacy_loss + } + } + else_if = { + limit = { + scope:victim = { + NOT = { exists = liege } + exists = host + } + any_pool_guest = { } + } + every_pool_guest = { + limit = { + NOR = { + this = scope:victim + is_in_list = guest_list + } + } + add_to_temporary_list = guest_list + } + every_in_list = { + list = guest_list + custom = all_your_guests + limit = { + this != scope:executioner + } + add_opinion = { + target = scope:executioner + modifier = executed_guest_modifier + } + } + } + else = { + if = { + limit = { + exists = scope:victim.liege + NOR = { + scope:victim.liege = scope:victim + scope:victim.liege = scope:executioner + scope:victim.liege = scope:imprisoner + } + } + scope:victim.liege = { + add_opinion = { + target = scope:executioner + modifier = executed_my_countryman_modifier + } + } + } + } + + # If we're a clan this affects unity + if = { + limit = { # If the victim is landed and you DON'T have an execution reason, you lose more unity + scope:victim = { is_landed = yes } + NOT = { has_execute_reason = scope:victim } + } + add_clan_unity_interaction_effect = { + CHARACTER = scope:executioner + TARGET = scope:victim + VALUE = medium_unity_loss + DESC = clan_unity_execute.desc + REVERSE_NON_HOUSE_TARGET = no + } + } + else_if = { + limit = { # If the victim is landed and you DO have an execution reason, you lose a bit less unity + scope:victim = { is_landed = yes } + has_execute_reason = scope:victim + } + add_clan_unity_interaction_effect = { + CHARACTER = scope:executioner + TARGET = scope:victim + VALUE = minor_unity_loss + DESC = clan_unity_execute.desc + REVERSE_NON_HOUSE_TARGET = no + } + } + else = { # For unlanded characters, we don't care as much, but you still lose some unity + add_clan_unity_interaction_effect = { + CHARACTER = scope:executioner + TARGET = scope:victim + VALUE = miniscule_unity_loss + DESC = clan_unity_execute.desc + REVERSE_NON_HOUSE_TARGET = no + } + } + #If you're a nomadic ruler, you can keep the head or send it for intimidation + if = { + limit = { + mpo_keep_prisoners_heads_trigger = yes + #execution by beheading, but that only gets tracked for players for some reason + OR = { + AND = { + is_ai = no + exists = scope:execution_beheaded + scope:execution_beheaded = yes + } + AND = { + is_ai = yes + NOT = { + scope:executioner.faith = { has_doctrine_parameter = human_sacrifice_active } + } + } + } + scope:victim = { + is_ruler = yes + is_adult = yes + highest_held_title_tier >= tier_county + #Need to be valid either for artifact or heir intimidation + OR = { + AND = { + exists = primary_heir + NOT = { + primary_heir = scope:executioner + } + } + highest_held_title_tier >= tier_kingdom + } + } + } + if = { + limit = { + scope:victim = { + highest_held_title_tier >= tier_empire + } + } + custom_tooltip = gain_illustrious_victim_head_artifact_tt + add_character_flag = { + flag = execution_head_illustrious_flag + days = 30 + } + } + else_if = { + limit = { + scope:victim = { + highest_held_title_tier >= tier_kingdom + } + } + custom_tooltip = gain_famed_victim_head_artifact_tt + add_character_flag = { + flag = execution_head_famed_flag + days = 30 + } + } + #Send head to heir + if = { + limit = { + scope:victim = { + AND = { + exists = primary_heir + NOT = { + primary_heir = scope:executioner + } + } + NOT = { + government_has_flag = government_is_theocracy + } + } + } + #Can send head for warscore + if = { + limit = { + is_at_war_with = scope:victim + any_character_war = { + primary_attacker = scope:executioner + primary_defender = scope:victim + casus_belli = { + any_target_title = { + this = scope:victim.primary_title + } + } + } + scope:victim = { is_ai = yes } + scope:victim.primary_heir = { + is_ai = yes + } + NAND = { + has_variable = peace_acceptance_head_scare + var:peace_acceptance_head_scare = { + this = scope:victim.primary_heir + } + } + } + custom_tooltip = send_head_for_warscore_tt + add_character_flag = { + flag = execution_head_warscore_flag + days = 30 + } + scope:victim.primary_heir = { + save_scope_as = headless_heir + } + } + #Can send head for vassalization acceptance + else_if = { + limit = { + scope:victim = { + is_independent_ruler = yes + highest_held_title_tier <= scope:executioner.highest_held_title_tier + primary_heir = { + highest_held_title_tier <= scope:executioner.highest_held_title_tier + NOR = { + is_vassal_or_below_of = scope:executioner + is_tributary_of_suzerain_or_above = scope:executioner + } + } + is_ai = yes + primary_heir = { is_ai = yes } + } + } + custom_tooltip = send_head_for_vassalization_tt + add_character_flag = { + flag = execution_head_vassalization_flag + days = 30 + } + scope:victim.primary_heir = { + save_scope_as = headless_heir + } + } + else_if = { + limit = { + OR = { + scope:victim = { + highest_held_title_tier > scope:executioner.highest_held_title_tier + } + scope:victim.primary_heir = { + highest_held_title_tier > scope:executioner.highest_held_title_tier + } + } + } + custom_tooltip = send_head_for_prestige_tt + add_character_flag = { + flag = execution_head_prestige_flag + days = 30 + } + scope:victim.primary_heir = { + save_scope_as = headless_heir + } + } + #Send head for obedient trait + else_if = { + limit = { + scope:victim = { + is_vassal_of = scope:executioner + } + scope:victim.primary_heir = { + obedience_target = root + is_obedient = no + } + } + custom_tooltip = send_head_for_obedience_tt + add_character_flag = { + flag = execution_head_obedience_flag + days = 30 + } + scope:victim.primary_heir = { + save_scope_as = headless_heir + } + } + #Can send head for fear hook + else_if = { + limit = { + scope:victim = { + highest_held_title_tier <= scope:executioner.highest_held_title_tier + } + scope:victim.primary_heir = { + highest_held_title_tier <= scope:executioner.highest_held_title_tier + } + can_add_hook = { + target = scope:victim.primary_heir + type = threat_hook + } + } + custom_tooltip = send_head_for_hook_tt + add_character_flag = { + flag = execution_head_hook_flag + days = 30 + } + scope:victim.primary_heir = { + save_scope_as = headless_heir + } + } + } + + trigger_event = { + id = mpo_nomad_events.1010 + days = 1 + } + } + } + + execute_opinion_effect = { VICTIM = scope:victim EXECUTIONER = scope:executioner } + + if = { + limit = { + scope:executioner = { + has_any_nickname = no + has_relation_lover = scope:victim + } + } + random = { + chance = 20 + scope:executioner = { + set_nickname_effect = { NICKNAME = nick_the_heartless } + } + } + } + + #If you have the Human Sacrifice tenet, give victim an appropriate death reason + hidden_effect = { + if = { + limit = { + scope:executioner.faith = { + has_doctrine = tenet_human_sacrifice + } + } + $VICTIM$ = { + death = { + death_reason = death_sacrificed_to_gods + killer = $EXECUTIONER$ + } + } + } + else_if = { + limit = { + exists = scope:execution_kennel + scope:execution_kennel = yes + } + $VICTIM$ = { + death = { + death_reason = death_kennel + killer = $EXECUTIONER$ + } + } + } + else = { + $VICTIM$ = { + death = { + death_reason = death_execution + killer = $EXECUTIONER$ + } + } + } + } +} + + +execute_opinion_effect = { + $VICTIM$ = { + # Victim's family & spouse hates executioner + every_close_family_member = { + limit = { NOT = { this = $EXECUTIONER$ } } + add_to_temporary_list = victim_family_list + } + every_spouse = { + limit = { + NOR = { + this = $EXECUTIONER$ + is_in_list = victim_family_list + } + } + add_to_temporary_list = victim_family_list + } + + if = { + limit = { + any_in_list = { + list = victim_family_list + count > 0 + } + } + if = { + limit = { + $EXECUTIONER$ = { + has_execute_reason = $VICTIM$ + } + } + every_in_list = { + list = victim_family_list + custom = all_close_family_and_spouses + add_opinion = { + target = $EXECUTIONER$ + modifier = executed_close_family + } + } + } + else = { + every_in_list = { + list = victim_family_list + custom = all_close_family_and_spouses + add_opinion = { + target = $EXECUTIONER$ + modifier = executed_close_family_crime + } + } + } + } + + # Victim's dynasty hates executioner + if = { + limit = { + exists = dynasty + exists = $EXECUTIONER$.dynasty + NOT = { dynasty = $EXECUTIONER$.dynasty } + NOT = { + $EXECUTIONER$ = { + has_execute_reason = $VICTIM$ + } + } + } + dynasty = { + every_dynasty_member = { + limit = { + NOR = { + this = $VICTIM$ + is_in_list = victim_family_list + } + } + custom = all_dynasty_members + add_to_temporary_list = victim_dynasty_list + add_opinion = { + target = $EXECUTIONER$ + modifier = executed_dynasty_member + } + } + } + } + + # Victim's friends and lovers + every_relation = { + type = friend + limit = { + NOR = { + this = $VICTIM$ + is_in_list = victim_family_list + is_in_list = victim_dynasty_list + } + } + add_to_list = victim_close_relations_list + } + every_relation = { + type = lover + limit = { + NOR = { + this = $VICTIM$ + is_in_list = victim_family_list + is_in_list = victim_dynasty_list + is_in_list = victim_close_relations_list + } + } + add_to_list = victim_close_relations_list + } + if = { + limit = { + any_in_list = { + list = victim_close_relations_list + always = yes + } + } + every_in_list = { + list = victim_close_relations_list + limit = { + NOT = { this = $EXECUTIONER$ } + } + custom = all_friends_and_lovers + add_opinion = { + target = $EXECUTIONER$ + modifier = executed_close_relation_opinion + } + } + } + + # House Relation + house ?= { + change_house_relation_effect = { + HOUSE = $EXECUTIONER$.house + VALUE = house_relation_damage_medium_value + REASON = execution + CHAR = $EXECUTIONER$ + TARGET_CHAR = $VICTIM$ + TITLE = scope:dummy_gender + } + } + } +} + + +#Used for religious sacrifice +sacrifice_prisoner_effect = { + + $VICTIM$ = { + save_scope_as = victim + } + + $EXECUTIONER$ = { + save_scope_as = executioner + } + + scope:executioner = { + if = { + limit = { + OR = { + #is_spouse_of = scope:victim + is_close_family_of = scope:victim + scope:victim = { tier_or_related_liege_tier_greater_or_equal_trigger = { TIER = tier_kingdom } } #Kingdom & empire + } + } + add_dread = major_dread_gain + } + else_if = { + limit = { + OR = { + scope:victim = { tier_or_related_liege_tier_equal_trigger = { TIER = tier_duchy } } + scope:victim = { tier_or_related_liege_tier_equal_trigger = { TIER = tier_county } } + } + } + add_dread = medium_dread_gain + } + else = { + add_dread = minor_dread_gain + } + if = { + limit = { + faith = scope:victim.faith + NOT = { + scope:executioner.faith = { + has_doctrine_parameter = human_sacrifice_active + } + } + } + add_piety = minor_piety_loss + } + else_if = { + limit = { + scope:executioner.faith = { + has_doctrine_parameter = human_sacrifice_active + } + } + if = { + limit = { + scope:victim = { + highest_held_title_tier = 5 + } + } + add_piety = massive_piety_gain + } + else_if = { + limit = { + scope:victim = { + highest_held_title_tier = 4 + } + } + add_piety = major_piety_gain + } + else_if = { + limit = { + scope:victim = { + highest_held_title_tier = 3 + } + } + add_piety = medium_piety_gain + } + else_if = { + limit = { + scope:victim = { + highest_held_title_tier = 2 + } + } + add_piety = minor_piety_gain + } + else_if = { + limit = { + scope:victim = { + highest_held_title_tier = 1 + } + } + add_piety = miniscule_piety_gain + } + } + # Stress loss + if = { + limit = { + has_trait = sadistic + } + stress_impact = { + sadistic = medium_stress_impact_loss + } + } + if = { + limit = { #Killing infidels is relaxing + has_trait = zealous + scope:executioner.faith != scope:victim.faith + NOT = { + scope:executioner.faith = { + has_doctrine_parameter = human_sacrifice_active + } + } + } + stress_impact = { + zealous = minor_stress_impact_loss + } + } + if = { + limit = { #Even more so if the religion is in favor of doing it. + has_trait = zealous + scope:executioner.faith != scope:victim.faith + scope:executioner.faith = { + has_doctrine_parameter = human_sacrifice_active + } + } + stress_impact = { + zealous = medium_stress_impact_loss + } + } + if = { + limit = { + has_relation_rival = scope:victim + } + add_prestige = medium_prestige_gain + if = { + limit = { + NOR = { + has_trait = vengeful + has_trait = forgiving + } + } + add_stress = major_stress_loss + } + else = { + stress_impact = { + vengeful = massive_stress_impact_loss + forgiving = 0 #No stress reduction + } + } + } + #Kinslaying + add_kinslayer_trait_or_nothing_effect = { VICTIM = scope:victim } + } + + execute_opinion_effect = { VICTIM = scope:victim EXECUTIONER = scope:executioner } + + $VICTIM$ = { + death = { + death_reason = death_sacrificed_to_gods + killer = $EXECUTIONER$ + } + } +} + + +imprison_character_effect = { + $TARGET$ = { save_scope_as = imprisonment_target } + $IMPRISONER$ = { save_scope_as = imprisoner } + + scope:imprisonment_target = { + if = { + limit = { + has_opinion_modifier = { + modifier = imprisoned_me_past + target = scope:imprisoner + } + } + hidden_effect = { + remove_opinion = { + target = scope:imprisoner + modifier = imprisoned_me + } + } + } + add_opinion = { + target = scope:imprisoner + modifier = imprisoned_me + } + } + + imprison_hostage_tooltip_effect = { WHO = scope:imprisonment_target } + + if = { + limit = { + scope:imprisoner = { is_landless_ruler = no } + scope:imprisonment_target = { + exists = liege + OR = { + is_playable_character = yes + is_close_or_extended_family_of = liege + is_spouse_of = liege + } + } + } + + scope:imprisoner = { + imprison = { + target = scope:imprisonment_target + type = house_arrest + } + scope:imprisonment_target = { + if = { + limit = { + any_close_or_extended_family_member = { + NOR = { + is_close_family_of = scope:imprisoner + scope:imprisoner = this + } + } + } + custom_tooltip = IMPRISONMENT_RELATIVES_EFFECT_HOUSE_ARREST + hidden_effect = { + every_close_or_extended_family_member = { + limit = { + NOR = { + is_close_family_of = scope:imprisoner + scope:imprisoner = this + } + } + add_opinion = { + modifier = imprisoned_family_member + target = scope:imprisoner + } + } + } + } + } + } + } + + else = { + scope:imprisoner = { + imprison = { + target = scope:imprisonment_target + type = dungeon + } + scope:imprisonment_target = { + if = { + limit = { + any_close_or_extended_family_member = { + NOR = { + is_close_family_of = scope:imprisoner + scope:imprisoner = this + } + } + } + custom_tooltip = IMPRISONMENT_RELATIVES_EFFECT_DUNGEON + hidden_effect = { + every_close_or_extended_family_member = { + limit = { + scope:imprisoner != this + } + add_opinion = { + modifier = imprisoned_family_member_dungeon + target = scope:imprisoner + } + } + } + } + } + } + } + + scope:imprisoner = { + imprison_tyranny_effect = yes + } + + #Disband any scheme you have against them + scope:imprisoner = { + if = { + limit = { + any_scheme = { + scheme_target_character = scope:imprisonment_target + } + } + every_scheme = { + limit = { + scheme_target_character = scope:imprisonment_target + } + end_scheme = yes + } + } + } + + #Send break up event if they are your lover + scope:imprisoner = { + if = { + limit = { + has_relation_lover = scope:imprisonment_target + NOT = { has_relation_rival = scope:imprisonment_target } #To enable really strange love stories + } + scope:imprisonment_target = { + trigger_event = { + id = lover.0101 + days = { 14 30 } + } + } + } + } + + #Remove them as guardian/ward for any courtiers and give feedback about this + imprison_remove_ward_guardian_effect = { IMPRISONER = scope:imprisoner PRISONER = scope:imprisonment_target } +} + +imprison_character_effect_ignore_reason = { + $TARGET$ = { save_temporary_scope_as = imprisonment_target } + $IMPRISONER$ = { save_temporary_scope_as = imprisoner } + + + if = { + limit = { + scope:imprisonment_target = { + exists = liege + OR = { + is_playable_character = yes + is_close_or_extended_family_of = liege + is_spouse_of = liege + } + } + } + + scope:imprisoner = { + imprison = { + target = scope:imprisonment_target + type = house_arrest + } + scope:imprisonment_target = { + if = { + limit = { + any_close_or_extended_family_member = { + NOR = { + is_close_family_of = scope:imprisoner + scope:imprisoner = this + } + } + } + custom_tooltip = IMPRISONMENT_RELATIVES_EFFECT_HOUSE_ARREST + } + } + } + } + + else = { + scope:imprisoner = { + imprison = { + target = scope:imprisonment_target + type = dungeon + } + scope:imprisonment_target = { + if = { + limit = { + any_close_or_extended_family_member = { + NOR = { + is_close_family_of = scope:imprisoner + scope:imprisoner = this + } + } + } + custom_tooltip = IMPRISONMENT_RELATIVES_EFFECT_DUNGEON + } + } + } + } + + scope:imprisoner = { + add_tyranny = imprisonment_tyranny_gain + } + + scope:imprisonment_target = { + if = { + limit = { + has_opinion_modifier = { + modifier = imprisoned_me_past + target = scope:imprisoner + } + } + hidden_effect = { + remove_opinion = { + target = scope:imprisoner + modifier = imprisoned_me + } + } + } + add_opinion = { + target = scope:imprisoner + modifier = imprisoned_me + } + } + + imprison_hostage_tooltip_effect = { WHO = scope:imprisonment_target } + + #Disband any scheme you have against them + scope:imprisoner = { + if = { + limit = { + any_scheme = { + scheme_target_character = scope:imprisonment_target + } + } + every_scheme = { + limit = { + scheme_target_character = scope:imprisonment_target + } + end_scheme = yes + } + } + } + + #Send break up event if they are your lover + scope:imprisoner = { + if = { + limit = { + has_relation_lover = scope:imprisonment_target + NOT = { has_relation_rival = scope:imprisonment_target } #To enable really strange love stories + } + scope:imprisonment_target = { + trigger_event = { + id = lover.0101 + days = { 14 30 } + } + } + } + } + + #Remove them as guardian/ward for any courtiers and give feedback about this + imprison_remove_ward_guardian_effect = { IMPRISONER = scope:imprisoner PRISONER = scope:imprisonment_target } +} + +imprison_hostage_tooltip_effect = { + $WHO$ = { + if = { + limit = { is_hostage = yes } + custom_tooltip = hostage_prison_invalidation_tt + } + } +} + + +hard_imprison_character_effect = { + $TARGET$ = { save_temporary_scope_as = new_target } + $IMPRISONER$ = { save_temporary_scope_as = new_imprisoner } + + + + scope:new_imprisoner = { + imprison = { + target = scope:new_target + type = house_arrest + } + } + + imprison_hostage_tooltip_effect = { WHO = scope:new_target } + + hidden_effect = { + #Disband any scheme you have against them + scope:new_imprisoner = { + if = { + limit = { + any_scheme = { + scheme_target_character = scope:new_target + } + } + every_scheme = { + limit = { + scheme_target_character = scope:new_target + } + end_scheme = yes + } + } + } + + #Send break up event if they are your lover + scope:new_imprisoner = { + if = { + limit = { + has_relation_lover = scope:new_target + NOT = { has_relation_rival = scope:new_target } #To enable really strange love stories + } + scope:new_target = { + trigger_event = { + id = lover.0101 + days = { 14 30 } + } + } + } + } + + #Remove them as guardian/ward for any courtiers and give feedback about this + imprison_remove_ward_guardian_effect = { IMPRISONER = scope:new_imprisoner PRISONER = scope:new_target } + } +} + +#Exactly the same as imprison_character_effect, except it never adds tyranny +#USE THIS SPARINGLY. READ ME: It is usually better to set an opinion with an imprisonment reason for "custom situations". For cases where there is a "standard imprisonment reason", such as for murder, but that imprisonment reason set before this script has to be executed, double-check that the imprisonment you're doing is actually rightful. +rightfully_imprison_character_effect = { + $TARGET$ = { save_scope_as = new_target } + $IMPRISONER$ = { save_scope_as = imprisoner } + + + if = { + limit = { + scope:new_target = { + exists = liege + OR = { + is_playable_character = yes + is_close_or_extended_family_of = liege + is_spouse_of = liege + } + } + } + + scope:imprisoner = { + imprison = { + target = scope:new_target + type = house_arrest + } + scope:new_target = { + if = { + limit = { + any_close_or_extended_family_member = { + NOR = { + is_close_family_of = scope:imprisoner + scope:imprisoner = this + } + } + } + hidden_effect = { + every_close_or_extended_family_member = { + limit = { + NOR = { + is_close_family_of = scope:imprisoner + scope:imprisoner = this + } + } + add_opinion = { + target = scope:imprisoner + modifier = imprisoned_family_member + opinion = -15 + } + } + } + custom_tooltip = IMPRISONMENT_RELATIVES_EFFECT_HOUSE_ARREST + } + } + } + } + + else = { + scope:imprisoner = { + imprison = { + target = scope:new_target + type = dungeon + } + scope:new_target = { + if = { + limit = { + any_close_or_extended_family_member = { + NOR = { + is_close_family_of = scope:imprisoner + scope:imprisoner = this + } + } + } + hidden_effect = { + every_close_or_extended_family_member = { + limit = { + NOR = { + is_close_family_of = scope:imprisoner + scope:imprisoner = this + } + } + add_opinion = { + target = scope:imprisoner + modifier = imprisoned_family_member + opinion = -15 + } + } + } + custom_tooltip = IMPRISONMENT_RELATIVES_EFFECT_DUNGEON + } + } + } + } + + scope:imprisoner = { + if = { + limit = { exists = scope:disable_display_rightful_imprisonment_tooltip } + # No tooltip if we do this. + } + else_if = { + limit = { + exists = scope:recipient + has_imprisonment_reason = scope:new_target + } + custom_tooltip = IS_ALLOWED_TO_IMPRISON_DESC + } + else = { custom_tooltip = IS_ALLOWED_TO_IMPRISON_NO_RECIPIENT_DESC } + } + + scope:new_target = { + if = { + limit = { + has_opinion_modifier = { + modifier = imprisoned_me_past + target = scope:imprisoner + } + } + hidden_effect = { + remove_opinion = { + target = scope:imprisoner + modifier = imprisoned_me + } + } + } + add_opinion = { + target = scope:imprisoner + modifier = imprisoned_me + } + } + + imprison_hostage_tooltip_effect = { WHO = scope:new_target } + + #Disband any scheme you have against them + scope:imprisoner = { + if = { + limit = { + any_scheme = { + scheme_target_character = scope:new_target + } + } + every_scheme = { + limit = { + scheme_target_character = scope:new_target + } + end_scheme = yes + } + } + } + + #Send break up event if they are your lover + scope:imprisoner = { + if = { + limit = { + has_relation_lover = scope:new_target + NOT = { has_relation_rival = scope:new_target } #To enable really strange love stories + } + scope:new_target = { + trigger_event = { + id = lover.0101 + days = { 14 30 } + } + } + } + } + + #Remove them as guardian/ward for any courtiers and give feedback about this + imprison_remove_ward_guardian_effect = { IMPRISONER = scope:imprisoner PRISONER = scope:new_target } +} + +rightfully_imprison_character_less_verbose_effect = { + $TARGET$ = { save_scope_as = new_target } + $IMPRISONER$ = { save_scope_as = imprisoner } + + + if = { + limit = { + scope:new_target = { + exists = liege + OR = { + is_playable_character = yes + is_close_or_extended_family_of = liege + is_spouse_of = liege + } + } + } + + scope:imprisoner = { + imprison = { + target = scope:new_target + type = house_arrest + } + hidden_effect = { + scope:new_target = { + if = { + limit = { + any_close_or_extended_family_member = { + NOR = { + is_close_family_of = scope:imprisoner + scope:imprisoner = this + } + } + } + hidden_effect = { + every_close_or_extended_family_member = { + limit = { + NOR = { + is_close_family_of = scope:imprisoner + scope:imprisoner = this + } + } + add_opinion = { + target = scope:imprisoner + modifier = imprisoned_family_member + opinion = -15 + } + } + } + custom_tooltip = IMPRISONMENT_RELATIVES_EFFECT_HOUSE_ARREST + } + } + } + } + } + + else = { + scope:imprisoner = { + imprison = { + target = scope:new_target + type = dungeon + } + hidden_effect = { + scope:new_target = { + if = { + limit = { + any_close_or_extended_family_member = { + NOR = { + is_close_family_of = scope:imprisoner + scope:imprisoner = this + } + } + } + hidden_effect = { + every_close_or_extended_family_member = { + limit = { + NOR = { + is_close_family_of = scope:imprisoner + scope:imprisoner = this + } + } + add_opinion = { + target = scope:imprisoner + modifier = imprisoned_family_member + opinion = -15 + } + } + } + custom_tooltip = IMPRISONMENT_RELATIVES_EFFECT_DUNGEON + } + } + } + } + } + + imprison_hostage_tooltip_effect = { WHO = scope:new_target } + + hidden_effect = { + scope:imprisoner = { + if = { + limit = { exists = scope:disable_display_rightful_imprisonment_tooltip } + # No tooltip if we do this. + } + else_if = { + limit = { + exists = scope:recipient + has_imprisonment_reason = scope:new_target + } + custom_tooltip = IS_ALLOWED_TO_IMPRISON_DESC + } + else = { custom_tooltip = IS_ALLOWED_TO_IMPRISON_NO_RECIPIENT_DESC } + } + + scope:new_target = { + add_opinion = { + target = scope:imprisoner + modifier = imprisoned_me + } + } + + #Disband any scheme you have against them + scope:imprisoner = { + if = { + limit = { + any_scheme = { + scheme_target_character = scope:new_target + } + } + every_scheme = { + limit = { + scheme_target_character = scope:new_target + } + end_scheme = yes + } + } + } + + #Send break up event if they are your lover + scope:imprisoner = { + if = { + limit = { + has_relation_lover = scope:new_target + NOT = { has_relation_rival = scope:new_target } #To enable really strange love stories + } + scope:new_target = { + trigger_event = { + id = lover.0101 + days = { 14 30 } + } + } + } + } + + #Remove them as guardian/ward for any courtiers and give feedback about this + imprison_remove_ward_guardian_effect = { IMPRISONER = scope:imprisoner PRISONER = scope:new_target } + } + +} + +# A lite version of imprison_character_effect without opinion penalties or other consequences (as they were captured in war, not at your command) +prisoner_of_war_capture_effect = { + $TARGET$ = { save_temporary_scope_as = new_target } + $IMPRISONER$ = { save_temporary_scope_as = imprisoner } + + if = { + limit = { + scope:new_target = { + exists = liege + OR = { + is_playable_character = yes + is_close_or_extended_family_of = liege + is_spouse_of = liege + } + } + } + + scope:imprisoner = { + imprison = { + target = scope:new_target + type = house_arrest + } + } + } + else = { + scope:imprisoner = { + imprison = { + target = scope:new_target + type = dungeon + } + } + } + + imprison_hostage_tooltip_effect = { WHO = scope:new_target } +} + +#An effect that picks imprison_character_effect or rightfully_imprison_character_effect as punishment for a sexual relationship, good to not show tyranny tooltip if imprisonment reason hasn't been set yet. But this should NEVER be used if the imprisonment reason isn't going to be set by the same piece of content. +pick_imprisonment_effect_based_on_sexual_relation_effect = { + if = { + limit = { + $TARGET$ = { + sexual_activity_with_partner_is_criminal_in_faith_trigger = { + PARTNER = $PARTNER$ + FAITH = $IMPRISONER$.faith + } + } + } + rightfully_imprison_character_effect = { + TARGET = $TARGET$ + IMPRISONER = $IMPRISONER$ + } + } + else = { + imprison_character_effect = { + TARGET = $TARGET$ + IMPRISONER = $IMPRISONER$ + } + } +} + +prison_pet_death_effect = { + if = { + limit = { + var:prison_pet_variable = flag:rat + } + remove_character_modifier = prison_pet_rat_modifier + } + else_if = { + limit = { + var:prison_pet_variable = flag:stone + } + remove_character_modifier = prison_pet_stone_modifier + } + else_if = { + limit = { + var:prison_pet_variable = flag:spoon + } + remove_character_modifier = prison_pet_spoon_modifier + } + else_if = { + limit = { + var:prison_pet_variable = flag:cockroach + } + remove_character_modifier = prison_pet_cockroach_modifier + } + remove_variable = prison_pet_variable +} + +consume_all_criminal_reasons_effect = { + $LIEGE$ = { + if = { + limit = { + has_imprisonment_reason = $CRIMINAL$ + } + consume_imprisonment_reasons = $CRIMINAL$ + } + if = { + limit = { + has_banish_reason = $CRIMINAL$ + } + consume_banish_reasons = $CRIMINAL$ + } + if = { + limit = { + has_execute_reason = $CRIMINAL$ + } + consume_execute_reasons = $CRIMINAL$ + } + if = { + limit = { + has_revoke_title_reason = $CRIMINAL$ + } + consume_revoke_title_reason = $CRIMINAL$ + } + } +} + +escape_from_prison_effect = { + save_scope_as = escapee + play_music_cue = "mx_cue_sacredrite" + scope:imprisoner = { + save_scope_as = bg_override_char + if = { + limit = { + exists = capital_province + } + capital_province = { + save_scope_as = background_wilderness_scope + } + } + else = { + location = { + save_scope_as = background_wilderness_scope + } + } + if = { + limit = { + OR = { + has_revoke_title_reason = scope:escapee + has_banish_reason = scope:escapee + has_execute_reason = scope:escapee + } + } + add_opinion = { + target = scope:escapee + modifier = escaped_from_prison_crime + } + } + else = { + add_opinion = { + target = scope:escapee + modifier = escaped_from_prison_opinion + } + } + } + create_character_memory = { + type = escaped_from_prison_memory + + participants = { + imprisoner = scope:imprisoner + } + } + add_character_flag = { + flag = escaped_from_prison_flag + days = 1 + } + add_character_flag = { #To make sure you don't get spammed about the release + flag = block_for_prison_release_notification + days = 1 + } + release_from_prison = yes + random_dummy_gender_soldier_effect = { SCOPE_NAME = dummy_gender } + hidden_effect = { + remove_decision_cooldown = escape_from_prison_decision + } + if = { + limit = { has_character_modifier = allowed_to_go_outside } + remove_character_modifier = allowed_to_go_outside + } + if = { + limit = { has_character_modifier = moldy_gruel_diet } + remove_character_modifier = moldy_gruel_diet + } +} + +#Are you unjustly trying to imprison your bishop? tut-tut +imprison_court_chaplain_consequences_effect = { + if = { + limit = { + scope:actor = { NOT = { has_imprisonment_reason = scope:recipient } } + scope:recipient = { has_council_position = councillor_court_chaplain } + } + if = { #Can I fire them? + limit = { + scope:recipient = { can_be_fired_from_council_trigger = { COURT_OWNER = scope:actor } } + } + scope:actor = { fire_councillor = scope:recipient } + } + scope:actor = { + add_piety_level = -1 + } + if = { + limit = { + exists = scope:actor.faith.religious_head + } + scope:actor.faith.religious_head = { + add_opinion = { + target = scope:actor + modifier = respect_opinion + opinion = -30 + } + } + } + } +} + +#You're trying to imprison your HoF? Oh boy +imprison_HoF_consequences_effect = { + if = { + limit = { + scope:actor = { + NOT = { has_imprisonment_reason = scope:recipient } + exists = faith.religious_head + faith.religious_head = scope:recipient + } + } + scope:actor = { + add_piety_level = -1 + add_piety = medium_piety_loss + } + } +} + +#Add tyranny if you don't have a justifiable reason +imprison_tyranny_effect = { + + # Normalize scopes for tooltip loc, because there is no god nor consistency + if = { + limit = { + exists = scope:imprisoner + NOT = { exists = scope:actor } + } + scope:imprisoner = { save_scope_as = actor } + } + if = { + limit = { + exists = scope:actor + NOT = { exists = scope:imprisoner } + } + scope:actor = { save_scope_as = imprisoner } + } + if = { + limit = { + exists = scope:imprisonment_target + NOT = { exists = scope:recipient } + } + scope:imprisonment_target = { save_scope_as = recipient } + } + if = { + limit = { + exists = scope:recipient + NOT = { exists = scope:imprisonment_target } + } + scope:recipient = { save_scope_as = imprisonment_target } + } + + # Determine if tyrannical or not + # Should use strife + if = { + limit = { exists = scope:use_strife_not_tyranny } + # If you have revocation reason, we allow that. + if = { + limit = { has_imprisonment_reason = scope:recipient } + consume_imprisonment_reasons = scope:recipient + } + else = { change_strife_opinion = medium_strife_gain } + } + # Got good reason + else_if = { + limit = { + scope:actor = { has_imprisonment_reason = scope:recipient } + } + custom_tooltip = IS_ALLOWED_TO_IMPRISON_DESC + + } + # Is at war or edge-case pondering general imprisonment + else_if = { + limit = { + OR = { + NOT = { exists = scope:recipient } + scope:actor = { is_at_war_with = scope:recipient } + } + } + custom_tooltip = IS_ALLOWED_TO_IMPRISON_NO_RECIPIENT_DESC + } + + else = { + add_tyranny = imprisonment_tyranny_gain + if = { + limit = { + scope:recipient = { + is_landed = yes + is_alive = yes + } + } + scope:actor = { + if = { + limit = { + has_legitimacy = yes + this = top_liege + } + add_legitimacy = miniscule_legitimacy_loss + } + } + } + } +} + +imprison_remove_ward_guardian_effect = { + #Remove them as guardian/ward for any courtiers and give feedback about this + $PRISONER$ = { save_temporary_scope_as = imprisonment_target } + $IMPRISONER$ = { save_temporary_scope_as = imprisoner } + + scope:imprisoner ?= { + #Check for relations + if = { + limit = { + exists = scope:imprisonment_target + any_courtier = { + has_relation_guardian = scope:imprisonment_target + has_relation_ward = scope:imprisonment_target + } + } + #Save all those with a ward/guardian relation to the person being imprisoned + every_courtier = { + limit = { + has_relation_guardian = scope:imprisonment_target + has_relation_ward = scope:imprisonment_target + } + add_to_list = ward_or_guardian_list + } + # Send messages to people that need to know that the ward/guardian relationship is over + every_in_list = { + list = ward_or_guardian_list + save_scope_as = their_ward_or_guardian #saved for appropriate portrait in message + + send_interface_message = { + type = event_childhood_neutral + title = remove_guardian_interaction_notification + left_icon = scope:imprisonment_target + right_icon = scope:their_ward_or_guardian + + scope:imprisonment_target = { + send_interface_message = { + type = event_childhood_neutral + title = remove_guardian_interaction_notification + left_icon = scope:imprisonment_target + right_icon = scope:their_ward_or_guardian + #Remove appropriate relationship + scope:their_ward_or_guardian = { + if = { + limit = { has_relation_guardian = scope:imprisonment_target } + remove_guardian_effect = { + GUARDIAN = scope:imprisonment_target + WARD = scope:their_ward_or_guardian + RETURN_WARD = yes + HIDE_OPINION = no + } + } + else = { + remove_guardian_effect = { + GUARDIAN = scope:their_ward_or_guardian + WARD = scope:imprisonment_target + RETURN_WARD = yes + HIDE_OPINION = no + } + } + } + } + } + } + } + } + } +} + +# If they recently revoked your title, or asked for your excommunication, they become your rival +imprison_attempt_escalates_rivalry_effect = { + scope:recipient = { + if = { + limit = { + OR = { + has_opinion_modifier = { + target = scope:actor + modifier = revoked_title + } + AND = { + exists = var:requested_my_excommunication + var:requested_my_excommunication = scope:actor + } + } + NOT = { has_relation_rival = scope:actor } + } + hidden_effect = { + if = { + limit = { has_relation_potential_rival = scope:actor } + remove_relation_potential_rival = scope:actor + } + } + set_relation_rival = scope:actor + } + else = { + hidden_effect = { + progress_towards_rival_effect = { + CHARACTER = scope:actor + REASON = rival_imprisoned + OPINION = 0 + } + } + } + } +} + +diarch_imprison_general_accept_effect = { + illegal_imprisonment_dread_effect = yes + imprison_HoF_consequences_effect = yes + # Sort stress. + scope:actor = { + # Stress. + if = { + limit = { has_imprisonment_reason = scope:recipient } + stress_impact = { + compassionate = minor_stress_impact_gain + forgiving = minor_stress_impact_gain + } + } + else = { + stress_impact = { + just = medium_stress_impact_gain + compassionate = medium_stress_impact_gain + } + } + tgp_activate_catalyst_against_hegemon_effect = { + HEGEMON = scope:actor.top_liege + CATALYST = catalyst_diarch_mandate + } + } + # Imprison the actual character. + imprison_character_effect = { + TARGET = scope:recipient + IMPRISONER = scope:actor + } + # If they recently revoked your title, or asked for your excommunication, they become your rival + imprison_attempt_escalates_rivalry_effect = yes + # Remove hostility flag. + if = { + limit = { + scope:actor = { has_character_flag = flag_hostile_actions_disabled_delay } + } + scope:actor = { remove_character_flag = flag_hostile_actions_disabled_delay } + } +} diff --git a/N3OW/common/scripted_effects/00_realm_effects.txt b/N3OW/common/scripted_effects/00_realm_effects.txt new file mode 100644 index 00000000..7ac73763 --- /dev/null +++ b/N3OW/common/scripted_effects/00_realm_effects.txt @@ -0,0 +1,211 @@ + +##################################################################### +# EFFECT LIST +##################################################################### + +increase_crown_authority_effect = { + if = { + limit = { has_realm_law_flag = uses_crown_authority } + #Laws + if = { + limit = { has_realm_law = crown_authority_0 } + add_realm_law = crown_authority_1 + } + else_if = { + limit = { has_realm_law = crown_authority_1 } + add_realm_law = crown_authority_2 + } + else_if = { + limit = { has_realm_law = crown_authority_2 } + add_realm_law = crown_authority_3 + } + } +} + +decrease_crown_authority_effect = { + if = { + limit = { has_realm_law_flag = uses_crown_authority } + #Laws + if = { + limit = { has_realm_law = crown_authority_3 } + add_realm_law = crown_authority_2 + } + else_if = { + limit = { has_realm_law = crown_authority_2 } + add_realm_law = crown_authority_1 + } + else_if = { + limit = { has_realm_law = crown_authority_1 } + add_realm_law = crown_authority_0 + } + } +} + +increase_tribal_authority_effect = { + if = { + limit = { has_realm_law_flag = uses_tribal_authority } + #Laws + if = { + limit = { has_realm_law = tribal_authority_0 } + add_realm_law = tribal_authority_1 + } + else_if = { + limit = { has_realm_law = tribal_authority_1 } + add_realm_law = tribal_authority_2 + } + else_if = { + limit = { has_realm_law = tribal_authority_2 } + add_realm_law = tribal_authority_3 + } + } +} + +decrease_tribal_authority_effect = { + if = { + limit = { has_realm_law_flag = uses_tribal_authority } + #Laws + if = { + limit = { has_realm_law = tribal_authority_3 } + add_realm_law = tribal_authority_2 + } + else_if = { + limit = { has_realm_law = tribal_authority_2 } + add_realm_law = tribal_authority_1 + } + else_if = { + limit = { has_realm_law = tribal_authority_1 } + add_realm_law = tribal_authority_0 + } + } +} + +increase_imperial_bureaucracy_effect = { + if = { + limit = { has_realm_law_flag = uses_imperial_bureaucracy } + #Laws + if = { + limit = { has_realm_law = imperial_bureaucracy_0 } + add_realm_law = imperial_bureaucracy_1 + } + else_if = { + limit = { has_realm_law = imperial_bureaucracy_1 } + add_realm_law = imperial_bureaucracy_2 + } + else_if = { + limit = { has_realm_law = imperial_bureaucracy_2 } + add_realm_law = imperial_bureaucracy_3 + } + } +} + +decrease_imperial_bureaucracy_effect = { + if = { + limit = { has_realm_law_flag = uses_imperial_bureaucracy } + #Laws + if = { + limit = { has_realm_law = imperial_bureaucracy_3 } + add_realm_law = imperial_bureaucracy_2 + } + else_if = { + limit = { has_realm_law = imperial_bureaucracy_2 } + add_realm_law = imperial_bureaucracy_1 + } + else_if = { + limit = { has_realm_law = imperial_bureaucracy_1 } + add_realm_law = imperial_bureaucracy_0 + } + } +} + +# We use this rather than doing it straight in the effect block for better mod compatibility, since this can be overridden without adjusting the rest of the laws file. +remove_law_related_modifiers_effect = { + # We call out some modifiers because we want the player to see what they're losing, but it's fine to hide future modifiers ye may add in a hidden_effect if they're minor. + if = { + limit = { has_character_modifier = liege_authority_boost_has_scapegoat_modifier } + remove_character_modifier = liege_authority_boost_has_scapegoat_modifier + } +} + +remove_vassal_directives = { + remove_character_flag = vassal_directive_improve_development + remove_character_flag = vassal_directive_train_commanders + remove_character_flag = vassal_directive_build_maa + remove_character_flag = vassal_directive_convert_faith + remove_character_flag = vassal_directive_convert_culture + remove_character_flag = vassal_directive_improve_cultural_acceptance + remove_character_flag = vassal_directive_building_focus_fortification + remove_character_flag = vassal_directive_building_focus_military + remove_character_flag = vassal_directive_building_focus_economy + remove_character_flag = vassal_directive_manage_fertility + remove_character_flag = vassal_directive_explore_cultures + remove_character_flag = vassal_directive_raid_innovation_intent + remove_character_flag = vassal_directive_raid_herd_intent +} + +increase_nomadic_authority_effect = { + if = { + limit = { has_realm_law_flag = uses_nomadic_authority } + #Laws + if = { + limit = { has_realm_law = nomadic_authority_1 } + add_realm_law = nomadic_authority_2 + } + else_if = { + limit = { has_realm_law = nomadic_authority_2 } + add_realm_law = nomadic_authority_3 + } + else_if = { + limit = { has_realm_law = nomadic_authority_3 } + add_realm_law = nomadic_authority_4 + } + } +} + +decrease_nomadic_authority_effect = { + if = { + limit = { has_realm_law_flag = uses_nomadic_authority } + #Laws + if = { + limit = { has_realm_law = nomadic_authority_4 } + add_realm_law = nomadic_authority_3 + } + else_if = { + limit = { has_realm_law = nomadic_authority_3 } + add_realm_law = nomadic_authority_2 + } + else_if = { + limit = { has_realm_law = nomadic_authority_2 } + add_realm_law = nomadic_authority_1 + } + } +} + +# Should be used in the county title scope +add_law_of_the_land_title_succession_law_if_appropriate_effect = { + save_scope_as = county_title + if = { + limit = { + #tier = tier_county # Commented out for performance reasons, comment back in if this effect is used outside of on_title_gained + NOT = { has_title_law = law_of_the_land_succession_law } + is_noble_family_title = no + title_province ?= { + holding_type = { + has_required_heir_governments = yes + NOT = { + any_required_heir_government_type = { + this = scope:county_title.holder.government_type + } + } + } + } + } + holder = { + send_interface_toast = { + title = succession_law_changed + left_icon = scope:county_title + + scope:county_title = { add_title_law = law_of_the_land_succession_law } + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_regional_scripted_effects.txt b/N3OW/common/scripted_effects/00_regional_scripted_effects.txt new file mode 100644 index 00000000..3b97b921 --- /dev/null +++ b/N3OW/common/scripted_effects/00_regional_scripted_effects.txt @@ -0,0 +1,871 @@ +#For use with HornedMythicalCreature / call this effect (set_up_horned_mythical_creature_effect = yes) in the line before creating the artifact +#Use this in the artifact's name/description in the loc-file [ROOT.Char.Custom('HornedMythicalCreature')] +#Remember to clear the var:horned_mythical_creature in your after = { ... } +set_up_horned_mythical_creature_effect = { + random_list = { + 50 = { + set_variable = { + name = horned_mythical_creature + value = flag:tarasque + } + } + 50 = { + set_variable = { + name = horned_mythical_creature + value = flag:indrik + } + } + 50 = { + set_variable = { + name = horned_mythical_creature + value = flag:ophiotaurus + } + } + 50 = { + set_variable = { + name = horned_mythical_creature + value = flag:monocerus + } + } + 50 = { + set_variable = { + name = horned_mythical_creature + value = flag:centicore + } + } + 50 = { + set_variable = { + name = horned_mythical_creature + value = flag:erchitu + } + } + 50 = { + set_variable = { + name = horned_mythical_creature + value = flag:hadhayosh + } + } + 50 = { + set_variable = { + name = horned_mythical_creature + value = flag:bulgu + } + } + 50 = { + set_variable = { + name = horned_mythical_creature + value = flag:catoblepas + } + } + 5 = { + trigger = { + location = { geographical_region = custom_iceland } + } + set_variable = { + name = horned_mythical_creature + value = flag:keewakw + } + } + + } +} + +#For use with RegionalMythicalCreature / call this effect (set_up_regional_mythical_creature_effect = yes) in the line before creating the artifact +#Use this in the artifact's name/description in the loc-file [ROOT.Char.Custom('RegionalMythicalCreature')] /and/ [ROOT.Char.Custom('RegionalMythicalCreatureLower')] +#Remember to clear the var:regional_mythical_creature_trinket in your after = { ... } +set_up_regional_mythical_creature_effect = { + if = { + #Britannia + limit = { + location = { geographical_region = world_europe_west_britannia } + NOT = { exists = var:regional_mythical_creature_trinket } + } + random_list = { + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:water_leper + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:fomorian + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:fachan + } + } + } + } + else_if = { + #West Europe + limit = { + location = { geographical_region = world_europe_west } + NOT = { exists = var:regional_mythical_creature_trinket } + } + random_list = { + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:cockatrice + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:lou_carcolh + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:myrmecoleon + } + } + } + } + else_if = { + #North Europe + limit = { + location = { geographical_region = world_europe_north } + NOT = { exists = var:regional_mythical_creature_trinket } + } + random_list = { + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:antero_vipunen + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:tjelvar + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:fin + } + } + 50 = { + trigger = { + location = { geographical_region = custom_gotland } + } + set_variable = { + name = regional_mythical_creature_trinket + value = flag:bysn + } + } + 50 = { + trigger = { + location = { geographical_region = custom_gotland } + } + set_variable = { + name = regional_mythical_creature_trinket + value = flag:disma + } + } + } + } + else_if = { + #South Europe + limit = { + location = { geographical_region = world_europe_south } + NOT = { exists = var:regional_mythical_creature_trinket } + } + random_list = { + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:basilisk + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:lhombri + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:argus_panoptes + } + } + } + } + else_if = { + #East Europe + limit = { + location = { geographical_region = world_europe_east } + NOT = { exists = var:regional_mythical_creature_trinket } + } + random_list = { + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:baba_yaga + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:psoglav + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:sirin + } + } + } + } + else_if = { + #West Africa + limit = { + location = { geographical_region = world_africa_west } + NOT = { exists = var:regional_mythical_creature_trinket } + } + random_list = { + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:mami_wata + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:dodo + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:utelif + } + } + } + } + else_if = { + #East Africa + limit = { + location = { geographical_region = world_africa_east } + NOT = { exists = var:regional_mythical_creature_trinket } + } + random_list = { + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:liqimsa + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:bulgu + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:opimachus + } + } + } + } + else_if = { + #Middle East + limit = { + location = { geographical_region = world_middle_east } + NOT = { exists = var:regional_mythical_creature_trinket } + } + random_list = { + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:manticore + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:behemoth + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:humbaba + } + } + } + } + else_if = { + #India + limit = { + location = { geographical_region = world_india } + NOT = { exists = var:regional_mythical_creature_trinket } + } + random_list = { + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:makara + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:yali + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:rakshasha + } + } + } + } + else_if = { + #East Asia + limit = { + location = { + OR = { + geographical_region = world_tibet + geographical_region = world_asia_china + geographical_region = world_asia_japan + geographical_region = world_asia_korea + geographical_region = world_asia_southeast + } + } + NOT = { exists = var:regional_mythical_creature_trinket } + } + random_list = { + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:manaul + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:bashee + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:camphruch + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:qilin + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:tengu + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:naga + } + } + } + } + else_if = { + #West Steppe + limit = { + location = { geographical_region = world_steppe_west } + NOT = { exists = var:regional_mythical_creature_trinket } + } + random_list = { + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:aptah_baga #Legendary two-headed frog (from Sakha) + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:xullyukuns #Supernatural water spirit (from Sakha) + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:zilant #Dragon/wyvern-like creature + } + } + } + } + else_if = { + #East Steppe + limit = { + location = { geographical_region = world_steppe_east } + NOT = { exists = var:regional_mythical_creature_trinket } + } + random_list = { + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:yelbeghen #Seven-headed giant/dragon + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:tepegoz #Fleshy giant-like cyclops + } + } + 50 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:archura #Deceitful forest demon + } + } + } + } + #Fallback + else = { + random_list = { + 100 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:dragon + } + } + 5 = { + set_variable = { + name = regional_mythical_creature_trinket + value = flag:cipactli + } + } + } + } +} + +select_local_farm_animal_effect = { + random_list = { + 50 = { + set_variable = { + name = local_farm_animal + value = flag:goat + } + } + 50 = { + set_variable = { + name = local_farm_animal + value = flag:chicken + } + } + 50 = { + modifier = { + factor = 0 + faith = { religion_tag = hinduism_religion } + } + set_variable = { + name = local_farm_animal + value = flag:cow + } + } + 50 = { + set_variable = { + name = local_farm_animal + value = flag:sheep + } + } + 50 = { + modifier = { + factor = 0 + faith = { + OR = { + religion_tag = islam_religion + religion_tag = judaism_religion + } + } + } + set_variable = { + name = local_farm_animal + value = flag:pig + } + } + 50 = { + modifier = { + factor = 0 + location = { + NOR = { + geographical_region = world_tibet + geographical_region = world_asia_china + geographical_region = world_asia_korea + geographical_region = world_asia_southeast + geographical_region = ghw_region_mongolia + } + } + } + set_variable = { + name = local_farm_animal + value = flag:yak + } + } + } +} + +# Plague effect, get a regionally appropriate faith for people to scapegoat +select_scapegoat_faith_effect = { + random_list = { + 100 = { # Courtier in your realm with hostile faith + trigger = { + any_courtier_or_guest = { + save_temporary_scope_as = courtier_to_check + root.faith = { + faith_hostility_level = { + target = scope:courtier_to_check.faith + value >= faith_hostile_level + } + } + } + } + random_courtier_or_guest = { + limit = { + save_temporary_scope_as = courtier_to_check + root.faith = { + faith_hostility_level = { + target = scope:courtier_to_check.faith + value >= faith_hostile_level + } + } + } + faith = { save_scope_as = faith_to_blame } + } + } + 100 = { # Vassal in your realm with hostile faith + trigger = { + top_liege ?= { + any_vassal_or_below = { + save_temporary_scope_as = courtier_to_check + root.faith = { + faith_hostility_level = { + target = scope:courtier_to_check.faith + value >= faith_hostile_level + } + } + } + } + } + top_liege = { + random_vassal_or_below = { + limit = { + save_temporary_scope_as = courtier_to_check + root.faith = { + faith_hostility_level = { + target = scope:courtier_to_check.faith + value >= faith_hostile_level + } + } + } + faith = { save_scope_as = faith_to_blame } + } + } + } + 100 = { # Neighbouring hostile faith + trigger = { + any_neighboring_and_across_water_top_liege_realm_owner = { + any_sub_realm_county = { + save_temporary_scope_as = county_to_check + root.faith = { + faith_hostility_level = { + target = scope:county_to_check.faith + value >= faith_hostile_level + } + } + } + } + } + random_neighboring_and_across_water_top_liege_realm_owner = { + limit = { + any_sub_realm_county = { + save_temporary_scope_as = county_to_check + root.faith = { + faith_hostility_level = { + target = scope:county_to_check.faith + value >= faith_hostile_level + } + } + } + } + random_sub_realm_county = { + limit = { + save_temporary_scope_as = county_to_check + root.faith = { + faith_hostility_level = { + target = scope:county_to_check.faith + value >= faith_hostile_level + } + } + } + faith = { save_scope_as = faith_to_blame } + } + } + } + 10 = { # Regional, fallback + random_list = { + 1000 = { # Judaism + trigger = { + capital_province ?= { + OR = { + geographical_region = world_europe + geographical_region = world_asia_minor + geographical_region = world_middle_east + geographical_region = world_africa_east + geographical_region = world_africa_north + } + } + # Jewish faiths shouldn't blame themselves + NOT = { root.faith.religion = religion:judaism_religion } + # Account for Syncretics and the like + root.faith = { + NOT = { has_doctrine_parameter = jewish_syncretic_actor_opinion_active } + } + } + religion:judaism_religion = { + random_faith = { + limit = { + NOR = { # Regional faiths should be excluded + this = faith:malabarism + this = faith:kabarism + } + } + save_scope_as = faith_to_blame + } + } + } + 1000 = { # Islam + trigger = { + capital_province ?= { + OR = { + geographical_region = world_middle_east # This would only apply for non-Islamic middle-easterners + geographical_region = world_india + geographical_region = world_africa + geographical_region = world_steppe + geographical_region = world_asia_minor + geographical_region = world_europe_west_iberia + geographical_region = world_africa_east + geographical_region = world_africa_north + geographical_region = world_asia_china + geographical_region = world_asia_southeast + } + } + NOT = { root.faith.religion = religion:islam_religion } + root.faith = { + NOT = { has_doctrine_parameter = islamic_syncretic_actor_opinion_active } + } + } + religion:islam_religion = { + random_faith = { + save_scope_as = faith_to_blame + } + } + } + 1000 = { # Christianity + trigger = { + capital_province ?= { + OR = { + geographical_region = world_europe + geographical_region = world_india + geographical_region = world_steppe + geographical_region = world_asia_minor + geographical_region = world_tibet + geographical_region = world_middle_east + geographical_region = world_africa_east + geographical_region = world_africa_north + geographical_region = world_asia_china + } + } + NOT = { root.faith.religion = religion:christianity_religion } + root.faith = { + NOT = { has_doctrine_parameter = christian_syncretic_actor_opinion_active } + } + } + religion:christianity_religion = { + if = { # Exclude Eastern Christians for Europe + limit = { + root = { + capital_province = { + OR = { + geographical_region = world_europe + geographical_region = world_asia_minor + } + } + } + } + random_faith = { + limit = { + NOT = { has_doctrine_parameter = eastern_syncretic_actor_opinion_active } + } + save_scope_as = faith_to_blame + } + } + else = { # Exclude non-Eastern Christians for Asia + random_faith = { + limit = { + has_doctrine_parameter = eastern_syncretic_actor_opinion_active + } + save_scope_as = faith_to_blame + } + } + } + } + 1000 = { # Jainism + trigger = { + capital_province ?= { + OR = { + geographical_region = world_india + geographical_region = world_burma + geographical_region = world_asia_china + geographical_region = world_asia_korea + geographical_region = world_asia_southeast + } + } + NOT = { root.faith.religion = religion:jainism_religion } + } + religion:jainism_religion = { + random_faith = { + save_scope_as = faith_to_blame + } + } + } + 1000 = { # Zoroastrianism + trigger = { + capital_province ?= { + OR = { + geographical_region = world_india + geographical_region = world_middle_east_persia + geographical_region = world_asia_china + geographical_region = world_asia_southeast + } + } + NOT = { root.faith.religion = religion:zoroastrianism_religion } + } + religion:zoroastrianism_religion = { + random_faith = { + save_scope_as = faith_to_blame + } + } + } + 1000 = { # Buddhism (Non-Buddhist Tibetans) + trigger = { + capital_province ?= { + OR = { + geographical_region = world_tibet + geographical_region = world_burma # In case Burma ceases to be Buddhist + geographical_region = world_asia_china # for non buddhist chinese et al + geographical_region = world_asia_japan + geographical_region = world_asia_korea + geographical_region = world_asia_southeast + } + } + NOT = { root.faith.religion = religion:buddhism_religion } + } + religion:buddhism_religion = { + random_faith = { + save_scope_as = faith_to_blame + } + } + } + 1000 = { # Bon (Non-Bon Tibetans) + trigger = { + capital_province ?= { + geographical_region = world_tibet + geographical_region = world_asia_china + } + NOT = { root.faith.religion = religion:bon_religion } + } + religion:bon_religion = { + random_faith = { + save_scope_as = faith_to_blame + } + } + } + 1000 = { # West African paganism + trigger = { + capital_province ?= { + geographical_region = world_africa_west + } + NOT = { root.faith.religion = religion:west_african_religion } + } + religion:west_african_religion = { + random_faith = { + save_scope_as = faith_to_blame + } + } + } + 1000 = { # West African paganism + trigger = { + capital_province ?= { + geographical_region = world_africa_west + } + NOT = { root.faith.religion = religion:west_african_bori_religion } + } + religion:west_african_bori_religion = { + random_faith = { + save_scope_as = faith_to_blame + } + } + } + 1000 = { # West African paganism + trigger = { + capital_province ?= { + geographical_region = world_africa_west + } + NOT = { root.faith.religion = religion:west_african_orisha_religion } + } + religion:west_african_orisha_religion = { + random_faith = { + save_scope_as = faith_to_blame + } + } + } + 1000 = { # West African paganism + trigger = { + capital_province ?= { + geographical_region = world_africa_west + } + NOT = { root.faith.religion = religion:west_african_roog_religion } + } + religion:west_african_roog_religion = { + random_faith = { + save_scope_as = faith_to_blame + } + } + } + 1 = { # Generic Paganism, fallback + trigger = { + NOT = { root.faith.religion = religion:paganism_religion } + } + religion:paganism_religion = { + random_faith = { + save_scope_as = faith_to_blame + } + } + } + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_relation_effects.txt b/N3OW/common/scripted_effects/00_relation_effects.txt new file mode 100644 index 00000000..383b1acf --- /dev/null +++ b/N3OW/common/scripted_effects/00_relation_effects.txt @@ -0,0 +1,1337 @@ + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! + +#progress_towards_friend_effect - Sets potential friend + opinion or upgrades potential friend to full friend +#progress_towards_rival_effect - Sets potential rival + opinion or upgrades potential rival to full rival +#progress_towards_lover_effect - Sets potential lover + opinion or upgrades potential lover to full lover + +#get_characters_of_major_interest_effect +#get_characters_of_minor_interest_effect +#get_characters_of_interest_effect + +#get_potential_enemies_effect +#get_random_potential_enemy_effect + +#progress_towards_friend_ai_effect - Progresses to friend if the target is an AI +#progress_towards_rival_ai_effect - Progresses to rival if the target is an AI +#progress_towards_lover_ai_effect - Progresses to lover if the target is an AI + +##################################################################### +# EFFECTS +##################################################################### + +### RELATION PROGRESS EFFECTS ### + +# Needs CHARACTER and OPINION value, use 0 for no opinion change and default__opinion script value for the normal amount + +#Sets potential friend + opinion or upgrades potential friend to full friend +progress_towards_friend_effect = { + #If potential friend, set friend! + if = { + limit = { + has_relation_potential_friend = $CHARACTER$ + can_set_relation_friend_trigger = { CHARACTER = $CHARACTER$ } + } + if = { + limit = { + exists = scope:relationship_reason_involved_character + exists = scope:relationship_reason_province + } + set_relation_friend = { + reason = $REASON$ + target = $CHARACTER$ + involved_character = scope:relationship_reason_involved_character + province = scope:relationship_reason_province + } + if = { + limit = { + this.involved_activity ?= { + has_activity_type = activity_playdate + } + } + this.involved_activity ?= { + add_activity_log_entry = { + key = activity_generic_friend_log + tags = { good } + score = 10 + character = prev + target = $CHARACTER$ + } + } + } + } + else_if = { + limit = { + exists = scope:relationship_reason_province + } + set_relation_friend = { + reason = $REASON$ + target = $CHARACTER$ + province = scope:relationship_reason_province + } + if = { + limit = { + this.involved_activity ?= { + has_activity_type = activity_playdate + } + } + this.involved_activity ?= { + add_activity_log_entry = { + key = activity_generic_friend_log + tags = { good } + score = 10 + character = prev + target = $CHARACTER$ + } + } + } + } + else_if = { + limit = { + exists = scope:relationship_reason_involved_character + } + set_relation_friend = { + reason = $REASON$ + target = $CHARACTER$ + involved_character = scope:relationship_reason_involved_character + } + if = { + limit = { + this.involved_activity ?= { + has_activity_type = activity_playdate + } + } + this.involved_activity ?= { + add_activity_log_entry = { + key = activity_generic_friend_log + tags = { good } + score = 10 + character = prev + target = $CHARACTER$ + } + } + } + } + else = { + set_relation_friend = { + reason = $REASON$ + target = $CHARACTER$ + } + if = { + limit = { + this.involved_activity ?= { + has_activity_type = activity_playdate + } + } + this.involved_activity ?= { + add_activity_log_entry = { + key = activity_generic_friend_log + tags = { good } + score = 10 + character = prev + target = $CHARACTER$ + } + } + } + } + # Complete activity intent if relevant + if = { + limit = { + exists = involved_activity + has_activity_intent = befriend_attendee_intent + intent_target ?= $CHARACTER$ + intent_target.involved_activity ?= this.involved_activity + } + save_scope_as = intent_completer + send_interface_toast = { + title = activity_intent_complete_toast + left_icon = $CHARACTER$ + complete_activity_intent = yes + } + } + } + # If not... + else = { + # ... set potential relation if we're not already friends! + if = { + limit = { + can_set_relation_potential_friend_trigger = { CHARACTER = $CHARACTER$ } + trigger_if = { + limit = { + is_ai = yes + $CHARACTER$ = { is_ai = yes } + } + $CHARACTER$ = { + opinion = { + target = prev + value >= -25 + } + } + } + trigger_else = { + always = yes + } + } + set_relation_potential_friend = $CHARACTER$ + } + + # ... add opinion if we should! + save_temporary_scope_value_as = { + name = friend_opinion + value = $OPINION$ + } + if = { + limit = { NOT = { scope:friend_opinion = 0 } } + reverse_add_opinion = { + target = $CHARACTER$ + modifier = friendliness_opinion + opinion = scope:friend_opinion + } + hidden_effect = { + add_opinion = { + target = $CHARACTER$ + modifier = friendliness_opinion + opinion = scope:friend_opinion + } + } + } + } +} + +#Sets potential rival + opinion or upgrades potential rival to full rival +progress_towards_rival_effect = { + # Do we merit an actual rivalry? + if = { + limit = { + # We don't care between low-tier chars. + NOT = { + $CHARACTER$ = { highest_held_title_tier <= tier_barony } + } + # Are they low-tier themselves? + highest_held_title_tier <= tier_barony + # If they are then they must... + NOR = { + # ... be related to the target... + is_close_or_extended_family_of = $CHARACTER$ + is_consort_of = $CHARACTER$ + # ... or be heir to someone within social spitting distance of the target. + any_heir_title = { + tier >= { + value = $CHARACTER$.highest_held_title_tier + # So if they're feuding with an emperor, then they must be heir to at least a duchy. + subtract = 2 + } + } + } + } + # Now, set grudge if we could already set it. + if = { + limit = { + NOT = { has_relation_grudge = $CHARACTER$ } + } + if = { + limit = { + exists = scope:relationship_reason_involved_character + exists = scope:relationship_reason_province + } + set_relation_grudge = { + reason = $REASON$ + target = $CHARACTER$ + involved_character = scope:relationship_reason_involved_character + province = scope:relationship_reason_province + } + } + else_if = { + limit = { + exists = scope:relationship_reason_province + } + set_relation_grudge = { + reason = $REASON$ + target = $CHARACTER$ + province = scope:relationship_reason_province + } + } + else_if = { + limit = { + exists = scope:relationship_reason_involved_character + } + set_relation_grudge = { + reason = $REASON$ + target = $CHARACTER$ + involved_character = scope:relationship_reason_involved_character + } + } + else = { + set_relation_grudge = { + reason = $REASON$ + target = $CHARACTER$ + } + } + } + # Otherwise, increment raw opinion. + else = { + add_opinion = { + target = $CHARACTER$ + modifier = grudge_opinion + opinion = -20 + } + } + } + #If potential rival, set rival! + else_if = { + limit = { + has_relation_potential_rival = $CHARACTER$ + can_set_relation_rival_trigger = { CHARACTER = $CHARACTER$ } + } + if = { + limit = { + exists = scope:relationship_reason_involved_character + exists = scope:relationship_reason_province + } + set_relation_rival = { + reason = $REASON$ + target = $CHARACTER$ + involved_character = scope:relationship_reason_involved_character + province = scope:relationship_reason_province + } + if = { + limit = { + this.involved_activity ?= { + has_activity_type = activity_playdate + } + } + this.involved_activity ?= { + add_activity_log_entry = { + key = activity_generic_rival_log + tags = { bad } + score = 10 + character = prev + target = $CHARACTER$ + } + } + } + } + else_if = { + limit = { + exists = scope:relationship_reason_province + } + set_relation_rival = { + reason = $REASON$ + target = $CHARACTER$ + province = scope:relationship_reason_province + } + if = { + limit = { + this.involved_activity ?= { + has_activity_type = activity_playdate + } + } + this.involved_activity ?= { + add_activity_log_entry = { + key = activity_generic_rival_log + tags = { bad } + score = 10 + character = prev + target = $CHARACTER$ + } + } + } + } + else_if = { + limit = { + exists = scope:relationship_reason_involved_character + } + set_relation_rival = { + reason = $REASON$ + target = $CHARACTER$ + involved_character = scope:relationship_reason_involved_character + } + if = { + limit = { + this.involved_activity ?= { + has_activity_type = activity_playdate + } + } + this.involved_activity ?= { + add_activity_log_entry = { + key = activity_generic_rival_log + tags = { bad } + score = 10 + character = prev + target = $CHARACTER$ + } + } + } + } + else = { + set_relation_rival = { + reason = $REASON$ + target = $CHARACTER$ + } + if = { + limit = { + this.involved_activity ?= { + has_activity_type = activity_playdate + } + } + this.involved_activity ?= { + add_activity_log_entry = { + key = activity_generic_rival_log + tags = { bad } + score = 10 + character = prev + target = $CHARACTER$ + } + } + } + } + } + # If not... + else = { + # ... set potential relation if we're not already rivals! + if = { + limit = { can_set_relation_potential_rival_trigger = { CHARACTER = $CHARACTER$ } } + set_relation_potential_rival = $CHARACTER$ + } + + # ... add opinion if we should! + save_temporary_scope_value_as = { + name = rival_opinion + value = $OPINION$ + } + if = { + limit = { NOT = { scope:rival_opinion = 0 } } + if = { + limit = { + $CHARACTER$ = { is_ai = yes } + } + reverse_add_opinion = { + target = $CHARACTER$ + modifier = hate_opinion + opinion = scope:rival_opinion + } + } + add_opinion = { + target = $CHARACTER$ + modifier = hate_opinion + opinion = scope:rival_opinion + } + } + } +} +# Please use this one with care: players should never auto-upgrade to nemesis if we can help it, this is mostly for the AI. +progress_towards_nemesis_effect = { + if = { + limit = { + has_relation_rival = $CHARACTER$ + can_set_relation_nemesis_trigger = { CHARACTER = $CHARACTER$ } + } + if = { + limit = { + exists = scope:relationship_reason_involved_character + exists = scope:relationship_reason_province + } + set_relation_nemesis = { + reason = $REASON$ + target = $CHARACTER$ + involved_character = scope:relationship_reason_involved_character + province = scope:relationship_reason_province + } + } + else_if = { + limit = { + exists = scope:relationship_reason_province + } + set_relation_nemesis = { + reason = $REASON$ + target = $CHARACTER$ + province = scope:relationship_reason_province + } + } + else_if = { + limit = { + exists = scope:relationship_reason_involved_character + } + set_relation_nemesis = { + reason = $REASON$ + target = $CHARACTER$ + involved_character = scope:relationship_reason_involved_character + } + } + else = { + set_relation_nemesis = { + reason = $REASON$ + target = $CHARACTER$ + } + } + } + else = { + progress_towards_rival_effect = { + CHARACTER = $CHARACTER$ + REASON = $REASON$ + OPINION = $OPINION$ + } + } +} + +#Sets potential lover + opinion or upgrades potential lover to full lover +progress_towards_lover_effect = { + #If potential lover, set lover! + if = { + limit = { + has_relation_potential_lover = $CHARACTER$ + can_set_relation_lover_trigger = { CHARACTER = $CHARACTER$ } + } + if = { + limit = { + exists = scope:relationship_reason_involved_character + exists = scope:relationship_reason_province + } + set_relation_lover = { + reason = $REASON$ + target = $CHARACTER$ + involved_character = scope:relationship_reason_involved_character + province = scope:relationship_reason_province + } + } + else_if = { + limit = { + exists = scope:relationship_reason_province + } + set_relation_lover = { + reason = $REASON$ + target = $CHARACTER$ + province = scope:relationship_reason_province + } + } + else_if = { + limit = { + exists = scope:relationship_reason_involved_character + } + set_relation_lover = { + reason = $REASON$ + target = $CHARACTER$ + involved_character = scope:relationship_reason_involved_character + } + } + else = { + set_relation_lover = { + reason = $REASON$ + target = $CHARACTER$ + } + } + # Complete activity intent if relevant + if = { + limit = { + exists = involved_activity + has_activity_intent = woo_attendee_intent + intent_target ?= $CHARACTER$ + intent_target.involved_activity ?= this.involved_activity + } + save_scope_as = intent_completer + send_interface_toast = { + title = activity_intent_complete_toast + left_icon = $CHARACTER$ + complete_activity_intent = yes + } + } + } + # If not... + else = { + # ... set potential relation if we're not already rivals! + if = { + limit = { can_set_relation_potential_lover_trigger = { CHARACTER = $CHARACTER$ } } + set_relation_potential_lover = $CHARACTER$ + } + + # ... add opinion if we should! + save_temporary_scope_value_as = { + name = lover_opinion + value = $OPINION$ + } + if = { + limit = { NOT = { scope:lover_opinion = 0 } } + reverse_add_opinion = { + target = $CHARACTER$ + modifier = romance_opinion + opinion = scope:lover_opinion + } + hidden_effect = { + add_opinion = { + target = $CHARACTER$ + modifier = romance_opinion + opinion = scope:lover_opinion + } + } + } + } +} + +### CHARACTERS OF INTEREST EFFECTS ### + +#Makes a list of every character of major interest + #Parameters: + # LISTNAME - the name of the list + +get_characters_of_major_interest_effect = { + save_temporary_scope_as = major_root + # 1 - Player heir + if = { + limit = { + major_interest_player_heir_trigger = { LISTNAME = $LISTNAME$ } + } + player_heir = { add_to_temporary_list = $LISTNAME$ } + } + # 2 - Liege + if = { + limit = { + major_interest_liege_trigger = { LISTNAME = $LISTNAME$ } + } + liege = { add_to_temporary_list = $LISTNAME$ } + } + # 3 - Realm Priest + if = { + limit = { + major_interest_realm_priest_trigger = { LISTNAME = $LISTNAME$ } + } + cp:councillor_court_chaplain = { add_to_temporary_list = $LISTNAME$ } + } + # 4 - Primary Spouse + if = { + limit = { + major_interest_primary_spouse_trigger = { LISTNAME = $LISTNAME$ } + } + primary_spouse = { add_to_temporary_list = $LISTNAME$ } + } + # 5 - Spymaster & # 11 - Other councillors + every_normal_councillor = { + limit = { + NOT = { is_in_list = $LISTNAME$ } + } + add_to_temporary_list = $LISTNAME$ + } + # 6 - Powerful vassals + every_powerful_vassal = { + limit = { + NOT = { is_in_list = $LISTNAME$ } + } + add_to_temporary_list = $LISTNAME$ + } + # 7 - Religious head (Excluded because they're highly context-specific) + # 8 - Potential heirs (Player only) + if = { + limit = { is_ai = no } + if = { + limit = { exists = dynasty } + dynasty = { + every_dynasty_member = { + limit = { + major_interest_potential_heirs_trigger = { LISTNAME = $LISTNAME$ CHARACTER = scope:major_root } + } + add_to_temporary_list = $LISTNAME$ + } + } + } + # 9 - Allies (Player only, Enemies are only relevant for content about wars) + every_ally = { + limit = { + NOT = { is_in_list = $LISTNAME$ } + } + add_to_temporary_list = $LISTNAME$ + } + } + # 10 - Neighboring rulers (not included in this list, hard to gauge relevance) +} + +#Makes a list of every character of minor interest + #Parameters: + # CHARACTER - the character who the list will be for + # LISTNAME - the name of the list +get_characters_of_minor_interest_effect = { + save_temporary_scope_as = minor_root + # 1 - Concubines & secondary spouses + every_consort = { + limit = { minor_interest_concubines_secondary_spouses_trigger = { CHARACTER = scope:minor_root LISTNAME = $LISTNAME$ } } + add_to_temporary_list = $LISTNAME$ + } + # 2 - Direct vassals of high tier + every_vassal = { + limit = { minor_interest_high_tier_vassal_trigger = { LISTNAME = $LISTNAME$ } } + add_to_temporary_list = $LISTNAME$ + } + # 3 - Betrothed + if = { + limit = { minor_interest_betrothed_trigger = { LISTNAME = $LISTNAME$ } } + betrothed = { add_to_temporary_list = $LISTNAME$ } + } + # 4 - Lovers + every_relation = { + type = lover + limit = { NOT = { is_in_list = $LISTNAME$ } } + add_to_temporary_list = $LISTNAME$ + } + # 5 - Rivals (excluded as they're typically only used in specific contexts) + # 6 - Close relatives + every_close_or_extended_family_member = { + limit = { minor_interest_close_relatives_trigger = { CHARACTER = scope:minor_root LISTNAME = $LISTNAME$ } } + add_to_temporary_list = $LISTNAME$ + } + if = { #Below is just for players + limit = { is_ai = no } + # 7 - Guardian + every_relation = { + type = guardian + limit = { NOT = { is_in_list = $LISTNAME$ } } + add_to_temporary_list = $LISTNAME$ + } + # 8 - Ward + every_relation = { + type = ward + limit = { NOT = { is_in_list = $LISTNAME$ } } + add_to_temporary_list = $LISTNAME$ + } + # 9 - Friends + every_relation = { + type = friend + limit = { NOT = { is_in_list = $LISTNAME$ } } + add_to_temporary_list = $LISTNAME$ + } + # 10 - Knights + every_knight = { + limit = { NOT = { is_in_list = $LISTNAME$ } } + add_to_temporary_list = $LISTNAME$ + } + # 11 - Highly skilled courtiers (players only) + if = { + limit = { is_ai = no } + every_courtier = { + limit = { minor_interest_skilled_courtiers_trigger = { LISTNAME = $LISTNAME$ } } + add_to_temporary_list = $LISTNAME$ + } + } + every_liege_or_above = { + limit = { minor_interest_liege_or_above_trigger = { CHARACTER = scope:minor_root LISTNAME = $LISTNAME$ } } + add_to_temporary_list = $LISTNAME$ + } + } +} + + + +#Makes a list of all characters of interest + #Parameters: + # LISTNAME - the name of the list +get_characters_of_interest_effect = { + get_characters_of_major_interest_effect = { + LISTNAME = $LISTNAME$ + } + get_characters_of_minor_interest_effect = { + LISTNAME = $LISTNAME$ + } +} + + + + + +#Makes a list of characters who are classified as potential enemies + #Parameters + # CHARACTER - The character whose enemies are being found + # LISTNAME - The name of the list +get_potential_enemies_effect = { + $CHARACTER$ = { + every_vassal = { + limit = { + is_powerful = yes + opinion = { + target = $CHARACTER$ + value <= 0 + } + NOT = { is_in_list = $LISTNAME$ } + } + add_to_list = $LISTNAME$ + } + every_relation = { + type = rival + limit = { + NOT = { is_in_list = $LISTNAME$ } + } + add_to_list = $LISTNAME$ + } + if = { + limit = { + top_liege != this + liege = { + opinion = { + target = $CHARACTER$ + value <= 0 + } + NOT = { + is_in_list = $LISTNAME$ + } + } + } + liege = { + add_to_list = $LISTNAME$ + } + } + if = { + limit = { + top_liege = this + } + every_neighboring_top_liege_realm_owner = { + limit = { + NOT = { is_allied_to = $CHARACTER$ } + OR = { + opinion = { + target = $CHARACTER$ + value <= 20 + } + AND = { + opinion = { + target = $CHARACTER$ + value <= 50 + } + has_any_cb_on = $CHARACTER$ + } + } + NOT = { is_in_list = $LISTNAME$ } + } + add_to_list = $LISTNAME$ + } + } + #Potential Heirs that do not like you + } +} + +set_as_oaf_effect = { + if = { + limit = { + NOT = { has_relation_oaf = $CHARACTER$ } + } + set_relation_oaf = $CHARACTER$ + } +} + +remove_friend_or_downgrade_friendship_effect = { + if = { + limit = { has_relation_best_friend = $SCOPE$ } + hidden_effect = { remove_relation_best_friend = $SCOPE$ } + set_relation_friend = { reason = friend_downgrade_best_friends target = $SCOPE$ } + } + else = { remove_relation_friend = $SCOPE$ } +} + +remove_lover_or_downgrade_relationship_effect = { + if = { + limit = { has_relation_soulmate = $SCOPE$ } + hidden_effect = { remove_relation_soulmate = $SCOPE$ } + set_relation_lover = $SCOPE$ + } + else = { remove_relation_lover = $SCOPE$ } +} + +# Immediately upgrade the relationship +upgrade_to_friend_effect = { + #If nemesis, change to rival + if = { + limit = { has_relation_nemesis = $CHARACTER$ } + remove_relation_nemesis = $CHARACTER$ + if = { + limit = { + exists = scope:relationship_reason_involved_character + } + set_relation_rival = { + target = $CHARACTER$ + reason = $REASON$ + involved_character = scope:relationship_reason_involved_character + } + } + else = { + set_relation_rival = { + target = $CHARACTER$ + reason = $REASON$ + } + } + } + #If rival, end rivalry. + else_if = { + limit = { has_relation_rival = $CHARACTER$ } + remove_relation_rival = $CHARACTER$ + } + # If not, look at upgrading from friend to best friend + else_if = { + limit = { + has_relation_friend = $CHARACTER$ + } + if = { + limit = { + exists = scope:relationship_reason_involved_character + } + set_relation_best_friend = { + target = $CHARACTER$ + reason = $REASON$ + copy_reason = friend + involved_character = scope:relationship_reason_involved_character + } + } + else = { + set_relation_best_friend = { + target = $CHARACTER$ + copy_reason = friend + reason = $REASON$ + } + } + } + # If not, look at upgrading from nothing to friend + else_if = { + limit = { + NOT = { has_relation_friend = $CHARACTER$ } + } + if = { + limit = { + exists = scope:relationship_reason_involved_character + } + set_relation_friend = { + target = $CHARACTER$ + reason = $REASON$ + involved_character = scope:relationship_reason_involved_character + } + } + else = { + set_relation_friend = { + target = $CHARACTER$ + reason = $REASON$ + } + } + } +} + +# Immediately downgrade the relationship +# DO NOT USE AFTER BP1 - hard to implement with relationship reasons +downgrade_to_rival_effect = { + #If best friend, change to friend + if = { + limit = { + has_relation_best_friend = $CHARACTER$ + } + remove_relation_best_friend = $CHARACTER$ + set_relation_friend = { reason = friend_downgrade_best_friends target = $CHARACTER$ } + } + #If friend, end friendship. + else_if = { + limit = { + has_relation_friend = $CHARACTER$ + } + remove_relation_friend = $CHARACTER$ + } + # If not, look at upgrading from rival to nemesis + else_if = { + limit = { + has_relation_rival = $CHARACTER$ + NOT = { has_relation_nemesis = $CHARACTER$ } + } + set_relation_nemesis = { + target = $CHARACTER$ + copy_reason = rival + reason = nemesis_downgrade_from_rival + } + } + # If not, look at upgrading from nothing to rival + else_if = { + limit = { + NOT = { has_relation_nemesis = $CHARACTER$ } + } + set_relation_rival = { + target = $CHARACTER$ + reason = $REASON$ + } + } +} + +set_random_friendship_reason = { # Use for adults, primarily + show_as_tooltip = { + set_relation_friend = $TARGET$ + } + hidden_effect = { + random_list = { + 10 = { + trigger = { + exists = location + NOT = { exists = liege } + } + set_relation_friend = { reason = friend_random_1 target = $TARGET$ province = location } + } + 10 = { + trigger = { + exists = location + NOT = { exists = liege } + } + set_relation_friend = { reason = friend_random_2 target = $TARGET$ province = location } + } + 10 = { + trigger = { + exists = location + NOT = { exists = liege } + } + set_relation_friend = { reason = friend_random_3 target = $TARGET$ province = location } + } + 10 = { + trigger = { + exists = location + NOT = { exists = liege } + } + set_relation_friend = { reason = friend_random_4 target = $TARGET$ province = location } + } + 10 = { + trigger = { + exists = location + NOT = { exists = liege } + } + set_relation_friend = { reason = friend_random_5 target = $TARGET$ province = location } + } + 10 = { + trigger = { + exists = liege + } + set_relation_friend = { reason = friend_random_6 target = $TARGET$ involved_character = liege } + } + 10 = { + trigger = { + exists = liege + } + set_relation_friend = { reason = friend_random_7 target = $TARGET$ involved_character = liege } + } + 10 = { + trigger = { + exists = liege + } + set_relation_friend = { reason = friend_random_8 target = $TARGET$ involved_character = liege } + } + 10 = { + trigger = { + exists = liege.capital_province + } + set_relation_friend = { reason = friend_random_9 target = $TARGET$ involved_character = liege province = liege.capital_province } + } + 10 = { + trigger = { + exists = liege.capital_province + } + set_relation_friend = { reason = friend_random_10 target = $TARGET$ involved_character = liege province = liege.capital_province } + } + 10 = { + trigger = { + NOR ={ + exists = location + exists = liege + } + } + set_relation_friend = { reason = friend_random_fallback target = $TARGET$ } + } + } + } +} + +set_random_rivalry_reason = { # Use for adults, primarily + show_as_tooltip = { + set_relation_$RELATION$ = $TARGET$ + } + hidden_effect = { + random_list = { + 10 = { + trigger = { + exists = location + NOT = { exists = liege } + } + set_relation_$RELATION$ = { reason = rival_random_1 target = $TARGET$ province = location } + } + 10 = { + trigger = { + exists = location + NOT = { exists = liege } + } + set_relation_$RELATION$ = { reason = rival_random_2 target = $TARGET$ province = location } + } + 10 = { + trigger = { + exists = location + NOT = { exists = liege } + } + set_relation_$RELATION$ = { reason = rival_random_3 target = $TARGET$ province = location } + } + 10 = { + trigger = { + exists = location + NOT = { exists = liege } + } + set_relation_$RELATION$ = { reason = rival_random_4 target = $TARGET$ province = location } + } + 10 = { + trigger = { + exists = location + NOT = { exists = liege } + } + set_relation_$RELATION$ = { reason = rival_random_5 target = $TARGET$ province = location } + } + 10 = { + trigger = { + exists = liege + } + set_relation_$RELATION$ = { reason = rival_random_6 target = $TARGET$ involved_character = liege } + } + 10 = { + trigger = { + exists = liege + } + set_relation_$RELATION$ = { reason = rival_random_7 target = $TARGET$ involved_character = liege } + } + 10 = { + trigger = { + exists = liege + } + set_relation_$RELATION$ = { reason = rival_random_8 target = $TARGET$ involved_character = liege } + } + 10 = { + trigger = { + exists = liege.capital_province + } + set_relation_$RELATION$ = { reason = rival_random_9 target = $TARGET$ involved_character = liege province = liege.capital_province } + } + 10 = { + trigger = { + exists = liege.capital_province + } + set_relation_$RELATION$ = { reason = rival_random_10 target = $TARGET$ involved_character = liege province = liege.capital_province } + } + 10 = { + trigger = { + exists = liege + } + set_relation_$RELATION$ = { reason = rivalry_at_court target = $TARGET$ involved_character = liege } + } + 10 = { + trigger = { + NOR ={ + exists = location + exists = liege + } + } + set_relation_$RELATION$ = { reason = rival_random_fallback target = $TARGET$ } + } + } + } +} + +set_random_lover_reason = { + show_as_tooltip = { + set_relation_lover = $TARGET$ + } + hidden_effect = { + random_list = { + 10 = { + trigger = { + $TARGET$ = { + is_female = yes + } + } + set_relation_lover = { reason = lover_random_1 target = $TARGET$ } + } + 10 = { + set_relation_lover = { reason = lover_random_2 target = $TARGET$ } + } + 10 = { + set_relation_lover = { reason = lover_random_3 target = $TARGET$ } + } + 10 = { + trigger = { + $TARGET$ = { + is_male = yes + } + } + set_relation_lover = { reason = lover_random_4 target = $TARGET$ } + } + 10 = { + set_relation_lover = { reason = lover_random_5 target = $TARGET$ } + } + 10 = { + set_relation_lover = { reason = lover_random_6 target = $TARGET$ } + } + 10 = { + trigger = { + $TARGET$ = { + is_male = yes + } + } + set_relation_lover = { reason = lover_random_7 target = $TARGET$ } + } + 10 = { + set_relation_lover = { reason = lover_random_8 target = $TARGET$ } + } + 10 = { + trigger = { + $TARGET$ = { + is_female = yes + } + } + set_relation_lover = { reason = lover_random_9 target = $TARGET$ } + } + 10 = { + set_relation_lover = { reason = lover_random_10 target = $TARGET$ } + } + } + } +} + +# OWNER = character +# TARGET = character +# RELATION = relation_key +send_set_relation_toast_effect = { + $OWNER$ = { + save_temporary_scope_as = relation_owner + } + $TARGET$ = { + save_temporary_scope_as = relation_target + } + scope:relation_owner = { + send_interface_toast = { + type = msg_set_relation_$RELATION$ + left_icon = this + right_icon = scope:relation_target + } + } + scope:relation_target = { + send_interface_toast = { + type = msg_set_relation_$RELATION$ + left_icon = this + right_icon = scope:relation_owner + } + } +} + +#Sets favor relation, then gives hook +progress_towards_hook_effect = { + #If has potential favor, give hook! + if = { + limit = { + NOT = { + has_hook = $CHARACTER$ + } + has_relation_potential_hook = $CHARACTER$ + } + add_hook = { + type = $HOOK_TYPE$ + target = $CHARACTER$ + } + } + # If not... + else = { + if = { + limit = { + NOT = { has_hook = $CHARACTER$ } + } + set_relation_potential_hook = $CHARACTER$ + } + else = { + reverse_add_opinion = { + target = $CHARACTER$ + modifier = favor_opinion + opinion = 25 + } + } + } +} + +progress_towards_friend_ai_effect = { + if = { + limit = { + $CHARACTER$ = { is_ai = yes } + } + progress_towards_friend_effect = { + CHARACTER = $CHARACTER$ + OPINION = $OPINION$ + REASON = $REASON$ + } + } +} + +progress_towards_lover_ai_effect = { + if = { + limit = { + $CHARACTER$ = { is_ai = yes } + } + progress_towards_lover_effect = { + CHARACTER = $CHARACTER$ + OPINION = $OPINION$ + REASON = $REASON$ + } + } +} + +progress_towards_rival_ai_effect = { + if = { + limit = { + $CHARACTER$ = { is_ai = yes } + } + progress_towards_rival_effect = { + CHARACTER = $CHARACTER$ + OPINION = $OPINION$ + REASON = $REASON$ + } + } +} + +progress_towards_intent_effect = { + if = { + limit = { + intent_target ?= $CHARACTER$ + has_activity_intent = woo_attendee_intent + } + progress_towards_lover_effect = { + REASON = $REASON$ + CHARACTER = $CHARACTER$ + OPINION = default_lover_opinion + } + } + else_if = { + limit = { + OR = { + AND = { + intent_target ?= $CHARACTER$ + has_activity_intent = befriend_attendee_intent + } + $FRIEND_FALLBACK$ = yes + } + } + progress_towards_friend_effect = { + REASON = $REASON$ + CHARACTER = $CHARACTER$ + OPINION = default_friend_opinion + } + } + else = { + reverse_add_opinion = { + modifier = kindness_opinion + target = $CHARACTER$ + opinion = default_friend_opinion + } + } +} + +clear_grudges_effect = { + $CHAR_1$ = { + if = { + limit = { has_relation_grudge = $CHAR_2$ } + remove_relation_grudge = $CHAR_2$ + } + } + $CHAR_2$ = { + if = { + limit = { has_relation_grudge = $CHAR_1$ } + remove_relation_grudge = $CHAR_1$ + } + } +} diff --git a/N3OW/common/scripted_effects/00_religion_effects.txt b/N3OW/common/scripted_effects/00_religion_effects.txt new file mode 100644 index 00000000..246fe82a --- /dev/null +++ b/N3OW/common/scripted_effects/00_religion_effects.txt @@ -0,0 +1,712 @@ +#Effects relating to religions + +# check_for_equal_doctrine_effect +# set_bhakti_effect + +# Used to set Equal Law when the Equal Faith Doctrine is gained +check_for_equal_doctrine_effect = { + if = { + limit = { + is_playable_character = yes + faith = { + has_doctrine = doctrine_gender_equal + } + scope:old_faith = { + NOT = { has_doctrine = doctrine_gender_equal } + } + NOT = { + has_realm_law = equal_law + } + } + add_realm_law_skip_effects = equal_law + } +} + +# Used to set a Hindu's personal god. +set_bhakti_effect = { + # Remove any previous personal god relation. + ## HINDUISM + if = { + limit = { religion = religion:hinduism_religion } + if = { + limit = { + has_character_modifier = bhakti_hinduism_ganga + } + remove_character_modifier = bhakti_hinduism_ganga + add_piety = massive_piety_loss + } + else_if = { + limit = { + has_character_modifier = bhakti_hinduism_saraswati + } + remove_character_modifier = bhakti_hinduism_saraswati + add_piety = massive_piety_loss + } + else_if = { + limit = { + has_character_modifier = bhakti_hinduism_kali + } + remove_character_modifier = bhakti_hinduism_kali + add_piety = massive_piety_loss + } + else_if = { + limit = { + has_character_modifier = bhakti_hinduism_kubera + } + remove_character_modifier = bhakti_hinduism_kubera + add_piety = massive_piety_loss + } + else_if = { + limit = { + has_character_modifier = bhakti_vaishnavism_lakishmi + } + remove_character_modifier = bhakti_vaishnavism_lakishmi + add_piety = massive_piety_loss + } + else_if = { + limit = { + has_character_modifier = bhakti_vaishnavism_jagganath + } + remove_character_modifier = bhakti_vaishnavism_jagganath + add_piety = massive_piety_loss + } + else_if = { + limit = { + has_character_modifier = bhakti_vaishnavism_jagganath + } + remove_character_modifier = bhakti_vaishnavism_jagganath + add_piety = massive_piety_loss + } + else_if = { + limit = { + has_character_modifier = bhakti_vaishnavism_hayagriva + } + remove_character_modifier = bhakti_vaishnavism_hayagriva + add_piety = massive_piety_loss + } + else_if = { + limit = { + has_character_modifier = bhakti_shaivism_parvati + } + remove_character_modifier = bhakti_shaivism_parvati + add_piety = massive_piety_loss + } + else_if = { + limit = { + has_character_modifier = bhakti_shaivism_virabhadra + } + remove_character_modifier = bhakti_shaivism_virabhadra + add_piety = massive_piety_loss + } + else_if = { + limit = { + has_character_modifier = bhakti_shaivism_munishwarar + } + remove_character_modifier = bhakti_shaivism_munishwarar + add_piety = massive_piety_loss + } + else_if = { + limit = { + has_character_modifier = bhakti_shaivism_dakshinamoorthy + } + remove_character_modifier = bhakti_shaivism_dakshinamoorthy + add_piety = massive_piety_loss + } + else_if = { + limit = { + has_character_modifier = bhakti_smartism_ganesha + } + remove_character_modifier = bhakti_smartism_ganesha + add_piety = massive_piety_loss + } + else_if = { + limit = { + has_character_modifier = bhakti_smartism_vishnu + } + remove_character_modifier = bhakti_smartism_vishnu + add_piety = massive_piety_loss + } + else_if = { + limit = { + has_character_modifier = bhakti_smartism_shiva + } + remove_character_modifier = bhakti_smartism_shiva + add_piety = massive_piety_loss + } + } + # GERMANIC + else_if = { + limit = { religion = religion:germanic_religion } + if = { + limit = { + has_character_modifier = bhakti_germanic_generic_odin + } + remove_character_modifier = bhakti_germanic_generic_odin + add_piety = massive_piety_loss + } + else_if = { + limit = { + has_character_modifier = bhakti_germanic_not_danish_ullr + } + remove_character_modifier = bhakti_germanic_not_danish_ullr + add_piety = massive_piety_loss + } + else_if = { + limit = { + has_character_modifier = bhakti_germanic_danish_tyr + } + remove_character_modifier = bhakti_germanic_danish_tyr + add_piety = massive_piety_loss + } + else_if = { + limit = { + has_character_modifier = bhakti_germanic_generic_thor + } + remove_character_modifier = bhakti_germanic_generic_thor + add_piety = massive_piety_loss + } + else_if = { + limit = { + has_character_modifier = bhakti_germanic_generic_freyr + } + remove_character_modifier = bhakti_germanic_generic_freyr + add_piety = massive_piety_loss + } + } + else = { + # If no current bhakti, cost is reduced. + add_piety = medium_piety_loss + } + + add_character_modifier = $BHAKTI$ +} + + +create_head_of_faith_title_effect = { + # Pay costs + if = { + limit = { + faith = { + has_doctrine_parameter = temporal_head_of_faith + OR = { + has_doctrine = muhammad_succession_sunni_doctrine + has_doctrine = muhammad_succession_shia_doctrine + } + } + } + if = { # Very expensive for non-sayyid to become a Caliph. + limit = { NOT = { has_trait = sayyid } } + add_piety = massive_piety_loss + } + # Free otherwise + } + else_if = { + limit = { faith = { has_doctrine_parameter = temporal_head_of_faith } } + add_piety = major_piety_loss + } + else = { remove_short_term_gold = medium_gold_max_value } + + # (Re)create the HoF title + custom_description_no_bullet = { + text = create_temporal_head_of_faith + subject = root + object = scope:faith + + # Temporal HoF + if = { + limit = { faith = { has_doctrine_parameter = temporal_head_of_faith } } + if = { + limit = { + faith = { + NOT = { exists = religious_head_title } + } + } + trigger_event = faith_creation.0001 # Creates new dynamic title + } + else = { trigger_event = faith_creation.0011 } # Re-uses existing title. + } + + # Spiritual HoF + else_if = { + limit = { faith = { has_doctrine_parameter = spiritual_head_of_faith } } + if = { + limit = { + faith = { + NOT = { exists = religious_head_title } + } + } + trigger_event = faith_creation.0002 # Creates new dynamic title + } + else = { trigger_event = faith_creation.0012 } # Re-uses existing title. + } + } + + # Send an informative message to all players about the new HoF + hidden_effect = { + save_scope_as = reformer + faith = { + save_scope_as = faith + change_fervor = { + value = major_fervor_gain + desc = fervor_gain_recreated_hof + } + } + every_player = { + if = { + limit = { faith = scope:faith } + trigger_event = { + id = faith_creation.1010 + days = 1 + } + } + else = { + trigger_event = { + id = faith_creation.1011 + days = 1 + } + } + } + } +} + +force_create_head_of_faith_title_Effect = { # Has no cost, should be done manually on a per-case basis + custom_description_no_bullet = { + text = create_temporal_head_of_faith + subject = root + object = scope:faith + + # Temporal HoF + if = { + limit = { faith = { has_doctrine_parameter = temporal_head_of_faith } } + trigger_event = faith_creation.0001 + } + + # Spiritual HoF + else_if = { + limit = { faith = { has_doctrine_parameter = spiritual_head_of_faith } } + trigger_event = faith_creation.0002 + } + } +} + +# Dynamic HoF title creation +set_up_dynamic_temporal_hof_title_effect = { + faith = { save_scope_as = my_faith } + create_dynamic_title = { + tier = duchy + name = REL_HEAD_TITLE_NAME + } + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + scope:new_title = { + set_destroy_if_invalid_heir = yes + set_no_automatic_claims = yes + set_definitive_form = yes + set_always_follows_primary_heir = yes + change_title_holder = { + holder = $NEW_HOLDER$ + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + faith = { set_religious_head_title = scope:new_title } + if = { + limit = { + NOT = { has_realm_law = same_faith_succession_law } + } + add_realm_law_skip_effects = same_faith_succession_law + } + scope:new_title = { + generate_coa = religious_title + add_title_law = temporal_head_of_faith_succession_law + } +} + +set_up_dynamic_spiritual_hof_title_effect = { + # Sort scopes & starting processes. + faith = { save_scope_as = my_faith } + create_dynamic_title = { + tier = duchy + name = REL_HEAD_TITLE_NAME + } + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + # Nab a suitable character. + if = { + limit = { + any_theocratic_vassal = { faith = $CREATOR$.faith } + } + ordered_theocratic_vassal = { + limit = { faith = $CREATOR$.faith } + order_by = head_of_faith_selection_weight + save_scope_as = new_religious_head + } + } + else = { + create_character = { + location = $CREATOR$.capital_province + age = { 30 50 } + gender_female_chance = root_faith_clergy_gender_female_chance + trait = education_learning_4 + faith = $CREATOR$.faith + culture = $CREATOR$.culture + learning = { 14 22 } + save_scope_as = new_religious_head + } + } + # Try to land the new title. + scope:my_faith = { + random_holy_site = { + # Prefer a capital that's under $CREATOR$. + limit = { county.holder = $CREATOR$ } + # Even if it's indirectly under $CREATOR$. + alternative_limit = { + county.holder = { target_is_liege_or_above = $CREATOR$ } + } + # Then go for any that's held by someone of the faith. + alternative_limit = { county.holder.faith = $CREATOR$.faith } + # Under *extreme* circumstances, pick any holy site with at least some faithful. + alternative_limit = { county.faith = $CREATOR$.faith } + # Ok, just pick any of them. We're out of options and we need _somewhere_. + alternative_limit = { always = yes } + save_scope_as = holy_site + } + } + if = { + limit = { exists = scope:holy_site } + scope:new_title = { set_capital_county = scope:holy_site.county } + } + # Configure final effects. + hidden_effect = { + scope:new_title = { + set_landless_title = yes + set_destroy_if_invalid_heir = yes + set_no_automatic_claims = yes + set_definitive_form = yes + set_always_follows_primary_heir = yes + change_title_holder = { + holder = scope:new_religious_head + change = scope:change + } + } + } + resolve_title_and_vassal_change = scope:change + faith = { set_religious_head_title = scope:new_title } + scope:new_title = { generate_coa = religious_title } + # We enclose the law safeguard in an if statement to prevent errors when this is only _about_ to be fired. + hidden_effect = { + if = { + limit = { exists = scope:new_religious_head } + scope:new_religious_head = { + if = { + limit = { + NOT = { has_realm_law = same_faith_theocratic_succession_law } + } + add_realm_law_skip_effects = same_faith_theocratic_succession_law + } + } + } + } +} + +# Excommunication management. +add_excommunication_tooltip_only_effect = { + show_as_tooltip = { + add_trait_force_tooltip = excommunicated + add_character_modifier = { # Minor negative modifier that stops us from immediately getting our excommunication recinded (so you have a guaranteed 'penance period'). + modifier = recent_excommunication + days = 365 + } + } +} +add_excommunication_actual_effect = { + add_trait = excommunicated + add_character_modifier = { # Minor negative modifier that stops us from immediately getting our excommunication recinded (so you have a guaranteed 'penance period'). + modifier = recent_excommunication + days = 365 + } +} + +add_excommunication_actual_effect_5_years_version = { + add_trait = excommunicated + add_character_modifier = { # Minor negative modifier that stops us from immediately getting our excommunication recinded (so you have a guaranteed 'penance period'). + modifier = recent_excommunication + years = 5 + } +} + +create_holy_order_neutral_effect = { + # Create a general holy order. + create_holy_order = { + leader = $LEADER$ + capital = $CAPITAL$ + save_scope_as = $NEW_HO_SCOPE$ + } + # Struggle Catalysts. + $FOUNDER$ = { + if = { + limit = { + any_character_struggle = { + involvement = involved + phase_has_catalyst = catalyst_creating_a_holy_order + } + } + every_character_struggle = { + involvement = involved + limit = { phase_has_catalyst = catalyst_creating_a_holy_order } + activate_struggle_catalyst = { + catalyst = catalyst_creating_a_holy_order + character = $FOUNDER$ + } + } + } + } +} + + +# Get random faith +get_random_faith_effect = { + if = { + limit = { $FORBIDROOTFAITH$ = yes } + random_religion_global = { + limit = { any_faith = { this != root.faith } } + random_faith = { + limit = { this != root.faith } + save_scope_as = random_faith + } + } + } + else = { + random_religion_global = { + random_faith = { save_scope_as = random_faith } + } + } +} + +set_up_dynamic_spiritual_hof_title_existing_hof_effect = { + + $RELIGIOUS_HEAD$ = { save_scope_as = new_religious_head } + + # Sort scopes & starting processes. + faith = { save_scope_as = my_faith } + create_dynamic_title = { + tier = duchy + name = REL_HEAD_TITLE_NAME + } + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + + # Nab a suitable character. + # The decision already chose one. + + # Try to land the new title. + scope:my_faith = { + random_holy_site = { + limit = { county.holder = $CREATOR$ } + alternative_limit = { + county.holder = { target_is_liege_or_above = $CREATOR$ } + } + alternative_limit = { + county.holder = { + faith = $CREATOR$.faith + is_ai = yes + } + } + save_scope_as = holy_site + } + } + if = { + limit = { exists = scope:holy_site } + scope:new_title = { set_capital_county = scope:holy_site.county } + } + # Configure final effects. + hidden_effect = { + scope:new_title = { + set_landless_title = yes + set_destroy_if_invalid_heir = yes + set_no_automatic_claims = yes + set_definitive_form = yes + set_always_follows_primary_heir = yes + change_title_holder = { + holder = scope:new_religious_head + change = scope:change + } + } + } + resolve_title_and_vassal_change = scope:change + faith = { set_religious_head_title = scope:new_title } + scope:new_title = { generate_coa = religious_title } + # We enclose the law safeguard in an if statement to prevent errors when this is only _about_ to be fired. + hidden_effect = { + if = { + limit = { exists = scope:new_religious_head } + scope:new_religious_head = { + if = { + limit = { + NOT = { has_realm_law = same_faith_theocratic_succession_law } + } + add_realm_law_skip_effects = same_faith_theocratic_succession_law + } + } + } + } +} + +### SECRET FAITH ### + +# Openly convert +secret_faith_openly_convert_character = { + if = { + limit = { exists = secret_faith } + set_character_faith_with_conversion = secret_faith # Gets vassals too, if they like you enough + remove_character_secret_faith = yes + } +} + +# Openly convert all secret faith counties in your realm +secret_faith_openly_convert_all_in_realm = { + if = { + limit = { any_sub_realm_county = { has_variable = false_convert } } + save_scope_value_as = { # Keeping track how many counties convert + name = num_false_converts_counties + value = 0 + } + + every_sub_realm_county = { + limit = { has_variable = false_convert } + set_county_faith = var:false_convert # Convert them + remove_county_modifier = false_convert_modifier # Remove modifier too + remove_variable = false_convert # No longer mark them as converts + add_county_modifier = { # Everyone likes practicing their faith in the open! + modifier = relieved_cryptos_modifier + years = 25 + } + save_scope_value_as = { # Updating how many counties convert + name = num_false_converts_counties + value = { + value = scope:num_false_converts_counties + add = 1 + } + } + } + if = { # Include counties in the message if there are any + limit = { scope:num_false_converts_counties > 0 } + root = { # There is an edgecase where root has a link to realm, but is not a character themselves! + send_interface_message = { + type = event_religious_good_text + title = event_false_converts.t + desc = event_false_converts_plus_counties.desc + } + } + } + } +} + +# Openly convert all secret faith counties of your faith in your realm +secret_faith_openly_convert_all_in_realm_specific = { + if = { + limit = { + any_sub_realm_county = { + has_variable = false_convert + var:false_convert = root.faith + faith != root.faith # Discount them if they've already been switched by the conversion action. + } + } + + save_scope_value_as = { # Keeping track how many counties convert + name = num_false_converts_counties + value = 0 + } + + every_sub_realm_county = { + limit = { + has_variable = false_convert + var:false_convert = root.faith + faith != root.faith # Discount them if they've already been switched by the conversion action. + } + set_county_faith = var:false_convert # Change faith + remove_county_modifier = false_convert_modifier + remove_variable = false_convert # Cleanup + add_county_modifier = { # Everyone likes practicing their faith in the open! + modifier = relieved_cryptos_modifier + years = 25 + } + save_scope_value_as = { # Updating how many counties convert + name = num_false_converts_counties + value = { + value = scope:num_false_converts_counties + add = 1 + } + } + } + + if = { # Include counties in the message if there are any + limit = { scope:num_false_converts_counties > 0 } + root = { + send_interface_message = { + type = event_religious_good_text + title = event_false_converts.t + desc = event_false_converts_plus_counties.desc + } + } + } + } +} + +add_heresiarch_trait_effect = { # Flag is need to prevent trait being removed when gaining it close to conversion + add_character_flag = { + flag = new_heresiarch + days = 3 + } + if = { + limit = { + NOT = { has_trait = heresiarch } + } + add_trait = heresiarch + } +} + +self_mutilation_minor_piety_gain_effect = { + if = { + limit = { + faith = { has_doctrine_parameter = self_mutilation_active } + } + custom_tooltip = { + text = self_mutilation_minor_piety_gain_tt + add_piety = minor_piety_gain + } + } +} + +self_mutilation_medium_piety_gain_effect = { + if = { + limit = { + faith = { has_doctrine_parameter = self_mutilation_active } + } + custom_tooltip = { + text = self_mutilation_medium_piety_gain_tt + add_piety = medium_piety_gain + } + } +} + +self_mutilation_major_piety_gain_effect = { + if = { + limit = { + faith = { has_doctrine_parameter = self_mutilation_active } + } + custom_tooltip = { + text = self_mutilation_major_piety_gain_tt + add_piety = major_piety_gain + } + } +} diff --git a/N3OW/common/scripted_effects/00_religious_interaction_effects.txt b/N3OW/common/scripted_effects/00_religious_interaction_effects.txt new file mode 100644 index 00000000..2382abff --- /dev/null +++ b/N3OW/common/scripted_effects/00_religious_interaction_effects.txt @@ -0,0 +1,1676 @@ +#Effects used for religion interactions + +excommunicate_character = { + if = { + limit = { + $REQUESTING_CHARACTER$.faith = $TARGET_CHARACTER$.faith + } + + $REQUESTING_CHARACTER$ = { + save_scope_as = requesting_character + } + $TARGET_CHARACTER$ = { + save_scope_as = target_character + faith.religious_head = { + save_scope_as = religious_head + } + + # If our religious head was convinced/persuaded to excommunicate us by another ruler, we want to make that clear. + if = { + limit = { + scope:requesting_character != scope:religious_head + } + add_excommunication_actual_effect = yes + add_opinion = { + modifier = angry_opinion + target = scope:religious_head + opinion = -30 + } + add_opinion = { + modifier = hate_opinion + target = scope:requesting_character + opinion = -50 + } + } + # Though if our head independently decided to excommunicate us, that should also be clear. + else = { + add_excommunication_actual_effect = yes + add_opinion = { + modifier = angry_opinion + target = scope:religious_head + opinion = -50 + } + } + + # LEGITIMACY LOSS FROM EXCOMMUNICATION + excommunication_legitimacy_effect = yes + + progress_towards_rival_effect = { + CHARACTER = scope:requesting_character + REASON = rival_requested_excommunication + OPINION = 0 + } + set_variable = { #TO save who wanted you excommunicated + name = requested_my_excommunication + value = scope:requesting_character + } + + # Regardless of why the excommunication happened, players should be aware whenever a character of interest is excommunicated. + every_player = { + limit = { + faith = scope:target_character.faith + NOR = { + this = scope:target_character # If we are the excommunication target, we were already send a notification in the script above this. + this = scope:requesting_character #If we are the excommunication requester, we already get a diplomacy response telling us about the excommunication. + } + + save_temporary_scope_as = player + OR = { + top_liege = scope:target_character # Our realm's top liege is a character of interest. + top_liege = { + any_vassal_or_below = { # Peers of the realm are also characters of interest... + this = scope:target_character + OR = { + NOT = { highest_held_title_tier = 1 } #... unless they're someone else's baron (then they're too inconsequential). + is_vassal_of = scope:player + } + } + } + any_close_family_member = { + this = scope:target_character # Family members are characters of interest, even if not part of our realm. + } + any_neighboring_top_liege_realm_owner = { + this = scope:target_character # Finally, any neighboring realm owners are characters of interest (as we get an excommunication war CB on them, as well as the ability to request claims). + } + } + } + save_scope_as = this_player + send_interface_message = { + type = excommunicated_other_message + title = excommunicated_other_message + desc = other_excommunicated_message + left_icon = scope:target_character + right_icon = scope:religious_head + } + } + } + } +} + +lift_character_excommunication_effect = { + $REQUESTING_CHARACTER$ = { + hidden_effect = { + send_interface_toast = { + title = lift_excommunicate_interaction_desc.tt + left_icon = $TARGET_CHARACTER$ + $TARGET_CHARACTER$ = { + show_as_tooltip = { remove_trait = excommunicated } + } + } + } + } + $TARGET_CHARACTER$ = { + remove_trait = excommunicated + add_character_modifier = { + modifier = excommunication_recently_lifted + years = 10 + } + add_opinion = { + modifier = grateful_opinion + target = $REQUESTING_CHARACTER$ + opinion = 30 + } + # To nudge friendship. + hidden_effect = { + if = { + limit = { + NOR = { + has_relation_friend = $REQUESTING_CHARACTER$ + has_relation_potential_friend = $REQUESTING_CHARACTER$ + } + } + set_relation_potential_friend = $REQUESTING_CHARACTER$ + } + } + } +} + +# Saves the target kingdom to scope:target_kingdom, and the target character to scope:target_character +determine_ghw_target_effect = { + # Find every *possible* kingdom + $FAITH$ = { + save_temporary_scope_value_as = { + name = faith_strength + value = faith_military_strength + } + } + #1178 Catholics target the Holy Land, to support Kingdom of Jerusalem and make Fourth Crusade more likely to trigger + if = { + limit = { + #Definitely hasn't been a crusade already + NOR = { + has_global_variable = frankokratia_occurred + has_global_variable = cath_crusade_1 + } + game_start_date = 1178.10.1 + $FAITH$ = { + this = faith:catholic + } + #Any holy land kingdom is valid + any_kingdom = { + valid_ghw_target_trigger = { FAITH = $FAITH$ } + OR = { + title_capital_county.title_province = { geographical_region = world_middle_east_arabia } + title_capital_county.title_province = { geographical_region = world_middle_east_jerusalem } + title_capital_county.title_province = { geographical_region = world_asia_minor } + this = title:k_cyprus + this = title:k_egypt + } + } + } + #Most likely to be aiding kingdom of jerusalem + if = { + limit = { + exists = title:k_jerusalem.holder + title:k_jerusalem.holder = { + faith = faith:catholic + } + any_kingdom = { + valid_ghw_target_trigger = { FAITH = $FAITH$ } + OR = { + title_capital_county.title_province = { geographical_region = world_middle_east_arabia } + title_capital_county.title_province = { geographical_region = world_middle_east_jerusalem } + title_capital_county.title_province = { geographical_region = world_asia_minor } + this = title:k_cyprus + this = title:k_egypt + } + any_de_jure_county = { + OR = { + holder = title:k_jerusalem.holder + holder.top_liege = title:k_jerusalem.holder + any_neighboring_county = { + OR = { + holder = title:k_jerusalem.holder + holder.top_liege = title:k_jerusalem.holder + } + } + } + } + } + } + every_kingdom = { + limit = { + valid_ghw_target_trigger = { FAITH = $FAITH$ } + OR = { + title_capital_county.title_province = { geographical_region = world_middle_east_arabia } + title_capital_county.title_province = { geographical_region = world_middle_east_jerusalem } + title_capital_county.title_province = { geographical_region = world_asia_minor } + this = title:k_cyprus + this = title:k_egypt + } + any_de_jure_county = { + OR = { + holder = title:k_jerusalem.holder + holder.top_liege = title:k_jerusalem.holder + any_neighboring_county = { + OR = { + holder = title:k_jerusalem.holder + holder.top_liege = title:k_jerusalem.holder + } + } + } + } + } + add_to_list = potential_kingdoms + } + } + else = { + every_kingdom = { + limit = { + valid_ghw_target_trigger = { FAITH = $FAITH$ } + OR = { + title_capital_county.title_province = { geographical_region = world_middle_east_arabia } + title_capital_county.title_province = { geographical_region = world_middle_east_jerusalem } + title_capital_county.title_province = { geographical_region = world_asia_minor } + this = title:k_cyprus + this = title:k_egypt + } + } + add_to_list = potential_kingdoms + } + } + } + else = { + every_kingdom = { + limit = { + valid_ghw_target_trigger = { FAITH = $FAITH$ } + } + add_to_list = potential_kingdoms + } + } + + # Pick out the 10 "best" ones + ordered_in_list = { + list = potential_kingdoms + order_by = great_holy_war_target_kingdom_weight + + min = 0 + max = 10 + check_range_bounds = no + + add_to_list = filtered_potential_kingdoms + } + # Pick one of the top 10 at random (weighted) + random_in_list = { + list = filtered_potential_kingdoms + weight = { + base = 10 + modifier = { + add = great_holy_war_target_kingdom_weight + } + } + save_scope_as = target_kingdom + } + random_log_scopes = yes + # Find a random top liege in the area + scope:target_kingdom = { + random_in_de_jure_hierarchy = { + continue = { tier > tier_county } + limit = { #Try to pick the largest ruler in the area. + tier = tier_county + $FAITH$ = { + is_hostile_enough_for_holy_war_trigger = { FAITH = prev.holder.faith } + } + holder = { + highest_held_title_tier >= 4 + any_realm_county = { count >= 5 } + } + } + alternative_limit = { + tier = tier_county + $FAITH$ = { + is_hostile_enough_for_holy_war_trigger = { FAITH = prev.holder.faith } + } + holder = { + highest_held_title_tier >= 3 + any_realm_county = { count >= 5 } + } + } + alternative_limit = { + tier = tier_county + $FAITH$ = { + is_hostile_enough_for_holy_war_trigger = { FAITH = prev.holder.faith } + } + holder = { + highest_held_title_tier >= 2 + any_realm_county = { count >= 5 } + } + } + alternative_limit = { + tier = tier_county + $FAITH$ = { + is_hostile_enough_for_holy_war_trigger = { FAITH = prev.holder.faith } + } + } + alternative_limit = { + tier = tier_kingdom + $FAITH$ = { + is_hostile_enough_for_holy_war_trigger = { FAITH = prev.holder.faith } + } + } + holder = { + save_scope_as = target_character + } + } + } +} + +pledge_ghw_piety_gain_effect = { + if = { + limit = { highest_held_title_tier = 5 } + add_piety = 150 + } + if = { + limit = { highest_held_title_tier = 4 } + add_piety = 120 + } + if = { + limit = { highest_held_title_tier = 3 } + add_piety = 90 + } + if = { + limit = { highest_held_title_tier = 2 } + add_piety = 60 + } + if = { + limit = { highest_held_title_tier = 1 } + add_piety = 30 + } +} + +pledge_ghw_piety_loss_effect = { + if = { + limit = { highest_held_title_tier = tier_empire } + add_piety = massive_piety_loss + } + if = { + limit = { highest_held_title_tier = tier_kingdom } + add_piety = major_piety_loss + } + if = { + limit = { highest_held_title_tier <= tier_duchy } + add_piety = medium_piety_loss + } +} + +pledge_ghw_war_chest_prestige_effect = { #To be fired within the scope of an Attacker of the correct Faith. + if = { + limit = { prev = { highest_held_title_tier = 5 } } + change_war_chest_prestige = 3000 + } + if = { + limit = { prev = { highest_held_title_tier = 4 } } + change_war_chest_prestige = 1500 + } + if = { + limit = { prev = { highest_held_title_tier = 3 } } + change_war_chest_prestige = 1000 + } + if = { + limit = { prev = { highest_held_title_tier = 2 } } + change_war_chest_prestige = 500 + } + if = { + limit = { prev = { highest_held_title_tier = 1 } } + change_war_chest_prestige = 250 + } +} + +pledge_ghw_war_chest_piety_effect = { #To be fired within the scope of an Attacker of the correct Faith. + if = { + limit = { prev = { highest_held_title_tier = 5 } } + change_war_chest_piety = 1200 + } + if = { + limit = { prev = { highest_held_title_tier = 4 } } + change_war_chest_piety = 600 + } + if = { + limit = { prev = { highest_held_title_tier = 3 } } + change_war_chest_piety = 300 + } + if = { + limit = { prev = { highest_held_title_tier = 2 } } + change_war_chest_piety = 150 + } + if = { + limit = { prev = { highest_held_title_tier = 1 } } + change_war_chest_piety = 75 + } +} + +unpledge_ghw_war_chest_prestige_effect = { #To be fired within the ghw scope, assuming that the prev scope is the character joining it as an attacker. + if = { + limit = { prev = { highest_held_title_tier = 5 } } + change_war_chest_prestige = -3000 + } + if = { + limit = { prev = { highest_held_title_tier = 4 } } + change_war_chest_prestige = -1500 + } + if = { + limit = { prev = { highest_held_title_tier = 3 } } + change_war_chest_prestige = -1000 + } + if = { + limit = { prev = { highest_held_title_tier = 2 } } + change_war_chest_prestige = -500 + } + if = { + limit = { prev = { highest_held_title_tier = 1 } } + change_war_chest_prestige = -250 + } +} + +unpledge_ghw_war_chest_piety_effect = { #To be fired within the scope of an Attacker of the correct Faith. + if = { + limit = { prev = { highest_held_title_tier = 5 } } + change_war_chest_piety = -1200 + } + if = { + limit = { prev = { highest_held_title_tier = 4 } } + change_war_chest_piety = -600 + } + if = { + limit = { prev = { highest_held_title_tier = 3 } } + change_war_chest_piety = -300 + } + if = { + limit = { prev = { highest_held_title_tier = 2 } } + change_war_chest_piety = -150 + } + if = { + limit = { prev = { highest_held_title_tier = 1 } } + change_war_chest_piety = -75 + } +} + +ghw_set_new_war_declarer_effect = { + #Determine Sponsor. (effect fired within FAITH scope) + if = { + limit = { + exists = religious_head + } + religious_head = { + save_scope_as = ghw_sponsor + } + great_holy_war = { + set_war_declarer = scope:ghw_sponsor + if = { + limit = { + NOT = { has_pledged_attacker = scope:ghw_sponsor } + } + pledge_attacker = scope:ghw_sponsor + } + } + } +} + +#Used within an undirected ghw scope to determine the Beneficiary selected by the war's leader. +#Notable scopes: +#the_faith +#target_faith +#target_kingdom +#ghw_sponsor + +undirected_ghw_recipient_selection_effect = { + #Prioritize Holder of the target_kingdom. + #Then Claimants of the target_kingdom. + #And so forth... + if = { #The Kingdom is held by a member of the Faith, the Crusade is attempting to restore some of its provinces. + limit = { + scope:target_kingdom = { + holder ?= { + this.faith = scope:the_faith + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + } + } + } + } + scope:the_faith.great_holy_war = { + set_designated_winner = scope:target_kingdom.holder + } + } + else_if = { #Claimants of the King-title belonging to the Faith exist. + limit = { + scope:target_kingdom = { + any_claimant = { + this.faith = scope:the_faith + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + } + } + } + } + scope:target_kingdom = { + random_claimant = { + limit = { + this.faith = scope:the_faith + is_adult = yes + has_trait = zealous + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + } + OR = { + AND = { + is_male = yes + faith = { has_doctrine = doctrine_gender_male_dominated } + } + AND = { + is_female = yes + faith = { has_doctrine = doctrine_gender_female_dominated } + } + NOR = { + faith = { has_doctrine = doctrine_gender_male_dominated } + faith = { has_doctrine = doctrine_gender_female_dominated } + } + } + reverse_opinion = { + target = scope:ghw_sponsor + value >= 0 + } + } + alternative_limit = { + this.faith = scope:the_faith + is_adult = yes + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + } + OR = { + AND = { + is_female = no + faith = { has_doctrine = doctrine_gender_male_dominated } + } + AND = { + is_female = yes + faith = { has_doctrine = doctrine_gender_female_dominated } + } + NOR = { + faith = { has_doctrine = doctrine_gender_male_dominated } + faith = { has_doctrine = doctrine_gender_female_dominated } + } + } + reverse_opinion = { + target = scope:ghw_sponsor + value >= 0 + } + } + alternative_limit = { + this.faith = scope:the_faith + is_adult = yes + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + } + OR = { + AND = { + is_female = no + faith = { has_doctrine = doctrine_gender_male_dominated } + } + AND = { + is_female = yes + faith = { has_doctrine = doctrine_gender_female_dominated } + } + NOR = { + faith = { has_doctrine = doctrine_gender_male_dominated } + faith = { has_doctrine = doctrine_gender_female_dominated } + } + } + } + alternative_limit = { + this.faith = scope:the_faith + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + } + OR = { + AND = { + is_female = no + faith = { has_doctrine = doctrine_gender_male_dominated } + } + AND = { + is_female = yes + faith = { has_doctrine = doctrine_gender_female_dominated } + } + NOR = { + faith = { has_doctrine = doctrine_gender_male_dominated } + faith = { has_doctrine = doctrine_gender_female_dominated } + } + } + } + alternative_limit = { + this.faith = scope:the_faith + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + } + } + save_scope_as = ghw_claimant + } + } + scope:the_faith.great_holy_war = { + set_designated_winner = scope:ghw_claimant + } + } + else = { #Else leave Open: the Recepient of the top contributor gets it. + scope:the_faith.great_holy_war = { + reset_designated_winner = yes + } + } +} + +undirected_ghw_recipient_selection_on_death_effect = { + #Prioritize Holder of the target_kingdom. + #Then Claimants of the target_kingdom. + #And so forth... + if = { #The Kingdom is held by a member of the Faith, the Crusade is attempting to restore some of its provinces. + limit = { + scope:target_kingdom = { + holder ?= { + this.faith = scope:the_faith + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + this = root + } + } + } + } + scope:the_faith.great_holy_war = { + set_designated_winner = scope:target_kingdom.holder + } + scope:target_kingdom.holder = { + save_scope_as = ghw_claimant + } + } + else_if = { #Claimants of the King-title belonging to the Faith exist. + limit = { + scope:target_kingdom = { + any_claimant = { + this.faith = scope:the_faith + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + this = root + } + } + } + } + scope:target_kingdom = { + random_claimant = { + limit = { + this.faith = scope:the_faith + is_adult = yes + has_trait = zealous + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + this = root + } + OR = { + AND = { + is_female = no + faith = { has_doctrine = doctrine_gender_male_dominated } + } + AND = { + is_female = yes + faith = { has_doctrine = doctrine_gender_female_dominated } + } + NOR = { + faith = { has_doctrine = doctrine_gender_male_dominated } + faith = { has_doctrine = doctrine_gender_female_dominated } + } + } + reverse_opinion = { + target = scope:ghw_sponsor + value >= 0 + } + } + alternative_limit = { + this.faith = scope:the_faith + is_adult = yes + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + this = root + } + OR = { + AND = { + is_female = no + faith = { has_doctrine = doctrine_gender_male_dominated } + } + AND = { + is_female = yes + faith = { has_doctrine = doctrine_gender_female_dominated } + } + NOR = { + faith = { has_doctrine = doctrine_gender_male_dominated } + faith = { has_doctrine = doctrine_gender_female_dominated } + } + } + reverse_opinion = { + target = scope:ghw_sponsor + value >= 0 + } + } + alternative_limit = { + this.faith = scope:the_faith + is_adult = yes + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + this = root + } + OR = { + AND = { + is_female = no + faith = { has_doctrine = doctrine_gender_male_dominated } + } + AND = { + is_female = yes + faith = { has_doctrine = doctrine_gender_female_dominated } + } + NOR = { + faith = { has_doctrine = doctrine_gender_male_dominated } + faith = { has_doctrine = doctrine_gender_female_dominated } + } + } + } + alternative_limit = { + this.faith = scope:the_faith + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + this = root + } + OR = { + AND = { + is_female = no + faith = { has_doctrine = doctrine_gender_male_dominated } + } + AND = { + is_female = yes + faith = { has_doctrine = doctrine_gender_female_dominated } + } + NOR = { + faith = { has_doctrine = doctrine_gender_male_dominated } + faith = { has_doctrine = doctrine_gender_female_dominated } + } + } + } + alternative_limit = { + this.faith = scope:the_faith + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + this = root + } + } + save_scope_as = ghw_claimant + } + } + scope:the_faith.great_holy_war = { + set_designated_winner = scope:ghw_claimant + } + } + else = { #Else leave Open: the Recepient of the top contributor gets it. + scope:the_faith.great_holy_war = { + reset_designated_winner = yes + } + } +} + +undirected_ghw_recipient_selection_on_victory_effect = { #Set in the event of no Recipient or Beneficiary when a Crusade is won. + #Prioritize Holder of the target_kingdom. + #Then Claimants of the target_kingdom. + #And so forth... + if = { #The Kingdom is held by a member of the Faith, the Crusade is attempting to restore some of its provinces. + limit = { + exists = scope:target_kingdom + exists = scope:target_kingdom.holder + exists = scope:the_faith.great_holy_war + scope:target_kingdom.holder = { + faith = scope:the_faith + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + } + } + } + scope:target_kingdom.holder = { + save_scope_as = title_recipient + } + scope:the_faith.great_holy_war = { + set_designated_winner = scope:title_recipient + } + } + else_if = { #Claimants of the King-title belonging to the Faith exist. + limit = { + exists = scope:target_kingdom + exists = scope:the_faith.great_holy_war + scope:target_kingdom = { + any_claimant = { + faith = scope:the_faith + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + } + } + } + } + scope:target_kingdom = { + random_claimant = { + limit = { + faith = scope:the_faith + is_adult = yes + has_trait = zealous + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + } + OR = { + AND = { + is_female = no + faith = { has_doctrine = doctrine_gender_male_dominated } + } + AND = { + is_female = yes + faith = { has_doctrine = doctrine_gender_female_dominated } + } + NOR = { + faith = { has_doctrine = doctrine_gender_male_dominated } + faith = { has_doctrine = doctrine_gender_female_dominated } + } + } + reverse_opinion = { + target = scope:ghw_sponsor + value >= 0 + } + } + alternative_limit = { + this.faith = scope:the_faith + is_adult = yes + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + } + OR = { + AND = { + is_female = no + faith = { has_doctrine = doctrine_gender_male_dominated } + } + AND = { + is_female = yes + faith = { has_doctrine = doctrine_gender_female_dominated } + } + NOR = { + faith = { has_doctrine = doctrine_gender_male_dominated } + faith = { has_doctrine = doctrine_gender_female_dominated } + } + } + reverse_opinion = { + target = scope:ghw_sponsor + value >= 0 + } + } + alternative_limit = { + this.faith = scope:the_faith + is_adult = yes + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + } + OR = { + AND = { + is_female = no + faith = { has_doctrine = doctrine_gender_male_dominated } + } + AND = { + is_female = yes + faith = { has_doctrine = doctrine_gender_female_dominated } + } + NOR = { + faith = { has_doctrine = doctrine_gender_male_dominated } + faith = { has_doctrine = doctrine_gender_female_dominated } + } + } + } + alternative_limit = { + this.faith = scope:the_faith + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + } + OR = { + AND = { + is_female = no + faith = { has_doctrine = doctrine_gender_male_dominated } + } + AND = { + is_female = yes + faith = { has_doctrine = doctrine_gender_female_dominated } + } + NOR = { + faith = { has_doctrine = doctrine_gender_male_dominated } + faith = { has_doctrine = doctrine_gender_female_dominated } + } + } + } + alternative_limit = { + this.faith = scope:the_faith + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + } + } + save_scope_as = title_recipient + } + } + scope:the_faith.great_holy_war = { + set_designated_winner = scope:title_recipient + } + } + else_if = { #If truly no character is available, just pick a random faithful. + limit = { + exists = scope:ghw_sponsor + exists = scope:the_faith.great_holy_war + scope:ghw_sponsor = { + any_courtier = { + is_adult = yes + is_ai = yes + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + } + faith = scope:the_faith + } + } + } + scope:ghw_sponsor = { + random_courtier = { + limit = { + has_character_flag = flag_is_ghw_fallback_recipient + is_adult = yes + is_ai = yes + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + } + faith = scope:the_faith + } + alternative_limit = { + scope:the_faith = { has_doctrine = doctrine_gender_male_dominated } + is_female = no + is_adult = yes + is_ai = yes + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + } + faith = scope:the_faith + } + alternative_limit = { + scope:the_faith = { has_doctrine = doctrine_gender_female_dominated } + is_female = yes + is_adult = yes + is_ai = yes + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + } + faith = scope:the_faith + } + alternative_limit = { + is_adult = yes + is_ai = yes + NOR = { + has_trait = excommunicated + has_trait = incapable + has_trait = devoted + } + faith = scope:the_faith + } + save_scope_as = title_recipient + } + } + scope:the_faith.great_holy_war = { + set_designated_winner = scope:title_recipient + } + } +} + +# SECRET FAITH EFFECTS + +# When someone is made to change their faith, find out which of their spouses/family will also convert. +# +# Expects: +# scope:recipient - who's spouses/family may also convert. +# +# Returns: +# List 'spouses_and_family_to_convert' - grabbed characters. +# +grab_spouses_and_family_to_convert_effect = { + scope:recipient = { + # Add yourself + add_to_list = spouses_and_family_to_convert + add_character_flag = spouse_or_family_to_convert + # Spouses convert + every_spouse = { + limit = { + OR = { + is_courtier_of = scope:actor + is_courtier_of = scope:recipient + is_vassal_of = scope:actor + is_vassal_of = scope:recipient + } + NOT = { has_character_flag = spouse_or_family_to_convert } + } + add_to_list = spouses_and_family_to_convert + add_character_flag = spouse_or_family_to_convert + } + # Family in recipient's court also convert + if = { + limit = { + is_ruler = yes + } + every_close_or_extended_family_member = { + custom = all_family_members_at_court + limit = { + employer ?= scope:recipient + faith = scope:recipient.faith + faith != scope:actor.faith + is_ai = yes + NOT = { has_character_flag = spouse_or_family_to_convert } + # Don't add the recipient twice + #root != scope:recipient + } + add_to_list = spouses_and_family_to_convert + add_character_flag = spouse_or_family_to_convert + } + } + } + every_in_list = { + list = spouses_and_family_to_convert + remove_character_flag = spouse_or_family_to_convert + } +} + +# Default conversion effect; allows the recipient to demure whether to keep a secret faith or not +demand_conversion_interaction_effect = { + + # Reward conversion + scope:actor = { mandala_converter_piety_effect = yes } + + # Grab additional converters, and present them in the tooltip. + grab_spouses_and_family_to_convert_effect = yes + show_as_tooltip = { + convert_family_to_faith_effect = { + FALSE_CONVERSION = no + FORCED = yes + } + } + every_in_list = { + list = spouses_and_family_to_convert + # Don't say that people can convert when you know they can't + if = { + limit = { + faith = scope:recipient.faith + NOT = { has_crypto_religionist_secret_known_by_character_trigger = { CHARACTER = scope:actor } } + NOT = { exists = secret_faith } + } + custom_tooltip = ask_for_conversion_interaction_accept_tooltip + } + } + + # Fire event that handles actual conversion. + scope:recipient = { + trigger_event = false_conversion.0900 + } +} + +# Switch a character to the specified faith and keep their old faith as a secret (or not) +# Assumes that spouses and family to convert have already been grabbed +convert_family_to_faith_effect = { + every_in_list = { + list = spouses_and_family_to_convert + # Make crypto-religionists of them, if applicable + if = { + limit = { + $FALSE_CONVERSION$ = yes + faith = scope:recipient.faith + } + scope:recipient.faith = { save_temporary_scope_as = old_faith } + set_character_faith = scope:actor.faith + make_character_crypto_religionist_effect = { CRYPTO_RELIGION = scope:old_faith } + # Grab the character's recently added crypto secret + if = { + limit = { + any_secret = { type = secret_crypto_religionist } + exists = secret_faith + # Ignore the crypto secret if it's not new + # This prevents the edge case of family members finding out about other family's different crypto faiths + secret_faith = scope:old_faith + } + random_secret = { + type = secret_crypto_religionist + save_scope_as = crypto_religionist_secret + } + } + # Make the secret known to all other family members + every_in_list = { + list = spouses_and_family_to_convert + if = { + limit = { + exists = scope:crypto_religionist_secret + prev != this + } + scope:crypto_religionist_secret = { + reveal_to_without_events_effect = { CHARACTER = prev } + } + } + } + } + else = { + set_character_faith = scope:actor.faith + } + if = { + limit = { + $FORCED$ = yes + } + hidden_effect = { + add_character_flag = { + flag = converted_by_forced_conversion_interaction + years = 5 + } + } + } + } + + scope:recipient = { + bastard_to_wild_oat_conversion_interaction_effect = yes + } + + # Struggle Catalysts. + if = { + limit = { + scope:recipient = { is_important_or_vip_struggle_character = yes } + scope:actor = { + any_character_struggle = { + involvement = involved + activate_struggle_catalyst_secondary_character_involvement_involved_trigger = { + CATALYST = catalyst_demanding_important_conversion + CHAR = scope:recipient + } + } + } + } + scope:actor = { + every_character_struggle = { + involvement = involved + limit = { + activate_struggle_catalyst_secondary_character_involvement_involved_trigger = { + CATALYST = catalyst_demanding_important_conversion + CHAR = scope:recipient + } + } + activate_struggle_catalyst = { + catalyst = catalyst_demanding_important_conversion + character = scope:actor + } + } + } + } +} + +make_character_crypto_religionist_effect = { + if = { + limit = { + NOR = { + any_secret = { type = secret_crypto_religionist } + exists = secret_faith + $CRYPTO_RELIGION$ = faith + } + } + hidden_effect = { set_character_secret_faith = $CRYPTO_RELIGION$ } + add_secret = { + type = secret_crypto_religionist + } + } +} + +make_county_crypto_religionists_effect = { + set_variable = { + name = false_convert + value = $FAITH$ + days = 18250 + } + add_county_modifier = { + modifier = false_convert_modifier + years = 50 + } +} + +# Makes the target a crypto-religionist of the root's faith and exposes both secrets to one another +# Owner_Crypto_Secret needs to be already scoped before calling this effect +spread_crypto_religion_to_target_effect = { + $TARGET$ = { + if = { + limit = { + NOT = { + any_secret = { type = secret_crypto_religionist } + } + } + + make_character_crypto_religionist_effect = { CRYPTO_RELIGION = scope:owner.secret_faith } + random_secret = { + type = secret_crypto_religionist + reveal_to_without_events_effect = { CHARACTER = root } + } + if = { + limit = { + NOT = { scope:owner_crypto_secret = { is_known_by = $TARGET$ } } + } + scope:owner_crypto_secret = { + reveal_to_without_events_effect = { CHARACTER = $TARGET$ } + } + } + } + } +} + +child_secret_faith_conversion_success_effect = { + scope:child = { + make_character_crypto_religionist_effect = { + CRYPTO_RELIGION = scope:guardian.secret_faith + } + } + # Notify the actor + scope:guardian = { + send_interface_message = { + type = event_religious_good + title = secret_faith.1001.message + left_icon = scope:child + scope:child = { + random_secret = { + type = secret_crypto_religionist + limit = { + NOT = { is_known_by = scope:guardian } + } + reveal_to = scope:guardian + } + add_opinion = { + target = PREV + modifier = impressed_opinion + opinion = 20 + } + } + random_secret = { + type = secret_crypto_religionist + limit = { + NOT = { is_known_by = scope:child } + } + reveal_to = scope:child + } + } + } +} + +child_secret_faith_conversion_failure_effect = { + scope:guardian = { + send_interface_toast = { + title = child_secret_faith_conversion_failure_effect.desc + left_icon = scope:child + scope:child = { + add_opinion = { + target = scope:guardian + modifier = suspicion_opinion + opinion = -15 + } + } + } + scope:guardian = { + if = { + limit = { this = root } + hidden_effect = { + add_opinion = { + target = scope:child + modifier = disappointed_opinion + opinion = -15 + } + } + } + else = { + add_opinion = { + target = scope:child + modifier = disappointed_opinion + opinion = -15 + } + } + } + } +} + +child_secret_faith_conversion_critical_failure_effect = { + hidden_effect = { + # Save and reveal secret + scope:guardian = { + random_secret = { + type = secret_crypto_religionist + save_scope_as = guardian_secret_faith_secret + if = { + limit = { NOT = { is_known_by = scope:child } } + reveal_to = scope:child + } + } + } + scope:child = { + # Inform the child's liege if relevant + if = { + limit = { + is_ruler = yes + NOR = { + liege = this + liege ?= scope:guardian + } + } + liege = { + send_interface_message = { + type = event_religious_neutral + title = child_secret_faith_conversion_critical_failure_effect.liege.desc + left_icon = scope:child + right_icon = scope:guardian + show_as_tooltip = { + scope:guardian_secret_faith_secret = { expose_secret = scope:child } + scope:child = { + add_opinion = { + target = scope:guardian + modifier = hate_opinion + opinion = -30 + } + } + } + } + } + } + } + } + scope:child = { + # Inform the child + send_interface_toast = { + type = event_religious_neutral + title = child_secret_faith_conversion_critical_failure_effect.desc + left_icon = scope:child + right_icon = scope:guardian + scope:guardian_secret_faith_secret = { expose_secret = scope:child } + add_opinion = { + target = scope:guardian + modifier = hate_opinion + opinion = -30 + } + } + } + scope:guardian = { + if = { + limit = { this = root } + hidden_effect = { + add_opinion = { + target = scope:child + modifier = hate_opinion + opinion = -30 + } + } + } + else = { + add_opinion = { + target = scope:child + modifier = hate_opinion + opinion = -30 + } + } + } +} + +new_faith_created_conversion_effect = { + # Convert Capital (if of same faith as recipient's old faith) + if = { + limit = { + scope:recipient = { + is_playable_character = yes + highest_held_title_tier > tier_barony + capital_county.faith = scope:recipient.faith + } + } + scope:recipient.capital_county = { + set_county_faith = scope:actor.faith + } + } + + # Convert family to new faith + grab_spouses_and_family_to_convert_effect = yes + convert_family_to_faith_effect = { + FALSE_CONVERSION = no + FORCED = yes + } +} + +adopt_religion_interaction_effect = { + # Convert Capital (if of same faith as recipient's old faith) + if = { + limit = { + scope:actor = { + highest_held_title_tier > tier_barony + capital_county.faith != scope:recipient.faith + } + } + scope:actor.capital_county = { + set_county_faith = scope:recipient.faith + } + } + + # Spouses and family adopt new faith + grab_spouses_and_family_to_convert_effect = yes + convert_family_to_faith_effect = { + FALSE_CONVERSION = no + FORCED = no + } +} + +sun_trial_death_effect = { + scope:prisoner = { + death = { + death_reason = death_sun_trial + killer = scope:imprisoner + } + } + + #Opinion penalties + every_close_or_extended_family_member = { + # Non-imprisoner-same-faith family upset that you threw their family out into the desert to die. + limit = { + this != scope:imprisoner + NOT = { faith = scope:imprisoner.faith } + } + custom = sun_trial_interaction.non_faith_family + add_opinion = { + target = scope:imprisoner + modifier = executed_close_family + } + } +} + +sun_trial_survival_effect = { + scope:prisoner = { + release_from_prison = yes + + # Non-imprisoner-same-faith are upset that you threw them out into the desert to die. + if = { + limit = { + NAND = { + faith = scope:imprisoner.faith + ai_zeal >= low_positive_ai_value + } + } + add_opinion = { + target = scope:imprisoner + modifier = angry_opinion + opinion = -40 + } + } + + # imprisoner-same-faith gain a bonus if they survive the sun trial. + if = { + limit = { + faith = scope:imprisoner.faith + } + add_character_modifier = { + modifier = blessed_by_the_sun_modifier + years = 15 + } + } + + # Don't notify the player that they were released from prison (they were already released as part of the interaction). + hidden_effect = { + add_character_flag = { + flag = block_for_prison_release_notification + days = 3 + } + } + } + scope:imprisoner = { + consume_imprisonment_reasons = scope:prisoner + hidden_effect = { + consume_imprisonment_reasons = scope:prisoner + consume_banish_reasons = scope:prisoner + consume_execute_reasons = scope:prisoner + consume_revoke_title_reason = scope:prisoner + } + } +} + +humsacd_a_hof_effect = { + if = { + limit = { + $SACRIFICER$.faith = { has_doctrine_parameter = human_sacrifice_active } + $SACRIFICED_HOF$.faith = { + religious_head = $SACRIFICED_HOF$ + NOT = { has_doctrine_parameter = human_sacrifice_active } + } + } + $SACRIFICER$ = { + # Save scopes for future events. + save_scope_as = sacrificer + # Forever tarnished to members of the faith. + add_to_variable_list = { + name = humsacd_hofs + target = $SACRIFICED_HOF$.faith + } + } + # Give $SACRIFICED_HOF$'s faith some fervour for this atrocity. + $SACRIFICED_HOF$ = { + # Save scopes for future events. + save_scope_as = sacrificed_hof + # Up fervour. + faith = { + change_fervor = { + value = hof_humsacd_fervour_gain + desc = fervor_sacrificed_our_head_of_faith + } + } + # Martyr the HoF explicitly if possible. + if = { + limit = { + OR = { + has_bad_nickname = yes + has_any_nickname = no + } + } + give_nickname = nick_the_martyr + } + } + # Inform players of the consequences. + ## Scope:sacrificer is now cheaper to holy war if they're a separate faith. + if = { + limit = { + scope:sacrificer.faith != scope:sacrificed_hof.faith + } + every_player = { + limit = { faith = scope:sacrificed_hof.faith } + trigger_event = fp1_other_decisions.0021 + } + } + # Inform scope:sacrificer about any consequences if appropriate. + scope:sacrificer = { + # ... Eventually. + if = { + limit = { + faith != scope:sacrificed_hof.faith + } + trigger_event = { + id = fp1_other_decisions.0022 + months = 1 + } + } + } + } +} + +give_piety_for_clinging_to_state_faith_effect = { + if = { + limit = { top_liege.primary_title.state_faith ?= scope:recipient.faith } + add_piety = 200 + } +} + +revel_in_pain_effect = { + #Get both rewards + if = { + limit = { has_trait = flagellant } + add_stress = medium_stress_loss + add_piety = major_piety_value + } + #Only Piety + else = { add_piety = major_piety_value } + + #Not already flagellant? + if = { + limit = { + NOT = { has_trait = flagellant } + } + random = { + chance = 20 + add_trait = flagellant + add_stress = medium_stress_loss + } + } + + increase_wounds_effect = { REASON = whipping } +} + +revel_in_pain_opinion_effect = { + if = { + limit = { this = scope:actor } + scope:actor = { + if = { + limit = { is_ai = yes } + add_opinion = { + modifier = attempted_transcendence_together_opinion + target = scope:recipient + opinion = 20 + } + } + } + } + if = { + limit = { this = scope:recipient } + scope:recipient = { + if = { + limit = { is_ai = yes } + add_opinion = { + modifier = attempted_transcendence_together_opinion + target = scope:actor + opinion = 20 + } + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_roaming_effects.txt b/N3OW/common/scripted_effects/00_roaming_effects.txt new file mode 100644 index 00000000..51056a6d --- /dev/null +++ b/N3OW/common/scripted_effects/00_roaming_effects.txt @@ -0,0 +1,145 @@ +################### +# Roaming Effects # +################### + +roaming_fame_reward_APA_effect = { + if = { + limit = { + has_perk = roaming_perk + } + custom_tooltip = roaming_fame_$REWARD$_tt + add_prestige_experience = { value = roaming_reward_fame_$REWARD$ } + roaming_tally_variable_effect = { TYPE = fame VALUE = roaming_reward_fame_$REWARD$ } + } +} + +roaming_stress_reward_APA_effect = { + add_stress = $REWARD$ + roaming_tally_variable_effect = { TYPE = stress VALUE = $REWARD$ } +} + +roaming_gold_reward_APA_effect = { + add_gold = $REWARD$ + roaming_tally_variable_effect = { TYPE = gold VALUE = $REWARD$ } +} + +roaming_mystic_xp_APA_effect = { + if = { + limit = { + has_trait = lifestyle_mystic + } + add_trait_xp = { + trait = lifestyle_mystic + value = $REWARD$ + } + roaming_tally_variable_effect = { TYPE = mystic_xp VALUE = $REWARD$ } + } +} + +roaming_tally_variable_effect = { + if = { + limit = { + has_variable = roaming_tally_$TYPE$ + } + change_variable = { + name = roaming_tally_$TYPE$ + add = $VALUE$ + } + } + else = { + set_variable = { + name = roaming_tally_$TYPE$ + value = $VALUE$ + } + } +} + +roaming_pondering_stone_effect = { + involved_activity = { + add_activity_log_entry = { + key = roaming_pondering_stone_key + tags = { activity_log } + character = scope:host + root = { + send_interface_toast = { + title = bp3_roaming.0100.a.flavor + add_character_modifier = { + modifier = pondering_$TYPE$_modifier + years = 5 + } + } + } + } + } +} + +roaming_tally_stress_impact_effect = { + if = { + limit = { + has_trait = $TRAIT$ + } + roaming_tally_variable_effect = { TYPE = stress VALUE = $VALUE$ } + } +} + +roaming_fame_reward_event_effect = { + if = { + limit = { + has_perk = roaming_perk + } + save_scope_value_as = { + name = fame_value + value = $VALUE$ + } + custom_tooltip = { + text = roaming_fame_reward_tt + add_prestige_experience = $VALUE$ + } + roaming_tally_variable_effect = { TYPE = fame VALUE = $VALUE$ } + } +} + +roaming_progress_events_reward_effect = { + involved_activity = { + add_activity_log_entry = { + key = $LOG_KEY$ + tags = { activity_log } + character = root + root = { + if = { + limit = { + has_activity_intent = roaming_storyteller_intent + } + roaming_fame_reward_event_effect = { VALUE = roaming_reward_fame_small } + } + else_if = { + limit = { + exists = scope:special_guest + has_activity_intent = roaming_befriend_intent + } + scope:special_guest = { + reverse_add_opinion = { + modifier = friendliness_opinion + target = root + opinion = 15 + } + roaming_tally_variable_effect = { TYPE = opinion VALUE = 10 } + } + root = { + reverse_add_opinion = { + modifier = friendliness_opinion + target = scope:special_guest + opinion = 15 + } + roaming_tally_variable_effect = { TYPE = opinion VALUE = 10 } + } + } + else = { + stress_impact = { base = miniscule_stress_impact_loss } + roaming_tally_variable_effect = { TYPE = stress VALUE = miniscule_stress_impact_loss } + } + } + } + } +} + diff --git a/N3OW/common/scripted_effects/00_romance_effects.txt b/N3OW/common/scripted_effects/00_romance_effects.txt new file mode 100644 index 00000000..71766b81 --- /dev/null +++ b/N3OW/common/scripted_effects/00_romance_effects.txt @@ -0,0 +1,1208 @@ + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! + +#casual_sex_or_lover_event_effect - triggers an event about two characters after they've had sex to determine if it was just casual or if there's something more going on + +##################################################################### +# EFFECTS +##################################################################### + +love_letter_calculation_effect = { + hidden_effect = { + save_scope_as = letterAuthor + duel = { + skill = diplomacy + value = 10 + 25 = { + compare_modifier = { + value = scope:duel_value + } + set_variable = { + name = love_letter_quality + value = 4 + } + } + 25 = { + compare_modifier = { + value = scope:duel_value + } + set_variable = { + name = love_letter_quality + value = 3 + } + } + 25 = { + set_variable = { + name = love_letter_quality + value = 2 + } + } + 25 = { + compare_modifier = { + value = scope:duel_value + multiplier = -0.5 + } + set_variable = { + name = love_letter_quality + value = 1 + } + } + } + } +} + +lover_activity_set_variable_effect = { + hidden_effect = { + random_list = { + 10 = { #No trigger, always available + modifier = { + OR = { + has_trait = lifestyle_herbalist + has_trait = shy + } + factor = 5 + } + set_variable = { + name = lover_activity + value = flag:garden_walk + days = 1 + } + } + 10 = { #No trigger, always available + modifier = { + OR = { + has_trait = gregarious + has_trait = gluttonous + } + factor = 5 + } + set_variable = { + name = lover_activity + value = flag:dinner + days = 1 + } + } + 10 = { #No trigger, always available + modifier = { + has_trait = greedy + factor = 5 + } + set_variable = { + name = lover_activity + value = flag:buy_gift + days = 1 + } + } + 10 = { + trigger = { + NOR = { + has_trait = shy + has_trait = callous + has_trait = sadistic + } + NOT = { PREV = { has_trait = shy } } + } + modifier = { + OR = { + has_trait = diplomat + has_trait = gregarious + } + factor = 5 + } + set_variable = { + name = lover_activity + value = flag:social_events + days = 1 + } + } + 10 = { + trigger = { + PREV = { stewardship > 10 } + NOT = { has_trait = greedy } + NOT = { PREV = { has_trait = generous } } + } + set_variable = { + name = lover_activity + value = flag:play_games + days = 1 + } + } + 5 = { + trigger = { + NOR = { + has_trait = shy + has_trait = temperate + } + NOT = { PREV = { has_trait = temperate } } + } + modifier = { + OR = { + has_trait = lifestyle_reveler + has_trait = drunkard + } + factor = 10 + } + set_variable = { + name = lover_activity + value = flag:drink + days = 1 + } + } + 10 = { + trigger = { + NOR = { + has_trait = craven + has_trait = physique_bad_1 + has_trait = physique_bad_2 + has_trait = physique_bad_3 + } + PREV = { + NOR ={ + has_trait = craven + has_trait = physique_bad_1 + has_trait = physique_bad_2 + has_trait = physique_bad_3 + } + } + } + modifier = { + has_trait = lifestyle_hunter + factor = 5 + } + set_variable = { + name = lover_activity + value = flag:go_hunting + days = 1 + } + } + 10 = { + trigger = { + NOR = { + has_trait = cynical + has_trait = impatient + } + PREV = { + NOR = { + has_trait = cynical + has_trait = impatient + } + } + } + set_variable = { + name = lover_activity + value = flag:stargaze + days = 1 + } + } + 10 = { + trigger = { + NOT = { has_trait = humble } + } + modifier = { + has_trait = arrogant + factor = 5 + } + set_variable = { + name = lover_activity + value = flag:flatter + days = 1 + } + } + 10 = { + trigger = { + NOT = { + has_trait = cynical + } + PREV = { NOT = { has_trait = cynical } } + religion = PREV.religion + } + modifier = { + has_trait = zealous + factor = 5 + } + set_variable = { + name = lover_activity + value = flag:talk_about_god + days = 1 + } + } + 10 = { + trigger = { + NOR = { + has_trait = craven + has_trait = physique_bad_1 + has_trait = physique_bad_2 + has_trait = physique_bad_3 + } + PREV = { + NOR ={ + has_trait = craven + has_trait = physique_bad_1 + has_trait = physique_bad_2 + has_trait = physique_bad_3 + } + } + } + modifier = { + has_trait = brave + factor = 5 + } + set_variable = { + name = lover_activity + value = flag:go_adventuring + days = 1 + } + } + 10 = { + trigger = { + NOT = { has_trait = cynical } + PREV = { NOT = { has_trait = cynical } } + } + modifier = { + OR = { + has_trait = family_first + has_trait = gregarious + has_trait = ambitious + has_trait = pregnant + } + factor = 5 + } + set_variable = { + name = lover_activity + value = flag:talk_about_future + days = 1 + } + } + 10 = { + trigger = { + NOT = { + has_trait = calm + } + OR = { + opinion = { target = PREV value < 15 } + reverse_opinion = { target = PREV value < 15 } + has_trait = wrathful + } + PREV = { NOT = { has_trait = calm } } + } + modifier = { + OR = { + opinion = { target = PREV value < 0 } + reverse_opinion = { target = PREV value < 0 } + has_trait = wrathful + } + factor = 5 + } + set_variable = { + name = lover_activity + value = flag:fight + days = 1 + } + } + 10 = { + trigger = { + OR = { + learning = 12 + has_trait = scholar + } + PREV = { learning = 10 } + } + modifier = { + has_trait = scholar + factor = 5 + } + set_variable = { + name = lover_activity + value = flag:discuss_books + days = 1 + } + } + 10 = { + trigger = { + NOR = { + has_trait = celibate + has_trait = chaste + } + PREV = { + NOR = { + has_trait = celibate + has_trait = chaste + } + } + } + modifier = { + OR = { + has_trait = seducer + has_trait = lustful + has_trait = deviant + } + factor = 5 + } + set_variable = { + name = lover_activity + value = flag:lovemaking + days = 1 + } + } + } + } +} + +lover_activity_remove_flag_effect = { + +} + + + + +had_sex_with_effect = { + save_scope_as = had_sex_root_character + $CHARACTER$ = { save_scope_as = had_sex_with_effect_partner } + + # Error logging + ## Children should never run this effect. + if = { + limit = { + OR = { + scope:had_sex_root_character = { is_adult = no } + scope:had_sex_with_effect_partner = { is_adult = no } + } + } + error_log = "Trying to run had_sex_with_effect but one or more partners is a child" + } + ## Did you forget to run the check for whether adultery was valid? + if = { + limit = { + # Rarely, we may also want to block this check (e.g., seduction schemes or monogamous threesomes). + NOT = { exists = scope:ignore_cheating_error_check } + } + # Check whether the root char is cheating. + if = { + limit = { + scope:had_sex_root_character = { + NOR = { + is_consort_of = scope:had_sex_with_effect_partner + has_relation_lover = scope:had_sex_with_effect_partner + } + might_cheat_on_every_partner_trigger = no + } + } + # The weird structure here is so that we can use prev scope in loc to grab both chars. + scope:had_sex_with_effect_partner = { + scope:had_sex_root_character = { error_log = had_sex_with_effect.log.root_cheated_inappropriately } + } + } + # Check whether their partner is cheating. + ## Though this does lead to potential duplication in the error log, where you'll get an entry for X cheating with Y _and_ for Y cheating with X, it is necessary: it's perfectly possible for one char to be cheating but the other not. + if = { + limit = { + scope:had_sex_with_effect_partner = { + NOR = { + is_consort_of = scope:had_sex_root_character + has_relation_lover = scope:had_sex_root_character + } + might_cheat_on_every_partner_trigger = no + } + } + # The weird structure here is so that we can use prev scope in loc to grab both chars. + scope:had_sex_root_character = { + scope:had_sex_with_effect_partner = { error_log = had_sex_with_effect.log.target_cheated_inappropriately } + } + } + } + ### Plus, remove the blocking scope we might have. + clear_saved_scope = ignore_cheating_error_check + + if = { + limit = { this = root } + custom_tooltip = had_sex_with_effect.first_person.tt + } + else_if = { + limit = { root = scope:had_sex_with_effect_partner } + custom_tooltip = had_sex_with_effect.other_person.tt + } + else = { + custom_tooltip = had_sex_with_effect.third_person.tt + } + + create_character_memory = { + type = had_sex + participants = { + sex_partner = scope:had_sex_with_effect_partner + } + } + + #Stress + if = { + limit = { # For use with events that add/remove more stress than these values, to avoid ugly tooltips + NOT = { + has_character_flag = no_sex_stress_loss + } + } + $CHARACTER$ = { + if = { + limit = { this = root } + stress_impact = { + lustful = minor_stress_impact_loss + rakish = minor_stress_impact_loss + } + } + else = { + hidden_effect = { + stress_impact = { + lustful = minor_stress_impact_loss + rakish = minor_stress_impact_loss + } + } + } + } + if = { + limit = { this = root } + stress_impact = { + lustful = minor_stress_impact_loss + rakish = minor_stress_impact_loss + } + } + else = { + hidden_effect = { + stress_impact = { + lustful = minor_stress_impact_loss + rakish = minor_stress_impact_loss + } + } + } + } + + #Pregnancy & story cycles + hidden_effect = { + if = { + limit = { + is_female = yes + $CHARACTER$ = { is_male = yes } + possible_pregnancy_after_sex_with_character_trigger = { CHARACTER = scope:had_sex_with_effect_partner } + } + add_to_variable_list = { + name = potential_father_variable_list + target = $CHARACTER$ + } + random = { + chance = $PREGNANCY_CHANCE$ + make_pregnant = { + father = $CHARACTER$ + } + } + if = { + limit = { + is_ai = no + NOT = { has_character_flag = had_story_cycle_peasant_affair } + is_ruler = yes + $CHARACTER$ = { + is_lowborn = yes + is_playable_character = no + is_courtier = no + } + NOT = { + any_scheme = { + scheme_target_character = $CHARACTER$ + } + } + } + set_variable = { + name = story_peasant_affair_target + value = $CHARACTER$ + } + create_story = story_peasant_affair + } + } + else_if = { + limit = { + is_male = yes + $CHARACTER$ = { is_female = yes } + possible_pregnancy_after_sex_with_character_trigger = { CHARACTER = scope:had_sex_with_effect_partner } + } + $CHARACTER$ = { + add_to_variable_list = { + name = potential_father_variable_list + target = scope:had_sex_root_character + } + } + if = { + limit = { + is_ai = no + NOT = { has_character_flag = had_story_cycle_peasant_affair } + is_ruler = yes + $CHARACTER$ = { + is_lowborn = yes + is_playable_character = no + is_courtier = no + } + NOT = { + any_scheme = { + scheme_target_character ?= $CHARACTER$ + } + } + } + set_variable = { + name = story_peasant_affair_target + value = $CHARACTER$ + } + $CHARACTER$ = { + if = { + limit = { + is_pregnant = no + fertility >= 0.1 + is_visibly_fertile = yes + } + random = { + chance = $PREGNANCY_CHANCE$ + add_character_flag = { + flag = peasant_is_pregnant + days = 560 + } + } + } + } + create_story = story_peasant_affair + } + else = { + $CHARACTER$ = { + random = { + chance = $PREGNANCY_CHANCE$ + make_pregnant = { + father = scope:had_sex_root_character + } + } + } + } + } + + #STD transmission + risk_of_std_from_effect = { PARTNER = $CHARACTER$ } + hidden_effect = { + $CHARACTER$ = { risk_of_std_from_effect = { PARTNER = scope:had_sex_root_character } } + } + + #Adultery suspicion + hidden_effect = { + if = { + limit = { + OR = { + is_married = yes + is_concubine = yes + } + NOR = { + any_consort = { this = $CHARACTER$ } + AND = { + house.house_head ?= this + house ?= { has_house_power_parameter = aspect_of_creation } + } + } + } + set_variable = { + name = had_recent_sex_with + value = $CHARACTER$ + days = 1000 + } + random = { + chance = 50 #This should be quite high as there is a chance that adultery.0001 "fails" i.e. spouse doesn't realize + every_relation = { + type = soulmate + limit = { + NOT = { this = $CHARACTER$ } #Soulmates should not grow suspicous of adulterous affairs after sleeping with their lover + } + add_to_temporary_list = partners_1 + } + every_consort = { + add_to_temporary_list = partners_1 + } + random_in_list = { + list = partners_1 + limit = { is_ai = no } + alternative_limit = { always = yes } + trigger_event = { + id = adultery.0001 + days = { 14 365 } + } + } + } + } + $CHARACTER$ = { + if = { + limit = { + OR = { + is_married = yes + is_concubine = yes + } + NOR = { + any_consort = { this = scope:had_sex_root_character } + AND = { + house.house_head ?= this + house ?= { has_house_power_parameter = aspect_of_creation } + } + } + } + set_variable = { + name = had_recent_sex_with + value = scope:had_sex_root_character + days = 1000 + } + random = { + chance = 50 #This should be quite high as there is a chance that adultery.0001 "fails" i.e. spouse doesn't realize + every_relation = { + type = soulmate + limit = { + this != scope:had_sex_root_character #Soulmates should not grow suspicous of adulterous affairs after sleeping with their lover + } + add_to_temporary_list = partners_2 + } + every_consort = { + add_to_temporary_list = partners_2 + } + random_in_list = { + list = partners_2 + limit = { is_ai = no } + alternative_limit = { always = yes } + trigger_event = { + id = adultery.0001 + days = { 14 365 } + } + } + } + } + } + } + + #Incestuous Relations + give_incest_secret_or_nothing_with_target_effect = { CHARACTER = $CHARACTER$ } + hidden_effect = { + $CHARACTER$ = { give_incest_secret_or_nothing_with_target_effect = { CHARACTER = scope:had_sex_root_character } } + } + + #Homosexuality + give_homosexual_secret_or_nothing_with_target_effect = { CHARACTER = $CHARACTER$ } + hidden_effect = { + $CHARACTER$ = { give_homosexual_secret_or_nothing_with_target_effect = { CHARACTER = scope:had_sex_root_character } } + } + } + + #Violet Poet trait + if = { + limit = { + scope:had_sex_root_character = { + has_trait = violet_poet + } + } + scope:had_sex_root_character = { + add_trait_xp = { + trait = violet_poet + value = { + integer_range = { + min = 5 + max = 10 + } + } + } + } + } + if = { + limit = { + scope:had_sex_with_effect_partner = { + has_trait = violet_poet + } + } + scope:had_sex_with_effect_partner = { + add_trait_xp = { + trait = violet_poet + value = { + integer_range = { + min = 5 + max = 10 + } + } + } + } + } + + # Achievements + fp2_had_friend_with_benefits = yes # FP2 History's Best Friend +} + +#For having sex with "someone" (not a character) +had_sex_with_unknown_effect = { + save_temporary_scope_value_as = { + name = gender + value = flag:$GENDER$ + } + + #Error logging + if = { + limit = { + is_adult = no + } + error_log = "Trying to run had_sex_with_unknown_effect on a child" + } + + #Stress release + if = { + limit = { + OR = { + has_trait = lustful + has_trait = lifestyle_reveler + } + } + add_stress = minor_stress_loss + } + + #Sodomy + if = { + limit = { scope:gender = flag:male } + give_homosexual_secret_or_nothing_with_target_effect = { CHARACTER = dummy_male } + } + + hidden_effect = { + #Adultery suspicion + set_variable = { + name = had_recent_sex + value = flag:$GENDER$ + } + random = { + chance = 5 + random_spouse = { + limit = { is_ai = no } + alternative_limit = { always = yes } + trigger_event = adultery.0001 + } + } + + #STD transmission + random_list = { + 95 = { + #Nothing + } + 4 = { + contract_disease_notify_effect = { DISEASE = lovers_pox } + } + 1 = { + contract_disease_notify_effect = { DISEASE = great_pox } + } + } + } +} + +#Run in the scope of the character breaking things off +lose_lover_effect = { + if = { + limit = { + has_relation_lover = $LOVER$ + } + remove_relation_lover = $LOVER$ + } + #To clear flags + if = { + limit = { + has_character_flag = can_be_confronted_about_lover_exclusivity + } + remove_character_flag = can_be_confronted_about_lover_exclusivity + } + if = { + limit = { + $LOVER$ = { + has_character_flag = can_be_confronted_about_lover_exclusivity + } + } + $LOVER$ = { + remove_character_flag = can_be_confronted_about_lover_exclusivity + } + } + + #To remove the object of importance if it exists + if = { + limit = { + has_variable_list = lover_object_of_importance + is_target_in_variable_list = { + name = lover_object_of_importance + target = $LOVER$ + } + } + clear_variable_list = lover_object_of_importance + } + else_if = { + limit = { + has_variable_list = lover_object_of_importance_2 + is_target_in_variable_list = { + name = lover_object_of_importance_2 + target = $LOVER$ + } + } + clear_variable_list = lover_object_of_importance_2 + } + else_if = { + limit = { + $LOVER$ = { + has_variable_list = lover_object_of_importance + is_target_in_variable_list = { + name = lover_object_of_importance + target = prev + } + } + } + $LOVER$ = { clear_variable_list = lover_object_of_importance } + } + else_if = { + limit = { + $LOVER$ = { + has_variable_list = lover_object_of_importance_2 + is_target_in_variable_list = { + name = lover_object_of_importance_2 + target = prev + } + } + } + $LOVER$ = { clear_variable_list = lover_object_of_importance_2 } + } +} + + + +#Which one of the two characters do I love the most? +whom_do_i_love_the_most_effect = { + if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER1$ + modifier = love_opinion + value >= 0 + } + has_opinion_modifier = { + target = $CHARACTER2$ + modifier = love_opinion + value >= 0 + } + } + if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER1$ + modifier = love_opinion + value >= 10 + } + has_opinion_modifier = { + target = $CHARACTER2$ + modifier = love_opinion + value >= 10 + } + } + if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER1$ + modifier = love_opinion + value >= 20 + } + has_opinion_modifier = { + target = $CHARACTER2$ + modifier = love_opinion + value >= 20 + } + } + if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER1$ + modifier = love_opinion + value >= 30 + } + has_opinion_modifier = { + target = $CHARACTER2$ + modifier = love_opinion + value >= 30 + } + } + if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER1$ + modifier = love_opinion + value >= 40 + } + has_opinion_modifier = { + target = $CHARACTER2$ + modifier = love_opinion + value >= 40 + } + } + if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER1$ + modifier = love_opinion + value >= 50 + } + has_opinion_modifier = { + target = $CHARACTER2$ + modifier = love_opinion + value >= 50 + } + } + if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER1$ + modifier = love_opinion + value >= 60 + } + has_opinion_modifier = { + target = $CHARACTER2$ + modifier = love_opinion + value >= 60 + } + } + if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER1$ + modifier = love_opinion + value >= 70 + } + has_opinion_modifier = { + target = $CHARACTER2$ + modifier = love_opinion + value >= 70 + } + } + if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER1$ + modifier = love_opinion + value >= 80 + } + has_opinion_modifier = { + target = $CHARACTER2$ + modifier = love_opinion + value >= 80 + } + } + random_list = { + 50 = { + $CHARACTER1$ = { save_scope_as = most_beloved } + } + 50 = { + $CHARACTER2$ = { save_scope_as = most_beloved } + } + } + } + else_if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER1$ + modifier = love_opinion + value >= 80 + } + } + $CHARACTER1$ = { save_scope_as = most_beloved } + } + else_if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER2$ + modifier = love_opinion + value >= 80 + } + } + $CHARACTER2$ = { save_scope_as = most_beloved } + } + } + else_if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER1$ + modifier = love_opinion + value >= 70 + } + } + $CHARACTER1$ = { save_scope_as = most_beloved } + } + else_if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER2$ + modifier = love_opinion + value >= 70 + } + } + $CHARACTER2$ = { save_scope_as = most_beloved } + } + } + else_if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER1$ + modifier = love_opinion + value >= 60 + } + } + $CHARACTER1$ = { save_scope_as = most_beloved } + } + else_if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER2$ + modifier = love_opinion + value >= 60 + } + } + $CHARACTER2$ = { save_scope_as = most_beloved } + } + } + else_if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER1$ + modifier = love_opinion + value >= 50 + } + } + $CHARACTER1$ = { save_scope_as = most_beloved } + } + else_if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER2$ + modifier = love_opinion + value >= 50 + } + } + $CHARACTER2$ = { save_scope_as = most_beloved } + } + } + else_if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER1$ + modifier = love_opinion + value >= 40 + } + } + $CHARACTER1$ = { save_scope_as = most_beloved } + } + else_if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER2$ + modifier = love_opinion + value >= 40 + } + } + $CHARACTER2$ = { save_scope_as = most_beloved } + } + } + else_if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER1$ + modifier = love_opinion + value >= 30 + } + } + $CHARACTER1$ = { save_scope_as = most_beloved } + } + else_if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER2$ + modifier = love_opinion + value >= 30 + } + } + $CHARACTER2$ = { save_scope_as = most_beloved } + } + } + else_if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER1$ + modifier = love_opinion + value >= 20 + } + } + $CHARACTER1$ = { save_scope_as = most_beloved } + } + else_if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER2$ + modifier = love_opinion + value >= 20 + } + } + $CHARACTER2$ = { save_scope_as = most_beloved } + } + } + else_if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER1$ + modifier = love_opinion + value >= 10 + } + } + $CHARACTER1$ = { save_scope_as = most_beloved } + } + else_if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER2$ + modifier = love_opinion + value >= 10 + } + } + $CHARACTER2$ = { save_scope_as = most_beloved } + } + } + else_if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER1$ + modifier = love_opinion + value >= 0 + } + } + $CHARACTER1$ = { save_scope_as = most_beloved } + } + else_if = { + limit = { + has_opinion_modifier = { + target = $CHARACTER2$ + modifier = love_opinion + value >= 0 + } + } + $CHARACTER2$ = { save_scope_as = most_beloved } + } + else = { + random_list = { + 50 = { + $CHARACTER1$ = { save_scope_as = most_beloved } + } + 50 = { + $CHARACTER2$ = { save_scope_as = most_beloved } + } + } + } +} + +casual_sex_or_lover_event_effect = { + $CHARACTER_2$ = { save_scope_as = married_seducer } + $CHARACTER_1$ = { + trigger_event = { + id = yearly.1002 + days = $DAYS$ + } + } +} + + diff --git a/N3OW/common/scripted_effects/00_scheme_scripted_effects.txt b/N3OW/common/scripted_effects/00_scheme_scripted_effects.txt new file mode 100644 index 00000000..8725d791 --- /dev/null +++ b/N3OW/common/scripted_effects/00_scheme_scripted_effects.txt @@ -0,0 +1,16635 @@ +########################## +# Scheme Scripted Effects +########################## + +################################################## +# General Scheme Effects + +try_to_force_assign_character_to_random_agent_slot_effect = { + if = { + limit = { + $CHAR$ = { is_valid_as_agent_in_any_slot = $SCHEME$ } + } + force_assign_character_to_random_agent_slot_effect = { + SCHEME = $SCHEME$ + CHAR = $CHAR$ + YEARS = $YEARS$ + } + } +} + +force_assign_character_to_random_agent_slot_effect = { + $SCHEME$ = { + random_scheme_agent_slot = { + limit = { + is_filled = no + save_temporary_scope_as = slot_temp + $CHAR$ = { is_valid_as_agent_in_slot = scope:slot_temp } + } + save_scope_as = valid_slot + } + } + $CHAR$ = { + force_add_to_agent_slot = { + agent_slot = scope:valid_slot + years = $YEARS$ + } + } +} + +increment_breaches_with_message_effect = { + scope:owner = { + send_interface_toast = { + type = msg_scheme_breached + title = feed_message.t.scheme_breached + left_icon = scope:target + scope:scheme = { add_scheme_breach = 1 } + play_sound_effect = "event:/DLC/EP3/SFX/Stingers/Scheme_Rework/ep3_mx_sting_schemerework_scheme_suffering_breaches" + } + } +} + +################################################## +# Ending Effects + +# What percentage chance is there that a scheme will be discovered per month? +## tl;dr = generally, 10% of 100 - secrecy rating. So if you have 60% secrecy, that's a 4% chance per month. +hostile_scheme_monthly_discovery_chance_effect = { + # If we're in the first X months of a scheme, give a grace period. + if = { + limit = { + has_variable = secrecy_grace_period + var:secrecy_grace_period >= 1 + } + change_variable = { + name = secrecy_grace_period + add = -1 + } + } + # Otherwise we want to start checking for discovery. + else_if = { + # Without a spymaster, you can't discover schemes. + ## This isn't tooltipped for the person doing the scheming: communicating it (and when it turns on, and when it turns off) would be erratic and spammy, so we just let them think they're getting nice'n'lucky. + limit = { + scope:scheme = { + # Character + trigger_if = { + limit = { exists = scheme_target_character.host } + scheme_target_character.host = { save_temporary_scope_as = breach_host_temp } + } + # Title + trigger_else_if = { + limit = { exists = scheme_target_title.holder } + scheme_target_title.holder = { save_temporary_scope_as = breach_host_temp } + } + # Fallback + trigger_else = { always = no } + scope:breach_host_temp ?= { + # Second for Adventurers + trigger_if = { + limit = { has_government = landless_adventurer_government } + court_position:second_camp_officer ?= { save_temporary_scope_as = breach_maker_temp } + } + # Spymaster for everyone else + trigger_else = { + cp:councillor_spymaster ?= { save_temporary_scope_as = breach_maker_temp } + } + } + } + } + # Sort scopes. + ## Vs. titles. + if = { + limit = { exists = scope:target.holder } + scope:target.holder = { save_scope_as = target } + } + ## Vs. characters. + else = { + scope:target = { save_scope_as = target } + } + ## Nab the spymaster too. + scope:breach_maker_temp = { save_scope_as = spymaster } + # Alright, now we roll for discovery. + # Save chance for simple debugging + save_scope_value_as = { + name = discovery_chance + value = monthly_scheme_discovery_chance_value + } + ## ... if scope:target lives at scope:owner's court. + if = { + limit = { + scope:breach_host_temp = scope:owner + scope:owner != scope:target + NOT = { exists = scope:scheme.var:had_self_court_discovery } + } + random = { + chance = scope:discovery_chance + # Either increment breaches. + if = { + limit = { scheme_breaches >= scheme_breaches_about_to_hit_limit_value } + increment_breaches_with_message_effect = yes + } + # Or expose us generally. + else = { + add_scheme_breach = 1 + scheme_owner = { play_sound_effect = "event:/DLC/EP3/SFX/Stingers/Scheme_Rework/ep3_mx_sting_schemerework_scheme_suffering_breaches" } + set_variable = { + name = had_self_court_discovery + value = yes + years = 3 + } + scope:owner = { + if = { + limit = { + scope:scheme = { is_savable_murder_scheme_trigger = yes } + } + trigger_event = hostile_scheme_discovery.4002 + } + else = { trigger_event = hostile_scheme_discovery.4001 } + } + # Flag that we're discovering something so that on-going events don't fire. + save_scope_value_as = { + name = discovery_event_happening + value = yes + } + } + } + } + ## ... otherwise they're at different courts. + else_if = { + limit = { + NOR = { + # You won't expose your own Scheme + scope:owner = scope:target + # Spymaster won't expose their own Scheme + scope:owner = scope:spymaster + # Spymaster won't expose *your* (liege's) Scheme + scope:owner = scope:spymaster.liege + # Spymaster won't expose a scheme if they are an agent of it + ## Secrecy is still relevant, you can still be discovered, just not on the monthly tick. + scheme_is_character_agent = scope:spymaster + } + } + # Roll to see whether we discover something. + random = { + chance = scope:discovery_chance + # If the scheme isn't exposed, then we do that first. + if = { + limit = { is_scheme_exposed = no } + # Increment our breaches. + increment_breaches_with_message_effect = yes + # Fire off an actual warning event. + scope:target_character.host ?= { trigger_event = hostile_scheme_discovery.2001 } + # Flag that we're discovering something so that on-going events don't fire. + save_scope_value_as = { + name = discovery_event_happening + value = yes + } + } + # Else, that means we've hit the limit for the scheme, so we discover and destroy it. + else_if = { + limit = { scheme_breaches >= scheme_breaches_about_to_hit_limit_value } + # Don't forget to increment breaches to max. + add_scheme_breach = 1 + scheme_owner = { play_sound_effect = "event:/DLC/EP3/SFX/Stingers/Scheme_Rework/ep3_mx_sting_schemerework_scheme_suffering_breaches" } + # Fire off the correct event. + scope:target_character.host ?= { trigger_event = hostile_scheme_discovery.1002 } + # Flag that we're discovering something so that on-going events don't fire. + save_scope_value_as = { + name = discovery_event_happening + value = yes + } + } + # Otherwise, we want to discover an agent. + else = { + # Increment our breaches. + increment_breaches_with_message_effect = yes + # And reveal an agent, if we can. + if = { + limit = { + any_scheme_agent_character = { + is_alive = yes + agent_valid_to_be_discovered_by_spymaster = yes + } + } + ordered_scheme_agent_character = { + limit = { + is_alive = yes + agent_valid_to_be_discovered_by_spymaster = yes + } + # Get the least stealthy agent. + order_by = { + value = 100 + subtract = intrigue + } + save_scope_as = agent + } + # If we have a candidate, reveal them. + scope:target_character.host ?= { trigger_event = hostile_scheme_discovery.1001 } + # Flag that we're discovering something so that on-going events don't fire. + save_scope_value_as = { + name = discovery_event_happening + value = yes + } + } + } + } + } + } +} + +# Sort the ending for a scheme. +generic_scheme_process_ending_effect = { + # Grab our scopes. + save_scope_as = scheme + scheme_owner = { save_scope_as = owner } + ## Targets. + scheme_target_character ?= { save_scope_as = target } + scheme_target_culture ?= { save_scope_as = target } + scheme_target_faith ?= { save_scope_as = target } + scheme_target_title ?= { save_scope_as = target } + # Success roll. + random = { + chance = scheme_success_chance + custom_tooltip = $RESULTS_TOOLTIP$ + save_scope_value_as = { + name = scheme_successful + value = yes + } + # Interception saves. + ## Unique saves roll. + ### E.g., your dog flings itself in front of an assassin for you. + if = { + limit = { is_savable_murder_scheme_trigger = yes } + # We use a scripted effect so that mods can overwrite it without overwriting the whole block. + scheme_unique_interception_roll_effect = yes + } + ## Repeatable saves roll. + ### E.g., your bodyguard flings itself in front of an assassin for you. + if = { + limit = { is_savable_murder_scheme_trigger = yes } + random = { + chance = scope:target.scheme_intercept_repeatable_chance_total_value + save_scope_value_as = { + name = interception_repeatable + value = yes + } + } + } + } + # Secrecy roll. + ## We check this after an interception so that, if a successful scheme is intercepted, we can boost its success a little to compensate. + if = { + limit = { is_type_secret = yes } + ## First, determine our secrecy value. + save_scope_value_as = { + name = discovery_chance + value = { + value = 100 + subtract = scheme_secrecy + # Boost this up a bit if the scheme was intercepted. + if = { + limit = { + OR = { + exists = scope:interception_unique + exists = scope:interception_repeatable + } + } + add = -30 + } + # And make sure there's always _some_ risk. + min = 5 + } + } + random = { + chance = scope:discovery_chance + custom_tooltip = scheme_remain_secret_roll_tt + save_scope_value_as = { + name = scheme_discovered + value = yes + } + # Grab an exposer. + if = { + limit = { exists = scope:target.host } + scope:target.host = { save_scope_as = murder_exposer } + } + else = { + scope:target = { save_scope_as = murder_exposer } + } + # Set up assorted cosmetics for murders. + scope:owner = { + # Portraits. + save_scope_as = owner_to_reveal + # Plus a flavour scope we use. + random_memory = { + limit = { + has_memory_category = negative + has_memory_participant = scope:target + NOR = { # These read poorly + has_memory_type = became_rivals + has_memory_type = became_nemesis + } + } + save_scope_as = bad_memory + } + } + } + } + # Process ending on_actions. + ## Scheme intercepted by a unique flag, stopping a killing at the last moment. + if = { + limit = { exists = scope:interception_unique } + scheme_owner = { + trigger_event = { on_action = pick_unique_murder_intercept_on_action } + } + } + ## Scheme intercepted by a repeatable flag, stopping a killing at the last moment. + else_if = { + limit = { exists = scope:interception_repeatable } + scheme_owner = { + trigger_event = { on_action = pick_repeatable_murder_intercept_on_action } + } + } + ## Scheme successful. + else_if = { + limit = { exists = scope:scheme_successful } + # If we have a contract conclusion event to fire, fire it. + if = { + limit = { exists = scope:contract_end_success } + scheme_owner = { + trigger_event = { + saved_event_id = scope:contract_end_success + delayed = yes + } + } + } + task_contract ?= { complete_task_contract = success_standard } + trigger_event = { $SUCCESS_EVENT_TYPE$ = $SUCCESS_EVENT_ID$ } + scheme_owner = { + play_sound_effect = "event:/DLC/EP3/SFX/Stingers/Scheme_Rework/ep3_mx_sting_schemerework_positive" + mandala_trickster_increment_successful_schemes_effect = yes + } + } + ## Scheme failed. + else = { + # If we have a contract conclusion event to fire, fire it. + if = { + limit = { exists = scope:contract_end_failure } + scheme_owner = { + trigger_event = { + saved_event_id = scope:contract_end_failure + delayed = yes + } + } + } + task_contract ?= { complete_task_contract = failure_standard } + trigger_event = { $FAILURE_EVENT_TYPE$ = $FAILURE_EVENT_ID$ } + scheme_owner = { play_sound_effect = "event:/DLC/EP3/SFX/Stingers/Scheme_Rework/ep3_mx_sting_schemerework_negative" } + } +} + +# Roll to see if a one-off factor stops an otherwise-successful murder scheme. +scheme_unique_interception_roll_effect = { + scope:target = { + # These are ordered highest % to lowest %: remember to adjust their position in the list if you adjust their percentage likelihood. + ## 50% — Saved by soulmate's sacrifice (boosted). + if = { + limit = { + has_perk = mortal_adoration_perk + any_relation = { + type = soulmate + available_lover_to_sacrifice_in_murder_trigger = { TARGET = scope:target } + } + } + random = { + chance = 50 + save_scope_value_as = { + name = interception_unique + value = flag:sacrifice_lover + } + } + } + ## 45% — Family Connections dynasty legacy. + else_if = { + limit = { + dynasty ?= { has_dynasty_perk = guile_legacy_5 } + NOT = { has_character_flag = guile_legacy_5_save_used } + } + random = { + chance = 45 + save_scope_value_as = { + name = interception_unique + value = flag:family_connections_dynleg + } + } + } + ## 30% — Saved by lover's sacrifice (boosted). + else_if = { + limit = { + has_perk = mortal_adoration_perk + any_relation = { + type = lover + available_lover_to_sacrifice_in_murder_trigger = { TARGET = scope:target } + } + } + random = { + chance = 30 + save_scope_value_as = { + name = interception_unique + value = flag:sacrifice_lover + } + } + } + ## 20% — Target's warhorse saves them from hired thugs + else_if = { + limit = { owns_story_of_type = story_cycle_martial_lifestyle_warhorse } + random = { + chance = 20 + save_scope_value_as = { + name = interception_unique + value = flag:sacrifice_warhorse + } + } + } + ## 20% — Saved by prison pet. + else_if = { + limit = { + is_imprisoned = yes + has_variable = prison_pet_variable + } + random = { + chance = 20 + save_scope_value_as = { + name = interception_unique + value = flag:sacrifice_pet_prison + } + } + } + ## 20% — Saved by soulmate's sacrifice (regular). + else_if = { + limit = { + any_relation = { + type = soulmate + available_lover_to_sacrifice_in_murder_trigger = { TARGET = scope:target } + } + } + random = { + chance = 20 + save_scope_value_as = { + name = interception_unique + value = flag:sacrifice_lover + } + } + } + ## 10% — Saved by lover's sacrifice (regular). + else_if = { + limit = { + any_relation = { + type = lover + available_lover_to_sacrifice_in_murder_trigger = { TARGET = scope:target } + } + } + random = { + chance = 10 + save_scope_value_as = { + name = interception_unique + value = flag:sacrifice_lover + } + } + } + ## 06% — Saved by cat. + ### Man's _true_ best friend. + else_if = { + limit = { + any_owned_story = { type = story_cycle_pet_cat } + } + random = { + chance = 6 + save_scope_value_as = { + name = interception_unique + value = flag:sacrifice_cat + } + } + } + ## 05% — Saved by dog. + else_if = { + limit = { + any_owned_story = { type = story_cycle_pet_dog } + } + random = { + chance = 5 + save_scope_value_as = { + name = interception_unique + value = flag:sacrifice_dog + } + } + } + ## 03% — Saved by due to bilinguality. + else_if = { + limit = { + knows_language_of_culture = scope:owner.culture + NOR = { + culture = { has_same_culture_language = scope:owner.culture } + AND = { + has_variable_list = bilingual_murder_saves + is_target_in_variable_list = { + name = bilingual_murder_saves + target = scope:owner.culture + } + } + } + } + random = { + chance = 3 + save_scope_value_as = { + name = interception_unique + value = flag:knowledge_bilingual + } + } + } + ## 01% — Saved due to mindbreak character. + else_if = { + limit = { + has_variable = mind_broken_victim + var:mind_broken_victim = { + is_alive = yes + NOT = { has_trait = incapable } + } + } + random = { + chance = 1 + save_scope_value_as = { + name = interception_unique + value = flag:sacrifice_mindbreak + } + } + } + ## 00.5% — Saved by having an artefact. + ### Special ridiculously low chance because otherwise this event, which has fun loc, will give _every_ character in the title a 1% chance to nullify any scheme against them. + else_if = { + limit = { + is_available_healthy_adult = yes + # Gotta be on land. + exists = location.barony + # And have a suitable artefact. + ## Which they probably will. + ### Statistically almost always, in fact. + has_any_artifact = yes + any_character_artifact = { + NOT = { has_variable = saved_from_assassination } + } + } + # Don't tell anyone this is even a possibility, as otherwise it's gonna look weird in the tooltips. + hidden_effect = { + random = { + chance = 1 + # And then reduce the chance even further. + random = { + chance = 50 + save_scope_value_as = { + name = interception_unique + value = flag:sacrifice_artefact + } + } + } + } + } + } +} + +# Reset a scoped scheme, including nixing any modifiers we don't want it to keep. +reset_failed_scheme_effect = { + reset_scheme_progress = yes + if = { + limit = { + has_scheme_modifier = scheme_end_buff_t2_modifier + } + remove_scheme_modifier = scheme_end_buff_t2_modifier + } + if = { + limit = { + has_scheme_modifier = scheme_end_buff_t3_modifier + } + remove_scheme_modifier = scheme_end_buff_t3_modifier + } + if = { + limit = { + has_scheme_modifier = scheme_end_buff_t4_modifier + } + remove_scheme_modifier = scheme_end_buff_t4_modifier + } +} + +################################################## +# General Critical Moment Effects + +# Sets up which agents are valid to be added to this scheme, then picks which two to suggest. +## We make a bazillion variants here because it's the easiest solution without having to have a dozen+ empty parameters in a single effect. +roll_critical_moment_options_02_agent_types_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:$OUTPUT_EVENT$ + } + if = { + limit = { + any_scheme_agent_slot = { count <= character_max_scheme_agents_value } + scope:scheme = { + NOR = { + has_variable = choice_a + has_variable = choice_b + } + } + } + # First, let's determine which types we're using and which we ain't. + ## Agent type 01. + save_scope_value_as = { + name = agent_type_01 + value = flag:$AGENT_TYPE_01$ + } + ## Agent type 02. + save_scope_value_as = { + name = agent_type_02 + value = flag:$AGENT_TYPE_02$ + } + # Then we roll for who's getting picked. + ## For var:choice_a. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOT = { scope:agent_type_01 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOT = { scope:agent_type_02 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + } + ## And var:choice_b. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOR = { + scope:agent_type_01 = flag:empty + var:choice_a = flag:$AGENT_TYPE_01$ + } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOR = { + scope:agent_type_02 = flag:empty + var:choice_a = flag:$AGENT_TYPE_02$ + } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + } + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0001 } + } +} +roll_critical_moment_options_03_agent_types_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:$OUTPUT_EVENT$ + } + if = { + limit = { + any_scheme_agent_slot = { count < character_max_scheme_agents_value } + scope:scheme = { + NOR = { + has_variable = choice_a + has_variable = choice_b + } + } + } + # First, let's determine which types we're using and which we ain't. + ## Agent type 01. + save_scope_value_as = { + name = agent_type_01 + value = flag:$AGENT_TYPE_01$ + } + ## Agent type 02. + save_scope_value_as = { + name = agent_type_02 + value = flag:$AGENT_TYPE_02$ + } + ## Agent type 03. + save_scope_value_as = { + name = agent_type_03 + value = flag:$AGENT_TYPE_03$ + } + # Then we roll for who's getting picked. + ## For var:choice_a. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOT = { scope:agent_type_01 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOT = { scope:agent_type_02 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOT = { scope:agent_type_03 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + } + ## And var:choice_b. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOR = { + scope:agent_type_01 = flag:empty + var:choice_a = flag:$AGENT_TYPE_01$ + } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOR = { + scope:agent_type_02 = flag:empty + var:choice_a = flag:$AGENT_TYPE_02$ + } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOR = { + scope:agent_type_03 = flag:empty + var:choice_a = flag:$AGENT_TYPE_03$ + } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + } + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0001 } + } +} +roll_critical_moment_options_04_agent_types_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:$OUTPUT_EVENT$ + } + if = { + limit = { + any_scheme_agent_slot = { count < character_max_scheme_agents_value } + scope:scheme = { + NOR = { + has_variable = choice_a + has_variable = choice_b + } + } + } + # First, let's determine which types we're using and which we ain't. + ## Agent type 01. + save_scope_value_as = { + name = agent_type_01 + value = flag:$AGENT_TYPE_01$ + } + ## Agent type 02. + save_scope_value_as = { + name = agent_type_02 + value = flag:$AGENT_TYPE_02$ + } + ## Agent type 03. + save_scope_value_as = { + name = agent_type_03 + value = flag:$AGENT_TYPE_03$ + } + ## Agent type 04. + save_scope_value_as = { + name = agent_type_04 + value = flag:$AGENT_TYPE_04$ + } + # Then we roll for who's getting picked. + ## For var:choice_a. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOT = { scope:agent_type_01 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOT = { scope:agent_type_02 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOT = { scope:agent_type_03 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOT = { scope:agent_type_04 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + } + ## And var:choice_b. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOR = { + scope:agent_type_01 = flag:empty + var:choice_a = flag:$AGENT_TYPE_01$ + } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOR = { + scope:agent_type_02 = flag:empty + var:choice_a = flag:$AGENT_TYPE_02$ + } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOR = { + scope:agent_type_03 = flag:empty + var:choice_a = flag:$AGENT_TYPE_03$ + } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOR = { + scope:agent_type_04 = flag:empty + var:choice_a = flag:$AGENT_TYPE_04$ + } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + } + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0001 } + } +} +roll_critical_moment_options_05_agent_types_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:$OUTPUT_EVENT$ + } + if = { + limit = { + any_scheme_agent_slot = { count < character_max_scheme_agents_value } + scope:scheme = { + NOR = { + has_variable = choice_a + has_variable = choice_b + } + } + } + # First, let's determine which types we're using and which we ain't. + ## Agent type 01. + save_scope_value_as = { + name = agent_type_01 + value = flag:$AGENT_TYPE_01$ + } + ## Agent type 02. + save_scope_value_as = { + name = agent_type_02 + value = flag:$AGENT_TYPE_02$ + } + ## Agent type 03. + save_scope_value_as = { + name = agent_type_03 + value = flag:$AGENT_TYPE_03$ + } + ## Agent type 04. + save_scope_value_as = { + name = agent_type_04 + value = flag:$AGENT_TYPE_04$ + } + ## Agent type 05. + save_scope_value_as = { + name = agent_type_05 + value = flag:$AGENT_TYPE_05$ + } + # Then we roll for who's getting picked. + ## For var:choice_a. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOT = { scope:agent_type_01 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOT = { scope:agent_type_02 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOT = { scope:agent_type_03 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOT = { scope:agent_type_04 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOT = { scope:agent_type_05 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + } + ## And var:choice_b. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOR = { + scope:agent_type_01 = flag:empty + var:choice_a = flag:$AGENT_TYPE_01$ + } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOR = { + scope:agent_type_02 = flag:empty + var:choice_a = flag:$AGENT_TYPE_02$ + } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOR = { + scope:agent_type_03 = flag:empty + var:choice_a = flag:$AGENT_TYPE_03$ + } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOR = { + scope:agent_type_04 = flag:empty + var:choice_a = flag:$AGENT_TYPE_04$ + } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOR = { + scope:agent_type_05 = flag:empty + var:choice_a = flag:$AGENT_TYPE_05$ + } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + } + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0001 } + } +} +roll_critical_moment_options_06_agent_types_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:$OUTPUT_EVENT$ + } + if = { + limit = { + any_scheme_agent_slot = { count < character_max_scheme_agents_value } + scope:scheme = { + NOR = { + has_variable = choice_a + has_variable = choice_b + } + } + } + # First, let's determine which types we're using and which we ain't. + ## Agent type 01. + save_scope_value_as = { + name = agent_type_01 + value = flag:$AGENT_TYPE_01$ + } + ## Agent type 02. + save_scope_value_as = { + name = agent_type_02 + value = flag:$AGENT_TYPE_02$ + } + ## Agent type 03. + save_scope_value_as = { + name = agent_type_03 + value = flag:$AGENT_TYPE_03$ + } + ## Agent type 04. + save_scope_value_as = { + name = agent_type_04 + value = flag:$AGENT_TYPE_04$ + } + ## Agent type 05. + save_scope_value_as = { + name = agent_type_05 + value = flag:$AGENT_TYPE_05$ + } + ## Agent type 06. + save_scope_value_as = { + name = agent_type_06 + value = flag:$AGENT_TYPE_06$ + } + # Then we roll for who's getting picked. + ## For var:choice_a. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOT = { scope:agent_type_01 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOT = { scope:agent_type_02 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOT = { scope:agent_type_03 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOT = { scope:agent_type_04 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOT = { scope:agent_type_05 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOT = { scope:agent_type_06 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + } + ## And var:choice_b. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOR = { + scope:agent_type_01 = flag:empty + var:choice_a = flag:$AGENT_TYPE_01$ + } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOR = { + scope:agent_type_02 = flag:empty + var:choice_a = flag:$AGENT_TYPE_02$ + } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOR = { + scope:agent_type_03 = flag:empty + var:choice_a = flag:$AGENT_TYPE_03$ + } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOR = { + scope:agent_type_04 = flag:empty + var:choice_a = flag:$AGENT_TYPE_04$ + } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOR = { + scope:agent_type_05 = flag:empty + var:choice_a = flag:$AGENT_TYPE_05$ + } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOR = { + scope:agent_type_06 = flag:empty + var:choice_a = flag:$AGENT_TYPE_06$ + } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + } + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0001 } + } +} +roll_critical_moment_options_07_agent_types_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:$OUTPUT_EVENT$ + } + if = { + limit = { + any_scheme_agent_slot = { count < character_max_scheme_agents_value } + scope:scheme = { + NOR = { + has_variable = choice_a + has_variable = choice_b + } + } + } + # First, let's determine which types we're using and which we ain't. + ## Agent type 01. + save_scope_value_as = { + name = agent_type_01 + value = flag:$AGENT_TYPE_01$ + } + ## Agent type 02. + save_scope_value_as = { + name = agent_type_02 + value = flag:$AGENT_TYPE_02$ + } + ## Agent type 03. + save_scope_value_as = { + name = agent_type_03 + value = flag:$AGENT_TYPE_03$ + } + ## Agent type 04. + save_scope_value_as = { + name = agent_type_04 + value = flag:$AGENT_TYPE_04$ + } + ## Agent type 05. + save_scope_value_as = { + name = agent_type_05 + value = flag:$AGENT_TYPE_05$ + } + ## Agent type 06. + save_scope_value_as = { + name = agent_type_06 + value = flag:$AGENT_TYPE_06$ + } + ## Agent type 07. + save_scope_value_as = { + name = agent_type_07 + value = flag:$AGENT_TYPE_07$ + } + # Then we roll for who's getting picked. + ## For var:choice_a. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOT = { scope:agent_type_01 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOT = { scope:agent_type_02 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOT = { scope:agent_type_03 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOT = { scope:agent_type_04 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOT = { scope:agent_type_05 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOT = { scope:agent_type_06 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOT = { scope:agent_type_07 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + } + ## And var:choice_b. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOR = { + scope:agent_type_01 = flag:empty + var:choice_a = flag:$AGENT_TYPE_01$ + } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOR = { + scope:agent_type_02 = flag:empty + var:choice_a = flag:$AGENT_TYPE_02$ + } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOR = { + scope:agent_type_03 = flag:empty + var:choice_a = flag:$AGENT_TYPE_03$ + } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOR = { + scope:agent_type_04 = flag:empty + var:choice_a = flag:$AGENT_TYPE_04$ + } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOR = { + scope:agent_type_05 = flag:empty + var:choice_a = flag:$AGENT_TYPE_05$ + } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOR = { + scope:agent_type_06 = flag:empty + var:choice_a = flag:$AGENT_TYPE_06$ + } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOR = { + scope:agent_type_07 = flag:empty + var:choice_a = flag:$AGENT_TYPE_07$ + } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + } + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0001 } + } +} +roll_critical_moment_options_08_agent_types_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:$OUTPUT_EVENT$ + } + if = { + limit = { + any_scheme_agent_slot = { count < character_max_scheme_agents_value } + scope:scheme = { + NOR = { + has_variable = choice_a + has_variable = choice_b + } + } + } + # First, let's determine which types we're using and which we ain't. + ## Agent type 01. + save_scope_value_as = { + name = agent_type_01 + value = flag:$AGENT_TYPE_01$ + } + ## Agent type 02. + save_scope_value_as = { + name = agent_type_02 + value = flag:$AGENT_TYPE_02$ + } + ## Agent type 03. + save_scope_value_as = { + name = agent_type_03 + value = flag:$AGENT_TYPE_03$ + } + ## Agent type 04. + save_scope_value_as = { + name = agent_type_04 + value = flag:$AGENT_TYPE_04$ + } + ## Agent type 05. + save_scope_value_as = { + name = agent_type_05 + value = flag:$AGENT_TYPE_05$ + } + ## Agent type 06. + save_scope_value_as = { + name = agent_type_06 + value = flag:$AGENT_TYPE_06$ + } + ## Agent type 07. + save_scope_value_as = { + name = agent_type_07 + value = flag:$AGENT_TYPE_07$ + } + ## Agent type 08. + save_scope_value_as = { + name = agent_type_08 + value = flag:$AGENT_TYPE_08$ + } + # Then we roll for who's getting picked. + ## For var:choice_a. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOT = { scope:agent_type_01 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOT = { scope:agent_type_02 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOT = { scope:agent_type_03 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOT = { scope:agent_type_04 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOT = { scope:agent_type_05 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOT = { scope:agent_type_06 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOT = { scope:agent_type_07 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOT = { scope:agent_type_08 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + } + ## And var:choice_b. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOR = { + scope:agent_type_01 = flag:empty + var:choice_a = flag:$AGENT_TYPE_01$ + } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOR = { + scope:agent_type_02 = flag:empty + var:choice_a = flag:$AGENT_TYPE_02$ + } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOR = { + scope:agent_type_03 = flag:empty + var:choice_a = flag:$AGENT_TYPE_03$ + } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOR = { + scope:agent_type_04 = flag:empty + var:choice_a = flag:$AGENT_TYPE_04$ + } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOR = { + scope:agent_type_05 = flag:empty + var:choice_a = flag:$AGENT_TYPE_05$ + } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOR = { + scope:agent_type_06 = flag:empty + var:choice_a = flag:$AGENT_TYPE_06$ + } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOR = { + scope:agent_type_07 = flag:empty + var:choice_a = flag:$AGENT_TYPE_07$ + } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOR = { + scope:agent_type_08 = flag:empty + var:choice_a = flag:$AGENT_TYPE_08$ + } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + } + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0001 } + } +} +roll_critical_moment_options_09_agent_types_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:$OUTPUT_EVENT$ + } + if = { + limit = { + any_scheme_agent_slot = { count < character_max_scheme_agents_value } + scope:scheme = { + NOR = { + has_variable = choice_a + has_variable = choice_b + } + } + } + # First, let's determine which types we're using and which we ain't. + ## Agent type 01. + save_scope_value_as = { + name = agent_type_01 + value = flag:$AGENT_TYPE_01$ + } + ## Agent type 02. + save_scope_value_as = { + name = agent_type_02 + value = flag:$AGENT_TYPE_02$ + } + ## Agent type 03. + save_scope_value_as = { + name = agent_type_03 + value = flag:$AGENT_TYPE_03$ + } + ## Agent type 04. + save_scope_value_as = { + name = agent_type_04 + value = flag:$AGENT_TYPE_04$ + } + ## Agent type 05. + save_scope_value_as = { + name = agent_type_05 + value = flag:$AGENT_TYPE_05$ + } + ## Agent type 06. + save_scope_value_as = { + name = agent_type_06 + value = flag:$AGENT_TYPE_06$ + } + ## Agent type 07. + save_scope_value_as = { + name = agent_type_07 + value = flag:$AGENT_TYPE_07$ + } + ## Agent type 08. + save_scope_value_as = { + name = agent_type_08 + value = flag:$AGENT_TYPE_08$ + } + ## Agent type 09. + save_scope_value_as = { + name = agent_type_09 + value = flag:$AGENT_TYPE_09$ + } + # Then we roll for who's getting picked. + ## For var:choice_a. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOT = { scope:agent_type_01 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOT = { scope:agent_type_02 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOT = { scope:agent_type_03 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOT = { scope:agent_type_04 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOT = { scope:agent_type_05 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOT = { scope:agent_type_06 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOT = { scope:agent_type_07 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOT = { scope:agent_type_08 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + # Agent type 09. + 0 = { + trigger = { + NOT = { scope:agent_type_09 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_09$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_09$ + } + modifier = { + add = $AGENT_TYPE_09_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_09$ } + } + } + } + ## And var:choice_b. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOR = { + scope:agent_type_01 = flag:empty + var:choice_a = flag:$AGENT_TYPE_01$ + } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOR = { + scope:agent_type_02 = flag:empty + var:choice_a = flag:$AGENT_TYPE_02$ + } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOR = { + scope:agent_type_03 = flag:empty + var:choice_a = flag:$AGENT_TYPE_03$ + } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOR = { + scope:agent_type_04 = flag:empty + var:choice_a = flag:$AGENT_TYPE_04$ + } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOR = { + scope:agent_type_05 = flag:empty + var:choice_a = flag:$AGENT_TYPE_05$ + } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOR = { + scope:agent_type_06 = flag:empty + var:choice_a = flag:$AGENT_TYPE_06$ + } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOR = { + scope:agent_type_07 = flag:empty + var:choice_a = flag:$AGENT_TYPE_07$ + } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOR = { + scope:agent_type_08 = flag:empty + var:choice_a = flag:$AGENT_TYPE_08$ + } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + # Agent type 09. + 0 = { + trigger = { + NOR = { + scope:agent_type_09 = flag:empty + var:choice_a = flag:$AGENT_TYPE_09$ + } + scheme_owner = { can_have_$AGENT_TYPE_09$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_09$ + } + modifier = { + add = $AGENT_TYPE_09_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_09$ } + } + } + } + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0001 } + } +} +roll_critical_moment_options_10_agent_types_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:$OUTPUT_EVENT$ + } + if = { + limit = { + any_scheme_agent_slot = { count < character_max_scheme_agents_value } + scope:scheme = { + NOR = { + has_variable = choice_a + has_variable = choice_b + } + } + } + # First, let's determine which types we're using and which we ain't. + ## Agent type 01. + save_scope_value_as = { + name = agent_type_01 + value = flag:$AGENT_TYPE_01$ + } + ## Agent type 02. + save_scope_value_as = { + name = agent_type_02 + value = flag:$AGENT_TYPE_02$ + } + ## Agent type 03. + save_scope_value_as = { + name = agent_type_03 + value = flag:$AGENT_TYPE_03$ + } + ## Agent type 04. + save_scope_value_as = { + name = agent_type_04 + value = flag:$AGENT_TYPE_04$ + } + ## Agent type 05. + save_scope_value_as = { + name = agent_type_05 + value = flag:$AGENT_TYPE_05$ + } + ## Agent type 06. + save_scope_value_as = { + name = agent_type_06 + value = flag:$AGENT_TYPE_06$ + } + ## Agent type 07. + save_scope_value_as = { + name = agent_type_07 + value = flag:$AGENT_TYPE_07$ + } + ## Agent type 08. + save_scope_value_as = { + name = agent_type_08 + value = flag:$AGENT_TYPE_08$ + } + ## Agent type 09. + save_scope_value_as = { + name = agent_type_09 + value = flag:$AGENT_TYPE_09$ + } + ## Agent type 10. + save_scope_value_as = { + name = agent_type_10 + value = flag:$AGENT_TYPE_10$ + } + # Then we roll for who's getting picked. + ## For var:choice_a. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOT = { scope:agent_type_01 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOT = { scope:agent_type_02 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOT = { scope:agent_type_03 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOT = { scope:agent_type_04 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOT = { scope:agent_type_05 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOT = { scope:agent_type_06 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOT = { scope:agent_type_07 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOT = { scope:agent_type_08 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + # Agent type 09. + 0 = { + trigger = { + NOT = { scope:agent_type_09 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_09$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_09$ + } + modifier = { + add = $AGENT_TYPE_09_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_09$ } + } + } + # Agent type 10. + 0 = { + trigger = { + NOT = { scope:agent_type_10 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_10$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_10$ + } + modifier = { + add = $AGENT_TYPE_10_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_10$ } + } + } + } + ## And var:choice_b. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOR = { + scope:agent_type_01 = flag:empty + var:choice_a = flag:$AGENT_TYPE_01$ + } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOR = { + scope:agent_type_02 = flag:empty + var:choice_a = flag:$AGENT_TYPE_02$ + } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOR = { + scope:agent_type_03 = flag:empty + var:choice_a = flag:$AGENT_TYPE_03$ + } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOR = { + scope:agent_type_04 = flag:empty + var:choice_a = flag:$AGENT_TYPE_04$ + } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOR = { + scope:agent_type_05 = flag:empty + var:choice_a = flag:$AGENT_TYPE_05$ + } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOR = { + scope:agent_type_06 = flag:empty + var:choice_a = flag:$AGENT_TYPE_06$ + } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOR = { + scope:agent_type_07 = flag:empty + var:choice_a = flag:$AGENT_TYPE_07$ + } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOR = { + scope:agent_type_08 = flag:empty + var:choice_a = flag:$AGENT_TYPE_08$ + } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + # Agent type 09. + 0 = { + trigger = { + NOR = { + scope:agent_type_09 = flag:empty + var:choice_a = flag:$AGENT_TYPE_09$ + } + scheme_owner = { can_have_$AGENT_TYPE_09$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_09$ + } + modifier = { + add = $AGENT_TYPE_09_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_09$ } + } + } + # Agent type 10. + 0 = { + trigger = { + NOR = { + scope:agent_type_10 = flag:empty + var:choice_a = flag:$AGENT_TYPE_10$ + } + scheme_owner = { can_have_$AGENT_TYPE_10$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_10$ + } + modifier = { + add = $AGENT_TYPE_10_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_10$ } + } + } + } + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0001 } + } +} +roll_critical_moment_options_11_agent_types_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:$OUTPUT_EVENT$ + } + if = { + limit = { + any_scheme_agent_slot = { count < character_max_scheme_agents_value } + scope:scheme = { + NOR = { + has_variable = choice_a + has_variable = choice_b + } + } + } + # First, let's determine which types we're using and which we ain't. + ## Agent type 01. + save_scope_value_as = { + name = agent_type_01 + value = flag:$AGENT_TYPE_01$ + } + ## Agent type 02. + save_scope_value_as = { + name = agent_type_02 + value = flag:$AGENT_TYPE_02$ + } + ## Agent type 03. + save_scope_value_as = { + name = agent_type_03 + value = flag:$AGENT_TYPE_03$ + } + ## Agent type 04. + save_scope_value_as = { + name = agent_type_04 + value = flag:$AGENT_TYPE_04$ + } + ## Agent type 05. + save_scope_value_as = { + name = agent_type_05 + value = flag:$AGENT_TYPE_05$ + } + ## Agent type 06. + save_scope_value_as = { + name = agent_type_06 + value = flag:$AGENT_TYPE_06$ + } + ## Agent type 07. + save_scope_value_as = { + name = agent_type_07 + value = flag:$AGENT_TYPE_07$ + } + ## Agent type 08. + save_scope_value_as = { + name = agent_type_08 + value = flag:$AGENT_TYPE_08$ + } + ## Agent type 09. + save_scope_value_as = { + name = agent_type_09 + value = flag:$AGENT_TYPE_09$ + } + ## Agent type 10. + save_scope_value_as = { + name = agent_type_10 + value = flag:$AGENT_TYPE_10$ + } + ## Agent type 11. + save_scope_value_as = { + name = agent_type_11 + value = flag:$AGENT_TYPE_11$ + } + # Then we roll for who's getting picked. + ## For var:choice_a. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOT = { scope:agent_type_01 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOT = { scope:agent_type_02 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOT = { scope:agent_type_03 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOT = { scope:agent_type_04 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOT = { scope:agent_type_05 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOT = { scope:agent_type_06 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOT = { scope:agent_type_07 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOT = { scope:agent_type_08 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + # Agent type 09. + 0 = { + trigger = { + NOT = { scope:agent_type_09 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_09$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_09$ + } + modifier = { + add = $AGENT_TYPE_09_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_09$ } + } + } + # Agent type 10. + 0 = { + trigger = { + NOT = { scope:agent_type_10 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_10$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_10$ + } + modifier = { + add = $AGENT_TYPE_10_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_10$ } + } + } + # Agent type 11. + 0 = { + trigger = { + NOT = { scope:agent_type_11 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_11$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_11$ + } + modifier = { + add = $AGENT_TYPE_11_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_11$ } + } + } + } + ## And var:choice_b. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOR = { + scope:agent_type_01 = flag:empty + var:choice_a = flag:$AGENT_TYPE_01$ + } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOR = { + scope:agent_type_02 = flag:empty + var:choice_a = flag:$AGENT_TYPE_02$ + } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOR = { + scope:agent_type_03 = flag:empty + var:choice_a = flag:$AGENT_TYPE_03$ + } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOR = { + scope:agent_type_04 = flag:empty + var:choice_a = flag:$AGENT_TYPE_04$ + } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOR = { + scope:agent_type_05 = flag:empty + var:choice_a = flag:$AGENT_TYPE_05$ + } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOR = { + scope:agent_type_06 = flag:empty + var:choice_a = flag:$AGENT_TYPE_06$ + } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOR = { + scope:agent_type_07 = flag:empty + var:choice_a = flag:$AGENT_TYPE_07$ + } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOR = { + scope:agent_type_08 = flag:empty + var:choice_a = flag:$AGENT_TYPE_08$ + } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + # Agent type 09. + 0 = { + trigger = { + NOR = { + scope:agent_type_09 = flag:empty + var:choice_a = flag:$AGENT_TYPE_09$ + } + scheme_owner = { can_have_$AGENT_TYPE_09$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_09$ + } + modifier = { + add = $AGENT_TYPE_09_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_09$ } + } + } + # Agent type 10. + 0 = { + trigger = { + NOR = { + scope:agent_type_10 = flag:empty + var:choice_a = flag:$AGENT_TYPE_10$ + } + scheme_owner = { can_have_$AGENT_TYPE_10$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_10$ + } + modifier = { + add = $AGENT_TYPE_10_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_10$ } + } + } + # Agent type 11. + 0 = { + trigger = { + NOR = { + scope:agent_type_11 = flag:empty + var:choice_a = flag:$AGENT_TYPE_11$ + } + scheme_owner = { can_have_$AGENT_TYPE_11$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_11$ + } + modifier = { + add = $AGENT_TYPE_11_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_11$ } + } + } + } + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0001 } + } +} +roll_critical_moment_options_12_agent_types_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:$OUTPUT_EVENT$ + } + if = { + limit = { + any_scheme_agent_slot = { count < character_max_scheme_agents_value } + scope:scheme = { + NOR = { + has_variable = choice_a + has_variable = choice_b + } + } + } + # First, let's determine which types we're using and which we ain't. + ## Agent type 01. + save_scope_value_as = { + name = agent_type_01 + value = flag:$AGENT_TYPE_01$ + } + ## Agent type 02. + save_scope_value_as = { + name = agent_type_02 + value = flag:$AGENT_TYPE_02$ + } + ## Agent type 03. + save_scope_value_as = { + name = agent_type_03 + value = flag:$AGENT_TYPE_03$ + } + ## Agent type 04. + save_scope_value_as = { + name = agent_type_04 + value = flag:$AGENT_TYPE_04$ + } + ## Agent type 05. + save_scope_value_as = { + name = agent_type_05 + value = flag:$AGENT_TYPE_05$ + } + ## Agent type 06. + save_scope_value_as = { + name = agent_type_06 + value = flag:$AGENT_TYPE_06$ + } + ## Agent type 07. + save_scope_value_as = { + name = agent_type_07 + value = flag:$AGENT_TYPE_07$ + } + ## Agent type 08. + save_scope_value_as = { + name = agent_type_08 + value = flag:$AGENT_TYPE_08$ + } + ## Agent type 09. + save_scope_value_as = { + name = agent_type_09 + value = flag:$AGENT_TYPE_09$ + } + ## Agent type 10. + save_scope_value_as = { + name = agent_type_10 + value = flag:$AGENT_TYPE_10$ + } + ## Agent type 11. + save_scope_value_as = { + name = agent_type_11 + value = flag:$AGENT_TYPE_11$ + } + ## Agent type 12. + save_scope_value_as = { + name = agent_type_12 + value = flag:$AGENT_TYPE_12$ + } + # Then we roll for who's getting picked. + ## For var:choice_a. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOT = { scope:agent_type_01 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOT = { scope:agent_type_02 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOT = { scope:agent_type_03 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOT = { scope:agent_type_04 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOT = { scope:agent_type_05 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOT = { scope:agent_type_06 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOT = { scope:agent_type_07 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOT = { scope:agent_type_08 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + # Agent type 09. + 0 = { + trigger = { + NOT = { scope:agent_type_09 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_09$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_09$ + } + modifier = { + add = $AGENT_TYPE_09_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_09$ } + } + } + # Agent type 10. + 0 = { + trigger = { + NOT = { scope:agent_type_10 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_10$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_10$ + } + modifier = { + add = $AGENT_TYPE_10_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_10$ } + } + } + # Agent type 11. + 0 = { + trigger = { + NOT = { scope:agent_type_11 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_11$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_11$ + } + modifier = { + add = $AGENT_TYPE_11_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_11$ } + } + } + # Agent type 12. + 0 = { + trigger = { + NOT = { scope:agent_type_12 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_12$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_12$ + } + modifier = { + add = $AGENT_TYPE_12_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_12$ } + } + } + } + ## And var:choice_b. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOR = { + scope:agent_type_01 = flag:empty + var:choice_a = flag:$AGENT_TYPE_01$ + } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOR = { + scope:agent_type_02 = flag:empty + var:choice_a = flag:$AGENT_TYPE_02$ + } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOR = { + scope:agent_type_03 = flag:empty + var:choice_a = flag:$AGENT_TYPE_03$ + } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOR = { + scope:agent_type_04 = flag:empty + var:choice_a = flag:$AGENT_TYPE_04$ + } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOR = { + scope:agent_type_05 = flag:empty + var:choice_a = flag:$AGENT_TYPE_05$ + } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOR = { + scope:agent_type_06 = flag:empty + var:choice_a = flag:$AGENT_TYPE_06$ + } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOR = { + scope:agent_type_07 = flag:empty + var:choice_a = flag:$AGENT_TYPE_07$ + } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOR = { + scope:agent_type_08 = flag:empty + var:choice_a = flag:$AGENT_TYPE_08$ + } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + # Agent type 09. + 0 = { + trigger = { + NOR = { + scope:agent_type_09 = flag:empty + var:choice_a = flag:$AGENT_TYPE_09$ + } + scheme_owner = { can_have_$AGENT_TYPE_09$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_09$ + } + modifier = { + add = $AGENT_TYPE_09_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_09$ } + } + } + # Agent type 10. + 0 = { + trigger = { + NOR = { + scope:agent_type_10 = flag:empty + var:choice_a = flag:$AGENT_TYPE_10$ + } + scheme_owner = { can_have_$AGENT_TYPE_10$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_10$ + } + modifier = { + add = $AGENT_TYPE_10_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_10$ } + } + } + # Agent type 11. + 0 = { + trigger = { + NOR = { + scope:agent_type_11 = flag:empty + var:choice_a = flag:$AGENT_TYPE_11$ + } + scheme_owner = { can_have_$AGENT_TYPE_11$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_11$ + } + modifier = { + add = $AGENT_TYPE_11_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_11$ } + } + } + # Agent type 12. + 0 = { + trigger = { + NOR = { + scope:agent_type_12 = flag:empty + var:choice_a = flag:$AGENT_TYPE_12$ + } + scheme_owner = { can_have_$AGENT_TYPE_12$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_12$ + } + modifier = { + add = $AGENT_TYPE_12_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_12$ } + } + } + } + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0001 } + } +} +roll_critical_moment_options_13_agent_types_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:$OUTPUT_EVENT$ + } + if = { + limit = { + any_scheme_agent_slot = { count < character_max_scheme_agents_value } + scope:scheme = { + NOR = { + has_variable = choice_a + has_variable = choice_b + } + } + } + # First, let's determine which types we're using and which we ain't. + ## Agent type 01. + save_scope_value_as = { + name = agent_type_01 + value = flag:$AGENT_TYPE_01$ + } + ## Agent type 02. + save_scope_value_as = { + name = agent_type_02 + value = flag:$AGENT_TYPE_02$ + } + ## Agent type 03. + save_scope_value_as = { + name = agent_type_03 + value = flag:$AGENT_TYPE_03$ + } + ## Agent type 04. + save_scope_value_as = { + name = agent_type_04 + value = flag:$AGENT_TYPE_04$ + } + ## Agent type 05. + save_scope_value_as = { + name = agent_type_05 + value = flag:$AGENT_TYPE_05$ + } + ## Agent type 06. + save_scope_value_as = { + name = agent_type_06 + value = flag:$AGENT_TYPE_06$ + } + ## Agent type 07. + save_scope_value_as = { + name = agent_type_07 + value = flag:$AGENT_TYPE_07$ + } + ## Agent type 08. + save_scope_value_as = { + name = agent_type_08 + value = flag:$AGENT_TYPE_08$ + } + ## Agent type 09. + save_scope_value_as = { + name = agent_type_09 + value = flag:$AGENT_TYPE_09$ + } + ## Agent type 10. + save_scope_value_as = { + name = agent_type_10 + value = flag:$AGENT_TYPE_10$ + } + ## Agent type 11. + save_scope_value_as = { + name = agent_type_11 + value = flag:$AGENT_TYPE_11$ + } + ## Agent type 12. + save_scope_value_as = { + name = agent_type_12 + value = flag:$AGENT_TYPE_12$ + } + ## Agent type 13. + save_scope_value_as = { + name = agent_type_13 + value = flag:$AGENT_TYPE_13$ + } + # Then we roll for who's getting picked. + ## For var:choice_a. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOT = { scope:agent_type_01 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOT = { scope:agent_type_02 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOT = { scope:agent_type_03 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOT = { scope:agent_type_04 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOT = { scope:agent_type_05 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOT = { scope:agent_type_06 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOT = { scope:agent_type_07 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOT = { scope:agent_type_08 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + # Agent type 09. + 0 = { + trigger = { + NOT = { scope:agent_type_09 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_09$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_09$ + } + modifier = { + add = $AGENT_TYPE_09_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_09$ } + } + } + # Agent type 10. + 0 = { + trigger = { + NOT = { scope:agent_type_10 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_10$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_10$ + } + modifier = { + add = $AGENT_TYPE_10_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_10$ } + } + } + # Agent type 11. + 0 = { + trigger = { + NOT = { scope:agent_type_11 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_11$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_11$ + } + modifier = { + add = $AGENT_TYPE_11_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_11$ } + } + } + # Agent type 12. + 0 = { + trigger = { + NOT = { scope:agent_type_12 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_12$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_12$ + } + modifier = { + add = $AGENT_TYPE_12_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_12$ } + } + } + # Agent type 13. + 0 = { + trigger = { + NOT = { scope:agent_type_13 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_13$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_13$ + } + modifier = { + add = $AGENT_TYPE_13_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_13$ } + } + } + } + ## And var:choice_b. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOR = { + scope:agent_type_01 = flag:empty + var:choice_a = flag:$AGENT_TYPE_01$ + } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOR = { + scope:agent_type_02 = flag:empty + var:choice_a = flag:$AGENT_TYPE_02$ + } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOR = { + scope:agent_type_03 = flag:empty + var:choice_a = flag:$AGENT_TYPE_03$ + } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOR = { + scope:agent_type_04 = flag:empty + var:choice_a = flag:$AGENT_TYPE_04$ + } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOR = { + scope:agent_type_05 = flag:empty + var:choice_a = flag:$AGENT_TYPE_05$ + } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOR = { + scope:agent_type_06 = flag:empty + var:choice_a = flag:$AGENT_TYPE_06$ + } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOR = { + scope:agent_type_07 = flag:empty + var:choice_a = flag:$AGENT_TYPE_07$ + } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOR = { + scope:agent_type_08 = flag:empty + var:choice_a = flag:$AGENT_TYPE_08$ + } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + # Agent type 09. + 0 = { + trigger = { + NOR = { + scope:agent_type_09 = flag:empty + var:choice_a = flag:$AGENT_TYPE_09$ + } + scheme_owner = { can_have_$AGENT_TYPE_09$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_09$ + } + modifier = { + add = $AGENT_TYPE_09_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_09$ } + } + } + # Agent type 10. + 0 = { + trigger = { + NOR = { + scope:agent_type_10 = flag:empty + var:choice_a = flag:$AGENT_TYPE_10$ + } + scheme_owner = { can_have_$AGENT_TYPE_10$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_10$ + } + modifier = { + add = $AGENT_TYPE_10_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_10$ } + } + } + # Agent type 11. + 0 = { + trigger = { + NOR = { + scope:agent_type_11 = flag:empty + var:choice_a = flag:$AGENT_TYPE_11$ + } + scheme_owner = { can_have_$AGENT_TYPE_11$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_11$ + } + modifier = { + add = $AGENT_TYPE_11_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_11$ } + } + } + # Agent type 12. + 0 = { + trigger = { + NOR = { + scope:agent_type_12 = flag:empty + var:choice_a = flag:$AGENT_TYPE_12$ + } + scheme_owner = { can_have_$AGENT_TYPE_12$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_12$ + } + modifier = { + add = $AGENT_TYPE_12_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_12$ } + } + } + # Agent type 13. + 0 = { + trigger = { + NOR = { + scope:agent_type_13 = flag:empty + var:choice_a = flag:$AGENT_TYPE_13$ + } + scheme_owner = { can_have_$AGENT_TYPE_13$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_13$ + } + modifier = { + add = $AGENT_TYPE_13_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_13$ } + } + } + } + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0001 } + } +} +roll_critical_moment_options_14_agent_types_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:$OUTPUT_EVENT$ + } + if = { + limit = { + any_scheme_agent_slot = { count < character_max_scheme_agents_value } + scope:scheme = { + NOR = { + has_variable = choice_a + has_variable = choice_b + } + } + } + # First, let's determine which types we're using and which we ain't. + ## Agent type 01. + save_scope_value_as = { + name = agent_type_01 + value = flag:$AGENT_TYPE_01$ + } + ## Agent type 02. + save_scope_value_as = { + name = agent_type_02 + value = flag:$AGENT_TYPE_02$ + } + ## Agent type 03. + save_scope_value_as = { + name = agent_type_03 + value = flag:$AGENT_TYPE_03$ + } + ## Agent type 04. + save_scope_value_as = { + name = agent_type_04 + value = flag:$AGENT_TYPE_04$ + } + ## Agent type 05. + save_scope_value_as = { + name = agent_type_05 + value = flag:$AGENT_TYPE_05$ + } + ## Agent type 06. + save_scope_value_as = { + name = agent_type_06 + value = flag:$AGENT_TYPE_06$ + } + ## Agent type 07. + save_scope_value_as = { + name = agent_type_07 + value = flag:$AGENT_TYPE_07$ + } + ## Agent type 08. + save_scope_value_as = { + name = agent_type_08 + value = flag:$AGENT_TYPE_08$ + } + ## Agent type 09. + save_scope_value_as = { + name = agent_type_09 + value = flag:$AGENT_TYPE_09$ + } + ## Agent type 10. + save_scope_value_as = { + name = agent_type_10 + value = flag:$AGENT_TYPE_10$ + } + ## Agent type 11. + save_scope_value_as = { + name = agent_type_11 + value = flag:$AGENT_TYPE_11$ + } + ## Agent type 12. + save_scope_value_as = { + name = agent_type_12 + value = flag:$AGENT_TYPE_12$ + } + ## Agent type 13. + save_scope_value_as = { + name = agent_type_13 + value = flag:$AGENT_TYPE_13$ + } + ## Agent type 14. + save_scope_value_as = { + name = agent_type_14 + value = flag:$AGENT_TYPE_14$ + } + # Then we roll for who's getting picked. + ## For var:choice_a. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOT = { scope:agent_type_01 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOT = { scope:agent_type_02 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOT = { scope:agent_type_03 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOT = { scope:agent_type_04 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOT = { scope:agent_type_05 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOT = { scope:agent_type_06 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOT = { scope:agent_type_07 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOT = { scope:agent_type_08 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + # Agent type 09. + 0 = { + trigger = { + NOT = { scope:agent_type_09 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_09$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_09$ + } + modifier = { + add = $AGENT_TYPE_09_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_09$ } + } + } + # Agent type 10. + 0 = { + trigger = { + NOT = { scope:agent_type_10 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_10$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_10$ + } + modifier = { + add = $AGENT_TYPE_10_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_10$ } + } + } + # Agent type 11. + 0 = { + trigger = { + NOT = { scope:agent_type_11 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_11$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_11$ + } + modifier = { + add = $AGENT_TYPE_11_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_11$ } + } + } + # Agent type 12. + 0 = { + trigger = { + NOT = { scope:agent_type_12 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_12$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_12$ + } + modifier = { + add = $AGENT_TYPE_12_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_12$ } + } + } + # Agent type 13. + 0 = { + trigger = { + NOT = { scope:agent_type_13 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_13$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_13$ + } + modifier = { + add = $AGENT_TYPE_13_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_13$ } + } + } + # Agent type 14. + 0 = { + trigger = { + NOT = { scope:agent_type_14 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_14$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_14$ + } + modifier = { + add = $AGENT_TYPE_14_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_14$ } + } + } + } + ## And var:choice_b. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOR = { + scope:agent_type_01 = flag:empty + var:choice_a = flag:$AGENT_TYPE_01$ + } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOR = { + scope:agent_type_02 = flag:empty + var:choice_a = flag:$AGENT_TYPE_02$ + } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOR = { + scope:agent_type_03 = flag:empty + var:choice_a = flag:$AGENT_TYPE_03$ + } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOR = { + scope:agent_type_04 = flag:empty + var:choice_a = flag:$AGENT_TYPE_04$ + } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOR = { + scope:agent_type_05 = flag:empty + var:choice_a = flag:$AGENT_TYPE_05$ + } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOR = { + scope:agent_type_06 = flag:empty + var:choice_a = flag:$AGENT_TYPE_06$ + } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOR = { + scope:agent_type_07 = flag:empty + var:choice_a = flag:$AGENT_TYPE_07$ + } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOR = { + scope:agent_type_08 = flag:empty + var:choice_a = flag:$AGENT_TYPE_08$ + } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + # Agent type 09. + 0 = { + trigger = { + NOR = { + scope:agent_type_09 = flag:empty + var:choice_a = flag:$AGENT_TYPE_09$ + } + scheme_owner = { can_have_$AGENT_TYPE_09$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_09$ + } + modifier = { + add = $AGENT_TYPE_09_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_09$ } + } + } + # Agent type 10. + 0 = { + trigger = { + NOR = { + scope:agent_type_10 = flag:empty + var:choice_a = flag:$AGENT_TYPE_10$ + } + scheme_owner = { can_have_$AGENT_TYPE_10$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_10$ + } + modifier = { + add = $AGENT_TYPE_10_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_10$ } + } + } + # Agent type 11. + 0 = { + trigger = { + NOR = { + scope:agent_type_11 = flag:empty + var:choice_a = flag:$AGENT_TYPE_11$ + } + scheme_owner = { can_have_$AGENT_TYPE_11$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_11$ + } + modifier = { + add = $AGENT_TYPE_11_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_11$ } + } + } + # Agent type 12. + 0 = { + trigger = { + NOR = { + scope:agent_type_12 = flag:empty + var:choice_a = flag:$AGENT_TYPE_12$ + } + scheme_owner = { can_have_$AGENT_TYPE_12$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_12$ + } + modifier = { + add = $AGENT_TYPE_12_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_12$ } + } + } + # Agent type 13. + 0 = { + trigger = { + NOR = { + scope:agent_type_13 = flag:empty + var:choice_a = flag:$AGENT_TYPE_13$ + } + scheme_owner = { can_have_$AGENT_TYPE_13$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_13$ + } + modifier = { + add = $AGENT_TYPE_13_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_13$ } + } + } + # Agent type 14. + 0 = { + trigger = { + NOR = { + scope:agent_type_14 = flag:empty + var:choice_a = flag:$AGENT_TYPE_14$ + } + scheme_owner = { can_have_$AGENT_TYPE_14$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_14$ + } + modifier = { + add = $AGENT_TYPE_14_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_14$ } + } + } + } + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0001 } + } +} +roll_critical_moment_options_15_agent_types_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:$OUTPUT_EVENT$ + } + if = { + limit = { + any_scheme_agent_slot = { count < character_max_scheme_agents_value } + scope:scheme = { + NOR = { + has_variable = choice_a + has_variable = choice_b + } + } + } + # First, let's determine which types we're using and which we ain't. + ## Agent type 01. + save_scope_value_as = { + name = agent_type_01 + value = flag:$AGENT_TYPE_01$ + } + ## Agent type 02. + save_scope_value_as = { + name = agent_type_02 + value = flag:$AGENT_TYPE_02$ + } + ## Agent type 03. + save_scope_value_as = { + name = agent_type_03 + value = flag:$AGENT_TYPE_03$ + } + ## Agent type 04. + save_scope_value_as = { + name = agent_type_04 + value = flag:$AGENT_TYPE_04$ + } + ## Agent type 05. + save_scope_value_as = { + name = agent_type_05 + value = flag:$AGENT_TYPE_05$ + } + ## Agent type 06. + save_scope_value_as = { + name = agent_type_06 + value = flag:$AGENT_TYPE_06$ + } + ## Agent type 07. + save_scope_value_as = { + name = agent_type_07 + value = flag:$AGENT_TYPE_07$ + } + ## Agent type 08. + save_scope_value_as = { + name = agent_type_08 + value = flag:$AGENT_TYPE_08$ + } + ## Agent type 09. + save_scope_value_as = { + name = agent_type_09 + value = flag:$AGENT_TYPE_09$ + } + ## Agent type 10. + save_scope_value_as = { + name = agent_type_10 + value = flag:$AGENT_TYPE_10$ + } + ## Agent type 11. + save_scope_value_as = { + name = agent_type_11 + value = flag:$AGENT_TYPE_11$ + } + ## Agent type 12. + save_scope_value_as = { + name = agent_type_12 + value = flag:$AGENT_TYPE_12$ + } + ## Agent type 13. + save_scope_value_as = { + name = agent_type_13 + value = flag:$AGENT_TYPE_13$ + } + ## Agent type 14. + save_scope_value_as = { + name = agent_type_14 + value = flag:$AGENT_TYPE_14$ + } + ## Agent type 15. + save_scope_value_as = { + name = agent_type_15 + value = flag:$AGENT_TYPE_15$ + } + # Then we roll for who's getting picked. + ## For var:choice_a. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOT = { scope:agent_type_01 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOT = { scope:agent_type_02 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOT = { scope:agent_type_03 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOT = { scope:agent_type_04 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOT = { scope:agent_type_05 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOT = { scope:agent_type_06 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOT = { scope:agent_type_07 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOT = { scope:agent_type_08 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + # Agent type 09. + 0 = { + trigger = { + NOT = { scope:agent_type_09 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_09$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_09$ + } + modifier = { + add = $AGENT_TYPE_09_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_09$ } + } + } + # Agent type 10. + 0 = { + trigger = { + NOT = { scope:agent_type_10 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_10$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_10$ + } + modifier = { + add = $AGENT_TYPE_10_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_10$ } + } + } + # Agent type 11. + 0 = { + trigger = { + NOT = { scope:agent_type_11 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_11$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_11$ + } + modifier = { + add = $AGENT_TYPE_11_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_11$ } + } + } + # Agent type 12. + 0 = { + trigger = { + NOT = { scope:agent_type_12 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_12$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_12$ + } + modifier = { + add = $AGENT_TYPE_12_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_12$ } + } + } + # Agent type 13. + 0 = { + trigger = { + NOT = { scope:agent_type_13 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_13$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_13$ + } + modifier = { + add = $AGENT_TYPE_13_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_13$ } + } + } + # Agent type 14. + 0 = { + trigger = { + NOT = { scope:agent_type_14 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_14$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_14$ + } + modifier = { + add = $AGENT_TYPE_14_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_14$ } + } + } + # Agent type 15. + 0 = { + trigger = { + NOT = { scope:agent_type_15 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_15$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_15$ + } + modifier = { + add = $AGENT_TYPE_15_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_15$ } + } + } + } + ## And var:choice_b. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOR = { + scope:agent_type_01 = flag:empty + var:choice_a = flag:$AGENT_TYPE_01$ + } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOR = { + scope:agent_type_02 = flag:empty + var:choice_a = flag:$AGENT_TYPE_02$ + } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOR = { + scope:agent_type_03 = flag:empty + var:choice_a = flag:$AGENT_TYPE_03$ + } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOR = { + scope:agent_type_04 = flag:empty + var:choice_a = flag:$AGENT_TYPE_04$ + } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOR = { + scope:agent_type_05 = flag:empty + var:choice_a = flag:$AGENT_TYPE_05$ + } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOR = { + scope:agent_type_06 = flag:empty + var:choice_a = flag:$AGENT_TYPE_06$ + } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOR = { + scope:agent_type_07 = flag:empty + var:choice_a = flag:$AGENT_TYPE_07$ + } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOR = { + scope:agent_type_08 = flag:empty + var:choice_a = flag:$AGENT_TYPE_08$ + } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + # Agent type 09. + 0 = { + trigger = { + NOR = { + scope:agent_type_09 = flag:empty + var:choice_a = flag:$AGENT_TYPE_09$ + } + scheme_owner = { can_have_$AGENT_TYPE_09$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_09$ + } + modifier = { + add = $AGENT_TYPE_09_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_09$ } + } + } + # Agent type 10. + 0 = { + trigger = { + NOR = { + scope:agent_type_10 = flag:empty + var:choice_a = flag:$AGENT_TYPE_10$ + } + scheme_owner = { can_have_$AGENT_TYPE_10$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_10$ + } + modifier = { + add = $AGENT_TYPE_10_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_10$ } + } + } + # Agent type 11. + 0 = { + trigger = { + NOR = { + scope:agent_type_11 = flag:empty + var:choice_a = flag:$AGENT_TYPE_11$ + } + scheme_owner = { can_have_$AGENT_TYPE_11$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_11$ + } + modifier = { + add = $AGENT_TYPE_11_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_11$ } + } + } + # Agent type 12. + 0 = { + trigger = { + NOR = { + scope:agent_type_12 = flag:empty + var:choice_a = flag:$AGENT_TYPE_12$ + } + scheme_owner = { can_have_$AGENT_TYPE_12$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_12$ + } + modifier = { + add = $AGENT_TYPE_12_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_12$ } + } + } + # Agent type 13. + 0 = { + trigger = { + NOR = { + scope:agent_type_13 = flag:empty + var:choice_a = flag:$AGENT_TYPE_13$ + } + scheme_owner = { can_have_$AGENT_TYPE_13$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_13$ + } + modifier = { + add = $AGENT_TYPE_13_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_13$ } + } + } + # Agent type 14. + 0 = { + trigger = { + NOR = { + scope:agent_type_14 = flag:empty + var:choice_a = flag:$AGENT_TYPE_14$ + } + scheme_owner = { can_have_$AGENT_TYPE_14$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_14$ + } + modifier = { + add = $AGENT_TYPE_14_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_14$ } + } + } + # Agent type 15. + 0 = { + trigger = { + NOR = { + scope:agent_type_15 = flag:empty + var:choice_a = flag:$AGENT_TYPE_15$ + } + scheme_owner = { can_have_$AGENT_TYPE_15$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_15$ + } + modifier = { + add = $AGENT_TYPE_15_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_15$ } + } + } + } + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0001 } + } +} +roll_critical_moment_options_16_agent_types_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:$OUTPUT_EVENT$ + } + if = { + limit = { + any_scheme_agent_slot = { count < character_max_scheme_agents_value } + scope:scheme = { + NOR = { + has_variable = choice_a + has_variable = choice_b + } + } + } + # First, let's determine which types we're using and which we ain't. + ## Agent type 01. + save_scope_value_as = { + name = agent_type_01 + value = flag:$AGENT_TYPE_01$ + } + ## Agent type 02. + save_scope_value_as = { + name = agent_type_02 + value = flag:$AGENT_TYPE_02$ + } + ## Agent type 03. + save_scope_value_as = { + name = agent_type_03 + value = flag:$AGENT_TYPE_03$ + } + ## Agent type 04. + save_scope_value_as = { + name = agent_type_04 + value = flag:$AGENT_TYPE_04$ + } + ## Agent type 05. + save_scope_value_as = { + name = agent_type_05 + value = flag:$AGENT_TYPE_05$ + } + ## Agent type 06. + save_scope_value_as = { + name = agent_type_06 + value = flag:$AGENT_TYPE_06$ + } + ## Agent type 07. + save_scope_value_as = { + name = agent_type_07 + value = flag:$AGENT_TYPE_07$ + } + ## Agent type 08. + save_scope_value_as = { + name = agent_type_08 + value = flag:$AGENT_TYPE_08$ + } + ## Agent type 09. + save_scope_value_as = { + name = agent_type_09 + value = flag:$AGENT_TYPE_09$ + } + ## Agent type 10. + save_scope_value_as = { + name = agent_type_10 + value = flag:$AGENT_TYPE_10$ + } + ## Agent type 11. + save_scope_value_as = { + name = agent_type_11 + value = flag:$AGENT_TYPE_11$ + } + ## Agent type 12. + save_scope_value_as = { + name = agent_type_12 + value = flag:$AGENT_TYPE_12$ + } + ## Agent type 13. + save_scope_value_as = { + name = agent_type_13 + value = flag:$AGENT_TYPE_13$ + } + ## Agent type 14. + save_scope_value_as = { + name = agent_type_14 + value = flag:$AGENT_TYPE_14$ + } + ## Agent type 15. + save_scope_value_as = { + name = agent_type_15 + value = flag:$AGENT_TYPE_15$ + } + ## Agent type 16. + save_scope_value_as = { + name = agent_type_16 + value = flag:$AGENT_TYPE_16$ + } + # Then we roll for who's getting picked. + ## For var:choice_a. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOT = { scope:agent_type_01 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOT = { scope:agent_type_02 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOT = { scope:agent_type_03 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOT = { scope:agent_type_04 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOT = { scope:agent_type_05 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOT = { scope:agent_type_06 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOT = { scope:agent_type_07 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOT = { scope:agent_type_08 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + # Agent type 09. + 0 = { + trigger = { + NOT = { scope:agent_type_09 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_09$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_09$ + } + modifier = { + add = $AGENT_TYPE_09_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_09$ } + } + } + # Agent type 10. + 0 = { + trigger = { + NOT = { scope:agent_type_10 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_10$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_10$ + } + modifier = { + add = $AGENT_TYPE_10_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_10$ } + } + } + # Agent type 11. + 0 = { + trigger = { + NOT = { scope:agent_type_11 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_11$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_11$ + } + modifier = { + add = $AGENT_TYPE_11_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_11$ } + } + } + # Agent type 12. + 0 = { + trigger = { + NOT = { scope:agent_type_12 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_12$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_12$ + } + modifier = { + add = $AGENT_TYPE_12_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_12$ } + } + } + # Agent type 13. + 0 = { + trigger = { + NOT = { scope:agent_type_13 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_13$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_13$ + } + modifier = { + add = $AGENT_TYPE_13_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_13$ } + } + } + # Agent type 14. + 0 = { + trigger = { + NOT = { scope:agent_type_14 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_14$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_14$ + } + modifier = { + add = $AGENT_TYPE_14_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_14$ } + } + } + # Agent type 15. + 0 = { + trigger = { + NOT = { scope:agent_type_15 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_15$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_15$ + } + modifier = { + add = $AGENT_TYPE_15_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_15$ } + } + } + # Agent type 16. + 0 = { + trigger = { + NOT = { scope:agent_type_16 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_16$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_16$ + } + modifier = { + add = $AGENT_TYPE_16_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_16$ } + } + } + } + ## And var:choice_b. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOR = { + scope:agent_type_01 = flag:empty + var:choice_a = flag:$AGENT_TYPE_01$ + } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOR = { + scope:agent_type_02 = flag:empty + var:choice_a = flag:$AGENT_TYPE_02$ + } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOR = { + scope:agent_type_03 = flag:empty + var:choice_a = flag:$AGENT_TYPE_03$ + } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOR = { + scope:agent_type_04 = flag:empty + var:choice_a = flag:$AGENT_TYPE_04$ + } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOR = { + scope:agent_type_05 = flag:empty + var:choice_a = flag:$AGENT_TYPE_05$ + } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOR = { + scope:agent_type_06 = flag:empty + var:choice_a = flag:$AGENT_TYPE_06$ + } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOR = { + scope:agent_type_07 = flag:empty + var:choice_a = flag:$AGENT_TYPE_07$ + } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOR = { + scope:agent_type_08 = flag:empty + var:choice_a = flag:$AGENT_TYPE_08$ + } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + # Agent type 09. + 0 = { + trigger = { + NOR = { + scope:agent_type_09 = flag:empty + var:choice_a = flag:$AGENT_TYPE_09$ + } + scheme_owner = { can_have_$AGENT_TYPE_09$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_09$ + } + modifier = { + add = $AGENT_TYPE_09_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_09$ } + } + } + # Agent type 10. + 0 = { + trigger = { + NOR = { + scope:agent_type_10 = flag:empty + var:choice_a = flag:$AGENT_TYPE_10$ + } + scheme_owner = { can_have_$AGENT_TYPE_10$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_10$ + } + modifier = { + add = $AGENT_TYPE_10_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_10$ } + } + } + # Agent type 11. + 0 = { + trigger = { + NOR = { + scope:agent_type_11 = flag:empty + var:choice_a = flag:$AGENT_TYPE_11$ + } + scheme_owner = { can_have_$AGENT_TYPE_11$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_11$ + } + modifier = { + add = $AGENT_TYPE_11_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_11$ } + } + } + # Agent type 12. + 0 = { + trigger = { + NOR = { + scope:agent_type_12 = flag:empty + var:choice_a = flag:$AGENT_TYPE_12$ + } + scheme_owner = { can_have_$AGENT_TYPE_12$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_12$ + } + modifier = { + add = $AGENT_TYPE_12_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_12$ } + } + } + # Agent type 13. + 0 = { + trigger = { + NOR = { + scope:agent_type_13 = flag:empty + var:choice_a = flag:$AGENT_TYPE_13$ + } + scheme_owner = { can_have_$AGENT_TYPE_13$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_13$ + } + modifier = { + add = $AGENT_TYPE_13_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_13$ } + } + } + # Agent type 14. + 0 = { + trigger = { + NOR = { + scope:agent_type_14 = flag:empty + var:choice_a = flag:$AGENT_TYPE_14$ + } + scheme_owner = { can_have_$AGENT_TYPE_14$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_14$ + } + modifier = { + add = $AGENT_TYPE_14_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_14$ } + } + } + # Agent type 15. + 0 = { + trigger = { + NOR = { + scope:agent_type_15 = flag:empty + var:choice_a = flag:$AGENT_TYPE_15$ + } + scheme_owner = { can_have_$AGENT_TYPE_15$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_15$ + } + modifier = { + add = $AGENT_TYPE_15_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_15$ } + } + } + # Agent type 16. + 0 = { + trigger = { + NOR = { + scope:agent_type_16 = flag:empty + var:choice_a = flag:$AGENT_TYPE_16$ + } + scheme_owner = { can_have_$AGENT_TYPE_16$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_16$ + } + modifier = { + add = $AGENT_TYPE_16_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_16$ } + } + } + } + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0001 } + } +} +roll_critical_moment_options_17_agent_types_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:$OUTPUT_EVENT$ + } + if = { + limit = { + any_scheme_agent_slot = { count < character_max_scheme_agents_value } + scope:scheme = { + NOR = { + has_variable = choice_a + has_variable = choice_b + } + } + } + # First, let's determine which types we're using and which we ain't. + ## Agent type 01. + save_scope_value_as = { + name = agent_type_01 + value = flag:$AGENT_TYPE_01$ + } + ## Agent type 02. + save_scope_value_as = { + name = agent_type_02 + value = flag:$AGENT_TYPE_02$ + } + ## Agent type 03. + save_scope_value_as = { + name = agent_type_03 + value = flag:$AGENT_TYPE_03$ + } + ## Agent type 04. + save_scope_value_as = { + name = agent_type_04 + value = flag:$AGENT_TYPE_04$ + } + ## Agent type 05. + save_scope_value_as = { + name = agent_type_05 + value = flag:$AGENT_TYPE_05$ + } + ## Agent type 06. + save_scope_value_as = { + name = agent_type_06 + value = flag:$AGENT_TYPE_06$ + } + ## Agent type 07. + save_scope_value_as = { + name = agent_type_07 + value = flag:$AGENT_TYPE_07$ + } + ## Agent type 08. + save_scope_value_as = { + name = agent_type_08 + value = flag:$AGENT_TYPE_08$ + } + ## Agent type 09. + save_scope_value_as = { + name = agent_type_09 + value = flag:$AGENT_TYPE_09$ + } + ## Agent type 10. + save_scope_value_as = { + name = agent_type_10 + value = flag:$AGENT_TYPE_10$ + } + ## Agent type 11. + save_scope_value_as = { + name = agent_type_11 + value = flag:$AGENT_TYPE_11$ + } + ## Agent type 12. + save_scope_value_as = { + name = agent_type_12 + value = flag:$AGENT_TYPE_12$ + } + ## Agent type 13. + save_scope_value_as = { + name = agent_type_13 + value = flag:$AGENT_TYPE_13$ + } + ## Agent type 14. + save_scope_value_as = { + name = agent_type_14 + value = flag:$AGENT_TYPE_14$ + } + ## Agent type 15. + save_scope_value_as = { + name = agent_type_15 + value = flag:$AGENT_TYPE_15$ + } + ## Agent type 16. + save_scope_value_as = { + name = agent_type_16 + value = flag:$AGENT_TYPE_16$ + } + ## Agent type 17. + save_scope_value_as = { + name = agent_type_17 + value = flag:$AGENT_TYPE_17$ + } + # Then we roll for who's getting picked. + ## For var:choice_a. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOT = { scope:agent_type_01 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOT = { scope:agent_type_02 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOT = { scope:agent_type_03 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOT = { scope:agent_type_04 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOT = { scope:agent_type_05 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOT = { scope:agent_type_06 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOT = { scope:agent_type_07 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOT = { scope:agent_type_08 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + # Agent type 09. + 0 = { + trigger = { + NOT = { scope:agent_type_09 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_09$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_09$ + } + modifier = { + add = $AGENT_TYPE_09_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_09$ } + } + } + # Agent type 10. + 0 = { + trigger = { + NOT = { scope:agent_type_10 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_10$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_10$ + } + modifier = { + add = $AGENT_TYPE_10_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_10$ } + } + } + # Agent type 11. + 0 = { + trigger = { + NOT = { scope:agent_type_11 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_11$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_11$ + } + modifier = { + add = $AGENT_TYPE_11_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_11$ } + } + } + # Agent type 12. + 0 = { + trigger = { + NOT = { scope:agent_type_12 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_12$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_12$ + } + modifier = { + add = $AGENT_TYPE_12_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_12$ } + } + } + # Agent type 13. + 0 = { + trigger = { + NOT = { scope:agent_type_13 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_13$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_13$ + } + modifier = { + add = $AGENT_TYPE_13_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_13$ } + } + } + # Agent type 14. + 0 = { + trigger = { + NOT = { scope:agent_type_14 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_14$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_14$ + } + modifier = { + add = $AGENT_TYPE_14_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_14$ } + } + } + # Agent type 15. + 0 = { + trigger = { + NOT = { scope:agent_type_15 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_15$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_15$ + } + modifier = { + add = $AGENT_TYPE_15_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_15$ } + } + } + # Agent type 16. + 0 = { + trigger = { + NOT = { scope:agent_type_16 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_16$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_16$ + } + modifier = { + add = $AGENT_TYPE_16_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_16$ } + } + } + # Agent type 17. + 0 = { + trigger = { + NOT = { scope:agent_type_17 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_17$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_17$ + } + modifier = { + add = $AGENT_TYPE_17_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_17$ } + } + } + } + ## And var:choice_b. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOR = { + scope:agent_type_01 = flag:empty + var:choice_a = flag:$AGENT_TYPE_01$ + } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOR = { + scope:agent_type_02 = flag:empty + var:choice_a = flag:$AGENT_TYPE_02$ + } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOR = { + scope:agent_type_03 = flag:empty + var:choice_a = flag:$AGENT_TYPE_03$ + } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOR = { + scope:agent_type_04 = flag:empty + var:choice_a = flag:$AGENT_TYPE_04$ + } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOR = { + scope:agent_type_05 = flag:empty + var:choice_a = flag:$AGENT_TYPE_05$ + } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOR = { + scope:agent_type_06 = flag:empty + var:choice_a = flag:$AGENT_TYPE_06$ + } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOR = { + scope:agent_type_07 = flag:empty + var:choice_a = flag:$AGENT_TYPE_07$ + } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOR = { + scope:agent_type_08 = flag:empty + var:choice_a = flag:$AGENT_TYPE_08$ + } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + # Agent type 09. + 0 = { + trigger = { + NOR = { + scope:agent_type_09 = flag:empty + var:choice_a = flag:$AGENT_TYPE_09$ + } + scheme_owner = { can_have_$AGENT_TYPE_09$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_09$ + } + modifier = { + add = $AGENT_TYPE_09_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_09$ } + } + } + # Agent type 10. + 0 = { + trigger = { + NOR = { + scope:agent_type_10 = flag:empty + var:choice_a = flag:$AGENT_TYPE_10$ + } + scheme_owner = { can_have_$AGENT_TYPE_10$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_10$ + } + modifier = { + add = $AGENT_TYPE_10_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_10$ } + } + } + # Agent type 11. + 0 = { + trigger = { + NOR = { + scope:agent_type_11 = flag:empty + var:choice_a = flag:$AGENT_TYPE_11$ + } + scheme_owner = { can_have_$AGENT_TYPE_11$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_11$ + } + modifier = { + add = $AGENT_TYPE_11_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_11$ } + } + } + # Agent type 12. + 0 = { + trigger = { + NOR = { + scope:agent_type_12 = flag:empty + var:choice_a = flag:$AGENT_TYPE_12$ + } + scheme_owner = { can_have_$AGENT_TYPE_12$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_12$ + } + modifier = { + add = $AGENT_TYPE_12_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_12$ } + } + } + # Agent type 13. + 0 = { + trigger = { + NOR = { + scope:agent_type_13 = flag:empty + var:choice_a = flag:$AGENT_TYPE_13$ + } + scheme_owner = { can_have_$AGENT_TYPE_13$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_13$ + } + modifier = { + add = $AGENT_TYPE_13_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_13$ } + } + } + # Agent type 14. + 0 = { + trigger = { + NOR = { + scope:agent_type_14 = flag:empty + var:choice_a = flag:$AGENT_TYPE_14$ + } + scheme_owner = { can_have_$AGENT_TYPE_14$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_14$ + } + modifier = { + add = $AGENT_TYPE_14_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_14$ } + } + } + # Agent type 15. + 0 = { + trigger = { + NOR = { + scope:agent_type_15 = flag:empty + var:choice_a = flag:$AGENT_TYPE_15$ + } + scheme_owner = { can_have_$AGENT_TYPE_15$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_15$ + } + modifier = { + add = $AGENT_TYPE_15_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_15$ } + } + } + # Agent type 16. + 0 = { + trigger = { + NOR = { + scope:agent_type_16 = flag:empty + var:choice_a = flag:$AGENT_TYPE_16$ + } + scheme_owner = { can_have_$AGENT_TYPE_16$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_16$ + } + modifier = { + add = $AGENT_TYPE_16_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_16$ } + } + } + # Agent type 17. + 0 = { + trigger = { + NOR = { + scope:agent_type_17 = flag:empty + var:choice_a = flag:$AGENT_TYPE_17$ + } + scheme_owner = { can_have_$AGENT_TYPE_17$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_17$ + } + modifier = { + add = $AGENT_TYPE_17_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_17$ } + } + } + } + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0001 } + } +} +roll_critical_moment_options_18_agent_types_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:$OUTPUT_EVENT$ + } + if = { + limit = { + any_scheme_agent_slot = { count < character_max_scheme_agents_value } + scope:scheme = { + NOR = { + has_variable = choice_a + has_variable = choice_b + } + } + } + # First, let's determine which types we're using and which we ain't. + ## Agent type 01. + save_scope_value_as = { + name = agent_type_01 + value = flag:$AGENT_TYPE_01$ + } + ## Agent type 02. + save_scope_value_as = { + name = agent_type_02 + value = flag:$AGENT_TYPE_02$ + } + ## Agent type 03. + save_scope_value_as = { + name = agent_type_03 + value = flag:$AGENT_TYPE_03$ + } + ## Agent type 04. + save_scope_value_as = { + name = agent_type_04 + value = flag:$AGENT_TYPE_04$ + } + ## Agent type 05. + save_scope_value_as = { + name = agent_type_05 + value = flag:$AGENT_TYPE_05$ + } + ## Agent type 06. + save_scope_value_as = { + name = agent_type_06 + value = flag:$AGENT_TYPE_06$ + } + ## Agent type 07. + save_scope_value_as = { + name = agent_type_07 + value = flag:$AGENT_TYPE_07$ + } + ## Agent type 08. + save_scope_value_as = { + name = agent_type_08 + value = flag:$AGENT_TYPE_08$ + } + ## Agent type 09. + save_scope_value_as = { + name = agent_type_09 + value = flag:$AGENT_TYPE_09$ + } + ## Agent type 10. + save_scope_value_as = { + name = agent_type_10 + value = flag:$AGENT_TYPE_10$ + } + ## Agent type 11. + save_scope_value_as = { + name = agent_type_11 + value = flag:$AGENT_TYPE_11$ + } + ## Agent type 12. + save_scope_value_as = { + name = agent_type_12 + value = flag:$AGENT_TYPE_12$ + } + ## Agent type 13. + save_scope_value_as = { + name = agent_type_13 + value = flag:$AGENT_TYPE_13$ + } + ## Agent type 14. + save_scope_value_as = { + name = agent_type_14 + value = flag:$AGENT_TYPE_14$ + } + ## Agent type 15. + save_scope_value_as = { + name = agent_type_15 + value = flag:$AGENT_TYPE_15$ + } + ## Agent type 16. + save_scope_value_as = { + name = agent_type_16 + value = flag:$AGENT_TYPE_16$ + } + ## Agent type 17. + save_scope_value_as = { + name = agent_type_17 + value = flag:$AGENT_TYPE_17$ + } + ## Agent type 18. + save_scope_value_as = { + name = agent_type_18 + value = flag:$AGENT_TYPE_18$ + } + # Then we roll for who's getting picked. + ## For var:choice_a. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOT = { scope:agent_type_01 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOT = { scope:agent_type_02 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOT = { scope:agent_type_03 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOT = { scope:agent_type_04 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOT = { scope:agent_type_05 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOT = { scope:agent_type_06 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOT = { scope:agent_type_07 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOT = { scope:agent_type_08 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + # Agent type 09. + 0 = { + trigger = { + NOT = { scope:agent_type_09 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_09$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_09$ + } + modifier = { + add = $AGENT_TYPE_09_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_09$ } + } + } + # Agent type 10. + 0 = { + trigger = { + NOT = { scope:agent_type_10 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_10$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_10$ + } + modifier = { + add = $AGENT_TYPE_10_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_10$ } + } + } + # Agent type 11. + 0 = { + trigger = { + NOT = { scope:agent_type_11 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_11$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_11$ + } + modifier = { + add = $AGENT_TYPE_11_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_11$ } + } + } + # Agent type 12. + 0 = { + trigger = { + NOT = { scope:agent_type_12 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_12$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_12$ + } + modifier = { + add = $AGENT_TYPE_12_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_12$ } + } + } + # Agent type 13. + 0 = { + trigger = { + NOT = { scope:agent_type_13 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_13$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_13$ + } + modifier = { + add = $AGENT_TYPE_13_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_13$ } + } + } + # Agent type 14. + 0 = { + trigger = { + NOT = { scope:agent_type_14 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_14$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_14$ + } + modifier = { + add = $AGENT_TYPE_14_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_14$ } + } + } + # Agent type 15. + 0 = { + trigger = { + NOT = { scope:agent_type_15 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_15$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_15$ + } + modifier = { + add = $AGENT_TYPE_15_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_15$ } + } + } + # Agent type 16. + 0 = { + trigger = { + NOT = { scope:agent_type_16 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_16$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_16$ + } + modifier = { + add = $AGENT_TYPE_16_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_16$ } + } + } + # Agent type 17. + 0 = { + trigger = { + NOT = { scope:agent_type_17 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_17$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_17$ + } + modifier = { + add = $AGENT_TYPE_17_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_17$ } + } + } + # Agent type 18. + 0 = { + trigger = { + NOT = { scope:agent_type_18 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_18$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_18$ + } + modifier = { + add = $AGENT_TYPE_18_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_18$ } + } + } + } + ## And var:choice_b. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOR = { + scope:agent_type_01 = flag:empty + var:choice_a = flag:$AGENT_TYPE_01$ + } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOR = { + scope:agent_type_02 = flag:empty + var:choice_a = flag:$AGENT_TYPE_02$ + } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOR = { + scope:agent_type_03 = flag:empty + var:choice_a = flag:$AGENT_TYPE_03$ + } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOR = { + scope:agent_type_04 = flag:empty + var:choice_a = flag:$AGENT_TYPE_04$ + } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOR = { + scope:agent_type_05 = flag:empty + var:choice_a = flag:$AGENT_TYPE_05$ + } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOR = { + scope:agent_type_06 = flag:empty + var:choice_a = flag:$AGENT_TYPE_06$ + } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOR = { + scope:agent_type_07 = flag:empty + var:choice_a = flag:$AGENT_TYPE_07$ + } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOR = { + scope:agent_type_08 = flag:empty + var:choice_a = flag:$AGENT_TYPE_08$ + } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + # Agent type 09. + 0 = { + trigger = { + NOR = { + scope:agent_type_09 = flag:empty + var:choice_a = flag:$AGENT_TYPE_09$ + } + scheme_owner = { can_have_$AGENT_TYPE_09$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_09$ + } + modifier = { + add = $AGENT_TYPE_09_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_09$ } + } + } + # Agent type 10. + 0 = { + trigger = { + NOR = { + scope:agent_type_10 = flag:empty + var:choice_a = flag:$AGENT_TYPE_10$ + } + scheme_owner = { can_have_$AGENT_TYPE_10$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_10$ + } + modifier = { + add = $AGENT_TYPE_10_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_10$ } + } + } + # Agent type 11. + 0 = { + trigger = { + NOR = { + scope:agent_type_11 = flag:empty + var:choice_a = flag:$AGENT_TYPE_11$ + } + scheme_owner = { can_have_$AGENT_TYPE_11$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_11$ + } + modifier = { + add = $AGENT_TYPE_11_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_11$ } + } + } + # Agent type 12. + 0 = { + trigger = { + NOR = { + scope:agent_type_12 = flag:empty + var:choice_a = flag:$AGENT_TYPE_12$ + } + scheme_owner = { can_have_$AGENT_TYPE_12$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_12$ + } + modifier = { + add = $AGENT_TYPE_12_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_12$ } + } + } + # Agent type 13. + 0 = { + trigger = { + NOR = { + scope:agent_type_13 = flag:empty + var:choice_a = flag:$AGENT_TYPE_13$ + } + scheme_owner = { can_have_$AGENT_TYPE_13$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_13$ + } + modifier = { + add = $AGENT_TYPE_13_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_13$ } + } + } + # Agent type 14. + 0 = { + trigger = { + NOR = { + scope:agent_type_14 = flag:empty + var:choice_a = flag:$AGENT_TYPE_14$ + } + scheme_owner = { can_have_$AGENT_TYPE_14$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_14$ + } + modifier = { + add = $AGENT_TYPE_14_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_14$ } + } + } + # Agent type 15. + 0 = { + trigger = { + NOR = { + scope:agent_type_15 = flag:empty + var:choice_a = flag:$AGENT_TYPE_15$ + } + scheme_owner = { can_have_$AGENT_TYPE_15$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_15$ + } + modifier = { + add = $AGENT_TYPE_15_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_15$ } + } + } + # Agent type 16. + 0 = { + trigger = { + NOR = { + scope:agent_type_16 = flag:empty + var:choice_a = flag:$AGENT_TYPE_16$ + } + scheme_owner = { can_have_$AGENT_TYPE_16$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_16$ + } + modifier = { + add = $AGENT_TYPE_16_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_16$ } + } + } + # Agent type 17. + 0 = { + trigger = { + NOR = { + scope:agent_type_17 = flag:empty + var:choice_a = flag:$AGENT_TYPE_17$ + } + scheme_owner = { can_have_$AGENT_TYPE_17$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_17$ + } + modifier = { + add = $AGENT_TYPE_17_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_17$ } + } + } + # Agent type 18. + 0 = { + trigger = { + NOR = { + scope:agent_type_18 = flag:empty + var:choice_a = flag:$AGENT_TYPE_18$ + } + scheme_owner = { can_have_$AGENT_TYPE_18$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_18$ + } + modifier = { + add = $AGENT_TYPE_18_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_18$ } + } + } + } + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0001 } + } +} +roll_critical_moment_options_19_agent_types_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:$OUTPUT_EVENT$ + } + if = { + limit = { + any_scheme_agent_slot = { count < character_max_scheme_agents_value } + scope:scheme = { + NOR = { + has_variable = choice_a + has_variable = choice_b + } + } + } + # First, let's determine which types we're using and which we ain't. + ## Agent type 01. + save_scope_value_as = { + name = agent_type_01 + value = flag:$AGENT_TYPE_01$ + } + ## Agent type 02. + save_scope_value_as = { + name = agent_type_02 + value = flag:$AGENT_TYPE_02$ + } + ## Agent type 03. + save_scope_value_as = { + name = agent_type_03 + value = flag:$AGENT_TYPE_03$ + } + ## Agent type 04. + save_scope_value_as = { + name = agent_type_04 + value = flag:$AGENT_TYPE_04$ + } + ## Agent type 05. + save_scope_value_as = { + name = agent_type_05 + value = flag:$AGENT_TYPE_05$ + } + ## Agent type 06. + save_scope_value_as = { + name = agent_type_06 + value = flag:$AGENT_TYPE_06$ + } + ## Agent type 07. + save_scope_value_as = { + name = agent_type_07 + value = flag:$AGENT_TYPE_07$ + } + ## Agent type 08. + save_scope_value_as = { + name = agent_type_08 + value = flag:$AGENT_TYPE_08$ + } + ## Agent type 09. + save_scope_value_as = { + name = agent_type_09 + value = flag:$AGENT_TYPE_09$ + } + ## Agent type 10. + save_scope_value_as = { + name = agent_type_10 + value = flag:$AGENT_TYPE_10$ + } + ## Agent type 11. + save_scope_value_as = { + name = agent_type_11 + value = flag:$AGENT_TYPE_11$ + } + ## Agent type 12. + save_scope_value_as = { + name = agent_type_12 + value = flag:$AGENT_TYPE_12$ + } + ## Agent type 13. + save_scope_value_as = { + name = agent_type_13 + value = flag:$AGENT_TYPE_13$ + } + ## Agent type 14. + save_scope_value_as = { + name = agent_type_14 + value = flag:$AGENT_TYPE_14$ + } + ## Agent type 15. + save_scope_value_as = { + name = agent_type_15 + value = flag:$AGENT_TYPE_15$ + } + ## Agent type 16. + save_scope_value_as = { + name = agent_type_16 + value = flag:$AGENT_TYPE_16$ + } + ## Agent type 17. + save_scope_value_as = { + name = agent_type_17 + value = flag:$AGENT_TYPE_17$ + } + ## Agent type 18. + save_scope_value_as = { + name = agent_type_18 + value = flag:$AGENT_TYPE_18$ + } + ## Agent type 19. + save_scope_value_as = { + name = agent_type_19 + value = flag:$AGENT_TYPE_19$ + } + # Then we roll for who's getting picked. + ## For var:choice_a. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOT = { scope:agent_type_01 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOT = { scope:agent_type_02 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOT = { scope:agent_type_03 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOT = { scope:agent_type_04 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOT = { scope:agent_type_05 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOT = { scope:agent_type_06 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOT = { scope:agent_type_07 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOT = { scope:agent_type_08 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + # Agent type 09. + 0 = { + trigger = { + NOT = { scope:agent_type_09 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_09$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_09$ + } + modifier = { + add = $AGENT_TYPE_09_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_09$ } + } + } + # Agent type 10. + 0 = { + trigger = { + NOT = { scope:agent_type_10 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_10$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_10$ + } + modifier = { + add = $AGENT_TYPE_10_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_10$ } + } + } + # Agent type 11. + 0 = { + trigger = { + NOT = { scope:agent_type_11 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_11$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_11$ + } + modifier = { + add = $AGENT_TYPE_11_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_11$ } + } + } + # Agent type 12. + 0 = { + trigger = { + NOT = { scope:agent_type_12 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_12$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_12$ + } + modifier = { + add = $AGENT_TYPE_12_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_12$ } + } + } + # Agent type 13. + 0 = { + trigger = { + NOT = { scope:agent_type_13 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_13$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_13$ + } + modifier = { + add = $AGENT_TYPE_13_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_13$ } + } + } + # Agent type 14. + 0 = { + trigger = { + NOT = { scope:agent_type_14 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_14$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_14$ + } + modifier = { + add = $AGENT_TYPE_14_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_14$ } + } + } + # Agent type 15. + 0 = { + trigger = { + NOT = { scope:agent_type_15 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_15$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_15$ + } + modifier = { + add = $AGENT_TYPE_15_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_15$ } + } + } + # Agent type 16. + 0 = { + trigger = { + NOT = { scope:agent_type_16 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_16$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_16$ + } + modifier = { + add = $AGENT_TYPE_16_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_16$ } + } + } + # Agent type 17. + 0 = { + trigger = { + NOT = { scope:agent_type_17 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_17$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_17$ + } + modifier = { + add = $AGENT_TYPE_17_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_17$ } + } + } + # Agent type 18. + 0 = { + trigger = { + NOT = { scope:agent_type_18 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_18$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_18$ + } + modifier = { + add = $AGENT_TYPE_18_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_18$ } + } + } + # Agent type 19. + 0 = { + trigger = { + NOT = { scope:agent_type_19 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_19$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_19$ + } + modifier = { + add = $AGENT_TYPE_19_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_19$ } + } + } + } + ## And var:choice_b. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOR = { + scope:agent_type_01 = flag:empty + var:choice_a = flag:$AGENT_TYPE_01$ + } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOR = { + scope:agent_type_02 = flag:empty + var:choice_a = flag:$AGENT_TYPE_02$ + } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOR = { + scope:agent_type_03 = flag:empty + var:choice_a = flag:$AGENT_TYPE_03$ + } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOR = { + scope:agent_type_04 = flag:empty + var:choice_a = flag:$AGENT_TYPE_04$ + } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOR = { + scope:agent_type_05 = flag:empty + var:choice_a = flag:$AGENT_TYPE_05$ + } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOR = { + scope:agent_type_06 = flag:empty + var:choice_a = flag:$AGENT_TYPE_06$ + } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOR = { + scope:agent_type_07 = flag:empty + var:choice_a = flag:$AGENT_TYPE_07$ + } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOR = { + scope:agent_type_08 = flag:empty + var:choice_a = flag:$AGENT_TYPE_08$ + } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + # Agent type 09. + 0 = { + trigger = { + NOR = { + scope:agent_type_09 = flag:empty + var:choice_a = flag:$AGENT_TYPE_09$ + } + scheme_owner = { can_have_$AGENT_TYPE_09$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_09$ + } + modifier = { + add = $AGENT_TYPE_09_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_09$ } + } + } + # Agent type 10. + 0 = { + trigger = { + NOR = { + scope:agent_type_10 = flag:empty + var:choice_a = flag:$AGENT_TYPE_10$ + } + scheme_owner = { can_have_$AGENT_TYPE_10$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_10$ + } + modifier = { + add = $AGENT_TYPE_10_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_10$ } + } + } + # Agent type 11. + 0 = { + trigger = { + NOR = { + scope:agent_type_11 = flag:empty + var:choice_a = flag:$AGENT_TYPE_11$ + } + scheme_owner = { can_have_$AGENT_TYPE_11$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_11$ + } + modifier = { + add = $AGENT_TYPE_11_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_11$ } + } + } + # Agent type 12. + 0 = { + trigger = { + NOR = { + scope:agent_type_12 = flag:empty + var:choice_a = flag:$AGENT_TYPE_12$ + } + scheme_owner = { can_have_$AGENT_TYPE_12$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_12$ + } + modifier = { + add = $AGENT_TYPE_12_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_12$ } + } + } + # Agent type 13. + 0 = { + trigger = { + NOR = { + scope:agent_type_13 = flag:empty + var:choice_a = flag:$AGENT_TYPE_13$ + } + scheme_owner = { can_have_$AGENT_TYPE_13$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_13$ + } + modifier = { + add = $AGENT_TYPE_13_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_13$ } + } + } + # Agent type 14. + 0 = { + trigger = { + NOR = { + scope:agent_type_14 = flag:empty + var:choice_a = flag:$AGENT_TYPE_14$ + } + scheme_owner = { can_have_$AGENT_TYPE_14$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_14$ + } + modifier = { + add = $AGENT_TYPE_14_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_14$ } + } + } + # Agent type 15. + 0 = { + trigger = { + NOR = { + scope:agent_type_15 = flag:empty + var:choice_a = flag:$AGENT_TYPE_15$ + } + scheme_owner = { can_have_$AGENT_TYPE_15$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_15$ + } + modifier = { + add = $AGENT_TYPE_15_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_15$ } + } + } + # Agent type 16. + 0 = { + trigger = { + NOR = { + scope:agent_type_16 = flag:empty + var:choice_a = flag:$AGENT_TYPE_16$ + } + scheme_owner = { can_have_$AGENT_TYPE_16$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_16$ + } + modifier = { + add = $AGENT_TYPE_16_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_16$ } + } + } + # Agent type 17. + 0 = { + trigger = { + NOR = { + scope:agent_type_17 = flag:empty + var:choice_a = flag:$AGENT_TYPE_17$ + } + scheme_owner = { can_have_$AGENT_TYPE_17$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_17$ + } + modifier = { + add = $AGENT_TYPE_17_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_17$ } + } + } + # Agent type 18. + 0 = { + trigger = { + NOR = { + scope:agent_type_18 = flag:empty + var:choice_a = flag:$AGENT_TYPE_18$ + } + scheme_owner = { can_have_$AGENT_TYPE_18$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_18$ + } + modifier = { + add = $AGENT_TYPE_18_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_18$ } + } + } + # Agent type 19. + 0 = { + trigger = { + NOR = { + scope:agent_type_19 = flag:empty + var:choice_a = flag:$AGENT_TYPE_19$ + } + scheme_owner = { can_have_$AGENT_TYPE_19$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_19$ + } + modifier = { + add = $AGENT_TYPE_19_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_19$ } + } + } + } + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0001 } + } +} +roll_critical_moment_options_20_agent_types_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:$OUTPUT_EVENT$ + } + if = { + limit = { + any_scheme_agent_slot = { count < character_max_scheme_agents_value } + scope:scheme = { + NOR = { + has_variable = choice_a + has_variable = choice_b + } + } + } + # First, let's determine which types we're using and which we ain't. + ## Agent type 01. + save_scope_value_as = { + name = agent_type_01 + value = flag:$AGENT_TYPE_01$ + } + ## Agent type 02. + save_scope_value_as = { + name = agent_type_02 + value = flag:$AGENT_TYPE_02$ + } + ## Agent type 03. + save_scope_value_as = { + name = agent_type_03 + value = flag:$AGENT_TYPE_03$ + } + ## Agent type 04. + save_scope_value_as = { + name = agent_type_04 + value = flag:$AGENT_TYPE_04$ + } + ## Agent type 05. + save_scope_value_as = { + name = agent_type_05 + value = flag:$AGENT_TYPE_05$ + } + ## Agent type 06. + save_scope_value_as = { + name = agent_type_06 + value = flag:$AGENT_TYPE_06$ + } + ## Agent type 07. + save_scope_value_as = { + name = agent_type_07 + value = flag:$AGENT_TYPE_07$ + } + ## Agent type 08. + save_scope_value_as = { + name = agent_type_08 + value = flag:$AGENT_TYPE_08$ + } + ## Agent type 09. + save_scope_value_as = { + name = agent_type_09 + value = flag:$AGENT_TYPE_09$ + } + ## Agent type 10. + save_scope_value_as = { + name = agent_type_10 + value = flag:$AGENT_TYPE_10$ + } + ## Agent type 11. + save_scope_value_as = { + name = agent_type_11 + value = flag:$AGENT_TYPE_11$ + } + ## Agent type 12. + save_scope_value_as = { + name = agent_type_12 + value = flag:$AGENT_TYPE_12$ + } + ## Agent type 13. + save_scope_value_as = { + name = agent_type_13 + value = flag:$AGENT_TYPE_13$ + } + ## Agent type 14. + save_scope_value_as = { + name = agent_type_14 + value = flag:$AGENT_TYPE_14$ + } + ## Agent type 15. + save_scope_value_as = { + name = agent_type_15 + value = flag:$AGENT_TYPE_15$ + } + ## Agent type 16. + save_scope_value_as = { + name = agent_type_16 + value = flag:$AGENT_TYPE_16$ + } + ## Agent type 17. + save_scope_value_as = { + name = agent_type_17 + value = flag:$AGENT_TYPE_17$ + } + ## Agent type 18. + save_scope_value_as = { + name = agent_type_18 + value = flag:$AGENT_TYPE_18$ + } + ## Agent type 19. + save_scope_value_as = { + name = agent_type_19 + value = flag:$AGENT_TYPE_19$ + } + ## Agent type 20. + save_scope_value_as = { + name = agent_type_20 + value = flag:$AGENT_TYPE_20$ + } + # Then we roll for who's getting picked. + ## For var:choice_a. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOT = { scope:agent_type_01 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOT = { scope:agent_type_02 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOT = { scope:agent_type_03 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOT = { scope:agent_type_04 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOT = { scope:agent_type_05 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOT = { scope:agent_type_06 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOT = { scope:agent_type_07 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOT = { scope:agent_type_08 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + # Agent type 09. + 0 = { + trigger = { + NOT = { scope:agent_type_09 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_09$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_09$ + } + modifier = { + add = $AGENT_TYPE_09_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_09$ } + } + } + # Agent type 10. + 0 = { + trigger = { + NOT = { scope:agent_type_10 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_10$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_10$ + } + modifier = { + add = $AGENT_TYPE_10_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_10$ } + } + } + # Agent type 11. + 0 = { + trigger = { + NOT = { scope:agent_type_11 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_11$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_11$ + } + modifier = { + add = $AGENT_TYPE_11_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_11$ } + } + } + # Agent type 12. + 0 = { + trigger = { + NOT = { scope:agent_type_12 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_12$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_12$ + } + modifier = { + add = $AGENT_TYPE_12_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_12$ } + } + } + # Agent type 13. + 0 = { + trigger = { + NOT = { scope:agent_type_13 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_13$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_13$ + } + modifier = { + add = $AGENT_TYPE_13_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_13$ } + } + } + # Agent type 14. + 0 = { + trigger = { + NOT = { scope:agent_type_14 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_14$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_14$ + } + modifier = { + add = $AGENT_TYPE_14_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_14$ } + } + } + # Agent type 15. + 0 = { + trigger = { + NOT = { scope:agent_type_15 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_15$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_15$ + } + modifier = { + add = $AGENT_TYPE_15_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_15$ } + } + } + # Agent type 16. + 0 = { + trigger = { + NOT = { scope:agent_type_16 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_16$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_16$ + } + modifier = { + add = $AGENT_TYPE_16_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_16$ } + } + } + # Agent type 17. + 0 = { + trigger = { + NOT = { scope:agent_type_17 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_17$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_17$ + } + modifier = { + add = $AGENT_TYPE_17_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_17$ } + } + } + # Agent type 18. + 0 = { + trigger = { + NOT = { scope:agent_type_18 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_18$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_18$ + } + modifier = { + add = $AGENT_TYPE_18_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_18$ } + } + } + # Agent type 19. + 0 = { + trigger = { + NOT = { scope:agent_type_19 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_19$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_19$ + } + modifier = { + add = $AGENT_TYPE_19_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_19$ } + } + } + # Agent type 20. + 0 = { + trigger = { + NOT = { scope:agent_type_20 = flag:empty } + scheme_owner = { can_have_$AGENT_TYPE_20$_trigger = yes } + } + set_variable = { + name = choice_a + value = flag:$AGENT_TYPE_20$ + } + modifier = { + add = $AGENT_TYPE_20_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_20$ } + } + } + } + ## And var:choice_b. + random_list = { + # Agent type 01. + 0 = { + trigger = { + NOR = { + scope:agent_type_01 = flag:empty + var:choice_a = flag:$AGENT_TYPE_01$ + } + scheme_owner = { can_have_$AGENT_TYPE_01$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_01$ + } + modifier = { + add = $AGENT_TYPE_01_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_01$ } + } + } + # Agent type 02. + 0 = { + trigger = { + NOR = { + scope:agent_type_02 = flag:empty + var:choice_a = flag:$AGENT_TYPE_02$ + } + scheme_owner = { can_have_$AGENT_TYPE_02$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_02$ + } + modifier = { + add = $AGENT_TYPE_02_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_02$ } + } + } + # Agent type 03. + 0 = { + trigger = { + NOR = { + scope:agent_type_03 = flag:empty + var:choice_a = flag:$AGENT_TYPE_03$ + } + scheme_owner = { can_have_$AGENT_TYPE_03$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_03$ + } + modifier = { + add = $AGENT_TYPE_03_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_03$ } + } + } + # Agent type 04. + 0 = { + trigger = { + NOR = { + scope:agent_type_04 = flag:empty + var:choice_a = flag:$AGENT_TYPE_04$ + } + scheme_owner = { can_have_$AGENT_TYPE_04$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_04$ + } + modifier = { + add = $AGENT_TYPE_04_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_04$ } + } + } + # Agent type 05. + 0 = { + trigger = { + NOR = { + scope:agent_type_05 = flag:empty + var:choice_a = flag:$AGENT_TYPE_05$ + } + scheme_owner = { can_have_$AGENT_TYPE_05$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_05$ + } + modifier = { + add = $AGENT_TYPE_05_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_05$ } + } + } + # Agent type 06. + 0 = { + trigger = { + NOR = { + scope:agent_type_06 = flag:empty + var:choice_a = flag:$AGENT_TYPE_06$ + } + scheme_owner = { can_have_$AGENT_TYPE_06$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_06$ + } + modifier = { + add = $AGENT_TYPE_06_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_06$ } + } + } + # Agent type 07. + 0 = { + trigger = { + NOR = { + scope:agent_type_07 = flag:empty + var:choice_a = flag:$AGENT_TYPE_07$ + } + scheme_owner = { can_have_$AGENT_TYPE_07$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_07$ + } + modifier = { + add = $AGENT_TYPE_07_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_07$ } + } + } + # Agent type 08. + 0 = { + trigger = { + NOR = { + scope:agent_type_08 = flag:empty + var:choice_a = flag:$AGENT_TYPE_08$ + } + scheme_owner = { can_have_$AGENT_TYPE_08$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_08$ + } + modifier = { + add = $AGENT_TYPE_08_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_08$ } + } + } + # Agent type 09. + 0 = { + trigger = { + NOR = { + scope:agent_type_09 = flag:empty + var:choice_a = flag:$AGENT_TYPE_09$ + } + scheme_owner = { can_have_$AGENT_TYPE_09$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_09$ + } + modifier = { + add = $AGENT_TYPE_09_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_09$ } + } + } + # Agent type 10. + 0 = { + trigger = { + NOR = { + scope:agent_type_10 = flag:empty + var:choice_a = flag:$AGENT_TYPE_10$ + } + scheme_owner = { can_have_$AGENT_TYPE_10$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_10$ + } + modifier = { + add = $AGENT_TYPE_10_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_10$ } + } + } + # Agent type 11. + 0 = { + trigger = { + NOR = { + scope:agent_type_11 = flag:empty + var:choice_a = flag:$AGENT_TYPE_11$ + } + scheme_owner = { can_have_$AGENT_TYPE_11$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_11$ + } + modifier = { + add = $AGENT_TYPE_11_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_11$ } + } + } + # Agent type 12. + 0 = { + trigger = { + NOR = { + scope:agent_type_12 = flag:empty + var:choice_a = flag:$AGENT_TYPE_12$ + } + scheme_owner = { can_have_$AGENT_TYPE_12$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_12$ + } + modifier = { + add = $AGENT_TYPE_12_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_12$ } + } + } + # Agent type 13. + 0 = { + trigger = { + NOR = { + scope:agent_type_13 = flag:empty + var:choice_a = flag:$AGENT_TYPE_13$ + } + scheme_owner = { can_have_$AGENT_TYPE_13$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_13$ + } + modifier = { + add = $AGENT_TYPE_13_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_13$ } + } + } + # Agent type 14. + 0 = { + trigger = { + NOR = { + scope:agent_type_14 = flag:empty + var:choice_a = flag:$AGENT_TYPE_14$ + } + scheme_owner = { can_have_$AGENT_TYPE_14$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_14$ + } + modifier = { + add = $AGENT_TYPE_14_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_14$ } + } + } + # Agent type 15. + 0 = { + trigger = { + NOR = { + scope:agent_type_15 = flag:empty + var:choice_a = flag:$AGENT_TYPE_15$ + } + scheme_owner = { can_have_$AGENT_TYPE_15$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_15$ + } + modifier = { + add = $AGENT_TYPE_15_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_15$ } + } + } + # Agent type 16. + 0 = { + trigger = { + NOR = { + scope:agent_type_16 = flag:empty + var:choice_a = flag:$AGENT_TYPE_16$ + } + scheme_owner = { can_have_$AGENT_TYPE_16$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_16$ + } + modifier = { + add = $AGENT_TYPE_16_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_16$ } + } + } + # Agent type 17. + 0 = { + trigger = { + NOR = { + scope:agent_type_17 = flag:empty + var:choice_a = flag:$AGENT_TYPE_17$ + } + scheme_owner = { can_have_$AGENT_TYPE_17$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_17$ + } + modifier = { + add = $AGENT_TYPE_17_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_17$ } + } + } + # Agent type 18. + 0 = { + trigger = { + NOR = { + scope:agent_type_18 = flag:empty + var:choice_a = flag:$AGENT_TYPE_18$ + } + scheme_owner = { can_have_$AGENT_TYPE_18$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_18$ + } + modifier = { + add = $AGENT_TYPE_18_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_18$ } + } + } + # Agent type 19. + 0 = { + trigger = { + NOR = { + scope:agent_type_19 = flag:empty + var:choice_a = flag:$AGENT_TYPE_19$ + } + scheme_owner = { can_have_$AGENT_TYPE_19$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_19$ + } + modifier = { + add = $AGENT_TYPE_19_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_19$ } + } + } + # Agent type 20. + 0 = { + trigger = { + NOR = { + scope:agent_type_20 = flag:empty + var:choice_a = flag:$AGENT_TYPE_20$ + } + scheme_owner = { can_have_$AGENT_TYPE_20$_trigger = yes } + } + set_variable = { + name = choice_b + value = flag:$AGENT_TYPE_20$ + } + modifier = { + add = $AGENT_TYPE_20_WEIGHT$ + always = yes + } + modifier = { + factor = weight_down_existing_agent_slots_value + any_scheme_agent_slot = { is_agent_slot_type = $AGENT_TYPE_20$ } + } + } + } + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0001 } + } +} + +# Add an agent type to a scheme. +## When you add a new agent type, add them to the bottom of this effect. Everything else should be taken care of automatically. +select_critical_moment_agents_effect = { + if = { + limit = { $CHOICE$ = flag:agent_assassin } + scope:scheme = { add_agent_slot = agent_assassin } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_assassin + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_lookout } + scope:scheme = { add_agent_slot = agent_lookout } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_lookout + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_infiltrator } + scope:scheme = { add_agent_slot = agent_infiltrator } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_infiltrator + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_footpad } + scope:scheme = { add_agent_slot = agent_footpad } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_footpad + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_alibi } + scope:scheme = { add_agent_slot = agent_alibi } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_alibi + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_thug } + scope:scheme = { add_agent_slot = agent_thug } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_thug + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_comrade_in_arms } + scope:scheme = { add_agent_slot = agent_comrade_in_arms } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_comrade_in_arms + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_socialite } + scope:scheme = { add_agent_slot = agent_socialite } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_socialite + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_musician } + scope:scheme = { add_agent_slot = agent_musician } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_musician + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_tumbler } + scope:scheme = { add_agent_slot = agent_tumbler } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_tumbler + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_poet } + scope:scheme = { add_agent_slot = agent_poet } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_poet + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_gabbler } + scope:scheme = { add_agent_slot = agent_gabbler } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_gabbler + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_shill } + scope:scheme = { add_agent_slot = agent_shill } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_shill + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_diplomat } + scope:scheme = { add_agent_slot = agent_diplomat } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_diplomat + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_justiciar } + scope:scheme = { add_agent_slot = agent_justiciar } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_justiciar + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_scribe } + scope:scheme = { add_agent_slot = agent_scribe } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_scribe + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_cleric } + scope:scheme = { add_agent_slot = agent_cleric } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_cleric + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_theologian } + scope:scheme = { add_agent_slot = agent_theologian } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_theologian + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_herald } + scope:scheme = { add_agent_slot = agent_herald } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_herald + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_wolf_hunter } + scope:scheme = { add_agent_slot = agent_wolf_hunter } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_wolf_hunter + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_thief } + scope:scheme = { add_agent_slot = agent_thief } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_thief + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_tutor } + scope:scheme = { add_agent_slot = agent_tutor } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_tutor + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_poisoner } + scope:scheme = { add_agent_slot = agent_poisoner } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_poisoner + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_eunuch } + scope:scheme = { add_agent_slot = agent_eunuch } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_eunuch + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_decoy } + scope:scheme = { add_agent_slot = agent_decoy } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_decoy + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_muscle } + scope:scheme = { add_agent_slot = agent_muscle } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_muscle + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_drillmaster } + scope:scheme = { add_agent_slot = agent_drillmaster } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_drillmaster + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_tracker } + scope:scheme = { add_agent_slot = agent_tracker } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_tracker + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_physic } + scope:scheme = { add_agent_slot = agent_physic } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_physic + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_smith } + scope:scheme = { add_agent_slot = agent_smith } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_smith + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_ambusher } + scope:scheme = { add_agent_slot = agent_ambusher } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_ambusher + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_bodyguard } + scope:scheme = { add_agent_slot = agent_bodyguard } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_bodyguard + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_scout } + scope:scheme = { add_agent_slot = agent_scout } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_scout + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_outrider } + scope:scheme = { add_agent_slot = agent_outrider } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_outrider + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_bookkeeper } + scope:scheme = { add_agent_slot = agent_bookkeeper } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_bookkeeper + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_bailiff } + scope:scheme = { add_agent_slot = agent_bailiff } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_bailiff + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_draughtsman } + scope:scheme = { add_agent_slot = agent_draughtsman } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_draughtsman + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_planner } + scope:scheme = { add_agent_slot = agent_planner } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_planner + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_supplier } + scope:scheme = { add_agent_slot = agent_supplier } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_supplier + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_outcast } + scope:scheme = { add_agent_slot = agent_outcast } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_outcast + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_wrangler } + scope:scheme = { add_agent_slot = agent_wrangler } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_wrangler + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_wrangler_speed } + scope:scheme = { add_agent_slot = agent_wrangler_speed } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_wrangler_speed + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_theologian_success } + scope:scheme = { add_agent_slot = agent_theologian_success } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_theologian_success + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_cleric_success } + scope:scheme = { add_agent_slot = agent_cleric_success } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_cleric_success + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_lookout_success } + scope:scheme = { add_agent_slot = agent_lookout_success } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_lookout_success + } + } + else_if = { + limit = { $CHOICE$ = flag:agent_lookout_speed } + scope:scheme = { add_agent_slot = agent_lookout_speed } + # Error suppression. + save_scope_value_as = { + name = $CHOICE$ + value = flag:agent_lookout_speed + } + } + # And remove the variables. + scope:scheme = { + remove_variable = choice_a + remove_variable = choice_b + } +} + +# Stop schemes from overflowing with opportunities forever + tell the player when they should do something. +cap_schemes_and_fire_reminders_effect = { + if = { + limit = { + scheme_agent_charges >= opportunity_cap_value + scheme_success_chance >= max_scheme_success_chance + } + if = { + limit = { + scheme_owner = { + is_ai = no + NOR = { + has_character_flag = scheme_critical_moments.0011 + has_variable = opportunities_reminder + } + } + } + scheme_owner = { + add_character_flag = currently_in_scheme_reminder + # supress the 'variable is used but is never set' error, the flag is set through code with the cooldown effect on the event, smh! + if = { + limit = { + always = no + } + add_character_flag = scheme_critical_moments.0011 + } + } + switch = { + trigger = scheme_type + murder = { + murder_scheme_prep_effect = yes + } + abduct = { + abduct_scheme_prep_effect = yes + } + challenge_status = { + challenge_status_scheme_prep_effect = yes + } + claim_throne = { + claim_throne_scheme_prep_effect = yes + } + depose = { + depose_scheme_prep_effect = yes + } + overthrow_regent = { + overthrow_regent_scheme_prep_effect = yes + } + expand_power_base = { + expand_power_base_scheme_prep_effect = yes + } + fabricate_hook = { + fabricate_hook_scheme_prep_effect = yes + } + generate_claim = { + generate_claim_scheme_prep_effect = yes + } + promote = { + promote_scheme_prep_effect = yes + } + slander = { + slander_scheme_prep_effect = yes + } + steal_back_artifact = { + steal_back_artifact_scheme_prep_effect = yes + } + seize_realm = { + seize_realm_scheme_prep_effect = yes + } + found_despotate = { + found_despotate_scheme_prep_effect = yes + } + raid_estate = { + raid_estate_scheme_prep_effect = yes + } + prepare_fire_dromons_scheme = { + prepare_fire_dromons_scheme_prep_effect = yes + } + steal_herd = { + steal_herd_scheme_prep_effect = yes + } + celestial_siphon_treasury = { + celestial_siphon_treasury_prep_effect = yes + } + disbelieve_mandala = { + disbelieve_mandala_scheme_prep_effect = yes + } + coerce_tributary = { + coerce_tributary_scheme_prep_effect = yes + } + } + } + # If the player hasn't been reminded once, tell them that their scheme has hit max opportunities. + scheme_owner = { + if = { + limit = { + is_ai = no + NOT = { has_variable = opportunities_reminder } + } + trigger_event = scheme_critical_moments.0011 + } + } + } +} + +# Tell schemes to wait for the player's say-so before firing a follow-up event. +suppress_scheme_follow_up_event_till_input_given_effect = { + save_scope_value_as = { + name = suppress_next_event + value = yes + } +} + +# Improve a certain type of modifier attached to the scheme, burning opportunities to do so. +improve_scheme_preparation_burnt_opportunities_modifier_effect = { + # Cap us at 10. + if = { + limit = { has_scheme_modifier = $MODIFIER$_level_10 } + # We should never be able to take the option at this point, but if we break it somehow, then do nothing rather than doubling up. + } + # 9 -> 10. + else_if = { + limit = { has_scheme_modifier = $MODIFIER$_level_09 } + # Clean the previous level. + hidden_effect = { remove_scheme_modifier = $MODIFIER$_level_09 } + # Add the new one. + add_scheme_modifier = { type = $MODIFIER$_level_10 } + } + # 8 -> 9. + else_if = { + limit = { has_scheme_modifier = $MODIFIER$_level_08 } + # Clean the previous level. + hidden_effect = { remove_scheme_modifier = $MODIFIER$_level_08 } + # Add the new one. + add_scheme_modifier = { type = $MODIFIER$_level_09 } + } + # 7 -> 8. + else_if = { + limit = { has_scheme_modifier = $MODIFIER$_level_07 } + # Clean the previous level. + hidden_effect = { remove_scheme_modifier = $MODIFIER$_level_07 } + # Add the new one. + add_scheme_modifier = { type = $MODIFIER$_level_08 } + } + # 6 -> 7. + else_if = { + limit = { has_scheme_modifier = $MODIFIER$_level_06 } + # Clean the previous level. + hidden_effect = { remove_scheme_modifier = $MODIFIER$_level_06 } + # Add the new one. + add_scheme_modifier = { type = $MODIFIER$_level_07 } + } + # 5 -> 6. + else_if = { + limit = { has_scheme_modifier = $MODIFIER$_level_05 } + # Clean the previous level. + hidden_effect = { remove_scheme_modifier = $MODIFIER$_level_05 } + # Add the new one. + add_scheme_modifier = { type = $MODIFIER$_level_06 } + } + # 4 -> 5. + else_if = { + limit = { has_scheme_modifier = $MODIFIER$_level_04 } + # Clean the previous level. + hidden_effect = { remove_scheme_modifier = $MODIFIER$_level_04 } + # Add the new one. + add_scheme_modifier = { type = $MODIFIER$_level_05 } + } + # 3 -> 4. + else_if = { + limit = { has_scheme_modifier = $MODIFIER$_level_03 } + # Clean the previous level. + hidden_effect = { remove_scheme_modifier = $MODIFIER$_level_03 } + # Add the new one. + add_scheme_modifier = { type = $MODIFIER$_level_04 } + } + # 2 -> 3. + else_if = { + limit = { has_scheme_modifier = $MODIFIER$_level_02 } + # Clean the previous level. + hidden_effect = { remove_scheme_modifier = $MODIFIER$_level_02 } + # Add the new one. + add_scheme_modifier = { type = $MODIFIER$_level_03 } + } + # 1 -> 2. + else_if = { + limit = { has_scheme_modifier = $MODIFIER$_level_01 } + # Clean the previous level. + hidden_effect = { remove_scheme_modifier = $MODIFIER$_level_01 } + # Add the new one. + add_scheme_modifier = { type = $MODIFIER$_level_02 } + } + # 0 -> 1. + else = { + # Add the first rung.. + add_scheme_modifier = { type = $MODIFIER$_level_01 } + } +} + +################################################## +# AI Usage Critical Moment Effects — Regular Schemes + +murder_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.1001 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +seduce_scheme_prep_effect = { + roll_critical_moment_options_07_agent_types_effect = { + # Success results event. + OUTPUT_EVENT = scheme_critical_moments.1011 + # Lookout + AGENT_TYPE_01 = agent_lookout + AGENT_TYPE_01_WEIGHT = critical_moment_agent_weight_high_value + # Infiltrator + AGENT_TYPE_02 = agent_infiltrator + AGENT_TYPE_02_WEIGHT = critical_moment_agent_weight_high_value + # Comrade_in_arms + AGENT_TYPE_03 = agent_comrade_in_arms + AGENT_TYPE_03_WEIGHT = critical_moment_agent_weight_high_value + # Socialite + AGENT_TYPE_04 = agent_socialite + AGENT_TYPE_04_WEIGHT = critical_moment_agent_weight_medium_value + # Musician + AGENT_TYPE_05 = agent_musician + AGENT_TYPE_05_WEIGHT = critical_moment_agent_weight_low_value + # Tumbler + AGENT_TYPE_06 = agent_tumbler + AGENT_TYPE_06_WEIGHT = critical_moment_agent_weight_low_value + # Poet + AGENT_TYPE_07 = agent_poet + AGENT_TYPE_07_WEIGHT = critical_moment_agent_weight_low_value + } +} + +abduct_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.1061 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +befriend_scheme_prep_effect = { + roll_critical_moment_options_04_agent_types_effect = { + # Success results event. + OUTPUT_EVENT = scheme_critical_moments.1031 + # Socialite + AGENT_TYPE_01 = agent_socialite + AGENT_TYPE_01_WEIGHT = critical_moment_agent_weight_high_value + # Infiltrator + AGENT_TYPE_02 = agent_infiltrator + AGENT_TYPE_02_WEIGHT = critical_moment_agent_weight_high_value + # Gabbler + AGENT_TYPE_03 = agent_gabbler + AGENT_TYPE_03_WEIGHT = critical_moment_agent_weight_high_value + # Shill + AGENT_TYPE_04 = agent_shill + AGENT_TYPE_04_WEIGHT = critical_moment_agent_weight_medium_value + } +} + +challenge_status_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.1171 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +claim_throne_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.1101 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +convert_to_witchcraft_scheme_prep_effect = { + roll_critical_moment_options_03_agent_types_effect = { + # Success results event. + OUTPUT_EVENT = scheme_critical_moments.1121 + # Infiltrator + AGENT_TYPE_01 = agent_infiltrator + AGENT_TYPE_01_WEIGHT = critical_moment_agent_weight_high_value + # Shill + AGENT_TYPE_02 = agent_shill + AGENT_TYPE_02_WEIGHT = critical_moment_agent_weight_high_value + # Alibi + AGENT_TYPE_03 = agent_alibi + AGENT_TYPE_03_WEIGHT = critical_moment_agent_weight_high_value + } +} + +court_scheme_prep_effect = { + roll_critical_moment_options_07_agent_types_effect = { + # Success results event. + OUTPUT_EVENT = scheme_critical_moments.1041 + # Herald + AGENT_TYPE_01 = agent_herald + AGENT_TYPE_01_WEIGHT = critical_moment_agent_weight_high_value + # Comrade-in-Arms + AGENT_TYPE_02 = agent_comrade_in_arms + AGENT_TYPE_02_WEIGHT = critical_moment_agent_weight_high_value + # Socialite + AGENT_TYPE_03 = agent_socialite + AGENT_TYPE_03_WEIGHT = critical_moment_agent_weight_high_value + # Musician + AGENT_TYPE_04 = agent_musician + AGENT_TYPE_04_WEIGHT = critical_moment_agent_weight_very_low_value + # Poet + AGENT_TYPE_05 = agent_poet + AGENT_TYPE_05_WEIGHT = critical_moment_agent_weight_very_low_value + # Tumbler + AGENT_TYPE_06 = agent_tumbler + AGENT_TYPE_06_WEIGHT = critical_moment_agent_weight_very_low_value + # Wolf Hunter + AGENT_TYPE_07 = agent_wolf_hunter + AGENT_TYPE_07_WEIGHT = critical_moment_agent_weight_microscopic_value + } +} + +damage_legitimacy_scheme_prep_effect = { + roll_critical_moment_options_03_agent_types_effect = { + # Success results event. + OUTPUT_EVENT = scheme_critical_moments.4010 + # Infiltrator + AGENT_TYPE_01 = agent_infiltrator + AGENT_TYPE_01_WEIGHT = critical_moment_agent_weight_high_value + # Diplomat + AGENT_TYPE_02 = agent_diplomat + AGENT_TYPE_02_WEIGHT = critical_moment_agent_weight_high_value + # Socialite + AGENT_TYPE_03 = agent_socialite + AGENT_TYPE_03_WEIGHT = critical_moment_agent_weight_medium_value + } +} + +depose_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.1191 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +overthrow_regent_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.1091 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +elope_scheme_prep_effect = { + roll_critical_moment_options_07_agent_types_effect = { + # Success results event. + OUTPUT_EVENT = scheme_critical_moments.1051 + # Infiltrator + AGENT_TYPE_01 = agent_infiltrator + AGENT_TYPE_01_WEIGHT = critical_moment_agent_weight_high_value + # Comrade_in_arms + AGENT_TYPE_02 = agent_comrade_in_arms + AGENT_TYPE_02_WEIGHT = critical_moment_agent_weight_high_value + # Socialite + AGENT_TYPE_03 = agent_socialite + AGENT_TYPE_03_WEIGHT = critical_moment_agent_weight_high_value + # Alibi + AGENT_TYPE_04 = agent_alibi + AGENT_TYPE_04_WEIGHT = critical_moment_agent_weight_medium_value + # Musician + AGENT_TYPE_05 = agent_musician + AGENT_TYPE_05_WEIGHT = critical_moment_agent_weight_very_low_value + # Poet + AGENT_TYPE_06 = agent_poet + AGENT_TYPE_06_WEIGHT = critical_moment_agent_weight_very_low_value + # Tumbler + AGENT_TYPE_07 = agent_tumbler + AGENT_TYPE_07_WEIGHT = critical_moment_agent_weight_very_low_value + } +} + +expand_power_base_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.1181 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +fabricate_hook_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.1071 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +foster_legitimacy_scheme_prep_effect = { + roll_critical_moment_options_03_agent_types_effect = { + # Success results event. + OUTPUT_EVENT = scheme_critical_moments.4000 + + # Herald + AGENT_TYPE_01 = agent_herald + AGENT_TYPE_01_WEIGHT = critical_moment_agent_weight_high_value + # Diplomat + AGENT_TYPE_02 = agent_diplomat + AGENT_TYPE_02_WEIGHT = critical_moment_agent_weight_high_value + # Socialite + AGENT_TYPE_03 = agent_socialite + AGENT_TYPE_03_WEIGHT = critical_moment_agent_weight_medium_value + } +} + +generate_claim_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.1151 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +learn_language_scheme_prep_effect = { + roll_critical_moment_options_04_agent_types_effect = { + # Success results event. + OUTPUT_EVENT = scheme_critical_moments.1081 + # Diplomat + AGENT_TYPE_01 = agent_diplomat + AGENT_TYPE_01_WEIGHT = critical_moment_agent_weight_high_value + # Cleric + AGENT_TYPE_02 = agent_cleric + AGENT_TYPE_02_WEIGHT = critical_moment_agent_weight_high_value + # Scribe + AGENT_TYPE_03 = agent_scribe + AGENT_TYPE_03_WEIGHT = critical_moment_agent_weight_high_value + # Tutor + AGENT_TYPE_04 = agent_tutor + AGENT_TYPE_04_WEIGHT = critical_moment_agent_weight_medium_value + } +} + +promote_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.1141 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +slander_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.1131 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +steal_back_artifact_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.1111 + } + scope:scheme.var:target_artifact = { + save_scope_as = artifact + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +steal_herd_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.1161 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +celestial_siphon_treasury_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.1201 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +celestial_movement_power_promote_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.1231 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +celestial_movement_power_slander_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.1234 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +sway_scheme_prep_effect = { + roll_critical_moment_options_07_agent_types_effect = { + # Success results event. + OUTPUT_EVENT = scheme_critical_moments.1021 + # Herald + AGENT_TYPE_01 = agent_herald + AGENT_TYPE_01_WEIGHT = critical_moment_agent_weight_high_value + # Diplomat + AGENT_TYPE_02 = agent_diplomat + AGENT_TYPE_02_WEIGHT = critical_moment_agent_weight_high_value + # Gabbler + AGENT_TYPE_03 = agent_gabbler + AGENT_TYPE_03_WEIGHT = critical_moment_agent_weight_high_value + # Shill + AGENT_TYPE_04 = agent_shill + AGENT_TYPE_04_WEIGHT = critical_moment_agent_weight_medium_value + # Musician + AGENT_TYPE_05 = agent_musician + AGENT_TYPE_05_WEIGHT = critical_moment_agent_weight_low_value + # Tumbler + AGENT_TYPE_06 = agent_tumbler + AGENT_TYPE_06_WEIGHT = critical_moment_agent_weight_low_value + # Poet + AGENT_TYPE_07 = agent_poet + AGENT_TYPE_07_WEIGHT = critical_moment_agent_weight_low_value + } +} + +seize_realm_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2901 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +found_despotate_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.8021 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +raid_estate_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.8035 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +ingratiate_family_scheme_prep_effect = { + save_scope_as = scheme + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.8051 } + } +} + +prepare_fire_dromons_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.8060 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +disbelieve_mandala_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.1211 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +coerce_tributary_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.1221 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +coerce_contribution_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.1241 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +leverage_contribution_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.1251 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +################################################## +# AI Usage Critical Moment Effects — Contract Schemes + +laamp_base_0001_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2001 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_0011_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2011 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_0021_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2021 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_0031_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2031 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_0041_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2041 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_1001_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2201 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_1011_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2211 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_1021_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2221 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_1031_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2231 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_1041_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2241 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_2001_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2401 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_2011_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2411 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_2021_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2421 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_2031_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2431 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_2041_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2441 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_3001_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2601 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_3011_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2611 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_3021_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2621 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_3031_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2631 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_3041_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2641 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_4001_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2801 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_4011_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2811 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_4021_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2821 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_4031_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2831 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_4041_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2841 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_5001_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.3001 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_5011_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.3011 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_5021_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.3021 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_5031_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.3031 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_5041_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.3041 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_5051_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.3051 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_6001_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.6001 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_6011_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.6011 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_6021_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.6021 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_base_6031_contract_scheme_prep_effect = { + save_scope_as = scheme + scope:scheme.task_contract ?= { save_scope_as = task_contract } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.6031 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +protect_minority_vassal_contract_diplomacy_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.3201 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +protect_minority_vassal_contract_martial_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.3201 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +protect_minority_vassal_contract_intrigue_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.3201 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +protect_minority_vassal_contract_learning_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.3201 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_prison_break_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.3211 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +laamp_help_find_secrets_scheme_prep_effect = { + save_scope_as = scheme + task_contract = { + save_scope_as = task_contract + var:task_contract_councillor = { + save_scope_as = task_contract_councillor + } + } + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.3221 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +celestial_minister_find_secrets_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.8065 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +################################################## +# Murder Scheme Effects + +# Give out the appropriate amount of dread when it's discovered the scoped char murdered someone. +murder_consequences_known_or_exposed_apply_dread_effect = { + # Don't apply this twice if it's gone out earlier in the chain. + if = { + limit = { + NOT = { exists = scope:murderer_dread_applied } + } + # Murdered own close family, king/emperor, or family of king/emperor. + if = { + limit = { + OR = { + is_close_family_of = $VICTIM$ + $VICTIM$ = { + tier_or_related_liege_tier_greater_or_equal_trigger = { TIER = tier_kingdom } + } + } + } + add_dread = major_dread_gain + } + # Murdered close family of duke/count. + else_if = { + limit = { + $VICTIM$ = { + tier_or_related_liege_tier_greater_or_equal_trigger = { TIER = tier_county } + } + } + add_dread = medium_dread_gain + } + # Murdered just... some guy. Just a person. Just a lil dude. + else = { add_dread = minor_dread_gain } + # And flag that we've gone through this. + save_scope_value_as = { + name = murderer_dread_applied + value = yes + } + } +} + +# Apply scope:owner's general ending & consequences. +scheme_owner_pov_murder_success_effect = { + # Murdering your rival gets you some bonus cred. + ## Presumably in how you comport yourself & who's a thorn in your side. + if = { + limit = { + scope:owner = { has_relation_rival = scope:target } + } + custom_tooltip = { + text = murder_outcome_murdered_rival_tt + add_prestige = medium_prestige_gain + } + } + # Dread for successfully murdering someone and getting discovered. + if = { + limit = { exists = scope:scheme_discovered } + murder_consequences_known_or_exposed_apply_dread_effect = { VICTIM = scope:target } + } + # Piety, if appropriate. + if = { + limit = { + faith = { has_doctrine_parameter = piety_gain_from_successful_intrigue_schemes } + } + add_piety = minor_piety_gain + } + # Stress. + ## Murdered a rival. + if = { + limit = { + scope:owner = { has_relation_rival = scope:target } + } + stress_impact = { + base = murder_base_stress_value + vengeful = massive_stress_impact_loss + sadistic = minor_stress_impact_loss + callous = miniscule_stress_impact_loss + compassionate = minor_stress_impact_gain + forgiving = major_stress_impact_gain + } + } + ## Murdered someone helpless. + else_if = { + limit = { + scope:target = { + OR = { + is_adult = no + is_incapable = yes + } + } + } + stress_impact = { + base = murder_base_stress_value + sadistic = major_stress_impact_loss + callous = minor_stress_impact_loss + compassionate = major_stress_impact_gain + } + } + ## Murdered anyone else. + else = { + stress_impact = { + base = murder_base_stress_value + sadistic = minor_stress_impact_loss + callous = miniscule_stress_impact_loss + compassionate = minor_stress_impact_gain + } + } + # Aaaaand show our other consequences. + show_as_tooltip = { + murder_success_kill_effect = { REASON = $REASON$ } + } +} + +# Actually kill scope:target. +murder_success_kill_effect = { + # If the scheme was discovered, reveal the murderer immediately. + if = { + limit = { exists = scope:scheme_discovered } + # Kill the target. + known_murder_effect = { + VICTIM = scope:target + MURDERER = scope:owner + EXPOSER = scope:murder_exposer + } + # Kill them. Kill them all. + murder_success_kill_entourage_too_effect = { + KNOWN_UNKNOWN = known + EXPOSER_REASON_PRE = EXPOSER + EXPOSER_REASON_POST = scope:murder_exposer + SHOW_UNKNOWN_ASSAILANT_TOOLTIP = no + } + } + # Otherwise, we process this anonymously. + else = { + # For scope:owner, we only show the effects as tooltips. + if = { + limit = { this = scope:owner } + show_as_tooltip = { + unknown_murder_effect = { + VICTIM = scope:target + MURDERER = scope:owner + REASON = $REASON$ + } + } + # Kill them. Kill them all. + show_as_tooltip = { + murder_success_kill_entourage_too_effect = { + KNOWN_UNKNOWN = unknown + EXPOSER_REASON_PRE = REASON + EXPOSER_REASON_POST = death_mysterious + SHOW_UNKNOWN_ASSAILANT_TOOLTIP = no + } + } + } + # Whereas for the target, we process the whole lot. + else_if = { + limit = { this = scope:target } + custom_tooltip = murder_unknown_murder_against_you_was_successful + hidden_effect = { + unknown_murder_effect = { + VICTIM = scope:target + MURDERER = scope:owner + REASON = $REASON$ + } + } + # Kill them. Kill them all. + murder_success_kill_entourage_too_effect = { + KNOWN_UNKNOWN = unknown + EXPOSER_REASON_PRE = REASON + EXPOSER_REASON_POST = death_mysterious + SHOW_UNKNOWN_ASSAILANT_TOOLTIP = yes + } + } + } +} + +# If appropriate, kill off a bunch of the folks travelling with scope:target. +murder_success_kill_entourage_too_effect = { + scope:owner ?= { + if = { + limit = { has_variable_list = entourage_members_to_kill } + save_temporary_scope_value_as = { + name = show_unknown_assailant_tooltip + value = $SHOW_UNKNOWN_ASSAILANT_TOOLTIP$ + } + every_in_list = { + variable = entourage_members_to_kill + save_temporary_scope_as = to_be_killed + if = { + limit = { scope:show_unknown_assailant_tooltip = yes } + custom_tooltip = murder_unknown_murder_against_you_was_successful_other + } + $KNOWN_UNKNOWN$_murder_effect = { + VICTIM = scope:to_be_killed + MURDERER = scope:owner + $EXPOSER_REASON_PRE$ = $EXPOSER_REASON_POST$ + } + } + } + } +} + +# Distribute murder failure effects. +murder_failure_effect = { + # Add Watchful Modifier to the target + scope:target = { + add_character_modifier = { + modifier = watchful_modifier + days = watchful_modifier_duration + } + } + # If the attempt was discovered, process the consequences of that. + if = { + limit = { exists = scope:scheme_discovered } + # If we're a clan this affects unity + ## Landed victims cost more unity. + if = { + limit = { + scope:target = { is_landed = yes } + } + add_clan_unity_interaction_effect = { + CHARACTER = scope:owner + TARGET = scope:target + VALUE = medium_unity_loss + DESC = clan_unity_murder_attempted.desc + REVERSE_NON_HOUSE_TARGET = no + } + } + ## For unlanded characters, we don't care as much, but you still lose some. + else = { + add_clan_unity_interaction_effect = { + CHARACTER = scope:owner + TARGET = scope:target + VALUE = minor_unity_loss + DESC = clan_unity_murder_attempted.desc + REVERSE_NON_HOUSE_TARGET = no + } + } + ## Tag scope:owner with a separate scope for portraits... + scope:owner = { + save_scope_as = owner_to_reveal + # ... and apply a little dread. + add_dread = minor_dread_gain + } + ## Point out that yeah, attempted murder will sour someone's opinion of you. + attempted_murder_opinion_effect = { + VICTIM = scope:target + MURDERER = scope:owner + } + } + # Otherwise, we just add a murder attempt secret. + else = { + # Make sure we don't inadvertently reveal the scheme to the target. + if = { + limit = { this = scope:owner } + scope:owner = { + add_secret = { + type = secret_murder_attempt + target = scope:target + } + } + } + } + # Lastly, if our imaginary friend put us up to this, then we address that. + scope:owner = { + if = { + limit = { + any_owned_story = { + type = story_cycle_imaginary_friend + var:imaginary_friend_murder_target ?= scope:target + } + } + trigger_event = { + id = bp2_yearly.2024 + days = 4 + } + } + } +} + +# If appropriate, murder anyone travelling with scope:target. +murder_entourage_list_effect = { + # Pick three random entourage members to kill + scope:target = { + current_travel_plan = { + random_entourage_character = { + limit = { + this != scope:target + } + scope:owner = { + add_to_variable_list = { + name = entourage_members_to_kill + target = prev + } + } + } + random_entourage_character = { + limit = { + NOR = { + this = scope:target + this = scope:owner + scope:owner = { + is_target_in_variable_list = { + name = entourage_members_to_kill + target = prev + } + } + } + } + scope:owner = { + add_to_variable_list = { + name = entourage_members_to_kill + target = prev + } + } + } + random_entourage_character = { + limit = { + NOR = { + this = scope:target + this = scope:owner + scope:owner = { + is_target_in_variable_list = { + name = entourage_members_to_kill + target = prev + } + } + } + } + scope:owner = { + add_to_variable_list = { + name = entourage_members_to_kill + target = prev + } + } + } + } + } +} + +# Restart's the current murder scheme, setting all its variables and such back to zero. +restart_murder_scheme_effect = { + show_as_tooltip = { + start_scheme = { + type = murder + target_character = scope:target + } + } + hidden_effect = { + scope:scheme = { + # Track how many times we've restarted, so we can reset progress. + increment_variable_effect = { + VAR = scheme_reset_to_zero_value + VAL = scheme_success_chance + } + # Reset our scheme. + reset_failed_scheme_effect = yes + } + } +} + +# Process the death result for anyone who dies during the murder interception. +murder_interception_handle_extra_deaths_effect = { + if = { + limit = { exists = scope:scheme_discovered } + known_murder_effect = { + VICTIM = $VICTIM$ + MURDERER = scope:owner + EXPOSER = scope:target + } + } + else = { + unknown_murder_effect = { + VICTIM = $VICTIM$ + MURDERER = scope:owner + REASON = $REASON$ + } + } +} + +# Adds either "Plush and Unremarkable Carpet" modifier if character is Iranian, otherwise adds "Plush and Exotic Carpet" +add_carpet_modifier_effect = { + if = { + limit = { + has_fp3_dlc_trigger = yes + culture = { has_cultural_pillar = heritage_iranian } + } + add_character_modifier = { + modifier = persian_has_plush_carpet_modifier + days = 3650 + } + } + else = { + add_character_modifier = { + modifier = has_plush_carpet_modifier + days = 3650 + } + } +} + +# If trying to lure a child to push off a roof, try to pick something tangible to tempt them with. +## The things I do for script hygiene. +rooftop_murder_lure_for_child_effect = { + random_list = { + # Dog. + 25 = { + trigger = { + scope:target = { any_owned_story = { type = story_cycle_pet_dog } } + } + save_scope_value_as = { + name = child_pushed_dog + value = yes + } + } + # Cat. + ## You monster. + 25 = { + trigger = { + scope:target = { any_owned_story = { type = story_cycle_pet_cat } } + } + save_scope_value_as = { + name = child_pushed_cat + value = yes + } + random = { + chance = 60 + save_scope_value_as = { + name = cat_survives + value = yes + } + } + } + # Toy. + 25 = { + trigger = { + scope:target = { has_variable = child_toy_variable } + } + save_scope_value_as = { + name = child_pushed_toy + value = yes + } + } + # Else nothing. + 1 = {} + } +} + +grab_best_agent_murderer_effect = { + scope:scheme = { + random_scheme_agent_slot = { + limit = { + is_agent_slot_type = agent_assassin + is_filled = yes + } + alternative_limit = { is_filled = yes } + slot_character = { save_scope_as = assassin } + } + # Plus generate a back-up, in case we need it. + random_dummy_gender_assassin_effect = yes + } +} + +################################################## +# Seduce Scheme Effects + +#Milestone should be 1 or 2, outcome should be success or failure +seduce_ongoing_add_scheme_modifier_effect = { + scope:scheme = { + add_scheme_modifier = { + type = seduce_$OUTCOME$_$MILESTONE$_modifier + } + } +} + +seduce_ongoing_possible_outcomes_tooltip_effect = { + show_as_tooltip = { + random_list = { + 1 = { + desc = seduce_ongoing_possible_outcomes_tooltip_effect.success.desc + show_chance = no + seduce_ongoing_add_scheme_modifier_effect = { MILESTONE = $MILESTONE$ OUTCOME = success } + } + 1 = { + desc = seduce_ongoing_possible_outcomes_tooltip_effect.failure.desc + show_chance = no + seduce_ongoing_add_scheme_modifier_effect = { MILESTONE = $MILESTONE$ OUTCOME = failure } + } + } + } +} + +#To add CHARACTER to a list that block seduction schemes from being initiated +## use in the scope of the character that blocks CHARACTER (i.e. the scheme target's scope) +seduction_block_character_effect = { + if = { + limit = { root = scope:target } + custom_tooltip = seduce_outcome.permanent_block + + hidden_effect = { + add_opinion = { + target = $CHARACTER$ + modifier = seduce_permanent_blocker_opinion + } + } + } + else_if = { + limit = { + exists = scope:target + scope:target = { + is_alive = yes + } + } + add_opinion = { + target = $CHARACTER$ + modifier = seduce_permanent_blocker_opinion + } + } +} + +seduction_cooldown_for_character_effect = { + if = { + limit = { root = scope:target } + custom_tooltip = seduce_outcome.cooldown + + hidden_effect = { + add_opinion = { + target = $CHARACTER$ + modifier = seduce_regular_cooldown_opinion + } + } + } + else = { + add_opinion = { + target = $CHARACTER$ + modifier = seduce_regular_cooldown_opinion + } + } +} + +owner_seduce_outcome_success_send_discovery_event_effect = { + hidden_effect = { + if = { + limit = { exists = scope:scheme_discovered } + trigger_event = { + id = seduce_outcome.2900 + days = 3 + } + } + } +} + +owner_seduce_outcome_become_lovers_option_effects = { + show_as_tooltip = { set_relation_lover = scope:target } + add_character_flag = { #to assure that this is when the relationship is set + flag = consummation_and_relationship + days = 10 + } + + reverse_add_opinion = { + target = scope:target + modifier = romance_opinion + opinion = 20 + } + + if = { + limit = { + faith = { + has_doctrine_parameter = piety_gain_from_successful_intrigue_schemes + } + } + add_piety = minor_piety_gain + } + + if = { + limit = { + has_government = landless_adventurer_government + has_perk = mortal_adoration_perk + scope:target = { is_ruler = yes } + } + add_contact = scope:target + add_hook_if_possible_default_length_effect = { + TARGET = scope:target + TYPE = manipulation_hook + } + } + + if = { + limit = { + dynasty ?= { + has_dynasty_perk = fp1_adventure_legacy_2 + } + } + add_prestige = fp1_adventure_legacy_2_prestige_value + } + + if = { + limit = { + is_close_family_of = scope:target + } + create_character_memory = { + type = seduced_family + + participants = { + family_member = scope:target + } + } + } + + owner_seduce_outcome_success_send_discovery_event_effect = yes +} + +owner_seduce_outcome_just_sex_effects = { + reverse_add_opinion = { + target = scope:target + modifier = romance_opinion + opinion = 20 + } + + if = { + limit = { + faith = { + has_doctrine_parameter = piety_gain_from_successful_intrigue_schemes + } + } + add_piety = minor_piety_gain + } + + if = { + limit = { + dynasty ?= { + has_dynasty_perk = fp1_adventure_legacy_2 + } + } + add_prestige = fp1_adventure_legacy_2_prestige_value + } + + owner_seduce_outcome_success_send_discovery_event_effect = yes +} + +#In most cases, it makes more sense to actually apply the sex effect in the target's events (which are after the owner's events). This is because A) you don't want any pop-ups for the target before they have recieved their event and B) because some effects won't get a tooltip for being applied if they were already applied before. The only exception is when the owner is a player and the target is an AI. + + target_seduce_outcome_sex_effect = { + scope:target = { + if = { + limit = { + NAND = { + scope:owner = { is_ai = no } + scope:target = { is_ai = yes } + } + } + had_sex_with_effect = { + CHARACTER = scope:owner + PREGNANCY_CHANCE = seduce_pregnancy_chance + } + } + else = { + show_as_tooltip = { + had_sex_with_effect = { + CHARACTER = scope:owner + PREGNANCY_CHANCE = seduce_pregnancy_chance + } + } + } + } +} + +owner_seduce_outcome_sex_effect = { + scope:owner = { + if = { + limit = { + scope:owner = { is_ai = no } + scope:target = { is_ai = yes } + } + had_sex_with_effect = { + CHARACTER = scope:target + PREGNANCY_CHANCE = seduce_pregnancy_chance + } + } + else = { + show_as_tooltip = { + had_sex_with_effect = { + CHARACTER = scope:owner + PREGNANCY_CHANCE = seduce_pregnancy_chance + } + } + } + } +} + + +seduce_outcome_discovered_expose_secrets_and_adultery_effect = { + extramarital_sex_attempt_exposure_consequences_with_target_effect = { TARGET = $CHARACTER$ SPOUSE_EVENT = yes } #Adds trait + if = { + limit = { relation_with_character_is_incestuous_in_my_or_lieges_faith_trigger = { CHARACTER = $CHARACTER$ } } + random_secret = { + type = secret_incest + expose_secret = $EXPOSER$ + } + } + if = { + limit = { relation_with_character_is_sodomy_in_my_or_lieges_faith_trigger = { CHARACTER = $CHARACTER$ } } + random_secret = { + type = secret_homosexual + expose_secret = $EXPOSER$ + } + } +} + +seduce_outcome_failure_discovered_apply_secrets_effect = { + give_incest_secret_or_nothing_with_target_effect = { CHARACTER = scope:target } + give_homosexual_secret_or_nothing_with_target_effect = { CHARACTER = scope:target } +} + +seduce_outcome_success_discovered_effect = { + if = { + limit = { + any_secret = { + type = secret_lover + OR = { + secret_target = scope:target + secret_target = scope:owner + } + } + } + random_secret = { #Revealing the secret will send events for both lovers + type = secret_lover + limit = { + OR = { + secret_target = scope:target + secret_target = scope:owner + } + } + expose_secret = scope:target_liege + } + } + else = { + scope:owner = { seduce_outcome_discovered_expose_secrets_and_adultery_effect = { CHARACTER = scope:target EXPOSER = scope:target_liege } } + scope:target = { seduce_outcome_discovered_expose_secrets_and_adultery_effect = { CHARACTER = scope:owner EXPOSER = scope:target_liege } } + } +} + +seduce_outcome_publicised_attempted_crimes_or_nothing_effect = { + $TARGET$ = { + #Grab everyone relevant who might be interested in the attempt. + every_close_family_member = { add_to_list = relevant_parties } + every_consort = { + limit = { + NOT = { is_in_list = relevant_parties } + } + add_to_list = relevant_parties + } + if = { + limit = { + liege ?= { + NOT = { is_in_list = relevant_parties } + } + } + add_to_list = relevant_parties + } + if = { + limit = { + court_owner ?= { + NOT = { is_in_list = relevant_parties } + } + } + add_to_list = relevant_parties + } + every_vassal = { + limit = { + NOT = { is_in_list = relevant_parties } + } + add_to_list = relevant_parties + } + every_relation = { + type = friend + limit = { + NOT = { is_in_list = relevant_parties } + } + add_to_list = relevant_parties + } + every_relation = { + type = lover + limit = { + NOT = { is_in_list = relevant_parties } + } + add_to_list = relevant_parties + } + $OWNER$ = { + every_close_family_member = { + limit = { + NOT = { is_in_list = relevant_parties } + } + add_to_list = relevant_parties + } + } + + #Adulterer + if = { + limit = { + $OWNER$ = { is_married = yes } + trait_is_shunned_or_criminal_in_faith_trigger = { + TRAIT = adulterer + FAITH = this.faith + GENDER_CHARACTER = $OWNER$ + } + } + every_in_list = { + list = relevant_parties + limit = { + #Filter out anyone who wouldn't care about this. + NOR = { + #Kids too young to understand the bias have no prejudice. + is_adult = no + #Not compos mentis. + has_trait = incapable + #People who are adulterers. + has_trait = adulterer + #The person doing the seducing don't think less of themselves either. + this = $OWNER$ + } + #And who count the action as adulterous. + trait_is_shunned_or_criminal_in_faith_trigger = { + TRAIT = adulterer + FAITH = faith + GENDER_CHARACTER = $OWNER$ + } + } + custom = characters_close_to_target_who_dislike_adultery + #Apply attempt opinion effects. + add_opinion = { + modifier = adulterer_advances_on_relevant_character + target = $OWNER$ + } + } + } + + #Fornicator + if = { + limit = { + $OWNER$ = { is_married = no } + trait_is_shunned_or_criminal_in_faith_trigger = { + TRAIT = fornicator + FAITH = faith + GENDER_CHARACTER = $OWNER$ + } + } + every_in_list = { + list = relevant_parties + limit = { + #Filter out anyone who wouldn't care about this. + NOR = { + #Kids too young to understand the bias have no prejudice. + is_adult = no + #Not compos mentis. + has_trait = incapable + #People who are fornicators. + has_trait = fornicator + #The person doing the seducing don't think less of themselves either. + this = $OWNER$ + } + #And who count the action to be fornication. + trait_is_shunned_or_criminal_in_faith_trigger = { + TRAIT = fornicator + FAITH = this.faith + GENDER_CHARACTER = $OWNER$ + } + } + custom = characters_close_to_target_who_dislike_fornication + #Apply attempt opinion effects. + add_opinion = { + modifier = fornicator_advances_on_relevant_character + target = $OWNER$ + } + } + } + + #Incestuous + if = { + limit = { + relation_with_character_is_incestuous_in_my_faith_trigger = { CHARACTER = $OWNER$ } + } + every_in_list = { + list = relevant_parties + limit = { + #Filter out anyone who wouldn't care about this. + NOR = { + #Kids too young to understand the bias have no prejudice. + is_adult = no + #Not compos mentis. + has_trait = incapable + #People who are incestuous. + has_trait = incestuous + #Or who don't count the action as incestuous. + faith = { + faith_allows_marriage_consanguinity_trigger = { + CHARACTER_1 = $OWNER$ + CHARACTER_2 = $TARGET$ + } + } + #The person doing the seducing don't think less of themselves either. + this = $OWNER$ + } + } + custom = characters_close_to_target_who_dislike_incest + #Apply attempt opinion effects. + add_opinion = { + modifier = incestuous_advances_on_relevant_character + target = $OWNER$ + } + } + } + + #Sodomite + if = { + limit = { + relation_with_character_is_sodomy_trigger = { CHARACTER = $OWNER$ } + } + every_in_list = { + list = relevant_parties + limit = { + #Filter out anyone who wouldn't care about this. + NOR = { + #Kids too young to understand the bias have no prejudice. + is_adult = no + #Not compos mentis. + has_trait = incapable + #People who are sodomites themselves. + has_trait = sodomite + #Males who could be sodomites. + AND = { + is_male = yes + OR = { + has_sexuality = bisexual + has_sexuality = homosexual + } + } + #Or who don't count the action as incestuous. + faith = { + faith_allows_marriage_consanguinity_trigger = { + CHARACTER_1 = $OWNER$ + CHARACTER_2 = $TARGET$ + } + } + #The person doing the seducing don't think less of themselves either. + this = $OWNER$ + } + #And, finally, must actually be fussed about sodomy to begin with. + relation_between_characters_is_sodomy_in_my_faith_trigger = { + CHARACTER_1 = $OWNER$ + CHARACTER_2 = $TARGET$ + } + } + custom = characters_close_to_target_who_dislike_sodomy + #Apply attempt opinion effects. + add_opinion = { + modifier = sodomite_advances_on_relevant_character + target = $OWNER$ + } + } + } + } +} + +set_relation_lover_through_seduction_effect = { + $CHARACTER$ = { save_scope_as = second_character } + if = { #To save a potential important object to be used later on + limit = { + exists = scope:scheme + scope:scheme = { has_variable = object_of_importance } + NOT = { has_variable_list = lover_object_of_importance } + } + add_to_variable_list = { + name = lover_object_of_importance + target = scope:scheme.var:object_of_importance + } + add_to_variable_list = { + name = lover_object_of_importance + target = scope:second_character + } + } + else_if = { #you can save two different seduction objects + limit = { + exists = scope:scheme + scope:scheme = { has_variable = object_of_importance } + has_variable_list = lover_object_of_importance + NOT = { has_variable_list = lover_object_of_importance_2 } + } + add_to_variable_list = { + name = lover_object_of_importance_2 + target = scope:scheme.var:object_of_importance + } + add_to_variable_list = { + name = lover_object_of_importance_2 + target = scope:second_character + } + } + scope:scheme = { + end_scheme = yes + } + if = { # Safeguard because so much stuff can happen + limit = { + NOT = { has_relation_lover = scope:second_character } + } + scope:second_character = { + set_relation_lover = { + target = prev + reason = $REASON$ + province = $LOCATION$ + } + } + } +} + +set_object_of_significance_effect = { + if = { + limit = { + scope:scheme = { + NOT = { has_variable = object_of_importance } + } + } + scope:scheme = { + random_list = { + 1 = { + set_variable = { + name = object_of_importance + value = flag:rose + } + } + 1 = { + set_variable = { + name = object_of_importance + value = flag:sea_shell + } + } + } + } + } +} + +set_random_religious_text_effect = { + random_list = { + 1 = { + #Christian + trigger = { faith.religion = religion:christianity_religion } + save_scope_value_as = { + name = religious_book_title + value = flag:golden_legend + } + } + 1 = { + #Christian + trigger = { faith.religion = religion:christianity_religion } + save_scope_value_as = { + name = religious_book_title + value = flag:city_of_god + } + } + 1 = { + #Christian + trigger = { + faith.religion = religion:christianity_religion + NOT = { faith = faith:orthodox } + } + save_scope_value_as = { + name = religious_book_title + value = flag:summa_theologica + } + } + 1 = { + #Christian + trigger = { + faith.religion = religion:christianity_religion + NOT = { faith = faith:orthodox } + } + save_scope_value_as = { + name = religious_book_title + value = flag:sic_et_non + } + } + 1 = { + #Christian Orthodox + trigger = { + faith = faith:orthodox + } + save_scope_value_as = { + name = religious_book_title + value = flag:chrysostomos + } + } + 1 = { + #Christian Orthodox + trigger = { + faith = faith:orthodox + } + save_scope_value_as = { + name = religious_book_title + value = flag:symeon_menologion + } + } + 1 = { + #Christian Orthodox + trigger = { + faith = faith:orthodox + } + save_scope_value_as = { + name = religious_book_title + value = flag:god_and_christ + } + } + 1 = { + #Muslim + trigger = { faith.religion = religion:islam_religion } + save_scope_value_as = { + name = religious_book_title + value = flag:the_small_book_on_theism + } + } + 1 = { + #Muslim + trigger = { faith.religion = religion:islam_religion } + save_scope_value_as = { + name = religious_book_title + value = flag:modern_philosophy + } + } + 1 = { + #Any + save_scope_value_as = { + name = religious_book_title + value = flag:stories_from_holy_book + } + } + } +} + +set_random_entertainment_text_effect = { + random_list = { + 1 = { + #Germanic language + trigger = { + root.culture = { + OR = { + has_cultural_pillar = language_central_germanic + has_cultural_pillar = language_norse + has_cultural_pillar = language_anglic + } + } + } + save_scope_value_as = { + name = entertainment_book_title + value = flag:beowulf + } + } + 1 = { + #Germanic language + trigger = { + root.culture = { + OR = { + has_cultural_pillar = language_central_germanic + has_cultural_pillar = language_norse + has_cultural_pillar = language_anglic + } + } + } + save_scope_value_as = { + name = entertainment_book_title + value = flag:niebelungenlied + } + } + 1 = { + #Latin + trigger = { root.culture = { has_cultural_pillar = language_italian } } + save_scope_value_as = { + name = entertainment_book_title + value = flag:song_of_roland + } + } + 1 = { + #Welsh saga + trigger = { + OR = { + root.culture = { has_cultural_pillar = language_brythonic } + root.culture = { has_cultural_pillar = language_goidelic } + } + } + save_scope_value_as = { + name = entertainment_book_title + value = flag:mabinogi + } + } + 1 = { + #Not in Jerusalem + trigger = { + NOR = { + AND = { + exists = root.capital_province + root.capital_province = { geographical_region = world_middle_east } + } + root.culture = { has_cultural_pillar = language_israelite } + } + } + save_scope_value_as = { + name = entertainment_book_title + value = flag:travels_to_jerusalem + } + } + 1 = { + # Not in India + trigger = { + trigger_if = { + limit = { + exists = root.capital_province + } + NOT = { + root.capital_province = { geographical_region = world_india } + } + } + } + save_scope_value_as = { + name = entertainment_book_title + value = flag:east_of_indus + } + } + 1 = { + #Not in Byzantium + trigger = { + NOR = { + root.culture = { + OR = { + has_cultural_pillar = heritage_byzantine + has_cultural_pillar = heritage_caucasian + } + } + has_title = title:e_byzantium + } + } + save_scope_value_as = { + name = entertainment_book_title + value = flag:travels_to_byzantium + } + } + 1 = { + #Greek + trigger = { root.culture = { has_cultural_pillar = language_greek } } + save_scope_value_as = { + name = entertainment_book_title + value = flag:digenes_akrites + } + } + 1 = { + #Greek + trigger = { root.culture = { has_cultural_pillar = language_greek } } + save_scope_value_as = { + name = entertainment_book_title + value = flag:epigrams + } + } + 1 = { + #Greek + trigger = { root.culture = { has_cultural_pillar = language_greek } } + save_scope_value_as = { + name = entertainment_book_title + value = flag:philogelos + } + } + 1 = { + #Any + save_scope_value_as = { + name = entertainment_book_title + value = flag:riddle_poems + } + } + } +} + +set_random_informative_text_effect = { + random_list = { + 1 = { + #Arabic + trigger = { + OR = { + root.culture = { has_cultural_pillar = heritage_arabic } + root.culture = { has_cultural_pillar = language_arabic } + } + } + save_scope_value_as = { + name = informative_book_title + value = flag:on_the_judgement_of_the_stars + } + } + 1 = { + #Arabic + trigger = { + OR = { + scope:culture ?= { has_cultural_pillar = heritage_arabic } + scope:culture ?= { has_cultural_pillar = language_arabic } + } + } + save_scope_value_as = { + name = informative_book_title + value = flag:the_perfect_state + } + } + 1 = { + #"Any" + save_scope_value_as = { + name = informative_book_title + value = flag:spiritual_medicine + } + } + 1 = { + #Latin + trigger = { + root.capital_province ?= { geographical_region = world_europe } + } + save_scope_value_as = { + name = informative_book_title + value = flag:trotula + } + } + 1 = { + #Jewish/Any + save_scope_value_as = { + name = informative_book_title + value = flag:the_improvement_of_the_moral_qualities + } + } + 1 = { + #Welsh (Anyone in the British Isles) + trigger = { + root.capital_province ?= { geographical_region = world_europe_west_britannia } + } + save_scope_value_as = { + name = informative_book_title + value = flag:armes_prydein + } + } + 1 = { + #Anywhere around the Mediterrenean + trigger = { + root.capital_province ?= { + OR = { + geographical_region = world_europe + geographical_region = world_africa_north_east + geographical_region = world_africa_north_west + } + } + } + save_scope_value_as = { + name = informative_book_title + value = flag:almagest + } + } + 1 = { + #Greek + trigger = { root.culture = { has_cultural_pillar = language_greek } } + save_scope_value_as = { + name = informative_book_title + value = flag:anekdota + } + } + 1 = { + #Greek + trigger = { root.culture = { has_cultural_pillar = language_greek } } + save_scope_value_as = { + name = informative_book_title + value = flag:chronographia + } + } + } +} + +#To set up a location to use for the sex scene custom loc key +set_random_sex_scene_location_effect = { + hidden_effect = { + if = { + limit = { NOT = { has_variable = sex_scene_location } } + random_list = { + 20 = { + set_variable = { + name = sex_scene_location + value = flag:garden + } + } + 20 = { + set_variable = { + name = sex_scene_location + value = flag:private_chamber + } + } + 20 = { + set_variable = { + name = sex_scene_location + value = flag:stable + } + } + 20 = { + set_variable = { + name = sex_scene_location + value = flag:copse + } + } + 20 = { + set_variable = { + name = sex_scene_location + value = flag:kitchen + } + } + } + } + } +} + +#To transfer the location used in the sex scene custom loc key from one character to another +transfer_sex_scene_location_to_character_effect = { + if = { + limit = { + has_variable = sex_scene_location + } + if = { + limit = { + var:sex_scene_location = flag:garden + } + $CHARACTER$ = { + set_variable = { + name = sex_scene_location + value = flag:garden + } + } + } + else_if = { + limit = { + var:sex_scene_location = flag:private_chamber + } + $CHARACTER$ = { + set_variable = { + name = sex_scene_location + value = flag:private_chamber + } + } + } + else_if = { + limit = { + var:sex_scene_location = flag:stable + } + $CHARACTER$ = { + set_variable = { + name = sex_scene_location + value = flag:stable + } + } + } + else_if = { + limit = { + var:sex_scene_location = flag:copse + } + $CHARACTER$ = { + set_variable = { + name = sex_scene_location + value = flag:copse + } + } + } + else_if = { + limit = { + var:sex_scene_location = flag:kitchen + } + $CHARACTER$ = { + set_variable = { + name = sex_scene_location + value = flag:kitchen + } + } + } + } +} + +################################################## +# Abduct Scheme Effects + +#Sets up the Outcome Roll values +abduct_outcome_roll_setup_effect = { + #Discovery Roll setup + save_scope_value_as = { + name = discovery_chance + value = { + value = 100 + subtract = scope:scheme.scheme_secrecy + } + } +} + +#Roll to check whether a Abduct Scheme is a success or a failure, and whether the owner is discovered +abduct_outcome_roll_effect = { + #SUCCESS ROLL + random = { + chance = scope:scheme.scheme_success_chance + custom_tooltip = abduct_successful_roll_tt + scope:owner = { mandala_trickster_increment_successful_schemes_effect = yes } + save_scope_value_as = { + name = scheme_successful + value = yes + } + } + ### End Success roll + #DISCOVERY ROLL + custom_label = abduct_success_discovery_tt + random = { + chance = scope:discovery_chance + custom_tooltip = abduct_become_discovered_roll_tt + save_scope_value_as = { + name = scheme_discovered + value = yes + } + } + ### End Discovery roll + + hidden_effect = { + #FIRE CORRECT ON ACTIONS + if = { + limit = { + exists = scope:scheme_successful + } + trigger_event = { + on_action = abduct_succeeded + } + } + else = { + trigger_event = { + on_action = abduct_failed + } + } + } +} + +#Used in the immediate of the Scheme Owner's success event +abduct_success_effect = { + + scope:target = { + add_character_flag = { + flag = was_abducted_block_notification_event + days = 2 + } + trigger_event = abduct_outcome.5001 + } + + hard_imprison_character_effect = { + TARGET = scope:target + IMPRISONER = scope:owner + } + + if = { + limit = { + exists = scope:owner.house + exists = scope:target.house + } + scope:owner.house = { + change_house_relation_effect = { + HOUSE = scope:target.house + VALUE = house_relation_damage_medium_value + REASON = abduction + CHAR = scope:owner + TARGET_CHAR = scope:target + TITLE = scope:dummy_gender + } + } + } +} + +abduct_failure_effect = { + #Add Watchful Modifier to the target + scope:target = { + show_as_tooltip = { + add_character_modifier = { + modifier = watchful_modifier + days = watchful_modifier_duration + } + } + } + + scope:target = { + trigger_event = abduct_outcome.5002 + } +} + +successful_abduct_outcome_event_option_effect = { + if = { + limit = { + faith = { + has_doctrine_parameter = piety_gain_from_successful_intrigue_schemes + } + } + add_piety = minor_piety_gain + } + + scope:scheme ?= { + end_scheme = yes + } +} + +################################################## +# Befriend Scheme Effects + +successful_befriend_potential_friend_effect = { + $CHARACTER$ = { + if = { #Always leads to a potential friendship + limit = { + NOR = { + has_relation_potential_friend = root + has_relation_friend = root + } + } + if = { #Remove potential rival relation if you have it + limit = { + has_relation_potential_rival = root + } + remove_relation_potential_rival = root + } + set_relation_potential_friend = root + } + if = { + limit = { + number_of_traits_in_common = { + target = root + value >= 3 + } + } + $CHARACTER$ = { + add_opinion = { + modifier = friendliness_opinion + target = root + opinion = 30 + } + } + } + else = { + $CHARACTER$ = { + add_opinion = { + modifier = friendliness_opinion + target = root + opinion = 20 + } + } + } + } +} + +successful_befriend_critical_change_effect = { + $CHARACTER$ = { + hidden_effect = { + if = { #Remove potential rival relation if you have it + limit = { + has_relation_potential_rival = root + } + remove_relation_potential_rival = root + } + } + if = { #Set friend relation + limit = { + NOT = { has_relation_friend = root } + } + if = { + limit = { + exists = scope:relationship_reason_location + } + set_relation_friend = { reason = $REASON$ target = root province = scope:relationship_reason_location } + } + else = { + set_relation_friend = { reason = $REASON$ target = root } + } + } + else_if = { #Fallback + limit = { + has_relation_friend = root + } + $CHARACTER$ = { + add_opinion = { + modifier = friendliness_opinion + target = root + opinion = 40 + } + } + } + } + if = { + limit = { + has_government = landless_adventurer_government + has_perk = friendly_counsel_perk + $CHARACTER$ = { is_ruler = yes } + } + add_contact = $CHARACTER$ + } +} + +failed_befriend_opinion_change_effect = { + $CHARACTER$ = { + add_opinion = { + modifier = refusal_opinion + target = root + opinion = -5 + } + hidden_effect = { + set_relation_potential_friend = root + } + } +} + +failed_befriend_opinion_critical_change_effect = { + $CHARACTER$ = { + add_opinion = { + modifier = disastrous_befriend_attempt_opinion + target = root + } + if = { + limit = { + NOR = { + has_relation_potential_rival = root + has_relation_rival = root + } + } + hidden_effect = { set_relation_potential_rival = root } + } + else_if = { #If you already are potential rivals, you have a chance of becoming Rivals + limit = { + has_relation_potential_rival = root + NOT = { has_relation_rival = root } + } + hidden_effect = { remove_relation_potential_rival = root } + set_relation_rival = { + target = root + reason = rival_disastrous_befriend_attempt + } + } + } +} + +################################################## +# Claim Throne Scheme Effects + +#Sets up the Outcome Roll values +claim_throne_outcome_roll_setup_effect = { + # Find appropriate title + scope:target = { + primary_title = { + save_scope_as = target_title + } + } + # Discovery Roll setup + save_scope_value_as = { + name = discovery_chance + value = { + value = 100 + subtract = scope:scheme.scheme_secrecy + } + } +} + +claim_throne_check_target_title_effect = { + # In case something has happened to the target_title, we try to reset it here: + if = { + limit = { + OR = { + NOT = { exists = scope:target_title } # The title could somehow disappear + NOT = { + scope:target_title = { # The title might feasibly pass to someone else + holder ?= scope:target + + } + } + } + } + scope:target = { + primary_title = { # We just assign the target's primary title as the new target title + save_scope_as = target_title + } + } + } + + # Rivalry check is done here, since it's run in every outcome + if = { + limit = { + OR = { + exists = scope:scheme_successful + exists = scope:scheme_discovered + } + NOT = { has_relation_rival = scope:target } + } + hidden_effect = { + random = { + chance = 30 + modifier = { + add = 30 + has_relation_potential_rival = scope:target + } + modifier = { + exists = scope:scheme_discovered + add = 30 + } + modifier = { + has_relation_friend = scope:target + add = -25 + } + + save_scope_value_as = { + name = set_rivalry + value = yes + } + } + } + } +} + +#Roll to check whether a Claim Throne Scheme is a success or a failure, and whether the owner is discovered +claim_throne_outcome_roll_effect = { + #SUCCESS ROLL + random = { + chance = scope:scheme.scheme_success_chance + custom_tooltip = claim_throne_successful_roll_tt + scope:owner = { mandala_trickster_increment_successful_schemes_effect = yes } + save_scope_value_as = { + name = scheme_successful + value = yes + } + } + ### End Success roll + #DISCOVERY ROLL + custom_description_no_bullet = { + text = claim_throne_success_discovery_warning_effect + } + random = { + chance = scope:discovery_chance + custom_tooltip = claim_throne_become_discovered_roll_tt + save_scope_value_as = { + name = scheme_discovered + value = yes + } + } + ### End Discovery roll + + hidden_effect = { + #FIRE CORRECT ON ACTIONS + if = { + limit = { + exists = scope:scheme_successful + } + trigger_event = { + on_action = claim_throne_succeeded + days = 3 + } + } + else = { + trigger_event = { + on_action = claim_throne_failed + days = 3 + } + } + } +} + +#Used in the immediate of the Scheme Owner's success event +claim_throne_success_effect = { + # Note that the Claim itself is added in successful_claim_throne_outcome_event_option_effect + + if = { + limit = { + exists = scope:scheme_discovered + } + # Trigger the response event for the target (actual opinion is set here) + scope:target = { + trigger_event = claim_throne_outcome.5001 + } + + show_as_tooltip = { # Target dislikes you + scope:target = { + add_opinion = { + target = scope:owner + modifier = claim_my_throne_success_discovered_opinion + } + } + } + } + else = { + # Trigger the response event for the target (actual opinion is set here) + scope:target = { + trigger_event = claim_throne_outcome.5002 + } + show_as_tooltip = { + scope:target = { + add_opinion = { + target = scope:owner + modifier = claim_my_throne_success_undiscovered_opinion + years = 10 + } + } + } + } +} + +claim_throne_failure_effect = { + add_prestige = claim_throne_discovered_failure_prestige_loss + scope:target = { + # Fire notification event for target + trigger_event = claim_throne_outcome.5003 + show_as_tooltip = { + add_opinion = { + target = scope:owner + modifier = claim_my_throne_failure_opinion + years = 10 + } + if = { + limit = { exists = scope:set_rivalry } + set_relation_rival = { + target = scope:owner + reason = rival_claimed_throne_failed + } + } + } + } +} + +successful_claim_throne_event_option_effect = { + if = { + limit = { + exists = scope:scheme_discovered + } + add_prestige = claim_throne_discovered_prestige_loss + } + show_as_tooltip = { + scope:target = { + if = { + limit = { exists = scope:set_rivalry } + set_relation_rival = { + target = scope:owner + reason = rival_claimed_throne + } + } + if = { + limit = { exists = scope:scheme_discovered } + add_opinion = { + target = scope:owner + modifier = claim_my_throne_success_discovered_opinion + } + } + else = { + add_opinion = { + target = scope:owner + modifier = claim_my_throne_success_undiscovered_opinion + years = 10 + } + } + } + } + + scope:scheme = { + end_scheme = yes + } + + add_pressed_claim = scope:target_title +} + +claim_throne_decline_execution_effect = { + custom_tooltip = do_not_execute_claim_throne_tooltip + scope:scheme = { + reset_failed_scheme_effect = yes + } +} + +claim_throne_set_mythical_founder_variable_effect = { + if = { + limit = { + AND = { # Charles Martell + OR = { + scope:target_title = title:k_france + scope:target_title = title:e_france + } + current_date > 1000.1.1 + } + } + set_variable = { + name = mythical_founder + value = flag:charles_martell + } + } + else_if = { # Alexander + limit = { + OR = { + scope:target_title = title:k_thessalonika + scope:target_title = title:k_hellas + scope:target_title = title:k_egypt + AND = { + OR = { + scope:target_title = title:k_persia + scope:target_title = title:e_persia + } + NOR = { + root.faith.religion = religion:islam_religion + root.faith.religion = religion:zoroastrianism_religion + } + } + scope:target_title = title:k_anatolia + } + } + set_variable = { + name = mythical_founder + value = flag:alexander + } + } + else_if = { # Lech + limit = { + scope:target_title = title:k_poland # Lech + } + set_variable = { + name = mythical_founder + value = flag:lech + } + } + else_if = { # Czech + limit = { + scope:target_title = title:k_bohemia # Lech + } + set_variable = { + name = mythical_founder + value = flag:czech + } + } + else_if = { # Rus + limit = { + OR = { # Rus + scope:target_title = title:k_white_rus + scope:target_title = title:k_ruthenia + scope:target_title = title:e_russia + } + } + set_variable = { + name = mythical_founder + value = flag:rus + } + } + else_if = { # Arthur + limit = { + OR = { + scope:target_title = title:k_wales + scope:target_title = title:k_cornwall + scope:target_title = title:k_england + scope:target_title = title:e_britannia + } + } + set_variable = { + name = mythical_founder + value = flag:arthur + } + } + else_if = { # Belisarius + limit = { + OR = { + scope:target_title = title:k_italy + scope:target_title = title:k_romagna + scope:target_title = title:k_sardinia + scope:target_title = title:e_italy + scope:target_title = title:h_roman_empire + scope:target_title = title:h_eastern_roman_empire + } + faith = faith:orthodox + } + set_variable = { + name = mythical_founder + value = flag:belisarius + } + } + else_if = { # Romulus + limit = { + OR = { + scope:target_title = title:k_italy + scope:target_title = title:k_romagna + scope:target_title = title:k_sardinia + scope:target_title = title:e_italy + scope:target_title = title:h_roman_empire + scope:target_title = title:h_eastern_roman_empire + } + } + set_variable = { + name = mythical_founder + value = flag:romulus + } + } + else_if = { # Ardashir + limit = { + OR = { + scope:target_title = title:k_persia + scope:target_title = title:e_persia + } + } + set_variable = { + name = mythical_founder + value = flag:ardashir + } + } + else_if = { # The Pharaohs + limit = { + scope:target_title = title:k_egypt + NOT = { religion = religion:islam_religion } + } + set_variable = { + name = mythical_founder + value = flag:pharaohs + } + } + else_if = { # The Visigothic Kings + limit = { + OR = { + scope:target_title = title:k_castille + scope:target_title = title:k_aragon + scope:target_title = title:k_navarra + scope:target_title = title:k_andalusia + scope:target_title = title:k_portugal + scope:target_title = title:e_spain + } + NOT = { religion = religion:islam_religion } + } + set_variable = { + name = mythical_founder + value = flag:visigothic_kings + } + } + else_if = { # Abd al-Rahman + limit = { + OR = { + scope:target_title = title:k_castille + scope:target_title = title:k_aragon + scope:target_title = title:k_navarra + scope:target_title = title:k_andalusia + scope:target_title = title:k_portugal + scope:target_title = title:e_spain + } + religion = religion:islam_religion + } + set_variable = { + name = mythical_founder + value = flag:abd_al_rahman + } + } + else_if = { # Zenobia + limit = { + OR = { + scope:target_title = title:k_syria + scope:target_title = title:k_mesopotamia + } + NOT = { religion = religion:islam_religion } + } + set_variable = { + name = mythical_founder + value = flag:zenobia + } + } + else = { + set_variable = { + name = mythical_founder + value = flag:fallback + } + } +} + +################################################## +# Elope Scheme Effects + +elope_opinion_list_builder_effect = { + $OWNER$ = { + every_spouse = { + limit = { NOT = { this = $TARGET$ } } + add_to_temporary_list = $LIST_NAME$ + } + } + $TARGET$ = { + every_spouse = { + limit = { NOT = { this = $OWNER$ } } + add_to_temporary_list = $LIST_NAME$ + } + liege = { + if = { + limit = { + NOR = { + is_in_list = $LIST_NAME$ + this = $OWNER$ + } + } + add_to_temporary_list = $LIST_NAME$ + } + } + } +} + +elope_success_effect = { + elope_opinion_list_builder_effect = { OWNER = $OWNER$ TARGET = $TARGET$ LIST_NAME = elope_opinion_list } + + #Because this can be used in events or interaction window, we save root_scope here + if = { + limit = { exists = scope:actor } + scope:actor = { save_temporary_scope_as = root_scope } + } + else = { + root = { save_temporary_scope_as = root_scope } + } + + #Target prisoner release + $TARGET$ = { + if = { + limit = { is_imprisoned = yes } + release_from_prison = yes + } + } + + $OWNER$ = { + #Tooltip for marriage + show_as_tooltip = { + if = { + limit = { is_female = yes } + marry_matrilineal = $TARGET$ + } + else = { + marry = $TARGET$ + } + } + + #Owner's personal consequences (hidden or not), divorce happens here + if = { + limit = { + scope:root_scope = $OWNER$ + } + elope_success_personal_consequences_effect = { CHARACTER = $OWNER$ } + } + else = { + hidden_effect = { elope_success_personal_consequences_effect = { CHARACTER = $OWNER$ } } + } + } + + #Opinions + ordered_in_list = { + list = elope_opinion_list + max = 10 #To make sure we include all + check_range_bounds = no + order_by = ai_vengefulness + + #Towards owner + if = { + limit = { + OR = { #Owner wants to see everything, root wants to see their own + scope:root_scope = $OWNER$ + scope:root_scope = this + } + } + elope_success_opinion_rivalry_effect = { CHARACTER = $OWNER$ } + } + else = { + hidden_effect = { elope_success_opinion_rivalry_effect = { CHARACTER = $OWNER$ } } + } + + #Towards target + if = { + limit = { scope:root_scope = this } #Root wants to see their own + elope_success_opinion_rivalry_effect = { CHARACTER = $TARGET$ } + } + else = { + hidden_effect = { elope_success_opinion_rivalry_effect = { CHARACTER = $TARGET$ } } + } + } + + + hidden_effect = { + #Target's personal consequences, divorce happens here + elope_success_personal_consequences_effect = { CHARACTER = $TARGET$ } + + #Marriage + $OWNER$ = { #We do this last so old spouses remain when we run personal consequences effect + if = { + limit = { is_female = yes } + marry_matrilineal = $TARGET$ + } + else = { + marry = $TARGET$ + } + } + } +} + +elope_failure_discovered_effect = { + elope_opinion_list_builder_effect = { OWNER = $OWNER$ TARGET = $TARGET$ LIST_NAME = elope_opinion_list } + + #Expose lover secret + $OWNER$ = { + random_secret = { + type = secret_lover + limit = { + secret_target = $TARGET$ + } + + if = { + limit = { $DISCOVERER$ = { is_ai = yes } } + expose_secret = $DISCOVERER$ + } + else = { + reveal_to = $DISCOVERER$ + } + } + } + + #Opinions + ordered_in_list = { + list = elope_opinion_list + max = 10 #To make sure we include all + check_range_bounds = no + order_by = ai_vengefulness + + #Towards owner + if = { + limit = { + OR = { #Owner wants to see everything, root wants to see their own + root = $OWNER$ + root = this + } + } + elope_failure_discovered_opinion_rivalry_effect = { CHARACTER = $OWNER$ } + } + else = { + hidden_effect = { elope_failure_discovered_opinion_rivalry_effect = { CHARACTER = $OWNER$ } } + } + + #Towards target + if = { + limit = { root = this } #Root wants to see their own + elope_failure_discovered_opinion_rivalry_effect = { CHARACTER = $TARGET$ } + } + else = { + hidden_effect = { elope_failure_discovered_opinion_rivalry_effect = { CHARACTER = $TARGET$ } } + } + } +} + +elope_success_opinion_rivalry_effect = { + #Crime opinion + add_opinion = { + target = $CHARACTER$ + modifier = elopement_opinion + } + + #Rivalry + if = { + limit = { + can_set_relation_rival_trigger = { CHARACTER = $CHARACTER$ } + is_ai = yes + trigger_if = { + limit = { is_spouse_of = $CHARACTER$ } + ai_vengefulness >= low_positive_ai_value + } + trigger_else = { + ai_vengefulness > 0 + } + } + if = { + limit = { + can_set_relation_nemesis_trigger = { CHARACTER = $CHARACTER$ } + ai_vengefulness >= medium_positive_ai_value + } + set_relation_nemesis = { + reason = nemesis_elopement + copy_reason = rival + target = $CHARACTER$ + } + } + else = { + set_relation_rival = { + target = $CHARACTER$ + reason = rival_eloped + } + } + } + else_if = { + limit = { + can_set_relation_potential_rival_trigger = { CHARACTER = $CHARACTER$ } + } + hidden_effect = { set_relation_potential_rival = $CHARACTER$ } + } +} + +elope_success_personal_consequences_effect = { + $CHARACTER$ = { + + #Divorce + if = { + limit = { + is_married = yes + } + every_spouse = { + save_temporary_scope_as = eloper_divorcee + + divorce_effect = { + DIVORCER = $CHARACTER$ + DIVORCEE = scope:eloper_divorcee + } + if = { + limit = { has_relation_lover = $CHARACTER$ } + remove_relation_lover = $CHARACTER$ + } + } + + #Divorce consequences + if = { + limit = { faith = { NOT = { has_doctrine = doctrine_divorce_allowed } } } + add_prestige_level = -1 + add_piety_level = -1 + + if = { + limit = { + faith = { has_doctrine = tenet_communion } + NOT = { has_trait = excommunicated } + } + add_trait = excommunicated + } + } + } + + #Break betrothal + if = { + limit = { is_betrothed = yes } + reverse_add_opinion = { + modifier = broke_betrothal_opinion + target = betrothed + } + break_betrothal = betrothed + if = { + limit = { + has_been_promised_grand_wedding = yes + } + break_grand_wedding_betrothal_effect = yes + } + } + + #End concubinage + if = { + limit = { is_concubine = yes } + liege = { + remove_concubine = $CHARACTER$ + + if = { + limit = { has_relation_lover = $CHARACTER$ } + remove_relation_lover = $CHARACTER$ + } + } + add_prestige_level = -1 + } + } +} + +elope_failure_discovered_opinion_rivalry_effect = { + add_opinion = { + target = $CHARACTER$ + modifier = attempted_elopement_opinion + } + + #Rivalry + if = { + limit = { + can_set_relation_potential_rival_trigger = { CHARACTER = $CHARACTER$ } + } + hidden_effect = { set_relation_potential_rival = $CHARACTER$ } + } +} + +################################################## +# Fabricate Hook Scheme Effects + +fabricate_hook_assign_appropriate_type_effect = { + debug_log = "Running Fabricate Hook's Assign Appropriate Hook effect" + assert_if = { + limit = { + scope:owner = { + has_strong_hook = scope:target + } + } + text = "The Fabricate Hook Scheme Owner already has a Strong Hook on the Target! Why is this effect running?" + } + assert_if = { + limit = { + scope:target = { is_ruler = yes } + NOT = { exists = scope:strong_hook_against_ruler } + scope:owner = { has_hook = scope:target } + } + text = "The Owner has a hook against a ruler target, and the strong hook roll failed. Something has gone wrong to get here!" + } + + save_scope_value_as = { + name = hook_type + value = flag:$TYPE$ + } + # Go through the Hook types, and assign the appropriate one + if = { + limit = { + scope:hook_type = flag:loyalty_hook + } + # Check rulers first (to give weaker Hooks) + if = { + limit = { + scope:target = { is_ruler = yes } + NOT = { exists = scope:strong_hook_against_ruler } # Set by on_ready in the Scheme + } + send_interface_toast = { + title = fabricate_hook_gained_indebted_title + left_icon = scope:target + add_hook = { + type = indebted_hook + target = scope:target + } + } + } + else = { + send_interface_toast = { + title = fabricate_hook_gained_loyalty_title + left_icon = scope:target + add_hook = { + type = loyalty_hook + target = scope:target + } + } + } + } + else_if = { + limit = { + scope:hook_type = flag:fabrication_hook + } + # Check rulers first (to give weaker Hooks) + if = { + limit = { + scope:target = { is_ruler = yes } + NOT = { exists = scope:strong_hook_against_ruler } # Set by on_ready in the Scheme + } + send_interface_toast = { + title = fabricate_hook_gained_manipulation_title + left_icon = scope:target + add_hook = { + type = manipulation_hook + target = scope:target + } + } + } + else = { + send_interface_toast = { + title = fabricate_hook_gained_indebted_title + left_icon = scope:target + add_hook = { + type = fabrication_hook + target = scope:target + } + } + } + } + else_if = { + limit = { + scope:hook_type = flag:life_threat_hook + } + debug_log = "Attempting to set life threat hook" + # Check rulers first (to give weaker Hooks) + if = { + limit = { + scope:target = { is_ruler = yes } + NOT = { exists = scope:strong_hook_against_ruler } # Set by on_ready in the Scheme + } + debug_log = "Trying to set regular threat hook against ruler" + send_interface_toast = { + title = fabricate_hook_gained_threat_title + left_icon = scope:target + add_hook = { + type = threat_hook + target = scope:target + } + scope:target = { + add_opinion = { + target = scope:owner + modifier = fabricate_hook_threatened_me + years = 10 + } + } + } + } + else = { + if = { + limit = { exists = scope:strong_hook_against_ruler } + debug_log = "Trying to set life_threat_hook against a ruler" + } + else = { + debug_log = "Setting life_threat_hook against non-ruler" + assert_if = { + limit = { scope:target = { is_ruler = yes } } + text = "There is no ruler strong hook roll, but we're still trying to set a life_threat_hook on them!" + } + } + send_interface_toast = { + title = fabricate_hook_gained_threat_title + left_icon = scope:target + add_hook = { + type = life_threat_hook + target = scope:target + } + scope:target = { + add_opinion = { + target = scope:owner + modifier = fabricate_hook_threatened_me + years = 10 + } + } + } + } + } + # Error catch + else = { + assert_if = { + limit = { always = yes } # It should never get here + text = "Fabricate Hook assignment effect did not have a Hook type set when trying to assign a Hook!" + } + } +} + +fabricate_hook_block_scheme_owner_from_further_schemes_effect = { + add_opinion = { + target = scope:owner + modifier = fabricated_hook_against_court_opinion + years = 5 + } + custom_tooltip = fabricate_hook_i_may_not_fabricate_again +} + +fabricate_hook_discovery_effect = { + show_as_tooltip = { # Target dislikes you + custom_tooltip = fabricate_hook_i_may_not_fabricate_again + scope:target = { + add_opinion = { + target = scope:owner + modifier = fabricated_hook_against_court_opinion + years = 5 + } + } + if = { + limit = { + exists = scope:target.court_owner + scope:target != scope:target.court_owner + } + scope:target.court_owner = { + add_opinion = { + target = scope:owner + modifier = fabricated_hook_against_court_opinion + years = 5 + } + } + } + } + + hidden_effect = { + # Set a blocker for Fabricating further Hooks against Court in question + if = { + limit = { + exists = scope:target.court_owner + } + scope:target.court_owner = { + send_interface_message = { + type = fabricate_hook_bad_message + left_icon = scope:owner + title = hostile_scheme_discovery.3002.t + + if = { + limit = { + scope:owner != scope:target.court_owner + } + fabricate_hook_block_scheme_owner_from_further_schemes_effect = yes + } + } + } + } + if = { + limit = { + OR = { + NOT = { exists = scope:target.court_owner } + scope:target.court_owner != scope:target + } + } + scope:target = { + add_opinion = { + target = scope:owner + modifier = fabricated_hook_against_court_opinion + years = 5 + } + } + } + } +} + +#Used in event options +fabricate_hook_success_effect = { + fabricate_hook_assign_appropriate_type_effect = { + TYPE = $TYPE$ # Sets the correct hook type to give + } + if = { + limit = { exists = scope:scheme_discovered } + fabricate_hook_discovery_effect = yes + } + if = { + limit = { exists = scope:scheme } + scope:scheme = { + end_scheme = yes + } + } +} + +fabricate_hook_decline_execution_effect = { + scope:scheme = { + add_scheme_modifier = { + type = fabricate_hook_building_influence_modifier + } + custom_tooltip = restart_scheme_tt + reset_failed_scheme_effect = yes + } +} + +fabricate_hook_success_notification_event_effect = { + custom_tooltip = fabricate_hook_hook_gained_on_you + if = { + limit = { + exists = scope:scheme_discovered + scope:target = scope:target.court_owner + } + fabricate_hook_block_scheme_owner_from_further_schemes_effect = yes + } +} + +################################################## +# Sway Scheme Effects + +sway_end_effect = { + if = { + limit = { + scope:target = { + NOT = { + has_opinion_modifier = { + target = scope:owner + modifier = scheme_sway_opinion + value >= sway_max_value # 100 by default + } + } + } + } + if = { + limit = { + exists = scope:scheme + } + scope:scheme = { + reset_failed_scheme_effect = yes + } + } + if = { + limit = { + exists = scope:scheme_successful + } + custom_tooltip = sway_continue + } + else = { + custom_tooltip = sway_try_again + } + + scope:owner = { # The AI never stops swaying unless we force it to, this makes them use a more even spread of schemes + if = { + limit = { + is_ai = yes + scope:target = { + NAND = { + is_vassal_of = scope:owner + is_a_faction_member = yes + opinion = { + target = scope:owner + value < 100 + } + } + } + } + if = { # Sway your realm priest for a long time + limit = { + scope:target = { + is_theocratic_lessee = yes + opinion = { + target = scope:owner + value <= 50 + } + } + } + random = { + chance = 10 + scope:scheme = { + end_scheme = yes + } + } + } + else_if = { + limit = { + scope:target = { + opinion = { + target = scope:owner + value < -25 + } + } + } + random = { + chance = 10 + scope:scheme = { + end_scheme = yes + } + } + } + else_if = { + limit = { + scope:target = { + opinion = { + target = scope:owner + value < 0 + } + } + } + random = { + chance = 30 + scope:scheme = { + end_scheme = yes + } + } + } + else_if = { + limit = { + scope:target = { + opinion = { + target = scope:owner + value < 35 + } + } + } + random = { + chance = 50 + scope:scheme = { + end_scheme = yes + } + } + } + else = { + scope:scheme = { + end_scheme = yes + } + } + } + } + } + else = { + #hidden_effect = { # What was this ever supposed to achieve? + # remove_opinion = { + # target = scope:owner + # modifier = scheme_sway_opinion + # } + # add_opinion = { + # target = scope:owner + # modifier = scheme_sway_opinion + # opinion = 100 + # } + #} + scope:owner = { + send_interface_toast = { + title = sway_complete + left_icon = scope:target + scope:scheme = { + end_scheme = yes + } + } + } + } +} + +sway_ongoing_1002_outcome_effect = { + if = { + limit = { + exists = scope:believer + has_relation_friend = scope:believer + } + show_as_tooltip = { theology_3021_a_success_effect = yes } + } + else = { + random_list = { + 1 = { + desc = diplomacy_majesty.0004.success.tt + show_chance = no + show_as_tooltip = { + scope:compliment_receiver = { + add_opinion = { + target = root + modifier = respect_opinion + opinion = 10 + } + } + } + } + 1 = { + desc = diplomacy_majesty.0004.failure.tt + show_chance = no + show_as_tooltip = { + scope:compliment_receiver = { + add_opinion = { + target = root + modifier = respect_opinion + opinion = -5 + } + } + } + } + } + } + + hidden_effect = { + if = { + limit = { + exists = scope:compliment_outcome + scope:compliment_outcome = flag:good + } + trigger_event = sway_ongoing.1003 + } + else_if = { #Is treated as a good outcome here + limit = { + exists = scope:compliment_outcome + scope:compliment_outcome = flag:neutral + } + trigger_event = sway_ongoing.1003 + } + else_if = { + limit = { + exists = scope:compliment_outcome + scope:compliment_outcome = flag:bad + } + trigger_event = sway_ongoing.1004 + } + } +} + +################################################## +# Court Scheme Effects + +court_success_prestige_effect = { + + if = { + limit = { court_love_is_shunned_or_criminal_trigger = no } #Only if it's not a taboo courtship + + #Whose tier matters? + if = { + limit = { + scope:target = { + is_ruler = no + exists = liege + OR = { + is_spouse_of = this.liege + is_close_or_extended_family_of = this.liege + } + } + } + scope:target = { liege = { save_scope_as = prestige_comparison } } + } + else = { + scope:target = { save_scope_as = prestige_comparison } + } + + #Epic + if = { + limit = { + #They are at least two levels above you or empire level + OR = { + tier_difference = { + target = scope:prestige_comparison + value <= -2 + } + scope:prestige_comparison.highest_held_title_tier = tier_empire + } + } + add_prestige = massive_prestige_gain + } + #Great + else_if = { + limit = { + OR = { + #They are one level above you or kingdom level + tier_difference = { + target = scope:prestige_comparison + value = -1 + } + scope:prestige_comparison.highest_held_title_tier = tier_kingdom + } + } + add_prestige = major_prestige_gain + } + #Good + else_if = { + limit = { + #They're your level or duchy level + OR = { + scope:prestige_comparison.highest_held_title_tier = this.highest_held_title_tier + scope:prestige_comparison.highest_held_title_tier = tier_duchy + } + } + add_prestige = medium_prestige_value + } + #Okay + else_if = { + limit = { + #They're at least county level + scope:prestige_comparison.highest_held_title_tier >= tier_county + } + add_prestige = minor_prestige_value + } + #Everything else (everyone targeting barons/unlanded) + else = { + add_prestige = miniscule_prestige_value + } + } +} + +court_ongoing_1010_good_duel_outcome_effect = { + add_prestige = medium_prestige_gain + scope:scheme = { + add_scheme_modifier = { + type = courting_act_of_heroism_modifier + } + } +} + +court_ongoing_fetch_gift_modifier_effect = { + #Wolf pelt + if = { + limit = { + scope:target = { has_character_flag = court_ongoing_wolf_pelt_flag } + has_royal_court = yes # Since these are court artifacts and serve no real purpose to those without a court + } + create_artifact_animal_hide_effect = { + OWNER = scope:target + HUNTER = scope:target + LEGENDARY = no + ANIMAL = flag:wolf + } + } + # Necklace + else_if = { + limit = { + scope:target = { has_character_flag = court_ongoing_necklace_flag } + } + create_artifact_necklace_effect = { + OWNER = scope:target + SMITH = scope:target + } + hidden_effect_new_object = { + scope:newly_created_artifact = { + flag_as_trash_artifact = yes + } + } + } + # Flower + else_if = { + limit = { + scope:target = { has_character_flag = court_ongoing_orchid_flag } + } + save_scope_value_as = { + name = flower_species + value = flag:flower_type_orchid + } + create_artifact_pressed_flower_effect = { OWNER = scope:target } + clear_saved_scope = flower_species + hidden_effect_new_object = { + scope:newly_created_artifact = { + flag_as_trash_artifact = yes + } + } + } + else = { + add_character_modifier = { + modifier = $GIFT$_modifier + years = 20 + } + } +} + +court_ongoing_fetch_gift_target_outcome_effect = { + hidden_effect = { + scope:target = { + if = { + limit = { is_ai = no } + } + save_temporary_scope_value_as = { + name = gift_outcome + value = flag:$OUTCOME$ + } + + if = { + limit = { + scope:gift_outcome = flag:success + } + send_interface_toast = { + title = court_ongoing.1021.$GIFT$.success + left_icon = scope:owner + court_ongoing_fetch_gift_modifier_effect = { GIFT = $GIFT$ } + } + } + else_if = { + limit = { + scope:gift_outcome = flag:failure + } + send_interface_toast = { + title = court_ongoing.1021.$GIFT$.failure + left_icon = scope:owner + } + } + #Flag clean up + remove_character_flag = court_ongoing_wolf_pelt_flag + remove_character_flag = court_ongoing_necklace_flag + remove_character_flag = court_ongoing_orchid_flag + } + } +} + +court_ongoing_1030_dog_modifier_effect = { + if = { + limit = { + NOT = { has_character_flag = had_dog_story } + } + start_dog_story_cycle_effect = yes + } +} + +court_ongoing_1030_cat_modifier_effect = { + if = { + limit = { + NOT = { has_character_flag = had_cat_story } + } + start_cat_story_cycle_effect = yes + } +} + +court_ongoing_1030_eagle_modifier_effect = { + if = { + limit = { + NOT = { has_character_flag = had_eagle_story } + } + save_scope_value_as = { + name = eagle_capture_method + value = flag:gift + } + start_eagle_story_cycle_effect = yes + } +} + +court_ongoing_1030_failure_effect = { + reverse_add_opinion = { + target = scope:target + modifier = disappointed_opinion + opinion = -10 + } +} + +court_ongoing_1100_outcome_effect = { + show_as_tooltip = { + random_list = { + 1 = { + desc = court_ongoing.1100.success.tt + show_chance = no + scope:scheme = { + add_scheme_modifier = { + type = courting_charm_modifier + } + } + } + 1 = { + desc = court_ongoing.1100.neutral.tt + show_chance = no + } + 1 = { + desc = court_ongoing.1100.failure.tt + show_chance = no + reverse_add_opinion = { + target = scope:target + modifier = insult_opinion + opinion = -10 + } + } + } + } + + hidden_effect = { + scope:target = { + trigger_event = { + id = court_ongoing.1101 + days = { 3 7 } + } + } + } +} + +court_consummate_effect = { + if = { + limit = { this = scope:owner } + + } + else = { + set_relation_soulmate = scope:owner + } +} + +court_kiss_effect = { + + hidden_effect = { + if = { + limit = { NOT = { has_relation_potential_lover = scope:target } } + set_relation_potential_lover = scope:target + } + } +} + +target_success_opinion_bonus_effect = { + reverse_add_opinion = { + target = scope:owner + modifier = love_opinion + opinion = 30 + } +} + +end_court_scheme_effect = { + save_temporary_scope_value_as = { + name = court_outcome + value = flag:$OUTCOME$ + } + + scope:owner = { + # SUCCESS: SOULMATES + # (This is the only one which target also needs to see, run it in owner scope in show_as_tooltip first and then execute in target's scope) + if = { + limit = { scope:court_outcome = flag:success_soulmate } + + scope:target = { set_relation_soulmate = { reason = $REASON$ target = prev } } + had_sex_with_effect = { #Run this in target scope because owner has own tooltip + CHARACTER = scope:target + PREGNANCY_CHANCE = pregnancy_chance + } + reverse_add_opinion = { + target = scope:target + modifier = romance_scheme_courtship_opinion #Blocks courtship + } + + #Maybe break of existing lover relationships + hidden_effect = { + scope:target = { + if = { + limit = { + has_trait = lustful + is_ai = yes + any_relation = { + type = lover + this != scope:owner + } + } + every_relation = { + type = lover + random = { + chance = 90 + opinion_modifier = { #Less likely if they really like the lover + who = scope:target + opinion_target = this + multiplier = -0.5 + min = -20 + } + modifier = { #More likely if they have more lovers + add = 10 + scope:target = { + any_relation = { + type = lover + count >= 2 + } + } + } + lover_breakup_effect = { + BREAKER = scope:target + LOVER = this + } + } + } + } + } + } + } + # SUCCESS: KISS + else_if = { + limit = { scope:court_outcome = flag:success_kiss } + custom_tooltip = court_outcome.kiss.tt + reverse_add_opinion = { + target = scope:target + modifier = romance_scheme_courtship_opinion #Blocks courtship + } + } + # FAILURE: SOFT + else_if = { + limit = { scope:court_outcome = flag:failure_soft } + #Shared effect with Seduce because failure in one scheme should block the other + scope:target = { seduction_cooldown_for_character_effect = { CHARACTER = scope:owner } } + } + # FAILURE: HARD + else_if = { + limit = { scope:court_outcome = flag:failure_hard } + #Shared effect with Seduce because failure in one scheme should block the other + scope:target = { seduction_block_character_effect = { CHARACTER = scope:owner } } + } + + # Tradition bonuses + if = { + limit = { + OR = { + scope:court_outcome = flag:success_soulmate + scope:court_outcome = flag:success_kiss + } + culture = { + has_cultural_parameter = romance_scheme_bonuses + } + exists = dynasty + } + dynasty = { + add_dynasty_prestige = minor_dynasty_prestige_gain + } + } + else_if = { + limit = { + OR = { + scope:court_outcome = flag:failure_soft + scope:court_outcome = flag:failure_hard + } + culture = { + has_cultural_parameter = romance_scheme_bonuses + } + } + add_stress = medium_stress_impact_gain + } + } + + scope:scheme = { end_scheme = yes } +} + +################################################## +# Steal Back Artefact Scheme Effects + +#Used in the immediate of the Scheme Owner's success event +steal_back_artifact_success_effect = { + scope:target = { + add_opinion = { + target = scope:owner + modifier = stole_artifact_from_me + } + # Feud score + scope:owner.house = { + change_house_relation_feud_score_effect = { + TARGET = scope:owner.house + REASON = stole_artifact + VALUE = house_feud_medium_counter_value + } + } + # Contracts + hidden_effect = { + if = { + limit = { + any_character_task_contract = { + task_contract_type = laamp_steal_artifact_contract + var:task_contract_target ?= scope:target + } + } + random_character_task_contract = { + task_contract_type = laamp_steal_artifact_contract + limit = { + var:task_contract_target ?= scope:target + } + complete_task_contract = success_standard + } + } + } + } +} + +steal_back_artifact_failure_effect = { + #Add Watchful Modifier to the target + scope:target = { + add_character_modifier = { + modifier = watchful_modifier + days = watchful_modifier_duration + } + add_opinion = { + target = scope:owner + modifier = attempted_to_steal_artifact_from_me + } + } +} + +################################################## +# Scheme Start Effects + +## Start a (non-contract) scheme with agents +# +# Arguments: +# SCHEME_TYPE - Type of scheme +# TARGET_TYPE - What type of thing to target (character or title) +# TARGET_SCOPE - Individual game object to target (character or title) +# AGENT_1..5 - Scheme agent slots for the scheme. +begin_scheme_with_agents_effect = { + save_scope_as = scheme_launcher + + # Flag that we _don't_ need more agents. + set_variable = { + name = agents_added + value = yes + days = 1 + } + + # Start the scheme. + start_scheme = { + type = $SCHEME_TYPE$ + $TARGET_TYPE$ = $TARGET_SCOPE$ + + save_scope_as = new_scheme + } + + # Assign agent slots et al. to the newly created scheme. + scope:new_scheme ?= { + # Add our starting agents. + add_agent_slot = $AGENT_1$ + add_agent_slot = $AGENT_2$ + add_agent_slot = $AGENT_3$ + add_agent_slot = $AGENT_4$ + add_agent_slot = $AGENT_5$ + + # Assign initial agents for non-player schemers. + if = { + limit = { + scope:scheme_launcher = { + is_ai = yes + } + } + auto_assign_scheme_agents = yes + } + + # If we have a custom charge threshold to complete, set that here. + ## Overthrow Regent. + if = { + limit = { scheme_type = overthrow_regent } + set_variable = { + name = custom_charge_threshold + value = 1 + } + } + # Set up our grace period. + set_variable = { + name = secrecy_grace_period + value = secrecy_grace_character_total_starting_value + } + } + + open_view = { + view = intrigue_window + player = scope:new_scheme.scheme_owner + } +} + +begin_contract_scheme_with_agents_effect = { + # Log our scheme launcher so that we can refer to them down the line. + save_scope_as = scheme_launcher + # Flag that we _don't_ need more agents. + set_variable = { + name = agents_added + value = yes + days = 1 + } + every_scheme = { add_to_list = current_schemes_list } + # check if you have to attach a contract to the scheme + # Now start the scheme. + start_scheme = { + type = $SCHEME_TYPE$ + $TARGET_TYPE$ = $TARGET_SCOPE$ + contract = $TASK_CONTRACT$ + } + # And grab the scheme's scope. + random_scheme = { + limit = { + NOT = { is_in_list = current_schemes_list } + } + save_scope_as = new_scheme + } + scope:new_scheme ?= { + # Add our starting agents. + add_agent_slot = $AGENT_1$ + add_agent_slot = $AGENT_2$ + add_agent_slot = $AGENT_3$ + add_agent_slot = $AGENT_4$ + add_agent_slot = $AGENT_5$ + # If we have a custom charge threshold to complete, set that here. + ## Overthrow Regent. + if = { + limit = { scheme_type = overthrow_regent } + set_variable = { + name = custom_charge_threshold + value = 1 + } + } + # Set up our grace period. + set_variable = { + name = secrecy_grace_period + value = secrecy_grace_character_total_starting_value + } + set_variable = { + name = attached_task_contract + value = $TASK_CONTRACT$ + } + } + $TASK_CONTRACT$ = { + set_variable = { + name = attached_scheme + value = scope:new_scheme + } + } + open_view = { + view = intrigue_window + player = scope:new_scheme.scheme_owner + } +} + +begin_scheme_basic_effect = { + # Log our scheme launcher so that we can refer to them down the line. + save_scope_as = scheme_launcher + # Log all the currently on-going schemes. + ## We do it this way being we can't guarantee mutually exclusive targets with non-character scheme targets any more: we can't just look for "X's murder scheme against Y", because X might be plotting against no target whatsoever and have multiple schemes of that type against nothing. + every_scheme = { add_to_list = current_schemes_list } + # Now start the scheme. + start_scheme = { + type = $SCHEME_TYPE$ + $TARGET_TYPE$ = $TARGET_SCOPE$ + } + # And grab the scheme's scope. + random_scheme = { + limit = { + NOT = { is_in_list = current_schemes_list } + } + save_scope_as = new_scheme + } + scope:new_scheme ?= { + # If we have a custom charge threshold to complete, set that here. + ## Sway. + if = { + limit = { scheme_type = sway } + set_variable = { + name = custom_charge_threshold + value = 5 + } + } + } +} + +add_scheme_starting_opportunities_intrigue_effect = { + if = { + limit = { scheme_owner.intrigue >= scheme_starting_opportunities_per_intrigue_threshold_value } + change_opportunities = { + value = scheme_owner.intrigue + subtract = scheme_starting_opportunities_per_intrigue_threshold_value + divide = scheme_starting_opportunities_per_intrigue_increment_value + ceiling = yes + max = 4 + } + } +} + +################################################## +# Scheme Pulse Action Effects + +# How many months should we wait before another pulse action can be queued? +scheme_pulse_action_sort_cooldown_effect = { + set_variable = { + name = scheme_pulse_action_on_cooldown + value = yes + months = 8 + } +} + +################################################## +# Countermeasure Effects + +inform_player_of_relevant_countermeasure_activated_effect = { + every_player = { + limit = { + any_scheme = { + scheme_target_character ?= root + has_variable = apply_countermeasures + } + } + send_interface_message = { + type = msg_countermeasure_change + title = countermeasures.t.target_changes + desc = countermeasures.desc.$COUNTERMEASURE$ + right_icon = root + } + } +} + +dispute_borders_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.8001 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +subsume_province_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.8011 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +raid_estate_opinion_effect = { + $TARGET$ = { save_temporary_scope_as = target_temp } + $OWNER$ = { save_temporary_scope_as = owner_temp } + scope:target_temp.house.house_head ?= { + # OPINION + add_opinion = { + target = scope:owner_temp + modifier = raided_estate_crime + } + # FEUD + if = { + limit = { has_relation_rival = scope:owner_temp } + if = { + limit = { valid_for_feud_events_with_target_trigger = { TARGET = scope:owner_temp } } + house_feud_start_effect = { + # Feuding House Head + ACTOR = scope:target_temp + # Target House Head + TARGET = scope:owner_temp + # Feud Reason + REASON = raid_estate + # House Member attacker if relevant + ATTACKER = scope:target_temp + # House Member victim if relevant + VICTIM = scope:owner_temp + } + } + } + # RELATION + progress_towards_rival_effect = { + REASON = rival_raid_estate + CHARACTER = scope:owner_temp + OPINION = 0 + } + } + # VICTIM OPINION + every_in_list = { + list = target_victims + if = { + limit = { exists = scope:scheme_maim } + add_opinion = { + target = scope:owner_temp + modifier = raid_estate_maimed_opinion + } + } + } + scope:target_temp.house = { + # HOUSE RELATION + change_house_relation_effect = { + HOUSE = scope:owner_temp.house + VALUE = house_relation_damage_major_value + REASON = raided_estate + CHAR = scope:owner_temp + TARGET_CHAR = scope:target_temp + TITLE = scope:dummy_gender + } + # OTHER MEMBER OPINION + every_house_member = { + custom = every_other_raid_estate_house_member_tt + limit = { + NOR = { + this = scope:target_temp + is_in_list = target_victims + } + } + add_opinion = { + target = scope:owner_temp + modifier = raid_estate_house_opinion + } + } + } + # CRIME + scope:owner_temp.top_liege ?= { + if = { + limit = { + this != scope:owner_temp + this != scope:target_temp + NOT = { scope:owner_temp.var:raid_estate_permission ?= scope:target_temp.house } + } + add_opinion = { + target = scope:owner_temp + modifier = raid_estate_vassal_crime + } + } + } +} + +education_5_scheme_progress_effect = { + if = { + limit = { + scope:actor = { has_trait = education_$SKILL$_5 } + } + scope:new_scheme ?= { + add_scheme_progress = { + value = scheme_progress_gain + multiply = 3 + } + } + } +} + +steal_herd_success_effect = { + if = { + limit = { + scope:target = { + exists = domicile + domicile.herd > 0 + } + } + scope:target = { + if = { + limit = { + scope:owner = { + OR = { + is_vassal_of = scope:target + is_liege_or_above_of = scope:target + } + } + } + add_opinion = { + target = scope:owner + modifier = stole_my_herd_crime + } + } + else = { + add_opinion = { + target = scope:owner + modifier = stole_my_herd + } + } + if = { + limit = { + is_independent_ruler = no + liege = { + NOT = { is_liege_or_above_of = scope:owner } + } + } + liege = { + add_opinion = { + target = scope:owner + modifier = stole_vassals_herd + } + } + } + custom_tooltip = { + text = steal_herd_vassal_tt + every_powerful_vassal = { + limit = { + NOR = { + this = scope:target + this = scope:owner + } + } + add_opinion = { + target = scope:owner + modifier = stole_lieges_herd + } + } + } + } + scope:owner = { + if = { + limit = { + scope:scheme = { exists = var:steal_herd_low } + } + if = { + limit = { + has_character_flag = steal_herd_extra + } + scope:target = { + pay_herd = { + target = scope:owner + value = { + value = domicile.ten_percent_current_herd_value + max = scope:owner.domicile.fifty_percent_current_herd_value + } + } + } + } + else = { + scope:target = { + pay_herd = { + target = scope:owner + value = { + value = domicile.five_percent_current_herd_value + max = scope:owner.domicile.fifty_percent_current_herd_value + } + } + } + } + } + else_if = { + limit = { + scope:scheme = { exists = var:steal_herd_normal } + } + if = { + limit = { + has_character_flag = steal_herd_extra + } + scope:target = { + pay_herd = { + target = scope:owner + value = { + value = domicile.fifteen_percent_current_herd_value + max = scope:owner.domicile.fifty_percent_current_herd_value + } + } + } + } + else = { + scope:target = { + pay_herd = { + target = scope:owner + value = { + value = domicile.ten_percent_current_herd_value + max = scope:owner.domicile.fifty_percent_current_herd_value + } + } + } + } + } + else_if = { + limit = { + scope:scheme = { exists = var:steal_herd_high } + } + if = { + limit = { + has_character_flag = steal_herd_extra + } + scope:target = { + pay_herd = { + target = scope:owner + value = { + value = domicile.twenty_percent_current_herd_value + max = scope:owner.domicile.fifty_percent_current_herd_value + } + } + } + } + else = { + scope:target = { + pay_herd = { + target = scope:owner + value = { + value = domicile.fifteen_percent_current_herd_value + max = scope:owner.domicile.fifty_percent_current_herd_value + } + } + } + } + } + } + } + + scope:owner = { + if = { + limit = { + has_character_flag = steal_herd_money + } + scope:target = { + pay_short_term_gold = { + target = scope:owner + gold = medium_gold_value + } + } + remove_character_flag = steal_herd_money + } + + if = { + limit = { + has_character_flag = steal_herd_extra + } + remove_character_flag = steal_herd_extra + } + } +} + +steal_herd_failure_effect = { + #Add Watchful Modifier to the target + scope:target = { + add_character_modifier = { + modifier = watchful_modifier + days = watchful_modifier_duration + } + + add_opinion = { + target = scope:owner + modifier = attempted_to_steal_herd_crime + } + } + #Lose some prestige + scope:owner = { + add_prestige = minor_prestige_loss + } +} + +purge_ai_scheme_slots_effect = { + scope:scheme = { + if = { + limit = { + any_scheme_agent_slot = { + is_filled = no + } + } + every_scheme_agent_slot = { + limit = { + is_filled = no + } + save_scope_as = slot_purge + prev = { remove_agent_slot = scope:slot_purge } + } + } + } +} + +coup_ceremonial_liege_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.2921 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} diff --git a/N3OW/common/scripted_effects/00_scripted_effects.txt b/N3OW/common/scripted_effects/00_scripted_effects.txt new file mode 100644 index 00000000..b1ed210e --- /dev/null +++ b/N3OW/common/scripted_effects/00_scripted_effects.txt @@ -0,0 +1,137 @@ + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! + +#save_var_scope_effect - To check for a variable saved scope and save it as a scope + +##################################################################### +# EFFECTS +##################################################################### + +#To check for a scope saved to a variable and save it as a scope +save_var_scope_effect = { + var:$VAR$ = { + save_scope_as = $VAR$ + } +} + +#To loan money from someone (Remember: you can only have one loan at a time!) +set_up_loan_effect = { + set_variable = { + name = loan_holder + value = $LENDER$ + } + set_variable = { + name = loan_amount_owed + value = $AMOUNT$ + } + $LENDER$ = { #To make the loan inheritable + set_variable = { + name = owes_me_money + value = root + } + hidden_effect = { + set_variable = { + name = loan_amount_lent + value = prev.var:loan_amount_owed + } + if = { + limit = { exists = var:loan_amount_lent } + pay_short_term_gold = { + target = root + gold = var:loan_amount_lent + } + remove_variable = loan_amount_lent + } + } + } +} + +disease_data_save_contraction_effect = { + if = { + limit = { + activate_disease_data_tracking_trigger = yes + has_variable = disease_data_activate_tracking + } + + change_variable = { + name = disease_data_character_$DISEASE$_amount + add = 1 + } + } +} + +#ARTIFACTS +add_character_artifact_claim_to_scope_effect = { + prev = { save_scope_as = artifact } + if = { + limit = { + NOT = { + $SCOPE$ = { has_personal_artifact_claim = scope:artifact } + } + } + $SCOPE$ = { add_personal_artifact_claim = prev } + } +} + +# For setting randomized event locales +get_random_location_effect = { + hidden_effect = { + random_list = { + 1 = { # Library + trigger = { + NOT = { government_has_flag = government_is_tribal } + } + set_variable = { + name = random_location + value = 0 + } + } + 1 = { # Garden + set_variable = { + name = random_location + value = 1 + } + } + 1 = { # Corridor + set_variable = { + name = random_location + value = 2 + } + } + 1 = { # Council Chamber + trigger = { + NOT = { government_has_flag = government_is_tribal } + } + set_variable = { + name = random_location + value = 3 + } + } + 1 = { # Throne Room + set_variable = { + name = random_location + value = 4 + } + } + 1 = { # War Camp + trigger = { is_in_army = yes } + set_variable = { + name = random_location + value = 5 + } + } + } + } +} + +# For setting or adding a character to the bought_truce_list +add_to_bought_truce_list = { + add_to_variable_list = { + name = bought_truce_list + target = $TARGET$ + days = $DAYS$ + } +} diff --git a/N3OW/common/scripted_effects/00_secret_effects.txt b/N3OW/common/scripted_effects/00_secret_effects.txt new file mode 100644 index 00000000..2a7285d9 --- /dev/null +++ b/N3OW/common/scripted_effects/00_secret_effects.txt @@ -0,0 +1,2417 @@ +#Scripted effects relating to secrets + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! + +#BLACKMAIL +#blackmail_target_with_secret_effect - adds a blackmail strong or weak blackmail hook for current scope against TARGET based on SECRET type, always use with "is_blackmailable_secret_trigger" + +#SECRET HANDLING +#give_incest_secret_or_nothing_effect - adds incest secret if incest is shunned in my or liege's faith +#give_incest_secret_or_nothing_with_target_effect - adds incest secret if relation with target is incest in my or liege's faith +#give_witch_secret_or_trait_effect - trait if accepted, secret if not +#give_deviant_secret_or_trait_effect - trait if accepted, secret if not +#give_cannibal_secret_or_trait_effect - trait if accepted, secret if not +#give_homosexual_secret_or_nothing_effect - nothing if accepted, secret if not +#give_homosexual_secret_or_nothing_with_target_effect - nothing if accepted, secret if relation with target is sodomy +#add_adulterer_trait_or_nothing_effect - adds trait is married and adultery is shunned/criminal, otherwise nothing +#add_fornicator_trait_or_nothing_effect - adds trait if unmarried and adultery is shunned/criminal, otherwise nothing +#add_adulterer_fornicator_trait_or_nothing_effect - add fornicator/adulterer trait if shunned/criminal, otherwise nothing +#add_kinslayer_trait_or_nothing_effect - adds kinslayer_1/2/3 trait or nothing (if kinslaying is accepted) + +#SECRET DISCOVERY +#reveal_to_without_events_effect - this effect should + +#SECRET EXPOSURE +#secret_exposed_notification_effect - sends events and feed messages +#remove_piety_level_for_shunned_or_criminal_trait_effect - removes a piety level if the trait is shunned/criminal +#secret_exposed_owner_effects_effect - applies traits etc. when a secret is revaled +#secret_exposed_notification_effects_effect - shows a tooltip for adding traits etc. when a secret is revealed +#secret_exposed_effects_effect - applies the correct effect for + +# LOVER SECRETS: INFIDELITY CONFRONTATION +# start_infidelity_confrontation_story_discovery_effect - Creates a story about confrontations/choices after discovered infidelity (lover secret discovery) +# start_infidelity_confrontation_story_exposure_effect - Creates a story about confrontations/choices after discovered infidelity (lover secret exposure) +# infidelity_confrontation_story_add_to_list_effect - Support effect for building lists in "start_infidelity_confrontation_story_exposure_effect" +# infidelity_confrontation_story_creation_effect - Support for "start_infidelity_confrontation_story_exposure/discovery_effect" for creating the story + +# MISC +#give_random_secret_effect - for testing +#give_random_likely_secret_effect + + + + +###################################################################### +# EFFECTS +###################################################################### + + +####BLACKMAIL#### + +#adds a blackmail strong or weak blackmail hook for current scope against TARGET based on SECRET type +#Always use with is_blackmailable_secret_trigger +blackmail_target_with_secret_effect = { + if = { + limit = { + $SECRET$ = { is_criminal_for = $TARGET$ } + can_add_hook = { + target = $TARGET$ + type = strong_blackmail_hook + } + } + add_hook = { + target = $TARGET$ + type = strong_blackmail_hook + secret = $SECRET$ + } + } + else_if = { + limit = { + $SECRET$ = { is_shunned_for = $TARGET$ } + can_add_hook = { + target = $TARGET$ + type = weak_blackmail_hook + } + } + add_hook = { + target = $TARGET$ + type = weak_blackmail_hook + secret = $SECRET$ + } + } +} + + +###SECRET HANDLING### + + +give_incest_secret_or_nothing_effect = { + save_temporary_scope_as = incest_character + if = { + limit = { + NOR = { + has_trait = incestuous + any_secret = { type = secret_incest } + } + is_adult = yes + trait_is_shunned_or_criminal_in_my_or_lieges_faith_trigger = { TRAIT = incestuous GENDER_CHARACTER = scope:incest_character } + } + add_secret = { + type = secret_incest + } + } +} + +give_incest_secret_or_nothing_with_target_effect = { #Should only add secret to one character! + if = { + limit = { relation_with_character_is_incestuous_in_my_or_lieges_faith_trigger = { CHARACTER = $CHARACTER$ } } + give_incest_secret_or_nothing_effect = yes #Checks my and liege's faith + } +} + + +give_witch_secret_or_trait_effect = { + save_temporary_scope_as = witch_character + if = { + limit = { #Not already a witch + NOR = { + has_trait = witch + any_secret = { type = secret_witch } + } + } + if = { + limit = { + trait_is_shunned_or_criminal_in_my_or_lieges_faith_trigger = { TRAIT = witch GENDER_CHARACTER = scope:witch_character } + } + add_secret = { + type = secret_witch + } + random_secret = { + type = secret_witch + save_scope_as = witch_secret + } + # If you have a legend maybe we change it? + if = { + limit = { + has_legend_chapter_trigger = { CHAPTER = opening } + } + random = { + chance = 10 + send_interface_toast = { + title = legend_chapter_change_toast + left_icon = root + promoted_legend = { + set_legend_chapter = { + name = opening + localization_key = legend_chapter_opening_witch + } + } + } + } + } + } + else = { + add_trait = witch + # If you have a legend maybe we change it? + if = { + limit = { + has_legend_chapter_trigger = { CHAPTER = opening } + } + random = { + chance = 10 + send_interface_toast = { + title = legend_chapter_change_toast + left_icon = root + promoted_legend = { + set_legend_chapter = { + name = opening + localization_key = legend_chapter_opening_witch + } + } + } + } + } + } + } +} + +remove_witch_secret_or_trait_effect = { + save_temporary_scope_as = witch_character + if = { + limit = { #Is already a witch + OR = { + has_trait = witch + any_secret = { type = secret_witch } + } + } + if = { + limit = { + has_trait = witch + } + remove_trait = witch + } + else = { + random_secret = { + type = secret_witch + remove_secret = yes + } + } + } +} + +give_deviant_secret_or_trait_effect = { + save_temporary_scope_as = deviant_character + if = { + limit = { #Not already a deviant + is_adult = yes + NOR = { + has_trait = deviant + any_secret = { type = secret_deviant } + } + } + if = { + limit = { + trait_is_shunned_or_criminal_in_my_or_lieges_faith_trigger = { TRAIT = deviant GENDER_CHARACTER = scope:deviant_character } + } + add_secret = { + type = secret_deviant + } + } + else_if = { + limit = { + is_adult = yes + } + add_trait = deviant + } + } +} + +give_cannibal_secret_or_trait_effect = { + save_temporary_scope_as = cannibal_character + if = { + limit = { #Not already a cannibal + NOR = { + has_trait = cannibal + any_secret = { type = secret_cannibal } + } + } + if = { + limit = { + trait_is_shunned_or_criminal_in_my_or_lieges_faith_trigger = { TRAIT = cannibal GENDER_CHARACTER = scope:cannibal_character } + } + add_secret = { + type = secret_cannibal + } + } + else = { + add_trait = cannibal + } + } +} + +remove_cannibal_secret_or_trait_effect = { + save_temporary_scope_as = cannibal_character + if = { + limit = { #Is already a cannibal + OR = { + has_trait = cannibal + any_secret = { type = secret_cannibal } + } + } + if = { + limit = { + has_trait = cannibal + } + remove_trait = cannibal + } + else = { + random_secret = { + type = secret_cannibal + remove_secret = yes + } + } + } +} + +give_homosexual_secret_or_nothing_effect = { + save_temporary_scope_as = homosexual_character + if = { + limit = { #Not already a known/secret sodomite and can become one + is_adult = yes + NOR = { + has_trait = sodomite + any_secret = { type = secret_homosexual } + } + is_male = yes + trait_is_shunned_or_criminal_in_my_or_lieges_faith_trigger = { TRAIT = sodomite GENDER_CHARACTER = scope:homosexual_character } + } + add_secret = { + type = secret_homosexual + } + } +} + +give_homosexual_secret_or_nothing_with_target_effect = { #Should only add secret to one character! + if = { + limit = { + is_adult = yes + is_male = yes + $CHARACTER$ = { + is_adult = yes + is_male = yes + } + } + give_homosexual_secret_or_nothing_effect = yes #Checks my and liege's faith + } +} + +give_non_believer_secret_effect = { + add_secret = { + type = secret_non_believer + } +} + +add_adulterer_trait_or_nothing_effect = { + save_scope_as = adulterer_check + if = { + limit = { + is_married = yes + trait_is_shunned_or_criminal_in_my_or_lieges_faith_trigger = { TRAIT = adulterer GENDER_CHARACTER = scope:adulterer_check } + } + add_trait_force_tooltip = adulterer + } +} + +add_fornicator_trait_or_nothing_effect = { + save_scope_as = fornicator_check + if = { + limit = { + is_adult = yes + is_married = no + trait_is_shunned_or_criminal_in_my_or_lieges_faith_trigger = { TRAIT = fornicator GENDER_CHARACTER = scope:fornicator_check } + } + add_trait_force_tooltip = fornicator + } +} + +add_adulterer_fornicator_trait_or_nothing_effect = { + if = { + limit = { is_married = yes } + add_adulterer_trait_or_nothing_effect = yes + } + else_if = { + limit = { + is_adult = yes + } + add_fornicator_trait_or_nothing_effect = yes + } +} + +add_kinslayer_trait_or_nothing_effect = { + save_scope_as = slayer + if = { + limit = { + murdering_character_is_kinslaying_in_my_or_same_dynasty_lieges_faith_trigger = { CHARACTER = $VICTIM$ } + } + if = { + limit = { + is_close_family_of = $VICTIM$ + } + if = { + limit = { this = scope:slayer } + set_trait_rank = { + trait = kinslayer + rank = 3 + } + remove_piety_level_for_shunned_or_criminal_trait_effect = { TRAIT = kinslayer_3 } + } + else = { + add_trait_force_tooltip = kinslayer_3 #This is to make sure trait appears in notification messages for other characters + } + } + else_if = { + limit = { + is_extended_family_of = $VICTIM$ + } + if = { + limit = { this = scope:slayer } + set_trait_rank = { + trait = kinslayer + rank = 2 + } + remove_piety_level_for_shunned_or_criminal_trait_effect = { TRAIT = kinslayer_2 } + } + else = { + add_trait_force_tooltip = kinslayer_2 #This is to make sure trait appears in notification messages for other characters + } + } + else_if = { + limit = { + dynasty ?= $VICTIM$.dynasty + } + if = { + limit = { this = scope:slayer } + set_trait_rank = { + trait = kinslayer + rank = 1 + } + remove_piety_level_for_shunned_or_criminal_trait_effect = { TRAIT = kinslayer_1 } + } + else = { + add_trait_force_tooltip = kinslayer_1 #This is to make sure trait appears in notification messages for other characters + } + } + } +} + +give_or_update_embezzler_secret_effect = { + # Either try to add a new embezzler secret. + if = { + limit = { + NOT = { + any_secret = { + type = secret_embezzler + secret_target = $TARGET$ + } + } + } + add_secret = { + type = secret_embezzler + target = $TARGET$ + } + random_secret = { + type = secret_embezzler + limit = { + secret_target = $TARGET$ + } + set_variable = { + name = embezzlement_stake + value = $STAKE$ + } + set_variable = { + name = embezzlement_stake_half + value = { + value = $STAKE$ + multiply = 0.5 + } + } + } + } + # Or else increment the existing one. + else = { + random_secret = { + type = secret_embezzler + limit = { + secret_target = $TARGET$ + has_variable = embezzlement_stake + } + change_variable = { + name = embezzlement_stake + add = $STAKE$ + } + change_variable = { + name = embezzlement_stake_half + add = { + value = $STAKE$ + multiply = 0.5 + } + } + } + } +} + +forgive_exposed_embezzler_effect = { + # Let 'em know they're off the hook. + scope:embezzler = { + # Very kind of you, old chap. + add_opinion = { + target = root + modifier = grateful_opinion + opinion = $OPINION$ + } + send_interface_toast = { + title = secrets.0122.c.tt + left_icon = root + root = { + if = { + limit = { + scope:secret = { + secret_type = secret_embezzler + } + } + remove_opinion = { + target = scope:embezzler + modifier = embezzled_opinion + } + } + else = { + remove_opinion = { + target = scope:embezzler + modifier = siphoned_treasury_crime + } + } + } + } + } +} + +give_coup_plotter_secret_effect = { + if = { + limit = { + NOT = { + any_secret = { + type = secret_coup_plotter + secret_target = $TARGET$ + } + } + } + add_secret = { + type = secret_coup_plotter + target = $TARGET$ + } + random_secret = { + type = secret_coup_plotter + limit = { + secret_target = $TARGET$ + } + } + } +} + + +###SECRET DISCOVERY### + +reveal_to_without_events_effect = { + if = { + limit = { secret_type = secret_disputed_heritage } + $CHARACTER$ = { + add_character_flag = { + flag = block_secret_disputed_heritage_discovery_event + days = 20 + } + } + } + else_if = { + limit = { secret_type = secret_unmarried_illegitimate_child } + $CHARACTER$ = { + add_character_flag = { + flag = block_secret_unmarried_illegitimate_child_discovery_event + days = 20 + } + } + } + else_if = { + limit = { secret_type = secret_murder_attempt } + $CHARACTER$ = { + add_character_flag = { + flag = block_secret_murder_attempt_discovery_event + days = 20 + } + } + } + else_if = { + limit = { secret_type = secret_murder } + $CHARACTER$ = { + add_character_flag = { + flag = block_secret_murder_discovery_event + days = 20 + } + } + } + else_if = { + limit = { secret_type = secret_lover } + #Cannot block because the event is mechanical. + #You can reveal a lover secret and add a variable to it to get special texts. Check out the story_cycle_infidelty_confronter + } + reveal_to = $CHARACTER$ +} + +###SECRET EXPOSURE EFFECTS### + +#Support effect for secret_exposed_notification_effect +save_list_targets_for_secret_exposure_events_effect = { + every_spouse = { + limit = { + show_me_exposed_secret_event_trigger = { SECRET = $SECRET$ CHARACTER = $CHARACTER$ } + } + add_to_list = send_exposed_secret_event_list + } + every_close_family_member = { + limit = { + show_me_exposed_secret_event_trigger = { SECRET = $SECRET$ CHARACTER = $CHARACTER$ } + NOT = { + any_in_list = { #These checks should remain here and not be in the scripted triggers + list = send_exposed_secret_event_list + this = prev + } + } + } + add_to_list = send_exposed_secret_event_list + } + if = { + limit = { + is_playable_character = yes # Do not send this event about mere courtiers; they're not important enough. + exists = liege + } + liege = { + if = { + limit = { + show_me_exposed_secret_event_trigger = { SECRET = $SECRET$ CHARACTER = $CHARACTER$ } + #Don't inform liege when exposed_secret_character is murder victim + NAND = { + $SECRET$ = { + OR = { + secret_type = secret_murder + secret_type = secret_murder_attempt + } + } + scope:victim = { this = $CHARACTER$ } + } + NOT = { + any_in_list = { + list = send_exposed_secret_event_list + this = prev + } + } + } + add_to_list = send_exposed_secret_event_list + } + } + } + every_heir_title = { + limit = { exists = holder } + holder = { + if = { + limit = { + show_me_exposed_secret_event_trigger = { SECRET = $SECRET$ CHARACTER = $CHARACTER$ } + NOT = { + any_in_list = { + list = send_exposed_secret_event_list + this = prev + } + } + } + add_to_list = send_exposed_secret_event_list + } + } + } +} + +save_extra_lover_list_targets_for_secret_exposure_events_effect = { + scope:target = { + if = { + limit = { + any_secret = { + type = secret_lover + secret_target = scope:owner + } + } + save_temporary_scope_as = secret_character + #Save spouses, close family members, liege and anyone they are primary heir of + random_secret = { + type = secret_lover + limit = { + secret_target = scope:owner + } + save_scope_as = targets_secret + } + save_list_targets_for_secret_exposure_events_effect = { SECRET = scope:targets_secret CHARACTER = scope:secret_character } + } + } +} + +save_extra_bastard_list_targets_for_secret_exposure_events_effect = { + #Those who care about child + if = { + limit = { + exists = scope:child + scope:owner != scope:child #Child hasn't inherited the secret + } + scope:target = { + save_temporary_scope_as = secret_character + save_list_targets_for_secret_exposure_events_effect = { SECRET = scope:secret CHARACTER = scope:secret_character } + } + } + #Those who care about real father + if = { + limit = { + exists = scope:real_father + scope:owner != scope:real_father #Real_father hasn't inherited the secret + } + scope:real_father = { + save_temporary_scope_as = secret_character + save_list_targets_for_secret_exposure_events_effect = { SECRET = scope:secret CHARACTER = scope:secret_character } + } + } + #Those who care about mother + if = { + limit = { + exists = scope:mother + scope:owner != scope:mother #Mother doesn't have secret anymore (dead) + } + scope:mother = { + save_temporary_scope_as = secret_character + save_list_targets_for_secret_exposure_events_effect = { SECRET = scope:secret CHARACTER = scope:secret_character } + } + } + #Make sure father is in there + if = { + limit = { + exists = scope:father + scope:father = { show_me_exposed_secret_event_trigger = { SECRET = scope:secret CHARACTER = scope:secret_character } } + } + scope:father = { add_to_list = send_exposed_secret_event_list } + } +} + +#Support effect for secret_exposed_notification_effect +save_list_targets_for_secret_exposure_feed_messages_effect = { + $SECRET$ = { + every_secret_knower = { + limit = { + show_me_exposed_secret_feed_message_trigger = { SECRET = $SECRET$ CHARACTER = $CHARACTER$ } + NOR = { + any_in_list = { #These checks should remain here and not be in the scripted triggers + list = send_exposed_secret_event_list + this = prev + } + any_in_list = { + list = send_exposed_secret_feed_message_list + this = prev + } + } + } + add_to_list = send_exposed_secret_feed_message_list + } + } +} + +#Support effect for secret_exposed_notification_effect +save_additional_lover_secret_list_targets_for_feed_messages_effect = { + #If it's a sodomy lover relation, also tell people who know of my sodomy secret + if = { + limit = { relation_with_character_is_sodomy_in_my_or_lieges_faith_trigger = { CHARACTER = scope:other_lover } } + random_secret = { + type = secret_homosexual + every_secret_knower = { + limit = { + show_me_exposed_secret_feed_message_trigger = { SECRET = scope:secret CHARACTER = scope:owner } + NOR = { + any_in_list = { #These checks should remain here and not be in the scripted triggers + list = send_exposed_secret_event_list + this = prev + } + any_in_list = { + list = send_exposed_secret_feed_message_list + this = prev + } + } + } + add_to_list = send_exposed_secret_feed_message_list + } + } + } + #If it's a incest lover relation, also tell people who know of my incest secret + if = { + limit = { relation_with_character_is_incestuous_in_my_or_lieges_faith_trigger = { CHARACTER = scope:other_lover } } + random_secret = { + type = secret_incest + every_secret_knower = { + limit = { + show_me_exposed_secret_feed_message_trigger = { SECRET = scope:secret CHARACTER = scope:owner } + NOR = { + any_in_list = { #These checks should remain here and not be in the scripted triggers + list = send_exposed_secret_event_list + this = prev + } + any_in_list = { + list = send_exposed_secret_feed_message_list + this = prev + } + } + } + add_to_list = send_exposed_secret_feed_message_list + } + } + } +} + +#Used to notify everyone who cares about secret owner/target (and additional characters of interest) about secret + effects +secret_exposed_notification_effect = { + save_scope_as = secret + secret_owner = { + save_scope_as = owner + } + if = { + limit = { exists = secret_target } + secret_target = { save_scope_as = target } + } + + + #### Visible events for those who care and knower of landed people's secrets ### + + #Save spouses, close family members, liege and anyone whom I am primary heir of + scope:owner = { + save_list_targets_for_secret_exposure_events_effect = { SECRET = scope:secret CHARACTER = scope:owner } + } + + #If it's a lover secret, tell people who cares about the target as well + if = { + limit = { scope:secret = { secret_type = secret_lover } } + save_extra_lover_list_targets_for_secret_exposure_events_effect = yes + } + + #If it's a bastard secret, tell people who cares about child/real_father as well + else_if = { + limit = { + scope:secret = { + OR = { + secret_type = secret_disputed_heritage + secret_type = secret_unmarried_illegitimate_child + } + } + } + save_extra_bastard_list_targets_for_secret_exposure_events_effect = yes + } + + #If it's a murder/murder attempt secret, also inform those who care about victim + else_if = { + limit = { + scope:secret = { + OR = { + secret_type = secret_murder_attempt + secret_type = secret_murder + } + } + } + + scope:victim = { save_list_targets_for_secret_exposure_events_effect = { SECRET = scope:secret CHARACTER = scope:victim } } + } + + #If it's a secret faith, save the faith + else_if = { + limit = { + scope:secret = { secret_type = secret_crypto_religionist } + } + scope:owner.secret_faith = { save_scope_as = crypto_faith } + } + + #Send the notification event + every_in_list = { + list = send_exposed_secret_event_list + + if = { + limit = { + scope:secret = { secret_type = secret_incest } + } + trigger_event = secrets.0106 + } + else_if = { + limit = { + scope:secret = { secret_type = secret_witch } + } + trigger_event = secrets.0107 + } + else_if = { + limit = { + scope:secret = { + OR = { + secret_type = secret_embezzler + secret_type = secret_siphoned_treasury + } + } + } + trigger_event = secrets.0122 + } + else_if = { + limit = { + scope:secret = { secret_type = secret_cannibal } + } + trigger_event = secrets.0104 + } + else_if = { + limit = { + scope:secret = { secret_type = secret_non_believer } + } + trigger_event = secrets.0105 + } + else_if = { + limit = { + scope:secret = { secret_type = secret_homosexual } + } + trigger_event = secrets.0103 + } + else_if = { + limit = { + scope:secret = { secret_type = secret_lover } + } + trigger_event = secrets.0108 + } + else_if = { + limit = { + scope:secret = { secret_type = secret_deviant } + } + trigger_event = secrets.0101 + } + else_if = { + limit = { + scope:secret = { secret_type = secret_disputed_heritage } + } + trigger_event = secrets.0110 + } + else_if = { + limit = { + scope:secret = { secret_type = secret_unmarried_illegitimate_child } + } + trigger_event = secrets.0112 + } + else_if = { + limit = { + scope:secret = { secret_type = secret_murder_attempt } + } + trigger_event = secrets.0116 + } + else_if = { + limit = { + scope:secret = { secret_type = secret_murder } + } + if = { + limit = { + scope:secret = { has_variable = known_murder } + } + add_death_event_blocker_effect = { DEAD = scope:victim } + } + trigger_event = secrets.0118 + } + else = { + add_to_list = send_exposed_secret_feed_message_list + } + } + + ### Sending feed messages to other characters who care ### + scope:owner = { + #Save secret knowers and extended family members for feed messages + save_list_targets_for_secret_exposure_feed_messages_effect = { SECRET = scope:secret CHARACTER = scope:owner } + } + + #Extra stuff for lover secrets + if = { + limit = { scope:secret = { secret_type = secret_lover } } + secret_owner = { + #Also send feed messages who know about my sodomy/incest secret if relation is homosexual/incestuous + scope:target = { save_temporary_scope_as = other_lover } + save_additional_lover_secret_list_targets_for_feed_messages_effect = yes + } + + #Feed messages for my lover secret target + scope:target = { + if = { + limit = { + exists = scope:targets_secret + } + #Save secret knowers and extended family members for feed messages + save_list_targets_for_secret_exposure_feed_messages_effect = { SECRET = scope:targets_secret CHARACTER = scope:target } + } + + #Also send feed messages who know about target's sodomy/incest secret if relation is homosexual/incestuous + scope:target = { save_temporary_scope_as = other_lover } + save_additional_lover_secret_list_targets_for_feed_messages_effect = yes + } + } + + every_in_list = { + list = send_exposed_secret_feed_message_list + save_scope_as = secret_expose_feed_message_scope + + send_interface_message = { + type = secret_exposed_message + left_icon = scope:owner + right_icon = scope:target + title = secret_exposed_notification_effect_message + desc = { + first_valid = { + triggered_desc = { + trigger = { scope:secret = { secret_type = secret_incest } } + desc = secret_exposed_notification_effect_message_incest + } + triggered_desc = { + trigger = { scope:secret = { secret_type = secret_witch } } + desc = secret_exposed_notification_effect_message_witch + } + triggered_desc = { + trigger = { scope:secret = { secret_type = secret_cannibal } } + desc = secret_exposed_notification_effect_message_cannibal + } + triggered_desc = { + trigger = { scope:secret = { secret_type = secret_non_believer } } + desc = secret_exposed_notification_effect_message_non_believer + } + triggered_desc = { + trigger = { scope:secret = { secret_type = secret_homosexual } } + desc = secret_exposed_notification_effect_message_homosexual + } + triggered_desc = { + trigger = { #Incest lover + scope:secret = { secret_type = secret_lover } + scope:owner = { relation_with_character_is_incestuous_in_faith_trigger = { CHARACTER = scope:target FAITH = scope:secret_expose_feed_message_scope.faith } } + } + desc = secret_exposed_notification_effect_message_lover_incest + } + triggered_desc = { + trigger = { #Sodomy lover + scope:secret = { secret_type = secret_lover } + scope:owner = { relation_with_character_is_sodomy_in_faith_trigger = { CHARACTER = scope:target FAITH = scope:secret_expose_feed_message_scope.faith } } + } + desc = secret_exposed_notification_effect_message_lover_sodomy + } + triggered_desc = { + trigger = { scope:secret = { secret_type = secret_lover } } + desc = secret_exposed_notification_effect_message_lover + } + triggered_desc = { + trigger = { scope:secret = { secret_type = secret_deviant } } + desc = secret_exposed_notification_effect_message_deviant + } + triggered_desc = { #Illegitimate child + trigger = { + scope:secret = { + OR = { + secret_type = secret_disputed_heritage + secret_type = secret_unmarried_illegitimate_child + } + } + } + desc = secret_exposed_notification_effect_message_illegitimate_child + } + triggered_desc = { + trigger = { scope:secret = { secret_type = secret_murder_attempt } } + desc = secret_exposed_notification_effect_message_murder_attempt + } + triggered_desc = { + trigger = { + scope:secret = { secret_type = secret_murder } + scope:owner != scope:secret_exposer + } + desc = secret_exposed_notification_effect_message_murder + } + triggered_desc = { + trigger = { + scope:secret = { secret_type = secret_murder } + scope:owner = scope:secret_exposer + } + desc = secret_exposed_notification_effect_message_known_murder + } + triggered_desc = { + trigger = { + scope:secret = { secret_type = secret_crypto_religionist } + } + desc = secret_exposed_notification_effect_message_faith + } + } + } + + if = { + limit = { has_hook_from_secret = scope:secret } + if = { + limit = { + has_hook_of_type = { + target = scope:owner + type = weak_blackmail_hook + } + } + remove_hook = { + target = scope:owner + type = weak_blackmail_hook + } + } + else_if = { + limit = { + has_hook_of_type = { + target = scope:owner + type = strong_blackmail_hook + } + } + remove_hook = { + target = scope:owner + type = strong_blackmail_hook + } + } + } + } + } + + ### Send toast to exposer ### + if = { + limit = { + trigger_if = { + limit = { exists = scope:target } + NOR = { + scope:secret_exposer = scope:target + scope:secret_exposer = scope:owner + } + } + trigger_else = { + scope:secret_exposer != scope:owner + } + } + scope:secret_exposer = { + save_scope_as = secret_expose_feed_message_scope + send_interface_toast = { + left_icon = scope:owner + right_icon = scope:target + title = secret_exposed_notification_effect_message + + if = { + limit = { scope:secret = { secret_type = secret_incest } } + custom_tooltip = secret_exposed_notification_effect_message_incest.i_exposed + } + else_if = { + limit = { scope:secret = { secret_type = secret_witch } } + custom_tooltip = secret_exposed_notification_effect_message_witch.i_exposed + } + else_if = { + limit = { scope:secret = { secret_type = secret_cannibal } } + custom_tooltip = secret_exposed_notification_effect_message_cannibal.i_exposed + } + else_if = { + limit = { scope:secret = { secret_type = secret_non_believer } } + custom_tooltip = secret_exposed_notification_effect_message_non_believer.i_exposed + } + else_if = { + limit = { scope:secret = { secret_type = secret_homosexual } } + custom_tooltip = secret_exposed_notification_effect_message_homosexual.i_exposed + } + else_if = { + limit = { #Incest lover + scope:secret = { secret_type = secret_lover } + scope:owner = { relation_with_character_is_incestuous_in_faith_trigger = { CHARACTER = scope:target FAITH = scope:secret_expose_feed_message_scope.faith } } + } + custom_tooltip = secret_exposed_notification_effect_message_lover_incest.i_exposed + } + else_if = { + limit = { #Sodomy lover + scope:secret = { secret_type = secret_lover } + scope:owner = { relation_with_character_is_sodomy_in_faith_trigger = { CHARACTER = scope:target FAITH = scope:secret_expose_feed_message_scope.faith } } + } + custom_tooltip = secret_exposed_notification_effect_message_lover_sodomy.i_exposed + } + else_if = { + limit = { scope:secret = { secret_type = secret_lover } } + custom_tooltip = secret_exposed_notification_effect_message_lover.i_exposed + } + else_if = { + limit = { scope:secret = { secret_type = secret_deviant } } + custom_tooltip = secret_exposed_notification_effect_message_deviant.i_exposed + } + else_if = { + limit = { + scope:secret = { + OR = { + secret_type = secret_disputed_heritage + secret_type = secret_unmarried_illegitimate_child + } + } + } + custom_tooltip = secret_exposed_notification_effect_message_illegitimate_child.i_exposed + } + else_if = { + limit = { scope:secret = { secret_type = secret_murder_attempt } } + custom_tooltip = secret_exposed_notification_effect_message_murder_attempt.i_exposed + } + else_if = { + limit = { scope:secret = { secret_type = secret_murder } } + custom_tooltip = secret_exposed_notification_effect_message_murder.i_exposed + } + else_if = { + limit = { scope:secret = { secret_type = secret_crypto_religionist } } + custom_tooltip = secret_exposed_notification_effect_message_faith.i_exposed + } + + if = { + limit = { has_hook_from_secret = scope:secret } + remove_hook = { + target = scope:owner + type = weak_blackmail_hook + } + } + + if = { + limit = { + has_government = landless_adventurer_government + has_perk = court_of_shadows_perk + } + add_prestige = { + value = 100 + multiply = { + value = scope:owner.highest_held_title_tier + add = 1 + } + min = 50 + } + } + + stress_impact = { + honest = medium_stress_impact_loss + just = medium_stress_impact_loss + } + + scope:owner = { + stress_impact = { + honest = medium_stress_impact_loss + just = medium_stress_impact_loss + } + } + + # If we're a clan this interaction affects unity + add_clan_unity_interaction_effect = { + CHARACTER = scope:secret_expose_feed_message_scope + TARGET = scope:owner + VALUE = major_unity_loss + DESC = clan_unity_secret_exposure.desc + REVERSE_NON_HOUSE_TARGET = no + } + } + } + } +} + +remove_piety_level_for_shunned_or_criminal_trait_effect = { + save_temporary_scope_as = piety_character + if = { + limit = { + OR = { + trait_is_shunned_in_faith_trigger = { TRAIT = $TRAIT$ FAITH = scope:piety_character.faith GENDER_CHARACTER = scope:piety_character } + trait_is_criminal_in_faith_trigger = { TRAIT = $TRAIT$ FAITH = scope:piety_character.faith GENDER_CHARACTER = scope:piety_character } + } + } + add_piety_level = -1 + + # LEGITIMACY LOSS FROM CRIME EXPOSURE + if = { + limit = { + is_valid_for_legitimacy_change = yes + NOT = { exists = scope:suppress_legitimacy_from_crime } + } + if = { + limit = { + trait_is_shunned_in_faith_trigger = { TRAIT = $TRAIT$ FAITH = scope:piety_character.faith GENDER_CHARACTER = scope:piety_character } + } + add_legitimacy = minor_legitimacy_loss + } + else = { add_legitimacy = medium_legitimacy_loss } + # Flag that we might not always want to apply future legitimacy losses down the line. + save_scope_value_as = { + name = suppress_legitimacy_from_crime + value = yes + } + } + } +} + +#Purpose: to make sure trait always appears in tooltip for other characters informed about you gaining trait +add_trait_only_force_tooltip_if_not_pov_effect = { + if = { + limit = { this = $POV$ } + add_trait = $TRAIT$ + } + else = { + add_trait_force_tooltip = $TRAIT$ + } +} + +remove_trait_only_force_tooltip_if_not_root_effect = { + if = { + limit = { this = root } + remove_trait = $TRAIT$ + } + else = { + remove_trait_force_tooltip = $TRAIT$ + } +} + +#applies traits etc. when a secret is revealed +#SECRET = secret in question, POV = point of view i.e. who get this event +secret_exposed_owner_effects_effect = { + + $SECRET$ = { + if = { + limit = { #Checks to make sure the right target gets saved. Confusion might arise from the secret's "on_expose" effect since it sends the same event (secrets.0008) for both target and owner. + exists = secret_target + exists = scope:target + scope:target = secret_owner + NOT = { secret_owner = $POV$ } #To not mess up tooltips (in e.g. secrets.0108) + } + secret_owner = { save_scope_as = exposed_secret_target } + } + else_if = { + limit = { + exists = secret_target + } + secret_target = { save_scope_as = exposed_secret_target } + } + + secret_owner = { save_scope_as = local_secret_owner } + } + + ###DEVIANT### + if = { + limit = { $SECRET$ = { secret_type = secret_deviant } } + add_trait_only_force_tooltip_if_not_pov_effect = { TRAIT = deviant POV = $POV$ } + remove_piety_level_for_shunned_or_criminal_trait_effect = { TRAIT = deviant } + } + ###SODOMITE### + else_if = { + limit = { + $SECRET$ = { secret_type = secret_homosexual } + relation_with_character_is_sodomy_in_my_or_lieges_faith_trigger = { CHARACTER = this } #To check your own gender + } + add_trait_only_force_tooltip_if_not_pov_effect = { TRAIT = sodomite POV = $POV$ } + remove_piety_level_for_shunned_or_criminal_trait_effect = { TRAIT = sodomite } + } + ###CANNIBAL### + else_if = { + limit = { $SECRET$ = { secret_type = secret_cannibal } } + add_trait_only_force_tooltip_if_not_pov_effect = { TRAIT = cannibal POV = $POV$ } + remove_piety_level_for_shunned_or_criminal_trait_effect = { TRAIT = cannibal } + } + ###NON-BELIEVER### + else_if = { + limit = { $SECRET$ = { secret_type = secret_non_believer } } + add_character_modifier = { + modifier = known_non_believer + days = 3650 + } + if = { + limit = { + OR = { + has_trait = zealous + has_character_flag = non_believer_lost_zealous + } + } + remove_trait_only_force_tooltip_if_not_root_effect = { TRAIT = zealous } + add_character_flag = { + flag = non_believer_lost_zealous + days = 5 + } + } + if = { + limit = { + OR = { + number_of_personality_traits < personality_trait_limit + has_character_flag = non_believer_gained_cynical + } + } + add_trait_only_force_tooltip_if_not_pov_effect = { TRAIT = cynical POV = $POV$ } + add_character_flag = { + flag = non_believer_gained_cynical + days = 5 + } + } + add_piety_level = -1 + } + ###EMBEZZLER### + else_if = { + limit = { + $SECRET$ = { secret_type = secret_embezzler } + scope:secret_target = { is_alive = yes } + } + scope:secret_target = { + # Apply appropriate criminal opinion. + add_opinion = { + target = scope:secret_owner + modifier = embezzled_opinion + } + } + } + else_if = { + limit = { + $SECRET$ = { secret_type = secret_siphoned_treasury } + scope:secret_target = { is_alive = yes } + } + scope:secret_target = { + add_opinion = { + target = scope:owner + modifier = siphoned_treasury_crime + } + } + } + ###INCEST### + else_if = { + limit = { $SECRET$ = { secret_type = secret_incest } } + add_trait_only_force_tooltip_if_not_pov_effect = { TRAIT = incestuous POV = $POV$ } + remove_piety_level_for_shunned_or_criminal_trait_effect = { TRAIT = incestuous } + } + ###WITCH### + else_if = { + limit = { $SECRET$ = { secret_type = secret_witch } } + add_trait_only_force_tooltip_if_not_pov_effect = { TRAIT = witch POV = $POV$ } + remove_piety_level_for_shunned_or_criminal_trait_effect = { TRAIT = witch } + } + ###LOVER### + else_if = { + limit = { + $SECRET$ = { secret_type = secret_lover } + NOT = { + scope:exposed_secret_target = { + government_has_flag = government_is_mandala + house ?= { has_house_power_parameter = aspect_of_creation } + } + } + } + + #Adds traits (adulterer, fornicator, sodomite, incestuous), removes devotion, sets opinions & rivalry + extramarital_sex_exposure_consequences_with_target_effect = { TARGET = scope:exposed_secret_target SPOUSE_EVENT = no } + } + ###DISPUTED HERITAGE### + else_if = { + limit = { + $SECRET$ = { + secret_type = secret_disputed_heritage + } + } + + # Child gains the Disputed Heritage trait + scope:child = { add_trait = disputed_heritage } + + # Biological parents, if alive, suffer penalties from adultery. + if = { + limit = { scope:mother = { is_alive = yes } } + scope:mother = { + # Comprehensive effect which adds adulter/fornicator/incestuous traits, unfaithfulness & slept with wife opinions, and characters losing the appropriate number of piety level(s). + expose_lover_secret_or_run_consequence_effect = { + TARGET = scope:real_father + EXPOSER = $POV$ + } + } + } + else_if = { limit = { scope:real_father = { is_alive = yes } } + # If the mother is dead, run this on the real_father instead (so it gets run somewhere). If the mother is alive, the real_father will have already suffered the penalties. + scope:real_father = { + expose_lover_secret_or_run_consequence_effect = { + TARGET = scope:mother + EXPOSER = $POV$ + } + } + } + + # Additional father opinion modifiers + hidden_effect = { + # Real father gains opinion of child + if = { + limit = { + scope:real_father = { is_alive = yes } + } + scope:real_father = { + add_opinion = { + target = scope:child + modifier = truly_of_my_blood_opinion + } + } + } + + #Non-real father loses opinion of child + if = { + limit = { + exists = scope:father + scope:father = { + is_alive = yes + } + } + scope:father = { + add_opinion = { + target = scope:child + modifier = uncertain_lineage_opinion + } + } + } + } + } + ###UNKNOWN FATHER### + else_if = { + limit = { + $SECRET$ = { + secret_type = secret_unmarried_illegitimate_child + } + } + # Set the correct Father for the child + scope:child = { + set_father = scope:real_father + set_parent_house_effect = yes + remove_inherited_descendent_traits_effect = yes + } + + #Father becomes adulterer/fornicator (mother already suffered these penalties when she was discovered pregnant out of wedlock) + scope:real_father = { + if = { + limit = { is_alive = yes } + + #Adds adulter/fornicator/incestuous traits, unfaithfulness & slept with wife opinions, removes piety levels + expose_lover_secret_or_run_consequence_effect = { + TARGET = scope:mother + EXPOSER = $POV$ + } + } + } + } + + ###ATTEMPTED MURDERER### + else_if = { + limit = { $SECRET$ = { secret_type = secret_murder_attempt } } + + #Hide this for everyone else + if = { + limit = { root = scope:murderer } + add_dread = 10 + hostile_scheme_exposure_legitimacy_effect = yes + attempted_murder_opinion_effect = { VICTIM = scope:victim MURDERER = scope:murderer } + } + } + ###MURDERER### + else_if = { + limit = { $SECRET$ = { secret_type = secret_murder } } + + #Traits, (crime) opinions, dread + murder_consequences_known_or_exposed_effect = { + MURDERER = scope:murderer + VICTIM = scope:victim + POV = $POV$ + } + } + else_if = { + limit = { + $SECRET$ = { secret_type = secret_coup_plotter } + scope:secret_target = { is_alive = yes } + } + + scope:secret_target = { + # Apply appropriate criminal opinion. + add_opinion = { + target = scope:secret_owner + modifier = coup_plotter_opinion + } + } + } + + + ## Struggle Catalysts + if = { + limit = { + scope:local_secret_owner = { + is_semi_important_ruler_struggle_character = yes + any_character_struggle = { + involvement = involved + phase_has_catalyst = catalyst_reveal_secret_important + } + } + } + scope:local_secret_owner = { + every_character_struggle = { + involvement = involved + activate_struggle_catalyst = { + catalyst = catalyst_reveal_secret_important + character = scope:local_secret_owner + } + } + } + } + if = { + limit = { + scope:local_secret_owner = { + has_trait = fp3_struggle_supporter + any_character_struggle = { + involvement = involved + phase_has_catalyst = catalyst_reveal_secret_supporter + } + } + } + scope:local_secret_owner = { + every_character_struggle = { + involvement = involved + activate_struggle_catalyst = { + catalyst = catalyst_reveal_secret_supporter + character = scope:local_secret_owner + } + log_debug_variable_for_persian_struggle_effect = { VAR = unrest_catalyst_reveal_secret_supporter } + } + } + } + if = { + limit = { + scope:local_secret_owner = { + has_trait = fp3_struggle_detractor + any_character_struggle = { + involvement = involved + phase_has_catalyst = catalyst_reveal_secret_detractor + } + } + } + scope:local_secret_owner = { + every_character_struggle = { + involvement = involved + activate_struggle_catalyst = { + catalyst = catalyst_reveal_secret_detractor + character = scope:local_secret_owner + } + log_debug_variable_for_persian_struggle_effect = { VAR = stabil_catalyst_reveal_secret_detractor } + } + } + } +} + +secret_exposed_owner_opinion_effects_effect = { + if = { + limit = { + exists = scope:secret_exposer + this != scope:secret_exposer + scope:secret_exposer = { is_alive = yes } + } + add_opinion = { + target = scope:secret_exposer + modifier = exposed_my_secret_opinion + } + } +} + +secret_exposed_notification_effects_effect = { + save_temporary_scope_as = notification_receiver + if = { + limit = { has_hook_from_secret = $SECRET$ } + remove_hook = { + target = $CHARACTER$ + } + } + show_as_tooltip = { + $CHARACTER$ = { #Shows traits etc. applied to owner (and other involved characters) + secret_exposed_owner_effects_effect = { SECRET = $SECRET$ POV = scope:notification_receiver } + secret_exposed_owner_opinion_effects_effect = yes + } + } +} + + + + + + + + + + +########################################### +# LOVER SECRETS: INFIDELITY CONFRONTATION # +########################################### + +# Support effect for building lists in "start_infidelity_confrontation_story_exposure_effect" +infidelity_confrontation_story_add_to_list_effect = { + save_temporary_scope_as = checked_confronting_partner + if = { + limit = { + NOR = { + this = $LOVER_1$ + this = $LOVER_2$ + scope:infidelity_story = { + is_target_in_variable_list = { + name = confronting_partners + target = scope:checked_confronting_partner + } + } + } + #Exempt polyamorous spouses. + accepts_adultery_without_penalty_trigger = no + } + scope:infidelity_story = { + add_to_variable_list = { + name = confronting_partners + target = scope:checked_confronting_partner + } + } + } +} + +# Support for "start_infidelity_confrontation_story_exposure/discovery_effect" effects to creating the story +infidelity_confrontation_story_creation_effect = { + $LOVER_1$ = { + create_story = { + type = story_cycle_infidelty_confronter + save_scope_as = infidelity_story + } + scope:infidelity_story = { + set_variable = { + name = lover_1 + value = $LOVER_1$ + } + set_variable = { + name = lover_2 + value = $LOVER_2$ + } + add_to_variable_list = { + name = infidelity_lovers + target = $LOVER_1$ + } + add_to_variable_list = { + name = infidelity_lovers + target = $LOVER_2$ + } + } + } +} + +# Creates a story about confrontations/choices after discovered infidelity (lover secret discovery) +start_infidelity_confrontation_story_discovery_effect = { + if = { + limit = { + NOR = { + $DISCOVERER$ = $LOVER_2$ + $DISCOVERER$ = $LOVER_1$ + } + $DISCOVERER$ = { + OR = { + has_relation_lover = $LOVER_1$ + is_spouse_of = $LOVER_1$ + has_relation_lover = $LOVER_2$ + is_spouse_of = $LOVER_2$ + } + } + NOR = { + $LOVER_1$ = { + any_owned_story = { + type = story_cycle_infidelty_confronter + var:lover_2 = $LOVER_2$ #var:lover_2 is the secret target i.e. the other person + } + } + $LOVER_2$ = { + any_owned_story = { + type = story_cycle_infidelty_confronter + var:lover_2 = $LOVER_1$ #var:lover_2 is the secret target i.e. the other person + } + } + } + #Exempt marriages to polyamorous spouses. + NOR = { + $LOVER_1$ = { + OR = { + any_spouse = { + count = all + accepts_adultery_without_penalty_trigger = yes + } + has_character_flag = block_infidelity_flag + } + } + $LOVER_2$ = { + OR = { + any_spouse = { + count = all + accepts_adultery_without_penalty_trigger = yes + } + has_character_flag = block_infidelity_flag + } + } + } + } + infidelity_confrontation_story_creation_effect = { LOVER_1 = $LOVER_1$ LOVER_2 = $LOVER_2$ } + scope:infidelity_story = { + add_to_variable_list = { + name = confronting_partners + target = $DISCOVERER$ + } + } + #Certain changes to desc in event if the secret was revealed through investigation + if = { + limit = { $DISCOVERER$ = { is_ai = no } } #Text changes are only relevant to players + + #Save the secrets so we can check them + $LOVER_1$ = { + random_secret = { + type = secret_lover + limit = { + secret_target = $LOVER_2$ + } + add_to_temporary_list = secrets_for_desc + } + } + $LOVER_2$ = { + random_secret = { + type = secret_lover + limit = { + secret_target = $LOVER_1$ + } + add_to_temporary_list = secrets_for_desc + } + } + + #infidelity_confrontation_1000_investigation_desc + if = { + limit = { + any_in_list = { + list = secrets_for_desc + exists = var:revealed_through_investigation_by_desc + var:revealed_through_investigation_by_desc = $DISCOVERER$ + } + } + scope:infidelity_story = { + set_variable = { + name = infidelity_confrontation_1000_investigation_desc + value = yes + } + } + } + + #revealed_through_confession_to_desc + if = { + limit = { + any_in_list = { + list = secrets_for_desc + exists = var:revealed_through_confession_to_desc + var:revealed_through_confession_to_desc = $DISCOVERER$ + } + } + scope:infidelity_story = { + set_variable = { + name = infidelity_confrontation_1000_confession_desc + value = yes + } + } + } + } + } +} + +# Creates a story about confrontations/choices after discovered infidelity (lover secret exposure) +start_infidelity_confrontation_story_exposure_effect = { + if = { + limit = { + NOR = { + $EXPOSER$ = $LOVER_2$ + $EXPOSER$ = $LOVER_1$ + } + OR = { + $LOVER_1$ = { + OR = { + any_spouse = { NOT = { this = $LOVER_2$ } } + any_relation = { + type = lover + NOT = { this = $LOVER_2$ } + } + } + } + $LOVER_2$ = { + OR = { + any_spouse = { NOT = { this = $LOVER_1$ } } + any_relation = { + type = lover + NOT = { this = $LOVER_1$ } + } + } + } + } + } + #Set up story + infidelity_confrontation_story_creation_effect = { LOVER_1 = $LOVER_1$ LOVER_2 = $LOVER_2$ } + scope:infidelity_story = { + set_variable = { + name = exposer + value = $EXPOSER$ + } + } + + #Add all confronting partners + $LOVER_1$ = { + every_spouse = { + infidelity_confrontation_story_add_to_list_effect = { LOVER_1 = $LOVER_1$ LOVER_2 = $LOVER_2$ } + } + every_relation = { + type = lover + infidelity_confrontation_story_add_to_list_effect = { LOVER_1 = $LOVER_1$ LOVER_2 = $LOVER_2$ } + } + } + $LOVER_2$ = { + every_spouse = { + infidelity_confrontation_story_add_to_list_effect = { LOVER_1 = $LOVER_1$ LOVER_2 = $LOVER_2$ } + } + every_relation = { + type = lover + infidelity_confrontation_story_add_to_list_effect = { LOVER_1 = $LOVER_1$ LOVER_2 = $LOVER_2$ } + } + } + + #Save a list of the confronting partners who already knew + scope:infidelity_story = { + every_in_list = { + variable = confronting_partners + limit = { + save_temporary_scope_as = confronting_partner_knowledge_check + OR = { + $LOVER_1$ = { + any_secret = { + type = secret_lover + secret_target = $LOVER_2$ + any_secret_knower = { this = scope:confronting_partner_knowledge_check } + } + } + $LOVER_2$ = { + any_secret = { + type = secret_lover + secret_target = $LOVER_1$ + any_secret_knower = { this = scope:confronting_partner_knowledge_check } + } + } + } + } + save_temporary_scope_as = knowing_confronting_partner + scope:infidelity_story = { + add_to_variable_list = { + name = knowing_confronting_partners + target = scope:knowing_confronting_partner + } + } + } + } + } +} + + + + +################# +# MISC +############## + + +# Used to give people a random secret (small chance of multiples) +give_random_secret_effect = { + random_list = { + 20 = { + modifier = { + factor = 0 + OR = { + has_trait = deviant + any_secret = { + type = secret_deviant + } + } + } + give_deviant_secret_or_trait_effect = yes + } + 20 = { + modifier = { + factor = 0 + OR = { + has_sexuality = homosexual + any_secret = { + type = secret_homosexual + } + } + } + give_homosexual_secret_or_nothing_effect = yes + } + 10 = { + modifier = { + factor = 0 + OR = { + has_trait = deviant + any_secret = { + type = secret_deviant + } + has_sexuality = homosexual + any_secret = { + type = secret_homosexual + } + } + } + add_secret = { + type = secret_deviant + } + give_homosexual_secret_or_nothing_effect = yes + } + 5 = { # Get ALL the secrets! + if = { + limit = { + NOR = { + has_sexuality = homosexual + any_secret = { + type = secret_homosexual + } + } + } + give_homosexual_secret_or_nothing_effect = yes + } + if = { + limit = { + NOR = { + has_trait = deviant + any_secret = { + type = secret_deviant + } + } + } + give_deviant_secret_or_trait_effect = yes + } + } + } +} + + +give_random_likely_secret_effect = { + save_temporary_scope_as = secret_getter + random_list = { + 100 = { #DEVIANT + trigger = { + is_adult = yes + secret_deviant_is_valid_trigger = { OWNER = this } + NOR = { + has_trait = chaste + has_trait = celibate + } + NOT = { any_secret = { type = secret_deviant } } + trait_is_shunned_or_criminal_in_my_or_lieges_faith_trigger = { TRAIT = deviant GENDER_CHARACTER = scope:secret_getter } + + } + modifier = { + has_trait = lustful + add = 200 + } + ai_value_modifier = { + ai_boldness = tiny_chance_impact_positive_ai_value #+50 for high positive boldness + ai_honor = tiny_chance_impact_negative_ai_value #+50 for high negative honor + ai_zeal = medium_chance_impact_negative_ai_value #-200 for high positive zeal + } + give_deviant_secret_or_trait_effect = yes + } + 200 = { #HOMOSEXUAL + trigger = { + is_adult = yes + trait_is_shunned_or_criminal_in_my_or_lieges_faith_trigger = { TRAIT = sodomite GENDER_CHARACTER = scope:secret_getter } + OR = { + has_sexuality = homosexual + has_sexuality = bisexual + } + NOT = { any_secret = { type = secret_homosexual } } + } + modifier = { + any_relation = { type = lover sex_opposite_of = prev } + factor = 0.1 + } + give_homosexual_secret_or_nothing_effect = yes + } + 150 = { #MURDER ATTEMPT + trigger = { + is_adult = yes + save_temporary_scope_as = murderer + OR = { + any_relation = { + type = rival + give_random_likely_secret_murder_attempt_victim_trigger = yes + } + any_close_or_extended_family_member = { + reverse_opinion = { + target = prev + value <= -10 + } + give_random_likely_secret_murder_attempt_victim_trigger = yes + } + } + } + ai_value_modifier = { + ai_boldness = tiny_chance_impact_positive_ai_value #+50 for high positive boldness + ai_greed = tiny_chance_impact_positive_ai_value #+50 for high positive greed + ai_compassion = low_chance_impact_negative_ai_value #-100 for high positive compassion + } + + save_temporary_scope_as = murderer + + every_relation = { + type = rival + limit = { + give_random_likely_secret_murder_attempt_victim_trigger = yes + } + add_to_list = victim_options + } + every_close_or_extended_family_member = { + limit = { + reverse_opinion = { + target = prev + value <= -10 + } + give_random_likely_secret_murder_attempt_victim_trigger = yes + } + add_to_list = victim_options + } + + random_in_list = { + list = victim_options + save_temporary_scope_as = victim + } + + add_secret = { + type = secret_murder_attempt + target = scope:victim + } + } + 100 = { #CANNIBAL + trigger = { + secret_cannibal_is_valid_trigger = { OWNER = this } + NOT = { any_secret = { type = secret_cannibal } } + trait_is_shunned_or_criminal_in_my_or_lieges_faith_trigger = { TRAIT = cannibal GENDER_CHARACTER = scope:secret_getter } + } + ai_value_modifier = { + ai_boldness = tiny_chance_impact_positive_ai_value #+50 for high positive boldness + ai_greed = tiny_chance_impact_positive_ai_value #+50 for high positive greed + ai_zeal = low_chance_impact_negative_ai_value #-100 for high positive zeal + ai_compassion = medium_chance_impact_negative_ai_value #-200 for high positive compassion + } + modifier = { + is_adult = no + add = -80 + } + + give_cannibal_secret_or_trait_effect = yes + } + 200 = { #HERETIC + trigger = { + NOT = { any_secret = { type = secret_non_believer } } + } + modifier = { + add = { + value = ai_zeal + multiply = -2 + } + } + + give_non_believer_secret_effect = yes + } + 400 = { #LOVER + trigger = { + is_adult = yes + NOT = { has_trait = celibate } + save_temporary_scope_as = lover_1 + OR = { + any_courtier_or_guest = { + give_random_likely_secret_lover_trigger = yes + } + any_vassal = { + any_courtier_or_guest = { + give_random_likely_secret_lover_trigger = yes + } + } + } + } + modifier = { + OR = { + has_trait = lustful + has_trait = seducer + } + add = 400 + } + modifier = { + has_trait = chaste + add = -300 + } + ai_value_modifier = { + ai_compassion = medium_chance_impact_positive_ai_value #+200 for high positive compassion + } + + save_temporary_scope_as = lover_1 + random_courtier_or_guest = { + limit = { give_random_likely_secret_lover_trigger = yes } + weight = { + base = 1 + modifier = { + has_trait = lustful + factor = 3 + } + } + save_temporary_scope_as = lover + } + if = { + limit = { NOT = { exists = scope:lover } } + random_vassal = { + limit = { any_courtier_or_guest = { give_random_likely_secret_lover_trigger = yes } } + random_courtier_or_guest = { + limit = { give_random_likely_secret_lover_trigger = yes } + weight = { + base = 1 + modifier = { + has_trait = lustful + factor = 3 + } + } + save_temporary_scope_as = lover + } + } + } + + set_random_lover_reason = { TARGET = scope:lover } + } + 100 = { #INCESTOUS LOVER + trigger = { + is_adult = yes + NOT = { has_trait = celibate } + save_temporary_scope_as = lover_2 + any_close_family_member = { + give_random_likely_secret_incestous_lover_trigger = yes + } + } + modifier = { + has_trait = deviant + add = 100 + } + + random_close_family_member = { + limit = { give_random_likely_secret_incestous_lover_trigger = yes } + set_random_lover_reason = { TARGET = prev } + } + } + 100 = { #WITCH + trigger = { + NOT = { any_secret = { type = secret_witch } } + trait_is_shunned_or_criminal_in_my_or_lieges_faith_trigger = { TRAIT = witch GENDER_CHARACTER = scope:secret_getter } + } + ai_value_modifier = { + ai_greed = tiny_chance_impact_positive_ai_value #+50 for high positive greed + ai_zeal = medium_chance_impact_negative_ai_value #+200 for high negative zeal + ai_compassion = tiny_chance_impact_negative_ai_value #+50 for high negative compassion + } + modifier = { + has_trait = lifestyle_mystic + add = 100 + } + modifier = { + has_trait = lifestyle_physician + add = 40 + } + + add_secret = { + type = secret_witch + } + } + } +} + + + +#Give secret and save as scope:secret +give_secret_and_save_as_secret_effect = { + save_temporary_scope_value_as = { + name = give_secret_type + value = flag:$SECRET_TYPE$ + } + + if = { + limit = { + OR = { + scope:give_secret_type = flag:secret_deviant + scope:give_secret_type = flag:secret_cannibal + scope:give_secret_type = flag:secret_non_believer + scope:give_secret_type = flag:secret_witch + } + } + add_secret = { + type = $SECRET_TYPE$ + } + } + else_if = { + limit = { + scope:give_secret_type = flag:secret_incest + } + give_incest_secret_or_nothing_effect = yes + } + else_if = { + limit = { + scope:give_secret_type = flag:secret_homosexual + is_male = yes + } + give_homosexual_secret_or_nothing_effect = yes + } + + random_secret = { + limit = { + secret_type = $SECRET_TYPE$ + } + save_scope_as = secret + } +} + +save_my_known_father_effect = { + if = { + limit = { + exists = this.father + NOT = { + any_known_secret = { + secret_target = prev + OR = { + secret_type = secret_disputed_heritage + secret_type = secret_unmarried_illegitimate_child + } + } + } + } + scope:father = { save_scope_as = known_father } + } + else_if = { + limit = { + exists = this.real_father + any_known_secret = { + secret_target = prev + OR = { + secret_type = secret_disputed_heritage + secret_type = secret_unmarried_illegitimate_child + } + } + } + scope:real_father = { save_scope_as = known_father } + } +} + + +add_random_blackmailable_secret_effect = { + save_scope_as = target + + random_list = { + 3 = { #Secret Deviant + trigger = { + secret_type_is_blackmailable_simple_trigger = { + TYPE = secret_deviant + TARGET = scope:target + BLACKMAILER = $BLACKMAILER$ + } + } + add_secret = { + type = secret_deviant + } + random_secret = { + type = secret_deviant + save_scope_as = new_secret + } + } + 5 = { #Secret Homosexual + trigger = { + secret_type_is_blackmailable_simple_trigger = { + TYPE = secret_homosexual + TARGET = scope:target + BLACKMAILER = $BLACKMAILER$ + } + } + add_secret = { + type = secret_homosexual + } + random_secret = { + type = secret_homosexual + save_scope_as = new_secret + } + } + 1 = { #Secret Cannibal + trigger = { + secret_type_is_blackmailable_simple_trigger = { + TYPE = secret_cannibal + TARGET = scope:target + BLACKMAILER = $BLACKMAILER$ + } + } + add_secret = { + type = secret_cannibal + } + random_secret = { + type = secret_cannibal + save_scope_as = new_secret + } + } + 2 = { #Secret Non-believer + trigger = { + secret_type_is_blackmailable_simple_trigger = { + TYPE = secret_non_believer + TARGET = scope:target + BLACKMAILER = $BLACKMAILER$ + } + } + add_secret = { + type = secret_non_believer + } + random_secret = { + type = secret_non_believer + save_scope_as = new_secret + } + } + 1 = { #Secret Incest + trigger = { + secret_type_is_blackmailable_simple_trigger = { + TYPE = secret_incest + TARGET = scope:target + BLACKMAILER = $BLACKMAILER$ + } + } + add_secret = { + type = secret_incest + } + random_secret = { + type = secret_incest + save_scope_as = new_secret + } + } + 2 = { #Secret Witch + trigger = { + secret_type_is_blackmailable_simple_trigger = { + TYPE = secret_witch + TARGET = scope:target + BLACKMAILER = $BLACKMAILER$ + } + } + add_secret = { + type = secret_witch + } + random_secret = { + type = secret_witch + save_scope_as = new_secret + } + } + } + + assert_if = { + limit = { + NOT = { exists = scope:new_secret } + } + text = "No secret added by add_random_blackmailable_secret_effect - Always check the target with random_blackmailable_secret_can_be_added_simple_trigger first!" + } +} diff --git a/N3OW/common/scripted_effects/00_setup_tests_effect.txt b/N3OW/common/scripted_effects/00_setup_tests_effect.txt new file mode 100644 index 00000000..3119d7ad --- /dev/null +++ b/N3OW/common/scripted_effects/00_setup_tests_effect.txt @@ -0,0 +1,55 @@ +# Tests in this effect will only run if the game is in debug mode + +run_setup_tests_effect = { + every_living_character = { + if = { + limit = { + is_married = yes + is_adult = no + } + error_log = "[THIS.Char.GetLogName] is married but not an adult!" + } + } + every_ruler = { + if = { + limit = { + has_government = herder_government + holds_landed_title = yes + liege = { + this != prev + has_government = nomad_government + } + } + error_log = "[THIS.Char.GetLogName] is a landed herder marked as a vassal of a nomadic ruler!" + } + if = { + limit = { suzerain != this } + if = { + limit = { + NOR = { + has_government = nomad_government + has_government = herder_government + } + OR = { + has_subject_contract_group = tributary_nomadic + has_subject_contract_group = tributary_steppe + } + } + error_log = "[THIS.Char.GetLogName] is not a herder or nomad tributary but has a nomadic or steppe subject contract!" + } + else_if = { + limit = { + OR = { + has_government = nomad_government + has_government = herder_government + } + NOR = { + has_subject_contract_group = tributary_nomadic + has_subject_contract_group = tributary_steppe + } + } + error_log = "[THIS.Char.GetLogName] is a herder or nomad tributary with a non-nomadic/steppe subject contract!" + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_sibling_effects.txt b/N3OW/common/scripted_effects/00_sibling_effects.txt new file mode 100644 index 00000000..23bb9f15 --- /dev/null +++ b/N3OW/common/scripted_effects/00_sibling_effects.txt @@ -0,0 +1,112 @@ + +###EFFECT LIST + +#save_friendly_unlanded_sibling_as_et_effect + +#Effects for increasing and decreasing sibling variable trackers: +#increase_helped_landed_sibling_value_effect +#decrease_helped_landed_sibling_value_effect +#increase_sibling_causing_trouble_value_effect +#decrease_sibling_causing_trouble_value_effect + + +save_friendly_unlanded_sibling_as_et_effect = { + random_sibling = { + limit = { + is_playable_character = no + is_adult = yes + opinion = { + target = root + value > 30 + } + } + save_scope_as = sibling + } +} + + + + +increase_helped_landed_sibling_value_effect = { + custom_tooltip = accepted_sibling_help_tt + hidden_effect = { + if = { + limit = { + root = { is_ai = no } + has_variable = helped_landed_sibling + } + change_variable = { + name = helped_landed_sibling + add = 1 + } + } + else = { + set_variable = { + name = helped_landed_sibling + value = 1 + } + } + } +} + + +decrease_helped_landed_sibling_value_effect = { + hidden_effect = { + if = { + limit = { + root = { is_ai = no } + has_variable = helped_landed_sibling + var:helped_landed_sibling > 1 + } + change_variable = { + name = helped_landed_sibling + add = -1 + } + } + else = { + remove_variable = helped_landed_sibling + } + } +} + + +increase_sibling_causing_trouble_value_effect = { + hidden_effect = { + if = { + limit = { + root = { is_ai = no } + has_variable = sibling_causing_trouble + } + change_variable = { + name = sibling_causing_trouble + add = 1 + } + } + else = { + set_variable = { + name = sibling_causing_trouble + value = 1 + } + } + } +} + + +decrease_sibling_causing_trouble_value_effect = { + hidden_effect = { + if = { + limit = { + root = { is_ai = no } + has_variable = sibling_causing_trouble + var:sibling_causing_trouble > 1 + } + change_variable = { + name = sibling_causing_trouble + add = -1 + } + } + else = { + remove_variable = sibling_causing_trouble + } + } +} \ No newline at end of file diff --git a/N3OW/common/scripted_effects/00_single_combat_effects.txt b/N3OW/common/scripted_effects/00_single_combat_effects.txt new file mode 100644 index 00000000..65933db6 --- /dev/null +++ b/N3OW/common/scripted_effects/00_single_combat_effects.txt @@ -0,0 +1,502 @@ + +################################################## +# Effects related to the Single Combat Engine +################################################## + +################################################## +# SETUP & CLEANUP EFFECTS + +configure_start_single_combat_effect = { + # DOCUMENTATION + ## scope:sc_initiator + ### Who started the combat? This is who the output/invalidation events will fire for. + ## scope:sc_attacker + ### The attacking party. + ## scope:sc_defender + ### The defending party. + ## scope:fatality = flag:default/possible/no/always + ### default: always if tribal, no otherwise. + ### possible: losing can be fatal, but isn't necessarily. + ### no: losing is never fatal. + ### always: losing always fatal. + ### practice: no death, no wounds. + ## scope:fixed = flag:no/flag:sc_attacker/scope:sc_defender + ### No: the match uses normal rules. + ### scope:sc_attacker: the attacker will always win. + ### scope:challenged: the defender will always win. + ## scope:locale = flag:XYZ + ### These just trigger the event background of the same name. New ones can be added as needed, but should be added across all three events (round, victory, loss/single_combat.0001, single_combat.0031, single_combat.0041), as we can't add a scripted list. + ### terrain_scope + ### battlefield + ### alley_night + ### alley_day + ### temple + ### corridor_night + ### corridor_day + ### courtyard + ### dungeon + ### docks + ### feast + ### market + ### tavern + ### throne_room + ### army_camp + ## output event ID + ### Which event fires after the combat's completion? + + # Sort parties. + $SC_INITIATOR$ = { save_scope_as = sc_initiator } + $SC_ATTACKER$ = { save_scope_as = sc_attacker } + $SC_DEFENDER$ = { save_scope_as = sc_defender } + # Arrange aftermath. + ## We're doing this early so we can invalidate well in a sec. + if = { + limit = { exists = scope:sc_finished } + clear_saved_scope = sc_finished + } + save_scope_value_as = { + name = follow_up_event + value = event_id:$OUTPUT_EVENT$ + } + save_scope_value_as = { + name = invalidation_event + value = event_id:$INVALIDATION_EVENT$ + } + # Invalidation check: have we managed to set scope:sc_attacker and scope:sc_defender to the same person? + ## If so, invalidate the duel, because this will cause crashes on Mac due to the duel's logic then looping in on itself later. + ### Shocking to hear Mac has problems, I know. + if = { + limit = { + scope:sc_attacker != scope:sc_defender + } + # Make sure they're clean for setup. + hidden_effect = { remove_single_combat_info_effect = yes } + # Set them both to busy for the single combat. + scope:sc_attacker = { + set_variable = { + name = engaged_in_single_combat + value = yes + } + } + scope:sc_defender = { + set_variable = { + name = engaged_in_single_combat + value = yes + } + } + ## Then try to take shirts off. + single_combat_apply_default_shirtlessness_effect = { + ATTACKER = scope:sc_attacker + DEFENDER = scope:sc_defender + } + # Set rules. + save_scope_value_as = { + name = fatality + value = flag:$FATALITY$ + } + save_scope_value_as = { + name = fixed + value = flag:$FIXED$ + } + save_scope_value_as = { + name = locale + value = flag:$LOCALE$ + } + ## Note where the fight is taking place, if we're using a specific location. + if = { + limit = { scope:locale = flag:terrain_scope } + scope:sc_defender.location = { save_scope_as = background_terrain_scope } + } + # Configure starting bonus/threshold variables. + scope:sc_attacker = { + set_variable = { + name = sc_attacker_injury_bonus + value = starting_injury_bonus + } + } + scope:sc_defender = { + set_variable = { + name = sc_defender_injury_bonus + value = starting_injury_bonus + } + set_variable = { + name = success_threshold + value = starting_success_threshold + } + } + # Configure starting round variables. + scope:sc_attacker = { + set_variable = { + name = sc_attacker_injury_risk_score + value = 0 + } + set_variable = { + name = sc_attacker_duel_success_score + value = 0 + } + # Including local variables for combat buffs & debuffs. + set_local_variable = { + name = current_duel_edge_buff + value = 0 + } + set_local_variable = { + name = current_duel_edge_debuff + value = 0 + } + # If the character lacks a preferred weapon, pick one. + set_signature_weapon_effect = yes + } + scope:sc_defender = { + set_variable = { + name = sc_defender_injury_risk_score + value = 0 + } + set_variable = { + name = sc_defender_duel_success_score + value = 0 + } + # Including local variables for combat buffs & debuffs. + set_local_variable = { + name = current_duel_edge_buff + value = 0 + } + set_local_variable = { + name = current_duel_edge_debuff + value = 0 + } + # Set up the combat rounds. + set_variable = { + name = current_round + value = 1 + } + # If the character lacks a preferred weapon, pick one. + set_signature_weapon_effect = yes + } + # Finally, send the first event. + scope:sc_defender = { trigger_event = single_combat.0001 } + } + # Otherwise, invalidate the duel immediately. + else = { + scope:sc_initiator = { + trigger_event = { saved_event_id = scope:invalidation_event } + } + # And fire an error to the debug log for us. + error_log = debug_log.single_combat_setup.attacker_and_defender_same_person + debug_log = debug_log.single_combat_setup.attacker_and_defender_same_person.notice + debug_log_scopes = yes + } +} + +# Clean all duel edge buff character modifiers. +remove_temporary_duel_edge_buff_modifiers_effect = { + # General modifiers. + remove_character_modifier = duel_edge_buff_01_modifier + remove_character_modifier = duel_edge_buff_02_modifier + remove_character_modifier = duel_edge_buff_03_modifier + remove_character_modifier = duel_edge_buff_04_modifier + remove_character_modifier = duel_edge_buff_05_modifier + remove_character_modifier = duel_edge_buff_06_modifier + remove_character_modifier = duel_edge_buff_07_modifier + remove_character_modifier = duel_edge_buff_08_modifier + remove_character_modifier = duel_edge_buff_09_modifier + remove_character_modifier = duel_edge_buff_10_modifier + remove_character_modifier = duel_edge_buff_11_modifier + remove_character_modifier = duel_edge_buff_12_modifier + remove_character_modifier = duel_edge_buff_13_modifier + remove_character_modifier = duel_edge_buff_14_modifier + remove_character_modifier = duel_edge_buff_15_modifier + remove_character_modifier = duel_edge_buff_16_modifier + remove_character_modifier = duel_edge_buff_17_modifier + remove_character_modifier = duel_edge_buff_18_modifier + remove_character_modifier = duel_edge_buff_19_modifier + remove_character_modifier = duel_edge_buff_20_modifier + remove_character_modifier = duel_edge_buff_21_modifier + remove_character_modifier = duel_edge_buff_22_modifier + remove_character_modifier = duel_edge_buff_23_modifier + remove_character_modifier = duel_edge_buff_24_modifier + remove_character_modifier = duel_edge_buff_25_modifier + remove_character_modifier = duel_edge_buff_26_modifier + remove_character_modifier = duel_edge_buff_27_modifier + remove_character_modifier = duel_edge_buff_28_modifier + remove_character_modifier = duel_edge_buff_29_modifier + remove_character_modifier = duel_edge_buff_30_modifier + # And the recalc flag. + remove_character_flag = sce_needs_forced_recalc_flag +} + +# Clean all duel edge debuff character modifiers. +remove_temporary_duel_edge_debuff_modifiers_effect = { + # General modifiers. + remove_character_modifier = duel_edge_debuff_01_modifier + remove_character_modifier = duel_edge_debuff_02_modifier + remove_character_modifier = duel_edge_debuff_03_modifier + remove_character_modifier = duel_edge_debuff_04_modifier + remove_character_modifier = duel_edge_debuff_05_modifier + remove_character_modifier = duel_edge_debuff_06_modifier + remove_character_modifier = duel_edge_debuff_07_modifier + remove_character_modifier = duel_edge_debuff_08_modifier + remove_character_modifier = duel_edge_debuff_09_modifier + remove_character_modifier = duel_edge_debuff_10_modifier + remove_character_modifier = duel_edge_debuff_11_modifier + remove_character_modifier = duel_edge_debuff_12_modifier + remove_character_modifier = duel_edge_debuff_13_modifier + remove_character_modifier = duel_edge_debuff_14_modifier + remove_character_modifier = duel_edge_debuff_15_modifier + remove_character_modifier = duel_edge_debuff_16_modifier + remove_character_modifier = duel_edge_debuff_17_modifier + remove_character_modifier = duel_edge_debuff_18_modifier + remove_character_modifier = duel_edge_debuff_19_modifier + remove_character_modifier = duel_edge_debuff_20_modifier + remove_character_modifier = duel_edge_debuff_21_modifier + remove_character_modifier = duel_edge_debuff_22_modifier + remove_character_modifier = duel_edge_debuff_23_modifier + remove_character_modifier = duel_edge_debuff_24_modifier + remove_character_modifier = duel_edge_debuff_25_modifier + remove_character_modifier = duel_edge_debuff_26_modifier + remove_character_modifier = duel_edge_debuff_27_modifier + remove_character_modifier = duel_edge_debuff_28_modifier + remove_character_modifier = duel_edge_debuff_29_modifier + remove_character_modifier = duel_edge_debuff_30_modifier + # And the recalc flag. + remove_character_flag = sce_needs_forced_recalc_flag +} + +# Clean all special combat character modifiers. +remove_temporary_combat_move_special_modifiers_effect = { + remove_character_modifier = combat_move_taunt_modifier + remove_character_modifier = combat_move_hurt_me_better_wounded_1_modifier + remove_character_modifier = combat_move_hurt_me_better_wounded_2_modifier + remove_character_modifier = combat_move_hurt_me_better_wounded_3_modifier +} + +# Clean up all character modifiers resulting from single combat. +remove_temporary_modifiers_combat_effect = { + # Buffs. + remove_temporary_duel_edge_buff_modifiers_effect = yes + # Debuffs. + remove_temporary_duel_edge_debuff_modifiers_effect = yes + # Special Combat. + remove_temporary_combat_move_special_modifiers_effect = yes +} + +# Clean up all combat move variables resulting from single combat. +remove_single_combat_character_local_variables_effect = { + # Reset the special move flag. + remove_local_variable = combat_move_special_slot_used_flag + # Remove previous combat move flags. + ## Tier 1 moves + remove_local_variable = combat_move_wait_and_hope_flag + remove_local_variable = combat_move_unsure_attack_flag + remove_local_variable = combat_move_enthusiastic_onslaught_flag + remove_local_variable = combat_move_hail_mary_flag + remove_local_variable = combat_move_pocket_sand_flag + remove_local_variable = combat_move_nut_em_flag + ## Tier 2 moves + remove_local_variable = combat_move_guard_flag + remove_local_variable = combat_move_probing_attack_flag + remove_local_variable = combat_move_onslaught_flag + remove_local_variable = combat_move_surprise_attack_flag + remove_local_variable = combat_move_taunt_flag + remove_local_variable = combat_move_put_the_boot_in_flag + ## Tier 3 moves + remove_local_variable = combat_move_strict_guard_flag + remove_local_variable = combat_move_confident_attack_flag + remove_local_variable = combat_move_expert_onslaught_flag + remove_local_variable = combat_move_attempt_disarm_flag + remove_local_variable = combat_move_lightning_assault_flag + remove_local_variable = combat_move_tire_opponent_flag + ## High Secondary Skill special moves + remove_local_variable = combat_move_reason_you_suck_speech_flag + remove_local_variable = combat_move_technique_from_legend_flag + remove_local_variable = combat_move_like_a_viper_flag + remove_local_variable = combat_move_pocket_silver_flag + remove_local_variable = combat_move_martial_voice_flag + remove_local_variable = combat_move_mocking_boast_flag + ## Location Specific special moves + remove_local_variable = combat_move_is_that_a_crocodile_flag + remove_local_variable = combat_move_desert_warrior_flag + remove_local_variable = combat_move_jungle_stalker_flag + remove_local_variable = combat_move_open_terrain_expert_flag + remove_local_variable = combat_move_rough_terrain_expert_flag + remove_local_variable = combat_move_forest_fighter_flag + ## Trait-Specific special moves + remove_local_variable = combat_move_raaargh_flag + remove_local_variable = combat_move_hard_grit_flag + remove_local_variable = combat_move_feint_and_stab_flag + remove_local_variable = combat_move_butchery_flag + remove_local_variable = combat_move_stoic_veteran_flag + remove_local_variable = combat_move_blade_dance_flag + remove_local_variable = combat_move_wrath_of_highgod_flag + remove_local_variable = combat_move_hurt_me_better_flag + ## Misc special moves + remove_local_variable = combat_move_special_fallback_flag + remove_local_variable = combat_move_something_to_hide_flag +} + +# Clean up all variables resulting from single combat. +remove_single_combat_variables_effect = { + remove_variable = tier_1_counter + remove_variable = tier_2_counter + remove_variable = tier_3_counter + remove_variable = sc_attacker_success_check + remove_variable = sc_defender_success_check + remove_variable = sc_attacker_injury_risk_check + remove_variable = sc_defender_injury_risk_check + remove_variable = sc_attacker_injury_bonus + remove_variable = sc_defender_injury_bonus + remove_variable = success_threshold + remove_variable = sc_attacker_injury_risk_score + remove_variable = sc_attacker_duel_success_score + remove_variable = sc_defender_injury_risk_score + remove_variable = sc_defender_duel_success_score + remove_variable = current_round + # Note, we don't remove var:engaged_in_single_combat here, as we run this effect at the start of combat for clean-up also. +} + +# Clean all consequences of a single combat. +remove_single_combat_info_effect = { + scope:sc_attacker = { + # Only remove variables if they're alive, as otherwise we get errors. + if = { + limit = { is_alive = yes } + remove_single_combat_character_local_variables_effect = yes + remove_single_combat_variables_effect = yes + remove_temporary_modifiers_combat_effect = yes + } + } + scope:sc_defender = { + # Only remove variables if they're alive, as otherwise we get errors. + if = { + limit = { is_alive = yes } + remove_single_combat_character_local_variables_effect = yes + remove_single_combat_variables_effect = yes + remove_temporary_modifiers_combat_effect = yes + } + } +} + +# Strip the shirts from characters where appropriate. +single_combat_apply_default_shirtlessness_effect = { + if = { + limit = { + $ATTACKER$ = { government_has_flag = government_is_tribal } + $DEFENDER$ = { government_has_flag = government_is_tribal } + } + $ATTACKER$ = { add_character_flag = single_combat_stripped_to_waist } + $DEFENDER$ = { add_character_flag = single_combat_stripped_to_waist } + } + else = { + $ATTACKER$ = { add_character_flag = single_combat_duel_armor } + $DEFENDER$ = { add_character_flag = single_combat_duel_armor } + } +} + +# Let everyone put their shirts back on. +single_combat_clean_shirtlessness_effect = { + $ATTACKER$ = { + if = { + limit = { has_character_flag = single_combat_stripped_to_waist } + remove_character_flag = single_combat_stripped_to_waist + } + else_if = { + limit = { has_character_flag = single_combat_duel_armor } + remove_character_flag = single_combat_duel_armor + } + } + $DEFENDER$ = { + if = { + limit = { has_character_flag = single_combat_stripped_to_waist } + remove_character_flag = single_combat_stripped_to_waist + } + else_if = { + limit = { has_character_flag = single_combat_duel_armor } + remove_character_flag = single_combat_duel_armor + } + } +} + +# Let everyone put their signature weapon back on. +single_combat_clean_temp_weapon_effect = { + $ATTACKER$ = { + if = { #check for variables set up in set_temporary_signature_weapon + limit = { + is_alive = yes + OR = { + has_variable = og_signature_weapon + has_variable = temporary_signature_weapon + } + } + if = { #remove the signature_weapon variable if the character didn't have anything before + limit = { + var:og_signature_weapon = flag:no_signature_weapon_yet + } + remove_variable = signature_weapon + } + else = { #restore the original signature_weapon + set_variable = { + name = signature_weapon + value = var:og_signature_weapon + } + } + #remove all variables set up in set_temporary_signature_weapon + remove_variable = temporary_signature_weapon + remove_variable = og_signature_weapon + } + } + $DEFENDER$ = { + if = { #check for variables set up in set_temporary_signature_weapon + limit = { + is_alive = yes + OR = { + has_variable = og_signature_weapon + has_variable = temporary_signature_weapon + } + } + if = { #remove the signature_weapon variable if the character didn't have anything before + limit = { + var:og_signature_weapon = flag:no_signature_weapon_yet + } + remove_variable = signature_weapon + } + else = { #restore the original signature_weapon + set_variable = { + name = signature_weapon + value = var:og_signature_weapon + } + } + #remove all variables set up in set_temporary_signature_weapon + remove_variable = temporary_signature_weapon + remove_variable = og_signature_weapon + } + } +} + +################################################## +# CONSEQUENCE EFFECTS + +single_combat_have_slain_kin_effect = { + # Check $ATTACKER$. + if = { + limit = { + $ATTACKER$ = { + is_alive = no + killer = $DEFENDER$ + } + } + $DEFENDER$ = { + add_kinslayer_trait_or_nothing_effect = { VICTIM = $ATTACKER$ } + } + } + # Check $DEFENDER$. + if = { + limit = { + $DEFENDER$ = { + is_alive = no + killer = $ATTACKER$ + } + } + $ATTACKER$ = { + add_kinslayer_trait_or_nothing_effect = { VICTIM = $DEFENDER$ } + } + } +} diff --git a/N3OW/common/scripted_effects/00_skill_effects.txt b/N3OW/common/scripted_effects/00_skill_effects.txt new file mode 100644 index 00000000..d11c91cb --- /dev/null +++ b/N3OW/common/scripted_effects/00_skill_effects.txt @@ -0,0 +1,190 @@ +#add_random_skill_point_effect + +add_random_skill_point_effect = { + random_list = { + 1 = { add_diplomacy_skill = 1 } + 1 = { add_intrigue_skill = 1 } + 1 = { add_learning_skill = 1 } + 1 = { add_martial_skill = 1 } + 1 = { add_prowess_skill = 1 } + 1 = { add_stewardship_skill = 1 } + } +} + +add_random_five_skill_points_effect = { + random_list = { + 1 = { add_diplomacy_skill = 5 } + 1 = { add_intrigue_skill = 5 } + 1 = { add_learning_skill = 5 } + 1 = { add_martial_skill = 5 } + 1 = { add_prowess_skill = 5 } + 1 = { add_stewardship_skill = 5 } + } +} + +add_highest_skill_point_effect = { + switch = { + trigger = highest_skill_including_prowess + diplomacy = { add_diplomacy_skill = 1 } + intrigue = { add_intrigue_skill = 1 } + learning = { add_learning_skill = 1 } + martial = { add_martial_skill = 1 } + stewardship = { add_stewardship_skill = 1 } + prowess = { add_prowess_skill = 1 } + } +} + +add_highest_skill_five_points_effect = { + switch = { + trigger = highest_skill_including_prowess + diplomacy = { add_diplomacy_skill = 5 } + intrigue = { add_intrigue_skill = 5 } + learning = { add_learning_skill = 5 } + martial = { add_martial_skill = 5 } + stewardship = { add_stewardship_skill = 5 } + prowess = { add_prowess_skill = 5 } + } +} + +add_highest_skill_two_points_effect = { + switch = { + trigger = highest_skill_including_prowess + diplomacy = { add_diplomacy_skill = 2 } + intrigue = { add_intrigue_skill = 2 } + learning = { add_learning_skill = 2 } + martial = { add_martial_skill = 2 } + stewardship = { add_stewardship_skill = 2 } + prowess = { add_prowess_skill = 2 } + } +} + +#Is run by get_lowest_skill_effect +calculate_lowest_skill_effect = { + save_scope_value_as = { + name = lowest_character_skill + value = flag:$SKILL$ + } + save_scope_value_as = { + name = lowest_character_skill_value + value = $SKILL$ + } +} + +#Sets scopes scope:lowest_character_skill and scope:lowest_character_skill_value +get_lowest_skill_effect = { + save_scope_value_as = { + name = lowest_character_skill + value = flag:diplomacy + } + save_scope_value_as = { + name = lowest_character_skill_value + value = diplomacy + } + #Let's make it a bit more random in case you have the same level in a lot of skills + random_list = { + 10 = { + if = { + limit = { + martial <= scope:lowest_character_skill_value + } + calculate_lowest_skill_effect = { SKILL = martial } + } + if = { + limit = { + stewardship <= scope:lowest_character_skill_value + } + calculate_lowest_skill_effect = { SKILL = stewardship } + } + if = { + limit = { + intrigue <= scope:lowest_character_skill_value + } + calculate_lowest_skill_effect = { SKILL = intrigue } + } + if = { + limit = { + learning <= scope:lowest_character_skill_value + } + calculate_lowest_skill_effect = { SKILL = learning } + } + } + 10 = { + if = { + limit = { + stewardship <= scope:lowest_character_skill_value + } + calculate_lowest_skill_effect = { SKILL = stewardship } + } + if = { + limit = { + intrigue <= scope:lowest_character_skill_value + } + calculate_lowest_skill_effect = { SKILL = intrigue } + } + if = { + limit = { + learning <= scope:lowest_character_skill_value + } + calculate_lowest_skill_effect = { SKILL = learning } + } + if = { + limit = { + martial <= scope:lowest_character_skill_value + } + calculate_lowest_skill_effect = { SKILL = martial } + } + } + 10 = { + if = { + limit = { + intrigue <= scope:lowest_character_skill_value + } + calculate_lowest_skill_effect = { SKILL = intrigue } + } + if = { + limit = { + learning <= scope:lowest_character_skill_value + } + calculate_lowest_skill_effect = { SKILL = learning } + } + if = { + limit = { + martial <= scope:lowest_character_skill_value + } + calculate_lowest_skill_effect = { SKILL = martial } + } + if = { + limit = { + stewardship <= scope:lowest_character_skill_value + } + calculate_lowest_skill_effect = { SKILL = stewardship } + } + } + 10 = { + if = { + limit = { + learning <= scope:lowest_character_skill_value + } + calculate_lowest_skill_effect = { SKILL = learning } + } + if = { + limit = { + martial <= scope:lowest_character_skill_value + } + calculate_lowest_skill_effect = { SKILL = martial } + } + if = { + limit = { + stewardship <= scope:lowest_character_skill_value + } + calculate_lowest_skill_effect = { SKILL = stewardship } + } + if = { + limit = { + intrigue <= scope:lowest_character_skill_value + } + calculate_lowest_skill_effect = { SKILL = intrigue } + } + } + } +} \ No newline at end of file diff --git a/N3OW/common/scripted_effects/00_spouse_effects.txt b/N3OW/common/scripted_effects/00_spouse_effects.txt new file mode 100644 index 00000000..1ab12c23 --- /dev/null +++ b/N3OW/common/scripted_effects/00_spouse_effects.txt @@ -0,0 +1,117 @@ + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! + +#councillor_spouse_lifestyle_rank_up_effect + +##################################################################### +# EFFECTS +##################################################################### + +councillor_spouse_lifestyle_rank_up_effect = { + random = { + chance = var:councillor_spouse_lifestyle_progress + modifier = { + add = $SKILL$ + } + modifier = { + factor = councillor_spouse_lifestyle_progress_factor + } + save_temporary_scope_value_as = { + name = ranked_up + value = yes + } + save_scope_as = councillor + random_spouse = { + limit = { + exists = this.cp:councillor_spouse + this.cp:councillor_spouse = scope:councillor + } + save_scope_as = council_owner + } + save_scope_value_as = { + name = skill_type + value = flag:$SKILL$ + } + if = { + limit = { has_character_modifier = councillor_spouse_$SKILL$_2_modifier } + remove_character_modifier = councillor_spouse_$SKILL$_2_modifier + scope:council_owner = { + send_interface_message = { + type = msg_spouse_task_good + title = councillor_spouse_background.0001.title + desc = councillor_spouse_background.0001.$SKILL$_notification + left_icon = scope:councillor + scope:councillor = { + switch = { + trigger = scope:skill_type + flag:diplomacy = { + add_trait = diplomat + debug_log = "A Spouse reached Lifestyle Rank 3, Diplomat was set" + } + flag:martial = { + add_trait = strategist + debug_log = "A Spouse reached Lifestyle Rank 3, Strategist was set" + } + flag:stewardship = { + add_trait = architect + debug_log = "A Spouse reached Lifestyle Rank 3, Architect was set" + } + flag:intrigue = { + add_trait = schemer + debug_log = "A Spouse reached Lifestyle Rank 3, Schemer was set" + } + flag:learning = { + add_trait = scholar + debug_log = "A Spouse reached Lifestyle Rank 3, Scholar was set" + } + fallback = { debug_log = "A Spouse reached Lifestyle Rank 3, but no trait was set" } + } + } + } + } + } + else_if = { + limit = { has_character_modifier = councillor_spouse_$SKILL$_1_modifier } + remove_character_modifier = councillor_spouse_$SKILL$_1_modifier + scope:council_owner = { + send_interface_message = { + type = msg_spouse_task_good + title = councillor_spouse_background.0001.title + desc = councillor_spouse_background.0001.$SKILL$_notification + left_icon = scope:councillor + scope:councillor = { + add_character_modifier = { + modifier = councillor_spouse_$SKILL$_2_modifier + } + } + } + } + debug_log = "A Spouse reached Lifestyle Rank 2" + } + else = { + scope:council_owner = { + send_interface_message = { + type = msg_spouse_task_good + title = councillor_spouse_background.0001.title + desc = councillor_spouse_background.0001.$SKILL$_notification + left_icon = scope:councillor + scope:councillor = { + add_character_modifier = { + modifier = councillor_spouse_$SKILL$_1_modifier + } + } + } + } + debug_log = "A Spouse reached Lifestyle Rank 1" + } + + #Reset the progress once the character has ranked up + set_variable = { + name = councillor_spouse_lifestyle_progress + value = 0 + } + } +} diff --git a/N3OW/common/scripted_effects/00_stewardship_lifestyle_effects.txt b/N3OW/common/scripted_effects/00_stewardship_lifestyle_effects.txt new file mode 100644 index 00000000..8133984c --- /dev/null +++ b/N3OW/common/scripted_effects/00_stewardship_lifestyle_effects.txt @@ -0,0 +1,548 @@ +#Effects used in Stewardship Lifestyle Focus events + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! +# +# Mediation Event Effects: +# stewardship_duty_special_2000_sc_mediation_saved_scopes_effect - Takes scopes saved as story cycle variables and re-saves them as accessible scopes. +# stewardship_duty_special_2000_sc_mediation_increase_s1_event_count_effect - Increments the counter of how many state 1 events have fired (for tracking event completion progress) +# stewardship_duty_special_2000_sc_mediation_increase_s2_event_count_effect - Increments the counter of how many stage 2 events have fired (for tracking event completion preogress) +# stewardship_duty_special_2000_sc_mediation_get_random_quarreler_effect - Randomly picks one of the two quarrelers and saves their scope for localization usage. +# +# Map Painting Effects: +# stewardship_duty_special_1201_map_painting_journey_continuation_effect - Advances the event chain onto the next step. +# stewardship_duty_special_1201_conclude_map_painting_effect - Concludes the event chain. +# +# Road Building Effects: +# stewardship_domain_special_1301_increase_road_progress_effect - Advances the event chain onto the next step. +# stewardship_domain_special_1301_increase_road_quality_effect - Improves the final outcome of the event chain when it completes. +# stewardship_domain_special_1301_decrease_road_quality_effect - Worsens the final outcome of the event chain when it completes. +# stewardship_domain_special_1301_automatic_progress_effect - Used to automatically progress the road's construction over time, without the need to fire repetitive events. +# stewardship_domain_special_1301_road_building_event_effect - Fires a random event in the event chain. +# +# Paton Effects: +# stewardship_duty_1062_get_client_effect - If a valid $FLAG$ courtier exists in the pool, save their scope so we don't need to create a new one. +# stewardship_duty_1062_create_philosopher_effect - Creates a courtier with the philosopher $FLAG$ and appropriate skills. +# stewardship_duty_1062_create_gardener_effect - Creates a courtier with the gardener $FLAG$ and appropriate skills. +# stewardship_duty_1062_create_poet_effect - Creates a courtier with the poet $FLAG$ and appropriate skills. +# stewardship_duty_1064_extend_patronage_term_effect - Extends the patronage contract for 5 years. +# stewardship_duty_1064_remove_patrons_buff_effect - Cleans up residual effects from the patronage contract if it ends early. +# +# Domesday Book Effects: +# stewardship_domain_special_1500_apply_domesday_effects - Braching script structure to apply all correct effects at the conclusion of the event chain. +# stewardship_domain_special_1500_apply_domesday_effects_2 - Script sub-structure called within the above effect, but with differing parameters based on what happened during the event chain. +# stewardship_domain_special_1500_apply_domesday_effects_3 - Script sub-structure called within the above effect, but with differing parameters based on what happened during the event chain. +# stewardship_domain_special_1500_increase_quality_effect - Improves the final outcome of the event chain when it completes. +# stewardship_domain_special_1500_decrease_quality_effect - Worstens the final outcome of the event chain when it completes. +# stewardship_domain_special_1500_domesday_cleanup - Removes all tracking variables & flags for the event chain once it has concluded. + +# sell_titles_grant_sufficient_gold_effect - gives the character sufficient gold to pay root + + +stewardship_duty_special_2000_sc_mediation_saved_scopes_effect = { + scope:story = { + var:vassal_1 = { + save_scope_as = vassal_1 + } + var:vassal_2 = { + save_scope_as = vassal_2 + } + } +} + +stewardship_duty_special_2000_sc_mediation_increase_s1_event_count_effect = { + scope:story = { + change_variable = { + name = num_of_stage_1_events + add = 1 + } + } +} + +stewardship_duty_special_2000_sc_mediation_increase_s2_event_count_effect = { + scope:story = { + change_variable = { + name = num_of_stage_2_events + add = 1 + } + } +} + +stewardship_duty_special_2000_sc_mediation_get_random_quarreler_effect = { + scope:story = { + var:vassal_1 = { + add_to_temporary_list = quarrelers + } + var:vassal_2 = { + add_to_temporary_list = quarrelers + } + } + random_in_list = { + list = quarrelers + save_scope_as = quarreler + } +} + +#Effects used in Lifestyle Focus events + + + +# stewardship_duty.1200 +stewardship_duty_special_1201_map_painting_journey_continuation_effect = { + hidden_effect = { + random_list = { + 70 = { + trigger_event = { + on_action = map_painting_event_selection + days = { 5 15 } + } + } + 30 = { + modifier = { + add = 30 + exists = scope:had_1203 + } + modifier = { + add = 30 + exists = scope:had_1204 + } + modifier = { + add = 30 + exists = scope:had_1205 + } + modifier = { + add = 30 + exists = scope:had_1206 + } + modifier = { + add = 30 + exists = scope:had_1207 + } + modifier = { + add = 30 + exists = scope:had_1208 + } + trigger_event = { + on_action = map_painting_outcome + days = { 5 15 } + } + } + } + } + custom_tooltip = stewardship_duty_special.1201.continue_tooltip +} + +#Used to clear flags and variables from the map painting rank up chain (intrigue_scheming_rare.1201) +stewardship_duty_special_1201_conclude_map_painting_effect = { + hidden_effect = { + remove_character_flag = is_in_stewardship_domain_special_event + } +} + + +#Scripted effects for the road building event chain: +stewardship_domain_special_1301_increase_road_progress_effect = { + set_variable = { + name = governance_road_progress + value = scope:road_progress + } + change_variable = { + name = governance_road_progress + add = 1 + } + save_scope_value_as = { + name = road_progress + value = var:governance_road_progress + } +} + +#Decrease road progress + + +#Increase road quality +stewardship_domain_special_1301_increase_road_quality_effect = { + set_variable = { + name = governance_road_quality + value = scope:road_quality + } + change_variable = { + name = governance_road_quality + add = 1 + } + save_scope_value_as = { + name = road_quality + value = var:governance_road_quality + } +} + + +#Decrease road quality +stewardship_domain_special_1301_decrease_road_quality_effect = { + set_variable = { + name = governance_road_quality + value = scope:road_quality + } + change_variable = { + name = governance_road_quality + add = -1 + } + save_scope_value_as = { + name = road_quality + value = var:governance_road_quality + } +} + + +stewardship_domain_special_1301_automatic_progress_effect = { + hidden_effect = { + random_list = { + 10 = { } + 10 = { + stewardship_domain_special_1301_increase_road_progress_effect = yes + } + 10 = { + stewardship_domain_special_1301_increase_road_progress_effect = yes + stewardship_domain_special_1301_increase_road_quality_effect = yes + } + 1 = { + stewardship_domain_special_1301_increase_road_progress_effect = yes + stewardship_domain_special_1301_increase_road_quality_effect = yes + scope:project_leader = { + add_stewardship_skill = 1 + } + } + } + } +} + +stewardship_domain_special_1301_road_building_event_effect = { + hidden_effect = { + trigger_event = { + on_action = stewardship_road_building_chain + days = { 30 60 } + } + } +} + +##################### +# Patronage Effects # +##################### +stewardship_duty_1062_get_client_effect = { + #If a suitable candidate was generated earlier, select them as an option. + + if = { + limit = { + any_pool_character = { + province = root.capital_province + has_character_flag = $FLAG$ + faith = root.faith + culture = { has_same_culture_heritage = root.culture } + age < 45 + NOT = { has_character_flag = stewardship_duty_1062_already_being_considered } + } + } + random_pool_character = { + province = root.capital_province + limit = { + has_character_flag = $FLAG$ + faith = root.faith + culture = { has_same_culture_heritage = root.culture } + age < 45 + NOT = { has_character_flag = stewardship_duty_1062_already_being_considered } + } + add_character_flag = { + flag = stewardship_duty_1062_already_being_considered + days = 10 + } + save_scope_as = $CLIENT_SCOPE$ + } + } +} + +stewardship_duty_1062_create_philosopher_effect = { + #Create a character with high learning to be our philosopher. + random_dummy_gender_scholar_effect = yes + create_character = { + location = root.capital_province + age = { 25 35 } + gender = scope:dummy_scholar_gender + trait = education_learning_2 + trait = shrewd + faith = root.faith + culture = root.culture + learning = { 10 12 } + save_scope_as = $CLIENT_SCOPE$ + } + scope:$CLIENT_SCOPE$ = { + add_character_flag = governance_1062_philosopher_flag + add_character_flag = { + flag = stewardship_duty_1062_already_being_considered + days = 10 + } + } +} + +stewardship_duty_1062_create_gardener_effect = { + #Create a character with decent stewardship and intelligence to be our gardener. + random_dummy_gender_servant_effect = yes + create_character = { + location = root.capital_province + age = { 25 35 } + gender = scope:dummy_servant_gender + trait = education_stewardship_1 + trait = diligent + trait = patient + faith = root.faith + culture = root.culture + learning = { 8 10 } + stewardship = { 8 10 } + save_scope_as = $CLIENT_SCOPE$ + } + scope:$CLIENT_SCOPE$ = { + add_character_flag = governance_1062_gardener_flag + add_character_flag = { + flag = stewardship_duty_1062_already_being_considered + days = 10 + } + } +} + +stewardship_duty_1062_create_poet_effect = { + #Create a character with high Diplomacy to be our poet. + random_dummy_gender_scholar_effect = yes + create_character = { + location = root.capital_province + age = { 25 35 } + gender = scope:dummy_scholar_gender + trait = education_diplomacy_2 + trait = gregarious + trait = zealous + trait = lifestyle_poet + faith = root.faith + culture = root.culture + diplomacy = { 10 12 } + save_scope_as = $CLIENT_SCOPE$ + } + scope:$CLIENT_SCOPE$ = { + add_character_flag = governance_1062_poet_flag + add_character_flag = { + flag = stewardship_duty_1062_already_being_considered + days = 10 + } + } +} + +stewardship_duty_1064_extend_patronage_term_effect = { + if = { + limit = { + $CLIENT$ = { + has_character_flag = governance_1062_gardener_flag + } + } + add_character_modifier = { + modifier = governance_1062_immaculate_gardens_modifier + years = 5 + } + } + else_if = { + limit = { + $CLIENT$ = { + has_character_flag = governance_1062_poet_flag + } + } + add_character_modifier = { + modifier = governance_1062_religious_tapestries_modifier + years = 5 + } + } + else_if = { + limit = { + $CLIENT$ = { + has_character_flag = governance_1062_philosopher_flag + } + } + add_character_modifier = { + modifier = governance_1062_natural_philosopher_modifier + years = 5 + } + } +} + +stewardship_duty_1064_remove_patrons_buff_effect = { + if = { + limit = { + $CLIENT$ = { + var:stewardship_duty_1062_employer = { + has_character_modifier = governance_1062_immaculate_gardens_modifier + } + } + } + $CLIENT$ = { + var:stewardship_duty_1062_employer = { + remove_character_modifier = governance_1062_immaculate_gardens_modifier + } + } + } + else_if = { + limit = { + $CLIENT$ = { + var:stewardship_duty_1062_employer = { + has_character_modifier = governance_1062_religious_tapestries_modifier + } + } + } + $CLIENT$ = { + var:stewardship_duty_1062_employer = { + remove_character_modifier = governance_1062_religious_tapestries_modifier + } + } + } + else_if = { + limit = { + $CLIENT$ = { + var:stewardship_duty_1062_employer = { + has_character_modifier = governance_1062_natural_philosopher_modifier + } + } + } + $CLIENT$ = { + var:stewardship_duty_1062_employer = { + remove_character_modifier = governance_1062_natural_philosopher_modifier + } + } + } + + #Removes the reference to our employer now that we're no longer working for them. + $CLIENT$ = { + remove_variable = stewardship_duty_1062_employer + } +} + +######################### +# Domesday Book Effects # +######################### + +#The following series of effects are used to calculate the ultimate impact of the domesday event chain on all of your provinces. +#These are divided up into 3 sequential effects which will each check one possible factor to determine what that's factor's impact +#on the final outcome will be, before the effect fires off the next effect in the sequence. + +#Determine which custom county localisation we should use, based on whether or not any counties have been excluded. +stewardship_domain_special_1500_apply_domesday_effects = { + #If any counties have been excluded at all, specify that they will not receive the bonus. + if = { + limit = { + any_in_list = { + list = excluded_counties + exists = this + } + } + stewardship_domain_special_1500_apply_domesday_effects_2 = { + CUSTOM_TEXT = stewardship_domain_special.1590.every_nonexcluded_county + } + } + #If no counties have been excluded from the survey, specify that all counties will receive the bonus. + else = { + stewardship_domain_special_1500_apply_domesday_effects_2 = { + CUSTOM_TEXT = stewardship_domain_special.1590.every_county + } + } +} + +#Determine which modifier we will apply to our counties, based on the total quality score accumulated during the event chain. +stewardship_domain_special_1500_apply_domesday_effects_2 = { + #All non-excluded counties receive the excellent quality modifier. + if = { + limit = { + var:stewardship_domain_special_1500_domesday_quality >= stewardship_domain_special_1500_domesday_excellent_quality + } + stewardship_domain_special_1500_apply_domesday_effects_3 = { + CUSTOM_TEXT = $CUSTOM_TEXT$ + DOMESDAY_ASSESSMENT = stewardship_domain_special_1500_excellent_quality_assessment + INCREASE_CONTROL = 20 + } + } + #All non-excluded counties receive the high quality modifier. + else_if = { + limit = { + var:stewardship_domain_special_1500_domesday_quality >= stewardship_domain_special_1500_domesday_high_quality + } + stewardship_domain_special_1500_apply_domesday_effects_3 = { + CUSTOM_TEXT = $CUSTOM_TEXT$ + DOMESDAY_ASSESSMENT = stewardship_domain_special_1500_high_quality_assessment + INCREASE_CONTROL = 15 + } + } + #All non-excluded-counties receive the mediocre quality modifier. + else = { + stewardship_domain_special_1500_apply_domesday_effects_3 = { + CUSTOM_TEXT = $CUSTOM_TEXT$ + DOMESDAY_ASSESSMENT = stewardship_domain_special_1500_mediocre_quality_assessment + INCREASE_CONTROL = 10 + } + } + #If the quality level of the survey is poor, no counties will receive any modifier. +} + +#Determine whether to use the distributed records effect or the no records effect, based on which option the player picked during the final event. +stewardship_domain_special_1500_apply_domesday_effects_3 = { + every_in_list = { + list = non_excluded_counties + custom = $CUSTOM_TEXT$ + + #Apply only the survey modifier to eligible counties. + change_county_control = $INCREASE_CONTROL$ + add_county_modifier = { + modifier = $DOMESDAY_ASSESSMENT$ + days = 1825 + } + + } +} + +#These following two effects increase or decrease the variable which keeps track of the survey's quality. +#Taking a penalty to the quality level hurts more than gaining a bonus, so the player needs to be judicious +#when determining if what they gain from accepting a penalty is worth the trade-off. + +#Increase domesday quality +stewardship_domain_special_1500_increase_quality_effect = { + change_variable = { + name = stewardship_domain_special_1500_domesday_quality + add = 1 + } + custom_tooltip = stewardship_domain_special.1500.quality_increase.tt +} + + +#Decrease domesday quality +stewardship_domain_special_1500_decrease_quality_effect = { + change_variable = { + name = stewardship_domain_special_1500_domesday_quality + add = -2 + } + custom_tooltip = stewardship_domain_special.1500.quality_decrease.tt +} + +#This effect is used at the end of the Domesday event chain to clean up any remaining variables/flags. +stewardship_domain_special_1500_domesday_cleanup = { + remove_character_flag = is_in_stewardship_domain_special_event + remove_variable = stewardship_domain_special_1500_domesday_is_active + remove_variable = stewardship_domain_special_1500_domesday_assessors_protected + remove_variable = stewardship_domain_special_1500_remaining_random_events + remove_variable = stewardship_domain_special_1500_domesday_quality + remove_variable = stewardship_domain_special_1500_last_random_event + remove_variable = stewardship_domain_special_1500_domesday_is_active +} + + +sell_titles_grant_sufficient_gold_effect = { + hidden_effect = { + if = { + limit = { + short_term_gold < $AMOUNT$ + } + add_gold = $AMOUNT$ + } + } +} diff --git a/N3OW/common/scripted_effects/00_stewardship_perk_effects.txt b/N3OW/common/scripted_effects/00_stewardship_perk_effects.txt new file mode 100644 index 00000000..1702fd01 --- /dev/null +++ b/N3OW/common/scripted_effects/00_stewardship_perk_effects.txt @@ -0,0 +1,124 @@ + +# Effects used by Perks in the Stewardship Lifestyle + +# extort_subjects_effect: Fires an extortion event for a suitable subject + +extort_subjects_effect = { + random_list = { + 10 = { # A Powerful Vassal + trigger = { + any_powerful_vassal = { + extortion_powerful_vassal_trigger = yes + } + } + save_temporary_scope_value_as = { + name = found_suitable_target + value = yes + } + random_powerful_vassal = { + limit = { + extortion_powerful_vassal_trigger = yes + } + save_scope_as = extortion_target + } + trigger_event = subject_extortion.0001 + } + 5 = { # A County + trigger = { + is_ai = no # So that this doesn't wreak havoc in the player's realm + any_held_title = { + extortion_county_trigger = yes + } + } + save_temporary_scope_value_as = { + name = found_suitable_target + value = yes + } + random_held_title = { + limit = { + extortion_county_trigger = yes + } + save_scope_as = extortion_target + } + trigger_event = subject_extortion.0002 + } + 10 = { # Theocratic Vassals + trigger = { + NOR = { has_character_flag = recently_extorted_theocratic_vassals } + any_vassal = { + extortion_theocratic_vassal_trigger = yes + } + } + save_temporary_scope_value_as = { + name = found_suitable_target + value = yes + } + random_vassal = { + limit = { + extortion_theocratic_vassal_trigger = yes + } + save_scope_as = extortion_target + } + trigger_event = subject_extortion.0003 + } + 5 = { # Vassals at Large + trigger = { + NOT = { has_character_flag = recently_extorted_vassals_at_large } + any_vassal = { + extortion_vassal_at_large_trigger = yes + } + } + save_temporary_scope_value_as = { + name = found_suitable_target + value = yes + } + random_vassal = { + limit = { + is_powerful_vassal = no + extortion_vassal_at_large_trigger = yes + } + alternative_limit = { + extortion_vassal_at_large_trigger = yes + } + save_scope_as = extortion_target + } + trigger_event = subject_extortion.0004 + } + 5 = { # Courtiers + trigger = { + NOT = { has_character_flag = recently_extorted_courtiers } + any_courtier = { + extortion_courtier_representative_trigger = yes + } + } + save_temporary_scope_value_as = { + name = found_suitable_target + value = yes + } + random_courtier = { + limit = { + extortion_courtier_representative_trigger = yes + } + save_scope_as = extortion_target + } + trigger_event = subject_extortion.0005 + } + } + + # Fallback in case no-one could be found + if = { + limit = { + NOT = { exists = scope:found_suitable_target } + } + trigger_event = subject_extortion.9998 + } +} + + +extortion_tracking_effect = { + set_variable = { + name = was_recently_extorted + value = yes + days = 1825 + } +} \ No newline at end of file diff --git a/N3OW/common/scripted_effects/00_story_cycle_same_gender_pen_pal_effects.txt b/N3OW/common/scripted_effects/00_story_cycle_same_gender_pen_pal_effects.txt new file mode 100644 index 00000000..a8b6cea0 --- /dev/null +++ b/N3OW/common/scripted_effects/00_story_cycle_same_gender_pen_pal_effects.txt @@ -0,0 +1,127 @@ + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! + + +##################################################################### +# EFFECTS +##################################################################### + +#Bring up opinion to at least 20 (They can't start out with less than -30) +test_m_1001_opinion_setting_effect = { + if = { #-30 to -16 + limit = { + opinion = { + target = $CHARACTER$ + value < -15 + } + } + add_opinion = { + target = $CHARACTER$ + modifier = respect_opinion + opinion = 50 + } + } + else_if = { # -15 to -1 + limit = { + opinion = { + target = $CHARACTER$ + value < -0 + } + } + add_opinion = { + target = $CHARACTER$ + modifier = respect_opinion + opinion = 35 + } + } + else_if = { #0 to 19 + limit = { + opinion = { + target = $CHARACTER$ + value < 20 + } + } + add_opinion = { + target = $CHARACTER$ + modifier = respect_opinion + opinion = 20 + } + } +} + +test_m_1100_options_effect = { + random_list = { + 100 = { + trigger = { NOT = { has_character_flag = test_m_1100_pregnancy_option } } + add_character_flag = test_m_1100_pregnancy_option + } + 1 = { + trigger = { NOT = { has_character_flag = test_m_1100_seduction_option } } + add_character_flag = test_m_1100_seduction_option + } + 1 = { + trigger = { NOT = { has_character_flag = test_m_1100_stress_option } } + add_character_flag = test_m_1100_stress_option + } + 1 = { + trigger = { NOT = { has_character_flag = test_m_1100_unhappy_marriage_option } } + add_character_flag = test_m_1100_unhappy_marriage_option + random_spouse = { + save_scope_as = spouse + } + } + 1 = { + trigger = { NOT = { has_character_flag = test_m_1100_regular_marriage_option } } + add_character_flag = test_m_1100_regular_marriage_option + random_spouse = { + save_scope_as = spouse + } + } + 1 = { + trigger = { + NOT = { has_character_flag = test_m_1100_raising_children_option } + any_child = { is_alive = yes } + } + add_character_flag = test_m_1100_raising_children_option + } + 1 = { + trigger = { + NOT = { has_character_flag = test_m_1100_secret_lover_option } + any_secret = { + type = secret_lover + secret_target = { is_alive = yes } + } + } + add_character_flag = test_m_1100_secret_lover_option + random_secret = { + type = secret_lover + limit = { + secret_target = { is_alive = yes } + } + secret_target = { save_scope_as = secret_lover } + } + } + } +} + +test_m_1100_clear_flags_effect = { + remove_character_flag = test_m_1100_pregnancy_option + remove_character_flag = test_m_1100_seduction_option + remove_character_flag = test_m_1100_stress_option + remove_character_flag = test_m_1100_unhappy_marriage_option + remove_character_flag = test_m_1100_regular_marriage_option + remove_character_flag = test_m_1100_raising_children_option + remove_character_flag = test_m_1100_secret_lover_option +} + +#Things to handle through other events: +# someone you fancy +# birthday gift +# happy new baby +# abortion +# rich friend helps poor friend +# best skill +# recent death support (both?) \ No newline at end of file diff --git a/N3OW/common/scripted_effects/00_stress_effects.txt b/N3OW/common/scripted_effects/00_stress_effects.txt new file mode 100644 index 00000000..1f2c1932 --- /dev/null +++ b/N3OW/common/scripted_effects/00_stress_effects.txt @@ -0,0 +1,1013 @@ +#Effects used in Stress events + +##################################################################### +# EFFECT LIST +##################################################################### +# +# By Sean Hughes: +# stress_threshold_event_aftereffects - Runs all post-event cleanup and pre-event setup to ensure the stress system keeps working without any breaks. +# remove_stress_threshold_option_flags_effect – Cleans up all flags which may have been applied to a character for the purpose of calculating which event options get offered to the player. +# contrite_get_secret_scopes_effect – Setup for 'contrite_get_secret_scopes_effect', should be run in immediate. +# contrite_reveal_secrets_effect – Reduces stress, but exposes one or more of your secrets. +# rakish_brothel_night_effect – Reduces stress, but has a high chance to contract STDs. +# reclusive_get_relationships_effect – setup for 'reclusive_damage_relationship_effect', should be run in the immediate. +# reclusive_damage_relationships_effect – Reduces stress, but damages a positive relationship you have with someone. +# inappetetic_advance_starvation_effect – Reduces stress, but applies a skill and health penalty. +# stress_replace_personality_trait_with_opposite_effect – Takes a personality trait, will add the trait and find an appropraite trait to remove to make space for it. +# stress_prison_remove_ordered_personality_trait_effect – Part of the above. Removes a personaliy trait based on an ordered list designed to be used in prison. +# stress_unimprisoned_remove_ordered_personality_trait_effect — Part of the above. Removes a personaliy trait based on an ordered list designed to be used outside of prison. +# stress_save_deceased_character_for_mental_break — Saves a character as a variable for a mental break event to reference them later. Does not actually trigger a mental break. + + +# Must be run at the end of 'immediate' in EVERY stress threshold event, to ensure all tasks the system expects to execute are done properly. +stress_threshold_event_post_immediate = { + + # Record the character's current stress level (must be done in the immediate so that if a character's stress level changes before 'after' executes we still apply the correct cooldowns). + if = { + limit = { + stress_level >= 3 + } + add_character_flag = apply_stress_threshold_cooldown_level_3 + } + else_if = { + limit = { + stress_level >= 2 + } + add_character_flag = apply_stress_threshold_cooldown_level_2 + } + else_if = { + limit = { + stress_level >= 1 + } + add_character_flag = apply_stress_threshold_cooldown_level_1 + } +} + +# Must be run in the 'after' EVERY stress threshold event, to ensure all tasks the system expect to execute are done properly. +stress_threshold_event_aftereffects = { + if = { + limit = { + is_alive = yes + } + + # Clean up all event option flags. + remove_stress_threshold_option_flags_effect = yes + + # Based on the character's recorded stress level, apply the appropraite cooldown flag for the cooldown duration - 1 days. + if = { + limit = { + has_character_flag = apply_stress_threshold_cooldown_level_3 + } + add_character_flag = { + flag = stress_threshold_event_3_cooldown + days = stress_threshold_cooldown_duration # 1 day less than 5 years (8 with Perk) + } + } + else_if = { + limit = { + has_character_flag = apply_stress_threshold_cooldown_level_2 + } + add_character_flag = { + flag = stress_threshold_event_2_cooldown + days = stress_threshold_cooldown_duration # 1 day less than 5 years (8 with Perk) + } + } + else = { + add_character_flag = { + flag = stress_threshold_event_1_cooldown + days = stress_threshold_cooldown_duration # 1 day less than 5 years (8 with Perk) + } + } + + # Remove the character's recorded stress level flags. + remove_character_flag = apply_stress_threshold_cooldown_level_3 + remove_character_flag = apply_stress_threshold_cooldown_level_2 + remove_character_flag = apply_stress_threshold_cooldown_level_1 + + # Schedule a new stress event to occur after the cooldown duration has elapsed. + trigger_event = { + id = stress_threshold.0005 + days = stress_threshold_second_check_timing # 5 year maximum between events (8 with Perk) + } + + # Warn the player that they will receive another event if they are still Stressed. + custom_tooltip = stress_threshold_cooldown_message + } +} + +# Clears all 'stress_threshold_option_xxx' flags from a character so that they will get the correct options offered to them the next time they get a stress threshold event. +remove_stress_threshold_option_flags_effect = { + remove_character_flag = stress_threshold_option_drunkard + remove_character_flag = stress_threshold_option_hashishiyah + remove_character_flag = stress_threshold_option_rakish + remove_character_flag = stress_threshold_option_reclusive + remove_character_flag = stress_threshold_option_irritable + remove_character_flag = stress_threshold_option_flagellant + remove_character_flag = stress_threshold_option_profligate + remove_character_flag = stress_threshold_option_improvident + remove_character_flag = stress_threshold_option_contrite + remove_character_flag = stress_threshold_option_comfort_eater + remove_character_flag = stress_threshold_option_inappetetic + remove_character_flag = stress_threshold_option_journaller + remove_character_flag = stress_threshold_option_confider + remove_character_flag = stress_threshold_option_athletic + remove_character_flag = stress_threshold_option_conversion + remove_character_flag = stress_threshold_option_depression + remove_character_flag = stress_threshold_option_burdened +} + +# Setup for 'contrite_reveal_secrets_effect'. Checks what secrets we have and save their scopes so the option tooltip is consistent and correct. +# While preferable to have some, it is okay if we don't have any, as we have a fallback in the option itself. +contrite_get_secret_scopes_effect = { + + random_secret = { + limit = { + is_criminal_for = root + can_be_exposed_by = root + } + save_scope_as = confessed_secret # The first secret must be criminal. + } + if = { + limit = { + exists = scope:confessed_secret + any_secret = { + this != scope:confessed_secret + can_be_exposed_by = root + } + } + random_secret = { + limit = { + this != scope:confessed_secret + can_be_exposed_by = root + } + save_scope_as = second_confessed_secret # The second secret can be anything as long as it is different from the first. + } + } +} + +# Requires 'contrite_get_secret_scopes_effect' to be run first. Reveals one or more secrets you know or, if you have none, applies a general opinion modifier to you and reduces stress. +contrite_reveal_secrets_effect = { + # The more secrets you have to confess, the more stress reduction you get! + if = { + limit = { + exists = scope:confessed_secret + scope:confessed_secret = { can_be_exposed_by = root } + } + scope:confessed_secret = { + expose_secret = root + } + if = { + limit = { + exists = scope:second_confessed_secret + scope:second_confessed_secret = { can_be_exposed_by = root } + } + scope:second_confessed_secret = { + expose_secret = root + } + add_stress = massive_stress_impact_loss # Revealing both a Criminal secret and a 2nd secret gives us a lot of Stress Reduction. + } + else = { + add_stress = major_stress_impact_loss # Revealing only a Criminal secret still gives us a lot of Stress Reduction. + } + } + else_if = { + limit = { + exists = scope:second_confessed_secret + scope:second_confessed_secret = { can_be_exposed_by = root } + } + scope:second_confessed_secret = { + expose_secret = root + } + add_stress = medium_stress_impact_loss # Revealing only a non-Criminal secret gives us less Stress Reduction. + } + # If you have no secrets, you reveal a 'minor secret' about yourself (not something which is a real Secret, but something still disturbing enough to make people uncomfortable). + else = { + add_character_modifier = { + modifier = stress_disturbing_confession + years = 3 + } + add_stress = medium_stress_impact_loss + } +} + +# Applies the effects of a one-night debauchery spree in a brothel. +# (Does not use "had_sex_with_unknown_effect" since we want a higher risk of STDs) +rakish_brothel_night_effect = { + # Warn the character about possible negative consequences. + custom_tooltip = stress_threshold.1011.rakish.tt + + # Negative consequences of the night. + random_list = { + 50 = { + trigger = { + is_attracted_to_men = yes + } + set_variable = { + name = had_recent_sex + value = flag:male + } + give_homosexual_secret_or_nothing_with_target_effect = { CHARACTER = dummy_male } + } + 50 = { + trigger = { + is_attracted_to_women = yes + } + set_variable = { + name = had_recent_sex + value = flag:female + } + } + } + hidden_effect = { + #Adultery suspicion + random = { + chance = 5 + random_spouse = { + limit = { is_ai = no } + alternative_limit = { always = yes } + trigger_event = adultery.0001 + } + } + + # Possible STD transmission + random_list = { + 75 = { + #Nothing + } + 20 = { + contract_disease_notify_effect = { DISEASE = lovers_pox } + } + 5 = { + contract_disease_notify_effect = { DISEASE = great_pox } + } + } + + #Possibility to start peasant story cycle + random = { + chance = 5 + if = { + limit = { + NOT = { has_character_flag = had_story_cycle_peasant_affair } + is_ruler = yes + is_ai = no + } + create_character = { + location = root.capital_province + template = beautiful_peasant_character + gender_female_chance = root_attraction_based_female_chance + faith = root.faith + culture = root.culture + save_scope_as = beautiful_peasant + } + scope:beautiful_peasant = { + set_sexuality = bisexual + } + if = { + limit = { + is_male = yes + exists = scope:beautiful_peasant + scope:beautiful_peasant = { + is_female = yes + age < define:NChildbirth|MAX_FEMALE_REPRODUCTION_AGE + } + } + random = { + chance = pregnancy_chance + scope:beautiful_peasant = { + add_character_flag = { + flag = peasant_is_pregnant + days = 560 + } + } + } + } + set_variable = { + name = story_peasant_affair_target + value = scope:beautiful_peasant + } + set_variable = { #To save how you met + name = rakish_night + value = 0 + } + create_story = story_peasant_affair + } + } + } + + add_stress = major_stress_impact_loss +} + + +# Check what relationships we have and save their scopes for 'reclusive_damage_relationships_effect' so that the option tooltip is consistent and correct. +# While preferable to have some, it is okay if we don't have any, as we have a fallback in the option itself. +reclusive_get_relationships_effect = { + if = { + limit = { + any_relation = { type = friend } + } + random_relation = { + type = friend + save_scope_as = lost_friend + } + } + else_if = { + limit = { + any_relation = { type = lover } + } + random_relation = { + type = lover + save_scope_as = lost_lover + } + } + else_if = { + limit = { + any_spouse = { + exists = this + } + } + random_spouse = { + save_scope_as = neglected_spouse + } + } +} + +# Requires 'reclusive_get_relationships_effect' to be run first (preferably in the immediate). Hurts the opinion of someone important to us and relieves stress. +reclusive_damage_relationships_effect = { + if = { + limit = { + exists = scope:lost_friend + scope:lost_friend = { is_alive = yes } + has_relation_friend = scope:lost_friend + } + remove_relation_friend = scope:lost_friend + add_stress = medium_stress_impact_loss + } + else_if = { + limit = { + exists = scope:lost_lover + scope:lost_lover = { is_alive = yes } + has_relation_lover = scope:lost_lover + } + remove_relation_lover = scope:lost_lover + add_stress = medium_stress_impact_loss + } + else_if = { + limit = { + exists = scope:neglected_spouse + scope:neglected_spouse = { is_alive = yes } + any_consort = { this = scope:neglected_spouse } + } + scope:neglected_spouse = { + add_opinion = { + modifier = neglected_opinion + target = root + opinion = -25 + } + } + add_stress = medium_stress_impact_loss + } + else = { + add_stress = minor_stress_impact_loss + } +} + +# Adds increasingly severe starvation penalties to a character. +inappetetic_advance_starvation_effect = { + if = { + limit = { + has_character_modifier = stress_inappetetic_hunger_3 + } + death = { death_reason = death_malnourishment } + } + else_if = { + limit = { + has_character_modifier = stress_inappetetic_hunger_2 + } + remove_character_modifier = stress_inappetetic_hunger_2 + add_character_modifier = { + modifier = stress_inappetetic_hunger_3 + years = 3 + } + } + else_if = { + limit = { + has_character_modifier = stress_inappetetic_hunger_1 + } + remove_character_modifier = stress_inappetetic_hunger_1 + add_character_modifier = { + modifier = stress_inappetetic_hunger_2 + years = 3 + } + } + else = { + add_character_modifier = { + modifier = stress_inappetetic_hunger_1 + years = 3 + } + } +} + +stress_get_victim_in_court_effect = { + if = { + limit = { + any_courtier = { + exists = this + is_imprisoned = no + } + } + random_courtier = { + limit = { + is_imprisoned = no + exists = root.player_heir + this = root.player_heir + } + alternative_limit = { + is_imprisoned = no + is_child_of = root + } + alternative_limit = { + is_imprisoned = no + is_spouse_of = root + } + alternative_limit = { + is_imprisoned = no + } + + save_scope_as = victim + } + } +} + +# Removes an existing personality trait and replace it with a 'negative' personality trait (though could conceivably be used with any personality trait). +# Designed for use in prison or high-stress situations. +stress_replace_personality_trait_with_opposite_effect = { + if = { + limit = { + flag:$TRAIT$ = flag:lustful + has_trait = chaste + } + remove_trait = chaste + } + else_if = { + limit = { + flag:$TRAIT$ = flag:chaste + has_trait = lustful + } + remove_trait = lustful + } + else_if = { + limit = { + flag:$TRAIT$ = flag:gluttonous + has_trait = temperate + } + remove_trait = temperate + } + else_if = { + limit = { + flag:$TRAIT$ = flag:temperate + has_trait = gluttonous + } + remove_trait = gluttonous + } + else_if = { + limit = { + flag:$TRAIT$ = flag:greedy + has_trait = generous + } + remove_trait = generous + } + else_if = { + limit = { + flag:$TRAIT$ = flag:generous + has_trait = greedy + } + remove_trait = greedy + } + else_if = { + limit = { + flag:$TRAIT$ = flag:lazy + has_trait = diligent + } + remove_trait = diligent + } + else_if = { + limit = { + flag:$TRAIT$ = flag:diligent + has_trait = lazy + } + remove_trait = lazy + } + else_if = { + limit = { + flag:$TRAIT$ = flag:wrathful + has_trait = calm + } + remove_trait = calm + } + else_if = { + limit = { + flag:$TRAIT$ = flag:calm + has_trait = wrathful + } + remove_trait = wrathful + } + else_if = { + limit = { + flag:$TRAIT$ = flag:patient + has_trait = impatient + } + remove_trait = impatient + } + else_if = { + limit = { + flag:$TRAIT$ = flag:impatient + has_trait = patient + } + remove_trait = patient + } + else_if = { + limit = { + flag:$TRAIT$ = flag:arrogant + has_trait = humble + } + remove_trait = humble + } + else_if = { + limit = { + flag:$TRAIT$ = flag:humble + has_trait = arrogant + } + remove_trait = arrogant + } + else_if = { + limit = { + flag:$TRAIT$ = flag:deceitful + has_trait = honest + } + remove_trait = honest + } + else_if = { + limit = { + flag:$TRAIT$ = flag:honest + has_trait = deceitful + } + remove_trait = deceitful + } + else_if = { + limit = { + flag:$TRAIT$ = flag:craven + has_trait = brave + } + remove_trait = brave + } + else_if = { + limit = { + flag:$TRAIT$ = flag:brave + has_trait = craven + } + remove_trait = craven + } + else_if = { + limit = { + flag:$TRAIT$ = flag:shy + has_trait = gregarious + } + remove_trait = gregarious + } + else_if = { + limit = { + flag:$TRAIT$ = flag:gregarious + has_trait = shy + } + remove_trait = shy + } + else_if = { + limit = { + flag:$TRAIT$ = flag:ambitious + has_trait = content + } + remove_trait = content + } + else_if = { + limit = { + flag:$TRAIT$ = flag:content + has_trait = ambitious + } + remove_trait = ambitious + } + else_if = { + limit = { + flag:$TRAIT$ = flag:arbitrary + has_trait = just + } + remove_trait = just + } + else_if = { + limit = { + flag:$TRAIT$ = flag:just + has_trait = arbitrary + } + remove_trait = arbitrary + } + else_if = { + limit = { + flag:$TRAIT$ = flag:cynical + has_trait = zealous + } + remove_trait = zealous + } + else_if = { + limit = { + flag:$TRAIT$ = flag:zealous + has_trait = cynical + } + remove_trait = cynical + } + else_if = { + limit = { + flag:$TRAIT$ = flag:paranoid + has_trait = trusting + } + remove_trait = trusting + } + else_if = { + limit = { + flag:$TRAIT$ = flag:trusting + has_trait = paranoid + } + remove_trait = paranoid + } + else_if = { + limit = { + flag:$TRAIT$ = flag:compassionate + OR = { + has_trait = callous + has_trait = sadistic + } + } + remove_trait = callous + remove_trait = sadistic + } + else_if = { + limit = { + flag:$TRAIT$ = flag:callous + has_trait = compassionate + } + remove_trait = compassionate + } + else_if = { + limit = { + flag:$TRAIT$ = flag:sadistic + has_trait = compassionate + } + remove_trait = compassionate + } + else_if = { + limit = { + flag:$TRAIT$ = flag:stubborn + has_trait = fickle + } + remove_trait = fickle + } + else_if = { + limit = { + flag:$TRAIT$ = flag:fickle + has_trait = stubborn + } + remove_trait = stubborn + } + else_if = { + limit = { + flag:$TRAIT$ = flag:vengeful + has_trait = forgiving + } + remove_trait = forgiving + } + else_if = { + limit = { + flag:$TRAIT$ = flag:forgiving + has_trait = vengeful + } + remove_trait = vengeful + } + else = { + if = { + limit = { + is_imprisoned = yes + } + stress_prison_remove_ordered_personality_trait_effect = yes + } + else = { + stress_unimprisoned_remove_ordered_personality_trait_effect = yes + } + } + add_trait_force_tooltip = $TRAIT$ +} + +# Removes one personality trait from a character, ordered based on what makes more sense for a character to lose while in prison. +stress_prison_remove_ordered_personality_trait_effect = { + if = { + limit = { has_trait = forgiving } + remove_trait = forgiving + } + else_if = { + limit = { has_trait = trusting } + remove_trait = trusting + } + else_if = { + limit = { has_trait = lustful } + remove_trait = lustful + } + else_if = { + limit = { has_trait = arrogant } + remove_trait = arrogant + } + else_if = { + limit = { has_trait = gregarious } + remove_trait = gregarious + } + else_if = { + limit = { has_trait = ambitious } + remove_trait = ambitious + } + else_if = { + limit = { has_trait = impatient } + remove_trait = impatient + } + else_if = { + limit = { has_trait = diligent } + remove_trait = diligent + } + else_if = { + limit = { has_trait = temperate } + remove_trait = temperate + } + else_if = { + limit = { has_trait = generous } + remove_trait = generous + } + else_if = { + limit = { has_trait = compassionate } + remove_trait = compassionate + } + else_if = { + limit = { has_trait = zealous } + remove_trait = zealous + } + else_if = { + limit = { has_trait = brave } + remove_trait = brave + } + else_if = { + limit = { has_trait = calm } + remove_trait = calm + } + else_if = { + limit = { has_trait = just } + remove_trait = just + } + else_if = { + limit = { has_trait = fickle } + remove_trait = fickle + } + else_if = { + limit = { has_trait = stubborn } + remove_trait = stubborn + } + else_if = { + limit = { has_trait = content } + remove_trait = content + } + else_if = { + limit = { has_trait = honest } + remove_trait = honest + } + else_if = { + limit = { has_trait = gluttonous } + remove_trait = gluttonous + } + else_if = { + limit = { has_trait = chaste } + remove_trait = chaste + } + else_if = { + limit = { has_trait = greedy } + remove_trait = greedy + } + else_if = { + limit = { has_trait = deceitful } + remove_trait = deceitful + } + else_if = { + limit = { has_trait = cynical } + remove_trait = cynical + } + else_if = { + limit = { has_trait = shy } + remove_trait = shy + } + else_if = { + limit = { has_trait = lazy } + remove_trait = lazy + } + else_if = { + limit = { has_trait = patient } + remove_trait = patient + } + else_if = { + limit = { has_trait = arbitrary } + remove_trait = arbitrary + } + else_if = { + limit = { has_trait = humble } + remove_trait = humble + } + else_if = { + limit = { has_trait = wrathful } + remove_trait = wrathful + } + else_if = { + limit = { has_trait = sadistic } + remove_trait = sadistic + } + else_if = { + limit = { has_trait = callous } + remove_trait = callous + } + else_if = { + limit = { has_trait = vengeful } + remove_trait = vengeful + } + else_if = { + limit = { has_trait = paranoid } + remove_trait = paranoid + } + else_if = { + limit = { has_trait = craven } + remove_trait = craven + } +} + +# Removes one personality trait from a character, ordered based on what makes more sense for a character to lose while not in prison. +stress_unimprisoned_remove_ordered_personality_trait_effect = { + if = { + limit = { has_trait = ambitious } + remove_trait = ambitious + } + else_if = { + limit = { has_trait = just } + remove_trait = just + } + else_if = { + limit = { has_trait = brave } + remove_trait = brave + } + else_if = { + limit = { has_trait = diligent } + remove_trait = diligent + } + else_if = { + limit = { has_trait = gregarious } + remove_trait = gregarious + } + else_if = { + limit = { has_trait = zealous } + remove_trait = zealous + } + else_if = { + limit = { has_trait = calm } + remove_trait = calm + } + else_if = { + limit = { has_trait = temperate } + remove_trait = temperate + } + else_if = { + limit = { has_trait = generous } + remove_trait = generous + } + else_if = { + limit = { has_trait = compassionate } + remove_trait = compassionate + } + else_if = { + limit = { has_trait = forgiving } + remove_trait = forgiving + } + else_if = { + limit = { has_trait = honest } + remove_trait = honest + } + else_if = { + limit = { has_trait = content } + remove_trait = content + } + else_if = { + limit = { has_trait = patient } + remove_trait = patient + } + else_if = { + limit = { has_trait = trusting } + remove_trait = trusting + } + else_if = { + limit = { has_trait = arrogant } + remove_trait = arrogant + } + else_if = { + limit = { has_trait = impatient } + remove_trait = impatient + } + else_if = { + limit = { has_trait = stubborn } + remove_trait = stubborn + } + else_if = { + limit = { has_trait = fickle } + remove_trait = fickle + } + else_if = { + limit = { has_trait = lustful } + remove_trait = lustful + } + else_if = { + limit = { has_trait = gluttonous } + remove_trait = gluttonous + } + else_if = { + limit = { has_trait = greedy } + remove_trait = greedy + } + else_if = { + limit = { has_trait = chaste } + remove_trait = chaste + } + else_if = { + limit = { has_trait = shy } + remove_trait = shy + } + else_if = { + limit = { has_trait = deceitful } + remove_trait = deceitful + } + else_if = { + limit = { has_trait = cynical } + remove_trait = cynical + } + else_if = { + limit = { has_trait = lazy } + remove_trait = lazy + } + else_if = { + limit = { has_trait = humble } + remove_trait = humble + } + else_if = { + limit = { has_trait = wrathful } + remove_trait = wrathful + } + else_if = { + limit = { has_trait = callous } + remove_trait = callous + } + else_if = { + limit = { has_trait = vengeful } + remove_trait = vengeful + } + else_if = { + limit = { has_trait = sadistic } + remove_trait = sadistic + } + else_if = { + limit = { has_trait = arbitrary } + remove_trait = arbitrary + } + else_if = { + limit = { has_trait = paranoid } + remove_trait = paranoid + } + else_if = { + limit = { has_trait = craven } + remove_trait = craven + } +} + +stress_save_deceased_character_for_mental_break = { + if = { + limit = { + always = no + } + } + else = { + set_variable = { + name = mental_break_deceased_character + value = $TARGET$ + days = 14 + } + set_variable = { + name = mental_break_deceased_character_relation + value = flag:$FLAG$ + days = 14 + } + } +} \ No newline at end of file diff --git a/N3OW/common/scripted_effects/00_task_contract_scripted_effects.txt b/N3OW/common/scripted_effects/00_task_contract_scripted_effects.txt new file mode 100644 index 00000000..0f4436e5 --- /dev/null +++ b/N3OW/common/scripted_effects/00_task_contract_scripted_effects.txt @@ -0,0 +1,35 @@ +############# +# Task Contract Scripted Effects +############# + +################################################## +# General Effects + +laamp_base_contract_schemes_set_up_outcome_immediate_effect = { + scope:scheme = { + # Grab the right scopes. + task_contract = { + task_contract_employer = { + save_scope_as = employer + save_scope_as = bg_override_char + } + save_scope_value_as = { + name = task_contract_tier + value = task_contract_tier + } + } + } +} + +governor_contract_travel_or_progress_effect = { + if = { + limit = { location != $DESTINATION$ } + start_travel_plan = { + destination = $DESTINATION$ + on_arrival_event = $ARRIVAL_EVENT$ + on_travel_planner_cancel_event = governor_contract_event.1012 + on_arrival_destinations = all_but_last + } + } + else = { trigger_event = $ARRIVAL_EVENT$ } +} diff --git a/N3OW/common/scripted_effects/00_tax_rivalry_effects.txt b/N3OW/common/scripted_effects/00_tax_rivalry_effects.txt new file mode 100644 index 00000000..16eef1d9 --- /dev/null +++ b/N3OW/common/scripted_effects/00_tax_rivalry_effects.txt @@ -0,0 +1,29 @@ +# TAX RIVALRY EFFECTS + +# NOTE: This effect needs var:story_steward and var:tax_collector to be set +create_tax_rivalry_story_effect = { + if = { + limit = { + is_ai = no # Don't care about AI enough to trigger this cycle for them + government_has_flag = government_is_clan + exists = house + exists = var:story_steward + exists = var:story_tax_collector + } + create_story = story_cycle_tax_rivalry + } + else = { + clean_up_tax_rivalry_story_variables_effect = yes + } +} + +# Clears these redundant variables if the tax rivalry story cycle isn't ongoing +clean_up_tax_rivalry_story_variables_effect = { + if = { + limit = { + NOT = { any_owned_story = { type = story_cycle_tax_rivalry } } + } + remove_variable = story_steward + remove_variable = story_tax_collector + } +} diff --git a/N3OW/common/scripted_effects/00_title_effects.txt b/N3OW/common/scripted_effects/00_title_effects.txt new file mode 100644 index 00000000..9706b7a5 --- /dev/null +++ b/N3OW/common/scripted_effects/00_title_effects.txt @@ -0,0 +1,87 @@ +become_title_holder_effect = { + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + $TITLE$ = { + change_title_holder = { + holder = root + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change +} + +reduce_partition_succession_law_effect = { + if = { + limit = { + has_realm_law = single_heir_succession_law + } + add_realm_law = high_partition_succession_law + } + else_if = { + limit = { + has_realm_law = high_partition_succession_law + } + add_realm_law = partition_succession_law + } + else_if = { + limit = { + has_realm_law = partition_succession_law + } + add_realm_law = confederate_partition_succession_law + } +} + +asturias_becomes_leon_and_castille_effect = { + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:k_leon = { + if = { + limit = { exists = scope:leon_char } + change_title_holder = { + holder = scope:leon_char + change = scope:title_change + } + } + copy_title_history = title:k_asturias + } + title:k_asturias = { + every_in_de_jure_hierarchy = { + limit = { tier = tier_duchy } + set_de_jure_liege_title = title:k_leon + } + hidden_effect = { + every_claimant = { + if = { + limit = { has_strong_claim_on = title:k_asturias } + remove_claim = title:k_asturias + add_pressed_claim = title:k_leon + } + else = { + remove_claim = title:k_asturias + add_unpressed_claim = title:k_leon + } + } + } + } + resolve_title_and_vassal_change = scope:title_change + # Destroy Asturias if appropriate. + if = { + limit = { exists = scope:leon_char } + scope:leon_char = { destroy_title = title:k_asturias } + } +} + +adjust_de_jure_effect = { + if = { + limit = { + completely_controls = $TITLE$ + } + $TITLE$ = { set_de_jure_liege_title = $DE_JURE$ } + } +} diff --git a/N3OW/common/scripted_effects/00_travel_effects.txt b/N3OW/common/scripted_effects/00_travel_effects.txt new file mode 100644 index 00000000..b040c258 --- /dev/null +++ b/N3OW/common/scripted_effects/00_travel_effects.txt @@ -0,0 +1,92 @@ +mp_pause_travel_plan = { + hidden_effect = { + current_travel_plan ?= { + pause_travel_plan_mp = yes + } + } +} + +mp_resume_travel_plan = { + hidden_effect = { + if = { + limit = { has_multiple_players = yes } + current_travel_plan ?= { + resume_travel_plan = yes + } + } + } +} + +mp_delay_travel_plan = { + hidden_effect = { + if = { + limit = { has_multiple_players = yes } + current_travel_plan ?= { + delay_travel_plan = { + days = $DAYS$ + } + } + } + } +} + +food_poison_chance_effect = { + custom_tooltip = chance_of_food_poisoning + hidden_effect = { + random = { + chance = food_poison_value + contract_disease_effect = { DISEASE = ill TREATMENT_EVENT = yes } + } + } +} + +add_poi_diplomacy_experience_effect = { + poi_lifestyle_experience_effect = { + LIFESTYLE = diplomacy + VALUE = travel_medium_xp + } +} + +add_poi_martial_experience_effect = { + poi_lifestyle_experience_effect = { + LIFESTYLE = martial + VALUE = travel_medium_xp + } +} + +add_poi_stewardship_experience_effect = { + poi_lifestyle_experience_effect = { + LIFESTYLE = stewardship + VALUE = travel_medium_xp + } +} + +add_poi_intrigue_experience_effect = { + poi_lifestyle_experience_effect = { + LIFESTYLE = intrigue + VALUE = travel_medium_xp + } +} + +add_poi_learning_experience_effect = { + poi_lifestyle_experience_effect = { + LIFESTYLE = learning + VALUE = travel_medium_xp + } +} + +add_poi_wanderer_experience_effect = { + if = { + limit = { + has_bp3_dlc_trigger = yes + } + poi_lifestyle_experience_effect = { + LIFESTYLE = wanderer + VALUE = travel_medium_xp + } + } +} + +poi_lifestyle_experience_effect = { + add_$LIFESTYLE$_lifestyle_xp = $VALUE$ +} diff --git a/N3OW/common/scripted_effects/00_tributary_setup_effects.txt b/N3OW/common/scripted_effects/00_tributary_setup_effects.txt new file mode 100644 index 00000000..eb38bc2b --- /dev/null +++ b/N3OW/common/scripted_effects/00_tributary_setup_effects.txt @@ -0,0 +1,1537 @@ +# This file contains the setup effects for the tributaries in the game. +# The setup_tributaries_effect is invoked by on_game_start and should make calls to subsequent scripted effects. +# Sections are organized by top-suzerain title. +# Note that existing vassals (as established in title history) must be released and recreated into tributaries before +# they can have their own tributaries. + +setup_tributaries_effect = { + if = { + limit = { has_mpo_dlc_trigger = yes } + if = { + limit = { current_date < 1066.9.15 } # so, 867 + mpo_867_tributary_setup_effect = yes + } + else_if = { + limit = { current_date = 1066.9.15 } + mpo_1066_tributary_setup_effect = yes + } + else_if = { + limit = { current_date > 1066.9.15 } # so, 1178 + mpo_1178_tributary_setup_effect = yes + } + } + if = { + limit = { has_tgp_dlc_trigger = yes } + if = { + limit = { current_date < 1066.9.15 } # so, 867 + tgp_867_tributary_setup_effect = yes + } + else_if = { + limit = { current_date = 1066.9.15 } + tgp_1066_tributary_setup_effect = yes + } + else_if = { + limit = { current_date > 1066.9.15 } # so, 1178 + tgp_1178_tributary_setup_effect = yes + } + } +} + +# $TRIBUTARY$ = the new tributary +# $SUZERAIN$ = their suzerain +# $WAR$ = determines if this was caused by war or agreement, yes or no +break_subject_contract_and_establish_tributary_effect = { + if = { + limit = { liege != this } + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = no + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + start_tributary_interaction_effect = { + SUZERAIN = $SUZERAIN$ + TRIBUTARY = $TRIBUTARY$ + } +} + +mpo_867_tributary_setup_effect = { + + #### k_magyar + character:159137 = { # Almos Árpád of k_magyar + save_scope_as = suzerain + character:fictional_mogyers_1 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + #### k_zhetysu + character:34872 = { # Bilge Karakhanid of k_zhetysu + save_scope_as = suzerain + character:188834 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:188852 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + character:188834 = { + save_scope_as = suzerain + character:fictional_karluks_16 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_karluks_18 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + #### k_oghuz_il + character:74031 = { # Kurush Yoishta of k_oghuz_il + save_scope_as = suzerain + character:fictional_turkish_5 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_turkish_7 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_turkish_9 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_turkish_10 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_turkish_11 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_turkish_13 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_turkish_31 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_turkish_33 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:fictional_turkish_7 = { + save_scope_as = suzerain + character:fictional_turkish_34 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:fictional_turkish_31 = { + save_scope_as = suzerain + character:fictional_turkish_8 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:fictional_turkish_11 = { # Cuneyd of c_mangyshalak + save_scope_as = suzerain + character:fictional_turkish_12 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:fictional_turkish_13 = { # Cuneyd of c_mangyshalak + save_scope_as = suzerain + character:fictional_turkish_32 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + ### e_caspian-pontic_steppe + character:74025 = { # Manasseh Bulanid of e_caspian-pontic_steppe + save_scope_as = suzerain + character:180236 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:159128 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:160111 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:160112 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:6860 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:6834 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:302238 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:302235 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:159708 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:302276 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:163118= { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_khazars_11 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_khazars_12 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_khazars_14 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_pechenegs_2 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_pechenegs_10 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_alans_3 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + #### e_kirghiz_khanate + character:303238 = { # Uzur Enisey Kyrgyz of e_kirghiz_khanate + save_scope_as = suzerain + character:302426 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303104 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303009 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303288 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303295 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303308 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:302958 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:302952 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303301 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303220 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303189 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303180 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:302995 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303255 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303123 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kirghiz_1 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kirghiz_2 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + + + # herders + character:fictional_uriankhais_11 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_uriankhais_12 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_buryats_2 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_buryats_3 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_buryats_7 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kirghiz_12 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kirghiz_13 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kirghiz_14 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kirghiz_16 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kirghiz_18 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kirghiz_19 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:302426 = { + save_scope_as = suzerain + character:fictional_laktans_1 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_ostyaks_1 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_ostyaks_2 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_ostyaks_3 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:303308 = { + save_scope_as = suzerain + character:fictional_naimans_1 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:303189 = { + save_scope_as = suzerain + character:fictional_kirghiz_15 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:303180 = { + save_scope_as = suzerain + character:fictional_uriankhais_13 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:302995 = { + save_scope_as = suzerain + character:fictional_kirghiz_3 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kirghiz_4 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kirghiz_11 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:303255 = { # Bodonchar Munkhag of c_karabalgasun + save_scope_as = suzerain + character:fictional_mongols_11 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:303220 = { # Jakha Kereyid of d_ovorkhangai + save_scope_as = suzerain + character:fictional_keraits_5 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_mongols_1 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:303123 = { # Menggei Mergid of d_selenga_valley + save_scope_as = suzerain + character:fictional_mongols_10 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:303301 = { # Qatarqa Güchügüd of d_gobi_altai + save_scope_as = suzerain + character:fictional_naimans_12 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_mongols_12 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + ### k_balhae + character:balhae_dae_12 = { # King Geon_hwang of k_balhae + save_scope_as = suzerain + character:jurchen_tieli_1 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:jurchen_odoli_01_fic = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:jurchen_tuowen_01_fic = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:mohe_funie_1 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:mohe_yuexi_1 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:mohe_yulou_1 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + ### d_BAL_hoewon + character:jurchen_tuowen_01_fic = { + save_scope_as = suzerain + character:mohe_suhemo_1 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + ### k_silla + character:balhae_dae_12 = { # King Eung-nyeom of k_silla + save_scope_as = suzerain + character:mohe_a_1 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } +} + +mpo_1066_tributary_setup_effect = { + + #### e_great_liao + character:194333 = { + save_scope_as = suzerain + character:303309 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303226 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_naimans_4 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_naimans_5 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_naimans_11 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303013 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303083 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303296 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303062 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303083 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_uriankhais_2 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_uriankhais_4 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_mongols_2 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_mongols_7 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_mongols_8 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:ruzhe_8 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:nn_yelu_zongyuan = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303303 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303314 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303226 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303267 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303289 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303131 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:nn_yelu_tieli_LUF = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:nn_xiao_yangliu = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + #Eastern tributaries, mostly Jurchens + character:balhae_dae_34 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:jurchen_wanyan_6 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:jurchen_jiagu_10_fic = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:jurchen_adian_10_fic = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:jurchen_tangkuo_10_fic = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:jurchen_nipanggu_10_fic = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:jurchen_tudan_10_fic = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:jurchen_yulou_8 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:jurchen_yuexi_8 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:jurchen_hesheli_10_fic = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + #Tribs in k_amur + character:jurchen_boli_10_fic = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:jurchen_boli_11_fic = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:jurchen_boli_12_fic = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:fictional_uriankhais_4 = { + save_scope_as = suzerain + character:fictional_uriankhais_10 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_uriankhais_3 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:303062 = { + save_scope_as = suzerain + character:fictional_mongols_9 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:303083 = { + save_scope_as = suzerain + character:fictional_uriankhais_1 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:303013 = { + save_scope_as = suzerain + character:fictional_oirats_2 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_buryats_1 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + + #### k_zhetysu + character:144107 = { + save_scope_as = suzerain + character:fictional_karluks_12 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_karluks_13 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:3022 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:302790 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:188843 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + character:188843 = { + save_scope_as = suzerain + character:188844 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:3022 = { + save_scope_as = suzerain + character:fictional_karluks_5 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_karluks_11 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_karluks_15 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + #### k_pechenegs + character:20641 = { + save_scope_as = suzerain + character:fictional_pechenegs_8 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_pechenegs_9 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + + #### k_caspian_steppe + character:806 = { + save_scope_as = suzerain + + character:302765 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:302584 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:302575 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:302596 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:302621 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:302762 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:228058 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:194447 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kimeks_14 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kimeks_18 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kimeks_19 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kimeks_21 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kimeks_23 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kimeks_25 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kimeks_27 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kimeks_28 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_turkish_16 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_turkish_17 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_turkish_18 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_turkish_19 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_turkish_20 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_cumans_15 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_cumans_16 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kipchaks_4 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kipchaks_28 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + character:fictional_kipchaks_4 = { + save_scope_as = suzerain + character:fictional_kipchaks_7 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kipchaks_27 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:fictional_kimeks_23 = { + save_scope_as = suzerain + character:fictional_kimeks_24 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kimeks_54 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:fictional_kimeks_21 = { + save_scope_as = suzerain + character:fictional_kimeks_26 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:302762 = { + save_scope_as = suzerain + character:fictional_kimeks_22 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kimeks_30 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kimeks_53 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kipchaks_11 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:fictional_kimeks_19 = { + save_scope_as = suzerain + character:fictional_kimeks_29 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:302621 = { + save_scope_as = suzerain + character:fictional_kipchaks_9 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:fictional_kimeks_14 = { + save_scope_as = suzerain + character:fictional_kimeks_13 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:302765 = { + save_scope_as = suzerain + character:fictional_kimeks_17 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:302596 = { + save_scope_as = suzerain + character:fictional_bashkirs_7 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_ostyaks_4 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:fictional_turkish_19 = { + save_scope_as = suzerain + character:fictional_kipchaks_10 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kipchaks_25 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:fictional_turkish_17 = { + save_scope_as = suzerain + character:fictional_turkish_27 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:fictional_turkish_16 = { + save_scope_as = suzerain + character:fictional_turkish_15 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_turkish_28 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + #### d_kargassia + + character:303046 = { + save_scope_as = suzerain + character:fictional_uriankhais_14 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + #### e_goryeo + + character:194333 = { + save_scope_as = suzerain + character:jurchen_yalu_10_fic = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } +} + +mpo_1178_tributary_setup_effect = { + + #### k_caspian_steppe + character:228030 = { + save_scope_as = suzerain + character:302579 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:302606 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:302627 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:302782 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kipchaks_16 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kipchaks_17 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kimeks_34 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kimeks_35 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kimeks_42 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + + # herders + character:fictional_cumans_9 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_cumans_10 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_cumans_11 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_cumans_12 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_cumans_13 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_cumans_14 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kipchaks_13 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kipchaks_14 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kipchaks_19 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kipchaks_20 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_bolghars_7 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_khazars_9 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_turkish_21 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:302627 = { + save_scope_as = suzerain + character:fictional_kipchaks_15 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kipchaks_21 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:fictional_kimeks_35 = { + save_scope_as = suzerain + character:fictional_kimeks_51 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:fictional_kipchaks_16 = { + save_scope_as = suzerain + character:fictional_kipchaks_18 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:302606 = { + save_scope_as = suzerain + character:fictional_kimeks_32 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kimeks_41 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + character:302782 = { + save_scope_as = suzerain + character:fictional_kimeks_33 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kimeks_37 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kimeks_38 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kimeks_39 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kimeks_40 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + #### e_kara_khitai + character:188912 = { + save_scope_as = suzerain + character:fictional_karluks_7 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_karluks_8 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_karluks_22 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kimeks_48 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:144122 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:karakhanid_1 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + character:144122 = { + save_scope_as = suzerain + character:fictional_kipchaks_22 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_karluks_9 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:karakhanid_3 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + #### k_naiman + character:naiman_guchugud_1 = { + save_scope_as = suzerain + character:fictional_naimans_6 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_naimans_7 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_naimans_8 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + #### d_degelen + character:fictional_kimeks_44 = { + save_scope_as = suzerain + character:fictional_kimeks_45 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kimeks_46 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kimeks_49 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_kimeks_50 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + #### d_khakass_hollow + character:303249 = { + save_scope_as = suzerain + character:fictional_kirghiz_28 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + #### d_ovorkhangai + character:303211 = { + save_scope_as = suzerain + character:fictional_keraits_1 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_keraits_2 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + #### d_khovsgol + character:303019 = { + save_scope_as = suzerain + character:303022 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:fictional_oirats_1 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + #### d_selenga_valley + character:303142 = { + save_scope_as = suzerain + character:fictional_mongols_5 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + #### e_andong + character:jurchen_wanyan_14 = { + save_scope_as = suzerain + character:jurchen_yulou_12 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:jurchen_yuexi_11 = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + #Tribs in k_amur + character:mohe_molihewen_20_fic = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:mohe_choripi_20_fic = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:mohe_wuguihai_20_fic = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:mohe_heishuiyang_20_fic = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:mohe_beihean_20_fic = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:mohe_vanda_20_fic = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:mohe_nimen_20_fic = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } +} + +tgp_867_tributary_setup_effect = { + title:h_china.holder = { + save_scope_as = suzerain + title:k_champa.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:k_silla.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:k_balhae.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:k_dzungaria.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:k_hexi.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_yinzhou_1.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:d_luoshi.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:d_shimen.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:d_luodian.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_yanchuan.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_juzhou.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:d_zangke.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:d_xiyuan.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_guile.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + #Srivijaya 867 + title:e_srivijaya.holder = { + save_scope_as = suzerain + title:c_SUM_bangka-belitung.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_SUM_east_sumatra.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_SUM_lampung.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_SUM_pasemah.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_SUM_bengkulu.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_SUM_lingga.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_SUM_dharmasraya.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_SUM_indragiri.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_SUM_meranti.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_SUM_kampar.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_SUM_muara_takus.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_SUM_pekanbaru.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_SUM_rokan.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_SUM_panai.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_SUM_lambri.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_MAL_gelanggi.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_MAL_johor.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_MAL_pahang.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_MAL_gangganegara.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_MAL_kedah.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_THAI_takua_pa.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_THAI_tambralinga.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:d_MAL_langkasuka.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_riau.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_JAV_sunda.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_JAV_galuh.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_JAV_cimanuk.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + #Borneo + title:d_BOR_tanjungpura.holder = { + save_scope_as = suzerain + title:c_BOR_sambas.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + #Silla + title:k_silla.holder = { + save_scope_as = suzerain + title:d_tamna.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_ulleong.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } +} + +tgp_1066_tributary_setup_effect = { + title:h_china.holder = { + save_scope_as = suzerain + title:k_dali.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:k_viet.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:k_dzungaria.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_yinzhou_1.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:d_shimen.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_zongzhou.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:d_luoshi.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_shaoqing.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:d_luodian.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_yanchuan.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_yanzhou_3.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_juzhou.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_guzhou.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:d_zangke.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_nanping.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_guile.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_tianzhou.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:d_xiyuan.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + title:k_viet.holder = { + save_scope_as = suzerain + title:k_champa.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + #Srivijaya 1066 + title:k_malayadvipa.holder = { + save_scope_as = suzerain + title:c_SUM_bangka-belitung.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_SUM_jambi.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_SUM_karang_brahi.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + #Melayu kingdom 1066 + title:d_SUM_jambi.holder = { + save_scope_as = suzerain + title:c_SUM_indragiri.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + #Chola tribs in Sumatra/Malaysia 1066 + title:k_tamilakam.holder = { + save_scope_as = suzerain + title:k_malayadvipa.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_SUM_panai.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_SUM_rokan.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_SUM_lambri.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_SUM_lingga.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + # + title:c_MAL_kedah.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_MAL_pahang.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_MAL_gangganegara.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + #Borneo + title:d_BOR_tanjungpura.holder = { + save_scope_as = suzerain + title:c_BOR_sambas.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } +} + +tgp_1178_tributary_setup_effect = { + title:h_china.holder = { + save_scope_as = suzerain + title:k_dali.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:k_viet.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + #Melayu kingdom/new Sanfoqi in Sumatra/Malaysia 1178 + title:d_SUM_jambi.holder = { + save_scope_as = suzerain + title:d_SUM_palembang.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_SUM_indragiri.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_SUM_minangkabau.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_SUM_lambri.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + #Tribs in Sumatra 1178 + title:d_SUM_riau.holder = { + save_scope_as = suzerain + title:c_SUM_pekanbaru.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + #Tribs of Kediri 1178 + title:d_JAV_mataram.holder = { + save_scope_as = suzerain + title:c_JAV_lumajang.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_JAV_madura.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_IDO_bali.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + title:c_SuMa_ternate.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + #Borneo + title:d_BOR_tanjungpura.holder = { + save_scope_as = suzerain + title:c_BOR_sambas.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + title:d_BOR_nan_sarunai.holder = { + save_scope_as = suzerain + title:c_BOR_banjar.holder = { + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } +} + +base_867_tributary_setup_effect = { + + character:34014 = { # Caliph ak-Mu'tazz ibn al-Mutawakkil (Abbasid) of the Abbasid Empire + save_scope_as = suzerain + character:41505 = { # Prince Ashot (Bagratuni) of Armenian Principality (Subjugated Tributary) + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:163115 = { # Sultan Ahmad ibn Tulun (Tulunid) of the Tulunid Sultanate + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + character:163115 = { # Sultan Ahmad ibn Tulun (Tulunid) of the Tulunid Sultanate + save_scope_as = suzerain + character:31720 = { # Petty King Zakharias III (Azim) of Makuria + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + character:1700 = { # Basileus Basileios (Makedon) of the Byzantine Empire + save_scope_as = suzerain + character:184026 = { # Serene Doge Orso (Participazio) of Venice (Subjugated Tributary) + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303450 = { # Count Miroslav (Bar) of Duklja (Subjugated Tributary) + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303449 = { # Count Uros (Trebinje) of Travunija (Subjugated Tributary) + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303447 = { # Count Pavel (Blagaj) of Zahumlje (Subjugated Tributary) + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:303448 = { # Count Gjin (Mokro) of Paganija (Subjugated Tributary) + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:145120 = { # Doux Amphilochios (Radenos) of Dalmatia (Subjugated Tributary) + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + character:90107 = { # King Ludwig II (Karling) of East Francia + save_scope_as = suzerain + character:184001 = { # Chieftain Msciwoj (Obodrytow) of Liubice + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:168582 = { # High Chieftain Mscislav (Hevelli) of Luticia + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } +} + +base_1066_tributary_setup_effect = { + character:107500 = { # King Sancho II (Jimena) of Castille + save_scope_as = suzerain + character:3924 = { # Emir Yahya ibn al-Zafir (Dhunnunid) of Tulaytulah + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + tributary_contract_set_obligation_level = { type = default_tributary_taxes level = 1 } + } + character:45016 = { # Emir Badis ibn Habus (Zirid) of Garnatah + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + tributary_contract_set_obligation_level = { type = default_tributary_taxes level = 1 } + } + } + + character:108500 = { # King Alfonso VI (Jimena) of Leon + save_scope_as = suzerain + character:3900 = { # Emir al-Muzaffar ibn al-Mansur (Aftasid) of Batalyaws + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + tributary_contract_set_obligation_level = { type = default_tributary_taxes level = 1 } + } + character:3212 = { # Emir al-Mu'tadid ibn Muhammad (Abbadid) of Isbiliyyah + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + tributary_contract_set_obligation_level = { type = default_tributary_taxes level = 1 } + } + } + + character:110500 = { # King Sancho Remiriz (Aragon) of Aragon + save_scope_as = suzerain + character:3934 = { # Emir al-Muqtadir ibn al-Musta'in (Hudid) of Saraqustah + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + tributary_contract_set_obligation_level = { type = default_tributary_taxes level = 1 } + } + character:3938 = { # Sheikh al-Muzaffar II ibn al-Musta'in (Hudid) of Laridah + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + tributary_contract_set_obligation_level = { type = default_tributary_taxes level = 1 } + } + } + + character:3096 = { # Caliph al-Mustansir ibn az-Zahir (Fatimid) of the Fatimid Sultanate + save_scope_as = suzerain + character:20572 = { # Petty King Georgios III (Azim) of Makuria + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } +} + +base_1178_tributary_setup_effect = { + character:204500 = { # King Henry II (Plantagenet) of England + save_scope_as = suzerain + character:202999 = { # King William (Dunkeld) of Scotland + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + character:201510 = { # King Valdemar (Estrid) of Denmark + save_scope_as = suzerain + character:221735 = { # Count Jaromar (Wizlawid) of Rana + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + character:226000 = { # Sultan Salah al-Dun Yusuf Ayyubid of the Ayyubid Sultanate + save_scope_as = suzerain + character:31729 = { # Petty King Basileios II (Azim) of Makuria + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } + + character:215530 = { # Basileus Manuel (Komnenos) of the Byzantine Empire + save_scope_as = suzerain + character:218500 = { # Duke Stefan Zavidic (Nemanjic) of Raska + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + character:223750 = { # Duke Bohemond III of (Poitiers-Antioch) of Antioch + break_subject_contract_and_establish_tributary_effect = { SUZERAIN = scope:suzerain TRIBUTARY = this } + } + } +} diff --git a/N3OW/common/scripted_effects/00_unity_effects.txt b/N3OW/common/scripted_effects/00_unity_effects.txt new file mode 100644 index 00000000..ab843e4f --- /dev/null +++ b/N3OW/common/scripted_effects/00_unity_effects.txt @@ -0,0 +1,228 @@ +########################## +# UNITY EFFECTS +########################## + +# This is a general effect to make you able to impact House Unity. +# The following scopes are needed: +# CHARACTER - The character doing the "action" that changes unity (usually scope:actor or ROOT) +# TARGET - The character being targeted by the "action" +# VALUE - How much unity should change (there are scripted values for these) +# DESC - A description of what CHARACTER did +#add_clan_unity_interaction_effect = { +# if = { +# limit = { # Check if unity is relevant +# $CHARACTER$ = { government_has_flag = government_is_clan } +# $TARGET$ = { government_has_flag = government_is_clan } +# exists = $CHARACTER$.house +# exists = $TARGET$.house +# $CHARACTER$.house = $TARGET$.house +# } +# +# # Save scopes for localisation +# $CHARACTER$ = { save_scope_as = unity_character } +# $TARGET$ = { save_scope_as = unity_target } +# +# $CHARACTER$.house = { +# save_scope_as = character_house +# +# add_unity_value = { +# value = { +# value = $VALUE$ +# if = { # House heads have a larger impact on unity +# limit = { house_head = $CHARACTER$ } +# multiply = unity_house_head_multiplier_value +# } +# } +# character = $CHARACTER$ +# desc = $DESC$ +# } +# } +# } +#} + +# Used in the following events: +# vassal_interaction.0002 +# vassal_interaction.0003 +# vassal_interaction.0004 +stop_attacker_vassal_war_add_clan_unity_effect = { + # If we are clan, we want to affect unity, but only during certain situations... + if = { + limit = { # If we are asking a non-house member to stop attacking a house member, gain unity + exists = scope:actor.house + exists = scope:recipient.house + scope:recipient.house != scope:actor.house + } + add_clan_unity_interaction_effect = { + CHARACTER = scope:actor + TARGET = scope:defender + VALUE = medium_unity_gain + DESC = clan_unity_aided_in_war.desc + REVERSE_NON_HOUSE_TARGET = no + } + } + else_if = { + limit = { # If we are asking a house member to stop attacking a non-house member, lose unity + exists = scope:actor.house + exists = scope:defender.house + scope:defender.house != scope:actor.house + } + add_clan_unity_interaction_effect = { + CHARACTER = scope:actor + TARGET = scope:recipient + VALUE = medium_unity_loss + DESC = clan_unity_stopped_vassal_war.desc + REVERSE_NON_HOUSE_TARGET = no + } + } +} + +# Used in the following events: +# vassal_interaction.0012 +# vassal_interaction.0013 +# vassal_interaction.0014 +stop_defender_vassal_war_add_clan_unity_effect = { + # If we are clan, we want to affect unity, but only during certain situations... + if = { + limit = { # If recipient is a house member and the attacker is not, lose unity + exists = scope:actor.house + exists = scope:attacker.house + scope:attacker.house != scope:actor.house + } + add_clan_unity_interaction_effect = { + CHARACTER = scope:actor + TARGET = scope:recipient + VALUE = medium_unity_loss + DESC = clan_unity_stop_defender_vassal_war.desc + REVERSE_NON_HOUSE_TARGET = no + } + } + else_if = { + limit = { # If recipient is a non-house member and the attacker is, gain unity + exists = scope:actor.house + exists = scope:recipient.house + scope:recipient.house != scope:actor.house + } + add_clan_unity_interaction_effect = { + CHARACTER = scope:actor + TARGET = scope:attacker + VALUE = medium_unity_gain + DESC = clan_unity_aided_in_war.desc + REVERSE_NON_HOUSE_TARGET = no + } + } +} + +refuse_call_to_arms_add_clan_unity_effect = { + add_clan_unity_interaction_effect = { + CHARACTER = scope:actor + TARGET = scope:recipient + VALUE = medium_unity_loss + DESC = clan_unity_call_to_war_decline.desc + REVERSE_NON_HOUSE_TARGET = no + } +} + +accept_faith_conversion_add_clan_unity_effect = { + # If we are clan, we want to affect unity when converting another house member to our faith... + if = { # But you only gain unity if you are converting a member TO the house's primary faith + limit = { + exists = scope:actor.house + scope:actor.house = { + any_house_member = { + percent >= 0.6 + faith = scope:actor.faith + } + } + } + add_clan_unity_interaction_effect = { + CHARACTER = scope:actor + TARGET = scope:recipient + VALUE = minor_unity_gain + DESC = clan_unity_conversion_accepted.desc + REVERSE_NON_HOUSE_TARGET = no + } + } + else_if = { # If you are converting them AWAY from the primary faith, lose unity + limit = { + exists = scope:actor.house + scope:actor.house = { + any_house_member = { + percent >= 0.6 + faith = scope:recipient.faith + } + } + } + add_clan_unity_interaction_effect = { + CHARACTER = scope:actor + TARGET = scope:recipient + VALUE = medium_unity_loss + DESC = clan_unity_conversion_accepted.desc + REVERSE_NON_HOUSE_TARGET = no + } + } +} + +refuse_faith_conversion_add_clan_unity_effect = { + # If we are clan, we want to affect unity when we fail to convert another house member to our faith... + if = { # If target declines to convert TO the house's primary faith, lose unity + limit = { + exists = scope:actor.house + scope:actor.house = { + any_house_member = { + percent >= 0.6 + faith = scope:actor.faith + } + } + } + add_clan_unity_interaction_effect = { + CHARACTER = scope:actor + TARGET = scope:recipient + VALUE = medium_unity_loss + DESC = clan_unity_conversion_declined.desc + REVERSE_NON_HOUSE_TARGET = no + } + } + else_if = { # If target declines to convert while BEING of the primary faith, gain unity + limit = { + exists = scope:actor.house + scope:actor.house = { + any_house_member = { + percent >= 0.6 + faith = scope:recipient.faith + } + } + } + add_clan_unity_interaction_effect = { + CHARACTER = scope:actor + TARGET = scope:recipient + VALUE = minor_unity_gain + DESC = clan_unity_conversion_declined.desc + REVERSE_NON_HOUSE_TARGET = no + } + } +} + +notify_players_about_unity_change_effect = { + # Notify human players if they are not involved! + $CHARACTER$.house = { + every_house_member = { + limit = { + is_ai = no + NOT = { this = $CHARACTER$ } + NOT = { this = $TARGET$ } + } + $CHARACTER$ = { save_scope_as = actor } + + send_interface_message = { + type = event_generic_neutral_text + title = unity_changed_title + desc = { + desc = unity_changed_desc + desc = $DESC$ + } + left_icon = $CHARACTER$ + right_icon = $TARGET$ + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_wanderer_lifestyle_effects.txt b/N3OW/common/scripted_effects/00_wanderer_lifestyle_effects.txt new file mode 100644 index 00000000..64708d23 --- /dev/null +++ b/N3OW/common/scripted_effects/00_wanderer_lifestyle_effects.txt @@ -0,0 +1,1039 @@ +# Effects used in the Wanderer Lifestyle + +visiting_poi_effect = { + if = { # Offa's Dyke + limit = { + OR = { + scope:province = province:1632 + scope:province = province:1633 + scope:province = province:1634 + scope:province = province:1648 + scope:province = province:1646 + scope:province = province:1643 + } + } + visiting_poi_variable_effect = { PROVINCE = province:1632 } + visiting_poi_variable_effect = { PROVINCE = province:1633 } + visiting_poi_variable_effect = { PROVINCE = province:1634 } + visiting_poi_variable_effect = { PROVINCE = province:1648 } + visiting_poi_variable_effect = { PROVINCE = province:1646 } + visiting_poi_variable_effect = { PROVINCE = province:1643 } + } + else_if = { # Hadrian's Wall + limit = { + OR = { + scope:province = province:8780 + scope:province = province:1635 + scope:province = province:1611 + scope:province = province:1609 + } + } + visiting_poi_variable_effect = { PROVINCE = province:8780 } + visiting_poi_variable_effect = { PROVINCE = province:1635 } + visiting_poi_variable_effect = { PROVINCE = province:1611 } + visiting_poi_variable_effect = { PROVINCE = province:1609 } + } + else_if = { # Danevirke + limit = { + OR = { + scope:province = province:62 + scope:province = province:84 + } + } + visiting_poi_variable_effect = { PROVINCE = province:62 } + visiting_poi_variable_effect = { PROVINCE = province:84 } + } + else_if = { # Great Wall of Gorgan + limit = { + OR = { + scope:province = province:4031 + scope:province = province:4030 + } + } + visiting_poi_variable_effect = { PROVINCE = province:4031 } + visiting_poi_variable_effect = { PROVINCE = province:4030 } + } + else = { + visiting_poi_variable_effect = { PROVINCE = scope:province } + } +} + +visiting_poi_variable_effect = { + add_to_variable_list = { + name = visited_poi + target = $PROVINCE$ + } +} + +visiting_monument_exploration_effect = { + if = { # Offa's Dyke + limit = { + OR = { + scope:province = province:1632 + scope:province = province:1633 + scope:province = province:1634 + scope:province = province:1648 + scope:province = province:1646 + scope:province = province:1643 + } + } + visiting_monument_exploration_variable_effect = { PROVINCE = province:1632 } + visiting_monument_exploration_variable_effect = { PROVINCE = province:1633 } + visiting_monument_exploration_variable_effect = { PROVINCE = province:1634 } + visiting_monument_exploration_variable_effect = { PROVINCE = province:1648 } + visiting_monument_exploration_variable_effect = { PROVINCE = province:1646 } + visiting_monument_exploration_variable_effect = { PROVINCE = province:1643 } + } + else_if = { # Hadrian's Wall + limit = { + OR = { + scope:province = province:8780 + scope:province = province:1635 + scope:province = province:1611 + scope:province = province:1609 + } + } + visiting_monument_exploration_variable_effect = { PROVINCE = province:8780 } + visiting_monument_exploration_variable_effect = { PROVINCE = province:1635 } + visiting_monument_exploration_variable_effect = { PROVINCE = province:1611 } + visiting_monument_exploration_variable_effect = { PROVINCE = province:1609 } + } + else_if = { # Danevirke + limit = { + OR = { + scope:province = province:62 + scope:province = province:84 + } + } + visiting_monument_exploration_variable_effect = { PROVINCE = province:62 } + visiting_monument_exploration_variable_effect = { PROVINCE = province:84 } + } + else_if = { # Great Wall of Gorgan + limit = { + OR = { + scope:province = province:4031 + scope:province = province:4030 + } + } + visiting_monument_exploration_variable_effect = { PROVINCE = province:4031 } + visiting_monument_exploration_variable_effect = { PROVINCE = province:4030 } + } + else = { + visiting_monument_exploration_variable_effect = { PROVINCE = scope:province } + } +} + +visiting_monument_exploration_variable_effect = { + add_to_variable_list = { + name = visited_monument_exploration + target = $PROVINCE$ + } +} + +wanderer_lifestyle_destination_effect = { + root = { + if = { + limit = { + OR = { + has_focus = wanderer_destination_focus + has_perk = finally_there_perk + } + } + add_prestige = wanderer_destination_prestige_value_with_effects + } + finally_there_stress_loss_effect = yes + } +} + +point_of_interest_prestige_effect = { + root = { + add_prestige = point_of_interest_prestige_value + finally_there_stress_loss_effect = yes + } +} + +finally_there_stress_loss_effect = { + root = { + if = { + limit = { + has_perk = finally_there_perk + } + if = { + limit = { + has_perk = been_there_done_that_perk + } + stress_impact = { base = -7 } + } + else = { stress_impact = { base = -5 } } + } + } +} + +local_arbitration_effect = { + root = { + send_interface_message = { + type = msg_county_corruption_good_increase_control + title = local_arbitration_key + left_icon = current_location.county + right_icon = root + + prev = { + remove_county_modifier = $COUNTY_MODIFIER$ + } + } + } +} + +local_arbitration_positive_effect = { + root = { + send_interface_message = { + type = event_generic_good + title = local_arbitration_key + left_icon = root.location.county + right_icon = root + + prev = { + add_county_modifier = { + modifier = $COUNTY_MODIFIER$ + years = 10 + } + } + } + } + hidden_effect = { + if = { + limit = { + root.location.county.holder != root + } + root.location.county.holder = { + send_interface_message = { + type = event_generic_good + title = local_arbitration_key + left_icon = root.location.county + right_icon = root + + show_as_tooltip = { + prev = { + add_county_modifier = { + modifier = $COUNTY_MODIFIER$ + years = 10 + } + } + } + } + } + } + } +} + +voyager_souvenirs_aplenty_effect = { + if = { + limit = { + has_perk = souvenirs_aplenty_perk + NOT = { location.barony ?= root.capital_barony } + location.county.development_level > root.capital_county.development_level + } + if = { + limit = { + has_variable = souvenirs_aplenty_var + } + change_variable = { + name = souvenirs_aplenty_var + add = { + add = voyager_souvenirs_aplenty_script_value + max = voyager_souvenirs_aplenty_max_value + } + } + } + else = { + set_variable = { + name = souvenirs_aplenty_var + value = voyager_souvenirs_aplenty_script_value + } + } + } +} + +voyager_souvenirs_aplenty_completion_effect = { + if = { + limit = { + has_perk = souvenirs_aplenty_perk + has_variable = souvenirs_aplenty_var + } + send_interface_toast = { + type = event_generic_good + title = souvenirs_aplenty_perk_title_message + + root.capital_county = { + change_development_progress_with_overflow = root.var:souvenirs_aplenty_var + } + } + remove_variable = souvenirs_aplenty_var + } +} + +voyager_gracious_host_impeccable_guest_effect = { + if = { + limit = { + has_perk = gracious_host_impeccable_guest_perk + exists = root.location.barony.holder + this != root.location.barony.holder + root.location.barony.holder.capital_barony = root.location.barony + } + root.location.barony.holder = { + add_opinion = { + modifier = impeccable_guest_opinion + opinion = 10 + target = root + } + } + } + if = { + limit = { + exists = root.location.barony.holder + this != root.location.barony.holder + root.location.barony.holder = { + has_perk = gracious_host_impeccable_guest_perk + } + } + add_opinion = { + modifier = gracious_host_opinion + opinion = 10 + target = root.location.barony.holder + } + } +} + +wayfarer_storyteller_fame_effect = { + if = { + limit = { + has_perk = roaming_perk + } + save_scope_value_as = { + name = fame_value + value = $VALUE$ + } + custom_tooltip = { + text = roaming_fame_reward_tt + add_prestige_experience = $VALUE$ + } + } +} + +wayfarer_the_real_threat_effect = { + ordered_councillor = { + limit = { + wayfarer_the_real_threat_trigger = yes + } + order_by = wayfarer_the_real_threat_value + position = $NUMBER$ + save_scope_as = threat_$NUMBER$ + } +} + +wayfarer_the_home_away_from_home_modifier_effect = { + if = { + limit = { + has_character_modifier = the_home_away_from_home_modifier + } + remove_character_modifier = the_home_away_from_home_modifier + } +} + +destination_remove_excursion_modifier_effect = { + if = { + limit = { + has_character_modifier = destination_excursion_safety_modifier + } + remove_character_modifier = destination_excursion_safety_modifier + } + else_if = { + limit = { + has_character_modifier = destination_excursion_speed_modifier + } + remove_character_modifier = destination_excursion_speed_modifier + } +} + +surveyor_perk_mustering_effect = { + if = { + limit = { + government_has_flag = government_is_settled + has_perk = mustering_the_troops_perk + location = { + exists = barony + barony.holder = root + has_stationed_regiment = yes + } + } + location = { + switch = { + trigger = has_stationed_regiment_of_base_type + skirmishers = { + add_province_modifier = { + modifier = mustered_skirmishers + years = 15 + } + } + archers = { + add_province_modifier = { + modifier = mustered_archers + years = 15 + } + } + light_cavalry = { + add_province_modifier = { + modifier = mustered_light_cavalry + years = 15 + } + } + pikemen = { + add_province_modifier = { + modifier = mustered_pikemen + years = 15 + } + } + heavy_infantry = { + add_province_modifier = { + modifier = mustered_heavy_infantry + years = 15 + } + } + siege_weapon = { + add_province_modifier = { + modifier = mustered_siege_weapon + years = 15 + } + } + heavy_cavalry = { + add_province_modifier = { + modifier = mustered_heavy_cavalry + years = 15 + } + } + elephant_cavalry = { + add_province_modifier = { + modifier = mustered_elephant_cavalry + years = 15 + } + } + camel_cavalry = { + add_province_modifier = { + modifier = mustered_camel_cavalry + years = 15 + } + } + archer_cavalry = { + add_province_modifier = { + modifier = mustered_archer_cavalry + years = 15 + } + } + } + } + } +} + +charting_the_realm_perk_effect = { + if = { + limit = { + has_perk = realm_charts_perk + OR = { + NOT = { has_variable_list = mapmaking_location_list } + NOT = { + is_target_in_variable_list = { + name = mapmaking_location_list + target = location + } + } + } + exists = location.county + location = { has_holding = yes } + OR = { #We save domain provinces, top lieges capital or direct vassals capitals at count tier or over - always by link comparisons + AND = { + location.county.holder = root + location.county != location.county.holder.capital_county + } + AND = { + top_liege != this + location.county.holder != root + root.top_liege = location.county.holder.top_liege + location = location.county.holder.top_liege.capital_province + } + AND = { + location.county.holder != root + location.county.holder.liege = root + location = location.county.holder.capital_province + } + } + } + add_to_variable_list = { + name = mapmaking_location_list + target = location + } + } +} + + +surveyor_tutor_child_effect = { + if = { + limit = { + location = { + exists = barony + barony.holder = root + } + current_travel_plan = { + has_travel_option = tutor_child_option + } + player_heir ?= { + NOT = { + is_target_in_variable_list = { + name = visited_domain_to_learn + target = location + } + } + OR = { + NOT = { has_variable_list = visited_domain_to_learn } + variable_list_size = { + name = visited_domain_to_learn + value < 8 + } + } + } + } + player_heir ?= { + if = { + limit = { + age < 15 + } + add_to_variable_list = { + name = visited_domain_to_learn + target = location + } + random_list = { + 15 = { + add_character_modifier = { + modifier = domain_tutoring_martial + } + } + 5 = { #Smaller chance of double boost, done as 2 boosts to maintain the right count for the maximum boost attainable + add_character_modifier = { + modifier = domain_tutoring_martial + } + add_character_modifier = { + modifier = domain_tutoring_martial + } + } + 15 = { + add_character_modifier = { + modifier = domain_tutoring_diplomacy + } + } + 5 = { #Smaller chance of double boost, done as 2 boosts to maintain the right count for the maximum boost attainable + add_character_modifier = { + modifier = domain_tutoring_diplomacy + } + add_character_modifier = { + modifier = domain_tutoring_diplomacy + } + } + 15 = { + add_character_modifier = { + modifier = domain_tutoring_intrigue + } + } + 5 = { #Smaller chance of double boost, done as 2 boosts to maintain the right count for the maximum boost attainable + add_character_modifier = { + modifier = domain_tutoring_intrigue + } + add_character_modifier = { + modifier = domain_tutoring_intrigue + } + } + 15 = { + add_character_modifier = { + modifier = domain_tutoring_stewardship + } + } + 5 = { #Smaller chance of double boost, done as 2 boosts to maintain the right count for the maximum boost attainable + add_character_modifier = { + modifier = domain_tutoring_stewardship + } + add_character_modifier = { + modifier = domain_tutoring_stewardship + } + } + 15 = { + add_character_modifier = { + modifier = domain_tutoring_learning + } + } + 5 = { #Smaller chance of double boost, done as 2 boosts to maintain the right count for the maximum boost attainable + add_character_modifier = { + modifier = domain_tutoring_learning + } + add_character_modifier = { + modifier = domain_tutoring_learning + } + } + } + } + } + } +} + +surveyor_no_stone_unturned_perk_effect = { + if = { + limit = { + OR = { + AND = { + has_perk = no_stone_unturned_perk + government_has_flag = government_is_settled + } + AND = { + has_perk = know_your_land_know_your_people_perk + government_has_flag = government_is_nomadic + } + } + this = scope:host + exists = location.county + location.county.holder = root + } + if = { + limit = { + location.county = { + NOR = { + has_county_modifier = no_stone_unturned_perk_modifier + has_county_modifier = no_stone_unturned_boosted_perk_modifier + } + } + } + if = { + limit = { + has_perk = personal_touch_perk #Increased effect + } + send_interface_toast = { + type = event_generic_good + title = no_stone_unturned_perk_modifier + + location.county = { + add_county_modifier = { + modifier = no_stone_unturned_boosted_perk_modifier + years = 10 + } + if = { + limit = { + scope:host = { government_has_flag = government_is_nomadic } + } + change_county_fertility = 15 + } + else = { + change_development_progress_with_overflow = 75 + } + } + } + } + else = { #Standard Effect + send_interface_toast = { + type = event_generic_good + title = no_stone_unturned_perk_modifier + + location.county = { + add_county_modifier = { + modifier = no_stone_unturned_perk_modifier + years = 10 + } + if = { + limit = { + scope:host = { government_has_flag = government_is_nomadic } + } + change_county_fertility = 10 + } + else = { + change_development_progress_with_overflow = 50 + } + } + } + } + } + else = { + location.county = { save_scope_as = perk_county } + send_interface_toast = { + type = event_generic_good + title = no_stone_unturned_perk_cooldown_title_message + custom_description_no_bullet = { + text = no_stone_unturned_perk_cooldown_message + } + } + } + } +} + +local_adjudicate_effect = { + if = { + limit = { + has_county_corruption_trigger = yes + } + switch = { + trigger = has_county_modifier + county_corruption_inefficient_tax_collection_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_inefficient_tax_collection_modifier } } + county_corruption_deserting_levies_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_deserting_levies_modifier } } + county_corruption_smuggling_ring_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_smuggling_ring_modifier } } + county_corruption_bandits_rampant_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_bandits_rampant_modifier } } + county_corruption_inefficient_census_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_inefficient_census_modifier } } + county_corruption_lack_of_sheriffs_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_lack_of_sheriffs_modifier } } + county_corruption_lack_of_courts_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_lack_of_courts_modifier } } + county_corruption_thieves_guild_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_thieves_guild_modifier } } + county_corruption_unsafe_highways_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_unsafe_highways_modifier } } + county_corruption_uncooperative_guilds_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_uncooperative_guilds_modifier } } + county_corruption_lackluster_administration_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_lackluster_administration_modifier } } + county_corruption_roaming_bandits_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_roaming_bandits_modifier } } + county_corruption_wild_beast_attacks_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_wild_beast_attacks_modifier } } + county_corruption_upset_shepherds_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_upset_shepherds_modifier } } + county_corruption_rogue_warriors_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_rogue_warriors_modifier } } + county_corruption_unruly_nomads_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_unruly_nomads_modifier } } + } + } + else = { + random_list = { + 1 = { + local_arbitration_positive_effect = { COUNTY_MODIFIER = local_arbitration_modifier_1 } + } + 1 = { + local_arbitration_positive_effect = { COUNTY_MODIFIER = local_arbitration_modifier_2 } + } + 1 = { + local_arbitration_positive_effect = { COUNTY_MODIFIER = local_arbitration_modifier_3 } + } + } + } +} + +battle_poi_trait_effect = { + root = { + if = { + limit = { + NOT = { has_trait = $TRAIT$ } + } + send_interface_toast = { + title = poi_battles.learn + left_icon = root + + add_trait = $TRAIT$ + } + } + } +} + +battle_poi_maa_regiment_effect = { + scope:combat_location = { + set_variable = { + name = battle_poi_$NAME$ + } + } +} + +battle_poi_randomizer_effect = { + set_variable = { + name = battle_poi_randomizer_$NAME$ + } +} + +battle_poi_region_cooldown_effect = { + set_global_variable = { + name = battle_poi_$REGION$_cooldown + years = 25 + } +} + +mapmaking_mythical_lie_effect = { + random_list = { + 1 = { + save_scope_value_as = { + name = mythical_lie + value = flag:dragon + } + } + 1 = { + save_scope_value_as = { + name = mythical_lie + value = flag:unicorn + } + } + 1 = { + save_scope_value_as = { + name = mythical_lie + value = flag:dog_people + } + } + 1 = { + save_scope_value_as = { + name = mythical_lie + value = flag:basilisk + } + } + 1 = { + save_scope_value_as = { + name = mythical_lie + value = flag:giant_serpent + } + } + 1 = { + save_scope_value_as = { + name = mythical_lie + value = flag:horned_men + } + } + 1 = { + save_scope_value_as = { + name = mythical_lie + value = flag:amazons + } + } + 1 = { + save_scope_value_as = { + name = mythical_lie + value = flag:headless_men + } + } + 1 = { + save_scope_value_as = { + name = mythical_lie + value = flag:giants + } + } + 1 = { + save_scope_value_as = { + name = mythical_lie + value = flag:hoved_feeted_men + } + } + 1 = { + save_scope_value_as = { + name = mythical_lie + value = flag:giant_crabs + } + } + 1 = { + save_scope_value_as = { + name = mythical_lie + value = flag:cyclops + } + } + } +} + +reminiscing_event_effect = { + if = { + limit = { + reminiscing_event_trigger = yes + } + trigger_event = wanderer_lifestyle_events.25 + } +} + +local_guild_effect = { + random_list = { + 10 = { # Millers Guild (Watermills) + trigger = { + has_building_or_higher = watermills_01 + } + save_scope_value_as = { + name = local_guild_scope + value = 1 + } + } + 10 = { # Bakers Guild (Windmills) + trigger = { + has_building_or_higher = windmills_01 + } + save_scope_value_as = { + name = local_guild_scope + value = 2 + } + } + 10 = { # Fishmongers Guild (Port) + trigger = { + has_building_or_higher = common_tradeport_01 + } + save_scope_value_as = { + name = local_guild_scope + value = 3 + } + } + 10 = { # Shoemakers/Tanners/Tailors/Weavers Guild (Cattle Pastures) + trigger = { + has_building_or_higher = pastures_01 + } + random_list = { + 10 = { + save_scope_value_as = { + name = local_guild_scope + value = 4 + } + } + 10 = { + save_scope_value_as = { + name = local_guild_scope + value = 5 + } + } + 10 = { + save_scope_value_as = { + name = local_guild_scope + value = 6 + } + } + 10 = { + save_scope_value_as = { + name = local_guild_scope + value = 7 + } + } + } + } + 10 = { # Butchers/Furriers/Skinners Guild (Hunting Grounds) + trigger = { + has_building_or_higher = hunting_grounds_01 + } + random_list = { + 10 = { + save_scope_value_as = { + name = local_guild_scope + value = 8 + } + } + 10 = { + save_scope_value_as = { + name = local_guild_scope + value = 9 + } + } + 10 = { + save_scope_value_as = { + name = local_guild_scope + value = 10 + } + } + } + } + 10 = { # Vintners Guild (Orchards) + trigger = { + has_building_or_higher = orchards_01 + } + save_scope_value_as = { + name = local_guild_scope + value = 11 + } + } + 10 = { # Carpenters Guild (Logging Camps) + trigger = { + has_building_or_higher = logging_camps_01 + } + save_scope_value_as = { + name = local_guild_scope + value = 12 + } + } + 10 = { # Masons/Miners Guild (Quarries) + trigger = { + has_building_or_higher = quarries_01 + } + random_list = { + 10 = { + save_scope_value_as = { + name = local_guild_scope + value = 13 + } + } + 10 = { + save_scope_value_as = { + name = local_guild_scope + value = 14 + } + } + } + } + 10 = { # Blacksmiths Guild (Blacksmith) + trigger = { + has_building_or_higher = smiths_01 + } + save_scope_value_as = { + name = local_guild_scope + value = 15 + } + } + 10 = { # Saddlers Guild (Stables) + trigger = { + has_building_or_higher = stables_01 + } + save_scope_value_as = { + name = local_guild_scope + value = 16 + } + } + 10 = { # Merchants Guild (Guild Halls) + trigger = { + has_building_or_higher = guild_halls_01 + } + save_scope_value_as = { + name = local_guild_scope + value = 17 + } + } + 10 = { # Physicians/Pharmacists Guild (Hospices) + trigger = { + has_building_or_higher = hospices_01 + } + random_list = { + 10 = { + save_scope_value_as = { + name = local_guild_scope + value = 18 + } + } + 10 = { + save_scope_value_as = { + name = local_guild_scope + value = 19 + } + } + } + } + 10 = { # Toolmakers Guild (Workshops) + trigger = { + has_building_or_higher = workshops_01 + } + save_scope_value_as = { + name = local_guild_scope + value = 20 + } + } + } +} + +local_guild_reward_effect = { + switch = { + trigger = scope:local_guild_scope + 1 = { add_building = watermills_01 } + 2 = { add_building = windmills_01 } + 3 = { add_building = common_tradeport_01 } + 4 = { add_building = pastures_01 } + 5 = { add_building = pastures_01 } + 6 = { add_building = pastures_01 } + 7 = { add_building = pastures_01 } + 8 = { add_building = hunting_grounds_01 } + 9 = { add_building = hunting_grounds_01 } + 10 = { add_building = hunting_grounds_01 } + 11 = { add_building = orchards_01 } + 12 = { add_building = logging_camps_01 } + 13 = { add_building = quarries_01 } + 14 = { add_building = quarries_01 } + 15 = { add_building = smiths_01 } + 16 = { add_building = stables_01 } + 17 = { add_building = guild_halls_01 } + 18 = { add_building = hospices_01 } + 19 = { add_building = hospices_01 } + 20 = { add_building = workshops_01 } + } +} diff --git a/N3OW/common/scripted_effects/00_wanderer_perk_effects.txt b/N3OW/common/scripted_effects/00_wanderer_perk_effects.txt new file mode 100644 index 00000000..1f8470b3 --- /dev/null +++ b/N3OW/common/scripted_effects/00_wanderer_perk_effects.txt @@ -0,0 +1,22 @@ + +# Effects used by Perks in the Wanderer Lifestyle +of_the_people_effect = { + if = { + limit = { + exists = location.county + is_ruler = yes + has_perk = of_the_people_perk + OR = { + location.county.holder ?= root + location.county.holder.liege ?= root + location.county.holder.top_liege ?= root + } + } + location.county = { + add_county_modifier = { + modifier = of_the_people_perk_modifier + years = 2 + } + } + } +} diff --git a/N3OW/common/scripted_effects/00_war_effects.txt b/N3OW/common/scripted_effects/00_war_effects.txt new file mode 100644 index 00000000..ac5154fe --- /dev/null +++ b/N3OW/common/scripted_effects/00_war_effects.txt @@ -0,0 +1,3060 @@ + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! + +# on_declared_war +# +# [...] +# +# send_captured_combatant_message: Sends the specified message to a character about a combatant being captured after a battle. +# send_slain_combatant_message: Sends the specified message to a character about a combatant being slain after (or in) a battle. +# add_truce_attacker_victory_effect: Used to set truces in a CB's on_victory +# add_truce_white_peace_effect: Used to set truces in a CB's on_white_peace +# add_truce_attacker_defeat_effect: Used to set truces in a CB's on_defeat + + +##################################################################### +# EFFECTS +##################################################################### + +on_declared_war = { + ############################### + ##### Attacker music + ############################### + if = { + limit = { + exists = scope:war # silence error when building description before war exists + scope:war = { using_holy_war_cb_trigger = yes } # going CB->war->is this war's CB a certain type->yes + } + scope:attacker = { play_music_cue = mx_cue_crusade_starts } + } + else_if = { + limit = { + exists = scope:war + has_mpo_dlc_trigger = yes + OR = { + scope:attacker = { + government_has_flag = government_is_nomadic + any_character_situation = { + this = situation:the_great_steppe + } + } + scope:defender = { + government_has_flag = government_is_nomadic + any_character_situation = { + this = situation:the_great_steppe + } + } + } + } + scope:attacker = { play_music_cue = mx_cue_the_khans_glory } + } + else_if = { + limit = { + exists = scope:war + OR = { + scope:attacker = { fp3_character_any_involvement_persian_struggle_trigger = yes } + scope:defender = { fp3_character_any_involvement_persian_struggle_trigger = yes } + } + } + scope:attacker = { play_music_cue = strugglewar_cue } + } + else_if = { + limit = { + exists = scope:war + OR = { + scope:attacker = { fp2_character_any_involvement_iberian_struggle_trigger = yes } + scope:defender = { fp2_character_any_involvement_iberian_struggle_trigger = yes } + } + } + scope:attacker = { play_music_cue = mx_IberiaWar } + } + else_if = { + limit = { + exists = scope:war + scope:attacker = { fp1_is_norse_tribal = yes } + } + scope:attacker = { play_music_cue = mx_raid } + } + else = { + scope:attacker = { play_music_cue = mx_cue_war_declared } + } + ############################### + ##### Defender music + ############################### + if = { + limit = { + exists = scope:war + OR = { + scope:attacker = { fp2_character_any_involvement_iberian_struggle_trigger = yes } + scope:defender = { fp2_character_any_involvement_iberian_struggle_trigger = yes } + } + } + scope:defender = { play_music_cue = mx_IberiaWar } + } + else_if = { + limit = { + exists = scope:war + has_mpo_dlc_trigger = yes + OR = { + scope:attacker = { + government_has_flag = government_is_nomadic + any_character_situation = { + this = situation:the_great_steppe + } + } + scope:defender = { + government_has_flag = government_is_nomadic + any_character_situation = { + this = situation:the_great_steppe + } + } + } + } + scope:defender = { play_music_cue = mx_cue_the_khans_glory } + } + else_if = { + limit = { + exists = scope:war + OR = { + scope:attacker = { fp3_character_any_involvement_persian_struggle_trigger = yes } + scope:defender = { fp3_character_any_involvement_persian_struggle_trigger = yes } + } + } + scope:defender = { play_music_cue = strugglewar_cue } + } + else_if = { + limit = { + exists = scope:war + scope:attacker = { fp1_is_norse_tribal = yes } + } + scope:defender = { play_music_cue = mx_raid } + } + + else = { + scope:defender = { + play_music_cue = mx_cue_war_declared + } + } + + ############################### + ##### Effects + ############################### + + #There is no fighting in the admin room! + if = { + limit = { + scope:attacker = { + OR = { + government_has_flag = government_is_feudal + government_has_flag = government_is_clan + government_has_flag = government_is_tribal + } + liege ?= { + government_has_flag = government_is_administrative + } + } + scope:defender = { + government_has_flag = government_is_administrative + liege ?= scope:attacker.liege + } + } + custom_description_no_bullet = { + text = on_declared_war_in_admin + } + scope:attacker.liege = { + add_opinion = { + target = scope:attacker + modifier = declared_war_in_admin + } + } + } + + # Breaking Truce + if = { + limit = { + scope:attacker = { + has_truce = scope:defender + NOT = { has_character_flag = allowed_war_declaration_sans_truce_penalties } + } + } + scope:attacker = { + custom_description_no_bullet = { + text = attack_breaking_truce_text + } + + # Remove the war target from the bought_truce_list if they're in it + if = { + limit = { + has_purchased_truce_with_char = { TARGET = scope:defender } + } + remove_list_variable = { + name = bought_truce_list + target = scope:recipient + } + } + + if = { + limit = { + NOT = { has_perk = flexible_truces_perk } + } + add_prestige = break_truce_prestige_loss + add_prestige_level = break_truce_prestige_level_loss + } + + if = { + limit = { + government_has_flag = government_is_mandala + scope:defender = { var:recent_mandala_suzerain ?= scope:attacker } + } + add_legitimacy = { + value = medium_legitimacy_loss + multiply = primary_title.tier + } + add_piety_experience = massive_piety_loss + add_character_modifier = { + modifier = mandala_broke_truce_modifier + years = 5 + } + } + else = { + add_legitimacy = { + value = medium_legitimacy_loss + multiply = primary_title.tier + } + } + add_character_modifier = { + modifier = broke_truce + years = 3 + } + + # Struggle Catalysts. + if = { + limit = { + any_character_struggle = { + involvement = involved + activate_struggle_catalyst_secondary_character_involvement_involved_trigger = { + CATALYST = catalyst_broke_truce_against_important_character + CHAR = scope:defender + } + } + } + every_character_struggle = { + involvement = involved + limit = { + activate_struggle_catalyst_secondary_character_involvement_involved_trigger = { + CATALYST = catalyst_broke_truce_against_important_character + CHAR = scope:defender + } + } + activate_struggle_catalyst = { + catalyst = catalyst_broke_truce_against_important_character + character = scope:attacker + } + } + } + } + } + # Breaking Betrothals + if = { + limit = { + scope:attacker = { + is_allied_to = scope:defender + any_close_family_member = { + court_owner = scope:attacker + is_betrothed = yes + betrothed = { + court_owner = scope:defender + is_close_family_of = scope:defender + } + } + } + } + scope:attacker = { + custom_description_no_bullet = { + text = attack_breaking_betrothal_text + } + add_prestige = { + value = break_truce_prestige_loss + multiply = break_betrothal_prestige_cost + } + #Did you promise a grand wedding? + if = { + limit = { + has_variable = promised_grand_wedding_marriage_countdown + any_close_family_member = { + court_owner = scope:attacker + is_betrothed = yes + has_been_promised_grand_wedding = yes + betrothed = { + court_owner = scope:defender + is_close_family_of = scope:defender + has_been_promised_grand_wedding = yes + } + } + } + random_close_family_member = { + limit = { + court_owner = scope:attacker + is_betrothed = yes + has_been_promised_grand_wedding = yes + betrothed = { + court_owner = scope:defender + is_close_family_of = scope:defender + has_been_promised_grand_wedding = yes + } + } + save_scope_as = victim + } + #Start a house feud, if possible. + if = { + limit = { + has_dlc_feature = friends_and_foes + exists = scope:attacker.house.house_head + exists = scope:defender.house.house_head + NOT = { scope:attacker.house = scope:defender.house} + } + house_feud_start_effect = { + #Feuding House Head + ACTOR = scope:attacker.house.house_head + #Target House Head + TARGET = scope:defender.house.house_head + #Feud Reason + REASON = family_broke_gw_betrothal + #House Member attacker if relevant + ATTACKER = scope:attacker + #House Member victim if relevant + VICTIM = scope:victim + } + } + #Then remove promise + remove_variable = promised_grand_wedding_marriage_countdown + } + every_close_family_member = { + limit = { + court_owner = scope:attacker + is_betrothed = yes + betrothed = { + court_owner = scope:defender + is_close_family_of = scope:defender + } + } + break_betrothal = betrothed + } + } + } + # Breaking Alliance + else_if = { + limit = { + scope:attacker = { + is_allied_to = scope:defender + } + } + scope:attacker = { + break_alliance_due_to_attack_effect = { TARGET = scope:defender } + } + } + # Breaking Tributary + if = { + limit = { + OR = { + scope:attacker = { is_tributary_of = scope:defender } + scope:defender = { is_tributary_of = scope:attacker } + } + } + scope:attacker = { + break_tributary_contract_due_to_attack_effect = { DEFENDER = scope:defender } + } + } + # BP2: Attacking Warden + if = { + limit = { + scope:attacker = { + any_home_court_hostage = { is_hostage_of = scope:defender } + } + } + scope:attacker = { + add_prestige = break_truce_prestige_loss + add_prestige_level = break_truce_prestige_level_loss + add_character_modifier = { + modifier = attacked_warden + years = 5 + } + # Hostages they hold (yours) + every_home_court_hostage = { + save_scope_as = hostage + every_close_family_member = { + limit = { + this != scope:attacker + } + custom = attacked_warden_tt + add_opinion = { + modifier = attacked_warden + target = scope:attacker + } + } + if = { + limit = { is_hostage_of = scope:defender } + custom_description_no_bullet = { + text = attack_breaking_truce_hostage + subject = scope:defender + object = scope:hostage + } + } + } + } + } + # BP2: Attacking Home Court + if = { + limit = { + scope:attacker = { + any_warden_hostage = { is_hostage_from = scope:defender } + } + } + scope:attacker = { + # Hostages you hold (theirs) + every_warden_hostage = { + save_scope_as = hostage + if = { + limit = { is_hostage_from = scope:defender } + custom_description_no_bullet = { + text = attack_breaking_truce_hostage + subject = scope:attacker + object = scope:hostage + } + } + } + add_prestige = break_truce_prestige_loss + add_prestige_level = break_truce_prestige_level_loss + add_character_modifier = { + modifier = attacked_home_court + years = 5 + } + # Hostages they hold (yours) + every_home_court_hostage = { + save_scope_as = hostage + every_close_family_member = { + limit = { + this != scope:attacker + } + custom = attacked_warden_tt + add_opinion = { + modifier = attacked_home_court + target = scope:attacker + } + } + if = { + limit = { is_hostage_of = scope:defender } + custom_description_no_bullet = { + text = attack_breaking_truce_hostage + subject = scope:defender + object = scope:hostage + } + } + } + } + } + + # Opinion + scope:defender = { + add_opinion = { + target = scope:attacker + modifier = declared_war + } + } + if = { + limit = { + NOT = { + scope:attacker = { + is_parent_of = scope:defender + } + } + } + if = { + limit = { + scope:defender = { + has_father = yes + } + } + scope:defender = { + father = { + add_opinion = { + target = scope:attacker + modifier = declared_war_on_son_daughter + } + } + } + } + if = { + limit = { + scope:defender = { + has_mother = yes + } + } + scope:defender = { + mother = { + add_opinion = { + target = scope:attacker + modifier = declared_war_on_son_daughter + } + } + } + } + } + if = { + limit = { + scope:attacker.culture != scope:defender.culture + scope:attacker = { is_landed = yes } + scope:defender = { is_landed = yes } + } + scope:defender.culture = { + change_cultural_acceptance = { + target = scope:attacker.culture + value = declare_war_culture_acceptance_impact + desc = cultural_acceptance_loss_declared_war + } + } + } + + scope:attacker = { + if = { + limit = { + any_vassal = { + vassal_stance = parochial + } + eighty_percent_of_current_military_strength <= scope:defender.current_military_strength + } + custom_tooltip = parochial_vassal_disapproves_war + hidden_effect = { + every_vassal = { + vassal_stance = parochial + add_opinion = { + target = scope:attacker + modifier = parochial_disapproves_strong_war_enemy_opinion + } + } + } + } + } + + # If we're a clan this interaction affects unity + add_clan_unity_interaction_effect = { + CHARACTER = scope:attacker + TARGET = scope:defender + VALUE = massive_unity_loss + DESC = clan_unity_declared_war.desc + REVERSE_NON_HOUSE_TARGET = no + } + + intrigue_duel_on_attack_effect = yes +} + +break_alliance_due_to_attack_effect = { + custom_description_no_bullet = { text = attack_ally_text } + add_prestige = attack_ally_prestige_loss + add_prestige_level = attack_ally_prestige_level_loss + add_character_modifier = { + modifier = attacked_ally + years = 3 + } + break_alliance = $TARGET$ +} + +break_tributary_contract_due_to_attack_effect = { + save_scope_as = attacker + if = { + limit = { is_tributary_of = $DEFENDER$ } + reverse_add_opinion = { + modifier = tributary_ceased_payments_opinion + target = $DEFENDER$ + } + $DEFENDER$ = { + send_interface_toast = { + type = msg_tributary_contract_broken_due_to_war + left_icon = $DEFENDER$ + right_icon = scope:attacker + } + } + send_interface_toast = { + type = msg_tributary_contract_broken_due_to_war + left_icon = scope:attacker + right_icon = $DEFENDER$ + } + end_tributary = yes + } + else = { + if = { + limit = { + scope:attacker = { + NOT = { has_character_flag = allowed_war_declaration_sans_truce_penalties } + } + } + reverse_add_opinion = { + modifier = betrayal_opinion + target = $DEFENDER$ + opinion = -50 + } + } + send_interface_toast = { + type = msg_tributary_contract_broken_due_to_war + left_icon = scope:attacker + right_icon = $DEFENDER$ + } + $DEFENDER$ = { + send_interface_toast = { + type = msg_tributary_contract_broken_due_to_war + left_icon = $DEFENDER$ + right_icon = scope:attacker + } + end_tributary = yes + } + } +} + +conquest_cb_title_transfer = { + save_scope_as = target_title # For the vassalization trigger. + + # Compile a list of all counties in the kingdom we will take from the defender. + every_in_de_jure_hierarchy = { + continue = { + tier > tier_county + } + limit = { + tier = tier_county + + # Current holder must be a (sub)vassal of the defender (no poaching titles from 3rd parties!) + holder ?= { + OR = { + this = scope:defender + target_is_liege_or_above = scope:defender + } + } + } + add_to_list = titles_taken + } + + # If we can take the current holder of a title as a vassal instead of siezing their land directly, do so. + every_in_de_jure_hierarchy = { + limit = { + tier >= tier_county + trigger_if = { + limit = { $RELIGIOUS_WAR$ = yes } + religious_cb_holder_under_target_can_be_vassalized = yes + } + trigger_else = { + conquest_cb_holder_under_target_can_be_vassalized = yes + } + } + + # Mark this vassal as being eligible to transfer from the defender to the attacker. + holder = { + if = { + limit = { + NOT = { is_in_list = potential_vassals} + } + add_to_list = potential_vassals + } + } + } + ordered_in_list = { + list = potential_vassals + order_by = highest_held_title_tier + max = 99 + check_range_bounds = no + + if = { + # If a liege has already been added to the vassalization list, skip us (we will remain our liege's vassal.) + limit = { + save_temporary_scope_as = this_vassal + any_in_list = { + list = vassals_taken + target_is_vassal_or_below = scope:this_vassal + } + } + } + else = { + # Flag this character to be vassalized instead of usurped. + add_to_list = vassals_taken + + # Remove the counties this vassal holds from the siezed title list (the vassal gets to keep their land when switching allegiance!) + every_sub_realm_county = { + remove_from_list = titles_taken + } + } + } +} + +expansion_cb_title_transfer = { + save_scope_as = target_title # For the vassalization trigger. + + # Compile a list of all counties in the target title we will take from the defender. + every_in_de_jure_hierarchy = { + continue = { + tier > tier_county + } + limit = { + tier = tier_county + + # Current holder must be a (sub)vassal of the defender (no poaching titles from 3rd parties!) + holder ?= { + OR = { + this = scope:defender + target_is_liege_or_above = scope:defender + } + } + } + add_to_list = titles_taken + } + + if = { + limit = { + save_temporary_scope_as = checked_title + + tier >= scope:attacker.highest_held_title_tier + OR = { + AND = { + is_title_created = yes + holder = { + NOT = { + any_sub_realm_county = { + NOT = { target_is_de_jure_liege_or_above = scope:checked_title } + } + } + } + } + AND = { + is_title_created = no + any_de_jure_county = { + percent > 0.5 + holder ?= { + OR = { + this = scope:defender + any_liege_or_above = { this = scope:defender } + } + } + } + } + } + } + add_to_list = target_title_taken + } + + # If we can take the current holder of a title as a vassal instead of siezing their land directly, do so. + every_in_de_jure_hierarchy = { + limit = { + tier >= tier_county + conquest_cb_holder_under_target_can_be_vassalized = yes + } + + # Mark this vassal as being eligible to transfer from the defender to the attacker. + holder = { + if = { + limit = { + NOT = { is_in_list = potential_vassals} + } + add_to_list = potential_vassals + } + } + } + ordered_in_list = { + list = potential_vassals + order_by = highest_held_title_tier + max = 99 + check_range_bounds = no + + if = { + # If a liege has already been added to the vassalization list, skip us (we will remain our liege's vassal.) + limit = { + save_temporary_scope_as = this_vassal + any_in_list = { + list = vassals_taken + target_is_vassal_or_below = scope:this_vassal + } + } + } + else = { + # Flag this character to be vassalized instead of usurped. + add_to_list = vassals_taken + + # Remove the counties this vassal holds from the siezed title list (the vassal gets to keep their land when switching allegiance!) + every_sub_realm_county = { + remove_from_list = titles_taken + } + } + } +} + +expedition_cb_title_transfer = { + save_scope_as = target_title # For the vassalization trigger. + + # Compile a list of all counties in the kingdom we will take from the defender. + every_in_de_jure_hierarchy = { + continue = { + tier > tier_county + } + limit = { + OR = { + tier = tier_county + tier = tier_duchy + } + + # Current holder must be a (sub)vassal of the defender (no poaching titles from 3rd parties!) + holder ?= { + OR = { + this = scope:defender + target_is_liege_or_above = scope:defender + } + } + } + add_to_list = titles_taken + } + + # If we can take the current holder of a title as a vassal instead of siezing their land directly, do so. + every_in_de_jure_hierarchy = { + limit = { + tier >= tier_county + trigger_if = { + limit = { $RELIGIOUS_WAR$ = yes } + religious_cb_holder_under_target_can_be_vassalized = yes + } + trigger_else = { + conquest_cb_holder_under_target_can_be_vassalized = yes + } + } + + # Mark this vassal as being eligible to transfer from the defender to the attacker. + holder = { + if = { + limit = { + NOT = { is_in_list = potential_vassals} + } + add_to_list = potential_vassals + } + } + } + ordered_in_list = { + list = potential_vassals + order_by = highest_held_title_tier + max = 99 + check_range_bounds = no + + if = { + # If a liege has already been added to the vassalization list, skip us (we will remain our liege's vassal.) + limit = { + save_temporary_scope_as = this_vassal + any_in_list = { + list = vassals_taken + target_is_vassal_or_below = scope:this_vassal + } + } + } + else = { + # Flag this character to be vassalized instead of usurped. + add_to_list = vassals_taken + + # Remove the counties this vassal holds from the siezed title list (the vassal gets to keep their land when switching allegiance!) + every_sub_realm_county = { + remove_from_list = titles_taken + } + } + } +} + +struggle_cb_title_transfer = { + save_scope_as = target_title # For the vassalization trigger. + + # Compile a list of all counties in the kingdom we will take from the defender. + every_in_de_jure_hierarchy = { + continue = { + tier > tier_county + } + limit = { + tier = tier_county + + # Current holder must be a (sub)vassal of the defender (no poaching titles from 3rd parties!) + holder ?= { + OR = { + this = scope:defender + target_is_liege_or_above = scope:defender + } + } + } + add_to_list = titles_taken + } + + every_in_list = { + list = target_titles + limit = { + tier = tier_county + holder ?= { + highest_held_title_tier < scope:attacker.highest_held_title_tier + OR = { + this = scope:defender + target_is_liege_or_above = scope:defender + } + any_sub_realm_county = { + count = all + is_in_list = titles_taken + } + } + } + holder = { + if = { + limit = { + NOT = { is_in_list = potential_vassals } + } + add_to_list = potential_vassals + } + } + } + + ordered_in_list = { + list = potential_vassals + order_by = highest_held_title_tier + max = 99 + check_range_bounds = no + + if = { + # If a liege has already been added to the vassalization list, skip us (we will remain our liege's vassal.) + limit = { + save_temporary_scope_as = this_vassal + any_in_list = { + list = vassals_taken + target_is_vassal_or_below = scope:this_vassal + } + } + } + else = { + # Flag this character to be vassalized instead of usurped. + add_to_list = vassals_taken + + # Remove the counties this vassal holds from the siezed title list (the vassal gets to keep their land when switching allegiance!) + every_held_county = { + remove_from_list = titles_taken + } + every_sub_realm_county = { + remove_from_list = titles_taken + } + } + } +} + +excommunication_cb_piety_change = { + + #Amount of piety gain is scaled based on the highest tier title the defender has. + if = { + limit = { + scope:defender.highest_held_title_tier = tier_empire + } + $WINNER$ = { + if = { + limit = { + $WINNER$ = scope:attacker + } + add_piety = { + add = religious_cb_piety_gain_empire + multiply = excommunication_cb_piety_change_multiplier + } + } + else = { + add_piety = religious_cb_piety_gain_empire + } + } + $LOSER$ = { + add_piety = religious_cb_piety_loss_empire + } + } + + else_if = { + limit = { + scope:defender.highest_held_title_tier = tier_kingdom + } + $WINNER$ = { + if = { + limit = { + $WINNER$ = scope:attacker + } + add_piety = { + add = religious_cb_piety_gain_kingdom + multiply = excommunication_cb_piety_change_multiplier + } + } + else = { + add_piety = religious_cb_piety_gain_kingdom + } + } + $LOSER$ = { + add_piety = religious_cb_piety_loss_kingdom + } + } + else_if = { + limit = { + scope:defender.highest_held_title_tier = tier_duchy + } + $WINNER$ = { + if = { + limit = { + $WINNER$ = scope:attacker + } + add_piety = { + add = religious_cb_piety_gain_duchy + multiply = excommunication_cb_piety_change_multiplier + } + } + else = { + add_piety = religious_cb_piety_gain_duchy + } + } + $LOSER$ = { + add_piety = religious_cb_piety_loss_duchy + } + } + else = { + $WINNER$ = { + if = { + limit = { + $WINNER$ = scope:attacker + } + add_piety = { + add = religious_cb_piety_gain_county + multiply = excommunication_cb_piety_change_multiplier + } + } + else = { + add_piety = religious_cb_piety_gain_county + } + } + $LOSER$ = { + add_piety = religious_cb_piety_loss_county + } + } +} + +on_lost_aggression_war_discontent_loss = { + scope:loser = { + if = { + limit = { + has_targeting_faction = yes + } + add_targeting_factions_discontent = 25 + } + } +} + + +# Imprison all faction-members (rebelling vassals if there's no faction) if they lose a revolt-war and add a revoke reason +on_lost_faction_revolt_war = { + scope:defender = { save_scope_as = imprisoner } + if = { + limit = { + exists = scope:attacker.joined_faction + } + scope:attacker.joined_faction = { + set_variable = { + name = peasant_destroying + value = yes + } + every_faction_member = { + if = { + limit = { + exists = scope:attacker.joined_faction # Can get destroyed as we loop through + } + leave_faction_with_cooldown_effect = { + FACTION = scope:attacker.joined_faction + YEARS = faction_war_defeat_cooldown + } + } + else = { + add_faction_cooldown_effect = { YEARS = faction_war_defeat_cooldown } + } + } + } + } + war = { + every_war_attacker = { + limit = { + exists = liege + any_liege_or_above = { this = scope:defender } + } + if = { + limit = { + has_title = title:k_chrysanthemum_throne + exists = title:k_chrysanthemum_throne.current_heir + } + title:k_chrysanthemum_throne.current_heir = { save_scope_as = new_emperor } + create_title_and_vassal_change = { + type = revoked + save_scope_as = title_change + } + title:k_chrysanthemum_throne = { + change_title_holder = { + holder = scope:new_emperor + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + } + if = { # Imprison them if they aren't imprisoned. + limit = { + is_imprisoned = no + } + hard_imprison_character_effect = { + TARGET = this + IMPRISONER = scope:defender + } + } + scope:defender = { + add_opinion = { + target = prev + modifier = vassal_lost_faction_revolt_war + } + } + hidden_effect = { + #block them from joining factions if they aren't blocked yet, hidden because you should always see it through the effect applied to every_faction_member above + if = { + limit = { + NOT = { has_character_flag = joining_faction_block } + } + add_faction_cooldown_effect = { YEARS = faction_war_defeat_cooldown } + } + } + } + } +} + +# Imprison all revolters on lost request revolt. +on_lost_request_revolt_war = { + war = { + every_war_attacker = { + limit = { + exists = liege + any_liege_or_above = { this = scope:defender } + } + if = { + limit = { is_imprisoned = no } + hard_imprison_character_effect = { + TARGET = this + IMPRISONER = scope:defender + } + } + if = { + limit = { liege = scope:defender } + add_faction_cooldown_effect = { YEARS = faction_war_defeat_cooldown } + } + scope:defender = { + add_opinion = { + target = prev + modifier = vassal_lost_faction_revolt_war + } + } + } + } +} + +# Add revoke reason on all faction-members if they white peace a revolt-war +on_white_peace_faction_revolt_war = { + if = { + limit = { exists = scope:attacker.joined_faction } + scope:attacker.joined_faction = { + save_scope_as = current_faction + every_faction_member = { + if = { + limit = { + exists = scope:current_faction # Can get destroyed as we loop through + } + leave_faction_with_cooldown_effect = { + FACTION = scope:current_faction + YEARS = faction_war_white_peace_cooldown + } + } + else = { + add_faction_cooldown_effect = { YEARS = faction_war_white_peace_cooldown } + } + scope:defender = { + add_opinion = { + target = prev + modifier = vassal_wp_faction_revolt_war + } + } + } + } + scope:current_faction ?= { add_faction_discontent = -200 } + } +} + +#Add revoke reason to all attackers if they white peace on request war. +on_white_peace_request_revolt_war = { + war = { + every_war_attacker = { + limit = { + exists = liege + any_liege_or_above = { this = scope:defender } + } + scope:defender = { + add_opinion = { + target = prev + modifier = vassal_wp_faction_revolt_war + } + } + if = { + limit = { liege = scope:defender } + add_faction_cooldown_effect = { YEARS = faction_war_white_peace_cooldown } + } + } + } +} + +change_liege_or_become_independent = { + $CHANGE$ = { save_scope_as = change } + $VASSAL$ = { save_scope_as = vassal } + scope:vassal.liege = { save_scope_as = liege } + + if = { + limit = { + scope:liege = { + top_liege = this + } + } + scope:vassal = { + becomes_independent = { + change = scope:change + } + } + } + else = { + scope:vassal = { + change_liege = { + liege = scope:liege.liege + change = scope:change + } + } + } +} + +on_peasant_faction_war_win_common = { + create_title_and_vassal_change = { + type = conquest + save_scope_as = change + add_claim_on_loss = yes + } + + setup_claim_cb = { + titles = $TARGET_TITLES$ + attacker = $ATTACKER$ + defender = $DEFENDER$ + claimant = $CLAIMANT$ + change = scope:change + } + + resolve_title_and_vassal_change = scope:change +} + +on_claimant_faction_war_win_common = { + $DEFENDER$ = { + if = { + limit = { + is_tributary = yes + exists = suzerain + $CLAIMANT$ = { + is_tributary = no + OR = { + is_ruler = no + is_vassal_or_below_of = $DEFENDER$ + } + } + } + suzerain = { save_scope_as = handover_suzerain } + } + } + $CLAIMANT$ = { + save_scope_as = the_claimant + } + + # If the claimant is the prisoner of the defender, free the claimant (it doesn't make much sense to leave the new king in the old king's dungeon) + scope:the_claimant = { + if = { + limit = { + is_imprisoned_by = $DEFENDER$ + } + release_from_prison = yes + } + } + + # Add mutual opinion bonuses between claimant and faction members, as well as a hook on the claimant if possible. + $ATTACKER$.joined_faction = { + every_faction_member = { + custom = FACTION_CLAIMANT_EVERY_FACTION_MEMBER + limit = { + NOT = { this = $ATTACKER$.joined_faction.special_character } + } + hidden_effect = { + add_opinion = { + modifier = claimant_faction_member_opinion + target = $ATTACKER$.joined_faction.special_character + } + reverse_add_opinion = { + modifier = claimant_faction_claimant_opinion + target = $ATTACKER$.joined_faction.special_character + } + } + if = { + limit = { + can_add_hook = { + type = favor_hook + target = $ATTACKER$.joined_faction.special_character + } + } + add_hook = { + type = favor_hook + target = $ATTACKER$.joined_faction.special_character + } + } + # Struggle boost + if = { + limit = { + culture = $ATTACKER$.joined_faction.special_character.culture + any_character_struggle = { + involvement = involved + has_struggle_phase_parameter = struggle_prestige_install_same_culture_claimant + } + } + add_prestige = major_prestige_gain + } + + # Save the number of faction members for use further down + add_to_list = num_faction_members + } + } + + # Give the claimant their new title. + create_title_and_vassal_change = { + type = faction_demand + save_scope_as = change + add_claim_on_loss = yes + } + + # Ceremonial Liege + if = { + limit = { + exists = top_liege.primary_title.var:administrative_ui_special_title + scope:faction_targeted_title = $DEFENDER$.top_liege.primary_title.var:administrative_ui_special_title + } + $DEFENDER$ = { + every_held_title = { + limit = { + is_noble_family_title = no + is_landless_type_title = no + tier >= scope:faction_targeted_title.tier + } + add_to_list = faction_titles + } + } + } + every_in_list = { + list = $TARGET_TITLES$ + add_to_list = faction_titles + holder = { + save_scope_as = target_holder + } + } + scope:target_holder ?= { + if = { + limit = { + top_liege = this + government_allows = administrative + primary_title = { is_in_list = faction_titles } + } + every_held_title = { + title_tier > barony + limit = { + is_noble_family_title = no + } + add_to_list = faction_titles + } + } + } + ordered_in_list = { + list = $TARGET_TITLES$ + position = 0 + order_by = tier + save_scope_as = target_title + } + $ATTACKER$.joined_faction = { + every_faction_county_member = { + limit = { + NOT = { is_in_list = faction_titles } + } + add_to_list = faction_titles + } + } + + setup_claim_cb = { + titles = faction_titles + attacker = $ATTACKER$ + defender = $DEFENDER$ + claimant = scope:the_claimant + change = scope:change + civil_war = yes + } + + # Ensure that the liege structure is preserved + if = { + limit = { + scope:target_title.holder = { top_liege != this } + scope:the_claimant.primary_title.tier < scope:target_title.tier + } + scope:the_claimant = { + change_liege = { + liege = scope:target_title.holder.liege + change = scope:change + } + } + } + + # Preserve Grandeur + if = { + limit = { + scope:target_title.holder = { + has_royal_court = yes + has_dlc_feature = royal_court + } + scope:the_claimant = { + has_royal_court = no + } + } + scope:the_claimant = { + set_variable = { + name = previous_holder_grandeur_value + value = scope:target_title.holder.court_grandeur_current + } + } + } + + hidden_effect = { + if = { + limit = { + exists = scope:target_title.holder.dynasty + exists = scope:the_claimant.dynasty + scope:target_title.holder = { + has_variable = conqueror + scope:target_title.holder.dynasty = scope:the_claimant.dynasty + } + scope:the_claimant = { + OR = { + is_ai = no + ai_has_cautious_personality = no + } + NOT = { has_variable = conqueror } + } + } + scope:the_claimant = { + if = { + limit = { + is_ai = no + } + trigger_event = { + id = conqueror.0001 + days = 10 + } + } + else = { + trigger_event = conqueror.0001 + } + } + } + } + + resolve_title_and_vassal_change = scope:change + + # We give you decent Legitimacy so you don't get immediately deposed - people _really_ want you in the throne + # Can you even get Legitimacy? + if = { + limit = { + scope:the_claimant = { + is_valid_for_legitimacy_change = yes + } + } + # Per tier + if = { + limit = { + scope:target_title.tier = tier_empire + } + scope:the_claimant = { + add_legitimacy = { + value = 1000 + multiply = nomadic_legitimacy_claimant_multiplier + } + } + } + else_if = { + limit = { + scope:target_title.tier = tier_kingdom + } + scope:the_claimant = { + add_legitimacy = { + value = 750 + multiply = nomadic_legitimacy_claimant_multiplier + } + } + } + else_if = { + limit = { + scope:target_title.tier = tier_duchy + } + scope:the_claimant = { + add_legitimacy = { + value = 500 + multiply = nomadic_legitimacy_claimant_multiplier + } + } + } + else = { + scope:the_claimant = { + add_legitimacy = { + value = 300 + multiply = nomadic_legitimacy_claimant_multiplier + } + } + } + # Per number of faction members + if = { + limit = { + list_size:num_faction_members > 0 + scope:the_claimant = { + is_valid_for_legitimacy_change = yes + } + } + scope:the_claimant = { + add_legitimacy = { + value = list_size:num_faction_members + multiply = 50 + } + } + } + + } + + # Add Appropriate Grandeur + scope:the_claimant = { + if = { + limit = { + exists = var:previous_holder_grandeur_value + has_royal_court = yes + has_dlc_feature = royal_court + } + hidden_effect = { + change_current_court_grandeur = -100 # Reset to 0 + change_current_court_grandeur = var:previous_holder_grandeur_value + remove_variable = previous_holder_grandeur_value + } + change_current_court_grandeur = massive_court_grandeur_gain # Gain a bonus to Grandeur for winning a claim faction + } + } + + # Byzantine flavor + if = { + limit = { + scope:target_title = title:e_byzantium + has_ep3_dlc_trigger = yes + } + scope:the_claimant = { + trigger_event = { + id = ep3_emperor_yearly.2030 + days = 15 + } + } + } + + if = { + limit = { + exists = scope:handover_suzerain + } + start_tributary_interaction_effect = { + TRIBUTARY = scope:the_claimant + SUZERAIN = scope:handover_suzerain + } + } + +} + + +#To release the winners prisoners when the war ends +#Needs the arguments ATTACKER and WINNER. ATTACKER is weather the attacker won or not (y/n) and WINNER is the scope of the winner. +release_prisoners_of_war_effect = { + #Prisoners of defenders + every_war_defender = { + every_prisoner = { + limit = { + OR = { + this = scope:war.primary_attacker + scope:war.primary_attacker.primary_title = { + place_in_line_of_succession = { + target = prev + value <= 3 + } + } + } + } + add_to_list = defender_valuable_prisoners_list + release_from_prison = yes + } + scope:war.primary_defender = { + set_variable = { + name = valuable_prisoners + value = list_size:defender_valuable_prisoners_list + } + } + } + #Prisoners of attackers + every_war_attacker = { + every_prisoner = { + limit = { + OR = { + this = scope:war.primary_defender + scope:war.primary_defender.primary_title = { + place_in_line_of_succession = { + target = prev + value <= 3 + } + } + } + } + add_to_list = attacker_valuable_prisoners_list + release_from_prison = yes + } + scope:war.primary_attacker = { + set_variable = { + name = valuable_prisoners + value = list_size:attacker_valuable_prisoners_list + } + } + } +} + + +send_captured_combatant_message = { + # The positioning of the character portraits needs to sync up with the loc-string we're using. + if = { + limit = { + $IS_ENEMY_MESSAGE$ = no + } + root = { + save_scope_as = right_character + } + scope:enemy_army_owner = { + save_scope_as = left_character + } + } + else = { + root = { + save_scope_as = left_character + } + scope:enemy_army_owner = { + save_scope_as = right_character + } + } + + # Send either a toast or a message to this character, depending on what variable was passed in. + if = { + limit = { + $TOAST$ = yes + } + send_interface_toast = { + message_filter_type = combat_prisoners + title = $DESC$ + left_icon = scope:left_character + right_icon = scope:right_character + } + } + else_if = { + limit = { + $IS_ENEMY_MESSAGE$ = no + } + send_interface_message = { + type = event_captured_combatants_good + title = $TITLE$ + desc = $DESC$ + left_icon = scope:left_character + right_icon = scope:right_character + } + } + else = { + send_interface_message = { + type = event_captured_combatants_bad + title = $TITLE$ + desc = $DESC$ + left_icon = scope:left_character + right_icon = scope:right_character + } + } +} + +send_slain_combatant_message = { + # The positioning of the character portraits needs to sync up with the loc-string we're using. + if = { + limit = { + $IS_ENEMY_MESSAGE$ = no + } + root = { + save_scope_as = right_character + } + $KILLER$ = { + save_scope_as = left_character + } + } + else = { + root = { + save_scope_as = left_character + } + $KILLER$ = { + save_scope_as = right_character + } + } + + # Send either a toast or a message to this character, depending on what variable was passed in. + if = { + limit = { + $TOAST$ = yes + } + send_interface_toast = { + message_filter_type = combat_casualties + title = $DESC$ + left_icon = scope:left_character + right_icon = scope:right_character + } + } + # + else_if = { + limit = { + $IS_ENEMY_MESSAGE$ = no + } + send_interface_message = { + type = event_slain_combatants_good + title = $TITLE$ + desc = $DESC$ + left_icon = scope:left_character + right_icon = scope:right_character + } + } + else = { + send_interface_message = { + type = event_slain_combatants_bad + title = $TITLE$ + desc = $DESC$ + left_icon = scope:left_character + right_icon = scope:right_character + } + } +} + +send_new_alliance_message = { + $THIS_CHARACTER$ = { + every_character_war = { + limit = { + # As a pure notification thing, we only care about players. No need to waste CPU cycles for AI-only wars. + any_war_participant = { + is_ai = no + } + # Only if we're the primary attacker or defender (non-primary participants can't call their own allies) + OR = { + primary_attacker = $THIS_CHARACTER$ + primary_defender = $THIS_CHARACTER$ + } + # Don't send messages about alliances to landless courtiers (who can't actually join wars, alliance or no) + $THIS_CHARACTER$ = { is_playable_character = yes } + $OTHER_CHARACTER$ = { is_playable_character = yes } + } + save_scope_as = this_war + $THIS_CHARACTER$ = { save_scope_as = this_character } + $OTHER_CHARACTER$ = { save_scope_as = other_character } + every_war_participant = { + limit = { + is_ai = no + # We only want to alert people of potential new enemies + any_war_enemy = { this = scope:this_character} + } + send_interface_toast = { + type = msg_war_enemy_new_ally + title = enemy_gained_new_ally + left_icon = scope:this_character + right_icon = scope:other_character + custom_tooltip = enemy_gained_new_ally_tt + } + } + } + } +} + +# TRUCES +# Add attacker truce on victory +add_truce_attacker_victory_effect = { + scope:attacker = { # Vassal Stance opinion effect + if = { + limit = { + any_vassal = { + vassal_stance = glory_hound + } + } + custom_tooltip = glory_hound_approves_war_victory + hidden_effect = { + every_vassal = { + vassal_stance = glory_hound + add_opinion = { + target = scope:attacker + modifier = glory_hound_approves_war_victory_opinion + } + } + } + } + if = { + limit = { + government_has_flag = government_is_clan + house ?= { has_house_unity_stage = antagonistic } + any_vassal = { + house ?= scope:attacker.house + } + } + custom_tooltip = antagonistic_house_approves_war_victory + hidden_effect = { + every_vassal = { + limit = { + house ?= scope:attacker.house + } + add_opinion = { + target = scope:attacker + modifier = antagonistic_house_approves_war_victory_opinion + } + } + } + } + } + scope:defender ?= { # Vassal Stance opinion effect + if = { + limit = { + any_vassal = { + vassal_stance = glory_hound + } + } + custom_tooltip = glory_hound_disapproves_war_defeat_defender + hidden_effect = { + every_vassal = { + vassal_stance = glory_hound + add_opinion = { + target = scope:defender + modifier = glory_hound_disapproves_war_defeat_opinion + } + } + } + } + if = { + limit = { + government_has_flag = government_is_clan + house ?= { has_house_unity_stage = antagonistic } + any_vassal = { + house ?= scope:defender.house + } + } + custom_tooltip = antagonistic_house_disapproves_war_defeat_defender + hidden_effect = { + every_vassal = { + limit = { + house ?= scope:defender.house + } + add_opinion = { + target = scope:defender + modifier = antagonistic_house_disapproves_war_defeat_opinion + } + } + } + } + } + scope:attacker = { + hidden_effect = { + add_truce_one_way = { + character = scope:defender + days = standard_truce_duration_days + war = root.war + result = victory + } + } + } + # Feud + scope:attacker.house = { + change_house_relation_feud_score_effect = { + TARGET = scope:defender.house + REASON = war + VALUE = house_feud_medium_counter_value + } + } + # Tooltips for hostage exchange, handled here as it's shared between casus belli + bp2_hostage_war_end_tooltip_effect = yes +} + +# Add white peace truce +add_truce_white_peace_effect = { + scope:attacker = { # Vassal Stance opinion effect + if = { + limit = { + any_vassal = { + vassal_stance = glory_hound + } + } + custom_tooltip = glory_hound_disapproves_war_white_peace + hidden_effect = { + every_vassal = { + vassal_stance = glory_hound + add_opinion = { + target = scope:attacker + modifier = glory_hound_disapproves_war_white_peace_opinion + } + } + } + } + if = { + limit = { + government_has_flag = government_is_clan + house ?= { has_house_unity_stage = antagonistic } + any_vassal = { + house ?= scope:attacker.house + } + } + custom_tooltip = antagonistic_house_disapproves_war_white_peace + hidden_effect = { + every_vassal = { + limit = { + house ?= scope:attacker.house + } + add_opinion = { + target = scope:attacker + modifier = antagonistic_house_disapproves_war_white_peace_opinion + } + } + } + } + if = { + limit = { + any_active_accolade = { + accolade_parameter = accolade_champions_white_peace + } + } + add_prestige = accolade_white_peace_prestige_value + } + } + scope:defender = { # Vassal Stance opinion effect + if = { + limit = { + any_vassal = { + vassal_stance = glory_hound + } + } + custom_tooltip = glory_hound_disapproves_war_white_peace_defender + hidden_effect = { + every_vassal = { + vassal_stance = glory_hound + add_opinion = { + target = scope:defender + modifier = glory_hound_disapproves_war_white_peace_opinion + } + } + } + } + if = { + limit = { + government_has_flag = government_is_clan + house ?= { has_house_unity_stage = antagonistic } + any_vassal = { + house ?= scope:defender.house + } + } + custom_tooltip = antagonistic_house_disapproves_war_white_peace_defender + hidden_effect = { + every_vassal = { + limit = { + house ?= scope:defender.house + } + add_opinion = { + target = scope:defender + modifier = antagonistic_house_disapproves_war_white_peace_opinion + } + } + } + } + } + hidden_effect = { + scope:attacker = { + add_truce_one_way = { + character = scope:defender + days = standard_truce_duration_days + war = root.war + result = white_peace + } + } + } + scope:attacker = { + if = { + limit = { + house_has_feud_relation_with_trigger = { TARGET = scope:defender } + } + house = { + every_house_member = { + limit = { is_ai = no } + send_interface_message = { + type = house_feud_white_peace_message + left_icon = scope:attacker + right_icon = scope:defender + title = msg_house_feud_white_peace + desc = msg_house_feud_white_peace_desc + } + } + } + scope:defender.house = { + every_house_member = { + limit = { is_ai = no } + send_interface_message = { + type = house_feud_white_peace_message + left_icon = scope:defender + right_icon = scope:attacker + title = msg_house_feud_white_peace + desc = msg_house_feud_white_peace_desc + } + } + } + } + } + # Tooltips for hostage exchange, handled here as it's shared between casus belli + bp2_hostage_war_end_tooltip_effect = yes +} + +# Add attacker truce on defeat +add_truce_attacker_defeat_effect = { + scope:attacker = { # Vassal Stance opinion effect + if = { + limit = { + any_vassal = { + vassal_stance = glory_hound + } + } + custom_tooltip = glory_hound_disapproves_war_defeat + hidden_effect = { + every_vassal = { + vassal_stance = glory_hound + add_opinion = { + target = scope:attacker + modifier = glory_hound_disapproves_war_defeat_opinion + } + } + } + } + if = { + limit = { + government_has_flag = government_is_clan + house ?= { has_house_unity_stage = antagonistic } + any_vassal = { + house ?= scope:attacker.house + } + } + custom_tooltip = antagonistic_house_disapproves_war_defeat + hidden_effect = { + every_vassal = { + limit = { + house ?= scope:attacker.house + } + add_opinion = { + target = scope:attacker + modifier = antagonistic_house_disapproves_war_defeat_opinion + } + } + } + } + } + hidden_effect = { + scope:attacker = { + add_truce_one_way = { + character = scope:defender + days = standard_truce_duration_days + war = root.war + result = defeat + } + } + } + scope:defender = { + # Feud + house = { + change_house_relation_feud_score_effect = { + TARGET = scope:attacker.house + REASON = war + VALUE = house_feud_medium_counter_value + } + } + if = { + limit = { + government_has_flag = government_is_clan + house ?= { has_house_unity_stage = antagonistic } + any_vassal = { + house ?= scope:defender.house + } + } + custom_tooltip = antagonistic_house_approves_war_victory_defensive + hidden_effect = { + every_vassal = { + limit = { + house ?= scope:defender.house + } + add_opinion = { + target = scope:defender + modifier = antagonistic_house_approves_war_victory_defensive_opinion + } + } + } + } + } + # Tooltips for hostage exchange, handled here as it's shared between casus belli + bp2_hostage_war_end_tooltip_effect = yes +} + +# Add GHW truces on attacker victory. +add_truce_GHW_attacker_victory_effect = { + hidden_effect = { + scope:attacker.faith.great_holy_war = { + every_pledged_defender = { + add_truce_both_ways = { + character = scope:title_recipient + days = 3650 + war = root.war + result = defeat + } + } + } + } +} + +# Force a white peace on any forced. +force_truce_GHW_defenders_effect = { + hidden_effect = { + #if any defender + #owns lands in target kingdom + #is primary in war with another defender who + #owns land in target kingdom + #is also a primary + #then end that war with a white peace + scope:the_ghw = { + every_pledged_defender = { + save_temporary_scope_as = white_peace_attacker + every_character_war = { + if = { + limit = { + primary_attacker = scope:white_peace_attacker + primary_defender = { + save_temporary_scope_as = white_peace_defender + OR = { + scope:the_ghw = { has_forced_defender = scope:white_peace_defender } + AND = { + scope:target_kingdom = { + any_de_jure_county_holder = { + OR = { + this = scope:white_peace_defender + any_liege_or_above = { this = scope:white_peace_defender } + } + } + } + top_liege = { + save_temporary_scope_as = white_peace_liege + scope:the_ghw = { has_forced_defender = scope:white_peace_liege } + } + } + } + } + } + end_war = white_peace + } + } + } + } + } +} + +notify_players_about_neighboring_war_resolution_effect = { + every_player = { + limit = { + NOT = { is_participant_in_war = scope:war} + } + save_scope_as = this_player + + # Checks if this player should be notified at all about the war resolution (e.g., either attacker or defender are neighbors). + if = { + limit = { + should_notify_player_about_neighboring_rulers_wars_trigger = { TARGET_CHARACTER = scope:winner } + + # Only notify about revolts if rebels win + trigger_if = { + limit = { + scope:war = { + OR = { + using_cb = peasant_war + using_cb = independence_faction_war + using_cb = liberty_faction_war + using_cb = populist_war + using_cb = depose_war + using_cb = claimant_faction_war + } + } + } + scope:winner = scope:attacker + } + } + + # Check which type of message we need to send to the player. + if = { + limit = { + always = yes + should_notify_player_about_neighboring_rulers_wars_trigger = { TARGET_CHARACTER = scope:loser } + } + # Send combined message about both the winner and the loser. + send_interface_message = { + type = msg_war_ended_neighbor + left_icon = scope:winner + right_icon = scope:loser + title = war_event.neighbor_war.both_neighbors.t + desc = war_event.neighbor_war.both_neighbors.desc + } + } + else = { + # Send message only about the winner. + send_interface_message = { + type = msg_war_ended_neighbor + left_icon = scope:winner + right_icon = scope:loser + title = war_event.neighbor_war.only_winner.t + desc = war_event.neighbor_war.only_winner.desc + } + } + } + else_if = { + limit = { + should_notify_player_about_neighboring_rulers_wars_trigger = { TARGET_CHARACTER = scope:loser } + + # Only notify about revolts if rebels win + trigger_if = { + limit = { + scope:war = { + OR = { + using_cb = peasant_war + using_cb = independence_faction_war + using_cb = liberty_faction_war + using_cb = populist_war + using_cb = depose_war + using_cb = claimant_faction_war + } + } + } + scope:winner = scope:attacker + } + } + + # Send message only about the loser. + send_interface_message = { + type = msg_war_ended_neighbor + left_icon = scope:loser + right_icon = scope:winner + title = war_event.neighbor_war.only_loser.t + desc = war_event.neighbor_war.only_loser.desc + } + } + } +} + +show_pow_release_message_effect = { + if = { + limit = { + any_character_war = { + primary_attacker = scope:attacker + primary_defender = scope:defender + } + } + every_character_war = { + limit = { + primary_attacker = scope:attacker + primary_defender = scope:defender + } + save_scope_as = war + } + if = { + limit = { prisoners_of_war_trigger = yes } + custom_tooltip = release_pow_at_end_of_war + } + } +} + +add_prestige_war_defender_effect = { + add_prestige = { + value = $PRESTIGE_VALUE$ + if = { + limit= { + scope:defender.culture = { + has_cultural_parameter = more_fame_for_successful_defensive_wars + } + } + multiply = 2 + } + } +} + +pay_short_term_gold_reparations_effect = { + if = { + limit = { has_government = landless_adventurer_government } + pay_short_term_gold = { + gold = { + value = medium_gold_value + multiply = $GOLD_VALUE$ + if = { + limit= { + scope:defender.culture = { has_cultural_parameter = more_gold_for_successful_defensive_wars } + } + multiply = 2 + } + } + target = scope:defender + } + } + else = { + pay_short_term_gold = { + gold = { + value = $GOLD_VALUE$ + if = { + limit= { + scope:defender.culture = { has_cultural_parameter = more_gold_for_successful_defensive_wars } + } + multiply = 2 + } + } + target = scope:defender + yearly_income = yes # STANDARD + } + } +} + +pay_short_term_gold_reparations_prefer_greater_income_effect = { + if = { + limit = { scope:defender.yearly_character_income >= scope:attacker.yearly_character_income } + pay_short_term_gold = { + gold = { + value = scope:defender.yearly_character_income + multiply = { + add = $FACTOR$ + if = { + limit= { + scope:defender.culture = { + has_cultural_parameter = more_gold_for_successful_defensive_wars + } + } + multiply = 2 + } + } + } + target = scope:defender + } + } + else = { + pay_short_term_gold = { + gold = { + value = yearly_character_income + multiply = { + add = $FACTOR$ + if = { + limit= { + scope:defender.culture = { + has_cultural_parameter = more_gold_for_successful_defensive_wars + } + } + multiply = 2 + } + } + } + target = scope:defender + } + } +} + + +mongol_invasion_county_looting_chance_effect = { + save_temporary_scope_as = county + if = { + limit = { + NOR = { + exists = var:looted_by_mongols + holder = scope:attacker + } + } + random = { + chance = scope:attacker.martial + # Each County should only be devastated once + set_variable = { + name = looted_by_mongols + value = yes + } + # Send a message (and gold!) to the Mongol Emperor + scope:attacker = { + send_interface_message = { + type = event_war_bad + title = mongols_sieged_county.t + left_icon = scope:county.holder + right_icon = scope:county + if = { + limit = { + scope:county.development_level >= 1 + } + add_gold = { + add = scope:county.development_level + multiply = 5 + } + } + if = { + limit = { dread < 150 } + add_dread = 2 + } + } + save_scope_as = mongol_emperor + # Send a message to the County's owner + scope:county.holder = { + send_interface_message = { + type = event_war_bad + title = mongols_sieged_county.t + left_icon = scope:mongol_emperor + right_icon = scope:county + scope:county = { mongols_devastate_county_effect = yes } + } + } + } + } + } +} + +intrigue_duel_on_attack_effect = { + scope:attacker = { + if = { + limit = { + has_character_flag = intrigue_duel_on_attack + } + duel = { + skill = intrigue + value = scope:defender.intrigue + 50 = { + compare_modifier = { + value = scope:duel_value + multiplier = 3.5 + min = -49 + } + desc = intrigue_duel_on_attack_effect.success + send_interface_toast = { + title = armies_hampered + left_icon = scope:attacker + right_icon = scope:defender + scope:defender = { + add_character_modifier = { + modifier = hampered_by_false_information_modifier + years = 5 + } + } + } + hidden_effect = { + show_as_tooltip = { + send_interface_toast = { + title = armies_hampered + left_icon = scope:attacker + right_icon = scope:defender + scope:defender = { + add_character_modifier = { + modifier = hampered_by_false_information_modifier + years = 5 + } + } + } + } + } + } + 50 = { + compare_modifier = { + value = scope:duel_value + multiplier = -3.5 + min = -49 + } + desc = intrigue_duel_on_attack_effect.failure + send_interface_toast = { + title = armies_unhampered + left_icon = scope:attacker + right_icon = scope:defender + } + } + } + } + } +} + +allies_progress_towards_friendship_effect = { + scope:war = { + every_war_participant = { + limit = { + is_target_in_variable_list = { + name = joined_as_ally + target = scope:war + } + } + if = { + limit = { + is_defender_in_war = scope:war + } + scope:defender = { + save_scope_as = actor + } + } + else = { + scope:attacker = { + save_scope_as = actor + } + } + save_scope_as = ally + if = { + limit = { + is_ai = yes + scope:war = { + war_contribution = { + target = scope:ally + value > 0 + } + } + } + scope:actor = { + progress_towards_friend_effect = { + CHARACTER = scope:ally + OPINION = 0 + REASON = friend_alliance + } + } + } + else = { + hidden_effect = { #To nudge friendship + scope:actor = { + if = { + limit = { + NOR = { + has_relation_friend = scope:ally + has_relation_potential_friend = scope:ally + } + scope:war = { + war_contribution = { + target = scope:ally + value > 0 + } + } + } + set_relation_potential_friend = scope:ally + } + } + } + } + remove_list_variable = { + name = joined_as_ally + target = scope:war + } + } + } +} + +# ROOT is a combat side in this scripted effect, but the THIS scope should be the commander +commander_trait_leveling_leveling_effect = { + if = { # Terrain Based + limit = { + OR = { + has_trait = desert_warrior + has_trait = open_terrain_expert + has_trait = rough_terrain_expert + has_trait = forest_fighter + has_trait = jungle_stalker + } + } + if = { + limit = { + has_trait = desert_warrior + location = { + OR = { + terrain = drylands + terrain = desert + terrain = desert_mountains + terrain = oasis + } + } + } + add_trait_xp = { + trait = desert_warrior + value = { + value = $XP$ + multiply = 2 + add = { + value = martial + divide = 10 + } + } + } + } + else_if = { + limit = { + has_trait = open_terrain_expert + location = { + OR = { + terrain = farmlands + terrain = plains + terrain = steppe + } + } + } + add_trait_xp = { + trait = open_terrain_expert + value = { + value = $XP$ + multiply = 2 + add = { + value = martial + divide = 10 + } + } + } + } + else_if = { + limit = { + has_trait = rough_terrain_expert + location = { + OR = { + terrain = hills + terrain = mountains + terrain = wetlands + } + } + } + add_trait_xp = { + trait = rough_terrain_expert + value = { + value = $XP$ + multiply = 2 + add = { + value = martial + divide = 10 + } + } + } + } + else_if = { + limit = { + has_trait = forest_fighter + location = { + OR = { + terrain = forest + terrain = taiga + } + } + } + add_trait_xp = { + trait = forest_fighter + value = { + value = $XP$ + multiply = 2 + add = { + value = martial + divide = 10 + } + } + } + } + else_if = { + limit = { + has_trait = jungle_stalker + location = { + terrain = jungle + } + } + add_trait_xp = { + trait = jungle_stalker + value = { + value = $XP$ + multiply = 2 + add = { + value = martial + divide = 10 + } + } + } + } + } + if = { # Forder + limit = { + has_trait = forder + location = { + OR = { + is_coastal = yes + is_riverside_province = yes + } + } + } + add_trait_xp = { + trait = forder + value = { + value = $XP$ + multiply = 2 + add = { + value = martial + divide = 10 + } + } + } + } + if = { # Attackers/Defenders + limit = { + OR = { + has_trait = aggressive_attacker + has_trait = unyielding_defender + } + } + if = { + limit = { + has_trait = aggressive_attacker + root = { is_combat_side_attacker = yes } + } + add_trait_xp = { + trait = aggressive_attacker + value = { + value = $XP$ + add = { + value = martial + divide = 10 + } + } + } + } + else_if = { + limit = { + has_trait = unyielding_defender + root = { is_combat_side_attacker = no } + } + add_trait_xp = { + trait = unyielding_defender + value = { + value = $XP$ + add = { + value = martial + divide = 10 + } + } + } + } + } + if = { # Flexible Leader + limit = { + has_trait = flexible_leader + } + add_trait_xp = { + trait = flexible_leader + value = { + value = $XP$ + multiply = 0.5 + add = { + value = martial + divide = 10 + } + } + } + } + if = { # Religious + limit = { + has_trait = holy_warrior + root.enemy_side.side_commander.religion != root.side_commander.religion + } + add_trait_xp = { + trait = holy_warrior + value = { + value = $XP$ + multiply = 0.75 + add = { + value = martial + divide = 10 + } + } + } + } + if = { # Larger Armies + limit = { + OR = { + has_trait = reckless + has_trait = cautious_leader + } + root = { troops_ratio < 0.95 } + } + if = { + limit = { + has_trait = reckless + } + add_trait_xp = { + trait = reckless + value = { + value = $XP$ + multiply = 3 + add = { + value = martial + divide = 10 + } + } + } + } + if = { + limit = { + has_trait = cautious_leader + } + add_trait_xp = { + trait = cautious_leader + value = { + value = $XP$ + multiply = 3 + add = { + value = martial + divide = 10 + } + } + } + } + } + if = { # Seasonal + limit = { + has_trait = winter_soldier + location = { has_winter_combat_trigger = yes } + } + add_trait_xp = { + trait = winter_soldier + value = { + value = $XP$ + multiply = 0.75 + add = { + value = martial + divide = 10 + } + } + } + } + if = { # Peasant Leader fighting non peasants + limit = { + has_trait = peasant_leader + root.enemy_side.side_commander = { + is_lowborn = no + } + } + add_trait_xp = { + trait = peasant_leader + value = { + value = $XP$ + multiply = 0.75 + add = { + value = martial + divide = 10 + } + } + } + } +} + +on_ceremonial_claimant_faction_war_win_common = { + $TITLE$ = { + save_scope_as = target_title + holder = { save_scope_as = previous_emperor } + } + $CLAIMANT$ = { + save_scope_as = the_claimant + # If the claimant is the prisoner of the defender, free the claimant (it doesn't make much sense to leave the new king in the old king's dungeon) + if = { + limit = { is_imprisoned_by = $DEFENDER$ } + release_from_prison = yes + } + } + + # Add mutual opinion bonuses between claimant and faction members, as well as a hook on the claimant if possible. + $ATTACKER$.joined_faction = { + every_faction_member = { + custom = FACTION_CLAIMANT_EVERY_FACTION_MEMBER + limit = { + NOT = { this = $ATTACKER$.joined_faction.special_character } + } + hidden_effect = { + add_opinion = { + modifier = ceremonial_claimant_faction_member_opinion + target = $ATTACKER$.joined_faction.special_character + } + reverse_add_opinion = { + modifier = ceremonial_claimant_faction_claimant_opinion + target = $ATTACKER$.joined_faction.special_character + } + } + if = { + limit = { + can_add_hook = { + type = favor_hook + target = $ATTACKER$.joined_faction.special_character + } + } + add_hook = { + type = favor_hook + target = $ATTACKER$.joined_faction.special_character + } + } + # Struggle boost + if = { + limit = { + culture = $ATTACKER$.joined_faction.special_character.culture + any_character_struggle = { + involvement = involved + has_struggle_phase_parameter = struggle_prestige_install_same_culture_claimant + } + } + add_prestige = major_prestige_gain + } + + # Save the number of faction members for use further down + add_to_list = num_faction_members + } + } + + scope:the_claimant = { + if = { + limit = { is_landed = yes } + force_step_down_landed_titles = yes + } + } + + # Give the claimant their new title. + create_title_and_vassal_change = { + type = faction_demand + save_scope_as = change + add_claim_on_loss = yes + } + + # Preserve Grandeur + if = { + limit = { + scope:target_title.holder = { + has_royal_court = yes + has_dlc_feature = royal_court + } + scope:the_claimant = { + has_royal_court = no + } + } + scope:the_claimant = { + set_variable = { + name = previous_holder_grandeur_value + value = scope:target_title.holder.court_grandeur_current + } + } + } + + scope:the_claimant = { + if = { + limit = { has_trait = former_emperor } + remove_trait = former_emperor + } + } + + scope:target_title = { + change_title_holder = { + holder = scope:the_claimant + change = scope:change + } + } + + resolve_title_and_vassal_change = scope:change + + scope:previous_emperor = { + add_trait = former_emperor + } + + # We give you decent Legitimacy so you don't get immediately deposed - people _really_ want you in the throne + # Can you even get Legitimacy? + if = { + limit = { + scope:the_claimant = { + is_valid_for_legitimacy_change = yes + } + } + # Per tier + if = { + limit = { + scope:target_title.tier = tier_empire + } + scope:the_claimant = { + add_legitimacy = { + value = 1000 + multiply = nomadic_legitimacy_claimant_multiplier + } + } + } + else_if = { + limit = { + scope:target_title.tier = tier_kingdom + } + scope:the_claimant = { + add_legitimacy = { + value = 750 + multiply = nomadic_legitimacy_claimant_multiplier + } + } + } + else_if = { + limit = { + scope:target_title.tier = tier_duchy + } + scope:the_claimant = { + add_legitimacy = { + value = 500 + multiply = nomadic_legitimacy_claimant_multiplier + } + } + } + else = { + scope:the_claimant = { + add_legitimacy = { + value = 300 + multiply = nomadic_legitimacy_claimant_multiplier + } + } + } + # Per number of faction members + if = { + limit = { + list_size:num_faction_members > 0 + scope:the_claimant = { + is_valid_for_legitimacy_change = yes + } + } + scope:the_claimant = { + add_legitimacy = { + value = list_size:num_faction_members + multiply = 50 + } + } + } + + } + + # Add Appropriate Grandeur + scope:the_claimant = { + if = { + limit = { + exists = var:previous_holder_grandeur_value + has_royal_court = yes + has_dlc_feature = royal_court + } + hidden_effect = { + change_current_court_grandeur = -100 # Reset to 0 + change_current_court_grandeur = var:previous_holder_grandeur_value + remove_variable = previous_holder_grandeur_value + } + change_current_court_grandeur = massive_court_grandeur_gain # Gain a bonus to Grandeur for winning a claim faction + } + } +} diff --git a/N3OW/common/scripted_effects/00_while_loop_effects.txt b/N3OW/common/scripted_effects/00_while_loop_effects.txt new file mode 100644 index 00000000..bc01ac71 --- /dev/null +++ b/N3OW/common/scripted_effects/00_while_loop_effects.txt @@ -0,0 +1,89 @@ +#WHILE LOOP EFFECTS + +#3 effects for managing while loops with counter: +#set_while_counter_variable_effect +#increase_while_counter_variable_effect +#remove_while_counter_variable_effect + +#save_target_list_as_separate_scopes_effect - saves up to 6 members of a target_list in alphabetical scopes (can be expanded if needed) + + +#3 effects for managing while loops with counter +set_while_counter_variable_effect = { + set_variable = { + name = while_counter + value = 0 + } +} + +increase_while_counter_variable_effect = { + change_variable = { + name = while_counter + add = 1 + } + +} + +remove_while_counter_variable_effect = { + remove_variable = while_counter +} + +#saves up to 6 members of a target_list in alphabetical scopes (can be expanded if needed) + +#Needs the argument TARGET_LIST with the target_list name +save_target_list_as_separate_scopes_effect = { + random_in_list = { + list = $TARGET_LIST$ + save_scope_as = target_list_member_a + } + random_in_list = { + list = $TARGET_LIST$ + limit = { scope:target_list_member_a != this } + save_scope_as = target_list_member_b + } + random_in_list = { + list = $TARGET_LIST$ + limit = { + NOR = { + scope:target_list_member_a = this + scope:target_list_member_b = this + } + } + save_scope_as = target_list_member_c + } + random_in_list = { + list = $TARGET_LIST$ + limit = { + NOR = { + scope:target_list_member_a = this + scope:target_list_member_b = this + scope:target_list_member_c = this + } + } + save_scope_as = target_list_member_d + } + random_in_list = { + list = $TARGET_LIST$ + limit = { + NOR = { + scope:target_list_member_a = this + scope:target_list_member_b = this + scope:target_list_member_c = this + scope:target_list_member_d = this + } + } + save_scope_as = target_list_member_e + } + random_in_list = { + list = $TARGET_LIST$ + limit = { + NOR = { + scope:target_list_member_a = this + scope:target_list_member_b = this + scope:target_list_member_c = this + scope:target_list_member_d = this + } + } + save_scope_as = target_list_member_f + } +} \ No newline at end of file diff --git a/N3OW/common/scripted_effects/00_witch_effects.txt b/N3OW/common/scripted_effects/00_witch_effects.txt new file mode 100644 index 00000000..24cf89dd --- /dev/null +++ b/N3OW/common/scripted_effects/00_witch_effects.txt @@ -0,0 +1,209 @@ +###CHILD CONVERSION EFFECTS### + +child_witch_conversion_success_effect = { + scope:child = { + give_witch_secret_or_trait_effect = yes + house = { + house_head = { + add_to_list = witch_message + } + } + every_parent = { + limit = { + is_ruler = yes + is_witch_trigger = yes + } + add_to_list = witch_message + } + random_relation = { + type = guardian + save_scope_as = guardian + } + } + every_in_list = { + list = witch_message + limit = { + this != scope:child + } + save_scope_as = witch_knower + send_interface_message = { + type = event_witchcraft_good + title = witch.1001.message + left_icon = scope:child + scope:child = { + if = { + limit = { has_trait = witch } + show_as_tooltip = { add_trait_force_tooltip = witch } + } + else_if = { + limit = { exists = scope:witch_secret } + scope:witch_secret = { reveal_to = scope:witch_knower } + } + add_opinion = { + target = PREV + modifier = impressed_opinion + opinion = 20 + } + } + random_secret = { + type = secret_witch + limit = { + NOT = { is_known_by = scope:child } + } + reveal_to = scope:child + } + } + } +} + +child_witch_conversion_failure_effect = { + scope:guardian = { + send_interface_toast = { + type = event_witchcraft_bad + title = child_witch_conversion_failure_effect.desc + left_icon = scope:child + scope:child = { + add_opinion = { + target = scope:guardian + modifier = suspicion_opinion + opinion = -15 + } + } + } + if = { + limit = { this = root } + hidden_effect = { + add_opinion = { + target = scope:child + modifier = disappointed_opinion + opinion = -15 + } + } + } + else = { + add_opinion = { + target = scope:child + modifier = disappointed_opinion + opinion = -15 + } + } + } +} + +child_witch_conversion_critical_failure_effect = { + scope:guardian = { + send_interface_toast = { + type = event_witchcraft_bad + title = child_witch_conversion_critical_failure_effect.desc + left_icon = scope:child + + scope:child = { + add_opinion = { + target = scope:guardian + modifier = hate_opinion + opinion = -30 + } + } + } + scope:child = { + scope:guardian = { + random_secret = { + type = secret_witch + save_scope_as = guardian_witch_secret + if = { + limit = { NOT = { is_known_by = scope:child } } + reveal_to = scope:child + } + if = { + limit = { + exists = scope:child.liege + NOR = { + is_known_by = scope:child.liege + scope:child = { is_ruler = yes } + } + } + scope:child.liege = { + send_interface_message = { + type = event_witchcraft_bad + title = child_witch_conversion_critical_failure_effect.liege.desc + left_icon = scope:guardian + right_icon = scope:child + scope:guardian_witch_secret = { reveal_to = scope:child.liege } + } + } + } + } + } + } + scope:guardian = { + if = { + limit = { this = root } + hidden_effect = { + add_opinion = { + target = scope:child + modifier = hate_opinion + opinion = -30 + } + } + } + else = { + add_opinion = { + target = scope:child + modifier = hate_opinion + opinion = -30 + } + } + } + } +} + +#Creates a witch and saves it as created_witch +#WHO is character who will interact with the witch and TEMPLATE is the character whose culture should be used +create_witch_effect = { + #Gender + random_list = { + 50 = { #Female + modifier = { + $WHO$ = { is_attracted_to_women = yes } + add = 30 + } + dummy_female = { save_temporary_scope_as = witch_gender } + } + 50 = { #Male + modifier = { + $WHO$ = { is_attracted_to_men = yes } + add = 30 + } + dummy_male = { save_temporary_scope_as = witch_gender } + } + } + + #Create them + create_character = { + location = $WHO$.capital_province + culture = $WHO$.culture + faith = $WHO$.faith + gender = scope:witch_gender + template = witchy_template + random_traits = no + + after_creation = { + give_witch_secret_or_trait_effect = yes + + #Sometimes adjust sexuality to create compatibility with WHO + if = { + limit = { + $WHO$ = { is_attracted_to_gender_of = prev } + NOT = { is_attracted_to_gender_of = $WHO$ } + } + random = { + chance = 65 + set_sexuality = bisexual + } + } + } + + save_scope_as = created_witch + } +} + diff --git a/N3OW/common/scripted_effects/00_yearly_event_effects.txt b/N3OW/common/scripted_effects/00_yearly_event_effects.txt new file mode 100644 index 00000000..f36cde51 --- /dev/null +++ b/N3OW/common/scripted_effects/00_yearly_event_effects.txt @@ -0,0 +1,433 @@ +#Effects used in the random Yearly Events + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! +# + +yearly_0001_set_random_weighted_skill_effect = { + set_variable = { + name = yearly_0001_skill + value = flag:diplomacy + } + random_list = { + 20 = { + #Must be better at the skill we pick than our liege. + trigger = { + $MENTEE$.diplomacy < $MENTOR$.diplomacy + } + + $MENTEE$ = { + set_variable = { + name = yearly_0001_skill + value = flag:diplomacy + } + } + } + 20 = { + #Must be better at the skill we pick than our liege. + trigger = { + $MENTEE$.martial < $MENTOR$.martial + } + + $MENTEE$ = { + set_variable = { + name = yearly_0001_skill + value = flag:martial + } + } + } + 20 = { + #Must be better at the skill we pick than our liege. + trigger = { + $MENTEE$.stewardship < $MENTOR$.stewardship + } + + $MENTEE$ = { + set_variable = { + name = yearly_0001_skill + value = flag:stewardship + } + } + } + 20 = { + #Must be better at the skill we pick than our liege. + trigger = { + $MENTEE$.intrigue < $MENTOR$.intrigue + } + + $MENTEE$ = { + set_variable = { + name = yearly_0001_skill + value = flag:intrigue + } + } + } + 20 = { + # + trigger = { + $MENTEE$.learning < $MENTOR$.learning + } + + $MENTEE$ = { + set_variable = { + name = yearly_0001_skill + value = flag:learning + } + } + } + } +} + +yearly_0001_improve_skill_effect = { + $MENTOR$ = { + save_scope_as = effect_mentor + } + $MENTEE$ = { + save_scope_as = effect_mentee + } + + #First we need to determine how much our mentor can teach us. + #This is based on the skill difference between the two of us. + if = { + limit = { + var:yearly_0001_skill = flag:diplomacy + } + + random_list = { + #Permanently increase Diplomacy by 2 points + 33 = { + desc = yearly.0001.a.success + + #Lower chance of getting this result as Diplomacy increases. + yearly_0001_success_modifier = { + SKILL = diplomacy + } + + #Apply the skill increase + send_interface_toast = { + title = yearly.0001.a.success + left_icon = $MENTEE$ + right_icon = $MENTOR$ + add_diplomacy_skill = 2 + } + + } + #Temporarily increase Diplomacy by 3 points + 66 = { + desc = yearly.0001.a.failure + + send_interface_toast = { + title = yearly.0001.a.failure + left_icon = $MENTEE$ + right_icon = $MENTOR$ + add_character_modifier = { + modifier = yearly_0001_improved_diplomacy + years = 5 + } + } + } + } + } + else_if = { + limit = { + var:yearly_0001_skill = flag:martial + } + + random_list = { + #Permanently increase Martial by 2 points + 33 = { + desc = yearly.0001.a.success + + #Lower chance of getting this result as Martial increases. + yearly_0001_success_modifier = { + SKILL = martial + } + + #Apply the skill increase + send_interface_toast = { + title = yearly.0001.a.success + left_icon = $MENTEE$ + right_icon = $MENTOR$ + add_martial_skill = 2 + } + } + #Temporarily increase Martial by 3 points + 66 = { + desc = yearly.0001.a.failure + + send_interface_toast = { + title = yearly.0001.a.failure + left_icon = $MENTEE$ + right_icon = $MENTOR$ + add_character_modifier = { + modifier = yearly_0001_improved_martial + years = 5 + } + } + } + } + + } + else_if = { + limit = { + var:yearly_0001_skill = flag:stewardship + } + + random_list = { + #Permanently increase Stewardship by 2 points + 33 = { + desc = yearly.0001.a.success + #Lower chance of getting this result as Stewardship increases. + yearly_0001_success_modifier = { + SKILL = stewardship + } + + #Apply the skill increase + send_interface_toast = { + title = yearly.0001.a.success + left_icon = $MENTEE$ + right_icon = $MENTOR$ + add_stewardship_skill = 2 + } + } + #Temporarily increase Stewardship by 3 points + 66 = { + desc = yearly.0001.a.failure + + send_interface_toast = { + title = yearly.0001.a.failure + left_icon = $MENTEE$ + right_icon = $MENTOR$ + add_character_modifier = { + modifier = yearly_0001_improved_stewardship + years = 5 + } + } + } + } + } + else_if = { + limit = { + var:yearly_0001_skill = flag:intrigue + } + + random_list = { + #Permanently increase Intrigue by 2 points + 33 = { + desc = yearly.0001.a.success + #Lower chance of getting this result as Intrigue increases. + yearly_0001_success_modifier = { + SKILL = intrigue + } + + #Apply the skill increase + send_interface_toast = { + title = yearly.0001.a.success + left_icon = $MENTEE$ + right_icon = $MENTOR$ + add_intrigue_skill = 2 + } + } + #Temporarily increase Intrigue by 3 points + 66 = { + desc = yearly.0001.a.failure + + send_interface_toast = { + title = yearly.0001.a.failure + left_icon = $MENTEE$ + right_icon = $MENTOR$ + + add_character_modifier = { + modifier = yearly_0001_improved_intrigue + years = 5 + } + } + } + } + } + else_if = { + limit = { + var:yearly_0001_skill = flag:learning + } + + random_list = { + #Permanently increase Learning by 2 points + 33 = { + desc = yearly.0001.a.success + #Lower chance of getting this result as Learning increases. + yearly_0001_success_modifier = { + SKILL = learning + } + + #Apply the skill increase + send_interface_toast = { + title = yearly.0001.a.success + left_icon = $MENTEE$ + right_icon = $MENTOR$ + add_learning_skill = 2 + } + } + #Temporarily increase Learning by 3 points + 66 = { + desc = yearly.0001.a.failure + + send_interface_toast = { + title = yearly.0001.a.failure + left_icon = $MENTEE$ + right_icon = $MENTOR$ + add_character_modifier = { + modifier = yearly_0001_improved_learning + years = 5 + } + } + } + } + } +} + +#Tried to come up with a better way to do this other than making a duplicate function for it, but failed. +#Localization makes it nigh impossible to make a scripted effect which can handle all possible use cases effectively. +yearly_0001_improve_vassal_skill_effect = { + + #First we need to determine how much our mentor can teach us. + #This is based on the skill difference between the two of us. + if = { + limit = { + var:yearly_0001_skill = flag:diplomacy + } + + random_list = { + #Permanently increase Diplomacy by 2 points + 33 = { + desc = yearly.0001.b.success + #Lower chance of getting this result as Diplomacy increases. + yearly_0001_success_modifier = { + SKILL = diplomacy + } + + add_diplomacy_skill = 2 + } + #Temporarily increase Diplomacy by 3 points + 66 = { + desc = yearly.0001.b.failure + + add_character_modifier = { + modifier = yearly_0001_improved_diplomacy + years = 5 + } + } + } + } + else_if = { + limit = { + var:yearly_0001_skill = flag:martial + } + + random_list = { + #Permanently increase Martial by 2 points + 33 = { + desc = yearly.0001.b.success + #Lower chance of getting this result as Martial increases. + yearly_0001_success_modifier = { + SKILL = martial + } + + add_martial_skill = 2 + } + #Temporarily increase Martial by 3 points + 66 = { + desc = yearly.0001.b.failure + + add_character_modifier = { + modifier = yearly_0001_improved_martial + years = 5 + } + } + } + } + else_if = { + limit = { + var:yearly_0001_skill = flag:stewardship + } + + random_list = { + #Permanently increase Stewardship by 2 points + 33 = { + desc = yearly.0001.b.success + #Lower chance of getting this result as Stewardship increases. + yearly_0001_success_modifier = { + SKILL = stewardship + } + + add_stewardship_skill = 2 + } + #Temporarily increase Stewardship by 3 points + 66 = { + desc = yearly.0001.b.failure + + add_character_modifier = { + modifier = yearly_0001_improved_stewardship + years = 5 + } + } + } + } + else_if = { + limit = { + var:yearly_0001_skill = flag:intrigue + } + + random_list = { + #Permanently increase Intrigue by 2 points + 33 = { + desc = yearly.0001.b.success + #Lower chance of getting this result as Intrigue increases. + yearly_0001_success_modifier = { + SKILL = intrigue + } + + add_intrigue_skill = 2 + } + #Temporarily increase Intrigue by 3 points + 66 = { + desc = yearly.0001.b.failure + + add_character_modifier = { + modifier = yearly_0001_improved_intrigue + years = 5 + } + } + } + } + else_if = { + limit = { + var:yearly_0001_skill = flag:learning + } + + random_list = { + #Permanently increase Learning by 2 points + 33 = { + desc = yearly.0001.b.success + #Lower chance of getting this result as Learning increases. + yearly_0001_success_modifier = { + SKILL = learning + } + + add_learning_skill = 2 + } + #Temporarily increase Learning by 3 points + 66 = { + desc = yearly.0001.b.failure + + add_character_modifier = { + modifier = yearly_0001_improved_learning + years = 5 + } + } + } + } +} + + diff --git a/N3OW/common/scripted_effects/01_building_upgrade_effects.txt b/N3OW/common/scripted_effects/01_building_upgrade_effects.txt new file mode 100644 index 00000000..da11f80e --- /dev/null +++ b/N3OW/common/scripted_effects/01_building_upgrade_effects.txt @@ -0,0 +1,275 @@ +################################################## +# Decisions +################################################## + +# Upgrades a single farm type building +# If such building does not exist, it is built. If building does not exist and there is no slot, it is built and a slot is added. +upgrade_farm_building = { + if = { + limit = { + building_farm_estates_requirement_terrain = yes + } + if = { + limit = { + NOT = { has_building = farm_estates_01 } + free_building_slots = 0 + } + add_province_modifier = extra_building_slot + add_building = farm_estates_01 + } + else_if = { + limit = { + NOT = { has_building = farm_estates_01 } + free_building_slots > 0 + } + add_building = farm_estates_01 + } + else_if = { + limit = { + has_building = farm_estates_01 + } + add_building = farm_estates_02 + } + else_if = { + limit = { + has_building = farm_estates_02 + } + add_building = farm_estates_03 + } + else_if = { + limit = { + has_building = farm_estates_03 + } + add_building = farm_estates_04 + } + else_if = { + limit = { + has_building = farm_estates_04 + } + add_building = farm_estates_05 + } + else_if = { + limit = { + has_building = farm_estates_05 + } + add_building = farm_estates_06 + } + else_if = { + limit = { + has_building = farm_estates_06 + } + add_building = farm_estates_07 + } + else_if = { + limit = { + has_building = farm_estates_07 + } + add_building = farm_estates_08 + } + } + else = { + if = { + limit = { + NOT = { has_building = pastures_01 } + free_building_slots = 0 + } + add_province_modifier = extra_building_slot + add_building = pastures_01 + } + else_if = { + limit = { + NOT = { has_building = pastures_01 } + free_building_slots >= 0 + } + add_building = pastures_01 + } + else_if = { + limit = { + has_building = pastures_01 + } + add_building = pastures_02 + } + else_if = { + limit = { + has_building = pastures_02 + } + add_building = pastures_03 + } + else_if = { + limit = { + has_building = pastures_03 + } + add_building = pastures_04 + } + else_if = { + limit = { + has_building = pastures_04 + } + add_building = pastures_05 + } + else_if = { + limit = { + has_building = pastures_05 + } + add_building = pastures_06 + } + else_if = { + limit = { + has_building = pastures_06 + } + add_building = pastures_07 + } + else_if = { + limit = { + has_building = pastures_07 + } + add_building = pastures_08 + } + } +} + +# Upgrades a single tradeport building +# If such a building does not exist and can be built, it is built. If no slot exists, a slot is added and it is built. +upgrade_tradeport = { + if = { + limit = { + NOR = { + has_building = common_tradeport_01 + has_building = common_tradeport_02 + has_building = common_tradeport_03 + has_building = common_tradeport_04 + has_building = common_tradeport_05 + has_building = common_tradeport_06 + has_building = common_tradeport_07 + has_building = common_tradeport_08 + } + free_building_slots = 0 + } + add_province_modifier = extra_building_slot + add_building = common_tradeport_01 + } + else_if = { + limit = { + NOR = { + has_building = common_tradeport_01 + has_building = common_tradeport_02 + has_building = common_tradeport_03 + has_building = common_tradeport_04 + has_building = common_tradeport_05 + has_building = common_tradeport_06 + has_building = common_tradeport_07 + has_building = common_tradeport_08 + } + free_building_slots > 1 + } + add_building = common_tradeport_01 + } + else_if = { + limit = { + has_building = common_tradeport_01 + } + add_building = common_tradeport_02 + } + else_if = { + limit = { + has_building = common_tradeport_02 + } + add_building = common_tradeport_03 + } + else_if = { + limit = { + has_building = common_tradeport_03 + } + add_building = common_tradeport_04 + } + else_if = { + limit = { + has_building = common_tradeport_04 + } + add_building = common_tradeport_05 + } + else_if = { + limit = { + has_building = common_tradeport_05 + } + add_building = common_tradeport_06 + } + else_if = { + limit = { + has_building = common_tradeport_06 + } + add_building = common_tradeport_07 + } + else_if = { + limit = { + has_building = common_tradeport_07 + } + add_building = common_tradeport_08 + } +} + +# Upgrades a single guidhall building +# If such a building does not exist and can be built, it is built. If no slot exists, a slot is added and it is built. +upgrade_guildhall = { + if = { + limit = { + NOT = { + has_building_or_higher = guild_halls_01 + } + free_building_slots = 0 + } + add_province_modifier = extra_building_slot + add_building = guild_halls_01 + } + else_if = { + limit = { + NOT = { + has_building_or_higher = guild_halls_01 + } + free_building_slots > 1 + } + add_building = guild_halls_01 + } + else_if = { + limit = { + has_building = guild_halls_01 + } + add_building = guild_halls_02 + } + else_if = { + limit = { + has_building = guild_halls_02 + } + add_building = guild_halls_03 + } + else_if = { + limit = { + has_building = guild_halls_03 + } + add_building = guild_halls_04 + } + else_if = { + limit = { + has_building = guild_halls_04 + } + add_building = guild_halls_05 + } + else_if = { + limit = { + has_building = guild_halls_05 + } + add_building = guild_halls_06 + } + else_if = { + limit = { + has_building = guild_halls_06 + } + add_building = guild_halls_07 + } + else_if = { + limit = { + has_building = guild_halls_07 + } + add_building = guild_halls_08 + } +} diff --git a/N3OW/common/scripted_effects/01_dlc_bp1_filippa_scripted_effects.txt b/N3OW/common/scripted_effects/01_dlc_bp1_filippa_scripted_effects.txt new file mode 100644 index 00000000..8a67ea4f --- /dev/null +++ b/N3OW/common/scripted_effects/01_dlc_bp1_filippa_scripted_effects.txt @@ -0,0 +1,369 @@ + +#Does not add opinion if either person is NOT AI +worsen_relationship_effect = { + if = { + limit = { + NOT = { this = $TARGET$ } + } + #Best Friend -> Friend + if = { + limit = { + has_relation_best_friend = $TARGET$ + } + remove_relation_best_friend = $TARGET$ + hidden_effect = { + set_relation_friend = { + target = $TARGET$ + reason = $REASON$ + } + } + if = { + limit = { + root = { is_ai = yes } + } + add_opinion = { + target = $TARGET$ + modifier = unfriendly_opinion + opinion = -15 + } + } + if = { + limit = { + $TARGET$ = { is_ai = yes } + } + reverse_add_opinion = { + target = $TARGET$ + modifier = unfriendly_opinion + opinion = -15 + } + } + } + #Friend -> Potential Friend + else_if = { + limit = { + has_relation_friend = $TARGET$ + } + remove_relation_friend = $TARGET$ + hidden_effect = { set_relation_potential_friend = $TARGET$ } + if = { + limit = { + root = { is_ai = yes } + } + add_opinion = { + target = $TARGET$ + modifier = unfriendly_opinion + opinion = -15 + } + } + if = { + limit = { + $TARGET$ = { is_ai = yes } + } + reverse_add_opinion = { + target = $TARGET$ + modifier = unfriendly_opinion + opinion = -15 + } + } + } + #Potential Friend -> Potential Rival + else_if = { + limit = { + has_relation_potential_friend = $TARGET$ + NOT = { has_relation_potential_rival = $TARGET$ } + } + remove_relation_potential_friend = $TARGET$ + set_relation_potential_rival = $TARGET$ + if = { + limit = { + root = { is_ai = yes } + } + add_opinion = { + target = $TARGET$ + modifier = unfriendly_opinion + opinion = -15 + } + } + if = { + limit = { + $TARGET$ = { is_ai = yes } + } + reverse_add_opinion = { + target = $TARGET$ + modifier = unfriendly_opinion + opinion = -15 + } + } + } + #Potential Rival -> Rival + else_if = { + limit = { + has_relation_potential_rival = $TARGET$ + } + set_relation_rival = { + target = $TARGET$ + reason = $REASON$ + } + if = { + limit = { + root = { is_ai = yes } + } + add_opinion = { + target = $TARGET$ + modifier = unfriendly_opinion + opinion = -30 + } + } + if = { + limit = { + $TARGET$ = { is_ai = yes } + } + reverse_add_opinion = { + target = $TARGET$ + modifier = unfriendly_opinion + opinion = -30 + } + } + } + #Rival -> Nemesis + else_if = { + limit = { + has_relation_rival = $TARGET$ + can_set_relation_nemesis_trigger = { CHARACTER = $TARGET$ } + } + set_relation_nemesis = { + target = $TARGET$ + reason = $REASON$ + } + if = { + limit = { + root = { is_ai = yes } + } + add_opinion = { + target = $TARGET$ + modifier = hate_opinion + opinion = -50 + } + } + if = { + limit = { + $TARGET$ = { is_ai = yes } + } + reverse_add_opinion = { + target = $TARGET$ + modifier = hate_opinion + opinion = -50 + } + } + } + #Nothing -> Potential Rival + else = { + set_relation_potential_rival = $TARGET$ + if = { + limit = { + root = { is_ai = yes } + } + add_opinion = { + target = $TARGET$ + modifier = unfriendly_opinion + opinion = -15 + } + } + if = { + limit = { + $TARGET$ = { is_ai = yes } + } + reverse_add_opinion = { + target = $TARGET$ + modifier = unfriendly_opinion + opinion = -15 + } + } + } + } +} + +#Does not add opinion if either person is NOT AI +improve_relationship_effect = { + if = { + limit = { + NOT = { this = $TARGET$ } + is_alive = yes + $TARGET$ = { is_alive = yes } + } + #Nemesis -> Rival + if = { + limit = { + has_relation_nemesis = $TARGET$ + } + remove_relation_nemesis = $TARGET$ + hidden_effect = { + set_relation_rival = { + target = $TARGET$ + reason = $REASON$ + } + } + if = { + limit = { + root = { is_ai = yes } + } + add_opinion = { + target = $TARGET$ + modifier = friendliness_opinion + opinion = 15 + } + } + if = { + limit = { + $TARGET$ = { is_ai = yes } + } + reverse_add_opinion = { + target = $TARGET$ + modifier = friendliness_opinion + opinion = 15 + } + } + } + #Rival -> Potential Rival + else_if = { + limit = { + has_relation_rival = $TARGET$ + } + remove_relation_rival = $TARGET$ + hidden_effect = { set_relation_potential_rival = $TARGET$ } + if = { + limit = { + root = { is_ai = yes } + } + add_opinion = { + target = $TARGET$ + modifier = friendliness_opinion + opinion = 15 + } + } + if = { + limit = { + $TARGET$ = { is_ai = yes } + } + reverse_add_opinion = { + target = $TARGET$ + modifier = friendliness_opinion + opinion = 15 + } + } + } + #Potential Rival -> Potential Friend + else_if = { + limit = { + has_relation_potential_rival = $TARGET$ + } + remove_relation_potential_rival = $TARGET$ + hidden_effect = { set_relation_potential_friend = $TARGET$ } + if = { + limit = { + root = { is_ai = yes } + } + add_opinion = { + target = $TARGET$ + modifier = friendliness_opinion + opinion = 15 + } + } + if = { + limit = { + $TARGET$ = { is_ai = yes } + } + reverse_add_opinion = { + target = $TARGET$ + modifier = friendliness_opinion + opinion = 15 + } + } + } + #Potential Friend -> Friend + else_if = { + limit = { + has_relation_potential_friend = $TARGET$ + } + set_relation_friend = { + target = $TARGET$ + reason = $REASON$ + } + if = { + limit = { + root = { is_ai = yes } + } + add_opinion = { + target = $TARGET$ + modifier = friendliness_opinion + opinion = 30 + } + } + if = { + limit = { + $TARGET$ = { is_ai = yes } + } + reverse_add_opinion = { + target = $TARGET$ + modifier = friendliness_opinion + opinion = 30 + } + } + } + #Friend -> Best Friend + else_if = { + limit = { + has_relation_friend = $TARGET$ + can_set_relation_best_friend_trigger = { CHARACTER = $TARGET$ } + } + set_relation_best_friend = { + target = $TARGET$ + reason = $REASON$ + } + if = { + limit = { + root = { is_ai = yes } + } + add_opinion = { + target = $TARGET$ + modifier = friendliness_opinion + opinion = 50 + } + } + if = { + limit = { + $TARGET$ = { is_ai = yes } + } + reverse_add_opinion = { + target = $TARGET$ + modifier = friendliness_opinion + opinion = 50 + } + } + } + #Nothing -> Potential Friend + else = { + set_relation_potential_friend = $TARGET$ + if = { + limit = { + root = { is_ai = yes } + } + add_opinion = { + target = $TARGET$ + modifier = friendliness_opinion + opinion = 15 + } + } + if = { + limit = { + $TARGET$ = { is_ai = yes } + } + reverse_add_opinion = { + target = $TARGET$ + modifier = friendliness_opinion + opinion = 15 + } + } + } + } +} diff --git a/N3OW/common/scripted_effects/01_dlc_fp1_scripted_effects.txt b/N3OW/common/scripted_effects/01_dlc_fp1_scripted_effects.txt new file mode 100644 index 00000000..cbccc128 --- /dev/null +++ b/N3OW/common/scripted_effects/01_dlc_fp1_scripted_effects.txt @@ -0,0 +1,1105 @@ +################################################## +# Decisions +################################################## + +secure_high_kingdom_north_sea_scripted_effect = { + scope:founder = { + #Standard effects. + ##Adjust the de jure capital appropriately first up, since otherwise we won't be able to see your preferred title. + hidden_effect = { + #If it's Denmark, we do nothing, as Denmark has the capital & CoA by default. + #If it's England, we make the capital London/York. + if = { + limit = { primary_title = title:k_england } + title:e_north_sea = { + set_capital_county = title:k_england.title_capital_county + } + } + #If it's Norway, we make the capital Steinkjer. + if = { + limit = { primary_title = title:k_norway } + title:e_north_sea = { + set_capital_county = title:c_trandheim.title_capital_county + } + } + } + ##Hand over the High Kingdom. + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:e_north_sea = { + change_title_holder = { + holder = scope:founder + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + ##Configure the new de jure setup. + title:k_england = { set_de_jure_liege_title = title:e_north_sea } + title:k_denmark = { set_de_jure_liege_title = title:e_north_sea } + title:k_norway = { set_de_jure_liege_title = title:e_north_sea } + ##Rename rump-Britannia, as it hardly covers the whole island any more. + title:e_britannia = { set_title_name = e_albia } + ## Completely controlled duchies of k_daneland are transferred back to k_england. + if = { + limit = { + title:k_daneland = { + any_in_de_jure_hierarchy = { + tier = tier_duchy + save_temporary_scope_as = current_duchy + scope:founder = { completely_controls = scope:current_duchy } + } + } + } + custom_tooltip = secure_high_kingdom_north_sea_scripted_effect.daneland_reabsorbed.tt + hidden_effect = { + title:k_daneland = { + every_in_de_jure_hierarchy = { + limit = { + tier = tier_duchy + save_temporary_scope_as = current_duchy + scope:founder = { completely_controls = scope:current_duchy } + } + set_de_jure_liege_title = title:k_england + } + } + } + } + + #Variable effects. + ##Unreformed tribals. + if = { + limit = { + government_has_flag = government_is_tribal + faith = { has_doctrine_parameter = unreformed } + } + #First, set a flag for achievements. + add_achievement_flag_effect = { FLAG = canute_the_greater_achievement_flag } + #You become feudal. + convert_whole_realm_to_feudalism_effect = yes + #To keep you stable, we give you a nice permanent modifier. + if = { + limit = { is_male = yes } + add_character_modifier = { modifier = high_king_of_the_seas_fp1_modifier } + } + else = { + add_character_modifier = { modifier = high_queen_of_the_seas_fp1_modifier } + } + #And a historically-appropriate nickname. + give_nickname = nick_the_sea_king + } + ##Reformed pagans. + else_if = { + limit = { + faith.religion = { is_in_family = rf_pagan } + NOT = { + faith = { has_doctrine_parameter = unreformed } + } + } + #We give you a nice hefty conversion boost against other reformed faiths for twenty years. + if = { + limit = { is_male = yes } + add_character_modifier = { + modifier = defiant_high_king_conversion_boost_modifier + years = 20 + } + } + else = { + add_character_modifier = { + modifier = defiant_high_queen_conversion_boost_modifier + years = 20 + } + } + #And an appropriate nickname. + give_nickname = nick_the_defiant + } + ##Everyone else (e.g., Christians, unreformed feudals, etc). + else = { + #Loyalty hooks & huge opinion boost from all agreeable vassals. + every_vassal = { + limit = { + is_powerful_vassal = yes + opinion = { + target = scope:founder + value >= 1 + } + } + if = { + limit = { + scope:founder = { is_male = yes } + } + add_opinion = { + modifier = king_of_the_north_sea_opinion + target = scope:founder + } + } + else = { + add_opinion = { + modifier = queen_of_the_north_sea_opinion + target = scope:founder + } + } + save_temporary_scope_as = current_vassal + scope:founder = { + add_hook = { + type = loyalty_hook + target = scope:current_vassal + } + } + } + #And a suitable nickname. + give_nickname = nick_the_great + } + } +} + +found_capital_of_rus_scripted_effect = { + #Reward fame to compensate for reduced development gain. + scope:new_rus_capital.holder = { + add_prestige_experience = major_prestige_gain + } + scope:new_rus_capital = { + #Boost local development a few levels; majority of development gain is handled in the modifiers now. + if = { + limit = { development_level < 5 } + change_development_level = { + value = 5 + subtract = scope:new_rus_capital.development_level + } + } + else_if = { + limit = { development_level < 8 } + change_development_level = { + value = 8 + subtract = scope:new_rus_capital.development_level + } + } + else_if = { + limit = { development_level < 12 } + change_development_level = { + value = 12 + subtract = scope:new_rus_capital.development_level + } + } + #If control is less than full, boost it to full. + if = { + limit = { county_control < full_county_control } + change_county_control = 100 + } + #Add county modifier giving solid opinion for a decent chunk of time. + add_county_modifier = { + modifier = capital_of_rus_opinion_modifier + years = 20 + } + #Add county modifier giving intense benefits for a century. + add_county_modifier = { + modifier = capital_of_rus_misc_benefits_modifier + years = 100 + } + #If this county isn't the de jure capital of e_russia, make it so. + if = { + limit = { + NOT = { this = title:e_russia.title_capital_county } + } + title:e_russia = { set_capital_county = scope:new_rus_capital } + } + } +} + +fp1_apply_generic_stele_bonuses_effect = { + add_piety = major_piety_gain + add_prestige = major_prestige_gain + add_legitimacy = medium_legitimacy_gain + every_vassal = { + limit = { fp1_can_raise_stele_trigger = yes } + custom = fp1_raise_runestone_vassals + add_opinion = { + modifier = pleased_opinion + target = root + opinion = 10 + } + } + # Saga in Stone achievement tracking. + if = { + limit = { + # Grab the player and any dynasty members of theirs. + any_player = { dynasty = root.dynasty } + } + dynasty = { + # Start a count if we don't have one. + if = { + limit = { + NOT = { exists = var:saga_in_stone_achievement_tally } + } + set_variable = { + name = saga_in_stone_achievement_tally + value = 1 + } + } + # Otherwise, increment it. + else = { + change_variable = { + name = saga_in_stone_achievement_tally + add = 1 + } + } + } + } +} + +elevate_mann_and_the_isles_scripted_effect = { + # You gain the Legacy of Piracy dynasty modifier. + dynasty = { + add_dynasty_modifier = { + modifier = fp1_legacy_of_piracy_modifier + years = 100 + } + # Also gain a large amount of dynasty prestige. + add_dynasty_prestige = excessive_dynasty_prestige_gain + } + # Cool nickname distributed elsewhere. + # Mann becomes a kingdom. + title:d_the_isles = { set_de_jure_liege_title = title:k_mann_the_isles } + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + } + title:k_mann_the_isles = { + change_title_holder = { + holder = scope:founder + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + # Buff the Isle of Mann. + title:c_isle_of_man = { + # Give it some extra building slots + title_province = { + add_province_modifier = elevate_mann_and_the_isles_modifier + } + # And a decent development boost. + change_development_level = medium_development_level_gain + } + # Make it your capital if it wasn't already. + if = { + limit = { + NOT = { capital_county = title:c_isle_of_man } + } + set_realm_capital = title:c_isle_of_man + } + # And convert it to your culture if it wasn't some flavour of North Germanic. + if = { + limit = { + NOR = { + title:c_isle_of_man.culture = { + has_cultural_pillar = heritage_north_germanic + } + title:c_isle_of_man.culture = culture:norman + } + } + title:c_isle_of_man = { set_county_culture = scope:founder.culture } + } + # Have a huge, terrifying event army. + spawn_army = { + levies = 5000 + men_at_arms = { + type = jomsviking_pirates + stacks = 5 + } + men_at_arms = { + type = jomsviking_pirates + stacks = 5 + } + men_at_arms = { + type = varangian_veterans + stacks = 5 + } + men_at_arms = { + type = bondi + stacks = 5 + } + men_at_arms = { + type = bondi + stacks = 5 + } + location = title:c_isle_of_man.title_province + name = fp1_mann_event_troops + } + # Mann gets a huge modernising boost. + title:c_isle_of_man = { + add_county_modifier = { + modifier = fp1_mann_pirate_capital_modifier + years = 100 + } + } + # If completely controlled, you integrate the duchies of the Western Isles, the Northern Isles, and Strathclyde. + ## The Western Isles. + if = { + limit = { completely_controls = title:d_northern_isles } + title:d_northern_isles = { set_de_jure_liege_title = title:k_mann_the_isles } + } + ## The Northern Isles. + if = { + limit = { completely_controls = title:d_western_isles } + title:d_western_isles = { set_de_jure_liege_title = title:k_mann_the_isles } + } + ## Strathclyde. + if = { + limit = { completely_controls = title:d_galloway } + title:d_galloway = { set_de_jure_liege_title = title:k_mann_the_isles } + } + # Plus, if you weren't already, become feudal. + if = { + limit = { government_has_flag = government_is_tribal } + convert_whole_realm_to_feudalism_effect = yes + } +} + +fp1_remove_stele_effect = { + if = { + limit = { has_county_modifier = fp1_stele_ancestors_strong } + remove_county_modifier = fp1_stele_ancestors_strong + } + if = { + limit = { has_county_modifier = fp1_stele_ancestors_weak } + remove_county_modifier = fp1_stele_ancestors_weak + } + if = { + limit = { has_county_modifier = fp1_stele_conquest_strong } + remove_county_modifier = fp1_stele_conquest_strong + } + if = { + limit = { has_county_modifier = fp1_stele_conquest_weak } + remove_county_modifier = fp1_stele_conquest_weak + } + if = { + limit = { has_county_modifier = fp1_stele_promotion_strong } + remove_county_modifier = fp1_stele_promotion_strong + } + if = { + limit = { has_county_modifier = fp1_stele_promotion_weak } + remove_county_modifier = fp1_stele_promotion_weak + } +} + +forge_the_jomsvikings_scripted_effect = { + # Display simplified results. + custom_tooltip = create_holy_order_decision_effect_message + # Select a random county. + random_held_title = { + limit = { fp1_valid_county_for_jomsvikings_trigger = yes } + save_scope_as = designated_county + } + # Select an appropriate barony. + ## If there's an empty space in the capital, we create a castle. + if = { + limit = { + scope:designated_county = { + any_county_province = { has_holding = no } + } + } + scope:designated_county = { + random_county_province = { + limit = { has_holding = no } + set_holding_type = castle_holding + barony = { save_scope_as = leased_barony } + } + } + } + ## Otherwise, grab an existing non-capital castle/city. + else = { + scope:designated_county = { + random_county_province = { + limit = { + is_county_capital = no + OR = { + has_holding_type = castle_holding + has_holding_type = city_holding + } + } + barony = { save_scope_as = leased_barony } + } + } + } + # Create a suitable leader for the Jomsvikings. + create_character = { + template = fp1_jomsviking_bigwig + location = scope:leased_barony.title_province + save_scope_as = leader + } + # Create the actual holy order. + create_holy_order_neutral_effect = { + LEADER = scope:leader + CAPITAL = scope:leased_barony + NEW_HO_SCOPE = new_holy_order + FOUNDER = scope:founder + } + # Make the local settlement Jomsberg. + ## Rename it. + scope:leased_barony = { set_title_name = b_jomsberg } + ## Give it some buildings. + hidden_effect = { + scope:leased_barony.title_province = { + # Walls & Towers. + if = { + limit = { + NOT = { has_building_or_higher = curtain_walls_01 } + } + # If it doesn't have a free building slot, give it one. + if = { + limit = { free_building_slots = 0 } + add_province_modifier = extra_building_slot + } + # Add the building. + add_building = curtain_walls_01 + } + # Barracks. + if = { + limit = { + NOT = { has_building_or_higher = barracks_01 } + } + # If it doesn't have a free building slot, give it one. + if = { + limit = { free_building_slots = 0 } + add_province_modifier = extra_building_slot + } + # Add the building. + add_building = barracks_01 + } + # Military Camps. + if = { + limit = { + NOT = { has_building_or_higher = military_camps_01 } + } + # If it doesn't have a free building slot, give it one. + if = { + limit = { free_building_slots = 0 } + add_province_modifier = extra_building_slot + } + # Add the building. + add_building = military_camps_01 + } + } + } + ## Mark it so it can be renamed if the order is ever destroyed. + set_global_variable = { + name = jomsberg_location + value = scope:leased_barony + } + # And the Grandmaster of Jomsberg certainly looks favourably on their patron. + ## Hidden because the title doesn't play nicely with characters created in the same immediate block. + hidden_effect = { + scope:founder = { set_relation_friend = { reason = friend_forging_jomsvikings target = scope:leader } } + } + # Mark the Jomsvikings as existing & make them easily accessible + set_global_variable = { + name = jomsvikings_title + value = scope:leader.primary_title + } + # Some minor misc effects. + create_holy_order_effect = yes + scope:leader.primary_title = { set_coa = ho_jomsvikings } + # Flag the Jomsvikings as forged. + hidden_effect = { + add_to_global_variable_list = { + name = unavailable_unique_decisions + target = flag:flag_forged_jomvikings + } + } +} + +forge_the_jomsvikings_maa_reward_effect = { + spawn_army = { + levies = { add = 500 } + men_at_arms = { + type = jomsviking_pirates + stacks = 4 + } + men_at_arms = { + type = varangian_veterans + stacks = 2 + } + men_at_arms = { + type = bondi + stacks = 4 + } + inheritable = yes + uses_supply = yes + location = scope:founder.capital_province + name = fp1_jomsvikings_event_troops + } +} + +forge_the_jomsvikings_decision_tooltip_effect = { + # Standard info. + custom_tooltip = create_holy_order_decision_effect_message + create_holy_order_effect = yes + # And the free army. + forge_the_jomsvikings_maa_reward_effect = yes +} + +fp1_remove_humsac_offended_counties_effect = { + every_sub_realm_county = { + if = { + limit = { has_county_modifier = held_human_sacrifice_fp1_modifier } + remove_county_modifier = held_human_sacrifice_fp1_modifier + } + } +} + +################################################## +# Interactions +################################################## + +designate_gruesome_festivals_sacrifice_interaction_effect = { + add_character_modifier = gruesome_festivals_designated_sacrifice_fp1_modifier + add_opinion = { + target = scope:actor + modifier = hate_opinion + opinion = -50 + } +} + +designate_gruesome_festivals_sacrifice_modifier_removed_effect = { + send_interface_toast = { + title = designate_gruesome_festivals_sacrifice_modifier_removed_effect.t + left_icon = $DESIGNATOR$ + remove_character_modifier = gruesome_festivals_designated_sacrifice_fp1_modifier + # Removed manually. + if = { + limit = { + exists = scope:removal_type + scope:removal_type = flag:manual + } + custom_tooltip = designate_gruesome_festivals_sacrifice_modifier_removed_effect.manual.tt + } + # Removed due to a new chief sacrifice being designated. + else_if = { + limit = { + exists = scope:removal_type + scope:removal_type = flag:override + } + custom_tooltip = designate_gruesome_festivals_sacrifice_modifier_removed_effect.override.tt + } + # Removed due to the chain invalidating. + else = { custom_tooltip = designate_gruesome_festivals_sacrifice_modifier_removed_effect.invalidation.tt } + } +} + +# Either-side effects for a tbc ending with death. +fp1_tbc_death_effect = { + # Check to see if this is a duel to the death between those of equal rank. + ## We check this here in case an *untimely* death causes either participant to go up a rank. + ## Equal rank: level playing field, maximum honour. + if = { + limit = { $TBC_VICTOR$.primary_title.tier = $TBC_LOSER$.primary_title.tier } + $TBC_VICTOR$ = { add_prestige = medium_prestige_gain } + } + ## Unequal rank: challenging your betters but clearly it was merited. + else_if = { + limit = { $TBC_VICTOR$.primary_title.tier < $TBC_LOSER$.primary_title.tier } + $TBC_VICTOR$ = { add_prestige = minor_prestige_gain } + } + $TBC_LOSER$ = { + death = { + killer = $TBC_VICTOR$ + death_reason = death_duel + } + } +} + +# Recipient-side effects for a tbc ending with a cash settlement. +fp1_tbc_gold_effect = { + $TBC_LOSER$ = { + pay_short_term_gold = { + target = $TBC_VICTOR$ + gold = major_gold_value + } + } +} + +# Recipient-side effects for a tbc ending with an agreed favour. +fp1_tbc_hook_effect = { + $TBC_VICTOR$ = { + add_hook = { + type = trial_by_combat_hook + target = $TBC_LOSER$ + } + } +} + +# Recipient-side effects for a tbc ending with utter humiliation. +fp1_tbc_humiliation_effect = { + $TBC_LOSER$ = { + every_vassal = { + custom = every_belligerent_vassal + limit = { + has_vassal_stance = belligerent + } + add_opinion = { + modifier = liege_lost_duel + target = $TBC_LOSER$ + } + } + add_stress = massive_stress_gain + } + $TBC_VICTOR$ = { + every_vassal = { + custom = every_belligerent_vassal + limit = { + has_vassal_stance = belligerent + } + custom = every_belligerent_vassal + add_opinion = { + modifier = liege_won_duel + target = $TBC_VICTOR$ + } + } + } +} + +# Actor-side effects for losing most types of tbc. +fp1_tbc_actor_defeated_effect = { + $TBC_LOSER$ = { + every_vassal = { + custom = every_belligerent_vassal + limit = { + has_vassal_stance = belligerent + } + add_opinion = { + modifier = liege_lost_duel + target = $TBC_LOSER$ + } + } + add_stress = major_stress_gain + } + $TBC_VICTOR$ = { + every_vassal = { + custom = every_belligerent_vassal + limit = { + has_vassal_stance = belligerent + } + custom = every_belligerent_vassal + add_opinion = { + modifier = liege_won_duel + target = $TBC_VICTOR$ + } + } + } +} + +try_create_challenge_to_single_combat = { + if = { + limit = { + is_imprisoned = no + root = { has_imprisonment_reason = prev } + } + try_create_important_action = { + important_action_type = action_can_challenge_to_single_combat + actor = root + recipient = this + } + } +} + +replace_with_learning_trait_effect = { + if = { + limit = { has_trait = education_intrigue_1 } + remove_trait = education_intrigue_1 + } + else_if = { + limit = { has_trait = education_intrigue_2 } + remove_trait = education_intrigue_2 + } + else_if = { + limit = { has_trait = education_intrigue_3 } + remove_trait = education_intrigue_3 + } + else_if = { + limit = { has_trait = education_intrigue_4 } + remove_trait = education_intrigue_4 + } + else_if = { + limit = { has_trait = education_intrigue_5 } + remove_trait = education_intrigue_5 + } + else_if = { + limit = { has_trait = education_diplomacy_1 } + remove_trait = education_diplomacy_1 + } + else_if = { + limit = { has_trait = education_diplomacy_2 } + remove_trait = education_diplomacy_2 + } + else_if = { + limit = { has_trait = education_diplomacy_3 } + remove_trait = education_diplomacy_3 + } + else_if = { + limit = { has_trait = education_diplomacy_4 } + remove_trait = education_diplomacy_4 + } + else_if = { + limit = { has_trait = education_diplomacy_5 } + remove_trait = education_diplomacy_5 + } + else_if = { + limit = { has_trait = education_stewardship_1 } + remove_trait = education_stewardship_1 + } + else_if = { + limit = { has_trait = education_stewardship_2 } + remove_trait = education_stewardship_2 + } + else_if = { + limit = { has_trait = education_stewardship_3 } + remove_trait = education_stewardship_3 + } + else_if = { + limit = { has_trait = education_stewardship_4 } + remove_trait = education_stewardship_4 + } + else_if = { + limit = { has_trait = education_stewardship_5 } + remove_trait = education_stewardship_5 + } + else_if = { + limit = { has_trait = education_martial_1 } + remove_trait = education_martial_1 + } + else_if = { + limit = { has_trait = education_martial_2 } + remove_trait = education_martial_2 + } + else_if = { + limit = { has_trait = education_martial_3 } + remove_trait = education_martial_3 + } + else_if = { + limit = { has_trait = education_martial_4 } + remove_trait = education_martial_4 + } + else_if = { + limit = { has_trait = education_martial_5 } + remove_trait = education_martial_5 + } + random_list = { + 2 = { add_trait = education_learning_2 } + 2 = { add_trait = education_learning_3 } + 1 = { add_trait = education_learning_4 } + } +} + +################################################## +# CBs +################################################## + +clean_scandinavian_adventurer_effect = { + scope:attacker = { + every_held_title = { + limit = { has_variable = temporary_title } + save_scope_as = destroyable_title + scope:attacker = { destroy_title = scope:destroyable_title } + } + remove_character_modifier = scandinavian_adventurer_fp1_modifier + } +} + +fp1_add_realm_size_appropriate_sa_reprieve_effect = { + # Depending on the sub realm size of $VICTIM$, we give them a scaling amount of time not to be hit by SA attacks. + ## The smallest realms get a long reprieve. + if = { + limit = { sub_realm_size <= tiny_realm_size } + add_character_modifier = { + modifier = fp1_reprieve_from_sa_modifier + years = 20 + } + } + ## Then a decent reprieve. + else_if = { + limit = { sub_realm_size <= minor_realm_size } + add_character_modifier = { + modifier = fp1_reprieve_from_sa_modifier + years = 15 + } + } + ## Then a short reprieve. + else_if = { + limit = { sub_realm_size <= medium_realm_size } + add_character_modifier = { + modifier = fp1_reprieve_from_sa_modifier + years = 10 + } + } + ## Then you're clearly too big and juicy a target for much reprieve at all. + else = { + add_character_modifier = { + modifier = fp1_reprieve_from_sa_modifier + years = 5 + } + } +} + +fp1_remember_recent_conquest_victory_effect = { + if = { + limit = { + # DLC check. + has_fp1_dlc_trigger = yes + # Is the culture eligible? + fp1_can_raise_stele_trigger = yes + } + set_variable = { + name = recent_conquest_victory + value = scope:defender + years = 5 + } + } +} + +################################################## +# Yearlies +################################################## + +nithing_character_creation_scripted_effect = { + add_trait = disinherited + add_character_modifier = { modifier = nithing_fp1_modifier } +} + +################################################## +# Legacies +################################################## + +initial_decentralized_rule_friends_modifier_effect = { + if = { + limit = { + exists = dynasty + is_ruler = yes + } + if = { + limit = { + NOT = { has_variable = decentralized_rule_perk_value } + } + set_variable = { + name = decentralized_rule_perk_value + value = 0 + } + } + + every_relation = { + type = friend + add_to_temporary_list = decentralized_rule_friends + } + every_relation = { + type = best_friend + add_to_temporary_list = decentralized_rule_friends + } + + if = { + limit = { + exists = var:decentralized_rule_perk_value + save_temporary_scope_as = affected_friend + var:decentralized_rule_perk_value < decentralized_rule_max + any_in_list = { + list = decentralized_rule_friends + count > scope:affected_friend.var:decentralized_rule_perk_value + } + } + add_character_modifier = { + modifier = decentralized_rule_perk_modifier + } + change_variable = { + name = decentralized_rule_perk_value + add = 1 + } + } + } +} + +decentralized_rule_friends_modifier_effect = { + if = { + limit = { + dynasty ?= { + has_dynasty_perk = fp1_adventure_legacy_5 + } + is_ruler = yes + } + if = { + limit = { + NOT = { has_variable = decentralized_rule_perk_value } + } + set_variable = { + name = decentralized_rule_perk_value + value = 0 + } + } + + every_relation = { + type = friend + add_to_temporary_list = decentralized_rule_friends + } + every_relation = { + type = best_friend + add_to_temporary_list = decentralized_rule_friends + } + + if = { + limit = { + exists = var:decentralized_rule_perk_value + save_temporary_scope_as = affected_friend + var:decentralized_rule_perk_value < decentralized_rule_max + any_in_list = { + list = decentralized_rule_friends + count > scope:affected_friend.var:decentralized_rule_perk_value + } + } + add_character_modifier = { + modifier = decentralized_rule_perk_modifier + } + change_variable = { + name = decentralized_rule_perk_value + add = 1 + } + } + } +} + +decentralized_rule_removal_effect = { + if = { + limit = { + dynasty ?= { + has_dynasty_perk = fp1_adventure_legacy_5 + } + } + + every_relation = { + type = friend + add_to_temporary_list = decentralized_rule_friends + } + every_relation = { + type = best_friend + add_to_temporary_list = decentralized_rule_friends + } + + if = { + limit = { + exists = var:decentralized_rule_perk_value + save_temporary_scope_as = affected_friend + var:decentralized_rule_perk_value <= decentralized_rule_max + var:decentralized_rule_perk_value > 0 + any_in_list = { + list = decentralized_rule_friends + count < var:decentralized_rule_perk_value + NOT = { has_character_flag = about_to_die_but_not_dead_yet_flag } + } + } + + if = { + limit = { + has_character_modifier = decentralized_rule_perk_modifier + } + remove_character_modifier = decentralized_rule_perk_modifier + } + + change_variable = { + name = decentralized_rule_perk_value + subtract = 1 + } + } + } +} + +################################################## +# Governments +################################################## + +calculate_authority_cooldown_break_effect = { + if = { + limit = { + has_variable = crown_authority_cooldown + realm_law_use_crown_authority = yes + } + # Set it up if it doesn't exist. + if = { + limit = { + NOT = { has_variable = authority_cooldown_break_tally } + } + set_variable = { + name = authority_cooldown_break_tally + value = authority_cooldown_breaker_value + } + # And increment it once, since they've just taken the first use and we give no freebies. + change_variable = { + name = authority_cooldown_break_tally + add = authority_cooldown_breaker_value + } + } + # Otherwise, increment it. + else_if = { + limit = { has_variable = authority_cooldown_break_tally } + change_variable = { + name = authority_cooldown_break_tally + add = authority_cooldown_breaker_value + } + } + } + else_if = { + limit = { + has_variable = tribal_authority_cooldown + realm_law_use_tribal_authority = yes + } + # Set it up if it doesn't exist. + if = { + limit = { + NOT = { has_variable = authority_cooldown_break_tally } + } + set_variable = { + name = authority_cooldown_break_tally + value = authority_cooldown_breaker_value + } + # And increment it once, since they've just taken the first use and we give no freebies. + change_variable = { + name = authority_cooldown_break_tally + add = authority_cooldown_breaker_value + } + } + # Otherwise, increment it. + else_if = { + limit = { has_variable = authority_cooldown_break_tally } + change_variable = { + name = authority_cooldown_break_tally + add = authority_cooldown_breaker_value + } + } + } + else_if = { + limit = { + has_variable = imperial_bureaucracy_cooldown + realm_law_use_imperial_bureaucracy = yes + } + # Set it up if it doesn't exist. + if = { + limit = { + NOT = { has_variable = authority_cooldown_break_tally } + } + set_variable = { + name = authority_cooldown_break_tally + value = authority_cooldown_breaker_value + } + # And increment it once, since they've just taken the first use and we give no freebies. + change_variable = { + name = authority_cooldown_break_tally + add = authority_cooldown_breaker_value + } + } + # Otherwise, increment it. + else_if = { + limit = { has_variable = authority_cooldown_break_tally } + change_variable = { + name = authority_cooldown_break_tally + add = authority_cooldown_breaker_value + } + } + } +} diff --git a/N3OW/common/scripted_effects/01_dlc_fp3_scripted_effects.txt b/N3OW/common/scripted_effects/01_dlc_fp3_scripted_effects.txt new file mode 100644 index 00000000..41d24eac --- /dev/null +++ b/N3OW/common/scripted_effects/01_dlc_fp3_scripted_effects.txt @@ -0,0 +1,1369 @@ +restore_badd_fortress_scripted_effect = { + + # Buff Ahar + title:b_ahar = { + # Give it an extra building slot. + title_province = { + add_province_modifier = extra_building_slot + add_province_modifier = { #and a mighty defensive buff + modifier = fp3_mountain_redoubt_modifier + } + } + } + title:c_tabriz = { # And a decent development boost. + change_development_level = minor_development_level_gain + } + # Make it your capital if it wasn't already. + if = { + limit = { + NOT = { capital_county = title:c_tabriz } + } + set_realm_capital = title:c_tabriz + } + title:b_ahar = { set_capital_barony = yes } +} + +destroy_the_magi_scripted_effect = { + + add_heresiarch_trait_effect = yes + + religion = { save_scope_as = root_religion } + + faith = { + change_fervor = { + value = 50 + desc = fervor_gain_magi_destroyed + } + if = { + limit = { + AND = { + has_doctrine = doctrine_spiritual_head + has_doctrine = doctrine_theocracy_temporal + } + } + custom_tooltip = replace_the_high_priest_effect_tooltip + hidden_effect = { + remove_doctrine = doctrine_spiritual_head + add_doctrine = doctrine_no_head + } + } + } + + + if = { + limit = { + AND = { + root.religion = religion:zoroastrianism_religion + OR = { + has_faith = faith:mazdakism + has_faith = faith:zurvanism + } + } + } + add_prestige = massive_prestige_gain + } + + custom_tooltip = destroy_the_magi_opinion_tooltip + hidden_effect = { + every_ruler = { + if = { + limit = { + AND = { + NOR = { + has_faith = faith:mazdakism + has_faith = faith:zurvanism + } + religion = religion:zoroastrianism_religion + } + } + add_opinion = { + target = root + modifier = fp3_spawn_of_ahriman_opinion + } + } + else_if = { + limit = { + faith = { has_doctrine = doctrine_major_branch_behdin } + } + add_opinion = { + target = root + modifier = fp3_abolished_priesthood_opinion + } + } + } + } +} + +opinion_based_on_sky_burial_viewpoint_scripted_effect = { + if = { + limit = { + OR = { + faith = { has_doctrine_parameter = sky_burials_active } + has_trait = compassionate + has_trait = cynical + has_trait = trusting + has_trait = forgiving + AND = { + NOT = { faith = { has_doctrine_parameter = sky_burials_active } } + ai_compassion >= medium_positive_ai_value + ai_zeal <= medium_positive_ai_value + } + AND = { + NOT = { faith = { has_doctrine_parameter = sky_burials_active } } + faith = { has_doctrine = doctrine_pluralism_pluralistic } + ai_zeal <= medium_positive_ai_value + } + } + } + add_opinion = { + target = root + opinion = 20 + modifier = fp3_loyal_to_dead_spouse_opinion + } + } + else_if = { + limit = { ai_zeal > medium_positive_ai_value } + add_opinion = { + target = root + opinion = -30 + modifier = fp3_blasphemous_practices_opinion + } + } + else = { + add_opinion = { + target = root + opinion = -10 + modifier = fp3_strange_rituals_opinion + } + } +} + +opinion_based_on_sky_burial_viewpoint_for_relatives_scripted_effect = { + if = { + limit = { + OR = { + faith = { has_doctrine_parameter = sky_burials_active } + has_trait = compassionate + has_trait = cynical + has_trait = trusting + has_trait = forgiving + AND = { + NOT = { faith = { has_doctrine_parameter = sky_burials_active } } + ai_compassion >= medium_positive_ai_value + ai_zeal <= medium_positive_ai_value + } + AND = { + NOT = { faith = { has_doctrine_parameter = sky_burials_active } } + faith = { has_doctrine = doctrine_pluralism_pluralistic } + ai_zeal <= medium_positive_ai_value + } + } + } + add_opinion = { + target = root + opinion = 20 + modifier = fp3_benevolent_opinion + } + } + else_if = { + limit = { ai_zeal > medium_positive_ai_value } + add_opinion = { + target = root + opinion = -30 + modifier = fp3_blasphemous_practices_opinion + } + } + else = { + add_opinion = { + target = root + opinion = -10 + modifier = fp3_strange_rituals_opinion + } + } +} + + + +##################################################################### +##### SELJUK INVASION +##################################################################### + +## Set up default title +give_seljuk_title_effect = { + create_dynamic_title = { + tier = duchy + name = fp3_seljuk_horde_title_title + adj = fp3_seljuk_horde_title_adj + } + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + + scope:new_title = { + set_capital_county = scope:seljuk_birthplace.county + set_landless_title = yes + set_coa = house:house_seljuk + set_destroy_if_invalid_heir = yes + set_destroy_on_gain_same_tier = yes + set_delete_on_destroy = yes + set_no_automatic_claims = yes + set_definitive_form = yes + set_can_be_named_after_dynasty = no + set_can_use_nomadic_naming = no + change_title_holder = { + holder = scope:lead_seljuk + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change +} + +### A leader is created +spawn_seljuk_character_effect = { + ## CULTURE SELECTION + # Look for a random culture in the region, weight up Oghuz with it also as a fallback + random_county_in_region = { + region = dlc_fp3_seljuk_birth_region + limit = { + exists = culture + } + weight = { + base = 1 + modifier = { + culture = culture:turkish + add = 100 + } + modifier = { + culture = { has_cultural_pillar = heritage_turkic } + add = 50 + } + } + culture = { save_scope_as = seljuk_birth_culture } + } + + ## FAITH SELECTION + # Create a list of possible faiths + every_county_in_region = { + region = world_steppe_west + title_province.faith = { add_to_list = seljuk_faith_selection_list } + } + # Find a religion in the wider region. weight it up if a county with the culture has that religion + random_in_list = { + list = seljuk_faith_selection_list + weight = { + base = 1 + # Upweight the faith of the culture if it is in their historical birth place + modifier = { + add = 50 + save_temporary_scope_as = temp_faith + scope:seljuk_birth_culture = { + any_culture_county = { + faith = scope:temp_faith + title_province = { geographical_region = dlc_fp3_seljuk_birth_region } + } + } + } + # Upweight Islamic faiths since it's historical (Maturidi) + modifier = { + religion_tag = islam_religion + add = 5 + } + # Exclude pagan faiths + modifier = { + has_doctrine_parameter = unreformed + factor = 0 + } + } + save_scope_as = seljuk_birth_faith + } + random_county_in_region = { + region = dlc_fp3_seljuk_birth_region + weight = { + base = 1 + modifier = { + culture = scope:seljuk_birth_culture + add = 2 + } + modifier = { + faith = scope:seljuk_birth_faith + add = 2 + } + } + random_county_province = { save_scope_as = seljuk_birthplace } + } + + create_character = { + age = { 20 40 } + location = scope:seljuk_birthplace + gender_female_chance = fp3_chance_female_leader + culture = scope:seljuk_birth_culture + faith = scope:seljuk_birth_faith + trait = brave + trait = ambitious + trait = gregarious + trait = education_martial_5 + trait = open_terrain_expert + trait = warlike_court_2 + martial = { 16 21 } + stewardship = { 12 15 } + diplomacy = { 11 14 } + intrigue = { 10 13 } + learning = { 9 11 } + prowess = { 18 24 } + + dynasty_house = house:house_seljuk + + after_creation = { + set_variable = { + name = seljuk_birthplace + value = scope:seljuk_birthplace + } + give_seljuk_title_effect = yes + add_gold = { medium_gold_min_value major_gold_max_value } + add_prestige = { medium_prestige_value massive_prestige_value } + add_piety = { medium_piety_value massive_piety_value } + add_martial_lifestyle_xp = 10000 + random = { + chance = 25 + add_trait = athletic + } + + add_character_flag = is_seljuk + game_rule_create_spouse_and_children = { CHARACTER = this LOCATION = this } #to make sure there is someone to continue the invasions + } + save_scope_as = lead_seljuk + } +} + +try_to_settle_the_seljuk_effect = { + # Search for a character who can host the tribe + save_scope_as = lead_seljuk + + if = { # # Attempt to settle them in a duchy within the d_nishapur region, where the conflict historically started. Starting here to save the Seljuks the trip from the Oghuz-Il region to Persia proper, then attempt to settle them in a suitable duchy title + limit = { + any_county_in_region = { + region = world_persian_empire + de_jure_liege = { + trigger_if = { + limit = { exists = holder } + holder = { is_ai = yes } + } + save_temporary_scope_as = duchy_temp + } + holder.top_liege = { capital_county.de_jure_liege != scope:duchy_temp } + } + } + random_county_in_region = { + region = world_persian_empire + limit = { + de_jure_liege = { + this = title:d_nishapur + trigger_if = { + limit = { exists = holder } + holder = { is_ai = yes } + } + save_temporary_scope_as = duchy_temp + } + holder.top_liege = { capital_county.de_jure_liege != scope:duchy_temp } + } + alternative_limit = { + de_jure_liege = { + de_jure_liege = title:k_khorasan + trigger_if = { + limit = { exists = holder } + holder = { is_ai = yes } + } + save_temporary_scope_as = duchy_temp + } + holder.top_liege = { capital_county.de_jure_liege != scope:duchy_temp } + } + alternative_limit = { + de_jure_liege = { + trigger_if = { + limit = { exists = holder } + holder = { is_ai = yes } + } + save_temporary_scope_as = duchy_temp + } + holder.top_liege = { capital_county.de_jure_liege != scope:duchy_temp } + } + weight = { + base = 1 + modifier = { + holder.top_liege = { save_temporary_scope_as = top_liege_temp } + any_neighboring_county = { + holder.top_liege != scope:top_liege_temp + } + } + } + de_jure_liege = { save_scope_as = fp3_seljuk_settle_target } + + debug_log = "Attempting to settle seljuk in random duchy" + + holder.top_liege = { trigger_event = fp3_story_cycle_seljuks_invasion_events.0002 } + } + } + else = { # nobody to settle, then attack! + start_wars_for_seljuk_empire_effect = yes + debug_log = "Attempting to settle seljuk by force" + } +} + +### Start war of conquest for the Seljuk heartland +start_wars_for_seljuk_empire_effect = { + save_temporary_scope_as = seljuk_conqueror + # Build a list of potential targets + every_independent_ruler = { + limit = { + any_sub_realm_county = { + title_province = { geographical_region = world_persian_empire } + } + } + if = { + limit = { NOT = { is_in_list = top_liege_targets } } + add_to_temporary_list = top_liege_targets + } + } + ordered_in_list = { + list = top_liege_targets + # Find the weakest target + order_by = { + value = current_military_strength + # Inver the list so the weakest is at the top + multiply = -1 + } + save_temporary_scope_as = new_war_target + primary_title = { save_temporary_scope_as = war_target_title } + # Declare the war + scope:seljuk_conqueror = { + start_war = { + cb = fp3_seljuk_invasion_cb + target = scope:new_war_target + target_title = scope:war_target_title + } + } + } +} + +# focus on forming a custom persian empire and freeing turkish people first +seljuk_war_target_evaluation_and_declaration_effect = { + # Set the Seljuk leader as reference point + save_scope_as = lead_seljuk + + #if the seljuk is a vassal he will try to fight other vassals first + if = { + limit = { + scope:lead_seljuk = { + top_liege != this + liege = { + any_vassal = { + highest_held_title_tier > tier_barony + NOR = { + is_allied_to = scope:lead_seljuk + has_usable_hook = scope:lead_seljuk + this = scope:lead_seljuk + } + } + } + } + } + #if you can't attack vassals, due to crown laws, then do a liberty faction instead + if = { + limit = { + liege = { + OR = { + has_realm_law = crown_authority_2 + has_realm_law = crown_authority_3 + } + } + can_join_or_create_faction_against = { + who = liege + faction = liberty_faction + } + } + #join one if it already exists + if = { + limit = { + liege = { + any_targeting_faction = { + faction_type = liberty_faction + } + } + } + liege = { + random_targeting_faction = { + faction_type = liberty_faction + save_temporary_scope_as = liberty_faction + } + } + scope:lead_seljuk = { + join_faction = scope:liberty_faction + } + #debug_log = "Seljuk joined liberty faction" + } + #otherwise create it + else = { + create_faction = { + type = liberty_faction + target = liege + } + #debug_log = "Seljuk created liberty faction" + } + } + #if you can attack, do it + else = { + scope:lead_seljuk = { + liege = { + random_vassal = { + limit = { + #don't try to attack barons + highest_held_title_tier > tier_barony + #don't try to attack anyone that you shouldn't want to + NOT = { + is_allied_to = scope:lead_seljuk + has_usable_hook = scope:lead_seljuk + this = scope:lead_seljuk + } + } + weight = { + base = 1 + #attack the weaklings first + modifier = { + add = { + value = current_military_strength + multiply = -1 + } + } + #focus on the closest to you + modifier = { + add = 1000 + any_held_county = { + any_neighboring_county = { + holder = scope:lead_seljuk + } + } + } + #attack mainly those inside the persian empire + modifier = { + add = 1000 + any_realm_province = { + geographical_region = world_persian_empire + } + } + } + save_temporary_scope_as = next_invasion_target + primary_title = { + duchy = { + save_temporary_scope_as = next_invasion_title_target + } + } + } + } + } + #debug_log = "Seljuk attacked a vassal" + } + } + # Select a new target + else_if = { # Check if a direct neighbor is a valid war target + limit = { + any_neighboring_and_across_water_top_liege_realm_owner = { + NOR = { + is_allied_to = scope:lead_seljuk + this = scope:lead_seljuk + any_liege_or_above = { + this = scope:lead_seljuk.liege + } + } + save_temporary_scope_as = truce_check + NOT = { + scope:lead_seljuk = { + any_truce_target = { + this = scope:truce_check + } + } + } + any_sub_realm_county = { + title_province = { geographical_region = world_persian_empire } + } + } + } + random_neighboring_and_across_water_top_liege_realm_owner = { + limit = { + NOR = { + is_allied_to = scope:lead_seljuk + this = scope:lead_seljuk + any_liege_or_above = { + this = scope:lead_seljuk.liege + } + } + save_temporary_scope_as = truce_check + NOT = { + scope:lead_seljuk = { + any_truce_target = { + this = scope:truce_check + } + } + } + any_sub_realm_county = { + title_province = { geographical_region = world_persian_empire } + } + } + weight = { + base = 1 + #attack the weaklings first + modifier = { + add = { + value = current_military_strength + multiply = -1 + } + } + #focus on the closest to you + modifier = { + add = 1000 + any_held_county = { + any_neighboring_county = { + holder = scope:lead_seljuk + } + } + } + } + save_temporary_scope_as = next_invasion_target + random_sub_realm_county = { + limit = { + title_province = { geographical_region = world_persian_empire } + } + weight = { + base = 1 + #pick a neighboring county if possible + modifier = { + add = 1000 + is_neighbor_to_realm = scope:lead_seljuk + } + } + duchy = { + save_temporary_scope_as = next_invasion_title_target + } + } + #debug_log = "Seljuk attacked a neighbor" + } + } + else_if = { # if no direct neighbors are valid war targets, then check the neighbors of the neighbors + limit = { + any_neighboring_and_across_water_top_liege_realm_owner = { + any_neighboring_and_across_water_top_liege_realm_owner = { + NOR = { + is_allied_to = scope:lead_seljuk + this = scope:lead_seljuk + any_liege_or_above = { + this = scope:lead_seljuk.liege + } + } + save_temporary_scope_as = truce_check + NOT = { + scope:lead_seljuk = { + any_truce_target = { + this = scope:truce_check + } + } + } + any_sub_realm_county = { + title_province = { geographical_region = world_persian_empire } + } + } + } + } + random_neighboring_and_across_water_top_liege_realm_owner = { + random_neighboring_and_across_water_top_liege_realm_owner = { + limit = { + NOR = { + is_allied_to = scope:lead_seljuk + this = scope:lead_seljuk + any_liege_or_above = { + this = scope:lead_seljuk.liege + } + } + save_temporary_scope_as = truce_check + NOT = { + scope:lead_seljuk = { + any_truce_target = { + this = scope:truce_check + } + } + } + any_sub_realm_county = { + title_province = { geographical_region = world_persian_empire } + } + } + weight = { + base = 1 + #attack the weaklings first + modifier = { + add = { + value = current_military_strength + multiply = -1 + } + } + #focus on the closest to you + modifier = { + add = 1000 + any_held_county = { + any_neighboring_county = { + holder = scope:lead_seljuk + } + } + } + } + save_temporary_scope_as = next_invasion_target + random_sub_realm_county = { + limit = { + title_province = { geographical_region = world_persian_empire } + } + weight = { + base = 1 + #pick a neighboring county if possible + modifier = { + add = 1000 + is_neighbor_to_realm = scope:lead_seljuk + } + } + duchy = { + save_temporary_scope_as = next_invasion_title_target + } + } + #debug_log = "Seljuk attacked a neihgbor's neighbor" + } + } + } + if = { + limit = { + exists = scope:next_invasion_target + } + start_war = { + cb = fp3_seljuk_invasion_cb + target = scope:next_invasion_target + target_title = scope:next_invasion_title_target + } + } +} + +# Fight for independence +seljuk_request_independence_from_liege_effect = { + save_scope_as = lead_seljuk + scope:lead_seljuk = { + if = { + limit = { + liege = { + any_targeting_faction = { + faction_type = independence_faction + } + } + } + run_interaction = { + interaction = join_independence_faction_interaction + actor = scope:lead_seljuk + recipient = liege + execute_threshold = decline + } + } + else_if = { + limit = { + can_create_faction = { + target = liege + type = independence_faction + } + } + run_interaction = { + interaction = start_independence_faction_interaction + actor = scope:lead_seljuk + recipient = liege + execute_threshold = decline + } + } + #debug_log_scopes = yes + #debug_log = "Seljuk asked for independence" + liege = { + random_targeting_faction = { + faction_type = independence_faction + faction_start_war = {} + } + } + } +} + +### Zanj Rebellion Effects + +#This is Ali Ibn Muhammad, leader of the Zanj Rebellion +spawn_zanj_leader_character_effect = { + create_character = { + age = { 55 65 } + name = "Muhammad" + gender = male + faith = faith:zayidi + location = title:c_basra.title_province + culture = culture:bedouin + + dynasty = none + + save_scope_as = zanj_leader_father + } + + create_character = { + age = { 55 65 } + gender = female + faith = faith:azariqa + location = title:c_basra.title_province + culture = culture:bedouin + + dynasty = none + + save_scope_as = zanj_leader_mother + } + + create_character = { + age = { 25 35 } + name = "Ali" + gender = male + faith = faith:zayidi + location = title:c_basra.title_province + culture = culture:bedouin + father = scope:zanj_leader_father + mother = scope:zanj_leader_mother + dynasty = none + + trait = education_intrigue_3 + trait = ambitious + trait = deceitful + trait = just + trait = shrewd + trait = peasant_leader + + random_traits = no + #Skills + learning = { + min_template_high_skill + max_template_high_skill + } + martial = { + min_template_average_skill + max_template_average_skill + } + prowess = { + min_template_low_skill + max_template_low_skill + } + diplomacy = { + min_template_average_skill + max_template_average_skill + } + intrigue = { + min_template_high_skill + max_template_high_skill + } + stewardship = { + min_template_low_skill + max_template_low_skill + } + save_scope_as = zanj_leader + } +} + +spawn_zanj_representative_character_effect = { + create_character = { + age = { 30 40 } + gender_female_chance = 50 + faith = faith:azariqa + location = title:c_basra.title_province + culture = culture:east_bantu + + dynasty = none + + trait = education_martial_3 + trait = organizer + trait = brave + trait = peasant_leader + random_traits_list = { + count = 2 + ambitious = {} + gregarious = {} + trusting = {} + wrathful = {} + just = {} + compassionate = {} + honest = {} + vengeful = {} + } + #Skills + learning = { + min_template_low_skill + max_template_average_skill + } + martial = { + min_template_average_skill + max_template_average_skill + } + prowess = { + min_template_low_skill + max_template_average_skill + } + diplomacy = { + min_template_average_skill + max_template_average_skill + } + intrigue = { + min_template_low_skill + max_template_average_skill + } + stewardship = { + min_template_low_skill + max_template_average_skill + } + save_scope_as = zanj_representative + } +} + +fp3_start_zanj_rebellion_effect = { + + $REBEL_LEADER$ = { save_scope_as = rebel_leader } + $TARGET_COUNTY$ = { save_scope_as = target_county } + #Give the zanj leader a title + create_dynamic_title = { + tier = duchy + name = fp3_zanj_rebellion_name + adj = fp3_zanj_rebellion_name_adj + } + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + scope:new_title = { + set_capital_county = scope:target_county + set_landless_title = yes + set_destroy_on_gain_same_tier = yes + set_no_automatic_claims = yes + set_can_be_named_after_dynasty = no + set_can_use_nomadic_naming = no + change_title_holder = { + holder = scope:rebel_leader + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + scope:new_title = { + generate_coa = yes + set_variable = { + name = temporary_title + value = yes + } + } + #Declare the war. + scope:rebel_leader = { + start_war = { + cb = fp3_zanj_rebellion_war + target = scope:target_county.holder.top_liege + target_title = scope:target_county.duchy + } + } + # Setup event troops. + scope:rebel_leader = { + spawn_army = { + levies = zanj_rebellion_strength_score_levy + men_at_arms = { + type = pikemen_unit + stacks = zanj_rebellion_strength_score_pikemen + } + men_at_arms = { + type = bowmen + stacks = zanj_rebellion_strength_score_bowmen + } + men_at_arms = { + type = light_footmen + stacks = zanj_rebellion_strength_score_skirmishers + } + location = province:6022 + origin = province:6022 + inheritable = yes + name = fp3_zanj_rebel_army_title + } + } +} + +create_zanj_courtier_effect = { + hidden_effect = { + create_character = { + location = $LOCATION$ + faith = faith:azariqa + culture = culture:east_bantu + dynasty = none + age = { 18 30 } + save_scope_as = new_zanj_courtier + gender_female_chance = 50 + } + scope:new_zanj_courtier = { + set_employer = $EMPLOYER$ + } + } +} + +create_zanj_vassal_effect = { + hidden_effect = { + create_character = { + faith = faith:azariqa + culture = culture:east_bantu + gender_female_chance = 50 + age = { 18 30 } + trait = peasant_leader + save_scope_as = new_zanj_vassal + location = $LOCATION$ + } + } +} + +inherit_zanj_rebellion_effect = { + scope:zanj_leader = { save_scope_as = old_zanj_leader } + spawn_zanj_representative_character_effect = yes + scope:zanj_representative = { save_scope_as = zanj_leader } + + scope:zanj_leader = { + set_variable = { + name = zanj_rebellion_strength_score + value = 7 + } + add_character_flag = new_zanj_leader + save_scope_as = story_owner + } +} + + +create_seljuk_army_effect = { + scope:lead_seljuk = { # Give them a sizable amount of troops to begin with so they don't instantly wipe out + if = { + limit = { has_dlc_feature = tours_and_tournaments } + # Give base_level troops that don't replenish + if = { + limit = { + has_mpo_dlc_trigger = yes + } + spawn_army = { + men_at_arms = { + type = nomadic_riders + stacks = { + value = seljuk_invasion_nomad_strength_score_levy + multiply = 2 + divide = 100 + } + } + men_at_arms = { + type = horse_archers + stacks = { + value = var:seljuk_invasion_nomad_strength_score + multiply = fp3_seljuk_stack_miniscule_value + multiply = scope:victim_strength_modifier + } + } + men_at_arms = { + type = accolade_maa_horse_archers + stacks = { + value = var:seljuk_invasion_nomad_strength_score + multiply = fp3_seljuk_stack_miniscule_value + multiply = scope:victim_strength_modifier + } + } + men_at_arms = { + type = heavy_horse_archers + stacks = { + value = var:seljuk_invasion_nomad_strength_score + multiply = fp3_seljuk_stack_miniscule_value + multiply = scope:victim_strength_modifier + } + } + men_at_arms = { + type = steppe_raiders + stacks = { + value = var:seljuk_invasion_nomad_strength_score + multiply = fp3_seljuk_stack_minor_value + multiply = scope:victim_strength_modifier + } + } + men_at_arms = { + type = nomad_lancers + stacks = { + value = var:seljuk_invasion_nomad_strength_score + multiply = fp3_seljuk_stack_miniscule_value + multiply = scope:victim_strength_modifier + } + } + men_at_arms = { + type = accolade_maa_outriders + stacks = { + value = var:seljuk_invasion_nomad_strength_score + multiply = fp3_seljuk_stack_miniscule_value + multiply = scope:victim_strength_modifier + } + } + men_at_arms = { + type = onager + stacks = { + value = seljuk_invasion_nomad_strength_score_siege_weapon + multiply = fp3_seljuk_stack_monumental_value + multiply = scope:victim_strength_modifier + } + } + location = scope:spawn_location + war = scope:war + war_keep_on_attacker_victory = yes + uses_supply = no + save_scope_as = seljuk_nomad_horde + name = fp3_seljuk_horde_army_title + } + } + else = { + spawn_army = { + levies = { + value = seljuk_invasion_nomad_strength_score_levy + multiply = 2 + } + men_at_arms = { + type = horse_archers + stacks = { + value = var:seljuk_invasion_nomad_strength_score + multiply = fp3_seljuk_stack_miniscule_value + multiply = scope:victim_strength_modifier + } + } + men_at_arms = { + type = accolade_maa_horse_archers + stacks = { + value = var:seljuk_invasion_nomad_strength_score + multiply = fp3_seljuk_stack_miniscule_value + multiply = scope:victim_strength_modifier + } + } + men_at_arms = { + type = accolade_maa_horse_archers + stacks = { + value = var:seljuk_invasion_nomad_strength_score + multiply = fp3_seljuk_stack_miniscule_value + multiply = scope:victim_strength_modifier + } + } + men_at_arms = { + type = light_horsemen + stacks = { + value = var:seljuk_invasion_nomad_strength_score + multiply = fp3_seljuk_stack_minor_value + multiply = scope:victim_strength_modifier + } + } + men_at_arms = { + type = accolade_maa_outriders + stacks = { + value = var:seljuk_invasion_nomad_strength_score + multiply = fp3_seljuk_stack_miniscule_value + multiply = scope:victim_strength_modifier + } + } + men_at_arms = { + type = accolade_maa_outriders + stacks = { + value = var:seljuk_invasion_nomad_strength_score + multiply = fp3_seljuk_stack_miniscule_value + multiply = scope:victim_strength_modifier + } + } + men_at_arms = { + type = onager + stacks = { + value = seljuk_invasion_nomad_strength_score_siege_weapon + multiply = fp3_seljuk_stack_monumental_value + multiply = scope:victim_strength_modifier + } + } + location = scope:spawn_location + war = scope:war + war_keep_on_attacker_victory = yes + uses_supply = no + save_scope_as = seljuk_nomad_horde + name = fp3_seljuk_horde_army_title + } + } + } + else = { + if = { + limit = { + has_mpo_dlc_trigger = yes + } + # Give base_level troops that don't replenish + spawn_army = { + men_at_arms = { + type = nomadic_riders + stacks = { + value = seljuk_invasion_nomad_strength_score_levy + divide = 100 + } + } + men_at_arms = { + type = horse_archers + stacks = { + value = var:seljuk_invasion_nomad_strength_score + multiply = fp3_seljuk_stack_massive_value + multiply = scope:victim_strength_modifier + } + } + men_at_arms = { + type = steppe_raiders + stacks = { + value = var:seljuk_invasion_nomad_strength_score + multiply = fp3_seljuk_stack_massive_value + multiply = scope:victim_strength_modifier + } + } + men_at_arms = { + type = heavy_horse_archers + stacks = { + value = var:seljuk_invasion_nomad_strength_score + multiply = fp3_seljuk_stack_massive_value + multiply = scope:victim_strength_modifier + } + } + + men_at_arms = { + type = onager + stacks = { + value = seljuk_invasion_nomad_strength_score_siege_weapon + multiply = fp3_seljuk_stack_monumental_value + multiply = scope:victim_strength_modifier + } + } + location = scope:spawn_location + war = scope:war + war_keep_on_attacker_victory = yes + uses_supply = no + save_scope_as = seljuk_nomad_horde + name = fp3_seljuk_horde_army_title + } + } + else = { + # Give base_level troops that don't replenish + spawn_army = { + levies = { + value = seljuk_invasion_nomad_strength_score_levy + multiply = 1 + } + men_at_arms = { + type = horse_archers + stacks = { + value = var:seljuk_invasion_nomad_strength_score + multiply = fp3_seljuk_stack_massive_value + multiply = scope:victim_strength_modifier + } + } + men_at_arms = { + type = light_horsemen + stacks = { + value = var:seljuk_invasion_nomad_strength_score + multiply = fp3_seljuk_stack_massive_value + multiply = scope:victim_strength_modifier + } + } + men_at_arms = { + type = bowmen + stacks = { + value = var:seljuk_invasion_nomad_strength_score + multiply = fp3_seljuk_stack_massive_value + multiply = scope:victim_strength_modifier + } + } + + men_at_arms = { + type = onager + stacks = { + value = seljuk_invasion_nomad_strength_score_siege_weapon + multiply = fp3_seljuk_stack_monumental_value + multiply = scope:victim_strength_modifier + } + } + location = scope:spawn_location + war = scope:war + war_keep_on_attacker_victory = yes + uses_supply = no + save_scope_as = seljuk_nomad_horde + name = fp3_seljuk_horde_army_title + } + } + } + } + scope:seljuk_nomad_horde ?= { assign_commander = scope:lead_seljuk } +} + +create_seljuk_army_at_peace_effect = { + # Give base_level troops that don't replenish + scope:lead_seljuk = { + # Give troops to attacker based on strength score counter + if = { + limit = { has_dlc_feature = tours_and_tournaments } + spawn_army = { + men_at_arms = { + type = nomadic_riders + stacks = { + value = seljuk_invasion_nomad_strength_score_levy + divide = 100 + } + } + men_at_arms = { + type = heavy_horse_archers + stacks = { + value = var:seljuk_invasion_nomad_strength_score + multiply = fp3_seljuk_stack_minor_value + multiply = scope:victim_strength_modifier + } + } + men_at_arms = { + type = nomad_lancers + stacks = { + value = var:seljuk_invasion_nomad_strength_score + multiply = fp3_seljuk_stack_minor_value + multiply = scope:victim_strength_modifier + } + } + men_at_arms = { + type = onager + stacks = seljuk_invasion_nomad_strength_score_siege_weapon + } + location = scope:spawn_location + origin = scope:spawn_location + save_scope_as = seljuk_nomad_horde + name = fp3_seljuk_horde_army_title + } + } + else = { + spawn_army = { + levies = seljuk_invasion_nomad_strength_score_levy + men_at_arms = { + type = horse_archers + stacks = var:seljuk_invasion_nomad_strength_score + } + men_at_arms = { + type = onager + stacks = seljuk_invasion_nomad_strength_score_siege_weapon + } + location = scope:spawn_location + origin = scope:spawn_location + uses_supply = no + save_scope_as = seljuk_nomad_horde + name = fp3_seljuk_horde_army_title + } + } + } +} + +increase_tax_collector_skill = { + switch = { + trigger = root.var:skill_to_increase + flag:stewardship = { add_stewardship_skill = 1 } + flag:intrigue = { add_intrigue_skill = 1 } + flag:diplomacy = { add_diplomacy_skill = 1 } + } +} diff --git a/N3OW/common/scripted_effects/01_ep1_court_artifact_creation_effects.txt b/N3OW/common/scripted_effects/01_ep1_court_artifact_creation_effects.txt new file mode 100644 index 00000000..da211ce1 --- /dev/null +++ b/N3OW/common/scripted_effects/01_ep1_court_artifact_creation_effects.txt @@ -0,0 +1,7002 @@ +########################################## +# Court Artifact Creation and Decoration # +########################################## + +############### +# CHEST + +create_artifact_chest_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $CARPENTER$ = { save_scope_as = carpenter } + hidden_effect_new_object = { + # Get artifact quality, wealth, and materials + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + scope:owner = { + # Create the artifact + create_artifact = { + name = artifact_chest_name + creator = scope:carpenter + description = placeholder # Will be regenerated in the post-creation effects + visuals = chest + type = chest + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + + scope:newly_created_artifact = { + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_chest_description + set_variable = { + name = big_chest + value = yes + } + + add_scaled_artifact_modifier_grandeur_small_effect = yes + add_scaled_artifact_modifier_piety_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_scaled_artifact_modifier_dynasty_prestige_effect = yes + } + remove_artifact_modifier = artifact_placeholder_modifier + } + } +} + +create_artifact_cabinet_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $CARPENTER$ = { save_scope_as = carpenter } + hidden_effect_new_object = { + # Get artifact quality, wealth, and materials + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + # Create the artifact + # Indian cabinets are actually diwans! + if = { + limit = { + scope:carpenter = { artifact_use_indian_building_visuals_trigger = yes } + } + scope:owner = { + create_artifact = { + name = artifact_diwan_name + creator = scope:carpenter + description = placeholder # Will be regenerated in the post-creation effects + visuals = diwan + type = cabinet + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + } + #Mena cabinets are actually tables! + else_if = { + limit = { + scope:carpenter = { + OR = { + artifact_use_mena_building_visuals_trigger = yes + artifact_use_iranian_building_visuals_trigger = yes + artifact_use_steppe_building_visuals_trigger = yes + } + } + } + scope:owner = { + create_artifact = { + name = artifact_table_name + creator = scope:carpenter + description = placeholder # Will be regenerated in the post-creation effects + visuals = table + type = cabinet + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + } + else = { + scope:owner = { + create_artifact = { + name = artifact_cabinet_name + creator = scope:carpenter + description = placeholder # Will be regenerated in the post-creation effects + visuals = cabinet + type = cabinet + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + } + scope:newly_created_artifact = { + get_artifact_feature_references_effect = yes + + add_scaled_artifact_modifier_grandeur_small_effect = yes + add_scaled_artifact_modifier_piety_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_scaled_artifact_modifier_dynasty_prestige_effect = yes + } + remove_artifact_modifier = artifact_placeholder_modifier + # Indian cabinets are actually diwans! + if = { + limit = { + scope:carpenter = { artifact_use_indian_building_visuals_trigger = yes } + } + set_artifact_description = artifact_diwan_description + } + else_if = { + limit = { + scope:carpenter = { + OR = { + artifact_use_mena_building_visuals_trigger = yes + artifact_use_iranian_building_visuals_trigger = yes + artifact_use_steppe_building_visuals_trigger = yes + } + } + } + set_artifact_description = artifact_table_description + } + else = { + set_variable = { + name = cabinet + value = yes + } + set_artifact_description = artifact_cabinet_description + } + } + } +} + +create_artifact_throne_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $MAKER$ = { save_scope_as = maker } + hidden_effect_new_object = { + # Get artifact quality, wealth, and materials + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + # Create the artifact + scope:owner = { + create_artifact = { + name = artifact_throne_name + description = placeholder # Will be regenerated in the post-creation effects + creator = scope:maker + visuals = throne + type = throne + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + scope:newly_created_artifact = { + set_artifact_description = artifact_throne_description + + #Let's add modifiers! + add_scaled_artifact_modifier_prestige_effect = yes + if = { + limit = { rarity = illustrious } + add_scaled_artifact_modifier_majesty_effect = yes + add_scaled_artifact_modifier_rulership_effect = yes + } + else_if = { + limit = { rarity = famed } + add_scaled_artifact_modifier_majesty_effect = yes + } + + # All thrones have a chance to get some extra Grandeur + add_scaled_artifact_modifier_grandeur_big_effect = yes + remove_artifact_modifier = artifact_placeholder_modifier + } + } +} + + +############### +# TAPESTRY + +create_artifact_tapestry_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $WEAVER$ = { save_scope_as = weaver } + + hidden_effect_new_object = { + # Get artifact quality, wealth, and materials + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + if = { #If the scene has been set in events we save it on the owner here so we can access it when choosing features + limit = { exists = scope:tapestry_scene } + scope:owner = { + set_variable = { + name = artifact_tapestry_scene + value = scope:tapestry_scene + days = 1 + } + } + } + # Fallback + else = { + random_list = { + 10 = { + scope:owner = { + set_variable = { + name = artifact_tapestry_scene + value = flag:geometric_patterns + days = 1 + } + } + } + 10 = { + scope:owner = { + set_variable = { + name = artifact_tapestry_scene + value = flag:garden + days = 1 + } + } + } + 10 = { + scope:owner = { + set_variable = { + name = artifact_tapestry_scene + value = flag:bucolic + days = 1 + } + } + } + } + } + # Create the artifact + scope:owner = { + if = { + limit = { + exists = scope:inspiration_owner + } + create_artifact = { + name = artifact_wall_tapestry_name + description = placeholder # Will be regenerated in the post-creation effects + creator = scope:weaver + visuals = tapestry + type = tapestry + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + else_if = { + limit = { + exists = scope:adventurer + } + create_artifact = { + name = artifact_wall_tapestry_name + description = placeholder # Will be regenerated in the post-creation effects + creator = scope:adventurer + visuals = tapestry + type = tapestry + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else = { + create_artifact = { + name = artifact_wall_tapestry_name + description = placeholder # Will be regenerated in the post-creation effects + creator = scope:weaver + visuals = tapestry + type = tapestry + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + } + scope:newly_created_artifact = { + set_artifact_description = artifact_wall_tapestry_description + # Set grandeur + add_scaled_artifact_modifier_grandeur_big_effect = yes + + if = { + limit = { + has_artifact_feature = tapestry_scene_religious + } + add_scaled_artifact_modifier_piety_effect = yes + } + else = { + add_scaled_artifact_modifier_majesty_effect = yes + } + + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_scaled_artifact_modifier_dynasty_prestige_effect = yes + } + remove_artifact_modifier = artifact_placeholder_modifier + } + } +} + + +############### +# HIDE + +#If the animal has been hunted we need to provide a location +get_animal_hunt_location_effect = { + if = { + limit = { + NOT = { exists = scope:location } + } + if = { + limit = { + exists = scope:owner.involved_activity + scope:owner.involved_activity = { has_activity_type = activity_hunt } + } + scope:owner.involved_activity.activity_location = { save_scope_as = location } + } + else = { + scope:owner = { + random_list = { + 30 = { #It's hunted in your own realm + trigger = { + any_sub_realm_county = { + exists = this + } + } + random_sub_realm_county = { + random_county_province = { save_scope_as = location } + } + } + 30 = { #It's hunted in a neighbors realm + trigger = { + highest_held_title_tier >= tier_county + any_neighboring_realm_same_rank_owner = { + exists = capital_county + } + } + random_neighboring_realm_same_rank_owner = { + limit = { + exists = capital_county + } + capital_county = { + random_county_province = { save_scope_as = location } + } + } + } + 1 = { # It's hunted in our current location (as a fallback if we're unlanded or only a baron). + trigger = { + OR = { + highest_held_title_tier < tier_county + is_landed = no + } + } + location.county = { + random_county_province = { save_scope_as = location } + } + } + } + } + } + } + scope:owner = { + if = { + limit = { + NOT = { has_variable = adventure_artifact_location } + } + set_variable = { + name = adventure_artifact_location + value = scope:location + days = 1 + } + } + if = { + limit = { + NOT = { has_variable = adventure_artifact_hunter } + exists = scope:creator + } + set_variable = { + name = adventure_artifact_hunter + value = scope:creator + days = 1 + } + } + else_if = { + limit = { + NOT = { has_variable = adventure_artifact_hunter } + } + set_variable = { + name = adventure_artifact_hunter + value = scope:owner + days = 1 + } + } + } +} + +create_artifact_animal_hide_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $HUNTER$ = { save_scope_as = hunter } + save_scope_value_as = { name = legendary value = $LEGENDARY$ } + scope:owner = { + set_variable = { name = animal_type value = $ANIMAL$ days = 5 } + if = { + limit = { + OR = { + NOT = { exists = var:animal_type } + var:animal_type ?= flag:none + } + } + random_list = { + 8 = { + hunt_activity_standard_game_effect = { PROVINCE = scope:hunter.location HUNTER = scope:hunter } + } + 2 = { + hunt_activity_dangerous_game_effect = { PROVINCE = scope:hunter.location } + } + } + } + } + if = { + limit = { exists = scope:adventurer } + scope:adventurer = { save_scope_as = creator } + } + else = { + scope:hunter = { save_scope_as = creator } + } + hidden_effect_new_object = { + # Get artifact quality, wealth, and materials + animal_artifact_wealth_quality_effect = yes + get_animal_hunt_location_effect = yes + scope:location = { add_to_list = artifact_material_sources } + if = { + limit = { + OR = { + hunt_hide_big_trigger = { VARIABLE = scope:owner.var:animal_type } + AND = { + exists = scope:animal_hide_size + scope:animal_hide_size = flag:big + } + } + } + if = { + limit = { + NOT = { exists = scope:animal_hide_size } + } + save_scope_value_as = { name = animal_hide_size value = flag:big } + } + create_artifact = { + name = artifact_animal_hide_big_name + creator = scope:creator + description = placeholder + visuals = large_animal_hide + type = animal_hide_big + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + scope:newly_created_artifact = { + # Set grandeur + add_scaled_artifact_modifier_grandeur_big_effect = yes + # Set prestige + add_scaled_artifact_modifier_prestige_effect = yes + } + } + else = { + if = { + limit = { + NOT = { exists = scope:animal_hide_size } + } + save_scope_value_as = { name = animal_hide_size value = flag:small } + } + create_artifact = { + name = artifact_small_hide_name + creator = scope:creator + description = placeholder + visuals = small_animal_hide + type = animal_hide + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + scope:newly_created_artifact = { + if = { + limit = { + has_artifact_feature = animal_hide_type_cat + exists = scope:owner.var:story_cycle_cat_name + } + set_variable = { + name = pet_name + value = scope:owner.var:story_cycle_cat_name + } + } + else_if = { + limit = { + has_artifact_feature = animal_hide_type_dog + exists = scope:owner.var:story_cycle_dog_name + } + set_variable = { + name = pet_name + value = scope:owner.var:story_cycle_dog_name + } + } + # Set grandeur + add_scaled_artifact_modifier_grandeur_small_effect = yes + # Set prestige + add_scaled_artifact_modifier_minor_prestige_effect = yes + } + } + scope:newly_created_artifact = { + set_max_durability = 60 + set_variable = { + name = adventure_artifact_location + value = scope:owner.var:adventure_artifact_location + } + set_variable = { + name = adventure_artifact_hunter + value = scope:owner.var:adventure_artifact_hunter + } + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_scaled_artifact_modifier_dynasty_prestige_effect = yes + } + remove_artifact_modifier = artifact_placeholder_modifier + set_variable = { + name = animal_type + value = scope:owner.var:animal_type + } + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + hunt_animal_artifact_modifier_selection_effect = yes + if = { + limit = { scope:legendary = yes } + set_artifact_name = artifact_animal_hide_name_legendary + set_variable = { name = legendary } + add_scaled_artifact_modifier_majesty_effect = yes + add_scaled_artifact_modifier_combat_effect = yes + } + else_if = { + limit = { exists = scope:adventurer } + set_artifact_name = artifact_animal_hide_name_adventurer + } + else_if = { + limit = { exists = var:pet_name } + if = { + limit = { has_artifact_feature = animal_hide_type_cat } + set_artifact_name = artifact_animal_hide_name_cat + } + else_if = { + limit = { has_artifact_feature = animal_hide_type_dog } + set_artifact_name = artifact_animal_hide_name_dog + } + } + else_if = { + limit = { artifact_type = animal_hide_big } + set_artifact_name = artifact_animal_hide_big_name + } + else = { set_artifact_name = artifact_small_hide_name } + set_artifact_description = artifact_small_hide_description + } + scope:owner = { + remove_variable = adventure_artifact_location + remove_variable = adventure_artifact_hunter + } + } +} + +################## +# SKULL + +create_artifact_wall_skull_effect = { + $OWNER$ = { save_scope_as = owner } + $HUNTER$ = { save_scope_as = hunter } + save_scope_value_as = { name = legendary value = $LEGENDARY$ } + scope:owner = { + set_variable = { name = animal_type value = $ANIMAL$ days = 5 } + if = { + limit = { + OR = { + NOT = { exists = var:animal_type } + var:animal_type ?= flag:none + } + } + random_list = { + 8 = { + hunt_activity_standard_game_effect = { PROVINCE = scope:hunter.location HUNTER = scope:hunter } + } + 2 = { + hunt_activity_dangerous_game_effect = { PROVINCE = scope:hunter.location } + } + } + } + } + if = { + limit = { exists = scope:adventurer } + scope:adventurer = { save_scope_as = creator } + } + else = { + scope:hunter = { save_scope_as = creator } + } + hidden_effect_new_object = { + # Get artifact quality, location, and animal + animal_artifact_wealth_quality_effect = yes + get_animal_hunt_location_effect = yes + scope:location = { add_to_list = artifact_material_sources } + scope:owner = { + create_artifact = { + name = artifact_wall_skull_name + description = placeholder + creator = scope:creator + visuals = animal_trophy + type = animal_skull + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + scope:newly_created_artifact = { + set_max_durability = 60 + # Set grandeur + add_scaled_artifact_modifier_grandeur_small_effect = yes + # Set prestige + add_scaled_artifact_modifier_minor_prestige_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_scaled_artifact_modifier_dynasty_prestige_effect = yes + } + remove_artifact_modifier = artifact_placeholder_modifier + set_variable = { + name = animal_type + value = scope:owner.var:animal_type + } + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + hunt_animal_artifact_modifier_selection_effect = yes + if = { + limit = { scope:legendary = yes } + set_artifact_name = artifact_wall_skull_name_legendary + set_variable = { name = legendary } + add_scaled_artifact_modifier_majesty_effect = yes + add_scaled_artifact_modifier_combat_effect = yes + } + else_if = { + limit = { exists = scope:adventurer } + set_artifact_name = artifact_wall_skull_name_adventurer + } + else = { set_artifact_name = artifact_wall_skull_name } + set_artifact_description = artifact_wall_skull_description + } + scope:owner = { + remove_variable = adventure_artifact_location + remove_variable = adventure_artifact_hunter + } + } +} + +create_artifact_wall_narwhal_horn_effect = { + $OWNER$ = { save_scope_as = owner } + $HUNTER$ = { save_scope_as = hunter } + + hidden_effect_new_object = { + # Get artifact quality and wealth + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + scope:owner = { + set_variable = { + name = animal_type + value = flag:unicorn + days = 1 + } + if = { + limit = { exists = scope:adventurer } + scope:adventurer = { save_scope_as = creator } + } + else = { save_scope_as = creator } + } + scope:owner = { + if = { + limit = { + exists = scope:adventurer + } + create_artifact = { + name = artifact_wall_narwhal_horn_name + description = artifact_wall_narwhal_horn + visuals = animal_trophy + type = animal_skull + modifier = artifact_monthly_prestige_3_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else = { + create_artifact = { + name = artifact_wall_narwhal_horn_name + description = artifact_wall_narwhal_horn + creator = scope:hunter + visuals = animal_trophy + type = animal_skull + modifier = artifact_monthly_prestige_3_modifier + wealth = scope:wealth + quality = scope:quality + #decaying = no + save_scope_as = newly_created_artifact + } + } + } + scope:newly_created_artifact = { + # Set grandeur + add_scaled_artifact_modifier_grandeur_big_effect = yes + # Set prestige + add_scaled_artifact_modifier_prestige_effect = yes + add_scaled_artifact_modifier_piety_effect = yes + # Extra for really good stuff + if = { + limit = { + OR = { + rarity = illustrious + rarity = famed + } + } + add_scaled_artifact_modifier_majesty_effect = yes + add_scaled_artifact_modifier_dynasty_prestige_effect = yes + } + remove_artifact_modifier = artifact_placeholder_modifier + save_scope_as = epic + } + } + scope:newly_created_artifact = { + if = { + limit = { scope:quality >= 66 } + add_artifact_modifier = artifact_court_grandeur_baseline_add_2_modifier + } + else_if = { + limit = { scope:quality >= 33 } + add_artifact_modifier = artifact_court_grandeur_baseline_add_1_modifier + } + + # Wealth determines prestige + if = { + limit = { scope:wealth >= 66 } + add_artifact_modifier = artifact_monthly_prestige_2_modifier + } + else_if = { + limit = { scope:wealth >= 33 } + add_artifact_modifier = artifact_placeholder_modifier + } + save_scope_as = epic + } +} + +############### +# ANIMAL TRINKET + +create_artifact_animal_trinket_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $HUNTER$ = { save_scope_as = hunter } + save_scope_value_as = { name = legendary value = $LEGENDARY$ } + scope:owner = { + set_variable = { name = animal_type value = $ANIMAL$ days = 5 } + if = { + limit = { + OR = { + NOT = { exists = var:animal_type } + var:animal_type ?= flag:none + } + } + random_list = { + 8 = { + hunt_activity_standard_game_effect = { PROVINCE = scope:hunter.location HUNTER = scope:hunter } + } + 2 = { + hunt_activity_dangerous_game_effect = { PROVINCE = scope:hunter.location } + } + } + } + } + if = { + limit = { exists = scope:adventurer } + scope:adventurer = { save_scope_as = creator } + } + else = { + scope:hunter = { save_scope_as = creator } + } + hidden_effect_new_object = { + # Get artifact quality, wealth, materials, and decorations + animal_artifact_wealth_quality_effect = yes + get_animal_hunt_location_effect = yes + scope:location = { add_to_list = artifact_material_sources } + scope:owner = { + if = { + limit = { + OR = { + scope:owner.var:animal_type ?= flag:fox + scope:owner.var:animal_type ?= flag:cat + } + } + create_artifact = { + name = artifact_animal_trinket_name + creator = scope:hunter + description = placeholder + visuals = fox_tail + type = animal_trinket + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { + OR = { + scope:owner.var:animal_type ?= flag:bear + scope:owner.var:animal_type ?= flag:leopard + scope:owner.var:animal_type ?= flag:lion + scope:owner.var:animal_type ?= flag:tiger + scope:owner.var:animal_type ?= flag:wolf + scope:owner.var:animal_type ?= flag:lynx + scope:owner.var:animal_type ?= flag:wolf + scope:owner.var:animal_type ?= flag:dog + scope:owner.var:animal_type ?= flag:hyena + } + } + create_artifact = { + name = artifact_animal_trinket_name + creator = scope:hunter + description = placeholder + visuals = bear_paw + type = animal_trinket + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { + OR = { + scope:owner.var:animal_type ?= flag:aurochs + scope:owner.var:animal_type ?= flag:bison + scope:owner.var:animal_type ?= flag:boar + } + } + create_artifact = { + name = artifact_animal_trinket_name + creator = scope:hunter + description = placeholder + visuals = tusk + type = animal_trinket + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { + OR = { + scope:owner.var:animal_type ?= flag:hare + scope:owner.var:animal_type ?= flag:horse + scope:owner.var:animal_type ?= flag:unicorn + } + } + create_artifact = { + name = artifact_animal_trinket_name + creator = scope:hunter + description = placeholder + visuals = pouch + type = animal_trinket + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + else = { + create_artifact = { + name = artifact_animal_trinket_name + creator = scope:hunter + description = placeholder + visuals = animal_trinket + type = animal_trinket + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + } + scope:newly_created_artifact = { + set_max_durability = 60 + # Set prestige + add_scaled_artifact_modifier_minor_prestige_effect = yes + # Set stress loss + add_scaled_artifact_modifier_stress_gain_effect = yes + remove_artifact_modifier = artifact_placeholder_modifier + set_variable = { + name = animal_type + value = scope:owner.var:animal_type + } + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + hunt_animal_artifact_modifier_selection_effect = yes + if = { + limit = { scope:legendary = yes } + set_variable = { name = legendary } + add_scaled_artifact_modifier_majesty_effect = yes + add_scaled_artifact_modifier_combat_effect = yes + } + set_artifact_description = artifact_animal_trinket_description + } + scope:owner = { + remove_variable = adventure_artifact_location + remove_variable = adventure_artifact_hunter + } + } +} + +############### +# ANIMAL FEATHER + +create_artifact_bird_feather_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $HUNTER$ = { save_scope_as = hunter } + scope:owner = { + set_variable = { name = animal_type value = $ANIMAL$ } + if = { + limit = { + OR = { + NOT = { exists = var:animal_type } + var:animal_type ?= flag:none + } + } + hunt_activity_falconry_game_effect = { PROVINCE = scope:hunter.location } + } + } + if = { + limit = { exists = scope:adventurer } + scope:adventurer = { save_scope_as = creator } + } + else = { + scope:hunter = { save_scope_as = creator } + } + hidden_effect_new_object = { + # Get artifact quality, wealth, materials, and decorations + animal_artifact_wealth_quality_effect = yes + get_animal_hunt_location_effect = yes + scope:location = { add_to_list = artifact_material_sources } + scope:owner = { + create_artifact = { + name = artifact_bird_feather_name + creator = scope:hunter + description = placeholder + visuals = bird_feather + type = bird_feather + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + scope:newly_created_artifact = { + if = { + limit = { + scope:owner.var:animal_type ?= flag:eagle + exists = scope:owner.var:story_cycle_eagle_name + } + set_variable = { + name = pet_name + value = scope:owner.var:story_cycle_eagle_name + } + set_artifact_name = artifact_animal_feather_name_eagle + set_artifact_description = artifact_bird_feather_pet_description + } + else = { + set_artifact_description = artifact_bird_feather_description + } + + set_max_durability = 60 + + # Set prestige + add_scaled_artifact_modifier_minor_prestige_effect = yes + # Set stress loss + add_scaled_artifact_modifier_stress_gain_effect = yes + remove_artifact_modifier = artifact_placeholder_modifier + + set_variable = { + name = animal_type + value = scope:owner.var:animal_type + } + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + } + scope:owner = { + remove_variable = adventure_artifact_location + remove_variable = adventure_artifact_hunter + remove_variable = animal_type + } + } +} + +############### +# BOX + +# Small box +create_artifact_box_small_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $CARPENTER$ = { save_scope_as = carpenter } + hidden_effect_new_object = { + # Get artifact quality, wealth, and materials + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + if = { #IF we have set the location we use it for the materials + limit = { exists = scope:location } + scope:location = { add_to_list = artifact_material_sources } + } + + # Create the artifact + scope:owner = { + if = { + limit = { + exists = scope:adventurer + } + create_artifact = { + name = artifact_box_small_name + creator = scope:adventurer + description = placeholder + visuals = small_box + type = box + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else = { + create_artifact = { + name = artifact_box_small_name + creator = scope:carpenter + description = placeholder + visuals = small_box + type = box + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + } + scope:newly_created_artifact = { + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_box_small_description + + # Set grandeur + add_scaled_artifact_modifier_grandeur_small_effect = yes + add_scaled_artifact_modifier_piety_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_scaled_artifact_modifier_dynasty_prestige_effect = yes + } + remove_artifact_modifier = artifact_placeholder_modifier + } + } +} + +# Medium box +create_artifact_box_medium_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $CARPENTER$ = { save_scope_as = carpenter } + hidden_effect_new_object = { + # Get artifact quality, wealth, and materials + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + if = { #IF we have set the location we use it for the materials + limit = { exists = scope:location } + scope:location = { add_to_list = artifact_material_sources } + } + + # Create the artifact + scope:owner = { + if = { + limit = { + exists = scope:adventurer + } + create_artifact = { + name = artifact_box_medium_name + creator = scope:adventurer + description = placeholder + visuals = medium_box + type = box + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else = { + create_artifact = { + name = artifact_box_medium_name + creator = scope:carpenter + description = placeholder + visuals = medium_box + type = box + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + } + scope:newly_created_artifact = { + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_box_medium_description + + # Set grandeur + add_scaled_artifact_modifier_grandeur_small_effect = yes + add_scaled_artifact_modifier_piety_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_scaled_artifact_modifier_dynasty_prestige_effect = yes + } + remove_artifact_modifier = artifact_placeholder_modifier + } + } +} + + + +############### +# GOBLET + +create_artifact_goblet_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $SMITH$ = { save_scope_as = goldsmith } + + hidden_effect_new_object = { + # Get artifact quality, wealth, and materials + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + if = { #Any existing dummy character gets turned into the goldsmith + limit = { + exists = scope:dummy_gender + scope:goldsmith = scope:dummy_gender + } + clear_saved_scope = goldsmith + clear_saved_scope = dummy_gender + } + # Create the artifact + scope:owner = { + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = artifact_goblet_name + description = placeholder + visuals = goblet + type = goblet + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + #decaying = no + save_scope_as = newly_created_artifact + history = { + location = scope:location + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else_if = { + limit = { + scope:host ?= $OWNER$ + scope:activity ?= { has_activity_type = activity_tournament } + } + create_artifact = { + name = artifact_goblet_name + creator = scope:host + description = placeholder # Will be updated in the post-creation effects after decorations are assigned. + visuals = goblet + type = goblet + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + history = { + type = prize_created + recipient = scope:host + } + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { exists = scope:goldsmith } + create_artifact = { + name = artifact_goblet_name + creator = scope:goldsmith + description = placeholder + visuals = goblet + type = goblet + wealth = scope:wealth + quality = scope:quality + #decaying = no + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + } + } + else = { + create_artifact = { + name = artifact_goblet_name + description = placeholder + visuals = goblet + type = goblet + wealth = scope:wealth + quality = scope:quality + #decaying = no + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } + } + } + scope:newly_created_artifact = { + set_artifact_description = artifact_goblet_description + + # Set grandeur + add_scaled_artifact_modifier_grandeur_small_effect = yes + + # Let's add another random effect to keep goblets interesting! + random_list = { + 10 = { + add_scaled_artifact_modifier_minor_prestige_effect = yes + } + 10 = { + add_scaled_artifact_modifier_majesty_effect = yes + } + 30 = { + trigger = { rarity = common } + # Common goblets have a chance to not get any extra modifiers + } + } + remove_artifact_modifier = artifact_placeholder_modifier + } + } +} + +create_artifact_wall_banner_effect = { + $OWNER$ = { save_scope_as = owner } + $CREATOR$ = { save_scope_as = creator } + $TARGET$ = { save_scope_as = target } #Can be a title, a house or a dynasty + + #This effect can be used to generate banners - either from battle or a character. + #For battle banners the variables epic_battle_location and epic_loser must be set. + #To generate a dynasty banner the variable banner_from_dynasty must be set + #To generate a house banner the variable banner_from_house must be set + #To generate a banner for a title no special variables need to be set + + hidden_effect_new_object = { + if = { + limit = { has_variable = epic_battle_location } + var:epic_battle_location = { save_scope_as = epic_battle_location } + remove_variable = epic_battle_location + } + if = { + limit = { has_variable = epic_loser } + var:epic_loser = { save_scope_as = epic_loser } + remove_variable = epic_loser + } + # Dynasty banner rarity determined by Dynasty Splendor + if = { + limit = { + scope:owner = { has_variable = banner_from_dynasty } + } + if = { + limit = { scope:owner.dynasty.dynasty_prestige_level = max_dynasty_prestige_level } + set_artifact_rarity_illustrious = yes + } + else_if = { + limit = { scope:owner.dynasty.dynasty_prestige_level >= high_dynasty_prestige_level } + set_artifact_rarity_famed = yes + } + else_if = { + limit = { scope:owner.dynasty.dynasty_prestige_level >= medium_dynasty_prestige_level } + set_artifact_rarity_masterwork = yes + } + else = { set_artifact_rarity_common = yes } + } + # Other banners use default rarity script + else = { + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + } + + scope:owner = { + if = { #Dynasty Banner + limit = { has_variable = banner_from_dynasty } + if = { #Startup Banner + limit = { has_variable = startup_banner } + create_artifact = { + name = artifact_wall_banner_dynasty_name + description = artifact_wall_banner_dynasty_description + visuals = banner + visuals_source = scope:target + template = dynasty_banner_template + type = wall_big + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + history = { + type = created + recipient = scope:owner + location = scope:owner.capital_province + } + } + remove_variable = startup_banner + } + else = { #Created Banner + create_artifact = { + name = artifact_wall_banner_dynasty_name + creator = scope:creator + description = artifact_wall_banner_dynasty_description + visuals = banner + visuals_source = scope:target + template = dynasty_banner_template + type = wall_big + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + } + } + scope:newly_created_artifact = { + set_variable = { # Tracks house + name = banner_dynasty + value = scope:target + } + set_variable = { # Tracks first owner + name = banner_commissioner + value = scope:owner + } + grant_banner_house_claim_effect = yes + set_artifact_description = artifact_wall_banner_dynasty_description # For commissioner flavor + } + remove_variable = banner_from_dynasty + } + else_if = { #House Banner + limit = { has_variable = banner_from_house } + if = { #Startup Banner + limit = { has_variable = startup_banner } + create_artifact = { + name = artifact_wall_banner_house_name + description = artifact_wall_banner_house_description + visuals = banner + visuals_source = scope:target + template = house_banner_template + type = wall_big + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + history = { + type = created + recipient = scope:owner + location = scope:owner.capital_province + } + } + remove_variable = startup_banner + } + else = { #Created Banner + create_artifact = { + name = artifact_wall_banner_house_name + creator = scope:creator + description = artifact_wall_banner_house_description + visuals = banner + visuals_source = scope:target + template = house_banner_template + type = wall_big + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + } + } + scope:newly_created_artifact = { + set_variable = { # Tracks house + name = banner_house + value = scope:target + } + } + remove_variable = banner_from_house + } + else_if = { # For banners looted after a battle + limit = { + exists = scope:epic_battle_location + exists = scope:epic_loser + } + create_artifact = { + name = artifact_wall_banner_battle_name + creator = scope:creator + description = artifact_wall_banner_battle_description + visuals = banner + visuals_source = scope:target + type = wall_big + modifier = artifact_placeholder_modifier + quality = conquered_banner_value + wealth = conquered_banner_value + decaying = no + save_scope_as = newly_created_artifact + history = { + location = scope:epic_battle_location + actor = scope:epic_loser + recipient = scope:owner + type = conquest + } + } + } + else = { #Royal Banner + create_artifact = { + name = artifact_wall_banner_royal_name + creator = scope:creator + description = artifact_wall_banner_royal_description + visuals = banner + visuals_source = scope:target + type = wall_big + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + } + } + } + + # Modifiers are completely randomized - Possible modifiers are based on the battle + scope:newly_created_artifact = { + add_scaled_artifact_modifier_grandeur_small_effect = yes + if = { + limit = { + exists = scope:epic_loser + } + random_list = { + pick = 2 + unique = yes + 10 = { # Knight Limit + random_list = { + 10 = { + add_artifact_modifier = artifact_knight_limit_1_modifier + } + 5 = { + add_artifact_modifier = artifact_knight_limit_2_modifier + } + } + } + 10 = { # Knight Effectiveness + random_list = { + 15 = { + add_artifact_modifier = artifact_knight_effectiveness_1_modifier + } + 10 = { + add_artifact_modifier = artifact_knight_effectiveness_2_modifier + } + 5 = { + add_artifact_modifier = artifact_knight_effectiveness_3_modifier + } + } + } + 10 = { # Levy Reinforcement Rate + random_list = { + 15 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_1_modifier + } + 5 = { + add_artifact_modifier = artifact_levy_reinforcement_rate_2_modifier + } + } + } + 10 = { # Dread Gain + random_list = { + 15 = { + add_artifact_modifier = artifact_dread_gain_mult_1_modifier + } + 5 = { + add_artifact_modifier = artifact_dread_gain_mult_2_modifier + } + } + } + 10 = { # Dread Baseline + random_list = { + 20 = { + add_artifact_modifier = artifact_dread_baseline_add_1_modifier + } + 5 = { + add_artifact_modifier = artifact_dread_baseline_add_2_modifier + } + } + } + 10 = { # Prestige Bonus - You only get one, as we don't want these to stack too much + random_list = { + 10 = { # Monthly Prestige + random_list = { + 10 = { + add_artifact_modifier = artifact_monthly_prestige_1_modifier + } + 5 = { + add_artifact_modifier = artifact_monthly_prestige_2_modifier + } + } + } + 10 = { # Prestige per Knight + random_list = { + 10 = { + add_artifact_modifier = artifact_monthly_prestige_gain_per_knight_add_1_modifier + } + 5 = { + add_artifact_modifier = artifact_monthly_prestige_gain_per_knight_add_2_modifier + } + } + } + 10 = { # Prestige per Dread + random_list = { + 10 = { + add_artifact_modifier = artifact_monthly_prestige_gain_per_dread_add_1_modifier + } + 5 = { + add_artifact_modifier = artifact_monthly_prestige_gain_per_dread_add_2_modifier + } + } + } + } + } + 10 = { # Advantage vs other Faiths + trigger = { + exists = scope:epic_loser + exists = scope:owner + scope:epic_loser = { + faith != scope:owner.faith + } + } + random_list = { + 15 = { + add_artifact_modifier = artifact_tolerance_advantage_mod_2_modifier + } + 10 = { + add_artifact_modifier = artifact_tolerance_advantage_mod_3_modifier + } + 5 = { + add_artifact_modifier = artifact_tolerance_advantage_mod_4_modifier + } + } + } + 10 = { # Controlled Province Advantage + trigger = { + exists = scope:owner + exists = scope:epic_loser + exists = scope:epic_battle_location + scope:owner = { + any_character_war = { + is_defender = scope:owner + is_attacker = scope:epic_loser + } + any_realm_province = { + this = scope:epic_battle_location + } + } + } + random_list = { + 15 = { + add_artifact_modifier = artifact_controlled_province_advantage_1_modifier + } + 10 = { + add_artifact_modifier = artifact_controlled_province_advantage_2_modifier + } + 5 = { + add_artifact_modifier = artifact_controlled_province_advantage_3_modifier + } + } + } + # Chance to acquire an advantage bonus for the terrain the battle was fought in + 10 = { # Plains Advantage + trigger = { + exists = scope:epic_battle_location + scope:epic_battle_location = { + terrain = plains + } + } + random_list = { + 15 = { + add_artifact_modifier = artifact_plains_advantage_1_modifier + } + 10 = { + add_artifact_modifier = artifact_plains_advantage_2_modifier + } + 5 = { + add_artifact_modifier = artifact_plains_advantage_3_modifier + } + } + } + 10 = { # Farmlands Advantage + trigger = { + exists = scope:epic_battle_location + scope:epic_battle_location = { + terrain = farmlands + } + } + random_list = { + 15 = { + add_artifact_modifier = artifact_farmlands_advantage_1_modifier + } + 10 = { + add_artifact_modifier = artifact_farmlands_advantage_2_modifier + } + 5 = { + add_artifact_modifier = artifact_farmlands_advantage_3_modifier + } + } + } + 10 = { # Hills Advantage + trigger = { + exists = scope:epic_battle_location + scope:epic_battle_location = { + terrain = hills + } + } + random_list = { + 15 = { + add_artifact_modifier = artifact_hills_advantage_1_modifier + } + 10 = { + add_artifact_modifier = artifact_hills_advantage_2_modifier + } + 5 = { + add_artifact_modifier = artifact_hills_advantage_3_modifier + } + } + } + 10 = { # Mountains Advantage + trigger = { + exists = scope:epic_battle_location + scope:epic_battle_location = { + terrain = mountains + } + } + random_list = { + 15 = { + add_artifact_modifier = artifact_mountains_advantage_1_modifier + } + 10 = { + add_artifact_modifier = artifact_mountains_advantage_2_modifier + } + 5 = { + add_artifact_modifier = artifact_mountains_advantage_3_modifier + } + } + } + 10 = { # Desert Advantage + trigger = { + exists = scope:epic_battle_location + scope:epic_battle_location = { + terrain = desert + } + } + random_list = { + 15 = { + add_artifact_modifier = artifact_desert_advantage_1_modifier + } + 10 = { + add_artifact_modifier = artifact_desert_advantage_2_modifier + } + 5 = { + add_artifact_modifier = artifact_desert_advantage_3_modifier + } + } + } + 10 = { # Desert Mountains Advantage + trigger = { + exists = scope:epic_battle_location + scope:epic_battle_location = { + terrain = desert_mountains + } + } + random_list = { + 15 = { + add_artifact_modifier = artifact_desert_mountains_advantage_1_modifier + } + 10 = { + add_artifact_modifier = artifact_desert_mountains_advantage_2_modifier + } + 5 = { + add_artifact_modifier = artifact_desert_mountains_advantage_3_modifier + } + } + } + 10 = { # Oasis Advantage + trigger = { + exists = scope:epic_battle_location + scope:epic_battle_location = { + terrain = oasis + } + } + random_list = { + 15 = { + add_artifact_modifier = artifact_oasis_advantage_1_modifier + } + 10 = { + add_artifact_modifier = artifact_oasis_advantage_2_modifier + } + 5 = { + add_artifact_modifier = artifact_oasis_advantage_3_modifier + } + } + } + 10 = { # Jungle Advantage + trigger = { + exists = scope:epic_battle_location + scope:epic_battle_location = { + terrain = jungle + } + } + random_list = { + 15 = { + add_artifact_modifier = artifact_jungle_advantage_1_modifier + } + 10 = { + add_artifact_modifier = artifact_jungle_advantage_2_modifier + } + 5 = { + add_artifact_modifier = artifact_jungle_advantage_3_modifier + } + } + } + 10 = { # Forest Advantage + trigger = { + exists = scope:epic_battle_location + scope:epic_battle_location = { + terrain = forest + } + } + random_list = { + 15 = { + add_artifact_modifier = artifact_forest_advantage_1_modifier + } + 10 = { + add_artifact_modifier = artifact_forest_advantage_2_modifier + } + 5 = { + add_artifact_modifier = artifact_forest_advantage_3_modifier + } + } + } + 10 = { # Taiga Advantage + trigger = { + exists = scope:epic_battle_location + scope:epic_battle_location = { + terrain = taiga + } + } + random_list = { + 15 = { + add_artifact_modifier = artifact_taiga_advantage_1_modifier + } + 10 = { + add_artifact_modifier = artifact_taiga_advantage_2_modifier + } + 5 = { + add_artifact_modifier = artifact_taiga_advantage_3_modifier + } + } + } + 10 = { # Wetlands Advantage + trigger = { + exists = scope:epic_battle_location + scope:epic_battle_location = { + terrain = wetlands + } + } + random_list = { + 15 = { + add_artifact_modifier = artifact_wetlands_advantage_1_modifier + } + 10 = { + add_artifact_modifier = artifact_wetlands_advantage_2_modifier + } + 5 = { + add_artifact_modifier = artifact_wetlands_advantage_3_modifier + } + } + } + 10 = { # Steppe Advantage + trigger = { + exists = scope:epic_battle_location + scope:epic_battle_location = { + terrain = steppe + } + } + random_list = { + 15 = { + add_artifact_modifier = artifact_steppe_advantage_1_modifier + } + 10 = { + add_artifact_modifier = artifact_steppe_advantage_2_modifier + } + 5 = { + add_artifact_modifier = artifact_steppe_advantage_3_modifier + } + } + } + 10 = { # Floodplains Advantage + trigger = { + exists = scope:epic_battle_location + scope:epic_battle_location = { + terrain = floodplains + } + } + random_list = { + 15 = { + add_artifact_modifier = artifact_floodplains_advantage_1_modifier + } + 10 = { + add_artifact_modifier = artifact_floodplains_advantage_2_modifier + } + 5 = { + add_artifact_modifier = artifact_floodplains_advantage_3_modifier + } + } + } + 10 = { # Drylands Advantage + trigger = { + exists = scope:epic_battle_location + scope:epic_battle_location = { + terrain = drylands + } + } + random_list = { + 15 = { + add_artifact_modifier = artifact_drylands_advantage_1_modifier + } + 10 = { + add_artifact_modifier = artifact_drylands_advantage_2_modifier + } + 5 = { + add_artifact_modifier = artifact_drylands_advantage_3_modifier + } + } + } + # glory_hound_opinion + 10 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_glory_hound_vassal_opinion_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_glory_hound_vassal_opinion_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_glory_hound_vassal_opinion_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_glory_hound_vassal_opinion_4_modifier + } + } + # glory_hound_levy_mult + 10 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_glory_hound_levy_contribution_mult_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_glory_hound_levy_contribution_mult_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_glory_hound_levy_contribution_mult_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_glory_hound_levy_contribution_mult_4_modifier + } + } + # belligerent_opinion + 10 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_belligerent_vassal_opinion_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_belligerent_vassal_opinion_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_belligerent_vassal_opinion_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_belligerent_vassal_opinion_4_modifier + } + } + # belligerent_levy_mult + 10 = { + if = { + limit = { rarity = common } + add_artifact_modifier = artifact_belligerent_levy_contribution_mult_1_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_belligerent_levy_contribution_mult_2_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_belligerent_levy_contribution_mult_3_modifier + } + else_if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_belligerent_levy_contribution_mult_4_modifier + } + } + } + } + else = { + add_scaled_artifact_modifier_dynasty_prestige_effect = yes + add_scaled_artifact_modifier_prestige_effect = yes + add_scaled_artifact_modifier_rulership_effect = yes + } + remove_artifact_modifier = artifact_placeholder_modifier + } + } +} + +create_artifact_wall_shield_effect = { + $OWNER$ = { save_scope_as = owner } + $TARGET$ = { save_scope_as = target } + $CREATOR$ = { save_scope_as = smith } + + hidden_effect_new_object = { + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + if = { + limit = { + scope:smith = { artifact_use_mediterranean_building_visuals_trigger = yes } + } + scope:owner = { + create_artifact = { + name = artifact_wall_shield_name + creator = scope:smith + description = artifact_wall_shield_description + visuals = wall_shield_medi + visuals_source = scope:target + type = wall_shield_special + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + } + else = { + scope:owner = { + create_artifact = { + name = artifact_wall_shield_name + creator = scope:smith + description = artifact_wall_shield_description + visuals = wall_shield + visuals_source = scope:target + type = wall_shield + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + } + scope:newly_created_artifact = { + add_scaled_artifact_modifier_grandeur_small_effect = yes + add_scaled_artifact_modifier_dynasty_prestige_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_scaled_artifact_modifier_minor_prestige_effect = yes + } + remove_artifact_modifier = artifact_placeholder_modifier + } + } +} + + +create_artifact_sculpture_effect = { + $OWNER$ = { save_scope_as = owner } + $SCULPTER$ = { save_scope_as = sculpter } + hidden_effect_new_object = { + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + if = { + limit = { + scope:owner = { is_female = yes } + } + save_scope_value_as = { + name = owner_fm + value = flag:female + } + } + else = { + save_scope_value_as = { + name = owner_fm + value = flag:male + } + } + + if = { + limit = { + OR = { + scope:sculpter = { + OR = { + artifact_use_mena_building_visuals_trigger = yes + artifact_use_iranian_building_visuals_trigger = yes + artifact_use_steppe_building_visuals_trigger = yes + } + } + scope:owner = { + faith = { + OR = { + has_doctrine = tenet_aniconism + religion = religion:islam_religion + } + } + } + } + } + scope:owner = { + create_artifact = { + name = artifact_sculpture_name + creator = scope:sculpter + description = placeholder + visuals = statue_mena + type = sculpture + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + } + else = { + scope:owner = { + create_artifact = { + name = artifact_sculpture_name + creator = scope:sculpter + description = placeholder + visuals = statue + type = sculpture + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + } + scope:newly_created_artifact = { + if = { + limit = { + has_artifact_feature = sculpture_material_wood + } + set_artifact_feature_group = generic_material_wood + } + #Description + if = { + limit = { + OR = { + scope:sculpter = { + OR = { + artifact_use_mena_building_visuals_trigger = yes + artifact_use_iranian_building_visuals_trigger = yes + artifact_use_steppe_building_visuals_trigger = yes + } + } + scope:owner = { #An owner who follows an aniconic faith will never want a statue that portrays a human + faith = { + OR = { + has_doctrine = tenet_aniconism + religion = religion:islam_religion + } + } + } + } + } + set_artifact_description = artifact_sculpture_animal_description #backup description if anti icons + } + else = { + set_artifact_description = artifact_sculpture_description #default description of person + } + add_scaled_artifact_modifier_grandeur_small_effect = yes + add_scaled_artifact_modifier_prestige_effect = yes + add_scaled_artifact_modifier_majesty_effect = yes + remove_artifact_modifier = artifact_placeholder_modifier + } + } +} + +create_artifact_pedestal_rock_effect = { + $OWNER$ = { save_scope_as = owner } + + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + scope:owner = { + create_artifact = { + name = artifact_pedestal_rock_name + creator = scope:owner + description = artifact_pedestal_rock_description + visuals = rock + type = pedestal + modifier = artifact_monthly_piety_4_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + decaying = no + } + } + scope:newly_created_artifact = { + add_artifact_modifier = artifact_monthly_piety_gain_mult_2_modifier + add_artifact_modifier = artifact_stress_gain_1_modifier + } +} + +create_artifact_pedestal_pouch_effect = { + $OWNER$ = { save_scope_as = owner } + + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + scope:owner = { + create_artifact = { + name = artifact_pedestal_pouch_name + creator = scope:owner + description = artifact_pedestal_pouch_description + visuals = pouch + type = pedestal + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } +} + +create_artifact_pedestal_scroll_effect = { + $OWNER$ = { save_scope_as = owner } + $WRITER$ = { save_scope_as = writer } + + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + scope:owner = { + create_artifact = { + name = artifact_pedestal_scroll_name + creator = scope:writer + description = artifact_pedestal_scroll_description + visuals = scroll + type = pedestal + modifier = artifact_monthly_prestige_4_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + scope:newly_created_artifact = { + add_artifact_modifier = artifact_stewardship_per_stress_level_2_modifier + add_artifact_modifier = artifact_parochial_vassal_opinion_3_modifier + } +} + +create_artifact_pedestal_religious_head_letter_effect = { + $OWNER$ = { save_scope_as = owner } + + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + scope:owner = { + create_artifact = { + name = artifact_pedestal_religious_head_letter_name + creator = scope:owner + description = artifact_pedestal_religious_head_letter_description + visuals = scroll + type = pedestal + modifier = religious_head_letter_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + + scope:newly_created_artifact = { + add_scaled_artifact_modifier_grandeur_small_effect = yes + add_scaled_artifact_modifier_piety_effect = yes + } +} + +#The crucifix should be preferred by non-aniconic Christian faiths +create_artifact_pedestal_crucifix_effect = { + $OWNER$ = { save_scope_as = owner } + + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + scope:owner = { + create_artifact = { + name = artifact_pedestal_crucifix_name + creator = scope:owner + description = artifact_pedestal_crucifix_description + visuals = cross + type = pedestal + template = cross_template + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + + scope:newly_created_artifact = { + add_scaled_artifact_modifier_devotion_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_scaled_artifact_modifier_piety_effect = yes + } + remove_artifact_modifier = artifact_placeholder_modifier + } +} + +#The cross is for aniconic Christian faiths +create_artifact_pedestal_cross_effect = { + $OWNER$ = { save_scope_as = owner } + + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + scope:owner = { + create_artifact = { + name = artifact_pedestal_cross_name + description = artifact_pedestal_cross_description + visuals = cross + type = pedestal + template = cross_template + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + } + } + + scope:newly_created_artifact = { + add_scaled_artifact_modifier_devotion_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_scaled_artifact_modifier_piety_effect = yes + } + remove_artifact_modifier = artifact_placeholder_modifier + } +} + +create_artifact_pedestal_human_skull_effect = { + $OWNER$ = { save_scope_as = owner } + + $CREATOR$ = { save_scope_as = creator } + + $DESKULLED$ = { save_scope_as = killed } + + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + scope:owner = { + create_artifact = { + name = artifact_pedestal_human_skull_name + creator = scope:creator + description = artifact_pedestal_human_skull_description + visuals = human_skull + type = pedestal + modifier = artifact_dread_gain_mult_1_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + scope:newly_created_artifact = { + add_scaled_artifact_modifier_grandeur_small_effect = yes + add_scaled_artifact_modifier_minor_prestige_effect = yes + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_dread_baseline_add_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_dread_baseline_add_1_modifier + } + } +} + +create_artifact_pedestal_human_skull_specific_effect = { + $OWNER$ = { save_scope_as = owner } + + $DESKULLED$ = { save_scope_as = killed } + + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + scope:owner = { + create_artifact = { + name = artifact_pedestal_human_skull_name + creator = scope:owner + description = artifact_pedestal_human_skull_specific_description + visuals = human_skull + type = miscellaneous + modifier = artifact_dread_baseline_add_1_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + } + } +} + +create_artifact_pedestal_diamond_effect = { + $OWNER$ = { save_scope_as = owner } + + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + scope:owner = { + create_artifact = { + name = artifact_pedestal_massive_diamond_name + creator = scope:owner + description = artifact_pedestal_massive_diamond + visuals = diamond + type = pedestal + modifier = artifact_monthly_prestige_2_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + decaying = no + } + } + scope:newly_created_artifact = { + add_scaled_artifact_modifier_grandeur_big_effect = yes + add_scaled_artifact_modifier_prestige_effect = yes + } +} + +create_artifact_pedestal_gold_effect = { + $OWNER$ = { save_scope_as = owner } + + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + scope:owner = { + create_artifact = { + name = artifact_pedestal_gold_nugget_name + description = artifact_pedestal_gold_nugget + creator = scope:owner + visuals = pouch + type = pedestal + #icon = pile of gold + modifier = artifact_monthly_prestige_2_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + decaying = no + } + } + + scope:newly_created_artifact = { + add_scaled_artifact_modifier_grandeur_small_effect = yes + add_2_scaled_artifact_modifier_majesty_effect = yes + } +} + + +################## +# Books + +#Effect used to influence a book-artifact's content quality +change_artifact_book_content_quality_effect = { + if = { + limit = { + $AMOUNT$ > 0 + } + custom_tooltip = change_artifact_book_content_quality_effect_gain + } + else_if = { + limit = { + $AMOUNT$ < 0 + } + custom_tooltip = change_artifact_book_content_quality_effect_loss + } + hidden_effect = { + if = { + limit = { + NOT = { + exists = var:book_content_quality + } + } + set_variable = { + name = book_content_quality + value = $AMOUNT$ + } + } + else = { + change_variable = { + name = book_content_quality + add = $AMOUNT$ + } + } + } +} + +# Effect used when a character becomes inspired to write a book +set_book_subject_effect = { + save_temporary_scope_value_as = { + name = allow_no_subject_option + value = $NO_SUBJECT$ + } + hidden_effect = { #If they haven't specified what they're gonna write about we decide it here (might still leave it up to the sponsor if allow_no_subject_option = yes!) + $BASE_SCOPE$ = { + if = { + limit = { + NOT = { exists = var:book_subject } + } + random_list = { #What do they want to write about? + 1 = { + modifier = { + add = 60 + has_education_martial_trigger = yes + } + modifier = { + add = 40 + book_subject_martial_trigger = yes + } + modifier = { + add = { #If they're good you get +, if they're shit you get - + value = average_skill_rating + subtract = martial + multiply = -5 + } + } + set_variable = { + name = book_subject + value = flag:martial + } + } + 1 = { + modifier = { + add = 60 + has_education_diplomacy_trigger = yes + } + modifier = { + add = { #If they're good you get +, if they're shit you get - + value = average_skill_rating + subtract = diplomacy + multiply = -5 + } + } + set_variable = { + name = book_subject + value = flag:diplomacy + } + } + 1 = { + modifier = { + add = 60 + has_education_stewardship_trigger = yes + } + modifier = { + add = { #If they're good you get +, if they're shit you get - + value = average_skill_rating + subtract = stewardship + multiply = -5 + } + } + set_variable = { + name = book_subject + value = flag:stewardship + } + } + 1 = { + modifier = { + add = 60 + has_education_intrigue_trigger = yes + } + modifier = { + add = { #If they're good you get +, if they're shit you get - + value = average_skill_rating + subtract = intrigue + multiply = -5 + } + } + set_variable = { + name = book_subject + value = flag:intrigue + } + } + 1 = { + modifier = { + add = 60 + has_education_learning_trigger = yes + } + modifier = { + add = { #If they're good you get +, if they're shit you get - + value = average_skill_rating + subtract = learning + multiply = -5 + } + } + set_variable = { + name = book_subject + value = flag:learning + } + } + 1 = { + modifier = { + add = 50 + book_subject_medicine_trigger = yes + } + modifier = { + add = 20 + is_witch_trigger = yes + } + modifier = { + add = { + value = learning + multiply = 2 + } + } + ai_value_modifier = { + ai_rationality = 0.25 + } + set_variable = { + name = book_subject + value = flag:medicine + } + } + 1 = { + trigger = { + is_witch_trigger = yes + } + modifier = { + add = 20 + book_subject_witch_trigger = yes + } + ai_value_modifier = { + ai_boldness = 0.75 + } + set_variable = { + name = book_subject + value = flag:witch + } + set_variable = { + name = book_subject_witch_scope + value = this + } + } + 40 = { + trigger = { + has_trait = lifestyle_reveler + } + ai_value_modifier = { + ai_compassion = 0.25 + } + set_variable = { + name = book_subject + value = flag:reveler + } + } + 40 = { + trigger = { + has_trait = lifestyle_blademaster + } + modifier = { + add = { + value = martial + multiply = 2 + } + } + set_variable = { + name = book_subject + value = flag:blademaster + } + } + 40 = { + trigger = { + has_trait = lifestyle_hunter + } + set_variable = { + name = book_subject + value = flag:hunter + } + } + 40 = { + trigger = { + has_trait = lifestyle_mystic + } + modifier = { + add = { + value = learning + multiply = 2 + } + } + set_variable = { + name = book_subject + value = flag:mystic + } + } + 40 = { + trigger = { + has_trait = lifestyle_herbalist + } + modifier = { + add = { + value = learning + multiply = 2 + } + } + set_variable = { + name = book_subject + value = flag:herbalist + } + } + 40 = { + trigger = { + has_trait = legend + } + modifier = { + add = { + value = martial + multiply = 2 + } + } + set_variable = { + name = book_subject + value = flag:legend + } + } + 1 = { + trigger = { + is_cannibal_trigger = yes + } + modifier = { + add = 30 + book_subject_cannibal_trigger = yes + } + ai_value_modifier = { + ai_boldness = 0.75 + } + set_variable = { + name = book_subject + value = flag:cannibal + } + } + 1 = { + modifier = { + add = 50 + book_subject_torturer_trigger = yes + } + compare_modifier = { + value = intrigue + multiplier = 0.5 + } + set_variable = { + name = book_subject + value = flag:torturer + } + } + 1 = { + trigger = { + is_deviant_trigger = yes + } + modifier = { + add = 30 + OR = { + has_trait = arrogant + has_trait = deviant + } + } + ai_value_modifier = { + ai_boldness = 0.75 + } + set_variable = { + name = book_subject + value = flag:deviant + } + } + 50 = { + trigger = { + has_trait = lunatic + } + ai_value_modifier = { + ai_boldness = 0.75 + } + set_variable = { + name = book_subject + value = flag:lunatic + } + } + 400 = { + trigger = { #Why are you sponsoring a kid to write?? + is_adult = no + } + set_variable = { + name = book_subject + value = flag:childhood + } + set_favorite_toy_effect = yes + } + 50 = { + trigger = { + book_subject_animals_trigger = yes + } + modifier = { #If a kid has a pet they're gonna wanna to write about it + add = 800 + is_adult = no + } + modifier = { + add = 75 + has_trait = lunatic + } + modifier = { + add = 50 + has_trait = intellect_bad + } + set_variable = { + name = book_subject + value = flag:animals + } + } + 50 = { #They don't care and you can decide! + trigger = { + scope:allow_no_subject_option = yes + } + modifier = { + add = 30 + has_personality_submissive_trigger = yes + } + ai_value_modifier = { + ai_boldness = -0.25 + ai_energy = -0.25 + } + } + } + + # FALLBACK: The previous list can return nothing if you're bad at all skills and have nothing special going on + if = { + limit = { + NOT = { exists = var:book_subject } + scope:allow_no_subject_option = no + } + random_list = { + 1 = { + modifier = { + add = 60 + has_education_martial_trigger = yes + } + modifier = { + add = 40 + OR = { + prowess >= high_skill_rating + has_trait = faith_warrior + has_trait = crusader_king + has_trait = viking + number_of_commander_traits >= 1 + } + } + modifier = { + add = { + value = martial + multiply = 2 + } + } + set_variable = { + name = book_subject + value = flag:martial + } + } + 1 = { + modifier = { + add = 60 + has_education_diplomacy_trigger = yes + } + modifier = { + add = { + value = diplomacy + multiply = 2 + } + } + set_variable = { + name = book_subject + value = flag:diplomacy + } + } + 1 = { + modifier = { + add = 60 + has_education_stewardship_trigger = yes + } + modifier = { + add = { + value = stewardship + multiply = 2 + } + } + set_variable = { + name = book_subject + value = flag:stewardship + } + } + 1 = { + modifier = { + add = 60 + has_education_intrigue_trigger = yes + } + modifier = { + add = { + value = intrigue + multiply = 2 + } + } + set_variable = { + name = book_subject + value = flag:intrigue + } + } + 1 = { + modifier = { + add = 60 + has_education_learning_trigger = yes + } + modifier = { + add = { + value = learning + multiply = 2 + } + } + set_variable = { + name = book_subject + value = flag:learning + } + } + } + } + } + } + } +} + + +# Get variables needed for the book +get_book_variables_effect = { + + scope:owner = { + # If we have a subject we save it as a variable on the owner so that we can access it when setting the subject-feature + if = { + limit = { + NOT = { scope:subject_is_set = flag:no } + } + set_variable = { + name = book_artifact_subject + value = scope:subject_is_set + days = 1 + } + } + else_if = { + limit = { + exists = scope:author + exists = scope:author.var:book_subject + } + set_variable = { + name = book_artifact_subject + value = scope:author.var:book_subject + days = 1 + } + } + + #If we have a topic we save it as a variable on the owner so that we can access it when setting the topic-feature + if = { + limit = { + NOT = { scope:topic_is_set = flag:no } + } + set_variable = { + name = book_artifact_topic + value = scope:topic_is_set + days = 1 + } + } + else_if = { + limit = { + exists = scope:author + exists = scope:author.var:book_topic + } + set_variable = { + name = book_artifact_topic + value = scope:author.var:book_topic + days = 1 + } + } + # If subject or topic is "no" we do nothing and let the feature system handle it + + # To save the topic category if it has been set in events + if = { + limit = { + exists = scope:author + exists = scope:author.var:book_topic_category + } + set_variable = { + name = book_topic_category + value = scope:author.var:book_topic_category + days = 1 + } + } + + # Save toy for childhood book loc (if it's a kid writing it will be the author who is a kid) + if = { + limit = { + exists = var:book_artifact_subject + var:book_artifact_subject = flag:childhood + } + if = { + limit = { + NOT = { exists = scope:author.var:child_toy_variable } + } + scope:author = { set_favorite_toy_effect = yes } + } + } + if = { #Is the book about a mystical animal you hunted? Then we need to save the animal as a variable so we can use the custom loc key in the loc + limit = { + exists = var:book_artifact_subject + var:book_artifact_subject = flag:mystical_animal + } + set_variable = { + name = animal_type + value = scope:owner.var:hunted_mystical_animal + days = 1 + } + } + # Witch + if = { + limit = { + exists = var:book_artifact_subject + var:book_artifact_subject = flag:witch + exists = scope:author.var:book_subject_witch_scope + } + set_variable = { + name = book_subject_witch_scope + value = scope:author.var:book_subject_witch_scope + days = 1 + } + } + # Soulmate + if = { + limit = { + exists = var:book_artifact_topic + var:book_artifact_topic = flag:soulmate #Check for relationship variable + } + if = { + limit = { + exists = scope:author + exists = scope:author.var:book_topic_relationship + } + set_variable = { + name = book_topic_relationship + value = scope:author.var:book_topic_relationship + days = 1 + } + } + else_if = { + limit = { + exists = var:book_topic_relationship + } + var:book_topic_relationship = { + save_scope_as = soulmate # We still save the scope here for use in events + } + } + } + # Relationship + if = { + limit = { + exists = var:book_artifact_topic + var:book_artifact_topic = flag:nemesis #Check for relationship variable + } + if = { + limit = { + exists = scope:author + exists = scope:author.var:book_topic_relationship + } + set_variable = { + name = book_topic_relationship + value = scope:author.var:book_topic_relationship + days = 1 + } + scope:author.var:book_topic_relationship = { + save_scope_as = nemesis # We still save the scope here for use in events + } + } + else_if = { + limit = { + exists = var:book_topic_relationship + } + set_variable = { + name = book_topic_relationship + value = scope:owner.var:book_topic_relationship + days = 1 + } + var:book_topic_relationship = { + save_scope_as = nemesis # We still save the scope here for use in events + } + } + } + # Unification + if = { + limit = { + exists = var:book_artifact_topic + var:book_artifact_topic = flag:unification + } + #Check for title variable + if = { + limit = { + exists = scope:author + exists = scope:author.var:book_topic_united_title + } + set_variable = { + name = relevant_title + value = scope:author.var:book_topic_united_title + days = 1 + } + } + else_if = { + limit = { + exists = var:book_topic_united_title + } + set_variable = { + name = relevant_title + value = scope:owner.var:book_topic_united_title + days = 1 + } + var:book_topic_united_title = { + save_scope_as = relevant_title + } + } + } + # Creation + if = { + limit = { + exists = var:book_artifact_topic + var:book_artifact_topic = flag:creation + } + #Check for title variable + if = { + limit = { + exists = scope:author + exists = scope:author.var:book_topic_created_title + } + set_variable = { + name = relevant_title + value = scope:author.var:book_topic_created_title + days = 1 + } + scope:author.var:book_topic_created_title = { + save_scope_as = relevant_title + } + } + else_if = { + limit = { + exists = var:book_topic_created_title + } + set_variable = { + name = relevant_title + value = scope:owner.var:book_topic_created_title + days = 1 + } + var:book_topic_created_title = { + save_scope_as = relevant_title + } + } + } + # Restoration + if = { + limit = { + exists = var:book_artifact_topic + var:book_artifact_topic = flag:restoration + } + #Check for title variable + if = { + limit = { + exists = scope:author + exists = scope:author.var:book_topic_restored_title + } + set_variable = { + name = relevant_title + value = scope:author.var:book_topic_restored_title + days = 1 + } + scope:author.var:book_topic_restored_title = { + save_scope_as = relevant_title + } + } + else_if = { + limit = { + exists = var:book_topic_restored_title + } + set_variable = { + name = relevant_title + value = scope:owner.var:book_topic_restored_title + days = 1 + } + var:book_topic_restored_title = { + save_scope_as = relevant_title + } + } + } + } +} + +# Here we save the content quality of the book; how well does the author understand/know the subject? This is separate from the artifact quality value since that's about the quality of the artifact itself, not the content of the text +get_book_content_quality_effect = { + $SKILL_BASE$ = { save_scope_as = skill_base } + save_scope_value_as = { + name = book_content_quality + value = { + # Choices in events etc. will affect the quality of the artifact you get + if = { + limit = { + exists = scope:skill_base.var:book_content_quality + } + add = { + value = scope:skill_base.var:book_content_quality + multiply = 10 + } + } + # Is it a lifestyle subject? Then it's good if the inspiration owner shares the lifestyle + if = { # medicine + limit = { + has_artifact_feature = book_subject_medicine + } + if = { + limit = { + scope:skill_base = { + has_trait = lifestyle_physician + } + } + add = 30 + } + if = { + limit = { + scope:skill_base = { + has_trait = lifestyle_mystic + } + } + add = 20 + } + if = { + limit = { + scope:skill_base = { + has_trait = lifestyle_herbalist + } + } + add = 20 + } + if = { + limit = { + scope:skill_base = { + is_witch_trigger = yes + } + } + add = 10 + } + } + if = { # reveler + limit = { + has_artifact_feature = book_subject_reveler + scope:skill_base = { + has_trait = lifestyle_reveler + } + } + add = 30 + } + if = { # blademaster + limit = { + has_artifact_feature = book_subject_blademaster + scope:skill_base = { + has_trait = lifestyle_blademaster + } + } + add = 30 + } + if = { # hunter + limit = { + has_artifact_feature = book_subject_hunter + scope:skill_base = { + has_trait = lifestyle_hunter + } + } + add = 30 + } + if = { # mystic + limit = { + has_artifact_feature = book_subject_mystic + scope:skill_base = { + has_trait = lifestyle_mystic + } + } + add = 30 + } + if = { # herbalist + limit = { + has_artifact_feature = book_subject_herbalist + scope:skill_base = { + has_trait = lifestyle_herbalist + } + } + add = 30 + } + if = { # cannibal + limit = { + has_artifact_feature = book_subject_cannibal + scope:skill_base = { + is_cannibal_trigger = yes + } + } + add = 30 + } + if = { # witch + limit = { + has_artifact_feature = book_subject_witch + scope:skill_base = { + is_witch_trigger = yes + } + } + add = 30 + } + if = { # deviant + limit = { + has_artifact_feature = book_subject_deviant + scope:skill_base = { + is_deviant_trigger = yes + } + } + add = 30 + } + if = { # lunatic + limit = { + has_artifact_feature = book_subject_lunatic + scope:skill_base = { + has_trait = lunatic + } + } + add = 30 + } + if = { # relationship - score based on the authors opinion of the subject + limit = { + has_artifact_feature = book_subject_relationship + scope:skill_base = { + save_temporary_opinion_value_as = { + name = opinion_of_subject + target = scope:owner.var:book_topic_relationship + } + } + } + add = { + value = scope:opinion_of_subject + min = 0 + max = 75 + } + } + if = { # relationship - boost if you're socially savvy + limit = { + has_artifact_feature = book_subject_relationship + scope:skill_base = { has_trait = gregarious } + } + add = 10 + } + # If it's about your actions related to unification/creation/restoration of a title then it's just naturally easier to make you look good + if = { + limit = { + OR = { + has_artifact_feature = book_subject_kingdom + has_artifact_feature = book_subject_empire + } + } + add = 50 + } + # The owner and inspiration owner's skills in the relevant subject, and education trait, affects the outcome + if = { + limit = { + has_artifact_feature = book_subject_martial + } + add = { #If they're good you get +, if they're shit you get - + value = average_skill_rating + subtract = scope:skill_base.martial + multiply = -6 + } + add = scope:owner.martial + scope:skill_base = { + if = { + limit = { + has_trait = education_martial_1 + } + add = 20 + } + else_if = { + limit = { + has_trait = education_martial_2 + } + add = 40 + } + else_if = { + limit = { + has_trait = education_martial_3 + } + add = 60 + } + } + } + else_if = { + limit = { + has_artifact_feature = book_subject_diplomacy + } + add = { #If they're good you get +, if they're shit you get - + value = average_skill_rating + subtract = scope:skill_base.diplomacy + multiply = -6 + } + add = scope:owner.diplomacy + scope:skill_base = { + if = { + limit = { + has_trait = education_diplomacy_1 + } + add = 20 + } + else_if = { + limit = { + has_trait = education_diplomacy_2 + } + add = 40 + } + else_if = { + limit = { + has_trait = education_diplomacy_3 + } + add = 60 + } + } + } + else_if = { + limit = { + has_artifact_feature = book_subject_stewardship + } + add = { #If they're good you get +, if they're shit you get - + value = average_skill_rating + subtract = scope:skill_base.stewardship + multiply = -6 + } + add = scope:owner.stewardship + scope:skill_base = { + if = { + limit = { + has_trait = education_stewardship_1 + } + add = 20 + } + else_if = { + limit = { + has_trait = education_stewardship_2 + } + add = 40 + } + else_if = { + limit = { + has_trait = education_stewardship_3 + } + add = 60 + } + } + } + else_if = { + limit = { + OR = { + has_artifact_feature = book_subject_intrigue + has_artifact_feature = book_subject_torturer + } + } + add = { #If they're good you get +, if they're shit you get - + value = average_skill_rating + subtract = scope:skill_base.intrigue + multiply = -6 + } + add = scope:owner.intrigue + scope:skill_base = { + if = { + limit = { + has_trait = education_intrigue_1 + } + add = 20 + } + else_if = { + limit = { + has_trait = education_intrigue_2 + } + add = 40 + } + else_if = { + limit = { + has_trait = education_intrigue_3 + } + add = 60 + } + } + } + else_if = { + limit = { + has_artifact_feature = book_subject_learning + } + add = { #If they're good you get +, if they're shit you get - + value = average_skill_rating + subtract = scope:skill_base.learning + multiply = -6 + } + add = scope:owner.learning + scope:skill_base = { + if = { + limit = { + has_trait = education_learning_1 + } + add = 20 + } + else_if = { + limit = { + has_trait = education_learning_2 + } + add = 40 + } + else_if = { + limit = { + has_trait = education_learning_3 + } + add = 60 + } + } + } + # The overall quality has an impact as well + add = { + value = scope:quality + multiply = 0.25 + } + } + } +} + +# CREATE A BOOK + +# -OWNER is always needed +# -CREATOR needs a scope, if you want no author specified you can use "random_dummy_gender_effect = yes" before the book effect and then scope:dummy_gender for author +# -SET_SUBJECT has to be a flag, and has to be one of the subjects defined as a "book_subject" feature. If you want no subject specified (it will then be set in the effect itself) use "flag:no" +# -SET_TOPIC has to be a flag, and has to be one of the topics defined as a "book_topic" feature. If you want no topic specified (it will then be set in the effect itself) use "flag:no". You have to also set the subject if you set the topic! + +# Example: +#random_dummy_gender_effect = yes +#create_artifact_book_effect = { +# OWNER = root +# CREATOR = scope:dummy_gender +# SET_SUBJECT = flag:intrigue +# SET_TOPIC = flag:no +#} +# This will give you a book with no known author about intrigue with a random topic. + +create_artifact_book_effect = { + $OWNER$ = { save_scope_as = owner } #Will always exist! + $CREATOR$ = { #Doesn't always exist + save_scope_as = author + } + save_temporary_scope_value_as = { + name = subject_is_set + value = $SET_SUBJECT$ + } + save_temporary_scope_value_as = { + name = topic_is_set + value = $SET_TOPIC$ + } + if = { + limit = { + exists = scope:dummy_gender + scope:author = scope:dummy_gender + } + clear_saved_scope = author + clear_saved_scope = dummy_gender + } + else = { #If we have an author we save them as a variable on the owner so that we can access them later on when setting the subject etc. + scope:owner = { + set_variable = { + name = book_artifact_author + value = scope:author + days = 1 + } + } + } + hidden_effect_new_object = { + # Get artifact quality and wealth + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + + # To save the subject, topic, and other variables we'll need if it has been set in events or in the effect + get_book_variables_effect = yes + + if = { #Should this be a court artifact? + limit = { + has_royal_court = yes + has_dlc_feature = court_artifacts + NOT = { exists = scope:should_be_trinket } + } + if = { #Do we have an author? + limit = { + exists = scope:author + } + if = { #Is this author using Palm Leaf (indian) books? + limit = { + scope:author = { artifacts_use_indian_books_trigger = yes } + } + scope:owner = { + create_artifact = { + name = placeholder # Will be regenerated in the post-creation effects + creator = scope:author + description = placeholder # Will be regenerated in the post-creation effects + visuals = indian_book + type = book + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + } + else = { #Codices/Non-Indian books + scope:owner = { + create_artifact = { + name = placeholder # Will be regenerated in the post-creation effects + creator = scope:author + description = placeholder # Will be regenerated in the post-creation effects + visuals = book + type = book + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + } + } + else = { #We don't have an author + if = { + limit = { #Is this a palm leaf/indian book? + scope:owner = { artifacts_use_indian_books_trigger = yes } + } + scope:owner = { + create_artifact = { + name = placeholder # Will be regenerated in the post-creation effects + description = placeholder # Will be regenerated in the post-creation effects + visuals = indian_book + type = book + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + } + else = { #This is a codex/non-indian book: + scope:owner = { + create_artifact = { + name = placeholder # Will be regenerated in the post-creation effects + description = placeholder # Will be regenerated in the post-creation effects + visuals = book + type = book + history = { type = created_before_history } # We don't know who wrote it + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + } + } + } + else = { #This is a court artifact + if = { + limit = { + exists = scope:author #We have an author + } + if = { + limit = { + scope:author = { artifacts_use_indian_books_trigger = yes } + } + scope:owner = { + create_artifact = { + name = placeholder # Will be regenerated in the post-creation effects + creator = scope:author + description = placeholder # Will be regenerated in the post-creation effects + visuals = indian_book + type = journal + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + } + } + # Subject and cover material is set as a required feature for a book-type artifact, but for a miscellaneous-type it's an optional feature, so we need to set it here + scope:newly_created_artifact = { + set_artifact_feature_group = book_subject + set_artifact_feature_group = book_cover_material + } + } + else = { #This is a codex/non-indian book + scope:owner = { + create_artifact = { + name = placeholder # Will be regenerated in the post-creation effects + creator = scope:author + description = placeholder # Will be regenerated in the post-creation effects + visuals = book + type = journal + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + + } + } + # Subject and cover material is set as a required feature for a book-type artifact, but for a miscellaneous-type it's an optional feature, so we need to set it here + scope:newly_created_artifact = { + set_artifact_feature_group = book_subject + set_artifact_feature_group = book_cover_material + } + } + } + else = { #We don't have an author + if = { + limit = { #Is this a palm-leaf/indian book? + scope:owner = { artifacts_use_indian_books_trigger = yes } + } + scope:owner = { + create_artifact = { + name = placeholder # Will be regenerated in the post-creation effects + description = placeholder # Will be regenerated in the post-creation effects + visuals = indian_book + type = journal + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + } + } + # Subject and cover material is set as a required feature for a book-type artifact, but for a miscellaneous-type it's an optional feature, so we need to set it here + scope:newly_created_artifact = { + set_artifact_feature_group = book_subject + set_artifact_feature_group = book_cover_material + } + } + else = { #This isn't a palm leaf/indian book + scope:owner = { + create_artifact = { + name = placeholder # Will be regenerated in the post-creation effects + description = placeholder # Will be regenerated in the post-creation effects + visuals = book + type = journal + history = { type = created_before_history } # We don't know who wrote it + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + } + } + # Subject and cover material is set as a required feature for a book-type artifact, but for a miscellaneous-type it's an optional feature, so we need to set it here + scope:newly_created_artifact = { + set_artifact_feature_group = book_subject + set_artifact_feature_group = book_cover_material + } + } + } + } + + scope:newly_created_artifact = { + set_artifact_feature_group = book_topic + set_artifact_feature_group = book_title + set_artifact_feature_group = book_decoration + set_artifact_feature_group = decoration_pattern + get_artifact_feature_references_effect = yes + # Get quality of written content + if = { + limit = { + NOT = { exists = scope:author } + } + get_book_content_quality_effect = { SKILL_BASE = scope:owner } + } + else = { + get_book_content_quality_effect = { SKILL_BASE = scope:author } + } + # We save these values as variables on the owner so that we can access them deep in scopes in the desc-loc later on + scope:owner = { + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + set_variable = { + name = book_content_quality + value = scope:book_content_quality + } + } + # Generate the updated - final description for the book + set_artifact_description = artifact_book_description + # Generate the updated title - final title for the book + set_artifact_name = artifact_book_title + # Is the subject a lifestyle? + if = { + limit = { + has_artifact_feature = book_topic_stewardship_old_ledger + } + #add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_1_modifier + remove_artifact_modifier = artifact_placeholder_modifier + flag_as_trash_artifact = yes + } + else_if = { + limit = { has_artifact_feature = book_subject_martial } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_martial_lifestyle_xp_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_martial_lifestyle_xp_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_martial_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_martial_lifestyle_xp_1_modifier + } + } + else_if = { + limit = { has_artifact_feature = book_subject_diplomacy } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_1_modifier + } + } + else_if = { + limit = { has_artifact_feature = book_subject_stewardship } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_1_modifier + } + } + else_if = { + limit = { has_artifact_feature = book_subject_learning } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_1_modifier + } + } + else_if = { + limit = { + OR = { + has_artifact_feature = book_subject_intrigue + has_artifact_feature = book_subject_torturer + } + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_intrigue_lifestyle_xp_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_intrigue_lifestyle_xp_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_intrigue_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_intrigue_lifestyle_xp_1_modifier + } + } + else_if = { + limit = { has_artifact_feature = book_subject_empire } + add_scaled_artifact_modifier_dynasty_prestige_effect = yes + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_short_reign_duration_mult_7_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_short_reign_duration_mult_5_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_short_reign_duration_mult_3_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_short_reign_duration_mult_1_modifier + } + add_artifact_modifier = artifact_dynasty_opinion_2_modifier + add_artifact_modifier = artifact_court_grandeur_baseline_add_1_modifier + } + else_if = { + limit = { has_artifact_feature = book_subject_kingdom } + add_scaled_artifact_modifier_dynasty_prestige_effect = yes + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_short_reign_duration_mult_7_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_short_reign_duration_mult_5_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_short_reign_duration_mult_3_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_short_reign_duration_mult_1_modifier + } + add_artifact_modifier = artifact_dynasty_opinion_2_modifier + add_artifact_modifier = artifact_court_grandeur_baseline_add_1_modifier + } + else_if = { + limit = { + OR = { + has_artifact_feature = book_subject_medicine + has_artifact_feature = book_subject_herbalist + } + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_health_gain_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_health_gain_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_health_gain_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_health_gain_1_modifier + } + } + else_if = { + limit = { has_artifact_feature = book_subject_reveler } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_courtly_vassal_opinion_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_courtly_vassal_opinion_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_courtly_vassal_opinion_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_courtly_vassal_opinion_2_modifier + } + } + else_if = { + limit = { has_artifact_feature = book_subject_blademaster } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_prowess_5_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_prowess_4_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_prowess_3_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_prowess_2_modifier + } + } + else_if = { + limit = { has_artifact_feature = book_subject_hunter } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_prowess_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_prowess_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_prowess_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_prowess_1_modifier + } + add_artifact_modifier = artifact_stress_gain_1_modifier + } + else_if = { + limit = { has_artifact_feature = book_subject_mystic } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_1_modifier + } + if = { + limit = { + NOT = { scope:owner.faith = { has_doctrine_parameter = witchcraft_accepted } } + } + add_artifact_modifier = artifact_clergy_opinion_penalty_2_modifier + } + } + else_if = { + limit = { has_artifact_feature = book_subject_lunatic } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_stress_gain_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_stress_gain_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_stress_gain_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_stress_gain_1_modifier + } + } + else_if = { + limit = { has_artifact_feature = book_subject_relationship } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_10_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_7_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_5_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_personal_scheme_phase_duration_add_2_modifier + } + } + else_if = { + limit = { #Only for the controversial subjects if they're accepted + OR = { + AND = { + has_artifact_feature = book_subject_cannibal + NOT = { + trait_is_criminal_in_faith_trigger = { TRAIT = cannibal FAITH = scope:owner.faith GENDER_CHARACTER = scope:owner } + } + } + AND = { + has_artifact_feature = book_subject_witch + NOT = { + trait_is_criminal_in_faith_trigger = { TRAIT = witch FAITH = scope:owner.faith GENDER_CHARACTER = scope:owner } + } + } + AND = { + has_artifact_feature = book_subject_deviant + NOT = { + trait_is_criminal_in_faith_trigger = { TRAIT = deviant FAITH = scope:owner.faith GENDER_CHARACTER = scope:owner } + } + } + + } + } + add_scaled_artifact_modifier_prestige_effect = yes + } + if = { + limit = { + OR = { + has_artifact_feature = book_subject_family_epic + has_artifact_feature = book_subject_family_epic_great + } + } + remove_artifact_modifier = artifact_placeholder_modifier + add_artifact_modifier = artifact_monthly_prestige_add_2_modifier + if = { + limit = { + artifact_type = book + } + add_artifact_modifier = artifact_court_grandeur_baseline_add_1_modifier + } + else = { + add_artifact_modifier = artifact_monthly_prestige_2_modifier + } + if = { # Vassal Opinion + limit = { + scope:story = { has_variable = opinion_artifact } + } + if = { + limit = { rarity = illustrious } + add_artifact_modifier = artifact_parochial_vassal_opinion_3_modifier + add_artifact_modifier = artifact_courtly_vassal_opinion_4_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_parochial_vassal_opinion_3_modifier + add_artifact_modifier = artifact_courtly_vassal_opinion_3_modifier + add_artifact_modifier = artifact_parochial_vassal_opinion_3_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_courtly_vassal_opinion_3_modifier + add_artifact_modifier = artifact_parochial_vassal_opinion_3_modifier + } + else_if = { + limit = { rarity = common } + add_artifact_modifier = artifact_courtly_vassal_opinion_1_modifier + add_artifact_modifier = artifact_parochial_vassal_opinion_1_modifier + add_artifact_modifier = artifact_courtly_vassal_opinion_1_modifier + add_artifact_modifier = artifact_parochial_vassal_opinion_1_modifier + } + } + if = { # Scheme Resistance + limit = { + scope:story = { has_variable = scheme_artifact } + } + if = { # 8 + limit = { rarity = illustrious } + add_artifact_modifier = artifact_scheme_resistance_add_2_modifier + add_artifact_modifier = artifact_scheme_resistance_add_2_modifier + add_artifact_modifier = artifact_scheme_resistance_add_2_modifier + add_artifact_modifier = artifact_scheme_resistance_add_2_modifier + } + else_if = { # 6 + limit = { rarity = famed } + add_artifact_modifier = artifact_scheme_resistance_add_2_modifier + add_artifact_modifier = artifact_scheme_resistance_add_2_modifier + add_artifact_modifier = artifact_scheme_resistance_add_2_modifier + } + else_if = { # 4 + limit = { rarity = masterwork } + add_artifact_modifier = artifact_scheme_resistance_add_2_modifier + add_artifact_modifier = artifact_scheme_resistance_add_2_modifier + } + else_if = { # 2 + limit = { rarity = common } + add_artifact_modifier = artifact_scheme_resistance_add_2_modifier + } + } + if = { # Controlled Province Advantage + limit = { + scope:story = { has_variable = advantage_artifact } + } + if = { # 10 + limit = { rarity = illustrious } + add_artifact_modifier = artifact_controlled_province_advantage_8_modifier + add_artifact_modifier = artifact_controlled_province_advantage_2_modifier + } + else_if = { # 8 + limit = { rarity = famed } + add_artifact_modifier = artifact_controlled_province_advantage_8_modifier + } + else_if = { # 6 + limit = { rarity = masterwork } + add_artifact_modifier = artifact_controlled_province_advantage_6_modifier + } + else_if = { # 4 + limit = { rarity = common } + add_artifact_modifier = artifact_controlled_province_advantage_4_modifier + } + } + if = { # Personal Scheme Success Chance + limit = { + scope:story = { has_variable = sway_artifact } + } + if = { # 10 + limit = { rarity = illustrious } + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_12_modifier # 20 + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_8_modifier + } + else_if = { + limit = { rarity = famed } + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_8_modifier # 16 + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_8_modifier + } + else_if = { + limit = { rarity = masterwork } + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_12_modifier # 12 + } + else_if = { + limit = { rarity = common } + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_8_modifier # 8 + } + } + if = { # Monthly Piety + Same Faith Domain Tax + limit = { + scope:story = { has_variable = piety_artifact } + } + if = { # 0.4 + 1 + limit = { rarity = illustrious } + add_artifact_modifier = artifact_monthly_piety_4_modifier # 0.4 + add_artifact_modifier = artifact_domain_tax_same_faith_mult_4_modifier # 1 + add_artifact_modifier = artifact_domain_tax_same_faith_mult_4_modifier + add_artifact_modifier = artifact_domain_tax_same_faith_mult_2_modifier + } + else_if = { # 0.3 + 0.8 + limit = { rarity = famed } + add_artifact_modifier = artifact_monthly_piety_3_modifier + add_artifact_modifier = artifact_domain_tax_same_faith_mult_4_modifier + add_artifact_modifier = artifact_domain_tax_same_faith_mult_4_modifier + } + else_if = { # 0.2 + 0.6 + limit = { rarity = masterwork } + add_artifact_modifier = artifact_monthly_piety_2_modifier + add_artifact_modifier = artifact_domain_tax_same_faith_mult_4_modifier + add_artifact_modifier = artifact_domain_tax_same_faith_mult_2_modifier + } + else_if = { # 0.1 + 0.4 + limit = { rarity = common } + add_artifact_modifier = artifact_monthly_piety_1_modifier + add_artifact_modifier = artifact_domain_tax_same_faith_mult_4_modifier + } + } + if = { + limit = { has_artifact_feature = book_subject_family_epic_great } + add_artifact_modifier = artifact_monthly_prestige_add_2_modifier #This is renown, can be combined with the renown option during making and adds up with the base renown added to all chronicles + } + #Small boost from perspectives: + + } + # Modifiers applied based on topic + if = { + limit = { + has_artifact_feature = book_topic_stewardship_old_ledger + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_1_modifier + remove_artifact_modifier = artifact_placeholder_modifier + } + if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + OR = { + scope:topic = flag:curse_sorcery + scope:topic = flag:poisons + } + } + trigger_else = { + OR = { + has_artifact_feature = book_topic_witch_curse_sorcery + has_artifact_feature = book_topic_intrigue_poisons + } + } + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_intrigue_lifestyle_xp_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_intrigue_lifestyle_xp_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_intrigue_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_intrigue_lifestyle_xp_1_modifier + } + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_2_modifier + add_artifact_modifier = artifact_dread_gain_mult_1_modifier + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + OR = { + scope:topic = flag:love_sorcery + scope:topic = flag:seduction + } + } + trigger_else = { + OR = { + has_artifact_feature = book_topic_witch_love_sorcery + has_artifact_feature = book_topic_intrigue_seduction + } + } + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_intrigue_lifestyle_xp_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_intrigue_lifestyle_xp_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_intrigue_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_intrigue_lifestyle_xp_1_modifier + } + add_artifact_modifier = artifact_scheme_resistance_add_2_modifier + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:fertility + } + trigger_else = { + OR = { + has_artifact_feature = book_topic_intrigue_fertility + has_artifact_feature = book_topic_intrigue_the_art_of_love + } + } + } + + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_fertility_gain_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_fertility_gain_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_fertility_gain_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_fertility_gain_1_modifier + } + + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_intrigue_lifestyle_xp_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_intrigue_lifestyle_xp_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_intrigue_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_intrigue_lifestyle_xp_1_modifier + } + } + + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:punishment + } + trigger_else = { + OR = { + has_artifact_feature = book_topic_intrigue_punishment + has_artifact_feature = book_topic_intrigue_punishment_not_torturer + } + } + } + add_artifact_modifier = artifact_monthly_intrigue_lifestyle_xp_2_modifier + add_artifact_modifier = artifact_stress_gain_2_modifier + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_dread_baseline_add_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_dread_baseline_add_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_dread_baseline_add_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_dread_baseline_add_1_modifier + } + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + OR = { + scope:topic = flag:digest + scope:topic = flag:admin + } + } + trigger_else = { + OR = { + has_artifact_feature = book_topic_stewardship_digest + has_artifact_feature = book_topic_stewardship_admin + } + } + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_1_modifier + } + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:architect + } + trigger_else = { + has_artifact_feature = book_topic_stewardship_architect + } + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_build_time_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_build_time_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_build_time_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_build_time_1_modifier + } + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + OR = { + scope:topic = flag:edda + scope:topic = flag:orkneyinga + } + } + trigger_else = { + OR = { + has_artifact_feature = book_topic_diplomacy_edda + has_artifact_feature = book_topic_diplomacy_orkneyinga + } + } + } + add_artifact_modifier = artifact_monthly_martial_lifestyle_xp_1_modifier + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_raid_speed_8_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_raid_speed_6_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_raid_speed_4_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_raid_speed_2_modifier + } + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:poetry + } + trigger_else = { + has_artifact_feature = book_topic_diplomacy_poetry + } + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_1_modifier + } + + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_8_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_6_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_4_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_2_modifier + } + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:jokes + } + trigger_else = { + has_artifact_feature = book_topic_diplomacy_jokes + } + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_1_modifier + } + + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_courtier_and_guest_opinion_7_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_courtier_and_guest_opinion_5_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_courtier_and_guest_opinion_3_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_courtier_and_guest_opinion_1_modifier + } + add_artifact_modifier = artifact_monthly_tyranny_2_modifier + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + OR = { + scope:topic = flag:kalila + scope:topic = flag:hitopadesa + scope:topic = flag:speculum + } + } + trigger_else = { + OR = { + has_artifact_feature = book_topic_diplomacy_kalila + has_artifact_feature = book_topic_diplomacy_hitopadesa + has_artifact_feature = book_topic_stewardship_speculum + } + } + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_1_modifier + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_1_modifier + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:cicero + } + trigger_else = { + has_artifact_feature = book_topic_diplomacy_cicero + } + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_1_modifier + } + add_artifact_modifier = artifact_diplomacy_1_modifier + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:dynasty + } + trigger_else = { + OR = { + has_artifact_feature = book_topic_diplomacy_dynasty + has_artifact_feature = book_topic_diplomacy_dynasty_big + } + } + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_1_modifier + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_dynasty_opinion_7_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_dynasty_opinion_5_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_dynasty_opinion_3_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_dynasty_opinion_1_modifier + } + + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_prestige_add_8_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_prestige_add_6_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_prestige_add_4_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_prestige_add_2_modifier + } + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:duels + } + trigger_else = { + has_artifact_feature = book_topic_martial_duels + } + } + add_artifact_modifier = artifact_monthly_martial_lifestyle_xp_1_modifier + + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_prowess_8_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_prowess_6_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_prowess_4_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_prowess_2_modifier + } + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:chivalry + } + trigger_else = { + has_artifact_feature = book_topic_martial_chivalry + } + } + add_artifact_modifier = artifact_monthly_martial_lifestyle_xp_1_modifier + + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_attraction_opinion_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_attraction_opinion_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_attraction_opinion_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_attraction_opinion_1_modifier + } + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:military + } + trigger_else = { + has_artifact_feature = book_topic_martial_military + } + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_controlled_province_advantage_7_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_controlled_province_advantage_5_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_controlled_province_advantage_3_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_controlled_province_advantage_1_modifier + } + + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_martial_lifestyle_xp_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_martial_lifestyle_xp_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_martial_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_martial_lifestyle_xp_1_modifier + } + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + OR = { + scope:topic = flag:science + scope:topic = flag:aristotle + } + } + trigger_else = { + OR = { + has_artifact_feature = book_topic_medicine_science + has_artifact_feature = book_topic_medicine_science_big + has_artifact_feature = book_topic_learning_aristotle + has_artifact_feature = book_topic_learning_metaphysical_conundrums + has_artifact_feature = book_topic_learning_tome_collections + } + } + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_1_modifier + } + add_artifact_modifier = artifact_learning_1_modifier + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:artifact_book_topic_anatomy + } + trigger_else = { + OR = { + has_artifact_feature = book_topic_learning_anatomy + has_artifact_feature = book_topic_medicine_medicine + has_artifact_feature = book_topic_medicine_herbs + has_artifact_feature = book_topic_medicine_galen + } + } + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_health_gain_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_health_gain_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_health_gain_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_health_gain_1_modifier + } + add_artifact_modifier = artifact_learning_1_modifier + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + OR = { + scope:topic = flag:religious + scope:topic = flag:prayers + scope:topic = flag:golden_legend + scope:topic = flag:hours + } + } + trigger_else = { + OR = { + has_artifact_feature = book_topic_learning_religious + has_artifact_feature = book_topic_learning_religious_big + has_artifact_feature = book_topic_learning_prayers + has_artifact_feature = book_topic_learning_hours + has_artifact_feature = book_topic_learning_golden_legend + has_artifact_feature = book_topic_learning_theological_treaties + } + } + } + add_scaled_artifact_modifier_devotion_effect = yes + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_piety_gain_mult_8_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_piety_gain_mult_6_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_piety_gain_mult_4_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_piety_gain_mult_2_modifier + } + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + OR = { + scope:topic = flag:iliad + scope:topic = flag:mahabharata + scope:topic = flag:mufaddaliyat + } + } + trigger_else = { + OR = { + has_artifact_feature = book_topic_learning_iliad + has_artifact_feature = book_topic_learning_mahabharata + has_artifact_feature = book_topic_learning_mufaddaliyat + } + } + } + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_1_modifier + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_tyranny_7_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_tyranny_5_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_tyranny_3_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_tyranny_1_modifier + } + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:soulmate + } + trigger_else = { + has_artifact_feature = book_topic_soulmate + } + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_attraction_opinion_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_attraction_opinion_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_attraction_opinion_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_attraction_opinion_1_modifier + } + add_artifact_modifier = artifact_stress_gain_1_modifier + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:nemesis + } + trigger_else = { + has_artifact_feature = book_topic_nemesis + } + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_dread_gain_mult_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_dread_gain_mult_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_dread_gain_mult_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_dread_gain_mult_1_modifier + } + add_artifact_modifier = artifact_stress_gain_1_modifier + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + OR = { + scope:topic = flag:animals_your_cat + scope:topic = flag:animals_your_dog + } + } + trigger_else = { + OR = { + has_artifact_feature = book_topic_animals_your_cat + has_artifact_feature = book_topic_animals_your_cat_no_name + has_artifact_feature = book_topic_animals_your_dog + has_artifact_feature = book_topic_animals_your_dog_no_name + has_artifact_feature = book_topic_animals_animals + } + } + } + add_scaled_artifact_modifier_prestige_effect = yes + add_artifact_modifier = artifact_stress_gain_1_modifier + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:childhood + } + trigger_else = { + OR = { + has_artifact_feature = book_topic_childhood_one + has_artifact_feature = book_topic_childhood_two + } + } + } + add_artifact_modifier = artifact_stress_gain_1_modifier + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_courtier_and_guest_opinion_6_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_courtier_and_guest_opinion_5_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_courtier_and_guest_opinion_3_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_courtier_and_guest_opinion_1_modifier + } + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:mercury + } + trigger_else = { + has_artifact_feature = book_topic_alchemy_mercury + } + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_clergy_opinion_7_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_clergy_opinion_5_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_clergy_opinion_3_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_clergy_opinion_1_modifier + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_1_modifier + } + add_artifact_modifier = artifact_monthly_prestige_2_modifier + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:arsenic + } + trigger_else = { + has_artifact_feature = book_topic_alchemy_arsenic + } + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_7_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_5_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_3_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_1_modifier + } + + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_dread_gain_mult_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_dread_gain_mult_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_dread_gain_mult_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_dread_gain_mult_1_modifier + } + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_1_modifier + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:gold + } + trigger_else = { + has_artifact_feature = book_topic_alchemy_gold + } + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_income_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_income_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_income_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_income_1_modifier + } + + add_scaled_artifact_modifier_prestige_effect = yes + + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_1_modifier + } + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:silver + } + trigger_else = { + has_artifact_feature = book_topic_alchemy_silver + } + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_income_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_income_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_income_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_income_1_modifier + } + + add_scaled_artifact_modifier_prestige_effect = yes + + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_1_modifier + } + } + else_if = { + limit = { + has_artifact_feature = book_subject_alchemy + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_1_modifier + } + add_scaled_artifact_modifier_prestige_effect = yes + add_artifact_modifier = artifact_learning_1_modifier + } + else_if = { + limit = { + has_artifact_feature = book_subject_language_manual + } + add_artifact_modifier = artifact_learn_language_scheme_phase_duration_add_1_modifier + remove_artifact_modifier = artifact_placeholder_modifier + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:martial_military_strategies + } + trigger_else = { + has_artifact_feature = book_topic_martial_military_strategies + } + } + + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_hard_casualty_modifier_3_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_hard_casualty_modifier_2_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_hard_casualty_modifier_1_modifier + } + + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_martial_lifestyle_xp_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_martial_lifestyle_xp_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_martial_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_martial_lifestyle_xp_1_modifier + } + + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:martial_troop_compositions + } + trigger_else = { + has_artifact_feature = book_topic_martial_troop_compositions + } + } + + if = { + limit = { + rarity = illustrious + } + random_list = { + 50 = { add_artifact_modifier = artifact_heavy_cavalry_toughness_3_modifier } + 50 = { add_artifact_modifier = artifact_heavy_infantry_toughness_3_modifier } + } + } + else_if = { + limit = { + rarity = famed + } + random_list = { + 50 = { add_artifact_modifier = artifact_heavy_cavalry_toughness_2_modifier } + 50 = { add_artifact_modifier = artifact_heavy_infantry_toughness_2_modifier } + } + } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 50 = { add_artifact_modifier = artifact_heavy_cavalry_toughness_1_modifier } + 50 = { add_artifact_modifier = artifact_heavy_infantry_toughness_1_modifier } + } + } + + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_martial_lifestyle_xp_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_martial_lifestyle_xp_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_martial_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_martial_lifestyle_xp_1_modifier + } + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:diplomacy_court_alliances + } + trigger_else = { + has_artifact_feature = book_topic_diplomacy_court_alliances + } + } + + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_1_modifier + } + + add_artifact_modifier = artifact_diplomacy_1_modifier + + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:diplomacy_court_politics + } + trigger_else = { + has_artifact_feature = book_topic_diplomacy_court_politics + } + } + + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_diplomacy_lifestyle_xp_1_modifier + } + + + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_courtier_and_guest_opinion_3_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_courtier_and_guest_opinion_2_modifier + } + else_if = { + limit = { + OR = { + rarity = common + rarity = masterwork + } + } + add_artifact_modifier = artifact_courtier_and_guest_opinion_1_modifier + } + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:stewardship_trade_routes + } + trigger_else = { + has_artifact_feature = book_topic_stewardship_trade_routes + } + } + + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_development_growth_3_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_development_growth_2_modifier + } + else_if = { + limit = { + OR = { + rarity = common + rarity = masterwork + } + } + add_artifact_modifier = artifact_development_growth_1_modifier + } + + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_1_modifier + } + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:stewardship_best_practices_tax_collectors + } + trigger_else = { + has_artifact_feature = book_topic_stewardship_best_practices_tax_collectors + } + } + + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_domain_tax_mult_3_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_domain_tax_mult_2_modifier + } + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:diplomacy_art_of_feasting + } + trigger_else = { + has_artifact_feature = book_topic_diplomacy_art_of_feasting + } + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_courtier_and_guest_opinion_7_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_courtier_and_guest_opinion_5_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_courtier_and_guest_opinion_3_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_courtier_and_guest_opinion_1_modifier + } + } + else_if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:stewardship_lawmaking + } + trigger_else = { + has_artifact_feature = book_topic_stewardship_lawmaking + } + } + + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_vassal_limit_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_vassal_limit_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_vassal_limit_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_vassal_limit_1_modifier + } + } + + + # Is the subject something weird? Then you'll get a penalty + if = { + limit = { + has_artifact_feature = book_subject_cannibal + } + if = { #We give a bigger boost here if it's illegal since they get nothing else + limit = { + trait_is_criminal_in_faith_trigger = { TRAIT = cannibal FAITH = root.faith GENDER_CHARACTER = root } + } + add_artifact_modifier = artifact_dread_baseline_add_2_modifier + add_artifact_modifier = artifact_vassal_opinion_penalty_1_modifier + } + else = { + add_artifact_modifier = artifact_dread_baseline_add_1_modifier + } + if = { + limit = { + trigger_if = { + limit = { + exists = scope:topic + } + scope:topic = flag:cannibal_recipes + } + trigger_else = { + has_artifact_feature = book_topic_cannibal_recipes + } + } + add_artifact_modifier = artifact_health_gain_1_modifier + } + else = { + add_artifact_modifier = artifact_stress_gain_1_modifier + } + } + if = { + limit = { + has_artifact_feature = book_subject_witch + } + if = { #We give a bigger boost here if it's illegal since they get nothing else + limit = { + trait_is_criminal_in_faith_trigger = { TRAIT = witch FAITH = root.faith GENDER_CHARACTER = root } + } + add_artifact_modifier = artifact_dread_gain_mult_2_modifier + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_2_modifier + add_artifact_modifier = artifact_clergy_opinion_penalty_2_modifier + } + else = { + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_1_modifier + } + } + if = { + limit = { + has_artifact_feature = book_subject_deviant + } + if = { #We give a bigger boost here if it's illegal since they get nothing else + limit = { + trait_is_criminal_in_faith_trigger = { TRAIT = deviant FAITH = root.faith GENDER_CHARACTER = root } + } + add_artifact_modifier = artifact_vassal_opinion_penalty_1_modifier + add_artifact_modifier = artifact_stress_gain_2_modifier + add_artifact_modifier = artifact_seduce_scheme_phase_duration_mult_1_modifier + } + else = { + add_artifact_modifier = artifact_stress_gain_1_modifier + add_artifact_modifier = artifact_seduce_scheme_phase_duration_mult_1_modifier + } + } + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + set_variable = { + name = book_content_quality + value = scope:book_content_quality + } + } + } + + #To clean out variables + if = { + limit = { + exists = scope:author + } + scope:author = { + if = { + limit = { + has_variable = book_subject + } + remove_variable = book_subject + } + if = { + limit = { + has_variable = book_topic + } + remove_variable = book_topic + } + if = { + limit = { + has_variable = book_topic_category + } + remove_variable = book_topic_category + } + if = { + limit = { + has_variable = book_content_quality + } + remove_variable = book_content_quality + } + } + } + scope:owner = { + if = { + limit = { has_variable = book_artifact_subject } + remove_variable = book_artifact_subject + } + if = { + limit = { has_variable = book_artifact_topic } + remove_variable = book_artifact_topic + } + if = { + limit = { has_variable = book_topic_category } + remove_variable = book_topic_category + } + if = { + limit = { + has_variable = book_topic_category + } + remove_variable = book_topic_category + } + if = { + limit = { + has_variable = book_content_quality + } + remove_variable = book_content_quality + } + } + + if = { + limit = { + exists = scope:should_be_trinket + } + clear_saved_scope = should_be_trinket + } +} + +create_artifact_pedestal_reliquary_christian_effect = { + $OWNER$ = { save_scope_as = owner } + + random_list = { + 20 = { + save_scope_value_as = { + name = christian_relic_name + value = flag:nail + } + } + 15 = { + save_scope_value_as = { + name = christian_relic_name + value = flag:thorn + } + } + 5 = { + save_scope_value_as = { + name = christian_relic_name + value = flag:sandals + } + } + 5 = { + save_scope_value_as = { + name = christian_relic_name + value = flag:girdle + } + } + 10 = { + save_scope_value_as = { + name = christian_relic_name + value = flag:skull + } + } + 10 = { + save_scope_value_as = { + name = christian_relic_name + value = flag:arm + } + } + 5 = { + save_scope_value_as = { + name = christian_relic_name + value = flag:loincloth + } + } + 20 = { + save_scope_value_as = { + name = christian_relic_name + value = flag:cross + } + } + 5 = { + save_scope_value_as = { + name = christian_relic_name + value = flag:crown + } + } + 5 = { + save_scope_value_as = { + name = christian_relic_name + value = flag:veronica + } + } + } + + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + scope:owner = { + create_artifact = { + name = artifact_pedestal_reliquary_christian_name + creator = scope:owner + description = artifact_pedestal_reliquary_christian_description + visuals = reliquary + type = pedestal + template = christian_relic_template + modifier = artifact_monthly_piety_3_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + + scope:newly_created_artifact = { + add_scaled_artifact_modifier_piety_effect = yes + add_scaled_artifact_modifier_devotion_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + set_variable = { + name = relic + value = flag:christian + } + } +} + +create_artifact_pedestal_reliquary_islam_effect = { + $OWNER$ = { save_scope_as = owner } + + random_list = { + 20 = { + save_scope_value_as = { + name = islam_relic_name + value = flag:hair + } + } + 5 = { + save_scope_value_as = { + name = islam_relic_name + value = flag:cloak + } + } + 10 = { + save_scope_value_as = { + name = islam_relic_name + value = flag:hand + } + } + 5 = { + save_scope_value_as = { + name = islam_relic_name + value = flag:keys + } + } + 15 = { + save_scope_value_as = { + name = islam_relic_name + value = flag:tooth + } + } + 10 = { + save_scope_value_as = { + name = islam_relic_name + value = flag:seal + } + } + 5 = { + save_scope_value_as = { + name = islam_relic_name + value = flag:banner + } + } + } + + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + scope:owner = { + create_artifact = { + name = artifact_pedestal_reliquary_islam_name + creator = scope:owner + description = artifact_pedestal_reliquary_islam_description + visuals = reliquary + type = pedestal + template = islam_relic_template + modifier = artifact_monthly_piety_3_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + + scope:newly_created_artifact = { + add_scaled_artifact_modifier_piety_effect = yes + add_scaled_artifact_modifier_devotion_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + set_variable = { + name = relic + value = flag:islamic + } + } +} + +create_artifact_pedestal_reliquary_buddhism_effect = { + $OWNER$ = { save_scope_as = owner } + + random_list = { + 15 = { + save_scope_value_as = { + name = buddhism_relic_name + value = flag:tooth + } + } + 15 = { + save_scope_value_as = { + name = buddhism_relic_name + value = flag:bone + } + } + 10 = { + save_scope_value_as = { + name = buddhism_relic_name + value = flag:robe + } + } + 5 = { + save_scope_value_as = { + name = buddhism_relic_name + value = flag:bowl + } + } + 5 = { + save_scope_value_as = { + name = buddhism_relic_name + value = flag:tongue + } + } + 10 = { + save_scope_value_as = { + name = buddhism_relic_name + value = flag:hair + } + } + 25 = { + save_scope_value_as = { + name = buddhism_relic_name + value = flag:sarira + } + } + 15 = { + save_scope_value_as = { + name = buddhism_relic_name + value = flag:bo + } + } + } + + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + scope:owner = { + create_artifact = { + name = artifact_pedestal_reliquary_buddhism_name + creator = scope:owner + description = artifact_pedestal_reliquary_buddhism_description + visuals = reliquary + type = pedestal + template = buddhism_relic_template + modifier = artifact_monthly_piety_3_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + + scope:newly_created_artifact = { + add_scaled_artifact_modifier_piety_effect = yes + add_scaled_artifact_modifier_devotion_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + set_variable = { + name = relic + value = flag:buddhism + } + } +} + +create_artifact_pedestal_reliquary_judaism_effect = { + $OWNER$ = { save_scope_as = owner } + + random_list = { + 15 = { + save_scope_value_as = { + name = judaism_relic_name + value = flag:menorah + } + } + } + + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + scope:owner = { + create_artifact = { + name = artifact_pedestal_reliquary_judaism_name + creator = scope:owner + description = artifact_pedestal_reliquary_judaism_description + visuals = reliquary + type = pedestal + template = judaism_relic_template + modifier = artifact_monthly_piety_3_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + + scope:newly_created_artifact = { + add_scaled_artifact_modifier_piety_effect = yes + add_scaled_artifact_modifier_devotion_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + save_scope_as = epic + set_variable = { + name = relic + value = flag:judaism + } + } +} + +create_artifact_sculpture_religious_effect = { + $OWNER$ = { save_scope_as = owner } + + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + scope:owner = { + create_artifact = { + name = artifact_sculpture_religious_name + description = artifact_sculpture_religious_description + creator = scope:owner + visuals = statue + type = sculpture + template = religious_statue_template + modifier = artifact_monthly_piety_3_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + } + } + + scope:newly_created_artifact = { + set_variable = { # required to track equipability in template (based on dynamic religion) + name = statue_religion + value = scope:owner.religion + } + add_scaled_artifact_modifier_piety_effect = yes + add_scaled_artifact_modifier_devotion_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + } +} + +create_artifact_sculpture_religious_christian_effect = { + $OWNER$ = { save_scope_as = owner } + + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + scope:owner = { + create_artifact = { + name = artifact_sculpture_religious_christian_name + description = artifact_sculpture_religious_christian_description + visuals = statue + creator = scope:owner + type = sculpture + template = christian_relic_template + modifier = artifact_monthly_piety_3_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + } + } + + scope:newly_created_artifact = { + add_scaled_artifact_modifier_piety_effect = yes + add_scaled_artifact_modifier_devotion_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + } +} + + + +# ALCHEMY + +# Panacea +create_artifact_panacea_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $ALCHEMIST$ = { save_scope_as = alchemist } + hidden_effect_new_object = { + # Get artifact quality, wealth, and materials + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + if = { #If we have set the location we use it for the materials + limit = { exists = scope:location } + scope:location = { add_to_list = artifact_material_sources } + } + + scope:owner = { + # Create the artifact + create_artifact = { + name = artifact_panacea_name + description = placeholder + creator = scope:alchemist + visuals = small_box + type = panacea + modifier = artifact_negate_health_penalty_add_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + + scope:newly_created_artifact = { + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_panacea_description + + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_negate_health_penalty_add_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_negate_health_penalty_add_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_negate_health_penalty_add_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_negate_health_penalty_add_1_modifier + } + add_scaled_artifact_modifier_prestige_effect = yes + } + } +} + + +# Elixir +create_artifact_elixir_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $ALCHEMIST$ = { save_scope_as = alchemist } + hidden_effect_new_object = { + # Get artifact quality, wealth, and materials + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + scope:owner = { + create_artifact = { + name = placeholder + description = placeholder + creator = scope:alchemist + visuals = flask + type = elixir + modifier = artifact_monthly_learning_lifestyle_xp_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + + scope:newly_created_artifact = { + get_artifact_feature_references_effect = yes + set_artifact_feature_group = elixir_type + set_artifact_name = artifact_elixir_name + set_artifact_description = artifact_elixir_description + + if = { # Strong health bonus for elixir of immortality + limit = { + has_artifact_feature = elixir_immortality + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_health_gain_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_health_gain_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_health_gain_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_health_penalty_1_modifier + } + } + else_if = { # Fertility bonus for elixir of youth + limit = { + has_artifact_feature = elixir_youth + } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_fertility_gain_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_fertility_gain_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_fertility_gain_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_fertility_negative_modifier + } + } + else = { # Otherwise you get a small health boost + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_health_gain_2_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_health_gain_2_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_health_gain_1_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_health_gain_1_modifier + } + } + # Rarity determines prestige + add_scaled_artifact_modifier_minor_prestige_effect = yes + + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + } + } +} + + +# Philosopher's Stone +create_artifact_philosophers_stone_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + hidden_effect_new_object = { + # Get artifact quality, wealth, and materials + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + if = { #If we have set the location we use it for the materials + limit = { exists = scope:location } + scope:location = { add_to_list = artifact_material_sources } + } + + scope:owner = { + # Create the artifact + create_artifact = { + name = artifact_philosophers_stone_name + creator = scope:owner + description = placeholder + visuals = small_box + type = philosophers_stone + modifier = artifact_health_gain_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + } + } + + scope:newly_created_artifact = { + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_philosophers_stone_description + + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_health_gain_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_health_gain_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_health_gain_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_health_gain_1_modifier + } + add_scaled_artifact_modifier_scholarship_effect = yes + add_scaled_artifact_modifier_prestige_effect = yes + } + } +} + +create_artifact_poetry_effect = { + $OWNER$ = { save_scope_as = owner } + + hidden_effect_new_object = { + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + scope:owner = { + create_artifact = { + name = artifact_poetry_name + creator = scope:owner + description = artifact_poetry_description + visuals = scroll + type = miscellaneous + modifier = artifact_monthly_minor_prestige_1_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + } + } + + scope:newly_created_artifact = { + add_scaled_artifact_modifier_minor_prestige_effect = yes + add_scaled_artifact_modifier_majesty_effect = yes + } + } +} diff --git a/N3OW/common/scripted_effects/01_ep1_court_event_effects.txt b/N3OW/common/scripted_effects/01_ep1_court_event_effects.txt new file mode 100644 index 00000000..2e83b219 --- /dev/null +++ b/N3OW/common/scripted_effects/01_ep1_court_event_effects.txt @@ -0,0 +1,72 @@ +################################################## +# Interactions +################################################## + +employed_booner_invalidation_effect = { + $LIEGE$ = { save_scope_as = liege } + $EMPLOYEE$ = { save_scope_as = employee } + scope:employee = { + if = { + limit = { exists = var:booner_target } + var:booner_target = { + save_scope_as = booner_target + scope:liege = { + send_interface_toast = { + type = event_toast_effect_bad + title = { + first_valid = { + triggered_desc = { + trigger = { scope:booner_target = scope:liege } + desc = employer_booner_invalidated_title + } + desc = employer_boon_target_invalidated_title + } + } + left_icon = scope:employee + right_icon = scope:booner_target + scope:booner_target = { + employed_booner_modifier_removal_effect = { POS = court_physician } + employed_booner_modifier_removal_effect = { POS = court_tutor } + employed_booner_modifier_removal_triple_effect = { POS = seneschal } + employed_booner_modifier_removal_effect = { POS = wet_nurse } + employed_booner_modifier_removal_triple_effect = { POS = high_almoner } + employed_booner_modifier_removal_effect = { POS = bodyguard } + employed_booner_modifier_removal_triple_effect = { POS = master_of_horse } + employed_booner_modifier_removal_triple_effect = { POS = travel_leader } + employed_booner_modifier_removal_effect = { POS = antiquarian } + employed_booner_modifier_removal_triple_effect = { POS = master_of_hunt } + employed_booner_modifier_removal_triple_effect = { POS = royal_architect } + employed_booner_modifier_removal_triple_effect = { POS = cupbearer } + employed_booner_modifier_removal_triple_effect = { POS = lady_in_waiting } + employed_booner_modifier_removal_triple_effect = { POS = food_taster } + } + } + } + } + remove_variable = booner_target + } + } + debug_log_scopes = yes +} + +employed_booner_modifier_removal_effect = { + if = { + limit = { has_character_modifier = employer_booner_$POS$_modifier } + remove_character_modifier = employer_booner_$POS$_modifier + } +} + +employed_booner_modifier_removal_triple_effect = { + if = { + limit = { has_character_modifier = employer_booner_$POS$_1_modifier } + remove_character_modifier = employer_booner_$POS$_1_modifier + } + else_if = { + limit = { has_character_modifier = employer_booner_$POS$_2_modifier } + remove_character_modifier = employer_booner_$POS$_2_modifier + } + else_if = { + limit = { has_character_modifier = employer_booner_$POS$_3_modifier } + remove_character_modifier = employer_booner_$POS$_3_modifier + } +} diff --git a/N3OW/common/scripted_effects/01_ep1_interaction_scripted_effects.txt b/N3OW/common/scripted_effects/01_ep1_interaction_scripted_effects.txt new file mode 100644 index 00000000..f3108e88 --- /dev/null +++ b/N3OW/common/scripted_effects/01_ep1_interaction_scripted_effects.txt @@ -0,0 +1,19 @@ +################################################## +# Interactions +################################################## + +indebt_guest_interaction_accepted_effect = { + # Scope:actor gets a useable hook... + add_hook = { + type = threat_hook + target = scope:recipient + years = 10 + } + # ... & loses a modest amount of opinion for their evilness. + reverse_add_opinion = { + target = scope:recipient + modifier = blackmailing_me_opinion + } + # Even if you succeed, you burn a little CGV. + change_current_court_grandeur = miniscule_court_grandeur_loss +} diff --git a/N3OW/common/scripted_effects/01_exp1_historical_artifacts_creation_effect.txt b/N3OW/common/scripted_effects/01_exp1_historical_artifacts_creation_effect.txt new file mode 100644 index 00000000..60062243 --- /dev/null +++ b/N3OW/common/scripted_effects/01_exp1_historical_artifacts_creation_effect.txt @@ -0,0 +1,4373 @@ +# Historical Artifacts Creation # + +set_artifact_rarity_common = { + save_scope_value_as = { + name = quality + value = 15 + } + save_scope_value_as = { + name = wealth + value = 15 + } +} + +set_artifact_rarity_masterwork = { + save_scope_value_as = { + name = quality + value = 30 + } + save_scope_value_as = { + name = wealth + value = 30 + } +} + +set_artifact_rarity_famed = { + save_scope_value_as = { + name = quality + value = 70 + } + save_scope_value_as = { + name = wealth + value = 70 + } +} + +set_artifact_rarity_illustrious = { + save_scope_value_as = { + name = quality + value = 100 + } + save_scope_value_as = { + name = wealth + value = 100 + } +} + +create_artifact_pedestal_christian_relic_effect_hist = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + # Identify which relic it is + random_list = { + 10 = { + save_scope_value_as = { + name = christian_relic_name + value = flag:nail + } + } + 10 = { + save_scope_value_as = { + name = christian_relic_name + value = flag:thorn + } + } + 10 = { + trigger = { + NOT = { + any_artifact = { + has_variable = christian_sandals + } + } + } + save_scope_value_as = { + name = christian_relic_name + value = flag:sandals + } + } + 10 = { + trigger = { + NOT = { + any_artifact = { + has_variable = christian_girdle + } + } + } + save_scope_value_as = { + name = christian_relic_name + value = flag:girdle + } + } + 10 = { + trigger = { + NOT = { + any_artifact = { + has_variable = christian_lance + } + } + } + save_scope_value_as = { + name = christian_relic_name + value = flag:lance + } + } + 10 = { + trigger = { + NOT = { + any_artifact = { + count > 5 + has_variable = christian_skull + } + } + } + save_scope_value_as = { + name = christian_relic_name + value = flag:skull + } + } + 10 = { + trigger = { + NOT = { + any_artifact = { + count > 5 + has_variable = christian_arm + } + } + } + save_scope_value_as = { + name = christian_relic_name + value = flag:arm + } + } + 10 = { + trigger = { + NOT = { + any_artifact = { + has_variable = christian_loincloth + } + } + } + save_scope_value_as = { + name = christian_relic_name + value = flag:loincloth + } + } + 10 = { + save_scope_value_as = { + name = christian_relic_name + value = flag:cross + } + } + 10 = { + trigger = { + NOT = { + any_artifact = { + has_variable = christian_crown + } + } + } + save_scope_value_as = { + name = christian_relic_name + value = flag:crown + } + } + 10 = { + trigger = { + NOT = { + any_artifact = { + has_variable = christian_veil + } + } + } + save_scope_value_as = { + name = christian_relic_name + value = flag:veronica + } + } + } + + # Create the artifact + if = { + limit = { + exists = scope:christian_relic_name + scope:christian_relic_name = flag:lance + } + set_artifact_rarity_illustrious = yes + create_artifact = { + name = artifact_pedestal_spear_destiny_name + description = artifact_pedestal_spear_destiny + type = pedestal + template = christian_artifact_template + visuals = pedestal_longinus + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + decaying = no + } + } + else_if = { + limit = { + exists = scope:christian_relic_name + OR = { + scope:christian_relic_name = flag:sandals + scope:christian_relic_name = flag:girdle + scope:christian_relic_name = flag:loincloth + scope:christian_relic_name = flag:crown + scope:christian_relic_name = flag:veronica + } + } + set_artifact_rarity_illustrious = yes + create_artifact = { + name = artifact_pedestal_reliquary_christian_name + description = artifact_pedestal_reliquary_christian_description + type = pedestal + wealth = scope:wealth + quality = scope:quality + template = christian_artifact_template + visuals = pedestal_christian_relic + history = { + type = created_before_history + } + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { + exists = scope:christian_relic_name + scope:christian_relic_name = flag:skull + } + create_artifact = { + name = artifact_pedestal_reliquary_christian_name + description = artifact_pedestal_reliquary_christian_description + type = pedestal + wealth = scope:wealth + quality = scope:quality + template = christian_artifact_template + visuals = human_skull + history = { + type = created_before_history + } + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + } + } + else = { + create_artifact = { + name = artifact_pedestal_reliquary_christian_name + description = artifact_pedestal_reliquary_christian_description + type = pedestal + wealth = scope:wealth + quality = scope:quality + template = christian_artifact_template + visuals = reliquary + history = { + type = created_before_history + } + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + } + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = { + name = relic + value = flag:christian + } + if = { + limit = { + exists = scope:christian_relic_name + scope:christian_relic_name = flag:veronica + } + set_variable = christian_veil + } + else_if = { + limit = { + exists = scope:christian_relic_name + scope:christian_relic_name = flag:crown + } + set_variable = christian_crown + } + else_if = { + limit = { + exists = scope:christian_relic_name + scope:christian_relic_name = flag:loincloth + } + set_variable = christian_loincloth + } + else_if = { + limit = { + exists = scope:christian_relic_name + scope:christian_relic_name = flag:lance + } + set_variable = christian_lance + } + else_if = { + limit = { + exists = scope:christian_relic_name + scope:christian_relic_name = flag:arm + } + set_variable = christian_arm + } + else_if = { + limit = { + exists = scope:christian_relic_name + scope:christian_relic_name = flag:sandals + } + set_variable = christian_sandals + } + else_if = { + limit = { + exists = scope:christian_relic_name + scope:christian_relic_name = flag:girdle + } + set_variable = christian_girdle + } + else_if = { + limit = { + exists = scope:christian_relic_name + scope:christian_relic_name = flag:skull + } + set_variable = christian_skull + } + add_scaled_artifact_modifier_piety_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_2_scaled_artifact_modifier_devotion_effect = yes + + } + else = { + add_scaled_artifact_modifier_devotion_effect = yes + } + add_artifact_modifier = artifact_monthly_prestige_penalty_modifier #overwrite default creation modifier + save_scope_as = epic + } +} + +create_artifact_pedestal_islamic_relic_effect_hist = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + # Identify which relic it is + random_list = { + 10 = { + save_scope_value_as = { + name = islam_relic_name + value = flag:hair + } + } + 10 = { + trigger = { + NOT = { + any_artifact = { + has_variable = islam_cloak + } + } + } + save_scope_value_as = { + name = islam_relic_name + value = flag:cloak + } + } + 10 = { + trigger = { + NOT = { + any_artifact = { + has_variable = islam_hand + } + } + } + save_scope_value_as = { + name = islam_relic_name + value = flag:hand + } + } + 10 = { + trigger = { + NOT = { + any_artifact = { + has_variable = islam_keys + } + } + } + save_scope_value_as = { + name = islam_relic_name + value = flag:keys + } + } + 10 = { + save_scope_value_as = { + name = islam_relic_name + value = flag:tooth + } + } + 10 = { + trigger = { + NOT = { + any_artifact = { + has_variable = islam_seal + } + } + } + save_scope_value_as = { + name = islam_relic_name + value = flag:seal + } + } + 10 = { + trigger = { + NOT = { + any_artifact = { + has_variable = islam_banner + } + } + } + save_scope_value_as = { + name = islam_relic_name + value = flag:banner + } + } + } + + # Create the artifact + if = { + limit = { + exists = scope:islam_relic_name + scope:islam_relic_name = flag:banner + } + set_artifact_rarity_illustrious = yes + create_artifact = { + name = artifact_banner_islam_name + description = artifact_banner_islam_description + type = wall_big + template = islam_artifact_template + visuals = banner_islam + visuals_source = title:d_shiite #Caliphate + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { + exists = scope:islam_relic_name + OR = { + scope:islam_relic_name = flag:cloak + scope:islam_relic_name = flag:hand + scope:islam_relic_name = flag:keys + scope:islam_relic_name = flag:seal + } + } + set_artifact_rarity_illustrious = yes + create_artifact = { + name = artifact_pedestal_reliquary_islam_name + description = artifact_pedestal_reliquary_islam_description + type = pedestal + template = islam_artifact_template + visuals = pedestal_islamic_relic + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + } + } + else = { + create_artifact = { + name = artifact_pedestal_reliquary_islam_name + description = artifact_pedestal_reliquary_islam_description + type = pedestal + template = islam_artifact_template + visuals = reliquary + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + } + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = { + name = relic + value = flag:islamic + } + add_scaled_artifact_modifier_piety_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_2_scaled_artifact_modifier_devotion_effect = yes + + } + else = { + add_scaled_artifact_modifier_devotion_effect = yes + } + add_artifact_modifier = artifact_monthly_prestige_penalty_modifier #overwrite default creation modifier + if = { + limit = { + exists = scope:islam_relic_name + scope:islam_relic_name = flag:cloak + } + set_variable = islam_cloak + } + else_if = { + limit = { + exists = scope:islam_relic_name + scope:islam_relic_name = flag:seal + } + set_variable = islam_seal + } + else_if = { + limit = { + exists = scope:islam_relic_name + scope:islam_relic_name = flag:keys + } + set_variable = islam_keys + } + else_if = { + limit = { + exists = scope:islam_relic_name + scope:islam_relic_name = flag:hand + } + set_variable = islam_hand + } + else_if = { + limit = { + exists = scope:islam_relic_name + scope:islam_relic_name = flag:banner + } + set_variable = islam_banner + } + add_scaled_artifact_modifier_devotion_effect = yes + save_scope_as = epic + } +} + +create_artifact_pedestal_buddhism_relic_effect_hist = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + # Identify which relic it is + random_list = { + 10 = { + save_scope_value_as = { + name = buddhism_relic_name + value = flag:tooth + } + } + 10 = { + save_scope_value_as = { + name = buddhism_relic_name + value = flag:bone + } + } + 10 = { + trigger = { + NOT = { + any_artifact = { + has_variable = buddhism_robe + } + } + } + save_scope_value_as = { + name = buddhism_relic_name + value = flag:robe + } + } + 10 = { + trigger = { + NOT = { + any_artifact = { + has_variable = buddhism_bowl + } + } + } + save_scope_value_as = { + name = buddhism_relic_name + value = flag:bowl + } + } + 10 = { + trigger = { + NOT = { + any_artifact = { + has_variable = buddhism_tongue + } + } + } + save_scope_value_as = { + name = buddhism_relic_name + value = flag:tongue + } + } + 10 = { + save_scope_value_as = { + name = buddhism_relic_name + value = flag:hair + } + } + 10 = { + save_scope_value_as = { + name = buddhism_relic_name + value = flag:sarira + } + } + 10 = { + save_scope_value_as = { + name = buddhism_relic_name + value = flag:bo + } + } + } + + # Create the artifact + if = { + limit = { + exists = scope:buddhism_relic_name + OR = { + scope:buddhism_relic_name = flag:robe + scope:buddhism_relic_name = flag:bowl + scope:buddhism_relic_name = flag:tongue + } + } + set_artifact_rarity_illustrious = yes + create_artifact = { + name = artifact_pedestal_reliquary_buddhism_name + description = artifact_pedestal_reliquary_buddhism_description + type = pedestal + template = buddhism_artifact_template + visuals = pedestal_buddhism_relic + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + } + } + else_if = { + limit = { + exists = scope:buddhism_relic_name + scope:buddhism_relic_name = flag:tooth + } + set_artifact_rarity_illustrious = yes + create_artifact = { + name = artifact_pedestal_reliquary_buddhism_name + description = artifact_pedestal_reliquary_buddhism_description + type = pedestal + template = buddhism_artifact_template + visuals = buddha_tooth + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + } + } + else = { + create_artifact = { + name = artifact_pedestal_reliquary_buddhism_name + description = artifact_pedestal_reliquary_buddhism_description + type = pedestal + template = buddhism_artifact_template + visuals = pedestal_buddhism_relic + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + } + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = { + name = relic + value = flag:buddhism + } + if = { + limit = { + exists = scope:buddhism_relic_name + scope:buddhism_relic_name = flag:tongue + } + set_variable = buddhism_tongue + } + else_if = { + limit = { + exists = scope:buddhism_relic_name + scope:buddhism_relic_name = flag:bowl + } + set_variable = buddhism_bowl + } + else_if = { + limit = { + exists = scope:buddhism_relic_name + scope:buddhism_relic_name = flag:robe + } + set_variable = buddhism_robe + } + add_scaled_artifact_modifier_piety_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_2_scaled_artifact_modifier_devotion_effect = yes + + } + else = { + add_scaled_artifact_modifier_devotion_effect = yes + } + add_artifact_modifier = artifact_monthly_prestige_penalty_modifier #overwrite default creation modifier + save_scope_as = epic + } +} + +create_artifact_pedestal_branch_relic_zoroastr_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + set_artifact_rarity_illustrious = yes + + # Identify which relic it is + random_list = { + 10 = { + save_scope_value_as = { + name = branch_name + value = flag:haoma + } + } + 10 = { + save_scope_value_as = { + name = branch_name + value = flag:cypress + } + } + } + + # Create the artifact + create_artifact = { + name = artifact_pedestal_branch_name + description = artifact_pedestal_branch_description + type = pedestal + visuals = pedestal_branch_relic_zoroastr + wealth = scope:wealth + quality = scope:quality + template = branch_zoroastr_template + history = { + type = created_before_history + } + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = { + name = relic + value = flag:zoroastr + } + add_scaled_artifact_modifier_piety_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_2_scaled_artifact_modifier_devotion_effect = yes + + } + else = { + add_scaled_artifact_modifier_devotion_effect = yes + } + add_artifact_modifier = artifact_monthly_prestige_penalty_modifier #overwrite default creation modifier + save_scope_as = epic + } +} + +create_artifact_pedestal_branch_relic_germanic_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + set_artifact_rarity_illustrious = yes + + # Identify which relic it is + random_list = { + 10 = { + save_scope_value_as = { + name = branch_name + value = flag:thor + } + } + 10 = { + save_scope_value_as = { + name = branch_name + value = flag:uppsala + } + } + } + + # Create the artifact + create_artifact = { + name = artifact_pedestal_branch_name + description = artifact_pedestal_branch_description + type = pedestal + template = branch_germanic_template + visuals = pedestal_branch_relic_germanic + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = { + name = relic + value = flag:germanic + } + add_scaled_artifact_modifier_piety_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_2_scaled_artifact_modifier_devotion_effect = yes + + } + else = { + add_scaled_artifact_modifier_devotion_effect = yes + } + save_scope_as = epic + } +} + +create_artifact_pedestal_branch_relic_slavic_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + set_artifact_rarity_illustrious = yes + + save_scope_value_as = { + name = branch_name + value = flag:alatyr + } + + # Create the artifact + create_artifact = { + name = artifact_pedestal_branch_name + description = artifact_pedestal_branch_description + type = pedestal + template = branch_slavic_template + visuals = pedestal_branch_relic_slavic + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = { + name = relic + value = flag:slavic + } + add_scaled_artifact_modifier_piety_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_2_scaled_artifact_modifier_devotion_effect = yes + + } + else = { + add_scaled_artifact_modifier_devotion_effect = yes + } + save_scope_as = epic + } +} + +create_artifact_pedestal_branch_relic_boog_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + set_artifact_rarity_illustrious = yes + + save_scope_value_as = { + name = branch_name + value = flag:somb + } + + # Create the artifact + create_artifact = { + name = artifact_pedestal_branch_name + description = artifact_pedestal_branch_description + type = pedestal + template = branch_boog_template + visuals = pedestal_branch_relic_boog + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = { + name = relic + value = flag:boog + } + add_scaled_artifact_modifier_piety_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_2_scaled_artifact_modifier_devotion_effect = yes + + } + else = { + add_scaled_artifact_modifier_devotion_effect = yes + } + add_artifact_modifier = artifact_monthly_prestige_penalty_modifier #overwrite default creation modifier + save_scope_as = epic + } +} + +create_artifact_pedestal_branch_relic_hinduism_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + set_artifact_rarity_illustrious = yes + + save_scope_value_as = { + name = branch_name + value = flag:kalpavriksha + } + + # Create the artifact + create_artifact = { + name = artifact_pedestal_branch_name + description = artifact_pedestal_branch_description + type = pedestal + template = branch_hinduism_template + visuals = pedestal_branch_relic_hinduism + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = { + name = relic + value = flag:hinduism + } + add_scaled_artifact_modifier_piety_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_2_scaled_artifact_modifier_devotion_effect = yes + + } + else = { + add_scaled_artifact_modifier_devotion_effect = yes + } + save_scope_as = epic + } +} + +create_artifact_pedestal_branch_relic_general_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + set_artifact_rarity_illustrious = yes + + save_scope_value_as = { + name = branch_name + value = flag:general + } + + # Create the artifact + create_artifact = { + name = artifact_pedestal_branch_name + description = artifact_pedestal_branch_description + type = pedestal + template = branch_general_template + visuals = pedestal_branch_relic_hinduism + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + } + + scope:newly_created_artifact = { + set_variable = { #This is needed to determine what religion the branch will work for. + name = relic_religion + value = $RELIGION$ + } + set_variable = { name = historical_unique_artifact value = yes } + add_scaled_artifact_modifier_piety_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_2_scaled_artifact_modifier_devotion_effect = yes + + } + else = { + add_scaled_artifact_modifier_devotion_effect = yes + } + save_scope_as = epic + } +} + +#Common Artifacts + +create_artifact_excalibur_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_common = yes + + # Create the artifact + create_artifact = { + name = excalibur_name + description = excalibur_description + type = pedestal + visuals = excalibur + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = excalibur_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = excalibur + save_scope_as = epic + } +} + +create_artifact_edmund_head_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = edmund_head_name + description = edmund_head_description + type = pedestal + visuals = head + wealth = scope:wealth + quality = scope:quality + template = christian_relic_template + history = { + type = created + date = 869.11.20 + recipient = character:163064 #Eadmund the Martyr + location = province:1520 #Blything + } + modifier = edmund_head_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = edmund_head + add_scaled_artifact_modifier_devotion_effect = yes + set_variable = { + name = relic + value = flag:christian + } + save_scope_as = epic + add_artifact_history = { + type = given + date = 946.5.27 + recipient = character:33350 # Æthelstan + } + add_artifact_title_history = { + target = title:k_england + date = 955.11.24 + } + } +} + +create_artifact_makarakundala_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = artifact_makarakundala_name + description = artifact_makarakundala_description + type = pedestal + visuals = riches + wealth = scope:wealth + quality = scope:quality + template = general_unique_template + history = { + type = created_before_history + } + modifier = makarakundala_modifier + save_scope_as = newly_created_artifact + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = makarakundala + add_scaled_artifact_modifier_devotion_effect = yes + save_scope_as = epic + } +} + +#Masterwork Artifacts + +create_artifact_ibeji_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_masterwork = yes + + # Create the artifact + create_artifact = { + name = artifact_ibeji_name + description = artifact_ibeji_description + template = general_unique_template + type = pedestal + visuals = medium_box + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = ibeji_modifier + save_scope_as = newly_created_artifact + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = ibeji + add_scaled_artifact_modifier_devotion_effect = yes + save_scope_as = epic + } +} + +create_artifact_chinese_caligraphy_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_masterwork = yes + + # Create the artifact + create_artifact = { + type = pedestal + visuals = scroll + wealth = scope:wealth + template = general_unique_template + quality = scope:quality + history = { + type = created_before_history + } + modifier = caligraphy_modifier + save_scope_as = newly_created_artifact + name = artifact_chinese_caligraphy_name + description = artifact_chinese_caligraphy_description + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = chinese_caligraphy + add_2_scaled_artifact_modifier_rulership_effect = yes + save_scope_as = epic + } +} + +create_artifact_throne_charlemagne_effect = { #Create at start + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_throne_charlemagne_name + description = artifact_throne_charlemagne_description + type = throne_special + visuals = throne_charlemagne + wealth = scope:wealth + quality = scope:quality + template = throne_charlemagne_template + history = { + type = created + date = 800.12.25 + recipient = character:6392 #Karl I the Great + location = province:2092 #Aachen + } + modifier = throne_charlemagne_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = charlamagne_throne + # k_lotharingia history copied manually because it is destroyed before 1066 + add_artifact_history = { + type = inherited + date = 814.1.2 + recipient = character:90095 #Louis I + } + add_artifact_history = { + type = inherited + date = 817.1.1 + recipient = character:30227 #Lothair I + } + add_artifact_title_history = { + target = title:e_hre + date = 973.5.7 + } + add_scaled_artifact_modifier_majesty_effect = yes + add_scaled_artifact_modifier_rulership_effect = yes + save_scope_as = epic + save_scope_value_as = { + name = throne + value = yes + } + } +} + +create_artifact_throne_solomon_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_throne_solomon_name + description = artifact_throne_solomon_description + type = throne_special + visuals = throne_solomon + wealth = scope:wealth + quality = scope:quality + template = throne_solomon_template + history = { + type = created_before_history + } + modifier = throne_solomon_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = throne_of_solomon + save_scope_as = epic + add_scaled_artifact_modifier_majesty_effect = yes + add_scaled_artifact_modifier_rulership_effect = yes + add_scaled_artifact_modifier_devotion_effect = yes + save_scope_value_as = { + name = throne + value = yes + } + } +} + +create_artifact_byz_throne_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_byz_throne_name + description = artifact_byz_throne_description + type = throne_special + visuals = ep3_throne_of_solomon + wealth = scope:wealth + quality = scope:quality + template = byz_throne_template + history = { + type = created_before_history + } + modifier = byz_throne_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + #set_variable = byz_throne_of_solomon + save_scope_as = epic + save_scope_value_as = { + name = throne + value = yes + } + add_artifact_title_history = { + target = title:e_byzantium + date = 940.1.1 + } + } +} + +create_artifact_throne_scone_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_throne_stone_scone_name + description = artifact_throne_stone_scone + type = throne_special + visuals = throne_scone + wealth = scope:wealth + quality = scope:quality + template = throne_scone_template + history = { + type = created + date = 841.6.1 + recipient = character:6018 #Kenneth mac Ailpín + location = province:1742 #Scone + } + modifier = throne_scone_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = throne_scone + save_scope_as = epic + add_scaled_artifact_modifier_rulership_effect = yes + save_scope_value_as = { + name = throne + value = yes + } + add_artifact_title_history = { + target = title:k_scotland + date = 858.1.1 + } + } +} + +create_artifact_wall_banner_kaviani_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_wall_banner_kaviani_name + description = artifact_wall_banner_kaviani + type = wall_big + template = kaviani_template + visuals = banner + visuals_source = dynasty:jamshid + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = banner_kaviani_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = banner_kaviani + save_scope_as = epic + } +} + +create_artifact_sculpture_cabinet_pentapyrgion_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_masterwork = yes + + # Create the artifact + create_artifact = { + name = artifact_sculpture_cabinet_pentapyrgion_name + description = artifact_sculpture_cabinet_pentapyrgion_description + type = sculpture + visuals = sculpture_cabinet_pentapyrgion + template = pentapyrgion_template + wealth = scope:wealth + quality = scope:quality + history = { + type = created + date = 839.6.1 + recipient = character:70491 #Theophilos + location = province:496 #Constantinople + } + modifier = pentapyrgion_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + add_artifact_title_history = { + target = title:e_byzantium + date = 842.1.20 + } + save_scope_value_as = { + name = cupboard + value = yes + } + } +} + +create_artifact_monomachus_crown_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = monomachus_crown_name + description = monomachus_crown_description + template = crown_wearable_template + type = helmet + visuals = pedestal_justinian + wealth = scope:wealth + quality = scope:quality + history = { + type = created + date = 1042.6.11 + recipient = character:1726 #Konstantinos IX + location = province:496 #Constantinople + } + modifier = monomachus_crown_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + save_scope_as = epic + add_artifact_title_history = { + target = title:e_byzantium + date = 1055.1.11 + } + } +} + +create_artifact_ruyi_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_masterwork = yes + + # Create the artifact + create_artifact = { + name = artifact_ruyi_name + description = artifact_ruyi_description + type = pedestal + visuals = regalia_court + wealth = scope:wealth + quality = scope:quality + template = general_unique_template + history = { + type = created_before_history + } + modifier = ruyi_modifier + save_scope_as = newly_created_artifact + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = ruyi + save_scope_as = epic + } +} + +create_artifact_jewelled_danda_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_masterwork = yes + + # Create the artifact + create_artifact = { + name = artifact_jewelled_danda_name + description = artifact_jewelled_danda_description + type = regalia_simple + visuals = regalia + wealth = scope:wealth + quality = scope:quality + template = regalia_template + history = { + type = created_before_history + } + modifier = jewelled_danda_modifier + save_scope_as = newly_created_artifact + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + add_2_scaled_artifact_modifier_rulership_effect = yes + add_scaled_artifact_modifier_scholarship_effect = yes + set_variable = danda + save_scope_as = epic + } +} + +create_artifact_khanda_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_masterwork = yes + + # Create the artifact + create_artifact = { + name = artifact_khanda_name + description = artifact_khanda_description + template = branch_hinduism_template + type = pedestal + visuals = wall_khanda_sword + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = khanda_modifier + save_scope_as = newly_created_artifact + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = khanda + set_variable = { + name = relic + value = flag:hinduism + } + save_scope_as = epic + } +} + +create_artifact_dagger_of_rostam_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_dagger_of_rostam_name + description = artifact_dagger_of_rostam_description + type = pedestal + visuals = dagger_court + template = general_unique_template + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = rustam_dagger_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = dagger_of_rostam + save_scope_as = epic + } +} + +create_artifact_ascalon_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_spear_of_ascalon_name + description = artifact_spear_of_ascalon_description + type = pedestal + visuals = spear_court + template = general_unique_template + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = spear_ascalon_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = ascalon + set_variable = { + name = relic + value = flag:christian + } + save_scope_as = epic + } +} + +create_artifact_zomorrodnegar_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_zomorrodnegar_name + description = artifact_zomorrodnegar_description + type = pedestal + visuals = sword_court + template = general_unique_template + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = zomorrodnegar_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = zomorrodnegar + save_scope_as = epic + } +} + +create_artifact_kaves_apron_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_kaves_apron_name + description = artifact_kaves_apron_description + type = wall_big + visuals = banner + visuals_source = dynasty:jamshid + template = general_unique_template + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = kaves_apron_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = kaves_apron + save_scope_as = epic + } +} + +create_artifact_muhammads_epistles_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_masterwork = yes + + # Create the artifact + create_artifact = { + type = pedestal + visuals = scroll + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + template = islam_artifact_template + name = artifact_muhammads_epistles_name + description = artifact_muhammads_epistles_description + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = muhammads_epistles + add_scaled_artifact_modifier_devotion_effect = yes + add_scaled_artifact_modifier_combat_effect = yes + set_variable = { + name = relic + value = flag:islamic + } + save_scope_as = epic + } +} + +create_artifact_aruval_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_masterwork = yes + + # Create the artifact + create_artifact = { + name = artifact_aruval_name + description = artifact_aruval_description + type = pedestal + visuals = wall_khanda_sword + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + template = branch_hinduism_template + modifier = aruval_modifier + save_scope_as = newly_created_artifact + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = aruval + set_variable = { + name = relic + value = flag:hinduism + } + save_scope_as = epic + } +} + +create_artifact_navaratna_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_masterwork = yes + + # Create the artifact + create_artifact = { + name = artifact_navaratna_name + description = artifact_navaratna_description + visuals = necklace + type = necklace + wealth = scope:wealth + quality = scope:quality + template = general_unique_template + history = { + type = created_before_history + } + modifier = navaratna_modifier + save_scope_as = newly_created_artifact + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = navaratna + get_artifact_feature_references_effect = yes + save_scope_as = epic + } +} + +create_artifact_pedestal_ikenga_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_masterwork = yes + + # Create the artifact + create_artifact = { + name = artifact_ikenga_name + description = artifact_ikenga_description + type = pedestal + visuals = small_box + wealth = scope:wealth + quality = scope:quality + template = general_unique_template + history = { + type = created_before_history + } + modifier = ikenga_modifier + save_scope_as = newly_created_artifact + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = ikenga + save_scope_as = epic + } +} + +create_artifact_afarganyu_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = afarganyu_name + description = artifact_afarganyu_description + template = branch_zoroastr_template + type = urn + visuals = urn + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = afarganyu_modifier + save_scope_as = newly_created_artifact + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = { + name = relic + value = flag:zoroastr + } + save_scope_as = epic + } +} + +create_artifact_siddhachakra_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_masterwork = yes + + # Create the artifact + create_artifact = { + name = siddhachakra_name + description = artifact_siddhachakra_description + template = jainism_artifact_template + type = pedestal + visuals = scroll + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = siddhachakra_modifier + save_scope_as = newly_created_artifact + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = { + name = relic + value = flag:jainism + } + save_scope_as = epic + } +} + +create_artifact_staff_kakusandha_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_staff_kakusandha + description = artifact_staff_kakusandha_desc + type = pedestal + visuals = spear_court + wealth = scope:wealth + quality = scope:quality + template = buddhism_artifact_template + history = { + type = created_before_history + } + modifier = kakusandha_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = staff_kakusandha + set_variable = { + name = relic + value = flag:buddhism + } + save_scope_as = epic + } +} + +create_artifact_konagamana_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = water_filter_konagamana + description = water_filter_konagamana_desc + type = pedestal + visuals = scroll + wealth = scope:wealth + quality = scope:quality + template = buddhism_artifact_template + history = { + type = created_before_history + } + modifier = konagamana_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = konagamana + set_variable = { + name = relic + value = flag:buddhism + } + save_scope_as = epic + } +} + +create_artifact_robe_kassapa_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = robe_kassapa + description = robe_kassapa_desc + template = buddhism_artifact_template + type = pedestal + visuals = reliquary + wealth = scope:wealth + quality = scope:quality + template = buddhism_artifact_template + history = { + type = created_before_history + } + modifier = kassapa_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = kassapa + set_variable = { + name = relic + value = flag:buddhism + } + save_scope_as = epic + } +} + +#Famed Artifacts + +create_artifact_reichskrone_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = reichskrone_name + description = reichskrone_description + type = helmet + visuals = hre_crown + wealth = scope:wealth + quality = scope:quality + template = reichskrone_template + history = { + type = created + date = 962.1.1 + recipient = character:1282 #Otto I + location = province:2092 #Aachen + } + modifier = reichskrone_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = { + name = artifact_succession_title + value = title:e_hre + } + add_artifact_title_history = { + target = title:e_hre + date = 962.1.1 + } + set_variable = { + name = reichskrone + value = yes + } + save_scope_as = epic + } +} + +create_artifact_cintamani_hindu_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = artifact_cintamani_name + description = artifact_cintamani_hindu_description + type = pedestal + visuals = rock + wealth = scope:wealth + quality = scope:quality + template = branch_hinduism_template + history = { + type = created_before_history + } + modifier = cintamani_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = cintamani_hindu + set_variable = { + name = relic + value = flag:hinduism + } + } +} + +create_artifact_cintamani_buddhist_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = artifact_cintamani_name + description = artifact_cintamani_buddhist_description + type = pedestal + visuals = rock + wealth = scope:wealth + quality = scope:quality + template = buddhism_artifact_template + history = { + type = created_before_history + } + modifier = cintamani_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = cintamani_buddhist + set_variable = { + name = relic + value = flag:buddhism + } + } +} + +create_artifact_wall_banner_edessa_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_wall_big_edessa_name + description = artifact_wall_big_edessa + type = pedestal + visuals = reliquary + wealth = scope:wealth + quality = scope:quality + template = edessa_template + history = { + type = created_before_history + location = province:4869 #Edessa + } + modifier = banner_of_edessa_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = banner_edessa + set_variable = { + name = relic + value = flag:christian + } + save_scope_as = epic + } +} + +create_artifact_wall_cid_sword_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = artifact_wall_cid_sword_name + description = artifact_wall_el_cids_sword + type = pedestal + visuals = wall_cid_sword + wealth = scope:wealth + quality = scope:quality + template = tizona_template + history = { + type = created_before_history + } + modifier = tizona_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + add_artifact_history = { + type = won_in_duel + date = 1097.1.1 + recipient = character:107590 #El Cid + } + set_variable = { name = historical_unique_artifact value = yes } + set_variable = sword_cid + save_scope_as = epic + } +} + +create_artifact_wall_muhammad_sword_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_famed = yes + + # Identify which sword it is + random_list = { + 10 = { + trigger = { + NOT = { + any_artifact = { + has_variable = sword_muhammad_aladb + } + } + } + save_scope_value_as = { + name = muhammad_sword_name + value = flag:aladb + } + set_variable = sword_muhammad_aladb + } + 10 = { + trigger = { + NOT = { + any_artifact = { + has_variable = sword_muhammad_almathur + } + } + } + save_scope_value_as = { + name = muhammad_sword_name + value = flag:almathur + } + set_variable = sword_muhammad_almathur + } + 10 = { + trigger = { + NOT = { + any_artifact = { + has_variable = sword_muhammad_arrasub + } + } + } + save_scope_value_as = { + name = muhammad_sword_name + value = flag:arrasub + } + set_variable = sword_muhammad_arrasub + } + 10 = { + trigger = { + NOT = { + any_artifact = { + has_variable = sword_muhammad_albattar + } + } + } + save_scope_value_as = { + name = muhammad_sword_name + value = flag:albattar + } + set_variable = sword_muhammad_albattar + } + 10 = { + trigger = { + NOT = { + any_artifact = { + has_variable = sword_muhammad_haft + } + } + } + save_scope_value_as = { + name = muhammad_sword_name + value = flag:haft + } + set_variable = sword_muhammad_haft + } + 10 = { + trigger = { + NOT = { + any_artifact = { + has_variable = sword_muhammad_qali + } + } + } + save_scope_value_as = { + name = muhammad_sword_name + value = flag:qali + } + set_variable = sword_muhammad_qali + } + 10 = { + trigger = { + NOT = { + any_artifact = { + has_variable = sword_muhammad_dhu + } + } + } + save_scope_value_as = { + name = muhammad_sword_name + value = flag:dhu + } + set_variable = sword_muhammad_dhu + } + 10 = { + trigger = { + NOT = { + any_artifact = { + has_variable = sword_muhammad_mikhdham + } + } + } + save_scope_value_as = { + name = muhammad_sword_name + value = flag:mikhdham + } + set_variable = sword_muhammad_mikhdham + } + 10 = { + trigger = { + NOT = { + any_artifact = { + has_variable = sword_muhammad_alqadib + } + } + } + save_scope_value_as = { + name = muhammad_sword_name + value = flag:alqadib + } + set_variable = sword_muhammad_alqadib + } + } + + # Create the artifact + create_artifact = { + name = artifact_wall_sword_muhammad_name + description = artifact_wall_sword_muhammad + type = pedestal + visuals = wall_muhammad_sword + wealth = scope:wealth + quality = scope:quality + template = muhammad_sword_template + history = { + type = created_before_history + } + modifier = muhammed_sword_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = sword_of_muhammad + save_scope_as = muhammad_sword + set_variable = { + name = relic + value = flag:islamic + } + random_list = { + pick = 2 + unique = yes + 10 = { + add_artifact_modifier = muhammed_sword_1_modifier + } + 10 = { + add_artifact_modifier = muhammed_sword_2_modifier + } + 10 = { + add_artifact_modifier = muhammed_sword_3_modifier + } + 10 = { + add_artifact_modifier = muhammed_sword_4_modifier + } + 10 = { + add_artifact_modifier = muhammed_sword_5_modifier + } + 10 = { + add_artifact_modifier = muhammed_sword_6_modifier + } + 10 = { + add_artifact_modifier = muhammed_sword_7_modifier + } + 10 = { + add_artifact_modifier = muhammed_sword_8_modifier + } + } + } + if = { + limit = { + scope:muhammad_sword_name = flag:aladb + } + scope:muhammad_sword = { + add_artifact_history = { + type = given + date = 624.3.13 + recipient = character:33922 #Muhammad the Prophet + } + } + } + if = { + limit = { + scope:muhammad_sword_name = flag:almathur + } + scope:muhammad_sword = { + add_artifact_history = { + type = inherited + date = 570.6.1 + recipient = character:33922 #Muhammad the Prophet + } + } + } + if = { + limit = { + scope:muhammad_sword_name = flag:arrasub + } + scope:muhammad_sword = { + add_artifact_history = { + type = inherited + date = 570.6.1 + recipient = character:33922 #Muhammad the Prophet + } + } + } + if = { + limit = { + OR = { + scope:muhammad_sword_name = flag:albattar + scope:muhammad_sword_name = flag:haft + scope:muhammad_sword_name = flag:qali + } + } + scope:muhammad_sword = { + add_artifact_history = { + type = conquest + date = 622.5.1 + recipient = character:33922 #Muhammad the Prophet + location = province:718 + } + } + } + if = { + limit = { + scope:muhammad_sword_name = flag:dhu + } + scope:muhammad_sword = { + add_artifact_history = { + type = conquest + date = 624.3.13 + recipient = character:33922 #Muhammad the Prophet + location = province:6210 #Al-Jar + } + } + } + if = { + limit = { + scope:muhammad_sword_name = flag:mikhdham + } + scope:muhammad_sword = { + add_artifact_history = { + type = given + date = 610.1.1 + recipient = character:33922 #Muhammad the Prophet + } + } + } + if = { + limit = { + scope:muhammad_sword_name = flag:alqadib + } + scope:muhammad_sword = { + add_artifact_history = { + type = given + date = 610.1.1 + recipient = character:33922 #Muhammad the Prophet + } + } + } + scope:muhammad_sword = { + save_scope_as = epic + } +} + +create_artifact_sword_mmaagha_kamalu_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = artifact_mmaagha_kamalu_name + description = artifact_mmaagha_kamalu_description + type = pedestal + visuals = sword_court + wealth = scope:wealth + quality = scope:quality + template = general_unique_template + history = { + type = created_before_history + } + modifier = mmaagha_kamalu_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = mmaagha_kamalu + save_scope_as = epic + } +} + +create_artifact_bronze_head_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = artifact_bronze_head_name + description = artifact_bronze_head_description + type = pedestal + visuals = head + wealth = scope:wealth + quality = scope:quality + template = general_unique_template + history = { + type = created_before_history + } + modifier = bronze_head_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = bronze_head + save_scope_as = epic + } +} + +create_artifact_crystal_carving_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = artifact_crystal_carving_name + description = artifact_crystal_carving_description + type = pedestal + visuals = riches + wealth = scope:wealth + quality = scope:quality + template = general_unique_template + history = { + type = created_before_history + } + modifier = crystal_carving_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = crystal_carving + save_scope_as = epic + } +} + +create_artifact_wall_sword_attila_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_wall_sword_attila_name + description = artifact_wall_sword_attila_description + type = pedestal + template = attila_template + visuals = wall_sword_attila + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = attila_sword_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = sword_attila + save_scope_as = epic + } +} + +create_artifact_pedestal_great_diamond_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = artifact_pedestal_great_diamond_name + description = artifact_pedestal_great_diamond_description + type = pedestal + template = general_unique_template + visuals = diamond + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = great_diamond_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = great_diamond + save_scope_as = epic + } +} + +create_artifact_pedestal_al_jabal_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_pedestal_al_jabal_name + description = artifact_pedestal_al_jabal_description + type = pedestal + visuals = ring_court + template = general_unique_template + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = al_jabal_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = al_jabal + save_scope_as = epic + } +} + +create_artifact_pedestal_al_yatima_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_pedestal_al_yatima_name + description = artifact_pedestal_al_yatima_description + type = pedestal + visuals = diamond + template = general_unique_template + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = al_yatima_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = al_yatima + save_scope_as = epic + } +} + +create_artifact_pedestal_cup_jamshid_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_pedestal_jamshid_name + description = artifact_pedestal_cup_jamshid + type = pedestal + template = cup_jamshid_template + visuals = pedestal_cup_jamshid + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = cup_jamshid_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = cup_jamshid + save_scope_as = epic + } +} + +create_artifact_pedestal_crown_iron_effect = { #Create at start + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_pedestal_crown_iron_name + description = artifact_pedestal_crown_iron + type = pedestal + template = crown_iron_template + visuals = pedestal_crown_iron + wealth = scope:wealth + quality = scope:quality + history = { + type = created + date = 313.2.1 + recipient = character:70523 #Konstantinos I the Great + location = province:496 #Constantinople + } + modifier = iron_crown_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = iron_crown + add_artifact_history = { + type = given + date = 600.1.1 + actor = character:7893 + recipient = character:190171 + location = province:2475 + } + add_artifact_history = { + type = given + date = 774.7.10 + recipient = character:6392 + location = province:2475 + } + add_artifact_history = { + type = given + date = 781.1.1 + recipient = character:6394 + location = province:2475 + } + add_artifact_history = { + type = inherited + date = 810.1.1 + recipient = character:6396 + location = province:2475 + } + add_artifact_history = { + type = inherited + date = 818.4.17 + recipient = character:90095 + location = province:2475 + } + add_artifact_history = { + type = inherited + date = 887.1.1 + recipient = character:71901 + location = province:2475 + } + # k_italy history copied manually because it is destroyed before 1066 + add_artifact_history = { + type = inherited + date = 896.1.1 + recipient = character:167969 #Liutfrido + } + add_artifact_history = { + type = inherited + date = 905.3.1 + recipient = character:167970 #Gotofredo + } + add_artifact_history = { + type = inherited + date = 910.8.4 + recipient = character:167971 #Gausberto + } + add_artifact_history = { + type = inherited + date = 940.1.1 + recipient = character:167972 #Uberto + } + add_artifact_history = { + type = inherited + date = 941.11.1 + recipient = character:167973 #Adalberto + } + add_artifact_history = { + type = inherited + date = 967.1.1 + recipient = character:7727 #Aleramo Aleramicci + } + add_artifact_history = { + type = inherited + date = 991.1.1 + recipient = character:7728 #Ottone I + } + add_artifact_history = { + type = inherited + date = 991.6.1 + recipient = character:7729 #Guglielmo I + } + add_artifact_history = { + type = inherited + date = 941.11.1 + recipient = character:167973 #Adalberto + } + add_artifact_title_history = { + target = title:e_hre + date = 1039.2.4 + } + save_scope_as = epic + } +} + +create_artifact_nikephoros_crown_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = nikephoros_crown_name + description = nikephoros_crown_description + type = pedestal + visuals = pedestal_justinian + template = justinian_template #Same as Justinian + wealth = scope:wealth + quality = scope:quality + history = { + type = created + date = 963.7.2 + recipient = character:1712 #Nikephoros Phokas + location = province:496 #Constantinople + } + modifier = nikephoros_crown_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = { + name = artifact_succession_title + value = title:e_byzantium + } + add_artifact_title_history = { + target = title:e_byzantium + date = 969.12.10 + } + } +} + +create_artifact_pedestal_shankha_conch_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = artifact_shankha_conch_name + description = artifact_shankha_conch_description + template = branch_hinduism_template + type = pedestal + visuals = small_box + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = shankha_conch_modifier + save_scope_as = newly_created_artifact + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = conch + set_variable = { + name = relic + value = flag:hinduism + } + save_scope_as = epic + } +} + +create_artifact_skull_cap_charlemagne_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = skull_cap_charlemagne_name + description = skull_cap_charlemagne_description + template = general_unique_template + type = pedestal + visuals = head + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = skull_cap_charlemagne_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + } +} + +create_artifact_essen_crown_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = essen_crown_name + description = essen_crown_description + type = pedestal + wealth = scope:wealth + quality = scope:quality + visuals = hre_crown + template = general_unique_template + history = { + type = created + date = 983.1.1 + recipient = character:1288 #Otto III + location = province:2677 #Essen + } + modifier = essen_crown_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + add_artifact_title_history = { + target = title:e_hre + date = 1002.1.23 + } + set_variable = { + name = artifact_succession_title + value = title:e_hre + } + } +} + +create_artifact_dhammapada_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = dhammapada_name + description = dhammapada_description + type = book + visuals = indian_book + wealth = scope:wealth + quality = scope:quality + template = general_unique_template + history = { + type = created_before_history + } + modifier = dhammapada_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = dhammapada + save_scope_as = epic + } +} + +create_artifact_vinaya_pitaka_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = vinaya_pitaka_name + description = vinaya_pitaka_description + type = book + visuals = indian_book + wealth = scope:wealth + quality = scope:quality + template = general_unique_template + history = { + type = created_before_history + } + modifier = vinaya_pitaka_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = vinaya_pitaka + save_scope_as = epic + } +} + +create_artifact_sutta_pitaka_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = sutta_pitaka_name + description = sutta_pitaka_description + type = book + visuals = indian_book + wealth = scope:wealth + quality = scope:quality + template = general_unique_template + history = { + type = created_before_history + } + modifier = sutta_pitaka_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = sutta_pitaka + save_scope_as = epic + } +} + +create_artifact_abhidhamma_pitaka_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = abhidhamma_pitaka_name + description = abhidhamma_pitaka_description + type = book + visuals = indian_book + wealth = scope:wealth + quality = scope:quality + template = general_unique_template + history = { + type = created_before_history + } + modifier = abhidhamma_pitaka_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = abhidhamma + save_scope_as = epic + } +} + +create_artifact_qadib_al_mulk_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = qadib_al_mulk_name + description = qadib_al_mulk_description + template = regalia_template + type = regalia + visuals = regalia + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + date = 670.1.1 #To order entries correctly + } + modifier = qadib_al_mulk_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = qadib_al_mulk + save_scope_as = epic + set_variable = { + name = artifact_succession_title + value = title:d_shiite #Caliphate + } + add_artifact_title_history = { + target = title:d_shiite #Caliphate + date = 881.1.1 + } + } +} + +create_artifact_al_dawat_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = al_dawat_name + description = al_dawat_description + template = general_unique_template + type = pedestal + visuals = small_box + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + date = 670.1.1 #To order entries correctly + } + modifier = al_dawat_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = al_dawat + set_variable = { + name = artifact_succession_title + value = title:d_shiite #Caliphate + } + save_scope_as = epic + add_artifact_title_history = { + target = title:d_shiite #Caliphate + date = 881.1.1 + } + } +} + +create_artifact_al_hafir_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = al_hafir_name + description = al_hafir_description + template = general_unique_template + type = pedestal + visuals = diamond + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + date = 670.1.1 #To order entries correctly + } + modifier = al_hafir_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = al_hafir + set_variable = { + name = artifact_succession_title + value = title:d_shiite #Caliphate + } + save_scope_as = epic + add_artifact_title_history = { + target = title:d_shiite #Caliphate + date = 881.1.1 + } + } +} + +create_artifact_al_sayf_al_khass_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = al_sayf_al_khass_name + description = al_sayf_al_khass_description + template = general_unique_template + type = pedestal + visuals = wall_muhammad_sword + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + date = 670.1.1 #To order entries correctly + } + modifier = al_sayf_al_khass_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = al_sayf_al_khass + save_scope_as = epic + set_variable = { + name = artifact_succession_title + value = title:d_shiite #Caliphate + } + add_artifact_title_history = { + target = title:d_shiite #Caliphate + date = 881.1.1 + } + } +} + +create_artifact_durendal_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = artifact_durendal_name + description = artifact_durendal_description + template = general_unique_template + type = pedestal + visuals = wall_cid_sword + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = durendal_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = durendal + save_scope_as = epic + } +} + +create_artifact_nagelring_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = artifact_nagelring_name + description = artifact_nagelring_description + template = general_unique_template + type = pedestal + visuals = wall_cid_sword + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = nagelring_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = nagelring + save_scope_as = epic + } +} + +create_artifact_szczerbiec_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_szczerbiec_name + description = artifact_szczerbiec_description + template = general_unique_template + type = pedestal + visuals = wall_szczerbiec_sword + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = szczerbiec_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = szczerbiec + save_scope_as = epic + } +} + +create_artifact_kladenets_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = artifact_kladenets_name + description = artifact_kladenets_description + template = general_unique_template + type = pedestal + visuals = sword_court + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = kladenets_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = kladenets + save_scope_as = epic + } +} + +create_artifact_legbiter_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_legbiter_name + description = artifact_legbiter_description + template = general_unique_template + type = pedestal + visuals = sword_court + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = legbiter_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = legbiter + save_scope_as = epic + } +} + +create_artifact_quernbiter_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_quernbiter_name + description = artifact_quernbiter_description + template = general_unique_template + type = pedestal + visuals = sword_court + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = quernbiter_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = quernbiter + save_scope_as = epic + } +} + +create_artifact_dragvandil_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_dragvandil_name + description = artifact_dragvandil_description + template = general_unique_template + type = pedestal + visuals = sword_court + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = dragvandil_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = dragvandil + save_scope_as = epic + } +} + +create_artifact_curtana_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_curtana_name + description = artifact_curtana_description + template = general_unique_template + type = pedestal + visuals = sword_court + wealth = scope:wealth + quality = scope:quality + history = { + type = created + date = 1042.6.9 + recipient = character:114 #Eadward the Confessor + location = province:1527 #Lunden + } + modifier = curtana_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = curtana + save_scope_as = epic + add_artifact_title_history = { + target = title:k_england + date = 1066.1.5 + } + } +} + +create_colada_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = artifact_colada_name + description = artifact_colada_description + template = general_unique_template + type = pedestal + visuals = sword_court + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = colada_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = colada + save_scope_as = epic + } +} + +create_artifact_angelicas_ring_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = artifact_ring_angelica_name + description = artifact_ring_angelica_description + template = general_unique_template + type = pedestal + visuals = ring_court + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = angelicas_ring_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = angelica_ring + save_scope_as = epic + } +} + +create_artifact_olifant_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = artifact_olifant_name + description = artifact_olifant_description + template = general_unique_template + type = pedestal + visuals = olifant_court + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = olifant_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = olifant + add_artifact_modifier = artifact_courtier_and_guest_opinion_4_modifier + add_artifact_modifier = artifact_court_grandeur_baseline_add_3_modifier + save_scope_as = epic + } +} + +create_artifact_aram_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = artifact_aram_name + description = artifact_aram_description + template = general_unique_template + type = pedestal + visuals = spear_court + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = aram_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = aram + save_scope_as = epic + } +} + +create_artifact_sledovik_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_sledovik_name + description = artifact_sledovik_description + visuals = rock + type = pedestal + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + template = relic_finno_ugric_template + modifier = sledovik_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = { + name = relic + value = flag:finno_ugric_religion + } + add_artifact_modifier = artifact_court_grandeur_baseline_add_2_modifier + save_scope_as = epic + } +} + +create_artifact_kantele_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = artifact_kantele_name + description = artifact_kantele_description + visuals = pedestal_david_harp + type = pedestal + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + template = relic_finno_ugric_template + modifier = kantele_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = kantele + set_variable = { + name = relic + value = flag:finno_ugric_religion + } + save_scope_as = epic + } +} + +#Illustrious Artifacts + +create_artifact_pedestal_david_harp_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_pedestal_david_harp_name + description = artifact_pedestal_david_harp + type = pedestal + template = david_harp_template + visuals = pedestal_david_harp + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + location = province:5965 #Jerusalem + } + modifier = david_harp_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = david_harp + save_scope_as = epic + } +} + +create_artifact_joyeuse_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_joyeuse_name + description = artifact_joyeuse_description + template = general_unique_template + type = pedestal + visuals = wall_cid_sword + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = joyeuse_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = joyeuse + save_scope_as = epic + } +} + +create_artifact_papal_tiara_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = papal_tiara_name + description = papal_tiara_description + template = papal_tiara_template + type = helmet + visuals = pope_tiara + wealth = scope:wealth + quality = scope:quality + history = { + type = created + date = 800.1.1 + recipient = character:7862 #Leo III - fictitious date, probably somewhere between the 8th and 9th centuries + location = province:2575 #Rome + } + modifier = artifact_monthly_piety_4_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = { + name = relic + value = flag:christian + } + set_variable = { + name = artifact_succession_title + value = title:k_papal_state + } + set_variable = { + name = pope_hat + value = yes + } + add_artifact_title_history = { + target = title:k_papal_state + date = 816.6.12 + } + add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_2_modifier + } +} + +create_artifact_sculpture_ark_of_covenant_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_sculpture_ark_of_covenant_name + description = artifact_sculpture_ark_of_covenant_description + type = sculpture + template = ark_covenant_template + visuals = sculpture_ark_of_covenant + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = ark_of_covenant_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = ark_of_the_covenant + save_scope_as = epic + save_scope_value_as = { + name = ark_covenant + value = yes + } + } +} + +create_artifact_pedestal_koh_i_noor_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_pedestal_koh_i_noor_name + description = artifact_pedestal_koh_i_noor_description + template = general_unique_template + type = pedestal + visuals = diamond + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = koh_i_noor + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = koh_i_noor + save_scope_as = epic + } +} + +create_artifact_al_taj_crown_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = al_taj_crown_name + description = al_taj_crown_description + template = crown_wearable_template + type = helmet + visuals = al_taj_crown + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + date = 670.1.1 #To order entries correctly + } + modifier = al_taj_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = al_taj + save_scope_as = epic + set_variable = { + name = artifact_succession_title + value = title:d_shiite #Caliphate + } + add_artifact_title_history = { + target = title:d_shiite #Caliphate + date = 881.1.1 + } + } +} + +create_artifact_wall_banner_thankfulness_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_wall_banner_thankfulness_name + description = artifact_wall_banner_thankfulness_description + template = banner_thankfulness + type = wall_big + visuals = banner_islam + visuals_source = title:d_sunni + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + date = 670.1.1 #To order entries correctly + } + modifier = banner_thankfulness + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = banner_thankfulness + save_scope_as = epic + set_variable = { + name = artifact_succession_title + value = title:d_shiite #Caliphate + } + add_artifact_title_history = { + target = title:d_shiite #Caliphate + date = 881.1.1 + } + } +} + +create_artifact_arms_of_alexander_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_arms_of_alex_name + description = artifact_arms_of_alex_description + template = general_unique_template + type = pedestal + visuals = pedestal_alexander_armor + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = alexander_the_great_armor_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = arms_of_alex + save_scope_as = epic + } +} + +create_artifact_turquoise_throne_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + type = throne_special + template = general_unique_template + visuals = throne_turquoise + wealth = scope:wealth + quality = scope:quality + name = turquoise_throne_name + description = turquoise_throne_description + history = { + type = created_before_history + } + modifier = turquoise_throne_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = turquoise_throne + save_scope_as = epic + } +} + +create_artifact_peacock_throne_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + type = throne_special + template = general_unique_template + visuals = throne_peacock + wealth = scope:wealth + quality = scope:quality + name = peacock_throne_name + description = peacock_throne_description + history = { + type = created_before_history + } + modifier = peacock_throne_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = peacock_throne + save_scope_as = epic + } +} + +create_artifact_spear_of_the_prophet_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_spear_of_the_prophet_name + description = artifact_spear_of_the_prophet_description + type = pedestal + visuals = spear_court + template = islam_artifact_template + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = spear_prophet_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = spear_of_the_prophet + save_scope_as = epic + set_variable = { + name = artifact_succession_title + value = title:d_sunni + } + } +} + +create_artifact_mantle_of_the_prophet_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_mantle_of_the_prophet_islam_name + description = artifact_mantle_of_the_prophet_description + template = islam_artifact_template + type = regalia_simple + visuals = regalia + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = mantle_prophet_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = { + name = relic + value = flag:islamic + } + set_variable = mantle_of_prophet + save_scope_as = epic + set_variable = { + name = artifact_succession_title + value = title:d_sunni + } + } +} + +create_artifact_sculpture_babr_e_bayan_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_sculpture_armor_babr_name + description = artifact_sculpture_armor_babr + type = sculpture + template = babr_template + visuals = sculpture_babr_e_bayan + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = babr_e_bayan_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = babr_e_bayan + save_scope_as = epic + } +} + +create_artifact_pedestal_justinian_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_pedestal_crown_justinian_name + description = artifact_pedestal_crown_justinian + type = pedestal + template = justinian_template + visuals = pedestal_justinian + wealth = scope:wealth + quality = scope:quality + history = { + type = created + date = 527.4.1 + recipient = character:70512 #Justinian the Great + location = province:496 #Constantinople + } + modifier = justinian_crown_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + set_variable = crown_of_justinian + add_artifact_title_history = { + target = title:e_byzantium + date = 565.11.14 + } + save_scope_as = epic + } +} + +create_artifact_statue_constantine_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = artifact_statue_constantine_name + description = artifact_statue_constantine + type = sculpture + visuals = statue_constantine + wealth = scope:wealth + quality = scope:quality + template = statue_constantine_template + history = { + type = created + date = 330.1.1 + recipient = character:70523 #Constantine the Great + location = province:496 #Constantinople + } + modifier = statue_constantine_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = statue_constantine + save_scope_as = epic + add_artifact_title_history = { + target = title:e_byzantium + date = 330.1.1 + } + } +} + +create_artifact_tree_automa_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_tree_automa_name + description = artifact_tree_automa + type = pedestal + visuals = tree_automa + wealth = scope:wealth + quality = scope:quality + template = tree_automa_template + history = { + type = created_before_history + } + modifier = tree_automa_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + #set_variable = tree_automa + save_scope_as = epic + add_artifact_title_history = { + target = title:e_byzantium + date = 940.1.1 + } + } +} + +create_artifact_statue_four_tetrarchs_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = artifact_statue_four_tetrarchs_name + description = artifact_statue_four_tetrarchs_desc + type = wall_small + visuals = statue_four_tetarchs + wealth = scope:wealth + quality = scope:quality + template = tree_automa_template + history = { + type = created_before_history + } + modifier = statue_four_tetrarchs_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + save_scope_as = epic + add_artifact_title_history = { + target = title:e_byzantium + date = 940.1.1 + } + } +} + +create_artifact_statue_roman_woman_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + set_artifact_rarity_famed = yes + + # Create the artifact + create_artifact = { + name = artifact_statue_roman_woman_name + description = artifact_statue_roman_woman_desc + type = sculpture + visuals = statue_roman_woman + wealth = scope:wealth + quality = scope:quality + template = statue_roman_woman_template + history = { + type = created_before_history + } + modifier = statue_roman_woman_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + save_scope_as = epic + add_artifact_title_history = { + target = title:e_byzantium + date = 940.1.1 + } + } +} + +create_artifact_hydraulic_organ_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_hydraulic_organ_name + description = artifact_hydraulic_organ_desc + type = sculpture + visuals = hydraulic_organ + wealth = scope:wealth + quality = scope:quality + template = hydraulic_organ_template + history = { + type = created_before_history + } + modifier = hydraulic_organ_modifier + save_scope_as = newly_created_artifact + decaying = no + } + + scope:newly_created_artifact = { + set_variable = { name = historical_unique_artifact value = yes } + save_scope_as = epic + add_artifact_title_history = { + target = title:e_byzantium + date = 940.1.1 + } + } +} diff --git a/N3OW/common/scripted_effects/02_dlc_ep1_decision_scripted_effects.txt b/N3OW/common/scripted_effects/02_dlc_ep1_decision_scripted_effects.txt new file mode 100644 index 00000000..d2362d4e --- /dev/null +++ b/N3OW/common/scripted_effects/02_dlc_ep1_decision_scripted_effects.txt @@ -0,0 +1,37 @@ +################################################## +# Court Grandeur +################################################## + +order_mass_eviction_decision_guests_only_effect = { + # Give us a neat tooltip. + show_as_tooltip = { + every_pool_guest = { + custom = custom.every_guest + move_to_pool = yes + } + } + # And actually do the moving. + hidden_effect = { + every_pool_guest = { select_and_move_to_pool_effect = yes } + } +} + +order_mass_eviction_decision_courtiers_&_guests_effect = { + # Give us a neat tooltip. + show_as_tooltip = { + every_courtier_or_guest = { + custom = custom.every_guest_and_unimportant_courtier + move_to_pool = yes + } + } + # And actually do the moving. + hidden_effect = { + every_pool_guest = { select_and_move_to_pool_effect = yes } + every_courtier = { + limit = { + order_mass_eviction_decision_evictable_courtier_trigger = yes + } + select_and_move_to_pool_effect = yes + } + } +} diff --git a/N3OW/common/scripted_effects/02_ep2_artifact_effects.txt b/N3OW/common/scripted_effects/02_ep2_artifact_effects.txt new file mode 100644 index 00000000..d38bc9b3 --- /dev/null +++ b/N3OW/common/scripted_effects/02_ep2_artifact_effects.txt @@ -0,0 +1,1364 @@ +generate_romantic_trinket_effect = { + $OWNER$ = { save_scope_as = owner } #Will always exist! + random_list = { + 50 = { #lock of hair + create_artifact = { + name = lock_of_hair + description = lock_of_hair.desc + type = miscellaneous + visuals = medallion + modifier = artifact_seduce_scheme_phase_duration_mult_1_modifier + modifier = artifact_spouse_opinion_add_3_modifier + save_scope_as = romantic_trinket + wealth = 20 + quality = 20 + max_durability = 30 + generate_history = no + } + } + 50 = { #ribbon with house embrodery + create_artifact = { + name = house_ribbon + description = house_ribbon.desc + type = miscellaneous + visuals = pocket_fancy_case + modifier = artifact_monthly_dynasty_prestige_2_modifier + modifier = artifact_spouse_opinion_add_1_modifier + save_scope_as = romantic_trinket + wealth = 25 + quality = 25 + max_durability = 30 + generate_history = no + } + } + 50 = { #necklace with initials + create_artifact = { + name = initials_necklace + description = initials_necklace.desc + type = miscellaneous + visuals = necklace + modifier = artifact_monthly_prestige_2_modifier + modifier = artifact_spouse_opinion_add_3_modifier + save_scope_as = romantic_trinket + wealth = 40 + quality = 40 + max_durability = 30 + generate_history = no + } + } + 50 = { #brooch with marriage prayer + create_artifact = { + name = marriage_prayer_brooch + description = marriage_prayer_brooch.desc + type = miscellaneous + visuals = brooch + modifier = artifact_monthly_piety_2_modifier + modifier = artifact_spouse_opinion_add_3_modifier + save_scope_as = romantic_trinket + wealth = 35 + quality = 35 + max_durability = 30 + generate_history = no + } + } + 10 = { #wooden phallus + create_artifact = { + name = wooden_phallus + description = wooden_phallus.desc + type = miscellaneous + visuals = small_box + modifier = artifact_fertility_gain_2_modifier + modifier = artifact_spouse_opinion_add_4_modifier + save_scope_as = romantic_trinket + wealth = 20 + quality = 20 + max_durability = 30 + generate_history = no + } + } + } +} + +generate_tournament_trinket_effect = { + $TRINKET_RECEIVER$ = { save_scope_as = trinket_receiver } + $TRINKET_GIVER$ = { save_scope_as = trinket_giver } + + random_list = { + 50 = { # feather + create_artifact = { + name = feather_trinket + description = feather_trinket.desc + type = miscellaneous + visuals = bird_feather + modifier = artifact_courtly_vassal_opinion_3_modifier + modifier = artifact_attraction_opinion_2_modifier + save_scope_as = purchasable_trinket + wealth = 20 + quality = 20 + max_durability = 30 + generate_history = no + } + } + 50 = { # chess piece + create_artifact = { + name = chess_trinket + description = chess_trinket.desc + type = miscellaneous + visuals = pocket_figurine + modifier = artifact_monthly_dynasty_prestige_2_modifier + save_scope_as = purchasable_trinket + wealth = 25 + quality = 25 + max_durability = 30 + generate_history = no + } + } + 50 = { # ribbon + create_artifact = { + name = ribbon_trinket + description = ribbon_trinket.desc + type = miscellaneous + visuals = pocket_fancy_case + modifier = artifact_monthly_prestige_2_modifier + modifier = artifact_seduce_scheme_phase_duration_mult_1_modifier + save_scope_as = purchasable_trinket + wealth = 30 + quality = 30 + max_durability = 30 + generate_history = no + } + } + 50 = { # glass orb + create_artifact = { + name = glass_orb_trinket + description = glass_orb_trinket.desc + type = miscellaneous + visuals = flask + modifier = artifact_monthly_piety_2_modifier + save_scope_as = purchasable_trinket + wealth = 35 + quality = 35 + max_durability = 30 + generate_history = no + } + } + 50 = { # tapestry + create_artifact = { + name = tapestry_trinket + description = tapestry_trinket.desc + type = miscellaneous + visuals = tapestry + modifier = artifact_fertility_gain_2_modifier + save_scope_as = purchasable_trinket + wealth = 40 + quality = 40 + max_durability = 30 + generate_history = no + } + } + } +} + +generate_personalised_sword_effect = { + random_list = { + 5 = { + trigger = { + has_trait = brave + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_prowess_4_modifier + } + } + 5 = { + trigger = { + has_trait = craven + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_retreat_losses_4_modifier + } + } + 5 = { + trigger = { + has_trait = calm + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_diplomacy_1_modifier + } + } + 5 = { + trigger = { + has_trait = wrathful + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_pursue_efficiency_4_modifier + } + } + 5 = { + trigger = { + has_trait = chaste + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_health_gain_2_modifier + } + } + 5 = { + trigger = { + has_trait = lustful + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_seduce_scheme_phase_duration_add_4_modifier + } + } + 5 = { + trigger = { + has_trait = content + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_courtier_and_guest_opinion_4_modifier + } + } + 5 = { + trigger = { + has_trait = ambitious + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_4_modifier + } + } + 5 = { + trigger = { + has_trait = diligent + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_development_growth_2_modifier + } + } + 5 = { + trigger = { + has_trait = lazy + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_stress_gain_2_modifier + } + } + 5 = { + trigger = { + has_trait = fickle + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_mercenary_hire_cost_mult_4_modifier + } + } + 5 = { + trigger = { + has_trait = stubborn + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_stewardship_per_stress_level_2_modifier + } + } + 5 = { + trigger = { + has_trait = forgiving + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_diplomacy_per_prestige_level_modifier + } + } + 5 = { + trigger = { + has_trait = vengeful + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_intrigue_per_stress_level_2_modifier + } + } + 5 = { + trigger = { + has_trait = generous + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_monthly_prestige_gain_per_happy_powerful_vassal_add_4_modifier + } + } + 5 = { + trigger = { + has_trait = greedy + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_monthly_income_4_modifier + } + } + 5 = { + trigger = { + has_trait = gregarious + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_befriend_scheme_phase_duration_add_4_modifier + } + } + 5 = { + trigger = { + has_trait = shy + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_learning_per_stress_level_2_modifier + } + } + 5 = { + trigger = { + has_trait = honest + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_short_reign_duration_mult_4_modifier + } + } + 5 = { + trigger = { + has_trait = deceitful + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_intrigue_1_modifier + } + } + 5 = { + trigger = { + has_trait = humble + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_powerful_vassal_opinion_4_modifier + } + } + 5 = { + trigger = { + has_trait = arrogant + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_monthly_prestige_4_modifier + } + } + 5 = { + trigger = { + has_trait = just + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_stewardship_1_modifier + } + } + 5 = { + trigger = { + has_trait = arbitrary + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_tolerance_advantage_mod_4_modifier + } + } + 5 = { + trigger = { + has_trait = patient + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_learning_1_modifier + } + } + 5 = { + trigger = { + has_trait = impatient + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_scheme_resistance_add_2_modifier + } + } + 5 = { + trigger = { + has_trait = temperate + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_levy_reinforcement_rate_2_modifier + } + } + 5 = { + trigger = { + has_trait = gluttonous + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_fertility_gain_4_modifier + } + } + 5 = { + trigger = { + has_trait = trusting + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_courtier_and_guest_opinion_4_modifier + } + } + 5 = { + trigger = { + has_trait = paranoid + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_scheme_resistance_add_2_modifier + } + } + 5 = { + trigger = { + has_trait = zealous + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_monthly_piety_4_modifier + } + } + 5 = { + trigger = { + has_trait = cynical + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_different_faith_opinion_4_modifier + } + } + 5 = { + trigger = { + has_trait = compassionate + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_general_opinion_1_modifier + } + } + 5 = { + trigger = { + has_trait = callous + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_monthly_tyranny_4_modifier + } + } + 5 = { + trigger = { + has_trait = sadistic + } + scope:artisanal_sword = { + add_artifact_modifier = artifact_dread_gain_mult_4_modifier + } + } + } +} + +assign_sword_names_effect = { + random_list = { + 10 = { #Standard, male + trigger = { + NOT = { has_character_flag = sword_name_widowmaker } + is_female = no + } + add_character_flag = sword_name_widowmaker + } + 10 = { #Standard, female + trigger = { + NOT = { has_character_flag = sword_name_widowermaker } + is_female = yes + } + add_character_flag = sword_name_widowermaker + } + 10 = { #Standard + trigger = { + NOT = { has_character_flag = sword_name_slicer } + } + add_character_flag = sword_name_slicer + } + 10 = { #Standard + trigger = { + NOT = { has_character_flag = sword_name_dicer } + } + add_character_flag = sword_name_dicer + } + 10 = { #Standard + trigger = { + NOT = { has_character_flag = sword_name_kingsbane } + is_female = no + } + add_character_flag = sword_name_kingsbane + } + 10 = { #Standard + trigger = { + NOT = { has_character_flag = sword_name_queensbane } + is_female = yes + } + add_character_flag = sword_name_queensbane + } + + #TRAITS + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_triumph } + has_trait = brave + } + add_character_flag = sword_name_triumph + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_fears_bane } + has_trait = craven + } + add_character_flag = sword_name_fears_bane + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_tranquility } + has_trait = calm + } + add_character_flag = sword_name_tranquility + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_reaper } + has_trait = wrathful + } + add_character_flag = sword_name_reaper + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_purity } + has_trait = chaste + } + add_character_flag = sword_name_purity + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_beguiler } + has_trait = lustful + } + add_character_flag = sword_name_beguiler + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_assurance } + has_trait = content + } + add_character_flag = sword_name_assurance + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_fate } + has_trait = ambitious + } + add_character_flag = sword_name_fate + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_grinder } + has_trait = diligent + } + add_character_flag = sword_name_grinder + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_indolence } + has_trait = lazy + } + add_character_flag = sword_name_indolence + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_quicksilver } + has_trait = fickle + } + add_character_flag = sword_name_quicksilver + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_obstinate } + has_trait = stubborn + } + add_character_flag = sword_name_obstinate + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_mercy } + has_trait = forgiving + } + add_character_flag = sword_name_mercy + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_vengeance } + has_trait = vengeful + } + add_character_flag = sword_name_vengeance + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_charity } + has_trait = generous + } + add_character_flag = sword_name_charity + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_opulence } + has_trait = greedy + } + add_character_flag = sword_name_opulence + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_amity } + has_trait = gregarious + } + add_character_flag = sword_name_amity + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_solitude } + has_trait = shy + } + add_character_flag = sword_name_solitude + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_candour } + has_trait = honest + } + add_character_flag = sword_name_candour + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_deceiver } + has_trait = deceitful + } + add_character_flag = sword_name_deceiver + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_humility } + has_trait = humble + } + add_character_flag = sword_name_humility + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_glory } + has_trait = arrogant + } + add_character_flag = sword_name_glory + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_justice } + has_trait = just + } + add_character_flag = sword_name_justice + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_whimsy } + has_trait = arbitrary + } + add_character_flag = sword_name_whimsy + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_serenity } + has_trait = patient + } + add_character_flag = sword_name_serenity + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_ardent } + has_trait = impatient + } + add_character_flag = sword_name_ardent + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_prudence } + has_trait = temperate + } + add_character_flag = sword_name_prudence + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_devourer } + has_trait = gluttonous + } + add_character_flag = sword_name_devourer + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_steadfast } + has_trait = trusting + } + add_character_flag = sword_name_steadfast + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_safeguard } + has_trait = paranoid + } + add_character_flag = sword_name_safeguard + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_faith } + has_trait = zealous + } + add_character_flag = sword_name_faith + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_doubt } + has_trait = cynical + } + add_character_flag = sword_name_doubt + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_clemency } + has_trait = compassionate + } + add_character_flag = sword_name_clemency + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_malice } + has_trait = sadistic + } + add_character_flag = sword_name_malice + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_desolation } + has_trait = callous + } + add_character_flag = sword_name_desolation + } + + # Non-Personality + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_bloodletter } + has_trait = berserker + } + add_character_flag = sword_name_bloodletter + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_fealty } + has_trait = loyal + } + add_character_flag = sword_name_fealty + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_oathbreaker } + has_trait = disloyal + } + add_character_flag = sword_name_oathbreaker + } + 10 = { + trigger = { + NOT = { has_character_flag = sword_name_raconteur } + has_trait = lifestyle_poet + } + add_character_flag = sword_name_raconteur + } + + #CULTURE/FAITH + # From the Matter of France + 10 = { #The sword of Archbishop Turpin + trigger = { + NOT = { has_character_flag = sword_name_almace } + culture = { has_cultural_pillar = heritage_frankish } + } + add_character_flag = sword_name_almace + } + 10 = { #Oliver's sword + trigger = { + NOT = { has_character_flag = sword_name_hauteclere } + culture = { has_cultural_pillar = heritage_frankish } + } + add_character_flag = sword_name_hauteclere + } + 10 = { #Ganelon's Sword + trigger = { + NOT = { has_character_flag = sword_name_murgleis } + culture = { has_cultural_pillar = heritage_frankish } + has_trait = deceitful #C'est Ganelon, ce rat traître! + } + add_character_flag = sword_name_murgleis + } + 10 = { #Renaud de Montauban's sword + trigger = { + NOT = { has_character_flag = sword_name_flamberge } + culture = { has_cultural_pillar = heritage_frankish } + } + add_character_flag = sword_name_flamberge + } + + #From Arthurian myth + 10 = { #Lancelot's sword + trigger = { + NOT = { has_character_flag = sword_name_arondight } + OR = { + culture = { has_cultural_pillar = heritage_goidelic } + culture = { has_cultural_pillar = heritage_brythonic } + } + } + add_character_flag = sword_name_arondight + } + 10 = { #The sword Mordred stole and later killed Arthur with + trigger = { + NOT = { has_character_flag = sword_name_clarent } + has_trait = sadistic #lil bit of flavour + OR = { + culture = { has_cultural_pillar = heritage_goidelic } + culture = { has_cultural_pillar = heritage_brythonic } + } + } + add_character_flag = sword_name_clarent + } + 10 = { #Lancelot's dad's sword + trigger = { + NOT = { has_character_flag = sword_name_coreiseuse } + OR = { + culture = { has_cultural_pillar = heritage_goidelic } + culture = { has_cultural_pillar = heritage_brythonic } + } + } + add_character_flag = sword_name_coreiseuse + } + 10 = { #Gawain's sword + trigger = { + NOT = { has_character_flag = sword_name_galatine } + OR = { + culture = { has_cultural_pillar = heritage_goidelic } + culture = { has_cultural_pillar = heritage_brythonic } + } + } + add_character_flag = sword_name_galatine + } + + #General Mythical/Historical + 10 = { #From the Volsunga Saga + trigger = { + NOT = { has_character_flag = sword_name_gramr } + culture = { has_cultural_pillar = heritage_north_germanic } + } + add_character_flag = sword_name_gramr + } + 10 = { #From the Tyrfing Cycle + trigger = { + NOT = { has_character_flag = sword_name_tyrfing } + culture = { has_cultural_pillar = heritage_north_germanic } + } + add_character_flag = sword_name_tyrfing + } + 10 = { #Heime's sword + trigger = { + NOT = { has_character_flag = sword_name_blutgang } + culture = { has_cultural_pillar = heritage_north_germanic } + } + add_character_flag = sword_name_blutgang + } + 10 = { #The legendary sword given to the Prophet Muhammad + trigger = { + NOT = { has_character_flag = sword_name_zulfiqar } + has_religion = religion:islam_religion + } + add_character_flag = sword_name_zulfiqar + } + 10 = { #The sword that killed Medusa + trigger = { + NOT = { has_character_flag = sword_name_harpe } + culture = { has_cultural_pillar = heritage_byzantine } + } + add_character_flag = sword_name_harpe + } + 10 = { #Saint George's sword + trigger = { + NOT = { has_character_flag = sword_name_ascalon } + has_religion = religion:christianity_religion + } + add_character_flag = sword_name_ascalon + } + 10 = { #Brahma's sword + trigger = { + NOT = { has_character_flag = sword_name_asi } + has_religion = religion:hinduism_religion + } + add_character_flag = sword_name_asi + } + 10 = { #Fergus mac Róich's sword + trigger = { + NOT = { has_character_flag = sword_name_caladgolg } + culture = { has_cultural_pillar = heritage_goidelic } + } + add_character_flag = sword_name_caladgolg + } + 10 = { #The Answerer, Irish mythological sword + trigger = { + NOT = { has_character_flag = sword_name_fragarach } + culture = { has_cultural_pillar = heritage_goidelic } + } + add_character_flag = sword_name_fragarach + } + 10 = { #Ravana's sword, gifted by Shiva + trigger = { + NOT = { has_character_flag = sword_name_chandrahas } + has_religion = religion:hinduism_religion + } + add_character_flag = sword_name_chandrahas + } + 10 = { #Vishnu's sword + trigger = { + NOT = { has_character_flag = sword_name_nandaka } + has_religion = religion:hinduism_religion + } + add_character_flag = sword_name_nandaka + } + + #Just for fun + 5 = { + trigger = { + NOT = { has_character_flag = sword_name_old_pokey } + } + add_character_flag = sword_name_old_pokey + } + 5 = { #Arya Stark's sword + trigger = { # Lots of people name their swords + NOT = { has_character_flag = sword_name_needle } # Yeah, lots of... + } + add_character_flag = sword_name_needle + } + 5 = { + trigger = { + NOT = { has_character_flag = sword_name_stabitha } + } + add_character_flag = sword_name_stabitha + } + 5 = { #LOTR reference, because duh + trigger = { + NOT = { has_character_flag = sword_name_marsil } + } + add_character_flag = sword_name_marsil + } + } +} + +remove_sword_flags_effect = { + if = { + limit = { + has_character_flag = sword_name_widowmaker + } + remove_character_flag = sword_name_widowmaker + } + if = { + limit = { + has_character_flag = sword_name_widowermaker + } + remove_character_flag = sword_name_widowermaker + } + if = { + limit = { + has_character_flag = sword_name_slicer + } + remove_character_flag = sword_name_slicer + } + if = { + limit = { + has_character_flag = sword_name_dicer + } + remove_character_flag = sword_name_dicer + } + if = { + limit = { + has_character_flag = sword_name_kingsbane + } + remove_character_flag = sword_name_kingsbane + } + if = { + limit = { + has_character_flag = sword_name_queensbane + } + remove_character_flag = sword_name_queensbane + } + if = { + limit = { + has_character_flag = sword_name_almace + } + remove_character_flag = sword_name_almace + } + if = { + limit = { + has_character_flag = sword_name_hauteclere + } + remove_character_flag = sword_name_hauteclere + } + if = { + limit = { + has_character_flag = sword_name_murgleis + } + remove_character_flag = sword_name_murgleis + } + if = { + limit = { + has_character_flag = sword_name_flamberge + } + remove_character_flag = sword_name_flamberge + } + if = { + limit = { + has_character_flag = sword_name_arondight + } + remove_character_flag = sword_name_arondight + } + if = { + limit = { + has_character_flag = sword_name_clarent + } + remove_character_flag = sword_name_clarent + } + if = { + limit = { + has_character_flag = sword_name_coreiseuse + } + remove_character_flag = sword_name_coreiseuse + } + if = { + limit = { + has_character_flag = sword_name_galatine + } + remove_character_flag = sword_name_galatine + } + if = { + limit = { + has_character_flag = sword_name_gramr + } + remove_character_flag = sword_name_gramr + } + if = { + limit = { + has_character_flag = sword_name_tyrfing + } + remove_character_flag = sword_name_tyrfing + } + if = { + limit = { + has_character_flag = sword_name_zulfiqar + } + remove_character_flag = sword_name_zulfiqar + } + if = { + limit = { + has_character_flag = sword_name_harpe + } + remove_character_flag = sword_name_harpe + } + if = { + limit = { + has_character_flag = sword_name_ascalon + } + remove_character_flag = sword_name_ascalon + } + if = { + limit = { + has_character_flag = sword_name_asi + } + remove_character_flag = sword_name_asi + } + if = { + limit = { + has_character_flag = sword_name_caladgolg + } + remove_character_flag = sword_name_caladgolg + } + if = { + limit = { + has_character_flag = sword_name_fragarach + } + remove_character_flag = sword_name_fragarach + } + if = { + limit = { + has_character_flag = sword_name_chandrahas + } + remove_character_flag = sword_name_chandrahas + } + if = { + limit = { + has_character_flag = sword_name_nandaka + } + remove_character_flag = sword_name_nandaka + } + if = { + limit = { + has_character_flag = sword_name_old_pokey + } + remove_character_flag = sword_name_old_pokey + } + if = { + limit = { + has_character_flag = sword_name_needle + } + remove_character_flag = sword_name_needle + } + if = { + limit = { + has_character_flag = sword_name_stabitha + } + remove_character_flag = sword_name_stabitha + } + if = { + limit = { + has_character_flag = sword_name_marsil + } + remove_character_flag = sword_name_marsil + } + if = { + limit = { + has_character_flag = sword_name_kingsbane + } + remove_character_flag = sword_name_kingsbane + } + if = { + limit = { + has_character_flag = sword_name_queensbane + } + remove_character_flag = sword_name_queensbane + } + if = { + limit = { + has_character_flag = sword_name_triumph + } + remove_character_flag = sword_name_triumph + } + if = { + limit = { + has_character_flag = sword_name_fears_bane + } + remove_character_flag = sword_name_fears_bane + } + if = { + limit = { + has_character_flag = sword_name_tranquility + } + remove_character_flag = sword_name_tranquility + } + if = { + limit = { + has_character_flag = sword_name_reaper + } + remove_character_flag = sword_name_reaper + } + if = { + limit = { + has_character_flag = sword_name_purity + } + remove_character_flag = sword_name_purity + } + if = { + limit = { + has_character_flag = sword_name_beguiler + } + remove_character_flag = sword_name_beguiler + } + if = { + limit = { + has_character_flag = sword_name_assurance + } + remove_character_flag = sword_name_assurance + } + if = { + limit = { + has_character_flag = sword_name_fate + } + remove_character_flag = sword_name_fate + } + if = { + limit = { + has_character_flag = sword_name_grinder + } + remove_character_flag = sword_name_grinder + } + if = { + limit = { + has_character_flag = sword_name_indolence + } + remove_character_flag = sword_name_indolence + } + if = { + limit = { + has_character_flag = sword_name_quicksilver + } + remove_character_flag = sword_name_quicksilver + } + if = { + limit = { + has_character_flag = sword_name_steadfast + } + remove_character_flag = sword_name_steadfast + } + if = { + limit = { + has_character_flag = sword_name_mercy + } + remove_character_flag = sword_name_mercy + } + if = { + limit = { + has_character_flag = sword_name_vengeance + } + remove_character_flag = sword_name_vengeance + } + if = { + limit = { + has_character_flag = sword_name_charity + } + remove_character_flag = sword_name_charity + } + if = { + limit = { + has_character_flag = sword_name_opulence + } + remove_character_flag = sword_name_opulence + } + if = { + limit = { + has_character_flag = sword_name_amity + } + remove_character_flag = sword_name_amity + } + if = { + limit = { + has_character_flag = sword_name_solitude + } + remove_character_flag = sword_name_solitude + } + if = { + limit = { + has_character_flag = sword_name_candour + } + remove_character_flag = sword_name_candour + } + if = { + limit = { + has_character_flag = sword_name_deceiver + } + remove_character_flag = sword_name_deceiver + } + if = { + limit = { + has_character_flag = sword_name_humility + } + remove_character_flag = sword_name_humility + } + if = { + limit = { + has_character_flag = sword_name_glory + } + remove_character_flag = sword_name_glory + } + if = { + limit = { + has_character_flag = sword_name_justice + } + remove_character_flag = sword_name_justice + } + if = { + limit = { + has_character_flag = sword_name_whimsy + } + remove_character_flag = sword_name_whimsy + } + if = { + limit = { + has_character_flag = sword_name_serenity + } + remove_character_flag = sword_name_serenity + } + if = { + limit = { + has_character_flag = sword_name_ardent + } + remove_character_flag = sword_name_ardent + } + if = { + limit = { + has_character_flag = sword_name_prudence + } + remove_character_flag = sword_name_prudence + } + if = { + limit = { + has_character_flag = sword_name_devourer + } + remove_character_flag = sword_name_devourer + } + if = { + limit = { + has_character_flag = sword_name_steadfast + } + remove_character_flag = sword_name_steadfast + } + if = { + limit = { + has_character_flag = sword_name_safeguard + } + remove_character_flag = sword_name_safeguard + } + if = { + limit = { + has_character_flag = sword_name_faith + } + remove_character_flag = sword_name_faith + } + if = { + limit = { + has_character_flag = sword_name_doubt + } + remove_character_flag = sword_name_doubt + } + if = { + limit = { + has_character_flag = sword_name_clemency + } + remove_character_flag = sword_name_clemency + } + if = { + limit = { + has_character_flag = sword_name_malice + } + remove_character_flag = sword_name_malice + } + if = { + limit = { + has_character_flag = sword_name_desolation + } + remove_character_flag = sword_name_desolation + } + if = { + limit = { + has_character_flag = sword_name_bloodletter + } + remove_character_flag = sword_name_bloodletter + } + if = { + limit = { + has_character_flag = sword_name_fealty + } + remove_character_flag = sword_name_fealty + } + if = { + limit = { + has_character_flag = sword_name_oathbreaker + } + remove_character_flag = sword_name_oathbreaker + } + if = { + limit = { + has_character_flag = sword_name_raconteur + } + remove_character_flag = sword_name_raconteur + } +} diff --git a/N3OW/common/scripted_effects/03_bp1_haunted_by_ghosts_effects.txt b/N3OW/common/scripted_effects/03_bp1_haunted_by_ghosts_effects.txt new file mode 100644 index 00000000..ca9f0341 --- /dev/null +++ b/N3OW/common/scripted_effects/03_bp1_haunted_by_ghosts_effects.txt @@ -0,0 +1,77 @@ +################################################## + +# Scripted effect to determine what sin you have and what virtue you should strive for +bp1_yearly_9026_determine_sin_and_virtue = { + if = { + limit = { + OR = { + has_trait = greedy + has_trait = gluttonous + has_trait = chaste + } + } + random_owned_story = { + type = story_being_visited_by_angry_ghosts + set_variable = { + name = trait_to_gain + value = 1 #generous + } + } + } + else_if = { + limit = { + OR = { + has_trait = murderer + any_secret = { + type = secret_murder + } + has_trait = wrathful + has_trait = vengeful + } + } + random_owned_story = { + type = story_being_visited_by_angry_ghosts + set_variable = { + name = trait_to_gain + value = 2 # forgiving + } + } + } + else = { + random_owned_story = { + type = story_being_visited_by_angry_ghosts + set_variable = { + name = trait_to_gain + value = 3 #compassionate + } + } + } +} + +# Increase good deeds and give a tooltip for it +bp1_increase_good_deeds = { + custom_tooltip = { + text = bp1_increase_good_deeds_tt + random_owned_story = { + type = story_being_visited_by_angry_ghosts + change_variable = { + name = good_deeds + add = 1 + } + } + } +} + +# Increase good deeds and give a tooltip for it +bp1_decrease_good_deeds = { + custom_tooltip = { + text = bp1_decrease_good_deeds_tt + random_owned_story = { + type = story_being_visited_by_angry_ghosts + change_variable = { + name = good_deeds + subtract = 1 + } + } + } +} diff --git a/N3OW/common/scripted_effects/03_bp1_scripted_effects.txt b/N3OW/common/scripted_effects/03_bp1_scripted_effects.txt new file mode 100644 index 00000000..962d7cb7 --- /dev/null +++ b/N3OW/common/scripted_effects/03_bp1_scripted_effects.txt @@ -0,0 +1,1223 @@ +##### FAMILY FEUD ##### + +### START EFFECTS ### + +# Start Feud, set variables, modifiers, relations, and stress +house_feud_start_effect = { + # Save scopes + $ACTOR$.house.house_head = { save_scope_as = starter_house_head } + $TARGET$.house.house_head = { save_scope_as = house_feud_rival } + $ATTACKER$ = { save_scope_as = house_feud_attacker } + $VICTIM$ = { save_scope_as = house_feud_victim } + # Save extra scopes if relevant + save_scope_value_as = { + name = house_feud_reason + value = flag:$REASON$ + } + if = { + limit = { + scope:house_feud_reason = flag:competing_claim + NOT = { exists = scope:house_feud_claim } + } + scope:house_feud_victim = { + ordered_claim = { + limit = { any_claimant = { this = scope:house_feud_attacker } } + order_by = tier + save_scope_as = house_feud_claim + } + } + } + if = { + limit = { + scope:starter_house_head.house != scope:house_feud_rival.house + house_relation_is_valid_to_start_trigger = { + HOUSE = scope:starter_house_head.house + OTHER_HOUSE = scope:house_feud_rival.house + } + } + # Save target House for reference + scope:starter_house_head ?= { + house = { + set_house_relation = { + target = scope:house_feud_rival.house + level = feud + description = house_relation_reason_feud_$REASON$ + save_scope_as = relation + } + } + scope:relation ?= { + set_variable = { + name = house_feud_cooldown + years = 25 + } + } + } + scope:starter_house_head ?= { + # Relations: Nemesis if already Rivals, else Rival + if = { + limit = { + has_relation_rival = scope:house_feud_rival + NOT = { has_relation_nemesis = scope:house_feud_rival } + can_set_relation_nemesis_trigger = { CHARACTER = scope:house_feud_rival } + } + set_relation_nemesis = { + reason = nemesis_house_feud + copy_reason = rival + target = scope:house_feud_rival + } + } + else_if = { + limit = { + NOT = { has_relation_rival = scope:house_feud_rival } + } + set_relation_rival = { + target = scope:house_feud_rival + reason = rival_house_feud_start_of_feud + } + } + # Stress + stress_impact = { vengeful = minor_stress_impact_loss } + house_feud_forgiving_stress_effect = yes + } + # Save reasons for reference + scope:relation = { + # Save Feud attacker + set_variable = { name = house_feud_attacker value = scope:house_feud_attacker } + # Save Feud victim + set_variable = { name = house_feud_victim value = scope:house_feud_victim } + set_variable = { name = house_feud_house_1 value = scope:house_feud_attacker.house } + set_variable = { name = house_feud_house_2 value = scope:house_feud_victim.house } + # Save Feud starters + set_variable = { name = house_feud_house_1_first_head value = scope:starter_house_head } + set_variable = { name = house_feud_house_2_first_head value = scope:house_feud_rival } + set_variable = { name = house_feud_house_1_score value = 0 } + set_variable = { name = house_feud_house_2_score value = 0 } + # Save start reason flavor + set_variable = { name = house_feud_reason value = flag:$REASON$ } + # Move starting score/save flavor if relevant + if = { + limit = { exists = var:house_feud_reason } + switch = { + trigger = var:house_feud_reason + flag:head_killed = { + change_variable = { name = house_feud_house_1_score add = house_feud_medium_counter_value } + } + flag:family_killed = { + change_variable = { name = house_feud_house_1_score add = house_feud_medium_counter_value } + } + flag:head_cuckolded = { + change_variable = { name = house_feud_house_1_score add = house_feud_minor_counter_value } + } + flag:family_cuckolded = { + change_variable = { name = house_feud_house_1_score add = house_feud_minor_counter_value } + } + flag:competing_claim = { + set_variable = { name = house_feud_title value = scope:house_feud_claim } + } + flag:head_tortured = { + if = { + limit = { + scope:house_feud_victim = { has_character_flag = house_feud_blinding_flag } + } + set_variable = { name = house_feud_reason value = flag:head_blinded } + } + else_if = { + limit = { + scope:house_feud_victim = { has_character_flag = house_feud_castration_flag } + } + set_variable = { name = house_feud_reason value = flag:head_castrated } + } + } + flag:family_tortured = { + if = { + limit = { + scope:house_feud_victim = { has_character_flag = house_feud_blinding_flag } + } + set_variable = { name = house_feud_reason value = flag:family_blinded } + } + else_if = { + limit = { + scope:house_feud_victim = { has_character_flag = house_feud_castration_flag } + } + set_variable = { name = house_feud_reason value = flag:family_castrated } + } + } + flag:head_cuckolded = { + if = { + limit = { NOT = { exists = scope:house_feud_spouse } } + scope:house_feud_victim = { random_spouse = { save_scope_as = house_feud_spouse } } + } + set_variable = { name = house_feud_spouse value = scope:house_feud_spouse } + } + flag:family_broke_gw_betrothal = { + if = { + limit = { scope:starter_house_head = scope:house_feud_victim } + set_variable = { name = house_feud_reason value = flag:head_broke_gw_betrothal } + } + } + } + } + # Invalidate exit + if = { + limit = { + NAND = { + exists = var:house_feud_house_1 + exists = var:house_feud_house_2 + exists = var:house_feud_house_1_first_head + exists = var:house_feud_house_2_first_head + exists = var:house_feud_house_1_score + exists = var:house_feud_house_2_score + exists = var:house_feud_reason + } + } + # Variable is missing! Ending story prematurely. + debug_log = "House Feud invalidated" + debug_log_scopes = yes + end_story = yes + } + # Inform House Members feud has started + every_relation_house = { + every_house_member = { + limit = { is_ai = no } + # Explanatory Tooltips + send_interface_message = { + type = house_feud_begins_message + left_icon = scope:starter_house_head + right_icon = scope:house_feud_rival + show_as_tooltip = { + scope:starter_house_head = { + #Show as tooltip does not require a reason + if = { + limit = { has_relation_nemesis = scope:house_feud_rival } + set_relation_nemesis = scope:house_feud_rival + } + else = { set_relation_rival = scope:house_feud_rival } + } + } + } + # deprecated + #trigger_event = { + # id = bp1_house_feud.0600 + # days = 5 + #} + } + } + } + ### MEMORY + scope:starter_house_head ?= { + create_character_memory = { + type = house_feud_started_memory + participants = { + house_head = scope:house_feud_rival + attacker = scope:house_feud_attacker + victim = scope:house_feud_victim + } + } + ordered_memory = { + limit = { + has_memory_type = house_feud_started_memory + any_memory_participant = { this = scope:house_feud_rival } + } + order_by = memory_creation_date + set_variable = { + name = house_feud_reason + value = scope:relation.var:house_feud_reason + } + if = { + limit = { exists = scope:relation.var:house_feud_title } + set_variable = { + name = house_feud_title + value = scope:relation.var:house_feud_title + } + } + if = { + limit = { exists = scope:relation.var:house_feud_spouse } + set_variable = { + name = house_feud_spouse + value = scope:relation.var:house_feud_spouse + } + } + } + } + } +} + +### END EFFECTS ### + +# End current Feud +#house_feud_end_story_effect = { +# # Explanatory tooltip +# custom_tooltip = house_feud_end_tt +# # End Story Cycle +# random_owned_story = { +# limit = { story_type = story_cycle_house_feud } +# end_story = yes +# } +#} + +# Clear up and set modifiers based on Feud score or fallback +#house_feud_end_modifier_effect = { +# if = { +# limit = { +# NOT = { exists = scope:story } +# exists = house.house_head +# house.house_head = { +# any_owned_story = { story_type = story_cycle_house_feud } +# } +# } +# house.house_head = { +# random_owned_story = { +# limit = { story_type = story_cycle_house_feud } +# save_scope_as = story +# } +# } +# } +# if = { +# limit = { exists = scope:story } +# scope:story = { +# if = { +# limit = { exists = var:house_feud_house.house_head } +# var:house_feud_house.house_head = { save_scope_as = house_feud_rival } +# } +# if = { +# limit = { +# exists = scope:house_feud_rival +# scope:house_feud_rival = { is_alive = yes } +# } +# story_owner = { +# # Remove Nemesis when ending Feud if relevant +# if = { +# limit = { has_relation_nemesis = scope:house_feud_rival } +# hidden_effect = { remove_relation_nemesis = scope:house_feud_rival } +# set_relation_rival = { +# target = scope:house_feud_rival +# reason = rival_house_feud_no_longer_nemesis +# } +# } +# # Otherwise remove Rival +# else_if = { +# limit = { has_relation_rival = scope:house_feud_rival } +# remove_relation_rival = scope:house_feud_rival +# } +# house = { +# every_house_member = { +# limit = { is_ai = yes } +# if = { +# limit = { has_relation_nemesis = scope:house_feud_rival } +# hidden_effect = { remove_relation_nemesis = scope:house_feud_rival } +# set_relation_rival = { +# target = scope:house_feud_rival +# reason = rival_house_feud_no_longer_nemesis +# } +# } +# # Otherwise remove Rival +# else_if = { +# limit = { has_relation_rival = scope:house_feud_rival } +# remove_relation_rival = scope:house_feud_rival +# } +# } +# } +# } +# } +# if = { +# limit = { +# exists = var:house_feud_death_counter +# exists = var:house_feud_kill_counter +# } +# # Reward modifiers based on score +# # If losing badly, worst modifier +# if = { +# limit = { house_feud_balance_value <= -3 } +# story_owner.house = { +# add_house_modifier = { +# modifier = house_feud_terrible_modifier +# years = 25 +# desc = house_feud_terrible_modifier_custom_desc +# } +# } +# } +# # If losing, bad modifier +# else_if = { +# limit = { house_feud_balance_value < -0.5 } +# story_owner.house = { +# add_house_modifier = { +# modifier = house_feud_bad_modifier +# years = 25 +# desc = house_feud_bad_modifier_custom_desc +# } +# } +# } +# # If similar, average modifier +# else_if = { +# limit = { +# house_feud_balance_value >= -0.5 +# house_feud_balance_value <= 0.5 +# } +# story_owner.house = { +# add_house_modifier = { +# modifier = house_feud_even_modifier +# years = 25 +# desc = house_feud_even_modifier_custom_desc +# } +# } +# } +# # If winning, decent modifier +# else_if = { +# limit = { +# house_feud_balance_value > 0.5 +# house_feud_balance_value < 3 +# } +# story_owner.house = { +# add_house_modifier = { +# modifier = house_feud_good_modifier +# years = 25 +# desc = house_feud_good_modifier_custom_desc +# } +# } +# } +# # If winning alot, good modifier +# else_if = { +# limit = { house_feud_balance_value >= 3 } +# story_owner.house = { +# add_house_modifier = { +# modifier = house_feud_excellent_modifier +# years = 25 +# desc = house_feud_excellent_modifier_custom_desc +# } +# } +# } +# story_owner.house = { +# custom_tooltip = house_reward_modifier_tt +# } +# } +# # Give good modifier as fallback or if Feud targets were wiped out +# else = { +# story_owner.house = { +# add_house_modifier = { +# modifier = house_feud_excellent_modifier +# years = 25 +# desc = house_feud_excellent_modifier_custom_desc +# } +# } +# } +# # Remove ongoing modifier +# story_owner.house = { remove_house_modifier = house_feud_story_modifier } +# } +# } +# custom_tooltip = house_feud_cooldown_tt +#} + +# Shared stress effect for Vengeful characters +house_feud_vengeful_stress_effect = { + stress_impact = { + vengeful = major_stress_impact_gain + arbitrary = medium_stress_impact_gain + wrathful = minor_stress_impact_gain + brave = minor_stress_impact_gain + ambitious = minor_stress_impact_gain + arrogant = minor_stress_impact_gain + } +} + +house_feud_forgiving_stress_effect = { + stress_impact = { + forgiving = major_stress_impact_gain + just = medium_stress_impact_gain + calm = minor_stress_impact_gain + craven = minor_stress_impact_gain + content = minor_stress_impact_gain + humble = minor_stress_impact_gain + } +} + + +### SCOPE EFFECTS ### + +# Save attacker and rival scopes for reference +house_feud_save_head_and_attacker_effect = { + house.house_head = { save_scope_as = house_feud_rival } + save_scope_as = house_feud_attacker +} + +### MESSAGE EFFECTS ### + +# Send Feud continued message to player House members on inheritance +#house_feud_send_continues_message_effect = { +# # Flag to block starting more than one Feud per lifetime in most cases (House Head cuckoldry and torture are exceptions) +# add_character_flag = had_house_feud_story +# house = { +# every_house_member = { +# limit = { is_ai = no } +# hidden_effect = { +# send_interface_message = { +# type = house_feud_continues_message +# left_icon = root +# right_icon = scope:house_feud_rival +# title = msg_house_feud_continues +# desc = msg_house_feud_continues_desc +# } +# } +# } +# } +#} + +### ACTION EFFECTS ### + +# Feud cuckoldry score and event effects +house_feud_lover_exposure_effect = { + hidden_effect = { + if = { + limit = { + has_bp1_dlc_trigger = yes + is_married = yes + any_spouse = { + exists = house.house_head + house.house_head ?= { + valid_for_feud_events_with_target_trigger = { TARGET = scope:sex_partner } + NOT = { + accepts_adultery_without_penalty_trigger = yes + } + } + } + } + # Save cheating spouse scope for reference + save_scope_as = house_feud_spouse + # Save cuckolder's scopes for reference + scope:sex_partner = { house_feud_save_head_and_attacker_effect = yes } + every_spouse = { + limit = { + house.house_head ?= { + valid_for_feud_events_with_target_trigger = { TARGET = scope:sex_partner } + } + } + # Save cuckolded spouse for reference + save_scope_as = house_feud_victim + house.house_head = { + # Chance for House Head to have option to start Feud + random = { + chance = 75 + modifier = { + add = 25 + has_trait = vengeful + } + modifier = { + add = -25 + has_trait = forgiving + } + modifier = { + add = -25 + has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:sex_partner } + } + # House Head version + if = { + limit = { is_spouse_of = scope:house_feud_spouse } + trigger_event = { + id = bp1_house_feud.0013 + days = { 5 15 } + } + } + # Close family version + else = { + trigger_event = { + id = bp1_house_feud.0014 + days = { 5 15 } + } + } + } + } + } + } + # Score and message effects + if = { + limit = { + exists = scope:sex_partner.house.house_head + any_spouse = { + save_temporary_scope_as = house_feud_cuckolded_temp_1 + scope:sex_partner = { + house_has_feud_relation_with_trigger = { TARGET = scope:house_feud_cuckolded_temp_1 } + } + save_temporary_scope_as = house_feud_cuckolded_temp_2 + } + } + scope:house_feud_cuckolded_temp_2 = { save_scope_as = house_feud_cuckolded } + scope:sex_partner.house = { + change_house_relation_feud_score_effect = { + TARGET = scope:house_feud_cuckolded.house + REASON = cuckolded + VALUE = house_feud_minor_counter_value + } + # If original Feud reason was cuckolding, fire revenge event for House Head + if = { + limit = { + any_house_relation = { + has_house_relation_level = feud + any_relation_house = { + NOT = { this = scope:sex_partner.house } + this = scope:house_feud_cuckolded.house + } + OR = { + var:house_feud_reason ?= flag:head_cuckolded + var:house_feud_reason ?= flag:family_cuckolded + } + var:house_feud_attacker ?= scope:house_feud_cuckolded + NOT = { exists = var:feud_avenged } + } + } + house_head = { + trigger_event = { id = bp1_house_feud.7003 days = 15 } + } + } + } + } + } +} + +# Feud torture score and event effects +house_feud_torture_event_effect = { + hidden_effect = { + # Tortured belongs to torturer's Houses's Feud target House + scope:actor.house ?= { + change_house_relation_feud_score_effect = { + TARGET = scope:recipient.house + REASON = torture + VALUE = house_feud_minor_counter_value + } + # If originial Feud reason was Torture, fire revenge event for House Head + if = { + limit = { + any_house_relation = { + has_house_relation_level = feud + OR = { + var:house_feud_victim.house ?= scope:actor.house + var:house_feud_reason ?= flag:head_tortured + var:house_feud_reason ?= flag:family_tortured + } + var:house_feud_attacker ?= scope:recipient + NOT = { exists = var:feud_avenged } + } + } + house_head = { + trigger_event = { id = bp1_house_feud.7002 days = 15 } + } + } + } + scope:recipient.house.house_head ?= { + # Chance for tortured House to start a Feud if eligible + if = { + limit = { + valid_for_feud_events_with_target_trigger = { TARGET = scope:actor } + } + random_list = { + # Give House Head option to start Feud + 25 = { + modifier = { + add = 25 + has_trait = vengeful + } + modifier = { + add = -25 + has_trait = forgiving + } + scope:actor = { house_feud_save_head_and_attacker_effect = yes } + scope:recipient = { + save_scope_as = house_feud_victim + house.house_head = { + if = { + limit = { this = scope:house_feud_victim } + trigger_event = { + id = bp1_house_feud.0010 # Version for tortured House Heads + days = { 5 15 } + } + } + else = { + trigger_event = { + id = bp1_house_feud.0011 # Version for tortured close family + days = { 5 15 } + } + } + } + } + } + # Clean up tortured's flags if no Feud started + 50 = { + scope:recipient = { + if = { + limit = { has_character_flag = house_feud_castration_flag } + remove_character_flag = house_feud_castration_flag + } + else_if = { + limit = { has_character_flag = house_feud_blinding_flag } + remove_character_flag = house_feud_blinding_flag + } + else_if = { + limit = { has_character_flag = house_feud_disfigured_flag } + remove_character_flag = house_feud_disfigured_flag + } + } + } + } + } + } + } +} + +set_war_memory_casus_belli_effect = { + save_scope_as = memory + scope:war = { + casus_belli = { + if = { + limit = { + any_target_title = { } + } + ordered_target_title = { + order_by = tier + save_scope_as = war_target + } + scope:memory = { + set_variable = { name = war_title value = scope:war_target } + } + } + if = { + limit = { exists = claimant } + claimant = { save_scope_as = war_claimant } + scope:memory = { + set_variable = { name = war_claimant value = scope:war_claimant } + } + } + } + scope:memory = { + set_variable = { + name = war_attacker + value = scope:war.primary_attacker + } + } + if = { # claim + limit = { + OR = { + using_cb = claim_cb + using_cb = claimant_faction_war + } + } + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_claim } + } + } + else_if = { # conquest + limit = { + OR = { + using_cb = county_conquest_cb + using_cb = duchy_conquest_cb + using_cb = county_struggle_cb + using_cb = fp2_mediterranean_conquest_cb + using_cb = nomadic_conquest_cb + using_cb = nomadic_conquest_duchy_cb + using_cb = domination_cb + using_cb = de_jure_cb_nomadic + using_cb = japan_install_bloc_member_cb + using_cb = japan_soryo_conquest_county_landless_cb + using_cb = japan_soryo_conquest_county_cb + } + } + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_conquest } + } + } + else_if = { # holy + limit = { + OR = { + using_cb = minor_religious_war + using_cb = religious_war + using_cb = major_religious_war + } + } + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_holy_war } + set_variable = { name = war_faith value = scope:war.primary_defender.faith } + set_variable = { name = war_faith_attacker value = scope:war.primary_attacker.faith } + } + } + else_if = { # de jure + limit = { + OR = { + using_cb = de_jure_cb + using_cb = individual_county_de_jure_cb + using_cb = individual_duchy_de_jure_cb + using_cb = japan_imperial_reconquest_cb + } + } + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_de_jure } + scope:war_target = { + ordered_this_title_or_de_jure_above = { + limit = { holder.top_liege = scope:war.primary_attacker } + order_by = tier + save_scope_as = war_liege + } + } + if = { + limit = { exists = scope:war_liege } + set_variable = { name = war_liege value = scope:war_liege } + } + } + } + else_if = { # invasion + limit = { + OR = { + using_cb = mpo_nomad_invasion_cb + using_cb = invasion_war + using_cb = clan_invasion_war + using_cb = mongol_invasion_war + using_cb = mongol_realm_invasion_war + using_cb = ep3_laamp_adventurer_county_invasion + using_cb = ep3_laamp_adventurer_duchy_invasion + using_cb = ep3_laamp_adventurer_kingdom_invasion + using_cb = ep3_laamp_adventurer_empire_invasion + using_cb = mpo_gok_onslaught_cb + using_cb = japan_imperial_expansion_cb + } + } + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_invasion } + } + } + else_if = { # ghw + limit = { + OR = { + using_cb = undirected_great_holy_war + using_cb = directed_great_holy_war + } + } + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_ghw } + set_variable = { name = war_faith value = scope:war.primary_defender.faith } + set_variable = { name = war_faith_attacker value = scope:war.primary_attacker.faith } + } + } + else_if = { # independence + limit = { + OR = { + using_cb = independence_war + using_cb = independence_faction_war + using_cb = tributary_independence_war + } + } + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_independence } + } + } + else_if = { # artifact + limit = { + OR = { + using_cb = artifact_war + using_cb = reclaim_relic_artifact_war + } + } + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_artifact } + } + } + else_if = { # populist + limit = { using_cb = populist_war } + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_populist } + set_variable = { name = war_faith value = scope:war.primary_defender.faith } + set_variable = { name = war_culture value = scope:war.primary_defender.culture } + } + } + else_if = { # subjugation + limit = { + OR = { + using_cb = tribal_subjugation_cb + using_cb = make_tributary_cb + using_cb = retaliation_cb + } + } + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_subjugation } + } + } + else_if = { # border + limit = { + OR = { + using_cb = fp2_border_raid + using_cb = sovereignty_cb + } + } + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_border } + } + } + else_if = { # government + limit = { + OR = { + using_cb = japan_demand_administrative_cb + using_cb = japan_refused_ritsuryo_cb + using_cb = japan_establish_soryo_administration_cb + } + } + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_government } + set_variable = { name = war_gov value = scope:war.primary_attacker.government_type } + } + } + else_if = { # bloc + limit = { + OR = { + using_cb = japan_bloc_war_cb + using_cb = japan_install_bloc_member_cb + } + } + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_bloc } + set_variable = { name = war_bloc value = scope:war.primary_attacker.house.house_confederation } + } + } + else = { + switch = { + trigger = using_cb + liberty_faction_war = { # liberty + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_liberty } + } + } + depose_war = { # depose + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_depose } + } + } + refused_liege_demand_war = { # tyranny + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_tyranny } + } + } + nation_fracturing_faction_war = { # fracture + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_fracture } + } + } + ducal_conquest_cb = { # ducal conquest + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_ducal_conquest } + } + } + imperial_reconquest_cb = { # imperial reconquest + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_imperial_reconquest } + } + } + dismantle_holy_pretender_cb = { # holy pretender + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_holy_pretender } + } + } + dismantle_byz_pretender_cb = { # byz pretender + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_byz_pretender } + } + } + excommunication_war = { # excommunicate + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_excommunicate } + } + } + flowery_war_cb = { # flower + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_flower } + } + } + vassalization_cb = { + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_vassalization } + } + } + fp1_varangian_adventurer_conquest = { + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_varangian } + } + } + fp1_scandi_adventurer_conquest = { + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_varangian } + } + } + fp2_expel_interloper = { + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_expel } + } + } + diarch_vassalisation_cb = { + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_vassalization } + } + } + remove_regent_cb = { + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_regent } + } + } + norman_conquest_cb = { + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_claim } + } + } + norwegian_invasion_cb = { + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_claim } + } + } + hungarian_migration_cb = { + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_invasion } + } + } + sons_of_lothbrok_invasion_cb = { + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_invasion } + } + } + peasant_war = { + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_peasant } + } + } + replace_ceremonial_regent_faction_war = { + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_depose } + } + } + fallback = { + scope:memory = { + set_variable = { name = war_cb value = flag:war_memory_cb_fallback } + } + } + } + } + } + if = { # Error culler + limit = { + exists = scope:memory.var:war_cb + OR = { + scope:memory.var:war_cb = flag:war_memory_cb_fallback + scope:memory.var:war_cb = flag:war_memory_cb_holy_war + scope:memory.var:war_cb = flag:war_memory_cb_imperial_reconquest + scope:memory.var:war_cb = flag:war_memory_cb_conquest + scope:memory.var:war_cb = flag:war_memory_cb_claim + scope:memory.var:war_cb = flag:war_memory_cb_de_jure + scope:memory.var:war_cb = flag:war_memory_cb_ducal_conquest + scope:memory.var:war_cb = flag:war_memory_cb_holy_pretender + scope:memory.var:war_cb = flag:war_memory_cb_byz_pretender + scope:memory.var:war_cb = flag:war_memory_cb_invasion + scope:memory.var:war_cb = flag:war_memory_cb_independence + scope:memory.var:war_cb = flag:war_memory_cb_liberty + scope:memory.var:war_cb = flag:war_memory_cb_depose + scope:memory.var:war_cb = flag:war_memory_cb_fracture + scope:memory.var:war_cb = flag:war_memory_cb_excommunicate + scope:memory.var:war_cb = flag:war_memory_cb_flower + scope:memory.var:war_cb = flag:war_memory_cb_ghw + scope:memory.var:war_cb = flag:war_memory_cb_artifact + scope:memory.var:war_cb = flag:war_memory_cb_subjugation + scope:memory.var:war_cb = flag:war_memory_cb_vassalization + scope:memory.var:war_cb = flag:war_memory_cb_varangian + scope:memory.var:war_cb = flag:war_memory_cb_border + scope:memory.var:war_cb = flag:war_memory_cb_expel + scope:memory.var:war_cb = flag:war_memory_cb_regent + scope:memory.var:war_cb = flag:war_memory_cb_tyranny + scope:memory.var:war_cb = flag:war_memory_cb_government + scope:memory.var:war_cb = flag:war_memory_cb_bloc + } + } + } +} + +copy_war_memory_casus_belli_effect = { + if = { + limit = { exists = $MEMORY$.var:war_cb } + set_variable = { + name = war_cb + value = $MEMORY$.var:war_cb + } + if = { + limit = { exists = $MEMORY$.var:war_attacker } + set_variable = { + name = war_attacker + value = $MEMORY$.var:war_attacker + } + } + if = { + limit = { exists = $MEMORY$.var:war_title } + set_variable = { + name = war_title + value = $MEMORY$.var:war_title + } + } + if = { + limit = { exists = $MEMORY$.var:war_claimant } + set_variable = { + name = war_claimant + value = $MEMORY$.var:war_claimant + } + } + if = { + limit = { exists = $MEMORY$.var:war_faith } + set_variable = { + name = war_faith + value = $MEMORY$.var:war_faith + } + } + if = { + limit = { exists = $MEMORY$.var:war_culture } + set_variable = { + name = war_culture + value = $MEMORY$.var:war_culture + } + } + if = { + limit = { exists = $MEMORY$.var:war_faith_attacker } + set_variable = { + name = war_faith_attacker + value = $MEMORY$.var:war_faith_attacker + } + } + if = { + limit = { exists = $MEMORY$.var:war_liege } + set_variable = { + name = war_liege + value = $MEMORY$.var:war_liege + } + } + } + else = { + set_variable = { + name = war_cb + value = flag:war_memory_cb_fallback + } + } +} + +set_war_over_memory_casus_belli_effect = { + ordered_memory = { + limit = { + has_memory_type = $STANCE$_war + any_memory_participant = { this = scope:$OTHER$ } + } + order_by = memory_creation_date + save_scope_as = war_memory + } + ordered_memory = { + limit = { + has_memory_type = war_$OUTCOME$ + any_memory_participant = { this = scope:$SELF$ } + any_memory_participant = { this = scope:$OTHER$ } + } + order_by = memory_creation_date + copy_war_memory_casus_belli_effect = { MEMORY = scope:war_memory } + } +} + +house_feud_murder_effect = { + if = { + limit = { + has_bp1_dlc_trigger = yes + exists = $VICTIM$.house.house_head + exists = $MURDERER$.house.house_head + } + $VICTIM$ = { save_scope_as = house_feud_victim } + $MURDERER$ = { save_scope_as = house_feud_attacker } + scope:house_feud_victim = { + save_ongoing_house_relation_effect = { TARGET = scope:house_feud_attacker } + } + # Notifications + # Inform victim house that they have lost score + if = { + limit = { + # Victim's House is targeted by killer's House + scope:house_feud_victim = { + house_has_feud_relation_with_trigger = { TARGET = scope:house_feud_attacker } + } + } + scope:house_feud_attacker.house = { + change_house_relation_feud_score_effect = { + TARGET = scope:house_feud_victim.house + REASON = kill + VALUE = house_feud_medium_counter_value + } + } + scope:relation ?= { + if = { + limit = { + scope:house_feud_attacker.house = var:house_feud_house_1 + } + set_variable = { + name = house_feud_house_1_recent_kill + value = scope:house_feud_victim + months = 6 + } + } + else = { + set_variable = { + name = house_feud_house_2_recent_kill + value = scope:house_feud_victim + months = 6 + } + } + } + } + # Events + # Fire Feud start event for victim house + if = { + limit = { + scope:house_feud_victim.house.house_head ?= { + NOT = { + has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:house_feud_victim } + } + valid_for_feud_events_with_target_trigger = { TARGET = scope:house_feud_attacker } + } + } + scope:house_feud_attacker = { house_feud_save_head_and_attacker_effect = yes } + scope:house_feud_victim.house.house_head = { + random = { + chance = 25 + modifier = { + add = 25 + has_trait = vengeful + } + modifier = { + add = -25 + has_trait = forgiving + } + modifier = { + add = 25 + has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:house_feud_attacker } + } + trigger_event = { + id = bp1_house_feud.0005 + days = { 5 15 } + } + } + } + } + # Fire Feud revenge event for killer house + scope:house_feud_attacker.house = { + if = { + limit = { + any_house_relation = { + has_house_relation_level = feud + any_relation_house = { + NOT = { this = scope:house_feud_attacker.house } + this = scope:house_feud_victim.house + } + OR = { + var:house_feud_reason ?= flag:head_killed + var:house_feud_reason ?= flag:family_killed + } + var:house_feud_attacker ?= scope:house_feud_victim + NOT = { exists = var:feud_avenged } + } + } + house_head = { + trigger_event = { id = bp1_house_feud.7001 days = 15 } + } + } + } + } +} diff --git a/N3OW/common/scripted_effects/03_bp2_scripted_effects.txt b/N3OW/common/scripted_effects/03_bp2_scripted_effects.txt new file mode 100644 index 00000000..94404bf2 --- /dev/null +++ b/N3OW/common/scripted_effects/03_bp2_scripted_effects.txt @@ -0,0 +1,1805 @@ +# Scripted Effects for BP2 + +# Scripted effect to generate a list of relevant characters that might interact with a child +generate_characters_relevant_to_child_list = { + # Grab any family that's around + $CHILD$ = { + every_close_or_extended_family_member = { + limit = { is_relevant_to_child = yes } + add_to_list = relevant_characters_to_child_list + } + } + # Grab relevant court folks + $CHILD$.liege_or_court_owner = { + every_courtier_or_guest = { + limit = { + is_relevant_to_child = yes + } + add_to_list = relevant_characters_to_child_list + } + every_knight = { + limit = { + is_relevant_to_child = yes + } + add_to_list = relevant_characters_to_child_list + } + every_councillor = { + limit = { is_relevant_to_child = yes } + add_to_list = relevant_characters_to_child_list + } + every_court_position_holder = { + limit = { is_relevant_to_child = yes } + add_to_list = relevant_characters_to_child_list + } + } + $CHILD$ = { + every_courtier_or_guest = { + limit = { + is_relevant_to_child = yes + } + add_to_list = relevant_characters_to_child_list + } + every_knight = { + limit = { + is_relevant_to_child = yes + } + add_to_list = relevant_characters_to_child_list + } + every_councillor = { + limit = { is_relevant_to_child = yes } + add_to_list = relevant_characters_to_child_list + } + every_court_position_holder = { + limit = { is_relevant_to_child = yes } + add_to_list = relevant_characters_to_child_list + } + } +} + +# Grab random char relevant to a given child +grab_char_relevant_to_child = { + generate_characters_relevant_to_child_list = { CHILD = $CHILD$ } + random_in_list = { + list = relevant_characters_to_child_list + save_scope_as = $SCOPE_OUTPUT$ + } +} + +# Grab martial character relevant to a given child +grab_martial_char_relevant_to_child = { + generate_characters_relevant_to_child_list = { CHILD = $CHILD$ } + ordered_in_list = { + list = relevant_characters_to_child_list + order_by = { + value = 0 + add = martial + if = { + limit = { is_knight = yes } + add = 25 + } + if = { + limit = { has_court_position = bodyguard_court_position } + add = 20 + } + if = { + limit = { has_court_position = akolouthos_court_position } + add = 20 + } + if = { + limit = { has_court_position = master_of_hunt_court_position } + add = 10 + } + if = { + limit = { this = $CHILD$.liege_or_court_owner.cp:councillor_marshal } + add = 30 + } + if = { + limit = { is_close_or_extended_family_of = $CHILD$ } + add = 10 + } + } + save_scope_as = $SCOPE_OUTPUT$ + } +} + +# Grab learning character relevant to a given child +grab_learning_char_relevant_to_child = { + generate_characters_relevant_to_child_list = { CHILD = $CHILD$ } + ordered_in_list = { + list = relevant_characters_to_child_list + order_by = { + value = 0 + add = learning + if = { + limit = { has_court_position = court_physician_court_position } + add = 20 + } + if = { + limit = { has_court_position = court_tutor_court_position } + add = 20 + } + if = { + limit = { has_court_position = court_guru_court_position } + add = 20 + } + if = { + limit = { + exists = $CHILD$.liege_or_court_owner.cp:councillor_court_chaplain + this = $CHILD$.liege_or_court_owner.cp:councillor_court_chaplain + } + add = 30 + } + if = { + limit = { + $CHILD$ = { is_ruler = yes } + exists = $CHILD$.cp:councillor_court_chaplain + this = $CHILD$.cp:councillor_court_chaplain + } + add = 50 + } + if = { + limit = { is_close_or_extended_family_of = $CHILD$ } + add = 15 + } + } + save_scope_as = $SCOPE_OUTPUT$ + } +} + +adopt_cultural_fashion_culture_effect = { + if = { + limit = { + culture = { + NOT = { has_clothing_gfx = $CULTURE$_clothing_gfx } + } + scope:advanced_culture = { has_clothing_gfx = $CULTURE$_clothing_gfx } + } + set_variable = { + name = adopted_cultural_fashion + value = flag:$CULTURE$ + } + if = { + limit = { + exists = primary_heir + reverse_opinion = { target = primary_heir value >= 50 } + } + primary_heir ?= { + set_variable = { + name = adopted_cultural_fashion + value = flag:$CULTURE$ + } + custom_tooltip = bp2_yearly.6070.change_clothes_heir + } + } + else = { custom_tooltip = bp2_yearly.6070.change_clothes } + } +} + +adopt_cultural_fashion_effect = { + save_scope_as = culture_adopter + if = { + limit = { + NOT = { culture = { has_clothing_gfx = byzantine_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = byzantine_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = byzantine } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = indian_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = indian_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = indian } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = mena_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = mena_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = mena } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = african_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = african_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = african } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = northern_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = northern_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = northern } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = iberian_muslim_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = iberian_muslim_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = iberian_muslim } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = iberian_christian_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = iberian_christian_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = iberian_christian } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = mongol_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = mongol_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = mongol } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = fp1_norse_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = fp1_norse_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = fp1_norse } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = western_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = western_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = western } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = dde_hre_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = dde_hre_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = dde_hre } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = dde_abbasid_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = dde_abbasid_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = dde_abbasid } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = iranian_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = iranian_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = iranian } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = turkic_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = turkic_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = turkic } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = afr_berber_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = afr_berber_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = afr_berber } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = west_slavic_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = west_slavic_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = west_slavic } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = french_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = french_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = french } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = east_slavic_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = east_slavic_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = east_slavic } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = sami_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = sami_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = sami } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = ugro_permian_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = ugro_permian_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = ugro_permian } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = chinese_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = chinese_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = chinese } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = japanese_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = japanese_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = japanese } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = malay_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = malay_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = malay } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = southeast_asian_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = southeast_asian_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = southeast_asian } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = korean_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = korean_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = korean } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = papuan_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = papuan_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = papuan } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = viet_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = viet_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = viet } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = tai_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = tai_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = tai } + } + else_if = { + limit = { + NOT = { culture = { has_clothing_gfx = ainu_clothing_gfx } } + scope:advanced_culture = { has_clothing_gfx = ainu_clothing_gfx } + } + adopt_cultural_fashion_culture_effect = { CULTURE = ainu } + } +} + +bp2_save_traditions_to_consider_effect = { + #Choose a category of tradition root is ready to reform and save a valid tradition from that category + random_list = { + 10 = { + trigger = { + AND = { + has_character_flag = foreign_realm_reforms + scope:advanced_culture = { + any_tradition = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = realm + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + } + } + } + } + } + scope:advanced_culture = { + random_tradition = { + limit = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = realm + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + } + } + save_scope_as = considered_tradition_1 + } + } + add_character_flag = considering_reform_realm + } + 10 = { + trigger = { + AND = { + has_character_flag = foreign_maa_reforms + scope:advanced_culture = { + any_tradition = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = combat + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + } + } + } + } + } + scope:advanced_culture = { + random_tradition = { + limit = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = combat + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + } + } + save_scope_as = considered_tradition_1 + } + } + add_character_flag = considering_reform_maa + } + 10 = { + trigger = { + AND = { + has_character_flag = foreign_social_reforms + scope:advanced_culture = { + any_tradition = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = societal + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + } + } + } + } + } + scope:advanced_culture = { + random_tradition = { + limit = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = societal + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + } + } + save_scope_as = considered_tradition_1 + } + } + add_character_flag = considering_reform_social + } + 10 = { + trigger = { + AND = { + has_character_flag = foreign_ritual_reforms + scope:advanced_culture = { + any_tradition = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = ritual + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + } + } + } + } + } + scope:advanced_culture = { + random_tradition = { + limit = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = ritual + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + } + } + save_scope_as = considered_tradition_1 + } + } + add_character_flag = considering_reform_ritual + } + 10 = { + trigger = { + AND = { + scope:advanced_culture = { + any_tradition = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = regional + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + } + } + } + } + } + scope:advanced_culture = { + random_tradition = { + limit = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = regional + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + } + } + save_scope_as = considered_tradition_1 + } + } + add_character_flag = considering_reform_regional + } + } + #PICK A SECOND + if = { + limit = { + scope:advanced_culture = { + any_tradition = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + } + scope:considered_tradition_1 != this + } + } + } + random_list = { + 10 = { + trigger = { + AND = { + has_character_flag = foreign_realm_reforms + scope:advanced_culture = { + any_tradition = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = realm + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + } + } + } + } + } + scope:advanced_culture = { + random_tradition = { + limit = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = realm + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + } + } + save_scope_as = considered_tradition_2 + #this will be the overall flavor + } + } + } + 10 = { + trigger = { + AND = { + has_character_flag = foreign_maa_reforms + scope:advanced_culture = { + any_tradition = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = combat + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + } + } + } + } + } + scope:advanced_culture = { + random_tradition = { + limit = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = combat + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + } + } + save_scope_as = considered_tradition_2 + #this will be the overall flavor + } + } + } + 10 = { + trigger = { + AND = { + has_character_flag = foreign_social_reforms + scope:advanced_culture = { + any_tradition = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = societal + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + } + } + } + } + } + scope:advanced_culture = { + random_tradition = { + limit = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = societal + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + } + } + save_scope_as = considered_tradition_2 + #this will be the overall flavor + } + } + } + 10 = { + trigger = { + AND = { + has_character_flag = foreign_ritual_reforms + scope:advanced_culture = { + any_tradition = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = ritual + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + } + } + } + } + } + scope:advanced_culture = { + random_tradition = { + limit = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = ritual + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + } + } + save_scope_as = considered_tradition_2 + #this will be the overall flavor + } + } + } + 10 = { + trigger = { + AND = { + scope:advanced_culture = { + any_tradition = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = regional + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + } + } + } + } + } + scope:advanced_culture = { + random_tradition = { + limit = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = regional + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + } + } + save_scope_as = considered_tradition_2 + #this will be the overall flavor + } + } + } + } + } + # PICK A THIRD + if = { + limit = { + scope:advanced_culture = { + any_tradition = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + } + NOT = { + scope:considered_tradition_1 = this + scope:considered_tradition_2 = this + } + } + } + } + random_list = { + 10 = { + trigger = { + AND = { + has_character_flag = foreign_realm_reforms + scope:advanced_culture = { + any_tradition = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = realm + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + scope:considered_tradition_2 = this + } + } + } + } + } + scope:advanced_culture = { + random_tradition = { + limit = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = realm + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + scope:considered_tradition_2 = this + } + } + save_scope_as = considered_tradition_3 + #this will be the overall flavor + } + } + } + 10 = { + trigger = { + AND = { + has_character_flag = foreign_maa_reforms + scope:advanced_culture = { + any_tradition = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = combat + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + scope:considered_tradition_2 = this + } + } + } + } + } + scope:advanced_culture = { + random_tradition = { + limit = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = combat + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + scope:considered_tradition_2 = this + } + } + save_scope_as = considered_tradition_3 + #this will be the overall flavor + } + } + } + 10 = { + trigger = { + AND = { + has_character_flag = foreign_social_reforms + scope:advanced_culture = { + any_tradition = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = societal + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + scope:considered_tradition_2 = this + } + } + } + } + } + scope:advanced_culture = { + random_tradition = { + limit = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = societal + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + scope:considered_tradition_2 = this + } + } + save_scope_as = considered_tradition_3 + #this will be the overall flavor + } + } + } + 10 = { + trigger = { + AND = { + has_character_flag = foreign_ritual_reforms + scope:advanced_culture = { + any_tradition = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = ritual + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + scope:considered_tradition_2 = this + } + } + } + } + } + scope:advanced_culture = { + random_tradition = { + limit = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = ritual + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + scope:considered_tradition_2 = this + } + } + save_scope_as = considered_tradition_3 + #this will be the overall flavor + } + } + } + 10 = { + trigger = { + AND = { + scope:advanced_culture = { + any_tradition = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = regional + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + scope:considered_tradition_2 = this + } + } + } + } + } + scope:advanced_culture = { + random_tradition = { + limit = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = regional + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + scope:considered_tradition_2 = this + } + } + save_scope_as = considered_tradition_3 + #this will be the overall flavor + } + } + } + } + } + #PICK FOURTH + if = { + limit = { + scope:advanced_culture = { + any_tradition = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + } + NOT = { + scope:considered_tradition_1 = this + scope:considered_tradition_2 = this + scope:considered_tradition_3 = this + } + } + } + } + random_list = { + 10 = { + trigger = { + AND = { + has_character_flag = foreign_realm_reforms + scope:advanced_culture = { + any_tradition = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = realm + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + scope:considered_tradition_2 = this + scope:considered_tradition_3 = this + } + } + } + } + } + scope:advanced_culture = { + random_tradition = { + limit = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = realm + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + scope:considered_tradition_2 = this + scope:considered_tradition_3 = this + } + } + save_scope_as = considered_tradition_4 + #this will be the overall flavor + } + } + } + 10 = { + trigger = { + AND = { + has_character_flag = foreign_maa_reforms + scope:advanced_culture = { + any_tradition = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = combat + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + scope:considered_tradition_2 = this + scope:considered_tradition_3 = this + } + } + } + } + } + scope:advanced_culture = { + random_tradition = { + limit = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = combat + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + scope:considered_tradition_2 = this + scope:considered_tradition_3 = this + } + } + save_scope_as = considered_tradition_4 + #this will be the overall flavor + } + } + } + 10 = { + trigger = { + AND = { + has_character_flag = foreign_social_reforms + scope:advanced_culture = { + any_tradition = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = societal + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + scope:considered_tradition_2 = this + scope:considered_tradition_3 = this + } + } + } + } + } + scope:advanced_culture = { + random_tradition = { + limit = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = societal + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + scope:considered_tradition_2 = this + scope:considered_tradition_3 = this + } + } + save_scope_as = considered_tradition_4 + #this will be the overall flavor + } + } + } + 10 = { + trigger = { + AND = { + has_character_flag = foreign_ritual_reforms + scope:advanced_culture = { + any_tradition = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = ritual + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + scope:considered_tradition_2 = this + scope:considered_tradition_3 = this + } + } + } + } + } + scope:advanced_culture = { + random_tradition = { + limit = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = ritual + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + scope:considered_tradition_2 = this + scope:considered_tradition_3 = this + } + } + save_scope_as = considered_tradition_4 + #this will be the overall flavor + } + } + } + 10 = { + trigger = { + AND = { + scope:advanced_culture = { + any_tradition = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = regional + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + scope:considered_tradition_2 = this + scope:considered_tradition_3 = this + } + } + } + } + } + scope:advanced_culture = { + random_tradition = { + limit = { + root = { + can_embrace_tradition = { + tradition = prev + } + } + has_tradition_category = regional + NOR = { + root = { + is_target_in_variable_list = { + name = rejected_traditions + target = prev + } + } + root.culture = { + has_cultural_tradition = prev + } + scope:considered_tradition_1 = this + scope:considered_tradition_2 = this + scope:considered_tradition_3 = this + } + } + save_scope_as = considered_tradition_4 + #this will be the overall flavor + } + } + } + } + } +} + + +#Effect to start the story and show the right modifier +start_rock_story_cycle_effect = { + show_as_tooltip = { + add_character_modifier = { + modifier = rock_story_modifier + } + } + hidden_effect = { + create_story = story_cycle_pet_rock + } +} + +#Pick out name options to show +assign_name_options_rock_story_cycle_effect = { + random_list = { + 1 = { + trigger = { NOT = { has_character_flag = name_cliff } } + add_character_flag = name_cliff + } + 1 = { + trigger = { + NOT = { has_character_flag = name_sandy } + scope:story.var:rock_color = flag:sandy + } + add_character_flag = name_sandy + } + 1 = { + trigger = { NOT = { has_character_flag = name_rocky } } + add_character_flag = name_rocky + } + 1 = { + trigger = { NOT = { has_character_flag = name_crag } } + add_character_flag = name_crag + } + 1 = { + trigger = { NOT = { has_character_flag = name_flint } } + add_character_flag = name_flint + } + 1 = { + trigger = { NOT = { has_character_flag = name_gritty } } + add_character_flag = name_gritty + } + 1 = { + trigger = { NOT = { has_character_flag = name_rubble } } + add_character_flag = name_rubble + } + 1 = { + trigger = { NOT = { has_character_flag = name_tuff } } + add_character_flag = name_tuff + } + 1 = { + trigger = { NOT = { has_character_flag = name_roxanne } } + add_character_flag = name_roxanne + } + 1 = { + trigger = { NOT = { has_character_flag = name_rosetta } } + add_character_flag = name_rosetta + } + 1 = { + trigger = { NOT = { has_character_flag = name_chip } } + add_character_flag = name_chip + } + 1 = { + trigger = { NOT = { has_character_flag = name_fluffy } } + add_character_flag = name_fluffy + } + 1 = { + trigger = { NOT = { has_character_flag = name_sten } } + add_character_flag = name_sten + } + 1 = { + trigger = { NOT = { has_character_flag = name_barney } } + add_character_flag = name_barney + } + 1 = { + trigger = { NOT = { has_character_flag = name_ariadne } } + add_character_flag = name_ariadne + } + 1 = { + trigger = { NOT = { has_character_flag = name_dwayne } } + add_character_flag = name_dwayne + } + 1 = { + trigger = { NOT = { has_character_flag = name_potapczyk } } + add_character_flag = name_potapczyk + } + 1 = { + trigger = { NOT = { has_character_flag = name_gemma } } + add_character_flag = name_gemma + } + } +} + +#Assign the colour of your rock +assign_rock_color_effect = { + save_temporary_scope_value_as = { + name = rock_color + value = flag:$COLOR$ + } + if = { + limit = { scope:rock_color = flag:random } + hidden_effect = { + random_list = { + 50 = { + set_variable = { + name = rock_color + value = flag:brown + } + } + 50 = { + set_variable = { + name = rock_color + value = flag:gray + } + } + 50 = { + set_variable = { + name = rock_color + value = flag:black + } + } + 50 = { + set_variable = { + name = rock_color + value = flag:white + } + } + 50 = { + set_variable = { + name = rock_color + value = flag:sandy + } + } + } + } + } + else_if = { + limit = { + OR = { + scope:rock_color = flag:brown + scope:rock_color = flag:gray + scope:rock_color = flag:black + scope:rock_color = flag:white + scope:rock_color = flag:sandy + } + } + set_variable = { + name = rock_color + value = flag:$COLOR$ + } + } +} + +#Assign the gender of your rock +assign_rock_gender_effect = { + save_temporary_scope_value_as = { + name = gender + value = flag:$GENDER$ + } + if = { + limit = { scope:gender = flag:random } + hidden_effect = { + random_list = { + 50 = { + set_variable = { + name = rock_gender + value = flag:female + } + } + 50 = { + set_variable = { + name = rock_gender + value = flag:male + } + } + } + } + } + else_if = { + limit = { + OR = { + scope:gender = flag:male + scope:gender = flag:female + } + } + set_variable = { + name = rock_gender + value = flag:$GENDER$ + } + } +} + +#Remove everything related to the rock story +remove_rock_story_modifiers_effect = { + if = { + limit = { + has_character_modifier = rock_story_modifier + } + remove_character_modifier = rock_story_modifier + } +} + +remove_rock_name_effect = { + remove_variable = story_cycle_rock_name + remove_localized_text = story_cycle_rock_name +} + diff --git a/N3OW/common/scripted_effects/03_dlc_fp2_scripted_effects.txt b/N3OW/common/scripted_effects/03_dlc_fp2_scripted_effects.txt new file mode 100644 index 00000000..def81cbf --- /dev/null +++ b/N3OW/common/scripted_effects/03_dlc_fp2_scripted_effects.txt @@ -0,0 +1,2141 @@ +################################################## +# Decisions +################################################## + +##### Struggle Ending ##### + +### Common + +# Add all Involved cultures with counties to a list +fp2_struggle_ending_culture_list_effect = { + every_culture_global = { + limit = { + save_temporary_scope_as = this_culture + struggle:iberian_struggle = { is_culture_involved_in_struggle = scope:this_culture } + culture_number_of_counties > 0 + } + save_scope_as = culture_scope + add_to_global_variable_list = { + name = fp2_struggle_ending_culture_list + target = scope:culture_scope + } + } +} + +# Add all Involved independent rulers to a list +fp2_stuggle_ending_involved_list_effect = { + save_scope_as = struggle_ender + struggle:iberian_struggle = { + every_involved_ruler = { + limit = { + top_liege = this + primary_title = { is_mercenary_company = no } + } + add_to_list = struggle_involvees + } + } + # Add all involved cultures with counties to a list, for war checks + fp2_struggle_ending_culture_list_effect = yes + # Add all involved faiths with counties to a list, for marriage and holy war checks + fp2_struggle_ending_faith_list_effect = yes +} + +### Hostility + +# Add all Involved faiths with counties to a list +fp2_struggle_ending_faith_list_effect = { + every_religion_global = { + limit = { + any_faith = { + save_temporary_scope_as = this_faith + struggle:iberian_struggle = { is_faith_involved_in_struggle = scope:this_faith } + num_county_followers > 0 + } + } + every_faith = { + limit = { + struggle:iberian_struggle = { is_faith_involved_in_struggle = prev } + num_county_followers > 0 + } + save_scope_as = faith_scope + add_to_global_variable_list = { + name = fp2_struggle_ending_faith_list + target = scope:faith_scope + } + } + } +} + +# Set cultural acceptance between all Involved cultures +fp2_struggle_hostility_cultural_acceptance_effect = { + hidden_effect = { + while = { + limit = { + any_in_global_list = { + variable = fp2_struggle_ending_culture_list + NOT = { has_variable = fp2_struggle_hostility_flag } + } + } + ordered_in_global_list = { + variable = fp2_struggle_ending_culture_list + limit = { + NOT = { has_variable = fp2_struggle_hostility_flag } + } + order_by = culture_number_of_counties + save_scope_as = culture_scope + set_variable = fp2_struggle_hostility_flag # variable ensures acceptance is only lost once per couple + } + every_in_global_list = { + variable = fp2_struggle_ending_culture_list + limit = { + NOR = { + has_variable = fp2_struggle_hostility_flag + this = scope:culture_scope + } + } + change_cultural_acceptance = { + target = scope:culture_scope + value = fp2_struggle_hostility_culture_acceptance_value + desc = fp2_struggle_hostility_acceptance_tt + } + } + } + every_in_global_list = { + variable = fp2_struggle_ending_culture_list + remove_variable = fp2_struggle_hostility_flag + } + } +} + +# Set cultural acceptance between all Involved cultures +fp2_struggle_hostility_cultural_acceptance_large_effect = { + hidden_effect = { + while = { + limit = { + any_in_global_list = { + variable = fp2_struggle_ending_culture_list + NOT = { has_variable = fp2_struggle_hostility_flag } + } + } + ordered_in_global_list = { + variable = fp2_struggle_ending_culture_list + limit = { + NOT = { has_variable = fp2_struggle_hostility_flag } + } + order_by = culture_number_of_counties + save_scope_as = culture_scope + set_variable = fp2_struggle_hostility_flag # variable ensures acceptance is only lost once per couple + } + every_in_global_list = { + variable = fp2_struggle_ending_culture_list + limit = { + NOR = { + has_variable = fp2_struggle_hostility_flag + this = scope:culture_scope + } + } + change_cultural_acceptance = { + target = scope:culture_scope + value = fp2_struggle_hostility_culture_acceptance_value + desc = fp2_struggle_hostility_acceptance_tt + } + } + } + every_in_global_list = { + variable = fp2_struggle_ending_culture_list + remove_variable = fp2_struggle_hostility_flag + } + } +} + + +### Compromise + +# Creates a new de jure kingdom from a duchy +fp2_struggle_compromise_create_new_kingdom_effect = { + add_to_list = duchy_kingdom + create_dynamic_title = { + tier = kingdom + name = $TYPE$_CREATED_TITLE_NAME + } + scope:old_title = { + # Edge case for kingdoms which do not control their own capital duchy + if = { + limit = { + title_capital_county = de_jure_liege.title_capital_county + exists = de_jure_liege.holder + holder != de_jure_liege.holder + } + de_jure_liege = { + # So kingdom has a capital + set_capital_county = this.holder.capital_county + # So titles do not share CoAs + set_coa = this.holder.house + } + } + set_de_jure_liege_title = scope:new_title + } + scope:new_title = { + set_coa = $FETCH$ + set_color_from_title = $FETCH$ + set_capital_county = $FETCH$.title_capital_county + set_de_jure_liege_title = title:e_spain + } +} + +# Create new de jure kingdoms from relevant duchies +fp2_struggle_compromise_duchies_to_kingdoms_effect = { + hidden_effect = { + title:d_zaragoza = { add_to_list = titular_iberian_duchies } + title:e_spain = { + # Cycle through de jure duchies held by independent dukes + every_in_de_jure_hierarchy = { + # Prefer primary titles + limit = { + this = this.holder.primary_title + fp2_struggle_ending_compromise_independent_duchy_trigger = yes + } + # Then capital titles + alternative_limit = { + this.title_capital_county = this.kingdom.title_capital_county + fp2_struggle_ending_compromise_independent_duchy_trigger = yes + } + alternative_limit = { fp2_struggle_ending_compromise_independent_duchy_trigger = yes } + save_scope_as = old_title + fp2_struggle_compromise_create_new_kingdom_effect = { TYPE = NEW FETCH = scope:old_title } + } + # Cycle through titular duchies held by independent dukes (e.g. Zaragoza) + every_in_list = { + list = titular_iberian_duchies + save_scope_as = special_duchy + if = { + # Independent holder who controls at least 50% a de jure duchy, and no kingdom has the same as that duchy + limit = { fp2_struggle_ending_compromise_titular_trigger = yes } + title:e_spain = { + random_in_de_jure_hierarchy = { + limit = { + tier = tier_duchy + any_direct_de_jure_vassal_title = { + percent >= 0.5 + holder.top_liege = scope:special_duchy.holder + } + } + save_scope_as = old_title + } + } + fp2_struggle_compromise_create_new_kingdom_effect = { TYPE = SPECIAL FETCH = scope:special_duchy } + } + } + # Cycle through uncreated de jure duchies to split if needed (e.g. Coimbra) + every_in_de_jure_hierarchy = { + limit = { fp2_struggle_ending_compromise_split_duchy_trigger = yes } + save_scope_as = old_title + fp2_struggle_compromise_create_new_kingdom_effect = { TYPE = NEW FETCH = scope:old_title } + } + } + } +} + +# Moves duchies to another kingdom +fp2_struggle_compromise_transfer_duchies_effect = { + title:e_spain = { + while = { + limit = { + any_in_de_jure_hierarchy = { fp2_struggle_compromise_transfer_duchy_trigger = yes } + } + every_in_de_jure_hierarchy = { + limit = { fp2_struggle_compromise_transfer_duchy_trigger = yes } + add_to_list = transferred_duchies + # To ensure kingdom's capitals are always inside them + if = { + limit = { title_capital_county = kingdom.title_capital_county } + kingdom = { + save_scope_as = old_kingdom + if = { + limit = { + any_direct_de_jure_vassal_title = { + NOT = { is_in_list = transferred_duchies } + title_capital_county.kingdom = scope:old_kingdom + } + } + random_direct_de_jure_vassal_title = { + limit = { + NOT = { is_in_list = transferred_duchies } + title_capital_county.kingdom = scope:old_kingdom + } + title_capital_county = { save_scope_as = new_capital } + } + set_capital_county = scope:new_capital + } + } + } + if = { + limit = { title_capital_county.holder.top_liege.primary_title.tier = tier_kingdom } + set_de_jure_liege_title = title_capital_county.holder.top_liege.primary_title + } + else = { set_de_jure_liege_title = title_capital_county.holder.top_liege.capital_county.kingdom } + } + } + } +} + +# Creates a new de jure empire from a kingdom +fp2_struggle_compromise_create_new_empire_effect = { + add_to_list = kingdom_empire + save_scope_as = old_title + create_dynamic_title = { + tier = empire + name = NEW_CREATED_TITLE_NAME + } + scope:old_title = { set_de_jure_liege_title = scope:new_title } + scope:new_title = { + add_to_list = new_empire_list + set_coa = scope:old_title + set_color_from_title = scope:old_title + set_capital_county = scope:old_title.title_capital_county + } +} + +# Create new de jure empires from relevant kingdoms +fp2_struggle_compromise_kingdoms_to_empires_effect = { + hidden_effect = { + title:e_spain = { + every_in_de_jure_hierarchy = { + limit = { + tier = tier_kingdom + any_in_de_jure_hierarchy = { + count >= fp2_struggle_compromise_ending_minimal_empire_size + tier = tier_county + } + } + fp2_struggle_compromise_create_new_empire_effect = yes + } + } + } +} + +# Distribute remaining Kingdoms to neighboring empires +fp2_struggle_compromise_distribute_kingdoms_to_neighbouring_empires_effect = { + hidden_effect = { + title:e_spain = { + every_in_de_jure_hierarchy = { + limit = { tier = tier_kingdom } + save_scope_as = kingdom_to_distribute + random_title_to_title_neighboring_and_across_water_kingdom = { + limit = { # Prefer land borders + any_this_title_or_de_jure_above = { is_in_list = new_empire_list } + any_title_to_title_neighboring_kingdom = { this = scope:kingdom_to_distribute } + } + alternative_limit = { # Then sea borders + any_this_title_or_de_jure_above = { is_in_list = new_empire_list } + } + weight = { + modifier = { # Value one from Iberia for small empire + add = { + value = 2 + subtract = { + value = 0 + every_in_de_jure_hierarchy = { + add = 0.25 + } + } + min = 0 + } + any_in_de_jure_hierarchy = { + tier = tier_county + title_province = { geographical_region = world_europe_west_iberia } + } + } + modifier = { # Value smaller empire + add = { + value = 2 + subtract = { + value = 0 + every_in_de_jure_hierarchy = { + limit = { tier = tier_kingdom } + add = 0.5 + } + } + min = 0 + } + } + modifier = { # Value most shared borders + add = { + value = 0 + every_in_de_jure_hierarchy = { + limit = { + tier = tier_county + any_neighboring_county = { target_is_de_jure_liege_or_above = scope:kingdom_to_distribute } + } + add = 1 + } + min = 0 + } + } + } + add_to_list = transferred_kingdoms + scope:kingdom_to_distribute = { set_de_jure_liege_title = prev.de_jure_liege } + } + } + } + } +} + +fp2_struggle_compromise_distribute_the_actual_titles = { + struggle:iberian_struggle = { + create_title_and_vassal_change = { + type = granted + save_scope_as = change + } + every_involved_ruler = { + limit = { + save_temporary_scope_as = new_owner_temp + primary_title = { + tier = tier_duchy + de_jure_liege ?= { fp2_struggle_ending_compromise_create_title_trigger = yes } + } + } + save_scope_as = new_owner + primary_title.de_jure_liege = { + change_title_holder = { + holder = scope:new_owner + change = scope:change + } + add_to_list = assigned_title + } + } + every_involved_ruler = { + limit = { + save_temporary_scope_as = new_owner_temp + primary_title = { + tier = tier_kingdom + de_jure_liege ?= { fp2_struggle_ending_compromise_create_title_trigger = yes } + } + } + save_scope_as = new_owner + primary_title.de_jure_liege = { + change_title_holder = { + holder = scope:new_owner + change = scope:change + } + add_to_list = assigned_title + } + } + resolve_title_and_vassal_change = scope:change + } +} + +# Add house modifiers to Involved rulers; Didn't rename the key for localization cost reasons +fp2_struggle_compromise_modifier_rewards_effect = { + struggle:iberian_struggle = { + show_as_tooltip = { + every_involved_ruler = { + limit = { this = root } + custom = fp2_struggle_compromise_house_rewards_tt + fp2_struggle_compromise_modifier_rewards_personal_house_effect = yes + } + every_involved_ruler = { + limit = { this = root } + custom = fp2_struggle_compromise_defensive_rewards_tt + fp2_struggle_compromise_modifier_rewards_personal_county_effect = yes + } + } + hidden_effect = { + every_involved_ruler = { + limit = { + top_liege = this + primary_title = { is_mercenary_company = no } + exists = house + NOT = { + house = { has_house_modifier = fp2_struggle_compromise_house_reward_modifier } + } + } + fp2_struggle_compromise_modifier_rewards_personal_house_effect = yes + } + every_involved_ruler = { + limit = { + top_liege = this + primary_title = { is_mercenary_company = no } + } + fp2_struggle_compromise_modifier_rewards_personal_county_effect = yes + } + } + } +} + +# Add house modifiers to a single character (used in tooltips); +fp2_struggle_compromise_modifier_rewards_personal_house_effect = { + house = { + custom_tooltip = fp2_struggle_compromise_house_enforce_truce_rewards_tt + add_house_modifier = { + modifier = fp2_struggle_compromise_house_reward_modifier + } + } +} + +# Add county modifiers to a single character (used in tooltips) +fp2_struggle_compromise_modifier_rewards_personal_county_effect = { + capital_county = { + add_county_modifier = { + modifier = fp2_struggle_compromise_defensive_reward_modifier + } + } +} + +# Add truces between all Involved rulers +fp2_struggle_compromise_truce_effect = { + hidden_effect = { + if = { + limit = { + struggle:iberian_struggle = { + any_involved_ruler = { + count > 1 + top_liege = this + primary_title = { is_mercenary_company = no } + } + } + } + struggle:iberian_struggle = { + every_involved_ruler = { + limit = { + top_liege = this + primary_title = { is_mercenary_company = no } + } + add_to_list = fp2_struggle_compromise_truce_list + } + } + while = { + limit = { + any_in_list = { + list = fp2_struggle_compromise_truce_list + NOT = { has_variable = fp2_struggle_compromise_flag } + } + } + ordered_in_list = { + list = fp2_struggle_compromise_truce_list + limit = { + NOT = { has_variable = fp2_struggle_compromise_flag } + } + order_by = realm_size + save_scope_as = realm_scope + set_variable = fp2_struggle_compromise_flag # variable ensures truces are set only once per couple + } + every_in_list = { + list = fp2_struggle_compromise_truce_list + limit = { + NOR = { + has_variable = fp2_struggle_compromise_flag + this = scope:realm_scope + has_truce = scope:realm_scope + } + } + add_truce_both_ways = { + character = scope:realm_scope + days = 3650 + name = TRUCE_FP2_COMPROMISE + } + } + } + every_in_list = { + list = fp2_struggle_compromise_truce_list + remove_variable = fp2_struggle_compromise_flag + } + } + } +} + +### Conciliation + +# Add House modifiers to all Involved rulers +fp2_struggle_conciliation_modifier_rewards_effect = { + struggle:iberian_struggle = { + every_involved_ruler = { + limit = { this = root } + custom = fp2_struggle_compromise_house_rewards_tt + show_as_tooltip = { fp2_struggle_conciliation_modifier_rewards_personal_effect = yes } + } + every_involved_ruler = { + limit = { + top_liege = this + primary_title = { is_mercenary_company = no } + exists = house + NOT = { + house = { has_house_modifier = fp2_struggle_conciliation_house_reward_modifier } + } + } + hidden_effect = { fp2_struggle_conciliation_modifier_rewards_personal_effect = yes } + } + } +} + +# Add House modifier to a single character (used in tooltips) +fp2_struggle_conciliation_modifier_rewards_personal_effect = { + house = { + add_house_modifier = { + modifier = fp2_struggle_conciliation_house_reward_modifier + } + } +} + +# Add cultural acceptance between Involved cultures +fp2_struggle_conciliation_cultural_acceptance_effect = { + hidden_effect = { + while = { + limit = { + any_in_global_list = { + variable = fp2_struggle_ending_culture_list + NOT = { has_variable = fp2_struggle_conciliation_flag } + } + } + ordered_in_global_list = { + variable = fp2_struggle_ending_culture_list + limit = { + NOT = { has_variable = fp2_struggle_conciliation_flag } + } + order_by = culture_number_of_counties + save_scope_as = culture_scope + set_variable = fp2_struggle_conciliation_flag # variable ensures acceptance is only gained once per couple + } + every_in_global_list = { + variable = fp2_struggle_ending_culture_list + limit = { + NOR = { + has_variable = fp2_struggle_conciliation_flag + this = scope:culture_scope + } + } + change_cultural_acceptance = { + target = scope:culture_scope + value = fp2_struggle_conciliation_culture_acceptance_value + desc = fp2_struggle_conciliation_acceptance_tt + } + } + } + every_in_global_list = { + variable = fp2_struggle_ending_culture_list + remove_variable = fp2_struggle_conciliation_flag + } + } +} + +################################################## +# Interactions +################################################## + +synergise_friendship_interaction_bonus_individual_effect = { + $SENIOR_CHARACTER$ = { + # Diplomacy education. + if = { + limit = { has_trait = education_diplomacy } + add_character_modifier = fp2_single_synergy_diplomacy_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_single_synergy_diplomacy_modifier } + } + # Martial education. + if = { + limit = { has_trait = education_martial } + add_character_modifier = fp2_single_synergy_martial_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_single_synergy_martial_modifier } + } + # Stewardship education. + if = { + limit = { has_trait = education_stewardship } + add_character_modifier = fp2_single_synergy_stewardship_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_single_synergy_stewardship_modifier } + } + # Intrigue education. + if = { + limit = { has_trait = education_intrigue } + add_character_modifier = fp2_single_synergy_intrigue_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_single_synergy_intrigue_modifier } + } + # Learning education. + if = { + limit = { has_trait = education_learning } + add_character_modifier = fp2_single_synergy_learning_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_single_synergy_learning_modifier } + } + } +} + +# Being $SENIOR_CHARACTER$ doesn't actually do anything in this variant, just maintaining term parity with the other synergy effect. +synergise_friendship_interaction_bonus_combined_effect = { + $SENIOR_CHARACTER$ = { + # Diplomacy combi-synergies. + if = { + limit = { has_trait = education_diplomacy } + # Diplomacy-Diplomacy + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_diplomacy } + } + add_character_modifier = fp2_double_synergy_diplomacy_diplomacy_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_diplomacy_diplomacy_modifier } + } + # Diplomacy-Martial + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_martial } + } + add_character_modifier = fp2_double_synergy_diplomacy_martial_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_diplomacy_martial_modifier } + } + # Diplomacy-Stewardship + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_stewardship } + } + add_character_modifier = fp2_double_synergy_diplomacy_stewardship_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_diplomacy_stewardship_modifier } + } + # Diplomacy-Intrigue + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_intrigue } + } + add_character_modifier = fp2_double_synergy_diplomacy_intrigue_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_diplomacy_intrigue_modifier } + } + # Diplomacy-Learning + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_learning } + } + add_character_modifier = fp2_double_synergy_diplomacy_learning_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_diplomacy_learning_modifier } + } + } + # Martial combi-synergies. + if = { + limit = { has_trait = education_martial } + # Martial-Diplomacy + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_diplomacy } + } + add_character_modifier = fp2_double_synergy_martial_diplomacy_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_martial_diplomacy_modifier } + } + # Martial-Martial + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_martial } + } + add_character_modifier = fp2_double_synergy_martial_martial_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_martial_martial_modifier } + } + # Martial-Stewardship + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_stewardship } + } + add_character_modifier = fp2_double_synergy_martial_stewardship_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_martial_stewardship_modifier } + } + # Martial-Intrigue + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_intrigue } + } + add_character_modifier = fp2_double_synergy_martial_intrigue_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_martial_intrigue_modifier } + } + # Martial-Learning + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_learning } + } + add_character_modifier = fp2_double_synergy_martial_learning_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_martial_learning_modifier } + } + } + # Stewardship combi-synergies. + if = { + limit = { has_trait = education_stewardship } + # Stewardship-Diplomacy + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_diplomacy } + } + add_character_modifier = fp2_double_synergy_stewardship_diplomacy_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_stewardship_diplomacy_modifier } + } + # Stewardship-Martial + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_martial } + } + add_character_modifier = fp2_double_synergy_stewardship_martial_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_stewardship_martial_modifier } + } + # Stewardship-Stewardship + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_stewardship } + } + add_character_modifier = fp2_double_synergy_stewardship_stewardship_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_stewardship_stewardship_modifier } + } + # Stewardship-Intrigue + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_intrigue } + } + add_character_modifier = fp2_double_synergy_stewardship_intrigue_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_stewardship_intrigue_modifier } + } + # Stewardship-Learning + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_learning } + } + add_character_modifier = fp2_double_synergy_stewardship_learning_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_stewardship_learning_modifier } + } + } + # Intrigue combi-synergies. + if = { + limit = { has_trait = education_intrigue } + # Intrigue-Diplomacy + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_diplomacy } + } + add_character_modifier = fp2_double_synergy_intrigue_diplomacy_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_intrigue_diplomacy_modifier } + } + # Intrigue-Martial + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_martial } + } + add_character_modifier = fp2_double_synergy_intrigue_martial_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_intrigue_martial_modifier } + } + # Intrigue-Stewardship + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_stewardship } + } + add_character_modifier = fp2_double_synergy_intrigue_stewardship_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_intrigue_stewardship_modifier } + } + # Intrigue-Intrigue + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_intrigue } + } + add_character_modifier = fp2_double_synergy_intrigue_intrigue_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_intrigue_intrigue_modifier } + } + # Intrigue-Learning + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_learning } + } + add_character_modifier = fp2_double_synergy_intrigue_learning_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_intrigue_learning_modifier } + } + } + # Learning combi-synergies. + if = { + limit = { has_trait = education_learning } + # Learning-Diplomacy + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_diplomacy } + } + add_character_modifier = fp2_double_synergy_learning_diplomacy_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_learning_diplomacy_modifier } + } + # Learning-Martial + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_martial } + } + add_character_modifier = fp2_double_synergy_learning_martial_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_learning_martial_modifier } + } + # Learning-Stewardship + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_stewardship } + } + add_character_modifier = fp2_double_synergy_learning_stewardship_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_learning_stewardship_modifier } + } + # Learning-Intrigue + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_intrigue } + } + add_character_modifier = fp2_double_synergy_learning_intrigue_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_learning_intrigue_modifier } + } + # Learning-Learning + if = { + limit = { + $JUNIOR_CHARACTER$ = { has_trait = education_learning } + } + add_character_modifier = fp2_double_synergy_learning_learning_modifier + $JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_learning_learning_modifier } + } + } + } +} + +synergise_friendship_interaction_actual_effect = { + if = { + limit = { always = scope:synergy_bonus_actor } + synergise_friendship_interaction_bonus_individual_effect = { + SENIOR_CHARACTER = scope:actor + JUNIOR_CHARACTER = scope:recipient + } + } + if = { + limit = { always = scope:synergy_bonus_recipient } + synergise_friendship_interaction_bonus_individual_effect = { + SENIOR_CHARACTER = scope:recipient + JUNIOR_CHARACTER = scope:actor + } + } + if = { + limit = { always = scope:synergy_bonus_mixed } + synergise_friendship_interaction_bonus_combined_effect = { + SENIOR_CHARACTER = scope:actor + JUNIOR_CHARACTER = scope:recipient + } + } +} + +remove_every_best_friend_synergy_bonus_modifier_effect = { + if = { + limit = { has_character_modifier = fp2_single_synergy_diplomacy_modifier } + remove_character_modifier = fp2_single_synergy_diplomacy_modifier + } + if = { + limit = { has_character_modifier = fp2_single_synergy_martial_modifier } + remove_character_modifier = fp2_single_synergy_martial_modifier + } + if = { + limit = { has_character_modifier = fp2_single_synergy_stewardship_modifier } + remove_character_modifier = fp2_single_synergy_stewardship_modifier + } + if = { + limit = { has_character_modifier = fp2_single_synergy_intrigue_modifier } + remove_character_modifier = fp2_single_synergy_intrigue_modifier + } + if = { + limit = { has_character_modifier = fp2_single_synergy_learning_modifier } + remove_character_modifier = fp2_single_synergy_learning_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_diplomacy_diplomacy_modifier } + remove_character_modifier = fp2_double_synergy_diplomacy_diplomacy_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_diplomacy_martial_modifier } + remove_character_modifier = fp2_double_synergy_diplomacy_martial_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_diplomacy_stewardship_modifier } + remove_character_modifier = fp2_double_synergy_diplomacy_stewardship_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_diplomacy_intrigue_modifier } + remove_character_modifier = fp2_double_synergy_diplomacy_intrigue_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_diplomacy_learning_modifier } + remove_character_modifier = fp2_double_synergy_diplomacy_learning_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_martial_diplomacy_modifier } + remove_character_modifier = fp2_double_synergy_martial_diplomacy_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_martial_martial_modifier } + remove_character_modifier = fp2_double_synergy_martial_martial_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_martial_stewardship_modifier } + remove_character_modifier = fp2_double_synergy_martial_stewardship_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_martial_intrigue_modifier } + remove_character_modifier = fp2_double_synergy_martial_intrigue_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_martial_learning_modifier } + remove_character_modifier = fp2_double_synergy_martial_learning_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_stewardship_diplomacy_modifier } + remove_character_modifier = fp2_double_synergy_stewardship_diplomacy_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_stewardship_martial_modifier } + remove_character_modifier = fp2_double_synergy_stewardship_martial_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_stewardship_stewardship_modifier } + remove_character_modifier = fp2_double_synergy_stewardship_stewardship_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_stewardship_intrigue_modifier } + remove_character_modifier = fp2_double_synergy_stewardship_intrigue_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_stewardship_learning_modifier } + remove_character_modifier = fp2_double_synergy_stewardship_learning_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_intrigue_diplomacy_modifier } + remove_character_modifier = fp2_double_synergy_intrigue_diplomacy_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_intrigue_martial_modifier } + remove_character_modifier = fp2_double_synergy_intrigue_martial_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_intrigue_stewardship_modifier } + remove_character_modifier = fp2_double_synergy_intrigue_stewardship_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_intrigue_intrigue_modifier } + remove_character_modifier = fp2_double_synergy_intrigue_intrigue_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_intrigue_learning_modifier } + remove_character_modifier = fp2_double_synergy_intrigue_learning_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_learning_diplomacy_modifier } + remove_character_modifier = fp2_double_synergy_learning_diplomacy_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_learning_martial_modifier } + remove_character_modifier = fp2_double_synergy_learning_martial_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_learning_stewardship_modifier } + remove_character_modifier = fp2_double_synergy_learning_stewardship_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_learning_intrigue_modifier } + remove_character_modifier = fp2_double_synergy_learning_intrigue_modifier + } + if = { + limit = { has_character_modifier = fp2_double_synergy_learning_learning_modifier } + remove_character_modifier = fp2_double_synergy_learning_learning_modifier + } +} + +purchase_truce_interaction_work_out_truce_days_effect = { + if = { + limit = { always = scope:pt_sum_small } + add_truce_both_ways = { + character = $TARGET$ + days = purchase_truce_interaction_truce_days_small_value + name = TRUCE_PURCHASED + } + } + else_if = { + limit = { always = scope:pt_sum_large } + add_truce_both_ways = { + character = $TARGET$ + days = purchase_truce_interaction_truce_days_large_value + name = TRUCE_PURCHASED + } + } + else = { + add_truce_both_ways = { + character = $TARGET$ + days = purchase_truce_interaction_truce_days_medium_value + name = TRUCE_PURCHASED + } + } +} + +purchase_truce_interaction_work_out_purchase_cost_effect = { + scope:actor = { + # Small cost. + if = { + limit = { always = scope:pt_sum_small } + pay_short_term_gold = { + target = scope:recipient + gold = { + value = 0 + add = pt_sum_small_value + } + } + } + # Large cost. + else_if = { + limit = { always = scope:pt_sum_large } + pay_short_term_gold = { + target = scope:recipient + gold = { + value = 0 + add = pt_sum_large_value + } + } + } + # Medium cost; we do this last as a fallback. + else = { + pay_short_term_gold = { + target = scope:recipient + gold = { + value = 0 + add = pt_sum_medium_value + } + } + } + } +} + +purchase_truce_interaction_activate_catalyst_effect = { + if = { + limit = { + any_character_struggle = { + involvement = involved + activate_struggle_catalyst_secondary_character_involvement_involved_trigger = { + CATALYST = catalyst_bought_important_truce + CHAR = scope:recipient + } + } + } + every_character_struggle = { + involvement = involved + limit = { + activate_struggle_catalyst_secondary_character_involvement_involved_trigger = { + CATALYST = catalyst_bought_important_truce + CHAR = scope:recipient + } + } + activate_struggle_catalyst = { + catalyst = catalyst_bought_important_truce + character = scope:actor + } + } + } + + # Generic truce catalayst + if = { + limit = { + any_character_struggle = { + involvement = involved + activate_struggle_catalyst_secondary_character_involvement_involved_trigger = { + CATALYST = catalyst_sign_truce_outside_war + CHAR = scope:recipient + } + } + } + every_character_struggle = { + involvement = involved + limit = { + activate_struggle_catalyst_secondary_character_involvement_involved_trigger = { + CATALYST = catalyst_sign_truce_outside_war + CHAR = scope:recipient + } + } + activate_struggle_catalyst = { + catalyst = catalyst_sign_truce_outside_war + character = scope:actor + } + } + } +} + +clean_revolt_county_modifiers_from_faction_members_effect = { + every_faction_county_member = { + if = { + limit = { has_county_modifier = small_investment_in_revolt_modifier } + remove_county_modifier = small_investment_in_revolt_modifier + } + else_if = { + limit = { has_county_modifier = medium_investment_in_revolt_modifier } + remove_county_modifier = medium_investment_in_revolt_modifier + } + else_if = { + limit = { has_county_modifier = high_investment_in_revolt_modifier } + remove_county_modifier = high_investment_in_revolt_modifier + } + } +} + +generate_troops_from_revolt_county_modifiers_effect = { + if = { + limit = { + scope:attacker = { + joined_faction = { + any_faction_county_member = { + OR = { + has_county_modifier = small_investment_in_revolt_modifier + has_county_modifier = medium_investment_in_revolt_modifier + has_county_modifier = high_investment_in_revolt_modifier + } + } + } + } + } + scope:attacker = { + joined_faction = { + every_faction_county_member = { + limit = { + OR = { + has_county_modifier = small_investment_in_revolt_modifier + has_county_modifier = medium_investment_in_revolt_modifier + has_county_modifier = high_investment_in_revolt_modifier + } + } + + random_county_province = { + save_scope_as = chosen_location + } + scope:attacker = { + + set_variable = { + name = number_rebel_reinforcements + value = { + add = { + if = { + limit = { prev = { has_county_modifier = small_investment_in_revolt_modifier } } + add = 250 + } + if = { + limit = { prev = { has_county_modifier = medium_investment_in_revolt_modifier } } + add = 750 + } + if = { + limit = { prev = { has_county_modifier = high_investment_in_revolt_modifier } } + add = 2000 + } + } + } + } + + spawn_army = { + name = peasant_troops_name + levies = var:number_rebel_reinforcements + location = scope:chosen_location + war = scope:war + } + } + } + + clean_revolt_county_modifiers_from_faction_members_effect = yes + + } + } + + } +} + +fp2_contract_assistance_war_pay_effect = { + if = { + limit = { + has_fp2_dlc_trigger = yes + any_war_participant = { + has_variable = owed_contract_assistance_war + var:owed_contract_assistance_war = scope:war + } + } + every_war_participant = { + limit = { + has_variable = owed_contract_assistance_war + var:owed_contract_assistance_war = scope:war + } + remove_variable = owed_contract_assistance_war + save_scope_as = contract_assistance_helper + if = { + limit = { is_attacker_in_war = scope:war } + scope:war.primary_attacker = { save_scope_as = contract_assistance_hirer } + } + else = { + scope:war.primary_defender = { save_scope_as = contract_assistance_hirer } + } + if = { + limit = { + scope:war = { + war_contribution = { + target = scope:contract_assistance_helper + value >= scope:contract_assistance_helper.var:owed_contract_assistance_contribution + } + } + } + scope:contract_assistance_hirer = { + send_interface_message = { + type = event_gold_neutral + title = contract_assistance_war_msg_title + left_icon = scope:contract_assistance_helper + custom_tooltip = contract_assistance_war_msg_hirer_paid_desc + pay_short_term_gold = { + target = scope:contract_assistance_helper + gold = scope:contract_assistance_helper.var:owed_contract_assistance_gold + } + } + } + scope:contract_assistance_helper = { + send_interface_message = { + type = event_gold_good + title = contract_assistance_war_msg_title + left_icon = scope:contract_assistance_hirer + custom_tooltip = contract_assistance_war_msg_helper_paid_desc + show_as_tooltip = { + scope:contract_assistance_hirer = { + pay_short_term_gold = { + target = scope:contract_assistance_helper + gold = scope:contract_assistance_helper.var:owed_contract_assistance_gold + } + } + } + } + } + } + else = { + scope:contract_assistance_hirer = { + send_interface_message = { + type = event_gold_neutral + title = contract_assistance_war_msg_title + left_icon = scope:contract_assistance_helper + custom_tooltip = contract_assistance_war_msg_hirer_kept_desc + } + } + scope:contract_assistance_helper = { + add_character_flag = { + flag = fp2_contract_assistance_failure + years = 10 + } + send_interface_message = { + type = event_gold_bad + title = contract_assistance_war_msg_title + left_icon = scope:contract_assistance_hirer + custom_tooltip = contract_assistance_war_msg_helper_kept_desc + } + } + } + remove_variable = owed_contract_assistance_contribution + remove_variable = owed_contract_assistance_gold + } + } +} + +fp2_contract_assistance_invalidated_effect = { + if = { + limit = { + has_fp2_dlc_trigger = yes + any_war_participant = { + has_variable = owed_contract_assistance_war + var:owed_contract_assistance_war = scope:war + } + } + every_war_participant = { + limit = { + has_variable = owed_contract_assistance_war + var:owed_contract_assistance_war = scope:war + } + remove_variable = owed_contract_assistance_war + remove_variable = owed_contract_assistance_contribution + remove_variable = owed_contract_assistance_gold + save_scope_as = contract_assistance_helper + if = { + limit = { is_attacker_in_war = scope:war } + scope:war.primary_attacker = { save_scope_as = contract_assistance_hirer } + } + else = { + scope:war.primary_defender = { save_scope_as = contract_assistance_hirer } + } + scope:contract_assistance_hirer = { + send_interface_message = { + type = event_gold_neutral + title = contract_assistance_war_msg_title + left_icon = scope:contract_assistance_helper + custom_tooltip = contract_assistance_war_msg_hirer_invalidated_desc + } + } + scope:contract_assistance_helper = { + send_interface_message = { + type = event_gold_neutral + title = contract_assistance_war_msg_title + left_icon = scope:contract_assistance_hirer + custom_tooltip = contract_assistance_war_msg_helper_invalidated_desc + } + } + } + } +} + +invite_special_guest_to_activity_effect = { + if = { + limit = { + exists = var:special_guest + } + + var:special_guest = { + save_scope_as = the_special_guest + } + + save_scope_as = sender + + scope:the_special_guest = { + add_to_activity = scope:activity + + set_variable = { + name = booked_for_a_party + value = scope:sender + days = 20 + } + } + + remove_variable = special_guest + } +} + +################################################## +# Struggle +################################################## + +fp2_struggle_apply_ai_agenda_effect = { + # Apply effects + add_character_flag = { + flag = agenda_towards_$INTENT$ + } + root = { + change_variable = { + name = agents_for_$INTENT$ + add = 1 + } + } +} + +gifting_leads_towards_friendship_effect = { + if = { + # then verify the right struggle phase + limit = { + is_diff_faith_or_culture_trigger = { + CHAR = scope:actor + STATUS = involved + } + any_character_struggle = { + involvement = involved + has_struggle_phase_parameter = struggle_gifts_involved_diff_faith_culture_leads_to_friendship + } + } + progress_towards_friend_effect = { + REASON = friend_struggle_gift + CHARACTER = scope:actor + OPINION = 0 + } + } +} + +################################################## +# CBs +################################################## + + + +################################################## +# Yearlies +################################################## + +fp2_lyonese_monk_return_territories_effect = { + if = { + limit = { + scope:acolyte = { is_playable_character = yes } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = change + } + scope:acolyte = { + every_held_title = { + title_tier >= county + change_title_holder = { + holder = scope:acolyte_host + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + } + } +} + +fp2_lyonese_monk_cancel_chain_effect = { + # Tidy up the story. + scope:story = { end_story = yes } + # Tidy up scope:acolyte. + ## We do this via some mild scope wizardry. + save_scope_value_as = { + name = remove_acolyte + value = flag:$REMOVAL$ + } + ## Either they sod off. + if = { + limit = { scope:remove_acolyte = flag:banished } + fp2_lyonese_monk_return_territories_effect = yes + scope:acolyte = { + move_to_pool = yes + silent_disappearance_effect = yes + } + } + ## Or they're killed during apprehension. + else_if = { + limit = { scope:remove_acolyte = flag:scuffle } + fp2_lyonese_monk_return_territories_effect = yes + scope:acolyte = { + custom_tooltip = fp2_lyonese_monk_cancel_chain_effect.tt + hidden_effect = { + death = { + death_reason = death_scuffle_with_soldiers + killer = scope:acolyte_host + } + } + } + } + ## Or else they're given to the Pope. + else_if = { + limit = { scope:remove_acolyte = flag:pope } + fp2_lyonese_monk_return_territories_effect = yes + # So we walk through the narrative... + scope:acolyte = { + if = { + limit = { is_playable_character = no } + select_and_move_to_pool_effect = yes + } + } + rightfully_imprison_character_effect = { + TARGET = scope:acolyte + IMPRISONER = scope:pope + } + scope:acolyte = { + hidden_effect = { + death = { + death_reason = death_dungeon + killer = scope:pope + } + } + } + } +} + +################################################## +# Legacies +################################################## + + + +################################################## +# Governments +################################################## + + + +################################################## +# Casus Belli +################################################## + +fp2_border_raid_damage_effect = { + change_county_control = fp2_border_raid_control_change_value + change_development_level = fp2_border_raid_development_change_value + if = { + limit = { exists = scope:raid_province } + show_as_tooltip = { destroy_random_building_effect = yes } + } + scope:attacker = { add_gold = fp2_border_raid_gold_change_value } +} + +################################################## +# Historical Artefacts +################################################## + +create_artifact_goblet_chalice_of_dona_urraca = { + $OWNER$ = { save_scope_as = owner } + set_artifact_rarity_famed = yes + scope:owner = { + create_artifact = { + name = fp2_chalice_dona_urraca + description = fp2_chalice_dona_urraca_desc + template = fp2_chalice_dona_urraca_template + type = miscellaneous_when_not_court + visuals = fp2_chalice_dona_urraca + wealth = scope:wealth + quality = scope:quality + modifier = chalice_of_dona_urraca_modifier + save_scope_as = newly_created_artifact + } + } + scope:newly_created_artifact = { + set_variable = { + name = dlc_potential_court_artefact + value = yes + } + set_variable = { + name = historical_unique_artifact + value = yes + } + set_variable = { + name = relic + value = flag:christian + } + } +} + +create_artifact_various_aquamanile_santiago = { + $OWNER$ = { save_scope_as = owner } + character:3206 = { save_scope_as = reforger } + set_artifact_rarity_illustrious = yes + scope:owner = { + create_artifact = { + name = fp2_santiago_aquamanile + description = fp2_santiago_aquamanile_desc + template = fp2_santiago_aquamanile_template + type = miscellaneous_when_not_court + visuals = fp2_santiago_aquamanile + wealth = scope:wealth + quality = scope:quality + modifier = former_bells_of_santiago_modifier + decaying = no + save_scope_as = newly_created_artifact + } + } + scope:newly_created_artifact = { + set_variable = { + name = dlc_potential_court_artefact + value = yes + } + set_variable = { + name = historical_unique_artifact + value = yes + } + set_variable = { + name = relic + value = flag:iberian_struggle + } + } +} + +create_artifact_various_bells_santiago = { + $OWNER$ = { save_scope_as = owner } + set_artifact_rarity_illustrious = yes + scope:owner = { + create_artifact = { + name = fp2_santiago_bells + description = fp2_santiago_bells_desc + template = fp2_santiago_bells_template + type = miscellaneous_when_not_court + visuals = fp2_santiago_bells + wealth = scope:wealth + quality = scope:quality + modifier = bells_of_santiago_modifier + decaying = no + save_scope_as = newly_created_artifact + } + } + scope:newly_created_artifact = { + set_variable = { + name = dlc_potential_court_artefact + value = yes + } + set_variable = { + name = historical_unique_artifact + value = yes + } + set_variable = { + name = relic + value = flag:iberian_struggle + } + } +} + +create_artifact_fp2_votive_crowns_effect = { + $OWNER$ = { save_scope_as = owner } + set_artifact_rarity_famed = yes + scope:owner = { + create_artifact = { + name = fp2_votive_crowns + description = fp2_votive_crowns_desc + template = crown_christian_relic_template + type = regalia + visuals = fp2_votive_crowns + wealth = scope:wealth + quality = scope:quality + modifier = votive_crown_modifier + save_scope_as = newly_created_artifact + } + } + scope:newly_created_artifact = { + set_variable = { + name = dlc_potential_court_artefact + value = yes + } + } +} + +################################################## +# Other Artefacts +################################################## + +create_artifact_fp2_armillary_sphere_core_effect = { + create_artifact = { + name = fp2_armillary_sphere + # Description will be regenerated in the post-creation effects, since we need to nab materials. + description = placeholder + creator = scope:maker + type = $TYPE$ + visuals = fp2_armillary_sphere + wealth = scope:wealth + quality = scope:quality + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + } +} + +create_artifact_fp2_armillary_sphere_effect = { + # Set up general scopes. + $OWNER$ = { save_scope_as = owner } + $MAKER$ = { save_scope_as = maker } + # Begin creating. + hidden_effect_new_object = { + # Get artifact quality, wealth, and materials. + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + # Create the artifact. + scope:owner = { + if = { + limit = { has_royal_court = yes } + create_artifact_fp2_armillary_sphere_core_effect = { TYPE = scientific_apparatus } + } + else = { + create_artifact_fp2_armillary_sphere_core_effect = { TYPE = miscellaneous_when_not_court } + } + } + scope:newly_created_artifact = { + # Flag this as something that can be reforged for free, if relevant. + if = { + limit = { + $OWNER$ = { has_royal_court = no } + } + set_variable = { + name = dlc_potential_court_artefact + value = yes + } + } + set_artifact_feature_group = generic_material_wood + set_artifact_feature_group = decoration_material_inlay + set_artifact_description = fp2_armillary_sphere_desc + # Let's add modifiers! + add_scaled_artifact_modifier_learning_lifestyle_xp_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_artifact_modifier = artifact_learning_per_prestige_level_modifier + } + add_scaled_artifact_modifier_grandeur_big_effect = yes + # Remove the placeholder. + remove_artifact_modifier = artifact_placeholder_modifier + } + } +} + +create_artifact_fp2_2p_chess_board_effect = { + $OWNER$ = { save_scope_as = owner } + set_artifact_rarity_common = yes + create_artifact = { + name = fp2_2p_chess_board + description = fp2_2p_chess_board_desc + type = miscellaneous_when_not_court + visuals = fp2_2p_chess_board + wealth = scope:wealth + quality = scope:quality + modifier = artifact_stress_gain_2_modifier + save_scope_as = newly_created_artifact + } + scope:newly_created_artifact = { + # Flag this as something that can be reforged for free. + set_variable = { + name = dlc_potential_court_artefact + value = yes + } + # And used in board games. + set_variable = { + name = can_be_used_for_board_games + value = yes + } + hidden_effect = { add_artifact_modifier = artifact_befriend_scheme_phase_duration_add_2_modifier } + } +} + +create_artifact_fp2_4p_chess_board_effect = { + $OWNER$ = { save_scope_as = owner } + set_artifact_rarity_masterwork = yes + create_artifact = { + name = fp2_4p_chess_board + description = fp2_4p_chess_board_desc + type = miscellaneous_when_not_court + visuals = fp2_4p_chess_board + wealth = scope:wealth + quality = scope:quality + modifier = artifact_stress_gain_4_modifier + save_scope_as = newly_created_artifact + } + scope:newly_created_artifact = { + # Flag this as something that can be reforged for free. + set_variable = { + name = dlc_potential_court_artefact + value = yes + } + # And used in board games. + set_variable = { + name = can_be_used_for_board_games + value = yes + } + hidden_effect = { add_artifact_modifier = artifact_befriend_scheme_phase_duration_add_4_modifier } + } +} + +create_artifact_fp2_andalusian_aquamanile_core_effect = { + create_artifact = { + name = fp2_andalusian_aquamanile + # Description will be regenerated in the post-creation effects, since we need to nab materials. + description = placeholder + type = $TYPE$ + visuals = fp2_andalusian_aquamanile + wealth = scope:wealth + quality = scope:quality + modifier = artifact_negate_health_penalty_add_2_modifier + save_scope_as = newly_created_artifact + } +} + +create_artifact_fp2_andalusian_aquamanile_effect = { + # Set up general scopes. + $OWNER$ = { save_scope_as = owner } + $SMITH$ = { save_scope_as = maker } + # Begin creating. + hidden_effect_new_object = { + # Get artifact quality, wealth, and materials. + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + # Create the artifact. + scope:owner = { + if = { + limit = { has_royal_court = yes } + create_artifact_fp2_andalusian_aquamanile_core_effect = { TYPE = jug } + } + else = { + create_artifact_fp2_andalusian_aquamanile_core_effect = { TYPE = miscellaneous_when_not_court } + } + } + scope:newly_created_artifact = { + # Flag this as something that can be reforged for free, if relevant. + if = { + limit = { + $OWNER$ = { has_royal_court = no } + } + set_variable = { + name = dlc_potential_court_artefact + value = yes + } + } + set_artifact_feature_group = goblet_material + set_artifact_feature_group = decoration_material_inlay + set_artifact_description = fp2_andalusian_aquamanile_desc + # Let's add modifiers! + ## Illustrious gets to be very swanky. + if = { + limit = { rarity = illustrious } + add_2_scaled_artifact_modifier_devotion_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + } + ## Common is a bit meh. + else_if = { + limit = { rarity = common } + add_scaled_artifact_modifier_devotion_effect = yes + } + ## Everything else is decent. + else = { add_2_scaled_artifact_modifier_devotion_effect = yes } + } + } +} + +fp2_enforce_truce_opinion_effect = { + if = { + limit = { scope:target.attacker_war_score >= fp2_enforce_truce_war_score_value } + reverse_add_opinion = { + target = scope:target.primary_attacker + modifier = fp2_enforced_truce_opinion + opinion = -20 + } + reverse_add_opinion = { + target = scope:target.primary_defender + modifier = fp2_enforced_truce_opinion + opinion = 20 + } + } + else_if = { + limit = { scope:target.defender_war_score >= fp2_enforce_truce_war_score_value } + reverse_add_opinion = { + target = scope:target.primary_defender + modifier = fp2_enforced_truce_opinion + opinion = -20 + } + reverse_add_opinion = { + target = scope:target.primary_attacker + modifier = fp2_enforced_truce_opinion + opinion = 20 + } + } + else = { + reverse_add_opinion = { + target = scope:target.primary_defender + modifier = fp2_enforced_truce_opinion + opinion = -10 + } + reverse_add_opinion = { + target = scope:target.primary_attacker + modifier = fp2_enforced_truce_opinion + opinion = -10 + } + } +} + +############################################################## +# Generic Scripted Effect: Get Lowest/Highest Player Skill +# By Hugo Cortell +################################ + +# (simplified for readability) + +get_lowest_player_skill_effect = { + save_scope_value_as = { + name = lowest_player_skill + value = flag:diplomacy + } + save_scope_value_as = { + name = lowest_player_skill_value + value = diplomacy + } + if = { + limit = { martial < scope:lowest_player_skill_value } + save_scope_value_as = { + name = lowest_player_skill + value = flag:martial + } + save_scope_value_as = { + name = lowest_player_skill_value + value = martial + } + } + if = { + limit = { stewardship < scope:lowest_player_skill_value } + save_scope_value_as = { + name = lowest_player_skill + value = flag:stewardship + } + save_scope_value_as = { + name = lowest_player_skill_value + value = stewardship + } + } + if = { + limit = { intrigue < scope:lowest_player_skill_value } + save_scope_value_as = { + name = lowest_player_skill + value = flag:intrigue + } + save_scope_value_as = { + name = lowest_player_skill_value + value = intrigue + } + } + if = { + limit = { learning < scope:lowest_player_skill_value } + save_scope_value_as = { + name = lowest_player_skill + value = flag:learning + } + save_scope_value_as = { + name = lowest_player_skill_value + value = learning + } + } +} + +get_highest_player_skill_effect = { + save_scope_value_as = { + name = highest_player_skill + value = flag:diplomacy + } + save_scope_value_as = { + name = highest_player_skill_value + value = diplomacy + } + if = { + limit = { martial > scope:highest_player_skill_value } + save_scope_value_as = { + name = highest_player_skill + value = flag:martial + } + save_scope_value_as = { + name = highest_player_skill_value + value = martial + } + } + if = { + limit = { stewardship > scope:highest_player_skill_value } + save_scope_value_as = { + name = highest_player_skill + value = flag:stewardship + } + save_scope_value_as = { + name = highest_player_skill_value + value = stewardship + } + } + if = { + limit = { intrigue > scope:highest_player_skill_value } + save_scope_value_as = { + name = highest_player_skill + value = flag:intrigue + } + save_scope_value_as = { + name = highest_player_skill_value + value = intrigue + } + } + if = { + limit = { learning > scope:highest_player_skill_value } + save_scope_value_as = { + name = highest_player_skill + value = flag:learning + } + save_scope_value_as = { + name = highest_player_skill_value + value = learning + } + } +} + +fp2_struggle_found_kingdom_toledo_empire_effect = { + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:k_toledo = { + change_title_holder = { + holder = root + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + title:d_toledo = { add_to_list = kingdom_toledo_absorb_list } + if = { + limit = { NOT = { exists = scope:has_kingdom_toledo_absorb_list_been_created } } + ordered_held_title = { + title_tier = duchy + limit = { + is_titular = no + NOT = { this = title:d_toledo } + root = { completely_controls = prev } + any_title_to_title_neighboring_and_across_water_duchy = { this = title:d_toledo } + de_jure_liege = { + any_in_de_jure_hierarchy = { + count > 2 + tier = tier_duchy + } + } + } + order_by = { + value = 0 + every_de_jure_county = { + limit = { any_neighboring_county = { de_jure_liege = title:d_toledo } } + add = 1 + } + } + add_to_list = kingdom_toledo_absorb_list + } + } + every_in_list = { + list = kingdom_toledo_absorb_list + if = { + limit = { + exists = de_jure_liege.holder + de_jure_liege.holder != root + } + de_jure_liege.holder = { add_to_list = kingdom_toledo_opinion_list } + } + set_de_jure_liege_title = title:k_toledo + } + hidden_effect = { title:k_toledo = { set_de_jure_liege_title = title:e_spain } } + every_in_list = { + list = kingdom_toledo_opinion_list + limit = { is_ai = yes } + add_opinion = { + target = root + modifier = absorbed_de_jure_opinion + } + } + #Prestige + add_prestige = massive_prestige_gain + add_character_modifier = { + modifier = fp2_form_kingdom_toledo_modifier + years = 10 + } +} + +fp2_struggle_hostility_ender_effect = { + give_nickname = nick_the_conquistador +} + +fp2_struggle_compromise_ender_effect = { + give_nickname = nick_the_pragmatic + dynasty = { add_dynasty_prestige = 10000 } +} + +fp2_struggle_compromise_tooltip_effect = { + # De Jure Kingdoms will become De Jure Empires + custom_tooltip = struggle_compromise_duchy_transfer_tt + custom_tooltip = fp2_struggle_compromise_create_new_empires_tt + # RIP Hispania + custom_tooltip = fp2_struggle_compromise_destroy_hispania_tt + if = { + limit = { + struggle:iberian_struggle = { + any_involved_ruler = { + count > 1 + top_liege = this + primary_title = { is_mercenary_company = no } + } + } + # Every Involved ruler gets a 10 year truce with every other + custom_tooltip = fp2_struggle_compromise_truce_tt + } + } + custom_tooltip = fp2_struggle_compromise_war_cost_tt +} + +fp2_struggle_conciliation_ender_effect = { + give_nickname = nick_the_equitable + dynasty = { add_dynasty_prestige = 10000 } +} + +fp2_struggle_conciliation_tooltip_effect = { + # Hispania is available! + custom_tooltip = fp2_struggle_can_create_empire_of_hispania_tt + # All Involved cultures gain acceptance of each other + custom_tooltip = fp2_struggle_conciliation_culture_tt + # Interfaith marriage unlocked for Involved cultures + custom_tooltip = fp2_struggle_conciliation_marriage_unlocked_tt + # Declaring holy wars is perma-disabled for locals in the region + custom_tooltip = fp2_struggle_conciliation_holy_war_disabled_tt + # Involved cultures/faiths can offer to join defensive wars with outsiders targetting Iberia + custom_tooltip = fp2_struggle_conciliation_join_war_tt + # Caravanserai line of buildings unlocked for Iberia + custom_tooltip = fp2_struggle_conciliation_caravanserai_unlock_tt +} diff --git a/N3OW/common/scripted_effects/03_dlc_fp3_artifact_creation_effects.txt b/N3OW/common/scripted_effects/03_dlc_fp3_artifact_creation_effects.txt new file mode 100644 index 00000000..b2ce4b76 --- /dev/null +++ b/N3OW/common/scripted_effects/03_dlc_fp3_artifact_creation_effects.txt @@ -0,0 +1,436 @@ +########################### +# Oxus Bracelet + +create_artifact_oxus_bracelet_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_oxus_bracelet_name + description = artifact_oxus_bracelet_description + type = pedestal + visuals = oxus_bracelet + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + } + + #if = { + # limit = { exists = scope:adventurer } + # create_artifact = { + # name = artifact_necklace_name + # description = placeholder #properly set later + # visuals = necklace + # type = necklace + # modifier = artifact_placeholder_modifier + # wealth = scope:wealth + # quality = scope:quality + # save_scope_as = newly_created_artifact + # history = { + # location = scope:location.title_province + # actor = scope:adventurer + # recipient = root + # type = given + # } + # } + #} + #else = { + # create_artifact = { + # name = artifact_necklace_name + # creator = scope:owner + # description = placeholder #properly set later + # visuals = necklace + # type = necklace + # modifier = artifact_placeholder_modifier + # wealth = scope:wealth + # quality = scope:quality + # save_scope_as = newly_created_artifact + # } + #} + + hidden_effect_new_object = { + scope:newly_created_artifact = { + remove_artifact_modifier = artifact_placeholder_modifier + + # Set some Prestige and Grandeur + add_scaled_artifact_modifier_prestige_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + + # Let's add a random secondary effect + random_list = { + 35 = { + add_scaled_artifact_modifier_majesty_effect = yes + } + 35 = { + add_scaled_artifact_modifier_dynasty_prestige_effect = yes + } + 15 = { + add_2_scaled_artifact_modifier_majesty_effect = yes + } + 15 = { + add_scaled_artifact_modifier_attractiveness_effect = yes + } + } + } + } +} + +########################### +# Persian Drinking Vessel + +create_artifact_persian_drinking_vessel_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + $SMITH$ = { save_scope_as = goldsmith } + + hidden_effect_new_object = { + # Get artifact quality, wealth, and materials + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + # Create the artifact + scope:owner = { + if = { + limit = { exists = scope:adventurer } + create_artifact = { + name = artifact_goblet_name + description = placeholder + visuals = persian_drinking_vessel + type = goblet + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + location = scope:location.title_province + actor = scope:adventurer + recipient = root + type = discovered + } + } + } + else = { + create_artifact = { + name = artifact_goblet_name + creator = scope:goldsmith + description = placeholder + visuals = persian_drinking_vessel + type = goblet + wealth = scope:wealth + quality = scope:quality + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + } + } + } + scope:newly_created_artifact = { + set_artifact_description = artifact_goblet_description + + # Set grandeur + add_scaled_artifact_modifier_grandeur_small_effect = yes + + # Let's add another random effect + random_list = { + 10 = { + add_scaled_artifact_modifier_minor_prestige_effect = yes + } + 10 = { + add_scaled_artifact_modifier_majesty_effect = yes + } + 30 = { + trigger = { rarity = common } + # Common goblets have a chance to not get any extra modifiers + } + } + remove_artifact_modifier = artifact_placeholder_modifier + } + } +} + +########################### +# Incense Burner Sculpture + +create_artifact_fp3_incense_burner_sculpture_effect_base = { + create_artifact = { + name = fp3_incense_burner_sculpture + # Description will be regenerated in the post-creation effects, since we need to nab materials. + description = placeholder + type = $TYPE$ + visuals = fp3_incense_burner_sculpture + wealth = scope:wealth + quality = scope:quality + modifier = artifact_negate_health_penalty_add_2_modifier + save_scope_as = newly_created_artifact + } +} + +create_artifact_fp3_incense_burner_sculpture_effect = { + # Set up general scopes. + $OWNER$ = { save_scope_as = owner } + $SMITH$ = { save_scope_as = maker } + # Begin creating. + hidden_effect_new_object = { + # Get artifact quality, wealth, and materials. + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + # Create the artifact. + scope:owner = { + if = { + limit = { has_royal_court = yes } + create_artifact_fp3_incense_burner_sculpture_effect_base = { TYPE = sculpture } + } + else = { + create_artifact_fp3_incense_burner_sculpture_effect_base = { TYPE = miscellaneous_when_not_court } + } + } + scope:newly_created_artifact = { + # Flag this as something that can be reforged for free, if relevant. + if = { + limit = { + $OWNER$ = { has_royal_court = no } + } + set_variable = { + name = dlc_potential_court_artefact + value = yes + } + } + set_artifact_feature_group = goblet_material + set_artifact_feature_group = decoration_material_inlay + set_artifact_description = fp3_incense_burner_sculpture_desc + # Let's add modifiers! + ## Illustrious gets to be very swanky. + if = { + limit = { rarity = illustrious } + add_scaled_artifact_modifier_prestige_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + add_scaled_artifact_modifier_stress_gain_effect = yes + add_scaled_artifact_modifier_attractiveness_effect = yes + } + ## Famed + else_if = { + limit = { rarity = famed } + add_scaled_artifact_modifier_prestige_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + add_scaled_artifact_modifier_stress_gain_effect = yes + } + ## Masterwork + else_if = { + limit = { rarity = masterwork } + add_scaled_artifact_modifier_prestige_effect = yes + add_scaled_artifact_modifier_stress_gain_effect = yes + } + ## Common + else_if = { + limit = { rarity = common } + add_scaled_artifact_modifier_stress_gain_effect = yes + } + } + } +} + + +########################### +# Sassanian Sword + +create_artifact_sassanian_sword_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + + random_list = { + 1 = { set_artifact_rarity_masterwork = yes } + 3 = { set_artifact_rarity_famed = yes } + 2 = { set_artifact_rarity_illustrious = yes } + } + + # Create the artifact + create_artifact = { + name = artifact_sassanian_sword_name + description = artifact_sassanian_sword_description + type = regalia + template = regalia_template + visuals = sassanian_sword + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + } + + hidden_effect_new_object = { + scope:newly_created_artifact = { + # Prestige modifier is scaled based on the Wealth of the artifact (opulence). + add_scaled_artifact_modifier_minor_prestige_effect = yes + + # Add a combat-related modifiers, 2 of them if it's famed. + if = { + limit = { + rarity = famed + } + add_2_scaled_artifact_modifier_combat_effect = yes + } + else = { + add_scaled_artifact_modifier_combat_effect = yes + } + + # Add a Majesty-related modifier based on the Quality of the artifact. + if = { + limit = { # Add a second Majesty-related modifier for high rarity artifacts. + OR = { + rarity = famed + rarity = illustrious + } + } + add_2_scaled_artifact_modifier_majesty_effect = yes + } + else = { + add_scaled_artifact_modifier_majesty_effect = yes + } + + add_scaled_artifact_modifier_attractiveness_effect = yes + + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + } + } +} + +create_artifact_illustrious_sassanian_sword_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { save_scope_as = owner } + # Not really used, but if we don't set the scopes we get errors in the feature selection + set_artifact_rarity_illustrious = yes + + # Create the artifact + create_artifact = { + name = artifact_sassanian_sword_name + description = artifact_sassanian_sword_description + type = regalia + template = regalia_template + visuals = sassanian_sword + wealth = scope:wealth + quality = scope:quality + history = { + type = created_before_history + } + modifier = artifact_placeholder_modifier + save_scope_as = newly_created_artifact + } + + hidden_effect_new_object = { + scope:newly_created_artifact = { + # Prestige modifier is scaled based on the Wealth of the artifact (opulence). + set_variable = sassanian_sword + add_scaled_artifact_modifier_minor_prestige_effect = yes + add_2_scaled_artifact_modifier_combat_effect = yes + add_2_scaled_artifact_modifier_majesty_effect = yes + add_scaled_artifact_modifier_attractiveness_effect = yes + + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + } + } +} + +########################### +# Ancient Drinking Vessel + +create_artifact_fp3_ancient_drinking_vessel_effect_base = { + create_artifact = { + name = fp3_ancient_drinking_vessel + description = placeholder + visuals = persian_drinking_vessel + type = $TYPE$ + wealth = scope:wealth + quality = scope:quality + #decaying = no + modifier = artifact_negate_health_penalty_add_2_modifier + save_scope_as = newly_created_artifact + history = { type = created_before_history } + } +} + +create_artifact_fp3_ancient_drinking_vessel_effect = { + # Set up general scopes. + $OWNER$ = { save_scope_as = owner } + # Begin creating. + hidden_effect_new_object = { + random_list = { + 1 = { set_artifact_rarity_illustrious = yes } + 2 = { set_artifact_rarity_famed = yes } + 3 = { set_artifact_rarity_masterwork = yes } + 1 = { set_artifact_rarity_common = yes } + } + # Create the artifact. + scope:owner = { + if = { + limit = { has_royal_court = yes } + create_artifact_fp3_ancient_drinking_vessel_effect_base = { TYPE = goblet } + } + else = { + create_artifact_fp3_ancient_drinking_vessel_effect_base = { TYPE = miscellaneous_when_not_court } + } + } + scope:newly_created_artifact = { + set_artifact_description = fp3_ancient_drinking_vessel_desc + # Flag this as something that can be reforged for free, if relevant. + if = { + limit = { + $OWNER$ = { has_royal_court = no } + } + set_variable = { + name = dlc_potential_court_artefact + value = yes + } + } + + # Let's add modifiers! + ## Illustrious gets to be very swanky. + if = { + limit = { rarity = illustrious } + add_scaled_artifact_modifier_prestige_effect = yes + add_scaled_artifact_modifier_stress_gain_effect = yes + add_scaled_artifact_modifier_attractiveness_effect = yes + } + ## Famed + else_if = { + limit = { rarity = famed } + add_scaled_artifact_modifier_prestige_effect = yes + add_scaled_artifact_modifier_stress_gain_effect = yes + } + ## Masterwork + else_if = { + limit = { rarity = masterwork } + add_scaled_artifact_modifier_prestige_effect = yes + add_scaled_artifact_modifier_stress_gain_effect = yes + } + ## Common + else_if = { + limit = { rarity = common } + add_scaled_artifact_modifier_stress_gain_effect = yes + } + } + } +} diff --git a/N3OW/common/scripted_effects/03_dlc_fp3_scripted_effects.txt b/N3OW/common/scripted_effects/03_dlc_fp3_scripted_effects.txt new file mode 100644 index 00000000..cca8325a --- /dev/null +++ b/N3OW/common/scripted_effects/03_dlc_fp3_scripted_effects.txt @@ -0,0 +1,748 @@ +claim_the_imamate_scripted_effect = { + # Create a HoF title & assign it appropriately. + if = { + limit = { + faith.religious_head != root + } + hidden_effect = { + # Are we Nizari? + if = { + limit = { faith = faith:nizari } + # Transfer the title. + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + title:d_nizari = { + change_title_holder = { + holder = scope:founder + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + faith = { set_religious_head_title = title:d_nizari } + + # Set up the remaining bits'n'bobs. + if = { + limit = { + NOT = { has_realm_law = same_faith_succession_law } + } + add_realm_law_skip_effects = same_faith_succession_law + } + title:d_nizari = { add_title_law = temporal_head_of_faith_succession_law } + # Make it the HoF head. + } + # Are we Zayidi? + else_if = { + limit = { faith = faith:zayidi } + # Transfer the title. + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + title:d_zayidi = { + change_title_holder = { + holder = scope:founder + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + faith = { set_religious_head_title = title:d_zayidi } + + # Set up the remaining bits'n'bobs. + if = { + limit = { + NOT = { has_realm_law = same_faith_succession_law } + } + add_realm_law_skip_effects = same_faith_succession_law + } + title:d_zayidi = { add_title_law = temporal_head_of_faith_succession_law } + # Make it the HoF head. + } + # Are we Twelvers? + else_if = { + limit = { faith = faith:imami } + # Transfer the title. + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + title:d_imami = { + change_title_holder = { + holder = scope:founder + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + faith = { set_religious_head_title = title:d_imami } + + # Set up the remaining bits'n'bobs. + if = { + limit = { + NOT = { has_realm_law = same_faith_succession_law } + } + add_realm_law_skip_effects = same_faith_succession_law + } + title:d_imami = { add_title_law = temporal_head_of_faith_succession_law } + # Make it the HoF head. + } + # Are we Ismailis? + else_if = { + limit = { faith = faith:ismaili } + # Transfer the title. + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + title:d_ismaili = { + change_title_holder = { + holder = scope:founder + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + faith = { set_religious_head_title = title:d_ismaili } + + # Set up the remaining bits'n'bobs. + if = { + limit = { + NOT = { has_realm_law = same_faith_succession_law } + } + add_realm_law_skip_effects = same_faith_succession_law + } + title:d_ismaili = { add_title_law = temporal_head_of_faith_succession_law } + # Make it the HoF head. + } + # If not, follow the usual flow. + else = { + set_up_dynamic_temporal_hof_title_effect = { NEW_HOLDER = scope:founder } + faith = { set_religious_head_title = scope:new_title } + } + } + custom_tooltip = appoint_a_righteous_caliph_decision.tt.you_become_caliph + } + dynasty = { + add_dynasty_modifier = { + modifier = fp3_light_of_the_walayah_modifier + years = 100 + } + # Also gain a large amount of dynasty prestige. + add_dynasty_prestige = 5000 + } +} + +avenge_the_battle_of_nahrawan_scripted_effect = { + + give_nickname = nick_the_avenger + add_character_modifier = { + modifier = fp3_azariqa_ascendancy_modifier + } + + add_prestige = massive_prestige_gain + + #Religious bonuses + add_piety = major_piety_gain + faith = { + change_fervor = { + value = medium_fervor_gain + desc = fervor_gain_avenged_battle_of_nahrawan + } + } + + if = { + limit = { + any_vassal_or_below = { + NOT = { + faith = { has_doctrine = muhammad_succession_muhakkima_doctrine } + } + is_ai = yes + capital_province ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_persian_empire + } + } + } + } + every_vassal_or_below = { + custom = every_non_muhakkima_vassal_middle_east + limit = { + NOT = { + faith = { has_doctrine = muhammad_succession_muhakkima_doctrine } + } + is_ai = yes + capital_province ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_persian_empire + } + } + } + random = { + chance = 25 + set_character_faith = scope:avenger.faith + } + } + } + + if = { + limit = { + any_realm_province = { + NOT = { + faith = { has_doctrine = muhammad_succession_muhakkima_doctrine } + } + OR = { + geographical_region = world_middle_east + geographical_region = world_persian_empire + } + } + } + every_realm_province = { + limit = { + NOT = { + faith = { has_doctrine = muhammad_succession_muhakkima_doctrine } + } + OR = { + geographical_region = world_middle_east + geographical_region = world_persian_empire + } + } + county = { + add_to_list = every_realm_county + } + } + + every_in_list = { + list = every_realm_county + custom = every_non_muhakkima_faith_county_middle_east + random = { + chance = 25 + custom_tooltip = every_non_avenger_faith_convert + hidden_effect = { set_county_faith = scope:avenger.faith } + } + } + } + + if = { + limit = { exists = scope:sunni_faith } + scope:sunni_faith = { + change_fervor = { + value = medium_fervor_loss + desc = fervor_loss_avenged_battle_of_nahrawan + } + } + } + if = { + limit = { exists = scope:shia_faith } + scope:shia_faith = { + change_fervor = { + value = medium_fervor_loss + desc = fervor_loss_avenged_battle_of_nahrawan + } + } + } +} + +promote_persian_scripture_scripted_effect = { + + if = { + limit = { + exists = faith.religious_head + this != faith.religious_head + } + custom_tooltip = fp3_promoted_scriptures_caliph_angry.tt + } + + add_character_modifier = { + modifier = fp3_promoted_persian_scripture_modifier + } + + if = { + limit = { is_ai = no } #this is so that we don't get AI converting Persia too quickly + custom_tooltip = fp3_promoted_scriptures_conversion_bonus.tt + } + + if = { + limit = { + faith = { has_doctrine = doctrine_pluralism_fundamentalist } + NOT = { + has_trait = cynical + has_trait = excommunicated + } + } + custom_tooltip = { + text = promote_persian_scripture_fundamentalist_stress + add_stress = promote_persian_scripture_fundamentalist_stress_value + } + } + + if = { + limit = { + any_realm_province = { + culture = { has_cultural_pillar = heritage_iranian } + OR = { + geographical_region = world_steppe_tarim + geographical_region = world_persian_empire + } + } + } + every_realm_province = { + limit = { + culture = { has_cultural_pillar = heritage_iranian } + OR = { + geographical_region = world_steppe_tarim + geographical_region = world_persian_empire + } + } + county = { + add_to_list = every_realm_county + } + } + + every_in_list = { + list = every_realm_county + custom = every_iranian_county + random = { + chance = 33 + add_county_modifier = { + modifier = fp3_persian_resurgence_county_modifier + years = 50 + } + } + } + } + + if = { + limit = { + any_vassal_or_below = { + is_ai = yes + OR = { + culture = { has_cultural_pillar = heritage_arabic } + AND = { + knows_language_of_culture = culture:levantine + OR = { + has_trait = zealous + has_trait = stubborn + has_trait = humble + } + } + } + } + } + every_vassal_or_below = { + custom = every_contrarian_vassal + limit = { + is_ai = yes + OR = { + culture = { has_cultural_pillar = heritage_arabic } + AND = { + knows_language_of_culture = culture:levantine + OR = { + has_trait = zealous + has_trait = stubborn + has_trait = humble + } + } + } + } + add_opinion = { + target = scope:persian_fanboy + modifier = fp3_disrespected_word_of_god_opinion + opinion = -30 + } + } + } +} + +read_name_in_friday_prayer_guts_become_supporter_effect = { + hidden_effect = { remove_trait = fp3_struggle_detractor } + add_trait_force_tooltip = fp3_struggle_supporter + add_character_modifier = { + modifier = fp3_displayed_pious_submission_to_caliph_modifier + years = 20 + } +} + +read_name_in_friday_prayer_guts_become_detractor_effect = { + hidden_effect = { remove_trait = fp3_struggle_supporter } + add_trait_force_tooltip = fp3_struggle_detractor + add_character_modifier = { + modifier = fp3_name_read_in_friday_prayer_modifier + years = 20 + } +} + +read_name_in_friday_prayer_guts_apply_sundry_changes_effect = { + # More like notoriety, but potato-potatoe. + if = { + limit = { + NOT = { exists = scope:prestige_gained } + } + add_prestige = medium_prestige_gain + } + # Are we getting an extra surcharge of stress? + if = { + limit = { fp3_name_read_in_friday_prayer_decision_liege_requirements_trigger = no } + add_stress = major_stress_gain + } + # Plus check who the current caliph is so we can see who you swore to. + set_variable = { + name = last_explicit_friday_prayer_caliph + value = title:d_sunni.holder + } +} + +read_name_in_friday_prayer_guts_apply_house_unity_changes_effect = { + # Twiddle with house unity a smidge. + ## We need to invert the triggers before the decision is taken, so we add a flag that'll only be applied when the effect runs. + add_character_flag = fp3_friday_prayer_twiddling_house_unity_force_correct_ui + ## Ok, now, what's the UI look like before the decision is taken? + ### Moving out of sync. + if = { + limit = { + NOT = { has_character_flag = fp3_friday_prayer_twiddling_house_unity_force_correct_ui } + exists = house.house_head + this != house.house_head + OR = { + AND = { + has_trait = fp3_struggle_supporter + house.house_head = { has_trait = fp3_struggle_supporter } + } + AND = { + has_trait = fp3_struggle_detractor + house.house_head = { has_trait = fp3_struggle_detractor } + } + } + } + add_clan_unity_interaction_effect = { + CHARACTER = root + TARGET = root.house.house_head + VALUE = major_unity_loss + DESC = clan_unity_name_read_in_friday_prayer_rebellious.desc + REVERSE_NON_HOUSE_TARGET = no + } + } + ### Moving into sync. + else_if = { + limit = { + NOT = { has_character_flag = fp3_friday_prayer_twiddling_house_unity_force_correct_ui } + exists = house.house_head + this != house.house_head + OR = { + AND = { + has_trait = fp3_struggle_detractor + house.house_head = { has_trait = fp3_struggle_supporter } + } + AND = { + has_trait = fp3_struggle_supporter + house.house_head = { has_trait = fp3_struggle_detractor } + } + } + } + add_clan_unity_interaction_effect = { + CHARACTER = root + TARGET = root.house.house_head + VALUE = medium_unity_gain + DESC = clan_unity_name_read_in_friday_prayer.desc + REVERSE_NON_HOUSE_TARGET = no + } + } + ## And what's it look like after? + ### Moving into sync. + if = { + limit = { + has_character_flag = fp3_friday_prayer_twiddling_house_unity_force_correct_ui + exists = house.house_head + this != house.house_head + OR = { + AND = { + has_trait = fp3_struggle_supporter + house.house_head = { has_trait = fp3_struggle_supporter } + } + AND = { + has_trait = fp3_struggle_detractor + house.house_head = { has_trait = fp3_struggle_detractor } + } + } + } + add_clan_unity_interaction_effect = { + CHARACTER = root + TARGET = root.house.house_head + VALUE = medium_unity_gain + DESC = clan_unity_name_read_in_friday_prayer.desc + REVERSE_NON_HOUSE_TARGET = no + } + } + ### Moving out of sync. + else_if = { + limit = { + has_character_flag = fp3_friday_prayer_twiddling_house_unity_force_correct_ui + exists = house.house_head + this != house.house_head + OR = { + AND = { + has_trait = fp3_struggle_detractor + house.house_head = { has_trait = fp3_struggle_supporter } + } + AND = { + has_trait = fp3_struggle_supporter + house.house_head = { has_trait = fp3_struggle_detractor } + } + } + } + add_clan_unity_interaction_effect = { + CHARACTER = root + TARGET = root.house.house_head + VALUE = major_unity_loss + DESC = clan_unity_name_read_in_friday_prayer_rebellious.desc + REVERSE_NON_HOUSE_TARGET = no + } + } + ## Aaaaand remove the very legitimate and not at all hacky flag we used to trick the tooltips into behaving. + remove_character_flag = fp3_friday_prayer_twiddling_house_unity_force_correct_ui +} + +read_name_in_friday_prayer_scripted_effect = { + # Apply the appropriate modifier. + ## Neutrals pick in the event. + if = { + limit = { + NOR = { + has_trait = fp3_struggle_supporter + has_trait = fp3_struggle_detractor + } + } + show_as_tooltip = { + random_list = { + # Become a supporter. + 100 = { + show_chance = no + desc = fp3_name_read_in_friday_prayer_decision.tt.become_supporter + read_name_in_friday_prayer_guts_become_supporter_effect = yes + } + # Become a detractor. + 100 = { + show_chance = no + desc = fp3_name_read_in_friday_prayer_decision.tt.become_detractor + read_name_in_friday_prayer_guts_become_detractor_effect = yes + } + } + } + } + ## Supporters become Detractors. + else_if = { + limit = { has_trait = fp3_struggle_supporter } + read_name_in_friday_prayer_guts_become_detractor_effect = yes + struggle:persian_struggle = { + every_involved_ruler = { + custom = custom.every_opposed_involved_struggle_ruler.supporter + limit = { + this != root + has_trait = fp3_struggle_supporter + } + add_opinion = { + target = root + modifier = turncoat_opinion + opinion = -40 + } + } + every_interloper_ruler = { + custom = custom.every_opposed_interloper_struggle_ruler.supporter + limit = { + this != root + has_trait = fp3_struggle_supporter + } + add_opinion = { + target = root + modifier = turncoat_opinion + opinion = -20 + } + } + } + } + ## Detractors become Supporters. + else_if = { + limit = { has_trait = fp3_struggle_detractor } + read_name_in_friday_prayer_guts_become_supporter_effect = yes + struggle:persian_struggle = { + every_involved_ruler = { + custom = custom.every_opposed_involved_struggle_ruler.detractor + limit = { + this != root + has_trait = fp3_struggle_detractor + } + add_opinion = { + target = root + modifier = turncoat_opinion + opinion = -40 + } + } + every_interloper_ruler = { + custom = custom.every_opposed_interloper_struggle_ruler.detractor + limit = { + this != root + has_trait = fp3_struggle_detractor + } + add_opinion = { + target = root + modifier = turncoat_opinion + opinion = -20 + } + } + } + } + # Finish things off. + read_name_in_friday_prayer_guts_apply_sundry_changes_effect = yes + read_name_in_friday_prayer_guts_apply_house_unity_changes_effect = yes +} + +favour_skilled_outsiders_decision_apply_opinions_effect = { + # Courtly vassals. + every_vassal = { + custom = favour_skilled_outsiders_decision.tt.upset_elites.courtly_non_heritage + limit = { favour_skilled_outsiders_decision_grab_courtlies_trigger = yes } + add_opinion = { + target = root + modifier = upset_elites_opinion + opinion = -40 + } + } + # Landless councillors. + every_councillor = { + custom = favour_skilled_outsiders_decision.tt.upset_elites.landless_councillor_non_heritage + limit = { favour_skilled_outsiders_decision_grab_landless_councillors_trigger = yes } + add_opinion = { + target = root + modifier = upset_elites_opinion + opinion = -30 + } + } + # Remaining vassals. + every_vassal = { + custom = favour_skilled_outsiders_decision.tt.upset_elites.non_courtly_non_heritage + limit = { favour_skilled_outsiders_decision_non_courtlies_trigger = yes } + add_opinion = { + target = root + modifier = upset_elites_opinion + opinion = -20 + } + } +} + +fp3_story_cycle_seljuks_invasion_events_grant_seljuks_land_effect = { + #to display proper reason in title history, as effect is used in both event and war cb + if = { + limit = { + exists = scope:war + } + create_title_and_vassal_change = { + type = conquest + save_scope_as = change + } + } + else = { + create_title_and_vassal_change = { + type = granted + save_scope_as = change + } + } + + show_as_tooltip = { # UI/UX + scope:fp3_seljuk_settle_target = { + change_title_holder = { + holder = scope:lead_seljuk + change = scope:change + } + } + } + hidden_effect = { + scope:fp3_seljuk_settle_target = { + change_title_holder = { + holder = scope:lead_seljuk + change = scope:change + } + every_de_jure_county = { + change_title_holder = { + holder = scope:lead_seljuk + change = scope:change + } + } + } + } + if = { + limit = { + highest_held_title_tier > tier_duchy + + } + send_interface_toast = { + type = event_toast_effect_good + title = east_europe.0030.t + left_icon = scope:lead_seljuk + right_icon = scope:fp3_seljuk_settle_target + + scope:lead_seljuk = { + change_liege = { + liege = scope:seljuk_victim + change = scope:change + } + } + } + } + + + resolve_title_and_vassal_change = scope:change + + # Give them an Alliance + scope:lead_seljuk = { + save_scope_as = recipient # for loc purposes + add_opinion = { + target = scope:seljuk_victim + modifier = event_negotiated_alliance_opinion + } + } + custom_tooltip = negotiate_alliance_effect_tooltip + create_alliance = { + target = scope:lead_seljuk + allied_through_owner = scope:seljuk_victim + allied_through_target = scope:lead_seljuk + } + + # Housekeeping for the lead seljuk fella + scope:lead_seljuk = { + add_character_flag = settled_seljuk + change_government = clan_government + } +} + +set_house_head_effect = { + $NEW_HEAD$ = { save_scope_as = new_head } + $OLD_HEAD$ = { + save_scope_as = old_head + if = { + limit = { + any_held_title = { is_noble_family_title = yes } + } + random_held_title = { + limit = { is_noble_family_title = yes } + save_scope_as = nf_title + } + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = change + add_claim_on_loss = no + } + scope:nf_title = { + change_title_holder_include_vassals = { + holder = scope:new_head + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + scope:new_head.house = { set_house_head = scope:new_head } +} diff --git a/N3OW/common/scripted_effects/04_dlc_ep2_tour_effects.txt b/N3OW/common/scripted_effects/04_dlc_ep2_tour_effects.txt new file mode 100644 index 00000000..50499c3d --- /dev/null +++ b/N3OW/common/scripted_effects/04_dlc_ep2_tour_effects.txt @@ -0,0 +1,815 @@ +#Effects used in hunt events + + +##################################################################### +# EFFECT LIST +##################################################################### +# !!! Remember to add all new effects with a short description here !!! +# + +#select_root_vegetable_effect - scripted loc, gives you the name of a regionally appropriate vegetable +#tour_generic_arrival_effect - Generic effects that happen when you arrive at a vassal's holding, stress impacts +#tour_distribute_control - Decides how much control to give to counties within a stop_host's domain +#tour_monthly_pulse_effect - Fires on the monthly pulse for all phases + +###################################################################### +# EFFECTS +###################################################################### + + +#Used to find a local animal to hunt +#Note: Don't add more here without also revisiting artifact creation for Skulls and hides. +select_root_vegetable_effect = { + hidden_effect = { + if = { + limit = { + NOT = { exists = var:root_vegetable } + } + random_list = { + 10 = { + # they're everywhere + set_variable = { + name = root_vegetable + value = flag:onion + } + } + 20 = { + trigger = { province_has_vegetable_carrot_trigger = yes } + set_variable = { + name = root_vegetable + value = flag:carrot + } + } + 20 = { + trigger = { province_has_vegetable_parsnip_trigger = yes } + set_variable = { + name = root_vegetable + value = flag:parsnip + } + } + 20 = { + trigger = { province_has_vegetable_turnip_trigger = yes } + set_variable = { + name = root_vegetable + value = flag:turnip + } + } + 20 = { + trigger = { province_has_vegetable_yams_trigger = yes } + set_variable = { + name = root_vegetable + value = flag:yam + } + } + 20 = { + trigger = { province_has_vegetable_kokoro_trigger = yes } + set_variable = { + name = root_vegetable + value = flag:kokoro + } + } + 20 = { + trigger = { province_has_vegetable_ginger_trigger = yes } + set_variable = { + name = root_vegetable + value = flag:ginger + } + } + 20 = { + trigger = { province_has_vegetable_taro_trigger = yes } + set_variable = { + name = root_vegetable + value = flag:taro + } + } + 20 = { + trigger = { province_has_vegetable_daikon_radish_trigger = yes } + set_variable = { + name = root_vegetable + value = flag:daikon_radish + } + } + 20 = { + trigger = { province_has_vegetable_yam_bean_trigger = yes } + set_variable = { + name = root_vegetable + value = flag:yam_bean + } + } + 20 = { + trigger = { province_has_vegetable_lotus_root_trigger = yes } + set_variable = { + name = root_vegetable + value = flag:lotus_root + } + } + 20 = { + trigger = { province_has_vegetable_burdock_root_trigger = yes } + set_variable = { + name = root_vegetable + value = flag:burdock_root + } + } + 20 = { + trigger = { province_has_vegetable_arrowroot_trigger = yes } + set_variable = { + name = root_vegetable + value = flag:arrowroot + } + } + } + } + } +} + +traveler_progress_point_gain_effect = { + if = { + limit = { + is_alive = yes + NOT = { exists = var:travel_provinces_traversed } + } + set_variable = { + name = travel_provinces_traversed + value = $CHANGE$ + } + } + else = { + change_variable = { + name = travel_provinces_traversed + add = $CHANGE$ + } + } + save_scope_value_as = { + name = travel_base_increase + value = $CHANGE$ + } + # Tooltips + if = { + limit = { has_trait = lifestyle_traveler } + if = { + limit = { scope:travel_base_increase <= 1 } + custom_tooltip = travel_progress_towards_trait_1_tt + } + else_if = { + limit = { scope:travel_base_increase = 2 } + custom_tooltip = travel_progress_towards_trait_2_tt + } + else = { custom_tooltip = travel_progress_towards_trait_3_tt } + } + else = { custom_tooltip = travel_progress_towards_trait_0_tt } + #Random chance of additional point to increase unpredictability + hidden_effect = { + random = { + chance = 50 + change_variable = { + name = travel_provinces_traversed + add = $RANDOM_CHANGE$ + } + } + } +} + +traveler_lifestyle_rank_up_check_effect = { + if = { + limit = { + NOT = { has_trait = lifestyle_traveler } + } + hidden_effect = { + random_list = { + 15 = { + modifier = { + add = 5 + exists = var:travel_provinces_traversed + var:travel_provinces_traversed >= traveler_rank_up_10_threshold + } + modifier = { + add = 5 + exists = var:travel_provinces_traversed + var:travel_provinces_traversed >= traveler_rank_up_9_threshold + } + modifier = { + add = 5 + exists = var:travel_provinces_traversed + var:travel_provinces_traversed >= traveler_rank_up_8_threshold + } + modifier = { + add = 5 + exists = var:travel_provinces_traversed + var:travel_provinces_traversed >= traveler_rank_up_7_threshold + } + modifier = { + add = 5 + exists = var:travel_provinces_traversed + var:travel_provinces_traversed >= traveler_rank_up_6_threshold + } + modifier = { + add = 5 + exists = var:travel_provinces_traversed + var:travel_provinces_traversed >= traveler_rank_up_5_threshold + } + modifier = { + add = 5 + exists = var:travel_provinces_traversed + var:travel_provinces_traversed >= traveler_rank_up_4_threshold + } + modifier = { + add = 5 + exists = var:travel_provinces_traversed + var:travel_provinces_traversed >= traveler_rank_up_3_threshold + } + modifier = { + add = 5 + exists = var:travel_provinces_traversed + var:travel_provinces_traversed >= traveler_rank_up_2_threshold + } + modifier = { + add = 5 + exists = var:travel_provinces_traversed + var:travel_provinces_traversed >= traveler_rank_up_1_threshold + } + trigger_event = { + id = travel_events.0050 + days = { 5 10 } + } + } + 85 = {} + } + } + } + else = { + send_interface_toast = { + title = travel_xp_gain_message + if = { + limit = { exists = var:travel_provinces_traversed } + if = { + limit = { var:travel_provinces_traversed >= traveler_rank_up_10_threshold } + add_trait_xp = { + trait = lifestyle_traveler + track = travel + value = 11 + } + } + else_if = { + limit = { var:travel_provinces_traversed >= traveler_rank_up_9_threshold } + add_trait_xp = { + trait = lifestyle_traveler + track = travel + value = 10 + } + } + else_if = { + limit = { var:travel_provinces_traversed >= traveler_rank_up_8_threshold } + add_trait_xp = { + trait = lifestyle_traveler + track = travel + value = 9 + } + } + else_if = { + limit = { var:travel_provinces_traversed >= traveler_rank_up_7_threshold } + add_trait_xp = { + trait = lifestyle_traveler + track = travel + value = 8 + } + } + else_if = { + limit = { var:travel_provinces_traversed >= traveler_rank_up_6_threshold } + add_trait_xp = { + trait = lifestyle_traveler + track = travel + value = 7 + } + } + else_if = { + limit = { var:travel_provinces_traversed >= traveler_rank_up_5_threshold } + add_trait_xp = { + trait = lifestyle_traveler + track = travel + value = 6 + } + } + else_if = { + limit = { var:travel_provinces_traversed >= traveler_rank_up_4_threshold } + add_trait_xp = { + trait = lifestyle_traveler + track = travel + value = 5 + } + } + else_if = { + limit = { var:travel_provinces_traversed >= traveler_rank_up_3_threshold } + add_trait_xp = { + trait = lifestyle_traveler + track = travel + value = 4 + } + } + else_if = { + limit = { var:travel_provinces_traversed >= traveler_rank_up_2_threshold } + add_trait_xp = { + trait = lifestyle_traveler + track = travel + value = 3 + } + } + else_if = { + limit = { var:travel_provinces_traversed >= traveler_rank_up_1_threshold } + add_trait_xp = { + trait = lifestyle_traveler + track = travel + value = 2 + } + } + else = { + add_trait_xp = { + trait = lifestyle_traveler + track = travel + value = 1 + } + } + } + } + } +} + +traveler_danger_xp_effect = { + if = { + limit = { has_trait = lifestyle_traveler } + if = { + limit = { + has_perk = journey_perk + } + add_trait_xp = { + trait = lifestyle_traveler + track = danger + value = { + integer_range = { + min = { + value = $MIN$ + add = 2 + } + max = { + value = $MAX$ + add = 2 + } + } + } + } + } + else = { + add_trait_xp = { + trait = lifestyle_traveler + track = danger + value = { + integer_range = { + min = $MIN$ + max = $MAX$ + } + } + } + } + } +} + +traveler_travel_xp_effect = { + if = { + limit = { has_trait = lifestyle_traveler } + if = { + limit = { + has_perk = journey_perk + } + add_trait_xp = { + trait = lifestyle_traveler + track = travel + value = { + integer_range = { + min = { + value = $MIN$ + add = 2 + } + max = { + value = $MAX$ + add = 2 + } + } + } + } + } + else = { + add_trait_xp = { + trait = lifestyle_traveler + track = travel + value = { + integer_range = { + min = $MIN$ + max = $MAX$ + } + } + } + } + } +} + +increase_tour_success_effect = { + if = { + limit = { + scope:activity = { + has_activity_option = { + category = special_type + option = tour_type_majesty + } + } + } + custom_tooltip = tour_becomes_more_majestic_tt + } + else_if = { + limit = { + scope:activity = { + has_activity_option = { + category = special_type + option = tour_type_taxation + } + } + } + custom_tooltip = tour_becomes_more_avaricious_tt + } + else_if = { + limit = { + scope:activity = { + has_activity_option = { + category = special_type + option = tour_type_intimidation + } + } + } + custom_tooltip = tour_becomes_more_intimidating_tt + } + scope:activity = { + change_variable = { + name = tour_success_var + add = { + value = $POINTS$ + multiply = 5 + } + } + } +} + +decrease_tour_success_effect = { + if = { + limit = { + scope:activity = { + has_activity_option = { + category = special_type + option = tour_type_majesty + } + } + } + custom_tooltip = tour_becomes_less_majestic_tt + } + else_if = { + limit = { + scope:activity = { + has_activity_option = { + category = special_type + option = tour_type_taxation + } + } + } + custom_tooltip = tour_becomes_less_avaricious_tt + } + else_if = { + limit = { + scope:activity = { + has_activity_option = { + category = special_type + option = tour_type_intimidation + } + } + } + custom_tooltip = tour_becomes_less_intimidating_tt + } + scope:activity = { + change_variable = { + name = tour_success_var + subtract = $POINTS$ + } + } +} + +tour_stop_host_effect = { + set_variable = { + name = stop_host + value = scope:host.location.county.holder + } + var:stop_host = { + # Remove character flag which prevents vassals to be visited from starting other activities + if = { + limit = { has_character_flag = being_visited_on_tour } + remove_character_flag = being_visited_on_tour + } + add_to_activity_without_travel = scope:activity + save_scope_as = stop_host_scope + scope:host = { + save_scope_as = visiting_liege + } + } + add_to_variable_list = { + name = tour_visited_vassals + target = var:stop_host + } +} + +tour_generic_arrival_effect = { + add_prestige = 50 + stress_impact = { + base = medium_stress_impact_loss + gregarious = minor_stress_impact_loss + arrogant = minor_stress_impact_loss + } +} + +show_tour_option_start_effect = { + if = { + limit = { + NAND = { + OR = { + involved_activity = { + has_activity_option = { + category = tour_luxuries + option = tour_luxuries_bad + } + } + involved_activity = { + has_activity_option = { + category = tour_luxuries + option = tour_luxuries_normal + } + } + } + involved_activity = { + has_activity_option = { + category = tour_entourage + option = tour_entourage_small + } + } + } + } + custom_tooltip = due_to_activity_options_tt + show_as_tooltip = { + add_prestige = { + value = 0 + if = { + limit = { + involved_activity = { + has_activity_option = { + category = tour_luxuries + option = tour_luxuries_good + } + } + } + add = 30 + } + else_if = { + limit = { + involved_activity = { + has_activity_option = { + category = tour_luxuries + option = tour_furniture_normal + } + } + } + add = medium_prestige_gain + } + else_if = { + limit = { + involved_activity = { + has_activity_option = { + category = tour_luxuries + option = tour_furniture_good + } + } + } + add = major_prestige_gain + } + if = { + limit = { + involved_activity = { + has_activity_option = { + category = tour_entourage + option = tour_entourage_normal + } + } + } + add = medium_prestige_gain + } + else_if = { + limit = { + involved_activity = { + has_activity_option = { + category = tour_entourage + option = tour_entourage_grand + } + } + } + add = major_prestige_gain + } + } + } + } +} + +tour_distribute_control = { + scope:activity = { + add_activity_log_entry = { + key = increased_control_log + tags = { good } + character = scope:visiting_liege + target = scope:stop_host_scope + show_in_conclusion = yes + if = { + limit = { + $CAPITAL$ > 0 + NOR = { # Do not apply if CAPITAL and HELD_COUNTIES are the same + $CAPITAL$ = $HELD_COUNTIES$ + $CAPITAL$ = $HELD_AND_VASSAL_COUNTIES$ + } + } + root.location.county = { change_county_control = $CAPITAL$ } + } + if = { # County titles held by your vassal and their vassals + limit = { + $HELD_AND_VASSAL_COUNTIES$ > 0 + } + if = { + limit = { + $CAPITAL$ = $HELD_AND_VASSAL_COUNTIES$ # Apply to capital if the values are the same + } + root.location.county.holder = { + every_sub_realm_county = { + custom = every_title_held_by_vassal_and_vassals + change_county_control = $HELD_AND_VASSAL_COUNTIES$ + } + } + } + else = { + root.location.county.holder = { + every_sub_realm_county = { + custom = every_title_held_by_vassal_and_vassals + limit = { + this != root.location.county + } + change_county_control = $HELD_AND_VASSAL_COUNTIES$ + } + } + } + } + else_if = { # Only apply if HELD_AND_VASSAL_COUNTIES is not applied, prevent double tooltips + limit = { + $HELD_COUNTIES$ > 0 + } + if = { + limit = { + $CAPITAL$ = $HELD_COUNTIES$ # Apply to capital if the values are the same + } + root.location.county.holder = { + every_held_title = { + custom = every_title_held_by_vassal + title_tier = county + change_county_control = $HELD_COUNTIES$ + } + } + } + else = { + root.location.county.holder = { + every_held_title = { + custom = every_title_held_by_vassal + limit = { + this != root.location.county + } + change_county_control = $HELD_COUNTIES$ + } + } + } + } + } + } +} + +tour_monthly_pulse_effect = { + scope:host = { + save_scope_as = visiting_liege + } + scope:activity.var:stop_host = { + save_scope_as = stop_host_scope + } + if = { + limit = { + scope:host = this + NOT = { + scope:activity = { exists = var:just_had_vassal_event } + } + } + set_variable = { + name = just_had_liege_event + value = yes + days = 3 + } + trigger_event = { + on_action = $ON_ACTION_POOL$_liege + } + } + else_if = { + limit = { + scope:activity.var:stop_host = this + NOT = { + scope:activity = { exists = var:just_had_liege_event } + } + } + set_variable = { + name = just_had_vassal_event + value = yes + days = 3 + } + trigger_event = { + on_action = $ON_ACTION_POOL$_vassal + } + } +} + +tour_progress_effect = { + # Progress the activity + if = { + limit = { + scope:activity = { exists = var:months_of_stop } + scope:activity = { var:months_of_stop >= 2 } + } + scope:host = { + save_scope_as = visiting_liege + location.province_owner ?= { + save_scope_as = stop_host_scope + if = { + limit = { has_character_flag = being_visited_on_tour } + remove_character_flag = being_visited_on_tour + } + } + } + trigger_event = tour_general.0510 + } + if = { + limit = { + scope:activity = { NOT = { exists = var:months_of_stop } } + } + scope:activity = { + set_variable = { + name = months_of_stop + value = 1 + } + } + } + else = { + scope:activity = { + change_variable = { + name = months_of_stop + add = 1 + } + } + } +} + +play_arrival_music_effect = { + if = { + limit = { + involved_activity.activity_location.culture = { has_graphical_india_culture_group_trigger = yes } + } + play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tours/ep2_event_grand_tour_set_india" + } + else_if = { + limit = { + involved_activity.activity_location.culture = { has_graphical_mena_culture_group_trigger = yes } + } + play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tours/ep2_event_grand_tour_set_mena" + } + else = { + play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tours/ep2_event_grand_tour_set_west" + } + if = { + limit = { + $WELCOME_LEVEL$ = welcome + } + play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tours/ep2_event_grand_tour_arrival_welcome" + } + else_if = { + limit = { + $WELCOME_LEVEL$ = neutral + } + play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tours/ep2_event_grand_tour_arrival_neutral" + } + else_if = { + limit = { + $WELCOME_LEVEL$ = suspicious + } + play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tours/ep2_event_grand_tour_arrival_suspicious" + } +} diff --git a/N3OW/common/scripted_effects/04_dlc_ep2_tournament_effects.txt b/N3OW/common/scripted_effects/04_dlc_ep2_tournament_effects.txt new file mode 100644 index 00000000..12e8be25 --- /dev/null +++ b/N3OW/common/scripted_effects/04_dlc_ep2_tournament_effects.txt @@ -0,0 +1,9020 @@ +########################### +########################### +##### CONTEST EFFECTS ##### +########################### +########################### + +######################### +##### SCORE EFFECTS ##### +######################### + +# Change score of a character for the current contest +# Used to increase/decrease chance of winning the contest based on event outcomes +activity_tournament_change_contestant_score_effect = { + save_scope_as = score_changee + if = { + limit = { + exists = scope:score_changee.involved_activity + is_participant_in_activity = scope:score_changee.involved_activity + scope:score_changee.involved_activity = { + any_guest_subset_current_phase = { + name = contestant + this = scope:score_changee + } + } + scope:score_changee = { activity_is_competing_trigger = yes } + } + if = { + limit = { exists = var:progress_to_victory } + save_scope_value_as = { + name = old_ptv + value = var:progress_to_victory + } + } + # Set score tracker + if = { + limit = { + NOT = { exists = var:progress_to_victory_score } + } + set_variable = { + name = progress_to_victory_score + value = { + value = contest_progress_$SCORE$_value + if = { + limit = { + scope:score_changee = { + is_ai = yes + NOR = { + liege.court_position:champion_court_position ?= this + involved_activity.special_guest:special_guest_champion ?= this + } + } + } + multiply = 0.5 + } + } + } + } + # Change existing score tracker + else = { + change_variable = { + name = progress_to_victory_score + add = { + value = contest_progress_$SCORE$_value + if = { + limit = { + scope:score_changee = { + is_ai = yes + NOR = { + liege.court_position:champion_court_position ?= this + involved_activity.special_guest:special_guest_champion ?= this + } + } + } + multiply = 0.5 + } + } + } + } + # Tooltip + custom_tooltip = contestant_score_$SCORE$_tt + # Update current PtV + if = { + limit = { has_activity_state = active } + if = { + limit = { + scope:score_changee.involved_activity = { activity_tournament_team_contest_trigger = yes } + } + scope:score_changee.involved_activity = { tournament_contest_update_team_ptv_effect = yes } + } + else = { + set_variable = { + name = progress_to_victory + value = progress_to_victory_active_contestant_value + } + } + } + else = { + set_variable = { + name = progress_to_victory + value = progress_to_victory_passive_contestant_value + } + } + # Toasts for qualification + if = { + limit = { + has_activity_state = passive + is_ai = no + } + if = { # No Longer Qualify + limit = { + exists = scope:old_ptv + scope:old_ptv >= scope:score_changee.involved_activity.var:progress_to_victory_threshold + var:progress_to_victory < scope:score_changee.involved_activity.var:progress_to_victory_threshold + } + send_interface_toast = { + title = tournament_unqualified_ptv_toast + left_icon = scope:score_changee + custom_tooltip = tournament_unqualified_ptv_tt + } + } + else_if = { # Now Qualify + limit = { + exists = scope:old_ptv + scope:old_ptv < scope:score_changee.involved_activity.var:progress_to_victory_threshold + var:progress_to_victory >= scope:score_changee.involved_activity.var:progress_to_victory_threshold + } + send_interface_toast = { + title = tournament_qualified_ptv_toast + left_icon = scope:score_changee + custom_tooltip = tournament_qualified_ptv_tt + } + } + } + } + else = { + if = { + limit = { exists = var:progress_to_victory } + remove_variable = progress_to_victory + } + if = { + limit = { exists = var:progress_to_victory_score } + remove_variable = progress_to_victory_score + } + if = { + limit = { exists = var:contest_aptitude } + remove_variable = contest_aptitude + } + } +} + +# Purge all tournament related variables +tournament_clear_contest_variables_effect = { + if = { + limit = { exists = var:progress_to_victory } + remove_variable = progress_to_victory + } + if = { + limit = { exists = var:progress_to_victory_score } + remove_variable = progress_to_victory_score + } + if = { + limit = { exists = var:contest_aptitude } + remove_variable = contest_aptitude + } + if = { + limit = { exists = var:mysterious_stranger_origin } + remove_variable = mysterious_stranger_origin + } + if = { + limit = { has_character_flag = resigned_contest_flag } + remove_character_flag = resigned_contest_flag + } + if = { + limit = { has_character_flag = horse_race_mysterious_stranger } + remove_character_flag = horse_race_mysterious_stranger + } + if = { + limit = { has_character_flag = contest_horse_race_war_horse } + remove_character_flag = contest_horse_race_war_horse + } + remove_character_flag = success_pivotal_flag + remove_character_flag = neutral_pivotal_flag + remove_character_flag = failure_pivotal_flag + if = { + limit = { exists = var:contest_qualified_match_wrestling } + remove_variable = contest_qualified_match_wrestling + } + if = { + limit = { exists = var:contest_semi_finalist_match_wrestling } + remove_variable = contest_semi_finalist_match_wrestling + } + if = { + limit = { exists = var:contest_finalist_match_wrestling } + remove_variable = contest_finalist_match_wrestling + } + if = { + limit = { exists = var:contest_qualified_match_duel } + remove_variable = contest_qualified_match_duel + } + if = { + limit = { exists = var:contest_semi_finalist_match_duel } + remove_variable = contest_semi_finalist_match_duel + } + if = { + limit = { exists = var:contest_finalist_match_duel } + remove_variable = contest_finalist_match_duel + } + if = { + limit = { exists = var:contest_qualified_match_joust } + remove_variable = contest_qualified_match_joust + } + if = { + limit = { exists = var:contest_semi_finalist_match_joust } + remove_variable = contest_semi_finalist_match_joust + } + if = { + limit = { exists = var:contest_finalist_match_joust } + remove_variable = contest_finalist_match_joust + } + if = { + limit = { exists = var:contest_qualified_match_board_game } + remove_variable = contest_qualified_match_board_game + } + if = { + limit = { exists = var:contest_semi_finalist_match_board_game } + remove_variable = contest_semi_finalist_match_board_game + } + if = { + limit = { exists = var:contest_finalist_match_board_game } + remove_variable = contest_finalist_match_board_game + } + if = { + limit = { exists = var:last_versus_match } + remove_variable = last_versus_match + } + if = { + limit = { exists = var:next_versus_match } + remove_variable = next_versus_match + } +} + +# Clean tournament only modifiers +tournament_clear_tournament_modifiers_effect = { + if = { + limit = { + any_character_artifact = { + has_artifact_modifier = artifact_tournament_sharpened_blade_modifier + } + } + every_character_artifact = { + remove_artifact_modifier = artifact_tournament_sharpened_blade_modifier + } + } +} + +# Purge all tournament related variables +tournament_clear_tournament_variables_effect = { + tournament_clear_contest_variables_effect = yes + if = { + limit = { exists = var:contest_versus_progress } + remove_variable = contest_versus_progress + } + if = { + limit = { exists = var:tournament_marriage_prize } + remove_variable = tournament_marriage_prize + } + if = { + limit = { has_character_flag = arrived_at_tournament_flag } + remove_character_flag = arrived_at_tournament_flag + } + if = { + limit = { has_character_modifier = tournament_melee_protector_modifier } + remove_character_modifier = tournament_melee_protector_modifier + } + if = { + limit = { has_character_flag = knows_mulan_flag } + remove_character_flag = knows_mulan_flag + } + if = { + limit = { has_character_flag = cloak_duelist_flag } + remove_character_flag = cloak_duelist_flag + } + if = { + limit = { exists = var:contest_horse_race_name } + remove_variable = contest_horse_race_name + } + if = { + limit = { exists = var:contest_horse_race_gender } + remove_variable = contest_horse_race_gender + } + if = { + limit = { exists = var:horse_race_jockey } + remove_variable = horse_race_jockey + } + clear_variable_list = tournament_favor_offers +} + +################# +### TEAM TYPE ### +################# + +# Examples: Melee, Horse Sport + +# Team contests divide competitors into two groups and compare them based on contest skills to determine winners + +# Sort competitors into 2 teams based on relationships and loyalties - on_start +tournament_contest_team_composition_effect = { + scope:activity = { + set_variable = { name = tournament_commenced } + # Players + every_guest_subset = { + name = contestant + phase = tournament_phase_$CONTEST$ + limit = { + OR = { + is_ai = no + AND = { + has_court_position = champion_court_position + liege = { is_ai = no } + } + } + tournament_contest_can_compete_trigger = yes + var:progress_to_victory >= scope:activity.var:progress_to_victory_threshold + } + add_tournament_contest_contestant_effect = { + CONTEST = $CONTEST$ + SKILL = $SKILL$ + PTV = progress_to_victory_active_contestant_value + } + } + # Filter relevant into entrants list + while = { + limit = { + any_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + count < 20 + } + any_guest_subset = { + name = contestant + phase = tournament_phase_$CONTEST$ + tournament_contest_can_compete_trigger = yes + } + } + # Determine eligible contestants + ordered_guest_subset = { + name = contestant + phase = tournament_phase_$CONTEST$ + limit = { tournament_contest_can_compete_trigger = yes } + order_by = var:progress_to_victory + add_tournament_contest_contestant_effect = { + CONTEST = $CONTEST$ + SKILL = $SKILL$ + PTV = progress_to_victory_active_contestant_value + } + } + } + # Inform liege of prestige from qualified knights + tournament_liege_qualification_toast_effect = yes + # Pick first team alpha character + random_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + limit = { this = scope:host } + alternative_limit = { + has_court_position = champion_court_position + liege = scope:host + } + alternative_limit = { is_playable_character = yes } + alternative_limit = { always = yes } + save_scope_as = new_list_member + scope:activity = { + add_to_guest_subset = { + name = team_alpha + target = scope:new_list_member + phase = tournament_phase_$CONTEST$ + } + } + save_scope_as = team_alpha_creator + } + # Pick first team beta character + random_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + limit = { + is_playable_character = yes + has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:team_alpha_creator } + this != scope:team_alpha_creator + } + alternative_limit = { + is_playable_character = yes + this != scope:team_alpha_creator + } + alternative_limit = { + this != scope:team_alpha_creator + } + weight = { + base = 1 + modifier = { + factor = 10 + has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:team_alpha_creator } + } + modifier = { + factor = 10 + AND = { + scope:team_alpha_creator = { has_activity_intent = murder_attendee_intent } + this = scope:team_alpha_creator.intent_target + } + } + modifier = { + factor = 0.5 + liege = scope:team_alpha_creator + } + modifier = { + add = 1 + top_liege = this + } + modifier = { + add = 1 + primary_title.tier >= scope:team_alpha_creator.primary_title.tier + } + } + save_scope_as = new_list_member + scope:activity = { + add_to_guest_subset = { + name = team_beta + target = scope:new_list_member + phase = tournament_phase_$CONTEST$ + } + } + } + # Randomly distribute remaining competitors to teams + ordered_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + limit = { + save_temporary_scope_as = new_list_member_temp + scope:activity = { + NOR = { + any_guest_subset_current_phase = { + name = team_alpha + this = scope:new_list_member_temp + } + any_guest_subset_current_phase = { + name = team_beta + this = scope:new_list_member_temp + } + } + } + } + order_by = { value = var:progress_to_victory } + max = 18 + check_range_bounds = no + save_scope_as = new_list_member + random_list = { # replace with more efficient script? + 10 = { + # Favor smaller team + activity_contest_team_size_modifier = { + SMALLER = alpha + LARGER = beta + } + # Relationships and loyalty + activity_contest_team_preference_modifier = { TEAM = alpha } + scope:activity = { + add_to_guest_subset = { + name = team_alpha + target = scope:new_list_member + phase = tournament_phase_$CONTEST$ + } + } + } + 10 = { + # Favor smaller team + activity_contest_team_size_modifier = { + SMALLER = beta + LARGER = alpha + } + # Relationships and loyalty + activity_contest_team_preference_modifier = { TEAM = beta } + scope:activity = { + add_to_guest_subset = { + name = team_beta + target = scope:new_list_member + phase = tournament_phase_$CONTEST$ + } + } + } + } + } + # Captains + random_guest_subset = { + name = team_alpha + weight = { + base = 1 + tournament_team_captain_modifier = yes + } + save_scope_as = alpha_captain + scope:activity = { + add_to_guest_subset = { + name = team_alpha_captain + target = scope:alpha_captain + } + } + } + random_guest_subset = { + name = team_beta + weight = { + base = 1 + tournament_team_captain_modifier = yes + } + save_scope_as = beta_captain + scope:activity = { + add_to_guest_subset = { + name = team_beta_captain + target = scope:beta_captain + } + } + } + # Update shared PtV values + tournament_contest_update_team_ptv_effect = yes + # Qualification ping + every_guest_subset = { + name = contestant + phase = tournament_phase_$CONTEST$ + if = { + limit = { + save_temporary_scope_as = new_list_member_temp + scope:activity = { + NOR = { + any_guest_subset_current_phase = { + name = team_alpha + this = scope:new_list_member_temp + } + any_guest_subset_current_phase = { + name = team_beta + this = scope:new_list_member_temp + } + } + } + } + save_scope_as = new_list_member + if = { + limit = { exists = var:contest_aptitude } + remove_variable = contest_aptitude + } + if = { + limit = { exists = var:progress_to_victory } + remove_variable = progress_to_victory + } + send_interface_toast = { + title = tournament_qualify_fail_title + left_icon = this + custom_tooltip = tournament_qualify_fail_desc + scope:activity = { + add_to_guest_subset = { + name = spectator + target = scope:new_list_member + phase = tournament_phase_$CONTEST$ + } + } + play_sound_effect = "event:/SFX/Events/Themes/sfx_event_theme_type_activity" + } + } + } + # Add Activity Log entry + add_activity_log_entry = { + key = tournament_contest_start_log + tags = { contest } + score = 20 + character = scope:host + } + # Fire starting event + every_attending_character = { + trigger_event = contest_events.0600 + } + } +} + +# Fire contest events with correct spacing +tournament_team_pulse_effect = { + scope:activity = { + every_guest_subset_current_phase = { + name = qualified + limit = { + exists = var:progress_to_victory + is_ai = no + } + trigger_event = { + on_action = contest_ongoing_event_$CONTEST$_setup_pulse + days = 1 + } + if = { + limit = { is_ai = no } + trigger_event = { + on_action = contest_ongoing_event_$CONTEST$_random_pulse + days = 7 + } + trigger_event = { + on_action = contest_ongoing_event_$CONTEST$_random_pulse + days = 14 + } + trigger_event = { + on_action = contest_ongoing_event_$CONTEST$_pivotal_pulse + days = 21 + } + } + else = { + trigger_event = { + on_action = contest_ongoing_event_$CONTEST$_ai_pulse + days = { 7 21 } + } + } + } + every_attending_character = { + limit = { + OR = { + is_in_guest_subset = { name = qualified } + is_ai = no + } + } + trigger_event = { + on_action = contest_ongoing_event_$CONTEST$_outcome_pulse + days = 25 + } + } + } +} + +# Set team ptv variables, which pool all team member's aptitude and score +tournament_contest_update_team_ptv_effect = { + set_variable = { + name = team_a_ptv + value = { + value = 25 + every_guest_subset_current_phase = { + name = team_alpha + limit = { exists = var:contest_aptitude } + add = { + value = var:contest_aptitude + divide = 10 + } + if = { + limit = { exists = var:progress_to_victory_score } + add = { + value = var:progress_to_victory_score + divide = 10 + } + } + } + } + } + set_variable = { + name = team_b_ptv + value = { + value = 25 + every_guest_subset_current_phase = { + name = team_beta + limit = { exists = var:contest_aptitude } + add = { + value = var:contest_aptitude + divide = 10 + } + if = { + limit = { exists = var:progress_to_victory_score } + add = { + value = var:progress_to_victory_score + divide = 10 + } + } + } + } + } + every_guest_subset_current_phase = { + name = team_alpha + set_variable = { + name = progress_to_victory + value = scope:activity.var:team_a_ptv + } + } + every_guest_subset_current_phase = { + name = team_beta + set_variable = { + name = progress_to_victory + value = scope:activity.var:team_b_ptv + } + } +} + +tournament_contest_winner_captain_effect = { + if = { # Original captain + limit = { + any_guest_subset = { + name = team_$WINNER$_captain + phase = tournament_phase_$CONTEST$ + is_alive = yes + } + } + random_guest_subset = { + name = team_$WINNER$_captain + phase = tournament_phase_$CONTEST$ + save_scope_as = contest_winner + } + } + else = { # New captain + random_guest_subset = { + name = winner + phase = tournament_phase_$CONTEST$ + limit = { is_alive = yes } + weight = { + base = 1 + tournament_team_captain_modifier = yes + } + save_scope_as = contest_winner + } + } + scope:activity = { + set_variable = { + name = melee_winner + value = scope:contest_winner + } + } + # Save losing captain + if = { + limit = { + any_guest_subset = { + name = team_$LOSER$_captain + phase = tournament_phase_$CONTEST$ + is_alive = yes + } + } + random_guest_subset = { + name = team_$LOSER$_captain + phase = tournament_phase_$CONTEST$ + save_scope_as = second_place + } + } + else = { + random_guest_subset = { + name = second_place + phase = tournament_phase_$CONTEST$ + limit = { is_alive = yes } + weight = { + base = 1 + tournament_team_captain_modifier = yes + } + save_scope_as = second_place + } + } +} + +# Determine winning team based on relative strength and event score - on_end +tournament_contest_team_winner_effect = { + # Achievement. + little_william_marshal_achievement_contest_end_effect = yes + scope:activity = { + tournament_contest_update_team_ptv_effect = yes + save_scope_value_as = { name = contest_complete value = flag:$CONTEST$ } + # Determine winning team + random_list = { + # ALPHA WINS + 1 = { + # Add all team member's contest ability + modifier = { add = var:team_a_ptv } + # More likely is this team's PtV is higher + modifier = { + var:team_a_ptv > var:team_b_ptv + factor = 2 + } + # If other team has less than half PtV of this team, this team wins win + modifier = { + progress_to_victory_fetch_team_a_half_value >= scope:activity.var:team_b_ptv + add = 1000 + } + every_guest_subset = { + name = team_alpha + phase = tournament_phase_$CONTEST$ + limit = { activity_tournament_valid_winner_trigger = yes } + save_scope_as = new_list_member + tournament_complete_win_contest_intent_effect = yes + scope:activity = { + add_to_guest_subset = { + name = winner + target = scope:new_list_member + phase = tournament_phase_$CONTEST$ + } + } + # Achievement. + little_william_marshal_achievement_contest_end_winner_effect = yes + } + every_guest_subset = { + name = team_beta + phase = tournament_phase_$CONTEST$ + limit = { activity_tournament_valid_winner_trigger = yes } + save_scope_as = new_list_member + scope:activity = { + add_to_guest_subset = { + name = second_place + target = scope:new_list_member + phase = tournament_phase_$CONTEST$ + } + } + } + # Save winning and losing captain + tournament_contest_winner_captain_effect = { + WINNER = alpha + LOSER = beta + CONTEST = melee + } + } + # BETA WINS + 1 = { + # Add all team member's contest ability + modifier = { add = var:team_b_ptv } + # More likely is this team's PtV is higher + modifier = { + var:team_b_ptv > var:team_a_ptv + factor = 2 + } + # If other team has less than half PtV of this team, this team wins win + modifier = { + progress_to_victory_fetch_team_b_half_value >= scope:activity.var:team_a_ptv + add = 1000 + } + every_guest_subset = { + name = team_beta + phase = tournament_phase_$CONTEST$ + limit = { activity_tournament_valid_winner_trigger = yes } + save_scope_as = new_list_member + tournament_complete_win_contest_intent_effect = yes + scope:activity = { + add_to_guest_subset = { + name = winner + target = scope:new_list_member + phase = tournament_phase_$CONTEST$ + } + } + # Achievement. + little_william_marshal_achievement_contest_end_winner_effect = yes + } + every_guest_subset = { + name = team_alpha + phase = tournament_phase_$CONTEST$ + limit = { activity_tournament_valid_winner_trigger = yes } + save_scope_as = new_list_member + scope:activity = { + add_to_guest_subset = { + name = second_place + target = scope:new_list_member + phase = tournament_phase_$CONTEST$ + } + } + } + # Save winning and losing captain + tournament_contest_winner_captain_effect = { + WINNER = beta + LOSER = alpha + CONTEST = melee + } + } + } + # Rewards + tournament_contest_team_rewards_effect = { CONTEST = $CONTEST$ } + # Add log entry + add_activity_log_entry = { + key = tournament_$CONTEST$_team_winner_log + tags = { winner contest } + score = 80 + show_in_conclusion = yes + character = scope:contest_winner + target = scope:second_place + + #Effect + show_as_tooltip = { + scope:contest_winner ?= { + # Prestige + tournament_team_winner_prestige_rewards_effect = yes + # Gold + tournament_team_winner_gold_rewards_effect = yes + # Trait + tournament_give_trait_effect = { CONTEST = $CONTEST$ } + # Modifier + add_character_modifier = { modifier = tournament_$CONTEST$_winner_modifier years = 5 } + } + } + } + # Fire host's prize award event + activity_host = { trigger_event = contest_events.0605 } + # Clear redundant variables + every_attending_character = { tournament_clear_contest_variables_effect = yes } + } +} + +################## +### TURNS TYPE ### +################## + +# Examples: Quintain, Archery, Recital +# Turn contests are determined by skill and event outcomes + +# Create competitor list and log entry +tournament_contest_turn_composition_effect = { + scope:activity = { + set_variable = { name = tournament_commenced } + # Players + every_guest_subset = { + name = contestant + phase = tournament_phase_$CONTEST$ + limit = { + OR = { + is_ai = no + AND = { + has_court_position = champion_court_position + liege = { is_ai = no } + } + } + tournament_contest_can_compete_trigger = yes + var:progress_to_victory >= scope:activity.var:progress_to_victory_threshold + } + add_tournament_contest_contestant_effect = { + CONTEST = $CONTEST$ + SKILL = $SKILL$ + PTV = progress_to_victory_active_contestant_value + } + } + # Filter relevant into entrants list + while = { + limit = { + any_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + count < 7 + } + any_guest_subset_current_phase = { + name = contestant + tournament_contest_can_compete_trigger = yes + } + } + ordered_guest_subset = { + name = contestant + phase = tournament_phase_$CONTEST$ + limit = { tournament_contest_can_compete_trigger = yes } + order_by = var:progress_to_victory + add_tournament_contest_contestant_effect = { + CONTEST = $CONTEST$ + SKILL = $SKILL$ + PTV = progress_to_victory_active_contestant_value + } + } + } + hidden_effect = { + random_list = { + 3 = { + ordered_guest_subset = { + name = contestant + phase = tournament_phase_$CONTEST$ + limit = { tournament_contest_can_compete_trigger = yes } + order_by = var:progress_to_victory + add_tournament_contest_contestant_effect = { + CONTEST = $CONTEST$ + SKILL = $SKILL$ + PTV = progress_to_victory_active_contestant_value + } + } + } + 1 = { + trigger = { + NOT = { exists = var:mysterious_stranger_appeared } + any_attending_character = { + culture = { + any_culture_county = { + exists = faith + any_direct_de_jure_vassal_title = { exists = this } + } + } + } + any_attending_character = { count <= 240 } + } + tournament_mysterious_stranger_effect = { + CONTEST = $CONTEST$ + SKILL = $SKILL$ + } + } + } + } + # Add Activity Log entry + add_activity_log_entry = { + key = tournament_contest_start_log + tags = { contest } + score = 20 + character = scope:host + } + # Inform liege of prestige from qualified knights + tournament_liege_qualification_toast_effect = yes + # Qualification ping + every_guest_subset = { + name = contestant + phase = tournament_phase_$CONTEST$ + limit = { + save_temporary_scope_as = new_list_member + NOT = { + scope:activity = { + any_guest_subset_current_phase = { + name = qualified + this = scope:new_list_member + } + } + } + } + tournament_contest_qualification_failure_effect = yes + } + # Fire starting event + every_attending_character = { + trigger_event = contest_events.0700 + } + } +} + +# Fire turn events with correct spacing +tournament_turn_pulse_effect = { + scope:activity = { + every_guest_subset_current_phase = { + name = qualified + limit = { exists = var:progress_to_victory } + trigger_event = { + on_action = contest_ongoing_event_$CONTEST$_random_pulse + days = 7 + } + trigger_event = { + on_action = contest_ongoing_event_$CONTEST$_random_pulse + days = 14 + } + trigger_event = { + on_action = contest_ongoing_event_$CONTEST$_pivotal_pulse + days = 21 + } + } + every_attending_character = { + limit = { + OR = { + is_in_guest_subset = { name = qualified } + is_ai = no + } + } + # If competing yourself, it is from your perspective, otherwise find someone relevant + tournament_pivotal_contestant_scope_effect = yes + trigger_event = { + on_action = contest_ongoing_event_$CONTEST$_outcome_pulse + days = 25 + } + } + } +} + +# Determines first, second, and third place in turn based contests +tournament_contest_turn_winner_effect = { + # Achievement. + little_william_marshal_achievement_contest_end_effect = yes + scope:activity = { + every_guest_subset = { + name = qualified + set_variable = { + name = progress_to_victory + value = progress_to_victory_active_contestant_value + } + } + save_scope_value_as = { name = contest_complete value = flag:$CONTEST$ } + # Set winner if player + if = { + limit = { + any_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + is_alive = yes + exists = var:contest_aptitude + exists = var:progress_to_victory + is_ai = no + save_temporary_scope_as = winner_temp + } + NOT = { + any_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + is_alive = yes + exists = var:contest_aptitude + exists = var:progress_to_victory + var:progress_to_victory > scope:winner_temp.var:progress_to_victory + } + } + } + random_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + limit = { + is_alive = yes + exists = var:contest_aptitude + exists = var:progress_to_victory + is_ai = no + save_temporary_scope_as = winner_temp + scope:activity = { + NOT = { + any_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + is_alive = yes + exists = var:contest_aptitude + exists = var:progress_to_victory + var:progress_to_victory > scope:winner_temp.var:progress_to_victory + } + } + } + } + save_scope_as = contest_winner + } + } + # Determine winner + else = { + random_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + limit = { + is_alive = yes + exists = var:contest_aptitude + exists = var:progress_to_victory + save_temporary_scope_as = winner_temp + } + weight = { + base = 1 + # Weights heavily on PtV, and major differences in score + tournament_contest_winner_determiner_modifier = { CHAR = scope:winner_temp CONTEST = $CONTEST$ } + } + save_scope_as = contest_winner + } + } + scope:contest_winner = { + tournament_complete_win_contest_intent_effect = yes + # Achievement. + little_william_marshal_achievement_contest_end_winner_effect = yes + } + # Determine second place + random_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + limit = { + is_alive = yes + exists = var:contest_aptitude + exists = var:progress_to_victory + this != scope:contest_winner + save_temporary_scope_as = second_temp + } + weight = { + base = 1 + # Weights heavily on PtV, and major differences in score + tournament_contest_winner_determiner_modifier = { CHAR = scope:second_temp CONTEST = $CONTEST$ } + } + save_scope_as = second_place + } + # Determine third place + random_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + limit = { + is_alive = yes + exists = var:contest_aptitude + exists = var:progress_to_victory + NOR = { + this = scope:contest_winner + this = scope:second_place + } + save_temporary_scope_as = third_temp + } + weight = { + base = 1 + # Weights heavily on PtV, and major differences in score + tournament_contest_winner_determiner_modifier = { CHAR = scope:third_temp CONTEST = $CONTEST$ } + } + save_scope_as = third_place + } + # Save all non-winner entrants so we can easily check if someone lost + every_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + limit = { + exists = var:contest_aptitude + exists = var:progress_to_victory + this != scope:contest_winner + } + add_to_list = contest_losers + } + # Save winner + add_to_guest_subset = { + name = winner + target = scope:contest_winner + phase = tournament_phase_$CONTEST$ + } + # Save podium placements for reference + add_to_guest_subset = { + name = second_place + target = scope:second_place + phase = tournament_phase_$CONTEST$ + } + add_to_guest_subset = { + name = third_place + target = scope:third_place + phase = tournament_phase_$CONTEST$ + } + # Rewards + tournament_contest_rewards_effect = { CONTEST = $CONTEST$ } + # Fire host's prize award event + activity_host = { trigger_event = contest_events.0705 } + # Clear redundant variables + every_attending_character = { tournament_clear_contest_variables_effect = yes } + } +} + +################# +### RACE TYPE ### +################# + +# Turn contests are determined by skill and event outcomes + +# Create competitor list and log entry +tournament_contest_race_composition_effect = { + # Set up contest + scope:activity = { + set_variable = { name = tournament_commenced } + # Set flavor variant + if = { + limit = { + scope:host.culture = { has_cultural_pillar = heritage_arabic } + } + set_variable = { + name = contest_horse_race_variant + value = flag:maydan + } + } + else = { + set_variable = { + name = contest_horse_race_variant + value = flag:default + } + } + # Players + every_guest_subset = { + name = contestant + phase = tournament_phase_$CONTEST$ + limit = { + is_ai = no + tournament_contest_can_compete_trigger = yes + exists = var:progress_to_victory + var:progress_to_victory >= scope:activity.var:progress_to_victory_threshold + } + add_tournament_contest_contestant_effect = { + CONTEST = $CONTEST$ + SKILL = $SKILL$ + PTV = progress_to_victory_active_contestant_value + } + } + # Filter relevant into entrants list + while = { + limit = { + any_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + count < 7 + } + any_guest_subset_current_phase = { + name = contestant + tournament_contest_can_compete_trigger = yes + } + } + ordered_guest_subset = { + name = contestant + phase = tournament_phase_$CONTEST$ + limit = { tournament_contest_can_compete_trigger = yes } + order_by = var:progress_to_victory + add_tournament_contest_contestant_effect = { + CONTEST = $CONTEST$ + SKILL = $SKILL$ + PTV = progress_to_victory_active_contestant_value + } + } + } + # Chance for mysterious stranger + hidden_effect = { + random_list = { + 3 = { + ordered_guest_subset = { + name = contestant + phase = tournament_phase_$CONTEST$ + limit = { tournament_contest_can_compete_race_trigger = yes } + order_by = var:progress_to_victory # to favor landed + add_tournament_contest_contestant_effect = { + CONTEST = $CONTEST$ + SKILL = $SKILL$ + PTV = progress_to_victory_active_contestant_value + } + } + } + 1 = { + trigger = { + NOT = { exists = var:mysterious_stranger_appeared } + any_guest_subset = { + name = contestant + phase = tournament_phase_$CONTEST$ + tournament_contest_can_compete_race_trigger = yes + } + } + random_guest_subset = { + name = contestant + phase = tournament_phase_$CONTEST$ + limit = { tournament_contest_can_compete_race_trigger = yes } + save_scope_as = mysterious_stranger + set_variable = { + name = mysterious_stranger_origin + value = scope:activity.activity_location.barony + } + add_character_flag = horse_race_mysterious_stranger + add_tournament_contest_contestant_effect = { + CONTEST = $CONTEST$ + SKILL = $SKILL$ + PTV = progress_to_victory_active_contestant_value + } + tournament_horse_race_fetch_horse_effect = yes + } + if = { + limit = { exists = scope:mysterious_stranger } + set_variable = { + name = mysterious_stranger_appeared + value = scope:mysterious_stranger + } + } + } + } + } + # Add Activity Log entry + add_activity_log_entry = { + key = tournament_contest_start_log + tags = { contest } + score = 20 + character = scope:host + } + # Inform liege of prestige from qualified knights + tournament_liege_qualification_toast_effect = yes + # Qualification ping + every_guest_subset = { + name = contestant + phase = tournament_phase_$CONTEST$ + limit = { + save_temporary_scope_as = new_list_member + NOT = { + scope:activity = { + any_guest_subset_current_phase = { + name = qualified + this = scope:new_list_member + } + } + } + } + tournament_contest_qualification_failure_effect = yes + } + # Fire starting event + every_attending_character = { + trigger_event = contest_events.0500 + } + } +} + +# Fire race events with correct spacing +tournament_race_pulse_effect = { + scope:activity = { + every_guest_subset_current_phase = { + name = qualified + limit = { exists = var:progress_to_victory } + trigger_event = { + on_action = contest_ongoing_event_$CONTEST$_random_pulse + days = 7 + } + trigger_event = { + on_action = contest_ongoing_event_$CONTEST$_random_pulse + days = 14 + } + trigger_event = { + on_action = contest_ongoing_event_$CONTEST$_pivotal_pulse + days = 21 + } + } + every_attending_character = { + limit = { + OR = { + is_in_guest_subset = { name = qualified } + is_ai = no + } + } + # If competing yourself, it is from your perspective, otherwise find someone relevant + tournament_pivotal_contestant_scope_effect = yes + trigger_event = { + on_action = contest_ongoing_event_$CONTEST$_outcome_pulse + days = 25 + } + } + } +} + +# Determines first, second, and third place in turn based contests +tournament_contest_race_winner_effect = { + # Achievement. + little_william_marshal_achievement_contest_end_effect = yes + scope:activity = { + every_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + set_variable = { + name = progress_to_victory + value = progress_to_victory_active_contestant_value + } + } + save_scope_value_as = { name = contest_complete value = flag:$CONTEST$ } + # Set winner if player + if = { + limit = { + any_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + is_alive = yes + exists = var:contest_aptitude + exists = var:progress_to_victory + is_ai = no + save_temporary_scope_as = winner_temp + } + NOT = { + any_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + is_alive = yes + exists = var:contest_aptitude + exists = var:progress_to_victory + var:progress_to_victory > scope:winner_temp.var:progress_to_victory + } + } + } + random_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + limit = { + is_alive = yes + exists = var:contest_aptitude + exists = var:progress_to_victory + is_ai = no + save_temporary_scope_as = winner_temp + scope:activity = { + NOT = { + any_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + is_alive = yes + exists = var:contest_aptitude + exists = var:progress_to_victory + var:progress_to_victory > scope:winner_temp.var:progress_to_victory + } + } + } + } + save_scope_as = contest_winner + } + } + else = { + # Determine winner + random_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + limit = { + is_alive = yes + exists = var:progress_to_victory + save_temporary_scope_as = winner_temp + } + weight = { + base = 1 + # Weights heavily on PtV, and major differences in score + tournament_contest_winner_determiner_modifier = { CHAR = scope:winner_temp CONTEST = $CONTEST$ } + } + save_scope_as = contest_winner + } + } + scope:contest_winner = { + tournament_horse_race_fetch_horse_effect = yes + tournament_complete_win_contest_intent_effect = yes + # Achievement. + little_william_marshal_achievement_contest_end_winner_effect = yes + } + # Determine second place + random_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + limit = { + is_alive = yes + exists = var:progress_to_victory + this != scope:contest_winner + save_temporary_scope_as = second_temp + } + weight = { + base = 1 + # Weights heavily on PtV, and major differences in score + tournament_contest_winner_determiner_modifier = { CHAR = scope:second_temp CONTEST = $CONTEST$ } + } + save_scope_as = second_place + tournament_horse_race_fetch_horse_effect = yes + } + # Determine third place + random_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + limit = { + is_alive = yes + exists = var:progress_to_victory + NOR = { + this = scope:contest_winner + this = scope:second_place + } + save_temporary_scope_as = third_temp + } + weight = { + base = 1 + # Weights heavily on PtV, and major differences in score + tournament_contest_winner_determiner_modifier = { CHAR = scope:third_temp CONTEST = $CONTEST$ } + } + save_scope_as = third_place + tournament_horse_race_fetch_horse_effect = yes + } + # Save all non-winner entrants so we can easily check if someone lost + every_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + limit = { + this != scope:contest_winner + } + add_to_list = contest_losers + } + # Save winner and add to overall tracker + add_to_guest_subset = { + name = winner + target = scope:contest_winner + phase = tournament_phase_$CONTEST$ + } + # Save podium placements for reference + if = { + limit = { exists = scope:second_place } + add_to_guest_subset = { + name = second_place + target = scope:second_place + phase = tournament_phase_$CONTEST$ + } + } + if = { + limit = { exists = scope:third_place } + add_to_guest_subset = { + name = third_place + target = scope:third_place + phase = tournament_phase_$CONTEST$ + } + } + # Rewards + tournament_contest_rewards_effect = { CONTEST = $CONTEST$ } + # Fire host's prize award event + activity_host = { trigger_event = contest_events.0505 } + # Clear redundant variables + every_attending_character = { tournament_clear_contest_variables_effect = yes } + } +} + +################### +### VERSUS TYPE ### +################### + +# Examples: Jousting, Single Combat, Board Game +# Versus contests are won through a tournament table + +# Create versus contestant list and log entry - contest_$CONTEST$_potential +tournament_contest_versus_composition_effect = { + scope:activity = { + set_variable = { name = tournament_commenced } + if = { + limit = { exists = var:contest_versus_progress } + remove_variable = contest_versus_progress + } + # Players + every_guest_subset = { + name = contestant + phase = tournament_phase_$CONTEST$ + limit = { + OR = { + is_ai = no + AND = { + has_court_position = champion_court_position + liege = { is_ai = no } + } + } + tournament_contest_can_compete_trigger = yes + exists = var:progress_to_victory + var:progress_to_victory >= scope:activity.var:progress_to_victory_threshold + } + add_tournament_contest_contestant_effect = { + CONTEST = $CONTEST$ + SKILL = $SKILL$ + PTV = progress_to_victory_active_contestant_value + } + } + # Filter relevant into entrants list + while = { + limit = { + any_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + count < 7 + } + any_guest_subset_current_phase = { + name = contestant + tournament_contest_can_compete_trigger = yes + } + } + ordered_guest_subset = { + name = contestant + phase = tournament_phase_$CONTEST$ + limit = { tournament_contest_can_compete_trigger = yes } + order_by = var:progress_to_victory + add_tournament_contest_contestant_effect = { + CONTEST = $CONTEST$ + SKILL = $SKILL$ + PTV = progress_to_victory_active_contestant_value + } + } + } + # Chance for a mysterious stranger + hidden_effect = { + random_list = { + 3 = { + ordered_guest_subset = { + name = contestant + phase = tournament_phase_$CONTEST$ + limit = { tournament_contest_can_compete_trigger = yes } + order_by = var:progress_to_victory + add_tournament_contest_contestant_effect = { + CONTEST = $CONTEST$ + SKILL = $SKILL$ + PTV = progress_to_victory_active_contestant_value + } + } + } + 1 = { + trigger = { + NOT = { exists = var:mysterious_stranger_appeared } + any_attending_character = { + culture = { + any_culture_county = { + exists = faith + any_direct_de_jure_vassal_title = { exists = this } + } + } + } + any_attending_character = { count <= 240 } + } + tournament_mysterious_stranger_effect = { + CONTEST = $CONTEST$ + SKILL = $SKILL$ + } + } + } + } + # Inform liege of prestige from qualified knights + tournament_liege_qualification_toast_effect = yes + # Save scopes for tournament tables + tournament_contest_versus_summary_scope_effect = yes + # Qualification ping + every_guest_subset = { + name = contestant + phase = tournament_phase_$CONTEST$ + limit = { + save_temporary_scope_as = new_list_member + NOT = { + scope:activity = { + any_guest_subset_current_phase = { + name = qualified + this = scope:new_list_member + } + } + } + } + tournament_contest_qualification_failure_effect = yes + } + # Add Activity Log entry + add_activity_log_entry = { + key = tournament_contest_start_log + tags = { contest } + score = 20 + character = scope:host + } + switch = { + trigger = has_current_phase + tournament_phase_joust = { + tournament_contest_versus_pulse_effect = { CONTEST = joust } + } + tournament_phase_duel = { + tournament_contest_versus_pulse_effect = { CONTEST = duel } + } + tournament_phase_wrestling = { + tournament_contest_versus_pulse_effect = { CONTEST = wrestling } + } + tournament_phase_board_game = { + tournament_contest_versus_pulse_effect = { CONTEST = board_game } + } + } + # Fire starting event + every_attending_character = { + trigger_event = contest_events.0800 + } + trigger_event = { + id = contest_events.0801 + days = 12 + } + trigger_event = { + id = contest_events.0801 + days = 19 + } + } +} + +# Pair opponents and fire summary event for current round +tournament_contest_versus_pulse_effect = { + scope:activity = { + if = { + limit = { + NOT = { exists = var:contest_versus_progress } + } + set_variable = { + name = contest_versus_progress + value = 0 + } + } + else = { + # Progress tournament stage tracker + change_variable = { + name = contest_versus_progress + add = 1 + } + } + # Resolve bouts for current stage (we use stage prior here to select from those who made it through) + switch = { + trigger = var:contest_versus_progress + 0 = { + tournament_contest_versus_pair_effect = { CONTEST = $CONTEST$ STAGE = qualified } + } + 1 = { + tournament_contest_versus_pair_effect = { CONTEST = $CONTEST$ STAGE = semi_finalist } + } + 2 = { + tournament_contest_versus_pair_effect = { CONTEST = $CONTEST$ STAGE = finalist } + } + } + # Save scopes for events + tournament_contest_versus_summary_scope_effect = yes + # Fire summary events + every_attending_character = { + limit = { + OR = { + is_in_guest_subset = { name = qualified } + is_ai = no + } + } + trigger_event = contest_events.0820 + trigger_event = { + on_action = tournament_intent_setup_events + days = 1 + } + } + } +} + +# Pair off versus contestants into bout matches +tournament_contest_versus_pair_effect = { + # Remove any event score gained in last round + every_guest_subset = { + name = $STAGE$ + phase = tournament_phase_$CONTEST$ + add_to_list = valid_contestants + set_variable = { + name = progress_to_victory + value = progress_to_victory_active_contestant_value + } + } + if = { + limit = { + any_guest_subset = { + name = $STAGE$ # e.g. quarter + phase = tournament_phase_$CONTEST$ + count < contest_versus_$STAGE$_count + } + } + debug_log = "Not enough versus contestants" + while = { + limit = { + any_guest_subset = { + name = $STAGE$ # e.g. quarter + phase = tournament_phase_$CONTEST$ + count < contest_versus_$STAGE$_count + } + } + if = { + limit = { + any_guest_subset = { + name = contestant + phase = tournament_phase_$CONTEST$ + save_temporary_scope_as = new_list_member + NOT = { + scope:activity = { + any_guest_subset_current_phase = { + name = $STAGE$ + this = scope:new_list_member + } + } + } + activity_is_valid_tournament_contestant = yes + } + } + random_guest_subset = { + name = contestant + phase = tournament_phase_$CONTEST$ + limit = { + save_temporary_scope_as = new_list_member + NOT = { + scope:activity = { + any_guest_subset_current_phase = { + name = $STAGE$ + this = scope:new_list_member + } + } + } + activity_is_valid_tournament_contestant = yes + } + save_scope_as = backup_contestant + } + } + else = { tournament_versus_create_contestant_fallback_effect = yes } + add_to_guest_subset = { + name = $STAGE$ + target = scope:backup_contestant + phase = tournament_phase_$CONTEST$ + } + } + } + # Pair remaining contestants + while = { + limit = { + any_guest_subset = { + name = $STAGE$ + phase = tournament_phase_$CONTEST$ + NOT = { has_variable = contest_$STAGE$_match_$CONTEST$ } + } + } + ordered_guest_subset = { + name = $STAGE$ + phase = tournament_phase_$CONTEST$ + limit = { + NOT = { has_variable = contest_$STAGE$_match_$CONTEST$ } + } + order_by = { + value = 50 + if = { + limit = { scope:activity = { has_current_phase = tournament_phase_joust } } + add = contest_horse_aptitude_value + } + else_if = { + limit = { scope:activity = { has_current_phase = tournament_phase_duel } } + add = contest_foot_aptitude_value + } + else_if = { + limit = { scope:activity = { has_current_phase = tournament_phase_board_game } } + add = contest_board_game_aptitude_value + } + else = { add = contest_pugilism_aptitude_value } + } + # Save pair of contestants + save_scope_as = versus_matchee + scope:activity = { + random_guest_subset = { + name = $STAGE$ + phase = tournament_phase_$CONTEST$ + limit = { + NOR = { + this = scope:versus_matchee + has_variable = contest_$STAGE$_match_$CONTEST$ + } + } + weight = { + base = 1 + # Prefer to leave rivalry matches later + modifier = { + factor = 0.5 + has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:versus_matchee } + } + # Prefer to leave player matches later + modifier = { + factor = 0.25 + is_ai = no + scope:versus_matchee = { is_ai = no } + } + # Prefer to leave stranger matches later + modifier = { + factor = 0.25 + is_ai = yes + scope:versus_matchee = { exists = var:mysterious_stranger_origin } + } + } + save_scope_as = versus_matcher + } + } + # Save stage matches for debug and fetching + if = { + limit = { scope:activity.var:contest_versus_progress = 2 } + set_variable = { + name = last_versus_match + value = var:contest_semi_finalist_match_$CONTEST$ + years = 1 + } + add_to_temporary_list = past_round_summary + } + else_if = { + limit = { scope:activity.var:contest_versus_progress = 1 } + set_variable = { + name = last_versus_match + value = var:contest_qualified_match_$CONTEST$ + years = 1 + } + add_to_temporary_list = past_round_summary + } + set_variable = { + name = contest_$STAGE$_match_$CONTEST$ + value = scope:versus_matcher + years = 1 + } + set_variable = { + name = next_versus_match + value = scope:versus_matcher + years = 1 + } + scope:versus_matcher = { + if = { + limit = { scope:activity.var:contest_versus_progress = 2 } + set_variable = { + name = last_versus_match + value = var:contest_semi_finalist_match_$CONTEST$ + years = 1 + } + add_to_temporary_list = past_round_summary + } + else_if = { + limit = { scope:activity.var:contest_versus_progress = 1 } + set_variable = { + name = last_versus_match + value = var:contest_qualified_match_$CONTEST$ + years = 1 + } + add_to_temporary_list = past_round_summary + } + set_variable = { + name = contest_$STAGE$_match_$CONTEST$ + value = scope:versus_matchee + years = 1 + } + set_variable = { + name = next_versus_match + value = scope:versus_matchee + years = 1 + } + add_to_temporary_list = past_round_summary + } + debug_log_scopes = yes + ### Resolve bouts + # AI only + if = { + limit = { + scope:versus_matchee = { is_ai = yes } + scope:versus_matcher = { is_ai = yes } + } + scope:versus_matchee = { + trigger_event = { + id = contest_events.0830 # Both AI - background script + days = 6 + } + } + } + # Player involvement + else = { + scope:versus_matchee = { + if = { + limit = { is_ai = no } + trigger_event = { + on_action = contest_bout_$CONTEST$_random_pulse + days = 2 + } + trigger_event = { + on_action = contest_bout_$CONTEST$_pivotal_pulse + days = 4 + } + } + } + scope:versus_matcher = { + if = { + limit = { is_ai = no } + trigger_event = { + on_action = contest_bout_$CONTEST$_random_pulse + days = 2 + } + trigger_event = { + on_action = contest_bout_$CONTEST$_pivotal_pulse + days = 4 + } + } + } + } + } + } +} + +# Save scopes of opponent based on bout stage +tournament_contest_versus_round_scope_effect = { + if = { + limit = { scope:activity.var:contest_versus_progress = 0 } + if = { + limit = { exists = var:contest_qualified_match_$CONTEST$ } + var:contest_qualified_match_$CONTEST$ = { save_scope_as = versus_contestant } + } + } + else_if = { + limit = { scope:activity.var:contest_versus_progress = 1 } + if = { + limit = { exists = var:contest_semi_finalist_match_$CONTEST$ } + var:contest_semi_finalist_match_$CONTEST$ = { save_scope_as = versus_contestant } + } + } + else = { + if = { + limit = { exists = var:contest_finalist_match_$CONTEST$ } + var:contest_finalist_match_$CONTEST$ = { save_scope_as = versus_contestant } + } + } +} + +tournament_contest_versus_match_scope_effect = { + scope:activity = { + switch = { + trigger = has_current_phase + tournament_phase_joust = { + $CHAR$ = { tournament_contest_versus_round_scope_effect = { CONTEST = joust } } + } + tournament_phase_wrestling = { + $CHAR$ = { tournament_contest_versus_round_scope_effect = { CONTEST = wrestling } } + } + tournament_phase_duel = { + $CHAR$ = { tournament_contest_versus_round_scope_effect = { CONTEST = duel } } + } + tournament_phase_board_game = { + $CHAR$ = { tournament_contest_versus_round_scope_effect = { CONTEST = board_game } } + } + } + } +} + +# Determine versus wound/death outcomes +tournament_contest_versus_battle_wound_effect = { + scope:contest_loser = { + if = { + limit = { exists = var:murder_sabotage_target } + random = { + chance = 50 + modifier = { + add = { + value = var:murder_sabotage_target + multiply = 15 + } + } + increase_wounds_effect = { REASON = contest_$CONTEST$_accident } + save_scope_as = sabotage_murder_wound + } + random = { + chance = 50 + modifier = { + add = { + value = var:murder_sabotage_target + multiply = 15 + } + } + add_character_flag = died_in_contest_flag + death = { + death_reason = death_contest_$CONTEST$_accident + killer = scope:contest_winner + } + save_scope_as = sabotage_murder_death + } + if = { + limit = { is_alive = yes } + remove_variable = murder_sabotage_target + } + } + else = { + random = { + chance = $WOUND_CHANCE$ + increase_wounds_effect = { REASON = contest_$CONTEST$_accident } + } + random = { + chance = $DEATH_CHANCE$ + add_character_flag = died_in_contest_flag + death = { + death_reason = death_contest_$CONTEST$_accident + killer = scope:contest_winner + } + } + } + } +} + +# Randomize versus bout outcome based on skill +tournament_contest_versus_battle_effect = { + save_temporary_scope_value_as = { + name = choose_winner + value = $CHOOSE_WINNER$ + } + save_temporary_scope_value_as = { + name = injury_chance + value = $INJURY_CHANCE$ + } + set_variable = { + name = progress_to_victory + value = progress_to_victory_active_contestant_value + } + var:next_versus_match = { + save_scope_as = next_versus_match + if = { + limit = { is_alive = yes } + set_variable = { + name = progress_to_victory + value = progress_to_victory_active_contestant_value + } + } + } + # Determine winner + if = { + limit = { scope:choose_winner = yes } + random_list = { + # ROOT WINS + 10 = { + trigger = { + is_alive = yes + save_temporary_scope_as = versus_matchee_temp + } + desc = tournament_contest_versus_battle_win_tt + modifier = { + exists = var:progress_to_victory_score + add = var:progress_to_victory_score + } + modifier = { + exists = var:contest_aptitude + add = { + value = var:contest_aptitude + divide = 2 + } + } + # Prefer unmatched rivals of players to not get knocked out + modifier = { + is_ai = yes + scope:next_versus_match = { is_ai = yes } + scope:activity = { + any_guest_subset = { + name = contestant + exists = var:progress_to_victory + this != scope:next_versus_match + is_ai = no + has_any_bad_relationship_with_character_trigger = { CHARACTER = root } + } + } + factor = 2 + } + modifier = { + has_variable = murder_sabotage_target + factor = 0.5 + } + # If aptitude is higher, more likely to win + modifier = { + exists = var:contest_aptitude + exists = scope:next_versus_match.var:contest_aptitude + var:contest_aptitude > scope:next_versus_match.var:contest_aptitude + factor = 2 + } + # If have at least double aptitude of other character, you win + modifier = { + exists = var:contest_aptitude + exists = scope:next_versus_match.var:contest_aptitude + contest_aptitude_fetch_half_value >= scope:next_versus_match.var:contest_aptitude + add = 1000 + } + show_chance = no + versus_contest_round_outcome_tooltip_effect = { + WINNER = root + LOSER = scope:next_versus_match + } + save_scope_as = contest_winner + scope:next_versus_match = { save_scope_as = contest_loser } + } + # VERSUS CONTESTANT WINS + 10 = { + desc = tournament_contest_versus_battle_lose_tt + trigger = { + scope:next_versus_match = { is_alive = yes } + } + modifier = { + exists = scope:next_versus_match.var:progress_to_victory_score + add = scope:next_versus_match.var:progress_to_victory_score + } + modifier = { + exists = scope:next_versus_match.var:contest_aptitude + add = { + value = scope:next_versus_match.var:contest_aptitude + divide = 2 + } + } + # Prefer unmatched rivals of players to not get knocked out + modifier = { + is_ai = yes + scope:next_versus_match = { is_ai = yes } + scope:activity = { + any_guest_subset = { + name = contestant + exists = var:progress_to_victory + this != root + is_ai = no + has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:next_versus_match } + } + } + factor = 2 + } + modifier = { + scope:next_versus_match = { has_variable = murder_sabotage_target } + factor = 0.5 + } + # If aptitude is higher, more likely to win + modifier = { + exists = scope:next_versus_match.var:contest_aptitude + exists = var:contest_aptitude + scope:next_versus_match.var:contest_aptitude > root.var:contest_aptitude + factor = 2 + } + # If they have at least double your aptitude, they win + modifier = { + exists = scope:next_versus_match.var:progress_to_victory + scope:next_versus_match.progress_to_victory_fetch_half_value >= root.var:progress_to_victory + add = 1000 + } + show_chance = no + versus_contest_round_outcome_tooltip_effect = { + WINNER = scope:next_versus_match + LOSER = root + } + scope:next_versus_match = { save_scope_as = contest_winner } + save_scope_as = contest_loser + } + } + } + if = { + limit = { + exists = scope:contest_winner.var:contest_aptitude + exists = scope:contest_loser.var:contest_aptitude + } + save_scope_value_as = { + name = score_difference + value = { + value = scope:contest_winner.var:contest_aptitude + subtract = scope:contest_loser.var:contest_aptitude + } + } + } + # Save contest winner and add activity log entry + scope:activity = { + switch = { + trigger = scope:activity.var:contest_versus_progress + 0 = { + add_to_guest_subset = { + name = semi_finalist + target = scope:contest_winner + phase = tournament_phase_$CONTEST$ + } + add_activity_log_entry = { + key = tournament_bout_quarter_log + tags = { bout contest } + score = 10 + character = scope:contest_winner + target = scope:contest_loser + } + } + 1 = { + add_to_guest_subset = { + name = finalist + target = scope:contest_winner + phase = tournament_phase_$CONTEST$ + } + add_activity_log_entry = { + key = tournament_bout_semi_log + tags = { bout contest } + score = 10 + character = scope:contest_winner + target = scope:contest_loser + } + } + 2 = { + add_to_guest_subset = { + name = winner + target = scope:contest_winner + phase = tournament_phase_$CONTEST$ + } + scope:contest_winner = { + set_variable = { + name = progress_to_victory + value = 100 + } + } + add_to_guest_subset = { + name = second_place + target = scope:contest_loser + phase = tournament_phase_$CONTEST$ + } + } + } + } + # Chance of injuries + if = { + limit = { scope:injury_chance ?= yes } + scope:activity = { + switch = { + trigger = has_current_phase + tournament_phase_joust = { + scope:contest_winner = { + set_variable = { + name = contest_aptitude + value = contest_horse_aptitude_value + } + } + tournament_contest_versus_battle_wound_effect = { + WOUND_CHANCE = 30 + DEATH_CHANCE = 5 + CONTEST = joust + } + } + tournament_phase_wrestling = { + scope:contest_winner = { + set_variable = { + name = contest_aptitude + value = contest_pugilism_aptitude_value + } + } + tournament_contest_versus_battle_wound_effect = { + WOUND_CHANCE = 10 + DEATH_CHANCE = 1 + CONTEST = wrestling + } + } + tournament_phase_duel = { + scope:contest_winner = { + set_variable = { + name = contest_aptitude + value = contest_foot_aptitude_value + } + } + tournament_contest_versus_battle_wound_effect = { + WOUND_CHANCE = 20 + DEATH_CHANCE = 3 + CONTEST = duel + } + } + tournament_phase_board_game = { + scope:contest_winner = { + set_variable = { + name = contest_aptitude + value = contest_board_game_aptitude_value + } + } + tournament_contest_versus_battle_wound_effect = { + WOUND_CHANCE = 5 + DEATH_CHANCE = 1 + CONTEST = board_game + } + } + } + } + } + scope:contest_winner = { + if = { + limit = { + scope:activity = { + any_guest_subset_current_phase = { + name = winner + this = scope:contest_winner + } + } + } + set_variable = { + name = progress_to_victory + value = 100 + } + } + else = { + set_variable = { + name = progress_to_victory + value = progress_to_victory_active_contestant_value + } + } + } + scope:contest_loser = { + if = { + limit = { is_alive = yes } + remove_variable = contest_aptitude + remove_variable = progress_to_victory + } + } + # Consequences for sabotage murder + if = { + limit = { + OR = { + exists = scope:sabotage_murder_wound + exists = scope:sabotage_murder_death + } + } + switch = { + trigger = exists + scope:sabotage_murder_wound = { + attempted_murder_opinion_effect = { VICTIM = scope:contest_loser MURDERER = scope:contest_winner } + } + scope:sabotage_murder_death = { + murder_opinion_effect = { VICTIM = scope:contest_loser MURDERER = scope:contest_winner } + } + } + if = { + limit = { + scope:host = { + is_alive = yes + is_ai = yes + this = scope:contest_loser + } + } + random = { + chance = 50 + modifier = { + add = 25 + has_trait = vengeful + } + modifier = { + add = 25 + has_trait = wrathful + } + modifier = { + add = -25 + has_trait = forgiving + } + rightfully_imprison_character_effect = { + TARGET = scope:contest_winner + IMPRISONER = scope:host + } + } + } + } + scope:contest_winner = { + save_scope_as = pivotal_contestant + trigger_event = { on_action = contest_bout_$CONTEST$_outcome_pulse } + } + scope:contest_loser = { + save_scope_as = pivotal_contestant + trigger_event = { on_action = contest_bout_$CONTEST$_outcome_pulse } + } + scope:activity = { + # Quarter and semi finals only show pivotals to contestants, and pertinent bout pings to everyone else + if = { + limit = { var:contest_versus_progress < 2 } + tournament_contest_versus_pertinent_update_effect = yes + } + # Everyone sees final pivotals + else = { + every_attending_character = { + limit = { + NOR = { + this = scope:contest_winner + this = scope:contest_loser + } + is_ai = no + } + # If competing yourself, it is from your perspective, otherwise find someone relevant + tournament_pivotal_contestant_scope_effect = yes + trigger_event = { on_action = contest_bout_$CONTEST$_outcome_pulse } + } + } + } +} + +tournament_contest_versus_pertinent_update_effect = { + scope:activity = { + every_attending_character = { + limit = { + is_ai = no + NOR = { + this = scope:contest_winner + this = scope:contest_loser + AND = { + exists = scope:wrathful_contestant + this = scope:wrathful_contestant + } + AND = { + exists = scope:wrathful_victim + this = scope:wrathful_victim + } + } + # First round only notify people who care + trigger_if = { + limit = { scope:activity.var:contest_versus_progress < 1 } + OR = { + # Scripted Relation + has_any_scripted_relation = scope:contest_winner + has_any_scripted_relation = scope:contest_loser + # Close Family + is_close_family_of = scope:contest_winner + is_close_family_of = scope:contest_loser + # Spouses + is_consort_of = scope:contest_winner + is_consort_of = scope:contest_loser + # Host + scope:host = scope:contest_winner + scope:host = scope:contest_loser + # Champion Liege + court_position:champion_court_position ?= scope:contest_winner + court_position:champion_court_position ?= scope:contest_loser + # Knights + any_acclaimed_knight = { this = scope:contest_winner } + any_acclaimed_knight = { this = scope:contest_loser } + # Intent Target + trigger_if = { + limit = { exists = intent_target } + OR = { + intent_target = scope:contest_winner + intent_target = scope:contest_loser + } + } + } + } + } + trigger_event = contest_events.0810 + } + } +} + +# Set round participants after resignations +tournament_contest_versus_resignation_effect = { + $RESIGNER$ = { save_scope_as = resign_target } + scope:resign_target = { + save_scope_as = contest_loser + remove_variable = contest_aptitude + add_character_flag = { + flag = resigned_contest_flag + months = 2 + } + } + scope:activity = { + switch = { + trigger = var:contest_versus_progress + 0 = { + scope:resign_target.var:contest_qualified_match_$CONTEST$ = { save_scope_as = resign_match } + add_to_guest_subset = { + name = semi_finalist + target = scope:resign_match + phase = tournament_phase_$CONTEST$ + } + } + 1 = { + scope:resign_target.var:contest_semi_finalist_match_$CONTEST$ = { save_scope_as = resign_match } + add_to_guest_subset = { + name = finalist + target = scope:resign_match + phase = tournament_phase_$CONTEST$ + } + } + 2 = { + scope:resign_target.var:contest_finalist_match_$CONTEST$ = { save_scope_as = resign_match } + add_to_guest_subset = { + name = winner + target = scope:resign_match + phase = tournament_phase_$CONTEST$ + } + add_to_guest_subset = { + name = second_place + target = scope:resign_target + phase = tournament_phase_$CONTEST$ + } + } + } + } + scope:resign_match = { + save_scope_as = contest_winner + remove_variable = contest_aptitude + set_variable = { + name = contest_aptitude + value = contest_$SKILL$_aptitude_value + } + } + scope:activity = { + add_activity_log_entry = { + key = tournament_resigned_versus_log + tags = { contestant removal } + score = 25 + character = scope:contest_loser + target = scope:contest_winner + + # Effect + versus_contest_resignation_tooltip_effect = { + RESIGNER = scope:resign_target + WINNER = scope:resign_match + } + } + every_attending_character = { + limit = { + is_ai = no + NOR = { + this = scope:contest_winner + this = scope:contest_loser + } + } + trigger_event = { + id = contest_events.0825 + days = 1 + } + } + } +} + +# Set round participants after disqualifications +tournament_contest_versus_disqualification_effect = { + $DISQUALIFIED$ = { save_scope_as = disqualify_target } + $MATCH$ = { save_scope_as = disqualify_match } + scope:disqualify_target = { + save_scope_as = contest_loser + remove_variable = contest_aptitude + remove_variable = progress_to_victory + add_character_flag = { + flag = disqualified_contest_flag + months = 2 + } + } + scope:disqualify_match = { + save_scope_as = contest_winner + remove_variable = contest_aptitude + set_variable = { + name = contest_aptitude + value = contest_$SKILL$_aptitude_value + } + set_variable = { + name = progress_to_victory + value = progress_to_victory_active_contestant_value + } + } + scope:activity = { + switch = { + trigger = var:contest_versus_progress + 0 = { + add_to_guest_subset = { + name = semi_finalist + target = scope:disqualify_match + phase = tournament_phase_$CONTEST$ + } + } + 1 = { + add_to_guest_subset = { + name = finalist + target = scope:disqualify_match + phase = tournament_phase_$CONTEST$ + } + } + 2 = { + add_to_guest_subset = { + name = winner + target = scope:disqualify_match + phase = tournament_phase_$CONTEST$ + } + } + } + add_activity_log_entry = { + key = tournament_disqualified_log + score = 50 + tags = { contestant removal } + character = scope:contest_loser + target = scope:host + + # Effect + scope:contest_loser = { + if ={ + limit = { scope:activity.var:contest_versus_progress = 2 } + custom_description = { + text = tournament_contest_disqualify_win_tt + subject = scope:disqualify_match # WINNER + object = scope:disqualify_target # DISQUALIFIED + } + } + else = { + custom_description = { + text = tournament_contest_disqualify_round_tt + subject = scope:disqualify_match # WINNER + object = scope:disqualify_target # DISQUALIFIED + } + } + if = { + limit = { is_ai = yes } + add_opinion = { + target = scope:host + modifier = tournament_disqualified_opinion + opinion = -15 + } + } + } + } + every_attending_character = { + limit = { + is_ai = no + trigger_if = { + limit = { exists = scope:contest_winner } + this != scope:contest_winner + } + trigger_if = { + limit = { exists = scope:contest_loser } + this != scope:contest_loser + } + } + trigger_event = contest_events.0826 + } + } +} + +# Disqualify qualified contestant from contest +tournament_contest_disqualification_effect = { + $DISQUALIFIED$ = { save_scope_as = disqualify_target } + scope:disqualify_target = { + remove_variable = contest_aptitude + remove_variable = progress_to_victory + add_character_flag = { + flag = disqualified_contest_flag + months = 2 + } + } + custom_description = { + text = tournament_contest_disqualify_tt + subject = $DISQUALIFIED$ + } +} + +# Swap determined winner and loser +tournament_contest_versus_swap_winner_loser_effect = { + switch = { + trigger = scope:activity.var:contest_versus_progress + 0 = { + remove_from_guest_subset = { + name = semi_finalist + target = scope:contest_winner + phase = tournament_phase_$CONTEST$ + } + add_to_guest_subset = { + name = semi_finalist + target = scope:contest_loser + phase = tournament_phase_$CONTEST$ + } + } + 1 = { + remove_from_guest_subset = { + name = finalist + target = scope:contest_winner + phase = tournament_phase_$CONTEST$ + } + add_to_guest_subset = { + name = finalist + target = scope:contest_loser + phase = tournament_phase_$CONTEST$ + } + } + 2 = { + remove_from_guest_subset = { + name = winner + target = scope:contest_winner + phase = tournament_phase_$CONTEST$ + } + add_to_guest_subset = { + name = winner + target = scope:contest_loser + phase = tournament_phase_$CONTEST$ + } + remove_from_guest_subset = { + name = second_place + target = scope:contest_loser + phase = tournament_phase_$CONTEST$ + } + add_to_guest_subset = { + name = second_place + target = scope:contest_winner + phase = tournament_phase_$CONTEST$ + } + } + } + scope:contest_winner = { + remove_variable = contest_aptitude + remove_variable = progress_to_victory + save_scope_as = disqualify_target + } + scope:contest_loser = { + set_variable = { + name = progress_to_victory + value = progress_to_victory_active_contestant_value + } + set_variable = { + name = contest_aptitude + value = contest_$SKILL$_aptitude_value + } + } + versus_contest_disqualification_tooltip_effect = { + WINNER = scope:contest_loser + DISQUALIFIED = scope:contest_winner + } +} + +# Replace qualified contestant for another - versus version +tournament_contest_versus_replace_qualifier_effect = { + $NEW_CONTESTANT$ = { save_scope_as = new_contestant } + $OLD_CONTESTANT$ = { save_scope_as = old_contestant } + if = { + limit = { + NOT = { exists = scope:activity.var:contest_versus_progress } + } + remove_from_guest_subset = { + name = qualified + target = scope:old_contestant + phase = tournament_phase_$CONTEST$ + } + add_to_guest_subset = { + name = spectator + target = scope:old_contestant + phase = tournament_phase_$CONTEST$ + } + add_to_guest_subset = { + name = qualified + target = scope:new_contestant + phase = tournament_phase_$CONTEST$ + } + } + else = { + switch = { + trigger = scope:activity.var:contest_versus_progress + 0 = { + remove_from_guest_subset = { + name = qualified + target = scope:old_contestant + phase = tournament_phase_$CONTEST$ + } + add_to_guest_subset = { + name = spectator + target = scope:old_contestant + phase = tournament_phase_$CONTEST$ + } + add_to_guest_subset = { + name = qualified + target = scope:new_contestant + phase = tournament_phase_$CONTEST$ + } + scope:new_contestant = { + set_variable = { + name = contest_qualified_match_$CONTEST$ + value = scope:old_contestant.var:contest_qualified_match_$CONTEST$ + years = 1 + } + } + scope:old_contestant = { remove_variable = contest_qualified_match_$CONTEST$ } + } + 1 = { + remove_from_guest_subset = { + name = semi_finalist + target = scope:old_contestant + phase = tournament_phase_$CONTEST$ + } + add_to_guest_subset = { + name = spectator + target = scope:old_contestant + phase = tournament_phase_$CONTEST$ + } + add_to_guest_subset = { + name = semi_finalist + target = scope:new_contestant + phase = tournament_phase_$CONTEST$ + } + scope:new_contestant = { + set_variable = { + name = contest_semi_finalist_match_$CONTEST$ + value = scope:old_contestant.var:contest_qualified_match_$CONTEST$ + years = 1 + } + } + scope:old_contestant = { remove_variable = contest_semi_finalist_match_$CONTEST$ } + } + 2 = { + remove_from_guest_subset = { + name = finalist + target = scope:old_contestant + phase = tournament_phase_$CONTEST$ + } + add_to_guest_subset = { + name = spectator + target = scope:old_contestant + phase = tournament_phase_$CONTEST$ + } + add_to_guest_subset = { + name = finalist + target = scope:new_contestant + phase = tournament_phase_$CONTEST$ + } + scope:new_contestant = { + set_variable = { + name = contest_finalist_match_$CONTEST$ + value = scope:old_contestant.var:contest_qualified_match_$CONTEST$ + years = 1 + } + } + scope:old_contestant = { remove_variable = contest_finalist_match_$CONTEST$ } + } + } + } + scope:old_contestant = { + remove_variable = contest_aptitude + remove_variable = progress_to_victory + save_scope_as = disqualify_target + } + scope:new_contestant = { + tournament_set_current_aptitude_variable_effect = yes + set_variable = { + name = progress_to_victory + value = progress_to_victory_active_contestant_value + } + } + scope:activity = { + every_attending_character = { + limit = { is_ai = no } + send_interface_toast = { + title = tournament_qualifier_replaced_toast + left_icon = scope:old_contestant + right_icon = scope:new_contestant + custom_description = { + text = tournament_contest_replaced_tt + subject = scope:new_contestant # REPLACER + object = scope:old_contestant # REPLACED + } + } + } + } +} + +# Save scopes for round summary events +tournament_contest_versus_summary_scope_effect = { + if = { + limit = { exists = var:contest_versus_progress } + switch = { + trigger = var:contest_versus_progress + 1 = { # Semi finalists + ordered_guest_subset_current_phase = { + name = semi_finalist + limit = { + NOR = { + scope:contest_summary_1 ?= this + scope:contest_summary_2 ?= this + scope:contest_summary_3 ?= this + } + } + max = 4 + check_range_bounds = no + order_by = primary_title.tier + if = { + limit = { NOT = { exists = scope:contest_summary_1 } } + save_scope_as = contest_summary_1 + } + else_if = { + limit = { NOT = { exists = scope:contest_summary_2 } } + save_scope_as = contest_summary_2 + } + else_if = { + limit = { NOT = { exists = scope:contest_summary_3 } } + save_scope_as = contest_summary_3 + } + else = { save_scope_as = contest_summary_4 } + } + } + 2 = { # Finalist + ordered_guest_subset_current_phase = { + name = finalist + limit = { + NOT = { scope:contest_summary_1 ?= this } + } + max = 2 + check_range_bounds = no + order_by = primary_title.tier + if = { + limit = { NOT = { exists = scope:contest_summary_1 } } + save_scope_as = contest_summary_1 + } + else = { save_scope_as = contest_summary_2 } + } + } + } + } +} + +# Save winner and second place scopes, award prizes, and fire ping events +tournament_contest_versus_winner_effect = { + # Achievement. + little_william_marshal_achievement_contest_end_effect = yes + scope:activity = { + save_scope_value_as = { name = contest_complete value = flag:$CONTEST$ } + # Save winner and add to overall winner tracker + random_guest_subset = { + name = winner + phase = tournament_phase_$CONTEST$ + save_scope_as = contest_winner + tournament_complete_win_contest_intent_effect = yes + # Achievement. + little_william_marshal_achievement_contest_end_winner_effect = yes + } + # Save other finalist as second place + random_guest_subset = { + name = second_place + phase = tournament_phase_$CONTEST$ + save_scope_as = second_place + } + if = { + limit = { + NOT = { exists = scope:second_place } + } + scope:contest_winner.var:next_versus_match ?= { save_scope_as = second_place } + } + # Save all non-winner entrants so we can easily check if someone lost + every_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + limit = { + NOT = { scope:contest_winner ?= this } + } + add_to_list = contest_losers + } + # Rewards + tournament_contest_rewards_effect = { CONTEST = $CONTEST$ } + # Fire host's prize award event + activity_host = { trigger_event = contest_events.0805 } + # Clear redundant variables + remove_variable = contest_versus_progress + every_attending_character = { tournament_clear_contest_variables_effect = yes } + } +} + +# List correct wound status for versus contests +tournament_wounded_or_dead_contest_effect = { + scope:activity = { + switch = { + trigger = has_current_phase + tournament_phase_joust = { + scope:contest_loser = { + tournament_wounded_or_dead_tooltip_effect = { CONTEST = joust } + } + } + tournament_phase_wrestling = { + scope:contest_loser = { + tournament_wounded_or_dead_tooltip_effect = { CONTEST = wrestling } + } + } + tournament_phase_duel = { + scope:contest_loser = { + tournament_wounded_or_dead_tooltip_effect = { CONTEST = duel } + } + } + tournament_phase_board_game = { + scope:contest_loser = { + tournament_wounded_or_dead_tooltip_effect = { CONTEST = board_game } + } + } + } + } +} + +# Save versus matched contestant's scopes +contest_versus_player_vs_ai_scope_effect = { + if = { + limit = { this = scope:versus_matchee } + scope:versus_matcher = { save_scope_as = versus_contestant } + } + else = { + scope:versus_matchee = { save_scope_as = versus_contestant } + } +} + +# Fallback for replacing dead versus contestant with a fresh one +tournament_versus_qualifier_death_effect = { + if = { + limit = { + involved_activity ?= { + has_activity_type = activity_tournament + OR = { + has_current_phase = tournament_phase_duel + has_current_phase = tournament_phase_wrestling + has_current_phase = tournament_phase_board_game + has_current_phase = tournament_phase_joust + } + any_guest_subset_current_phase = { name = qualified this = root } + } + NOT = { has_character_flag = died_in_contest_flag } + } + save_scope_as = dead_contestant + var:next_versus_match = { save_scope_as = versus_match } + involved_activity = { + save_scope_as = activity + if = { + limit = { + scope:versus_match = { is_in_guest_subset = { name = finalist } } + } + tournament_versus_dead_qualifier_effect = { SUBSET = winner } + } + else_if = { + limit = { + scope:versus_match = { is_in_guest_subset = { name = semi_finalist } } + } + tournament_versus_dead_qualifier_effect = { SUBSET = finalist } + } + else = { + tournament_versus_dead_qualifier_effect = { SUBSET = semi_finalist } + } + } + every_player = { + limit = { is_participant_in_activity = scope:activity } + send_interface_toast = { + title = tournament_qualifier_dies_toast + left_icon = scope:dead_contestant + right_icon = scope:versus_contestant + custom_tooltip = tournament_quailfier_dies_tt + } + } + } +} + +# Used to add new qualifiers to correct versus subset +tournament_versus_new_qualifier_effect = { + switch = { + trigger = has_current_phase + tournament_phase_duel = { + add_to_guest_subset = { + name = $SUBSET$ + phase = tournament_phase_duel + target = scope:new_qualifier + } + } + tournament_phase_wrestling = { + add_to_guest_subset = { + name = $SUBSET$ + phase = tournament_phase_wrestling + target = scope:new_qualifier + } + } + tournament_phase_board_game = { + add_to_guest_subset = { + name = $SUBSET$ + phase = tournament_phase_board_game + target = scope:new_qualifier + } + } + tournament_phase_joust = { + add_to_guest_subset = { + name = $SUBSET$ + phase = tournament_phase_joust + target = scope:new_qualifier + } + } + } +} + +tournament_versus_dead_qualifier_effect = { + switch = { + trigger = has_current_phase + tournament_phase_duel = { + add_to_guest_subset = { + name = $SUBSET$ + phase = tournament_phase_duel + target = scope:versus_match + } + } + tournament_phase_wrestling = { + add_to_guest_subset = { + name = $SUBSET$ + phase = tournament_phase_wrestling + target = scope:versus_match + } + } + tournament_phase_board_game = { + add_to_guest_subset = { + name = $SUBSET$ + phase = tournament_phase_board_game + target = scope:versus_match + } + } + tournament_phase_joust = { + add_to_guest_subset = { + name = $SUBSET$ + phase = tournament_phase_joust + target = scope:versus_match + } + } + } +} + +########################### +### MYSTERIOUS STRANGER ### +########################### + +# Create a mysterious stranger contestant +tournament_mysterious_stranger_effect = { + random_attending_character = { + culture = { save_scope_as = attending_culture } + } + scope:attending_culture = { + random_culture_county = { + faith = { save_scope_as = attending_faith } + random_direct_de_jure_vassal_title = { save_scope_as = attending_barony } + } + } + create_character = { + template = tournament_$SKILL$_character + location = scope:activity.activity_location + faith = scope:attending_faith + culture = scope:attending_culture + dynasty = none + save_scope_as = mysterious_stranger + } + scope:mysterious_stranger = { + set_variable = { + name = mysterious_stranger_origin + value = scope:attending_barony + } + set_variable = { + name = contest_aptitude + value = contest_$SKILL$_aptitude_value + } + add_to_activity = scope:activity + } + add_activity_log_entry = { + key = contest_mysterious_stranger_log + tags = { contestant } + score = 25 + character = scope:mysterious_stranger + + # Effect + show_as_tooltip = { + scope:mysterious_stranger = { add_to_activity = scope:activity } + } + } + add_to_guest_subset = { + name = qualified + target = scope:mysterious_stranger + phase = tournament_phase_$CONTEST$ + } + set_variable = mysterious_stranger_appeared +} + +############## +### WAGERS ### +############## + +# Find scopes for possible wagers +tournament_generate_wager_scope_effect = { + # Top contestant - for maths + ordered_guest_subset_current_phase = { + name = qualified + limit = { + NOT = { exists = var:mysterious_stranger_origin } + } + order_by = var:contest_aptitude + save_scope_as = wager_top_contestant + tournament_horse_race_fetch_horse_effect = yes + } + save_scope_value_as = { + name = wager_diff_value + value = { + add = scope:wager_top_contestant.var:contest_aptitude + divide = 2 + } + } + # Bottom contestant - for maths + ordered_guest_subset_current_phase = { + name = qualified + order_by = { + value = 0 + subtract = var:contest_aptitude + } + save_scope_as = wager_bottom_contestant + tournament_horse_race_fetch_horse_effect = yes + } + # Champion contestant + if = { + limit = { + scope:wagerer = { employs_court_position = champion_court_position } + any_guest_subset_current_phase = { + name = qualified + has_court_position = champion_court_position + liege = scope:wagerer + NOR = { + this = scope:wager_top_contestant + this = scope:wager_bottom_contestant + } + } + } + random_guest_subset_current_phase = { + name = qualified + limit = { + has_court_position = champion_court_position + liege = scope:wagerer + NOR = { + this = scope:wager_top_contestant + this = scope:wager_bottom_contestant + } + } + save_scope_as = wager_champion_contestant + if = { + limit = { + scope:activity = { has_current_phase = tournament_phase_horse_race } + } + tournament_horse_race_fetch_horse_effect = yes + } + } + } + # Flavor contestant + if = { + limit = { + any_guest_subset_current_phase = { + name = qualified + OR = { + has_any_good_relationship_with_character_trigger = { CHARACTER = root } + is_child_of = root + is_spouse_of = root + } + NOR = { + this = scope:wager_top_contestant + AND = { + exists = scope:wager_champion_contestant + this = scope:wager_champion_contestant + } + } + } + } + ordered_guest_subset_current_phase = { + name = qualified + limit = { + OR = { + has_any_good_relationship_with_character_trigger = { CHARACTER = root } + is_child_of = root + is_spouse_of = root + } + NOR = { + this = scope:wager_top_contestant + AND = { + exists = scope:wager_champion_contestant + this = scope:wager_champion_contestant + } + } + } + order_by = var:contest_aptitude + save_scope_as = wager_flavor_contestant + if = { + limit = { + scope:activity = { has_current_phase = tournament_phase_horse_race } + } + tournament_horse_race_fetch_horse_effect = yes + } + } + } + # Underdog contestant + if = { + limit = { + any_guest_subset_current_phase = { + name = qualified + NOR = { + exists = var:mysterious_stranger_origin + this = scope:wager_top_contestant + AND = { + exists = scope:wager_flavor_contestant + this = scope:wager_flavor_contestant + } + AND = { + exists = scope:wager_champion_contestant + this = scope:wager_champion_contestant + } + trigger_if = { + limit = { exists = scope:wager_flavor_contestant } + this = scope:wager_flavor_contestant + } + } + contest_aptitude_fetch_value <= tournament_wager_diff_value + } + } + random_guest_subset_current_phase = { + name = qualified + limit = { + NOR = { + exists = var:mysterious_stranger_origin + this = scope:wager_top_contestant + AND = { + exists = scope:wager_flavor_contestant + this = scope:wager_flavor_contestant + } + AND = { + exists = scope:wager_champion_contestant + this = scope:wager_champion_contestant + } + trigger_if = { + limit = { exists = scope:wager_flavor_contestant } + this = scope:wager_flavor_contestant + } + } + contest_aptitude_fetch_value <= tournament_wager_diff_value + } + weight = { + base = 1 + modifier = { + factor = 0.1 + this = root + } + } + save_scope_as = wager_underdog_contestant + if = { + limit = { + scope:activity = { has_current_phase = tournament_phase_horse_race } + } + tournament_horse_race_fetch_horse_effect = yes + } + } + } + # Second favourite + else_if = { + limit = { + NOT = { exists = scope:wager_underdog_contestant } + any_guest_subset_current_phase = { + name = qualified + NOR = { + this = scope:wager_top_contestant + exists = var:mysterious_stranger_origin + AND = { + exists = scope:wager_flavor_contestant + this = scope:wager_flavor_contestant + } + AND = { + exists = scope:wager_champion_contestant + this = scope:wager_champion_contestant + } + } + } + } + ordered_guest_subset_current_phase = { + name = qualified + limit = { + NOR = { + this = scope:wager_top_contestant + exists = var:mysterious_stranger_origin + AND = { + exists = scope:wager_flavor_contestant + this = scope:wager_flavor_contestant + } + } + } + order_by = var:contest_aptitude + save_scope_as = wager_second_contestant + if = { + limit = { + scope:activity = { has_current_phase = tournament_phase_horse_race } + } + tournament_horse_race_fetch_horse_effect = yes + } + } + } + # Mysterious stranger + if = { + limit = { + any_guest_subset_current_phase = { + name = qualified + exists = var:mysterious_stranger_origin + } + } + random_guest_subset_current_phase = { + name = qualified + limit = { exists = var:mysterious_stranger_origin } + save_scope_as = mysterious_stranger + if = { + limit = { + scope:activity = { has_current_phase = tournament_phase_horse_race } + } + tournament_horse_race_fetch_horse_effect = yes + } + } + } +} + +# Info and payout for won/lost wager +tournament_contest_wager_effect = { + if = { + limit = { + exists = var:tournament_wager_target + exists = var:tournament_wager_payout + } + var:tournament_wager_target = { save_scope_as = wager_target } + if = { + limit = { scope:wager_target = scope:contest_winner } + if = { + limit = { + scope:contest_complete ?= flag:horse_race + exists = scope:wager_target.var:contest_horse_race_name + } + custom_tooltip = wager_won_horse_tooltip + } + else = { custom_tooltip = wager_won_tooltip } + add_gold = var:tournament_wager_payout + } + else = { + if = { + limit = { + scope:contest_complete ?= flag:horse_race + exists = scope:wager_target.var:contest_horse_race_name + } + custom_tooltip = wager_lost_horse_tooltip + } + else = { custom_tooltip = wager_lost_tooltip } + } + remove_variable = tournament_wager_stake + remove_variable = tournament_wager_target + remove_variable = tournament_wager_payout + } +} + +# Tooltips for current status of placed wager +tournament_contest_wager_info_effect = { + if = { + limit = { + exists = var:tournament_wager_target + exists = var:tournament_wager_payout + } + var:tournament_wager_target = { save_scope_as = wager_target } + if = { + limit = { + scope:activity = { activity_tournament_versus_contest_trigger = yes } + } + switch = { + trigger = var:tournament_wager_target + scope:contest_loser = { custom_tooltip = wager_lost_tooltip } + scope:contest_winner = { custom_tooltip = wager_valid_tooltip } + } + } + else = { + if = { + limit = { + var:tournament_wager_target = { exists = var:contest_aptitude } + } + if = { + limit = { + scope:activity = { has_current_phase = tournament_phase_horse_race } + } + custom_tooltip = wager_valid_horse_tooltip + } + else = { custom_tooltip = wager_valid_tooltip } + } + else = { + if = { + limit = { + scope:activity = { has_current_phase = tournament_phase_horse_race } + } + custom_tooltip = wager_lost_horse_tooltip + } + else = { custom_tooltip = wager_lost_tooltip } + } + } + } +} + +# Place wager on a contestant +tournament_place_wager_effect = { + $CONTENDER$ = { save_scope_as = wager_target } + set_variable = { + name = tournament_wager_stake + value = tiny_gold_value + } + set_variable = { + name = tournament_wager_payout + value = tournament_wager_payout_value + } + set_variable = { + name = tournament_wager_target + value = scope:wager_target + } + scope:activity = { + add_activity_log_entry = { + key = tournament_placed_wager_log + tags = { wager } + score = 25 + character = root + target = scope:wager_target + + # Effects + root = { remove_short_term_gold = tiny_gold_value } + } + } + if = { + limit = { + scope:activity = { has_current_phase = tournament_phase_horse_race } + } + custom_tooltip = tournament_events.1000.horse_winnings_tt + } + else = { custom_tooltip = tournament_events.1000.winnings_tt } +} + +# Stress impact for betting on someone other than yourself +tournament_bet_on_other_stress_effect = { + if = { + limit = { exists = var:contest_aptitude } + stress_impact = { + arrogant = minor_stress_impact_gain + } + } + stress_impact = { + greedy = minor_stress_impact_gain + profligate = minor_stress_impact_loss + } +} + +# Info on potential effects for breaking islamic gambling laws +tournament_contest_maysir_tooltip_effect = { + if = { + limit = { + religion = religion:islam_religion + scope:activity = { + NOR = { + has_current_phase = tournament_phase_archery + has_current_phase = tournament_phase_horse_race + } + } + } + custom_description = { text = ep2_tournament_maysir_tt } + } +} + +# Effects for muslims breaking islamic gambling laws +tournament_contest_maysir_effect = { + if = { + limit = { + religion = religion:islam_religion + scope:activity = { + NOR = { + has_current_phase = tournament_phase_archery + has_current_phase = tournament_phase_horse_race + } + } + } + custom_description = { text = ep2_tournament_maysir_tt } + add_piety = medium_piety_loss + stress_impact = { + zealous = medium_stress_impact_gain + } + } +} + +############## +### PRIZES ### +############## + +# Create a prize artifact relevant to the current contest type +tournament_contest_generate_prize_effect = { + save_scope_value_as = { + name = contest_type + value = flag:$CONTEST$ + } + hidden_effect = { random_dummy_gender_effect = yes } + scope:activity = { + ### Combined wealth and quality determines tier + # 50-129 Masterwork + # 130-179 Famed + # 180+ Illustrious + save_scope_value_as = { + name = wealth + value = { + value = 0 + # Activity prize options + if = { # Common only + limit = { has_activity_option = { category = tournament_option_prizes option = tournament_prizes_bad } } + add = { 1 24 } + } + else_if = { # Common or Masterwork - often Masterwork + limit = { has_activity_option = { category = tournament_option_prizes option = tournament_prizes_normal } } + add = { 15 64 } + } + else_if = { # Masterwork or Famed - often Masterwork + limit = { has_activity_option = { category = tournament_option_prizes option = tournament_prizes_good } } + add = { 35 89 } + } + else_if = { # Masterwork, Famed, or Illustrious - often Famed + limit = { has_activity_option = { category = tournament_option_prizes option = tournament_prizes_very_good } } + add = { 60 105 } + } + else_if = { # Famed or Illustrious - 50/50 split + limit = { has_activity_option = { category = tournament_option_prizes option = tournament_prizes_splendid } } + add = { 69 111 } + } + } + } + save_scope_value_as = { + name = quality + value = { + value = 0 + # Activity prize options + if = { # Common only + limit = { has_activity_option = { category = tournament_option_prizes option = tournament_prizes_bad } } + add = { 1 24 } + } + else_if = { # Common or Masterwork - often Masterwork + limit = { has_activity_option = { category = tournament_option_prizes option = tournament_prizes_normal } } + add = { 15 64 } + } + else_if = { # Masterwork or Famed - often Masterwork + limit = { has_activity_option = { category = tournament_option_prizes option = tournament_prizes_good } } + add = { 35 89 } + } + else_if = { # Masterwork, Famed, or Illustrious - often Famed + limit = { has_activity_option = { category = tournament_option_prizes option = tournament_prizes_very_good } } + add = { 60 105 } + } + else_if = { # Famed or Illustrious - 50/50 split + limit = { has_activity_option = { category = tournament_option_prizes option = tournament_prizes_splendid } } + add = { 69 111 } + } + } + } + } + random_list = { + 15 = { # Armor + trigger = { + OR = { + scope:contest_type = flag:duel + scope:contest_type = flag:joust + scope:contest_type = flag:melee + } + } + create_artifact_armor_effect = { + OWNER = scope:host + CREATOR = scope:dummy_gender + SET_ARMOR_TYPE = flag:no + } + if = { + limit = { exists = scope:newly_created_artifact } + scope:newly_created_artifact = { set_artifact_name = tournament_prize_armor_name } + } + } + 15 = { # Weapon + trigger = { + OR = { + scope:contest_type = flag:duel + scope:contest_type = flag:joust + scope:contest_type = flag:melee + } + } + create_artifact_weapon_effect = { + OWNER = scope:host + CREATOR = scope:dummy_gender + SET_WEAPON_TYPE = flag:no + } + if = { + limit = { exists = scope:newly_created_artifact } + scope:newly_created_artifact = { set_artifact_name = tournament_prize_weapon_name } + } + } + 15 = { # Bow + trigger = { scope:contest_type = flag:archery } + create_artifact_bow_effect = { + OWNER = scope:host + CREATOR = scope:dummy_gender + SET_BOW_TYPE = flag:no + } + if = { + limit = { exists = scope:newly_created_artifact } + scope:newly_created_artifact = { set_artifact_name = tournament_prize_bow_name } + } + } + 5 = { # Ring + create_artifact_ring_effect = { + OWNER = scope:host + SMITH = scope:dummy_gender + } + if = { + limit = { exists = scope:newly_created_artifact } + scope:newly_created_artifact = { set_artifact_name = tournament_prize_ring_name } + } + } + 5 = { # Necklace + trigger = { + scope:host.culture = { has_cultural_era_or_later = culture_era_early_medieval } + } + if = { + limit = { + scope:$CONTEST$_winner = { has_royal_court = yes } + } + create_artifact_necklace_pedestal_effect = { + OWNER = scope:host + SMITH = scope:dummy_gender + } + } + else = { + create_artifact_necklace_effect = { + OWNER = scope:host + SMITH = scope:dummy_gender + } + } + if = { + limit = { exists = scope:newly_created_artifact } + scope:newly_created_artifact = { set_artifact_name = tournament_prize_necklace_name } + } + } + 5 = { # Brooch + if = { + limit = { + scope:$CONTEST$_winner = { has_royal_court = yes } + } + create_artifact_brooch_pedestal_effect = { + OWNER = scope:host + SMITH = scope:dummy_gender + } + } + else = { + create_artifact_brooch_effect = { + OWNER = scope:host + SMITH = scope:dummy_gender + } + } + if = { + limit = { exists = scope:newly_created_artifact } + scope:newly_created_artifact = { set_artifact_name = tournament_prize_brooch_name } + } + } + 5 = { # Goblet + trigger = { + scope:$CONTEST$_winner = { has_royal_court = yes } + scope:host.culture = { has_cultural_era_or_later = culture_era_early_medieval } + } + create_artifact_goblet_effect = { + OWNER = scope:host + SMITH = scope:dummy_gender + } + if = { + limit = { exists = scope:newly_created_artifact } + scope:newly_created_artifact = { set_artifact_name = tournament_prize_goblet_name } + } + } + 5 = { # Bowl + trigger = { + scope:$CONTEST$_winner = { has_royal_court = yes } + scope:host.culture = { has_cultural_era_or_later = culture_era_early_medieval } + } + create_artifact_bowl_effect = { + OWNER = scope:host + SMITH = scope:dummy_gender + } + if = { + limit = { exists = scope:newly_created_artifact } + scope:newly_created_artifact = { set_artifact_name = tournament_prize_bowl_name } + } + } + 5 = { # Urn + trigger = { + scope:$CONTEST$_winner = { has_royal_court = yes } + scope:host.culture = { has_cultural_era_or_later = culture_era_early_medieval } + } + create_artifact_urn_effect = { + OWNER = scope:host + POTTER = scope:dummy_gender + } + if = { + limit = { exists = scope:newly_created_artifact } + scope:newly_created_artifact = { set_artifact_name = tournament_prize_urn_name } + } + } + 5 = { # Statuette + trigger = { + scope:contest_type = flag:joust + scope:$CONTEST$_winner = { has_royal_court = yes } + scope:host.culture = { has_cultural_era_or_later = culture_era_high_medieval } + } + hidden_effect_new_object = { + # Get artifact quality, wealth, materials, and decorations + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + create_artifact = { + name = tournament_prize_statuette_name + creator = scope:host + description = placeholder # Will be regenerated in the post-creation effects + type = pedestal + visuals = statuette + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + history = { + type = prize_created + recipient = scope:host + } + save_scope_as = newly_created_artifact + } + scope:newly_created_artifact = { + set_artifact_description = artifact_statuette_description + # Add artifact modifiers + add_scaled_artifact_modifier_grandeur_small_effect = yes + add_scaled_artifact_modifier_minor_prestige_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_scaled_artifact_modifier_majesty_effect = yes + } + } + } + } + 5 = { # Wine Tun + trigger = { + scope:$CONTEST$_winner = { + has_royal_court = yes + drinks_alcohol_trigger = yes + } + scope:host = { + drinks_alcohol_trigger = yes + culture = { has_cultural_era_or_later = culture_era_high_medieval } + } + } + hidden_effect_new_object = { + # Get artifact quality, wealth, materials, and decorations + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + create_artifact = { + name = tournament_prize_tun_barrel_name + creator = scope:host + description = placeholder # Will be regenerated in the post-creation effects + type = tun_barrel + visuals = tun_barrel + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + history = { + type = prize_created + recipient = scope:host + } + save_scope_as = newly_created_artifact + } + scope:newly_created_artifact = { + set_artifact_description = artifact_tun_barrel_description + # Add artifact modifiers + add_scaled_artifact_modifier_grandeur_small_effect = yes + add_scaled_artifact_modifier_minor_prestige_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_scaled_artifact_modifier_rulership_effect = yes + } + } + } + } + 5 = { # Scepter + trigger = { + scope:host.culture = { has_cultural_era_or_later = culture_era_high_medieval } + } + if = { + limit = { + scope:$CONTEST$_winner = { has_royal_court = yes } + } + hidden_effect_new_object = { + # Get artifact quality, wealth, materials, and decorations + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + create_artifact = { + name = tournament_prize_scepter_name + creator = scope:host + description = placeholder # Will be regenerated in the post-creation effects + type = scepter_pedestal + visuals = scepter_pedestal + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + history = { + type = prize_created + recipient = scope:host + } + save_scope_as = newly_created_artifact + } + scope:newly_created_artifact = { + set_artifact_description = artifact_scepter_description + # Add artifact modifiers + add_scaled_artifact_modifier_minor_prestige_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_scaled_artifact_modifier_rulership_effect = yes + } + } + } + } + else = { + hidden_effect_new_object = { + # Get artifact quality, wealth, materials, and decorations + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + create_artifact = { + name = tournament_prize_scepter_name + creator = scope:host + description = placeholder # Will be regenerated in the post-creation effects + type = miscellaneous + visuals = regalia + template = regalia_template + modifier = artifact_placeholder_modifier + wealth = scope:wealth + quality = scope:quality + history = { + type = prize_created + recipient = scope:host + } + save_scope_as = newly_created_artifact + } + scope:newly_created_artifact = { + set_artifact_description = artifact_scepter_description + # Add artifact modifiers + add_scaled_artifact_modifier_minor_prestige_effect = yes + add_scaled_artifact_modifier_grandeur_small_effect = yes + if = { + limit = { + OR = { + rarity = famed + rarity = illustrious + } + } + add_scaled_artifact_modifier_rulership_effect = yes + } + } + } + } + } + } + if = { + limit = { exists = scope:newly_created_artifact } + scope:newly_created_artifact = { + if = { + limit = { + rarity = famed + } + random = { + chance = 50 + add_scaled_artifact_modifier_combat_effect = yes + } + } + else_if = { + limit = { + rarity = illustrious + } + add_scaled_artifact_modifier_combat_effect = yes + } + } + scope:$CONTEST$_winner = { + save_scope_as = contest_winner + send_interface_toast = { + type = toast_tournament_contest_reward + title = tournament_contest_reward_toast_title + left_icon = scope:newly_created_artifact + } + } + scope:newly_created_artifact = { + save_scope_as = $CONTEST$_prize + add_to_list = contest_prizes + if = { + limit = { scope:host = scope:contest_winner } + set_artifact_description = tournament_prize_host_desc_$CONTEST$ + } + else = { set_artifact_description = tournament_prize_desc_$CONTEST$ } + set_variable = suppress_artifact_notifications + scope:activity = { + add_activity_log_entry = { + key = tournament_$CONTEST$_prize_log + character = scope:host + target = scope:$CONTEST$_winner + artifact = scope:$CONTEST$_prize + show_in_conclusion = yes + + # EFFECT + scope:$CONTEST$_prize = { + set_owner = { + target = scope:$CONTEST$_winner + history = { + type = prize_awarded + actor = scope:host + recipient = scope:$CONTEST$_winner + } + } + } + } + } + remove_variable = suppress_artifact_notifications + } + } +} + +# Create an armor prize +tournament_contest_armor_prize_effect = { + create_artifact = { + name = tournament_prize_armor_name + creator = scope:host + description = placeholder # Will be regenerated in the post-creation effects + type = armor_$TYPE$ + visuals = armor + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + type = prize_created + recipient = scope:host + } + } +} + +# Create a weapon prize +tournament_contest_weapon_prize_effect = { + create_artifact = { + name = tournament_prize_weapon_name + creator = scope:host + description = placeholder # Will be regenerated in the post-creation effects + visuals = $VISUALS$ + type = $TYPE$ + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + type = prize_created + recipient = scope:host + } + } +} + +# Create a bow prize +tournament_contest_bow_prize_effect = { + create_artifact = { + name = tournament_prize_bow_name + creator = scope:host + description = placeholder # Will be regenerated in the post-creation effects + visuals = $TYPE$ + type = $TYPE$ + modifier = artifact_prowess_1_modifier + wealth = scope:wealth + quality = scope:quality + save_scope_as = newly_created_artifact + history = { + type = prize_created + recipient = scope:host + } + } +} + +tournament_contest_rewards_give_liege_prestige_effect = { + if = { + limit = { tournament_is_knightly_entourage_character_trigger = yes } + # Now, we distribute the sum. + hidden_effect = { + # Save for loc. + save_scope_as = winner + liege = { + # Save for loc. + save_scope_as = winner_liege + # Distribute prestige. + add_prestige = scope:host.$AMOUNT$ + } + } + # And remember to tell everyone about it. + custom_tooltip = $TOOLTIP$ + } +} + +tournament_contest_rewards_split_prize_money_with_liege_effect = { + if = { + limit = { tournament_is_knightly_entourage_character_trigger = yes } + # Grab scopes for loc. + save_scope_as = winner + liege = { save_scope_as = winner_liege } + # If they love you, they give you all the cash. + if = { + limit = { + opinion = { + target = scope:winner_liege + value >= very_high_positive_opinion + } + } + custom_tooltip = tournament_landless_knight_liege_rewards.tt.tournament_gold.knight_loves_liege + pay_short_term_gold = { + target = scope:winner_liege + gold = $AMOUNT$ + } + } + # If they like you, they give you most of it. + if = { + limit = { + opinion = { + target = scope:winner_liege + value >= medium_positive_opinion + } + } + custom_tooltip = tournament_landless_knight_liege_rewards.tt.tournament_gold.knight_likes_liege + pay_short_term_gold = { + target = scope:winner_liege + gold = { + value = $AMOUNT$ + multiply = 0.75 + } + } + } + # If they're neutral to dislike, they split it 50:50. + if = { + limit = { + opinion = { + target = scope:winner_liege + value >= high_negative_opinion + } + } + custom_tooltip = tournament_landless_knight_liege_rewards.tt.tournament_gold.knight_accepts_liege + pay_short_term_gold = { + target = scope:winner_liege + gold = { + value = $AMOUNT$ + multiply = 0.5 + } + } + } + # If they _really_ hate you, they refuse to give anything. + else = { custom_tooltip = tournament_landless_knight_liege_rewards.tt.tournament_gold.knight_hates_liege } + } +} + +tournament_winner_prestige_rewards_effect = { + if = { + limit = { scope:activity.num_phases > 4 } + add_prestige = scope:host.massive_prestige_value + if = { + limit = { exists = dynasty } + dynasty = { add_dynasty_prestige = scope:host.minor_dynasty_prestige_gain } + } + # If appropriate, give the winner's liege a reward too. + tournament_contest_rewards_give_liege_prestige_effect = { + AMOUNT = tournament_first_place_reward_prestige_major_value + TOOLTIP = tournament_landless_knight_liege_rewards.tt.tournament_first_place_reward_prestige_major + } + } + else_if = { + limit = { scope:activity.num_phases > 3 } + add_prestige = scope:host.major_prestige_value + # If appropriate, give the winner's liege a reward too. + tournament_contest_rewards_give_liege_prestige_effect = { + AMOUNT = tournament_first_place_reward_prestige_medium_value + TOOLTIP = tournament_landless_knight_liege_rewards.tt.tournament_first_place_reward_prestige_medium + } + } + else = { + add_prestige = scope:host.medium_prestige_value + # If appropriate, give the winner's liege a reward too. + tournament_contest_rewards_give_liege_prestige_effect = { + AMOUNT = tournament_first_place_reward_prestige_minor_value + TOOLTIP = tournament_landless_knight_liege_rewards.tt.tournament_first_place_reward_prestige_minor + } + } +} + +tournament_winner_gold_rewards_effect = { + if = { + limit = { + scope:activity = { + has_activity_option = { + category = tournament_option_prizes + option = tournament_prizes_good + } + } + } + add_gold = scope:host.medium_gold_value + tournament_contest_rewards_split_prize_money_with_liege_effect = { AMOUNT = medium_gold_value } + } + else_if = { + limit = { + scope:activity = { + has_activity_option = { + category = tournament_option_prizes + option = tournament_prizes_normal + } + } + } + add_gold = scope:host.minor_gold_value + tournament_contest_rewards_split_prize_money_with_liege_effect = { AMOUNT = minor_gold_value } + } + else = { + add_gold = scope:host.tiny_gold_value + tournament_contest_rewards_split_prize_money_with_liege_effect = { AMOUNT = tiny_gold_value } + } +} + +tournament_second_prestige_rewards_effect = { + if = { + limit = { scope:activity.num_phases > 4 } + add_prestige = scope:host.major_prestige_value + # If appropriate, give the winner's liege a reward too. + tournament_contest_rewards_give_liege_prestige_effect = { + AMOUNT = tournament_second_place_reward_prestige_major_value + TOOLTIP = tournament_landless_knight_liege_rewards.tt.tournament_second_place_reward_prestige_major + } + } + else_if = { + limit = { scope:activity.num_phases > 3 } + add_prestige = scope:host.medium_prestige_value + # If appropriate, give the winner's liege a reward too. + tournament_contest_rewards_give_liege_prestige_effect = { + AMOUNT = tournament_second_place_reward_prestige_medium_value + TOOLTIP = tournament_landless_knight_liege_rewards.tt.tournament_second_place_reward_prestige_medium + } + } + else = { + add_prestige = scope:host.minor_prestige_value + # If appropriate, give the winner's liege a reward too. + tournament_contest_rewards_give_liege_prestige_effect = { + AMOUNT = tournament_second_place_reward_prestige_minor_value + TOOLTIP = tournament_landless_knight_liege_rewards.tt.tournament_second_place_reward_prestige_minor + } + } +} + +tournament_second_gold_rewards_effect = { + if = { + limit = { + scope:activity = { + has_activity_option = { + category = tournament_option_prizes + option = tournament_prizes_good + } + } + } + add_gold = scope:host.minor_gold_value + tournament_contest_rewards_split_prize_money_with_liege_effect = { AMOUNT = minor_gold_value } + } + else_if = { + limit = { + scope:activity = { + has_activity_option = { + category = tournament_option_prizes + option = tournament_prizes_normal + } + } + } + add_gold = scope:host.tiny_gold_value + tournament_contest_rewards_split_prize_money_with_liege_effect = { AMOUNT = tiny_gold_value } + } +} + +tournament_third_prestige_rewards_effect = { + if = { + limit = { scope:activity.num_phases > 4 } + add_prestige = scope:host.medium_prestige_value + # If appropriate, give the winner's liege a reward too. + tournament_contest_rewards_give_liege_prestige_effect = { + AMOUNT = tournament_third_place_reward_prestige_major_value + TOOLTIP = tournament_landless_knight_liege_rewards.tt.tournament_third_place_reward_prestige_major + } + } + else_if = { + limit = { scope:activity.num_phases > 3 } + add_prestige = scope:host.minor_prestige_value + # If appropriate, give the winner's liege a reward too. + tournament_contest_rewards_give_liege_prestige_effect = { + AMOUNT = tournament_third_place_reward_prestige_medium_value + TOOLTIP = tournament_landless_knight_liege_rewards.tt.tournament_third_place_reward_prestige_medium + } + } + else = { add_prestige = scope:host.miniscule_prestige_value } +} + +tournament_third_gold_rewards_effect = { + if = { + limit = { + scope:activity = { + has_activity_option = { + category = tournament_option_prizes + option = tournament_prizes_good + } + } + } + add_gold = scope:host.tiny_gold_value + tournament_contest_rewards_split_prize_money_with_liege_effect = { AMOUNT = tiny_gold_value } + } +} + +tournament_contest_rewards_effect = { + scope:activity = { + random_guest_subset = { + name = winner + phase = tournament_phase_$CONTEST$ + save_scope_as = contest_winner + add_to_list = awarded_contestants + scope:activity = { + add_activity_log_entry = { + key = tournament_$CONTEST$_winner_log + tags = { winner contest } + score = 80 + show_in_conclusion = yes + character = scope:contest_winner + + # EFFECT + scope:contest_winner ?= { + # Prestige + tournament_winner_prestige_rewards_effect = yes + # Gold + tournament_winner_gold_rewards_effect = yes + # Trait + tournament_give_trait_effect = { CONTEST = $CONTEST$ } + # Modifier + add_character_modifier = { modifier = tournament_$CONTEST$_winner_modifier years = 5 } + } + } + } + #Memory + create_character_memory = { + type = tournament_won_contest_memory + + participants = { + contestant = this + host = scope:host + } + } + ordered_memory = { + memory_type = tournament_won_contest_memory + order_by = memory_creation_date + set_variable = { + name = contest_type + value = flag:tournament_phase_$CONTEST$ + } + } + add_to_list = awarded_contestants + custom_tooltip = contest_winner_ceremony_tt + } + # Second Place + random_guest_subset = { + name = second_place + phase = tournament_phase_$CONTEST$ + # Prestige + tournament_second_prestige_rewards_effect = yes + # Gold + tournament_second_gold_rewards_effect = yes + # Trait + tournament_give_trait_effect = { CONTEST = $CONTEST$ } + add_character_modifier = { modifier = tournament_$CONTEST$_participant_modifier years = 5 } + add_to_list = awarded_contestants + } + # Third place + random_guest_subset = { + name = third_place + phase = tournament_phase_$CONTEST$ + # Prestige + tournament_third_prestige_rewards_effect = yes + # Gold + tournament_third_gold_rewards_effect = yes + # Trait + tournament_give_trait_effect = { CONTEST = $CONTEST$ } + add_character_modifier = { modifier = tournament_$CONTEST$_participant_modifier years = 5 } + add_to_list = awarded_contestants + } + # Other competitors + every_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + custom = contest_individual_losers_tt + limit = { + NOT = { is_in_list = awarded_contestants } + } + tournament_give_trait_effect = { CONTEST = $CONTEST$ } + add_character_modifier = { modifier = tournament_$CONTEST$_participant_modifier years = 5 } + } + } +} + +tournament_team_winner_prestige_rewards_effect = { + if = { + limit = { scope:activity.num_phases > 4 } + add_prestige = scope:host.major_prestige_value + # If appropriate, give the winner's liege a reward too. + tournament_contest_rewards_give_liege_prestige_effect = { + AMOUNT = tournament_team_winner_reward_prestige_major_value + TOOLTIP = tournament_landless_knight_liege_rewards.tt.tournament_team_winner_reward_prestige_major + } + } + else_if = { + limit = { scope:activity.num_phases > 3 } + add_prestige = scope:host.medium_prestige_value + # If appropriate, give the winner's liege a reward too. + tournament_contest_rewards_give_liege_prestige_effect = { + AMOUNT = tournament_team_winner_reward_prestige_medium_value + TOOLTIP = tournament_landless_knight_liege_rewards.tt.tournament_team_winner_reward_prestige_medium + } + } + else = { + add_prestige = scope:host.minor_prestige_value + # If appropriate, give the winner's liege a reward too. + tournament_contest_rewards_give_liege_prestige_effect = { + AMOUNT = tournament_team_winner_reward_prestige_minor_value + TOOLTIP = tournament_landless_knight_liege_rewards.tt.tournament_team_winner_reward_prestige_minor + } + } +} + +tournament_team_winner_gold_rewards_effect = { + if = { + limit = { + scope:activity = { + has_activity_option = { + category = tournament_option_prizes + option = tournament_prizes_good + } + } + } + add_gold = scope:host.minor_gold_value + tournament_contest_rewards_split_prize_money_with_liege_effect = { AMOUNT = minor_gold_value } + } + else_if = { + limit = { + scope:activity = { + has_activity_option = { + category = tournament_option_prizes + option = tournament_prizes_normal + } + } + } + add_gold = scope:host.tiny_gold_value + tournament_contest_rewards_split_prize_money_with_liege_effect = { AMOUNT = tiny_gold_value } + } +} + +tournament_team_loser_prestige_rewards_effect = { + if = { + limit = { scope:activity.num_phases > 4 } + add_prestige = scope:host.medium_prestige_value + # If appropriate, give the winner's liege a reward too. + tournament_contest_rewards_give_liege_prestige_effect = { + AMOUNT = tournament_team_loser_reward_prestige_major_value + TOOLTIP = tournament_landless_knight_liege_rewards.tt.tournament_team_loser_reward_prestige_major + } + } + else_if = { + limit = { scope:activity.num_phases > 3 } + add_prestige = scope:host.minor_prestige_value + # If appropriate, give the winner's liege a reward too. + tournament_contest_rewards_give_liege_prestige_effect = { + AMOUNT = tournament_team_loser_reward_prestige_medium_value + TOOLTIP = tournament_landless_knight_liege_rewards.tt.tournament_team_loser_reward_prestige_medium + } + } + else = { add_prestige = scope:host.miniscule_prestige_value } +} + +tournament_contest_team_rewards_effect = { + scope:activity = { + every_guest_subset = { + name = winner + phase = tournament_phase_$CONTEST$ + custom = contest_team_winners_tt + # Prestige + tournament_team_winner_prestige_rewards_effect = yes + # Gold + tournament_team_winner_gold_rewards_effect = yes + # Trait + tournament_give_trait_effect = { CONTEST = $CONTEST$ } + # Modifier + add_character_modifier = { modifier = tournament_$CONTEST$_winner_modifier years = 5 } + # Memory + create_character_memory = { + type = tournament_won_contest_memory + + participants = { + contestant = this + host = scope:host + } + } + ordered_memory = { + memory_type = tournament_won_contest_memory + order_by = memory_creation_date + set_variable = { + name = contest_type + value = flag:tournament_phase_$CONTEST$ + } + } + add_to_list = contest_winners + } + random_guest_subset = { + name = winner + phase = tournament_phase_$CONTEST$ + limit = { + scope:activity.var:melee_winner ?= this + is_alive = yes + } + alternative_limit = { is_alive = yes } + weight = { + base = 1 + tournament_team_captain_modifier = yes + } + save_scope_as = contest_winner + custom_tooltip = contest_winner_ceremony_tt + } + # Losers + every_guest_subset = { + name = second_place + phase = tournament_phase_$CONTEST$ + custom = contest_team_losers_tt + # Prestige + tournament_team_loser_prestige_rewards_effect = yes + # Trait + tournament_give_trait_effect = { CONTEST = $CONTEST$ } + # Modifier + add_character_modifier = { modifier = tournament_$CONTEST$_participant_modifier years = 5 } + add_to_list = contest_losers + } + } +} + +################### +### PAS D'ARMES ### +################### + +# Create token trophy taken from non-martial, e.g. scarf + +# Token +create_artifact_pas_darmes_token_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + select_local_animal_effect = { TYPE = any } # Save scope to limit possible animals: any/big/small/dangerous/harmless/prowling + save_scope_as = owner + } + $WINNER$ = { save_scope_as = winner } + hidden_effect_new_object = { + # Get artifact quality, wealth, and materials + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + if = { #If we have set the location we use it for the materials + limit = { exists = scope:location } + scope:location = { add_to_list = artifact_material_sources } + } + scope:winner = { + # Create the artifact + create_artifact = { + name = artifact_pas_darmes_token_name + creator = scope:owner + description = placeholder + visuals = small_box + type = pas_darmes_token + modifier = artifact_monthly_prestige_add_1_modifier + wealth = scope:wealth + quality = scope:quality + max_durability = 5 + save_scope_as = newly_created_artifact + history = { + #type = pas_darmes_yielded + type = given + location = scope:location + actor = scope:owner + recipient = scope:winner + } + } + } + scope:newly_created_artifact = { + set_variable = { + name = token_owner + value = scope:owner + } + set_artifact_feature_group = decoration_pattern + set_artifact_feature_group = generic_material_cloth + set_artifact_description = artifact_pas_darmes_token_description + switch = { + trigger = rarity + illustrious = { add_artifact_modifier = artifact_monthly_prestige_add_4_modifier } + famed = { add_artifact_modifier = artifact_monthly_prestige_add_3_modifier } + masterwork = { add_artifact_modifier = artifact_monthly_prestige_add_2_modifier } + common = { add_artifact_modifier = artifact_monthly_prestige_add_1_modifier } + } + add_scaled_artifact_modifier_attractiveness_effect = yes + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + } + scope:owner = { remove_variable = animal_type } + } +} + +# Create spurs trophy taken from victory +create_artifact_pas_darmes_spurs_effect = { + # Get the character the artifact is being made for. + $WINNER$ = { + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + save_scope_as = winner + } + $LOSER$ = { save_scope_as = owner } + hidden_effect_new_object = { + # Get artifact quality, wealth, and materials + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + if = { #If we have set the location we use it for the materials + limit = { exists = scope:location } + scope:location = { add_to_list = artifact_material_sources } + } + scope:winner = { + # Create the artifact + create_artifact = { + name = artifact_pas_darmes_spurs_name + creator = scope:owner + description = placeholder + visuals = small_box + type = pas_darmes_spurs + modifier = artifact_monthly_prestige_add_1_modifier + wealth = scope:wealth + quality = scope:quality + max_durability = 30 + save_scope_as = newly_created_artifact + history = { + #type = pas_darmes_won + type = given + location = scope:location + actor = scope:owner + recipient = scope:winner + } + } + } + scope:newly_created_artifact = { + set_variable = { + name = token_owner + value = scope:owner + } + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_pas_darmes_spurs_description + switch = { + trigger = rarity + illustrious = { add_artifact_modifier = artifact_monthly_prestige_add_4_modifier } + famed = { add_artifact_modifier = artifact_monthly_prestige_add_3_modifier } + masterwork = { add_artifact_modifier = artifact_monthly_prestige_add_2_modifier } + common = { add_artifact_modifier = artifact_monthly_prestige_add_1_modifier } + } + add_scaled_artifact_modifier_attractiveness_effect = yes + add_scaled_artifact_modifier_combat_effect = yes + set_variable = { + name = quality + value = scope:quality + } + set_variable = { + name = wealth + value = scope:wealth + } + } + } +} + +# Create favor given to favorite contestant, e.g. handkerchief +create_artifact_tournament_favor_effect = { + # Get the character the artifact is being made for. + $OWNER$ = { + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + save_scope_as = owner + } + $RECIPIENT$ = { save_scope_as = recipient } + hidden_effect_new_object = { + # Get artifact quality, wealth, and materials + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + scope:activity.activity_location = { add_to_list = artifact_material_sources } + scope:recipient = { + # Create the artifact + create_artifact = { + name = artifact_tournament_favor_name + creator = scope:owner + description = placeholder + visuals = small_box + type = tournament_favor + modifier = artifact_monthly_prestige_add_1_modifier + wealth = scope:wealth + quality = scope:quality + max_durability = 10 + save_scope_as = newly_created_artifact + history = { + type = given + location = scope:activity.activity_location + recipient = scope:recipient + } + } + } + scope:newly_created_artifact = { + flag_as_trash_artifact = yes + set_variable = { + name = favor_giver + value = scope:owner + } + get_artifact_feature_references_effect = yes + set_artifact_description = artifact_tournament_favor_description + switch = { + trigger = rarity + illustrious = { add_artifact_modifier = artifact_monthly_prestige_add_4_modifier } + famed = { add_artifact_modifier = artifact_monthly_prestige_add_3_modifier } + masterwork = { add_artifact_modifier = artifact_monthly_prestige_add_2_modifier } + common = { add_artifact_modifier = artifact_monthly_prestige_add_1_modifier } + } + add_scaled_artifact_modifier_attractiveness_effect = yes + } + } +} + +################## +### HORSE RACE ### +################## + +# Fetch a randomized horse name +tournament_horse_race_fetch_horse_effect = { + save_temporary_scope_as = horse_owner + if = { + limit = { + OR = { + NOT = { exists = var:contest_horse_race_name } + NOT = { exists = var:contest_horse_race_gender } + } + } + hidden_effect = { + while = { + limit = { + OR = { + NOT = { exists = var:contest_horse_race_name } + # Stop multiple horses with same name + scope:activity = { + any_guest_subset = { + name = contestant + exists = var:contest_horse_race_name + this != scope:horse_owner + var:contest_horse_race_name = scope:horse_owner.var:contest_horse_race_name + } + } + } + } + random_list = { + ## FAITH + # BUDDHISM + 300 = { # Kanthaka - Siddhartha's + trigger = { religion = religion:buddhism_religion } + set_variable = { name = contest_horse_race_name value = flag:kanthaka } + } + # GODS/SAINTS + 150 = { + trigger = { + NOT = { + religion = { is_in_family = rf_abrahamic } + } + } + modifier = { + factor = 2 + faith = { has_doctrine = unreformed_faith_doctrine } + } + random_list = { + 5 = { set_variable = { name = contest_horse_race_name value = flag:faith_fate_god } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:faith_knowledge_god } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:faith_night_god } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:faith_trickster_god } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:faith_war_god } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:faith_water_god } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:faith_wealth_god } } + } + } + # HINDUISM + 300 = { + trigger = { religion = religion:hinduism_religion } + random_list = { + 5 = { # Dadhi-krā - Dawn + set_variable = { name = contest_horse_race_name value = flag:dadhi_kra } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Devadatta - Vishnu's + set_variable = { name = contest_horse_race_name value = flag:devadatta } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Dyaus Pita - Sky Father + set_variable = { name = contest_horse_race_name value = flag:dyauspitar } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Keshi - Kalki's + set_variable = { name = contest_horse_race_name value = flag:keshi } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Uhchaihshravas - Horse King + set_variable = { name = contest_horse_race_name value = flag:uchchaihshravas } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + } + } + # ISLAM + 300 = { + trigger = { religion = religion:islam_religion } + random_list = { + 5 = { # Abbayan - Muhammad's mares + set_variable = { name = contest_horse_race_name value = flag:abbayan } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 5 = { # al-Murtajiz - Muhammad's stallions + set_variable = { name = contest_horse_race_name value = flag:al_murtajiz } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # al-Sakb - Muhammad's stallions + set_variable = { name = contest_horse_race_name value = flag:al_sakb } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # al-Ya'sub - Muhammad's stallions + set_variable = { name = contest_horse_race_name value = flag:al_yasub } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { set_variable = { name = contest_horse_race_name value = flag:buraq } } # Buraq - Islam + 5 = { # Habdan - Muhammad's mares + set_variable = { name = contest_horse_race_name value = flag:hadban } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 5 = { # Haizum - Gabriel's + set_variable = { name = contest_horse_race_name value = flag:haizum } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 5 = { # Hamdani - Muhammad's mares + set_variable = { name = contest_horse_race_name value = flag:hamdani } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 5 = { # Kuhaylan - Muhammad's mares + set_variable = { name = contest_horse_race_name value = flag:kuhaylan } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 5 = { # Lihaf - Muhammad's stallions + set_variable = { name = contest_horse_race_name value = flag:lihaf } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Lizaz - Muhammad's stallions + set_variable = { name = contest_horse_race_name value = flag:lizaz } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Seqlawi - Muhammad's mares + set_variable = { name = contest_horse_race_name value = flag:seqlawi } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 5 = { # Zuljanah - Husayn ibn Ali's + set_variable = { name = contest_horse_race_name value = flag:zuljanah } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + } + } + # NORSE + 300 = { + trigger = { religion = religion:germanic_religion } + random_list = { + 5 = { # Alsviðr - Sól's + set_variable = { name = contest_horse_race_name value = flag:alsvidr } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Árvakr - Sól's + set_variable = { name = contest_horse_race_name value = flag:arvakr } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Falhófnir - Yggdrasil + set_variable = { name = contest_horse_race_name value = flag:falhofnir } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Glad - Yggdrasil + set_variable = { name = contest_horse_race_name value = flag:glad } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Glær - Yggdrasil + set_variable = { name = contest_horse_race_name value = flag:glaer } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Gulltoppr - Heimdallr's + set_variable = { name = contest_horse_race_name value = flag:gulltoppr } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Hófvarpnir - Gná's + set_variable = { name = contest_horse_race_name value = flag:hofvarpnir } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Hrímfaxi - Nótt's + set_variable = { name = contest_horse_race_name value = flag:hrimfaxi } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # # Skinfaxi - Dagur's + set_variable = { name = contest_horse_race_name value = flag:skinfaxi } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Sleipnir - Odin's + set_variable = { name = contest_horse_race_name value = flag:sleipnir } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Svaðilfari - Sleipnir father + set_variable = { name = contest_horse_race_name value = flag:svadilfari } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + } + } + ## CULTURE + # ARABIC + 300 = { + trigger = { + culture = { + any_parent_culture_or_above = { has_cultural_pillar = heritage_arabic } + } + } + random_list = { + 5 = { # al-Dinari - Arabian horse father + set_variable = { name = contest_horse_race_name value = flag:al_dinari } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # al-Hujays - Arabian horse father + set_variable = { name = contest_horse_race_name value = flag:al_hujays } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # al-Ward - Arabian horse father + set_variable = { name = contest_horse_race_name value = flag:al_ward } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # A'waj - Arabian horse father + set_variable = { name = contest_horse_race_name value = flag:awaj } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Dhi al-'Uqqal - Arabian horse father + set_variable = { name = contest_horse_race_name value = flag:dhi_al_uqqal } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Sabal - Arabian horse mother + set_variable = { name = contest_horse_race_name value = flag:sabal } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 5 = { # Zad al-Rakib - Arabian horse father + set_variable = { name = contest_horse_race_name value = flag:zad_al_rakib } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + } + } + # BRYTHONIC + 300 = { + trigger = { + culture = { + any_parent_culture_or_above = { has_cultural_pillar = heritage_brythonic } + } + } + random_list = { + 5 = { # Gringolet - Sir Gawain's + set_variable = { name = contest_horse_race_name value = flag:gringolet } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Hengroen - King Arthur's + set_variable = { name = contest_horse_race_name value = flag:hengroen } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Llamrei - King Arthur's + set_variable = { name = contest_horse_race_name value = flag:llamrei } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 5 = { # Morvarc’h - Breton + set_variable = { name = contest_horse_race_name value = flag:morvarch } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + } + } + # CHINESE + 300 = { + trigger = { + culture = { + any_parent_culture_or_above = { has_cultural_pillar = heritage_chinese } + } + } + random_list = { + 5 = { # Red Hare/Chi Tu - Lü Bu's + set_variable = { name = contest_horse_race_name value = flag:red_hare } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { set_variable = { name = contest_horse_race_name value = flag:typhoon } } # Typhoon + } + } + # FRANKISH + 300 = { + trigger = { + culture = { + any_parent_culture_or_above = { has_cultural_pillar = heritage_frankish } + } + } + random_list = { + 5 = { # Baucent - Guillaume d'Orange's + set_variable = { name = contest_horse_race_name value = flag:baucent } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Bayard - Chansons de gestes + set_variable = { name = contest_horse_race_name value = flag:bayard } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Sorel - Gerin's + set_variable = { name = contest_horse_race_name value = flag:sorel } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Tencendur - Charlemagne's + set_variable = { name = contest_horse_race_name value = flag:tencendur } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Veillantif - Roland's + set_variable = { name = contest_horse_race_name value = flag:veillantif } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + } + } + # GRECO-ROMAN + 300 = { + trigger = { + culture = { + any_parent_culture_or_above = { + OR = { + has_cultural_pillar = heritage_byzantine + has_cultural_pillar = heritage_latin + } + } + } + } + random_list = { + 5 = { # Arion - Iliad + set_variable = { name = contest_horse_race_name value = flag:arion } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Asturcus - Caesar's + set_variable = { name = contest_horse_race_name value = flag:asturcus } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Balius - Achilles' + set_variable = { name = contest_horse_race_name value = flag:balius } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Boreas - North Wind + set_variable = { name = contest_horse_race_name value = flag:boreas } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Bucephalus - Megas Alexandros' + set_variable = { name = contest_horse_race_name value = flag:bucephalus } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Caesar - Emperor + set_variable = { name = contest_horse_race_name value = flag:caesar } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Chiron - Centaur + set_variable = { name = contest_horse_race_name value = flag:chiron } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Epona - goddess + set_variable = { name = contest_horse_race_name value = flag:epona } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 5 = { # Equuleus - Hippe + set_variable = { name = contest_horse_race_name value = flag:equuleus } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 5 = { # Hippocampus - Poseidon's + set_variable = { name = contest_horse_race_name value = flag:hippocampus } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { set_variable = { name = contest_horse_race_name value = flag:incitatus } } # Incitatus - Caligula's + 5 = { set_variable = { name = contest_horse_race_name value = flag:notus } } # Notus - South Wind + 5 = { # Pedasos - Achilles' + set_variable = { name = contest_horse_race_name value = flag:pedasos } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Pegasus - Bellerophon's + set_variable = { name = contest_horse_race_name value = flag:pegasus } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 5 = { # Rhaebus - Mezentius' + set_variable = { name = contest_horse_race_name value = flag:rhaebus } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { set_variable = { name = contest_horse_race_name value = flag:seianian } } # Seianian - Gnaeus Seius' + 5 = { set_variable = { name = contest_horse_race_name value = flag:sterope } } # Sterope - Helios' + 5 = { # Xanthos - Achilles' + set_variable = { name = contest_horse_race_name value = flag:xanthos } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { set_variable = { name = contest_horse_race_name value = flag:zephryus } } # Zephyrus - West Wind + } + } + # GOIDELIC + 300 = { + trigger = { + culture = { + any_parent_culture_or_above = { has_cultural_pillar = heritage_goidelic } + } + } + random_list = { + 5 = { # Dub Sainglend - Cúchulainn's + set_variable = { name = contest_horse_race_name value = flag:dub_sainglend } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Embarr - Lugh Lamh-fada's + set_variable = { name = contest_horse_race_name value = flag:enbarr } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 5 = { # Kelpie - mythological + set_variable = { name = contest_horse_race_name value = flag:kelpie } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 5 = { # Liath Macha - Cúchulainn's + set_variable = { name = contest_horse_race_name value = flag:liath_macha } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + } + } + # IBERIAN + 300 = { + trigger = { + culture = { has_cultural_pillar = language_iberian } + } + random_list = { + 5 = { # Altivo - El Dorado + set_variable = { name = contest_horse_race_name value = flag:altivo } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Babieca - El Cid's + set_variable = { name = contest_horse_race_name value = flag:babieca } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Rocinante - Don Quixote's + set_variable = { name = contest_horse_race_name value = flag:rocinante } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { + set_variable = { name = contest_horse_race_name value = flag:tornado } + } + } + } + # INDO-ARYAN + 300 = { + trigger = { + culture = { has_cultural_pillar = heritage_indo_aryan } + } + random_list = { + 5 = { # Pratap's + set_variable = { name = contest_horse_race_name value = flag:atak } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Pratap's + set_variable = { name = contest_horse_race_name value = flag:chetak } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Ranjit's + set_variable = { name = contest_horse_race_name value = flag:laili } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 5 = { # Pratap's + set_variable = { name = contest_horse_race_name value = flag:natak } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + } + } + # MONGOLIC + 300 = { + trigger = { + culture = { + any_parent_culture_or_above = { has_cultural_pillar = heritage_mongolic } + } + } + random_list = { + 5 = { set_variable = { name = contest_horse_race_name value = flag:aranjagaan } } # Aranjagaan - Jangar's + 5 = { set_variable = { name = contest_horse_race_name value = flag:oyomaa } } # Oyomaa - Jangar's + 5 = { set_variable = { name = contest_horse_race_name value = flag:tolin_khul } } # Tolin Khul - folk song + } + } + # PERSIAN + 300 = { + trigger = { + culture = { + any_parent_culture_or_above = { has_cultural_pillar = heritage_iranian } + } + } + random_list = { + 5 = { # Rahbar (Leader) - Akbar's + set_variable = { name = contest_horse_race_name value = flag:rahbar } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Rakhsh - Rostam's + set_variable = { name = contest_horse_race_name value = flag:rakhsh } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + } + } + # SCANDINAVIAN + 300 = { + trigger = { + culture = { + any_parent_culture_or_above = { has_cultural_pillar = heritage_north_germanic } + } + } + random_list = { + 5 = { + # Grani - Sigurd's + set_variable = { name = contest_horse_race_name value = flag:grani } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + } + } + # SLAVIC + 300 = { + trigger = { + culture = { + any_parent_culture_or_above = { has_cultural_pillar = heritage_east_slavic } + } + } + random_list = { + 5 = { # Sivko-Burko - Ivan the Fool's + set_variable = { name = contest_horse_race_name value = flag:sivko_burko } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { + set_variable = { name = contest_horse_race_name value = flag:sivko } + } + 5 = { + set_variable = { name = contest_horse_race_name value = flag:burko } + } + } + } + # TURKIC + 300 = { + trigger = { + culture = { + any_parent_culture_or_above = { has_cultural_pillar = heritage_turkic } + } + } + random_list = { + 5 = { # G'irot - Koroghlu's + set_variable = { name = contest_horse_race_name value = flag:girot } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Tulpar - mythological + set_variable = { name = contest_horse_race_name value = flag:tulpar } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + } + } + ## COLOR/NOUN + 300 = { + modifier = { # Mongol's prefer color/marking names + factor = 2 + culture = { has_cultural_pillar = heritage_mongolic } + } + random_list = { + # COLOR + 5 = { set_variable = { name = contest_horse_race_name value = flag:bay } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:black } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:blue } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:brindle } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:buckskin } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:chestnut } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:cloud } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:cream } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:crimson } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:dapple } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:dawn } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:dun } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:dusk } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:flaxen } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:flame } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:frost } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:golden } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:gray } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:leopard } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:milk } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:night } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:pearl } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:red } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:roan } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:rose } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:ruby } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:scarlet } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:shade } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:shadow } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:shining } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:silk } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:silver } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:smoke } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:snow } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:sorrel } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:sun } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:tawny } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:yellow } } + } + random = { + chance = 50 + random_list = { + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:blaze } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:coat } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:dash } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:face } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:feet } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:foot } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:hair } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:hide } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:hoof } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:hooves } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:mane } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:mottle } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:socks } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:speckles } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:spots } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:star } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:steed } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:stockings } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:streak } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:stripe } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:tail } } + } + } + } + # ADJECTIVE/NOUN + 300 = { + # ADJECTIVE + random_list = { + 5 = { set_variable = { name = contest_horse_race_name value = flag:brave } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:brisk } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:fleet } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:long } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:speed } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:storm } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:swift } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:thunder } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:wave } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:wind } } + } + random = { + chance = 50 + random_list = { + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:bolt } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:bound } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:dart } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:dash } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:feet } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:foot } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:hocks } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:hoof } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:hooves } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:rush } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:sprint } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:steed } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:step } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:stride } } + 5 = { set_variable = { name = contest_horse_race_name_2 value = flag:streak } } + } + } + } + ## NOUN/LONG ADJECTIVE + 300 = { + random_list = { + 25 = { + trigger = { + faith = { has_doctrine = tenet_monasticism } + } + set_variable = { name = contest_horse_race_name value = flag:abbess } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 25 = { + trigger = { + faith = { has_doctrine = tenet_monasticism } + } + set_variable = { name = contest_horse_race_name value = flag:abbot } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 25 = { set_variable = { name = contest_horse_race_name value = flag:adamant } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:agile } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:charger } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:chaser } } + 25 = { + modifier = { + add = 75 + government_has_flag = government_is_tribal + } + set_variable = { name = contest_horse_race_name value = flag:chieftain } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 25 = { + modifier = { + add = 75 + government_has_flag = government_is_tribal + } + set_variable = { name = contest_horse_race_name value = flag:chieftess } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 25 = { set_variable = { name = contest_horse_race_name value = flag:cyclone } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:deluge } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:downpour } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:endurance } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:faithful } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:flash } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:forthright } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:fury } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:gale } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:hare } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:haste } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:intrepid } } + 25 = { + trigger = { + NOT = { government_has_flag = government_is_tribal } + } + set_variable = { name = contest_horse_race_name value = flag:lady } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 25 = { set_variable = { name = contest_horse_race_name value = flag:leader } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:lightning } } + 25 = { + trigger = { + NOT = { government_has_flag = government_is_tribal } + } + set_variable = { name = contest_horse_race_name value = flag:lord } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 25 = { set_variable = { name = contest_horse_race_name value = flag:lucky } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:majesty } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:mule } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:plucky } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:prancer } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:pride } } + 25 = { + trigger = { + NOT = { government_has_flag = government_is_tribal } + } + set_variable = { name = contest_horse_race_name value = flag:prince } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 25 = { + trigger = { + NOT = { government_has_flag = government_is_tribal } + } + set_variable = { name = contest_horse_race_name value = flag:princess } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 25 = { set_variable = { name = contest_horse_race_name value = flag:rapid } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:resolute } } + 25 = { + trigger = { + NOT = { government_has_flag = government_is_tribal } + } + set_variable = { name = contest_horse_race_name value = flag:seneschal } + } + 25 = { set_variable = { name = contest_horse_race_name value = flag:snowflake } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:spirit } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:steadfast } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:sunlight } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:tenacity } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:tempest } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:thunderclap } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:unwavering } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:whirlwind } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:winner } } + # GENDER + 25 = { + trigger = { + NOT = { government_has_flag = government_is_tribal } + } + random_list = { + 5 = { + trigger = { + OR = { + religion = religion:germanic_religion + culture = { has_cultural_pillar = heritage_north_germanic } + } + faith = { has_doctrine = tenet_warmonger } + } + set_variable = { name = contest_horse_race_name value = flag:berserker } + } + 5 = { + trigger = { + faith = { has_doctrine_parameter = great_holy_wars_active } + } + set_variable = { name = contest_horse_race_name value = flag:crusader } + } + 5 = { + set_variable = { name = contest_horse_race_name value = flag:commander } + } + 5 = { + set_variable = { name = contest_horse_race_name value = flag:marshal } + } + 5 = { + set_variable = { name = contest_horse_race_name value = flag:varangian } + } + } + random_list = { + 5 = { + trigger = { + culture = { + OR = { + has_cultural_pillar = martial_custom_female_only + has_cultural_pillar = martial_custom_equal + } + } + } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 5 = { + trigger = { + culture = { + OR = { + has_cultural_pillar = martial_custom_male_only + has_cultural_pillar = martial_custom_equal + } + } + } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + } + } + } + } + ## FETCH + 300 = { + random_list = { + 100 = { + trigger = { is_playable_character = yes } + random_list = { + 25 = { set_variable = { name = contest_horse_race_name value = flag:capital_name } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:capital_empire } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:capital_pride } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:capital_county } } + } + } + 25 = { set_variable = { name = contest_horse_race_name value = flag:culture_knight } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:culture_lightning } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:culture_thunder } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:faith_adherent } } + 25 = { set_variable = { name = contest_horse_race_name value = flag:faith_afterlife } } + 25 = { + trigger = { + faith = { + OR = { + has_doctrine = doctrine_clerical_gender_female_only + has_doctrine = doctrine_clerical_gender_either + } + } + } + set_variable = { name = contest_horse_race_name value = flag:faith_bishop_female } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 25 = { + trigger = { + faith = { + OR = { + has_doctrine = doctrine_clerical_gender_male_only + has_doctrine = doctrine_clerical_gender_either + } + } + } + set_variable = { name = contest_horse_race_name value = flag:faith_bishop_male } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 25 = { + trigger = { + faith = { has_doctrine_parameter = great_holy_wars_active } + } + set_variable = { name = contest_horse_race_name value = flag:faith_crusade } + } + 25 = { + set_variable = { name = contest_horse_race_name value = flag:faith_devotee_female } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 25 = { + set_variable = { name = contest_horse_race_name value = flag:faith_devotee_male } + + } + 25 = { set_variable = { name = contest_horse_race_name value = flag:faith_divine_realm } } + 10 = { + trigger = { + faith = { + NOT = { has_doctrine = doctrine_no_head } + } + } + set_variable = { name = contest_horse_race_name value = flag:faith_pope } + if = { + limit = { + faith = { has_doctrine = doctrine_clerical_gender_male_only } + } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + else_if = { + limit = { + faith = { has_doctrine = doctrine_clerical_gender_female_only } + } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + } + 25 = { + set_variable = { name = contest_horse_race_name value = flag:faith_priest_female } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 25 = { + set_variable = { name = contest_horse_race_name value = flag:faith_priest_male } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 25 = { set_variable = { name = contest_horse_race_name value = flag:faith_symbol } } + 25 = { + trigger = { + this != root.top_liege + } + set_variable = { name = contest_horse_race_name value = flag:liege_title } + } + 25 = { + trigger = { + this != root.top_liege + } + set_variable = { name = contest_horse_race_name value = flag:liege_title_name } + } + 25 = { + trigger = { is_playable_character = yes } + set_variable = { name = contest_horse_race_name value = flag:owner_title } + } + 25 = { + trigger = { is_playable_character = yes } + set_variable = { name = contest_horse_race_name value = flag:title_name } + } + ## TRAITS + 25 = { + trigger = { + NOT = { + faith = { has_doctrine_parameter = forbidden_from_pilgrimage } + } + } + set_variable = { name = contest_horse_race_name value = flag:pilgrim } + } + } + } + ## EASTER EGGS + 50 = { + random_list = { + 5 = { # Arkle + trigger = { title:c_sutherland.holder.top_liege = root.top_liege } + set_variable = { name = contest_horse_race_name value = flag:arkle } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { + trigger = { + culture = { has_cultural_pillar = language_french } + } + modifier = { + factor = 2 + has_trait = drunkard + } + modifier = { + factor = 2 + has_trait = arrogant + } + modifier = { + factor = 2 + has_trait = depressed + } + set_variable = { name = contest_horse_race_name value = flag:beaujacques } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 1 = { set_variable = { name = contest_horse_race_name value = flag:big_dog } } + 1 = { set_variable = { name = contest_horse_race_name value = flag:big_honse } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:binky } } + 5 = { # Black Beauty + set_variable = { name = contest_horse_race_name value = flag:black_beauty } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { + set_variable = { name = contest_horse_race_name value = flag:boxer } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { + set_variable = { name = contest_horse_race_name value = flag:brego } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Secretariat + set_variable = { name = contest_horse_race_name value = flag:chancery } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { set_variable = { name = contest_horse_race_name value = flag:clip_clop } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:cloppy } } + 5 = { # Wellington's + trigger = { + culture = { has_cultural_pillar = heritage_west_germanic } + } + set_variable = { name = contest_horse_race_name value = flag:copenhagen } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 5 = { + set_variable = { name = contest_horse_race_name value = flag:donkey } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 5 = { # Desert Orchid + set_variable = { name = contest_horse_race_name value = flag:desert_orchid } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { + set_variable = { name = contest_horse_race_name value = flag:dustkicker } + } + 5 = { # Enable + set_variable = { name = contest_horse_race_name value = flag:facilitate } + set_variable = { name = contest_horse_race_gender value = flag:female } + } + 5 = { # Frankel + trigger = { + culture = { has_cultural_pillar = language_high_german } + } + set_variable = { name = contest_horse_race_name value = flag:frenkel } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Man o' War + set_variable = { name = contest_horse_race_name value = flag:galley } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { set_variable = { name = contest_horse_race_name value = flag:glitterhoof } } + 1 = { set_variable = { name = contest_horse_race_name value = flag:gymer } } + 1 = { set_variable = { name = contest_horse_race_name value = flag:hoarse } } + 1 = { set_variable = { name = contest_horse_race_name value = flag:honse } } + 1 = { set_variable = { name = contest_horse_race_name value = flag:horsey } } + 1 = { set_variable = { name = contest_horse_race_name value = flag:jerry } } + 5 = { + trigger = { religion = religion:christianity_religion } + set_variable = { name = contest_horse_race_name value = flag:joseph } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { + trigger = { + culture = { + OR = { + has_cultural_pillar = heritage_chinese + has_cultural_pillar = heritage_mongolic + } + } + } + set_variable = { name = contest_horse_race_name value = flag:khan } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { + trigger = { + culture = { has_cultural_pillar = heritage_north_germanic } + } + set_variable = { name = contest_horse_race_name value = flag:kjekk } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 1 = { set_variable = { name = contest_horse_race_name value = flag:lord_pepper_iii } } + 5 = { # Napoleon's + trigger = { + culture = { + OR = { + has_cultural_pillar = heritage_frankish + has_cultural_pillar = heritage_latin + } + } + } + set_variable = { name = contest_horse_race_name value = flag:marengo } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { + set_variable = { name = contest_horse_race_name value = flag:marshal_neigh } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { + trigger = { + culture = { + OR = { + has_cultural_pillar = heritage_byzantine + has_cultural_pillar = heritage_latin + } + } + } + set_variable = { name = contest_horse_race_name value = flag:maximus } + } + 5 = { # Seabiscuit + set_variable = { name = contest_horse_race_name value = flag:oceancracker } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { set_variable = { name = contest_horse_race_name value = flag:pebbles } } + 5 = { + trigger = { + culture = { + any_parent_culture_or_above = { has_cultural_pillar = language_anglic } + any_parent_culture_or_above = { has_cultural_pillar = language_brythonic } + } + } + set_variable = { name = contest_horse_race_name value = flag:pringle } + } + 5 = { # Galileo + trigger = { + culture = { + OR = { + has_cultural_pillar = heritage_arabic + has_cultural_pillar = heritage_byzantine + has_cultural_pillar = heritage_latin + } + } + } + set_variable = { name = contest_horse_race_name value = flag:ptolemy } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { # Red Rum + trigger = { + NOT = { + faith = { trait_is_sin = drunkard } + } + } + set_variable = { name = contest_horse_race_name value = flag:red_wine } + set_variable = { name = contest_horse_race_gender value = flag:male } + } + 5 = { set_variable = { name = contest_horse_race_name value = flag:roach } } + 1 = { set_variable = { name = contest_horse_race_name value = flag:sir_whinny } } + 1 = { set_variable = { name = contest_horse_race_name value = flag:sir_horsington } } + 5 = { set_variable = { name = contest_horse_race_name value = flag:torrent } } + } + } + } + # GENDER + if = { + limit = { + NOT = { exists = var:contest_horse_race_gender } + } + random_list = { + 5 = { set_variable = { name = contest_horse_race_gender value = flag:female } } + 5 = { set_variable = { name = contest_horse_race_gender value = flag:male } } + } + } + } + } + } +} + +############################ +### RECURRING CHARACTERS ### +############################ + +try_to_create_recurring_character_effect = { + hidden_effect = { + if = { + limit = { + # We want exactly one player. + calc_true_if = { + amount = 1 + is_ai = no + $CHARACTER$ = { is_ai = no } + } + # With only a few recurring characters per tourney. + ## Currently, set this to 1 to try and make them more generally memorable. + ### If we start messing with event weight multipliers based on this, then we might want to increase it, so split things up a bit more. + num_of_relation_activity_recurrer < 1 + NOT = { has_relation_activity_recurrer = $CHARACTER$ } + } + set_relation_activity_recurrer = $CHARACTER$ + # Debug stuff. + ## Disabled; decomment it if you want to see who gets grabbed. + #if = { + #limit = { is_ai = no } + #add_to_variable_list = { + #name = recurring_characters + #target = $CHARACTER$ + #} + #} + #else = { + #save_temporary_scope_as = ai_temp + #$CHARACTER$ = { + #add_to_variable_list = { + #name = recurring_characters + #target = scope:ai_temp + #} + #} + #} + } + } +} + +clean_up_recurring_characters_effect = { + hidden_effect = { + save_temporary_scope_as = player_temp + every_relation = { + type = activity_recurrer + remove_relation_activity_recurrer = scope:player_temp + } + } +} + +# Award XP in relevant tourney trait tracks +disburse_xp_and_liege_prestige_effect = { + # XP + if = { + limit = { has_trait = tourney_participant } + # Bow + if = { + limit = { exists = scope:archery_winner } + add_trait_xp = { + trait = tourney_participant + track = bow + value = { + value = 0 + if = { + limit = { scope:archery_winner ?= this } + add = tournament_hastiludes_xp_gain_massive_value + } + else = { add = tournament_hastiludes_xp_gain_medium_value } + } + } + } + # Horse + if = { + limit = { + OR = { + exists = scope:melee_winner + exists = scope:joust_winner + exists = scope:horse_race_winner + } + } + add_trait_xp = { + trait = tourney_participant + track = horse + value = { + value = 0 + if = { # Melee + limit = { + scope:activity = { + any_guest_subset = { name = qualified phase = tournament_phase_melee this = root } + } + } + if = { + limit = { + scope:activity = { + any_guest_subset = { name = winner phase = tournament_phase_melee this = root } + } + } + add = tournament_hastiludes_xp_gain_medium_value + } + else = { add = tournament_hastiludes_xp_gain_minor_value } + } + if = { # Joust + limit = { + scope:activity = { + any_guest_subset = { name = qualified phase = tournament_phase_joust this = root + } + } + } + if = { + limit = { scope:joust_winner ?= this } + add = tournament_hastiludes_xp_gain_massive_value + } + else = { add = tournament_hastiludes_xp_gain_medium_value } + } + if = { # Horse Race + limit = { + scope:activity = { + any_guest_subset = { name = qualified phase = tournament_phase_horse_race this = root } + } + } + if = { + limit = { scope:horse_race_winner ?= this } + add = tournament_hastiludes_xp_gain_massive_value + } + else = { add = tournament_hastiludes_xp_gain_medium_value } + } + } + } + } + # Foot + if = { + limit = { + OR = { + exists = scope:melee_winner + exists = scope:duel_winner + exists = scope:wrestling_winner + } + } + add_trait_xp = { + trait = tourney_participant + track = foot + value = { + value = 0 + if = { # Melee + limit = { + scope:activity = { + any_guest_subset = { name = qualified phase = tournament_phase_melee this = root } + } + } + if = { + limit = { + scope:activity = { + any_guest_subset = { name = winner phase = tournament_phase_melee this = root } + } + } + add = tournament_hastiludes_xp_gain_medium_value + } + else = { add = tournament_hastiludes_xp_gain_minor_value } + } + if = { # Duel + limit = { + scope:activity = { + any_guest_subset = { name = qualified phase = tournament_phase_duel this = root } + } + } + if = { + limit = { scope:duel_winner ?= this } + add = tournament_hastiludes_xp_gain_massive_value + } + else = { add = tournament_hastiludes_xp_gain_medium_value } + } + if = { # Wrestling + limit = { + scope:activity = { + any_guest_subset = { name = qualified phase = tournament_phase_wrestling this = root } + } + } + if = { + limit = { scope:wrestling_winner ?= this } + add = tournament_hastiludes_xp_gain_massive_value + } + else = { add = tournament_hastiludes_xp_gain_medium_value } + } + } + } + } + # Wit + if = { + limit = { + OR = { + exists = scope:board_game_winner + exists = scope:recital_winner + } + } + add_trait_xp = { + trait = tourney_participant + track = wit + value = { + value = 0 + if = { # Board Game + limit = { + scope:activity = { + any_guest_subset = { name = qualified phase = tournament_phase_board_game this = root } + } + } + if = { + limit = { scope:board_game_winner ?= this } + add = tournament_hastiludes_xp_gain_massive_value + } + else = { add = tournament_hastiludes_xp_gain_medium_value } + } + if = { # Recital + limit = { + scope:activity = { + any_guest_subset = { name = qualified phase = tournament_phase_recital this = root } + } + } + if = { + limit = { scope:recital_winner ?= this } + add = tournament_hastiludes_xp_gain_massive_value + } + else = { add = tournament_hastiludes_xp_gain_medium_value } + } + } + } + } + # Poets + if = { + limit = { + exists = scope:recital_winner + } + if = { + limit = { + has_trait = lifestyle_poet + } + add_trait_xp = { + trait = lifestyle_poet + value = { + value = 0 + if = { + limit = { + scope:activity = { + any_guest_subset = { name = qualified phase = tournament_phase_recital this = root } + } + } + if = { + limit = { scope:recital_winner ?= this } + add = tournament_hastiludes_xp_gain_massive_value + } + else = { add = tournament_hastiludes_xp_gain_medium_value } + } + } + } + } + } + } + # Liege Prestige + if = { + limit = { + OR = { + AND = { + exists = scope:archery_winner + OR = { + root.court_position:champion_court_position ?= scope:archery_winner + scope:archery_winner = { is_knight_of = root } + } + } + AND = { + exists = scope:recital_winner + OR = { + root.court_position:champion_court_position ?= scope:recital_winner + scope:recital_winner = { is_knight_of = root } + } + } + AND = { + exists = scope:joust_winner + OR = { + root.court_position:champion_court_position ?= scope:joust_winner + scope:joust_winner = { is_knight_of = root } + } + } + AND = { + exists = scope:wrestling_winner + OR = { + root.court_position:champion_court_position ?= scope:wrestling_winner + scope:wrestling_winner = { is_knight_of = root } + } + } + AND = { + exists = scope:duel_winner + OR = { + root.court_position:champion_court_position ?= scope:duel_winner + scope:duel_winner = { is_knight_of = root } + } + } + AND = { + exists = scope:board_game_winner + OR = { + root.court_position:champion_court_position ?= scope:board_game_winner + scope:board_game_winner = { is_knight_of = root } + } + } + AND = { + exists = scope:horse_race_winner + OR = { + root.court_position:champion_court_position ?= scope:horse_race_winner + scope:horse_race_winner = { is_knight_of = root } + } + } + AND = { + exists = scope:melee_winner + OR = { + root.court_position:champion_court_position ?= scope:melee_winner + scope:melee_winner = { is_knight_of = root } + } + } + } + } + add_prestige = { + value = 0 + if = { + limit = { exists = scope:archery_winner } + if = { + limit = { root.court_position:champion_court_position ?= scope:archery_winner } + add = medium_prestige_value + } + else_if = { + limit = { scope:archery_winner = { is_knight_of = root } } + add = minor_prestige_value + } + } + else_if = { + limit = { exists = scope:recital_winner } + if = { + limit = { root.court_position:champion_court_position ?= scope:recital_winner } + add = medium_prestige_value + } + else_if = { + limit = { scope:recital_winner = { is_knight_of = root } } + add = minor_prestige_value + } + } + else_if = { + limit = { exists = scope:joust_winner } + if = { + limit = { root.court_position:champion_court_position ?= scope:joust_winner } + add = medium_prestige_value + } + else_if = { + limit = { scope:joust_winner = { is_knight_of = root } } + add = minor_prestige_value + } + } + else_if = { + limit = { exists = scope:wrestling_winner } + if = { + limit = { root.court_position:champion_court_position ?= scope:wrestling_winner } + add = medium_prestige_value + } + else_if = { + limit = { scope:wrestling_winner = { is_knight_of = root } } + add = minor_prestige_value + } + } + else_if = { + limit = { exists = scope:duel_winner } + if = { + limit = { root.court_position:champion_court_position ?= scope:duel_winner } + add = medium_prestige_value + } + else_if = { + limit = { scope:duel_winner = { is_knight_of = root } } + add = minor_prestige_value + } + } + else_if = { + limit = { exists = scope:board_game_winner } + if = { + limit = { root.court_position:champion_court_position ?= scope:board_game_winner } + add = medium_prestige_value + } + else_if = { + limit = { scope:board_game_winner = { is_knight_of = root } } + add = minor_prestige_value + } + } + else_if = { + limit = { exists = scope:horse_race_winner } + if = { + limit = { root.court_position:champion_court_position ?= scope:horse_race_winner } + add = medium_prestige_value + } + else_if = { + limit = { scope:horse_race_winner = { is_knight_of = root } } + add = minor_prestige_value + } + } + else_if = { + limit = { exists = scope:melee_winner } + if = { + limit = { root.court_position:champion_court_position ?= scope:melee_winner } + add = minor_prestige_value + } + else_if = { + limit = { scope:melee_winner = { is_knight_of = root } } + add = miniscule_prestige_value + } + } + } + } +} + +########################### +### PROGRESS TO VICTORY ### +########################### + +# Update PtV and aptitude, used on passive pulse to keep values up to date before contest begins +set_passive_contest_aptitude_and_progress_effect = { + if = { + limit = { + OR = { + AND = { + activity_is_valid_tournament_contestant = yes + activity_tournament_race_contest_trigger = no + } + AND = { + is_playable_character = yes + activity_tournament_race_contest_trigger = yes + } + } + } + if = { # Foot + limit = { + scope:activity = { + OR = { + has_current_phase = tournament_phase_melee + has_current_phase = tournament_phase_duel + } + } + } + set_variable = { name = contest_aptitude value = contest_foot_aptitude_value } + } + else_if = { # Horse + limit = { + scope:activity = { has_current_phase = tournament_phase_joust } + } + set_variable = { name = contest_aptitude value = contest_horse_aptitude_value } + } + else_if = { # Pugilism + limit = { + scope:activity = { has_current_phase = tournament_phase_wrestling } + } + set_variable = { name = contest_aptitude value = contest_pugilism_aptitude_value } + } + else_if = { # Archery + limit = { + scope:activity = { has_current_phase = tournament_phase_archery } + } + set_variable = { name = contest_aptitude value = contest_archery_aptitude_value } + } + else_if = { # Recital + limit = { + scope:activity = { has_current_phase = tournament_phase_recital } + } + set_variable = { name = contest_aptitude value = contest_recital_aptitude_value } + } + else_if = { # Board Game + limit = { + scope:activity = { has_current_phase = tournament_phase_board_game } + } + set_variable = { name = contest_aptitude value = contest_board_game_aptitude_value } + } + else_if = { # Horse Race + limit = { + scope:activity = { has_current_phase = tournament_phase_horse_race } + } + set_variable = { name = contest_aptitude value = contest_horse_race_aptitude_value } + } + + #Have you taken the Prowess Training decision? + if = { + limit = { + has_character_modifier = tournament_training_decision_modifier + activity_tournament_prowess_contest_trigger = yes + } + set_variable = { + name = progress_to_victory + value = { + value = progress_to_victory_passive_contestant_value + add = 20 + } + } + } + set_variable = { + name = progress_to_victory + value = progress_to_victory_passive_contestant_value + } + } + else = { remove_variable = progress_to_victory } +} + +############## +### SHARED ### +############## + +# Save champion, if they exist +tournament_contest_champion_scope_effect = { + if = { + limit = { employs_court_position = champion_court_position } + random_court_position_holder = { + limit = { has_court_position = champion_court_position } + save_scope_as = contest_champion + } + } +} + +# Randomly wound attendees effect +contest_wound_attendees_effect = { + custom_tooltip = { + text = contest_wound_attendees_effect + while = { + count = 12 + random_guest_subset = { + name = contestant + limit = { + NOT = { is_in_list = wounded_attendees } + OR = { + this = root + is_ai = yes + } + } + add_to_list = wounded_attendees + increase_wounds_no_death_effect = { REASON = fight } + } + } + } +} + +# Randomly wound attendees unrelated to root effect +contest_wound_non_root_attendees_effect = { + custom_tooltip = { + text = contest_wound_non_root_attendees_effect + while = { + count = 9 + random_guest_subset = { + name = contestant + limit = { + NOR = { + is_in_list = wounded_attendees + is_ai = no + this = root + is_courtier_of = root + is_knight_of = root + } + } + add_to_list = wounded_attendees + increase_wounds_no_death_effect = { REASON = fight } + } + } + } +} + +# Randomly wound combatants unrelated to root effect +tournament_wound_non_root_combatants_effect = { + custom_tooltip = { + text = tournament_wound_non_root_combatants_effect + while = { + count = 4 + random_guest_subset = { + name = contestant + limit = { + is_healthy = yes + highest_held_title_tier < tier_county + NOR = { + is_in_list = wounded_attendees + is_ai = no + this = root + is_courtier_of = root + is_knight_of = root + is_close_or_extended_family_of = root + reverse_opinion = { + target = root + value >= 25 + } + } + } + add_to_list = wounded_combatants + increase_wounds_no_death_effect = { REASON = fight } + } + } + } +} + +# Tournament reward tooltips +tournament_display_rewards_effect = { + show_as_tooltip = { + switch = { + trigger = scope:contest_complete + flag:joust = { + tournament_contest_rewards_effect = { CONTEST = joust } + } + flag:wrestling = { + tournament_contest_rewards_effect = { CONTEST = wrestling } + } + flag:duel = { + tournament_contest_rewards_effect = { CONTEST = duel } + } + flag:board_game = { + tournament_contest_rewards_effect = { CONTEST = board_game } + } + flag:melee = { + tournament_contest_team_rewards_effect = { CONTEST = melee } + } + flag:horse_race = { + tournament_contest_rewards_effect = { CONTEST = horse_race } + } + flag:archery = { + tournament_contest_rewards_effect = { CONTEST = archery } + } + flag:recital = { + tournament_contest_rewards_effect = { CONTEST = recital } + } + } + } +} + +# Notify of arrival of intent target at tournament +activity_intent_target_arrival_notification_effect = { + if = { + limit = { + NOT = { + capital_province ?= scope:activity.activity_location + } + NAND = { + is_playable_character = no + exists = liege.capital_province + liege.capital_province = scope:activity.activity_location + } + save_temporary_scope_as = intent_target_temp + scope:activity = { + any_attending_character = { + intent_target ?= scope:intent_target_temp + } + } + } + save_scope_as = intent_targetee + scope:activity = { + every_attending_character = { + limit = { + intent_target ?= scope:intent_targetee + } + save_scope_as = intent_targeter + send_interface_message = { + title = activity_intent_target_arrival_title + left_icon = scope:intent_targetee + custom_tooltip = activity_intent_target_arrival_desc + } + } + } + } +} + +# Add contestant as qualified and notify +add_tournament_contest_contestant_effect = { + save_scope_as = new_list_member + # Add to subset + scope:activity = { + add_to_guest_subset = { + name = qualified + target = scope:new_list_member + phase = tournament_phase_$CONTEST$ + } + } + # Update stats + set_variable = { + name = contest_aptitude + value = contest_$SKILL$_aptitude_value + } + set_variable = { + name = progress_to_victory + value = $PTV$ + } + # Toast + if = { + limit = { + scope:activity = { has_current_phase = tournament_phase_horse_race } + } + send_interface_toast = { + title = tournament_qualify_title + left_icon = scope:new_list_member + custom_tooltip = tournament_qualify_race_desc + play_sound_effect = "event:/SFX/Events/Themes/sfx_event_theme_type_martial" + } + } + else = { + send_interface_toast = { + title = tournament_qualify_title + left_icon = scope:new_list_member + custom_tooltip = tournament_qualify_desc + add_prestige = minor_prestige_gain + play_sound_effect = "event:/SFX/Events/Themes/sfx_event_theme_type_martial" + } + if = { + limit = { + OR = { + this = scope:activity.special_guest:special_guest_champion + has_court_position = champion_court_position + is_knight = yes + } + } + liege = { + add_to_list = qualification_liege_list + add_to_variable_list = { + name = qualified_knights + target = scope:new_list_member + } + } + } + } +} + +# Notify of failure to qualify for a contest +tournament_contest_qualification_failure_effect = { + if = { + limit = { exists = var:contest_aptitude } + remove_variable = contest_aptitude + } + if = { + limit = { exists = var:progress_to_victory } + remove_variable = progress_to_victory + } + # RACE + if = { + limit = { + scope:activity = { has_current_phase = tournament_phase_horse_race } + } + send_interface_toast = { + title = tournament_qualify_fail_title + custom_tooltip = tournament_qualify_fail_race_desc + } + } + # VERSUS/TURN + else = { + send_interface_toast = { + title = tournament_qualify_fail_title + left_icon = root + custom_tooltip = tournament_qualify_fail_desc + } + if = { + limit = { + OR = { + this = scope:activity.special_guest:special_guest_champion + has_court_position = champion_court_position + } + liege = { + is_ai = no + is_participant_in_activity = scope:activity + } + } + save_scope_as = contest_champion + liege = { + send_interface_toast = { + title = tournament_champion_qualify_fail_title + left_icon = scope:contest_champion + custom_tooltip = tournament_champion_qualify_fail_desc + } + } + } + } +} + +# Save a random contestant on the opposite team +contest_team_save_enemy_member_effect = { + scope:activity = { + if = { + limit = { + any_guest_subset_current_phase = { + name = team_alpha + this = root + } + } + random_guest_subset_current_phase = { + name = team_beta + limit = { + is_alive = yes + is_ai = yes + } + save_scope_as = $SCOPE$ + } + } + else = { + random_guest_subset_current_phase = { + name = team_beta + limit = { + is_alive = yes + is_ai = yes + } + save_scope_as = $SCOPE$ + } + } + } +} + +# Hand out Tourney Participant trait +tournament_give_trait_effect = { + if = { + limit = { + save_temporary_scope_as = new_list_member + scope:activity ?= { + any_guest_subset = { + name = qualified + phase = tournament_phase_$CONTEST$ + this = scope:new_list_member + } + } + NOT = { has_trait = tourney_participant } + } + hidden_effect = { + random = { + chance = 50 + modifier = { + is_ai = no + add = 50 + } + modifier = { + scope:contest_winner ?= this + add = 100 + } + modifier = { + scope:activity ?= { + any_guest_subset = { + name = winner + phase = tournament_phase_$CONTEST$ + this = root + } + } + add = 50 + } + modifier = { + scope:activity ?= { + any_guest_subset = { + name = second_place + phase = tournament_phase_$CONTEST$ + this = root + } + } + add = 30 + } + modifier = { + scope:activity ?= { + any_guest_subset = { + name = third_place + phase = tournament_phase_$CONTEST$ + this = root + } + } + add = 15 + } + add_trait = tourney_participant + } + } + if = { + limit = { has_trait = tourney_participant } + show_as_tooltip = { add_trait = tourney_participant } + } + } +} + +# Replace qualified contestant for another +tournament_contest_replace_qualifier_effect = { + $NEW_CONTESTANT$ = { save_scope_as = new_contestant } + $OLD_CONTESTANT$ = { save_scope_as = old_contestant } + remove_from_guest_subset = { + name = qualified + target = scope:old_contestant + phase = tournament_phase_$CONTEST$ + } + add_to_guest_subset = { + name = spectator + target = scope:old_contestant + phase = tournament_phase_$CONTEST$ + } + add_to_guest_subset = { + name = qualified + target = scope:new_contestant + phase = tournament_phase_$CONTEST$ + } + scope:old_contestant = { + remove_variable = contest_aptitude + remove_variable = progress_to_victory + save_scope_as = disqualify_target + } + scope:new_contestant = { + tournament_set_current_aptitude_variable_effect = yes + set_variable = { + name = progress_to_victory + value = progress_to_victory_active_contestant_value + } + } + scope:activity = { + every_attending_character = { + limit = { is_ai = no } + send_interface_toast = { + title = tournament_qualifier_replaced_toast + left_icon = scope:old_contestant + right_icon = scope:new_contestant + custom_description = { + text = tournament_contest_replaced_tt + subject = scope:new_contestant # REPLACER + object = scope:old_contestant # REPLACED + } + } + } + } +} + +# Withdraw character from a contest they have qualified from +tournament_contest_withdraw_effect = { + $CHARACTER$ = { save_scope_as = withdrawer } + scope:withdrawer = { remove_variable = contest_aptitude } + custom_description = { + text = tournament_contest_withdraw_tt + subject = scope:withdrawer + } +} + +# Knock qualified contestant out of a contest +tournament_contest_knocked_out_effect = { + $CHARACTER$ = { save_scope_as = withdrawer } + scope:withdrawer = { + remove_variable = contest_aptitude + involved_activity = { + remove_from_guest_subset = { + name = qualified + target = scope:withdrawer + } + } + } + custom_description = { + text = tournament_contest_knocked_tt + subject = scope:withdrawer + } +} + +# List correct wound status tooltip +tournament_wounded_or_dead_tooltip_effect = { + show_as_tooltip = { + if = { + limit = { is_alive = no } + death = { + death_reason = death_contest_$CONTEST$_accident + killer = scope:contest_winner + } + } + else_if = { + limit = { has_character_flag = agency_wound } + switch = { + trigger = has_trait + wounded_1 = { add_trait_force_tooltip = wounded_1 } + wounded_2 = { add_trait_force_tooltip = wounded_2 } + wounded_3 = { add_trait_force_tooltip = wounded_3 } + } + } + } +} + +# Potentially make wandering knight appear in tournament +chance_for_knight_appearance_effect = { + if = { + limit = { + NOT = { exists = scope:activity.var:tournament_commenced } + scope:activity = { + any_attending_character = { + count < 240 #Max is 250, we are leaving some open space. + } + } + } + random = { + chance = 50 + every_realm_county = { + if = { + limit = { + save_temporary_scope_as = potential_county + NOT = { + any_in_list = { + list = pool_counties + duchy = scope:potential_county.duchy + } + } + } + add_to_temporary_list = pool_counties + } + } + every_in_list = { + list = pool_counties + save_temporary_scope_as = pool_county + every_pool_character = { + province = scope:pool_county.title_province + limit = { + prowess >= 12 #make sure this matches the tooltip of the decision and all the 12s below + guest_knight_candidate_trigger = { HOST = scope:host } + is_available = yes + NOT = { exists = involved_activity } + } + add_to_temporary_list = potential_knights + } + } + #Randomize a good knight from the realm pool characters + random_in_list = { + list = potential_knights + limit = { is_alive = yes } + weight = { + base = 1 + modifier = { + add = { + value = prowess + subtract = 12 + multiply = 5 + } + } + } + save_scope_as = knight + } + #If no one was found, make one + if = { + limit = { + NOT = { exists = scope:knight } + } + create_character = { + location = root.capital_province + template = pool_repopulate_prowess + prowess = { 12 15 } + save_scope_as = knight + } + } + #Cultural Traditions + if = { + limit = { + scope:host.culture = { has_cultural_parameter = better_knights_from_decision } + } + hidden_effect = { + scope:knight = { + blademaster_lifestyle_rank_up_effect = yes + knight_increase_prowess_chance_effect = yes + knight_increase_prowess_chance_effect = yes + } + } + } + #Add knight to court + scope:host = { + send_interface_message = { + type = msg_tournament_knight_arrives + title = tournament_knight_appeared_title + left_icon = scope:knight + scope:knight = { + hidden_effect = { + add_to_activity = scope:activity + set_location = scope:activity.activity_location + set_passive_contest_aptitude_and_progress_effect = yes + } + } + custom_tooltip = tournament_knight_appeared_tt + } + } + } + } +} + +# Set aptitude variable based on the current contest type +tournament_set_current_aptitude_variable_effect = { + set_variable = { + name = contest_aptitude + value = { + value = 0 + if = { + limit = { scope:activity = { has_current_phase = tournament_phase_joust } } + add = contest_horse_aptitude_value + } + else_if = { + limit = { + scope:activity = { + OR = { + has_current_phase = tournament_phase_duel + has_current_phase = tournament_phase_melee + } + } + } + add = contest_foot_aptitude_value + } + else_if = { + limit = { scope:activity = { has_current_phase = tournament_phase_board_game } } + add = contest_board_game_aptitude_value + } + else_if = { + limit = { scope:activity = { has_current_phase = tournament_phase_recital } } + add = contest_recital_aptitude_value + } + else_if = { + limit = { scope:activity = { has_current_phase = tournament_phase_horse_race } } + add = contest_horse_race_aptitude_value + } + else_if = { + limit = { scope:activity = { has_current_phase = tournament_phase_archery } } + add = contest_archery_aptitude_value + } + else = { add = contest_pugilism_aptitude_value } + } + } +} + +# Replace qualified contestant with another +tournament_replace_qualifier_scope_effect = { + # For events replacing a contestant + scope:activity = { + if = { + limit = { + NOT = { exists = var:contest_aptitude } + } + random_guest_subset_current_phase = { + name = qualified + limit = { + is_ai = yes + NOT = { + liege ?= { is_ai = no } + liege.court_position:champion_court_position ?= this + } + NOT = { root.court_position:champion_court_position ?= this } + NOT = { + any_relation = { + type = lover + type = friend + type = rival + is_participant_in_activity = scope:activity + is_ai = no + } + } + } + weight = { + base = 1 + modifier = { + add = 50 + var:contest_aptitude < root.contest_current_contest_aptitude_value + } + modifier = { # Try to exclude mysterious strangers + add = -100 + exists = var:mysterious_stranger_origin + } + modifier = { # Try to exclude own knights + add = -25 + OR = { + is_knight_of = root + liege ?= { is_ai = no } + } + } + } + save_scope_as = replaced_contestant + } + if = { + limit = { + any_guest_subset_current_phase = { + name = qualified + has_relation_rival = root + } + } + random_guest_subset_current_phase = { + name = qualified + limit = { has_relation_rival = root } + save_scope_as = rival_contestant + } + } + } + } + if = { + limit = { exists = var:contest_aptitude } + scope:activity = { + ordered_guest_subset_current_phase = { + name = contestant + limit = { + save_temporary_scope_as = new_list_member + NOR = { + scope:activity = { + any_guest_subset_current_phase = { + name = qualified + this = scope:new_list_member + } + } + } + activity_is_valid_tournament_contestant = yes + } + order_by = contest_current_contest_aptitude_value + save_scope_as = new_contestant + } + } + } + else = { save_scope_as = new_contestant } +} + +# Save relevant scopes for start of contest events +tournament_contest_start_portrait_effect = { + if = { + limit = { + intent_target ?= { is_alive = yes } + } + intent_target = { save_scope_as = intent_scope } + } + tournament_contest_champion_scope_effect = yes + if = { + limit = { exists = scope:marriage_prize } + scope:marriage_prize = { save_scope_as = portrait_scope } + } + else_if = { + limit = { + exists = scope:mysterious_stranger + NAND = { + exists = scope:versus_contestant + scope:versus_contestant = scope:mysterious_stranger + } + } + scope:mysterious_stranger = { save_scope_as = portrait_scope } + } + else_if = { + limit = { exists = scope:contest_champion } + scope:contest_champion = { save_scope_as = portrait_scope } + } + scope:activity = { + ordered_guest_subset_current_phase = { + name = qualified + limit = { + NAND = { exists = scope:contest_summary_1 this = scope:contest_summary_1 } + NAND = { exists = scope:contest_summary_2 this = scope:contest_summary_2 } + NAND = { exists = scope:contest_summary_3 this = scope:contest_summary_3 } + NAND = { exists = scope:contest_summary_4 this = scope:contest_summary_4 } + NAND = { exists = scope:contest_summary_5 this = scope:contest_summary_5 } + NAND = { exists = scope:contest_summary_6 this = scope:contest_summary_6 } + NAND = { exists = scope:contest_summary_7 this = scope:contest_summary_7 } + } + max = 8 + check_range_bounds = no + order_by = primary_title.tier + if = { + limit = { NOT = { exists = scope:contest_summary_1 } } + save_scope_as = contest_summary_1 + } + else_if = { + limit = { NOT = { exists = scope:contest_summary_2 } } + save_scope_as = contest_summary_2 + } + else_if = { + limit = { NOT = { exists = scope:contest_summary_3 } } + save_scope_as = contest_summary_3 + } + else_if = { + limit = { NOT = { exists = scope:contest_summary_4 } } + save_scope_as = contest_summary_4 + } + else_if = { + limit = { NOT = { exists = scope:contest_summary_5 } } + save_scope_as = contest_summary_5 + } + else_if = { + limit = { NOT = { exists = scope:contest_summary_6 } } + save_scope_as = contest_summary_6 + } + else_if = { + limit = { NOT = { exists = scope:contest_summary_7 } } + save_scope_as = contest_summary_7 + } + else = { save_scope_as = contest_summary_8 } + } + } + tournament_contest_versus_match_scope_effect = { CHAR = root } +} + +# Save relevant scopes for end of contest events +tournament_contest_end_portrait_effect = { + tournament_contest_champion_scope_effect = yes + if = { + limit = { + OR = { + scope:contest_winner ?= this + involved_activity = { + any_guest_subset_current_phase = { name = winner this = root } + } + } + exists = scope:contest_loser + } + scope:contest_loser = { save_scope_as = contest_portrait } + } + else_if = { + limit = { + OR = { + scope:contest_winner ?= this + involved_activity = { + any_guest_subset_current_phase = { name = winner this = root } + } + } + exists = scope:second_place + } + scope:second_place = { save_scope_as = contest_portrait } + } + else_if = { + limit = { + OR = { + scope:contest_loser ?= this + NOT = { + involved_activity = { + any_guest_subset_current_phase = { name = winner this = root } + } + } + } + exists = scope:contest_winner + } + scope:contest_winner = { save_scope_as = contest_portrait } + } +} + +# Accidentally kill a character, inform other attendees, and track total number of accidents +tournament_accidental_death_effect = { + scope:activity = { + if = { + limit = { exists = scope:accident_killer } + add_activity_log_entry = { + key = tournament_accident_killer_log + tags = { contestant death bad } + score = 25 + character = scope:accident_victim + target = scope:accident_killer + } + scope:accident_victim = { + death = { + death_reason = death_contest_melee_accident + killer = scope:accident_killer + } + } + } + else = { + add_activity_log_entry = { + key = tournament_accident_log + tags = { contestant death bad } + score = 25 + character = scope:accident_victim + } + scope:accident_victim = { + death = { death_reason = death_contest_melee_accident } + } + } + every_attending_character = { + if = { + limit = { + OR = { + has_any_scripted_relation = scope:accident_victim + is_close_family_of = scope:accident_victim + is_consort_of = scope:accident_victim + AND = { + this = scope:accident_victim.liege + tier_difference = { + target = scope:accident_victim + value <= 1 + } + } + liege = scope:accident_victim + } + } + trigger_event = tournament_events.0701 + } + else = { + send_interface_message = { + type = event_death_bad + title = tournament_accident_death_msg_title + left_icon = scope:accident_victim + show_as_tooltip = { + if = { + limit = { exists = scope:accident_killer } + scope:accident_victim = { + death = { + death_reason = death_contest_melee_accident + killer = scope:accident_killer + } + } + } + else = { + scope:accident_victim = { + death = { death_reason = death_contest_melee_accident } + } + } + } + } + } + } + # For making sure there are not obscene numbers of accidents + if = { + limit = { exists = var:accident_death_count } + change_variable = { + name = accident_death_count + add = 1 + } + } + else = { + set_variable = { + name = accident_death_count + value = 1 + } + } + } +} + +tournament_versus_create_contestant_fallback_effect = { + scope:activity = { + random_attending_character = { + culture = { save_scope_as = attending_culture } + } + scope:attending_culture = { + random_culture_county = { + faith = { save_scope_as = attending_faith } + random_direct_de_jure_vassal_title = { save_scope_as = attending_barony } + } + } + if = { + limit = { has_current_phase = tournament_phase_joust } + create_character = { + template = tournament_horse_character + location = scope:activity.activity_location + faith = scope:attending_faith + culture = scope:attending_culture + dynasty = none + save_scope_as = backup_contestant + } + scope:backup_contestant = { + add_to_activity = scope:activity + } + } + else_if = { + limit = { has_current_phase = tournament_phase_board_game } + create_character = { + template = tournament_board_game_character + location = scope:activity.activity_location + faith = scope:attending_faith + culture = scope:attending_culture + dynasty = none + save_scope_as = backup_contestant + } + scope:backup_contestant = { + add_to_activity = scope:activity + } + } + else_if = { + limit = { has_current_phase = tournament_phase_wrestling } + create_character = { + template = tournament_pugilism_character + location = scope:activity.activity_location + faith = scope:attending_faith + culture = scope:attending_culture + dynasty = none + save_scope_as = backup_contestant + } + scope:backup_contestant = { + add_to_activity = scope:activity + } + } + else = { + create_character = { + template = tournament_foot_character + location = scope:activity.activity_location + faith = scope:attending_faith + culture = scope:attending_culture + dynasty = none + save_scope_as = backup_contestant + } + scope:backup_contestant = { + add_to_activity = scope:activity + } + } + } +} + +tournament_complete_win_contest_intent_effect = { + if = { + limit = { + has_activity_intent = win_contest_intent + NOT = { has_completed_activity_intent = win_contest_intent } + } + send_interface_toast = { + title = activity_intent_complete_toast + left_icon = this + complete_activity_intent = yes + if = { + limit = { + NOT = { + involved_activity = { has_current_phase = tournament_phase_melee } + } + } + stress_impact = { base = medium_stress_impact_loss } + } + else = { + stress_impact = { base = minor_stress_impact_loss } + } + } + } +} + +tournament_add_contestant_or_spectator_effect = { + save_scope_as = new_arrival + if = { + limit = { + NOR = { + is_in_guest_subset = { name = contestant } + is_in_guest_subset = { name = spectator } + } + } + if = { + limit = { activity_is_valid_tournament_contestant = yes } + involved_activity = { + add_to_guest_subset = { name = contestant target = scope:new_arrival } + } + } + else = { + involved_activity = { + add_to_guest_subset = { name = spectator target = scope:new_arrival } + } + } + } +} + +tournament_add_as_spectator_effect = { + save_temporary_scope_as = new_arrival + if = { + limit = { + NOR = { + is_in_guest_subset = { name = qualified } + is_in_guest_subset = { name = spectator } + } + } + involved_activity = { + add_to_guest_subset = { name = spectator target = scope:new_arrival } + } + } +} + +tournament_choose_jockey_effect = { + save_scope_as = chosen_jockey + if = { + limit = { + NOT = { is_participant_in_activity = scope:activity } + } + hidden_effect = { add_to_activity = scope:activity } + scope:activity = { + add_to_guest_subset = { name = spectator target = scope:chosen_jockey } + } + } + every_in_list = { + list = potential_jockeys + limit = { + NOR = { + this = scope:chosen_jockey + this = root + has_character_flag = generated_jockey + } + } + add_opinion = { + target = root + modifier = disappointed_opinion + opinion = -10 + } + } + root = { + set_variable = { + name = horse_race_jockey + value = scope:chosen_jockey + } + } +} + +tournament_liege_qualification_toast_effect = { + every_in_list = { + list = qualification_liege_list + save_scope_as = qualification_liege + # Save number below 2 for toast + set_variable = { + name = qualified_knights_count + value = { + value = 0 + scope:qualification_liege = { + every_in_list = { + variable = qualified_knights + limit = { + NOR = { + has_court_position = champion_court_position + scope:qualification_liege.court_position:champion_court_position ?= this + } + } + add = 1 + } + } + } + days = 1 + } + # If champion qualified + if = { + limit = { + any_in_list = { + variable = qualified_knights + OR = { + has_court_position = champion_court_position + scope:qualification_liege.court_position:champion_court_position ?= this + } + } + } + random_in_list = { + variable = qualified_knights + limit = { + OR = { + has_court_position = champion_court_position + scope:qualification_liege.court_position:champion_court_position ?= this + } + } + save_scope_as = contest_champion + } + } + if = { + limit = { + any_in_list = { + variable = qualified_knights + NOT = { scope:contest_champion ?= this } + } + } + random_in_list = { + variable = qualified_knights + limit = { + NOT = { scope:contest_champion ?= this } + is_of_major_interest_trigger = { CHARACTER = scope:qualification_liege } + } + alternative_limit = { + NOT = { scope:contest_champion ?= this } + is_of_minor_interest_trigger = { CHARACTER = scope:qualification_liege } + } + alternative_limit = { + NOT = { scope:contest_champion ?= this } + } + save_scope_as = knight_1 + } + } + if = { + limit = { + NOT = { exists = scope:contest_champion } + any_in_list = { + variable = qualified_knights + NOT = { scope:knight_1 ?= this } + } + } + random_in_list = { + variable = qualified_knights + limit = { + NOT = { scope:knight_1 ?= this } + is_of_major_interest_trigger = { CHARACTER = scope:qualification_liege } + } + alternative_limit = { + NOT = { scope:knight_1 ?= this } + is_of_minor_interest_trigger = { CHARACTER = scope:qualification_liege } + } + alternative_limit = { + NOT = { scope:knight_1 ?= this } + } + save_scope_as = knight_2 + } + } + if = { # Champion + knights + limit = { + exists = scope:contest_champion + exists = scope:knight_1 + } + send_interface_toast = { + type = toast_tournament_qualification_champion + title = tournament_champion_qualify_multi_title + left_icon = scope:contest_champion + right_icon = scope:knight_1 + custom_tooltip = tournament_champion_qualify_multi_desc + add_prestige = { + value = { # Knights + value = miniscule_prestige_gain + multiply = var:qualified_knights_count + } + add = minor_prestige_gain # Champion + } + } + } + else_if = { # Champion + limit = { exists = scope:contest_champion } + send_interface_toast = { + type = toast_tournament_qualification_champion + title = tournament_champion_qualify_title + left_icon = scope:contest_champion + right_icon = scope:knight_1 + custom_tooltip = tournament_champion_qualify_desc + add_prestige = minor_prestige_gain # Champion + } + } + else_if = { # 2 or more knights + limit = { exists = scope:knight_2 } + send_interface_toast = { + type = toast_tournament_qualification_knight + title = tournament_knight_qualify_multi_title + left_icon = scope:knight_1 + right_icon = scope:knight_2 + custom_tooltip = tournament_knight_qualify_multi_desc + add_prestige = { + value = { # Knights + value = miniscule_prestige_gain + multiply = var:qualified_knights_count + } + } + } + } + else_if = { # 1 knight + limit = { exists = scope:knight_1 } + send_interface_toast = { + type = toast_tournament_qualification_knight + title = tournament_knight_qualify_title + left_icon = scope:knight_1 + custom_tooltip = tournament_knight_qualify_desc + add_prestige = { + value = { # Knight + value = miniscule_prestige_gain + multiply = var:qualified_knights_count + } + } + } + } + clear_variable_list = qualified_knights + } +} + +# Save winner scopes for summary event +tournament_save_contest_winner_scopes_effect = { + scope:activity ?= { + if = { + limit = { + any_guest_subset = { + name = winner + phase = tournament_phase_melee + is_alive = yes + } + } + random_guest_subset = { + name = winner + phase = tournament_phase_melee + limit = { + scope:activity.var:melee_winner ?= this + is_alive = yes + } + alternative_limit = { is_alive = yes } + weight = { + base = 1 + tournament_team_captain_modifier = yes + } + save_scope_as = melee_winner + } + set_variable = { + name = melee_winner + value = scope:melee_winner + } + } + if = { + limit = { + any_guest_subset = { name = winner phase = tournament_phase_archery } + } + random_guest_subset = { + name = winner + phase = tournament_phase_archery + save_scope_as = archery_winner + } + set_variable = { + name = archery_winner + value = scope:archery_winner + } + } + if = { + limit = { + any_guest_subset = { name = winner phase = tournament_phase_horse_race } + } + random_guest_subset = { + name = winner + phase = tournament_phase_horse_race + save_scope_as = horse_race_winner + } + set_variable = { + name = horse_race_winner + value = scope:horse_race_winner + } + } + if = { + limit = { + any_guest_subset = { name = winner phase = tournament_phase_recital } + } + random_guest_subset = { + name = winner phase = tournament_phase_recital + save_scope_as = recital_winner + } + set_variable = { + name = recital_winner + value = scope:recital_winner + } + } + if = { + limit = { + any_guest_subset = { name = winner phase = tournament_phase_joust } + } + random_guest_subset = { + name = winner + phase = tournament_phase_joust + save_scope_as = joust_winner + } + set_variable = { + name = joust_winner + value = scope:joust_winner + } + } + if = { + limit = { + any_guest_subset = { name = winner phase = tournament_phase_wrestling } + } + random_guest_subset = { + name = winner + phase = tournament_phase_wrestling + save_scope_as = wrestling_winner + } + set_variable = { + name = wrestling_winner + value = scope:wrestling_winner + } + } + if = { + limit = { + any_guest_subset = { name = winner phase = tournament_phase_duel } + } + random_guest_subset = { + name = winner phase = tournament_phase_duel + save_scope_as = duel_winner + } + set_variable = { + name = duel_winner + value = scope:duel_winner + } + } + if = { + limit = { + any_guest_subset = { name = winner phase = tournament_phase_board_game } + } + random_guest_subset = { + name = winner + phase = tournament_phase_board_game + save_scope_as = board_game_winner + } + set_variable = { + name = board_game_winner + value = scope:board_game_winner + } + } + } +} + +# Award prize artifacts to all contest winners +tournament_disburse_contest_prize_effect = { + if = { + limit = { exists = scope:duel_winner } + tournament_contest_generate_prize_effect = { CONTEST = duel } + } + if = { + limit = { exists = scope:joust_winner } + tournament_contest_generate_prize_effect = { CONTEST = joust } + } + if = { + limit = { exists = scope:wrestling_winner } + tournament_contest_generate_prize_effect = { CONTEST = wrestling } + } + if = { + limit = { exists = scope:board_game_winner } + tournament_contest_generate_prize_effect = { CONTEST = board_game } + } + if = { + limit = { exists = scope:archery_winner } + tournament_contest_generate_prize_effect = { CONTEST = archery } + } + if = { + limit = { exists = scope:recital_winner } + tournament_contest_generate_prize_effect = { CONTEST = recital } + } + if = { + limit = { exists = scope:horse_race_winner } + tournament_contest_generate_prize_effect = { CONTEST = horse_race } + } + if = { + limit = { exists = scope:melee_winner } + tournament_contest_generate_prize_effect = { CONTEST = melee } + } +} + +# Show tooltips for prize awards +tournament_disburse_contest_prize_tooltip_effect = { + if = { + limit = { exists = scope:duel_prize } + show_as_tooltip = { + scope:duel_prize = { + set_owner = { target = scope:duel_winner } + } + } + } + if = { + limit = { exists = scope:joust_prize } + show_as_tooltip = { + scope:joust_prize = { + set_owner = { target = scope:joust_winner } + } + } + } + if = { + limit = { exists = scope:wrestling_prize } + show_as_tooltip = { + scope:wrestling_prize = { + set_owner = { target = scope:wrestling_winner } + } + } + } + if = { + limit = { exists = scope:board_game_prize } + show_as_tooltip = { + scope:board_game_prize = { + set_owner = { target = scope:board_game_winner } + } + } + } + if = { + limit = { exists = scope:archery_prize } + show_as_tooltip = { + scope:archery_prize = { + set_owner = { target = scope:archery_winner } + } + } + } + if = { + limit = { exists = scope:recital_prize } + show_as_tooltip = { + scope:recital_prize = { + set_owner = { target = scope:recital_winner } + } + } + } + if = { + limit = { exists = scope:horse_race_prize } + show_as_tooltip = { + scope:horse_race_prize = { + set_owner = { target = scope:horse_race_winner } + } + } + } + if = { + limit = { exists = scope:melee_prize } + show_as_tooltip = { + scope:melee_prize = { + set_owner = { target = scope:melee_winner } + } + } + } +} + +# Save pivotal contestant perspective scope, root or someone important to you +tournament_pivotal_contestant_scope_effect = { + if = { + limit = { + trigger_if = { + limit = { + scope:activity = { + activity_tournament_versus_contest_trigger = yes + var:contest_versus_progress ?= 2 + } + } + is_in_guest_subset = { name = finalist } + } + trigger_else_if = { + limit = { + scope:activity = { + activity_tournament_versus_contest_trigger = yes + var:contest_versus_progress ?= 1 + } + } + is_in_guest_subset = { name = semi_finalist } + } + trigger_else = { + is_in_guest_subset = { name = qualified } + } + } + save_scope_as = pivotal_contestant + } + # Otherwise, find someone you care about to frame the event + else = { + # Filter out anyone who is no longer a valid contestant + scope:activity = { + every_guest_subset_current_phase = { + name = qualified + limit = { + trigger_if = { + limit = { scope:activity.var:contest_versus_progress ?= 2 } + is_in_guest_subset = { name = finalist } + } + trigger_else_if = { + limit = { scope:activity.var:contest_versus_progress ?= 1 } + is_in_guest_subset = { name = semi_finalist } + } + trigger_else = { always = yes } + this != root + } + add_to_list = potential_pivotal_contestants + } + } + # Randomly select the most relevant character possible + random_in_list = { + list = potential_pivotal_contestants + # Intent Targets + limit = { root.intent_target ?= this } + # Wager Targets + alternative_limit = { root.var:tournament_wager_target ?= this } + # Relations + alternative_limit = { has_relation_to = root } + # Champions + alternative_limit = { root.court_position:champion_court_position ?= this } + # Children + alternative_limit = { is_child_of = root } + # Spouses + alternative_limit = { is_consort_of = root } + # Close Family + alternative_limit = { is_close_family_of = root } + # Liege + alternative_limit = { root.liege ?= this } + # Powerful Vassals + alternative_limit = { is_powerful_vassal_of = root } + # Vassals + alternative_limit = { is_vassal_of = root } + # Knights + alternative_limit = { is_knight_of = root } + # Extended Family + alternative_limit = { is_extended_family_of = root } + # Courtiers + alternative_limit = { is_courtier_of = root } + # Other + alternative_limit = { always = yes } + weight = { + base = 1 + opinion_modifier = { + who = root + opinion_target = this + } + modifier = { add = var:progress_to_victory } + } + save_scope_as = pivotal_contestant + } + } + if = { + limit = { + exists = scope:contest_winner + exists = scope:contest_loser + } + if = { + limit = { scope:pivotal_contestant = scope:contest_winner } + scope:contest_loser = { save_scope_as = other_contestant } + } + else = { + scope:contest_winner = { save_scope_as = other_contestant } + } + } +} + +# Save values for determining overall progress in a contest +tournament_pivotal_ptv_value_effect = { + if = { + limit = { exists = scope:pivotal_contestant.var:progress_to_victory } + scope:activity = { + ordered_guest_subset_current_phase = { + name = qualified + limit = { exists = var:progress_to_victory } + order_by = var:progress_to_victory + save_scope_as = best_contestant + } + ordered_guest_subset_current_phase = { + name = qualified + limit = { exists = var:progress_to_victory } + order_by = { + value = 0 + subtract = var:progress_to_victory + } + save_scope_as = worst_contestant + } + } + save_scope_value_as = { + name = best_worst_diff + value = { + value = scope:best_contestant.var:progress_to_victory + subtract = scope:worst_contestant.var:progress_to_victory + } + } + save_scope_value_as = { + name = ptv_half_way + value = { + value = scope:worst_contestant.var:progress_to_victory + add = { + value = scope:best_worst_diff + divide = 2 + } + } + } + save_scope_value_as = { + name = pivotal_best_diff + value = { + value = scope:pivotal_contestant.var:progress_to_victory + subtract = scope:best_contestant.var:progress_to_victory + } + } + save_scope_value_as = { + name = pivotal_worst_diff + value = { + value = scope:pivotal_contestant.var:progress_to_victory + subtract = scope:worst_contestant.var:progress_to_victory + } + } + } +} + +# Save values for determining overall progress in a contest +tournament_pivotal_ptv_versus_value_effect = { + save_scope_value_as = { + name = pivotal_diff + value = { + value = scope:pivotal_contestant.character_chance_of_victory + subtract = scope:versus_contestant.character_chance_of_victory + } + } +} + +tournament_pivotal_flavor_variable_effect = { + set_variable = { + name = contest_$CONTEST$_flavor + value = $ID$ + months = 1 + } +} + +tournament_pivotal_duel_effect = { + save_scope_value_as = { + name = no_change_chance + value = $NO_CHANGE_CHANCE$ + } + save_scope_as = contestant + remove_character_flag = success_pivotal_flag + remove_character_flag = neutral_pivotal_flag + remove_character_flag = failure_pivotal_flag + $DUELIST$ = { save_scope_as = duelist } # used if a proxy's skills are tested, e.g. a jockey + scope:duelist = { + duel = { + skills = { $SKILL_1$ $SKILL_2$ } + value = decent_skill_rating + 10 = { + compare_modifier = { + value = scope:duel_value + multiplier = 3.5 + min = 5 + } + tournament_horse_contest_trait_pivotal_modifier = yes + tournament_foot_contest_trait_pivotal_modifier = yes + tournament_wit_contest_trait_pivotal_modifier = yes + tournament_bow_contest_trait_pivotal_modifier = yes + scope:contestant = { + activity_tournament_change_contestant_score_effect = { SCORE = increase_$INCREASE$ } + add_character_flag = success_pivotal_flag + } + } + 10 = { + trigger = { scope:no_change_chance = yes } + scope:contestant = { add_character_flag = neutral_pivotal_flag } + } + 10 = { + compare_modifier = { + value = scope:duel_value + multiplier = -3.5 + min = 5 + } + scope:contestant = { + activity_tournament_change_contestant_score_effect = { SCORE = decrease_$DECREASE$ } + add_character_flag = failure_pivotal_flag + } + } + } + } +} + +tournament_pivotal_duel_single_skill_effect = { + save_scope_value_as = { + name = no_change_chance + value = $NO_CHANGE_CHANCE$ + } + save_scope_as = contestant + $DUELIST$ = { save_scope_as = duelist } # used if a proxy's skills are tested, e.g. a jockey + scope:duelist = { + duel = { + skill = $SKILL_1$ + value = decent_skill_rating + 10 = { + compare_modifier = { + value = scope:duel_value + multiplier = 3.5 + min = 5 + } + tournament_horse_contest_trait_pivotal_modifier = yes + tournament_foot_contest_trait_pivotal_modifier = yes + tournament_wit_contest_trait_pivotal_modifier = yes + tournament_bow_contest_trait_pivotal_modifier = yes + scope:contestant = { + activity_tournament_change_contestant_score_effect = { SCORE = increase_$INCREASE$ } + add_character_flag = success_pivotal_flag + } + } + 50 = { + trigger = { scope:no_change_chance = yes } + scope:contestant = { add_character_flag = neutral_pivotal_flag } + } + 10 = { + compare_modifier = { + value = scope:duel_value + multiplier = -3.5 + min = 5 + } + scope:contestant = { + activity_tournament_change_contestant_score_effect = { SCORE = decrease_$DECREASE$ } + add_character_flag = failure_pivotal_flag + } + } + } + } +} + +versus_tyrannical_disqualification_effect = { + scope:contest_winner = { save_scope_as = tyrannical_disqualification_target } + scope:activity = { + add_activity_log_entry = { + key = contest_tyrannical_disqualification_log + score = 50 + tags = { contestant removal } + character = scope:contest_loser + target = scope:contest_winner + + # Effects + scope:contest_loser = { + add_tyranny = minor_tyranny_gain + add_prestige = minor_prestige_loss + add_character_modifier = { + modifier = tournament_tyrannical_disqualification_modifier + years = 5 + } + reverse_add_opinion = { + target = scope:contest_winner + modifier = tournament_tyrannical_disqualification_opinion + opinion = -15 + } + } + } + switch = { + trigger = has_current_phase + # Joust + tournament_phase_joust = { + tournament_contest_versus_swap_winner_loser_effect = { CONTEST = joust SKILL = horse } + } + # Wrestling + tournament_phase_wrestling = { + tournament_contest_versus_swap_winner_loser_effect = { CONTEST = wrestling SKILL = pugilism } + } + # Duel + tournament_phase_duel = { + tournament_contest_versus_swap_winner_loser_effect = { CONTEST = duel SKILL = foot } + } + # Board Game + tournament_phase_board_game = { + tournament_contest_versus_swap_winner_loser_effect = { CONTEST = board_game SKILL = board_game } + } + } + } + stress_impact = { + just = medium_stress_impact_gain + humble = medium_stress_impact_gain + } +} + +#ADD RANDOM HASTILUDES SKILL LEVELS +# with some mighty stacks of modifiers to make them culturally appropriate +add_random_tourney_participant_level_effect = { + if = { + limit = { + has_trait = tourney_participant + } + random_list = { + 40 = { } + # FOOT XP + 15 = { + add_trait_xp = { + trait = tourney_participant + track = foot + value = 20 + } + modifier = { + add = 40 + culture = { + OR = { + has_cultural_tradition = tradition_fp1_coastal_warriors + has_cultural_tradition = tradition_stand_and_fight + has_cultural_tradition = tradition_druzhina + has_cultural_tradition = tradition_futuwaa + has_cultural_tradition = tradition_garuda_warriors + has_cultural_tradition = tradition_himalayan_settlers + has_cultural_tradition = tradition_khadga_puja + has_cultural_tradition = tradition_mountaineer_ruralism + has_cultural_tradition = tradition_hird + } + } + } + modifier = { + add = 20 + culture = { + OR = { + has_cultural_tradition = tradition_metal_craftsmanship + has_cultural_tradition = tradition_roman_legacy + has_cultural_tradition = tradition_mountain_homes + has_cultural_tradition = tradition_polders + has_cultural_tradition = tradition_republican_legacy + has_cultural_tradition = tradition_formation_fighting + has_cultural_tradition = tradition_fp1_trials_by_combat + has_cultural_tradition = tradition_fp1_performative_honour + has_cultural_tradition = tradition_caucasian_wolves + has_cultural_tradition = tradition_ep3_audacious_cadets + has_cultural_tradition = tradition_mobile_guards + has_cultural_tradition = tradition_mountain_herding + has_cultural_tradition = tradition_horn_mountain_skirmishing + has_cultural_tradition = tradition_mubarizuns + has_cultural_tradition = tradition_burman_royal_army + has_cultural_tradition = tradition_upland_skirmishing + } + } + } + modifier = { + add = -20 + culture = { + OR = { + has_cultural_tradition = tradition_frugal_armorsmiths + has_cultural_tradition = tradition_strength_in_numbers + } + } + } + modifier = { + add = -25 + prowess <= 8 + } + } + 10 = { + add_trait_xp = { + trait = tourney_participant + track = foot + value = 50 + } + modifier = { + add = 30 + culture = { + OR = { + has_cultural_tradition = tradition_fp1_coastal_warriors + has_cultural_tradition = tradition_stand_and_fight + has_cultural_tradition = tradition_druzhina + has_cultural_tradition = tradition_futuwaa + has_cultural_tradition = tradition_garuda_warriors + has_cultural_tradition = tradition_himalayan_settlers + has_cultural_tradition = tradition_khadga_puja + has_cultural_tradition = tradition_mountaineer_ruralism + has_cultural_tradition = tradition_hird + } + } + } + modifier = { + add = 15 + culture = { + OR = { + has_cultural_tradition = tradition_metal_craftsmanship + has_cultural_tradition = tradition_roman_legacy + has_cultural_tradition = tradition_mountain_homes + has_cultural_tradition = tradition_polders + has_cultural_tradition = tradition_republican_legacy + has_cultural_tradition = tradition_formation_fighting + has_cultural_tradition = tradition_fp1_trials_by_combat + has_cultural_tradition = tradition_fp1_performative_honour + has_cultural_tradition = tradition_caucasian_wolves + has_cultural_tradition = tradition_ep3_audacious_cadets + has_cultural_tradition = tradition_mobile_guards + has_cultural_tradition = tradition_mountain_herding + has_cultural_tradition = tradition_horn_mountain_skirmishing + has_cultural_tradition = tradition_mubarizuns + has_cultural_tradition = tradition_burman_royal_army + has_cultural_tradition = tradition_upland_skirmishing + } + } + } + modifier = { + add = -20 + culture = { + OR = { + has_cultural_tradition = tradition_frugal_armorsmiths + has_cultural_tradition = tradition_strength_in_numbers + } + } + } + modifier = { + add = -25 + prowess <= 8 + } + } + 5 = { + add_trait_xp = { + trait = tourney_participant + track = foot + value = 80 + } + modifier = { + add = 20 + culture = { + OR = { + has_cultural_tradition = tradition_fp1_coastal_warriors + has_cultural_tradition = tradition_stand_and_fight + has_cultural_tradition = tradition_druzhina + has_cultural_tradition = tradition_futuwaa + has_cultural_tradition = tradition_garuda_warriors + has_cultural_tradition = tradition_himalayan_settlers + has_cultural_tradition = tradition_khadga_puja + has_cultural_tradition = tradition_mountaineer_ruralism + has_cultural_tradition = tradition_hird + } + } + } + modifier = { + add = 10 + culture = { + OR = { + has_cultural_tradition = tradition_metal_craftsmanship + has_cultural_tradition = tradition_roman_legacy + has_cultural_tradition = tradition_mountain_homes + has_cultural_tradition = tradition_polders + has_cultural_tradition = tradition_republican_legacy + has_cultural_tradition = tradition_formation_fighting + has_cultural_tradition = tradition_fp1_trials_by_combat + has_cultural_tradition = tradition_fp1_performative_honour + has_cultural_tradition = tradition_caucasian_wolves + has_cultural_tradition = tradition_ep3_audacious_cadets + has_cultural_tradition = tradition_mobile_guards + has_cultural_tradition = tradition_mountain_herding + has_cultural_tradition = tradition_horn_mountain_skirmishing + has_cultural_tradition = tradition_mubarizuns + has_cultural_tradition = tradition_burman_royal_army + has_cultural_tradition = tradition_upland_skirmishing + } + } + } + modifier = { + add = -15 + culture = { + OR = { + has_cultural_tradition = tradition_frugal_armorsmiths + has_cultural_tradition = tradition_strength_in_numbers + } + } + } + modifier = { + add = -25 + prowess <= 8 + } + } + # HORSE XP + 15 = { + add_trait_xp = { + trait = tourney_participant + track = horse + value = 20 + } + modifier = { + add = 40 + culture = { + OR = { + has_cultural_tradition = tradition_roman_legacy + has_cultural_tradition = tradition_horse_breeder + has_cultural_tradition = tradition_chivalry + has_cultural_tradition = tradition_desert_ribat + has_cultural_tradition = tradition_desert_nomads + has_cultural_tradition = tradition_horse_lords + has_cultural_tradition = tradition_hussar + has_cultural_tradition = tradition_saharan_nomads + has_cultural_tradition = tradition_ep3_indomitable_azatani + has_cultural_tradition = tradition_ep3_imperial_tagmata + } + } + } + modifier = { + add = 20 + culture = { + OR = { + has_cultural_tradition = tradition_dryland_dwellers + has_cultural_tradition = tradition_pastoralists + has_cultural_tradition = tradition_hit_and_run + has_cultural_tradition = tradition_hunters + has_cultural_tradition = tradition_caucasian_wolves + has_cultural_tradition = tradition_ep3_audacious_cadets + has_cultural_tradition = tradition_chanson_de_geste + has_cultural_tradition = tradition_burman_royal_army + has_cultural_tradition = tradition_sacred_hunts + has_cultural_tradition = tradition_lords_of_the_elephant + } + } + } + modifier = { + add = -20 + prowess <= 4 + } + } + 10 = { + add_trait_xp = { + trait = tourney_participant + track = horse + value = 50 + } + modifier = { + add = 30 + culture = { + OR = { + has_cultural_tradition = tradition_roman_legacy + has_cultural_tradition = tradition_horse_breeder + has_cultural_tradition = tradition_chivalry + has_cultural_tradition = tradition_desert_ribat + has_cultural_tradition = tradition_desert_nomads + has_cultural_tradition = tradition_horse_lords + has_cultural_tradition = tradition_hussar + has_cultural_tradition = tradition_lords_of_the_elephant + has_cultural_tradition = tradition_saharan_nomads + has_cultural_tradition = tradition_ep3_indomitable_azatani + has_cultural_tradition = tradition_ep3_imperial_tagmata + } + } + } + modifier = { + add = 15 + culture = { + OR = { + has_cultural_tradition = tradition_dryland_dwellers + has_cultural_tradition = tradition_pastoralists + has_cultural_tradition = tradition_hit_and_run + has_cultural_tradition = tradition_hunters + has_cultural_tradition = tradition_caucasian_wolves + has_cultural_tradition = tradition_ep3_audacious_cadets + has_cultural_tradition = tradition_chanson_de_geste + has_cultural_tradition = tradition_burman_royal_army + has_cultural_tradition = tradition_sacred_hunts + } + } + } + modifier = { + add = -20 + prowess <= 4 + } + } + 5 = { + add_trait_xp = { + trait = tourney_participant + track = horse + value = 80 + } + modifier = { + add = 20 + culture = { + OR = { + has_cultural_tradition = tradition_roman_legacy + has_cultural_tradition = tradition_horse_breeder + has_cultural_tradition = tradition_chivalry + has_cultural_tradition = tradition_desert_ribat + has_cultural_tradition = tradition_desert_nomads + has_cultural_tradition = tradition_horse_lords + has_cultural_tradition = tradition_hussar + has_cultural_tradition = tradition_lords_of_the_elephant + has_cultural_tradition = tradition_saharan_nomads + has_cultural_tradition = tradition_ep3_indomitable_azatani + has_cultural_tradition = tradition_ep3_imperial_tagmata + } + } + } + modifier = { + add = 10 + culture = { + OR = { + has_cultural_tradition = tradition_dryland_dwellers + has_cultural_tradition = tradition_pastoralists + has_cultural_tradition = tradition_hit_and_run + has_cultural_tradition = tradition_hunters + has_cultural_tradition = tradition_caucasian_wolves + has_cultural_tradition = tradition_ep3_audacious_cadets + has_cultural_tradition = tradition_chanson_de_geste + has_cultural_tradition = tradition_burman_royal_army + has_cultural_tradition = tradition_sacred_hunts + } + } + } + modifier = { + add = -20 + prowess <= 4 + } + } + # WIT XP + 10 = { + add_trait_xp = { + trait = tourney_participant + track = wit + value = 20 + } + modifier = { + add = 45 + culture = { + OR = { + has_cultural_tradition = tradition_astute_diplomats + has_cultural_tradition = tradition_welcoming + has_cultural_parameter = poet_trait_gives_bonuses + has_cultural_tradition = tradition_storytellers + has_cultural_tradition = tradition_fp1_northern_stories + has_cultural_tradition = tradition_fp2_strategy_gamers + has_cultural_tradition = tradition_chanson_de_geste + } + } + } + modifier = { + add = -25 + diplomacy <= 10 + learning <= 10 + } + modifier = { + add = 20 + OR = { + diplomacy >= 15 + learning >= 15 + } + } + modifier = { + add = 25 + culture = { + OR = { + has_cultural_tradition = tradition_esteemed_hospitality + has_cultural_tradition = tradition_forbearing + has_cultural_tradition = tradition_life_is_just_a_joke + has_cultural_tradition = tradition_chivalry + has_cultural_tradition = tradition_philosopher_culture + has_cultural_tradition = tradition_music_theory + has_cultural_tradition = tradition_things + } + } + } + } + 5 = { + add_trait_xp = { + trait = tourney_participant + track = wit + value = 50 + } + modifier = { + add = 35 + culture = { + OR = { + has_cultural_tradition = tradition_astute_diplomats + has_cultural_tradition = tradition_welcoming + has_cultural_parameter = poet_trait_gives_bonuses + has_cultural_tradition = tradition_storytellers + has_cultural_tradition = tradition_fp1_northern_stories + has_cultural_tradition = tradition_fp2_strategy_gamers + has_cultural_tradition = tradition_chanson_de_geste + } + } + } + modifier = { + add = 20 + culture = { + OR = { + has_cultural_tradition = tradition_esteemed_hospitality + has_cultural_tradition = tradition_forbearing + has_cultural_tradition = tradition_life_is_just_a_joke + has_cultural_tradition = tradition_chivalry + has_cultural_tradition = tradition_philosopher_culture + has_cultural_tradition = tradition_music_theory + has_cultural_tradition = tradition_things + } + } + } + modifier = { + add = -25 + diplomacy <= 10 + learning <= 10 + } + modifier = { + add = 20 + OR = { + diplomacy >= 15 + learning >= 15 + } + } + } + 5 = { + add_trait_xp = { + trait = tourney_participant + track = wit + value = 80 + } + modifier = { + add = 20 + culture = { + OR = { + has_cultural_tradition = tradition_astute_diplomats + has_cultural_tradition = tradition_welcoming + has_cultural_parameter = poet_trait_gives_bonuses + has_cultural_tradition = tradition_storytellers + has_cultural_tradition = tradition_fp1_northern_stories + has_cultural_tradition = tradition_fp2_strategy_gamers + has_cultural_tradition = tradition_chanson_de_geste + } + } + } + modifier = { + add = 10 + culture = { + OR = { + has_cultural_tradition = tradition_esteemed_hospitality + has_cultural_tradition = tradition_forbearing + has_cultural_tradition = tradition_life_is_just_a_joke + has_cultural_tradition = tradition_chivalry + has_cultural_tradition = tradition_philosopher_culture + has_cultural_tradition = tradition_music_theory + has_cultural_tradition = tradition_things + } + } + } + modifier = { + add = -25 + diplomacy <= 10 + learning <= 10 + } + modifier = { + add = 20 + OR = { + diplomacy >= 15 + learning >= 15 + } + } + } + # BOW XP + 10 = { + add_trait_xp = { + trait = tourney_participant + track = bow + value = 20 + } + modifier = { + add = 45 + culture = { + OR = { + has_cultural_tradition = tradition_adaptive_skirmishing + has_cultural_tradition = tradition_hunters + has_cultural_tradition = tradition_bush_hunting + has_cultural_tradition = tradition_forest_wardens + has_cultural_tradition = tradition_horse_lords + has_cultural_tradition = tradition_land_of_the_bow + has_cultural_tradition = tradition_longbow_competitions + } + } + } + modifier = { + add = 25 + culture = { + OR = { + has_cultural_tradition = tradition_forest_folk + has_cultural_tradition = tradition_jungle_dwellers + has_cultural_tradition = tradition_polders + has_cultural_tradition = tradition_fp1_coastal_warriors + has_cultural_tradition = tradition_formation_fighting + has_cultural_tradition = tradition_hit_and_run + has_cultural_tradition = tradition_sacred_hunts + has_cultural_tradition = tradition_mobile_guards + has_cultural_tradition = tradition_mountain_herding + has_cultural_tradition = tradition_horn_mountain_skirmishing + has_cultural_tradition = tradition_upland_skirmishing + } + } + } + modifier = { + factor = 0 + OR = { + has_trait = blind + has_trait = maimed + } + } + modifier = { + add = 15 + has_trait = lifestyle_hunter + } + } + 5 = { + add_trait_xp = { + trait = tourney_participant + track = bow + value = 50 + } + modifier = { + add = 35 + culture = { + OR = { + has_cultural_tradition = tradition_adaptive_skirmishing + has_cultural_tradition = tradition_hunters + has_cultural_tradition = tradition_bush_hunting + has_cultural_tradition = tradition_forest_wardens + has_cultural_tradition = tradition_horse_lords + has_cultural_tradition = tradition_land_of_the_bow + } + } + } + modifier = { + add = 15 + culture = { + OR = { + has_cultural_tradition = tradition_forest_folk + has_cultural_tradition = tradition_jungle_dwellers + has_cultural_tradition = tradition_polders + has_cultural_tradition = tradition_fp1_coastal_warriors + has_cultural_tradition = tradition_formation_fighting + has_cultural_tradition = tradition_hit_and_run + has_cultural_tradition = tradition_sacred_hunts + has_cultural_tradition = tradition_mobile_guards + has_cultural_tradition = tradition_mountain_herding + has_cultural_tradition = tradition_horn_mountain_skirmishing + has_cultural_tradition = tradition_upland_skirmishing + has_cultural_tradition = tradition_longbow_competitions + } + } + } + modifier = { + add = 15 + has_trait = lifestyle_hunter + } + modifier = { + factor = 0 + OR = { + has_trait = blind + has_trait = maimed + } + } + } + 5 = { + add_trait_xp = { + trait = tourney_participant + track = bow + value = 80 + } + modifier = { + add = 20 + culture = { + OR = { + has_cultural_tradition = tradition_adaptive_skirmishing + has_cultural_tradition = tradition_hunters + has_cultural_tradition = tradition_bush_hunting + has_cultural_tradition = tradition_forest_wardens + has_cultural_tradition = tradition_horse_lords + has_cultural_tradition = tradition_land_of_the_bow + } + } + } + modifier = { + add = 10 + culture = { + OR = { + has_cultural_tradition = tradition_forest_folk + has_cultural_tradition = tradition_jungle_dwellers + has_cultural_tradition = tradition_polders + has_cultural_tradition = tradition_fp1_coastal_warriors + has_cultural_tradition = tradition_formation_fighting + has_cultural_tradition = tradition_hit_and_run + has_cultural_tradition = tradition_sacred_hunts + has_cultural_tradition = tradition_mobile_guards + has_cultural_tradition = tradition_mountain_herding + has_cultural_tradition = tradition_horn_mountain_skirmishing + has_cultural_tradition = tradition_upland_skirmishing + has_cultural_tradition = tradition_longbow_competitions + } + } + } + modifier = { + add = 15 + has_trait = lifestyle_hunter + } + modifier = { + factor = 0 + OR = { + has_trait = blind + has_trait = maimed + } + } + } + } + random_list = { + 60 = { } + 10 = { + add_trait_xp = { + trait = tourney_participant + track = foot + value = 20 + } + } + 10 = { + add_trait_xp = { + trait = tourney_participant + track = bow + value = 20 + } + } + 10 = { + add_trait_xp = { + trait = tourney_participant + track = horse + value = 20 + } + } + 10 = { + add_trait_xp = { + trait = tourney_participant + track = wit + value = 20 + } + } + } + } +} + +versus_contest_round_outcome_tooltip_effect = { + if = { + limit = { scope:activity.var:contest_versus_progress = 2 } + custom_description = { + text = tournament_contest_round_win_tt + subject = $WINNER$ + object = $LOSER$ + } + } + else = { + custom_description = { + text = tournament_contest_round_tt + subject = $WINNER$ + object = $LOSER$ + } + } +} + +versus_contest_disqualification_tooltip_effect = { + if = { + limit = { scope:activity.var:contest_versus_progress = 2 } + custom_description = { + text = tournament_contest_disqualify_win_tt + subject = $WINNER$ + object = $DISQUALIFIED$ + } + } + else = { + custom_description = { + text = tournament_contest_disqualify_round_tt + subject = $WINNER$ + object = $DISQUALIFIED$ + } + } +} + +versus_contest_resignation_tooltip_effect = { + if = { + limit = { scope:activity.var:contest_versus_progress = 2 } + custom_description = { + text = tournament_contest_resign_win_tt + subject = $WINNER$ + object = $RESIGNER$ + } + } + else = { + custom_description = { + text = tournament_contest_resign_round_tt + subject = $WINNER$ + object = $RESIGNER$ + } + } +} + +versus_force_concession_effect = { + reverse_add_opinion = { + target = scope:versus_contestant + modifier = tournament_bribed_replacement_opinion + opinion = -10 + } + scope:versus_contestant = { + remove_variable = progress_to_victory + remove_variable = contest_aptitude + } + scope:activity = { + switch = { + trigger = var:contest_versus_progress + 0 = { + add_to_guest_subset = { name = semi_finalist target = root } + } + 1 = { + add_to_guest_subset = { name = finalist target = root } + } + 2 = { + add_to_guest_subset = { name = winner target = root } + } + } + } + versus_contest_resignation_tooltip_effect = { + RESIGNER = scope:versus_contestant + WINNER = root + } + stress_impact = { + just = miniscule_stress_impact_gain + humble = miniscule_stress_impact_gain + content = miniscule_stress_impact_gain + diligent = miniscule_stress_impact_gain + } +} + +little_william_marshal_achievement_contest_end_effect = { + if = { + limit = { + exists = global_var:started_little_william_marshal_achievement + scope:activity = { + any_attending_character = { + is_ai = no + } + } + } + # Increment overall contest tally. + change_global_variable = { + name = started_little_william_marshal_achievement + add = 1 + } + } +} + +little_william_marshal_achievement_contest_end_winner_effect = { + if = { + limit = { + exists = global_var:started_little_william_marshal_achievement + is_ai = no + } + change_global_variable = { + name = little_william_marshal_achievement_tally + add = 1 + } + } +} diff --git a/N3OW/common/scripted_effects/04_dlc_ep2_wedding_effects.txt b/N3OW/common/scripted_effects/04_dlc_ep2_wedding_effects.txt new file mode 100644 index 00000000..3b89bc07 --- /dev/null +++ b/N3OW/common/scripted_effects/04_dlc_ep2_wedding_effects.txt @@ -0,0 +1,149 @@ +# Create the grand wedding variables between the two characters, they must already have been betrothed by the code hook in the marry +# interaction or by manually setting a betrothal. For manual betrothal setting prefer using create_grand_wedding_betrothal. +# SPOUSE_1 = First spouse character +# SPOUSE_2 = Second spouse character +# HOST = Character promising to host the grand wedding +set_grand_wedding_betrothal_variables = { + $SPOUSE_1$ = { + set_variable = { name = promised_grand_wedding_by value = $HOST$ } + save_scope_as = spouse_1 + } + $SPOUSE_2$ = { + set_variable = { name = promised_grand_wedding_by value = $HOST$ } + save_scope_as = spouse_2 + } + $HOST$ = { + set_variable = { + name = promised_grand_wedding_marriage_countdown + value = $SPOUSE_1$ + years = grand_wedding_timeout + } + set_variable = { + name = promised_grand_wedding_to + value = $PROMISEE$ + } + # Notification that the countdown has expired (one day before, to avoid getting the variable deleted before we have used it) + trigger_event = { + id = ep2_wedding.0001 + days = grand_wedding_timeout_notification + } + } +} + +# Recreate the variables setup if the host dies and is replaced +wedding_update_hosting_variable_effect = { + if = { + limit = { + scope:spouse_1 = { has_variable = promised_grand_wedding_by } + } + scope:spouse_1 = { + remove_variable = promised_grand_wedding_by + set_variable = { name = promised_grand_wedding_by value = scope:new_host } + } + } + if = { + limit = { + scope:spouse_2 = { has_variable = promised_grand_wedding_by } + } + scope:spouse_2 = { + remove_variable = promised_grand_wedding_by + set_variable = { name = promised_grand_wedding_by value = scope:new_host } + } + } + if = { + limit = { + scope:host = { has_variable = promised_grand_wedding_marriage_countdown } + } + scope:new_host = { + set_variable = { + name = promised_grand_wedding_marriage_countdown + value = scope:spouse_1 + years = grand_wedding_timeout + } + } + } +} + +# Crease a betrothal between SPOUSE_1 and SPOUSE_2 with HOST promising to host a grand wedding +# SPOUSE_1 = First spouse character +# SPOUSE_2 = Second spouse character +# HOST = Character promising to host the grand wedding +create_grand_wedding_betrothal = { + if = { + limit = { + $SPOUSE_1$ = { + is_female = yes + } + } + $SPOUSE_1$ = { + create_betrothal_matrilineal = $SPOUSE_2$ + } + } + else = { + $SPOUSE_1$ = { + create_betrothal = $SPOUSE_2$ + } + } + + set_grand_wedding_betrothal_variables = { + SPOUSE_1 = $SPOUSE_1$ + SPOUSE_2 = $SPOUSE_2$ + HOST = $HOST$ + PROMISEE = $PROMISEE$ + } +} + +# Wedding Options on_start +wedding_normal_option_effect = { + scope:host = { + if = { + limit = { + any_vassal = { + OR = { + has_vassal_stance = parochial + has_vassal_stance = zealot + } + } + } + every_vassal = { + limit = { + OR = { + has_vassal_stance = parochial + has_vassal_stance = zealot + } + } + add_opinion = { + target = scope:host + modifier = wedding_balanced_option_opinion + } + } + } + } +} + +wedding_good_option_effect = { + scope:host = { + if = { + limit = { + any_vassal = { + OR = { + has_vassal_stance = courtly + has_vassal_stance = glory_hound + } + } + } + every_vassal = { + limit = { + OR = { + has_vassal_stance = courtly + has_vassal_stance = glory_hound + } + } + add_opinion = { + target = scope:host + modifier = wedding_good_option_opinion + } + } + } + } +} diff --git a/N3OW/common/scripted_effects/05_bp2_hostage_effects.txt b/N3OW/common/scripted_effects/05_bp2_hostage_effects.txt new file mode 100644 index 00000000..f7ba278c --- /dev/null +++ b/N3OW/common/scripted_effects/05_bp2_hostage_effects.txt @@ -0,0 +1,840 @@ + +################################################## +# Effects related to the hostage system + +# Execute that hostage +bp2_execute_hostage_effect = { + scope:hostage = { save_scope_as = victim } + scope:hostage_warden = { save_scope_as = executioner } + scope:executioner = { + # Dread + add_dread = minor_dread_gain + #Kinslaying + add_kinslayer_trait_or_nothing_effect = { VICTIM = scope:victim } + } + show_as_tooltip = { + # Kill hostage + scope:victim = { + death = { + death_reason = death_hostage_execution + killer = scope:executioner + } + } + } + # Cancel truce + scope:executioner = { + if = { + limit = { + OR = { + NOT = { has_variable = recently_executed_hostage } + NOT = { has_variable = recently_executed_hostage_home_court } + } + } + set_variable = { + name = recently_executed_hostage + value = scope:hostage + years = 1 + } + set_variable = { + name = recently_executed_hostage_home_court + value = scope:hostage_home_court + years = 1 + } + } + } + # Opinion + scope:victim = { + # Victim's family & spouse hates executioner + every_close_family_member = { + limit = { this != scope:executioner } + add_to_temporary_list = victim_family_list + } + every_spouse = { + limit = { this != scope:executioner } + add_to_temporary_list = victim_family_list + } + if = { + limit = { + any_in_list = { list = victim_family_list count > 0 } + } + every_in_list = { + list = victim_family_list + custom = all_close_family_and_spouses + limit = { + NOR = { + this = scope:hostage_home_court + this = scope:executioner + } + } + add_opinion = { + target = scope:executioner + modifier = executed_close_family + } + } + } + # Victim's dynasty hates executioner + if = { + limit = { + exists = dynasty + exists = scope:executioner.dynasty + dynasty != scope:executioner.dynasty + } + dynasty = { + every_dynasty_member = { + limit = { + NOR = { + this = scope:executioner + this = scope:victim + is_in_list = victim_family_list + } + } + custom = all_dynasty_members + add_to_temporary_list = victim_dynasty_list + add_opinion = { + target = scope:executioner + modifier = executed_dynasty_member + } + } + } + } + # Victim's friends and lovers + every_relation = { + type = friend + type = lover + limit = { + NOR = { + this = scope:executioner + this = scope:victim + is_in_list = victim_family_list + is_in_list = victim_dynasty_list + } + } + custom = all_friends_and_lovers + add_opinion = { + target = scope:executioner + modifier = executed_close_relation_opinion + } + } + } + # Stress + scope:executioner = { + if = { + limit = { + NOT = { has_trait = sadistic } + scope:victim = { + OR = { + is_child_of = scope:executioner + is_grandchild_of = scope:executioner + is_great_grandchild_of = scope:executioner + } + } + } + stress_impact = { + base = minor_stress_impact_gain + compassionate = massive_stress_impact_gain + forgiving = major_stress_impact_gain + generous = minor_stress_impact_gain + family_first = minor_stress_impact_gain + } + } + else_if = { + limit = { + NOT = { has_trait = sadistic } + scope:victim = { + OR = { + has_relation_friend = scope:executioner + has_relation_lover = scope:executioner + } + } + } + stress_impact = { + base = medium_stress_impact_gain + compassionate = massive_stress_impact_gain + forgiving = major_stress_impact_gain + generous = medium_stress_impact_gain + trusting = minor_stress_impact_gain + content = minor_stress_impact_gain + } + } + else = { + stress_impact = { + sadistic = medium_stress_impact_loss + compassionate = medium_stress_impact_gain + forgiving = minor_stress_impact_gain + generous = minor_stress_impact_gain + } + } + } + # Actually kill the hostage once effects are run + hidden_effect = { + scope:hostage_home_court = { + send_interface_toast = { + title = hostage_executed_toast + left_icon = scope:hostage + right_icon = scope:executioner + scope:victim = { + show_as_tooltip = { + death = { + death_reason = death_hostage_execution + killer = scope:executioner + } + } + } + } + } + scope:executioner = { + send_interface_toast = { + title = hostage_executed_toast + left_icon = scope:hostage + right_icon = scope:hostage_home_court + scope:victim = { + death = { + death_reason = death_hostage_execution + killer = scope:executioner + } + } + } + } + } +} + +bp2_return_hostage_effect = { + # Put hostage return at top of tooltip + show_as_tooltip = { + $HOSTAGE$ = { return_hostage = yes } + } + $HOSTAGE$.warden ?= { + if = { + limit = { + OR = { + bp2_warden_title_tier_lower_trigger = { WARDEN = $HOSTAGE$.warden HOME_COURT = $HOSTAGE$.home_court } + bp2_warden_dynasty_renown_lower_trigger = { WARDEN = $HOSTAGE$.warden HOME_COURT = $HOSTAGE$.home_court } + } + } + if = { + limit = { + $HOSTAGE$.warden.faith ?= { + faith_hostility_level = { + target = $HOSTAGE$.home_court.faith + value >= faith_hostile_level + } + } + } + custom_tooltip = hostage_prestige_piety_renown_income_loss_tt + } + else = { custom_tooltip = hostage_prestige_renown_income_loss_tt } + } + else = { custom_tooltip = hostage_prestige_income_loss_tt } + if = { + limit = { + $HOSTAGE$.home_court ?= { + NOR = { + any_warden_hostage = { home_court = $HOSTAGE$.warden } + OR = { + has_truce = $HOSTAGE$.warden + is_allied_to = $HOSTAGE$.warden + } + } + } + } + if = { + limit = { + NOT = { exists = scope:actor } + NOT = { exists = scope:recipient } + } + $HOSTAGE$.home_court = { save_scope_as = actor } + $HOSTAGE$.warden = { save_scope_as = recipient } + } + custom_tooltip = hostage_truce_ending_tt + } + } + $HOSTAGE$ = { + if = { + limit = { + hostage_duration = { years < 1 } + } + set_variable = { + name = short_hostage_duration + years = 10 + value = $HOSTAGE$.warden + } + } + else_if = { + limit = { + hostage_duration = { years >= 5 } + } + set_variable = { + name = long_hostage_duration + years = 10 + value = $HOSTAGE$.warden + } + } + else = { + set_variable = { + name = hostage_duration + years = 10 + value = $HOSTAGE$.warden + } + } + if = { + limit = { + exists = $HOSTAGE$.warden.capital_province + } + $HOSTAGE$.warden.capital_province = { save_scope_as = starting_location } + } + else_if = { + limit = { + exists = $HOSTAGE$.warden.location + } + $HOSTAGE$.warden.location = { save_scope_as = starting_location } + } + if = { + limit = { is_ruler = yes } + capital_province = { save_scope_as = destination_province } + } + else_if = { + limit = { exists = $HOSTAGE$.home_court.capital_province } + $HOSTAGE$.home_court ?= { + save_scope_as = home_court + capital_province = { save_scope_as = destination_province } + } + } + else_if = { + limit = { exists = $HOSTAGE$.home_court.location } + $HOSTAGE$.home_court.location = { save_scope_as = destination_province } + } + else = { + $HOSTAGE$.location = { save_scope_as = destination_province } + } + # Actually return hostage last + hidden_effect = { + if = { + limit = { is_hostage = yes } + return_hostage = yes + } + if = { + limit = { + exists = scope:destination_province + exists = scope:starting_location + } + set_location = scope:starting_location + start_travel_plan = { + players_use_planner = no + destination = scope:destination_province + on_start_on_action = on_hostage_depart_for_home_court + on_travel_planner_cancel_on_action = on_hostage_depart_travel_planner_exit + on_arrival_on_action = on_hostage_arrive_at_home_court + on_arrival_destinations = last + return_trip = no # One way + } + } + else = { + set_location = scope:destination_province + } + } + } +} + +bp2_return_hostage_no_travel_effect = { + # Put hostage return at top of tooltip + show_as_tooltip = { + $HOSTAGE$ = { return_hostage = yes } + } + $HOSTAGE$.warden ?= { + if = { + limit = { + OR = { + bp2_warden_title_tier_lower_trigger = { WARDEN = $HOSTAGE$.warden HOME_COURT = $HOSTAGE$.home_court } + bp2_warden_dynasty_renown_lower_trigger = { WARDEN = $HOSTAGE$.warden HOME_COURT = $HOSTAGE$.home_court } + } + } + if = { + limit = { + $HOSTAGE$.warden.faith ?= { + faith_hostility_level = { + target = $HOSTAGE$.home_court.faith + value >= faith_hostile_level + } + } + } + custom_tooltip = hostage_prestige_piety_renown_income_loss_tt + } + else = { custom_tooltip = hostage_prestige_renown_income_loss_tt } + } + else = { custom_tooltip = hostage_prestige_income_loss_tt } + if = { + limit = { + $HOSTAGE$.home_court ?= { + NOR = { + any_warden_hostage = { home_court = $HOSTAGE$.warden } + OR = { + has_truce = $HOSTAGE$.warden + is_allied_to = $HOSTAGE$.warden + } + } + } + } + custom_tooltip = hostage_truce_ending_tt + } + } + $HOSTAGE$ = { + if = { + limit = { + hostage_duration = { years < 1 } + } + set_variable = { + name = short_hostage_duration + years = 10 + value = $HOSTAGE$.warden + } + } + else_if = { + limit = { + hostage_duration = { years >= 5 } + } + set_variable = { + name = long_hostage_duration + years = 10 + value = $HOSTAGE$.warden + } + } + else = { + set_variable = { + name = hostage_duration + years = 10 + value = $HOSTAGE$.warden + } + } + # Actually return hostage last + hidden_effect = { + if = { + limit = { is_hostage = yes } + return_hostage = yes + } + } + } +} + +bp2_send_hostage_two_way_tooltip_effect = { + scope:hostage_sender_1 = { + if = { + limit = { has_truce = scope:hostage_sender_1 } + custom_tooltip = hostage_existing_truce_two_way_1_tt + } + } + scope:hostage_sender_2 = { + if = { + limit = { has_truce = scope:hostage_sender_1 } + custom_tooltip = hostage_existing_truce_two_way_2_tt + } + } +} + +hostage_depart_effect = { + $HOSTAGE$ ?= { + # Remove guardian if relevant + if = { + limit = { + any_relation = { type = guardian } + } + every_relation = { + type = guardian + save_scope_as = current_guardian_scope + remove_guardian_effect = { + GUARDIAN = scope:current_guardian_scope + WARD = $HOSTAGE$ + RETURN_WARD = no + HIDE_OPINION = yes + } + } + } + else_if = { + limit = { + any_relation = { type = ward } + } + every_relation = { + type = ward + save_scope_as = current_ward_scope + remove_guardian_effect = { + GUARDIAN = $HOSTAGE$ + WARD = scope:current_ward_scope + RETURN_WARD = yes + HIDE_OPINION = yes + } + } + } + hidden_effect = { + $HOME_COURT$ = { + send_interface_toast = { + title = hostage_departs_title + left_icon = $HOSTAGE$ + right_icon = $WARDEN$ + # Departure info + $HOSTAGE$ = { + custom_description = { + text = hostage_leaves_home_tt + subject = $HOSTAGE$ + object = $WARDEN$ + } + } + } + } + # Toast for recipient + $WARDEN$ = { + send_interface_toast = { + title = hostage_departs_title + left_icon = $HOSTAGE$ + right_icon = $HOME_COURT$ + # Departure info + $HOSTAGE$ = { + custom_description = { + text = hostage_leaves_home_tt + subject = $HOSTAGE$ + object = $WARDEN$ + } + } + } + } + } + show_as_tooltip = { + $WARDEN$ = { take_hostage = $HOSTAGE$ } + } + if = { + limit = { + OR = { + bp2_warden_title_tier_lower_trigger = { WARDEN = $WARDEN$ HOME_COURT = $HOME_COURT$ } + bp2_warden_dynasty_renown_lower_trigger = { WARDEN = $WARDEN$ HOME_COURT = $HOME_COURT$ } + } + } + if = { + limit = { + $WARDEN$.faith = { + faith_hostility_level = { + target = $HOME_COURT$.faith + value >= faith_hostile_level + } + } + } + custom_description = { + text = hostage_prestige_piety_renown_income_tt + subject = $WARDEN$ + } + custom_description_no_bullet = { + text = hostage_faith_hostility_tt + subject = $WARDEN$ + object = $HOME_COURT$ + } + if = { + limit = { + bp2_warden_dynasty_renown_lower_trigger = { WARDEN = $WARDEN$ HOME_COURT = $HOME_COURT$ } + } + custom_description_no_bullet = { + text = warden_lower_dynasty_renown_tt + subject = $WARDEN$ + object = $HOME_COURT$ + } + } + if = { + limit = { + bp2_warden_title_tier_lower_trigger = { WARDEN = $WARDEN$ HOME_COURT = $HOME_COURT$ } + } + custom_description_no_bullet = { + text = warden_lower_title_tier_tt + subject = $WARDEN$ + object = $HOME_COURT$ + } + } + } + else = { + custom_description = { + text = hostage_prestige_renown_income_tt + subject = $WARDEN$ + } + if = { + limit = { + bp2_warden_dynasty_renown_lower_trigger = { WARDEN = $WARDEN$ HOME_COURT = $HOME_COURT$ } + } + custom_description_no_bullet = { + text = warden_lower_dynasty_renown_tt + subject = $WARDEN$ + object = $HOME_COURT$ + } + } + if = { + limit = { + bp2_warden_title_tier_lower_trigger = { WARDEN = $WARDEN$ HOME_COURT = $HOME_COURT$ } + } + custom_description_no_bullet = { + text = warden_lower_title_tier_tt + subject = $WARDEN$ + object = $HOME_COURT$ + } + } + } + } + else = { + custom_description = { + text = hostage_prestige_income_tt + subject = $WARDEN$ + } + } + remove_character_flag = under_offer_as_hostage_flag + set_variable = { + name = hostage_travelling_to_warden + value = $WARDEN$ + years = 2 + } + start_travel_plan = { + destination = $WARDEN$.capital_province + on_start_on_action = on_hostage_depart_for_warden + on_travel_planner_cancel_on_action = on_hostage_depart_travel_planner_exit + on_arrival_on_action = on_hostage_arrive_at_warden + on_arrival_destinations = last + return_trip = no # One way + } + } +} + +# Invalidate travelling hostages +hostage_travel_invalidation_effect = { + if = { + limit = { + exists = var:hostage_travelling_to_warden + OR = { + var:hostage_travelling_to_warden = { + OR = { + # Warden dies (flag:warden) + is_alive = no + # Warden loses lands (flag:warden) + is_playable_character = no + # War + AND = { + exists = root.liege + is_at_war_with = root.liege + } + } + } + # Hostage is jailed (flag:imprisoner) + is_imprisoned = yes + # Hostage becomes landed (flag:ruler) + is_playable_character = yes + # No longer important to home court (flag:invalid) + trigger_if = { + limit = { exists = liege } + NOR = { + is_child_of = liege + is_grandchild_of = liege + is_sibling_of = liege + is_nibling_of = liege + } + } + trigger_else = { + # Home court no longer landed (flag:home_court) + NOT = { exists = liege } + } + } + } + save_scope_as = hostage + if = { + limit = { exists = liege } + liege = { save_scope_as = home_court } + } + var:hostage_travelling_to_warden = { + send_interface_toast = { + title = hostage_invalidated_during_travel_title + left_icon = scope:hostage + right_icon = scope:home_court + show_as_tooltip = { + scope:hostage = { return_hostage = yes } + } + } + } + scope:home_court ?= { + send_interface_toast = { + title = hostage_invalidated_during_travel_title + left_icon = scope:hostage + right_icon = scope:hostage.var:hostage_travelling_to_warden + scope:hostage = { + show_as_tooltip = { return_hostage = yes } + current_travel_plan = { + if = { + limit = { can_cancel = yes } + cancel_travel_plan = yes + } + } + set_location_to_default = yes + } + } + } + if = { + limit = { is_alive = yes } + remove_variable = hostage_travelling_to_warden + } + debug_log = "Hostage invalidated during travel" + debug_log_scopes = yes + } +} + +# Invalidate travelling wards +ward_travel_invalidation_effect = { + if = { + limit = { + exists = var:ward_travelling_to_guardian + OR = { + # Ward is imprisoned + is_imprisoned = yes + # Ward has guardian already + any_relation = { type = guardian } + is_playable_character = yes + + var:ward_travelling_to_guardian = { + is_alive = no + # Guardian is jailed + is_imprisoned = yes + # Guardian has wards already + num_of_relation_ward >= 2 + } + NOT = { exists = var:ward_travelling_to_guardian } + NOT = { exists = var:character_making_education_request } + } + } + var:ward_travelling_to_guardian ?= { save_scope_as = guardian } + save_scope_as = ward + if = { + limit = { exists = liege } + liege = { + save_scope_as = ward_liege + send_interface_toast = { + title = ward_invalidated_during_travel_title + left_icon = scope:ward + right_icon = scope:guardian + show_as_tooltip = { + scope:ward = { remove_relation_guardian = scope:guardian } + } + } + } + } + scope:guardian ?= { + send_interface_toast = { + title = ward_invalidated_during_travel_title + left_icon = scope:ward + right_icon = scope:ward_liege + scope:ward = { + show_as_tooltip = { remove_relation_guardian = scope:guardian } + current_travel_plan = { + if = { + limit = { can_cancel = yes } + cancel_travel_plan = yes + } + } + set_location_to_default = yes + } + } + if = { + limit = { is_alive = yes } + remove_variable = guardian_waiting_for_ward + } + } + if = { + limit = { is_alive = yes } + remove_variable = ward_travelling_to_guardian + remove_variable = character_making_education_request + } + debug_log = "Ward invalidated during travel" + debug_log_scopes = yes + } +} + +# Invalidate travelling guardians +guardian_travel_invalidation_effect = { + if = { + limit = { + exists = var:guardian_travelling_to_ward + OR = { + # Guardian is imprisoned + is_imprisoned = yes + + # Guardian has wards already + num_of_relation_ward >= 2 + is_playable_character = yes + + var:guardian_travelling_to_ward = { + is_alive = no + # Ward is jailed + is_imprisoned = yes + # Ward has a guardian already + any_relation = { type = guardian } + } + NOT = { exists = var:guardian_travelling_to_ward } + } + } + var:guardian_travelling_to_ward ?= { save_scope_as = ward } + save_scope_as = guardian + scope:ward ?= { + if = { + limit = { exists = liege } + liege = { + save_scope_as = ward_liege + send_interface_toast = { + title = ward_invalidated_during_travel_title + left_icon = scope:guardian + right_icon = scope:ward + show_as_tooltip = { + scope:guardian = { remove_relation_ward = scope:ward } + } + } + } + } + send_interface_toast = { + title = guardian_invalidated_during_travel_title + left_icon = scope:guardian + scope:guardian = { + show_as_tooltip = { remove_relation_ward = scope:ward } + current_travel_plan = { + if = { + limit = { can_cancel = yes } + cancel_travel_plan = yes + } + } + set_location_to_default = yes + } + } + if = { + limit = { is_alive = yes } + remove_variable = character_making_education_request + remove_variable = ward_waiting_for_guardian + } + } + if = { + limit = { is_alive = yes } + remove_variable = guardian_travelling_to_ward + } + debug_log = "Guardian invalidated during travel" + debug_log_scopes = yes + } +} + +bp2_hostage_war_end_tooltip_effect = { + show_as_tooltip = { + scope:attacker = { + every_close_family_member = { + limit = { var:hostage_travelling_to_warden ?= scope:defender } + custom_description = { + text = hostage_leaves_home_tt + subject = this + object = scope:defender + } + } + } + scope:defender = { + every_close_family_member = { + limit = { var:hostage_travelling_to_warden ?= scope:attacker } + custom_description = { + text = hostage_leaves_home_tt + subject = this + object = scope:attacker + } + } + } + } +} diff --git a/N3OW/common/scripted_effects/05_dlc_bp2_effects.txt b/N3OW/common/scripted_effects/05_dlc_bp2_effects.txt new file mode 100644 index 00000000..6cb09bff --- /dev/null +++ b/N3OW/common/scripted_effects/05_dlc_bp2_effects.txt @@ -0,0 +1,1466 @@ +#Placeholder hostage effect +take_hostage = { + add_visiting_courtier = $HOSTAGE$ +} + +#Adult Education rewards effects +#Account for the state of our variables, apply flags that are resolved in disburse_adult_education_reward_effect +resolve_adult_education_success_reward_effect = { + involved_activity ?= { + #Perfect studies - 75-100 + if = { + limit = { var:activity_special_type_progression >= 75 } + scope:host = { + add_character_flag = perfect_studies_reward + if = { #100% from 1 to 2 + limit = { has_level_1_education_trait_trigger = yes } + add_character_flag = increase_education_level_1 + } + else_if = { #100% chance from 2 to 3 + limit = { has_level_2_education_trait_trigger = yes } + add_character_flag = increase_education_level_2 + } + else_if = { #85% chance from 3 to 4 + limit = { has_level_3_education_trait_trigger = yes } + random = { + chance = 85 + add_character_flag = increase_education_level_3 + } + } + else_if = { #60% chance from 4 to 5 + limit = { has_level_4_education_trait_trigger = yes } + random = { + chance = 60 + modifier = { + involved_activity = { + has_activity_option = { + category = adult_education_option_books + option = adult_education_books_normal + } + } + add = 5 + } + add_character_flag = increase_education_level_4 + } + } + } + } + #High-end studies - 50-75 + else_if = { + limit = { + var:activity_special_type_progression < 75 + var:activity_special_type_progression >= 50 + } + scope:host = { + add_character_flag = high_studies_reward + if = { #100% from 1 to 2 + limit = { has_level_1_education_trait_trigger = yes } + add_character_flag = increase_education_level_1 + } + else_if = { #85% from 2 to 3 + limit = { has_level_2_education_trait_trigger = yes } + random = { + chance = 85 + add_character_flag = increase_education_level_2 + } + } + else_if = { #65% from 3 to 4 + limit = { has_level_3_education_trait_trigger = yes } + random = { + chance = 65 + add_character_flag = increase_education_level_3 + } + } + else_if = { #40% chance from 4 to 5 + limit = { has_level_4_education_trait_trigger = yes } + random = { + chance = 40 + modifier = { + involved_activity = { + has_activity_option = { + category = adult_education_option_books + option = adult_education_books_normal + } + } + add = 5 + } + add_character_flag = increase_education_level_4 + } + } + } + } + #OK studies - 25-50 + else_if = { + limit = { + var:activity_special_type_progression < 50 + var:activity_special_type_progression >= 25 + } + scope:host = { + add_character_flag = mid_studies_reward + if = { #85% from 1 to 2 + limit = { has_level_1_education_trait_trigger = yes } + random = { + chance = 85 + add_character_flag = increase_education_level_1 + } + } + else_if = { #65% from 2 to 3 + limit = { has_level_2_education_trait_trigger = yes } + random = { + chance = 65 + add_character_flag = increase_education_level_2 + } + } + else_if = { #40% from 3 to 4 + limit = { has_level_3_education_trait_trigger = yes } + random = { + chance = 40 + add_character_flag = increase_education_level_3 + } + } + else_if = { #15% chance from 4 to 5 + limit = { has_level_4_education_trait_trigger = yes } + random = { + chance = 15 + modifier = { + involved_activity = { + has_activity_option = { + category = adult_education_option_books + option = adult_education_books_normal + } + } + add = 5 + } + add_character_flag = increase_education_level_4 + } + } + } + } + #Lousy studies - 0-25 + else = { + scope:host = { + add_character_flag = low_studies_reward + if = { #65% from 1 to 2 + limit = { has_level_1_education_trait_trigger = yes } + random = { + chance = 65 + add_character_flag = increase_education_level_1 + } + } + else_if = { #40% from 2 to 3 + limit = { has_level_2_education_trait_trigger = yes } + random = { + chance = 40 + add_character_flag = increase_education_level_2 + } + } + else_if = { #15% from 3 to 4 + limit = { has_level_3_education_trait_trigger = yes } + random = { + chance = 15 + add_character_flag = increase_education_level_3 + } + } + } + } + if = { + limit = { + activity_location = { + is_province_valid_confucian_education_trigger = yes + } + } + scope:host = { + if = { + limit = { + NOT = { has_trait = confucian_education } + } + add_trait = confucian_education + add_trait_xp = { + trait = confucian_education + value = { + value = scope:activity.var:activity_special_type_progression + multiply = { + value = 0 + if = { + limit = { + scope:host = { + has_activity_intent = study_hard_intent + } + } + add = 0.25 + } + if = { + limit = { + scope:activity = { + has_activity_option = { + category = adult_education_option_books + option = adult_education_books_good + } + } + } + add = 0.25 + } + } + round = yes + } + } + } + else = { + add_trait_xp = { + trait = confucian_education + value = { + value = scope:activity.var:activity_special_type_progression + multiply = { + value = 0 + if = { + limit = { + scope:host = { + has_activity_intent = study_hard_intent + } + } + add = 0.35 + } + if = { + limit = { + scope:activity = { + has_activity_option = { + category = adult_education_option_books + option = adult_education_books_good + } + } + } + add = 0.35 + } + } + round = yes + } + } + } + } + } + } +} + +adult_education_completed_log_entry_effect = { + involved_activity = { + add_activity_log_entry = { + key = adult_education_studies_completed_log + tags = { completed } + score = 100 + show_in_conclusion = yes + character = root + #Effects + root = { + disburse_adult_education_reward_effect = yes + } + } + } +} + +add_relevant_lifestyle_perk_point_effect = { + if = { + limit = { + has_trait = education_diplomacy + } + add_diplomacy_lifestyle_perk_points = $NUMBER$ + } + else_if = { + limit = { + has_trait = education_martial + } + add_martial_lifestyle_perk_points = $NUMBER$ + } + else_if = { + limit = { + has_trait = education_stewardship + } + add_stewardship_lifestyle_perk_points = $NUMBER$ + } + else_if = { + limit = { + has_trait = education_intrigue + } + add_intrigue_lifestyle_perk_points = $NUMBER$ + } + else_if = { + limit = { + has_trait = education_learning + } + add_learning_lifestyle_perk_points = $NUMBER$ + } +} + +disburse_adult_education_reward_effect = { + switch = { # Hand out education traits + trigger = has_character_flag + increase_education_level_1 = { + increase_education_level_1_effect = yes + remove_character_flag = increase_education_level_1 + } + increase_education_level_2 = { + increase_education_level_2_effect = yes + remove_character_flag = increase_education_level_2 + } + increase_education_level_3 = { + increase_education_level_3_effect = yes + remove_character_flag = increase_education_level_3 + } + increase_education_level_4 = { + increase_education_level_4_effect = yes + remove_character_flag = increase_education_level_4 + } + } + switch = { # Hand out lifestyle perks/xp + trigger = has_character_flag + perfect_studies_reward = { + add_relevant_lifestyle_perk_point_effect = { NUMBER = 3 } + remove_character_flag = perfect_studies_reward + } + high_studies_reward = { + add_relevant_lifestyle_perk_point_effect = { NUMBER = 2 } + remove_character_flag = high_studies_reward + } + mid_studies_reward = { + add_relevant_lifestyle_perk_point_effect = { NUMBER = 1 } + remove_character_flag = mid_studies_reward + } + low_studies_reward = { + bp2_lifestyle_xp_gain_per_type_effect = { VALUE = major } + remove_character_flag = low_studies_reward + } + } + # Options rewards + if = { + limit = { + scope:activity = { + has_activity_option = { + category = adult_education_option_books + option = adult_education_books_good + } + } + has_dlc_feature = royal_court + scope:host = { has_royal_court = yes } + } + custom_tooltip = adult_education_books_good_reward + hidden_effect = { + random_dummy_gender_effect = yes + create_artifact_book_effect = { + OWNER = scope:host + CREATOR = scope:dummy_gender + SET_SUBJECT = flag:no + SET_TOPIC = flag:no + } + hidden_effect_new_object = { + scope:newly_created_artifact = { + set_artifact_rarity = illustrious + } + } + scope:activity = { + add_to_variable_list = { + name = artifact_rewards + target = scope:newly_created_artifact + } + } + } + } + else_if = { + limit = { + scope:activity = { + has_activity_option = { + category = adult_education_option_books + option = adult_education_books_good + } + } + } + custom_tooltip = adult_education_books_good_reward + hidden_effect = { + save_temporary_scope_value_as = { + name = should_be_trinket + value = yes + } + random_dummy_gender_effect = yes + save_scope_value_as = { + name = quality + value = 50 + } + save_scope_value_as = { + name = wealth + value = 50 + } + create_artifact_book_effect = { + OWNER = scope:host + CREATOR = scope:dummy_gender + SET_SUBJECT = flag:no + SET_TOPIC = flag:no + } + hidden_effect_new_object = { + scope:newly_created_artifact = { + set_artifact_rarity = illustrious + } + } + scope:activity = { + add_to_variable_list = { + name = artifact_rewards + target = scope:newly_created_artifact + } + } + } + if = { + limit = { + has_trait = education_diplomacy + } + add_diplomacy_skill = 1 + } + else_if = { + limit = { + has_trait = education_martial + } + add_martial_skill = 1 + } + else_if = { + limit = { + has_trait = education_stewardship + } + add_stewardship_skill = 1 + } + else_if = { + limit = { + has_trait = education_intrigue + } + add_intrigue_skill = 1 + } + else_if = { + limit = { + has_trait = education_learning + } + add_learning_skill = 1 + } + } + else_if = { + limit = { + scope:activity = { + has_activity_option = { + category = adult_education_option_books + option = adult_education_books_normal + } + } + } + if = { + limit = { + has_trait = education_diplomacy + } + add_diplomacy_skill = 1 + } + else_if = { + limit = { + has_trait = education_martial + } + add_martial_skill = 1 + } + else_if = { + limit = { + has_trait = education_stewardship + } + add_stewardship_skill = 1 + } + else_if = { + limit = { + has_trait = education_intrigue + } + add_intrigue_skill = 1 + } + else_if = { + limit = { + has_trait = education_learning + } + add_learning_skill = 1 + } + } +} + +increase_education_level_1_type_effect = { + hidden_effect = { remove_trait = education_$TYPE$_1 } + add_trait_force_tooltip = education_$TYPE$_2 + scope:activity = { + add_to_variable_list = { + name = trait_rewards + target = trait:education_$TYPE$_2 + } + } +} + +increase_education_level_2_type_effect = { + hidden_effect = { remove_trait = education_$TYPE$_2 } + add_trait_force_tooltip = education_$TYPE$_3 + scope:activity = { + add_to_variable_list = { + name = trait_rewards + target = trait:education_$TYPE$_3 + } + } +} + +increase_education_level_3_type_effect = { + hidden_effect = { remove_trait = education_$TYPE$_3 } + add_trait_force_tooltip = education_$TYPE$_4 + scope:activity = { + add_to_variable_list = { + name = trait_rewards + target = trait:education_$TYPE$_4 + } + } +} + +increase_education_level_4_type_effect = { + hidden_effect = { remove_trait = education_$TYPE$_4 } + add_trait_force_tooltip = education_$TYPE$_5 + scope:activity = { + add_to_variable_list = { + name = trait_rewards + target = trait:education_$TYPE$_5 + } + } +} + +increase_education_level_1_effect = { + if = { + limit = { has_trait = education_diplomacy } + increase_education_level_1_type_effect = { TYPE = diplomacy } + } + else_if = { + limit = { has_trait = education_martial } + increase_education_level_1_type_effect = { TYPE = martial } + } + else_if = { + limit = { has_trait = education_stewardship } + increase_education_level_1_type_effect = { TYPE = stewardship } + } + else_if = { + limit = { has_trait = education_intrigue } + increase_education_level_1_type_effect = { TYPE = intrigue } + } + else_if = { + limit = { has_trait = education_learning } + increase_education_level_1_type_effect = { TYPE = learning } + } +} + +increase_education_level_2_effect = { + if = { + limit = { has_trait = education_diplomacy } + increase_education_level_2_type_effect = { TYPE = diplomacy } + } + else_if = { + limit = { has_trait = education_martial } + increase_education_level_2_type_effect = { TYPE = martial } + } + else_if = { + limit = { has_trait = education_stewardship } + increase_education_level_2_type_effect = { TYPE = stewardship } + } + else_if = { + limit = { has_trait = education_intrigue } + increase_education_level_2_type_effect = { TYPE = intrigue } + } + else_if = { + limit = { has_trait = education_learning } + increase_education_level_2_type_effect = { TYPE = learning } + } +} + +increase_education_level_3_effect = { + if = { + limit = { has_trait = education_diplomacy } + increase_education_level_3_type_effect = { TYPE = diplomacy } + } + else_if = { + limit = { has_trait = education_martial } + increase_education_level_3_type_effect = { TYPE = martial } + } + else_if = { + limit = { has_trait = education_stewardship } + increase_education_level_3_type_effect = { TYPE = stewardship } + } + else_if = { + limit = { has_trait = education_intrigue } + increase_education_level_3_type_effect = { TYPE = intrigue } + } + else_if = { + limit = { has_trait = education_learning } + increase_education_level_3_type_effect = { TYPE = learning } + } +} + +increase_education_level_4_effect = { + if = { + limit = { has_trait = education_diplomacy } + increase_education_level_4_type_effect = { TYPE = diplomacy } + } + else_if = { + limit = { has_trait = education_martial } + increase_education_level_4_type_effect = { TYPE = martial } + } + else_if = { + limit = { has_trait = education_stewardship } + increase_education_level_4_type_effect = { TYPE = stewardship } + } + else_if = { + limit = { has_trait = education_intrigue } + increase_education_level_4_type_effect = { TYPE = intrigue } + } + else_if = { + limit = { has_trait = education_learning } + increase_education_level_4_type_effect = { TYPE = learning } + } +} + +bp2_lifestyle_xp_gain_per_type_effect = { + if = { + limit = { + has_trait = education_diplomacy + } + add_diplomacy_lifestyle_xp = $VALUE$_lifestyle_xp + } + else_if = { + limit = { + has_trait = education_martial + } + add_martial_lifestyle_xp = $VALUE$_lifestyle_xp + } + else_if = { + limit = { + has_trait = education_stewardship + } + add_stewardship_lifestyle_xp = $VALUE$_lifestyle_xp + } + else_if = { + limit = { + has_trait = education_intrigue + } + add_intrigue_lifestyle_xp = $VALUE$_lifestyle_xp + } + else_if = { + limit = { + has_trait = education_learning + } + add_learning_lifestyle_xp = $VALUE$_lifestyle_xp + } +} + +bp2_goliards_potential_shenanigans_effect = { + custom_tooltip = goliardic_shenanigans_effect_tt + hidden_effect = { + random_list = { + 10 = { + modifier = { + has_diplomacy_lifestyle_trait_trigger = yes + add = 5 + } + send_interface_toast = { + title = $TITLE_VALUE$ + left_icon = root + add_diplomacy_skill = 1 + } + } + 10 = { + modifier = { + has_intrigue_lifestyle_trait_trigger = yes + add = 5 + } + send_interface_toast = { + title = $TITLE_VALUE$ + left_icon = root + add_intrigue_skill = 1 + } + } + 10 = { + send_interface_toast = { + title = $TITLE_VALUE$ + left_icon = root + add_prowess_skill = 1 + } + } + 15 = { + trigger = { + is_eunuch_trigger = no + NOR = { + has_trait = lovers_pox + has_trait = early_great_pox + has_trait = great_pox + has_trait = celibate + has_character_flag = immune_to_disease + } + can_contract_disease_trigger = { DISEASE = lovers_pox } + } + send_interface_toast = { + title = $TITLE_VALUE$ + left_icon = root + contract_disease_effect = { DISEASE = lovers_pox TREATMENT_EVENT = no } + } + } + 15 = { + send_interface_toast = { + title = $TITLE_VALUE$ + left_icon = root + increase_wounds_no_death_effect = { REASON = fight } + } + } + 10 = { + trigger = { + NOT = { has_trait = lifestyle_poet } + } + send_interface_toast = { + title = $TITLE_VALUE$ + left_icon = root + add_trait = lifestyle_poet + } + } + 10 = { + send_interface_toast = { + title = $TITLE_VALUE$ + left_icon = root + if = { + limit = { has_trait = lifestyle_blademaster } + add_trait_xp = { + trait = lifestyle_blademaster + value = 5 + } + } + else = { add_trait = lifestyle_blademaster } + } + } + 5 = { + trigger = { + NOT = { has_trait = drunkard } + drinks_alcohol_trigger = yes + } + send_interface_toast = { + title = $TITLE_VALUE$ + left_icon = root + add_trait = drunkard + } + } + 5 = { + trigger = { can_be_hashishiyah = yes } + send_interface_toast = { + title = $TITLE_VALUE$ + left_icon = root + add_trait = hashishiyah + } + } + 10 = { + send_interface_toast = { + title = $TITLE_VALUE$ + left_icon = root + bp2_lifestyle_xp_gain_per_type_effect = { VALUE = medium } + } + } + 10 = { + trigger = { + has_trait = tourney_participant + } + add_trait_xp = { + trait = tourney_participant + track = wit + value = 5 + } + } + } + } +} + +# Set up a University Teacher +bp2_university_teacher_setup = { + scope:activity.activity_location = { save_scope_as = location } + if = { + limit = { + scope:activity = { + NOT = { + any_attending_character = { + has_character_flag = teacher_1 + } + } + } + } + if = { + limit = { + any_pool_character = { + province = scope:location + is_available_healthy_ai_adult = yes + OR = { + has_character_flag = teacher_1 + has_character_flag = teacher_2 + } + } + } + random_pool_character = { + province = scope:location + limit = { + is_available_healthy_ai_adult = yes + OR = { + has_character_flag = teacher_1 + has_character_flag = teacher_2 + } + } + save_scope_as = teacher_1 + } + } + else_if = { + limit = { + any_pool_character = { + province = scope:location + is_available_adult_education_teacher = yes + } + } + random_pool_character = { + province = scope:location + limit = { + is_available_adult_education_teacher = yes + } + save_scope_as = teacher_1 + } + } + else = { + create_character = { + template = adult_education_teacher + dynasty = none + location = scope:location + save_scope_as = teacher_1 + after_creation = { + add_character_flag = created + } + } + } + scope:teacher_1 = { + if = { + limit = { + has_character_flag = teacher_2 + } + remove_character_flag = teacher_2 + } + if = { + limit = { + has_character_flag = student_1 + } + remove_character_flag = student_1 + } + if = { + limit = { + has_character_flag = student_2 + } + remove_character_flag = student_2 + } + add_to_activity = scope:activity + add_character_flag = teacher_1 + } + } + if = { + limit = { + scope:activity = { + NOT = { + any_attending_character = { + has_character_flag = teacher_2 + } + } + } + } + if = { + limit = { + any_pool_character = { + province = scope:location + is_available_healthy_ai_adult = yes + OR = { + has_character_flag = teacher_1 + has_character_flag = teacher_2 + } + trigger_if = { + limit = { exists = scope:teacher_1 } + this != scope:teacher_1 + } + } + } + random_pool_character = { + province = scope:location + limit = { + is_available_healthy_ai_adult = yes + OR = { + has_character_flag = teacher_1 + has_character_flag = teacher_2 + } + trigger_if = { + limit = { exists = scope:teacher_1 } + this != scope:teacher_1 + } + } + save_scope_as = teacher_2 + } + } + else_if = { + limit = { + any_pool_character = { + province = scope:location + is_available_adult_education_teacher = yes + trigger_if = { + limit = { exists = scope:teacher_1 } + this != scope:teacher_1 + } + } + } + random_pool_character = { + province = scope:location + limit = { + is_available_adult_education_teacher = yes + trigger_if = { + limit = { exists = scope:teacher_1 } + this != scope:teacher_1 + } + } + save_scope_as = teacher_2 + } + } + else = { + create_character = { + template = adult_education_teacher + dynasty = none + location = scope:location + save_scope_as = teacher_2 + after_creation = { + add_character_flag = created + } + } + } + scope:teacher_2 = { + if = { + limit = { + has_character_flag = teacher_1 + } + remove_character_flag = teacher_1 + } + if = { + limit = { + has_character_flag = student_1 + } + remove_character_flag = student_1 + } + if = { + limit = { + has_character_flag = student_2 + } + remove_character_flag = student_2 + } + add_to_activity = scope:activity + add_character_flag = teacher_2 + } + } +} + +# Set up a University student +bp2_university_student_setup = { + scope:activity.activity_location = { save_scope_as = location } + if = { + limit = { + NOT = { + scope:activity = { + any_attending_character = { + has_character_flag = student_1 + } + } + } + } + if = { + limit = { + any_pool_character = { + province = scope:location + is_available_healthy_ai_adult = yes + NOT = { + exists = involved_activity + } + exists = this + } + } + random_pool_character = { + province = scope:location + limit = { + is_available_healthy_ai_adult = yes + NOT = { + exists = involved_activity + } + } + save_scope_as = student_1 + } + } + else = { + create_character = { + template = adult_education_student + dynasty = none + location = scope:location + save_scope_as = student_1 + after_creation = { + add_character_flag = created + } + } + scope:student_1 = { + add_character_flag = generated_character_uni + } + } + scope:student_1 = { + if = { + limit = { + has_character_flag = teacher_1 + } + remove_character_flag = teacher_1 + } + if = { + limit = { + has_character_flag = teacher_2 + } + remove_character_flag = teacher_2 + } + if = { + limit = { + has_character_flag = student_2 + } + remove_character_flag = student_2 + } + add_to_activity = scope:activity + add_character_flag = student_1 + } + } + + if = { + limit = { + NOT = { + scope:activity = { + any_attending_character = { + has_character_flag = student_2 + } + } + } + } + if = { + limit = { + any_pool_character = { + province = scope:location + is_available_healthy_ai_adult = yes + NOT = { + exists = involved_activity + } + exists = this + } + } + random_pool_character = { + province = scope:location + limit = { + is_available_healthy_ai_adult = yes + NOT = { + exists = involved_activity + } + } + save_scope_as = student_2 + } + } + else = { + create_character = { + template = adult_education_student + dynasty = none + location = scope:location + save_scope_as = student_2 + after_creation = { + add_character_flag = created + } + } + scope:student_2 = { + add_character_flag = generated_character_uni + } + } + scope:student_2 = { + if = { + limit = { + has_character_flag = teacher_1 + } + remove_character_flag = teacher_1 + } + if = { + limit = { + has_character_flag = teacher_2 + } + remove_character_flag = teacher_2 + } + if = { + limit = { + has_character_flag = student_1 + } + remove_character_flag = student_1 + } + add_to_activity = scope:activity + add_character_flag = student_2 + } + } +} + +# Adoption effect +adopt_effect = { + $ADOPTER$ = { + adopt = $CHILD$ + $CHILD$ = { + set_house = $ADOPTER$.house + # Remove bastard traits + if = { + limit = { + has_any_bastard_trait_trigger = yes + } + remove_all_bastard_traits = yes + } + } + # Parochial vassals hate this + if = { + limit = { + NOR = { + has_game_rule = adoption_always_allowed + culture = { has_cultural_parameter = allows_adoption } + } + } + every_vassal = { + custom = every_courtly_vassal_actor + vassal_stance = courtly + add_opinion = { + modifier = angry_opinion + opinion = -20 + target = $ADOPTER$ + } + } + } + # Zealous vassals *hate* you adopting a heretic + if = { + limit = { + faith = { + faith_hostility_level = { + target = $CHILD$.faith + value >= faith_evil_level + } + } + } + every_vassal = { + custom = every_zealot_vassal_actor + vassal_stance = zealot + add_opinion = { + modifier = angry_opinion + opinion = -25 + target = $ADOPTER$ + } + } + } + else_if = { + limit = { + faith = { + faith_hostility_level = { + target = $CHILD$.faith + value >= faith_hostile_level + } + } + } + every_vassal = { + custom = every_zealot_vassal_actor + vassal_stance = zealot + add_opinion = { + modifier = angry_opinion + opinion = -20 + target = $ADOPTER$ + } + } + } + else_if = { + limit = { + faith = { + faith_hostility_level = { + target = $CHILD$.faith + value >= faith_astray_level + } + } + } + every_vassal = { + custom = every_zealot_vassal_actor + vassal_stance = zealot + add_opinion = { + modifier = angry_opinion + opinion = -10 + target = $ADOPTER$ + } + } + } + # Minority vassals *love* you adopting a foreigner + if = { + limit = { + OR = { + faith = { + faith_hostility_level = { + target = $CHILD$.faith + value >= faith_astray_level + } + } + NOT = { culture = $CHILD$.culture } + } + } + every_vassal = { + custom = every_minority_vassal_actor + vassal_stance = minority + add_opinion = { + modifier = respect_opinion + opinion = 25 + target = $ADOPTER$ + } + } + } + # Your other children hate this + every_child = { + custom = every_non_content_child + add_opinion = { + modifier = angry_opinion + opinion = -20 + target = $ADOPTER$ + } + } + # Player heirs *hate* you adopting someone to be your new heir + if = { + limit = { + exists = player_heir + OR = { + player_heir.age < $CHILD$.age + player_heir = { has_trait = ambitious } + } + NOT = { + player_heir = { has_trait = humble } + player_heir = { has_trait = content } + player_heir = { has_trait = forgiving } + } + } + player_heir = { + progress_towards_rival_effect = { + CHARACTER = $ADOPTER$ + REASON = rival_adopted_another_heir + OPINION = default_rival_opinion + } + set_relation_rival = { + target = $CHILD$ + reason = rival_stole_my_throne + } + } + } + } + #adopted child should travel to new parent + $CHILD$ = { + if = { + limit = { exists = $ADOPTER$.capital_province } # Ward heads to landed Guardian + $ADOPTER$.capital_province = { save_scope_as = destination_province } + } + else_if = { # Ward heads to Guardian's host + limit = { exists = $ADOPTER$.host.capital_province } + $ADOPTER$.host.capital_province = { save_scope_as = destination_province } + } + else = { + $ADOPTER$.location = { save_scope_as = destination_province } + } + save_scope_as = adoptee + $ADOPTER$ = { + save_scope_as = adopter + } + if = { + limit = { + any_relation = { + type = guardian + NOT = { this = $ADOPTER$ } + } + } + random_relation = { + type = guardian + limit = { NOT = { this = $ADOPTER$ } } + save_scope_as = old_guardian + } + remove_guardian_effect = { + GUARDIAN = scope:old_guardian + WARD = scope:adoptee + RETURN_WARD = no + HIDE_OPINION = no + } + } + if = { + limit = { NOT = { scope:destination_province = $CHILD$.location } } + set_variable = { + name = adoptee_travelling_to_adopter + years = 2 + value = scope:adopter + } + start_travel_plan = { + destination = scope:destination_province + on_start_on_action = on_adoptee_depart_for_adopter + on_travel_planner_cancel_on_action = on_adoptee_depart_travel_planner_exit + on_arrival_on_action = on_adoptee_arrive_at_adopter + on_arrival_destinations = last + return_trip = no # One way + } + custom_tooltip = adoptee_leaves_for_adopter_tt + } + if = { + limit = { + $ADOPTER$ = { + has_blood_brother = yes + any_relation = { + type = blood_brother + NOT = { + is_close_family_of = $CHILD$ + } + } + } + } + $ADOPTER$ = { + random_relation = { + type = blood_brother + save_scope_as = other_blood_brother + } + } + mpo_blood_brother_new_family_member_opinion_effect = yes + } + } +} + +# Adventurer Adoption effect +adventurer_adopt_effect = { + $ADOPTER$ = { + hidden_effect = { adopt = $CHILD$ } + $CHILD$ = { + hidden_effect = { + set_house = $ADOPTER$.house + found_cadet_house_decision_effect = { + CHARACTER = scope:recipient + PRESTIGE = 0 + } + } + custom_tooltip = adventurer_adoption_child_tt + # Remove bastard traits + if = { + limit = { + has_any_bastard_trait_trigger = yes + } + remove_all_bastard_traits = yes + } + # Remove disinherited if you're the house head. + if = { + limit = { + $ADOPTER$.house.house_head = $ADOPTER$ + has_trait = disinherited + } + remove_trait = disinherited + } + } + # Your other children hate this + every_child = { + custom = every_non_content_child + add_opinion = { + modifier = angry_opinion + opinion = -20 + target = $ADOPTER$ + } + } + # Player heirs *hate* you adopting someone to be your new heir + if = { + limit = { + exists = player_heir + OR = { + player_heir.age < $CHILD$.age + player_heir = { has_trait = ambitious } + } + NOR = { + player_heir = { has_trait = humble } + player_heir = { has_trait = content } + player_heir = { has_trait = forgiving } + } + } + player_heir = { + progress_towards_rival_effect = { + CHARACTER = $ADOPTER$ + REASON = rival_adopted_another_heir + OPINION = default_rival_opinion + } + set_relation_rival = { + target = $CHILD$ + reason = rival_stole_my_throne + } + } + } + } + #adopted child should travel to new parent + $CHILD$ = { + if = { + limit = { exists = $ADOPTER$.capital_province } # Ward heads to landed Guardian + $ADOPTER$.capital_province = { save_scope_as = destination_province } + } + else_if = { # Ward heads to Guardian's host + limit = { exists = $ADOPTER$.host.capital_province } + $ADOPTER$.host.capital_province = { save_scope_as = destination_province } + } + else = { + $ADOPTER$.location = { save_scope_as = destination_province } + } + save_scope_as = adoptee + $ADOPTER$ = { + save_scope_as = adopter + } + if = { + limit = { + any_relation = { + type = guardian + NOT = { this = $ADOPTER$ } + } + } + random_relation = { + type = guardian + limit = { NOT = { this = $ADOPTER$ } } + save_scope_as = old_guardian + } + remove_guardian_effect = { + GUARDIAN = scope:old_guardian + WARD = scope:adoptee + RETURN_WARD = no + HIDE_OPINION = no + } + } + if = { + limit = { NOT = { scope:destination_province = $CHILD$.location } } + set_variable = { + name = adoptee_travelling_to_adopter + years = 2 + value = scope:adopter + } + start_travel_plan = { + destination = scope:destination_province + on_start_on_action = on_adoptee_depart_for_adopter + on_travel_planner_cancel_on_action = on_adoptee_depart_travel_planner_exit + on_arrival_on_action = on_adoptee_arrive_at_adopter + on_arrival_destinations = last + return_trip = no # One way + } + custom_tooltip = adoptee_leaves_for_adopter_tt + } + #Enters into blood brotherhood family bond + if = { + limit = { + $ADOPTER$ = { + has_blood_brother = yes + any_relation = { + type = blood_brother + NOT = { + is_close_family_of = $CHILD$ + } + } + } + } + $ADOPTER$ = { + random_relation = { + type = blood_brother + save_scope_as = other_blood_brother + } + } + mpo_blood_brother_new_family_member_opinion_effect = yes + } + } +} diff --git a/N3OW/common/scripted_effects/05_dlc_fp3_scripted_effects.txt b/N3OW/common/scripted_effects/05_dlc_fp3_scripted_effects.txt new file mode 100644 index 00000000..ccf5b590 --- /dev/null +++ b/N3OW/common/scripted_effects/05_dlc_fp3_scripted_effects.txt @@ -0,0 +1,1268 @@ +################################################## +# Struggle & Struggle Decisions +################################################## + +##### Struggle Ending ##### +fp3_end_persian_struggle_effect = { + if = { + limit = { + exists = title:e_arabia.holder + title:e_arabia.holder = { has_character_modifier = fp3_struggle_caliph_super_suspicious_modifier } + } + title:e_arabia.holder = { remove_character_modifier = fp3_struggle_caliph_super_suspicious_modifier } + } + + every_in_global_list = { # We de-flag chars (surprisingly performance friendly, from all possible options) + variable = fp3_intro_flag_character_list + if = { + limit = { has_character_flag = fp3_struggle_intro_event_flag } # Since only alive chars have flags, we don't need to check for anything else + remove_character_flag = fp3_struggle_intro_event_flag + } + } + + # Global variable tracking. + ## For usage in councillor tasks. + set_global_variable = { + name = fp3_struggle_ending + value = $FLAG$ + } + ## For debug purposes. + if = { + limit = { gather_debug_variables_for_persian_struggle_trigger = yes } + increment_global_variable_effect = { + VAL = current_year + VAR = sp_end_date + } + } + + every_player = { + limit = { fp3_does_this_player_care_about_the_persian_struggle = yes } # Needs to be checked before the struggle ends due to race condition issues + add_to_list = player_to_notify # Making a list so stuff is tiggered after the struggle ends, to make extra sure I don't break anything. + } + + every_in_list = { # Then we *actually* notify palyers, making sure the struggle has already ended + list = player_to_notify + limit = { + this != root + } + trigger_event = $EVENT$ + } + struggle:persian_struggle ?= { end_struggle = $ENDING$ } +} + +#### MISC STRUGGLE ENDING(s) STUFF #### +fp3_ending_effects_assertion = { + # Save Sunni caliph or previous one as scope:struggle_liege + fp3_save_sunni_caliph_or_previous_effect = yes + + dynasty ?= { add_dynasty_prestige = 10000 } + + if = { + limit = { + NOT = { title:e_arabia.holder.dynasty ?= dynasty } + } + title:e_arabia.holder.dynasty ?= { add_dynasty_prestige = 10000 } + } + + custom_tooltip = fp3_struggle_assertion_subjugation_expanded_tt + custom_tooltip = fp3_struggle_assertion_caliphal_muslim_faction_protection_tt + + hidden_effect = { + destroy_title = title:e_persia + title:d_sunni = { + set_variable = { + name = dar_al_islam + value = yes + } + } + house = { + set_variable = { + name = subjugations_expanded + value = yes + } + } + title:e_arabia.holder.house = { + set_variable = { + name = subjugations_expanded + value = yes + } + } + } + + struggle:persian_struggle = { + title:e_arabia.holder = { + add_prestige = 5000 + custom_tooltip = fp3_struggle_assertion_caliph_detractor_tt + # Destroy Persia, make each of its kingdoms a de jure part of the Caliph's central title (assuming he still has an empire) + custom_tooltip = { + text = fp3_struggle_assertion_arabia_absorb_persia_swing_rewards_tt + title:e_persia = { + every_in_de_jure_hierarchy = { + limit = { tier = tier_kingdom } + set_de_jure_liege_title = title:e_arabia + } + } + } + # transfer the supporter trait to the next generation while detractors fade away + custom_tooltip = { + text = fp3_struggle_assertion_transfer_supporter_to_next_gen_tt + struggle:persian_struggle = { + every_involved_ruler = { + limit = { + has_trait = fp3_struggle_supporter + NOT = { + primary_title = { is_mercenary_company = yes } + } + } + every_child = { + if = { + limit = { + NOR = { + has_trait = fp3_struggle_supporter + primary_title ?= { is_mercenary_company = yes } + } + } + if = { + limit = { has_trait = fp3_struggle_detractor } + remove_trait = fp3_struggle_detractor + } + add_trait = fp3_struggle_supporter + } + } + } + + every_interloper_ruler = { + limit = { + has_trait = fp3_struggle_supporter + NOT = { + primary_title = { is_mercenary_company = yes } + } + } + every_child = { + if = { + limit = { + NOR = { + has_trait = fp3_struggle_supporter + primary_title ?= { is_mercenary_company = yes } + } + } + if = { + limit = { has_trait = fp3_struggle_detractor } + remove_trait = fp3_struggle_detractor + } + add_trait = fp3_struggle_supporter + } + } + } + } + } + custom_tooltip = fp3_struggle_persia_ending_assertion_faction_reluctance_tt + } + hidden_effect = { + every_involved_ruler = { + limit = { has_trait = fp3_struggle_detractor } + custom = every_detractor + title:e_arabia.holder = { + add_opinion = { + modifier = caliphal_authority + target = prev + } + } + } + } + # Vassalize supporters + every_involved_ruler = { + limit = { + top_liege = this + OR = { + has_trait = fp3_struggle_supporter + scope:struggle_liege = { + has_hook_of_type = { + target = prev + type = caliphal_submission_hook + } + } + } + NOR = { + this = scope:struggle_liege + primary_title = { is_mercenary_company = yes } + } + } + custom = fp3_struggle_assertion_vassalization_rewards_tt + create_title_and_vassal_change = { + type = swear_fealty + save_scope_as = change + add_claim_on_loss = no + } + change_liege = { + liege = scope:struggle_liege + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + # Involved event + every_involved_ruler = { + limit = { this != root } + trigger_event = fp3_struggle.0072 + } + # Interloper event + every_interloper_ruler = { + limit = { this != root } + trigger_event = fp3_struggle.0072 + } + } + + faith = { + change_fervor = { + value = 50 + desc = fervor_gain_strengthen_caliphate + } + # Propagate the Caliph's Faith in the struggle region + custom_tooltip = { + text = fp3_struggle_assertion_spread_faith_through_struggle_region_tt + struggle:persian_struggle = { + every_involved_county = { + limit = { + faith != root.faith + } + random = { + chance = fp3_strengthen_caliphate_ending_conversion_chance_percent_value + set_county_faith = root.faith + } + } + + every_involved_ruler = { + limit = { + NOR = { + faith = root.faith + primary_title = { is_mercenary_company = yes } + } + } + random = { + chance = fp3_strengthen_caliphate_ending_conversion_chance_percent_value + set_character_faith = root.faith + } + } + } + } + # Sunni faiths gets a bonus for the rest of the game converting other counties + custom_tooltip = { + text = struggle_persia_ending_assertion_boost_sunni_county_conversion_tt + set_global_variable = { + name = fp3_struggle_ending_assertion_school + value = flag:sunni + } + } + } + + if = { + limit = { is_ai = no } + add_character_flag = { + flag = fp3_abassid_strong_achievement_unlocked + years = 4 + } + } +} + +fp3_struggle_ending_shia_caliphate_effects = { + ### CHARACTER + give_nickname = nick_the_righteous_caliph + + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:e_persia = { + change_title_holder = { + holder = root + change = scope:title_change + } + save_scope_as = title_e_persia + } + resolve_title_and_vassal_change = scope:title_change + + save_scope_as = founder + claim_the_imamate_scripted_effect = yes + add_piety = 5000 + + ### FAITH + faith = { + change_fervor = { + value = 50 + desc = fervor_gain_shia_caliphate + } + if = { + limit = { has_doctrine = muhammad_succession_muhakkima_doctrine } + # Muhakkima faiths gets a bonus for the rest of the game converting other counties + custom_tooltip = { + text = struggle_persia_ending_assertion_boost_muhakkima_county_conversion_tt + set_global_variable = { + name = fp3_struggle_ending_assertion_school + value = flag:muhakkima + } + } + } + else_if = { + limit = { has_doctrine = muhammad_succession_zandaqa_doctrine } + # Zandaqa faiths gets a bonus for the rest of the game converting other counties + custom_tooltip = { + text = struggle_persia_ending_assertion_boost_zandaqa_county_conversion_tt + set_global_variable = { + name = fp3_struggle_ending_assertion_school + value = flag:zandaqa + } + } + } + else_if = { + limit = { has_doctrine = muhammad_succession_sunni_doctrine } + # Sunni faiths gets a bonus for the rest of the game converting other counties + custom_tooltip = { + text = struggle_persia_ending_assertion_boost_sunni_county_conversion_tt + set_global_variable = { + name = fp3_struggle_ending_assertion_school + value = flag:sunni + } + } + } + else = { + # Shia faiths gets a bonus for the rest of the game converting other counties + custom_tooltip = { + text = struggle_persia_ending_assertion_boost_shia_county_conversion_tt + set_global_variable = { + name = fp3_struggle_ending_assertion_school + value = flag:shia + } + } + } + # Propagate the Caliph's Faith in the struggle region + custom_tooltip = { + text = fp3_struggle_ending_shia_caliphate_spread_faith_through_struggle_region_tt + struggle:persian_struggle = { + every_involved_county = { + limit = { + faith != root.faith + } + random = { + chance = fp3_shia_caliphate_ending_conversion_chance_percent_value + set_county_faith = root.faith + } + } + every_involved_ruler = { + limit = { + NOR = { + faith = root.faith + primary_title = { is_mercenary_company = yes } + } + } + random = { + chance = fp3_shia_caliphate_ending_conversion_chance_percent_value + set_character_faith = root.faith + } + } + } + } + } + + if = { + limit = { is_ai = no } + add_character_flag = { + flag = fp3_challenger_caliphate_achievement_unlocked + years = 4 + } + } +} + +fp3_struggle_ending_vassalize_caliph_effects = { + + # We vassalize the caliph, their vassals might use the confusion to declare independence + create_title_and_vassal_change = { # Note: do not attempt to simulate faction logic, it is too volatile + type = usurped + save_scope_as = change + } + title:e_arabia.holder = { + every_vassal = { + add_to_list = vassals_to_transfer + } + add_to_list = vassals_to_transfer + } + title:e_arabia = { + change_title_holder_include_vassals = { + holder = root + change = scope:change + } + save_scope_as = title_e_arabia + } + title:d_sunni.holder = { + change_liege = { + liege = root + change = scope:change + } + } + hidden_effect = { + every_in_list = { + list = vassals_to_transfer + limit = { + root != liege + } + change_liege = { + liege = root + change = scope:change + } + } + } + + resolve_title_and_vassal_change = scope:change + + dynasty ?= { + add_dynasty_prestige = 5000 + } + + give_nickname = nick_the_caliph_protector + + add_prestige = 5000 + + # Unlocks permanent bonuses: + house = { + custom_tooltip = fp3_struggle_request_honorary_title_interactions_rewards_tt + custom_tooltip = fp3_struggle_request_unity_interference_interactions_rewards_tt + } + + if = { + limit = { is_ai = no } + add_character_flag = { + flag = fp3_vassalize_the_caliph_achievement_unlocked + years = 4 + } + } +} + +#### REMOVE CONTRACT COOLDOWN #### +fp3_remove_vassal_contract_cooldown_for_tension_effect = { + if = { + limit = { is_struggle_phase = struggle_persia_phase_stabilisation } + every_involved_ruler = { + remove_interaction_cooldown = liege_modify_vassal_contract_interaction + remove_interaction_cooldown = vassal_modify_vassal_contract_interaction + remove_interaction_cooldown = ai_only_liege_modify_vassal_contract_interaction + remove_interaction_cooldown = ai_only_vassal_modify_vassal_contract_interaction + } + } +} + +fp3_struggle_apply_independent_vassalage_catalyst_effect = { + $NEW_LIEGE$ = { + # Involved characters vassalising an independent involved ruler. + if = { + limit = { + any_character_struggle = { + involvement = involved + activate_struggle_catalyst_secondary_character_involvement_involved_trigger = { + CATALYST = catalyst_vassalize_independent_ruler + CHAR = $NEW_VASSAL$ + } + } + } + every_character_struggle = { + involvement = involved + limit = { + activate_struggle_catalyst_secondary_character_involvement_involved_trigger = { + CATALYST = catalyst_vassalize_independent_ruler + CHAR = $NEW_VASSAL$ + } + } + activate_struggle_catalyst = { + catalyst = catalyst_vassalize_independent_ruler + character = $NEW_LIEGE$ + } + log_debug_variable_for_persian_struggle_effect = { VAR = stabil_catalyst_vassalize_independent_ruler } + } + } + } +} + +fp3_struggle_apply_supporter_detractor_war_won_catalysts_effect = { + # During the Persian Struggle, a supporter wins any war in the region. + ## Unfair wars. + if = { + limit = { + has_trait = fp3_struggle_supporter + # Scope:attacker won? + trigger_if = { + limit = { + scope:winner = scope:attacker + exists = scope:war.var:struggle_defender_tier + } + highest_held_title_tier > scope:war.var:struggle_defender_tier + } + # Else, scope:defender won. + trigger_if = { + limit = { + scope:winner = scope:defender + exists = scope:war.var:struggle_attacker_tier + } + highest_held_title_tier > scope:war.var:struggle_attacker_tier + } + any_character_struggle = { + involvement = involved + activate_struggle_catalyst_warfare_check_attacker_involvement_trigger = { + CATALYST = catalyst_supporter_win_unfair_war_within_the_region + VAR_SCOPE = scope:war + INVOLVEMENT = involved + } + } + } + every_character_struggle = { + involvement = involved + limit = { + activate_struggle_catalyst_warfare_check_attacker_involvement_trigger = { + CATALYST = catalyst_supporter_win_unfair_war_within_the_region + VAR_SCOPE = scope:war + INVOLVEMENT = involved + } + } + activate_struggle_catalyst = { + catalyst = catalyst_supporter_win_unfair_war_within_the_region + character = scope:winner + } + scope:war = { set_variable = used_for_struggle_catalyst_on_war_ended } + log_debug_variable_for_persian_struggle_effect = { VAR = stabil_catalyst_supporter_win_unfair_war_within_the_region } + } + } + ## Fair wars. + else_if = { + limit = { + has_trait = fp3_struggle_supporter + # Scope:attacker won? + trigger_if = { + limit = { + scope:winner = scope:attacker + exists = scope:war.var:struggle_defender_tier + } + highest_held_title_tier <= scope:war.var:struggle_defender_tier + } + # Else, scope:defender won. + trigger_if = { + limit = { + scope:winner = scope:defender + exists = scope:war.var:struggle_attacker_tier + } + highest_held_title_tier <= scope:war.var:struggle_attacker_tier + } + scope:war = { + NOT = { has_variable = used_for_struggle_catalyst_on_war_ended } + } + any_character_struggle = { + involvement = involved + activate_struggle_catalyst_warfare_check_attacker_involvement_trigger = { + CATALYST = catalyst_supporter_win_fair_war_within_the_region + VAR_SCOPE = scope:war + INVOLVEMENT = involved + } + } + } + every_character_struggle = { + involvement = involved + limit = { + activate_struggle_catalyst_warfare_check_attacker_involvement_trigger = { + CATALYST = catalyst_supporter_win_fair_war_within_the_region + VAR_SCOPE = scope:war + INVOLVEMENT = involved + } + } + activate_struggle_catalyst = { + catalyst = catalyst_supporter_win_fair_war_within_the_region + character = scope:winner + } + scope:war = { set_variable = used_for_struggle_catalyst_on_war_ended } + log_debug_variable_for_persian_struggle_effect = { VAR = stabil_catalyst_supporter_win_fair_war_within_the_region } + } + } + # During the Persian Struggle, a detractor wins any war in the region. + ## Unfair wars. + else_if = { + limit = { + has_trait = fp3_struggle_detractor + # Scope:attacker won? + trigger_if = { + limit = { + scope:winner = scope:attacker + exists = scope:war.var:struggle_defender_tier + } + highest_held_title_tier > scope:war.var:struggle_defender_tier + } + # Else, scope:defender won. + trigger_if = { + limit = { + scope:winner = scope:defender + exists = scope:war.var:struggle_attacker_tier + } + highest_held_title_tier > scope:war.var:struggle_attacker_tier + } + scope:war = { + NOT = { has_variable = used_for_struggle_catalyst_on_war_ended } + } + any_character_struggle = { + involvement = involved + activate_struggle_catalyst_warfare_check_attacker_involvement_trigger = { + CATALYST = catalyst_detractor_win_unfair_war_within_the_region + VAR_SCOPE = scope:war + INVOLVEMENT = involved + } + } + } + every_character_struggle = { + involvement = involved + limit = { + activate_struggle_catalyst_warfare_check_attacker_involvement_trigger = { + CATALYST = catalyst_detractor_win_unfair_war_within_the_region + VAR_SCOPE = scope:war + INVOLVEMENT = involved + } + } + activate_struggle_catalyst = { + catalyst = catalyst_detractor_win_unfair_war_within_the_region + character = scope:winner + } + scope:war = { set_variable = used_for_struggle_catalyst_on_war_ended } + log_debug_variable_for_persian_struggle_effect = { VAR = unrest_catalyst_detractor_win_unfair_war_within_the_region } + } + } + ## Fair wars. + else_if = { + limit = { + has_trait = fp3_struggle_detractor + # Scope:attacker won? + trigger_if = { + limit = { + scope:winner = scope:attacker + exists = scope:war.var:struggle_defender_tier + } + highest_held_title_tier <= scope:war.var:struggle_defender_tier + } + # Else, scope:defender won. + trigger_if = { + limit = { + scope:winner = scope:defender + exists = scope:war.var:struggle_attacker_tier + } + highest_held_title_tier <= scope:war.var:struggle_attacker_tier + } + any_character_struggle = { + involvement = involved + activate_struggle_catalyst_warfare_check_attacker_involvement_trigger = { + CATALYST = catalyst_detractor_win_fair_war_within_the_region + VAR_SCOPE = scope:war + INVOLVEMENT = involved + } + } + } + every_character_struggle = { + involvement = involved + limit = { + activate_struggle_catalyst_warfare_check_attacker_involvement_trigger = { + CATALYST = catalyst_detractor_win_fair_war_within_the_region + VAR_SCOPE = scope:war + INVOLVEMENT = involved + } + } + activate_struggle_catalyst = { + catalyst = catalyst_detractor_win_fair_war_within_the_region + character = scope:winner + } + scope:war = { set_variable = used_for_struggle_catalyst_on_war_ended } + log_debug_variable_for_persian_struggle_effect = { VAR = unrest_catalyst_detractor_win_fair_war_within_the_region } + } + } +} + +################################### +# MISC Effects +################################### +remove_any_education_traits_effect = { # Looks ugly but performance is better than with an IF check + remove_trait = education_martial_1 + remove_trait = education_martial_2 + remove_trait = education_martial_3 + remove_trait = education_martial_4 + remove_trait = education_martial_prowess_1 + remove_trait = education_martial_prowess_2 + remove_trait = education_martial_prowess_3 + remove_trait = education_martial_prowess_4 + remove_trait = education_learning_1 + remove_trait = education_learning_2 + remove_trait = education_learning_3 + remove_trait = education_learning_4 + remove_trait = education_intrigue_1 + remove_trait = education_intrigue_2 + remove_trait = education_intrigue_3 + remove_trait = education_intrigue_4 + remove_trait = education_stewardship_1 + remove_trait = education_stewardship_2 + remove_trait = education_stewardship_3 + remove_trait = education_stewardship_4 + remove_trait = education_diplomacy_1 + remove_trait = education_diplomacy_2 + remove_trait = education_diplomacy_3 + remove_trait = education_diplomacy_4 +} + +fp3_struggle_ending_concession_effects = { + # All the involved independent rulers get a white peace + custom_tooltip = { + text = fp3_concession_white_peace_tt + struggle:persian_struggle = { + every_involved_ruler = { + limit = { + top_liege = this + NOT = { + primary_title = { is_mercenary_company = yes } + } + } + save_scope_as = peace_target + scope:peace_target = { + every_primary_war_enemy = { + limit = { + top_liege = this + NOT = { + primary_title = { is_mercenary_company = yes } + } + fp3_character_any_involvement_persian_struggle_trigger = yes + } + every_character_war = { + limit = { + OR = { + primary_attacker = scope:peace_target + primary_defender = scope:peace_target + } + } + end_war = white_peace + } + } + } + } + } + + # Silk Road bonus towards prosperity if and when Persia's turmoil comes to an end + tgp_silk_road_iranian_intermezzo_ending_effect = yes + } + + # All the involved independent rulers gain truces with each other + custom_tooltip = { + text = fp3_concession_truce_tt + struggle:persian_struggle = { + every_involved_ruler = { + limit = { + top_liege = this + NOT = { + primary_title = { is_mercenary_company = yes } + } + } + save_scope_as = first_truce + every_character_struggle = { + limit = { is_struggle_type = persian_struggle } + every_involved_ruler = { + limit = { + NOR = { + this = scope:first_truce + primary_title = { is_mercenary_company = yes } + } + top_liege = this + } + add_truce_both_ways = { + character = scope:first_truce + days = 18250 + name = fp3_concession_truce_reason + } + } + } + } + } + } + + # All involved rulers, independent or not, lose all their claims + custom_tooltip = { + text = fp3_concession_lose_claim_tt + struggle:persian_struggle = { + every_involved_ruler = { + save_scope_as = claim_loser + every_claim = { + scope:claim_loser = { remove_claim = prev } + } + } + } + } + + custom_tooltip = { + text = fp3_concession_rebuilding_efforts_tt + struggle:persian_struggle = { + every_involved_ruler = { + limit = { + has_trait = fp3_struggle_supporter + is_house_head = yes + NOT = { + primary_title = { is_mercenary_company = yes } + } + } + house ?= { + add_house_modifier = { + modifier = fp3_house_modifier_rebuilding_efforts + years = fp3_house_modifier_concession_ending_duration + } + } + } + } + } + + custom_tooltip = { + text = fp3_concession_frontier_ambitions_tt + struggle:persian_struggle = { + every_involved_ruler = { + limit = { + has_trait = fp3_struggle_detractor + is_house_head = yes + NOT = { + primary_title = { is_mercenary_company = yes } + } + } + house ?= { + add_house_modifier = { + modifier = fp3_house_modifier_frontier_ambitions + years = fp3_house_modifier_concession_ending_duration + } + } + } + } + } +} + + + # Strong independent iranian ruler becomes persian emperor, frees all the iranian subjects and has an easier time vassalizing and or converting them +fp3_struggle_rekindle_iran_effects = { + give_nickname = nick_the_rekindler_of_iran + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + title:e_persia = { + change_title_holder = { + holder = root + change = scope:title_change + } + save_scope_as = title_e_persia + } + resolve_title_and_vassal_change = scope:title_change + + custom_tooltip = fp3_event_troops_reformer_effect_tt + hidden_effect = { + spawn_army = { + name = persian_warriors + men_at_arms = { + type = asawira + stacks = 5 + } + men_at_arms = { + type = ayyar + stacks = 10 + } + location = this.capital_province + uses_supply = yes + inheritable = yes + } + spawn_army = { + name = persian_warriors + men_at_arms = { + type = asawira + stacks = 5 + } + men_at_arms = { + type = ayyar + stacks = 10 + } + location = this.capital_province + uses_supply = yes + inheritable = yes + } + } + add_prestige = 5000 + + # increase the religious conversion demand and offer vassalage acceptance for this character + dynasty = { + add_dynasty_modifier = { modifier = fp3_rekindler_of_iran_modifier } + custom_tooltip = fp3_rekindler_of_iran_modifier_vassalization_effect_tt + custom_tooltip = fp3_rekindler_of_iran_modifier_conversion_effect_tt + add_dynasty_prestige = 10000 + } + + if = { + limit = { + scope:struggle_persia_ending_rekindle_iran_decision_option_secret_faith = yes + } + set_character_faith_with_conversion = secret_faith + hidden_effect = { + remove_character_secret_faith = yes + } + } + + faith = { + custom_tooltip = { + text = fp3_iranian_faith_for_rekindle_persia_spread_to_fellow_iranians_tt + struggle:persian_struggle = { + every_involved_county = { + limit = { + culture = { has_cultural_pillar = heritage_iranian } + faith != scope:propagated_faith + } + random = { + chance = fp3_iranian_faith_for_rekindle_persia_conversion_chance_percent_value + set_county_faith = scope:propagated_faith + } + } + every_involved_ruler = { + limit = { + culture = { has_cultural_pillar = heritage_iranian } + faith != scope:propagated_faith + NOT = { + primary_title = { is_mercenary_company = yes } + } + } + random = { + chance = fp3_iranian_faith_for_rekindle_persia_conversion_chance_percent_value + set_character_faith = scope:propagated_faith + } + } + } + } + } + + struggle:persian_struggle = { + every_involved_ruler = { + limit = { culture = { has_cultural_pillar = heritage_iranian } } + # Add a character modifiers for the Iranian to help them rise! + custom = fp3_flame_of_iran_modifier_effect_tt + add_character_modifier = { modifier = fp3_flame_of_iran_modifier } + custom_tooltip = fp3_flame_of_iran_independence_effect_tt + custom_tooltip = fp3_event_troops_effect_tt + hidden_effect = { + spawn_army = { + name = persian_warriors + men_at_arms = { + type = asawira + stacks = 2 + } + location = this.capital_province + uses_supply = yes + inheritable = yes + } + spawn_army = { + name = persian_warriors + men_at_arms = { + type = ayyar + stacks = 4 + } + location = this.capital_province + uses_supply = yes + inheritable = yes + } + spawn_army = { + name = persian_warriors + men_at_arms = { + type = tawashi + stacks = 2 + } + location = this.capital_province + uses_supply = yes + inheritable = yes + } + spawn_army = { + name = persian_warriors + men_at_arms = { + type = zupin_warrior + stacks = 4 + } + location = this.capital_province + uses_supply = yes + inheritable = yes + } + spawn_army = { + name = persian_warriors + men_at_arms = { + type = tarkhan + stacks = 2 + } + location = this.capital_province + uses_supply = yes + inheritable = yes + } + if = { + limit = { + top_liege != this + NOT = { + liege.culture = { has_cultural_pillar = heritage_iranian } + } + } + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = yes + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + } + } + + culture = { + # increase the cultural acceptance for every iranian culture with the rekindler of iran's culture + custom_tooltip = { + text = fp3_rekindle_iran_cultural_acceptance_tt + every_culture_global = { + limit = { + has_cultural_pillar = heritage_iranian + this != root.culture + } + change_cultural_acceptance = { + target = root.culture + value = 100 + desc = fp3_rekindle_iran_cultural_acceptance_tt + } + } + } + + custom_tooltip = struggle_persia_ending_rekindle_iran_easier_to_convert_culture_tt + } + + if = { + limit = { is_ai = no } + add_character_flag = { + flag = fp3_rekindle_iran_achievement_unlocked + years = 4 + } + } +} + +fp3_sundered_caliphate_effects = { + save_scope_as = sunderer + # Save Sunni caliph or previous one as scope:struggle_liege + fp3_save_sunni_caliph_or_previous_effect = yes + + add_prestige = massive_prestige_gain + house ?= { + add_house_modifier = { + modifier = fp3_house_modifier_destroyed_the_caliphate + years = fp3_house_modifier_sunder_caliphate_duration + } + } + + scope:the_caliph = { + add_opinion = { + target = scope:sunderer + modifier = fp3_sundered_caliphate_opinion + opinion = -75 + } + # This is here to make effect order pretty + every_vassal = { + custom = fp3_sunder_the_caliphate_same_faith_vassal_tt + limit = { faith = scope:sunderer.faith } + # vassals from same religion as root gains opinion and give hook + save_scope_as = same_faith_caliph_vassal + add_opinion = { + target = scope:sunderer + modifier = fp3_sundered_caliphate_opinion + opinion = 25 + } + custom_tooltip = { + text = fp3_sunder_the_caliphate_same_faith_vassal_hook_tt + if = { + limit = { + scope:sunderer = { + can_add_hook = { + type = favor_hook + target = scope:same_faith_caliph_vassal + } + } + } + scope:sunderer = { + add_hook_no_toast = { + type = favor_hook + target = scope:same_faith_caliph_vassal + } + } + } + } + } + every_vassal = { + custom = fp3_sunder_the_caliphate_hostile_faith_vassal_tt + limit = { + faith != root.faith + faith = { + faith_hostility_level = { + target = scope:the_caliph.faith + value >= religious_cb_enabled_hostility_level + } + } + } + # vassals with faith hostile to caliph gains opinion + add_opinion = { + target = scope:sunderer + modifier = fp3_sundered_caliphate_opinion + opinion = 25 + } + } + custom_tooltip = destroys_caliph_titles_caliph_tt + if = { + limit = {title:e_arabia.holder = scope:the_caliph } + custom_tooltip = destroys_caliph_titles_arabia_tt + } + } + + # Notify players about the fall of the Caliphate + hidden_effect = { + every_player = { + limit = { + OR = { + is_vassal_of = scope:the_caliph + fp3_character_involved_in_struggle_trigger = yes + this = scope:the_caliph + } + this != scope:sunderer + } + trigger_event = fp3_struggle.0192 + } + scope:the_caliph = { + destroy_title = title:d_sunni + if = { + limit = { has_title = title:e_arabia } + destroy_title = title:e_arabia + } + } + } +} + +fp3_struggle_catalysts_for_activities_effect = { + scope:activity = { + if = { + limit = { + any_special_guest = { + always = yes + } + } + random_special_guest = { + save_scope_as = special_honorary_guest + } + } + } + if = { + limit = { + this = scope:host + scope:special_honorary_guest ?= { is_alive = yes } + scope:host = { + is_alive = yes + any_character_struggle = { + involvement = involved + activate_struggle_catalyst_secondary_character_involvement_involved_trigger = { + CATALYST = catalyst_invite_involved_as_honorary_guests_to_feast_hunt + CHAR = scope:special_honorary_guest + } + } + } + } + scope:host = { + every_character_struggle = { + involvement = involved + limit = { phase_has_catalyst = catalyst_invite_involved_as_honorary_guests_to_feast_hunt } + activate_struggle_catalyst = { + catalyst = catalyst_invite_involved_as_honorary_guests_to_feast_hunt + character = scope:host + } + log_debug_variable_for_persian_struggle_effect = { VAR = stabil_catalyst_invite_involved_as_honorary_guests_to_feast_hunt } + } + } + } +} + +fp3_challenge_house_head_duel_challenger_win_prestige_effect = { + scope:house_challenger = { add_prestige = medium_prestige_gain } +} + +fp3_challenge_house_head_duel_challenger_win_house_effect = { + scope:house_challenger.house = { set_house_head = scope:house_challenger } + scope:house_challenger = { + custom_tooltip = { + text = fp3_challenge_house_head_recent_cooldown_tt + add_character_flag = { + flag = fp3_challenge_house_head_recent_flag + years = 3 + } + } + } +} + +fp3_challenge_house_head_duel_challenger_loss_effect = { + scope:house_challenger = { + if = { + limit = { is_alive = yes } + add_prestige = medium_prestige_loss + } + } + scope:house_head = { + add_prestige = medium_piety_value + if = { + limit = { + scope:house_challenger = { is_alive = yes } + } + add_hook_no_toast = { + type = trial_by_combat_hook + target = scope:house_challenger + } + } + custom_tooltip = { + text = fp3_challenge_house_head_recent_cooldown_tt + add_character_flag = { + flag = fp3_challenge_house_head_recent_flag + years = 3 + } + } + } +} + +# Saves Sunni holder, or the last one +fp3_save_sunni_caliph_or_previous_effect = { + if = { + limit = { exists = title:d_sunni.holder } + title:d_sunni.holder = { save_scope_as = struggle_liege } + } + else = { + title:d_sunni.previous_holder = { save_scope_as = struggle_liege } + } +} + +fp3_struggle_apply_catalyst_interloper_uninvolved_gain_struggle_titles = { + if = { + limit = { + scope:war = { + var:struggle_scope_defender ?= struggle:persian_struggle + var:struggle_involvement_defender ?= flag:involved + } + scope:attacker = { + OR = { + fp3_character_uninvolved_in_struggle_trigger = yes + fp3_character_interloper_in_struggle_trigger = yes + } + } + struggle:persian_struggle = { + phase_has_catalyst = catalyst_interloper_uninvolved_gain_struggle_titles + } + } + struggle:persian_struggle = { + activate_struggle_catalyst = { + catalyst = catalyst_interloper_uninvolved_gain_struggle_titles + character = scope:attacker + } + log_debug_variable_for_persian_struggle_effect = { VAR = concession_catalyst_interloper_uninvolved_gain_struggle_titles } + } + } +} diff --git a/N3OW/common/scripted_effects/06_dlc_ce1_epidemics_effects.txt b/N3OW/common/scripted_effects/06_dlc_ce1_epidemics_effects.txt new file mode 100644 index 00000000..f55e46a0 --- /dev/null +++ b/N3OW/common/scripted_effects/06_dlc_ce1_epidemics_effects.txt @@ -0,0 +1,924 @@ +#grab_epidemic_disease_effect +#remove_isolated_capital_modifiers_effect + +#grabs your most important epidemic disease and saves it as a scope +#refer to it in loc as [disease_scope.GetNameNoTooltip( GetPlayer )|l] +grab_epidemic_disease_effect = { + if = { + limit = { has_trait = typhus } + trait:typhus = { save_scope_as = disease_scope } + } + else_if = { + limit = { has_trait = measles } + trait:measles = { save_scope_as = disease_scope } + } + else_if = { + limit = { has_trait = bubonic_plague } + trait:bubonic_plague = { save_scope_as = disease_scope } + } + else_if = { + limit = { has_trait = dysentery } + trait:dysentery = { save_scope_as = disease_scope } + } + else_if = { + limit = { has_trait = consumption } + trait:consumption = { save_scope_as = disease_scope } + } + else_if = { + limit = { has_trait = smallpox } + trait:smallpox = { save_scope_as = disease_scope } + } + else = { trait:ergotism = { save_scope_as = disease_scope } } +} + +# Sends a notification event to the relevant people when a province is infected +notify_holders_and_above = { + save_scope_as = infected_county + if = { + limit = { + # Just so we don't fire multiple alerts for the Black Death + scope:infected_county = { + NOT = { + any_county_province_epidemic = { + intensity = apocalyptic + epidemic_type = epidemic_type:bubonic_plague + } + } + } + } + if = { + limit = { + scope:infected_county = { + any_county_province_epidemic = { + intensity = apocalyptic + NOT = { epidemic_type = epidemic_type:bubonic_plague } + } + } + } + holder.top_liege = { + trigger_event = epidemic_events.1101 + every_vassal_or_below = { #Toast notif + limit = { + is_ai = no + NOT = { + is_target_in_variable_list = { + name = plagues_notified + target = scope:epidemic + } + } + } + add_to_variable_list = { + name = plagues_notified + target = scope:epidemic + } + send_interface_toast = { + type = msg_epidemic_outbreak + title = epidemic_events.alert_title + left_icon = scope:infected_county + custom_tooltip = epidemic_events.alert_description + } + } + } + holder = { + if = { + limit = { + is_ai = no + notified_of_plague_trigger = no + } + trigger_event = epidemic_events.1101 + } + every_liege_or_above = { + limit = { + is_ai = no + notified_of_plague_trigger = no + } + trigger_event = epidemic_events.1101 + } + every_vassal_or_below = { + limit = { + is_ai = no + notified_of_plague_trigger = no + } + trigger_event = epidemic_events.1101 + } + } + } + else_if = { + # If it's minor we send you a toast unless it's in your domain + limit = { + scope:infected_county = { + any_county_province_epidemic = { + NOR = { + epidemic_type = epidemic_type:bubonic_plague + outbreak_intensity >= major + } + } + holder = { + this != top_liege + } + } + } + if = { + limit = { + holder.top_liege = { + notified_of_plague_trigger = no + } + } + holder.top_liege = { + send_interface_toast = { + type = msg_epidemic_outbreak + title = epidemic_events.alert_title + left_icon = scope:infected_county + custom_tooltip = epidemic_events.alert_description + } + add_to_variable_list = { + name = plagues_notified + target = scope:epidemic + } + every_vassal_or_below = { #Toast notif + limit = { + is_ai = no + this != scope:infected_county.holder + notified_of_plague_trigger = no + } + add_to_variable_list = { + name = plagues_notified + target = scope:epidemic + } + send_interface_toast = { + type = msg_epidemic_outbreak + title = epidemic_events.alert_title + left_icon = scope:infected_county + custom_tooltip = epidemic_events.alert_description + } + } + } + } + if = { + limit = { + holder = { + is_ai = no + notified_of_plague_trigger = no + } + } + holder = { + trigger_event = epidemic_events.1100 + every_liege_or_above = { + limit = { + is_ai = no + notified_of_plague_trigger = no + } + send_interface_toast = { + type = msg_epidemic_outbreak + title = epidemic_events.alert_title + left_icon = scope:infected_county + custom_tooltip = epidemic_events.alert_description + } + } + every_vassal_or_below = { + limit = { + is_ai = no + notified_of_plague_trigger = no + } + send_interface_toast = { + type = msg_epidemic_outbreak + title = epidemic_events.alert_title + left_icon = scope:infected_county + custom_tooltip = epidemic_events.alert_description + } + } + } + } + } + else = { # If Major or Apocalyptic but not the Black Death + holder.top_liege = { + trigger_event = epidemic_events.1100 + every_vassal_or_below = { #Toast notif + limit = { + is_ai = no + notified_of_plague_trigger = no + } + add_to_variable_list = { + name = plagues_notified + target = scope:epidemic + } + send_interface_toast = { + type = msg_epidemic_outbreak + title = epidemic_events.alert_title + left_icon = scope:infected_county + custom_tooltip = epidemic_events.alert_description + } + } + } + holder = { + if = { + limit = { + is_ai = no + notified_of_plague_trigger = no + } + trigger_event = epidemic_events.1100 + } + every_liege_or_above = { + limit = { + is_ai = no + NOT = { + is_target_in_variable_list = { + name = plagues_notified + target = scope:epidemic + } + } + } + trigger_event = epidemic_events.1100 + } + every_vassal_or_below = { + limit = { + is_ai = no + notified_of_plague_trigger = no + } + trigger_event = epidemic_events.1100 + } + } + } + } +} +# Start Black Death event chain +start_black_death_chain_effect = { + holder ?= { + save_scope_as = black_death_holder + } + every_ruler = { + if = { + limit = { + is_ai = no + in_diplomatic_range = scope:black_death_holder + NOT = { + any_owned_story = { + type = story_cycle_black_death + } + } + } + trigger_event = epidemic_events.5999 + } + every_liege_or_above = { + limit = { + is_ai = no + in_diplomatic_range = scope:black_death_holder + NOT = { + any_owned_story = { + type = story_cycle_black_death + } + } + } + trigger_event = epidemic_events.5999 + } + } +} + +# Grabs a courtier who would plausibly be superstitious +get_superstitious_courtier_effect = { + if = { + limit = { + any_courtier_or_guest = { + is_available_adult = yes + OR = { + learning <= mediocre_skill_rating + has_trait = intellect_bad + has_trait = dull + has_character_modifier = bp1_superstition_modifier + } + } + } + random_courtier_or_guest = { + limit = { + is_available_adult = yes + OR = { + learning <= mediocre_skill_rating + has_trait = intellect_bad + has_trait = dull + has_character_modifier = bp1_superstition_modifier + } + } + save_scope_as = superstitious_courtier + } + } + else = { + random_courtier_or_guest = { + limit = { + is_available_adult = yes + } + save_scope_as = superstitious_courtier + } + } +} + +get_random_realm_epidemic = { + random_sub_realm_county = { + limit = { + any_county_province_epidemic = { outbreak_intensity >= $INTENSITY$ } + } + weight = { + base = 1 + modifier = { + add = 750 + has_province_with_epidemic = { intensity >= apocalyptic } + } + modifier = { + add = 5 + has_province_with_epidemic = { intensity >= major } + } + } + random_county_province = { + limit = { + any_province_epidemic = { + outbreak_intensity >= $INTENSITY$ + } + } + weight = { + base = 1 + modifier = { + add = 750 + any_province_epidemic = { + intensity >= apocalyptic + } + } + modifier = { + add = 5 + any_province_epidemic = { + intensity >= major + } + } + } + random_province_epidemic = { + limit = { + outbreak_intensity >= $INTENSITY$ + } + weight = { + base = 1 + modifier = { + add = 750 + outbreak_intensity >= apocalyptic + } + modifier = { + add = 5 + outbreak_intensity >= major + } + } + save_scope_as = epidemic_scope + } + } + } +} + +get_random_nearby_realm_epidemic = { + random_sub_realm_county = { + limit = { + any_county_province = { + OR = { + county.holder = root + squared_distance = { + target = root.capital_province + value <= squared_distance_medium #250 map-pixels. Roughly one Ireland away (top to bottom). + } + } + any_province_epidemic = { + outbreak_intensity >= $INTENSITY$ + } + } + } + weight = { + base = 1 + modifier = { + add = 750 + has_province_with_epidemic = { intensity >= apocalyptic } + } + modifier = { + add = 5 + has_province_with_epidemic = { intensity >= major } + } + } + random_county_province = { + limit = { + any_province_epidemic = { + outbreak_intensity >= $INTENSITY$ + } + } + weight = { + base = 1 + modifier = { + add = 750 + any_province_epidemic = { + intensity >= apocalyptic + } + } + modifier = { + add = 5 + any_province_epidemic = { + intensity >= major + } + } + } + random_province_epidemic = { + limit = { + outbreak_intensity >= $INTENSITY$ + } + weight = { + base = 1 + modifier = { + add = 750 + outbreak_intensity >= apocalyptic + } + modifier = { + add = 5 + outbreak_intensity >= major + } + } + save_scope_as = epidemic_scope + } + } + } +} + +# Epidemic treatment effect +epidemic_prevention_effect = { + $PHYSICIAN$ = { save_scope_as = physician } + # Apply prevention + if = { + limit = { + $PREVENTION_LEVEL$ = 1 + } + custom_tooltip = minor_epidemic_treatment.tt + hidden_effect = { + # OUTCOME RANDOMIZATION + random_list = { + 70 = { # Success + modifier = { + factor = scope:physician.physician_safe_treatment_skill_factor + # 1 for an average learning skill character without traits + # 0.2 min for low learning + # ~3 for high skill character without traits + # ~12 for high skill character with best trait (physician_3) + } + trigger_event = { id = physician_epidemic_events.1021 days = { 3 14 } } #Safe prevention sucess + } + 30 = { # Failure + trigger_event = { id = physician_epidemic_events.1022 days = { 3 14 } } #Safe prevention failure + } + } + } + } + if = { + limit = { + $PREVENTION_LEVEL$ = 2 + } + custom_tooltip = moderate_epidemic_treatment.tt + # OUTCOME RANDOMIZATION + hidden_effect = { + random_list = { + 1 = { #Success + modifier = { + scope:physician = { + learning >= mediocre_skill_rating + learning < medium_skill_rating + } + factor = 2 + } + modifier = { + scope:physician = { + learning >= medium_skill_rating + learning < decent_skill_rating + } + factor = 4 + } + modifier = { + scope:physician = { + learning >= decent_skill_rating + learning < high_skill_rating + } + factor = 7 + } + modifier = { + scope:physician = { + learning >= high_skill_rating + } + factor = 10 + } + modifier = { + scope:physician = { has_trait = lifestyle_physician } + factor = 2 + } + modifier = { + scope:physician = { + has_trait = lifestyle_physician + has_trait_xp = { + trait = lifestyle_physician + value >= 50 + } + } + factor = 5 + } + modifier = { + scope:physician = { + has_trait = lifestyle_physician + has_trait_xp = { + trait = lifestyle_physician + value >= 100 + } + } + factor = 5 + } + trigger_event = { id = physician_epidemic_events.1023 days = { 3 14 } } #success + } + 10 = { #Failure + trigger_event = { id = physician_epidemic_events.1024 days = { 3 14 } } #Failure + } + } + } + } + if = { + limit = { + $PREVENTION_LEVEL$ = 3 + } + custom_tooltip = mystic_epidemic_treatment.tt + # OUTCOME RANDOMIZATION + hidden_effect = { + random_list = { + 1 = { #Success + modifier = { + scope:physician = { + learning >= mediocre_skill_rating + learning < medium_skill_rating + } + factor = 2 + } + modifier = { + scope:physician = { + learning >= medium_skill_rating + learning < decent_skill_rating + } + factor = 4 + } + modifier = { + scope:physician = { + learning >= decent_skill_rating + learning < high_skill_rating + } + factor = 7 + } + modifier = { + scope:physician = { + learning >= high_skill_rating + } + factor = 10 + } + modifier = { + scope:physician = { has_trait = lifestyle_mystic } + factor = 2 + } + modifier = { + scope:physician = { + has_trait = lifestyle_mystic + has_trait_xp = { + trait = lifestyle_mystic + value >= 50 + } + } + factor = 5 + } + modifier = { + scope:physician = { + has_trait = lifestyle_mystic + has_trait_xp = { + trait = lifestyle_mystic + value >= 50 + } + } + factor = 5 + } + + #Critical or normal success? + random_list = { + 1 = { + modifier = { + scope:physician = { has_trait = lifestyle_physician } + factor = 1.5 + } + modifier = { + scope:physician = { + has_trait = lifestyle_physician + has_trait_xp = { + trait = lifestyle_physician + value >= 50 + } + } + factor = 2 + } + modifier = { + scope:physician = { + has_trait = lifestyle_physician + has_trait_xp = { + trait = lifestyle_physician + value >= 50 + } + } + factor = 3 + } + trigger_event = { id = physician_epidemic_events.1025 days = { 3 14 } } #Critical success + } + 5 = { + trigger_event = { id = physician_epidemic_events.1023 days = { 3 14 } } #Normal success + } + } + } + 10 = { #Failure + #Critical or normal failure? + random_list = { + 1 = { + trigger_event = { id = physician_epidemic_events.1026 days = { 3 14 } } #Critical failure + } + 5 = { + trigger_event = { id = physician_epidemic_events.1024 days = { 3 14 } } #Failure + } + } + } + } + } + } +} + +remove_isolated_capital_modifiers_effect = { + if = { + limit = { + has_county_modifier = isolate_capital_decision_modifier + NOT = { + any_county_province = { + this != root + any_province_epidemic = { + this = scope:epidemic + } + } + } + } + remove_county_modifier = isolate_capital_decision_modifier + } + if = { + limit = { + holder.top_liege = { + any_sub_realm_county = { has_county_modifier = isolate_capital_decision_modifier } + } + holder.top_liege = { + NOT = { + any_sub_realm_county = { + any_county_province = { + this != root + any_province_epidemic = { + this = scope:epidemic + } + } + } + } + } + } + holder.top_liege = { + every_sub_realm_county = { + limit = { + has_county_modifier = isolate_capital_decision_modifier + } + remove_county_modifier = isolate_capital_decision_modifier + } + } + } +} + +give_epidemic_immunity = { + if = { + limit = { + $EPIDEMIC$.epidemic_type.epidemic_trait = trait:measles + } + add_character_flag = measles_immunity + } + if = { + limit = { + $EPIDEMIC$.epidemic_type.epidemic_trait = trait:bubonic_plague + } + add_character_flag = bubonic_immunity + } + add_to_variable_list = { + name = immunised_plagues + target = $EPIDEMIC$ + } +} + +add_plague_county_modifiers = { + if = { + limit = { + any_sub_realm_county = { + development_level >= 30 + } + } + show_as_tooltip = { # Show as tooltip to reduce tooltip size + every_sub_realm_county = { + custom = shattered_by_plague_tt + add_county_modifier = { + modifier = shattered_by_plague + years = 10 + } + } + } + } + if = { + limit = { + any_sub_realm_county = { + AND = { + development_level >= 20 + development_level < 30 + } + } + } + show_as_tooltip = { # Show as tooltip to reduce tooltip size + every_sub_realm_county = { + custom = ravaged_by_plague_tt + add_county_modifier = { + modifier = ravaged_by_plague + years = 10 + } + } + } + } + if = { + limit = { + any_sub_realm_county = { + AND = { + development_level >= 15 + development_level < 20 + } + } + } + show_as_tooltip = { # Show as tooltip to reduce tooltip size + every_sub_realm_county = { + custom = blighted_by_plague_tt + add_county_modifier = { + modifier = blighted_by_plague + years = 10 + } + } + } + } + if = { + limit = { + any_sub_realm_county = { + AND = { + development_level >= 10 + development_level < 15 + } + } + } + show_as_tooltip = { # Show as tooltip to reduce tooltip size + every_sub_realm_county = { + custom = struck_by_plague_tt + add_county_modifier = { + modifier = struck_by_plague + years = 10 + } + } + } + } + hidden_effect = { + every_sub_realm_county = { + if = { # Refresh the modifier for new plagues + limit = { + has_county_modifier = struck_by_plague + } + remove_county_modifier = struck_by_plague + } + else_if = { + limit = { + has_county_modifier = blighted_by_plague + } + remove_county_modifier = blighted_by_plague + } + else_if = { + limit = { + has_county_modifier = ravaged_by_plague + } + remove_county_modifier = ravaged_by_plague + } + else_if = { + limit = { + has_county_modifier = shattered_by_plague + } + remove_county_modifier = shattered_by_plague + } + } + every_sub_realm_county = { + limit = { + development_level >= 30 + } + add_county_modifier = { + modifier = shattered_by_plague + years = 10 + } + } + every_sub_realm_county = { + limit = { + AND = { + development_level >= 20 + development_level < 30 + } + } + add_county_modifier = { + modifier = ravaged_by_plague + years = 10 + } + } + every_sub_realm_county = { + limit = { + AND = { + development_level >= 15 + development_level < 20 + } + } + add_county_modifier = { + modifier = blighted_by_plague + years = 10 + } + } + every_sub_realm_county = { + limit = { + AND = { + development_level >= 10 + development_level < 15 + } + } + add_county_modifier = { + modifier = struck_by_plague + years = 10 + } + } + } +} + +plague_recovery_event_effect = { + scope:epidemic = { save_scope_as = epidemic } + county.holder.liege = { + add_to_variable_list = { + name = formerly_infected_counties + target = root.county + years = 10 + } + if = { + limit = { + any_sub_realm_county = { + any_county_province = { + count = 1 + any_province_epidemic = { + count = 1 + } + } + } + } + trigger_event = { + id = epidemic_events.0110 + days = 1 + } + } + } +} + +cant_touch_this_achievement_effect = { + if = { + limit = { + county.holder = { + OR = { + this = { is_ai = no } + any_liege_or_above = { is_ai = no } + } + } + epidemic_resistance >= 100 + } + county.holder = { + add_achievement_global_variable_effect = { + VARIABLE = ce1_cant_touch_this_achievement_unlocked + VALUE = yes + } + } + } +} + +# this = county to apply to +# scope:epidemic = epidemic infecting +# BASE = how much to apply by default for this epidemic type +apply_infection_development_loss = { + save_temporary_scope_value_as = { + name = base_loss + value = $BASE$ + } + change_development_progress_with_overflow = epidemic_development_loss_value +} + +apply_infection_fertility_loss = { + save_temporary_scope_value_as = { + name = base_loss + value = $BASE$ + } + change_county_fertility = epidemic_fertility_loss_value +} diff --git a/N3OW/common/scripted_effects/06_dlc_ce1_leg_b_effects.txt b/N3OW/common/scripted_effects/06_dlc_ce1_leg_b_effects.txt new file mode 100644 index 00000000..5571aa50 --- /dev/null +++ b/N3OW/common/scripted_effects/06_dlc_ce1_leg_b_effects.txt @@ -0,0 +1,903 @@ +# get_building_name_effect - assigns a randomised name to your legendary building + +get_building_name_effect = { + random_list = { + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_shrine } + NOT = { + has_character_flag = shrine_of_highgod + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:shrine_of_highgod + } + } + else = { + add_character_flag = shrine_of_highgod + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_shrine } + NOT = { + has_character_flag = province_shrine + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:province_shrine + } + } + else = { + add_character_flag = province_shrine + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_shrine } + NOT = { + has_character_flag = shrine_of_healthgod + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:shrine_of_healthgod + } + } + else = { + add_character_flag = shrine_of_healthgod + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_shrine } + NOT = { + has_character_flag = shrine_of_fertilitygod + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:shrine_of_fertilitygod + } + } + else = { + add_character_flag = shrine_of_fertilitygod + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_shrine } + NOT = { + has_character_flag = shrine_of_wealthgod + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:shrine_of_wealthgod + } + } + else = { + add_character_flag = shrine_of_wealthgod + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_shrine } + NOT = { + has_character_flag = shrine_of_wisdom + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:shrine_of_wisdom + } + } + else = { + add_character_flag = shrine_of_wisdom + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_shrine } + NOT = { + has_character_flag = shrine_of_courage + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:shrine_of_courage + } + } + else = { + add_character_flag = shrine_of_courage + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_shrine } + NOT = { + has_character_flag = wargods_rest + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:wargods_rest + } + } + else = { + add_character_flag = wargods_rest + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_shrine } + scope:legendary_province = { exists = var:legendary_figure } + NOT = { + has_character_flag = figures_mount + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:figures_mount + } + } + else = { + add_character_flag = figures_mount + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_shrine } + scope:legendary_province = { exists = var:legendary_figure } + NOT = { + has_character_flag = figures_temple + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:figures_temple + } + } + else = { + add_character_flag = figures_temple + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_shrine } + scope:legendary_province = { exists = var:legendary_figure } + NOT = { + has_character_flag = figures_shrine + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:figures_shrine + } + } + else = { + add_character_flag = figures_shrine + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_shrine } + scope:legendary_province = { exists = var:legendary_figure } + NOT = { + has_character_flag = figures_rest + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:figures_rest + } + } + else = { + add_character_flag = figures_rest + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_shrine } + scope:legendary_province = { exists = var:legendary_figure } + NOT = { + has_character_flag = figure_at_province + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:figure_at_province + } + } + else = { + add_character_flag = figure_at_province + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_palace } + OR = { + is_female = yes + any_spouse = { is_female = yes } + } + NOT = { + has_character_flag = queens_palace + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:queens_palace + } + } + else = { + add_character_flag = queens_palace + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_palace } + OR = { + is_male = yes + any_spouse = { is_male = yes } + } + NOT = { + has_character_flag = kings_palace + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:kings_palace + } + } + else = { + add_character_flag = kings_palace + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_palace } + NOT = { + has_character_flag = province_hall + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:province_hall + } + } + else = { + add_character_flag = province_hall + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_palace } + scope:legendary_province = { exists = var:legendary_figure } + NOT = { + has_character_flag = dynasty_hall + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:dynasty_hall + } + } + else = { + add_character_flag = dynasty_hall + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_palace } + scope:legendary_province = { exists = var:legendary_figure } + NOT = { + has_character_flag = dynasty_house + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:dynasty_house + } + } + else = { + add_character_flag = dynasty_house + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_palace } + scope:legendary_province = { exists = var:legendary_figure } + NOT = { + has_character_flag = figures_manor + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:figures_manor + } + } + else = { + add_character_flag = figures_manor + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_palace } + scope:legendary_province = { exists = var:legendary_figure } + NOT = { + has_character_flag = location_house + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:location_house + } + } + else = { + add_character_flag = location_house + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_statue } + scope:legendary_province = { exists = var:legendary_figure } + NOT = { + has_character_flag = figures_glory + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:figures_glory + } + } + else = { + add_character_flag = figures_glory + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_statue } + scope:legendary_province = { exists = var:legendary_figure } + NOT = { + has_character_flag = figure_at_province + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:figure_at_province + } + } + else = { + add_character_flag = figure_at_province + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_statue } + scope:legendary_province = { exists = var:legendary_figure } + NOT = { + has_character_flag = great_statue_of_figure + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:great_statue_of_figure + } + } + else = { + add_character_flag = great_statue_of_figure + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_statue } + NOT = { + has_character_flag = hero_of_province + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:hero_of_province + } + } + else = { + add_character_flag = hero_of_province + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_statue } + NOT = { + has_character_flag = great_statue_at_province + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:great_statue_at_province + } + } + else = { + add_character_flag = great_statue_at_province + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_statue } + NOT = { + has_character_flag = heros_honor + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:heros_honor + } + } + else = { + add_character_flag = heros_honor + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_watchtower } + NOT = { + has_character_flag = great_tower_of_province + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:great_tower_of_province + } + } + else = { + add_character_flag = great_tower_of_province + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_watchtower } + NOT = { + has_character_flag = province_watchtower + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:province_watchtower + } + } + else = { + add_character_flag = province_watchtower + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_watchtower } + NOT = { + has_character_flag = province_castle + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:province_castle + } + } + else = { + add_character_flag = province_castle + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_watchtower } + scope:legendary_province = { exists = var:legendary_figure } + NOT = { + has_character_flag = figures_tower + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:figures_tower + } + } + else = { + add_character_flag = figures_tower + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_watchtower } + scope:legendary_province = { exists = var:legendary_figure } + NOT = { + has_character_flag = dynasty_tower + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:dynasty_tower + } + } + else = { + add_character_flag = dynasty_tower + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_hunting_lodge } + NOT = { + has_character_flag = province_lodge + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:province_lodge + } + } + else = { + add_character_flag = province_lodge + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_hunting_lodge } + NOT = { + has_character_flag = great_lodge_of_province + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:great_lodge_of_province + } + } + else = { + add_character_flag = great_lodge_of_province + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_hunting_lodge } + NOT = { + has_character_flag = lodge_of_wargod + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:lodge_of_wargod + } + } + else = { + add_character_flag = lodge_of_wargod + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_hunting_lodge } + scope:legendary_province = { exists = var:legendary_figure } + NOT = { + has_character_flag = figures_lodge + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:figures_lodge + } + } + else = { + add_character_flag = figures_lodge + } + } + 10 = { + trigger = { + scope:legendary_province = { has_building = legendary_hunting_lodge } + scope:legendary_province = { exists = var:legendary_figure } + NOT = { + has_character_flag = dynasty_lodge + } + } + if = { + limit = { is_ai = yes } + set_variable = { + name = leg_b_name + value = flag:dynasty_lodge + } + } + else = { + add_character_flag = dynasty_lodge + } + } + } +} + +legendary_building_0001_cleanup = { + if = { + limit = { + has_character_flag = shrine_of_highgod + } + remove_character_flag = shrine_of_highgod + } + if = { + limit = { + has_character_flag = province_shrine + } + remove_character_flag = province_shrine + } + if = { + limit = { + has_character_flag = shrine_of_healthgod + } + remove_character_flag = shrine_of_healthgod + } + if = { + limit = { + has_character_flag = shrine_of_fertilitygod + } + remove_character_flag = shrine_of_fertilitygod + } + if = { + limit = { + has_character_flag = shrine_of_wealthgod + } + remove_character_flag = shrine_of_wealthgod + } + if = { + limit = { + has_character_flag = shrine_of_wisdom + } + remove_character_flag = shrine_of_wisdom + } + if = { + limit = { + has_character_flag = shrine_of_courage + } + remove_character_flag = shrine_of_courage + } + if = { + limit = { + has_character_flag = wargods_rest + } + remove_character_flag = wargods_rest + } + if = { + limit = { + has_character_flag = figures_mount + } + remove_character_flag = figures_mount + } + if = { + limit = { + has_character_flag = figures_temple + } + remove_character_flag = figures_temple + } + if = { + limit = { + has_character_flag = figures_shrine + } + remove_character_flag = figures_shrine + } + if = { + limit = { + has_character_flag = figures_rest + } + remove_character_flag = figures_rest + } + if = { + limit = { + has_character_flag = figure_at_province + } + remove_character_flag = figure_at_province + } + if = { + limit = { + has_character_flag = queens_palace + } + remove_character_flag = queens_palace + } + if = { + limit = { + has_character_flag = kings_palace + } + remove_character_flag = kings_palace + } + if = { + limit = { + has_character_flag = province_hall + } + remove_character_flag = province_hall + } + if = { + limit = { + has_character_flag = dynasty_hall + } + remove_character_flag = dynasty_hall + } + if = { + limit = { + has_character_flag = dynasty_house + } + remove_character_flag = dynasty_house + } + if = { + limit = { + has_character_flag = figures_manor + } + remove_character_flag = figures_manor + } + if = { + limit = { + has_character_flag = location_house + } + remove_character_flag = location_house + } + if = { + limit = { + has_character_flag = figures_glory + } + remove_character_flag = figures_glory + } + if = { + limit = { + has_character_flag = figure_at_province + } + remove_character_flag = figure_at_province + } + if = { + limit = { + has_character_flag = great_statue_of_figure + } + remove_character_flag = great_statue_of_figure + } + if = { + limit = { + has_character_flag = hero_of_province + } + remove_character_flag = hero_of_province + } + if = { + limit = { + has_character_flag = great_statue_at_province + } + remove_character_flag = great_statue_at_province + } + if = { + limit = { + has_character_flag = heros_honor + } + remove_character_flag = heros_honor + } + if = { + limit = { + has_character_flag = great_tower_of_province + } + remove_character_flag = great_tower_of_province + } + if = { + limit = { + has_character_flag = province_watchtower + } + remove_character_flag = province_watchtower + } + if = { + limit = { + has_character_flag = province_castle + } + remove_character_flag = province_castle + } + if = { + limit = { + has_character_flag = figures_tower + } + remove_character_flag = figures_tower + } + if = { + limit = { + has_character_flag = dynasty_tower + } + remove_character_flag = dynasty_tower + } + if = { + limit = { + has_character_flag = province_lodge + } + remove_character_flag = province_lodge + } + if = { + limit = { + has_character_flag = great_lodge_of_province + } + remove_character_flag = great_lodge_of_province + } + if = { + limit = { + has_character_flag = lodge_of_wargod + } + remove_character_flag = lodge_of_wargod + } + if = { + limit = { + has_character_flag = figures_lodge + } + remove_character_flag = figures_lodge + } + if = { + limit = { + has_character_flag = dynasty_lodge + } + remove_character_flag = dynasty_lodge + } + if = { + limit = { + exists = var:leg_b_name + } + remove_variable = leg_b_name + } +} diff --git a/N3OW/common/scripted_effects/06_dlc_ce1_legend_effects.txt b/N3OW/common/scripted_effects/06_dlc_ce1_legend_effects.txt new file mode 100644 index 00000000..7900fedf --- /dev/null +++ b/N3OW/common/scripted_effects/06_dlc_ce1_legend_effects.txt @@ -0,0 +1,3024 @@ +#grab_appropriate_chronicler_effect +#grab_appropriate_bard_feast_effect - this one doesn't check if they're available, so it can be used in activities +#grab_appropriate_bard_effect - this one checks if they're available +#grab_mythical_founder_effect +#disburse_hunt_legend_seeds +#change_legend_quality_effect - This adjusts the quality of a legend using an invisible progress bar that goes from 0-100. When it hits 100, the legend increases one step in quality, if it dips below 0, the legend loses one step in quality +#legend_completion_quality_flag_effect +#legend_ending_rewards_heroic_effect +#legend_ending_rewards_holy_effect +#legend_ending_rewards_legitimizing_effect +#legend_completion_type_flag_effect +#get_appropriate_ancient_people - this looks for regionally appropriate ancient people for you to lay claim to +# get_appropriate_exotic_location - Atlantis, Vinland, places of dubious historicity +# generate_godly_descent_seed_support_effect - create a godly descent seed based on loc keys +# generate_religion_descent_effect - generate a godly descent seed based on scopes +# balancing_legend_global_var_effect +# send_interface_message_legend_notification_effect +# send_interface_toast_legend_notification_effect +# create_swan_knight_legend_seed_effect + +grab_appropriate_chronicler_effect = { + if = { #If the culture would have relied on poets for this we grab them first + limit = { + OR = { + culture = { + OR = { + has_cultural_tradition = tradition_fp1_northern_stories + has_cultural_parameter = poet_trait_gives_bonuses + has_cultural_tradition = tradition_storytellers + has_cultural_tradition = tradition_chanson_de_geste + } + } + faith = { + trait_is_virtue = lifestyle_poet + } + } + any_court_position_holder = { + type = court_poet_court_position + is_available_ai_adult = yes + } + } + random_court_position_holder = { + type = court_poet_court_position + limit = { + is_available_ai_adult = yes + } + save_scope_as = chronicler + } + } + else_if = { #Otherwise we go for the Chronicler first + limit = { + any_court_position_holder = { + type = chronicler_court_position + is_available_ai_adult = yes + } + } + random_court_position_holder = { + type = chronicler_court_position + limit = { + is_available_ai_adult = yes + } + save_scope_as = chronicler + } + } + else_if = { + limit = { + any_court_position_holder = { + type = court_poet_court_position + is_available_ai_adult = yes + } + } + random_court_position_holder = { + type = court_poet_court_position + limit = { + is_available_ai_adult = yes + } + save_scope_as = chronicler + } + } + else_if = { + limit = { + any_court_position_holder = { + type = court_musician_court_position + is_available_ai_adult = yes + } + } + random_court_position_holder = { + type = court_musician_court_position + limit = { + is_available_ai_adult = yes + } + save_scope_as = chronicler + } + } + else = { + ordered_courtier = { + limit = { + this != root + is_available_ai_adult = yes + } + order_by = { + value = diplomacy + if = { + limit = { + OR = { + has_trait = lifestyle_poet + has_trait = journaller + } + } + add = 10 + } + if = { + limit = { is_spouse_of = root } + add = -2 + } + } + save_scope_as = chronicler + } + } +} + +grab_appropriate_bard_feast_effect = { + if = { + limit = { + employs_court_position = court_musician_court_position + scope:activity = { + any_attending_character = { + employer = root + has_court_position = court_musician_court_position + is_physically_able_ai_adult = yes + } + } + } + scope:activity = { + random_attending_character = { + limit = { + employer = root + has_court_position = court_musician_court_position + is_physically_able_ai_adult = yes + } + save_scope_as = bard + } + } + } + else_if = { + limit = { + employs_court_position = court_poet_court_position + scope:activity = { + any_attending_character = { + employer = root + has_court_position = court_poet_court_position + is_physically_able_ai_adult = yes + } + } + } + scope:activity = { + random_attending_character = { + limit = { + employer = root + has_court_position = court_poet_court_position + is_physically_able_ai_adult = yes + } + save_scope_as = bard + } + } + } + else_if = { + limit = { + scope:activity = { + any_attending_character = { + OR = { + is_vassal_of = root + is_courtier_of = root + } + this != root + NOT = { is_spouse_of = root } + NOT = { is_child_of = root } + NOT = { is_councillor_of = root } + is_physically_able_ai_adult = yes + } + } + } + scope:activity = { + ordered_attending_character = { + limit = { + OR = { + is_vassal_of = root + is_courtier_of = root + } + this != root + NOT = { is_spouse_of = root } + NOT = { is_child_of = root } + is_physically_able_ai_adult = yes + } + order_by = { + value = diplomacy + if = { + limit = { + has_trait = lifestyle_poet + } + add = 10 + } + if = { + limit = { + has_trait = journaller + } + add = 5 + } + } + } + save_scope_as = bard + } + } + else = { + create_character = { + template = bard_template + dynasty = none + location = root.location + gender_female_chance = root_faith_dominant_gender_female_chance + save_scope_as = bard + } + } +} + +grab_appropriate_bard_effect = { + if = { + limit = { + employs_court_position = court_musician_court_position + any_court_position_holder = { + type = court_musician_court_position + is_available_healthy_ai_adult = yes + } + } + random_court_position_holder = { + type = court_musician_court_position + limit = { is_available_healthy_ai_adult = yes } + save_scope_as = bard + } + } + else_if = { + limit = { + employs_court_position = court_poet_court_position + any_court_position_holder = { + type = court_poet_court_position + is_available_healthy_ai_adult = yes + } + } + random_court_position_holder = { + type = court_poet_court_position + limit = { is_available_healthy_ai_adult = yes } + save_scope_as = bard + } + } + else_if = { + limit = { + any_courtier = { + this != root + NOT = { is_spouse_of = root } + NOT = { is_child_of = root } + NOT = { is_councillor_of = root } + is_available_healthy_ai_adult = yes + } + } + ordered_courtier = { + limit = { + this != root + NOT = { is_spouse_of = root } + NOT = { is_child_of = root } + NOT = { is_councillor_of = root } + is_available_healthy_ai_adult = yes + } + order_by = { + value = diplomacy + if = { + limit = { + has_trait = lifestyle_poet + } + add = 10 + } + if = { + limit = { + has_trait = journaller + } + add = 5 + } + } + save_scope_as = bard + } + } + else = { + create_character = { + template = bard_template + dynasty = none + location = root.location + gender_female_chance = root_faith_dominant_gender_female_chance + save_scope_as = bard + } + } +} + +grab_mythical_founder_effect = { + hidden_effect = { + if = { + limit = { + NOT = { exists = var:mythical_ancestor_var } + } + random_list = { + 10 = { # Charles Martell + trigger = { + AND = { + OR = { + root.primary_title = title:k_france + root.primary_title = title:e_france + } + current_date > 1000.1.1 + } + } + set_variable = { name = mythical_ancestor_var value = flag:charles_martell } + } + 10 = { # Alexander the Great + trigger = { + OR = { + root.primary_title = title:k_thessalonika + root.primary_title = title:k_hellas + root.primary_title = title:k_egypt + AND = { + OR = { + root.primary_title = title:k_persia + root.primary_title = title:e_persia + } + NOR = { + root.faith.religion = religion:islam_religion + root.faith.religion = religion:zoroastrianism_religion + } + } + root.primary_title = title:k_anatolia + } + } + set_variable = { name = mythical_ancestor_var value = flag:alexander } + } + 10 = { # Lech + trigger = { + root.primary_title = title:k_poland + } + set_variable = { name = mythical_ancestor_var value = flag:lech } + } + 10 = { # Czech + trigger = { + OR = { + root.primary_title = title:k_bohemia + root.primary_title = title:d_bohemia + } + } + set_variable = { name = mythical_ancestor_var value = flag:czech } + } + 10 = { # Rus + trigger = { + OR = { + root.primary_title = title:k_white_rus + root.primary_title = title:k_ruthenia + root.primary_title = title:e_russia + } + } + set_variable = { name = mythical_ancestor_var value = flag:rus } + } + 10 = { # King Arthur + trigger = { + OR = { + root.primary_title = title:k_wales + root.primary_title = title:k_cornwall + root.primary_title = title:k_england + root.primary_title = title:e_britannia + } + } + set_variable = { name = mythical_ancestor_var value = flag:arthur } + } + 10 = { # Corineus + trigger = { + root.primary_title = title:k_cornwall + } + modifier = { + current_date < 1000.1.1 + factor = 3 + } + set_variable = { name = mythical_ancestor_var value = flag:corineus } + } + 10 = { # Magnus Maximus + trigger = { + root.primary_title = title:k_wales + } + modifier = { + current_date < 1000.1.1 + factor = 3 + } + set_variable = { name = mythical_ancestor_var value = flag:magnus_maximus } + } + 30 = { # Brutus of Troy, we want this to be the default for the Brits + trigger = { + OR = { + root.primary_title = title:k_england + root.primary_title = title:e_britannia + } + } + set_variable = { name = mythical_ancestor_var value = flag:brutus } + } + 10 = { # Aeneas of Troy + trigger = { + OR = { + #Used in the Roman de Brut + root.primary_title = title:k_england + root.primary_title = title:e_britannia + #Also used by the house of Tosny + root.primary_title = title:d_normandy + capital_province = { geographical_region = world_europe_west_britannia } + #And of course used in Rome + root.primary_title = title:k_italy + root.primary_title = title:k_romagna + root.primary_title = title:k_sardinia + root.primary_title = title:e_italy + root = { + is_roman_emperor_primary_title_excluding_byzantium_trigger = yes + } + } + } + set_variable = { name = mythical_ancestor_var value = flag:aeneas } + } + 10 = { # Scota + trigger = { + OR = { # Gaels + root.primary_title = title:k_scotland + root.primary_title = title:k_ireland + } + current_date > 1100.1.1 + } + modifier = { + root.primary_title = title:k_scotland + factor = 3 + } + set_variable = { name = mythical_ancestor_var value = flag:scota } + } + 10 = { # Romulus + trigger = { + OR = { + root.primary_title = title:k_italy + root.primary_title = title:k_romagna + root.primary_title = title:k_sardinia + root.primary_title = title:e_italy + root = { is_roman_emperor_primary_title_excluding_byzantium_trigger = yes } + } + } + set_variable = { name = mythical_ancestor_var value = flag:romulus } + } + 10 = { # Numa Pompilius + trigger = { + OR = { + root.primary_title = title:k_italy + root.primary_title = title:k_romagna + root.primary_title = title:k_sardinia + root.primary_title = title:e_italy + root = { is_roman_emperor_primary_title_excluding_byzantium_trigger = yes } + } + } + set_variable = { name = mythical_ancestor_var value = flag:numa } + } + 10 = { # Belisarius + trigger = { + OR = { + root.primary_title = title:k_italy + root.primary_title = title:k_romagna + root.primary_title = title:k_sardinia + root.primary_title = title:e_italy + root = { is_roman_emperor_primary_title_excluding_byzantium_trigger = yes } + } + } + set_variable = { name = mythical_ancestor_var value = flag:belisarius } + } + 10 = { # Ardashir + trigger = { + OR = { + root.primary_title = title:k_persia + root.primary_title = title:e_persia + } + } + set_variable = { name = mythical_ancestor_var value = flag:ardashir } + } + 10 = { # Pharaohs + trigger = { + root.primary_title = title:k_egypt + NOT = { religion = religion:islam_religion } + } + set_variable = { name = mythical_ancestor_var value = flag:pharaohs } + } + 10 = { # Visigothic Kings + trigger = { + OR = { + root.primary_title = title:k_castille + root.primary_title = title:k_leon + root.primary_title = title:d_galicia + root.primary_title = title:k_aragon + root.primary_title = title:k_navarra + root.primary_title = title:k_andalusia + root.primary_title = title:k_portugal + root.primary_title = title:e_spain + } + NOT = { religion = religion:islam_religion } + } + set_variable = { name = mythical_ancestor_var value = flag:visigothic_kings } + } + 10 = { # Abd al-Rahman + trigger = { + OR = { + root.primary_title = title:k_castille + root.primary_title = title:k_aragon + root.primary_title = title:k_navarra + root.primary_title = title:k_andalusia + root.primary_title = title:k_portugal + root.primary_title = title:e_spain + } + religion = religion:islam_religion + } + set_variable = { name = mythical_ancestor_var value = flag:abd_al_rahman } + } + 10 = { # Zenobia + trigger = { + OR = { + root.primary_title = title:k_syria + root.primary_title = title:k_mesopotamia + } + NOT = { religion = religion:islam_religion } + } + set_variable = { name = mythical_ancestor_var value = flag:zenobia } + } + 10 = { # King Solomon + trigger = { + root.primary_title.title_capital_county.title_province = { + geographical_region = ghw_region_ethiopia + } + root.faith.religion = religion:christianity_religion + } + set_variable = { name = mythical_ancestor_var value = flag:solomon } + } + 10 = { # Conan Meriadoc + trigger = { + root.culture = culture:breton + NOR = { # used to distinguish themselves from the French + root.primary_title = title:k_france + root.primary_title = title:e_france + } + } + set_variable = { name = mythical_ancestor_var value = flag:conan_meriadoc } + } + 10 = { # Pishdadian Dynasty + trigger = { + OR = { + root.primary_title = title:k_persia + root.primary_title = title:e_persia + } + OR = { + root.faith.religion = religion:islam_religion + root.faith.religion = religion:zoroastrianism_religion + } + } + set_variable = { name = mythical_ancestor_var value = flag:pishdadian } + } + 10 = { # Chościsko + trigger = { + OR = { + root.primary_title = title:k_poland + root.primary_title = title:d_lesser_poland + AND = { + root.primary_title.title_capital_county.title_province = { + geographical_region = ghw_region_poland + } + faith.religion = faith:slavic_pagan.religion + } + } + } + set_variable = { name = mythical_ancestor_var value = flag:choscisko } + } + 10 = { # Arsacids + trigger = { + OR = { + root.primary_title = title:k_armenia + root.primary_title = title:k_armenian_principality + root.primary_title = title:e_armenia + } + } + set_variable = { name = mythical_ancestor_var value = flag:arsacids } + } + 10 = { # King David + trigger = { + OR = { + root.primary_title = title:k_georgia + root.primary_title = title:d_georgia + } + root.faith.religion = religion:christianity_religion + } + set_variable = { name = mythical_ancestor_var value = flag:david } + } + 10 = { # Karkota Naga + trigger = { + root.primary_title = title:k_kashmir + } + set_variable = { name = mythical_ancestor_var value = flag:naga } + } + 10 = { # God Brahman + trigger = { + root.culture = culture:tamil + OR = { #Lands held by the Pallavas + root.primary_title = title:d_tondai_nadu + root.primary_title = title:c_kanchipuram + root.primary_title = title:k_tamilakam + root.primary_title = title:c_muluvagil + } + } + set_variable = { name = mythical_ancestor_var value = flag:brahman } + } + 10 = { # Odin + trigger = { + root.faith = faith:norse_pagan + OR = { + root.primary_title = title:k_norway + root.primary_title = title:k_sweden + root.primary_title = title:d_iceland + root.primary_title = title:k_denmark + } + } + set_variable = { name = mythical_ancestor_var value = flag:odin } + } + 10 = { # Ragnar Lodbrok + trigger = { + OR = { + root.primary_title = title:k_norway + root.primary_title = title:k_sweden + root.primary_title = title:d_iceland + root.primary_title = title:k_denmark + } + } + set_variable = { name = mythical_ancestor_var value = flag:ragnar } + } + 10 = { # Brunhild + trigger = { + OR = { + root.primary_title = title:k_norway + root.primary_title = title:k_sweden + root.primary_title = title:d_iceland + root.primary_title = title:k_denmark + } + } + modifier = { + is_female = yes + factor = 5 + } + set_variable = { name = mythical_ancestor_var value = flag:brunhild } + } + 10 = { # Eremon + trigger = { + OR = { + root.primary_title = title:k_ireland + root.primary_title = title:d_connacht + root.primary_title = title:d_ulster + root.primary_title = title:c_ailech + root.primary_title = title:c_oriel + root.primary_title = title:c_breifne + root.primary_title = title:c_athlone + } + } + modifier = { + OR = { + root.primary_title = title:d_connacht + root.primary_title = title:d_ulster + root.primary_title = title:c_ailech + root.primary_title = title:c_oriel + root.primary_title = title:c_breifne + root.primary_title = title:c_athlone + } + factor = 3 + } + set_variable = { name = mythical_ancestor_var value = flag:eremon } + } + 10 = { # Eber + trigger = { + OR = { + root.primary_title = title:k_ireland + root.primary_title = title:d_munster + root.primary_title = title:c_ossory + root.primary_title = title:d_leinster + root.primary_title = title:c_desmond + } + } + modifier = { + OR = { + root.primary_title = title:d_munster + root.primary_title = title:c_ossory + root.primary_title = title:d_leinster + root.primary_title = title:c_desmond + } + factor = 3 + } + set_variable = { name = mythical_ancestor_var value = flag:eber } + } + 10 = { # Genghis Khan + trigger = { + root.culture = { has_cultural_pillar = heritage_mongolic } + current_date > 1228.1.1 + } + set_variable = { name = mythical_ancestor_var value = flag:genghis } + } + 10 = { # Emperor Constantine + trigger = { + OR = { + root.primary_title = title:c_byzantion + root.primary_title = title:e_byzantium + } + } + set_variable = { name = mythical_ancestor_var value = flag:constantine } + } + 10 = { # Emperor Justinian + trigger = { + OR = { + root.primary_title = title:c_byzantion + root.primary_title = title:e_byzantium + } + } + set_variable = { name = mythical_ancestor_var value = flag:justinian } + } + 5 = { # Melusine + trigger = { + OR = { + AND = { + has_trait = eccentric + capital_province = { geographical_region = world_europe_west } + } + #Used by the house of Anjou/Plantagenet + root.primary_title = title:c_anjou + root.primary_title = title:d_anjou + #Started in Lusignan + root.primary_title = title:d_poitou + } + current_date > 1060.1.1 + } + modifier = { #The first Plantagenets go crazy over her + OR = { + root.primary_title = title:c_anjou + root.primary_title = title:d_anjou + root.primary_title = title:d_poitou + } + current_date > 1060.1.1 + current_date < 1200.1.1 + factor = 5 + } + set_variable = { name = mythical_ancestor_var value = flag:melusine } + } + 1 = { # Fallback, only triggered when necessary + set_variable = { name = mythical_ancestor_var value = flag:fallback } + } + } + } + } +} + +disburse_hunt_legend_seeds = { + if = { + limit = { + is_ruler = yes + has_dlc_feature = legends + NOT = { has_game_rule = historical_legends_only } + } + if = { + limit = { + scope:activity.var:animal_type = flag:dragon + } + create_legend_seed = { + type = heroic + quality = famed + chronicle = beast_slayer + properties = { + beast = flag:dragon + location = root.location + } + } + } + else_if = { + limit = { + scope:activity.var:animal_type = flag:unicorn + } + create_legend_seed = { + type = heroic + quality = famed + chronicle = beast_slayer + properties = { + beast = flag:unicorn + location = root.location + } + } + } + else_if = { + limit = { + scope:activity.var:animal_type = flag:bear + } + random = { + chance = 50 + create_legend_seed = { + type = heroic + quality = famed + chronicle = beast_slayer + properties = { + beast = flag:bear + location = root.location + } + } + } + } + else_if = { + limit = { + OR = { + scope:activity.var:animal_type = flag:tiger + scope:activity.var:animal_type = flag:lion + scope:activity.var:animal_type = flag:leopard + } + } + random = { + chance = 30 + create_legend_seed = { + type = heroic + quality = famed + chronicle = beast_slayer + properties = { + beast = flag:ferocious_beast + location = root.location + } + } + } + } + } +} + +# Has to be run on the legend itself +change_legend_quality_effect = { + # Firstly, do I exist and if not, set me + if = { + limit = { + NOT = { exists = var:legend_quality_progress } + } + if = { + limit = { + $VALUE$ <= major_legend_quality_decrease + } + custom_tooltip = major_legend_quality_decrease_tt + set_variable = { + name = legend_quality_progress + value = $VALUE$ + } + } + else_if = { + limit = { + $VALUE$ <= medium_legend_quality_decrease + } + custom_tooltip = medium_legend_quality_decrease_tt + set_variable = { + name = legend_quality_progress + value = $VALUE$ + } + } + else_if = { + limit = { + $VALUE$ < 0 + } + custom_tooltip = minor_legend_quality_decrease_tt + set_variable = { + name = legend_quality_progress + value = $VALUE$ + } + } + else_if = { + limit = { + $VALUE$ >= major_legend_quality_increase + } + custom_tooltip = major_legend_quality_increase_tt + set_variable = { + name = legend_quality_progress + value = $VALUE$ + } + } + else_if = { + limit = { + $VALUE$ >= medium_legend_quality_increase + } + custom_tooltip = medium_legend_quality_increase_tt + set_variable = { + name = legend_quality_progress + value = $VALUE$ + } + } + else_if = { + limit = { + $VALUE$ > 0 + } + custom_tooltip = minor_legend_quality_increase_tt + set_variable = { + name = legend_quality_progress + value = $VALUE$ + } + } + else = { + set_variable = { + name = legend_quality_progress + value = 0 + } + } + } + # Otherwise, check if the progress is going to go over 100 and if so, cap at 100 + else_if = { + limit = { + exists = var:legend_quality_progress + 100 <= { + value = var:legend_quality_progress + add = $VALUE$ + } + } + set_variable = { + name = legend_quality_progress + value = 100 + } + } + # Otherwise, check if the progress is going to go below 0 and if so, cap at 0 + else_if = { + limit = { + exists = var:legend_quality_progress + 0 >= { + value = var:legend_quality_progress + add = $VALUE$ + } + } + set_variable = { + name = legend_quality_progress + value = 0 + } + } + # Otherwise, just apply the mathematics + else = { + if = { + limit = { + $VALUE$ <= major_legend_quality_decrease + } + custom_tooltip = major_legend_quality_decrease_tt + change_variable = { + name = legend_quality_progress + add = $VALUE$ + } + } + else_if = { + limit = { + $VALUE$ <= medium_legend_quality_decrease + } + custom_tooltip = medium_legend_quality_decrease_tt + change_variable = { + name = legend_quality_progress + add = $VALUE$ + } + } + else_if = { + limit = { + $VALUE$ < 0 + } + custom_tooltip = minor_legend_quality_decrease_tt + change_variable = { + name = legend_quality_progress + add = $VALUE$ + } + } + else_if = { + limit = { + $VALUE$ >= major_legend_quality_increase + } + custom_tooltip = major_legend_quality_increase_tt + change_variable = { + name = legend_quality_progress + add = $VALUE$ + } + } + else_if = { + limit = { + $VALUE$ >= medium_legend_quality_increase + } + custom_tooltip = medium_legend_quality_increase_tt + change_variable = { + name = legend_quality_progress + add = $VALUE$ + } + } + else_if = { + limit = { + $VALUE$ > 0 + } + custom_tooltip = minor_legend_quality_increase_tt + change_variable = { + name = legend_quality_progress + add = $VALUE$ + } + } + } +} + +#Rewards for Famed Legends +legend_ending_rewards_famed_heroic_effect = { + add_legitimacy = medium_legitimacy_gain + if = { + limit = { exists = promoted_legend } + set_variable = finished_famed_legend_var + set_variable = finished_heroic_legend_var + } +} + +legend_ending_rewards_famed_holy_effect = { + add_legitimacy = medium_legitimacy_gain + if = { + limit = { exists = promoted_legend } + set_variable = finished_famed_legend_var + set_variable = finished_holy_legend_var + } +} + +legend_ending_rewards_famed_legitimizing_effect = { + add_legitimacy = { + value = medium_legitimacy_gain + multiply = 2 + } + if = { + limit = { exists = promoted_legend } + set_variable = finished_famed_legend_var + set_variable = finished_legitimizing_legend_var + } +} + +#Rewards for Illustrious Legends +legend_ending_rewards_illustrious_heroic_effect = { + add_legitimacy = major_legitimacy_gain + if = { + limit = { exists = promoted_legend } + set_variable = finished_illustrious_legend_var + set_variable = finished_heroic_legend_var + } +} + +legend_ending_rewards_illustrious_holy_effect = { + add_legitimacy = major_legitimacy_gain + if = { + limit = { exists = promoted_legend } + set_variable = finished_illustrious_legend_var + set_variable = finished_holy_legend_var + } +} + +legend_ending_rewards_illustrious_legitimizing_effect = { + add_legitimacy = { + value = major_legitimacy_gain + multiply = 2 + } + if = { + limit = { exists = promoted_legend } + set_variable = finished_illustrious_legend_var + set_variable = finished_legitimizing_legend_var + } +} + +#Rewards for Mythical Legends +legend_ending_rewards_mythical_heroic_effect = { + add_legitimacy = massive_legitimacy_gain + # Chance to become a Living Legend + if = { + limit = { + dynasty ?= { + ce1_heroic_track_perks >= 4 + } + } + add_trait = legend + } + if = { + limit = { exists = promoted_legend } + set_variable = finished_mythical_legend_var + set_variable = finished_heroic_legend_var + } +} + +legend_ending_rewards_mythical_holy_effect = { + add_legitimacy = massive_legitimacy_gain + # Chance to become a Saint + if = { + limit = { + dynasty ?= { + ce1_heroic_track_perks >= 3 + } + } + add_trait = saint + if = { + limit = { NOT = { has_global_variable = num_of_saints_var } } + set_global_variable = { + name = num_of_saints_var + value = 1 + } + } + else = { + change_global_variable = { + name = num_of_saints_var + add = 1 + } + } + if = { + limit = { is_ai = no } + add_achievement_global_variable_effect = { + VARIABLE = ce1_canonized_achievement_unlocked + VALUE = yes + } + } + } + if = { + limit = { exists = promoted_legend } + set_variable = finished_mythical_legend_var + set_variable = finished_holy_legend_var + } +} + +legend_ending_rewards_mythical_legitimizing_effect = { + add_legitimacy = { + value = massive_legitimacy_gain + multiply = 2 + } + if = { + limit = { exists = promoted_legend } + set_variable = finished_mythical_legend_var + set_variable = finished_legitimizing_legend_var + } +} + +#We clean out the notification variables +remove_legend_notification_variables_effect = { + every_player = { + limit = { + exists = var:legend_alerted_var + var:legend_alerted_var = promoted_legend + } + remove_variable = legend_alerted_var + } +} + +#Rewards for all Heroic Legends +legend_ending_rewards_heroic_effect = { + # Legitimacy gain based on Legend Protagonist + disburse_legend_protagonist_legitimacy_effect = yes + # Available decision + custom_tooltip = legend_ending_decision_tt + hidden_effect = { + create_character_memory = { + type = ce1_completed_my_heroic_legend + participants = { + owner = root + protagonist = scope:legend_protagonist + } + } + } +} + +#Rewards for all Legitimizing Legends +legend_ending_rewards_legitimizing_effect = { + # Legitimacy gain based on Legend Protagonist + disburse_legend_protagonist_legitimacy_effect = yes + # We let you diverge if it's an Ancient People legend + if = { + limit = { + exists = scope:legendary_culture + has_dlc_feature = diverge_culture # Don't mislead players who don't have access to divergence + } + custom_tooltip = { + text = can_select_legendary_culture_pillars_tt + set_variable = { + name = legendary_culture + value = scope:legendary_culture + } + } + } + if = { #Roman Heritage legend without a Roman Empire + limit = { + scope:title_claim = title:h_roman_empire + NOT = { + exists = global_var:flag_restored_roman_empire + } + } + title:d_latium.empire = { #Italy + add_to_list = roman_heritage_claims + } + title:d_tunis.kingdom = { #North Africa + add_to_list = roman_heritage_claims + } + title:d_thrace.empire = { #Byz + add_to_list = roman_heritage_claims + } + title:d_alexandria.kingdom = { #Egypt + add_to_list = roman_heritage_claims + } + title:d_antioch.kingdom = { #Syria + add_to_list = roman_heritage_claims + } + title:d_palestine.kingdom = { #Palestine + add_to_list = roman_heritage_claims + } + custom_tooltip = { + text = legend_title_does_not_exist_sub_realm_claims_given_tt + } + hidden_effect = { + every_in_list = { + list = roman_heritage_claims + + if = { + limit = { + exists = this.holder + this.holder != root + } + root = { + add_pressed_claim = prev + add_to_variable_list = { + name = legendary_claims + target = prev + } + } + } + else_if = { + limit = { + this.tier > tier_county + } + hidden_effect = { + legend_distribute_claims_in_de_jure = yes + } + } + } + } + + } + else_if = { + limit = { + exists = scope:title_claim.holder + scope:title_claim.holder != root + } + add_pressed_claim = scope:title_claim + add_to_variable_list = { + name = legendary_claims + target = scope:title_claim + } + } + else_if = { + limit = { + scope:title_claim.tier > tier_county + } + custom_tooltip = { + text = legend_title_does_not_exist_sub_realm_claims_given_tt + } + hidden_effect = { + scope:title_claim = { + legend_distribute_claims_in_de_jure = yes + } + } + } + # Available decision + custom_tooltip = legend_ending_decision_tt + promoted_legend ?= { set_variable = finished_legend_var } + hidden_effect = { + create_character_memory = { + type = ce1_completed_my_legitimizing_legend + participants = { + owner = root + protagonist = scope:legend_protagonist + } + } + } +} + +legend_distribute_claims_in_de_jure = { + every_direct_de_jure_vassal_title = { + if = { + limit = { + exists = holder + } + root = { + add_pressed_claim = prev + add_to_variable_list = { + name = legendary_claims + target = prev + } + } + } + else_if = { + limit = { + this.tier > tier_county + } + every_direct_de_jure_vassal_title = { + if = { + limit = { + exists = holder + } + root = { + add_unpressed_claim = prev + add_to_variable_list = { + name = legendary_claims + target = prev + } + } + } + else_if = { + limit = { + this.tier > tier_county + } + every_direct_de_jure_vassal_title = { + if = { + limit = { + exists = holder + } + root = { + add_unpressed_claim = prev + add_to_variable_list = { + name = legendary_claims + target = prev + } + } + } + } + } + } + } + } +} + +#Rewards for all Holy Legends +legend_ending_rewards_holy_effect = { + # Legitimacy gain based on Legend Protagonist + disburse_legend_protagonist_legitimacy_effect = yes + # Available decision + custom_tooltip = legend_ending_decision_tt + promoted_legend ?= { set_variable = finished_legend_var } + hidden_effect = { + create_character_memory = { + type = ce1_completed_my_holy_legend + participants = { + owner = root + protagonist = scope:legend_protagonist + } + } + } +} + +# Achievements for legends +legend_ending_achievements_effect = { + if = { + limit = { + exists = promoted_legend + } + if = { # If you have the legend of Scota + limit = { + is_ai = no + promoted_legend ?= { + has_legend_chronicle = ancient_people + legend_property:culture ?= culture:ancient_egyptian + legend_property:title ?= title:k_scotland + legend_property:original_region ?= geographical_region:ghw_region_egypt_et_al + } + } + add_achievement_global_variable_effect = { + VARIABLE = ce1_the_pharaoh_islands_achievement_unlocked + VALUE = yes + } + } + if = { + limit = { is_ai = no } + add_achievement_global_variable_effect = { + VARIABLE = ce1_legendary_achievement_unlocked + VALUE = yes + } + } + if = { # If you finish your ancestor's legend + limit = { + is_ai = no + has_variable = ce1_neverending_story_achievement_possible + promoted_legend = { has_variable = ce1_neverending_story_achievement_possible_legend } + } + add_achievement_global_variable_effect = { + VARIABLE = ce1_neverending_story_achievement_unlocked + VALUE = yes + } + } + if = { # If you finish a mythical legend as a count + limit = { + is_ai = no + highest_held_title_tier = tier_county + promoted_legend = { legend_quality = mythical } + } + add_achievement_global_variable_effect = { + VARIABLE = ce1_local_legend_achievement_unlocked + VALUE = yes + } + } + } +} + +get_appropriate_ancient_people = { + random_list = { + 999 = { + trigger = { + religion = { is_in_family = rf_abrahamic } + NOT = { culture = culture:hebrew } + } + set_variable = { + name = original_region + value = geographical_region:israel_region + years = 1 + } + culture:hebrew = { save_scope_as = ancient_culture } + } + 999 = { + trigger = { + OR = { + root.culture = { + OR = { + culture_overlaps_geographical_region = world_europe + culture_overlaps_geographical_region = world_africa + culture_overlaps_geographical_region = world_asia_minor + } + } + culture = culture:egyptian + culture = culture:scottish + } + NOT = { culture = culture:ancient_egyptian } + } + set_variable = { + name = original_region + value = geographical_region:ghw_region_egypt_et_al + years = 1 + } + culture:ancient_egyptian = { save_scope_as = ancient_culture } + } + 999 = { + trigger = { + OR = { + root.culture = { + OR = { + culture_overlaps_geographical_region = world_steppe + culture_overlaps_geographical_region = custom_carpathia + } + } + culture = { has_cultural_pillar = heritage_turkic } + culture = { has_cultural_pillar = heritage_mongolic } + culture = { has_cultural_pillar = heritage_magyar } + } + NOT = { culture = culture:hunnic } + } + set_variable = { + name = original_region + value = geographical_region:world_steppe_west + years = 1 + } + culture:hunnic = { save_scope_as = ancient_culture } + } + 999 = { + trigger = { + OR = { + root.culture = { + culture_overlaps_geographical_region = world_europe + } + culture = { has_cultural_pillar = heritage_iberian } + culture = { has_cultural_pillar = heritage_north_germanic } + } + NOT = { culture = culture:gothic } + } + set_variable = { + name = original_region + value = geographical_region:world_steppe_west + years = 1 + } + culture:gothic = { save_scope_as = ancient_culture } + } + 999 = { + trigger = { + OR = { + root.culture = { + OR = { + culture_overlaps_geographical_region = world_asia_minor + culture_overlaps_geographical_region = world_middle_east + } + } + } + NOT = { culture = culture:persian } + } + set_variable = { + name = original_region + value = geographical_region:world_middle_east_persia + years = 1 + } + culture:persian = { save_scope_as = ancient_culture } + } + 999 = { + trigger = { + OR = { + root.culture = { + OR = { + culture_overlaps_geographical_region = world_europe + culture_overlaps_geographical_region = world_asia_minor + culture_overlaps_geographical_region = world_middle_east + culture_overlaps_geographical_region = world_africa_north + } + } + } + NOT = { culture = culture:trojan } + } + set_variable = { + name = original_region + value = geographical_region:troy_region + years = 1 + } + culture:trojan = { save_scope_as = ancient_culture } + } + 999 = { + trigger = { + OR = { + root.culture = { + OR = { + culture_overlaps_geographical_region = world_europe + culture_overlaps_geographical_region = world_asia_minor + culture_overlaps_geographical_region = world_middle_east + culture_overlaps_geographical_region = world_africa_north + culture_overlaps_geographical_region = world_india + culture_overlaps_geographical_region = world_steppe_tarim + } + } + } + NOT = { culture = culture:macedonian } + } + set_variable = { + name = original_region + value = geographical_region:world_europe_south_east + years = 1 + } + culture:macedonian = { save_scope_as = ancient_culture } + } + 999 = { + trigger = { + OR = { + root.culture = { + culture_overlaps_geographical_region = custom_roman_full_borders + } + religion = religion:hellenism_religion + religion = { + AND = { + is_in_family = rf_abrahamic + NOT = { this = religion:judaism_religion } + } + } + } + NOT = { culture = culture:roman } + } + set_variable = { + name = original_region + value = geographical_region:custom_roman_full_borders + years = 1 + } + culture:roman = { save_scope_as = ancient_culture } + } + 1 = { # Roman (fallback, placeholder) + set_variable = { + name = original_region + value = geographical_region:custom_roman_full_borders + years = 1 + } + culture:roman = { save_scope_as = ancient_culture } + } + } +} + +get_appropriate_exotic_location = { + random_list = { + 999 = { # Atlantis, must care about Greek stuff + trigger = { + OR = { + religion = { is_in_family = rf_abrahamic } + religion = religion:hellenism_religion + culture = { has_cultural_pillar = heritage_byzantine } + culture = { has_cultural_pillar = heritage_ancient_greek } + culture = { has_cultural_pillar = heritage_latin } + } + } + save_scope_value_as = { + name = exotic_location + value = flag:atlantis + } + } + 999 = { # Olympus, must care about Greek stuff + trigger = { + OR = { + religion = { is_in_family = rf_abrahamic } + religion = religion:hellenism_religion + culture = { has_cultural_pillar = heritage_byzantine } + culture = { has_cultural_pillar = heritage_ancient_greek } + culture = { has_cultural_pillar = heritage_latin } + } + } + save_scope_value_as = { + name = exotic_location + value = flag:olympus + } + } + 999 = { # India, must be faraway + trigger = { + NOT = { + any_character_to_title_neighboring_and_across_water_county = { + title_province = { geographical_region = world_india } + } + } + } + save_scope_value_as = { + name = exotic_location + value = flag:hindustan + } + } + 999 = { # Vinland, must be into vikings and adventures and all that + trigger = { + OR = { + religion = religion:germanic_religion + culture = { has_cultural_pillar = heritage_north_germanic } + culture = { has_innovation = innovation_varangian_adventurers } + } + } + save_scope_value_as = { + name = exotic_location + value = flag:vinland + } + } + 999 = { # Sunset invasion memes + trigger = { + OR = { + religion = religion:germanic_religion + culture = { has_cultural_pillar = heritage_north_germanic } + culture = { has_innovation = innovation_varangian_adventurers } + } + } + save_scope_value_as = { + name = exotic_location + value = flag:sunset_empire + } + } + 999 = { # Kingdom of Prester John, must be a Christian who doesn't know about Copts + trigger = { + religion = religion:christianity_religion + NOT = { + any_character_to_title_neighboring_and_across_water_county = { + holder = { faith = faith:coptic } + } + } + NOT = { # Prester John isn't exciting if Egypt is Christian + title:k_egypt = { + holder ?= { religion = religion:christianity_religion } + } + } + } + save_scope_value_as = { + name = exotic_location + value = flag:prester_john_kingdom + } + } + 999 = { # Albion, Christians in Jerusalem were way way into Arthurian myth + trigger = { + religion = religion:christianity_religion + capital_county = { + title_province = { geographical_region = world_middle_east } + } + } + save_scope_value_as = { + name = exotic_location + value = flag:albion + } + } + 999 = { # Himavanta, legendary forest in the himalayas + trigger = { + OR = { + capital_county = { + title_province = { + OR = { + geographical_region = world_india + geographical_region = world_tibet + geographical_region = world_burma + geographical_region = world_asia_china + } + } + } + culture = { culture_overlaps_geographical_region = world_india } + culture = { culture_overlaps_geographical_region = world_tibet } + culture = { culture_overlaps_geographical_region = world_burma } + culture = { culture_overlaps_geographical_region = world_asia_china } + } + } + save_scope_value_as = { + name = exotic_location + value = flag:himavanta + } + } + 999 = { # Mahishmati, lost city + trigger = { + OR = { + capital_county = { + title_province = { geographical_region = world_india } + } + culture = { culture_overlaps_geographical_region = world_india } + } + } + save_scope_value_as = { + name = exotic_location + value = flag:mahishmati + } + } + 999 = { # Kumari Kandam, lost continent + trigger = { + culture = { + has_cultural_pillar = heritage_dravidian + } + } + save_scope_value_as = { + name = exotic_location + value = flag:kumari_kandam + } + } + 999 = { # Beyul, hidden valleys + trigger = { + OR = { + capital_county.title_province = { + OR = { + geographical_region = world_tibet + geographical_region = world_asia_china + } + } + culture = { culture_overlaps_geographical_region = world_tibet } + culture = { culture_overlaps_geographical_region = world_asia_china } + } + } + save_scope_value_as = { + name = exotic_location + value = flag:beyul + } + } + 999 = { # Bald Mountain, slavic witchy mountain + trigger = { + OR = { + culture_has_slavic_heritage_pillar_trigger = yes + religion = religion:slavic_religion + } + } + save_scope_value_as = { + name = exotic_location + value = flag:bald_mountain + } + } + 999 = { # Irum, lost city in the Quran + trigger = { + religion = religion:islam_religion + } + save_scope_value_as = { + name = exotic_location + value = flag:irum + } + } + 1 = { # China (fallback) + save_scope_value_as = { + name = exotic_location + value = flag:china + } + } + } +} + +# Generates a legend seed that just points to a loc key by combining FAITH with GOD (example, FAITH = germanic + GOD = high_god will result in germanic_high_god_name and localise to "Odin") +generate_godly_descent_seed_support_effect = { + create_legend_seed = { + type = holy + quality = famed + chronicle = godly_descent + properties = { + god = flag:$FAITH$_$GOD$_name + title = root.primary_title + } + } +} + +# Runs the above effect based on an actual RELIGION that you feed into it, for example feeding Root.Religion into RELIGION will cause it to generate your religion's god loc keys +generate_religion_descent_effect = { + if = { + limit = { + $RELIGION$ = religion:akom_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = akom + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:baltic_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = baltic + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:basque_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = basque + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:bon_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = bon + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:buddhism_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = buddhism + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:tani_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = tani + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:dualism_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = dualism + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:finno_ugric_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = finno_ugric + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:germanic_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = germanic + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:hellenism_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = hellenism + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:hinduism_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = hinduism + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:jainism_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = jainism + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:kushitism_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = kushitism + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:magyar_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = magyar + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:mundhum_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = mundhumism + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:north_african_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = acham + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:qiangic_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = qiangic + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:siberian_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = siberian + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:slavic_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = slavic + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:taoism_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = taoism + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:tengrism_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = tengrism + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:waaqism_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = waaqism + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:west_african_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = west_african + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:west_african_bori_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = west_african_bori + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:west_african_orisha_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = west_african_orisha + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:west_african_roog_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = west_african_roog + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:yazidi_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = yazidi + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:zoroastrianism_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = zoroastrianism + GOD = $GOD$ + } + } + else_if = { + limit = { + $RELIGION$ = religion:zunism_religion + } + generate_godly_descent_seed_support_effect = { + FAITH = zunism + GOD = $GOD$ + } + } + else = { # Generic Pagan, fallback + generate_godly_descent_seed_support_effect = { + FAITH = paganism + GOD = $GOD$ + } + } +} + +# Mythical Legends guaranteed access to Legendary Buildings + +give_legendary_building_mythical_holy_tooltip_effect = { + if = { + limit = { + OR = { + root = { + locale_valid_for_legendary_buildings = yes + } + capital_province = { has_special_building_slot = no } + any_sub_realm_barony = { + title_province = { has_special_building_slot = no } + } + } + } + give_legendary_building_location_holy_effect = yes + } + set_variable = { + name = legendary_reward_location + value = scope:legendary_locale + } + set_variable = { + name = legendary_figure + value = scope:protagonist + } +} + +give_legendary_building_mythical_heroic_tooltip_effect = { + if = { + limit = { + OR = { + root = { + locale_valid_for_legendary_buildings = yes + } + capital_province = { has_special_building_slot = no } + any_sub_realm_barony = { + title_province = { has_special_building_slot = no } + } + } + } + give_legendary_building_location_heroic_effect = yes + } + set_variable = { + name = legendary_reward_location + value = scope:legendary_locale + } + set_variable = { + name = legendary_figure + value = scope:protagonist + } +} + +give_legendary_building_mythical_legitimizing_tooltip_effect = { + if = { + limit = { + OR = { + root = { + locale_valid_for_legendary_buildings = yes + } + capital_province = { has_special_building_slot = no } + any_sub_realm_barony = { + title_province = { has_special_building_slot = no } + } + } + } + give_legendary_building_location_legitimizing_effect = yes + } + set_variable = { + name = legendary_reward_location + value = scope:legendary_locale + } + set_variable = { + name = legendary_figure + value = scope:protagonist + } +} + +# Famed/Illustrious have a 50% chance + +give_legendary_building_holy_tooltip_effect = { #50% chance + # Chance to get legendary building + if = { + limit = { + OR = { + root = { + locale_valid_for_legendary_buildings = yes + } + capital_province = { has_special_building_slot = no } + any_sub_realm_barony = { + title_province = { has_special_building_slot = no } + } + } + } + random = { + chance = { + value = 50 + } + give_legendary_building_location_holy_effect = yes + } + } + set_variable = { + name = legendary_reward_location + value = scope:legendary_locale + } + set_variable = { + name = legendary_figure + value = scope:protagonist + } +} + +give_legendary_building_heroic_tooltip_effect = { #50% chance + # Chance to get legendary building + if = { + limit = { + OR = { + root = { + locale_valid_for_legendary_buildings = yes + } + capital_province = { has_special_building_slot = no } + any_sub_realm_barony = { + title_province = { has_special_building_slot = no } + } + } + } + random = { + chance = { + value = 50 + } + give_legendary_building_location_heroic_effect = yes + set_variable = { + name = legendary_reward_location + value = scope:legendary_locale + } + set_variable = { + name = legendary_figure + value = scope:protagonist + } + } + } +} + +give_legendary_building_legitimizing_tooltip_effect = { #50% chance + # Chance to get legendary building + if = { + limit = { + OR = { + root = { + locale_valid_for_legendary_buildings = yes + } + capital_province = { has_special_building_slot = no } + any_sub_realm_barony = { + title_province = { has_special_building_slot = no } + } + } + } + random = { + chance = { + value = 50 + } + give_legendary_building_location_legitimizing_effect = yes + } + } + set_variable = { + name = legendary_reward_location + value = scope:legendary_locale + } + set_variable = { + name = legendary_figure + value = scope:protagonist + } +} + +give_legendary_building_location_standard_effect = { + if = { # Prioritize the location of the legend if possible + limit = { + root = { + locale_valid_for_legendary_buildings = yes + } + } + scope:location = { save_scope_as = legendary_locale } + } + else_if = { # Otherwise, get the capital + limit = { + capital_province = { has_special_building_slot = no } + } + capital_province = { save_scope_as = legendary_locale } + } + else_if = { # Otherwise, prioritize a title you hold directly + limit = { + any_held_title = { + title_tier = county + title_province = { has_special_building_slot = no } + } + } + random_held_title = { + title_tier = county + limit = { + title_province = { has_special_building_slot = no } + } + title_province = { save_scope_as = legendary_locale } + } + } + else_if = { #Otherwise, prioritize a barony that you hold directly + limit = { + any_held_title = { + title_tier = barony + title_province = { + has_special_building_slot = no + } + } + } + random_held_title = { + title_tier = barony + limit = { + title_province = { + has_special_building_slot = no + } + } + title_province = { + save_scope_as = legendary_locale + } + } + + } + else_if = { # Otherwise, prioritize a barony within a title you hold + limit = { + any_held_title = { + title_tier = county + any_county_province = { has_special_building_slot = no } + } + } + random_held_title = { + title_tier = county + limit = { + any_county_province = { has_special_building_slot = no } + } + random_county_province = { + limit = { + has_special_building_slot = no + } + save_scope_as = legendary_locale + } + } + } + else_if = { # Find a feudal barony... + limit = { + any_sub_realm_barony = { + title_province = { + has_special_building_slot = no + has_holding_type = castle_holding + } + } + } + random_sub_realm_barony = { + limit = { + title_province = { + has_special_building_slot = no + has_holding_type = castle_holding + } + } + title_province = { save_scope_as = legendary_locale } + } + } + else_if = { # Find a province with a holding + limit = { + any_sub_realm_barony = { + title_province = { + has_special_building_slot = no + has_holding = yes + } + } + } + random_sub_realm_barony = { + limit = { + title_province = { + has_special_building_slot = no + has_holding = yes + } + } + title_province = { save_scope_as = legendary_locale } + } + } + else = { # Final fallback, just any barony in your realm + random_sub_realm_barony = { + title_province = { save_scope_as = legendary_locale } + } + } + if = { + limit = { + OR = { + exists = scope:beast + has_trait_xp = { + trait = lifestyle_hunter + track = hunter + value >= 62 + } + has_trait_xp = { + trait = lifestyle_hunter + track = falconer + value >= 62 + } + culture ?= { + has_cultural_parameter = always_unlock_legendary_hunting_lodge + } + } + } + custom_tooltip = { + text = can_build_legendary_hunting_lodge_tt + add_character_flag = legendary_hunting_lodge_flag + } + } + if = { + limit = { + dynasty ?= { ce1_heroic_track_perks >= 5 } + } + custom_tooltip = { + text = can_build_legendary_watchtower_tt + add_character_flag = legendary_watchtower_flag + } + } +} + +give_legendary_building_location_holy_effect = { + give_legendary_building_location_standard_effect = yes + custom_tooltip = { + text = can_build_legendary_shrine_tt + add_character_flag = legendary_shrine_flag + } +} + +give_legendary_building_location_heroic_effect = { + give_legendary_building_location_standard_effect = yes + custom_tooltip = { + text = can_build_legendary_statue_tt + add_character_flag = legendary_statue_flag + } +} + +give_legendary_building_location_legitimizing_effect = { + give_legendary_building_location_standard_effect = yes + custom_tooltip = { + text = can_build_legendary_palace_tt + add_character_flag = legendary_palace_flag + } +} + +legend_seed_new_title_effect = { + if = { + limit = { has_dlc_feature = legends } + create_legend_seed = { + type = heroic + quality = famed + chronicle = new_title + properties = { + title = root.primary_title + founder = root + } + } + } +} + +legend_seed_great_deed_dynasty_effect = { + if = { + limit = { has_dlc_feature = legends } + if = { + limit = { + highest_held_title_tier < tier_hegemony + } + create_legend_seed = { + type = legitimizing + quality = famed + chronicle = great_deed_dynasty + properties = { + dynasty = root.dynasty + founder = root + title = root.primary_title.empire + } + } + } + else = { + create_legend_seed = { + type = legitimizing + quality = famed + chronicle = great_deed_dynasty + properties = { + dynasty = root.dynasty + founder = root + title = root.primary_title + } + } + } + } +} + +legend_seed_great_deed_region_effect = { + if = { + limit = { has_dlc_feature = legends } + create_legend_seed = { + type = heroic + quality = famed + chronicle = great_deed_region + properties = { + legend_region = $REGION$ + founder = root + } + } + } +} + +legend_seed_great_deed_title_effect = { + if = { + limit = { has_dlc_feature = legends } + create_legend_seed = { + type = heroic + quality = famed + chronicle = great_deed_title + properties = { + title = $TITLE$ + founder = root + } + } + } +} + +legend_seed_great_deed_faith_effect = { + if = { + limit = { has_dlc_feature = legends } + create_legend_seed = { + type = holy + quality = famed + chronicle = great_deed_faith + properties = { + founder = root + antagonist = $ANTAGONIST$ + old_faith = $OLD_FAITH$ + new_faith = root.faith + } + } + } +} + +legend_seed_struggle_ended_effect = { + if = { + limit = { has_dlc_feature = legends } + create_legend_seed = { + type = heroic + quality = famed + chronicle = struggle_ended + properties = { + founder = root + culture = root.culture + struggle = $STRUGGLE$ + struggle_ending = $STRUGGLE_ENDING$ + } + } + } +} + +mark_historical_legend_as_done = { + if = { # Dynastic legacy + limit = { + legend_property:founder ?= legend_owner.house.house_founder + legend_property:dynasty ?= legend_owner.dynasty + legend_property:title ?= legend_owner.primary_title + } + legend_owner.dynasty = { + set_variable = { + name = dynasty_legend_used + value = yes + } + } + } + if = { # Arthur + limit = { + legend_property:ancestor ?= character:159835 + legend_property:title ?= title:k_england + } + set_global_variable = { + name = king_arthur_legend + value = yes + } + } + else_if = { # Carolingian + limit = { + legend_property:ancestor ?= character:6392 + legend_property:title ?= title:e_france + } + set_global_variable = { + name = carolingian_legend + value = yes + } + } + else_if = { # the_wheelwright + limit = { + legend_property:ancestor ?= character:82233 + } + set_global_variable = { + name = the_wheelwright_legend + value = yes + } + } + else_if = { # cadell + limit = { + legend_property:ancestor ?= character:159058 + } + set_global_variable = { + name = cadell_legend + value = yes + } + } + else_if = { # sons_of_rurik + limit = { + legend_property:ancestor ?= character:40605 + } + set_global_variable = { + name = sons_of_rurik_legend + value = yes + } + } + else_if = { # el_cid + limit = { + legend_property:ancestor ?= character:107590 + } + set_global_variable = { + name = el_cid_legend + value = yes + } + } + else_if = { # peasant_emperor + limit = { + legend_property:ancestor ?= character:1700 + } + set_global_variable = { + name = peasant_emperor_legend + value = yes + } + } + else_if = { # premysl + limit = { + legend_property:ancestor ?= character:168345 + } + set_global_variable = { + name = premysl_legend + value = yes + } + } + else_if = { # borjigin + limit = { + legend_property:ancestor ?= character:303250 + } + set_global_variable = { + name = borjigin_legend + value = yes + } + } + else_if = { # the_red_hand + limit = { + legend_property:ancestor ?= character:7255 + } + set_global_variable = { + name = the_red_hand_legend + value = yes + } + } + else_if = { # yazdagird_iii + limit = { + legend_property:ancestor ?= character:180637 + } + set_global_variable = { + name = yazdagird_iii_legend + value = yes + } + } + else_if = { # bahram_gur + limit = { + legend_property:ancestor ?= character:180645 + } + set_global_variable = { + name = bahram_gur_legend + value = yes + } + } + else_if = { # saman_khudah + limit = { + legend_property:ancestor ?= character:188637 + } + set_global_variable = { + name = saman_khudah_legend + value = yes + } + } + else_if = { # saman_khudah + limit = { + legend_property:ancestor ?= character:163109 + } + set_global_variable = { + name = ragnarr_legend + value = yes + } + } + else_if = { + limit = { + legend_property:ancestor_flag ?= flag:vercingetorix + } + set_global_variable = { + name = vercingetorix_legend + value = yes + } + } + else_if = { + limit = { + legend_property:ancestor_flag ?= flag:afrasiyab + } + set_global_variable = { + name = afrasiyab_legend + value = yes + } + } + else_if = { + limit = { + legend_property:culture ?= culture:hebrew + legend_property:title ?= title:k_georgia + legend_property:original_region ?= geographical_region:world_middle_east_jerusalem + } + set_global_variable = { + name = sons_of_david_legend + value = yes + } + } + else_if = { + limit = { + legend_property:ancestor_flag ?= flag:magi + } + set_global_variable = { + name = magi_descendant_legend + value = yes + } + } + else_if = { + limit = { + legend_property:culture ?= culture:gothic + legend_property:title ?= title:e_spain + legend_property:original_region ?= geographical_region:world_steppe_west + } + set_global_variable = { + name = gothic_kings_legend + value = yes + } + } + else_if = { + limit = { + legend_property:culture ?= culture:trojan + legend_property:title ?= title:e_britannia + legend_property:original_region ?= geographical_region:troy_region + } + set_global_variable = { + name = new_troy_london_legend + value = yes + } + } + else_if = { + limit = { + legend_property:culture ?= culture:trojan + legend_property:title ?= title:c_cornwall + legend_property:original_region ?= geographical_region:troy_region + } + set_global_variable = { + name = corineus_legend + value = yes + } + } + else_if = { + limit = { + legend_property:culture ?= culture:ancient_egyptian + legend_property:title ?= title:k_scotland + legend_property:original_region ?= geographical_region:ghw_region_egypt_et_al + } + set_global_variable = { + name = scota_legend + value = yes + } + } + else_if = { + limit = { + legend_property:culture ?= culture:hebrew + legend_property:title ?= title:e_abyssinia + legend_property:original_region ?= geographical_region:ghw_region_jerusalem + } + set_global_variable = { + name = menelik_i_legend + value = yes + } + } + else_if = { + limit = { + legend_property:culture ?= culture:hebrew + legend_property:title ?= title:e_abyssinia + legend_property:original_region ?= geographical_region:israel_region + } + set_global_variable = { + name = kings_of_semien_legend + value = yes + } + } + else_if = { + limit = { + legend_property:culture ?= culture:roman + legend_property:original_region ?= geographical_region:custom_roman_full_borders + } + set_global_variable = { + name = roman_heritage_legend + value = yes + } + } + else_if = { + limit = { + legend_property:culture ?= culture:hunnic + legend_property:title ?= title:e_caspian-pontic_steppe + legend_property:original_region ?= geographical_region:world_steppe_west + } + set_global_variable = { + name = hunnic_heritage_legend + value = yes + } + } + else_if = { + limit = { + legend_property:ancestor ?= character:7627 + } + set_global_variable = { + name = alfred_of_wessex_legend + value = yes + } + } + else_if = { + limit = { + legend_property:ancestor ?= character:168130 + } + set_global_variable = { + name = william_gellones_legend + value = yes + } + } + else_if = { + limit = { + legend_property:ancestor ?= character:99 + } + set_global_variable = { + name = edward_the_martyr_legend + value = yes + } + } + else_if = { + limit = { + legend_property:ancestor_flag ?= flag:noah + } + set_global_variable = { + name = sceafa_legend + value = yes + } + } + else_if = { + limit = { + legend_property:ancestor_flag ?= flag:shibi_chakravarti + } + set_global_variable = { + name = shibi_chakravarti_legend + value = yes + } + } + else_if = { + limit = { + legend_property:beast ?= flag:naga + } + set_global_variable = { + name = naga_descent_legend + value = yes + } + } + else_if = { + limit = { + legend_property:beast ?= flag:dragon + } + set_global_variable = { + name = pyusawhti_legend + value = yes + } + } + else_if = { + limit = { + legend_property:god ?= flag:germanic_high_god_name + legend_property:title ?= title:k_norway + } + set_global_variable = { + name = hieros_gamos_skirnismal_legend + value = yes + } + } + else_if = { + limit = { + legend_property:god ?= flag:hinduism_high_god_name + legend_property:title ?= title:e_deccan + } + set_global_variable = { + name = descendants_of_brahman_legend + value = yes + } + } +} + +legend_seed_struggle_ending_effect = { + create_legend_seed = { + type = heroic + quality = famed + chronicle = struggle_conclusion + properties = { + struggle_ender = $ENDER$ + struggle = flag:$STRUGGLE$ + } + } +} + +balancing_legend_global_var_effect = { + if = { + limit = { + NOT = { has_global_variable = legend_count_var } + } + set_global_variable = { + name = legend_count_var + value = 1 + } + } + else = { + change_global_variable = { + name = legend_count_var + add = 1 + } + } +} + +gain_heroic_legend_seed_tooltip_effect = { + if = { + limit = { + has_dlc_feature = legends + } + custom_tooltip = gain_heroic_legend_seed.tt + } +} + +gain_holy_legend_seed_tooltip_effect = { + if = { + limit = { + has_dlc_feature = legends + } + custom_tooltip = gain_holy_legend_seed.tt + } +} + +gain_legitimizing_legend_seed_tooltip_effect = { + if = { + limit = { + has_dlc_feature = legends + } + custom_tooltip = gain_legitimizing_legend_seed.tt + } +} + +send_interface_message_legend_notification_effect = { + county = { save_scope_as = spread_county } + scope:legend = { save_scope_as = spread_legend } + county.holder = { + set_variable = { + name = legend_alerted_var + value = scope:legend + } + send_interface_message = { + type = event_generic_good_text + title = legend_spread_notification_title + desc = legend_spread_notification_desc + + right_icon = scope:spread_county + } + } +} + +send_interface_toast_legend_notification_effect = { + county = { save_scope_as = spread_county } + scope:legend = { save_scope_as = spread_legend } + county.holder = { + set_variable = { + name = legend_alerted_var + value = scope:legend + } + send_interface_toast = { + title = legend_spread_notification_title + custom_tooltip = legend_spread_notification_desc + left_icon = scope:spread_county + } + } +} + +create_swan_knight_legend_seed_effect = { + if = { + limit = { + location = { + geographical_region = world_europe + } + } + create_legend_seed = { + type = heroic + quality = famed + chronicle = swan_knight + properties = { + friendly_animal = flag:swan + } + } + } + else_if = { + limit = { + location = { + OR = { + geographical_region = world_india + geographical_region = world_burma + geographical_region = ghw_region_caucasus + geographical_region = world_asia_china + geographical_region = world_asia_japan + geographical_region = world_asia_korea + geographical_region = world_asia_southeast + } + } + } + create_legend_seed = { + type = heroic + quality = famed + chronicle = swan_knight + properties = { + friendly_animal = flag:tiger + } + } + } + else_if = { + limit = { + location = { + geographical_region = world_africa + } + } + create_legend_seed = { + type = heroic + quality = famed + chronicle = swan_knight + properties = { + friendly_animal = flag:lion + } + } + } + else = { + create_legend_seed = { + type = heroic + quality = famed + chronicle = swan_knight + properties = { + friendly_animal = flag:hart + } + } + } +} diff --git a/N3OW/common/scripted_effects/06_dlc_ce1_legitimacy_effects.txt b/N3OW/common/scripted_effects/06_dlc_ce1_legitimacy_effects.txt new file mode 100644 index 00000000..04dc03e6 --- /dev/null +++ b/N3OW/common/scripted_effects/06_dlc_ce1_legitimacy_effects.txt @@ -0,0 +1,556 @@ +###################### +# Legitimacy +###################### + +#standard_activity_participation_legitimacy_effect +#legendary_hunt_participation_legitimacy_effect +#grand_activity_participation_legitimacy_effect +#war_end_legitimacy_effect +#faction_war_end_legitimacy_effect +#faction_accept_demand_legitimacy_effect +#excommunication_legitimacy_effect +#hostile_scheme_exposure_legitimacy_effect +#epidemic_outbreak_legitimacy_effect +#epidemic_endemic_capital_legitimacy_effect +#disburse_legend_protagonist_legitimacy_effect +#base_legitimacy_intent_reward - Give a small amount of legitimacy, just in case players didn't get any events relating to it + +add_legitimacy_effect = { + if = { + limit = { is_valid_for_legitimacy_change = yes } + add_legitimacy = $LEGITIMACY$ + } +} + +# LEGITIMACY GAIN FOR STANDARD ACTIVITY PARTICIPATION +standard_activity_participation_legitimacy_effect = { + if = { + limit = { is_valid_for_legitimacy_change = yes } + if = { + limit = { + this = scope:host + } + add_legitimacy = minor_legitimacy_gain + } + else = { + add_legitimacy = miniscule_legitimacy_gain + } + } +} + +# LEGITIMACY GAIN FOR PILGRIMAGE ACTIVITY PARTICIPATION +pilgrimage_activity_participation_legitimacy_effect = { + if = { + limit = { is_valid_for_legitimacy_change = yes } + if = { + limit = { + this = scope:host + dynasty ?= { + has_dynasty_perk = tgp_sea_legacy_1 + } + } + add_legitimacy = tgp_legitimacy_from_pilgrimage + } + else_if = { + limit = { + this = scope:host + } + add_legitimacy = minor_legitimacy_gain + } + else = { + add_legitimacy = miniscule_legitimacy_gain + } + } +} + +# LEGITIMACY GAIN FOR LEGENDARY HUNT PARTICIPATION +legendary_hunt_participation_legitimacy_effect = { + if = { + limit = { is_valid_for_legitimacy_change = yes } + if = { + limit = { + this = scope:host + } + add_legitimacy = major_legitimacy_gain + } + else = { + add_legitimacy = medium_legitimacy_gain + } + } +} + +# LEGITIMACY GAIN FOR GRAND ACTIVITY PARTICIPATION +grand_activity_participation_legitimacy_effect = { + if = { + limit = { is_valid_for_legitimacy_change = yes } + if = { + limit = { + scope:activity = { + has_activity_type = activity_tour + has_activity_option = { + category = special_type + option = tour_type_majesty + } + } + } + add_legitimacy = major_legitimacy_gain + } + else_if = { + limit = { + this = scope:host + } + add_legitimacy = medium_legitimacy_gain + } + else = { + add_legitimacy = minor_legitimacy_gain + } + } +} + +# LEGITIMACY GAIN FOR WINNING A WAR +add_legitimacy_attacker_victory_effect = { + war_end_legitimacy_effect = { + WINNER = scope:attacker + LOSER = scope:defender + } +} + +add_legitimacy_attacker_defeat_effect = { + war_end_legitimacy_effect = { + WINNER = scope:defender + LOSER = scope:attacker + } +} + +war_end_legitimacy_effect = { + # Special rewards for Temüjin vs Jamukha + if = { + limit = { + scope:attacker = { + OR = { + this = character:125501 + this = character:mpo_mongol_1 + } + has_variable = temujin_jamukha_war_var + } + scope:defender = { + OR = { + this = character:125501 + this = character:mpo_mongol_1 + } + } + } + scope:attacker = { + add_legitimacy = 500 + } + } + else = { + if = { + limit = { + any_in_list = { list = target_titles } + } + ordered_in_list = { + list = target_titles + order_by = tier + save_scope_as = target_title + save_scope_value_as = { + name = title_tier_minus_1 + value = { + value = scope:target_title.tier + subtract = 1 + } + } + } + } + $WINNER$ = { + if = { + limit = { + is_valid_for_legitimacy_change = yes + primary_title.tier <= $LOSER$.primary_title.tier + } + send_interface_toast = { + type = msg_legitimacy_gain + title = legitimacy_gain_toast + left_icon = $WINNER$ + right_icon = $LOSER$ + + add_legitimacy = { + value = { + value = 0 + + if = { # You get a lot of Legitimacy for punching above your weight + limit = { # Specially if you are a Duke/Count against an Emperor + OR = { + primary_title.tier = tier_county + primary_title.tier = tier_duchy + } + $LOSER$.primary_title.tier = tier_empire + } + value = 200 + } + else_if = { # Or a Count against a King + limit = { + primary_title.tier = tier_county + $LOSER$.primary_title.tier = tier_kingdom + } + value = 150 + } + else_if = { # Or a Count vs a Duke + limit = { + primary_title.tier = tier_county + $LOSER$.primary_title.tier = tier_duchy + } + value = 100 + } + else_if = { # Or a Duke vs a King + limit = { + primary_title.tier = tier_duchy + $LOSER$.primary_title.tier = tier_kingdom + } + value = 100 + } + else_if = { # Or King vs Emperor + limit = { + primary_title.tier = tier_kingdom + $LOSER$.primary_title.tier = tier_empire + } + value = 100 + } + else_if = { # Special Legitimacy gain for same tier + limit = { + primary_title.tier = $LOSER$.primary_title.tier + } + value = 50 + } + } + + if = { # We give you extra Legitimacy for Religious Wars + limit = { + root.war ?= { + OR = { + using_cb = minor_religious_war + using_cb = religious_war + } + } + } + multiply = 2 + } + else_if = { # And even more for Holy Wars + limit = { + root.war ?= { + OR = { + using_cb = major_religious_war + using_cb = undirected_great_holy_war + using_cb = directed_great_holy_war + } + } + } + multiply = 3 + } + + if = { # We give you extra Legitimacy for special On Start Wars + limit = { + root.war ?= { + OR = { + using_cb = norman_conquest_cb + using_cb = norwegian_invasion_cb + using_cb = sons_of_lothbrok_invasion_cb + } + } + } + multiply = 4 + } + + if = { # And we 50% increase whatever you have if you are a nomad + limit = { + government_has_flag = government_is_nomadic + } + multiply = 1.5 + } + } + } + } + # Special extra Legitimacy gain for Byzantine rulers since their procedence didn't matter as much, to prevent them from always having 0 Legitimacy basically + hidden_effect = { + if = { + limit = { + exists = scope:target_title + scope:target_title = title:e_byzantium + $WINNER$ = { is_valid_for_legitimacy_change = yes } + } + add_legitimacy = 1000 + } + } + } + } +} + +# LEGITIMACY FOR LOSING A FACTION WAR +faction_war_end_defeat_legitimacy_effect = { + scope:attacker = { + if = { + limit = { is_valid_for_legitimacy_change = yes } + send_interface_toast = { + type = msg_legitimacy_gain + title = legitimacy_gain_toast + left_icon = scope:attacker + right_icon = scope:defender + add_legitimacy = minor_legitimacy_gain + } + } + } + scope:defender = { + if = { + limit = { + is_valid_for_legitimacy_change = yes + #prevent China from falling into Chaos when the Hegemony is claimed by not removing the legitimacy + scope:attacker = { + NAND = { + is_leading_faction_type = claimant_faction + joined_faction.special_title = title:h_china + } + } + } + if = { + limit = { + scope:attacker = { + OR = { + is_leading_faction_type = peasant_faction + is_leading_faction_type = claimant_faction + is_leading_faction_type = populist_faction + } + } + } + send_interface_toast = { + type = event_toast_effect_bad + title = legitimacy_loss_toast + left_icon = scope:defender + right_icon = scope:attacker + add_legitimacy = major_legitimacy_loss + } + } + else = { + send_interface_toast = { + type = event_toast_effect_bad + title = legitimacy_loss_toast + left_icon = scope:defender + right_icon = scope:attacker + if = { + limit = { + has_nomadic_legitimacy = yes + } + add_legitimacy = { + value = medium_legitimacy_loss + multiply = 2 + } + } + else = { + add_legitimacy = medium_legitimacy_loss + } + } + } + } + } +} + +# LEGITIMACY FOR WINNING A FACTION WAR +faction_war_end_victory_legitimacy_effect = { + scope:defender = { + if = { + limit = { is_valid_for_legitimacy_change = yes } + send_interface_toast = { + type = msg_legitimacy_gain + title = legitimacy_gain_toast + left_icon = scope:attacker + right_icon = scope:defender + add_legitimacy = minor_legitimacy_gain + } + } + } +} + +# LEGITIMACY LOSS FOR ACCEPTING FACTION DEMANDS +faction_accept_demand_legitimacy_effect = { + if = { + limit = { is_valid_for_legitimacy_change = yes } + add_legitimacy = minor_legitimacy_loss + } +} + +# LEGITIMACY LOSS FROM EXCOMMUNICATION +excommunication_legitimacy_effect = { + if = { + limit = { is_valid_for_legitimacy_change = yes } + send_interface_toast = { + type = msg_legitimacy_loss + title = legitimacy_loss_toast + left_icon = scope:target_character + right_icon = scope:requesting_character + add_legitimacy = major_legitimacy_loss + } + } +} + +# LEGITIMACY LOSS FROM HOSTILE SCHEME EXPOSURE +hostile_scheme_exposure_legitimacy_effect = { + if = { + limit = { is_valid_for_legitimacy_change = yes } + add_legitimacy = minor_legitimacy_loss + } +} + +# LEGITIMACY LOSS FROM EPIDEMIC OUTBREAK +epidemic_outbreak_legitimacy_effect = { + save_scope_as = epidemic + $PROVINCE$.county.holder = { + save_scope_as = outbreak_top_liege + if = { + limit = { is_valid_for_legitimacy_change = yes } + if = { + limit = { + scope:epidemic = { outbreak_intensity = major } + } + add_legitimacy = { + value = miniscule_legitimacy_loss + multiply = $PROVINCE$.county.holder.primary_title.tier + } + } + else_if = { + limit = { + scope:epidemic = { outbreak_intensity = apocalyptic } + } + add_legitimacy = { + value = minor_legitimacy_loss + multiply = $PROVINCE$.county.holder.primary_title.tier + } + } + } + } +} + +# LEGITIMACY LOSS FROM EPIDEMIC OUTBREAK +epidemic_endemic_capital_legitimacy_effect = { + save_scope_as = endemic_capital + province_owner = { + if = { + limit = { is_valid_for_legitimacy_change = yes } + send_interface_toast = { + type = msg_legitimacy_loss + title = legitimacy_loss_toast + left_icon = scope:endemic_capital.province_owner + right_icon = scope:endemic_capital.barony + custom_tooltip = legitimacy_loss_endemic_capital_tt + add_legitimacy = miniscule_legitimacy_loss + } + } + } +} + +base_legitimacy_intent_reward = { + if = { + limit = { + has_activity_intent = legitimacy_intent + } + add_legitimacy = minor_legitimacy_gain + } +} + +# Achievements +claim_title_achievement_effect = { + if = { + limit = { + is_ai = no + scope:actor.legitimacy_level >= scope:recipient.legitimacy_level + } + add_achievement_global_variable_effect = { + VARIABLE = ce1_upward_mobility_achievement_unlocked + VALUE = yes + } + } +} + +# Legitimacy Protagonist gain from Legends +disburse_legend_protagonist_legitimacy_effect = { + # Legitimacy gain based on Protagonist + if = { + limit = { + scope:protagonist = { + this != root # The legend owner + num_virtuous_traits >= 3 + } + } + custom_tooltip = { + text = legend_protagonist_legitimacy_major_tt + add_legitimacy = major_legitimacy_gain + } + } + else_if = { + limit = { + scope:protagonist = { + this != root # The legend owner + num_virtuous_traits >= 2 + } + } + custom_tooltip = { + text = legend_protagonist_legitimacy_medium_tt + add_legitimacy = medium_legitimacy_gain + } + } + else_if = { + limit = { + scope:protagonist = { + this != root # The legend owner + num_virtuous_traits >= 1 + } + } + custom_tooltip = { + text = legend_protagonist_legitimacy_minor_tt + add_legitimacy = minor_legitimacy_gain + } + } + else_if = { # No Virtuous traits but at least you didn't choose yourself + limit = { + scope:protagonist = { + this != root + } + } + custom_tooltip = { + text = legend_protagonist_legitimacy_miniscule_tt + add_legitimacy = miniscule_legitimacy_gain + } + } +} + + +#Add legitimacy sans displaying levels +add_minor_legitimacy_no_tier_effect = { + save_scope_as = legitimacy_gainer + custom_tooltip = { + text = minor_legitimacy_gain_no_tier_tt + add_legitimacy = minor_legitimacy_gain + } +} + +add_medium_legitimacy_no_tier_effect = { + save_scope_as = legitimacy_gainer + custom_tooltip = { + text = medium_legitimacy_gain_no_tier_tt + add_legitimacy = medium_legitimacy_gain + } +} + +add_major_legitimacy_no_tier_effect = { + save_scope_as = legitimacy_gainer + custom_tooltip = { + text = major_legitimacy_gain_no_tier_tt + add_legitimacy = major_legitimacy_gain + } +} + +add_massive_legitimacy_no_tier_effect = { + save_scope_as = legitimacy_gainer + custom_tooltip = { + text = massive_legitimacy_gain_no_tier_tt + add_legitimacy = massive_legitimacy_gain + } +} diff --git a/N3OW/common/scripted_effects/07_dlc_ep3_scripted_effects.txt b/N3OW/common/scripted_effects/07_dlc_ep3_scripted_effects.txt index cbf44291..c3d366be 100644 --- a/N3OW/common/scripted_effects/07_dlc_ep3_scripted_effects.txt +++ b/N3OW/common/scripted_effects/07_dlc_ep3_scripted_effects.txt @@ -3,9 +3,6 @@ ################################################## create_landless_adventurer_title_history_effect = { - # TODO_CD_EP3: currently causes errors for history titles - #set_destroy_on_gain_same_tier = yes - #set_delete_on_destroy = yes holder ?= { if = { limit = { @@ -37,6 +34,30 @@ create_landless_adventurer_title_effect = { $FLAVOR_CHAR$ = { save_scope_as = adventurer_flavor_char } hidden_effect = { random_list = { + 1000 = { + trigger = { + scope:warrior_youth ?= scope:new_landless_adventurer + } + create_adventurer_title = { + name = adventurer_name_free_warriors + holder = scope:new_landless_adventurer + article = DEFAULT_TITLE_NAME_ARTICLE + save_scope_as = new_title + } + } + 1000 = { + trigger = { + scope:warrior_youth ?= scope:new_landless_adventurer + age <= 20 + exists = scope:host.house + } + create_adventurer_title = { + name = adventurer_name_youths + holder = scope:new_landless_adventurer + article = DEFAULT_TITLE_NAME_ARTICLE + save_scope_as = new_title + } + } 10 = { create_adventurer_title = { name = adventurer_name_001 @@ -437,6 +458,7 @@ create_landless_adventurer_title_effect = { flag:runaway_allowed = { custom_tooltip = nearby_landless_adventurer_created_message_runaway_allowed_tt } flag:runaway_forbidden = { custom_tooltip = nearby_landless_adventurer_created_message_runaway_forbidden_tt } flag:wanderer = { custom_tooltip = nearby_landless_adventurer_created_message_wanderer_tt } + flag:eradicate = { custom_tooltip = nearby_landless_adventurer_created_message_eradicate_tt } fallback = { custom_tooltip = nearby_landless_adventurer_created_message_fallback_tt } } } @@ -735,7 +757,7 @@ ep3_become_landed_save_liege_effect = { } else_if = { limit = { - scope:ruler = { is_independent_ruler = no } + scope:ruler = { top_liege != this } any_in_list = { list = $TITLE_LIST$ tier = scope:ruler.highest_held_title_tier @@ -936,9 +958,30 @@ ep3_become_landed_transfer_effect = { government_is_tribal = { save_scope_value_as = { name = old_government value = flag:tribal } } + government_is_wanua = { + save_scope_value_as = { name = old_government value = flag:wanua } + } government_is_nomadic = { save_scope_value_as = { name = old_government value = flag:nomad } } + government_is_celestial = { + save_scope_value_as = { name = old_government value = flag:admin } + } + government_is_steppe_admin = { + save_scope_value_as = { name = old_government value = flag:admin } + } + government_is_meritocratic = { + save_scope_value_as = { name = old_government value = flag:admin } + } + government_is_japan_administrative = { + save_scope_value_as = { name = old_government value = flag:admin } + } + government_is_japan_feudal = { + save_scope_value_as = { name = old_government value = flag:japan_feudal } + } + government_is_mandala = { + save_scope_value_as = { name = old_government value = flag:mandala } + } } } every_in_list = { @@ -999,7 +1042,7 @@ ep3_become_landed_transfer_effect = { } } else_if = { - limit = { is_independent_ruler = no } + limit = { top_liege != this } becomes_independent = { change = scope:title_change } } resolve_title_and_vassal_change = scope:title_change @@ -1023,15 +1066,18 @@ ep3_become_landed_transfer_effect = { change_government = nomad_government } ## Administrative. + ## Celestial. + ## Steppe admin. + ## Meritocratic. + ## Soryo. else_if = { limit = { - scope:new_primary_title = { tier > tier_duchy } OR = { - scope:new_liege ?= { government_has_flag = government_is_administrative } + scope:new_liege ?= { government_allows = administrative } scope:old_government ?= flag:admin } } - change_government = administrative_government + change_to_administrative_effect = yes } ## Clan. else_if = { @@ -1041,7 +1087,7 @@ ep3_become_landed_transfer_effect = { scope:old_government ?= flag:clan AND = { ep3_is_clan_inclined_trigger = yes - is_independent_ruler = yes + top_liege = this } } } @@ -1057,6 +1103,36 @@ ep3_become_landed_transfer_effect = { } change_government = tribal_government } + ## Wanua. + else_if = { + limit = { + OR = { + scope:new_liege ?= { government_has_flag = government_is_wanua } + scope:old_government ?= flag:wanua + } + } + change_government = wanua_government + } + ## Ritsuryo. + else_if = { + limit = { + OR = { + scope:new_liege ?= { government_has_flag = government_is_japan_feudal } + scope:old_government ?= flag:japan_feudal + } + } + change_government = japan_feudal_government + } + ## Mandala. + else_if = { + limit = { + OR = { + scope:new_liege ?= { government_has_flag = government_is_mandala } + scope:old_government ?= flag:mandala + } + } + change_government = mandala_government + } ## Else feudal. else = { change_government = feudal_government } if = { @@ -1156,7 +1232,7 @@ ep3_become_landed_cleanup_effect = { else = { if = { limit = { - is_independent_ruler = no + top_liege != this NOT = { exists = scope:new_liege } } create_title_and_vassal_change = { @@ -1383,17 +1459,9 @@ purchase_land_interaction_shortened_effect = { procure_estate_interaction_effect = { if = { - limit = { - scope:piety_option = yes - } + limit = { scope:piety_option = yes } if = { - limit = { - faith = { - NOT = { - this = scope:recipient.faith - } - } - } + limit = { faith != scope:recipient.faith } set_character_faith = scope:recipient.faith add_character_flag = { flag = procure_estate_conversion @@ -1408,9 +1476,7 @@ procure_estate_interaction_effect = { } } else_if = { - limit = { - scope:gold_option = yes - } + limit = { scope:gold_option = yes } show_as_tooltip = { pay_short_term_gold = { target = scope:recipient @@ -1422,8 +1488,12 @@ procure_estate_interaction_effect = { } } else_if = { - limit = { - scope:hook = yes + limit = { scope:hook = yes } + scope:recipient = { + add_hook = { + target = scope:actor + type = favor_hook + } } } else = { @@ -1434,25 +1504,15 @@ procure_estate_interaction_effect = { } } } - scope:recipient = { - change_influence = medium_influence_loss - add_hook = { - target = scope:actor - type = favor_hook - } - } + scope:recipient = { change_influence = medium_influence_loss } #Scope:actor becomes ladmin scope:actor = { if = { limit = { scope:actor.house ?= { any_house_member = { - any_held_title = { - is_noble_family_title = yes - } - top_liege = { - this = scope:recipient.top_liege - } + any_held_title = { is_noble_family_title = yes } + top_liege = scope:recipient.top_liege } } } @@ -1471,11 +1531,14 @@ procure_estate_interaction_effect = { return_to_court = yes } } - create_noble_family_effect = yes + create_noble_family_effect = { GOVERNMENT_GIVER = scope:recipient } hidden_effect = { # Return any escaped courtiers. every_in_list = { list = courtiers_list + limit = { + NOT = { liege_or_court_owner = scope:actor } + } scope:actor = { add_courtier = prev } } # And boot any new autogenned arrivals. @@ -1502,17 +1565,12 @@ procure_estate_interaction_effect = { change = scope:title_change } resolve_title_and_vassal_change = scope:title_change - change_government = administrative_government hidden_effect = { - if = { - limit = { - NOT = { - domicile.domicile_location = { - this = scope:recipient.capital_province - } + domicile ?= { + if = { + limit = { + NOT = { domicile_location = scope:recipient.capital_province } } - } - domicile = { move_domicile = scope:recipient.capital_province } } @@ -1538,6 +1596,7 @@ procure_estate_interaction_effect = { every_vassal_or_below = { limit = { is_ai = no + NOT = { this = scope:actor } } send_interface_message = { type = msg_landless_adventurer_nearby @@ -1636,7 +1695,7 @@ negotiate_settlement_interaction_effect = { limit = { scope:recipient = { highest_held_title_tier < scope:actor.highest_held_title_tier - is_independent_ruler = yes + top_liege = this } } create_title_and_vassal_change = { @@ -1892,7 +1951,7 @@ seize_realm_scheme_success_effect = { participants = { deposed = scope:target } } ordered_memory = { - limit = { has_memory_type = seized_realm_memory } + memory_type = seized_realm_memory order_by = memory_creation_date if = { limit = { @@ -1911,7 +1970,7 @@ seize_realm_scheme_success_effect = { participants = { deposer = scope:owner } } ordered_memory = { - limit = { has_memory_type = realm_seized_memory } + memory_type = realm_seized_memory order_by = memory_creation_date if = { limit = { @@ -1963,7 +2022,7 @@ seize_realm_scheme_failure_effect = { participants = { deposed = scope:target } } ordered_memory = { - limit = { has_memory_type = seized_realm_failed_memory } + memory_type = seized_realm_failed_memory order_by = memory_creation_date if = { limit = { @@ -2004,7 +2063,7 @@ seize_realm_scheme_failure_effect = { participants = { deposer = scope:owner } } ordered_memory = { - limit = { has_memory_type = realm_seized_failed_memory } + memory_type = realm_seized_failed_memory order_by = memory_creation_date if = { limit = { @@ -2115,7 +2174,7 @@ adventurer_realm_destabilisation_list_effect = { $TITLE_GIVER$ = { any_held_title = { tier >= scope:title.tier - NOT = { this = scope:title } + this != scope:title } } } @@ -2125,7 +2184,7 @@ adventurer_realm_destabilisation_list_effect = { } trigger_if = { limit = { - government_has_flag = government_is_administrative + government_allows = administrative } scope:title = { OR = { @@ -2260,7 +2319,7 @@ adventurer_realm_destabilisation_list_effect = { factor = 1.1 dynasty ?= { this = scope:ruler.dynasty - NOT = { this = scope:adventurer.dynasty } + this != scope:adventurer.dynasty } } modifier = { # Relatives of adventurer less likely @@ -2272,7 +2331,7 @@ adventurer_realm_destabilisation_list_effect = { factor = 0.75 dynasty ?= { this = scope:adventurer.dynasty - NOT = { this = scope:ruler.dynasty } + this != scope:ruler.dynasty } } ### HOOKS @@ -2348,7 +2407,7 @@ adventurer_realm_destabilisation_civil_war_effect = { limit = { scope:title = { any_claimant = { - NOT = { this = scope:adventurer } + this != scope:adventurer } } } @@ -2396,7 +2455,7 @@ adventurer_realm_destabilisation_civil_war_effect = { every_in_list = { list = independent_vassals limit = { - NOT = { this = scope:revolt_leader } + this != scope:revolt_leader can_join_faction = scope:faction } join_faction = scope:faction @@ -2427,11 +2486,11 @@ adventurer_realm_destabilisation_transfer_effect = { save_temporary_scope_as = vassal_temp if = { limit = { - scope:adventurer = { is_independent_ruler = yes } + scope:adventurer = { top_liege = this } scope:ruler = { NOT = { any_held_title = { - NOT = { this = scope:title } + this != scope:title any_in_de_jure_hierarchy = { this = scope:vassal_temp.primary_title } } } @@ -2444,7 +2503,7 @@ adventurer_realm_destabilisation_transfer_effect = { scope:ruler = { NOT = { any_held_title = { - NOT = { this = scope:title } + this != scope:title any_in_de_jure_hierarchy = { this = scope:vassal_temp.primary_title } } } @@ -2487,7 +2546,7 @@ adventurer_realm_destabilisation_transfer_effect = { save_temporary_scope_as = title_temp if = { limit = { - NOT = { holder = scope:adventurer } + holder != scope:adventurer OR = { holder = scope:ruler holder.highest_held_title_tier >= scope:title.tier @@ -3064,58 +3123,127 @@ torture_grants_influence_effect = { create_noble_family_effect = { debug_log = create_noble_family_title - save_scope_as = new_noble_family_holder + $GOVERNMENT_GIVER$ = { save_scope_as = government_giver } hidden_effect = { # NF can only be held by house heads if = { # Start by checking that we are not the house head already limit = { - house ?= { - house_head != scope:new_noble_family_holder - } + house ?= { house_head != scope:new_noble_family_holder } } if = { # If not, let's see if it would be reasonable to become house head... limit = { - house ?= { - house_head ?= { - top_liege = scope:new_noble_family_holder.top_liege - OR = { - is_ruler = no - primary_title = { - tier <= tier_county - } - } - is_ai = yes # Don't steal house head from a player + house.house_head ?= { + top_liege = scope:new_noble_family_holder.top_liege + OR = { + is_ruler = no + primary_title.tier <= tier_county } + is_ai = yes # Don't steal house head from a player } } house = { set_house_head = scope:new_noble_family_holder } } else = { # ... Otherwise, we create a cadet branch - create_cadet_branch = yes + create_cadet_branch = {} } } } - give_noble_family_title = { - name = noble_family_name - article = DEFAULT_TITLE_NAME_ARTICLE - save_scope_as = new_title - } - scope:new_title = { - holder = { - save_scope_as = noble_family_head - } - set_coa = scope:noble_family_head.house - } - custom_description = { - text = create_noble_family_tt - } - - #Notifications - top_liege ?= { - every_vassal = { + scope:government_giver = { + if = { limit = { - is_ai = no - NOT = { this = scope:new_noble_family_holder } + scope:new_noble_family_holder = { + NOT = { + any_held_title = { is_noble_family_title = yes } + } + } + } + switch = { + trigger = has_government + japan_administrative_government = { # Japan has count level NFs + scope:new_noble_family_holder = { + give_noble_family_title = { + name = noble_family_name + tier = county + article = DEFAULT_TITLE_NAME_ARTICLE + government = japan_administrative_government + save_scope_as = new_title + } + } + } + japan_feudal_government = { # Japan has count level NFs + scope:new_noble_family_holder = { + give_noble_family_title = { + name = noble_family_name + tier = county + article = DEFAULT_TITLE_NAME_ARTICLE + government = japan_feudal_government + save_scope_as = new_title + } + } + } + celestial_government = { # China has different government + scope:new_noble_family_holder = { + give_noble_family_title = { + name = noble_family_name + tier = county + article = DEFAULT_TITLE_NAME_ARTICLE + government = celestial_government + save_scope_as = new_title + } + trigger_event = { + id = tgp_china_career.0001 + days = { 2 5 } + } + } + } + meritocratic_government = { # Meritocratic has different government + scope:new_noble_family_holder = { + give_noble_family_title = { + name = noble_family_name + tier = county + article = DEFAULT_TITLE_NAME_ARTICLE + government = meritocratic_government + save_scope_as = new_title + } + } + } + steppe_admin_government = { # Steppe Admin has different government + scope:new_noble_family_holder = { + give_noble_family_title = { + name = noble_family_name + tier = county + article = DEFAULT_TITLE_NAME_ARTICLE + government = steppe_admin_government + save_scope_as = new_title + } + } + } + fallback = { + scope:new_noble_family_holder = { + give_noble_family_title = { + name = noble_family_name + tier = duchy + article = DEFAULT_TITLE_NAME_ARTICLE + government = administrative_government + save_scope_as = new_title + } + } + } + } + } + scope:new_title.holder ?= { + save_scope_as = noble_family_head + scope:new_title = { set_coa = scope:noble_family_head.house } + } + custom_description = { text = create_noble_family_tt } + + #Notifications + every_player = { + limit = { + top_liege = scope:new_noble_family_holder.top_liege + this != scope:new_noble_family_holder + # China has hundreds of Noble Families, it gets spammy + NOT = { government_allows = merit } } trigger_event = { id = ep3_emperor_yearly.2410 @@ -3152,27 +3280,22 @@ increase_governance_effect = { } } } - if = { # First, let's make sure you are a governor in an Admin realm + # Double-check if you have the governor trait - If not, let's make sure you get it + if = { limit = { - government_has_flag = government_is_administrative - is_landed = yes + NOT = { has_trait = governor } + is_governor = yes } - # Double-check if you have the governor trait - If not, let's make sure you get it - if = { - limit = { - NOT = { has_trait = governor } - } - add_trait = governor + add_trait = governor + } + # If you have the trait, let's increase your XP for it + else_if = { + limit = { + has_trait = governor } - # If you have the trait, let's increase your XP for it - else_if = { - limit = { - has_trait = governor - } - add_trait_xp = { - trait = governor - value = scope:governor_xp_gain - } + add_trait_xp = { + trait = governor + value = scope:governor_xp_gain } } } @@ -3236,801 +3359,14 @@ spawn_governance_contract_effect = { } # Select which contract to create - random_list = { - 10 = { # Overdue Taxes - trigger = { - NOT = { has_character_flag = task_contract_cooldown_overdue_taxes } - any_sub_realm_county = { - any_county_province = { - has_holding = yes - NOT = { this = scope:governor.capital_province } - } - } - } - - # Select a suitable location - random_sub_realm_county = { - limit = { - any_county_province = { - has_holding = yes - NOT = { this = scope:governor.capital_province } - } - } - random_county_province = { - limit = { - has_holding = yes - NOT = { this = scope:governor.capital_province } - } - save_scope_as = target_province - } - } - - create_task_contract = { - task_contract_type = overdue_taxes - task_contract_tier = scope:governance_task_contract_tier - location = scope:target_province - save_scope_as = new_governance_issue - } - add_character_flag = { - flag = task_contract_cooldown_overdue_taxes - years = 10 - } - } - 10 = { # Hoarding Mayor - trigger = { - NOT = { has_character_flag = task_contract_cooldown_hoarding_mayor } - any_sub_realm_county = { - any_county_province = { - has_holding_type = city_holding - province_owner = { - NOT = { this = scope:governor } - gold >= 500 # Mayor needs to have a lot of gold - } - } - } - } - - # Select a suitable location - random_sub_realm_county = { - limit = { - any_county_province = { - has_holding_type = city_holding - province_owner = { - NOT = { this = scope:governor } - gold >= 500 # Mayor needs to have a lot of gold - } - } - } - random_county_province = { - limit = { - has_holding_type = city_holding - province_owner = { - NOT = { this = scope:governor } - gold >= 500 # Mayor needs to have a lot of gold - } - } - save_scope_as = target_province - } - } - - create_task_contract = { - task_contract_type = hoarding_mayor - task_contract_tier = scope:governance_task_contract_tier - location = scope:target_province - task_contract_employer = scope:target_province.province_owner - save_scope_as = new_governance_issue - } - add_character_flag = { - flag = task_contract_cooldown_hoarding_mayor - years = 10 - } - } - 10 = { # Bountiful Harvest - trigger = { - NOT = { has_character_flag = task_contract_cooldown_bountiful_harvest } - } - - # Select a suitable location - capital_province = { - save_scope_as = target_province - } - - create_task_contract = { - task_contract_type = bountiful_harvest - task_contract_tier = scope:governance_task_contract_tier - location = scope:target_province - save_scope_as = new_governance_issue - } - add_character_flag = { - flag = task_contract_cooldown_bountiful_harvest - years = 10 - } - - modifier = { # Increased chance if there is fertile terrain types present - factor = 1.5 - any_sub_realm_county = { - any_county_province = { - OR = { - terrain = farmlands - terrain = floodplains - } - } - } - } - modifier = { # Reduced chance if there is only rough terrain present - factor = 0.5 - NOT = { - any_sub_realm_county = { - any_county_province = { - OR = { - terrain = farmlands - terrain = floodplains - terrain = plains - terrain = drylands - terrain = oasis - terrain = forest - } - } - } - } - } - } - 10 = { # Rampant Bandits - trigger = { - NOT = { has_character_flag = task_contract_cooldown_rampant_bandits } - any_sub_realm_county = { - any_county_province = { - NOT = { this = county.holder.capital_province } - } - } - } - - # Select a suitable location - random_sub_realm_county = { - limit = { - any_county_province = { - NOT = { this = county.holder.capital_province } - } - } - weight = { - base = 1 - modifier = { # Prioritize counties with low control - add = { - value = 100 - subtract = county_control - } - county_control < 100 - } - } - add_county_modifier = { - modifier = ep3_governance_rampant_bandits - years = 40 - } - random_county_province = { - limit = { - NOT = { this = county.holder.capital_province } - } - weight = { - base = 1 - modifier = { # Empty baronies make for better hiding spots - add = 15 - has_holding = no - } - modifier = { # You can harass cities easier than castles or temples - add = 4 - has_holding_type = city_holding - } - modifier = { # You can harass temples easier than castles - add = 2 - has_holding_type = church_holding - } - } - save_scope_as = target_province - } - } - - create_task_contract = { - task_contract_type = rampant_bandits - task_contract_tier = scope:governance_task_contract_tier - location = scope:target_province - save_scope_as = new_governance_issue - } - add_character_flag = { - flag = task_contract_cooldown_rampant_bandits - years = 10 - } - - modifier = { # Significantly reduce the chance if there is no county with reduced control - factor = 0.1 - NOT = { - any_sub_realm_county = { county_control <= 90 } - } - } - modifier = { # Increased chance if there are multiple counties with low control - factor = 1.5 - any_sub_realm_county = { - percent >= 0.25 - county_control <= 75 - } - } - modifier = { # Increased it more if control is even lower - factor = 2 - any_sub_realm_county = { - percent >= 0.5 - county_control <= 50 - } - } - } - 10 = { # Discontent Soldiers - trigger = { - NOT = { has_character_flag = task_contract_cooldown_discontent_soldiers } - any_maa_regiment = { - is_title_maa_regiment = yes - is_raised = no - count >= 2 - } - any_neighboring_and_across_water_realm_same_rank_owner = { - liege = root.liege - } - } - - # Select a suitable location - capital_province = { - save_scope_as = target_province - } - - create_task_contract = { - task_contract_type = discontent_soldiers - task_contract_tier = scope:governance_task_contract_tier - location = scope:target_province - save_scope_as = new_governance_issue - } - add_character_flag = { - flag = task_contract_cooldown_discontent_soldiers - years = 10 - } - } - 10 = { # Inept Mayor - trigger = { - NOT = { has_character_flag = task_contract_cooldown_inept_mayor } - any_sub_realm_county = { - any_county_province = { - has_holding_type = city_holding - province_owner = { - NOT = { this = scope:governor } - stewardship <= mediocre_skill_rating - } - } - } - } - - # Select a suitable location - random_sub_realm_county = { - limit = { - any_county_province = { - has_holding_type = city_holding - province_owner = { - NOT = { this = scope:governor } - stewardship <= mediocre_skill_rating - } - } - } - random_county_province = { - limit = { - has_holding_type = city_holding - province_owner = { - NOT = { this = scope:governor } - stewardship <= mediocre_skill_rating - } - } - save_scope_as = target_province - } - add_county_modifier = { - modifier = ep3_mismanaged_administration_modifier - years = 10 - } - } - - create_task_contract = { - task_contract_type = inept_mayor - task_contract_tier = scope:governance_task_contract_tier - location = scope:target_province - task_contract_employer = scope:target_province.province_owner - save_scope_as = new_governance_issue - } - add_character_flag = { - flag = task_contract_cooldown_inept_mayor - years = 10 - } - } - 10 = { # Provincial Investment - trigger = { - NOT = { has_character_flag = task_contract_cooldown_prov_investment } - scope:governance_task_contract_tier = define:NTaskContract|HIGH_TASK_CONTRACT_TIER - } - - # Select a suitable location - capital_province = { - save_scope_as = target_province - } - - create_task_contract = { - task_contract_type = prov_investment - task_contract_tier = scope:governance_task_contract_tier - location = scope:target_province - save_scope_as = new_governance_issue - } - add_character_flag = { - flag = task_contract_cooldown_prov_investment - years = 10 - } - modifier = { - has_trait = education_stewardship - add = 10 - } - } - 10 = { # Raiding Peasants - trigger = { - NOT = { has_character_flag = task_contract_cooldown_raiding_peasants } - any_sub_realm_county = { - any_neighboring_county = { - holder = { - top_liege = { - NOT = { this = scope:governor.top_liege } - } - } - } - any_county_province = { - has_holding = yes - } - } - } - - # Select a suitable location - random_sub_realm_county = { - limit = { - any_neighboring_county = { - holder = { - top_liege = { - NOT = { this = scope:governor.top_liege } - } - } - } - any_county_province = { - has_holding = yes - } - } - random_county_province = { - limit = { - has_holding = yes - } - save_scope_as = target_province - } - } - - create_task_contract = { - task_contract_type = raiding_peasants - task_contract_tier = scope:governance_task_contract_tier - location = scope:target_province - save_scope_as = new_governance_issue - } - add_character_flag = { - flag = task_contract_cooldown_raiding_peasants - years = 10 - } - } - 10 = { # Wild Predators - trigger = { - NOT = { has_character_flag = task_contract_cooldown_wild_predators } - any_sub_realm_county = { - any_county_province = { - OR = { - has_building_or_higher = hunting_grounds_01 - has_building_or_higher = royal_forest_01 - terrain = forest - terrain = jungle - } - } - } - } - - # Select a suitable location - random_sub_realm_county = { - limit = { - any_county_province = { - OR = { - has_building_or_higher = hunting_grounds_01 - has_building_or_higher = royal_forest_01 - terrain = forest - terrain = jungle - } - } - } - add_county_modifier = { - modifier = ep3_wild_predators_modifier - years = 10 - } - random_county_province = { - limit = { - OR = { - has_building_or_higher = hunting_grounds_01 - has_building_or_higher = royal_forest_01 - } - } - alternative_limit = { - OR = { - terrain = forest - terrain = jungle - } - } - save_scope_as = target_province - } - } - - create_task_contract = { - task_contract_type = wild_predators - task_contract_tier = scope:governance_task_contract_tier - location = scope:target_province - save_scope_as = new_governance_issue - } - add_character_flag = { - flag = task_contract_cooldown_wild_predators - years = 10 - } - } - 10 = { # Evil Presence - trigger = { - NOT = { has_character_flag = task_contract_cooldown_evil_presence } - scope:governance_task_contract_tier = define:NTaskContract|LOW_TASK_CONTRACT_TIER - any_sub_realm_county = { - faith.religion = religion:christianity_religion - any_county_province = { - has_holding = yes - province_owner != scope:governor - } - } - } - - # Select a suitable location - random_sub_realm_county = { - limit = { - faith.religion = religion:christianity_religion - any_county_province = { - has_holding = yes - province_owner != scope:governor - } - } - random_county_province = { - limit = { - has_holding = yes - province_owner != scope:governor - } - save_scope_as = target_province - } - } - - create_task_contract = { - task_contract_type = evil_presence - task_contract_tier = scope:governance_task_contract_tier - location = scope:target_province - save_scope_as = new_governance_issue - } - add_character_flag = { - flag = task_contract_cooldown_evil_presence - years = 10 - } - } - 10 = { # Miraculous Healing - trigger = { - NOT = { has_character_flag = task_contract_cooldown_miraculous_healing } - } - - # Select a suitable location - capital_province = { - save_scope_as = target_province - } - - create_task_contract = { - task_contract_type = miraculous_healing - task_contract_tier = scope:governance_task_contract_tier - location = scope:target_province - save_scope_as = new_governance_issue - } - add_character_flag = { - flag = task_contract_cooldown_miraculous_healing - years = 10 - } - } - 10 = { # Buried Treasure - trigger = { - NOT = { has_character_flag = task_contract_cooldown_buried_treasure } - any_sub_realm_county = { - any_county_province = { - has_holding = yes - province_owner != scope:governor - } - } - } - - # Select a suitable location - random_sub_realm_county = { - limit = { - any_county_province = { - has_holding = yes - province_owner != scope:governor - } - } - random_county_province = { - limit = { - has_holding = yes - province_owner != scope:governor - } - save_scope_as = target_province - } - } - - create_task_contract = { - task_contract_type = buried_treasure - task_contract_tier = scope:governance_task_contract_tier - location = scope:target_province - save_scope_as = new_governance_issue - } - add_character_flag = { - flag = task_contract_cooldown_buried_treasure - years = 10 - } - } - 10 = { # Public Land - trigger = { - NOT = { has_character_flag = task_contract_cooldown_public_land } - any_sub_realm_county = { - any_county_province = { - any_province_domicile = { - owner = scope:governor - is_domicile_type = estate - } - } - } - OR = { - any_sub_realm_county = { - any_county_province = { - has_holding = yes - province_owner != scope:governor - has_holding_type = castle_holding - } - } - any_sub_realm_county = { - any_county_province = { - any_province_domicile = { - is_domicile_type = estate - owner = { - NOT = { this = scope:governor } - is_ai = yes - is_alive = yes - } - } - } - } - } - } - - # Select a suitable location - random_sub_realm_county = { - limit = { - any_county_province = { - any_province_domicile = { - is_domicile_type = estate - owner = { - NOT = { this = scope:governor } - is_ai = yes - is_alive = yes - } - } - } - } - random_county_province = { - limit = { - any_province_domicile = { - is_domicile_type = estate - owner = { - NOT = { this = scope:governor } - is_ai = yes - is_alive = yes - } - } - - } - save_scope_as = target_province - } - scope:target_province ?= { - random_province_domicile = { - limit = { - is_domicile_type = estate - owner = { - NOT = { this = scope:governor } - is_ai = yes - is_alive = yes - } - } - owner = { save_scope_as = employer } - } - } - } - if = { - limit = { - NOT = { exists = scope:target_province } - } - random_sub_realm_county = { - limit = { - any_county_province = { - has_holding = yes - province_owner != scope:governor - has_holding_type = castle_holding - } - } - random_county_province = { - limit = { - has_holding = yes - province_owner != scope:governor - has_holding_type = castle_holding - } - save_scope_as = target_province - province_owner = { save_scope_as = employer } - } - } - } - - create_task_contract = { - task_contract_type = public_land - task_contract_tier = scope:governance_task_contract_tier - location = scope:target_province - task_contract_employer = scope:employer - save_scope_as = new_governance_issue - } - add_character_flag = { - flag = task_contract_cooldown_public_land - years = 10 - } - } - 10 = { # Mad Prophet - trigger = { - NOT = { has_character_flag = task_contract_cooldown_mad_prophet } - any_sub_realm_county = { - any_county_province = { - has_holding = yes - province_owner != scope:governor - } - } - } - - # Select a suitable location - random_sub_realm_county = { - limit = { - any_county_province = { - has_holding = yes - province_owner != scope:governor - } - } - random_county_province = { - limit = { - has_holding = yes - province_owner != scope:governor - } - save_scope_as = target_province - } - } - - create_task_contract = { - task_contract_type = mad_prophet - task_contract_tier = scope:governance_task_contract_tier - location = scope:target_province - save_scope_as = new_governance_issue - } - add_character_flag = { - flag = task_contract_cooldown_mad_prophet - years = 10 - } - } - 10 = { # Titles for Sale - trigger = { - NOT = { has_character_flag = task_contract_cooldown_titles_sale } - faith = { - NOR = { - has_doctrine = doctrine_theocracy_lay_clergy - has_doctrine = doctrine_temporal_head - } - } - } - - # Select a suitable location - capital_province = { - save_scope_as = target_province - } - - create_task_contract = { - task_contract_type = titles_sale - task_contract_tier = scope:governance_task_contract_tier - location = scope:target_province - save_scope_as = new_governance_issue - } - add_character_flag = { - flag = task_contract_cooldown_titles_sale - years = 10 - } - } - 10 = { # Hungry Times - trigger = { - NOT = { has_character_flag = task_contract_cooldown_hungry_times } - any_sub_realm_county = { - any_county_province = { - has_holding = yes - province_owner != scope:governor - has_variable = epidemic_cooldown_general - } - } - } - - # Select a suitable location - random_sub_realm_county = { - limit = { - any_county_province = { - has_holding = yes - province_owner != scope:governor - has_variable = epidemic_cooldown_general - } - } - random_county_province = { - limit = { - has_holding = yes - province_owner != scope:governor - has_variable = epidemic_cooldown_general - } - save_scope_as = target_province - } - } - - create_task_contract = { - task_contract_type = hungry_times - task_contract_tier = scope:governance_task_contract_tier - location = scope:target_province - save_scope_as = new_governance_issue - } - add_character_flag = { - flag = task_contract_cooldown_hungry_times - years = 15 #epidemic_cooldown_general lasts 15 years, and we don't want this to trigger twice in a row for the same place - } - } - 10 = { # Wartime Measures - trigger = { - NOT = { has_character_flag = task_contract_cooldown_wartime_measures } - liege = { is_at_war = yes } - is_at_war = no - OR = { - vassal_contract_has_flag = admin_theme_frontier - vassal_contract_has_flag = admin_theme_military - } - } - - # Select a suitable location - capital_province = { - save_scope_as = target_province - } - - create_task_contract = { - task_contract_type = wartime_measures - task_contract_tier = scope:governance_task_contract_tier - location = scope:target_province - save_scope_as = new_governance_issue - } - add_character_flag = { - flag = task_contract_cooldown_wartime_measures - years = 10 - } - } + trigger_event = { + on_action = spawn_admin_governance_contract_on_action } - + play_sound_effect = "event:/DLC/EP3/SFX/Stingers/Byzantine_Flavor/ep3_mx_sting_byzantineflavor_become_governor" +} +manage_new_governance_contract_effect = { if = { limit = { exists = scope:target_province } if = { @@ -4401,7 +3737,7 @@ admin_change_government_effect = { # If liege has clan - Become clan! else_if = { limit = { - is_independent_ruler = no + top_liege != this OR = { liege = { government_has_flag = government_is_clan } AND = { @@ -4412,10 +3748,24 @@ admin_change_government_effect = { } change_government = clan_government } - # If liege has feudal - Become feudal! + # If liege has japanese feudal - Become japanese feudal! else_if = { limit = { is_independent_ruler = no + OR = { + liege = { government_has_flag = government_is_japan_feudal } + AND = { + liege = { government_has_flag = government_is_japan_feudal } + NOT = { religion = religion:islam_religion } + } + } + } + change_government = japan_feudal_government + } + # If liege has feudal - Become feudal! + else_if = { + limit = { + top_liege != this OR = { liege = { government_has_flag = government_is_feudal } AND = { @@ -4429,7 +3779,7 @@ admin_change_government_effect = { # If you're an independent Muslim ruler - Become clan! else_if = { limit = { - is_independent_ruler = yes + top_liege = this faith = { religion_tag = islam_religion } } change_government = clan_government @@ -4463,15 +3813,23 @@ ep3_dynasty_legacy_add_legitimacy_effect = { if = { limit = { scope:host = { - government_has_flag = government_is_administrative - dynasty = { has_dynasty_perk = ep3_administrative_legacy_3 } + government_allows = administrative + OR = { + dynasty = { has_dynasty_perk = ep3_administrative_legacy_3 } + top_participant_group:dynastic_cycle ?= { + participant_group_type = conservative_movement + } + } } # Does the activity location have a domicile owned by a house member # Does that domicile have the Reception Hall building activity_location = { any_province_domicile = { owner = { house ?= scope:host.house } - has_domicile_building_or_higher = reception_hall_01 + OR = { + has_domicile_building_or_higher = reception_hall_01 + has_domicile_building_or_higher = east_asian_estate_reception_hall_01 + } } } } @@ -4479,7 +3837,10 @@ ep3_dynasty_legacy_add_legitimacy_effect = { random_province_domicile = { limit = { owner = { house ?= scope:host.house } - has_domicile_building_or_higher = reception_hall_01 + OR = { + has_domicile_building_or_higher = reception_hall_01 + has_domicile_building_or_higher = east_asian_estate_reception_hall_01 + } } owner = { save_scope_as = reception_hall_owner } } @@ -7552,6 +6913,11 @@ ep3_palace_looting_random_malus_effect = { ep3_child_castration_effect = { add_trait = beardless_eunuch + torture_memory_effect = { + VICTIM = scope:recipient + TORTURER = scope:actor + TYPE = castrated_beardless + } #Eunuch bonus effects custom_tooltip = castration_increased_aptitude if = { @@ -7624,6 +6990,11 @@ ep3_child_castration_effect = { ep3_youth_castration_effect = { add_trait = eunuch_1 + torture_memory_effect = { + VICTIM = scope:recipient + TORTURER = scope:actor + TYPE = castrated + } #eunuch bonus effects custom_tooltip = castration_increased_aptitude if = { @@ -7805,7 +7176,7 @@ save_traveler_culture_effect = { random_culture_global = { limit = { exists = culture_head - NOT = { this = root.culture } + this != root.culture } save_scope_as = traveler_culture } @@ -7813,7 +7184,7 @@ save_traveler_culture_effect = { random_culture_global = { limit = { exists = culture_head - NOT = { this = root.culture } + this != root.culture OR = { AND = { culture_overlaps_geographical_region = world_europe @@ -7883,6 +7254,50 @@ save_traveler_culture_effect = { culture_overlaps_geographical_region = world_burma scope:traveler_culture = { culture_overlaps_geographical_region = world_tibet } } + AND = { + culture_overlaps_geographical_region = world_tibet + scope:traveler_culture = { culture_overlaps_geographical_region = world_asia_china } + } + AND = { + culture_overlaps_geographical_region = world_asia_china + scope:traveler_culture = { culture_overlaps_geographical_region = world_asia_china } + } + AND = { + culture_overlaps_geographical_region = world_asia_china + scope:traveler_culture = { culture_overlaps_geographical_region = world_asia_southeast } + } + AND = { + culture_overlaps_geographical_region = world_asia_china + scope:traveler_culture = { culture_overlaps_geographical_region = world_asia_korea } + } + AND = { + culture_overlaps_geographical_region = world_asia_china + scope:traveler_culture = { culture_overlaps_geographical_region = world_asia_japan } + } + AND = { + culture_overlaps_geographical_region = world_asia_korea + scope:traveler_culture = { culture_overlaps_geographical_region = world_asia_china } + } + AND = { + culture_overlaps_geographical_region = world_asia_korea + scope:traveler_culture = { culture_overlaps_geographical_region = world_asia_japan } + } + AND = { + culture_overlaps_geographical_region = world_asia_korea + scope:traveler_culture = { culture_overlaps_geographical_region = world_asia_korea } + } + AND = { + culture_overlaps_geographical_region = world_asia_japan + scope:traveler_culture = { culture_overlaps_geographical_region = world_asia_japan } + } + AND = { + culture_overlaps_geographical_region = world_asia_japan + scope:traveler_culture = { culture_overlaps_geographical_region = world_asia_china } + } + AND = { + culture_overlaps_geographical_region = world_asia_japan + scope:traveler_culture = { culture_overlaps_geographical_region = world_asia_korea } + } } cultural_acceptance = { target = scope:traveler_culture @@ -7909,8 +7324,7 @@ ep3_ai_castration_effect = { 5 = {} 5 = { trigger = { - exists = liege - liege = { employs_court_position = court_physician_court_position } + liege ?= { employs_court_position = court_physician_court_position } } modifier = { add = 5 @@ -8291,7 +7705,7 @@ ep3_pick_random_maa_regiment_effect = { # LATE 1 = { trigger = { - culture = { has_innovation = innovation_bombard } + culture = { has_innovation = innovation_gunpowder } scope:include_siege_maa = yes } save_scope_value_as = { @@ -8414,7 +7828,7 @@ ep3_pick_random_maa_regiment_effect = { } save_scope_value_as = { name = maa_to_create - value = flag:chu_ko_nu + value = flag:shenbigong } } 1 = { @@ -8638,8 +8052,7 @@ ep3_pick_random_maa_regiment_effect = { } 1 = { trigger = { - exists = dynasty - dynasty = { + dynasty ?= { has_dynasty_perk = fp3_khvarenah_legacy_4 } } @@ -8677,8 +8090,7 @@ ep3_pick_random_maa_regiment_effect = { } 1 = { trigger = { - exists = dynasty - dynasty = { + dynasty ?= { has_dynasty_perk = warfare_legacy_5 } } @@ -9118,9 +8530,9 @@ ep3_create_random_maa_regiment_effect = { SIZE = $SIZE$ } } - flag:chu_ko_nu = { + flag:shenbigong = { create_maa_or_upgrade_regiment_effect = { - TYPE = chu_ko_nu + TYPE = shenbigong SIZE = $SIZE$ } } @@ -9517,15 +8929,13 @@ ep3_hasan_advance_radicalism = { if = { limit = { any_owned_story = { - story_type = story_hasan + type = story_hasan } } custom_tooltip = { text = advance_to_the_assassins_tt random_owned_story = { - limit = { - story_type = story_hasan - } + type = story_hasan if = { limit = { exists = var:radical_points @@ -9903,12 +9313,12 @@ hasan_sabbah_end_war = { if = { limit = { any_owned_story = { - story_type = story_hasan + type = story_hasan exists = var:preferred_caliph } } random_owned_story = { - limit = { story_type = story_hasan } + type = story_hasan var:preferred_caliph = { save_scope_as = caliph } } } @@ -9992,13 +9402,11 @@ hasan_sabbah_end_war = { if = { limit = { any_owned_story = { - story_type = story_hasan + type = story_hasan } } random_owned_story = { - limit = { - story_type = story_hasan - } + type = story_hasan end_story = yes } } @@ -10162,7 +9570,7 @@ fire_governor_long_war_response_events = { limit = { scope:defender = { government_has_flag = government_is_administrative - is_independent_ruler = yes + top_liege = this any_vassal = { is_governor = yes NOR = { @@ -10288,7 +9696,7 @@ fire_governor_long_war_response_events = { limit = { scope:attacker = { government_has_flag = government_is_administrative - is_independent_ruler = yes + top_liege = this any_vassal = { is_governor = yes NOR = { @@ -10463,7 +9871,7 @@ ep3_governor_yearly_3010_war_aid_effect = { target = scope:emperor type = favor_hook } - } #TODO_CD_EP3_JC FIRST OPTION SHOULD BE BECOMING CO-EMPEROR IF POSSIBLE, but make sure it doesn't happen more than once + } else = { change_influence = major_influence_gain } @@ -10710,7 +10118,7 @@ governor_resignation_title_transfer_effect = { limit = { any_held_title = { count = 1 - tier >= tier_duchy + title_tier >= duchy is_landless_type_title = no is_noble_family_title = no } @@ -10718,9 +10126,7 @@ governor_resignation_title_transfer_effect = { primary_title.current_heir = { save_scope_as = next_candidate } every_vassal = { limit = { - NOT = { - this = scope:next_candidate - } + this != scope:next_candidate } change_liege = { liege = scope:next_candidate @@ -10728,8 +10134,8 @@ governor_resignation_title_transfer_effect = { } } every_held_title = { + title_tier >= county limit = { - tier >= tier_county is_landless_type_title = no is_noble_family_title = no } @@ -10742,8 +10148,8 @@ governor_resignation_title_transfer_effect = { } else = { every_held_title = { + title_tier >= duchy limit = { - tier >= tier_duchy is_landless_type_title = no is_noble_family_title = no } @@ -10752,9 +10158,7 @@ governor_resignation_title_transfer_effect = { limit = { holder = { is_vassal_of = scope:resigner - NOT = { - this = scope:next_candidate - } + this != scope:next_candidate } } holder = { @@ -10780,8 +10184,10 @@ governor_resignation_title_transfer_effect = { } # Fallback for counties not held in de jure duchies every_held_title = { + title_tier = county limit = { - tier = tier_county + is_landless_type_title = no + is_noble_family_title = no } change_title_holder_include_vassals = { holder = scope:emperor @@ -10869,6 +10275,13 @@ boost_governor_efficiency_success_effect = { } } } + # Merit based realm gain some merit for improving others + if = { + limit = { + government_allows = merit + } + change_merit = medium_merit_gain + } } } } @@ -11527,7 +10940,7 @@ war_task_contracts_completion_effect = { using_civil_war_cb_trigger = yes any_war_participant = { any_character_active_contract = { - has_task_contract_type = laamp_join_faction_contract + task_contract_type = laamp_join_faction_contract task_contract_employer = { is_participant_in_war = scope:war } @@ -11536,8 +10949,8 @@ war_task_contracts_completion_effect = { } every_war_participant = { every_character_active_contract = { + task_contract_type = laamp_join_faction_contract limit = { - has_task_contract_type = laamp_join_faction_contract task_contract_employer = { is_participant_in_war = scope:war } @@ -11675,7 +11088,7 @@ laamp_as_mercenary_payout_tooltip_effect = { limit = { exists = scope:war any_war_ally = { - is_landless_adventurer = yes + has_government = landless_adventurer_government OR = { any_character_active_contract = { has_task_contract_type = laamp_join_war_contract @@ -11692,7 +11105,7 @@ laamp_as_mercenary_payout_tooltip_effect = { every_war_ally = { if = { limit = { - is_landless_adventurer = yes + has_government = landless_adventurer_government } save_scope_as = laamp_temp save_scope_as = actor @@ -11767,7 +11180,7 @@ laamp_as_mercenary_payout_tooltip_effect = { limit = { exists = scope:war any_war_ally = { - is_landless_adventurer = yes + has_government = landless_adventurer_government OR = { any_character_active_contract = { has_task_contract_type = laamp_join_war_contract @@ -11784,7 +11197,7 @@ laamp_as_mercenary_payout_tooltip_effect = { every_war_ally = { if = { limit = { - is_landless_adventurer = yes + has_government = landless_adventurer_government } save_scope_as = laamp_temp save_scope_as = actor @@ -12044,7 +11457,7 @@ disburse_camp_party_reward_effect = { involved_activity = { every_attending_character = { limit = { - NOT = { this = scope:host } + this != scope:host } custom = every_attending_guest add_opinion = { @@ -12909,6 +12322,39 @@ depose_effect = { save_scope_as = attacker save_scope_as = winner } + # ACH crown laws reset + if = { + limit = { + has_variable = crowned_king_var + } + remove_variable = crowned_king_var + if = { + limit = { + NOT = { has_game_rule = coronation_laws_off } + OR = { + has_realm_law = crowned_king + has_realm_law = crowned_emperor + } + } + add_realm_law_skip_effects = uncrowned + } + } + if = { + limit = { + has_variable = crowned_emperor_var + } + remove_variable = crowned_emperor_var + if = { + limit = { + NOT = { has_game_rule = coronation_laws_off } + OR = { + has_realm_law = crowned_king + has_realm_law = crowned_emperor + } + } + add_realm_law_skip_effects = uncrowned + } + } every_held_title = { add_to_list = target_titles } trigger_event = ep3_laamps.0002 } @@ -13153,7 +12599,12 @@ governor_contract_invalidated_message_effect = { left_icon = scope:task_contract_character desc = admin_contract_invalidated_desc - current_travel_plan ?= { cancel_travel_plan = yes } + current_travel_plan ?= { + if = { + limit = { can_cancel = yes } + cancel_travel_plan = yes + } + } } } } @@ -13361,7 +12812,12 @@ add_random_external_estate_building = { random_list = { 10 = { trigger = { - NOT = { has_domicile_building_or_higher = temple_small_01 } + NOR = { + has_domicile_building_or_higher = temple_small_01 + owner = { + government_has_flag = government_is_celestial + } + } } add_domicile_building = temple_small_01 if = { @@ -13391,7 +12847,12 @@ add_random_external_estate_building = { } 10 = { trigger = { - NOT = { has_domicile_building_or_higher = vineyard_01 } + NOR = { + has_domicile_building_or_higher = vineyard_01 + owner.culture ?= { + has_innovation = innovation_champa_rice + } + } } add_domicile_building = vineyard_01 if = { @@ -13431,7 +12892,12 @@ add_random_external_estate_building = { } 10 = { trigger = { - NOT = { has_domicile_building_or_higher = grain_field_01 } + NOR = { + has_domicile_building_or_higher = grain_field_01 + owner.culture ?= { + has_innovation = innovation_champa_rice + } + } } add_domicile_building = grain_field_01 if = { @@ -13439,6 +12905,21 @@ add_random_external_estate_building = { add_domicile_building = grain_field_02 } } + 10 = { + trigger = { + NOT = { + has_domicile_building_or_higher = rice_field_01 + } + owner.culture ?= { + has_innovation = innovation_champa_rice + } + } + add_domicile_building = rice_field_01 + if = { + limit = { has_domicile_building = estate_main_03 } + add_domicile_building = rice_field_02 + } + } 10 = { trigger = { NOT = { has_domicile_building_or_higher = stable_01 } @@ -13481,7 +12962,12 @@ add_random_external_estate_building = { } 10 = { trigger = { - NOT = { has_domicile_building_or_higher = olive_01 } + NOR = { + has_domicile_building_or_higher = olive_01 + owner.culture ?= { + has_innovation = innovation_champa_rice + } + } } add_domicile_building = olive_01 if = { @@ -13492,3 +12978,25 @@ add_random_external_estate_building = { } } } + +estate_newly_built_grain_field_effect = { + scope:owner = { + if = { + limit = { + is_alive = yes + years_from_game_start >= 1 + } + random = { + chance = 75 + add_character_flag = { + flag = domicile_new_built_grain_field + months = 1 + } + trigger_event = { + id = ep3_governor_yearly.3001 + days = 5 + } + } + } + } +} diff --git a/N3OW/common/scripted_effects/07_dlc_ep3_story_cycle_adventurer_ai_scripted_effects.txt b/N3OW/common/scripted_effects/07_dlc_ep3_story_cycle_adventurer_ai_scripted_effects.txt new file mode 100644 index 00000000..a108fa74 --- /dev/null +++ b/N3OW/common/scripted_effects/07_dlc_ep3_story_cycle_adventurer_ai_scripted_effects.txt @@ -0,0 +1,1844 @@ + +################################################## +# AI Contract Story Effects + +ep3_adventurer_ai_contract_find_next_employer_effect = { + save_scope_as = story + # Save previous employer for easy reference + var:previous_employer ?= { save_scope_as = previous_employer } + # Save current employer for easy reference + var:active_employer ?= { save_scope_as = current_employer } + # Find next employer in active de jure kingdom + var:active_kingdom = { + random_de_jure_county_holder = { + limit = { + save_temporary_scope_as = new_employer_temp + NOR = { + scope:story = { + is_target_in_variable_list = { + name = recent_employers + target = scope:new_employer_temp + } + } + is_at_war_with = scope:story.story_owner + has_imprisonment_reason = scope:story.story_owner + has_execute_reason = scope:story.story_owner + has_banish_reason = scope:story.story_owner + any_liege_or_above = { + OR = { + has_imprisonment_reason = scope:story.story_owner + has_execute_reason = scope:story.story_owner + has_banish_reason = scope:story.story_owner + is_at_war_with = scope:story.story_owner + } + } + } + } + weight = { + base = 1 + # Prefer higher ranked employers + modifier = { add = highest_held_title_tier } + # Prefer same culture employers + modifier = { + culture = { has_same_culture_heritage = scope:story.story_owner.culture } + factor = 1.5 + } + # Prefer same faith employers + modifier = { + faith = scope:story.story_owner.faith + factor = 1.5 + } + # Prefer same faith employers + modifier = { + religion = scope:story.story_owner.religion + factor = 1.5 + } + # Prefer new employers + modifier = { + scope:previous_employer ?= scope:new_employer_temp + factor = 0.25 + } + modifier = { + scope:current_employer ?= scope:new_employer_temp + factor = 0.25 + } + # Mercenary + modifier = { + scope:story.story_owner = { + has_realm_law = camp_purpose_mercenaries + NOR = { + has_relation_rival = scope:new_employer_temp + scope:new_employer_temp = { + any_war_enemy = { + OR = { + is_consort_of = scope:story.story_owner + is_close_family_of = scope:story.story_owner + is_allied_to = scope:story.story_owner + has_relation_friend = scope:story.story_owner + } + } + } + } + can_create_task_contract = { + type_name = laamp_join_war_contract + employer = scope:new_employer_temp + } + } + factor = 2 + } + } + # Save new employer + save_scope_as = new_employer + } + } + if = { + limit = { exists = scope:new_employer } + if = { # Save previous employer for checks and debugging + limit = { exists = scope:current_employer } + set_variable = { + name = previous_employer + value = scope:current_employer + } + add_to_variable_list = { + name = recent_employers + target = scope:current_employer + years = 2 + } + } + set_variable = { # Save active employer + name = active_employer + value = scope:new_employer + } + set_variable = { # Reset remaining contracts counter + name = remaining_contract_counter + value = { + integer_range = { + min = ep3_adventurer_ai_contracts_per_employer_min_value + max = ep3_adventurer_ai_contracts_per_employer_max_value + } + } + } + change_variable = { # Change remaining employer counter + name = remaining_employer_counter + add = -1 + } + story_owner = { # Travel to or create contract + if = { # Travel + limit = { location != scope:new_employer.capital_province } + save_scope_value_as = { # Approx provisions for journey + name = lammp_travel_provisions + value = { + value = "location.squared_distance(scope:new_employer.capital_province)" + divide = 300 + } + } + domicile = { # the AI doesn't have to know how to use provisions efficiently, so just add a couple so that they don't suicide + if = { + limit = { provisions < scope:lammp_travel_provisions } + change_provisions = scope:lammp_travel_provisions + } + } + start_travel_plan = { + destination = scope:new_employer.capital_province + travel_with_domicile = yes + return_trip = no + on_arrival_on_action = on_adventurer_ai_new_employer_arrival + on_arrival_destinations = last + } + } + else = { + trigger_event = { on_action = on_adventurer_ai_new_employer_arrival } + } + } + } + else = { # Find a new kingdom if noone would hire you + set_variable = { + name = remaining_contract_counter + value = 0 + } + set_variable = { + name = remaining_employer_counter + value = 0 + } + } + story_owner = { + domicile = { # the AI doesn't have to know how to use provisions efficiently, so just add a couple so that they don't suicide + if = { + limit = { provisions < max_provisions } + change_provisions = max_provisions + } + } + } +} + +ep3_adventurer_ai_contract_find_next_contract_effect = { + save_scope_as = story + story_owner = { + location.barony.de_jure_liege.holder ?= { save_scope_as = new_employer } + # Create new contract + if = { + limit = { exists = scope:new_employer } + if = { # Mercenaries + limit = { + has_realm_law = camp_purpose_mercenaries + NOR = { + has_relation_rival = scope:new_employer + scope:new_employer = { + any_war_enemy = { + OR = { + is_consort_of = scope:story.story_owner + is_close_family_of = scope:story.story_owner + is_allied_to = scope:story.story_owner + has_relation_friend = scope:story.story_owner + } + } + } + } + can_create_task_contract = { + type_name = laamp_join_war_contract + employer = scope:new_employer + } + } + create_task_contract = { + task_contract_type = laamp_join_war_contract + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + else = { + random_list = { + ### DIPLOMACY + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_0001 + employer = scope:new_employer + } + } + modifier = { + diplomacy != 0 + factor = diplomacy + } + create_task_contract = { + task_contract_type = laamp_base_0001 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_0011 + employer = scope:new_employer + } + } + modifier = { + diplomacy != 0 + factor = diplomacy + } + create_task_contract = { + task_contract_type = laamp_base_0011 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_0021 + employer = scope:new_employer + } + } + modifier = { + diplomacy != 0 + factor = diplomacy + } + create_task_contract = { + task_contract_type = laamp_base_0021 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_0031 + employer = scope:new_employer + } + } + modifier = { + diplomacy != 0 + factor = diplomacy + } + create_task_contract = { + task_contract_type = laamp_base_0031 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_0041 + employer = scope:new_employer + } + } + modifier = { + diplomacy != 0 + factor = diplomacy + } + create_task_contract = { + task_contract_type = laamp_base_0041 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + ### MARTIAL + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_1011 + employer = scope:new_employer + } + } + modifier = { + martial != 0 + factor = martial + } + create_task_contract = { + task_contract_type = laamp_base_1011 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + #deprecated contract + 0 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_1021 + employer = scope:new_employer + } + } + modifier = { + martial != 0 + factor = martial + } + create_task_contract = { + task_contract_type = laamp_base_1021 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + #deprecated contract + 0 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_1031 + employer = scope:new_employer + } + } + modifier = { + martial != 0 + factor = martial + } + create_task_contract = { + task_contract_type = laamp_base_1031 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_1041 + employer = scope:new_employer + } + } + modifier = { + martial != 0 + factor = martial + } + create_task_contract = { + task_contract_type = laamp_base_1041 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + ### STEWARDSHIP + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_2001 + employer = scope:new_employer + } + } + modifier = { + stewardship != 0 + factor = stewardship + } + create_task_contract = { + task_contract_type = laamp_base_2001 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_2011 + employer = scope:new_employer + } + } + modifier = { + stewardship != 0 + factor = stewardship + } + create_task_contract = { + task_contract_type = laamp_base_2011 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_2021 + employer = scope:new_employer + } + } + modifier = { + stewardship != 0 + factor = stewardship + } + create_task_contract = { + task_contract_type = laamp_base_2021 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_2031 + employer = scope:new_employer + } + } + modifier = { + stewardship != 0 + factor = stewardship + } + create_task_contract = { + task_contract_type = laamp_base_2031 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_2041 + employer = scope:new_employer + } + } + modifier = { + stewardship != 0 + factor = stewardship + } + create_task_contract = { + task_contract_type = laamp_base_2041 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + ### INTRIGUE + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_3001 + employer = scope:new_employer + } + } + modifier = { + intrigue != 0 + factor = intrigue + } + create_task_contract = { + task_contract_type = laamp_base_3001 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_3011 + employer = scope:new_employer + } + } + modifier = { + intrigue != 0 + factor = intrigue + } + create_task_contract = { + task_contract_type = laamp_base_3011 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_3021 + employer = scope:new_employer + } + } + modifier = { + intrigue != 0 + factor = intrigue + } + create_task_contract = { + task_contract_type = laamp_base_3021 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_3031 + employer = scope:new_employer + } + } + modifier = { + intrigue != 0 + factor = intrigue + } + create_task_contract = { + task_contract_type = laamp_base_3031 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_3041 + employer = scope:new_employer + } + } + modifier = { + intrigue != 0 + factor = intrigue + } + create_task_contract = { + task_contract_type = laamp_base_3041 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + ### LEARNING + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_4001 + employer = scope:new_employer + } + } + modifier = { + learning != 0 + factor = learning + } + create_task_contract = { + task_contract_type = laamp_base_4001 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_4011 + employer = scope:new_employer + } + } + modifier = { + learning != 0 + factor = learning + } + create_task_contract = { + task_contract_type = laamp_base_4011 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_4021 + employer = scope:new_employer + } + } + modifier = { + learning != 0 + factor = learning + } + create_task_contract = { + task_contract_type = laamp_base_4021 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_4031 + employer = scope:new_employer + } + } + modifier = { + learning != 0 + factor = learning + } + create_task_contract = { + task_contract_type = laamp_base_4031 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_4041 + employer = scope:new_employer + } + } + modifier = { + learning != 0 + factor = learning + } + create_task_contract = { + task_contract_type = laamp_base_4041 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + ### PROWESS + #deprecated contract + 0 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_5001 + employer = scope:new_employer + } + } + modifier = { + prowess != 0 + factor = prowess + } + create_task_contract = { + task_contract_type = laamp_base_5001 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + #deprecated contract + 0 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_5011 + employer = scope:new_employer + } + } + modifier = { + prowess != 0 + factor = prowess + } + create_task_contract = { + task_contract_type = laamp_base_5011 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + #deprecated contract + 0 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_5021 + employer = scope:new_employer + } + } + modifier = { + prowess != 0 + factor = prowess + } + create_task_contract = { + task_contract_type = laamp_base_5021 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_5031 + employer = scope:new_employer + } + } + modifier = { + prowess != 0 + factor = prowess + } + create_task_contract = { + task_contract_type = laamp_base_5031 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + #deprecated contract + 0 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_5041 + employer = scope:new_employer + } + } + modifier = { + prowess != 0 + factor = prowess + } + create_task_contract = { + task_contract_type = laamp_base_5041 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + # JUSTICAR + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_6001 + employer = scope:new_employer + } + } + modifier = { + prowess != 0 + factor = prowess + } + create_task_contract = { + task_contract_type = laamp_base_6001 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_6021 + employer = scope:new_employer + } + } + modifier = { + diplomacy != 0 + factor = diplomacy + } + create_task_contract = { + task_contract_type = laamp_base_6021 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_base_6031 + employer = scope:new_employer + } + } + modifier = { + prowess != 0 + factor = prowess + } + create_task_contract = { + task_contract_type = laamp_base_6031 + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + # EXTRA + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_boost_legitimacy_contract + employer = scope:new_employer + } + } + modifier = { + diplomacy != 0 + factor = diplomacy + } + create_task_contract = { + task_contract_type = laamp_boost_legitimacy_contract + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_rid_councillor_contract + employer = scope:new_employer + } + } + modifier = { + martial != 0 + factor = martial + } + create_task_contract = { + task_contract_type = laamp_rid_councillor_contract + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_gain_wanderer_contract + employer = scope:new_employer + } + } + modifier = { + martial != 0 + factor = martial + } + create_task_contract = { + task_contract_type = laamp_gain_wanderer_contract + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_find_secret_contract + employer = scope:new_employer + } + } + modifier = { + intrigue != 0 + factor = intrigue + } + create_task_contract = { + task_contract_type = laamp_find_secret_contract + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 10 = { + trigger = { + can_create_task_contract = { + type_name = laamp_eliminate_heir_contract + employer = scope:new_employer + } + } + modifier = { + intrigue != 0 + factor = intrigue + } + create_task_contract = { + task_contract_type = laamp_eliminate_heir_contract + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 250 = { + trigger = { + can_create_task_contract = { + type_name = laamp_steal_artifact_contract + employer = scope:new_employer + } + } + create_task_contract = { + task_contract_type = laamp_steal_artifact_contract + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 250 = { + trigger = { + can_create_task_contract = { + type_name = laamp_construction_contract + employer = scope:new_employer + } + } + create_task_contract = { + task_contract_type = laamp_construction_contract + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 250 = { + trigger = { + can_create_task_contract = { + type_name = laamp_cultural_minority_contract + employer = scope:new_employer + } + } + create_task_contract = { + task_contract_type = laamp_cultural_minority_contract + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 250 = { + trigger = { + can_create_task_contract = { + type_name = laamp_religious_minority_contract + employer = scope:new_employer + } + } + create_task_contract = { + task_contract_type = laamp_religious_minority_contract + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 250 = { + trigger = { + can_create_task_contract = { + type_name = laamp_prison_break_contract + employer = scope:new_employer + } + } + create_task_contract = { + task_contract_type = laamp_prison_break_contract + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 250 = { + trigger = { + can_create_task_contract = { + type_name = laamp_join_faction_contract + employer = scope:new_employer + } + } + create_task_contract = { + task_contract_type = laamp_join_faction_contract + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 250 = { + trigger = { + can_create_task_contract = { + type_name = laamp_help_faith_conversion_contract + employer = scope:new_employer + } + } + create_task_contract = { + task_contract_type = laamp_help_faith_conversion_contract + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 250 = { + trigger = { + can_create_task_contract = { + type_name = laamp_fight_faith_conversion_contract + employer = scope:new_employer + } + } + create_task_contract = { + task_contract_type = laamp_fight_faith_conversion_contract + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 250 = { + trigger = { + can_create_task_contract = { + type_name = laamp_help_find_secrets_contract + employer = scope:new_employer + } + } + create_task_contract = { + task_contract_type = laamp_help_find_secrets_contract + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 250 = { + trigger = { + can_create_task_contract = { + type_name = laamp_help_fabricate_claim_contract + employer = scope:new_employer + } + } + create_task_contract = { + task_contract_type = laamp_help_fabricate_claim_contract + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 250 = { + trigger = { + can_create_task_contract = { + type_name = laamp_help_increase_control_contract + employer = scope:new_employer + } + } + create_task_contract = { + task_contract_type = laamp_help_increase_control_contract + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + # MERCENARY + 500 = { + trigger = { + has_realm_law = camp_purpose_mercenaries + can_create_task_contract = { + type_name = laamp_raid_contract + employer = scope:new_employer + } + } + create_task_contract = { + task_contract_type = laamp_raid_contract + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 500 = { + trigger = { + has_realm_law = camp_purpose_mercenaries + can_create_task_contract = { + type_name = laamp_join_war_contract + employer = scope:new_employer + } + } + create_task_contract = { + task_contract_type = laamp_join_war_contract + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 500 = { + trigger = { + has_realm_law = camp_purpose_mercenaries + can_create_task_contract = { + type_name = laamp_help_claimant_contract + employer = scope:new_employer + } + } + create_task_contract = { + task_contract_type = laamp_help_claimant_contract + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + 500 = { + trigger = { + has_realm_law = camp_purpose_legitimists + can_create_task_contract = { + type_name = laamp_legitimist_support_contract + employer = scope:new_employer + } + } + create_task_contract = { + task_contract_type = laamp_legitimist_support_contract + task_contract_tier = scope:new_employer.task_contract_tier_value + location = scope:new_employer.capital_province + task_contract_employer = scope:new_employer + } + } + } + } + # Save contract + random_available_task_contract = { save_scope_as = contract } + } + } + # Take contract + if = { + limit = { exists = scope:contract } + # Save active employer + if = { + limit = { NOT = { exists = scope:story.var:active_employer } } + set_variable = { + name = active_employer + value = scope:new_employer + } + } + story_owner = { accept_task_contract = scope:contract } + # Save contract for debugging for easy reference + set_variable = { + name = active_contract + value = scope:contract + } + } + # Change remaining contract counter + change_variable = { + name = remaining_contract_counter + add = -1 + } +} + +ep3_adventurer_ai_contract_find_next_kingdom_effect = { + save_scope_as = story + # Save previous kingdom for easy reference + var:previous_kingdom ?= { save_scope_as = previous_kingdom } + # Find de jure kingdom neighboring active kingdom + var:active_kingdom ?= { + save_scope_as = current_kingdom + # If we've pre-scripted story content, stay in our current kingdom. + if = { + limit = { + scope:story.story_owner = { has_character_flag = laamp_stay_same_kingdom } + } + save_scope_as = new_kingdom + } + # If we're an explorer, go further afield. + else_if = { + limit = { + scope:story.story_owner = { + OR = { + has_realm_law = camp_purpose_explorers + #Normans gonna Norman + AND = { + culture = { has_cultural_parameter = much_more_likely_to_be_laamps } + #But not all of them... + ai_boldness >= high_positive_ai_value + ai_energy >= high_positive_ai_value + } + #Vikings gonna Viking + AND = { + culture = { + has_cultural_parameter = more_likely_to_be_laamps + has_cultural_parameter = unlock_maa_varangian_veterans + } + religion = { is_in_family = rf_pagan } + #But not all of them... + ai_greed >= 0 + } + } + } + } + empire = { + random_title_to_title_neighboring_and_across_water_empire = { + weight = { + base = 1 + ep3_adventurer_ai_contract_find_next_kingdom_modifier = { ADVENTURER = scope:story.story_owner } + } + random_in_de_jure_hierarchy = { + continue = { tier > tier_kingdom } + limit = { tier = tier_kingdom } + weight = { + base = 1 + ep3_adventurer_ai_contract_find_next_kingdom_modifier = { ADVENTURER = scope:story.story_owner } + } + save_scope_as = new_kingdom + } + } + } + } + # Otherwise, we're not, so stay at home. + else = { + random_title_to_title_neighboring_and_across_water_kingdom = { + limit = { + save_temporary_scope_as = new_kingdom_temp + NOT = { # Prefer variety + scope:story = { + is_target_in_variable_list = { + name = recent_kingdoms + target = scope:new_kingdom_temp + } + } + } + any_title_to_title_neighboring_kingdom = { this = scope:current_kingdom } # Prefer to not sail + } + alternative_limit = { + any_title_to_title_neighboring_kingdom = { this = scope:current_kingdom } # Prefer to not sail + } + alternative_limit = { always = yes } + weight = { + base = 1 + # Prefer to stay around the same general area + modifier = { + scope:previous_kingdom ?= this + factor = 2 + } + modifier = { + scope:previous_kingdom.empire ?= this.empire + factor = 2 + } + modifier = { + scope:current_kingdom.empire ?= this.empire + factor = 2 + } + ep3_adventurer_ai_contract_find_next_kingdom_modifier = { ADVENTURER = scope:story.story_owner } + } + save_scope_as = new_kingdom + } + } + } + if = { + limit = { + NOT = { exists = scope:new_kingdom } + } + story_owner.location.empire ?= { + random_direct_de_jure_vassal_title = { + limit = { + this != scope:current_kingdom + } + alternative_limit = { always = yes } + weight = { + base = 1 + # Prefer to stay around the same general area + modifier = { + scope:previous_kingdom ?= this + factor = 2 + } + modifier = { + scope:previous_kingdom.empire ?= this.empire + factor = 2 + } + modifier = { + scope:current_kingdom.empire ?= this.empire + factor = 2 + } + ep3_adventurer_ai_contract_find_next_kingdom_modifier = { ADVENTURER = scope:story.story_owner } + } + save_scope_as = new_kingdom + } + } + } + else_if = { + limit = { + NOT = { exists = scope:new_kingdom } + } + random_empire = { + limit = { + is_landless_type_title = no + any_direct_de_jure_vassal_title = { is_landless_type_title = no } + } + random_direct_de_jure_vassal_title = { + limit = { + this != scope:current_kingdom + is_landless_type_title = no + } + alternative_limit = { is_landless_type_title = no } + weight = { + base = 1 + # Prefer to stay around the same general area + modifier = { + scope:previous_kingdom ?= this + factor = 2 + } + modifier = { + scope:previous_kingdom.empire ?= this.empire + factor = 2 + } + modifier = { + scope:current_kingdom.empire ?= this.empire + factor = 2 + } + ep3_adventurer_ai_contract_find_next_kingdom_modifier = { ADVENTURER = scope:story.story_owner } + } + save_scope_as = new_kingdom + } + } + } + if = { + limit = { exists = scope:new_kingdom } + # Save previous kingdom for checks and debugging + set_variable = { + name = previous_kingdom + value = scope:current_kingdom + } + add_to_variable_list = { + name = recent_kingdoms + target = scope:current_kingdom + years = 2 + } + # Save active kingdom + set_variable = { + name = active_kingdom + value = scope:new_kingdom + } + # Reset contract counter + set_variable = { + name = remaining_contract_counter + value = { + integer_range = { + min = ep3_adventurer_ai_contracts_per_employer_min_value + max = ep3_adventurer_ai_contracts_per_employer_max_value + } + } + } + # Reset employer counter + set_variable = { + name = remaining_employer_counter + value = { + integer_range = { + min = ep3_adventurer_ai_employers_per_kingdom_min_value + max = ep3_adventurer_ai_employers_per_kingdom_max_value + } + } + } + # Edge case logic for Hereward. + scope:new_kingdom = { + if = { + limit = { + character:90028 ?= scope:story.story_owner + this = scope:current_kingdom + } + random_list = { + 1 = { + trigger = { + NOT = { province:1525 = scope:story.story_owner.domicile.domicile_location } + } + province:1525 = { save_scope_as = destination_province } + } + 1 = { + trigger = { + NOT = { province:1534 = scope:story.story_owner.domicile.domicile_location } + } + province:1534 = { save_scope_as = destination_province } + } + 1 = { + trigger = { + NOT = { province:1535 = scope:story.story_owner.domicile.domicile_location } + } + province:1535 = { save_scope_as = destination_province } + } + 1 = { + trigger = { + NOT = { province:1536 = scope:story.story_owner.domicile.domicile_location } + } + province:1536 = { save_scope_as = destination_province } + } + 1000 = { + trigger = { + NOT = { province:1537 = scope:story.story_owner.domicile.domicile_location } + } + province:1537 = { save_scope_as = destination_province } + } + 1 = { + trigger = { + NOT = { province:1541 = scope:story.story_owner.domicile.domicile_location } + } + province:1541 = { save_scope_as = destination_province } + } + 1 = { + trigger = { + NOT = { province:1542 = scope:story.story_owner.domicile.domicile_location } + } + province:1542 = { save_scope_as = destination_province } + } + 1 = { + trigger = { + NOT = { province:1584 = scope:story.story_owner.domicile.domicile_location } + } + province:1584 = { save_scope_as = destination_province } + } + 1 = { + trigger = { + NOT = { province:1585 = scope:story.story_owner.domicile.domicile_location } + } + province:1585 = { save_scope_as = destination_province } + } + 1 = { + trigger = { + NOT = { province:1601 = scope:story.story_owner.domicile.domicile_location } + } + province:1601 = { save_scope_as = destination_province } + } + } + } + else_if = { + limit = { this = scope:current_kingdom } + random_de_jure_county = { + limit = { + title_province != scope:story.story_owner.domicile.domicile_location + } + title_province = { save_scope_as = destination_province } + } + } + else = { + title_capital_county.title_province = { save_scope_as = destination_province } + } + } + # Travel + story_owner = { + domicile = { # the AI doesn't have to know how to use provisions efficiently, so just add a couple so that they don't suicide + if = { + limit = { provisions < max_provisions } + change_provisions = max_provisions + } + } + start_travel_plan = { + destination = scope:destination_province + travel_with_domicile = yes + return_trip = no + on_arrival_on_action = on_adventurer_ai_new_kingdom_arrival + on_arrival_destinations = last + } + } + } + story_owner = { + # Military Upgrades + if = { + limit = { + is_at_war = no + OR = { + has_realm_law = camp_purpose_mercenaries + has_realm_law = camp_purpose_brigands + has_realm_law = camp_purpose_legitimists + } + } + while = { + count = 5 + random_maa_regiment = { + limit = { maa_current_troops_count < maa_max_troops_count } + change_maa_troops_count = replenishable_troops_value + } + } + random_maa_regiment = { + limit = { can_upgrade_maa = yes } + change_maa_regiment_size = { + size = 1 + reinforce = yes + } + } + if = { + limit = { + OR = { + has_realm_law = camp_purpose_mercenaries + has_realm_law = camp_purpose_legitimists + } + } + random_maa_regiment = { + limit = { can_upgrade_maa = yes } + change_maa_regiment_size = { + size = 1 + reinforce = yes + } + } + } + if = { + limit = { has_realm_law = camp_purpose_mercenaries } + random_maa_regiment = { + limit = { can_upgrade_maa = yes } + change_maa_regiment_size = { + size = 1 + reinforce = yes + } + } + } + } + } +} + +# Move adventurer to the war target, if necessary +# ADVENTURER = character +# WAR_TARGET = character +ep3_adventurer_ai_war_travel_effect = { + $ADVENTURER$.domicile.domicile_location = { save_scope_as = current_location } # Since passed scopes can't be used in square_distance + $WAR_TARGET$ = { # Find closest neighboring realm, and its closest county, to you, and go there + ordered_neighboring_and_across_water_top_liege_realm_owner = { + limit = { + # Always prefer not across water, but allow it in edge cases + save_temporary_scope_as = war_neighbour_temp + $WAR_TARGET$ = { + any_neighboring_top_liege_realm_owner = { this = scope:war_neighbour_temp } + } + } + alternative_limit = { always = yes } + order_by = { + value = 0 + subtract = "capital_county.squared_distance(scope:current_location)" + } + save_scope_as = war_neighbour + ordered_sub_realm_county = { + limit = { + any_neighboring_county = { + holder ?= { + OR = { + this = $WAR_TARGET$ + target_is_liege_or_above = $WAR_TARGET$ + } + } + } + } + order_by = { + value = 0 + subtract = "title_province.squared_distance(scope:current_location)" + } + save_scope_as = war_stage + } + } + } + save_scope_value_as = { # Approx provisions for journey + name = lammp_travel_provisions + value = { + value = "scope:current_location.squared_distance(scope:war_stage.title_province)" + divide = 300 + } + } + $ADVENTURER$ = { + domicile = { # the AI doesn't have to know how to use provisions efficiently, so just add a couple so that they don't suicide + if = { + limit = { provisions < scope:lammp_travel_provisions } + change_provisions = scope:lammp_travel_provisions + } + } + start_travel_plan = { + destination = scope:war_stage.title_province + travel_with_domicile = yes + players_use_planner = no + return_trip = no + on_arrival_destinations = all + on_arrival_on_action = on_adventurer_ai_war_target_arrival + } + } +} + +# Adventurer declares war on target, if possible +# ADVENTURER = character +# WAR_TARGET = character +ep3_adventurer_ai_war_declare_effect = { + $ADVENTURER$ = { + if = { + limit = { has_realm_law = camp_purpose_legitimists } + if = { + limit = { + $WAR_TARGET$ = { + ep3_adventurer_ai_valid_legitimist_target_trigger = { ADVENTURER = $ADVENTURER$ } + } + } + ordered_claim = { + limit = { + tier >= tier_kingdom + holder = $WAR_TARGET$ + } + order_by = tier + save_scope_as = claim + } + start_war = { + target = $WAR_TARGET$ + casus_belli = claim_cb + claimant = $ADVENTURER$ + target_title = scope:claim + } + } + } + else_if = { + limit = { + has_cb_on = { + target = $WAR_TARGET$ + casus_belli = ep3_laamp_adventurer_empire_invasion + } + } + start_war = { + target = $WAR_TARGET$ + casus_belli = ep3_laamp_adventurer_empire_invasion + } + } + else_if = { + limit = { + has_cb_on = { + target = $WAR_TARGET$ + casus_belli = ep3_laamp_adventurer_kingdom_invasion + } + } + start_war = { + target = $WAR_TARGET$ + casus_belli = ep3_laamp_adventurer_kingdom_invasion + } + } + else_if = { + limit = { + has_cb_on = { + target = $WAR_TARGET$ + casus_belli = ep3_laamp_adventurer_duchy_invasion + } + } + $WAR_TARGET$ = { # Grab an appropriate Duchy + random_sub_realm_duchy = { + limit = { + any_in_de_jure_hierarchy = { # At least 2 counties + continue = { tier > tier_county } + count >= 2 + tier = tier_county + holder ?= { + OR = { + this = $WAR_TARGET$ + is_vassal_or_below_of = $WAR_TARGET$ + } + } + } + any_in_de_jure_hierarchy = { # And either coastal or bordering another realm (otherwise it'll look u g l y) + continue = { tier > tier_county } + tier = tier_county + holder ?= { + OR = { + this = $WAR_TARGET$ + is_vassal_or_below_of = $WAR_TARGET$ + } + } + OR = { + is_coastal_county = yes + any_neighboring_county = { + NOT = { + holder.top_liege = $WAR_TARGET$.top_liege + } + } + } + } + } + save_scope_as = target_title + } + } + start_war = { + target = $WAR_TARGET$ + casus_belli = ep3_laamp_adventurer_duchy_invasion + target_title = scope:target_title + } + } + else = { + $WAR_TARGET$ = { # Grab an appropriate Duchy + random_sub_realm_county = { + limit = { + OR = { + is_coastal_county = yes + any_neighboring_county = { + NOT = { + holder.top_liege = $WAR_TARGET$.top_liege + } + } + } + } + save_scope_as = target_title + } + } + start_war = { + target = $WAR_TARGET$ + casus_belli = ep3_laamp_adventurer_county_invasion + target_title = scope:target_title + } + } + } +} + +# Find a target for adventurer to attack +ep3_adventurer_ai_war_find_target_effect = { + save_scope_as = story + set_variable = { + name = remaining_contract_counter + value = 0 + } + set_variable = { + name = remaining_employer_counter + value = 0 + } + story_owner.domicile.domicile_location = { save_scope_as = current_location } + if = { + limit = { + story_owner = { + has_realm_law = camp_purpose_legitimists + any_claim = { + holder = { + ep3_adventurer_ai_valid_legitimist_target_trigger = { ADVENTURER = scope:story.story_owner } + } + } + } + } + story_owner = { + ordered_claim = { + limit = { + holder = { + ep3_adventurer_ai_valid_legitimist_target_trigger = { ADVENTURER = scope:story.story_owner } + } + } + order_by = tier + holder = { save_scope_as = war_target } + } + } + } + else = { + every_independent_ruler = { + limit = { + ep3_adventurer_ai_valid_war_target_trigger = { ADVENTURER = scope:story.story_owner } + } + add_to_list = potential_war_targets + } + random_in_list = { + list = potential_war_targets + limit = { + save_temporary_scope_as = war_target_temp + scope:story.story_owner = { + any_claim = { + holder ?= scope:war_target_temp + target_is_de_jure_liege_or_above = scope:war_target_temp.primary_title + } + } + } + alternative_limit = { + primary_title = { + any_in_de_facto_hierarchy = { + tier = tier_empire + save_temporary_scope_as = war_target_title_temp + } + } + scope:story.story_owner = { + can_declare_war = { + defender = scope:war_target_temp + casus_belli = ep3_laamp_adventurer_empire_invasion + target_titles = { scope:war_target_title_temp } + } + } + } + alternative_limit = { + primary_title = { + any_in_de_facto_hierarchy = { + tier = tier_kingdom + save_temporary_scope_as = war_target_title_temp + } + } + scope:story.story_owner = { + can_declare_war = { + defender = scope:war_target_temp + casus_belli = ep3_laamp_adventurer_kingdom_invasion + target_titles = { scope:war_target_title_temp } + } + } + } + alternative_limit = { + primary_title = { + any_in_de_facto_hierarchy = { + tier = tier_duchy + save_temporary_scope_as = war_target_title_temp + } + } + scope:story.story_owner = { + can_declare_war = { + defender = scope:war_target_temp + casus_belli = ep3_laamp_adventurer_duchy_invasion + target_titles = { scope:war_target_title_temp } + } + } + } + alternative_limit = { + any_sub_realm_county = { + count >= 1 + save_temporary_scope_as = war_target_title_temp + } + } + weight = { + base = 10000 + modifier = { + add = { + value = current_strength_with_allies_value + multiply = -2 + } + } + modifier = { + is_at_war = yes + add = 250 + } + modifier = { + add = { + value = "capital_county.squared_distance(scope:story.story_owner.domicile.domicile_location)" + multiply = -1 + } + } + modifier = { + add = { + value = "reverse_opinion(scope:story.story_owner)" + multiply = 2 + } + } + modifier = { + scope:story.story_owner = { + any_claim = { + holder ?= { + OR = { + this = scope:war_target_temp + target_is_liege_or_above = scope:war_target_temp + } + } + } + } + add = 500 + } + } + save_scope_as = war_target + } + } + if = { + limit = { exists = scope:war_target } + set_variable = { # Save war target + name = war_target_realm + value = scope:war_target.primary_title + months = 6 + } + set_variable = { # Save travel/declare attempts count to safeguard against loops + name = war_target_attempts + value = 0 + } + story_owner = { + trigger_event = { on_action = on_adventurer_ai_war_target_arrival } + } + } +} diff --git a/N3OW/common/scripted_effects/07_frankokratia_scripted_effects.txt b/N3OW/common/scripted_effects/07_frankokratia_scripted_effects.txt new file mode 100644 index 00000000..7d30cd1d --- /dev/null +++ b/N3OW/common/scripted_effects/07_frankokratia_scripted_effects.txt @@ -0,0 +1,7028 @@ +ep3_frankokratia_save_financier_effect = { + #Start with Venice, then any Italian republic + title:e_italy = { + random_in_de_jure_hierarchy = { + limit = { + this = title:k_venice + title:k_venice.holder = { + ep3_frankokratia_financier_trigger = yes + government_has_flag = government_is_republic + } + } + alternative_limit = { + NOT = { this = title:k_venice } + holder ?= { + highest_held_title_tier >= tier_county + government_has_flag = government_is_republic + ep3_frankokratia_financier_trigger = yes + } + } + holder = { save_scope_as = financier } + } + } + #A Sicilian coastal republic + if = { + limit = { + NOT = { exists = scope:financier } + } + title:k_sicily = { + random_in_de_jure_hierarchy = { + limit = { + holder ?= { + highest_held_title_tier >= tier_county + government_has_flag = government_is_republic + ep3_frankokratia_financier_trigger = yes + } + } + holder = { save_scope_as = financier } + } + } + } + #A Croatian coastal republic + if = { + limit = { + NOT = { exists = scope:financier } + } + title:k_croatia = { + random_in_de_jure_hierarchy = { + limit = { + holder ?= { + highest_held_title_tier >= tier_county + government_has_flag = government_is_republic + ep3_frankokratia_financier_trigger = yes + } + } + holder = { save_scope_as = financier } + } + } + } + #A Burgundian coastal republic + if = { + limit = { + NOT = { exists = scope:financier } + } + title:k_burgundy = { + random_in_de_jure_hierarchy = { + limit = { + holder ?= { + highest_held_title_tier >= tier_county + government_has_flag = government_is_republic + ep3_frankokratia_financier_trigger = yes + } + } + holder = { save_scope_as = financier } + } + } + } + #An Aquitainian coastal republic + if = { + limit = { + NOT = { exists = scope:financier } + } + title:k_aquitaine = { + random_in_de_jure_hierarchy = { + limit = { + holder ?= { + highest_held_title_tier >= tier_county + government_has_flag = government_is_republic + ep3_frankokratia_financier_trigger = yes + } + } + holder = { save_scope_as = financier } + } + } + } + #An Iberian coastal republic + if = { + limit = { + NOT = { exists = scope:financier } + } + title:e_spain = { + random_in_de_jure_hierarchy = { + limit = { + holder ?= { + highest_held_title_tier >= tier_county + government_has_flag = government_is_republic + ep3_frankokratia_financier_trigger = yes + } + } + holder = { save_scope_as = financier } + } + } + } + #A wealthy Italian ruler + if = { + limit = { + NOT = { exists = scope:financier } + } + title:e_italy = { + random_in_de_jure_hierarchy = { + limit = { + holder ?= { + highest_held_title_tier >= tier_county + highest_held_title_tier < tier_empire + ep3_frankokratia_financier_trigger = yes + } + } + holder = { save_scope_as = financier } + } + } + } + #A wealthy Sicilian ruler + if = { + limit = { + NOT = { exists = scope:financier } + } + title:k_sicily = { + random_in_de_jure_hierarchy = { + limit = { + holder ?= { + highest_held_title_tier >= tier_county + highest_held_title_tier < tier_empire + ep3_frankokratia_financier_trigger = yes + } + } + holder = { save_scope_as = financier } + } + } + } + #A wealthy Croatian ruler + if = { + limit = { + NOT = { exists = scope:financier } + } + title:k_croatia = { + random_in_de_jure_hierarchy = { + limit = { + holder ?= { + highest_held_title_tier >= tier_county + highest_held_title_tier < tier_empire + ep3_frankokratia_financier_trigger = yes + } + } + holder = { save_scope_as = financier } + } + } + } + #Make sure they have enough money to be a financier + hidden_effect = { + scope:financier = { + add_gold = 500 + } + } +} + +ep3_frankokratia_story_setup_save_vars_effect = { + #save variables for the story + set_variable = { + name = ghw_sponsor + value = scope:ghw_sponsor + } + set_variable = { + name = financier_title + value = scope:financier.primary_title + } + set_variable = { + name = byz_emperor + value = scope:byz_emperor + } + set_variable = { + name = byz_claimant + value = scope:byz_claimant + } + scope:byz_claimant = { + add_character_flag = byz_claimant_flag + } +} + +ep3_frankokratia_remove_pledged_attackers_effect = { + global_var:byz_claimant_champion ?= { + #save neeeded scopes + save_scope_as = byz_claimant_champion + random_owned_story = { + type = frankokratia_story + limit = { + exists = var:byz_claimant + } + var:byz_claimant = { + save_scope_as = byz_claimant + } + } + #Start war + start_war = { + casus_belli = crusading_claim_cb + target = title:e_byzantium.holder + claimant = scope:byz_claimant + target_title = title:e_byzantium + } + random_character_war = { + limit = { using_cb = crusading_claim_cb } + save_scope_as = frankokratia_war + } + #Add the claimant if they can join + if = { + limit = { + scope:byz_claimant = { is_ruler = yes } + } + scope:frankokratia_war = { + add_attacker = scope:byz_claimant + } + } + } + #Remove from GHW + if = { + limit = { + has_pledged_attacker = scope:byz_claimant_champion + } + unpledge_attacker = scope:byz_claimant_champion + } + if = { + limit = { + has_pledged_attacker = scope:byz_claimant + } + unpledge_attacker = scope:byz_claimant + } + #Redirected Crusader Fluff event + scope:byz_claimant_champion = { + trigger_event = ep3_frankokratia_events.0030 + } + #Do the same for all committed rulers + every_pledged_attacker = { + limit = { + has_character_flag = joining_frankokratia + this != root.faith.religious_head + } + #Unpledge from GHW + faith.great_holy_war = { + unpledge_attacker = prev + } + #ADD TO WAR + scope:frankokratia_war = { + add_attacker = prev + } + #Redirected Crusader Fluff event + trigger_event = ep3_frankokratia_events.0030 + } + scope:byz_claimant_champion = { + random_owned_story = { + type = frankokratia_story + if = { + limit = { + global_var:financier_title.holder ?= { + NOT = { + any_character_war = { + using_cb = crusading_claim_cb + } + } + } + } + scope:frankokratia_war = { + add_attacker = global_var:financier_title.holder + } + } + every_in_list = { + variable = frankokratia_leaders + limit = { + NOT = { + any_character_war = { + using_cb = crusading_claim_cb + } + } + is_ruler = yes + is_alive = yes + } + scope:frankokratia_war = { + add_attacker = prev + } + #Redirected Crusader Fluff event + trigger_event = ep3_frankokratia_events.0030 + } + } + } +} + +ep3_frankokratia_save_financier_sate_lands_effect = { + if = { + limit = { + any_realm_county = { + duchy = title:d_istria + NOT = { is_in_list = financier_sate_titles } + } + OR = { + #The duchy can be created + NOT = { exists = title:d_istria.holder } + #The duchy can be taken + title:d_istria.holder = { + is_vassal_or_below_of = title:e_byzantium.holder + is_ai = yes + NOT = { is_powerful_vassal_of = title:e_byzantium.holder } + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + } + title:d_istria = { save_scope_as = financier_sate_reward } + } + else_if = { + limit = { + any_realm_county = { + duchy = title:d_ragusa + NOT = { is_in_list = financier_sate_titles } + } + OR = { + #The duchy can be created + NOT = { exists = title:d_ragusa.holder } + #The duchy can be taken + title:d_ragusa.holder = { + is_vassal_or_below_of = title:e_byzantium.holder + is_ai = yes + NOT = { is_powerful_vassal_of = title:e_byzantium.holder } + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + } + title:d_dalmatia = { + save_scope_as = financier_sate_reward_duchy + add_to_list = financier_sate_titles + } + } + else_if = { + limit = { + any_realm_county = { + duchy = title:d_dalmatia + NOT = { is_in_list = financier_sate_titles } + } + OR = { + #The duchy can be created + NOT = { exists = title:d_dalmatia.holder } + #The duchy can be taken + title:d_dalmatia.holder = { + is_vassal_or_below_of = title:e_byzantium.holder + is_ai = yes + NOT = { is_powerful_vassal_of = title:e_byzantium.holder } + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + } + title:d_dalmatia = { + save_scope_as = financier_sate_reward_duchy + add_to_list = financier_sate_titles + } + } + else_if = { + limit = { + any_realm_county = { + duchy = title:d_cephalonia + NOT = { is_in_list = financier_sate_titles } + } + OR = { + #The duchy can be created + NOT = { exists = title:d_cephalonia.holder } + #The duchy can be taken + title:d_cephalonia.holder = { + is_vassal_or_below_of = title:e_byzantium.holder + is_ai = yes + NOT = { is_powerful_vassal_of = title:e_byzantium.holder } + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + } + title:d_cephalonia = { + save_scope_as = financier_sate_reward_duchy + add_to_list = financier_sate_titles + } + } + else_if = { + limit = { + any_realm_county = { + duchy = title:d_krete + NOT = { is_in_list = financier_sate_titles } + } + OR = { + #The duchy can be created + NOT = { exists = title:d_krete.holder } + #The duchy can be taken + title:d_krete.holder = { + is_vassal_or_below_of = title:e_byzantium.holder + is_ai = yes + NOT = { is_powerful_vassal_of = title:e_byzantium.holder } + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + } + title:d_krete = { + save_scope_as = financier_sate_reward_duchy + add_to_list = financier_sate_titles + } + } + else_if = { + limit = { + any_realm_county = { + duchy = title:d_cyprus + NOT = { is_in_list = financier_sate_titles } + } + OR = { + #The duchy can be created + NOT = { exists = title:d_cyprus.holder } + #The duchy can be taken + title:d_krete.holder = { + is_vassal_or_below_of = title:e_byzantium.holder + is_ai = yes + NOT = { is_powerful_vassal_of = title:e_byzantium.holder } + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + } + title:d_cyprus = { + save_scope_as = financier_sate_reward_duchy + add_to_list = financier_sate_titles + } + } + else_if = { + limit = { + any_realm_county = { + duchy = title:d_crimea + NOT = { is_in_list = financier_sate_titles } + } + OR = { + #The duchy can be created + NOT = { exists = title:d_crimea.holder } + #The duchy can be taken + title:d_crimea.holder = { + is_vassal_or_below_of = title:e_byzantium.holder + is_ai = yes + NOT = { is_powerful_vassal_of = title:e_byzantium.holder } + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + } + title:d_crimea = { + save_scope_as = financier_sate_reward_duchy + add_to_list = financier_sate_titles + } + } + #Moving on to counties they'd be interested in + else_if = { + limit = { + any_realm_county = { + NOT = { is_in_list = financier_sate_titles } + duchy = title:d_istria + has_coastal_province = yes + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + } + random_realm_county = { + limit = { + NOT = { is_in_list = financier_sate_titles } + duchy = title:d_istria + has_coastal_province = yes + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + save_scope_as = financier_sate_reward_county_1 + add_to_list = financier_sate_titles + } + } + else_if = { + limit = { + any_realm_county = { + NOT = { is_in_list = financier_sate_titles } + duchy = title:d_ragusa + has_coastal_province = yes + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + } + random_realm_county = { + limit = { + NOT = { is_in_list = financier_sate_titles } + duchy = title:d_ragusa + has_coastal_province = yes + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + if = { + limit = { exists = scope:financier_sate_reward_county_1 } + save_scope_as = financier_sate_reward_county_2 + } + else = { save_scope_as = financier_sate_reward_county_1 } + add_to_list = financier_sate_titles + } + } + else_if = { + limit = { + any_realm_county = { + NOT = { is_in_list = financier_sate_titles } + duchy = title:d_dalmatia + has_coastal_province = yes + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + } + random_realm_county = { + limit = { + NOT = { is_in_list = financier_sate_titles } + duchy = title:d_dalmatia + has_coastal_province = yes + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + if = { + limit = { exists = scope:financier_sate_reward_county_1 } + save_scope_as = financier_sate_reward_county_2 + } + else = { save_scope_as = financier_sate_reward_county_1 } + add_to_list = financier_sate_titles + } + } + else_if = { + limit = { + any_realm_county = { + NOT = { is_in_list = financier_sate_titles } + duchy = title:d_cephalonia + has_coastal_province = yes + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + } + random_realm_county = { + limit = { + NOT = { is_in_list = financier_sate_titles } + duchy = title:d_cephalonia + has_coastal_province = yes + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + if = { + limit = { exists = scope:financier_sate_reward_county_1 } + save_scope_as = financier_sate_reward_county_2 + } + else = { save_scope_as = financier_sate_reward_county_1 } + add_to_list = financier_sate_titles + } + } + else_if = { + limit = { + any_realm_county = { + NOT = { is_in_list = financier_sate_titles } + duchy = title:d_krete + has_coastal_province = yes + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + } + random_realm_county = { + limit = { + NOT = { is_in_list = financier_sate_titles } + duchy = title:d_krete + has_coastal_province = yes + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + if = { + limit = { exists = scope:financier_sate_reward_county_1 } + save_scope_as = financier_sate_reward_county_2 + } + else = { save_scope_as = financier_sate_reward_county_1 } + add_to_list = financier_sate_titles + } + } + + else_if = { + limit = { + any_realm_county = { + NOT = { is_in_list = financier_sate_titles } + duchy = title:d_cyprus + has_coastal_province = yes + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + } + random_realm_county = { + limit = { + NOT = { is_in_list = financier_sate_titles } + duchy = title:d_cyprus + has_coastal_province = yes + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + if = { + limit = { exists = scope:financier_sate_reward_county_1 } + save_scope_as = financier_sate_reward_county_2 + } + else = { save_scope_as = financier_sate_reward_county_1 } + add_to_list = financier_sate_titles + } + } + else_if = { + limit = { + any_realm_county = { + NOT = { is_in_list = financier_sate_titles } + duchy = title:d_crimea + has_coastal_province = yes + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + } + random_realm_county = { + limit = { + NOT = { is_in_list = financier_sate_titles } + duchy = title:d_crimea + has_coastal_province = yes + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + if = { + limit = { exists = scope:financier_sate_reward_county_1 } + save_scope_as = financier_sate_reward_county_2 + } + else = { save_scope_as = financier_sate_reward_county_1 } + add_to_list = financier_sate_titles + } + } + #Specific counties of interest + else_if = { + limit = { + any_realm_county = { + NOT = { is_in_list = financier_sate_titles } + this = title:c_zadar + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + } + random_realm_county = { + limit = { + NOT = { is_in_list = financier_sate_titles } + this = title:c_zadar + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + if = { + limit = { exists = scope:financier_sate_reward_county_1 } + save_scope_as = financier_sate_reward_county_2 + } + else = { save_scope_as = financier_sate_reward_county_1 } + add_to_list = financier_sate_titles + } + } + else_if = { + limit = { + any_realm_county = { + NOT = { is_in_list = financier_sate_titles } + this = title:c_cherso + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + } + random_realm_county = { + limit = { + NOT = { is_in_list = financier_sate_titles } + this = title:c_cherso + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + if = { + limit = { exists = scope:financier_sate_reward_county_1 } + save_scope_as = financier_sate_reward_county_2 + } + else = { save_scope_as = financier_sate_reward_county_1 } + add_to_list = financier_sate_titles + } + } + else_if = { + limit = { + any_realm_county = { + NOT = { is_in_list = financier_sate_titles } + this = title:c_dyrrachion + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + } + random_realm_county = { + limit = { + NOT = { is_in_list = financier_sate_titles } + this = title:c_dyrrachion + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + if = { + limit = { exists = scope:financier_sate_reward_county_1 } + save_scope_as = financier_sate_reward_county_2 + } + else = { save_scope_as = financier_sate_reward_county_1 } + add_to_list = financier_sate_titles + } + } + else_if = { + limit = { + any_realm_county = { + NOT = { is_in_list = financier_sate_titles } + this = title:c_euboea + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + } + random_realm_county = { + limit = { + NOT = { is_in_list = financier_sate_titles } + this = title:c_euboea + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + if = { + limit = { exists = scope:financier_sate_reward_county_1 } + save_scope_as = financier_sate_reward_county_2 + } + else = { save_scope_as = financier_sate_reward_county_1 } + add_to_list = financier_sate_titles + } + } + else_if = { + limit = { + any_realm_county = { + NOT = { is_in_list = financier_sate_titles } + this = title:c_messenia + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + } + random_realm_county = { + limit = { + NOT = { is_in_list = financier_sate_titles } + this = title:c_messenia + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + if = { + limit = { exists = scope:financier_sate_reward_county_1 } + save_scope_as = financier_sate_reward_county_2 + } + else = { save_scope_as = financier_sate_reward_county_1 } + add_to_list = financier_sate_titles + } + } + #Grab any coastal county + else_if = { + limit = { + any_realm_county = { + NOT = { is_in_list = financier_sate_titles } + has_coastal_province = yes + holder = { + is_ai = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + } + random_realm_county = { + limit = { + NOT = { is_in_list = financier_sate_titles } + has_coastal_province = yes + holder = { + is_ai = yes + NOT = { + is_at_war_with = title:e_byzantium.holder + } + } + } + if = { + limit = { exists = scope:financier_sate_reward_county_1 } + save_scope_as = financier_sate_reward_county_2 + } + else = { save_scope_as = financier_sate_reward_county_1 } + add_to_list = financier_sate_titles + } + } + + #IF we got a duchy, add all the valid counties in it to the list + if = { + limit = { + exists = scope:financier_sate_reward_duchy + } + every_realm_county = { + limit = { + duchy = scope:financier_sate_reward_duchy + holder = { + is_ai = yes + OR = { + this = title:e_byzantium.holder + NOT = { + is_at_war_with = title:e_byzantium.holder + } + } + } + } + add_to_list = financier_sate_titles + } + } +} + +ep3_frankokratia_give_financier_sate_lands_effect = { + #If there's a duchy to give, give all titles in it + if = { + limit = { + exists = scope:financier_sate_reward_duchy + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = yes + } + every_in_list = { + list = financier_sate_titles + change_title_holder = { + holder = scope:financier + change = scope:title_change + take_baronies = yes + } + } + resolve_title_and_vassal_change = scope:title_change + } + else = { + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = yes + } + scope:financier_sate_reward_county_1 = { + change_title_holder = { + holder = scope:financier + change = scope:title_change + take_baronies = yes + } + } + if = { + limit = { + exists = scope:financier_sate_reward_county_2 + } + scope:financier_sate_reward_county_2 = { + change_title_holder = { + holder = scope:financier + change = scope:title_change + take_baronies = yes + } + } + } + resolve_title_and_vassal_change = scope:title_change + } +} + +ep3_frankokratia_gather_governor_funds_effect = { + if = { + limit = { + any_vassal = { + is_governor = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + every_vassal = { + limit = { + is_governor = yes + NOT = { is_at_war_with = title:e_byzantium.holder } + } + hidden_effect = { + pay_short_term_gold = { + target = title:e_byzantium.holder + gold = 150 + } + } + add_to_list = paying_off_crusaders + } + } + else_if = { + limit = { + any_vassal = { + is_governor = no + NOT = { is_at_war_with = title:e_byzantium.holder } + } + } + every_vassal = { + limit = { + is_governor = no + NOT = { is_at_war_with = title:e_byzantium.holder } + } + hidden_effect = { + pay_short_term_gold = { + target = title:e_byzantium.holder + gold = 50 + } + } + add_to_list = paying_off_crusaders + } + } + scope:attacker = { + random_owned_story = { + type = frankokratia_story + save_scope_as = frankokratia_story + } + } + save_scope_value_as = { + name = crusader_payoff_total + value = scope:attacker.pay_off_crusaders_value + } + save_scope_value_as = { + name = payoff_per_crusader + value = { + value = 0 + add = scope:crusader_payoff_total + divide = { + value = 1 + scope:frankokratia_story = { + every_in_list = { + variable = frankokratia_leaders + limit = { + this != scope:attacker + } + add = 1 + } + } + subtract = 1 + min = 1 + } + } + } +} + +ep3_frankokratia_capital_sacking_effect = { + custom_tooltip = latin_empire_creation_tooltip + custom_tooltip = latin_empire_land_distribution_tooltip + add_dread = massive_dread_gain + custom_tooltip = { + text = every_crusader_gets_paid_sacking + add_short_term_gold = ep3_sacking_byz_capital_payoff_value + } + custom_tooltip = byzantine_empire_destroyed_tooltip + + hidden_effect = { + scope:frankokratia_story = { + every_in_list = { + variable = frankokratia_leaders + limit = { + this != scope:attacker + } + add_dread = medium_dread_gain + } + } + } + + scope:claimant.capital_county = { + change_county_control = -100 + if = { + limit = { + scope:claimant.capital_county = { + development_level >= 90 + } + } + change_development_level = -20 + } + else_if = { + limit = { + scope:claimant.capital_county = { + development_level >= 60 + } + } + change_development_level = -15 + } + else_if = { + limit = { + scope:claimant.capital_county = { + development_level >= 40 + } + } + change_development_level = -10 + } + else = { + change_development_level = -5 + } + custom_tooltip = byz_capital_building_destroyed_tooltip + } + scope:claimant.primary_title = { + state_faith = { + change_fervor = { + value = major_fervor_value + desc = imperial_capital_sacked_fervor_gain + } + } + } + + hidden_effect = { + scope:claimant.capital_province = { + destroy_random_building_variable_effect = yes + destroy_random_building_effect = yes + } + scope:claimant.capital_province = { + destroy_random_building_variable_effect = yes + destroy_random_building_effect = yes + } + scope:claimant.capital_province = { + destroy_random_building_variable_effect = yes + destroy_random_building_effect = yes + } + } + + faith:catholic = { + change_fervor = { + value = medium_fervor_loss + desc = imperial_capital_sacked_fervor_gain + } + } + hidden_effect = { + if = { + limit = { + NOT = { + culture = { + this = scope:claimant.capital_county.culture + } + } + } + culture = { + change_cultural_acceptance = { + target = scope:claimant.capital_county.culture + value = massive_cultural_acceptance_loss + desc = sacked_imperial_capital_cultural_acceptance + } + } + } + if = { + limit = { + NOR = { + scope:financier.culture = { + this = root.culture + } + scope:financier.culture = { + this = scope:claimant.capital_county.culture + } + } + } + scope:financier.culture = { + change_cultural_acceptance = { + target = scope:claimant.capital_county.culture + value = massive_cultural_acceptance_loss + desc = sacked_imperial_capital_cultural_acceptance + } + } + } + } + hidden_effect = { + #Destroy emperor's personal MaA + scope:claimant = { + if = { + limit = { + any_maa_regiment = { + is_title_maa_regiment = no + is_maa_type = cataphract + } + } + random_maa_regiment = { + limit = { + is_title_maa_regiment = no + is_maa_type = cataphract + } + destroy_maa_regiment = yes + } + } + else_if = { + limit = { + any_maa_regiment = { + is_title_maa_regiment = no + } + } + random_maa_regiment = { + limit = { + is_title_maa_regiment = no + } + destroy_maa_regiment = yes + } + } + } + } + if = { + limit = { + is_allied_to = scope:claimant + } + break_alliance = scope:claimant + } + + add_trait = despoiler_of_byzantium + custom_tooltip = frankokratia_leaders_gain_despoiler_trait + hidden_effect = { + scope:frankokratia_story = { + every_in_list = { + variable = frankokratia_leaders + limit = { + this != scope:attacker + } + add_trait = despoiler_of_byzantium + } + } + } + trigger_event = ep3_frankokratia_events.0042 +} + +ep3_frankokratia_kill_byzantines_effect = { + #Byzantines (and misc locals) are slaughtered in the taking of the city + title:e_byzantium.holder = { + #Courtiers of emperor + every_courtier_or_guest = { + limit = { + NOT = { + any_heir_title = { + holder ?= { + this = global_var:byz_claimant_champion + } + } + } + } + add_to_list = byz_civilians + } + #Local pool characters + every_pool_character = { + province = title:e_byzantium.holder.capital_province + limit = { + NOT = { + any_heir_title = { + holder ?= { + this = global_var:byz_claimant_champion + } + } + } + } + add_to_list = byz_civilians + } + #ai landless house heads in the capital + every_vassal = { + limit = { + is_ai = yes + is_landless_administrative = yes + domicile ?= { + domicile_location.county = { + this = title:e_byzantium.holder.capital_county + } + } + } + add_to_list = byz_civilians + } + #Courtiers of landless house heads in the capital + every_vassal = { + limit = { + is_landless_administrative = yes + domicile ?= { + domicile_location.county = { + this = title:e_byzantium.holder.capital_county + } + } + } + every_courtier_or_guest = { + limit = { + NOT = { + any_heir_title = { + holder ?= { + this = global_var:byz_claimant_champion + } + } + } + } + add_to_list = byz_civilians + } + } + } + ordered_in_list = { + order_by = { + value = 1 + #I suppose they would probably try to avoid killing Catholics... if possible + if = { + limit = { + NOR = { + faith = faith:catholic + this = scope:defender + is_close_family_of = scope:defender + } + } + add = 1 + } + } + list = byz_civilians + max = { + value = list_size:byz_civilians + divide = 3 + } + add_to_global_variable_list = { + name = slaughtered_byzantines_list + target = this + days = 30 + } + } + set_global_variable = { + name = slaughtered_byzantines + value = { + value = 0 + every_in_global_list = { + variable = slaughtered_byzantines_list + add = 1 + } + } + days = 30 + } + + #Let everyone know this happened + scope:frankokratia_story = { + every_in_list = { + variable = frankokratia_leaders + limit = { + is_ai = no + } + add_to_list = byz_slaughter_recipients + } + } + title:e_byzantium.holder = { + if = { + limit = { + is_ai = no + } + add_to_list = byz_slaughter_recipients + } + every_vassal_or_below = { + limit = { + is_ai = no + } + add_to_list = byz_slaughter_recipients + } + } + every_in_list = { + list = byz_slaughter_recipients + trigger_event = ep3_frankokratia_events.0046 + } + + hidden_effect = { + every_in_global_list = { + variable = slaughtered_byzantines_list + death = { + death_reason = death_frankokratia_sacking + } + } + } +} + +ep3_frankokratia_paying_off_latins_effect = { + #If crusader state exists - all troops go to crusader king and crusaders get piety + if = { + limit = { + scope:frankokratia_story = { + has_variable = crusader_kingdom + exists = var:crusader_kingdom.holder + var:crusader_kingdom.holder = { + faith = scope:attacker.faith + NOR = { + is_at_war_with = scope:attacker + is_at_war_with = scope:claimant + } + } + } + } + scope:frankokratia_story = { + var:crusader_kingdom.holder = { + save_scope_as = crusader_king + } + } + scope:crusader_king = { + spawn_army = { + name = ep3_frankokratia_reward_army_name + uses_supply = yes + levies = 3400 + men_at_arms = { + type = cataphract + stacks = ep3_byz_regiments_ck_value + } + location = scope:claimant.capital_province + } + } + scope:attacker = { + add_piety = massive_piety_gain + } + if = { + limit = { + scope:attacker = { + has_trait = excommunicated + } + } + scope:attacker = { remove_trait = excommunicated } + } + custom_tooltip = frankokratia_leaders_lose_excommunicated + } + else = { + scope:attacker = { + add_piety = major_piety_gain + spawn_army = { + name = ep3_frankokratia_reward_army_name + uses_supply = yes + levies = ep3_byz_reward_levy_size_value + men_at_arms = { + type = cataphract + stacks = ep3_byz_regiments_gained_value + } + location = scope:claimant.capital_province + inheritable = no + } + custom_tooltip = frankokratia_leaders_gain_identical_force + } + } + if = { + limit = { + exists = scope:financier_sate_reward_duchy + } + show_as_tooltip = { + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = yes + } + scope:financier_sate_reward_duchy = { + change_title_holder = { + holder = scope:financier + change = scope:title_change + take_baronies = yes + } + } + resolve_title_and_vassal_change = scope:title_change + } + hidden_effect = { + title:e_byzantium.holder = { + ep3_frankokratia_give_financier_sate_lands_effect = yes + } + } + } + else_if = { + limit = { + exists = scope:financier_sate_reward_county_1 + } + title:e_byzantium.holder = { + ep3_frankokratia_give_financier_sate_lands_effect = yes + } + } + add_legitimacy = major_legitimacy_loss + add_tyranny = massive_tyranny_gain + + add_character_modifier = { + modifier = bent_before_crusaders_modifier + years = 10 + } + #Army transfer - Emperor loses MaA regiments + if = { + limit = { + exists = scope:regiment_2 + } + custom_tooltip = 2_byzantine_regiments_given_over_tooltip + hidden_effect = { + scope:regiment_1 = { destroy_maa_regiment = yes } + } + } + else_if = { + limit = { + exists = scope:regiment_1 + } + custom_tooltip = 1_byzantine_regiment_given_over_tooltip + hidden_effect = { + scope:regiment_1 = { destroy_maa_regiment = yes } + scope:regiment_2 = { destroy_maa_regiment = yes } + } + } + + capital_county = { + add_county_modifier = { + modifier = crippled_by_imperial_debt_modifier + years = 25 + } + } + + # Show how much gold is paid out to every crusader + ep3_frankokratia_gather_governor_funds_effect = yes + custom_tooltip = { + text = every_crusader_gets_paid + scope:frankokratia_story = { + every_in_list = { + variable = frankokratia_leaders + scope:claimant = { + pay_short_term_gold = { + target = prev + gold = scope:payoff_per_crusader + } + } + } + } + } +} + +ep3_frankokratia_designate_latin_empire_effect = { + #GO FOR CONSTANTINOPLE/THESSALONIKA AS CAPITAL KINGDOM FIRST + if = { + limit = { + title:e_byzantium.holder = { + any_realm_county = { + this = title:c_byzantion + } + } + title:c_byzantion.holder = { + is_ai = yes + OR = { + this = title:e_byzantium.holder + NOT = { + is_at_war_with = title:e_byzantium.holder + } + } + } + } + title:c_byzantion = { save_scope_as = latin_capital } + title:b_constantinople = { + save_scope_as = latin_capital_barony + } + #Try to save thessalonika as the most natural capital kingdom + if = { + limit = { + title:k_thessalonika = { + ep3_frankokratia_latin_kingdom_available_trigger = yes + } + } + title:k_thessalonika = { save_scope_as = latin_kingdom_1 } + } + #Start going through other capital kingdoms in order of logic - they really should have one + else_if = { + limit = { + title:k_nikaea = { + ep3_frankokratia_latin_kingdom_available_trigger = yes + } + } + title:k_nikaea = { save_scope_as = latin_kingdom_1 } + } + else_if = { + limit = { + title:k_hellas = { + ep3_frankokratia_latin_kingdom_available_trigger = yes + } + } + title:k_hellas = { save_scope_as = latin_kingdom_1 } + } + else_if = { + limit = { + title:k_bulgaria = { + ep3_frankokratia_latin_kingdom_available_trigger = yes + } + } + title:k_bulgaria = { save_scope_as = latin_kingdom_1 } + } + else_if = { + limit = { + title:e_byzantium = { + any_in_de_jure_hierarchy = { + tier = tier_kingdom + ep3_frankokratia_latin_kingdom_available_trigger = yes + any_de_jure_county = { + is_coastal_county = yes + } + } + } + } + title:e_byzantium = { + random_in_de_jure_hierarchy = { + limit = { + tier = tier_kingdom + ep3_frankokratia_latin_kingdom_available_trigger = yes + any_de_jure_county = { + is_coastal_county = yes + } + } + save_scope_as = latin_kingdom_1 + } + } + } + else_if = { + limit = { + NOT = { exists = scope:latin_kingdom_1 } + } + title:e_byzantium = { + random_in_de_jure_hierarchy = { + limit = { + tier = tier_kingdom + ep3_frankokratia_latin_kingdom_available_trigger = yes + } + save_scope_as = latin_kingdom_1 + } + } + } + #The latins also took Hellas, first prio + if = { + limit = { + title:e_byzantium.holder = { + any_realm_county = { + kingdom = title:k_hellas + title:k_hellas = { + this != scope:latin_kingdom_1 + ep3_frankokratia_latin_kingdom_available_trigger = yes + } + } + } + } + title:k_hellas = { save_scope_as = latin_kingdom_2 } + } + #The latins had a short-lived attempt at ruling southern Bulgaria + else_if = { + limit = { + title:e_byzantium.holder = { + any_realm_county = { + kingdom = title:k_bulgaria + title:k_bulgaria = { + this != scope:latin_kingdom_1 + ep3_frankokratia_latin_kingdom_available_trigger = yes + } + } + } + } + title:k_bulgaria = { save_scope_as = latin_kingdom_2 } + } + #Krete, why not + else_if = { + limit = { + title:e_byzantium.holder = { + any_realm_county = { + kingdom = title:k_krete + title:k_krete = { + this != scope:latin_kingdom_1 + ep3_frankokratia_latin_kingdom_available_trigger = yes + } + } + } + } + title:k_krete = { save_scope_as = latin_kingdom_2 } + } + #The latins had some of Nikaea I guess + else_if = { + limit = { + title:e_byzantium.holder = { + any_realm_county = { + kingdom = title:k_nikaea + title:k_nikaea = { + this != scope:latin_kingdom_1 + ep3_frankokratia_latin_kingdom_available_trigger = yes + } + } + } + } + title:k_nikaea = { save_scope_as = latin_kingdom_2 } + } + #Cyprus, why not + else_if = { + limit = { + title:e_byzantium.holder = { + any_realm_county = { + kingdom = title:k_cyprus + title:k_cyprus = { + this != scope:latin_kingdom_1 + ep3_frankokratia_latin_kingdom_available_trigger = yes + } + } + } + } + title:k_cyprus = { save_scope_as = latin_kingdom_2 } + } + } + #NO CONSTANTINOPLE - WHATEVER THE IMPERIAL CAPITAL IS + else = { + title:e_byzantium.holder.capital_county = { + save_scope_as = latin_capital + } + title:e_byzantium.holder.capital_barony = { + save_scope_as = latin_capital_barony + } + #Is the kingdom available as capital kingdom? + if = { + limit = { + scope:latin_capital.kingdom = { + ep3_frankokratia_latin_kingdom_available_trigger = yes + } + } + scope:latin_capital.kingdom = { save_scope_as = latin_kingdom_1 } + } + #Is any neighboring kingdom available to be capital? + else_if = { + limit = { + title:e_byzantium = { + any_in_de_jure_hierarchy = { + tier = tier_kingdom + ep3_frankokratia_latin_kingdom_available_trigger = yes + any_de_jure_county = { + #Belongs to the empire + OR = { + holder = { + this = title:e_byzantium.holder + } + holder = { + is_vassal_or_below_of = title:e_byzantium.holder + NOT = { + is_at_war_with = title:e_byzantium.holder + } + } + } + #Neighbours main kingdom + any_neighboring_county = { + kingdom = scope:latin_capital.kingdom + } + } + } + } + } + title:e_byzantium = { + random_in_de_jure_hierarchy = { + limit = { + tier = tier_kingdom + OR = { + NOT = { exists = holder } + holder = { + this = title:e_byzantium.holder + } + } + any_de_jure_county = { + #Belongs to the empire + OR = { + holder = title:e_byzantium.holder + holder = { + is_vassal_or_below_of = title:e_byzantium.holder + NOT = { + is_at_war_with = title:e_byzantium.holder + } + } + } + #Neighbours main kingdom + any_neighboring_county = { + kingdom = scope:latin_capital.kingdom + } + } + } + save_scope_as = latin_kingdom_1 + } + } + } + #Need to start looking at random capital kingdoms + else_if = { + limit = { + title:e_byzantium = { + any_in_de_jure_hierarchy = { + tier = tier_kingdom + ep3_frankokratia_latin_kingdom_available_trigger = yes + any_de_jure_county = { + is_coastal_county = yes + } + } + } + } + title:e_byzantium = { + random_in_de_jure_hierarchy = { + limit = { + tier = tier_kingdom + ep3_frankokratia_latin_kingdom_available_trigger = yes + any_de_jure_county = { + is_coastal_county = yes + } + } + save_scope_as = latin_kingdom_1 + } + } + } + else_if = { + limit = { + NOT = { exists = scope:latin_kingdom_1 } + } + title:e_byzantium = { + random_in_de_jure_hierarchy = { + limit = { + tier = tier_kingdom + ep3_frankokratia_latin_kingdom_available_trigger = yes + } + save_scope_as = latin_kingdom_1 + } + } + } + #Give a random neighboring kingdom as a second one + if = { + limit = { + title:e_byzantium = { + any_in_de_jure_hierarchy = { + tier = tier_kingdom + this != scope:latin_kingdom_1 + ep3_frankokratia_latin_kingdom_available_trigger = yes + any_de_jure_county = { + #Belongs to the empire + OR = { + holder = { + this = title:e_byzantium.holder + } + holder = { + is_vassal_or_below_of = title:e_byzantium.holder + NOT = { + is_at_war_with = title:e_byzantium.holder + } + } + } + #Neighbours main kingdom + any_neighboring_county = { + kingdom = scope:latin_kingdom_1 + } + } + } + } + } + title:e_byzantium = { + random_in_de_jure_hierarchy = { + limit = { + tier = tier_kingdom + this != scope:latin_kingdom_1 + ep3_frankokratia_latin_kingdom_available_trigger = yes + any_de_jure_county = { + #Belongs to the empire + OR = { + holder = { + this = title:e_byzantium.holder + } + holder = { + is_vassal_or_below_of = title:e_byzantium.holder + NOT = { + is_at_war_with = title:e_byzantium.holder + } + } + } + #Neighbours main kingdom + any_neighboring_county = { + kingdom = scope:latin_kingdom_1 + } + } + } + save_scope_as = latin_kingdom_2 + } + } + } + } + scope:latin_capital = { + add_to_list = latin_emperor_titles + } + scope:latin_kingdom_1 ?= { + add_to_list = latin_emperor_titles + set_global_variable = { + name = latin_kingdom_1 + value = scope:latin_kingdom_1 + days = 60 + } + } + scope:latin_kingdom_2 ?= { + add_to_list = latin_emperor_titles + set_global_variable = { + name = latin_kingdom_2 + value = scope:latin_kingdom_2 + days = 60 + } + } + title:e_latin_empire = { + add_to_list = latin_emperor_titles + } +} + +ep3_latin_empire_designate_financier_lands_effect = { + #First, give aegean islands counties + title:e_byzantium.holder = { + if = { + limit = { + scope:latin_capital.kingdom = { + this = title:k_thessalonika + } + any_realm_county = { + NOT = { is_in_list = financier_sate_titles } + duchy = title:d_aegean_islands + holder = { + is_ai = yes + NOT = { + is_at_war_with = title:e_byzantium.holder + } + } + } + } + title:d_aegean_islands = { + save_scope_as = financier_latin_emp_duchy + } + } + #Not possible? Give them counties from a duchy with a coastal province in the latin kingdom + else_if = { + limit = { + any_realm_county = { + NOR = { + is_in_list = financier_sate_titles + this = scope:latin_capital + } + kingdom = scope:latin_capital.kingdom + has_coastal_province = yes + holder = { + is_ai = yes + NOT = { + is_at_war_with = title:e_byzantium.holder + } + } + } + } + random_realm_county = { + limit = { + NOR = { + is_in_list = financier_sate_titles + this = scope:latin_capital + } + kingdom = scope:latin_capital.kingdom + has_coastal_province = yes + holder = { + is_ai = yes + NOT = { + is_at_war_with = title:e_byzantium.holder + } + } + } + duchy = { save_scope_as = financier_latin_emp_duchy } + } + } + #Not possible? Give them counties from a duchy with a coastal province that borders the latin kingdom + else_if = { + limit = { + any_realm_county = { + any_neighboring_county = { + kingdom = scope:latin_capital.kingdom + } + NOR = { + is_in_list = financier_sate_titles + this = scope:latin_capital + } + has_coastal_province = yes + holder = { + is_ai = yes + NOT = { + is_at_war_with = title:e_byzantium.holder + } + } + } + } + random_realm_county = { + limit = { + NOR = { + is_in_list = financier_sate_titles + this = scope:latin_capital + } + any_neighboring_county = { + kingdom = scope:latin_capital.kingdom + } + has_coastal_province = yes + holder = { + is_ai = yes + NOT = { + is_at_war_with = title:e_byzantium.holder + } + } + } + duchy = { save_scope_as = financier_latin_emp_duchy } + } + } + #Not possible? Run the sate rewards effect again and add more to that list + else = { + ep3_frankokratia_save_financier_sate_lands_effect = yes + } + + #Give all counties in the duchy + if = { + limit = { + exists = scope:financier_latin_emp_duchy + } + every_realm_county = { + limit = { + duchy = scope:financier_latin_emp_duchy + holder = { + is_ai = yes + NOT = { + is_at_war_with = title:e_byzantium.holder + } + } + } + add_to_list = financier_latin_emp_titles + } + } + #Give the duchy the financier's counties are in, if possible + if = { + limit = { + scope:financier_latin_emp_duchy ?= { + NOT = { is_in_list = financier_sate_titles } + OR = { + NOT = { exists = holder } + holder = { + is_ai = yes + NOT = { + is_at_war_with = title:e_byzantium.holder + } + OR = { + this = title:e_byzantium.holder + is_vassal_or_below_of = title:e_byzantium.holder + } + } + } + } + } + scope:financier_latin_emp_duchy = { + add_to_list = financier_latin_emp_titles + } + } + #GIVE THE SATE REWARD TITLES as well as the prior stuff + every_in_list = { + list = financier_sate_titles + add_to_list = financier_latin_emp_titles + } + } +} + +ep3_frankokratia_grant_latin_empire_effect = { + #Make it less likely frankokratia will happen again + set_global_variable = { + name = frankokratia_occurred + value = current_date + } + scope:latin_capital.kingdom = { + every_de_jure_county = { + limit = { + this != scope:latin_capital + holder = { + OR = { + this = title:e_byzantium.holder + AND = { + is_ai = yes + is_vassal_or_below_of = title:e_byzantium.holder + NOT = { + is_at_war_with = title:e_byzantium.holder + } + } + } + this != scope:financier + } + } + add_to_list = latin_emperor_titles + } + } + scope:latin_capital = { + if = { + limit = { + duchy = { + OR = { + NOT = { exists = holder } + holder = { + is_ai = yes + OR = { + is_vassal_or_below_of = title:e_byzantium.holder + this = title:e_byzantium.holder + } + NOT = { + is_at_war_with = title:e_byzantium.holder + } + } + } + } + } + duchy = { + add_to_list = latin_emperor_titles + } + } + } + show_as_tooltip = { + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + add_claim_on_loss = yes + } + every_in_list = { + list = latin_emperor_titles + limit = { + tier > tier_county + } + change_title_holder = { + holder = scope:latin_emperor + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + } + hidden_effect = { + #Titles for emperor + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = yes + } + every_in_list = { + list = latin_emperor_titles + change_title_holder = { + holder = scope:latin_emperor + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + } + scope:latin_emperor = { + #Gains Latin Empire special troops + if = { + limit = { + scope:frankokratia_story = { + any_in_list = { + variable = frankokratia_leaders + culture = { + has_cultural_parameter = unlock_maa_conrois + } + } + any_in_list = { + variable = frankokratia_leaders + culture = { + has_innovation = innovation_advanced_bowmaking + } + } + } + } + spawn_army = { + name = ep3_latin_emp_army_name + uses_supply = yes + inheritable = yes + levies = latin_emp_army_levies_value + men_at_arms = { + type = conrois + stacks = latin_emp_army_maa_value + } + men_at_arms = { + type = crossbowmen + stacks = latin_emp_army_maa_value + } + location = scope:latin_capital_barony.title_province + } + } + else_if = { + limit = { + scope:frankokratia_story = { + any_in_list = { + variable = frankokratia_leaders + culture = { + has_cultural_parameter = unlock_maa_conrois + } + } + any_in_list = { + variable = frankokratia_leaders + culture = { + has_innovation = innovation_quilted_armor + } + } + } + + } + spawn_army = { + name = ep3_latin_emp_army_name + uses_supply = yes + inheritable = yes + levies = latin_emp_army_levies_value + men_at_arms = { + type = conrois + stacks = latin_emp_army_maa_value + } + men_at_arms = { + type = armored_footmen + stacks = latin_emp_army_maa_value + } + location = scope:latin_capital_barony.title_province + } + } + else_if = { + limit = { + scope:frankokratia_story = { + any_in_list = { + variable = frankokratia_leaders + culture = { + has_cultural_parameter = unlock_maa_conrois + } + } + } + } + spawn_army = { + name = ep3_latin_emp_army_name + uses_supply = yes + inheritable = yes + levies = latin_emp_army_levies_value + men_at_arms = { + type = conrois + stacks = latin_emp_army_maa_value + } + men_at_arms = { + type = pikemen_unit + stacks = latin_emp_army_maa_value + } + location = scope:latin_capital_barony.title_province + } + } + else_if = { + limit = { + scope:frankokratia_story = { + any_in_list = { + variable = frankokratia_leaders + culture = { + has_innovation = innovation_arched_saddle + } + } + any_in_list = { + variable = frankokratia_leaders + culture = { + has_innovation = innovation_advanced_bowmaking + } + } + } + } + spawn_army = { + name = ep3_latin_emp_army_name + uses_supply = yes + inheritable = yes + levies = latin_emp_army_levies_value + men_at_arms = { + type = armored_horsemen + stacks = latin_emp_army_maa_value + } + men_at_arms = { + type = crossbowmen + stacks = latin_emp_army_maa_value + } + location = scope:latin_capital_barony.title_province + } + } + else_if = { + limit = { + scope:frankokratia_story = { + any_in_list = { + variable = frankokratia_leaders + culture = { + has_innovation = innovation_arched_saddle + } + } + any_in_list = { + variable = frankokratia_leaders + culture = { + has_innovation = innovation_quilted_armor + } + } + } + } + spawn_army = { + name = ep3_latin_emp_army_name + uses_supply = yes + inheritable = yes + levies = latin_emp_army_levies_value + men_at_arms = { + type = armored_horsemen + stacks = latin_emp_army_maa_value + } + men_at_arms = { + type = armored_footmen + stacks = latin_emp_army_maa_value + } + location = scope:latin_capital_barony.title_province + } + } + else_if = { + limit = { + scope:frankokratia_story = { + any_in_list = { + variable = frankokratia_leaders + culture = { + has_innovation = innovation_arched_saddle + } + } + } + } + spawn_army = { + name = ep3_latin_emp_army_name + uses_supply = yes + inheritable = yes + levies = latin_emp_army_levies_value + men_at_arms = { + type = armored_horsemen + stacks = latin_emp_army_maa_value + } + men_at_arms = { + type = pikemen_unit + stacks = latin_emp_army_maa_value + } + location = scope:latin_capital_barony.title_province + } + } + else_if = { + limit = { + scope:frankokratia_story = { + any_in_list = { + variable = frankokratia_leaders + culture = { + has_innovation = innovation_quilted_armor + } + } + any_in_list = { + variable = frankokratia_leaders + culture = { + has_innovation = innovation_advanced_bowmaking + } + } + } + } + spawn_army = { + name = ep3_latin_emp_army_name + uses_supply = yes + inheritable = yes + levies = latin_emp_army_levies_value + men_at_arms = { + type = armored_footmen + stacks = latin_emp_army_maa_value + } + men_at_arms = { + type = crossbowmen + stacks = latin_emp_army_maa_value + } + location = scope:latin_capital_barony.title_province + } + } + else_if = { + limit = { + scope:frankokratia_story = { + any_in_list = { + variable = frankokratia_leaders + culture = { + has_innovation = innovation_quilted_armor + } + } + } + } + spawn_army = { + name = ep3_latin_emp_army_name + uses_supply = yes + inheritable = yes + levies = latin_emp_army_levies_value + men_at_arms = { + type = armored_footmen + stacks = latin_emp_army_maa_value + } + men_at_arms = { + type = light_horsemen + stacks = latin_emp_army_maa_value + } + location = scope:latin_capital_barony.title_province + } + } + else_if = { + limit = { + scope:frankokratia_story = { + any_in_list = { + variable = frankokratia_leaders + culture = { + has_innovation = innovation_advanced_bowmaking + } + } + } + } + spawn_army = { + name = ep3_latin_emp_army_name + uses_supply = yes + inheritable = yes + levies = latin_emp_army_levies_value + men_at_arms = { + type = crossbowmen + stacks = latin_emp_army_maa_value + } + men_at_arms = { + type = light_horsemen + stacks = latin_emp_army_maa_value + } + location = scope:latin_capital_barony.title_province + } + } + else = { + spawn_army = { + name = ep3_latin_emp_army_name + uses_supply = yes + inheritable = yes + levies = latin_emp_army_levies_value + men_at_arms = { + type = light_horsemen + stacks = latin_emp_army_maa_value + } + men_at_arms = { + type = pikemen_unit + stacks = latin_emp_army_maa_value + } + location = scope:latin_capital_barony.title_province + } + } + } + #Change succession law? + scope:latin_emperor = { + add_realm_law = crown_authority_2 + } + #Stop this admin stuff + if = { + limit = { + scope:latin_emperor = { + government_has_flag = government_is_administrative + } + } + scope:latin_emperor = { + change_government = feudal_government + } + } +} + +ep3_frankokratia_clear_old_lands_change_capital_effect = { + if = { + limit = { + ep3_frankokratia_discard_old_lands_trigger = yes + exists = scope:latin_kingdom_1 + exists = scope:latin_kingdom_2 + this = scope:latin_empire_receiver + } + custom_tooltip = old_titles_vassals_emp_beneficiary_2_kings_tooltip + } + else_if = { + limit = { + ep3_frankokratia_discard_old_lands_trigger = yes + exists = scope:latin_kingdom_1 + this = scope:latin_empire_receiver + } + custom_tooltip = old_titles_vassals_emp_beneficiary_1_king_tooltip + } + else_if = { + limit = { + this = scope:latin_empire_receiver + } + custom_tooltip = old_titles_vassals_emp_beneficiary_no_king_tooltip + } + else = { + custom_tooltip = old_titles_vassals_lord_beneficiary_tooltip + } + if = { + limit = { + this != scope:latin_empire_receiver + } + scope:beneficiary = { + save_scope_as = old_title_gainer + } + } + else = { + scope:emp_beneficiary = { + save_scope_as = old_title_gainer + } + } + hidden_effect = { + if = { + limit = { + OR = { + any_in_list = { + list = root_old_vassals + count >= 1 + } + any_in_list = { + list = root_old_titles + count >= 1 + } + } + } + #Remove all of character's other titles - pass to heir? + create_title_and_vassal_change = { + type = granted + save_scope_as = change + add_claim_on_loss = no + } + every_in_list = { + list = root_old_vassals + change_liege = { + liege = scope:old_title_gainer + change = scope:change + } + } + every_in_list = { + list = root_old_titles + change_title_holder = { + holder = scope:old_title_gainer + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + #Need to give titles back to their former liege + if = { + limit = { + has_variable = old_liege + } + var:old_liege = { + save_scope_as = old_liege + } + scope:old_title_gainer = { + create_title_and_vassal_change = { + type = granted + save_scope_as = change + add_claim_on_loss = no + } + change_liege = { + liege = scope:old_liege + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + ##Or need to make titles independent + else_if = { + limit = { + scope:old_title_gainer = { + highest_held_title_tier < tier_empire + } + } + scope:old_title_gainer = { + create_title_and_vassal_change = { + type = independency + save_scope_as = change + add_claim_on_loss = no + } + becomes_independent = { change = scope:change } + resolve_title_and_vassal_change = scope:change + } + } + } + if = { + limit = { + any_realm_county = { + this = title:c_byzantion + } + capital_county = { + NOT = { + this = title:c_byzantion + } + } + } + set_realm_capital = title:c_byzantion + } + } +} + +ep3_frankokratia_distribute_lands_to_crusaders_effect = { + + #save a list of all titles there are to give out + #Counties in latin kingdom + every_in_list = { + list = latin_emperor_titles + limit = { + NOR = { + this = scope:latin_capital + #Don't give out financier's lands, unless financier is latin emp + holder = { + this = scope:financier + this != scope:latin_emperor + } + this = title:c_byzantion + } + tier = tier_county + NOT = { + duchy = { + holder = scope:latin_emperor + } + } + } + add_to_list = available_latin_kingdom_counties + add_to_list = available_latin_emp_counties + } + #Counties on border with latin capital + scope:latin_emperor = { + every_realm_county = { + limit = { + this = scope:latin_capital + } + every_neighboring_county = { + limit = { + OR = { + holder = title:e_byzantium.holder + holder = { + is_ai = yes + is_vassal_or_below_of = title:e_byzantium.holder + NOT = { + is_at_war_with = title:e_byzantium.holder + } + } + } + } + add_to_list = available_latin_neighbor_counties + add_to_list = available_latin_emp_counties + } + } + } + #Border counties belonging to kingdom owned by latin emperor + if = { + limit = { + exists = scope:latin_kingdom_2 + } + scope:latin_emperor = { + every_realm_county = { + every_neighboring_county = { + limit = { + kingdom = scope:latin_kingdom_2 + OR = { + holder = title:e_byzantium.holder + holder = { + is_ai = yes + is_vassal_or_below_of = title:e_byzantium.holder + NOT = { + is_at_war_with = title:e_byzantium.holder + } + } + } + } + add_to_list = available_latin_neighbor_counties + add_to_list = available_latin_emp_counties + } + } + } + } + + ##Save duchies in the latin emp that can be given out + if = { + limit = { + any_in_list = { + list = available_latin_kingdom_counties + duchy = { + OR = { + NOT = { exists = holder } + holder = title:e_byzantium.holder + holder = { + is_ai = yes + is_vassal_or_below_of = title:e_byzantium.holder + NOT = { + is_at_war_with = title:e_byzantium.holder + } + } + } + } + } + } + every_in_list = { + list = available_latin_kingdom_counties + limit = { + duchy = { + OR = { + NOT = { exists = holder } + holder = title:e_byzantium.holder + holder = { + is_ai = yes + is_vassal_or_below_of = title:e_byzantium.holder + NOT = { + is_at_war_with = title:e_byzantium.holder + } + } + NOT = { + holder = { + this = scope:financier + this != scope:latin_emperor + } + } + } + } + } + duchy = { + add_to_list = available_latin_kingdom_duchies + add_to_list = available_latin_emp_duchies + } + } + } + #Save neighboring duchies that can be given out + if = { + limit = { + any_in_list = { + list = available_latin_neighbor_counties + duchy = { + OR = { + NOT = { exists = holder } + holder = title:e_byzantium.holder + holder = { + is_ai = yes + is_vassal_or_below_of = title:e_byzantium.holder + NOT = { + is_at_war_with = title:e_byzantium.holder + } + } + } + } + } + } + every_in_list = { + list = available_latin_neighbor_counties + limit = { + duchy = { + OR = { + NOT = { exists = holder } + holder = title:e_byzantium.holder + holder = { + is_ai = yes + is_vassal_or_below_of = title:e_byzantium.holder + NOT = { + is_at_war_with = title:e_byzantium.holder + } + } + NOT = { + holder = { + this = scope:financier + this != scope:latin_emperor + } + } + } + } + } + duchy = { + add_to_list = available_latin_neighbor_duchies + add_to_list = available_latin_emp_duchies + } + } + } + + while = { + limit = { + #Ends when counties or empire duchies (which should all have empire counties) are out + OR = { + any_in_list = { + list = available_latin_kingdom_counties + count >= 1 + } + any_in_list = { + list = available_latin_emp_duchies + count >= 1 + } + } + } + if = { + limit = { + scope:frankokratia_story = { + any_in_list = { + variable = frankokratia_leaders + is_ruler = yes + NOR = { + is_in_list = designated_latin_emp_titles + this = scope:financier + this = scope:latin_empire_receiver + } + } + } + } + #Save player first + if = { + limit = { + scope:frankokratia_story = { + any_in_list = { + variable = frankokratia_leaders + is_ruler = yes + is_ai = no + NOR = { + is_in_list = designated_latin_emp_titles + this = scope:financier + this = scope:latin_empire_receiver + } + } + } + } + #Grant duchy and county to strongest player + scope:frankokratia_story = { + ordered_in_list = { + variable = frankokratia_leaders + order_by = max_military_strength + limit = { + is_ruler = yes + is_ai = no + NOR = { + is_in_list = designated_latin_emp_titles + this = scope:financier + this = scope:latin_empire_receiver + } + } + add_to_list = designated_latin_emp_titles + save_scope_as = latin_title_candidate + } + } + } + #save AI + else = { + scope:frankokratia_story = { + ordered_in_list = { + variable = frankokratia_leaders + order_by = max_military_strength + limit = { + is_ruler = yes + NOR = { + is_in_list = designated_latin_emp_titles + this = scope:financier + this = scope:latin_empire_receiver + } + } + add_to_list = designated_latin_emp_titles + save_scope_as = latin_title_candidate + } + } + } + #Save titles they're getting + + #Give them a latin kingdom duchy and county + if = { + limit = { + any_in_list = { + list = available_latin_kingdom_duchies + count >= 1 + } + } + random_in_list = { + list = available_latin_kingdom_duchies + remove_from_list = available_latin_kingdom_duchies + remove_from_list = available_latin_emp_duchies + save_scope_as = duchy_to_grant + title_capital_county = { save_scope_as = duchy_capital } + } + random_in_list = { + list = available_latin_kingdom_counties + save_temporary_scope_as = county_temp + limit = { + this = scope:duchy_capital + } + alternative_limit = { + duchy = scope:duchy_to_grant + } + remove_from_list = available_latin_kingdom_counties + remove_from_list = available_latin_emp_counties + save_scope_as = county_to_grant + } + scope:latin_title_candidate = { + #Set the variable so it can be granted when character gets event + set_variable = { + name = latin_duchy + value = scope:duchy_to_grant + } + set_variable = { + name = latin_county + value = scope:county_to_grant + } + } + } + #Give them a neighboring county and duchy + else_if = { + limit = { + any_in_list = { + list = available_latin_neighbor_duchies + count >= 1 + } + } + random_in_list = { + list = available_latin_neighbor_duchies + remove_from_list = available_latin_neighbor_duchies + remove_from_list = available_latin_emp_duchies + save_scope_as = duchy_to_grant + title_capital_county = { save_scope_as = duchy_capital } + } + random_in_list = { + list = available_latin_neighbor_counties + save_temporary_scope_as = county_temp + limit = { + duchy = scope:duchy_to_grant + } + remove_from_list = available_latin_neighbor_counties + remove_from_list = available_latin_emp_counties + save_scope_as = county_to_grant + } + scope:latin_title_candidate = { + #Set the variable so it can be granted when character gets event + set_variable = { + name = latin_duchy + value = scope:duchy_to_grant + } + set_variable = { + name = latin_county + value = scope:county_to_grant + } + } + } + #Give them a latin kingdom county + else = { + random_in_list = { + list = available_latin_kingdom_counties + remove_from_list = available_latin_kingdom_counties + remove_from_list = available_latin_emp_counties + save_scope_as = county_to_grant + } + scope:latin_title_candidate = { + #Set the variable so it can be granted when character gets event + set_variable = { + name = latin_county + value = scope:county_to_grant + } + } + } + } + #No one is left to give titles to - end this + else = { + every_in_list = { + list = available_latin_emp_counties + remove_from_list = available_latin_emp_counties + if = { + limit = { is_in_list = available_latin_kingdom_counties } + remove_from_list = available_latin_kingdom_counties + } + if = { + limit = { is_in_list = available_latin_neighbor_counties } + remove_from_list = available_latin_neighbor_counties + } + if = { + limit = { is_in_list = available_latin_emp_counties } + remove_from_list = available_latin_emp_counties + } + } + } + + + #Grant county to strongest player + + #Grant duchy and county to strongest ai + #Grant county to strongest ai + #Order them by military strength? + #Start with every county that isn't capital in kingdom of latin emp goes to a crusader + #Any bordering counties in other kingdom latins have + #Any additional bordering counties, as needed until ll crusaders get one + #Any coastal county in empire + + #Save flag that removes them from this process + + #Add to beneficiary titles list + } +} + +ep3_frankokratia_grant_latin_lands_effect = { + root = { + var:latin_county = { + add_to_list = my_latin_titles + } + if = { + limit = { + has_variable = latin_duchy + } + var:latin_duchy = { + add_to_list = my_latin_titles + } + destroy_title = var:latin_duchy + } + } + + + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + } + every_in_list = { + list = my_latin_titles + change_title_holder = { + holder = scope:latin_title_gainer + change = scope:title_change + } + } + scope:latin_title_gainer = { + change_liege = { + liege = scope:latin_emperor + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + + + #Remove so this doesn't cause title stealing + every_in_list = { + list = my_latin_titles + remove_from_list = my_latin_titles + } + + + #Make sure they're feudal + if = { + limit = { + scope:latin_empire_receiver = { + this = scope:financier + } + } + if = { + limit = { + OR = { + religion = religion:islam_religion + culture = { has_cultural_pillar = heritage_iranian } + culture = { has_cultural_pillar = heritage_turkic } + culture = { has_cultural_pillar = heritage_arabic } + } + } + scope:latin_title_gainer = { change_government = clan_government } + } + else = { + scope:latin_title_gainer = { change_government = feudal_government } + } + } +} + +ep3_latin_empire_grant_financier_lands_effect = { + add_to_list = gained_latin_emp_titles + #Title switch + create_title_and_vassal_change = { + type = conquest + save_scope_as = title_change + add_claim_on_loss = yes + } + every_in_list = { + list = financier_latin_emp_titles + change_title_holder = { + holder = scope:financier + change = scope:title_change + take_baronies = yes + } + } + + resolve_title_and_vassal_change = scope:title_change +} + +ep3_frankokratia_pick_emperor_beneficiary_effect = { + save_scope_as = frankokratia_crusader + #SET FIRST emp_beneficiary VARIABLE + #Dominant gender close family + random_close_family_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_trigger = yes + dynasty = scope:frankokratia_crusader.dynasty + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary + value = prev + } + } + } + #Dominant gender house member + if = { + limit = { + NOT = { has_variable = emp_beneficiary } + } + house = { + random_house_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_trigger = yes + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary + value = prev + } + } + } + } + } + #Dominant gender dynasty member + if = { + limit = { + NOT = { has_variable = emp_beneficiary } + } + dynasty = { + random_dynasty_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_trigger = yes + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary + value = prev + } + } + } + } + } + #Close family any gender + if = { + limit = { + NOT = { has_variable = emp_beneficiary } + } + random_close_family_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_soft_trigger = yes + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary + value = prev + } + } + } + } + #dynasty member any gender + if = { + limit = { + NOT = { has_variable = emp_beneficiary } + } + dynasty = { + random_dynasty_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_soft_trigger = yes + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary + value = prev + } + } + } + } + } + #Same culture dominant gender courtier + if = { + limit = { + NOT = { has_variable = emp_beneficiary } + } + random_courtier_or_guest = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + culture = scope:frankokratia_crusader.culture + ep3_frankokratia_beneficiary_gender_trigger = yes + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary + value = prev + } + } + } + } + #any courtier + if = { + limit = { + NOT = { has_variable = emp_beneficiary } + } + random_courtier_or_guest = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + culture = scope:frankokratia_crusader.culture + ep3_frankokratia_beneficiary_gender_soft_trigger = yes + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary + value = prev + } + } + } + } + #pool character + if = { + limit = { + NOT = { has_variable = emp_beneficiary } + } + random_pool_character = { + province = scope:frankokratia_crusader.capital_province + limit = { + ep3_frankokratia_beneficiary_trigger = yes + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary + value = prev + } + } + } + } + if = { + limit = { + NOT = { has_variable = emp_beneficiary } + } + #Create character + create_character = { + location = scope:claimant.location + template = ep3_frankokratia_crusader_template + faith = scope:frankokratia_crusader.faith + culture = scope:frankokratia_crusader.culture + save_scope_as = new_latin_lord + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary + value = scope:new_latin_lord + } + } + } + var:emp_beneficiary = { save_scope_as = emp_beneficiary } + + #SET SECOND emp_beneficiary VARIABLE + ##Dominant gender close family + random_close_family_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_trigger = yes + dynasty = scope:frankokratia_crusader.dynasty + this != scope:emp_beneficiary + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary_2 + value = prev + } + } + } + #Dominant gender house member + if = { + limit = { + NOT = { has_variable = emp_beneficiary_2 } + } + house = { + random_house_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_trigger = yes + this != scope:emp_beneficiary + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary_2 + value = prev + } + } + } + } + } + #Dominant gender dynasty member + if = { + limit = { + NOT = { has_variable = emp_beneficiary_2 } + } + dynasty = { + random_dynasty_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_trigger = yes + this != scope:emp_beneficiary + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary_2 + value = prev + } + } + } + } + } + #Close family any gender + if = { + limit = { + NOT = { has_variable = emp_beneficiary_2 } + } + random_close_family_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_soft_trigger = yes + this != scope:emp_beneficiary + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary_2 + value = prev + } + } + } + } + #dynasty member any gender + if = { + limit = { + NOT = { has_variable = emp_beneficiary_2 } + } + dynasty = { + random_dynasty_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_soft_trigger = yes + this != scope:emp_beneficiary + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary_2 + value = prev + } + } + } + } + } + #Same culture dominant gender courtier + if = { + limit = { + NOT = { has_variable = emp_beneficiary_2 } + } + random_courtier_or_guest = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + culture = scope:frankokratia_crusader.culture + ep3_frankokratia_beneficiary_gender_trigger = yes + this != scope:emp_beneficiary + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary_2 + value = prev + } + } + } + } + #any courtier + if = { + limit = { + NOT = { has_variable = emp_beneficiary_2 } + } + random_courtier_or_guest = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + culture = scope:frankokratia_crusader.culture + ep3_frankokratia_beneficiary_gender_soft_trigger = yes + this != scope:emp_beneficiary + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary_2 + value = prev + } + } + } + } + #pool character + if = { + limit = { + NOT = { has_variable = emp_beneficiary_2 } + } + random_pool_character = { + province = scope:frankokratia_crusader.capital_province + limit = { + ep3_frankokratia_beneficiary_trigger = yes + this != scope:emp_beneficiary + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary_2 + value = prev + } + } + } + } + if = { + limit = { + has_variable = emp_beneficiary_2 + } + var:emp_beneficiary_2 = { save_scope_as = emp_beneficiary_2 } + } + + if = { + limit = { + has_variable = emp_beneficiary_2 + } + #SET THIRD emp_beneficiary VARIABLE + ##Dominant gender close family + random_close_family_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_trigger = yes + dynasty = scope:frankokratia_crusader.dynasty + NOR = { + this = scope:emp_beneficiary + this = scope:emp_beneficiary_2 + } + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary_3 + value = prev + } + } + } + #Dominant gender house member + if = { + limit = { + NOT = { has_variable = emp_beneficiary_3 } + } + house = { + random_house_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_trigger = yes + NOR = { + this = scope:emp_beneficiary + this = scope:emp_beneficiary_2 + } + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary_3 + value = prev + } + } + } + } + + } + #Dominant gender dynasty member + if = { + limit = { + NOT = { has_variable = emp_beneficiary_3 } + } + dynasty = { + random_dynasty_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_trigger = yes + NOR = { + this = scope:emp_beneficiary + this = scope:emp_beneficiary_2 + } + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary_3 + value = prev + } + } + } + } + } + #Close family any gender + if = { + limit = { + NOT = { has_variable = emp_beneficiary_3 } + } + random_close_family_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_soft_trigger = yes + NOR = { + this = scope:emp_beneficiary + this = scope:emp_beneficiary_2 + } + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary_3 + value = prev + } + } + } + } + #dynasty member any gender + if = { + limit = { + NOT = { has_variable = emp_beneficiary_3 } + } + dynasty = { + random_dynasty_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_soft_trigger = yes + NOR = { + this = scope:emp_beneficiary + this = scope:emp_beneficiary_2 + } + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary_3 + value = prev + } + } + } + } + } + #Same culture dominant gender courtier + if = { + limit = { + NOT = { has_variable = emp_beneficiary_3 } + } + random_courtier_or_guest = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + culture = scope:frankokratia_crusader.culture + ep3_frankokratia_beneficiary_gender_trigger = yes + NOR = { + this = scope:emp_beneficiary + this = scope:emp_beneficiary_2 + } + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary_3 + value = prev + } + } + } + } + #any courtier + if = { + limit = { + NOT = { has_variable = emp_beneficiary_3 } + } + random_courtier_or_guest = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + culture = scope:frankokratia_crusader.culture + ep3_frankokratia_beneficiary_gender_soft_trigger = yes + NOR = { + this = scope:emp_beneficiary + this = scope:emp_beneficiary_2 + } + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary_3 + value = prev + } + } + } + } + #pool character + if = { + limit = { + NOT = { has_variable = emp_beneficiary_3 } + } + random_pool_character = { + province = scope:frankokratia_crusader.capital_province + limit = { + ep3_frankokratia_beneficiary_trigger = yes + NOR = { + this = scope:emp_beneficiary + this = scope:emp_beneficiary_2 + } + } + scope:frankokratia_crusader = { + set_variable = { + name = emp_beneficiary_3 + value = prev + } + } + } + } + if = { + limit = { + has_variable = emp_beneficiary_3 + } + var:emp_beneficiary_3 = { save_scope_as = emp_beneficiary_3 } + } + } +} + +ep3_frankokratia_pick_crusader_beneficiary_effect = { + save_scope_as = frankokratia_crusader + #SET FIRST BENEFICIARY VARIABLE + #Dominant gender close family + random_close_family_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_trigger = yes + dynasty = scope:frankokratia_crusader.dynasty + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary + value = prev + } + } + } + #Dominant gender house member + if = { + limit = { + NOT = { has_variable = beneficiary } + } + house ?= { + random_house_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_trigger = yes + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary + value = prev + } + } + } + } + + } + #Dominant gender dynasty member + if = { + limit = { + NOT = { has_variable = beneficiary } + } + dynasty ?= { + random_dynasty_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_trigger = yes + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary + value = prev + } + } + } + } + } + #Close family any gender + if = { + limit = { + NOT = { has_variable = beneficiary } + } + random_close_family_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_soft_trigger = yes + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary + value = prev + } + } + } + } + #dynasty member any gender + if = { + limit = { + NOT = { has_variable = beneficiary } + } + dynasty ?= { + random_dynasty_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_soft_trigger = yes + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary + value = prev + } + } + } + } + } + #Same culture dominant gender courtier + if = { + limit = { + NOT = { has_variable = beneficiary } + } + random_courtier_or_guest = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + culture = scope:frankokratia_crusader.culture + ep3_frankokratia_beneficiary_gender_trigger = yes + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary + value = prev + } + } + } + } + #any courtier + if = { + limit = { + NOT = { has_variable = beneficiary } + } + random_courtier_or_guest = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + culture = scope:frankokratia_crusader.culture + ep3_frankokratia_beneficiary_gender_soft_trigger = yes + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary + value = prev + } + } + } + } + #pool character + if = { + limit = { + NOT = { has_variable = beneficiary } + } + random_pool_character = { + province = scope:frankokratia_crusader.capital_province + limit = { + ep3_frankokratia_beneficiary_trigger = yes + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary + value = prev + } + } + } + } + if = { + limit = { + NOT = { has_variable = beneficiary } + } + #Create character + create_character = { + location = scope:latin_emperor.location + template = ep3_frankokratia_crusader_template + faith = scope:frankokratia_crusader.faith + culture = scope:frankokratia_crusader.culture + save_scope_as = new_latin_lord + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary + value = scope:new_latin_lord + } + } + } + + + #SET SECOND BENEFICIARY VARIABLE + ##Dominant gender close family + random_close_family_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_trigger = yes + dynasty = scope:frankokratia_crusader.dynasty + this != scope:frankokratia_crusader.var:beneficiary + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary_2 + value = prev + } + } + } + #Dominant gender house member + if = { + limit = { + NOT = { has_variable = beneficiary_2 } + } + house ?= { + random_house_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_trigger = yes + this != scope:frankokratia_crusader.var:beneficiary + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary_2 + value = prev + } + } + } + } + } + #Dominant gender dynasty member + if = { + limit = { + NOT = { has_variable = beneficiary_2 } + } + dynasty ?= { + random_dynasty_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_trigger = yes + this != scope:frankokratia_crusader.var:beneficiary + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary_2 + value = prev + } + } + } + } + } + #Close family any gender + if = { + limit = { + NOT = { has_variable = beneficiary_2 } + } + random_close_family_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_soft_trigger = yes + this != scope:frankokratia_crusader.var:beneficiary + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary_2 + value = prev + } + } + } + } + #dynasty member any gender + if = { + limit = { + NOT = { has_variable = beneficiary_2 } + } + dynasty ?= { + random_dynasty_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_soft_trigger = yes + this != scope:frankokratia_crusader.var:beneficiary + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary_2 + value = prev + } + } + } + } + } + #Same culture dominant gender courtier + if = { + limit = { + NOT = { has_variable = beneficiary_2 } + } + random_courtier_or_guest = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + culture = scope:frankokratia_crusader.culture + ep3_frankokratia_beneficiary_gender_trigger = yes + this != scope:frankokratia_crusader.var:beneficiary + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary_2 + value = prev + } + } + } + } + #any courtier + if = { + limit = { + NOT = { has_variable = beneficiary_2 } + } + random_courtier_or_guest = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + culture = scope:frankokratia_crusader.culture + ep3_frankokratia_beneficiary_gender_soft_trigger = yes + this != scope:frankokratia_crusader.var:beneficiary + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary_2 + value = prev + } + } + } + } + #pool character + if = { + limit = { + NOT = { has_variable = beneficiary_2 } + } + random_pool_character = { + province = scope:frankokratia_crusader.capital_province + limit = { + ep3_frankokratia_beneficiary_trigger = yes + this != scope:frankokratia_crusader.var:beneficiary + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary_2 + value = prev + } + } + } + } + if = { + limit = { + has_variable = beneficiary_2 + } + #SET THIRD BENEFICIARY VARIABLE + ##Dominant gender close family + random_close_family_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_trigger = yes + dynasty = scope:frankokratia_crusader.dynasty + NOR = { + this = scope:frankokratia_crusader.var:beneficiary + this = scope:frankokratia_crusader.var:beneficiary_2 + } + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary_3 + value = prev + } + } + }#Dominant gender house member + if = { + limit = { + NOT = { has_variable = beneficiary_3 } + } + house ?= { + random_house_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_trigger = yes + NOR = { + this = scope:frankokratia_crusader.var:beneficiary + this = scope:frankokratia_crusader.var:beneficiary_2 + } + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary_3 + value = prev + } + } + } + } + + } + #Dominant gender dynasty member + if = { + limit = { + NOT = { has_variable = beneficiary_3 } + } + dynasty ?= { + random_dynasty_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_trigger = yes + NOR = { + this = scope:frankokratia_crusader.var:beneficiary + this = scope:frankokratia_crusader.var:beneficiary_2 + } + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary_3 + value = prev + } + } + } + } + } + #Close family any gender + if = { + limit = { + NOT = { has_variable = beneficiary_3 } + } + random_close_family_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_soft_trigger = yes + NOR = { + this = scope:frankokratia_crusader.var:beneficiary + this = scope:frankokratia_crusader.var:beneficiary_2 + } + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary_3 + value = prev + } + } + } + } + #dynasty member any gender + if = { + limit = { + NOT = { has_variable = beneficiary_3 } + } + dynasty ?= { + random_dynasty_member = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + ep3_frankokratia_beneficiary_gender_soft_trigger = yes + NOR = { + this = scope:frankokratia_crusader.var:beneficiary + this = scope:frankokratia_crusader.var:beneficiary_2 + } + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary_3 + value = prev + } + } + } + } + } + #Same culture dominant gender courtier + if = { + limit = { + NOT = { has_variable = beneficiary_3 } + } + random_courtier_or_guest = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + culture = scope:frankokratia_crusader.culture + ep3_frankokratia_beneficiary_gender_trigger = yes + NOR = { + this = scope:frankokratia_crusader.var:beneficiary + this = scope:frankokratia_crusader.var:beneficiary_2 + } + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary_3 + value = prev + } + } + } + } + #any courtier + if = { + limit = { + NOT = { has_variable = beneficiary_3 } + } + random_courtier_or_guest = { + limit = { + ep3_frankokratia_beneficiary_trigger = yes + culture = scope:frankokratia_crusader.culture + ep3_frankokratia_beneficiary_gender_soft_trigger = yes + NOR = { + this = scope:frankokratia_crusader.var:beneficiary + this = scope:frankokratia_crusader.var:beneficiary_2 + } + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary_3 + value = prev + } + } + } + } + #pool character + if = { + limit = { + NOT = { has_variable = beneficiary_3 } + } + random_pool_character = { + province = scope:frankokratia_crusader.capital_province + limit = { + ep3_frankokratia_beneficiary_trigger = yes + NOR = { + this = scope:frankokratia_crusader.var:beneficiary + this = scope:frankokratia_crusader.var:beneficiary_2 + } + } + scope:frankokratia_crusader = { + set_variable = { + name = beneficiary_3 + value = prev + } + } + } + } + } +} + +ep3_frankokratia_form_byzantine_kingdoms_effect = { + every_vassal = { + limit = { + is_landless_ruler = yes + is_ai = yes + highest_held_title_tier < tier_kingdom + + } + add_to_list = byz_landless + } + every_vassal = { + limit = { + is_ai = yes + is_landed = yes + NOT = { + government_has_flag = government_is_theocracy + } + } + add_to_list = byz_vassals + } + #Create player kings and kings for players + every_vassal_or_below = { + limit = { + OR = { + has_variable = frankokratia_becoming_king + AND = { + has_variable = frankokratia_gaining_vassal + highest_held_title_tier < tier_kingdom + capital_county = { + kingdom = { + NOT = { + exists = holder + } + } + } + highest_held_title_tier >= tier_duchy + #Must be free of any liege that isn't the emperor + NOT = { + liege = { + highest_held_title_tier < tier_empire + } + } + OR = { + is_powerful_vassal_of = title:e_byzantium.holder + house ?= { is_powerful_family = yes } + #Let's just always let Nikaea do this, they special + capital_county = { + kingdom = title:k_nikaea + NOT = { + exists = title:k_nikaea.holder + } + } + } + } + } + } + save_scope_as = player_byz_king + capital_county.kingdom = { + save_scope_as = player_byz_kingdom + } + create_character_memory = { + type = frankokratia_byz_independent_memory + } + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + scope:player_byz_kingdom = { + change_title_holder = { + holder = scope:player_byz_king + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + } + #Move players under their kings + every_vassal = { + limit = { + has_variable = frankokratia_gaining_vassal + var:frankokratia_gaining_vassal = { + NOT = { + is_vassal_or_below_of = prev + } + } + } + save_scope_as = new_daddy + var:frankokratia_gaining_vassal = { + create_title_and_vassal_change = { + type = granted + save_scope_as = change + add_claim_on_loss = no + } + change_liege = { + liege = scope:new_daddy + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + #Make players independent + every_vassal_or_below = { + limit = { + has_variable = frankokratia_independent + NOT = { + liege = title:e_byzantium.holder + } + } + if = { + limit = { + OR = { + religion = religion:islam_religion + culture = { has_cultural_pillar = heritage_iranian } + culture = { has_cultural_pillar = heritage_turkic } + culture = { has_cultural_pillar = heritage_arabic } + } + highest_held_title_tier < tier_kingdom + + } + change_government = clan_government + } + else_if = { + limit = { + highest_held_title_tier < tier_kingdom + } + change_government = feudal_government + } + create_character_memory = { + type = frankokratia_byz_independent_memory + } + create_title_and_vassal_change = { + type = independency + save_scope_as = change + } + becomes_independent = { change = scope:change } + resolve_title_and_vassal_change = scope:change + } + + #Get every available kingdom that has a duke's capital in it + if = { + limit = { + any_realm_county = { + empire = title:e_byzantium + kingdom = { + NOR = { + exists = holder + AND = { + exists = scope:latin_kingdom_1 + this = scope:latin_kingdom_1 + } + AND = { + exists = scope:latin_kingdom_2 + this = scope:latin_kingdom_2 + } + is_in_list = available_byz_kingdoms + } + } + save_temporary_scope_as = county_temp + holder.capital_county = scope:county_temp + holder = { + is_ai = yes + highest_held_title_tier >= tier_duchy + OR = { + is_powerful_vassal_of = title:e_byzantium.holder + house ?= { is_powerful_family = yes } + #If people in e_byz are weak, make sure nikaea is still created + AND = { + NOT = { + any_in_list = { + list = byz_vassals + count = 3 + highest_held_title_tier >= tier_duchy + capital_county = { + kingdom = { + this = { is_in_list = available_byz_kingdoms } + NOT = { exists = holder } + } + } + OR = { + house = { is_powerful_family = yes } + is_powerful_vassal_of = title:e_byzantium.holder + } + } + } + capital_county = { + kingdom = title:k_nikaea + NOT = { + exists = title:k_nikaea.holder + } + } + } + + } + } + } + } + every_realm_county = { + limit = { + empire = title:e_byzantium + kingdom = { + NOR = { + exists = holder + AND = { + exists = scope:latin_kingdom_1 + this = scope:latin_kingdom_1 + } + AND = { + exists = scope:latin_kingdom_2 + this = scope:latin_kingdom_2 + } + is_in_list = available_byz_kingdoms + } + } + save_temporary_scope_as = county_temp + + holder.capital_county = scope:county_temp + holder = { + is_ai = yes + highest_held_title_tier >= tier_duchy + OR = { + is_powerful_vassal_of = title:e_byzantium.holder + house = { is_powerful_family = yes } + #If people in e_byz are weak, make sure nikaea is still created + AND = { + NOT = { + any_in_list = { + list = byz_vassals + count = 3 + highest_held_title_tier >= tier_duchy + capital_county = { + kingdom = { + this = { is_in_list = available_byz_kingdoms } + NOT = { exists = holder } + } + } + OR = { + house = { is_powerful_family = yes } + is_powerful_vassal_of = title:e_byzantium.holder + } + } + } + capital_county = { + kingdom = title:k_nikaea + NOT = { + exists = title:k_nikaea.holder + } + } + } + } + } + } + kingdom = { + add_to_list = available_byz_kingdoms + } + } + } + + #Assign new kingdoms + if = { + limit = { + any_in_list = { + list = available_byz_kingdoms + tier = tier_kingdom + } + } + while = { + limit = { + any_in_list = { + list = available_byz_kingdoms + NOT = { exists = holder } + } + } + ordered_in_list = { + list = byz_vassals + order_by = max_military_strength + limit = { + capital_county = { + kingdom = { + this = { is_in_list = available_byz_kingdoms } + NOT = { exists = holder } + } + } + highest_held_title_tier >= tier_duchy + OR = { + is_powerful_vassal_of = title:e_byzantium.holder + house = { is_powerful_family = yes } + #If people in e_byz are weak, make sure nikaea is still created + AND = { + NOT = { + any_in_list = { + list = byz_vassals + count = 3 + highest_held_title_tier >= tier_duchy + capital_county = { + kingdom = { + this = { is_in_list = available_byz_kingdoms } + NOT = { exists = holder } + } + } + OR = { + house = { is_powerful_family = yes } + is_powerful_vassal_of = title:e_byzantium.holder + } + } + } + capital_county = { + kingdom = title:k_nikaea + NOT = { + exists = title:k_nikaea.holder + } + } + } + } + } + create_character_memory = { + type = frankokratia_byz_independent_memory + } + save_scope_as = new_byz_king + capital_county.kingdom = { + save_scope_as = new_byz_kingdom + } + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + scope:new_byz_kingdom = { + change_title_holder = { + holder = scope:new_byz_king + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + } + } + } + #Move de jure neighbour vassals into kingdoms + if = { + limit = { + any_vassal = { + is_in_list = byz_vassals + highest_held_title_tier <= tier_duchy + government_has_flag = government_is_administrative + OR = { + ai_boldness <= medium_negative_ai_value + ai_honor >= medium_positive_ai_value + ai_energy <= medium_negative_ai_value + has_trait = loyal + } + capital_county = { + save_temporary_scope_as = prime_title + kingdom.holder ?= { + OR = { + is_in_list = byz_vassals + this = title:e_byzantium.holder + } + } + } + #One of heir counties borders the king's personal counties + any_sub_realm_county = { + any_neighboring_county = { + holder = { + OR = { + this = scope:prime_title.kingdom.holder + any_liege_or_above = { + this = scope:prime_title.kingdom.holder + } + } + } + } + } + } + } + while = { + limit = { + any_vassal = { + is_in_list = byz_vassals + highest_held_title_tier <= tier_duchy + government_has_flag = government_is_administrative + OR = { + ai_boldness <= medium_negative_ai_value + ai_honor >= medium_positive_ai_value + ai_energy <= medium_negative_ai_value + has_trait = loyal + } + capital_county = { + save_temporary_scope_as = prime_title + kingdom.holder ?= { + OR = { + is_in_list = byz_vassals + this = title:e_byzantium.holder + } + } + } + any_sub_realm_county = { + any_neighboring_county = { + holder = { + OR = { + this = scope:prime_title.kingdom.holder + any_liege_or_above = { + this = scope:prime_title.kingdom.holder + } + } + } + } + } + } + } + random_in_list = { + list = byz_vassals + limit = { + is_in_list = byz_vassals + highest_held_title_tier <= tier_duchy + government_has_flag = government_is_administrative + OR = { + ai_boldness <= medium_negative_ai_value + ai_honor >= medium_positive_ai_value + ai_energy <= medium_negative_ai_value + has_trait = loyal + } + capital_county = { + save_temporary_scope_as = prime_title + kingdom.holder ?= { + OR = { + is_in_list = byz_vassals + this = title:e_byzantium.holder + } + } + } + any_sub_realm_county = { + any_neighboring_county = { + holder = { + OR = { + this = scope:prime_title.kingdom.holder + any_liege_or_above = { + this = scope:prime_title.kingdom.holder + } + } + } + } + } + } + save_scope_as = vassalizing_vassal + random_in_list = { + list = byz_vassals + limit = { + is_in_list = byz_vassals + any_held_title = { + title_tier = kingdom + any_de_jure_county = { + save_temporary_scope_as = county_temp + scope:vassalizing_vassal.capital_county = { + this = scope:county_temp + } + } + } + } + save_scope_as = new_liege + } + create_title_and_vassal_change = { + type = granted + save_scope_as = change + add_claim_on_loss = no + } + change_liege = { + liege = scope:new_liege + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + } + #Move landless into kingdoms + if = { + limit = { + any_vassal = { + is_in_list = byz_landless + } + any_vassal = { + highest_held_title_tier >= tier_kingdom + government_has_flag = government_is_administrative + } + } + while = { + limit = { + any_in_list = { + list = byz_landless + exists = house + has_domicile = yes + } + } + if = { + limit = { + any_in_list = { + list = byz_landless + house ?= { + any_house_member = { + any_held_title = { + title_tier = kingdom + } + highest_held_title_tier >= tier_kingdom + government_has_flag = government_is_administrative + } + } + } + } + random_in_list = { + list = byz_landless + limit = { + house ?= { + any_house_member = { + any_held_title = { + title_tier = kingdom + } + highest_held_title_tier >= tier_kingdom + government_has_flag = government_is_administrative + } + } + } + house = { + random_house_member = { + limit = { + any_held_title = { + title_tier = kingdom + } + highest_held_title_tier >= tier_kingdom + government_has_flag = government_is_administrative + } + save_scope_as = new_byz_liege + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = change + add_claim_on_loss = no + } + change_liege = { + liege = scope:new_byz_liege + change = scope:change + } + resolve_title_and_vassal_change = scope:change + remove_from_list = byz_landless + if = { + limit = { + has_domicile = yes + } + domicile = { + move_domicile = scope:new_byz_liege.capital_province + } + } + } + } + else_if = { + limit = { + any_in_list = { + list = byz_landless + has_domicile = yes + domicile.domicile_location = { + kingdom = { + holder ?= { + government_has_flag = government_is_administrative + liege = title:e_byzantium.holder + } + } + } + } + } + random_in_list = { + list = byz_landless + limit = { + has_domicile = yes + domicile.domicile_location = { + kingdom = { + holder ?= { + government_has_flag = government_is_administrative + liege = title:e_byzantium.holder + } + } + } + } + domicile.domicile_location = { + kingdom = { + holder = { + save_scope_as = new_byz_liege + } + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = change + add_claim_on_loss = no + } + change_liege = { + liege = scope:new_byz_liege + change = scope:change + } + resolve_title_and_vassal_change = scope:change + remove_from_list = byz_landless + if = { + limit = { + has_domicile = yes + } + domicile = { + move_domicile = scope:new_byz_liege.capital_province + } + } + } + } + else = { + random_in_list = { + list = byz_landless + title:e_byzantium.holder = { + random_vassal = { + limit = { + highest_held_title_tier >= tier_kingdom + government_has_flag = government_is_administrative + } + save_scope_as = new_byz_liege + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = change + add_claim_on_loss = no + } + change_liege = { + liege = scope:new_byz_liege + change = scope:change + } + resolve_title_and_vassal_change = scope:change + remove_from_list = byz_landless + if = { + limit = { + has_domicile = yes + } + domicile = { + move_domicile = scope:new_byz_liege.capital_province + } + } + } + } + } + } + + #Make admin kings house heads if they ain't + every_vassal = { + limit = { + highest_held_title_tier = tier_kingdom + government_has_flag = government_is_administrative + exists = house + save_temporary_scope_as = house_king + house.house_head = { + #Not already house head + this != scope:house_king + highest_held_title_tier < tier_kingdom + #Only remove player house head status if they're in the realm + OR = { + is_ai = yes + top_liege = scope:house_king.liege + } + } + #If there's more than one king of their house, they are the strongest + NOT = { + house = { + any_house_member = { + highest_held_title_tier = tier_kingdom + government_has_flag = government_is_administrative + max_military_strength > scope:house_king.max_military_strength + } + } + } + } + house = { + set_house_head = prev + } + domicile = { + move_domicile = prev.capital_province + } + } + + #Make governor house heads to save noble families being destroyed + every_vassal = { + limit = { + highest_held_title_tier = tier_kingdom + } + every_vassal_or_below = { + limit = { + highest_held_title_tier >= tier_county + government_has_flag = government_is_administrative + exists = house + save_temporary_scope_as = house_chud + house.house_head = { + #Not already house head + this != scope:house_chud + government_has_flag = government_is_administrative + highest_held_title_tier < tier_kingdom + #Only remove player house head status if they're in the realm + OR = { + is_ai = yes + liege ?= scope:house_chud.top_liege + } + #Liege is the Byzantine emperor + liege ?= { + top_liege = this + } + #If there's more than one admin survivor of their house, they are the strongest + NOT = { + house = { + any_house_member = { + OR = { + highest_held_title_tier = tier_kingdom + AND = { + liege ?= { + highest_held_title_tier = tier_kingdom + } + max_military_strength > scope:house_chud.max_military_strength + } + } + government_has_flag = government_is_administrative + } + } + } + } + } + house = { + set_house_head = prev + } + domicile = { + move_domicile = prev.capital_province + } + } + } + + #Switch anyone not under a king to feudal + every_vassal_or_below = { + limit = { + is_landed = yes + government_has_flag = government_is_administrative + highest_held_title_tier < tier_kingdom + OR = { + liege = { + highest_held_title_tier < tier_kingdom + } + liege = title:e_byzantium.holder + } + } + if = { + limit = { + OR = { + religion = religion:islam_religion + culture = { has_cultural_pillar = heritage_iranian } + culture = { has_cultural_pillar = heritage_turkic } + culture = { has_cultural_pillar = heritage_arabic } + } + } + change_government = clan_government + } + else = { + change_government = feudal_government + } + } +} + +ep3_frankokratia_byzantine_independence_effect = { + every_vassal_or_below = { + limit = { + is_landed = yes + is_ai = yes + highest_held_title_tier < tier_kingdom + highest_held_title_tier >= tier_county + liege = { + save_temporary_scope_as = temp_byz_liege + } + OR = { + #They have a strong reason and the last piece is personality + AND = { + ai_boldness > high_negative_ai_value + ai_honor < high_positive_ai_value + ai_energy > high_negative_ai_value + OR = { + trigger_if = { + limit = { + liege ?= { + government_has_flag = government_is_administrative + } + } + NOT = { + government_has_flag = government_is_administrative + } + } + liege = { + governor_efficiency < 0.7 + } + culture = { + this != scope:temp_byz_liege.culture + } + faith = { + this != scope:temp_byz_liege.faith + } + opinion = { + target = liege + value <= -50 + } + #They are not de jure to the liege + NOT = { + primary_title = { + target_is_de_jure_liege_or_above = scope:temp_byz_liege.primary_title + } + } + } + } + #Their only reason is an inclination + AND = { + ai_boldness >= low_positive_ai_value + ai_honor <= low_negative_ai_value + ai_energy >= low_positive_ai_value + OR = { + liege = { + influence_level <= 2 + } + opinion = { + target = liege + value <= -25 + } + liege = { + governor_efficiency < 0.85 + } + } + } + } + NOR = { + has_trait = loyal + opinion = { + target = liege + value >= 80 + } + liege = { + influence_level >= 4 + } + liege = { + governor_efficiency >= 1.4 + } + } + } + if = { + limit = { + OR = { + religion = religion:islam_religion + culture = { has_cultural_pillar = heritage_iranian } + culture = { has_cultural_pillar = heritage_turkic } + culture = { has_cultural_pillar = heritage_arabic } + } + highest_held_title_tier < tier_kingdom + + } + change_government = clan_government + } + else_if = { + limit = { + highest_held_title_tier < tier_kingdom + } + change_government = feudal_government + } + create_character_memory = { + type = frankokratia_byz_independent_memory + } + create_title_and_vassal_change = { + type = independency + save_scope_as = change + } + becomes_independent = { change = scope:change } + resolve_title_and_vassal_change = scope:change + } +} + +ep3_frankokratia_vassalize_latin_counts_effect = { + #Move de jure neighbour vassals into kingdoms + if = { + limit = { + #Duchy titles have been assigned + any_vassal = { + highest_held_title_tier = tier_duchy + } + #At least one count is under the duchy + any_vassal = { + highest_held_title_tier = tier_county + primary_title.duchy = { + holder ?= { + is_vassal_of = scope:latin_emperor + } + } + } + } + every_vassal = { + limit = { + highest_held_title_tier = tier_county + primary_title.duchy = { + holder ?= { + is_vassal_of = scope:latin_emperor + } + } + } + add_to_list = counts_to_distribute + } + while = { + limit = { + any_vassal = { + is_in_list = counts_to_distribute + } + } + random_in_list = { + list = counts_to_distribute + save_scope_as = vassalizing_vassal + primary_title.duchy.holder = { + save_scope_as = new_liege + } + create_title_and_vassal_change = { + type = granted + save_scope_as = change + add_claim_on_loss = no + } + change_liege = { + liege = scope:new_liege + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + } + #Give out leftover counties + if = { + limit = { + any_held_title = { + title_tier = county + duchy = { + holder ?= { + is_vassal_or_below_of = scope:latin_emperor + } + } + } + } + while = { + limit = { + any_held_title = { + title_tier = county + duchy = { + holder ?= { + is_vassal_or_below_of = scope:latin_emperor + } + } + } + } + random_held_title = { + title_tier = county + limit = { + duchy = { + holder ?= { + is_vassal_or_below_of = scope:latin_emperor + } + } + } + duchy.holder = { + save_scope_as = latin_vassal + } + save_scope_as = county_to_grant + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + } + scope:county_to_grant = { + change_title_holder = { + holder = scope:latin_vassal + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + } + } +} + +ep3_frankokratia_end_story_effect = { + global_var:byz_claimant_champion = { + remove_character_modifier = prepared_for_daring_deeds_modifier + remove_character_flag = pope_condemned_crusader_claim + remove_character_flag = pope_endorsed_crusader_claim + random_owned_story = { + type = frankokratia_story + var:claimant ?= { + hidden_effect = { + remove_character_modifier = eager_for_empire_modifier + remove_character_flag = swore_to_convert_byz_catholic + remove_character_flag = paying_off_latins + remove_character_flag = ep3_frankokratia_events.0041_succeeded_duel + } + } + every_in_list = { + variable = frankokratia_leaders + hidden_effect = { + remove_character_modifier = grand_crusader_fleet_modifier + remove_character_flag = joining_frankokratia + remove_character_flag = had_event_frankokratia_0020 + remove_character_flag = dont_send_general_event_franko + remove_variable = old_liege + remove_variable = latin_county + remove_variable = emp_beneficiary + remove_variable = emp_beneficiary_2 + remove_variable = emp_beneficiary_3 + remove_variable = beneficiary + remove_variable = beneficiary_2 + remove_variable = beneficiary_3 + remove_variable = latin_duchy + clear_variable_list = lost_titles + } + } + end_story = yes + } + remove_global_variable = byz_claimant_champion + remove_global_variable = financier_title + remove_global_variable = slaughtered_byzantines + remove_global_variable = latin_kingdom_1 + remove_global_variable = latin_kingdom_2 + clear_global_variable_list = slaughtered_byzantines_list + } +} + +greek_anarchy_army_spawn_effect = { + random_list = { + 5 = { + trigger = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_cataphract + } + scope:defender = { + any_realm_county = { + culture = { + has_cultural_parameter = unlock_maa_cataphract + } + } + } + scope:defender = { + culture = { + has_cultural_parameter = unlock_maa_cataphract + } + } + } + } + #Cool heavy cav should be less likely for petty wars + modifier = { + NOT = { + scope:defender = { + highest_held_title_tier >= tier_kingdom + } + } + add = -4 + } + if = { + limit = { + scope:defender = { + culture = { + has_cultural_parameter = unlock_maa_cataphract + } + } + } + scope:defender.culture = { save_scope_as = army_culture } + } + else_if = { + limit = { + scope:defender = { + any_realm_county = { + culture = { + has_cultural_parameter = unlock_maa_cataphract + } + } + } + } + scope:defender = { + random_realm_county = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_cataphract + } + } + culture = { save_scope_as = army_culture } + } + } + } + else = { + culture = { + save_scope_as = army_culture + } + } + spawn_army = { + name = greek_anarchy_war_greek_army_name + uses_supply = yes + inheritable = no + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = cataphract + stacks = greek_anarchy_army_heavy_cav_value + } + location = scope:attacker.capital_province + } + } + 4 = { + trigger = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_ballistrai + } + scope:defender = { + culture = { + has_cultural_parameter = unlock_maa_ballistrai + } + } + scope:defender = { + any_realm_county = { + culture = { + has_cultural_parameter = unlock_maa_ballistrai + } + } + } + } + } + if = { + limit = { + scope:defender = { + culture = { + has_cultural_parameter = unlock_maa_ballistrai + } + } + } + scope:defender.culture = { save_scope_as = army_culture } + } + else_if = { + limit = { + scope:defender = { + any_realm_county = { + culture = { + has_cultural_parameter = unlock_maa_ballistrai + } + } + } + } + scope:defender = { + random_realm_county = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_ballistrai + } + } + culture = { save_scope_as = army_culture } + } + } + } + else = { + culture = { + save_scope_as = army_culture + } + } + spawn_army = { + name = greek_anarchy_war_greek_army_name + uses_supply = yes + inheritable = no + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = ballistrai + stacks = greek_anarchy_army_maa_value + } + location = scope:attacker.capital_province + } + } + 4 = { + trigger = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_skoutatoi + } + scope:defender = { + any_realm_county = { + culture = { + has_cultural_parameter = unlock_maa_skoutatoi + } + } + } + scope:defender = { + culture = { + has_cultural_parameter = unlock_maa_skoutatoi + } + } + } + } + if = { + limit = { + scope:defender = { + culture = { + has_cultural_parameter = unlock_maa_skoutatoi + } + } + } + scope:defender.culture = { save_scope_as = army_culture } + } + else_if = { + limit = { + scope:defender = { + any_realm_county = { + culture = { + has_cultural_parameter = unlock_maa_skoutatoi + } + } + } + } + scope:defender = { + random_realm_county = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_skoutatoi + } + } + culture = { save_scope_as = army_culture } + } + } + } + else = { + culture = { + save_scope_as = army_culture + } + } + spawn_army = { + name = greek_anarchy_war_greek_army_name + uses_supply = yes + inheritable = no + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = skoutatoi + stacks = greek_anarchy_army_maa_value + } + location = scope:attacker.capital_province + } + } + 4 = { + trigger = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_akritai + } + scope:defender = { + any_realm_county = { + culture = { + has_cultural_parameter = unlock_maa_akritai + } + county_has_province_with_terrain = { + terrain = mountains + } + } + } + scope:defender = { + culture = { + has_cultural_parameter = unlock_maa_akritai + } + } + } + } + if = { + limit = { + scope:defender = { + culture = { + has_cultural_parameter = unlock_maa_akritai + } + } + } + scope:defender.culture = { save_scope_as = army_culture } + } + else_if = { + limit = { + scope:defender = { + any_realm_county = { + culture = { + has_cultural_parameter = unlock_maa_akritai + } + } + } + } + scope:defender = { + random_realm_county = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_akritai + } + } + culture = { save_scope_as = army_culture } + } + } + } + else = { + culture = { + save_scope_as = army_culture + } + } + spawn_army = { + name = greek_anarchy_war_greek_army_name + uses_supply = yes + inheritable = no + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = akritai + stacks = greek_anarchy_army_weak_maa_value + } + location = scope:attacker.capital_province + } + } + #Armenians + 10 = { + trigger = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_ayrudzi + } + scope:defender = { + culture = { + has_cultural_parameter = unlock_maa_ayrudzi + } + } + scope:defender = { + any_realm_county = { + culture = { + has_cultural_parameter = unlock_maa_ayrudzi + } + } + } + } + } + if = { + limit = { + scope:defender = { + culture = { + has_cultural_parameter = unlock_maa_ayrudzi + } + } + } + scope:defender.culture = { save_scope_as = army_culture } + } + else_if = { + limit = { + scope:defender = { + any_realm_county = { + culture = { + has_cultural_parameter = unlock_maa_ayrudzi + } + } + } + } + scope:defender = { + random_realm_county = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_ayrudzi + } + } + culture = { save_scope_as = army_culture } + } + } + } + else = { + culture = { + save_scope_as = army_culture + } + } + spawn_army = { + name = greek_anarchy_war_neighbor_army_name + uses_supply = yes + inheritable = no + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = ayrudzi + stacks = greek_anarchy_army_maa_value + } + location = scope:attacker.capital_province + } + } + #Georgians + 10 = { + trigger = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_monaspa + } + scope:defender = { + culture = { + has_cultural_parameter = unlock_maa_monaspa + } + } + scope:defender = { + any_realm_county = { + culture = { + has_cultural_parameter = unlock_maa_monaspa + } + } + } + } + } + if = { + limit = { + scope:defender = { + culture = { + has_cultural_parameter = unlock_maa_monaspa + } + } + } + scope:defender.culture = { save_scope_as = army_culture } + } + else_if = { + limit = { + scope:defender = { + any_realm_county = { + culture = { + has_cultural_parameter = unlock_maa_monaspa + } + } + } + } + scope:defender = { + random_realm_county = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_monaspa + } + } + culture = { save_scope_as = army_culture } + } + } + } + else = { + culture = { + save_scope_as = army_culture + } + } + spawn_army = { + name = greek_anarchy_war_neighbor_army_name + uses_supply = yes + inheritable = no + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = monaspa + stacks = greek_anarchy_army_heavy_cav_value + } + location = scope:attacker.capital_province + } + } + #Cataphract archers + 10 = { + trigger = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_cataphract_archers + } + scope:defender = { + culture = { + has_cultural_parameter = unlock_maa_cataphract_archers + } + } + scope:defender = { + any_realm_county = { + culture = { + has_cultural_parameter = unlock_maa_cataphract_archers + } + } + } + } + } + if = { + limit = { + scope:defender = { + culture = { + has_cultural_parameter = unlock_maa_cataphract_archers + } + } + } + scope:defender.culture = { save_scope_as = army_culture } + } + else_if = { + limit = { + scope:defender = { + any_realm_county = { + culture = { + has_cultural_parameter = unlock_maa_cataphract_archers + } + } + } + } + scope:defender = { + random_realm_county = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_cataphract_archers + } + } + culture = { save_scope_as = army_culture } + } + } + } + else = { + culture = { + save_scope_as = army_culture + } + } + spawn_army = { + name = greek_anarchy_war_neighbor_army_name + uses_supply = yes + inheritable = no + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = cataphract_archers + stacks = greek_anarchy_army_heavy_cav_value + } + location = scope:attacker.capital_province + } + } + #Konni folk get konni + 10 = { + trigger = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_hussar + } + scope:defender = { + culture = { + has_cultural_parameter = unlock_maa_hussar + } + } + scope:defender = { + any_realm_county = { + culture = { + has_cultural_parameter = unlock_maa_hussar + } + } + } + } + } + if = { + limit = { + scope:defender = { + culture = { + has_cultural_parameter = unlock_maa_hussar + } + } + } + scope:defender.culture = { save_scope_as = army_culture } + } + else_if = { + limit = { + scope:defender = { + any_realm_county = { + culture = { + has_cultural_parameter = unlock_maa_hussar + } + } + } + } + scope:defender = { + random_realm_county = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_hussar + } + } + culture = { save_scope_as = army_culture } + } + } + } + else = { + culture = { + save_scope_as = army_culture + } + } + spawn_army = { + name = greek_anarchy_war_neighbor_army_name + uses_supply = yes + inheritable = no + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = hussar + stacks = greek_anarchy_army_maa_value + } + location = scope:attacker.capital_province + } + } + #Varangians + 10 = { + trigger = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_varangian_veterans + } + culture = { + this = culture:greek + } + culture = { + any_parent_culture_or_above = { + this = culture:greek + } + } + scope:defender = { + culture = { + has_cultural_parameter = unlock_maa_varangian_veterans + } + } + scope:defender = { + any_realm_county = { + culture = { + has_cultural_parameter = unlock_maa_varangian_veterans + } + } + } + } + } + modifier = { + OR = { + culture = { + this = culture:greek + } + culture = { + any_parent_culture_or_above = { + this = culture:greek + } + } + } + highest_held_title_tier <= tier_duchy + add = -8 + } + spawn_army = { + name = greek_anarchy_war_generic_army_name_2 + uses_supply = yes + inheritable = no + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = varangian_veterans + stacks = greek_anarchy_army_maa_value + } + location = scope:attacker.capital_province + } + } + #Horse archers + 7 = { + trigger = { + OR = { + culture = { + culture_has_archer_cavalry_maa = yes + } + scope:defender = { + any_realm_county = { + culture = { + culture_has_archer_cavalry_maa = yes + } + } + } + scope:defender = { + any_vassal = { + OR = { + culture = { culture_has_archer_cavalry_maa = yes } + mpo_can_recruit_nomad_maa_trigger = yes + } + } + } + scope:defender = { + OR = { + culture = { culture_has_archer_cavalry_maa = yes } + mpo_can_recruit_nomad_maa_trigger = yes + } + } + } + } + if = { + limit = { + scope:defender = { + any_realm_county = { + culture = { + culture_has_archer_cavalry_maa = yes + } + } + } + } + scope:defender = { + random_realm_county = { + limit = { + culture = { + culture_has_archer_cavalry_maa = yes + } + } + culture = { save_scope_as = army_culture } + } + } + } + else_if = { + limit = { + scope:defender = { + OR = { + culture = { culture_has_archer_cavalry_maa = yes } + mpo_can_recruit_nomad_maa_trigger = yes + } + } + } + scope:defender = { + culture = { + save_scope_as = army_culture + } + } + } + else_if = { + limit = { + scope:defender = { + any_vassal = { + OR = { + culture = { culture_has_archer_cavalry_maa = yes } + mpo_can_recruit_nomad_maa_trigger = yes + } + } + } + } + scope:defender = { + random_vassal = { + limit = { + OR = { + culture = { culture_has_archer_cavalry_maa = yes } + mpo_can_recruit_nomad_maa_trigger = yes + } + } + culture = { save_scope_as = army_culture } + } + } + } + else = { + culture = { + save_scope_as = army_culture + } + } + spawn_army = { + name = greek_anarchy_war_nomad_army_name + uses_supply = yes + inheritable = no + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = horse_archers + stacks = greek_anarchy_army_maa_value + } + location = scope:attacker.capital_province + } + } + #Crossbowmen + 2 = { + trigger = { + OR = { + culture = { + OR = { + has_innovation = innovation_advanced_bowmaking + has_innovation = innovation_repeating_crossbow + } + } + scope:defender = { + any_realm_county = { + culture = { + OR = { + has_innovation = innovation_advanced_bowmaking + has_innovation = innovation_repeating_crossbow + } + } + } + } + } + } + spawn_army = { + name = greek_anarchy_war_generic_army_name_2 + uses_supply = yes + inheritable = no + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = crossbowmen + stacks = greek_anarchy_army_maa_value + } + location = scope:attacker.capital_province + } + } + #Norman knights + 2 = { + trigger = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_conrois + } + top_liege = { + any_vassal = { + highest_held_title_tier >= tier_county + culture = { + has_cultural_parameter = unlock_maa_conrois + } + } + } + any_realm_county = { + culture = { + has_cultural_parameter = unlock_maa_conrois + } + } + #Normans should be just runnin' wild + culture:norman = { + exists = culture_head + has_cultural_parameter = unlock_maa_conrois + } + } + } + modifier = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_conrois + } + top_liege = { + any_vassal = { + highest_held_title_tier >= tier_county + culture = { + has_cultural_parameter = unlock_maa_conrois + } + } + } + any_realm_county = { + culture = { + has_cultural_parameter = unlock_maa_conrois + } + } + } + add = 18 + } + if = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_conrois + } + } + culture = { + save_scope_as = army_culture + } + } + else_if = { + limit = { + top_liege = { + any_vassal = { + culture = { + has_cultural_parameter = unlock_maa_conrois + } + } + } + } + top_liege = { + random_vassal = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_conrois + } + } + culture = { + save_scope_as = army_culture + } + } + } + } + else_if = { + limit = { + any_realm_county = { + culture = { + has_cultural_parameter = unlock_maa_conrois + } + } + } + random_realm_county = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_conrois + } + } + culture = { + save_scope_as = army_culture + } + } + } + else = { + culture:norman = { + save_scope_as = army_culture + } + } + spawn_army = { + name = greek_anarchy_war_crusaders_army_name + uses_supply = yes + inheritable = no + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = conrois + stacks = greek_anarchy_army_heavy_cav_value + } + location = scope:attacker.capital_province + } + } + #Longbowmen + 10 = { + trigger = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_longbowmen + } + top_liege = { + any_vassal = { + highest_held_title_tier >= tier_county + culture = { + has_cultural_parameter = unlock_maa_longbowmen + } + } + } + any_realm_county = { + culture = { + has_cultural_parameter = unlock_maa_longbowmen + } + } + } + } + if = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_longbowmen + } + } + culture = { + save_scope_as = army_culture + } + } + else_if = { + limit = { + top_liege = { + any_vassal = { + culture = { + has_cultural_parameter = unlock_maa_longbowmen + } + } + } + } + top_liege = { + random_vassal = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_longbowmen + } + } + culture = { + save_scope_as = army_culture + } + } + } + } + else = { + random_realm_county = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_longbowmen + } + } + culture = { + save_scope_as = army_culture + } + } + } + spawn_army = { + name = greek_anarchy_war_crusaders_army_name + uses_supply = yes + inheritable = no + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = longbowmen + stacks = greek_anarchy_army_maa_value + } + location = scope:attacker.capital_province + } + } + #Picchieri + 10 = { + trigger = { + OR = { + culture = { + has_innovation = innovation_pike_columns + } + top_liege = { + any_vassal = { + highest_held_title_tier >= tier_county + culture = { + has_innovation = innovation_pike_columns + } + } + } + any_realm_county = { + culture = { + has_innovation = innovation_pike_columns + } + } + } + } + if = { + limit = { + culture = { + has_innovation = innovation_pike_columns + } + } + culture = { + save_scope_as = army_culture + } + } + else_if = { + limit = { + top_liege = { + any_vassal = { + culture = { + has_innovation = innovation_pike_columns + } + } + } + } + top_liege = { + random_vassal = { + limit = { + culture = { + has_innovation = innovation_pike_columns + } + } + culture = { + save_scope_as = army_culture + } + } + } + } + else = { + random_realm_county = { + limit = { + culture = { + has_innovation = innovation_pike_columns + } + } + culture = { + save_scope_as = army_culture + } + } + } + spawn_army = { + name = greek_anarchy_war_crusaders_army_name + uses_supply = yes + inheritable = no + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = picchieri + stacks = greek_anarchy_army_maa_value + } + location = scope:attacker.capital_province + } + } + #Goedendag + 10 = { + trigger = { + OR = { + culture = { + has_innovation = innovation_adaptive_militia + } + top_liege = { + any_vassal = { + highest_held_title_tier >= tier_county + culture = { + has_innovation = innovation_adaptive_militia + } + } + } + any_realm_county = { + culture = { + has_innovation = innovation_adaptive_militia + } + } + } + } + if = { + limit = { + culture = { + has_innovation = innovation_adaptive_militia + } + } + culture = { + save_scope_as = army_culture + } + } + else_if = { + limit = { + top_liege = { + any_vassal = { + culture = { + has_innovation = innovation_adaptive_militia + } + } + } + } + top_liege = { + random_vassal = { + limit = { + culture = { + has_innovation = innovation_adaptive_militia + } + } + culture = { + save_scope_as = army_culture + } + } + } + } + else = { + random_realm_county = { + limit = { + culture = { + has_innovation = innovation_adaptive_militia + } + } + culture = { + save_scope_as = army_culture + } + } + } + spawn_army = { + name = greek_anarchy_war_crusaders_army_name + uses_supply = yes + inheritable = no + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = goedendag + stacks = greek_anarchy_army_weak_maa_value + } + location = scope:attacker.capital_province + } + } + #Caballeros + 10 = { + trigger = { + OR = { + culture = { + has_innovation = innovation_caballeros + } + top_liege = { + any_vassal = { + highest_held_title_tier >= tier_county + culture = { + has_innovation = innovation_caballeros + } + } + } + any_realm_county = { + culture = { + has_innovation = innovation_caballeros + } + } + } + } + if = { + limit = { + culture = { + has_innovation = innovation_caballeros + } + } + culture = { + save_scope_as = army_culture + } + } + else_if = { + limit = { + top_liege = { + any_vassal = { + culture = { + has_innovation = innovation_caballeros + } + } + } + } + top_liege = { + random_vassal = { + limit = { + culture = { + has_innovation = innovation_caballeros + } + } + culture = { + save_scope_as = army_culture + } + } + } + } + else = { + random_realm_county = { + limit = { + culture = { + has_innovation = innovation_caballeros + } + } + culture = { + save_scope_as = army_culture + } + } + } + spawn_army = { + name = greek_anarchy_war_crusaders_army_name + uses_supply = yes + inheritable = no + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = caballero + stacks = greek_anarchy_army_maa_value + } + location = scope:attacker.capital_province + } + } + #Hobbies + 10 = { + trigger = { + OR = { + culture = { + has_innovation = innovation_hobbies + } + top_liege = { + any_vassal = { + highest_held_title_tier >= tier_county + culture = { + has_innovation = innovation_hobbies + } + } + } + any_realm_county = { + culture = { + has_innovation = innovation_hobbies + } + } + } + } + if = { + limit = { + culture = { + has_innovation = innovation_hobbies + } + } + culture = { + save_scope_as = army_culture + } + } + else_if = { + limit = { + top_liege = { + any_vassal = { + culture = { + has_innovation = innovation_hobbies + } + } + } + } + top_liege = { + random_vassal = { + limit = { + culture = { + has_innovation = innovation_hobbies + } + } + culture = { + save_scope_as = army_culture + } + } + } + } + else = { + random_realm_county = { + limit = { + culture = { + has_innovation = innovation_hobbies + } + } + culture = { + save_scope_as = army_culture + } + } + } + spawn_army = { + name = greek_anarchy_war_crusaders_army_name + uses_supply = yes + inheritable = no + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = hobelar + stacks = greek_anarchy_army_maa_value + } + location = scope:attacker.capital_province + } + } + #Schiltron + 10 = { + trigger = { + OR = { + culture = { + has_innovation = innovation_rectilinear_schiltron + } + top_liege = { + any_vassal = { + highest_held_title_tier >= tier_county + culture = { + has_innovation = innovation_rectilinear_schiltron + } + } + } + any_realm_county = { + culture = { + has_innovation = innovation_rectilinear_schiltron + } + } + } + } + if = { + limit = { + culture = { + has_innovation = innovation_rectilinear_schiltron + } + } + culture = { + save_scope_as = army_culture + } + } + else_if = { + limit = { + top_liege = { + any_vassal = { + culture = { + has_innovation = innovation_rectilinear_schiltron + } + } + } + } + top_liege = { + random_vassal = { + limit = { + culture = { + has_innovation = innovation_rectilinear_schiltron + } + } + culture = { + save_scope_as = army_culture + } + } + } + } + else = { + random_realm_county = { + limit = { + culture = { + has_innovation = innovation_rectilinear_schiltron + } + } + culture = { + save_scope_as = army_culture + } + } + } + spawn_army = { + name = greek_anarchy_war_crusaders_army_name + uses_supply = yes + inheritable = no + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = schiltron + stacks = greek_anarchy_army_maa_value + } + location = scope:attacker.capital_province + } + } + #Valets + 10 = { + trigger = { + OR = { + culture = { + has_innovation = innovation_valets + } + top_liege = { + any_vassal = { + highest_held_title_tier >= tier_county + culture = { + has_innovation = innovation_valets + } + } + } + any_realm_county = { + culture = { + has_innovation = innovation_valets + } + } + } + scope:defender = { + highest_held_title_tier >= tier_kingdom + } + } + if = { + limit = { + culture = { + has_innovation = innovation_valets + } + } + culture = { + save_scope_as = army_culture + } + } + else_if = { + limit = { + top_liege = { + any_vassal = { + culture = { + has_innovation = innovation_valets + } + } + } + } + top_liege = { + random_vassal = { + limit = { + culture = { + has_innovation = innovation_valets + } + } + culture = { + save_scope_as = army_culture + } + } + } + } + else = { + random_realm_county = { + limit = { + culture = { + has_innovation = innovation_valets + } + } + culture = { + save_scope_as = army_culture + } + } + } + spawn_army = { + name = greek_anarchy_war_crusaders_army_name + uses_supply = yes + inheritable = no + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = gendarme + stacks = greek_anarchy_army_heavy_cav_value + } + location = scope:attacker.capital_province + } + } + #landsknecht + 10 = { + trigger = { + OR = { + culture = { + has_innovation = innovation_zweihanders + } + top_liege = { + any_vassal = { + highest_held_title_tier >= tier_county + culture = { + has_innovation = innovation_zweihanders + } + } + } + any_realm_county = { + culture = { + has_innovation = innovation_zweihanders + } + } + } + } + if = { + limit = { + culture = { + has_innovation = innovation_zweihanders + } + } + culture = { + save_scope_as = army_culture + } + } + else_if = { + limit = { + top_liege = { + any_vassal = { + culture = { + has_innovation = innovation_zweihanders + } + } + } + } + top_liege = { + random_vassal = { + limit = { + culture = { + has_innovation = innovation_zweihanders + } + } + culture = { + save_scope_as = army_culture + } + } + } + } + else = { + random_realm_county = { + limit = { + culture = { + has_innovation = innovation_zweihanders + } + } + culture = { + save_scope_as = army_culture + } + } + } + spawn_army = { + name = greek_anarchy_war_crusaders_army_name + uses_supply = yes + inheritable = no + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = landsknecht + stacks = greek_anarchy_army_maa_value + } + location = scope:attacker.capital_province + } + } + #Huscarls + 10 = { + trigger = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_huscarls + } + top_liege = { + any_vassal = { + highest_held_title_tier >= tier_county + culture = { + has_cultural_parameter = unlock_maa_huscarls + } + } + } + any_realm_county = { + culture = { + has_cultural_parameter = unlock_maa_huscarls + } + } + } + } + if = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_huscarls + } + } + culture = { + save_scope_as = army_culture + } + } + else_if = { + limit = { + top_liege = { + any_vassal = { + culture = { + has_cultural_parameter = unlock_maa_huscarls + } + } + } + } + top_liege = { + random_vassal = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_huscarls + } + } + culture = { + save_scope_as = army_culture + } + } + } + } + else = { + random_realm_county = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_huscarls + } + } + culture = { + save_scope_as = army_culture + } + } + } + spawn_army = { + name = greek_anarchy_war_crusaders_army_name + uses_supply = yes + inheritable = no + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = huscarl + stacks = greek_anarchy_army_maa_value + } + location = scope:attacker.capital_province + } + } + #Camels + 5 = { + trigger = { + OR = { + culture = { + has_innovation = innovation_war_camels + } + scope:defender = { + any_realm_county = { + culture = { + has_innovation = innovation_war_camels + } + county_has_province_with_terrain = { + terrain = drylands + terrain = desert + } + } + } + } + } + if = { + limit = { + scope:defender = { + any_realm_county = { + culture = { + has_innovation = innovation_war_camels + } + county_has_province_with_terrain = { + terrain = drylands + terrain = desert + } + } + } + } + scope:defender = { + random_realm_county = { + limit = { + culture = { + has_innovation = innovation_war_camels + } + county_has_province_with_terrain = { + terrain = drylands + terrain = desert + } + } + culture = { + save_scope_as = army_culture + } + } + } + } + else = { + culture = { + save_scope_as = army_culture + } + } + spawn_army = { + name = greek_anarchy_war_nomad_army_name + uses_supply = yes + inheritable = no + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = camel_rider + stacks = greek_anarchy_army_maa_value + } + location = scope:attacker.capital_province + } + } + #Heavy cav + 4 = { + trigger = { + OR = { + culture = { + has_innovation = innovation_arched_saddle + } + scope:defender = { + culture = { + has_innovation = innovation_arched_saddle + } + } + scope:defender = { + any_realm_county = { + culture = { + has_innovation = innovation_arched_saddle + } + } + } + } + scope:defender = { + highest_held_title_tier >= tier_kingdom + } + } + spawn_army = { + name = greek_anarchy_war_generic_army_name_2 + inheritable = no + uses_supply = yes + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = armored_horsemen + stacks = greek_anarchy_army_heavy_cav_value + } + location = scope:attacker.capital_province + } + } + #Heavy Infantry + 1 = { + trigger = { + OR = { + culture = { + has_innovation = innovation_quilted_armor + } + scope:defender = { + culture = { + has_innovation = innovation_quilted_armor + } + } + scope:defender = { + any_realm_county = { + culture = { + has_innovation = innovation_quilted_armor + } + } + } + } + } + spawn_army = { + name = greek_anarchy_war_generic_army_name_2 + inheritable = no + uses_supply = yes + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = armored_footmen + stacks = greek_anarchy_army_maa_value + } + location = scope:attacker.capital_province + } + } + #Pikemen + 2 = { + trigger = { + scope:defender = { + any_realm_county = { + county_has_province_with_terrain = { + terrain = mountains + } + } + } + } + spawn_army = { + name = greek_anarchy_war_generic_army_name_2 + inheritable = no + uses_supply = yes + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = pikemen_unit + stacks = greek_anarchy_army_maa_value + } + location = scope:attacker.capital_province + } + } + #Archers + 2 = { + trigger = { + scope:defender = { + any_realm_county = { + county_has_province_with_terrain = { + terrain = forest + } + } + } + } + spawn_army = { + name = greek_anarchy_war_generic_army_name_2 + inheritable = no + uses_supply = yes + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = bowmen + stacks = greek_anarchy_army_maa_value + } + location = scope:attacker.capital_province + } + } + #Light Horsemen + 1 = { + spawn_army = { + name = greek_anarchy_war_generic_army_name_2 + inheritable = no + uses_supply = yes + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = light_horsemen + stacks = greek_anarchy_army_maa_value + } + location = scope:attacker.capital_province + } + } + #Light Footmen + 1 = { + spawn_army = { + name = greek_anarchy_war_generic_army_name_2 + inheritable = no + uses_supply = yes + levies = greek_anarchy_army_levy_value + men_at_arms = { + type = light_footmen + stacks = greek_anarchy_army_weak_maa_value + } + location = scope:attacker.capital_province + } + } + } +} + +expunge_latin_dominion_effect = { + if = { + limit = { + OR = { + ep3_orthodox_faith_trigger = yes + faith = faith:hellenic_pagan + } + } + add_character_modifier = { + modifier = ascendant_byz_reclaimant_ortho_modifier + years = 20 + } + } + else = { + add_character_modifier = { + modifier = ascendant_byz_reclaimant_modifier + years = 20 + } + } +} + +frankokratia_latin_emp_end_msg_effect = { + save_scope_as = latin_emp + faith = { + every_faith_ruler = { + limit = { + is_ai = no + NOT = { + has_character_flag = had_ep3_frankokratia_events_0100 + } + } + add_to_list = latin_destroyed_recipients + } + } + title:e_latin_empire = { + every_in_de_jure_hierarchy = { + if = { + limit = { + holder ?= { + is_ai = no + NOR = { + is_in_list = latin_destroyed_recipients + has_character_flag = had_ep3_frankokratia_events_0100 + } + } + } + holder = { + add_to_list = latin_destroyed_recipients + } + } + } + } + title:e_byzantium = { + every_in_de_jure_hierarchy = { + if = { + limit = { + holder ?= { + is_ai = no + NOR = { + is_in_list = latin_destroyed_recipients + has_character_flag = had_ep3_frankokratia_events_0100 + } + } + } + holder = { + add_to_list = latin_destroyed_recipients + } + } + } + } + if = { + limit = { + #Notification looks weird if it's Byzantine empire no longer being a Latin + NOT = { + any_held_title = { + this = title:e_byzantium + } + } + } + every_in_list = { + list = latin_destroyed_recipients + limit = { + this != root + } + trigger_event = ep3_frankokratia_events.0100 + } + #Trigger one day after for root, switch the titles + if = { + limit = { + NOT = { + has_character_flag = had_ep3_frankokratia_events_0100 + } + } + trigger_event = { + id = ep3_frankokratia_events.0100 + days = 1 + } + } + } +} + +frankokratia_remove__war_leader_var_effect = { + if = { + limit = { + any_character_war = { + using_cb = crusading_claim_cb + any_war_participant = { + this = scope:recipient + } + any_war_attacker = { + any_owned_story = { + type = frankokratia_story + any_in_list = { + variable = frankokratia_leaders + this = scope:actor + } + } + } + } + } + random_character_war = { + limit = { + any_war_participant = { + any_owned_story = { + type = frankokratia_story + any_in_list = { + variable = frankokratia_leaders + this = scope:actor + } + } + } + } + random_war_participant = { + limit = { + any_owned_story = { + type = frankokratia_story + any_in_list = { + variable = frankokratia_leaders + this = scope:actor + } + } + } + random_owned_story = { + type = frankokratia_story + limit = { + any_in_list = { + variable = frankokratia_leaders + this = scope:actor + } + } + remove_list_variable = { + name = frankokratia_leaders + target = scope:actor + } + } + } + } + } +} diff --git a/N3OW/common/scripted_effects/08_bp3_effects.txt b/N3OW/common/scripted_effects/08_bp3_effects.txt new file mode 100644 index 00000000..208a0710 --- /dev/null +++ b/N3OW/common/scripted_effects/08_bp3_effects.txt @@ -0,0 +1,1269 @@ +wandering_lifestyle_exp_post_travel_effect = { + if = { + limit = { + is_ai = no + has_bp3_dlc_trigger = yes + exists = current_travel_plan + } + add_wanderer_lifestyle_xp = 5 + } +} + +inspection_success_chance_change_effect = { + scope:activity = { + if = { + limit = { + NOT = { exists = var:inspection_success_chance_event } + } + set_variable = { name = inspection_success_chance_event value = 0 } + } + change_variable = { + name = inspection_success_chance_event + add = inspection_activity_success_$CHANGE$_value + } + set_variable = { + name = inspection_success_chance + value = inspection_success_chance_value + } + } + custom_tooltip = inspection_activity_success_$CHANGE$_tt +} + +inspection_success_chance_change_focus_effect = { + if = { + limit = { + has_variable = inspection_activity_$FOCUS$_focus + } + inspection_success_chance_change_effect = { + CHANGE = $CHANGE$ + } + } +} + +inspection_success_chance_change_not_focus_effect = { + if = { + limit = { + NOT = { has_variable = inspection_activity_$FOCUS$_focus } + } + inspection_success_chance_change_effect = { + CHANGE = $CHANGE$ + } + } +} + +inspection_claim_effects = { + if = { + limit = { + $ACTOR$ = { + NOT = { has_claim_on = $TARGET$ } + } + } + $ACTOR$ = { add_$TYPE$_claim = $TARGET$ } + } +} + +inspection_fighting_guilds_effect = { + scope:city_province = { + random_list = { + 10 = { # Millers Guild (Watermills) + trigger = { + trigger_if = { + limit = { + has_variable = fighting_guilds_option_1 + } + NOT = { var:fighting_guilds_option_1 = 1 } + } + building_watermills_requirement_terrain = yes + culture = { + has_innovation = innovation_windmills + } + NOT = { has_building_or_higher = watermills_01 } + } + set_variable = { + name = fighting_guilds_option_$VALUE$ + value = 1 + } + } + 10 = { # Bakers Guild (Windmills) + trigger = { + trigger_if = { + limit = { + has_variable = fighting_guilds_option_1 + } + NOT = { var:fighting_guilds_option_1 = 2 } + } + building_windmills_requirement_terrain = yes + culture = { + has_innovation = innovation_windmills + } + NOT = { has_building_or_higher = windmills_01 } + } + set_variable = { + name = fighting_guilds_option_$VALUE$ + value = 2 + } + } + 10 = { # Fishmongers Guild (Port) + trigger = { + trigger_if = { + limit = { + has_variable = fighting_guilds_option_1 + } + NOT = { var:fighting_guilds_option_1 = 3 } + } + building_common_tradeport_requirement_terrain = yes + NOT = { has_building_or_higher = common_tradeport_01 } + } + set_variable = { + name = fighting_guilds_option_$VALUE$ + value = 3 + } + } + 10 = { # Shoemakers/Tanners/Tailors/Weavers Guild (Cattle Pastures) + trigger = { + trigger_if = { + limit = { + has_variable = fighting_guilds_option_1 + } + NOR = { + var:fighting_guilds_option_1 = 4 + var:fighting_guilds_option_1 = 5 + var:fighting_guilds_option_1 = 6 + var:fighting_guilds_option_1 = 7 + } + } + building_pastures_requirement_terrain = yes + NOT = { has_building_or_higher = pastures_01 } + } + random_list = { + 10 = { + set_variable = { + name = fighting_guilds_option_$VALUE$ + value = 4 + } + } + 10 = { + set_variable = { + name = fighting_guilds_option_$VALUE$ + value = 5 + } + } + 10 = { + set_variable = { + name = fighting_guilds_option_$VALUE$ + value = 6 + } + } + 10 = { + set_variable = { + name = fighting_guilds_option_$VALUE$ + value = 7 + } + } + } + } + 10 = { # Butchers/Furriers/Skinners Guild (Hunting Grounds) + trigger = { + trigger_if = { + limit = { + has_variable = fighting_guilds_option_1 + } + NOR = { + var:fighting_guilds_option_1 = 8 + var:fighting_guilds_option_1 = 9 + var:fighting_guilds_option_1 = 10 + } + } + building_hunting_grounds_requirement_terrain = yes + NOT = { has_building_or_higher = hunting_grounds_01 } + } + random_list = { + 10 = { + set_variable = { + name = fighting_guilds_option_$VALUE$ + value = 8 + } + } + 10 = { + set_variable = { + name = fighting_guilds_option_$VALUE$ + value = 9 + } + } + 10 = { + set_variable = { + name = fighting_guilds_option_$VALUE$ + value = 10 + } + } + } + } + 10 = { # Vintners Guild (Orchards) + trigger = { + trigger_if = { + limit = { + has_variable = fighting_guilds_option_1 + } + NOT = { var:fighting_guilds_option_1 = 11 } + } + building_orchards_requirement_terrain = yes + NOT = { has_building_or_higher = orchards_01 } + } + set_variable = { + name = fighting_guilds_option_$VALUE$ + value = 11 + } + } + 10 = { # Carpenters Guild (Logging Camps) + trigger = { + trigger_if = { + limit = { + has_variable = fighting_guilds_option_1 + } + NOT = { var:fighting_guilds_option_1 = 12 } + } + building_logging_camps_requirement_terrain = yes + NOT = { has_building_or_higher = logging_camps_01 } + } + set_variable = { + name = fighting_guilds_option_$VALUE$ + value = 12 + } + } + 10 = { # Masons/Miners Guild (Quarries) + trigger = { + trigger_if = { + limit = { + has_variable = fighting_guilds_option_1 + } + NOR = { + var:fighting_guilds_option_1 = 13 + var:fighting_guilds_option_1 = 14 + } + } + building_quarries_requirement_terrain = yes + NOT = { has_building_or_higher = quarries_01 } + } + random_list = { + 10 = { + set_variable = { + name = fighting_guilds_option_$VALUE$ + value = 13 + } + } + 10 = { + set_variable = { + name = fighting_guilds_option_$VALUE$ + value = 14 + } + } + } + } + 10 = { # Blacksmiths Guild (Blacksmith) + trigger = { + trigger_if = { + limit = { + has_variable = fighting_guilds_option_1 + } + NOT = { var:fighting_guilds_option_1 = 15 } + } + building_smiths_requirement_terrain = yes + NOT = { has_building_or_higher = smiths_01 } + } + set_variable = { + name = fighting_guilds_option_$VALUE$ + value = 15 + } + } + 10 = { # Saddlers Guild (Stables) + trigger = { + trigger_if = { + limit = { + has_variable = fighting_guilds_option_1 + } + NOT = { var:fighting_guilds_option_1 = 16 } + } + building_stables_requirement_terrain = yes + NOT = { has_building_or_higher = stables_01 } + } + set_variable = { + name = fighting_guilds_option_$VALUE$ + value = 16 + } + } + 10 = { # Merchants Guild (Guild Halls) + trigger = { + trigger_if = { + limit = { + has_variable = fighting_guilds_option_1 + } + NOT = { var:fighting_guilds_option_1 = 17 } + } + has_building_or_higher = city_01 + NOT = { has_building_or_higher = guild_halls_01 } + } + set_variable = { + name = fighting_guilds_option_$VALUE$ + value = 17 + } + } + 10 = { # Physicians/Pharmacists Guild (Hospices) + trigger = { + trigger_if = { + limit = { + has_variable = fighting_guilds_option_1 + } + NOR = { + var:fighting_guilds_option_1 = 18 + var:fighting_guilds_option_1 = 19 + } + } + NOT = { has_building_or_higher = hospices_01 } + } + random_list = { + 10 = { + set_variable = { + name = fighting_guilds_option_$VALUE$ + value = 18 + } + } + 10 = { + set_variable = { + name = fighting_guilds_option_$VALUE$ + value = 19 + } + } + } + } + 10 = { # Toolmakers Guild (Workshops) + trigger = { + trigger_if = { + limit = { + has_variable = fighting_guilds_option_1 + } + NOT = { var:fighting_guilds_option_1 = 20 } + } + building_workshops_requirement_terrain = yes + culture = { + has_innovation = innovation_advanced_bowmaking + } + NOT = { has_building_or_higher = workshops_01 } + } + set_variable = { + name = fighting_guilds_option_$VALUE$ + value = 20 + } + } + 1 = { # Fallback - Innkeepers Guild + trigger = { + trigger_if = { + limit = { + has_variable = fighting_guilds_option_1 + } + NOT = { var:fighting_guilds_option_1 = 21 } + } + NOT = { has_province_modifier = inspection_fighting_guilds_innkeepers_guild_modifier } + } + set_variable = { + name = fighting_guilds_option_$VALUE$ + value = 21 + } + } + 1 = { # Fallback - Artists Guild + trigger = { + trigger_if = { + limit = { + has_variable = fighting_guilds_option_1 + } + NOT = { var:fighting_guilds_option_1 = 22 } + } + NOT = { has_province_modifier = inspection_fighting_guilds_artists_guild_modifier } + } + set_variable = { + name = fighting_guilds_option_$VALUE$ + value = 22 + } + } + } + } +} + +inspection_fighting_guilds_setup_reward_effect = { + switch = { + trigger = var:fighting_guilds_option_$VALUE$ + 1 = { add_building = watermills_01 } + 2 = { add_building = windmills_01 } + 3 = { add_building = common_tradeport_01 } + 4 = { add_building = pastures_01 } + 5 = { add_building = pastures_01 } + 6 = { add_building = pastures_01 } + 7 = { add_building = pastures_01 } + 8 = { add_building = hunting_grounds_01 } + 9 = { add_building = hunting_grounds_01 } + 10 = { add_building = hunting_grounds_01 } + 11 = { add_building = orchards_01 } + 12 = { add_building = logging_camps_01 } + 13 = { add_building = quarries_01 } + 14 = { add_building = quarries_01 } + 15 = { add_building = smiths_01 } + 16 = { add_building = stables_01 } + 17 = { add_building = guild_halls_01 } + 18 = { add_building = hospices_01 } + 19 = { add_building = hospices_01 } + 20 = { add_building = workshops_01 } + 21 = { + scope:city_province = { + add_province_modifier = inspection_fighting_guilds_innkeepers_guild_modifier + } + } + 22 = { + scope:city_province = { + add_province_modifier = inspection_fighting_guilds_artists_guild_modifier + } + } + } +} + +inspection_survey_intent_development = { + if = { + limit = { + has_activity_intent = survey_learning_intent + } + capital_county = { + change_development_progress_with_overflow = $VALUE$ + } + } +} + +inspection_survey_intent_control = { + if = { + limit = { + has_activity_intent = survey_learning_intent + capital_county = { county_control < 100 } + } + capital_county = { + change_county_control = $VALUE$ + } + } + else = { + inspection_survey_intent_development = { VALUE = $VALUE$ } + } +} + +inspection_survey_intent_county_modifier = { + if = { + limit = { + has_activity_intent = survey_learning_intent + capital_county = { + NOT = { has_county_modifier = $MODIFIER$ } + } + } + capital_county = { + add_county_modifier = { + modifier = $MODIFIER$ + years = 5 + } + } + } + else = { + inspection_survey_intent_development = { VALUE = 5 } + } +} + +inspection_survey_intent_province_modifier = { + if = { + limit = { + has_activity_intent = survey_learning_intent + capital_barony.title_province = { + NOT = { has_province_modifier = $MODIFIER$ } + } + } + capital_barony.title_province = { + add_province_modifier = { + modifier = $MODIFIER$ + years = 5 + } + } + } + else = { + inspection_survey_intent_development = { VALUE = 5 } + } +} + +inspection_survey_local_message_county_modifier = { + hidden_effect = { + if = { + limit = { + scope:province.county.holder != scope:host + } + scope:province.county.holder = { + send_interface_message = { + type = send_interface_$TYPE$ + title = bp3_survey_liege_intervention + + show_as_tooltip = { + scope:province.county = { + add_county_modifier = { + modifier = $MODIFIER$ + years = $YEARS$ + } + } + } + } + } + } + } +} + +inspection_survey_local_message_province_modifier = { + hidden_effect = { + if = { + limit = { + scope:province.county.holder != scope:host + } + scope:province.county.holder = { + send_interface_message = { + type = send_interface_$TYPE$ + title = bp3_survey_liege_intervention + + show_as_tooltip = { + scope:province = { + add_province_modifier = { + modifier = $MODIFIER$ + years = $YEARS$ + } + } + } + } + } + } + } +} + +inspection_survey_local_message_permanent_province_modifier = { + hidden_effect = { + if = { + limit = { + scope:province.county.holder != scope:host + } + scope:province.county.holder = { + send_interface_message = { + type = send_interface_$TYPE$ + title = bp3_survey_liege_intervention + + show_as_tooltip = { + scope:province = { + add_province_modifier = $MODIFIER$ + } + } + } + } + } + } +} + +inspection_survey_local_message_specific_location_province_modifier = { + hidden_effect = { + if = { + limit = { + county.holder != scope:host + } + save_scope_as = saved_province + county.holder = { + send_interface_message = { + type = send_interface_$TYPE$ + title = bp3_survey_liege_intervention + + show_as_tooltip = { + scope:saved_province = { + add_province_modifier = { + modifier = $MODIFIER$ + years = $YEARS$ + } + } + } + } + } + } + } +} + +court_brewmaster_assign_modifier_positive_effect = { + send_interface_message = { + type = send_interface_message_good + title = experimental_brew_title + right_icon = root + + add_character_modifier = { + modifier = experimental_brew_$MODIFIER$_modifier + months = 6 + } + } +} + +brewery_counter_effect = { + county = { + if = { + limit = { + has_variable = brewery_counter_var + NOT = { + any_county_province = { + has_building_or_higher = breweries_01 + } + } + } + remove_variable = brewery_counter_var + } + else_if = { + limit = { + NOT = { has_variable = brewery_counter_var } + any_county_province = { has_building_or_higher = breweries_01 } + } + set_variable = { + name = brewery_counter_var + value = current_year + } + } + } +} + +brewery_counter_start_effect = { + if = { + limit = { + has_building_or_higher = breweries_01 + } + county = { + set_variable = { + name = brewery_counter_var + value = { + value = current_year + subtract = { integer_range = { min = 1 max = 80 } } + } + } + } + } +} + +souvenirs_aplenty_gallowsbait_effect = { + send_interface_message = { + type = event_generic_good + title = souvenirs_aplenty_perk_name + left_icon = root + + add_gold = 25 + add_trait_xp = { + trait = gallowsbait + track = $TRACK$ + value = 5 + } + } +} + +landless_inspector_assign_terrain_effect = { + if = { + limit = { + has_perk = no_stone_unturned_perk + government_has_flag = government_is_landless_adventurer + } + add_character_modifier = landless_inspector_$TERRAIN$_tier_3_modifier + } + else_if = { + limit = { + has_perk = no_stone_unturned_perk + government_has_flag = government_is_nomadic + } + add_character_modifier = nomadic_inspector_$TERRAIN$_tier_3_modifier + } + else_if = { + limit = { + has_perk = local_inspection_perk + government_has_flag = government_is_landless_adventurer + } + add_character_modifier = landless_inspector_$TERRAIN$_tier_2_modifier + } + else_if = { + limit = { + has_perk = local_inspection_perk + government_has_flag = government_is_nomadic + } + add_character_modifier = nomadic_inspector_$TERRAIN$_tier_2_modifier + } + else_if = { + limit = { + has_perk = mustering_the_troops_perk + } + add_character_modifier = landless_inspector_$TERRAIN$_tier_1_modifier + } + else = { + landless_inspector_remove_terrain_effect = yes + } +} + +landless_inspector_upgrade_terrain_tier_effect = { + landless_inspector_upgrade_terrain_tier_extrapolated_effect = { TERRAIN = woodlands} + landless_inspector_upgrade_terrain_tier_extrapolated_effect = { TERRAIN = highlands} + landless_inspector_upgrade_terrain_tier_extrapolated_effect = { TERRAIN = lowlands } + landless_inspector_upgrade_terrain_tier_extrapolated_effect = { TERRAIN = drylands } +} + +landless_inspector_upgrade_terrain_tier_extrapolated_effect = { + if = { + limit = { + has_character_modifier = landless_inspector_$TERRAIN$_tier_2_modifier + has_perk = no_stone_unturned_perk + government_has_flag = government_is_landless_adventurer + } + remove_character_modifier = landless_inspector_$TERRAIN$_tier_2_modifier + add_character_modifier = landless_inspector_$TERRAIN$_tier_3_modifier + } + else_if = { + limit = { + has_character_modifier = landless_inspector_$TERRAIN$_tier_1_modifier + has_perk = local_inspection_perk + government_has_flag = government_is_landless_adventurer + } + remove_character_modifier = landless_inspector_$TERRAIN$_tier_1_modifier + add_character_modifier = landless_inspector_$TERRAIN$_tier_2_modifier + } + if = { + limit = { + has_character_modifier = nomadic_inspector_$TERRAIN$_tier_2_modifier + has_perk = no_stone_unturned_perk + government_has_flag = government_is_nomadic + } + remove_character_modifier = nomadic_inspector_$TERRAIN$_tier_2_modifier + add_character_modifier = nomadic_inspector_$TERRAIN$_tier_3_modifier + } + else_if = { + limit = { + has_character_modifier = landless_inspector_$TERRAIN$_tier_1_modifier + has_perk = local_inspection_perk + government_has_flag = government_is_nomadic + } + remove_character_modifier = landless_inspector_$TERRAIN$_tier_1_modifier + add_character_modifier = nomadic_inspector_$TERRAIN$_tier_2_modifier + } +} + +landless_inspector_remove_terrain_effect = { + hidden_effect = { + landless_inspector_remove_terrain_extrapolated_effect = { TERRAIN = woodlands } + landless_inspector_remove_terrain_extrapolated_effect = { TERRAIN = highlands } + landless_inspector_remove_terrain_extrapolated_effect = { TERRAIN = lowlands } + landless_inspector_remove_terrain_extrapolated_effect = { TERRAIN = drylands } + } +} + +landless_inspector_remove_master_terrain_effect = { + hidden_effect = { + remove_character_modifier = master_terrain_forest_modifier + remove_character_modifier = master_terrain_jungle_modifier + remove_character_modifier = master_terrain_taiga_modifier + remove_character_modifier = master_terrain_wetlands_modifier + + remove_character_modifier = master_terrain_mountains_modifier + remove_character_modifier = master_terrain_hills_modifier + remove_character_modifier = master_terrain_desert_mountains_modifier + + remove_character_modifier = master_terrain_plains_modifier + remove_character_modifier = master_terrain_steppe_modifier + remove_character_modifier = master_terrain_farmlands_modifier + remove_character_modifier = master_terrain_floodplains_modifier + + remove_character_modifier = master_terrain_drylands_modifier + remove_character_modifier = master_terrain_desert_modifier + remove_character_modifier = master_terrain_oasis_modifier + } +} + +landless_inspector_remove_terrain_extrapolated_effect = { + remove_character_modifier = nomadic_inspector_$TERRAIN$_tier_3_modifier + remove_character_modifier = nomadic_inspector_$TERRAIN$_tier_2_modifier + remove_character_modifier = landless_inspector_$TERRAIN$_tier_3_modifier + remove_character_modifier = landless_inspector_$TERRAIN$_tier_2_modifier + remove_character_modifier = landless_inspector_$TERRAIN$_tier_1_modifier +} + +local_arbitration_boon_logic_purpose_effect = { + hidden_effect = { + if = { + limit = { + has_perk = local_arbitration_perk + } + if = { + limit = { + has_realm_law = camp_purpose_wanderers + } + add_character_modifier = landless_local_arbitration_wanderers_modifier + } + else_if = { + limit = { + has_realm_law = camp_purpose_mercenaries + } + add_character_modifier = landless_local_arbitration_mercenaries_modifier + } + else_if = { + limit = { + has_realm_law = camp_purpose_scholars + } + add_character_modifier = landless_local_arbitration_scholars_modifier + } + else_if = { + limit = { + has_realm_law = camp_purpose_explorers + } + add_character_modifier = landless_local_arbitration_explorers_modifier + } + else_if = { + limit = { + has_realm_law = camp_purpose_brigands + } + add_character_modifier = landless_local_arbitration_brigands_modifier + } + else_if = { + limit = { + has_realm_law = camp_purpose_legitimists + } + add_character_modifier = landless_local_arbitration_legitimists_modifier + } + else_if = { + limit = { + has_government = landless_adventurer_government + } + add_character_modifier = landless_local_arbitration_wanderers_modifier + } + } + } +} + +local_arbitration_boon_change_purpose_effect = { + hidden_effect = { + local_arbitration_boon_remove_purpose_effect = yes + + local_arbitration_boon_logic_purpose_effect = yes + } +} + +local_arbitration_boon_set_purpose_effect = { + hidden_effect = { + local_arbitration_boon_remove_purpose_effect = yes + + if = { + limit = { + has_perk = local_arbitration_perk + } + add_character_modifier = $MODIFIER$ + } + } +} + +local_arbitration_boon_remove_purpose_effect = { + remove_character_modifier = landless_local_arbitration_wanderers_modifier + remove_character_modifier = landless_local_arbitration_mercenaries_modifier + remove_character_modifier = landless_local_arbitration_scholars_modifier + remove_character_modifier = landless_local_arbitration_explorers_modifier + remove_character_modifier = landless_local_arbitration_brigands_modifier + remove_character_modifier = landless_local_arbitration_legitimists_modifier +} + +remove_all_landless_inspector_modifiers = { + hidden_effect = { + local_arbitration_boon_remove_purpose_effect = yes + landless_inspector_remove_terrain_effect = yes + landless_inspector_remove_master_terrain_effect = yes + } +} + +landless_inspector_cleanup_modifier = { + if = { + limit = { + has_perk = mustering_the_troops_perk + } + if = { + limit = { + NOR = { + government_has_flag = government_is_nomadic + is_landless_adventurer = yes + } + } + remove_all_landless_inspector_modifiers = yes + } + } +} + +landless_inspector_master_terrain_effect = { + hidden_effect = { + add_character_modifier = master_terrain_$TERRAIN$_modifier + } + custom_tooltip = master_terrain_custom_tooltip_$TERRAIN$ + custom_description = { + text = personal_touch_3_effect + } +} + +merge_aquitaine_effect = { + title:$PRIMARY$ = { + save_scope_as = rightful_title + every_in_de_jure_hierarchy = { + custom = merge_aquitaine_decision_vassal_$TEXT$ + limit = { + tier < tier_kingdom + } + holder ?= { + if = { + limit = { + NOR = { + is_in_list = merge_aquitaine_list + this = root + } + } + add_opinion = { + modifier = rightful_king_opinion + target = root + opinion = 20 + } + add_to_temporary_list = merge_aquitaine_list + } + } + custom_tooltip = merge_aquitaine_opinion + } + } + title:$SECONDARY$ = { + save_scope_as = destroyed_title + every_in_de_jure_hierarchy = { + custom = merge_aquitane_culture_tooltip_$TEXT$ + limit = { + tier = tier_county + } + hidden_effect = { + culture ?= { + if = { + limit = { + NOR = { + is_in_list = merge_aquitaine_list + this = root.culture + any_parent_culture_or_above = { this = root.culture } + } + } + change_cultural_acceptance = { + target = root.culture + value = -25 + desc = cultural_acceptance_merge_aquitaine + } + add_to_list = merge_aquitaine_list + } + } + } + custom_tooltip = merge_aquitaine_culture_tooltip + } + every_in_de_jure_hierarchy = { + custom = merge_aquitaine_decision_tooltip_$TEXT$ + limit = { + tier = tier_duchy + } + hidden_effect = { set_de_jure_liege_title = title:$PRIMARY$ } + custom_tooltip = merge_aquitaine_decision_tooltip_2_$TEXT$ + } + } + destroy_title = title:$SECONDARY$ +} + +hire_for_court_position_journey_effect = { + hidden_effect = { + $CHARACTER$ = { + add_to_court_and_entourage_effect = yes + } + if = { + limit = { + any_court_position_holder = { + type = $COURT_POSITION$_court_position + } + } + random_court_position_holder = { + type = $COURT_POSITION$_court_position + save_scope_as = current_holder + } + } + } + + show_as_tooltip = { + if = { + limit = { + is_valid_to_hire_court_position_type = $COURT_POSITION$_court_position + trigger_if = { + limit = { + exists = scope:current_holder + } + $CHARACTER$.aptitude:$COURT_POSITION$_court_position > scope:current_holder.aptitude:$COURT_POSITION$_court_position + } + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = $COURT_POSITION$_court_position + } + custom_tooltip = will_have_excellent_aptitude + } + else = { + $CHARACTER$ = { + add_to_court_and_entourage_effect = yes + } + } + } + + if = { + limit = { + is_valid_to_hire_court_position_type = $COURT_POSITION$_court_position + OR = { + NOT = { exists = scope:current_holder } + trigger_if = { + limit = { + has_character_flag = bodyguard_flag + } + any_court_position_holder = { + type = bodyguard_court_position + count <= 1 + } + } + } + } + employ_character_as_position_in_current_scope_court_effect = { + CHARACTER = $CHARACTER$ + POSITION = $COURT_POSITION$ + } + } + else_if = { + limit = { + exists = scope:current_holder + $CHARACTER$.aptitude:$COURT_POSITION$_court_position > scope:current_holder.aptitude:$COURT_POSITION$_court_position + } + add_character_flag = temporary_court_position_cost_removal + replace_court_position = { + recipient = $CHARACTER$ + holder = scope:current_holder + court_position = $COURT_POSITION$_court_position + } + remove_character_flag = temporary_court_position_cost_removal + } + + if = { + limit = { + has_activity_intent = journey_curiosity_intent + } + add_hook = { + type = strong_obligation_hook + target = $CHARACTER$ + } + custom_tooltip = obligation_hook_tt + } +} + +hire_for_court_position_journey_laamp_replacement_effect = { + show_as_tooltip = { + if = { + limit = { + is_valid_to_hire_court_position_type = $COURT_POSITION$_court_position + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = $COURT_POSITION$_court_position + } + custom_tooltip = will_have_excellent_aptitude + } + else_if = { + limit = { + is_valid_to_hire_court_position_type = $LAAMP_POSITION$_camp_officer + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = $LAAMP_POSITION$_camp_officer + } + custom_tooltip = will_have_excellent_aptitude + } + else = { + $CHARACTER$ = { + add_to_court_and_entourage_effect = yes + } + } + } + + hidden_effect = { + $CHARACTER$ = { + add_to_court_and_entourage_effect = yes + } + } + + if = { + limit = { + is_valid_to_hire_court_position_type = $COURT_POSITION$_court_position + NOT = { exists = scope:current_holder } + } + employ_character_as_position_in_current_scope_court_effect = { + CHARACTER = $CHARACTER$ + POSITION = $COURT_POSITION$ + } + } + else_if = { + limit = { + is_valid_to_hire_court_position_type = $LAAMP_POSITION$_camp_officer + NOT = { exists = scope:current_holder } + } + employ_character_as_position_in_current_scope_camp_effect = { + CHARACTER = $CHARACTER$ + POSITION = $LAAMP_POSITION$ + } + } + else_if = { + limit = { + is_valid_to_hire_court_position_type = $COURT_POSITION$_court_position + exists = scope:current_holder + $CHARACTER$.aptitude:$COURT_POSITION$_court_position > scope:current_holder.aptitude:$COURT_POSITION$_court_position + } + add_character_flag = temporary_court_position_cost_removal + replace_court_position = { + recipient = $CHARACTER$ + holder = scope:current_holder + court_position = $COURT_POSITION$_court_position + } + remove_character_flag = temporary_court_position_cost_removal + } + else_if = { + limit = { + is_valid_to_hire_court_position_type = $LAAMP_POSITION$_camp_officer + exists = scope:current_holder + $CHARACTER$.aptitude:$LAAMP_POSITION$_camp_officer > scope:current_holder.aptitude:$LAAMP_POSITION$_camp_officer + } + add_character_flag = temporary_court_position_cost_removal + replace_court_position = { + recipient = $CHARACTER$ + holder = scope:current_holder + court_position = $LAAMP_POSITION$_camp_officer + } + remove_character_flag = temporary_court_position_cost_removal + } + + add_hook = { + type = strong_obligation_hook + target = $CHARACTER$ + } + custom_tooltip = obligation_hook_tt +} + +hire_for_two_court_position_journey_laamp_replacement_effect = { + show_as_tooltip = { + if = { + limit = { + is_valid_to_hire_court_position_type = $COURT_POSITION$_court_position + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = $COURT_POSITION$_court_position + } + custom_tooltip = will_have_excellent_aptitude + } + else_if = { + limit = { + is_valid_to_hire_court_position_type = $COURT_POSITION_2$_court_position + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = $COURT_POSITION_2$_court_position + } + custom_tooltip = will_have_excellent_aptitude + } + else_if = { + limit = { + is_valid_to_hire_court_position_type = $LAAMP_POSITION$_camp_officer + } + appoint_court_position = { + recipient = $CHARACTER$ + court_position = $LAAMP_POSITION$_camp_officer + } + custom_tooltip = will_have_excellent_aptitude + } + } + + hidden_effect = { + $CHARACTER$ = { + add_to_court_and_entourage_effect = yes + } + } + + if = { + limit = { + is_valid_to_hire_court_position_type = $COURT_POSITION$_court_position + NOT = { exists = scope:current_holder } + } + employ_character_as_position_in_current_scope_court_effect = { + CHARACTER = $CHARACTER$ + POSITION = $COURT_POSITION$ + } + } + else_if = { + limit = { + is_valid_to_hire_court_position_type = $COURT_POSITION_2$_court_position + NOT = { exists = scope:current_holder } + } + employ_character_as_position_in_current_scope_court_effect = { + CHARACTER = $CHARACTER$ + POSITION = $COURT_POSITION_2$ + } + } + else_if = { + limit = { + is_valid_to_hire_court_position_type = $LAAMP_POSITION$_camp_officer + NOT = { exists = scope:current_holder } + } + employ_character_as_position_in_current_scope_camp_effect = { + CHARACTER = $CHARACTER$ + POSITION = $LAAMP_POSITION$ + } + } + else_if = { + limit = { + is_valid_to_hire_court_position_type = $COURT_POSITION$_court_position + exists = scope:current_holder + $CHARACTER$.aptitude:$COURT_POSITION$_court_position > scope:current_holder.aptitude:$COURT_POSITION$_court_position + } + add_character_flag = temporary_court_position_cost_removal + replace_court_position = { + recipient = $CHARACTER$ + holder = scope:current_holder + court_position = $COURT_POSITION$_court_position + } + remove_character_flag = temporary_court_position_cost_removal + } + else_if = { + limit = { + is_valid_to_hire_court_position_type = $COURT_POSITION_2$_court_position + exists = scope:current_holder + $CHARACTER$.aptitude:$COURT_POSITION_2$_court_position > scope:current_holder.aptitude:$COURT_POSITION_2$_court_position + } + add_character_flag = temporary_court_position_cost_removal + replace_court_position = { + recipient = $CHARACTER$ + holder = scope:current_holder + court_position = $COURT_POSITION_2$_court_position + } + remove_character_flag = temporary_court_position_cost_removal + } + else_if = { + limit = { + is_valid_to_hire_court_position_type = $LAAMP_POSITION$_camp_officer + exists = scope:current_holder + $CHARACTER$.aptitude:$LAAMP_POSITION$_camp_officer > scope:current_holder.aptitude:$LAAMP_POSITION$_camp_officer + } + add_character_flag = temporary_court_position_cost_removal + replace_court_position = { + recipient = $CHARACTER$ + holder = scope:current_holder + court_position = $LAAMP_POSITION$_camp_officer + } + remove_character_flag = temporary_court_position_cost_removal + } + + add_hook = { + type = strong_obligation_hook + target = $CHARACTER$ + } + custom_tooltip = obligation_hook_tt +} diff --git a/N3OW/common/scripted_effects/09_dlc_mpo_scripted_effects.txt b/N3OW/common/scripted_effects/09_dlc_mpo_scripted_effects.txt new file mode 100644 index 00000000..6dddeaff --- /dev/null +++ b/N3OW/common/scripted_effects/09_dlc_mpo_scripted_effects.txt @@ -0,0 +1,6572 @@ +# Used in the Migration flow +# Requires: +# scope:actor - the character recieving the title +# scope:target_title - the title in question +creating_kingdom_empire_title_effect = { + save_scope_as = old_title + + if = { + limit = { + scope:target_title.tier = tier_kingdom + } + create_dynamic_title = { + tier = kingdom + name = NEW_CREATED_TITLE_NAME + } + } + else_if = { + limit = { + scope:target_title.tier = tier_empire + } + create_dynamic_title = { + tier = empire + name = NEW_CREATED_TITLE_NAME + } + } + + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + + scope:new_title = { + add_to_list = creating_new_titles + } + + every_in_list = { + list = creating_new_titles + change_title_holder = { + holder = scope:old_holder + change = scope:change + } + } + + resolve_title_and_vassal_change = scope:change + + scope:new_title = { + set_coa = scope:old_title + set_color_from_title = scope:old_title + set_capital_county = scope:old_title.title_capital_county + } + + scope:old_holder = { set_primary_title_to = scope:new_title } +} + +migration_find_fitting_title_effect = { + save_scope_as = old_holder + if = { # If they are losing all their core lands, but it's not their main title, we'll just move them into one of their vassal lands + limit = { + scope:old_holder = { + NOT = { + any_held_county = { + exists = duchy + NOT = { target_is_de_jure_liege_or_above = scope:target_title } + } + } + any_vassal = { + any_held_county = { + exists = duchy + NOT = { target_is_de_jure_liege_or_above = scope:target_title } + } + } + } + NOT = { scope:target_title = scope:old_holder.primary_title } + } + create_title_and_vassal_change = { + type = revoked + save_scope_as = change + } + scope:old_holder = { + ordered_vassal = { + limit = { + any_held_county = { + exists = duchy + NOT = { target_is_de_jure_liege_or_above = scope:target_title } + } + } + order_by = { + value = 1 + if = { + limit = { + government_has_flag = government_is_herder + } + add = 500 + } + subtract = domicile.herd + } + ordered_held_county = { + limit = { + exists = duchy + NOT = { target_is_de_jure_liege_or_above = scope:target_title } + } + order_by = { + value = 1 + add = county_fertility + } + change_title_holder = { + holder = scope:old_holder + change = scope:change + } + } + } + } + resolve_title_and_vassal_change = scope:change + } + if = { # If it is their primary title, we try to find a fitting replacement for them + limit = { + scope:target_title = scope:old_holder.primary_title + } + if = { # For kingdoms and empires, we simply make a dynamic title for one of their leftover titles + limit = { + scope:target_title.tier > tier_duchy + scope:old_holder = { + any_realm_county = { + holder = scope:old_holder + NOT = { target_is_de_jure_liege_or_above = scope:target_title } + } + } + } + scope:old_holder = { + random_realm_county = { + limit = { + holder = scope:old_holder + NOT = { target_is_de_jure_liege_or_above = scope:target_title } + } + creating_kingdom_empire_title_effect = yes + } + } + } + else_if = { # For duchies, we try to find a fitting title, first by checking if they have an uncreated title to one of their lands + limit = { + scope:target_title.holder = scope:old_holder + scope:target_title.tier = tier_duchy + scope:old_holder.capital_province.duchy = { + is_title_created = no + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = change2 + } + scope:old_holder.capital_province.duchy ?= { + change_title_holder = { + holder = scope:old_holder + change = scope:change2 + } + } + resolve_title_and_vassal_change = scope:change2 + } + else_if = { # Or if one of their vassals do + limit = { + scope:target_title = { + tier = tier_duchy + any_direct_de_facto_vassal_title = { + duchy ?= { is_title_created = no } + } + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = change2 + } + scope:target_title = { + random_direct_de_facto_vassal_title = { + limit = { + duchy ?= { is_title_created = no } + } + save_scope_as = old_holder_new_capital + duchy ?= { + add_to_list = title_change + } + } + } + scope:old_holder_new_capital.duchy ?= { + if = { + limit = { + any_de_jure_county = { + holder ?= { government_has_flag = government_is_herder } + holder.liege ?= scope:old_holder + } + } + random_de_jure_county = { + limit = { + holder ?= { government_has_flag = government_is_herder } + holder.liege ?= scope:old_holder + } + add_to_list = title_change + } + } + else_if = { + limit = { + any_de_jure_county = { + holder.liege ?= scope:old_holder + } + } + random_de_jure_county = { + limit = { + holder.liege ?= scope:old_holder + } + add_to_list = title_change + } + } + } + every_in_list = { + list = title_change + change_title_holder = { + holder = scope:old_holder + change = scope:change2 + } + } + resolve_title_and_vassal_change = scope:change2 + } + } +} + +migration_settle_down_obedient_vassal_effect = { + scope:actor = { + ordered_in_list = { + variable = obedient_vassals + order_by = { + value = 1 + domicile ?= { + add = herd + } + } + limit = { + is_landed = no + } + save_scope_as = current_vassal + add_to_list = settled_vassal + } + remove_list_variable = { + name = obedient_vassals + target = scope:current_vassal + } + } + change_title_holder = { + holder = scope:current_vassal + change = scope:change4 + } + set_variable = { + name = migration_previous_culture + years = 5 + value = culture + } + set_county_culture = scope:current_vassal.domicile.domicile_culture + set_county_faith = scope:current_vassal.domicile.domicile_faith + scope:current_vassal = { + change_liege = { + liege = scope:actor + change = scope:change4 + } + } +} + +migration_fitting_vassal_lands_effect = { + if = { + limit = { + scope:target_title.tier >= tier_$UPPER_TIER$ + any_in_list = { + variable = obedient_vassals + count >= 1 + } + } + while = { + limit = { + any_realm_county = { + NOR = { + $LOWER_TIER$ = scope:actor.capital_province.$LOWER_TIER$ + holder = { is_in_list = settled_vassal } + } + } + any_in_list = { + variable = obedient_vassals + count >= 1 + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = change4 + } + ordered_realm_county = { + limit = { + NOR = { + $LOWER_TIER$ = scope:actor.capital_province.$LOWER_TIER$ + holder = { is_in_list = settled_vassal } + } + } + order_by = { + value = 1 + every_de_jure_county = { add = 50 } + $LOWER_TIER$.title_capital_county = { add = county_fertility } + if = { + limit = { + this = $LOWER_TIER$.title_capital_county + } + add = 500 + } + } + migration_settle_down_obedient_vassal_effect = yes + $LOWER_TIER$ = { + if = { + limit = { + OR = { + is_title_created = no + holder ?= { + NOT = { is_in_list = settled_vassal } + OR = { + liege = scope:actor + top_liege = scope:actor + } + } + } + } + change_title_holder = { + holder = scope:current_vassal + change = scope:change4 + } + } + } + } + resolve_title_and_vassal_change = scope:change4 + } + } +} + +migration_message_effect = { + save_scope_as = old_holder + every_neighboring_top_liege_realm_owner = { add_to_temporary_list = old_holder_neighbours } + # Messages for Self + send_interface_message = { + type = msg_migration_into_realm + title = msg_migration_into_realm_title + desc = msg_migration_into_realm_desc + left_icon = scope:actor + right_icon = scope:target_title + } + if = { + limit = { is_tributary = yes } + # Messages for Suzerains and fellow Tributaries + suzerain = { + save_temporary_scope_as = suzerain_temp + add_to_temporary_list = old_holder_suzerain # for debugging + send_interface_message = { + type = msg_migration_into_realm + title = msg_migration_into_realm_tributary_title + desc = msg_migration_into_realm_tributary_desc + left_icon = scope:actor + right_icon = scope:old_holder + } + every_player = { + limit = { + is_tributary_of = scope:suzerain_temp + NOT = { this = scope:old_holder } # Self + } + send_interface_message = { + type = msg_migration_into_realm + title = msg_migration_into_realm_fellow_tributary_title + desc = msg_migration_into_realm_fellow_tributary_desc + left_icon = scope:actor + right_icon = scope:old_holder + } + } + clear_saved_scope = suzerain_temp + } + } + else_if = { + limit = { is_independent_ruler = no } + # Messages for Lieges and fellow Vassals + top_liege = { + save_temporary_scope_as = top_liege_temp + add_to_temporary_list = old_holder_top_liege # for debugging + send_interface_message = { + type = msg_migration_into_realm + title = msg_migration_into_realm_vassal_title + desc = msg_migration_into_realm_vassal_desc + left_icon = scope:actor + right_icon = scope:old_holder + } + every_player = { + limit = { + is_vassal_of = scope:top_liege_temp + NOT = { this = scope:old_holder } # Self + } + send_interface_message = { + type = msg_migration_into_realm + title = msg_migration_into_realm_fellow_vassal_title + desc = msg_migration_into_realm_fellow_vassal_desc + left_icon = scope:actor + right_icon = scope:old_holder + } + } + } + clear_saved_scope = top_liege_temp + } + # Messages for Vassals + every_player = { + limit = { is_vassal_of = scope:old_holder } + send_interface_message = { + type = msg_migration_into_realm + title = msg_migration_into_realm_tributary_title + desc = msg_migration_into_realm_tributary_desc + left_icon = scope:actor + right_icon = scope:old_holder + } + } + # Messages for Tributaries + every_player = { + limit = { is_tributary_of = scope:old_holder } + send_interface_message = { + type = msg_migration_into_realm + title = msg_migration_into_suzerain_title + desc = msg_migration_into_suzerain_desc + left_icon = scope:actor + right_icon = scope:old_holder + } + } + # Messages for Neighbours + every_player = { + limit = { + is_in_list = old_holder_neighbours + NOR = { # Exclude all those who have already had a message + this = scope:actor + is_in_list = old_holder # Self + is_in_list = old_holder_suzerain # Suzerains + suzerain = { is_in_list = old_holder_suzerain } # Fellow Tributaries + is_in_list = old_holder_top_liege # Lieges + top_liege = { is_in_list = old_holder_top_liege } # Fellow Vassals + is_vassal_of = scope:old_holder # Vassals + is_tributary_of = scope:old_holder # Tributaries + var:migration_neighbour_cooldown ?= scope:actor # Avoid duplicates + } + } + set_variable = { + name = migration_neighbour_cooldown + value = scope:actor + days = 1 + } + send_interface_message = { + type = msg_migration_into_neighbour + title = msg_migration_into_neighbour_title + desc = msg_migration_into_neighbour_desc + left_icon = scope:actor + right_icon = scope:old_holder.top_liege + } + } + clear_saved_scope = old_holder +} + +migration_title_and_vassal_change_effect = { + scope:domain ?= { + if = { + limit = { + tier = tier_county + } + holder = { + add_to_list = old_holder + } + } + else = { + every_de_jure_county_holder = { + limit = { + is_independent_ruler = yes + } + add_to_list = old_holder + } + } + } + scope:target_title.holder ?= { + add_to_list = old_holder + } + + # Change 1: The old holder will attempt to create a new title for their lands, if they are losing their primary title + every_in_list = { + list = old_holder + # Inform relevant people + migration_message_effect = yes + # Run effects + migration_find_fitting_title_effect = yes + } + + # Change 2: Hand out titles to actor + create_title_and_vassal_change = { + type = migration + save_scope_as = change1 + add_claim_on_loss = yes + } + scope:target_title ?= { + change_title_holder = { + holder = scope:actor + change = scope:change1 + } + } + if = { + limit = { + NOT = { scope:domain = scope:target_title } + } + scope:domain = { + change_title_holder = { + holder = scope:actor + change = scope:change1 + } + } + } + if = { + limit = { + scope:domain.tier = tier_duchy + } + scope:domain = { + every_de_jure_county = { + change_title_holder = { + holder = scope:actor + change = scope:change1 + } + } + } + } + if = { + limit = { + scope:target_title.tier >= tier_kingdom + } + scope:target_title ?= { + every_de_jure_county_holder = { + limit = { + OR = { + any_in_list = { + list = old_holder + this = prev + } + this = scope:recipient + AND = { + scope:recipient = this.liege + any_held_county = { + exists = duchy + NOT = { target_is_de_jure_liege_or_above = scope:target_title } + } + } + } + } + change_title_holder = { + holder = scope:actor + change = scope:change1 + } + } + } + scope:target_title = { + every_de_jure_county_holder = { + limit = { + OR = { + any_in_list = { + list = old_holder + NOT = { this = prev } + this = prev.liege + } + AND = { + NOT = { this = scope:recipient } + scope:recipient = this.liege + } + } + NOT = { this = scope:actor } + } + add_to_list = new_vassals + } + } + } + every_in_list = { + list = new_vassals + change_liege = { + liege = scope:actor + change = scope:change1 + } + } + resolve_title_and_vassal_change = scope:change1 + + # Change 3: Free vassals who don't belong in the new title + scope:actor = { + every_vassal = { + limit = { + NOT = { + any_held_county = { + target_is_de_jure_liege_or_above = scope:target_title + } + } + } + create_title_and_vassal_change = { + type = independency + save_scope_as = change + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + + # Change 4: Destroy top title of a nomad who doesn't have any land anymore + every_in_list = { + list = old_holder + if = { + limit = { + NOT = { + any_held_title = { + tier = tier_county + exists = duchy + } + } + any_held_title = { + tier >= tier_county + is_landless_type_title = no + } + } + every_held_title = { + limit = { + tier >= tier_county + is_landless_type_title = no + } + prev = { destroy_title = prev } + } + } + } + + # Change 5: Settle down previously obedient vassals in new lands + scope:actor = { + if = { + limit = { + any_in_list = { + variable = obedient_vassals + count >= 1 + } + } + # Empire solution + migration_fitting_vassal_lands_effect = { + UPPER_TIER = empire + LOWER_TIER = kingdom + } + # Kingdom solution + migration_fitting_vassal_lands_effect = { + UPPER_TIER = kingdom + LOWER_TIER = duchy + } + # Duchy solution + if = { + limit = { + scope:target_title.tier >= tier_duchy + domain_limit_available < 0 + any_in_list = { + variable = obedient_vassals + count >= 1 + } + } + while = { + limit = { + domain_limit_available < 0 + any_in_list = { + variable = obedient_vassals + count >= 1 + } + any_held_county = { + exists = duchy + NOT = { this = scope:actor.capital_province.county } + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = change4 + } + ordered_held_county = { + limit = { + exists = duchy + NOT = { this = scope:actor.capital_province.county } + } + order_by = { + value = 1 + if = { + limit = { + NOT = { + any_neighboring_county = { + this = scope:actor.capital_province.county + } + } + } + add = 100 + } + } + migration_settle_down_obedient_vassal_effect = yes + } + resolve_title_and_vassal_change = scope:change4 + } + } + # Clean up liege setup + create_title_and_vassal_change = { + type = granted + save_scope_as = change4 + } + every_vassal = { + limit = { + exists = primary_title.de_jure_liege.holder + } + change_liege = { + liege = primary_title.de_jure_liege.holder + change = scope:change4 + } + } + resolve_title_and_vassal_change = scope:change4 + } + } + + # Change 6: If you cannot find land for your old obedient vassals, just destroy their camp and make them a part of your court + scope:actor = { + every_in_list = { + variable = obedient_vassals + limit = { + is_landed = no + } + save_scope_as = current_vassal + every_courtier_or_guest = { + set_employer = scope:actor + } + destroy_title = primary_title + root = { + remove_list_variable = { + name = obedient_vassals + target = scope:current_vassal + } + } + set_employer = scope:actor + } + } + + # Change 7: Move domiciles so they are in the right provinces + every_in_list = { + list = old_holder + domicile ?= { move_domicile = prev.capital_province } + every_vassal = { + domicile ?= { move_domicile = prev.capital_province } + } + } + scope:actor = { + domicile ?= { move_domicile = prev.capital_province } + every_vassal = { + domicile ?= { move_domicile = prev.capital_province } + } + } + + # Change 8: If for some reason you have any vassals who are still your subjects, but don't hold land, they will become independent + scope:actor = { + every_vassal = { + limit = { + NOT = { + any_held_county = { + exists = duchy + } + } + } + create_title_and_vassal_change = { + type = independency + save_scope_as = change + } + becomes_independent = { + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + + # Inform nearby peeps + every_player = { + limit = { + NOR = { + this = scope:actor + is_in_list = old_holder_suzerain + suzerain = { is_in_list = old_holder_suzerain } + is_in_list = old_holder_top_liege + top_liege = { is_in_list = old_holder_top_liege } + } + is_in_list = old_holder_neighbours + } + } + + # Debugging + if = { + limit = { debug_only = yes } + debug_log = "Migration completed" + debug_log_scopes = yes + } +} + +migration_set_obedient_vassal_effect = { + create_title_and_vassal_change = { + type = migration + save_scope_as = change + } + every_realm_county = { + limit = { + holder = scope:current_vassal + is_nomad_title = no + is_noble_family_title = no + } + create_character = { + template = herder_character + faith = scope:current_vassal.domicile.domicile_faith + culture = scope:current_vassal.domicile.domicile_culture + location = scope:current_vassal.primary_title.title_capital_county.title_province + save_scope_as = herder_character + after_creation = { + remove_character_flag = peasant_outfit + add_to_list = government_change + } + } + change_title_holder = { + holder = scope:herder_character + change = scope:change + } + title_province = { + if = { + limit = { + has_holding_type = nomad_holding + } + set_holding_type = herder_holding + } + } + } + resolve_title_and_vassal_change = scope:change + every_held_title = { + limit = { + tier >= tier_duchy + } + prev = { destroy_title = prev } + } + + every_in_list = { + list = government_change + change_government = herder_government + remove_from_list = government_change + } + + scope:actor = { + add_to_variable_list = { + name = obedient_vassals + target = scope:current_vassal + } + } +} + +offer_confederation_accepter_effect = { + if = { + limit = { + scope:actor = { + is_confederation_member = no + } + } + custom_tooltip = create_confederation_recipient_tt + } + else = { + custom_tooltip = join_confederation_recipient_tt + } + custom_tooltip = confederation_defensive_wars_tt + custom_tooltip = unlock_leave_confederation_interaction_tt +} + +confederation_realm_transfer_effect = { + save_scope_as = transfer_liege + every_vassal = { + limit = { + highest_held_title_tier >= tier_county + primary_title = { + NOT = { + any_this_title_or_de_jure_above = { + holder = scope:transfer_liege + } + } + } + } + add_to_list = vassals_to_transfer + } + add_to_list = vassals_to_transfer + create_title_and_vassal_change = { + type = granted + save_scope_as = change_3 + add_claim_on_loss = no + } + primary_title = { + change_title_holder = { + holder = $CHARACTER$ + change = scope:change_3 + } + } + resolve_title_and_vassal_change = scope:change_3 + + every_in_list = { + custom = custom.every_non_de_jure_vassal + list = vassals_to_transfer + create_title_and_vassal_change = { + type = swear_fealty + save_scope_as = change_4 + } + change_liege = { + liege = $CHARACTER$ + change = scope:change_4 + } + resolve_title_and_vassal_change = scope:change_4 + } +} + +mpo_mongol_recovered_head_content_effect = { + if = { + limit = { + any_side_participant = { + has_variable = beheaded_warrior + is_ruler = yes + } + } + every_side_participant = { + limit = { + has_variable = beheaded_warrior + is_ruler = yes + } + save_scope_as = beheaded_liege + random_list = { + 1 = { + trigger = { + is_alive = yes + is_imprisoned = no + } + modifier = { + OR = { + is_consort_of = var:beheaded_warrior + is_close_family_of = var:beheaded_warrior + } + add = 20 + } + modifier = { + has_variable = beheaded_warrior_powerful_vassal + add = 1 + } + trigger_event = { + id = mpo_nomad_events.1001 + days = 1 + } + add_character_flag = { + flag = beheaded_warrior_cooldown + years = 2 + } + } + 4 = { + modifier = { + OR = { + has_multiple_players = yes + is_ai = yes + } + factor = 2 + } + remove_variable = beheaded_warrior + remove_variable = beheaded_warrior_foe + remove_variable = beheaded_warrior_councillor + remove_variable = beheaded_warrior_powerful_vassal + remove_variable = beheaded_warrior_accolade + remove_variable = beheaded_warrior_location + } + } + } + } +} + +mpo_beheaded_warrior_artifact_creation_effect = { + #Important character to an emperor - high tier artifact + if = { + limit = { + highest_held_title_tier >= tier_empire + mpo_important_beheaded_warrior_trigger = yes + } + random_list = { + 2 = { + trigger = { + scope:beheaded_warrior = { + is_close_family_of = root + } + } + create_artifact = { + name = warriors_head_artifact + description = kin_head_artifact_desc + rarity = famed + type = miscellaneous + modifier = kin_head_modifier_tier_3 + decaying = yes + template = mpo_severed_head_template + visuals = pocket_severed_head + creator = scope:beheaded_warrior + save_scope_as = head_artifact + } + scope:head_artifact = { + add_scaled_artifact_modifier_dynasty_prestige_effect = yes + } + } + 1 = { + trigger = { + has_variable = beheaded_warrior_accolade + } + create_artifact = { + name = warriors_head_artifact + description = accolade_head_artifact_desc + rarity = famed + type = miscellaneous + modifier = accolade_head_modifier_tier_3 + decaying = yes + template = mpo_severed_head_template + visuals = pocket_severed_head + creator = scope:beheaded_warrior + save_scope_as = head_artifact + } + } + 1 = { + create_artifact = { + name = warriors_head_artifact + description = warriors_head_artifact_desc + rarity = famed + type = miscellaneous + modifier = warriors_head_modifier_tier_3 + decaying = yes + template = mpo_severed_head_template + visuals = pocket_severed_head + creator = scope:beheaded_warrior + save_scope_as = head_artifact + } + } + 1 = { + create_artifact = { + name = warriors_head_artifact + description = warriors_head_artifact_desc + rarity = famed + type = miscellaneous + modifier = warriors_head_modifier_tier_3_alt + decaying = yes + template = mpo_severed_head_template + visuals = pocket_severed_head + creator = scope:beheaded_warrior + save_scope_as = head_artifact + } + } + 1 = { + create_artifact = { + name = warriors_head_artifact + description = warriors_head_artifact_desc + rarity = famed + type = miscellaneous + modifier = warriors_head_modifier_tier_3_alt_2 + decaying = yes + template = mpo_severed_head_template + visuals = pocket_severed_head + creator = scope:beheaded_warrior + save_scope_as = head_artifact + } + } + 1 = { + create_artifact = { + name = warriors_head_artifact + description = warriors_head_artifact_desc + rarity = famed + type = miscellaneous + modifier = warriors_head_modifier_tier_3_alt_3 + decaying = yes + template = mpo_severed_head_template + visuals = pocket_severed_head + creator = scope:beheaded_warrior + save_scope_as = head_artifact + } + } + } + } + #Mid-tier character + else_if = { + limit = { + OR = { + highest_held_title_tier >= tier_empire + AND = { + highest_held_title_tier >= tier_kingdom + mpo_important_beheaded_warrior_trigger = yes + } + } + } + random_list = { + 2 = { + trigger = { + scope:beheaded_warrior = { + is_close_family_of = root + } + } + create_artifact = { + name = warriors_head_artifact + description = kin_head_artifact_desc + rarity = masterwork + type = miscellaneous + modifier = kin_head_modifier_tier_2 + decaying = yes + template = mpo_severed_head_template + visuals = pocket_severed_head + creator = scope:beheaded_warrior + save_scope_as = head_artifact + } + scope:head_artifact = { + add_scaled_artifact_modifier_dynasty_prestige_effect = yes + } + } + 1 = { + trigger = { + has_variable = beheaded_warrior_accolade + } + create_artifact = { + name = warriors_head_artifact + description = accolade_head_artifact_desc + rarity = masterwork + type = miscellaneous + modifier = accolade_head_modifier_tier_2 + decaying = yes + template = mpo_severed_head_template + visuals = pocket_severed_head + creator = scope:beheaded_warrior + save_scope_as = head_artifact + } + } + 1 = { + create_artifact = { + name = warriors_head_artifact + description = warriors_head_artifact_desc + rarity = masterwork + type = miscellaneous + modifier = warriors_head_modifier_tier_2 + decaying = yes + template = mpo_severed_head_template + visuals = pocket_severed_head + creator = scope:beheaded_warrior + save_scope_as = head_artifact + } + } + 1 = { + create_artifact = { + name = warriors_head_artifact + description = warriors_head_artifact_desc + rarity = masterwork + type = miscellaneous + modifier = warriors_head_modifier_tier_2_alt + decaying = yes + template = mpo_severed_head_template + visuals = pocket_severed_head + creator = scope:beheaded_warrior + save_scope_as = head_artifact + } + } + 1 = { + create_artifact = { + name = warriors_head_artifact + description = warriors_head_artifact_desc + rarity = masterwork + type = miscellaneous + modifier = warriors_head_modifier_tier_2_alt_2 + decaying = yes + template = mpo_severed_head_template + visuals = pocket_severed_head + creator = scope:beheaded_warrior + save_scope_as = head_artifact + } + } + 1 = { + create_artifact = { + name = warriors_head_artifact + description = warriors_head_artifact_desc + rarity = masterwork + type = miscellaneous + modifier = warriors_head_modifier_tier_2_alt_3 + decaying = yes + template = mpo_severed_head_template + visuals = pocket_severed_head + creator = scope:beheaded_warrior + save_scope_as = head_artifact + } + } + } + } + #Low tier character + else = { + random_list = { + 2 = { + trigger = { + scope:beheaded_warrior = { + is_close_family_of = root + } + } + create_artifact = { + name = warriors_head_artifact + description = kin_head_artifact_desc + rarity = common + type = miscellaneous + modifier = kin_head_modifier_tier_1 + decaying = yes + template = mpo_severed_head_template + visuals = pocket_severed_head + creator = scope:beheaded_warrior + save_scope_as = head_artifact + } + scope:head_artifact = { + add_scaled_artifact_modifier_dynasty_prestige_effect = yes + } + } + 1 = { + trigger = { + has_variable = beheaded_warrior_accolade + } + create_artifact = { + name = warriors_head_artifact + description = accolade_head_artifact_desc + rarity = common + type = miscellaneous + modifier = accolade_head_modifier_tier_1 + decaying = yes + template = mpo_severed_head_template + visuals = pocket_severed_head + creator = scope:beheaded_warrior + save_scope_as = head_artifact + } + } + 1 = { + create_artifact = { + name = warriors_head_artifact + description = warriors_head_artifact_desc + rarity = common + type = miscellaneous + modifier = warriors_head_modifier_tier_1 + decaying = yes + template = mpo_severed_head_template + visuals = pocket_severed_head + creator = scope:beheaded_warrior + save_scope_as = head_artifact + } + } + 1 = { + create_artifact = { + name = warriors_head_artifact + description = warriors_head_artifact_desc + rarity = common + type = miscellaneous + modifier = warriors_head_modifier_tier_1_alt + decaying = yes + template = mpo_severed_head_template + visuals = pocket_severed_head + creator = scope:beheaded_warrior + save_scope_as = head_artifact + } + } + 1 = { + create_artifact = { + name = warriors_head_artifact + description = warriors_head_artifact_desc + rarity = common + type = miscellaneous + modifier = warriors_head_modifier_tier_1_alt_2 + decaying = yes + template = mpo_severed_head_template + visuals = pocket_severed_head + creator = scope:beheaded_warrior + save_scope_as = head_artifact + } + } + 1 = { + create_artifact = { + name = warriors_head_artifact + description = warriors_head_artifact_desc + rarity = common + type = miscellaneous + modifier = warriors_head_modifier_tier_1_alt_3 + decaying = yes + template = mpo_severed_head_template + visuals = pocket_severed_head + creator = scope:beheaded_warrior + save_scope_as = head_artifact + } + } + } + } + save_scope_as = owner + hidden_effect = { + scope:head_artifact = { + add_scaled_artifact_modifier_combat_effect = yes + set_max_durability = 50 + } + } +} + +mpo_execution_head_artifact_creation_effect = { + save_scope_as = owner + #This is an emperor's head + if = { + limit = { + has_character_flag = execution_head_illustrious_flag + } + create_artifact = { + name = executed_head_artifact + description = executed_head_emperor_artifact_desc + rarity = illustrious + type = miscellaneous + modifier = artifact_monthly_prestige_gain_per_dread_add_4_modifier + decaying = yes + template = mpo_severed_head_template + visuals = pocket_severed_head + creator = scope:victim + save_scope_as = head_artifact + } + } + else = { + create_artifact = { + name = executed_head_artifact + description = executed_head_king_artifact_desc + rarity = famed + type = miscellaneous + modifier = artifact_monthly_prestige_gain_per_dread_add_3_modifier + decaying = yes + template = mpo_severed_head_template + visuals = pocket_severed_head + creator = scope:victim + save_scope_as = head_artifact + } + } + if = { + limit = { + scope:head_artifact = { + NOT = { + artifact_owner = { + this = root + } + } + } + } + scope:head_artifact = { + set_owner = root + } + } + + random_list = { + 4 = { + trigger = { + OR = { + is_at_war_with = scope:headless_heir + is_causing_raid_hostility_towards = scope:headless_heir + } + } + scope:head_artifact = { + add_2_scaled_artifact_modifier_combat_effect = yes + } + } + 1 = { + trigger = { + scope:headless_heir = { + government_has_flag = government_is_nomadic + } + } + scope:head_artifact = { + add_scaled_artifact_modifier_archer_cavalry_damage_add_effect = yes + add_scaled_artifact_modifier_minor_prestige_effect = yes + } + } + 1 = { + trigger = { + OR = { + scope:victim.faith = { + NOT = { + this = root.faith + } + } + scope:victim = { + has_trait = zealous + } + scope:victim = { + has_trait = pilgrim + } + scope:headless_heir.primary_title = { + is_head_of_faith = yes + } + } + } + scope:head_artifact = { + add_scaled_artifact_modifier_piety_effect = yes + } + scope:head_artifact = { + add_scaled_artifact_modifier_devotion_effect = yes + } + } + 1 = { + trigger = { + OR = { + scope:victim.faith = { + NOT = { + this = root.faith + } + } + scope:victim = { + has_trait = zealous + } + scope:victim = { + has_trait = pilgrim + } + scope:headless_heir.primary_title = { + is_head_of_faith = yes + } + } + } + scope:head_artifact = { + add_2_scaled_artifact_modifier_devotion_effect = yes + } + } + 1 = { + scope:head_artifact = { + add_scaled_artifact_modifier_grandeur_big_effect = yes + } + } + 1 = { + scope:head_artifact = { + add_2_scaled_artifact_modifier_majesty_effect = yes + } + } + 1 = { + trigger = { + scope:victim = { + OR = { + has_trait = education_stewardship_4 + has_trait = education_stewardship_5 + has_trait = administrator + has_trait = avaricious + has_trait = architect + stewardship >= very_high_skill_rating + } + } + } + scope:head_artifact = { + add_2_scaled_artifact_modifier_rulership_effect = yes + } + } + 1 = { + trigger = { + exists = root.dynasty + NOT = { + scope:victim.dynasty ?= { + this = root.dynasty + } + } + } + scope:head_artifact = { + add_scaled_artifact_modifier_dynasty_prestige_effect = yes + add_scaled_artifact_modifier_hire_mercenary_effect = yes + } + } + } + hidden_effect = { + scope:head_artifact = { + set_max_durability = 50 + } + } +} + +### PAIZA ### + +ai_paiza_giveaway_effect = { + random_courtier = { + limit = { + NOT = { + any_character_artifact = { + scope:artifact.var:paiza_patron ?= root + } + } + } + mpo_create_paiza_artifact_effect = { + PATRON = root + GRANTEE = this + } + } + random_vassal = { + limit = { + NOT = { + any_character_artifact = { + scope:artifact.var:paiza_patron ?= root + } + } + } + mpo_create_paiza_artifact_effect = { + PATRON = root + GRANTEE = this + } + } +} + +mpo_find_suitable_merchant_effect = { + random_list = { + 1 = { #Merv + trigger = { + title:c_bukhara = { + development_level >= 30 + NOT = { + holder.top_liege = { + government_has_flag = government_is_nomadic + } + } + } + } + modifier = { + add = title:c_bukhara.development_level + } + title:b_bukhara = { + save_scope_as = merchant_origin + } + } + 1 = { #Nishapur + trigger = { + title:c_nishapur = { + development_level >= 30 + NOT = { + holder.top_liege = { + government_has_flag = government_is_nomadic + } + } + } + } + modifier = { + add = title:c_nishapur.development_level + } + title:b_nishapur = { + save_scope_as = merchant_origin + } + } + 1 = { #Khotan + trigger = { + title:c_khotan = { + development_level >= 30 + NOT = { + holder.top_liege = { + government_has_flag = government_is_nomadic + } + } + } + } + modifier = { + add = title:c_khotan.development_level + } + title:b_khotan = { + save_scope_as = merchant_origin + } + } + 1 = { #Wroclaw + trigger = { + title:c_breslau = { + development_level >= 30 + NOT = { + holder.top_liege = { + government_has_flag = government_is_nomadic + } + } + } + } + modifier = { + add = title:c_breslau.development_level + } + title:b_breslau = { + save_scope_as = merchant_origin + } + } + 1 = { #Krakow + trigger = { + title:c_krakowska = { + development_level >= 30 + NOT = { + holder.top_liege = { + government_has_flag = government_is_nomadic + } + } + } + } + modifier = { + add = title:c_krakowska.development_level + } + title:b_krakow = { + save_scope_as = merchant_origin + } + } + 1 = { #Novgorod + trigger = { + title:c_novgorod = { + development_level >= 30 + NOT = { + holder.top_liege = { + government_has_flag = government_is_nomadic + } + } + } + } + modifier = { + add = title:c_novgorod.development_level + } + title:b_novgorod = { + save_scope_as = merchant_origin + } + } + 1 = { #Kyiv + trigger = { + title:c_kiev = { + development_level >= 30 + NOT = { + holder.top_liege = { + government_has_flag = government_is_nomadic + } + } + } + } + modifier = { + add = title:c_kiev.development_level + } + title:b_kiev = { + save_scope_as = merchant_origin + } + } + 1 = { #Baghdad + trigger = { + title:c_baghdad = { + development_level >= 30 + NOT = { + holder.top_liege = { + government_has_flag = government_is_nomadic + } + } + } + } + modifier = { + add = title:c_baghdad.development_level + } + title:b_baghdad = { + save_scope_as = merchant_origin + } + } + 1 = { #Pisa + trigger = { + title:c_pisa = { + development_level >= 30 + NOT = { + holder.top_liege = { + government_has_flag = government_is_nomadic + } + } + } + } + modifier = { + add = title:c_pisa.development_level + } + title:b_pisa = { + save_scope_as = merchant_origin + } + } + 1 = { #Venice + trigger = { + title:c_baghdad = { + development_level >= 30 + NOT = { + holder.top_liege = { + government_has_flag = government_is_nomadic + } + } + } + } + modifier = { + add = title:c_baghdad.development_level + } + title:b_baghdad = { + save_scope_as = merchant_origin + } + } + 1 = { #Cairo + trigger = { + title:c_cairo = { + development_level >= 30 + NOT = { + holder.top_liege = { + government_has_flag = government_is_nomadic + } + } + } + } + modifier = { + add = title:c_cairo.development_level + } + title:b_cairo = { + save_scope_as = merchant_origin + } + } + 1 = { #Genua + trigger = { + title:c_genoa = { + development_level >= 30 + NOT = { + holder.top_liege = { + government_has_flag = government_is_nomadic + } + } + } + } + modifier = { + add = title:c_genoa.development_level + } + title:b_genoa = { + save_scope_as = merchant_origin + } + } + 1 = { #Constantinople + #something has to be in constantinople + modifier = { + add = title:c_byzantion.development_level + } + title:b_constantinople = { + save_scope_as = merchant_origin + } + } + } + hidden_effect = { + scope:merchant_origin.county = { + save_scope_as = merchant_county + } + create_character = { + location = scope:merchant_origin.county.title_province + template = foreign_merchant_template + save_scope_as = paiza_merchant + } + scope:paiza_merchant = { + add_gold = { + value = root.tiny_gold_value + multiply = 21.37 + } + } + } +} + +#scope:patron is the creator +#scope:receiver is who gets it +mpo_create_paiza_artifact_effect = { + $PATRON$ = { + save_scope_as = patron + } + $GRANTEE$ = { + save_scope_as = grantee + } + save_scope_value_as = { + name = wealth + value = { + value = 20 + multiply = { + value = scope:patron.primary_title.tier + add = scope:patron.dominance_value + } + } + } + save_scope_value_as = { + name = quality + value = { + value = 20 + multiply = { + value = scope:patron.primary_title.tier + add = scope:patron.dominance_value + } + } + } + scope:grantee = { + create_artifact = { + name = paiza_artifact_title + type = miscellaneous + template = paiza_artifact_template + creator = scope:patron + description = paiza_artifact_desc + visuals = paiza + wealth = scope:wealth + quality = scope:quality + modifier = artifact_steppe_danger_travel_high_modifier + modifier = artifact_steppe_advantage_2_modifier + save_scope_as = created_paiza + } + } + scope:created_paiza = { + set_variable = { + name = paiza_patron + value = scope:patron + } + } +} + + +mpo_paiza_innovation_reward_effect = { + switch = { + trigger = has_domicile_parameter + nomad_yurt_increased_innovation_paiza_lvl_1 = { + root = { + add_character_modifier = { + modifier = mpo_fascination_leap_modifier + years = 4 + } + } + } + nomad_yurt_increased_innovation_paiza_lvl_2 = { + root = { + add_character_modifier = { + modifier = mpo_fascination_leap_modifier + years = 6 + } + if = { + limit = { + culture = { + can_get_innovation_from = scope:merchant_origin.county.culture + } + } + culture = { + get_random_innovation_from = scope:merchant_origin.county.culture + } + } + } + } + nomad_yurt_increased_innovation_paiza_lvl_3 = { + root = { + add_character_modifier = { + modifier = mpo_fascination_leap_modifier + years = 8 + } + if = { + limit = { + culture = { + can_get_innovation_from = scope:merchant_origin.county.culture + } + } + culture = { + get_random_innovation_from = scope:merchant_origin.county.culture + } + } + if = { + limit = { + culture = { + can_get_innovation_from = scope:merchant_origin.county.culture + } + } + culture = { + get_random_innovation_from = scope:merchant_origin.county.culture + } + } + } + } + } + + root = { + if = { + limit = { + NOT = { + domicile ?= { has_domicile_building_or_higher = innovation_yurt_02 } + } + } + add_character_modifier = { + modifier = mpo_fascination_leap_modifier + years = 2 + } + } + } + +} + + +mpo_paiza_deal_grade_effect = { + if = { + limit = { + has_character_flag = established_paiza_system + } + set_variable = { + name = trade_gold_value + value = { + value = scope:paiza_merchant.var:paiza_gold_invested + multiply = 0.4 + } + } + } + else = { + set_variable = { + name = trade_gold_value + value = { + value = scope:paiza_merchant.var:paiza_gold_invested + multiply = 0.2 + } + } + } + + set_variable = { + name = trade_gold_percent + value = 1 + } + change_variable = { + name = trade_gold_percent + add = { + add = scope:paiza_merchant.sum_of_all_skills_value + multiply = 0.01 + max = 4 + min = 0 + } + } + #custom_tooltip = paiza_merchant_skill_gold_percent + domicile ?= { + switch = { + trigger = has_domicile_parameter + nomad_yurt_paiza_more_gold_lvl_1 = { + custom_tooltip = paiza_yurt_gold_percent_1 + root = { + change_variable = { + name = trade_gold_percent + add = 0.05 + } + } + } + nomad_yurt_paiza_more_gold_lvl_2 = { + custom_tooltip = paiza_yurt_gold_percent_2 + root = { + change_variable = { + name = trade_gold_percent + add = 0.1 + } + } + } + nomad_yurt_paiza_more_gold_lvl_3 = { + custom_tooltip = paiza_yurt_gold_percent_3 + root = { + change_variable = { + name = trade_gold_percent + add = 0.2 + } + } + } + } + } + change_variable = { + name = trade_gold_value + multiply = root.var:trade_gold_percent + } +} + + +mpo_yurts_paiza_bonuses_tooltip_effect = { + if = { + limit = { + domicile ?= { + OR = { + has_domicile_building_or_higher = fertility_trade_yurt_01 + has_domicile_building_or_higher = herd_trade_yurt_01 + has_domicile_building_or_higher = knight_trade_yurt_01 + has_domicile_building_or_higher = merchant_yurt_01 + has_domicile_building_or_higher = char_trade_yurt_01 + } + } + } + custom_tooltip = yurt_paiza_bonuses_generic + } + + domicile ?= { + if = { + limit = { + has_domicile_building_or_higher = fertility_trade_yurt_01 + } + switch = { + trigger = has_domicile_parameter + nomad_yurt_paiza_fertility_gain_lvl_1 = { custom_tooltip = nomad_yurt_paiza_fertility_gain_lvl_1_tooltip } + nomad_yurt_paiza_fertility_gain_lvl_2 = { custom_tooltip = nomad_yurt_paiza_fertility_gain_lvl_2_tooltip } + nomad_yurt_paiza_fertility_gain_lvl_3 = { custom_tooltip = nomad_yurt_paiza_fertility_gain_lvl_3_tooltip } + } + } + if = { + limit = { + has_domicile_building_or_higher = herd_trade_yurt_01 + } + switch = { + trigger = has_domicile_parameter + nomad_yurt_paiza_herd_gain_lvl_1 = { custom_tooltip = nomad_yurt_paiza_herd_gain_lvl_1_tooltip } + nomad_yurt_paiza_herd_gain_lvl_2 = { custom_tooltip = nomad_yurt_paiza_herd_gain_lvl_2_tooltip } + nomad_yurt_paiza_herd_gain_lvl_3 = { custom_tooltip = nomad_yurt_paiza_herd_gain_lvl_3_tooltip } + } + } + if = { + limit = { + has_domicile_building_or_higher = knight_trade_yurt_01 + } + switch = { + trigger = has_domicile_parameter + nomad_yurt_paiza_maa_gain_lvl_1 = { custom_tooltip = nomad_yurt_paiza_maa_gain_lvl_1_tooltip } + nomad_yurt_paiza_maa_gain_lvl_2 = { custom_tooltip = nomad_yurt_paiza_maa_gain_lvl_2_tooltip } + nomad_yurt_paiza_maa_gain_lvl_3 = { custom_tooltip = nomad_yurt_paiza_maa_gain_lvl_3_tooltip } + } + } + if = { + limit = { + has_domicile_building_or_higher = merchant_yurt_01 + } + switch = { + trigger = has_domicile_parameter + nomad_yurt_paiza_more_gold_lvl_1 = { custom_tooltip = nomad_yurt_paiza_more_gold_lvl_1_tooltip } + nomad_yurt_paiza_more_gold_lvl_2 = { custom_tooltip = nomad_yurt_paiza_more_gold_lvl_2_tooltip } + nomad_yurt_paiza_more_gold_lvl_3 = { custom_tooltip = nomad_yurt_paiza_more_gold_lvl_3_tooltip } + } + } + if = { + limit = { + has_domicile_building_or_higher = char_trade_yurt_01 + } + switch = { + trigger = has_domicile_parameter + nomad_yurt_paiza_char_gain_lvl_1 = { custom_tooltip = nomad_yurt_paiza_char_gain_lvl_1_tooltip } + nomad_yurt_paiza_char_gain_lvl_2 = { custom_tooltip = nomad_yurt_paiza_char_gain_lvl_2_tooltip } + nomad_yurt_paiza_char_gain_lvl_3 = { custom_tooltip = nomad_yurt_paiza_char_gain_lvl_3_tooltip } + } + } + } +} + +mpo_yurts_paiza_bonuses_effect = { + if = { + limit = { + domicile ?= { + OR = { + has_domicile_building_or_higher = fertility_trade_yurt_01 + has_domicile_building_or_higher = herd_trade_yurt_01 + has_domicile_building_or_higher = knight_trade_yurt_01 + has_domicile_building_or_higher = merchant_yurt_01 + has_domicile_building_or_higher = char_trade_yurt_01 + } + } + } + custom_tooltip = yurt_paiza_bonuses_generic + } + domicile ?= { + if = { + limit = { + has_domicile_building_or_higher = fertility_trade_yurt_01 + } + switch = { + trigger = has_domicile_parameter + nomad_yurt_paiza_fertility_gain_lvl_1 = { + root = { + every_held_county = { + limit = { + uses_county_fertility = yes + } + add_county_modifier = { + modifier = paiza_fertility_modifier_1 + years = 2 + } + } + } + } + nomad_yurt_paiza_fertility_gain_lvl_2 = { + root = { + every_held_county = { + limit = { + uses_county_fertility = yes + } + add_county_modifier = { + modifier = paiza_fertility_modifier_2 + years = 4 + } + } + } + } + nomad_yurt_paiza_fertility_gain_lvl_3 = { + root = { + every_held_county = { + limit = { + uses_county_fertility = yes + } + add_county_modifier = { + modifier = paiza_fertility_modifier_3 + years = 6 + } + } + } + } + } + } + if = { + limit = { + has_domicile_building_or_higher = herd_trade_yurt_01 + } + switch = { + trigger = has_domicile_parameter + nomad_yurt_paiza_herd_gain_lvl_1= { + change_herd = { + value = root.var:trade_gold_value + multiply = 0.05 + } + } + nomad_yurt_paiza_herd_gain_lvl_2 = { + change_herd = { + value = root.var:trade_gold_value + multiply = 0.05 + } + } + nomad_yurt_paiza_herd_gain_lvl_3 = { + change_herd = { + value = root.var:trade_gold_value + multiply = 0.2 + } + } + } + } + if = { + limit = { + has_domicile_building_or_higher = knight_trade_yurt_01 + } + switch = { + trigger = has_domicile_parameter + nomad_yurt_paiza_maa_gain_lvl_1 = { + root = { + spawn_army = { + name = paiza_troops + men_at_arms = { + type = accolade_maa_archers + stacks = 1 + } + location = root.location + origin = scope:merchant_origin + inheritable = yes + } + } + } + nomad_yurt_paiza_maa_gain_lvl_2 = { + root = { + spawn_army = { + name = paiza_troops + men_at_arms = { + type = accolade_maa_archers + stacks = 4 + } + location = root.location + origin = scope:merchant_origin + inheritable = yes + } + } + } + nomad_yurt_paiza_maa_gain_lvl_3 = { + root = { + spawn_army = { + name = paiza_troops + men_at_arms = { + type = accolade_maa_archers + stacks = 4 + } + men_at_arms = { + type = accolade_maa_vanguards + stacks = 4 + } + location = root.location + origin = scope:merchant_origin + inheritable = yes + } + } + } + } + } + if = { + limit = { + has_domicile_building_or_higher = char_trade_yurt_01 + } + switch = { + trigger = has_domicile_parameter + nomad_yurt_paiza_char_gain_lvl_1 = { + root = { + hidden_effect = { + create_character = { + location = root.location + culture = scope:merchant_origin.county.culture + faith = scope:merchant_origin.county.faith + gender_female_chance = 50 + template = peasant_character + save_scope_as = yurt_merchant_char + } + scope:yurt_merchant_char = { + add_trait = lifestyle_traveler + } + } + add_courtier = scope:yurt_merchant_char + } + } + nomad_yurt_paiza_char_gain_lvl_2 = { + root = { + hidden_effect = { + create_character = { + location = root.location + culture = scope:merchant_origin.county.culture + faith = scope:merchant_origin.county.faith + gender_female_chance = 50 + template = merchant_template + save_scope_as = yurt_merchant_char + } + scope:yurt_merchant_char = { + add_trait = lifestyle_traveler + } + } + add_courtier = scope:yurt_merchant_char + } + } + nomad_yurt_paiza_char_gain_lvl_3 = { + root = { + hidden_effect = { + create_character = { + location = root.location + culture = scope:merchant_origin.county.culture + faith = scope:merchant_origin.county.faith + gender_female_chance = 50 + template = merchant_template + save_scope_as = yurt_merchant_char + } + scope:yurt_merchant_char = { + add_random_skill_point_effect = yes + add_random_skill_point_effect = yes + add_random_skill_point_effect = yes + add_random_skill_point_effect = yes + add_random_skill_point_effect = yes + add_random_skill_point_effect = yes + random_list = { + 1 = { add_trait = avaricious } + 1 = { add_trait = diplomat } + 1 = { add_trait = overseer } + } + add_trait = lifestyle_traveler + } + } + add_courtier = scope:yurt_merchant_char + } + } + } + } + } +} + +mpo_paiza_improve_maa_smol_effect = { + add_character_modifier = mpo_paiza_improve_maa_modifier + add_character_flag = paiza_metal_trade_yurt_flag + domicile ?= { + switch = { + trigger = has_domicile_building + paiza_metal_trade_yurt_01 = { + add_domicile_building = paiza_metal_trade_yurt_02 + } + paiza_metal_trade_yurt_02 = { + add_domicile_building = paiza_metal_trade_yurt_03 + } + paiza_metal_trade_yurt_03 = { + custom_tooltip = paiza_metal_yurt_smol_block + } + } + if = { + limit = { + NOT = { + has_domicile_building_or_higher = paiza_metal_trade_yurt_01 + } + } + add_domicile_building = paiza_metal_trade_yurt_01 + } + } + remove_character_flag = paiza_metal_trade_yurt_flag +} + +mpo_paiza_improve_maa_effect = { + add_character_modifier = mpo_paiza_improve_maa_modifier + add_character_flag = paiza_metal_trade_yurt_flag + domicile ?= { + switch = { + trigger = has_domicile_building + paiza_metal_trade_yurt_01 = { + add_domicile_building = paiza_metal_trade_yurt_02 + } + paiza_metal_trade_yurt_02 = { + add_domicile_building = paiza_metal_trade_yurt_03 + } + paiza_metal_trade_yurt_03 = { + add_domicile_building = paiza_metal_trade_yurt_04 + } + paiza_metal_trade_yurt_04 = { + add_domicile_building = paiza_metal_trade_yurt_05 + } + paiza_metal_trade_yurt_05 = { + add_domicile_building = paiza_metal_trade_yurt_06 + } + } + if = { + limit = { + NOT = { + has_domicile_building_or_higher = paiza_metal_trade_yurt_01 + } + } + add_domicile_building = paiza_metal_trade_yurt_01 + } + } + remove_character_flag = paiza_metal_trade_yurt_flag +} + +mpo_paiza_abuse_counter_effect = { + $PAIZA_PATRON$ = { save_scope_as = paiza_patron } + $PAIZA_ABUSER$ = { save_scope_as = paiza_abuser } + if = { + limit = { + scope:paiza_patron = { + is_ai = no + } + } + custom_tooltip = mpo_paiza_abuse_counter_effect.random + scope:paiza_patron = { + trigger_event = { + id = mpo_decisions_events.0112 + days = { 1 4 } + } + } + } + else = { + if = { + limit = { + NOT = { + exists = var:paiza_abuse_stance + } + } + custom_tooltip = mpo_paiza_abuse_counter_effect.indifferent + set_variable = { + name = paiza_abuse_stance + value = flag:indifferent + } + } + else_if = { + limit = { + exists = var:paiza_abuse_stance + } + switch = { + trigger = var:paiza_abuse_stance + flag:angry = { + custom_tooltip = mpo_paiza_abuse_counter_effect.angry + random_list = { + 90 = { + modifier = { + add = mpo_paiza_abuse_khan_reaction_value + } + custom_tooltip = mpo_paiza_abuse_counter_effect.khan_reaction_action + trigger_event = { + id = mpo_decisions_events.0111 + days = { 21 37 } + } + } + 10 = { + custom_tooltip = mpo_paiza_abuse_counter_effect.khan_reaction_angry + } + } + } + flag:annoyed = { + custom_tooltip = mpo_paiza_abuse_counter_effect.annoyed + random_list = { + 40 = { + modifier = { + add = mpo_paiza_abuse_khan_reaction_value + } + custom_tooltip = mpo_paiza_abuse_counter_effect.khan_reaction_action + trigger_event = { + id = mpo_decisions_events.0111 + days = { 21 37 } + } + } + 40 = { + custom_tooltip = mpo_paiza_abuse_counter_effect.khan_reaction_angry + modifier = { + add = { + value = mpo_paiza_abuse_khan_reaction_value + divide = 2 + } + } + set_variable = { + name = paiza_abuse_stance + value = flag:angry + } + } + 20 = { + custom_tooltip = mpo_paiza_abuse_counter_effect.khan_reaction_annoyed + } + } + } + flag:indifferent = { + custom_tooltip = mpo_paiza_abuse_counter_effect.indifferent + random_list = { + 20 = { + custom_tooltip = mpo_paiza_abuse_counter_effect.annoyed + modifier = { + add = { + value = mpo_paiza_abuse_khan_reaction_value + divide = 2 + } + } + set_variable = { + name = paiza_abuse_stance + value = flag:annoyed + } + } + 80 = { + custom_tooltip = mpo_paiza_abuse_counter_effect.indifferent + } + } + } + } + } + } + trigger_event = { + id = mpo_decisions_events.0098 + days = { 4 8 } + } +} + +mpo_decisions_events_friend_fail_effect = { + random_list = { + 4 = { + trigger = { + scope:friendship_target = { + is_ai = yes + } + OR = { + any_child = { + NOR = { + this = scope:friendship_target + this = scope:heir + has_relation_friend = scope:friendship_target + has_relation_best_friend = scope:friendship_target + has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:friendship_target } + is_at_war_with = scope:friendship_target + } + is_imprisoned = no + is_incapable = no + is_courtier_of = root + age >= 6 + } + any_sibling = { + NOR = { + this = scope:friendship_target + this = scope:heir + has_relation_friend = scope:friendship_target + has_relation_best_friend = scope:friendship_target + has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:friendship_target } + is_at_war_with = scope:friendship_target + } + is_imprisoned = no + is_incapable = no + is_courtier_of = root + age >= 6 + } + } + } + random_child = { + limit = { + NOR = { + this = scope:friendship_target + this = scope:heir + has_relation_friend = scope:friendship_target + has_relation_best_friend = scope:friendship_target + has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:friendship_target } + is_at_war_with = scope:friendship_target + } + is_imprisoned = no + is_incapable = no + is_courtier_of = root + age >= 6 + } + save_scope_as = accidental_friend + } + if = { + limit = { + NOT = { + exists = scope:accidental_friend + } + } + random_sibling = { + limit = { + NOR = { + this = scope:friendship_target + this = scope:heir + has_relation_friend = scope:friendship_target + has_relation_best_friend = scope:friendship_target + has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:friendship_target } + is_at_war_with = scope:friendship_target + } + is_imprisoned = no + is_incapable = no + is_courtier_of = root + age >= 6 + } + save_scope_as = accidental_friend + } + } + scope:friendship_target = { + set_relation_friend = { + target = root + reason = friend_accidental_introduction + } + } + } + 2 = { + trigger = { + scope:friendship_target = { + is_ai = yes + } + scope:friendship_target = { + NOR = { + has_relation_friend = scope:friendship_target + has_relation_best_friend = scope:friendship_target + has_any_bad_relationship_with_character_trigger = { CHARACTER = root } + } + } + } + scope:friendship_target = { + set_relation_friend = { + target = root + reason = friend_accidental_introduction + } + } + } + 1 = { + scope:friendship_target = { + add_opinion = { + modifier = charmed_opinion + target = root + opinion = 30 + } + } + } + 2 = { + trigger = { + culture = { + NOT = { + this = scope:friendship_target.culture + } + cultural_acceptance = { + target = scope:friendship_target.culture + value < 100 + } + } + } + culture = { + change_cultural_acceptance = { + target = scope:friendship_target.culture + value = minor_cultural_acceptance_gain + desc = cultural_acceptance_friendly_visit + } + } + if = { + limit = { + scope:heir.culture = { + NOR = { + this = scope:friendship_target.culture + this = root.culture + } + cultural_acceptance = { + target = scope:friendship_target.culture + value < 100 + } + } + } + scope:heir.culture = { + change_cultural_acceptance = { + target = scope:friendship_target.culture + value = minor_cultural_acceptance_gain + desc = cultural_acceptance_friendly_visit + } + } + } + } + 1 = { + trigger = { + scope:friendship_target = { + is_ai = yes + } + scope:friendship_target = { + short_term_gold >= minor_gold_value + + } + } + scope:friendship_target = { + pay_short_term_gold = { + target = scope:heir + gold = minor_gold_value + } + } + scope:heir = { + add_opinion = { + target = scope:friendship_target + modifier = gift_opinion + opinion = 25 + } + } + } + 1 = { + trigger = { + scope:friendship_target = { + is_ai = yes + government_has_flag = government_is_nomadic + exists = domicile + domicile.herd >= domicile.minor_herd_value + } + government_has_flag = government_is_nomadic + } + pay_herd = { + target = root + value = domicile.minor_herd_value + } + add_opinion = { + target = scope:friendship_target + modifier = gift_opinion + opinion = 25 + } + } + 1 = { + trigger = { + scope:friendship_target = { + has_lifestyle = diplomacy_lifestyle + } + } + scope:heir = { + add_diplomacy_skill = 1 + add_diplomacy_lifestyle_xp = minor_lifestyle_xp + } + } + 1 = { + trigger = { + scope:friendship_target = { + has_lifestyle = martial_lifestyle + } + } + scope:heir = { + add_martial_skill = 1 + add_martial_lifestyle_xp = minor_lifestyle_xp + } + } + 1 = { + trigger = { + scope:friendship_target = { + has_lifestyle = stewardship_lifestyle + } + } + scope:heir = { + add_stewardship_skill = 1 + add_stewardship_lifestyle_xp = minor_lifestyle_xp + } + } + 1 = { + trigger = { + scope:friendship_target = { + has_lifestyle = intrigue_lifestyle + } + } + scope:heir = { + add_intrigue_skill = 1 + add_intrigue_lifestyle_xp = minor_lifestyle_xp + } + } + 1 = { + trigger = { + scope:friendship_target = { + has_lifestyle = learning_lifestyle + } + } + scope:heir = { + add_learning_skill = 1 + add_learning_lifestyle_xp = minor_lifestyle_xp + } + } + 1 = { + trigger = { + OR = { + stress > 0 + scope:heir = { + stress > 0 + } + } + } + add_stress = minor_stress_impact_loss + scope:heir = { + add_stress = medium_stress_impact_loss + } + } + } +} + +mpo_heir_lifestyle_xp_gain_effect = { + if = { + limit = { + scope:lifestyle_trait = { + OR = { + this = trait:lifestyle_physician + this = trait:lifestyle_mystic + this = trait:lifestyle_blademaster + this = trait:lifestyle_reveler + } + } + } + scope:heir = { + add_trait_xp = { + trait = scope:lifestyle_trait + value = 30 + } + } + } + else_if = { + limit = { + scope:lifestyle_trait = { + this = trait:lifestyle_hunter + } + } + scope:heir = { + add_trait_xp = { + trait = lifestyle_hunter + track = hunter + value = 15 + } + } + scope:heir = { + add_trait_xp = { + trait = lifestyle_hunter + track = falconer + value = 15 + } + } + } + else_if = { + limit = { + scope:lifestyle_trait = { + this = trait:lifestyle_traveler + } + } + scope:heir = { + add_trait_xp = { + trait = lifestyle_traveler + track = travel + value = 15 + } + } + scope:heir = { + add_trait_xp = { + trait = lifestyle_traveler + track = danger + value = 15 + } + } + } + else_if = { + limit = { + scope:lifestyle_trait = { + this = trait:lifestyle_herbalist + } + scope:heir = { + NOT = { + has_trait = lifestyle_physician + } + } + } + scope:heir = { + add_trait = lifestyle_physician + } + } + else_if = { + limit = { + scope:lifestyle_trait = { + this = trait:lifestyle_herbalist + } + scope:heir = { + has_trait = lifestyle_physician + } + } + scope:heir = { + add_trait_xp = { + trait = lifestyle_physician + value = 30 + } + } + } + else_if = { + limit = { + scope:lifestyle_trait = { + this = trait:lifestyle_poet + } + } + scope:heir = { + add_diplomacy_skill = 1 + add_diplomacy_lifestyle_xp = medium_lifestyle_xp + } + } + else_if = { + limit = { + scope:lifestyle_trait = { + this = trait:lifestyle_gardener + } + scope:heir = { + NOT = { + has_trait = lifestyle_herbalist + } + } + } + scope:heir = { + add_trait = lifestyle_herbalist + } + } + else_if = { + limit = { + scope:lifestyle_trait = { + this = trait:lifestyle_gardener + } + scope:heir = { + has_trait = lifestyle_herbalist + } + } + scope:heir = { + add_stewardship_skill = 1 + add_diplomacy_lifestyle_xp = medium_lifestyle_xp + } + } + else_if = { + limit = { + scope:lifestyle_trait = { + this = trait:drunkard + } + scope:heir = { + has_trait = lifestyle_reveler + } + } + scope:heir = { + add_trait = lifestyle_reveler + } + } + else_if = { + limit = { + scope:lifestyle_trait = { + this = trait:drunkard + } + scope:heir = { + has_trait = lifestyle_reveler + } + } + scope:heir = { + add_trait_xp = { + trait = lifestyle_reveler + value = 30 + } + } + } + else_if = { + limit = { + scope:lifestyle_trait = { + this = trait:hashishiyah + } + scope:heir = { + NOT = { + has_trait = lifestyle_herbalist + } + } + } + scope:heir = { + add_trait = lifestyle_herbalist + } + } + else_if = { + limit = { + scope:lifestyle_trait = { + this = trait:hashishiyah + } + scope:heir = { + has_trait = lifestyle_reveler + } + } + scope:heir = { + add_trait = lifestyle_reveler + } + } + else_if = { + limit = { + scope:lifestyle_trait = { + this = trait:hashishiyah + } + scope:heir = { + has_trait = lifestyle_reveler + } + } + scope:heir = { + add_trait_xp = { + trait = lifestyle_reveler + value = 30 + } + } + } +} + +mpo_heir_hastiluder_xp_gain_effect = { + random_list = { + 1 = { + trigger = { + scope:friendship_target = { + has_trait_xp = { + trait = tourney_participant + track = foot + value >= 50 + } + } + scope:heir = { + has_trait_xp = { + trait = tourney_participant + track = foot + value >= 50 + } + } + } + scope:heir = { + add_trait_xp = { + trait = tourney_participant + track = foot + value = 35 + } + } + } + 1 = { + trigger = { + scope:friendship_target = { + has_trait_xp = { + trait = tourney_participant + track = horse + value >= 50 + } + } + scope:heir = { + has_trait_xp = { + trait = tourney_participant + track = horse + value >= 50 + } + } + } + scope:heir = { + add_trait_xp = { + trait = tourney_participant + track = horse + value = 35 + } + } + } + 1 = { + trigger = { + scope:friendship_target = { + has_trait_xp = { + trait = tourney_participant + track = bow + value >= 50 + } + } + scope:heir = { + has_trait_xp = { + trait = tourney_participant + track = bow + value >= 50 + } + } + } + scope:heir = { + add_trait_xp = { + trait = tourney_participant + track = bow + value = 35 + } + } + } + 1 = { + trigger = { + scope:friendship_target = { + has_trait_xp = { + trait = tourney_participant + track = wit + value >= 50 + } + } + scope:heir = { + has_trait_xp = { + trait = tourney_participant + track = wit + value >= 50 + } + } + } + scope:heir = { + add_trait_xp = { + trait = tourney_participant + track = wit + value = 35 + } + } + } + } +} + +mpo_target_lifestyle_xp_gain_effect = { + if = { + limit = { + scope:lifestyle_trait = { + OR = { + this = trait:lifestyle_physician + this = trait:lifestyle_mystic + this = trait:lifestyle_blademaster + this = trait:lifestyle_reveler + } + } + } + scope:friendship_target = { + add_trait_xp = { + trait = scope:lifestyle_trait + value = 20 + } + } + } + else_if = { + limit = { + scope:lifestyle_trait = { + this = trait:lifestyle_hunter + } + } + scope:friendship_target = { + add_trait_xp = { + trait = lifestyle_hunter + track = hunter + value = 10 + } + } + scope:friendship_target = { + add_trait_xp = { + trait = lifestyle_hunter + track = falconer + value = 10 + } + } + } + else_if = { + limit = { + scope:lifestyle_trait = { + this = trait:lifestyle_traveler + } + } + scope:friendship_target = { + add_trait_xp = { + trait = lifestyle_traveler + track = travel + value = 10 + } + } + scope:friendship_target = { + add_trait_xp = { + trait = lifestyle_traveler + track = danger + value = 10 + } + } + } + else_if = { + limit = { + scope:lifestyle_trait = { + this = trait:lifestyle_herbalist + } + scope:heir = { + has_trait = lifestyle_physician + } + } + scope:friendship_target = { + add_trait_xp = { + trait = lifestyle_physician + value = 20 + } + } + } + else_if = { + limit = { + scope:lifestyle_trait = { + this = trait:lifestyle_poet + } + } + scope:friendship_target = { + add_diplomacy_lifestyle_xp = medium_lifestyle_xp + } + } + else_if = { + limit = { + scope:lifestyle_trait = { + this = trait:lifestyle_gardener + } + scope:heir = { + has_trait = lifestyle_herbalist + } + } + scope:friendship_target = { + add_diplomacy_lifestyle_xp = medium_lifestyle_xp + } + } + else_if = { + limit = { + scope:lifestyle_trait = { + this = trait:drunkard + } + scope:heir = { + has_trait = lifestyle_reveler + } + } + scope:friendship_target = { + add_trait_xp = { + trait = lifestyle_reveler + value = 20 + } + } + } + else_if = { + limit = { + scope:lifestyle_trait = { + this = trait:hashishiyah + } + scope:heir = { + has_trait = lifestyle_reveler + } + } + scope:friendship_target = { + add_trait_xp = { + trait = lifestyle_reveler + value = 20 + } + } + } + else = { + scope:friendship_target = { + add_stress = medium_stress_loss + } + } +} + +mpo_target_hastiluder_xp_gain_effect = { + random_list = { + 1 = { + trigger = { + scope:friendship_target = { + has_trait_xp = { + trait = tourney_participant + track = foot + value >= 50 + } + } + scope:heir = { + has_trait_xp = { + trait = tourney_participant + track = foot + value >= 50 + } + } + } + scope:friendship_target = { + add_trait_xp = { + trait = tourney_participant + track = foot + value = 20 + } + } + } + 1 = { + trigger = { + scope:friendship_target = { + has_trait_xp = { + trait = tourney_participant + track = horse + value >= 50 + } + } + scope:heir = { + has_trait_xp = { + trait = tourney_participant + track = horse + value >= 50 + } + } + } + scope:friendship_target = { + add_trait_xp = { + trait = tourney_participant + track = horse + value = 20 + } + } + } + 1 = { + trigger = { + scope:friendship_target = { + has_trait_xp = { + trait = tourney_participant + track = bow + value >= 50 + } + } + scope:heir = { + has_trait_xp = { + trait = tourney_participant + track = bow + value >= 50 + } + } + } + scope:friendship_target = { + add_trait_xp = { + trait = tourney_participant + track = bow + value = 20 + } + } + } + 1 = { + trigger = { + scope:friendship_target = { + has_trait_xp = { + trait = tourney_participant + track = wit + value >= 50 + } + } + scope:heir = { + has_trait_xp = { + trait = tourney_participant + track = wit + value >= 50 + } + } + } + scope:friendship_target = { + add_trait_xp = { + trait = tourney_participant + track = wit + value = 20 + } + } + } + } +} + +nomad_domicile_refund_effect = { + #Domicile buildings give cash refund + if = { + limit = { + has_domicile = yes + } + save_scope_as = former_nomad + custom_tooltip = nomad_domicile_buildings_converted + hidden_effect = { + add_gold = { + value = { + value = medium_gold_value + switch = { + trigger = domicile.num_domicile_buildings + 7 = { multiply = 7 } + 6 = { multiply = 6 } + 5 = { multiply = 5 } + 4 = { multiply = 4 } + 3 = { multiply = 3 } + 2 = { multiply = 2 } + } + } + } + } + } +} + +nomad_convert_people_to_tribe_effect = { + change_government = tribal_government + + #Winning a cool war to get this government should mean high authority + if = { + limit = { + exists = scope:overrunner + this = scope:overrunner + } + add_realm_law = tribal_authority_2 + } +} + +nomad_convert_people_to_clan_effect = { + change_government = clan_government + + #Start off crown authorities. + if = { + limit = { + NOT = { has_realm_law = crown_authority_1 } + } + add_realm_law_skip_effects = crown_authority_1 + } +} + +nomad_convert_people_to_feudal_effect = { + change_government = feudal_government + + #Start off crown authorities. + if = { + limit = { + NOT = { has_realm_law = crown_authority_1 } + } + add_realm_law_skip_effects = crown_authority_1 + } +} + +mpo_overrunning_vassal_title_distribution_effect = { + every_held_title = { + limit = { + tier = tier_county + any_this_title_or_de_jure_above = { + tier = tier_duchy + NOT = { + this = scope:new_capital_duchy + } + } + } + add_to_list = overrun_counties + } + scope:target = { + every_direct_de_jure_vassal_title = { + limit = { + tier = tier_duchy + NOT = { + this = scope:new_capital_duchy + } + any_de_jure_county = { + count >= 2 + holder = scope:attacker + } + OR = { + NOT = { exists = holder } + holder.top_liege = scope:defender + holder.top_liege = scope:attacker + } + } + add_to_list = overrun_duchies + } + } + #Distribute all counties + while = { + limit = { + any_in_list = { + list = overrun_counties + holder = scope:attacker + } + any_in_list = { + list = potential_overrunning_vassals + NOT = { + has_character_flag = got_overrun_title + } + } + } + #Is a duchy available? + if = { + limit = { + any_in_list = { + list = overrun_duchies + any_de_jure_county = { + holder = scope:attacker + } + } + } + #Grant biggest duchy available + if = { + limit = { + any_in_list = { + list = overrun_duchies + #Forgive me for how stupid this is + any_de_jure_county = { + count >= 5 + holder = scope:attacker + } + } + } + random_in_list = { + list = overrun_duchies + limit = { + any_de_jure_county = { + count >= 5 + holder = scope:attacker + } + } + save_scope_as = duchy_to_grant + } + } + else_if = { + limit = { + any_in_list = { + list = overrun_duchies + #Forgive me for how stupid this is + any_de_jure_county = { + count >= 4 + holder = scope:attacker + } + } + } + random_in_list = { + list = overrun_duchies + limit = { + any_de_jure_county = { + count >= 4 + holder = scope:attacker + } + } + save_scope_as = duchy_to_grant + } + } + else_if = { + limit = { + any_in_list = { + list = overrun_duchies + #Forgive me for how stupid this is + any_de_jure_county = { + count >= 3 + holder = scope:attacker + } + } + } + random_in_list = { + list = overrun_duchies + limit = { + any_de_jure_county = { + count >= 3 + holder = scope:attacker + } + } + save_scope_as = duchy_to_grant + } + } + else = { + random_in_list = { + list = overrun_duchies + save_scope_as = duchy_to_grant + } + } + #Choose best county + scope:duchy_to_grant = { + if = { + limit = { + title_capital_county = { + holder = scope:attacker + } + } + title_capital_county = { + save_scope_as = title_to_grant + } + } + else = { + ordered_de_jure_county = { + order_by = development_level + limit = { + holder = scope:attacker + } + save_scope_as = title_to_grant + } + } + } + } + #Counts + else = { + ordered_in_list = { + order_by = development_level + list = overrun_counties + save_scope_as = title_to_grant + } + } + #Choose a vassal + ordered_in_list = { + list = potential_overrunning_vassals + limit = { + NOT = { + has_character_flag = got_overrun_title + } + } + order_by = max_military_strength + save_scope_as = title_gainer + #Add character flag - they should be done + add_character_flag = got_overrun_title + + #tributaries go + hidden_effect = { + every_tributary = { + custom = custom.every_tributary + end_tributary = yes + } + } + + #Give up nomadic titles + if = { + limit = { + NOT = { + scope:title_to_grant = { + any_county_province = { + OR = { + has_holding_type = nomad_holding + has_holding_type = herder_holding + } + } + } + } + } + mpo_overrunning_ending_nomadism_effect = yes + } + #Nomads should still move + else = { + hidden_effect = { + give_domain_to_herders = yes + } + } + } + scope:title_gainer = { + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + } + scope:title_to_grant = { + change_title_holder = { + holder = scope:title_gainer + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + #Add duchy if they're getting one + if = { + limit = { + exists = scope:duchy_to_grant + } + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + } + scope:duchy_to_grant = { + change_title_holder = { + holder = scope:title_gainer + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + } + #If they got a duchy, can bring over an existing vassal as a vassal + if = { + limit = { + exists = scope:duchy_to_grant + scope:duchy_to_grant = { + any_de_jure_county = { + holder = scope:attacker + is_in_list = overrun_counties + } + } + any_vassal = { + highest_held_title_tier >= tier_county + NOT = { + any_held_title = { + kingdom = scope:target + } + } + mpo_overrunning_willing_vassal_trigger = yes + } + } + scope:duchy_to_grant = { + random_de_jure_county = { + limit = { + holder = scope:attacker + is_in_list = overrun_counties + } + save_scope_as = undervassal_county + } + } + ordered_vassal = { + order_by = max_military_strength + limit = { + highest_held_title_tier >= tier_county + NOT = { + any_held_title = { + kingdom = scope:target + } + } + mpo_overrunning_willing_vassal_trigger = yes + } + save_scope_as = undervassal + + #Give up nomadic titles + if = { + limit = { + NOT = { + scope:undervassal_county = { + any_county_province = { + OR = { + has_holding_type = nomad_holding + has_holding_type = herder_holding + } + } + } + } + } + mpo_overrunning_ending_nomadism_effect = yes + } + #Nomads should still move + else = { + hidden_effect = { + give_domain_to_herders = yes + } + } + #Change government to match attacker + scope:undervassal = { + if = { + limit = { + scope:title_to_grant = { + any_county_province = { + OR = { + has_holding_type = nomad_holding + has_holding_type = herder_holding + } + } + } + } + #Do nothing, they're still nomadic + } + else_if = { + limit = { + scope:undervassal_county = { + any_county_province = { + has_holding_type = tribal_holding + } + } + } + nomad_convert_people_to_tribe_effect = yes + } + else_if = { + limit = { + scope:undervassal = { + OR = { + #Personal reasons to go clan + faith.religion = religion:islam_religion + culture ?= { + OR = { + has_cultural_pillar = heritage_arabic + has_cultural_pillar = heritage_iranian + } + } + #county and liege are clan + AND = { + scope:title_to_grant = { + OR = { + faith.religion = religion:islam_religion + culture = { + OR = { + has_cultural_pillar = heritage_arabic + has_cultural_pillar = heritage_iranian + } + } + } + } + scope:attacker = { + government_has_flag = government_is_clan + } + } + } + } + } + nomad_convert_people_to_clan_effect = yes + } + else = { + nomad_convert_people_to_feudal_effect = yes + } + } + #Have to re-add them as a vassal probably + create_title_and_vassal_change = { + type = granted + save_scope_as = change + add_claim_on_loss = no + } + change_liege = { + liege = scope:undervassal_county.duchy.holder + change = scope:change + } + resolve_title_and_vassal_change = scope:change + + #Give them their county + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change_2 + } + scope:title_to_grant = { + change_title_holder = { + holder = scope:undervassal + change = scope:title_change_2 + } + } + resolve_title_and_vassal_change = scope:title_change_2 + } + } + } + #Change government + scope:attacker = { + if = { + limit = { + scope:title_to_grant = { + any_county_province = { + OR = { + has_holding_type = nomad_holding + has_holding_type = herder_holding + } + } + } + } + #Do nothing, they're still nomadic + } + else_if = { + limit = { + scope:title_to_grant = { + any_county_province = { + has_holding_type = tribal_holding + } + } + } + scope:title_gainer = { + nomad_convert_people_to_tribe_effect = yes + } + } + else_if = { + limit = { + scope:title_gainer = { + OR = { + #Personal reasons to go clan + faith.religion = religion:islam_religion + culture = { + OR = { + has_cultural_pillar = heritage_arabic + has_cultural_pillar = heritage_iranian + } + } + #county and liege are clan + AND = { + scope:title_to_grant = { + OR = { + faith.religion = religion:islam_religion + culture = { + OR = { + has_cultural_pillar = heritage_arabic + has_cultural_pillar = heritage_iranian + } + } + } + } + scope:attacker = { + government_has_flag = government_is_clan + } + } + } + } + } + scope:title_gainer = { + nomad_convert_people_to_clan_effect = yes + } + } + else = { + scope:title_gainer = { + nomad_convert_people_to_feudal_effect = yes + } + } + } + + #Have to re-add them as a vassal probably + scope:title_gainer = { + if = { + limit = { + NOT = { + liege = scope:attacker + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = change + add_claim_on_loss = no + } + change_liege = { + liege = scope:attacker + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + + #Remove chosen titles from list + scope:duchy_to_grant ?= { + remove_from_list = overrun_duchies + } + scope:title_to_grant = { + remove_from_list = overrun_counties + } + scope:undervassal_county ?= { + remove_from_list = overrun_counties + } + if = { + limit = { + exists = scope:duchy_to_grant + } + clear_saved_scope = duchy_to_grant + } + } + #ASSIGN VASSALS TO DUKES + every_vassal = { + limit = { + highest_held_title_tier = tier_county + primary_title = { + kingdom = scope:target + any_this_title_or_de_jure_above = { + tier = tier_duchy + exists = holder + NOT = { + holder = scope:attacker + } + holder.top_liege = scope:attacker + } + } + } + #Have to re-add them as a vassal probably + create_title_and_vassal_change = { + type = granted + save_scope_as = change + add_claim_on_loss = no + } + change_liege = { + liege = primary_title.duchy.holder + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + + #GIVE DUKES THE REST OF THEIR COUNTIES FROM ATTACKER + every_held_title = { + limit = { + tier = tier_county + kingdom = scope:target + any_this_title_or_de_jure_above = { + tier = tier_duchy + exists = holder + NOT = { + holder = scope:attacker + } + holder = { + is_vassal_or_below_of = scope:attacker + } + } + } + scope:attacker = { + create_title_and_vassal_change = { + type = granted + save_scope_as = title_change + } + } + change_title_holder = { + holder = duchy.holder + change = scope:title_change + } + scope:attacker = { + resolve_title_and_vassal_change = scope:title_change + } + } + #Get rid of this now-useless flag + every_vassal = { + limit = { + has_character_flag = got_overrun_title + } + remove_character_flag = got_overrun_title + } +} + +mpo_overrunning_ending_nomadism_effect = { + #Wrap up being a nomad + nomad_domicile_refund_effect = yes + nomad_convert_herds_to_gold_special_troops_effect = yes + hidden_effect = { + give_domain_to_herders = yes + } +} + +nomad_convert_herds_to_gold_special_troops_effect = { + save_scope_as = former_nomad + custom_tooltip = gold_army_for_herd_tt + hidden_effect = { + if = { + limit = { + domicile.herd >= 50 + } + save_scope_as = army_getter + add_gold = { + value = domicile.herd + multiply = 0.3 + min = 100 + max = 10000 + } + spawn_army = { + levies = 200 + men_at_arms = { + type = horse_archers + men = { value = domicile.herd multiply = 0.02 min = 100 max = 10000 } + } + men_at_arms = { + type = steppe_raiders + men = { value = domicile.herd multiply = 0.01 min = 100 max = 10000 } + } + men_at_arms = { + type = nomad_lancers + men = { value = domicile.herd multiply = 0.01 min = 100 max = 10000 } + } + men_at_arms = { + type = nomadic_riders + men = { value = domicile.herd multiply = 0.1 min = 100 max = 10000 } + } + location = capital_province + inheritable = yes + uses_supply = yes + name = former_nomad_army_name + } + } + } +} + +set_throatsinging_style_effect = { + random_list = { + 10 = { + modifier = { + add = 10 + is_female = yes + } + set_variable = { + name = throatsinging_style + value = flag:sygyt + } + } + 10 = { + set_variable = { + name = throatsinging_style + value = flag:hoomei + } + } + 10 = { + set_variable = { + name = throatsinging_style + value = flag:kargyraa + } + } + } + set_variable = { + name = throatsinging_practice + value = 1 + } +} + +mpo_dominance_scaled_minor_gold_gain = { + if = { + limit = { + OR = { + has_realm_law = nomadic_authority_4 + has_realm_law = nomadic_authority_5 + } + } + add_gold = massive_gold_value + } + if = { + limit = { + has_realm_law = nomadic_authority_3 + } + add_gold = major_gold_value + } + if = { + limit = { + has_realm_law = nomadic_authority_2 + } + add_gold = medium_gold_value + } + if = { + limit = { + has_realm_law = nomadic_authority_1 + } + add_gold = minor_gold_value + } +} + +mpo_decisions_events_0500_effect = { + custom_tooltip = { + text = mpo_decisions_events_0500_effect_vassal_tt + every_vassal = { + limit = { + NOT = { + is_obedient_to = root + } + } + add_opinion = { + target = root + modifier = obedience_opinion + } + } + } + custom_tooltip = { + text = mpo_decisions_events_0500_effect_courtier_tt + every_courtier = { + limit = { + NOR = { + is_obedient_to = root + has_obedience_reason = root + } + } + add_opinion = { + target = root + modifier = obedience_opinion + } + } + } + custom_tooltip = { + text = mpo_desperate_stance_invasion_cb_enable_var_tt + set_variable = mpo_desperate_stance_invasion_cb_enable_var + } +} + +mpo_dominance_scaled_miniscule_gold_gain = { + if = { + limit = { + OR = { + has_realm_law = nomadic_authority_4 + has_realm_law = nomadic_authority_5 + } + } + add_gold = major_gold_value + } + if = { + limit = { + has_realm_law = nomadic_authority_3 + } + add_gold = medium_gold_value + } + if = { + limit = { + has_realm_law = nomadic_authority_2 + } + add_gold = minor_gold_value + } + if = { + limit = { + has_realm_law = nomadic_authority_1 + } + add_gold = miniscule_gold_value + } +} + +mpo_save_potential_blood_brother_war_allies_effect = { + scope:war = { + if = { + limit = { + any_war_attacker = { + count >= 2 + mpo_valid_for_blood_brotherhood_trigger = yes + } + } + #Lord forgive me for this script + every_war_attacker = { + limit = { + mpo_valid_for_blood_brotherhood_trigger = yes + } + add_to_list = attacker_war_allies_list + + } + while = { + limit = { + any_war_attacker = { + is_in_list = attacker_war_allies_list + } + } + random_war_attacker = { + limit = { + is_in_list = attacker_war_allies_list + } + save_scope_as = current_ally + } + every_war_attacker = { + limit = { + mpo_valid_for_blood_brotherhood_trigger = yes + NOT = { + this = scope:current_ally + } + } + add_to_variable_list = { + name = former_war_allies + target = scope:current_ally + years = 10 + } + } + scope:current_ally = { + remove_from_list = attacker_war_allies_list + } + clear_saved_scope = current_ally + } + } + if = { + limit = { + any_war_defender = { + count >= 2 + mpo_valid_for_blood_brotherhood_trigger = yes + } + } + every_war_defender = { + limit = { + mpo_valid_for_blood_brotherhood_trigger = yes + } + add_to_list = defender_war_allies_list + } + while = { + limit = { + any_war_defender = { + is_in_list = defender_war_allies_list + } + } + random_war_defender = { + limit = { + is_in_list = defender_war_allies_list + } + save_scope_as = current_ally + } + every_war_defender = { + limit = { + mpo_valid_for_blood_brotherhood_trigger = yes + NOT = { + this = scope:current_ally + } + } + add_to_variable_list = { + name = former_war_allies + target = scope:current_ally + years = 10 + } + } + scope:current_ally = { + remove_from_list = defender_war_allies_list + } + clear_saved_scope = current_ally + } + } + } +} + +mpo_blood_brother_new_family_member_opinion_effect = { + hidden_effect = { + #Add blood brother close family opinion to actor's family + save_scope_as = new_kin + scope:other_blood_brother = { + add_to_list = other_blood_brother_family + add_character_flag = unhandled_family + every_child = { + add_to_list = other_blood_brother_family + add_character_flag = unhandled_family + } + primary_spouse ?= { + add_to_list = other_blood_brother_family + add_character_flag = unhandled_family + } + } + #Save other family on new kin + while = { + limit = { + any_in_list = { + list = other_blood_brother_family + has_character_flag = unhandled_family + } + } + random_in_list = { + list = other_blood_brother_family + limit = { + has_character_flag = unhandled_family + } + save_scope_as = other_blood_brother_picked_family + remove_character_flag = unhandled_family + } + scope:other_blood_brother_picked_family = { + add_opinion = { + target = scope:new_kin + modifier = blood_brother_close_family_opinion + } + reverse_add_opinion = { + target = scope:new_kin + modifier = blood_brother_close_family_opinion + } + } + clear_saved_scope = other_blood_brother_picked_family + } + } +} + +mpo_blood_brother_remove_family_opinion_effect = { + hidden_effect = { + #Add blood brother close family opinion to actor's family + save_scope_as = former_kin + scope:other_blood_brother = { + add_to_list = other_blood_brother_family + add_character_flag = unhandled_family + every_child = { + add_to_list = other_blood_brother_family + add_character_flag = unhandled_family + } + primary_spouse ?= { + add_to_list = other_blood_brother_family + add_character_flag = unhandled_family + } + } + #Remove other family on former kin + while = { + limit = { + any_in_list = { + list = other_blood_brother_family + has_character_flag = unhandled_family + } + } + random_in_list = { + list = other_blood_brother_family + limit = { + has_character_flag = unhandled_family + } + save_scope_as = other_blood_brother_picked_family + remove_character_flag = unhandled_family + } + scope:other_blood_brother_picked_family = { + remove_opinion = { + target = scope:former_kin + modifier = blood_brother_close_family_opinion + } + scope:former_kin = { + remove_opinion = { + target = scope:other_blood_brother_picked_family + modifier = blood_brother_close_family_opinion + } + } + } + clear_saved_scope = other_blood_brother_picked_family + } + } +} + +mpo_blood_brother_tooltip_actor_effect = { + show_as_tooltip = { + set_relation_blood_brother = scope:recipient + } + custom_tooltip = blood_brother_alliance_actor_alliance_past_tt + custom_tooltip = blood_brother_actor_gains_hook_past_tt + custom_tooltip = blood_brother_actor_recipient_hook_past_tt +} +mpo_blood_brother_tooltip_recipient_effect = { + show_as_tooltip = { set_relation_blood_brother = scope:actor } + custom_tooltip = blood_brother_alliance_recipient_alliance_past_tt + custom_tooltip = blood_brother_recipient_gains_hook_past_tt + custom_tooltip = blood_brother_recipient_actor_hook_past_tt +} +make_blood_brother_save_common_enemy_effect = { + save_temporary_scope_as = blood_brother_temp + #DUKES OR HIGHER + #Nemeses and rivals + if = { + limit = { + any_relation = { + type = nemesis + mpo_blood_brother_common_enemy_sub_trigger = yes + mpo_ideal_common_foe_trigger = yes + } + } + ordered_relation = { + order_by = max_military_strength + type = nemesis + limit = { + mpo_blood_brother_common_enemy_sub_trigger = yes + mpo_ideal_common_foe_trigger = yes + } + save_scope_as = shared_foe + } + } + else_if = { + limit = { + any_relation = { + type = rival + mpo_blood_brother_common_enemy_sub_trigger = yes + mpo_ideal_common_foe_trigger = yes + } + } + ordered_relation = { + order_by = max_military_strength + type = rival + limit = { + mpo_blood_brother_common_enemy_sub_trigger = yes + mpo_ideal_common_foe_trigger = yes + } + save_scope_as = shared_foe + } + } + #You have a house feud against someone recipient is also opposed to + else_if = { + limit = { + exists = house.house_head + exists = scope:recipient.house + NOT = { + house = scope:recipient.house + } + house = { + any_house_relation = { + has_house_relation_level = feud + any_relation_house = { + house_head = { + mpo_blood_brother_common_enemy_sub_trigger = yes + mpo_ideal_common_foe_trigger = yes + } + } + } + } + } + house = { + random_house_relation = { + limit = { + has_house_relation_level = feud + any_relation_house = { + house_head = { + mpo_blood_brother_common_enemy_sub_trigger = yes + mpo_ideal_common_foe_trigger = yes + } + } + } + random_relation_house = { + limit = { + house_head = { + mpo_blood_brother_common_enemy_sub_trigger = yes + mpo_ideal_common_foe_trigger = yes + } + } + house_head = { save_scope_as = shared_foe } + } + } + } + } + #In faction against someone recipient is opposed to + else_if = { + limit = { + liege ?= { + any_targeting_faction = { + any_faction_member = { + this = scope:actor + } + } + mpo_blood_brother_common_enemy_sub_trigger = yes + mpo_ideal_common_foe_trigger = yes + } + } + liege = { + save_scope_as = shared_foe + } + } + #You are at war with someone that recipient is also opposed to + else_if = { + limit = { + any_war_enemy = { + NOT = { has_variable = rebel_leader_peasants } + any_character_war = { + is_war_leader = prev + is_war_leader = scope:actor + } + mpo_blood_brother_common_enemy_sub_trigger = yes + mpo_ideal_common_foe_trigger = yes + } + } + ordered_war_enemy = { + order_by = max_military_strength + limit = { + NOT = { has_variable = rebel_leader_peasants } + any_character_war = { + is_war_leader = prev + is_war_leader = scope:actor + } + mpo_blood_brother_common_enemy_sub_trigger = yes + mpo_ideal_common_foe_trigger = yes + } + save_scope_as = shared_foe + } + } + #You have a faction member that recipient is also opposed to + else_if = { + limit = { + any_targeting_faction = { + any_faction_member = { + mpo_blood_brother_common_enemy_sub_trigger = yes + mpo_ideal_common_foe_trigger = yes + } + } + } + random_targeting_faction = { + ordered_faction_member = { + order_by = max_military_strength + limit = { + mpo_blood_brother_common_enemy_sub_trigger = yes + mpo_ideal_common_foe_trigger = yes + } + save_scope_as = shared_foe + } + } + } + #You are a title claimant against someone recipient don't like + else_if = { + limit = { + any_claim = { + exists = holder + NOT = { + scope:recipient = { has_claim_on = prev } + } + holder = { + mpo_blood_brother_common_enemy_sub_trigger = yes + mpo_ideal_common_foe_trigger = yes + } + } + } + ordered_claim = { + order_by = tier + limit = { + exists = holder + NOT = { + scope:recipient = { has_claim_on = prev } + } + holder = { + mpo_blood_brother_common_enemy_sub_trigger = yes + mpo_ideal_common_foe_trigger = yes + } + } + holder = { + save_scope_as = shared_foe + } + } + } + #You have a title claimant that recipient is also opposed to + else_if = { + limit = { + any_held_title = { + NOT = { + scope:recipient = { + has_claim_on = prev + } + } + any_claimant = { + mpo_blood_brother_common_enemy_sub_trigger = yes + mpo_ideal_common_foe_trigger = yes + } + } + } + ordered_held_title = { + order_by = tier + limit = { + NOT = { + scope:recipient = { + has_claim_on = prev + } + } + any_claimant = { + mpo_blood_brother_common_enemy_sub_trigger = yes + mpo_ideal_common_foe_trigger = yes + } + } + ordered_claimant = { + order_by = current_military_strength + limit = { + mpo_blood_brother_common_enemy_sub_trigger = yes + mpo_ideal_common_foe_trigger = yes + } + save_scope_as = shared_foe + } + } + } + + #ANYONE IS FINE + + #Nemeses and rivals + else_if = { + limit = { + any_relation = { + type = nemesis + mpo_blood_brother_common_enemy_sub_trigger = yes + } + } + ordered_relation = { + order_by = max_military_strength + type = nemesis + limit = { mpo_blood_brother_common_enemy_sub_trigger = yes } + save_scope_as = shared_foe + } + } + else_if = { + limit = { + any_relation = { + type = rival + mpo_blood_brother_common_enemy_sub_trigger = yes + } + } + ordered_relation = { + order_by = max_military_strength + type = rival + limit = { mpo_blood_brother_common_enemy_sub_trigger = yes } + save_scope_as = shared_foe + } + } + #You have a house feud against someone recipient is also opposed to + else_if = { + limit = { + + exists = house.house_head + exists = scope:recipient.house + NOT = { + house = scope:recipient.house + } + house = { + any_house_relation = { + has_house_relation_level = feud + any_relation_house = { + house_head = { mpo_blood_brother_common_enemy_sub_trigger = yes } + } + } + } + } + house = { + random_house_relation = { + limit = { + has_house_relation_level = feud + any_relation_house = { + house_head = { mpo_blood_brother_common_enemy_sub_trigger = yes } + } + } + random_relation_house = { + limit = { + house_head = { mpo_blood_brother_common_enemy_sub_trigger = yes } + } + house_head = { save_scope_as = shared_foe } + } + } + } + } + #In faction against someone recipient is opposed to + else_if = { + limit = { + liege ?= { + any_targeting_faction = { + any_faction_member = { + this = scope:actor + } + } + mpo_blood_brother_common_enemy_sub_trigger = yes + } + } + liege = { + save_scope_as = shared_foe + } + } + #You are at war with someone that recipient is also opposed to + else_if = { + limit = { + any_war_enemy = { + NOT = { has_variable = rebel_leader_peasants } + any_character_war = { + is_war_leader = prev + is_war_leader = scope:actor + } + mpo_blood_brother_common_enemy_sub_trigger = yes + } + } + ordered_war_enemy = { + order_by = max_military_strength + limit = { + NOT = { has_variable = rebel_leader_peasants } + any_character_war = { + is_war_leader = prev + is_war_leader = scope:actor + } + mpo_blood_brother_common_enemy_sub_trigger = yes + } + save_scope_as = shared_foe + } + } + #You have a faction member that recipient is also opposed to + else_if = { + limit = { + any_targeting_faction = { + any_faction_member = { + mpo_blood_brother_common_enemy_sub_trigger = yes + } + } + } + random_targeting_faction = { + ordered_faction_member = { + order_by = max_military_strength + limit = { + mpo_blood_brother_common_enemy_sub_trigger = yes + } + save_scope_as = shared_foe + } + } + } + #You are a title claimant against someone recipient don't like + else_if = { + limit = { + any_claim = { + exists = holder + NOT = { + scope:recipient = { has_claim_on = prev } + } + holder = { + mpo_blood_brother_common_enemy_sub_trigger = yes + } + } + } + ordered_claim = { + order_by = tier + limit = { + exists = holder + NOT = { + scope:recipient = { has_claim_on = prev } + } + holder = { + mpo_blood_brother_common_enemy_sub_trigger = yes + } + } + holder = { + save_scope_as = shared_foe + } + } + } + #You have a title claimant that recipient is also opposed to + else_if = { + limit = { + any_held_title = { + NOT = { + scope:recipient = { + has_claim_on = prev + } + } + any_claimant = { + mpo_blood_brother_common_enemy_sub_trigger = yes + } + } + } + ordered_held_title = { + order_by = tier + limit = { + NOT = { + scope:recipient = { + has_claim_on = prev + } + } + any_claimant = { + mpo_blood_brother_common_enemy_sub_trigger = yes + } + } + ordered_claimant = { + order_by = current_military_strength + limit = { + mpo_blood_brother_common_enemy_sub_trigger = yes + mpo_ideal_common_foe_trigger = yes + } + save_scope_as = shared_foe + } + } + } +} + +mpo_remove_blood_brother_modifiers_effect = { + remove_character_modifier = blood_brother_foe_modifier + remove_character_modifier = blood_brother_august_modifier + remove_character_modifier = blood_brother_august_nomadic_modifier + remove_character_modifier = blood_brother_warrior_modifier + remove_character_modifier = blood_brother_clever_modifier + remove_character_modifier = blood_brother_clever_nomadic_modifier + remove_character_modifier = blood_brother_loving_modifier + if = { + limit = { + has_variable = blood_brother_foe + } + remove_variable = blood_brother_foe + } + if = { + limit = { + any_relation = { + type = blood_brother + } + } + every_relation = { + type = blood_brother + + remove_character_modifier = blood_brother_foe_modifier + remove_character_modifier = blood_brother_august_modifier + remove_character_modifier = blood_brother_august_nomadic_modifier + remove_character_modifier = blood_brother_warrior_modifier + remove_character_modifier = blood_brother_clever_modifier + remove_character_modifier = blood_brother_clever_nomadic_modifier + remove_character_modifier = blood_brother_loving_modifier + if = { + limit = { + has_variable = blood_brother_foe + } + remove_variable = blood_brother_foe + } + } + } +} + +refill_maa_with_herd_effect = { + save_scope_as = nomad_temp + while = { + limit = { + scope:actor.domicile.herd > 0 + any_maa_regiment = { + maa_regiments_valid_to_refill_trigger = yes + } + } + random_maa_regiment = { + limit = { + maa_regiments_valid_to_refill_trigger = yes + } + save_scope_as = maa_scope + save_scope_value_as = { + name = current_herd_max_value_scope + value = scope:actor.domicile.herd + } + scope:actor.domicile ?= { + change_herd = { + value = { + add = scope:maa_scope.replenishable_troops_value + divide = herd_refill_value + max = scope:current_herd_max_value_scope + multiply = -1 + } + } + } + change_maa_troops_count = replenishable_troops_with_herd_value + } + } +} + +end_blood_brotherhood_effect = { + if = { + limit = { + has_relation_blood_brother = $TARGET$ + } + remove_relation_blood_brother = $TARGET$ + } +} + +make_obedient_recipient_to_actor_effect = { + if = { + limit = { + scope:recipient = { + obedience_target = scope:actor + NOT = { is_obedient_to = scope:actor } + } + } + scope:recipient = { + add_opinion = { + target = scope:actor + modifier = obedience_opinion + } + } + } +} + +lower_dominance_level_effect = { + switch = { + trigger = has_realm_law + nomadic_authority_1 = { + # Nothing happens + } + nomadic_authority_2 = { + remove_realm_law = nomadic_authority_2 + add_realm_law = nomadic_authority_1 + } + nomadic_authority_3 = { + remove_realm_law = nomadic_authority_3 + add_realm_law = nomadic_authority_2 + } + nomadic_authority_4 = { + remove_realm_law = nomadic_authority_4 + add_realm_law = nomadic_authority_3 + } + } + set_variable = { + name = nomadic_authority_cooldown + years = 5 + } +} + +adopt_nomadic_ways_decision_effect = { + change_government = nomad_government + custom_tooltip = adopt_nomadic_ways_decision_title_tt + custom_tooltip = adopt_nomadic_ways_decision_herd_tt + if = { + limit = { NOT = { has_trait = nomadic_philosophy } } + add_trait_force_tooltip = nomadic_philosophy + } +} + +# Different effect as we cannot access the Herder scope in the preview +adopt_nomadic_ways_decision_event_effect = { + add_character_flag = { + flag = domicile_culture_and_faith_check + days = 1 + } + set_variable = { + name = previous_provisions + value = root.domicile.provisions + } + change_government = nomad_government + location.county = { save_scope_as = title } + create_title_and_vassal_change = { + type = granted + save_scope_as = change + add_claim_on_loss = no + } + scope:title = { + change_title_holder = { + holder = root + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + # We give you 25% of your provisions as Herd + custom_tooltip = adopt_nomadic_ways_decision_herd_tt + domicile = { + change_herd = { + value = root.var:previous_provisions + multiply = 0.25 + } + } + if = { + limit = { NOT = { has_trait = nomadic_philosophy } } + add_trait = nomadic_philosophy + } +} + +mpo_confederation_join_defensive_war_effect = { + scope:defender.confederation = { + every_confederation_member = { + limit = { + highest_held_title_tier >= tier_county + NOR = { + is_at_war_with = scope:defender + is_allied_to = scope:attacker + is_imprisoned_by = scope:defender + is_imprisoned_by = scope:attacker + is_defender_in_war = scope:war + is_attacker_in_war = scope:war + } + } + scope:war = { + add_defender = prev + } + } + } +} + +confederation_migration_notification_effect = { + confederation ?= { + every_confederation_member = { + limit = { + NOT = { + this = scope:actor + } + } + send_interface_message = { + type = msg_broken_confederation + title = msg_broken_confederation_migration + desc = msg_broken_confederation_migration_desc + left_icon = scope:actor + } + } + } + send_interface_message = { + type = msg_broken_confederation + title = msg_broken_confederation_migration_root + desc = msg_broken_confederation_migration_root_desc + left_icon = confederation + } + add_character_flag = { + flag = migrating_from_confederation + months = 1 + } +} + +summon_three_fair_courtiers_effect = { + save_scope_as = root_scope + create_character = { + employer = scope:root_scope + template = $NOMAD_TEMPLATE_CHARACTER$ + faith = root.location.faith + culture = root.location.culture + save_scope_as = new_commander + } + if = { # Error suppression + limit = { + exists = scope:new_commander + } + scope:new_commander = { + assign_random_nickname_effect = yes + add_character_flag = { + flag = blocked_from_leaving + years = 25 + } + } + if = { + limit = { + scope:new_commander = { + NOT = { + is_courtier_of = scope:root_scope + } + } + } + add_courtier = scope:new_commander + } + send_interface_message = { + title = nomad_character_recruited.t + left_icon = scope:new_commander + custom_tooltip = commander_recruited.desc + } + } +} + +mpo_war_vassal_tributary_effect = { + create_title_and_vassal_change = { + type = conquest + save_scope_as = change + add_claim_on_loss = yes + } + + every_in_list = { + list = target_titles + if = { + limit = { + tier >= tier_county + } + every_de_jure_county = { + limit = { + holder = { + OR = { + this = scope:defender + top_liege = scope:defender + top_suzerain ?= scope:defender + } + } + } + holder ?= { + add_to_list = target_holder + } + add_to_list = target_titles + } + } + + holder ?= { + add_to_list = target_holder + save_scope_as = temp_de_jure_liege + } + add_hook_from_temp_de_jure_liege_to_attacker = yes + } + + every_in_list = { + list = target_titles + add_to_list = prestige_gain_list + } + + ordered_in_list = { + list = target_titles + order_by = tier + max = 1 + save_scope_as = war_goal_title + } + + every_in_list = { + list = target_holder + save_scope_as = current_target_holder + if = { + limit = { + NOT = { + any_held_county = { + exists = duchy + NOT = { is_in_list = target_titles } + } + } + NOR = { + this = scope:attacker + top_liege = scope:attacker + top_suzerain ?= scope:attacker + } + highest_held_title_tier <= scope:war_goal_title.tier + } + if = { + limit = { + NOR = { + this = scope:attacker + top_liege = scope:attacker + top_suzerain ?= scope:attacker + } + scope:attacker = { + vassal_count >= vassal_limit + } + } + start_tributary_from_war_effect = { + TRIBUTARY = scope:defender + SUZERAIN = scope:attacker + WAR = $WAR$ + } + #If you tributarize a confederate, they leave their confederation + if = { + limit = { + scope:defender = { + is_confederation_member = yes + } + } + scope:defender.confederation = { + remove_confederation_member = scope:defender + } + } + } + else_if = { + limit = { + NOR = { + this = scope:attacker + top_liege = scope:attacker + top_suzerain ?= scope:attacker + } + } + change_liege = { + liege = scope:attacker + change = scope:change + } + } + every_in_list = { + list = target_titles + limit = { + holder ?= { this = scope:current_target_holder } + } + remove_from_list = target_titles + } + } + } + + every_in_list = { + list = target_titles + limit = { + OR = { + NOT = { exists = holder } + holder ?= { + NOR = { + this = scope:attacker + any_liege_or_above = { this = scope:attacker } + top_suzerain ?= scope:attacker + } + } + } + } + change_title_holder = { + holder = scope:attacker + change = scope:change + } + remove_from_list = target_titles + } + + save_scope_value_as = { + name = cb_prestige_factor + value = { + value = 0 + every_in_list = { + list = prestige_gain_list + add = 50 + } + } + } + + scope:attacker = { + add_prestige = scope:cb_prestige_factor + } + resolve_title_and_vassal_change = scope:change + + scope:target_title = { + every_de_jure_county = { + limit = { + holder = { + government_has_flag = government_is_herder + is_tributary = no + } + } + hidden_effect = { + start_tributary_from_war_effect = { + TRIBUTARY = holder + SUZERAIN = scope:attacker + WAR = $WAR$ + } + } + } + if = { + limit = { + NOT = { target_is_de_jure_liege_or_above = scope:attacker.primary_title } + NOT = { + any_de_jure_county = { + holder = { + NOR = { + top_liege = scope:attacker + top_suzerain ?= scope:attacker + } + } + } + } + } + set_de_jure_liege_title = scope:attacker.primary_title + } + } + + every_in_list = { + list = target_holder + if = { + limit = { + NOT = { + any_held_title = { + exists = duchy + } + } + highest_held_title_tier > tier_county + } + every_held_title = { + limit = { + tier >= tier_county + } + scope:defender = { + destroy_title = prev + } + } + } + } +} + +#Called from game start on action +#inside domicile scope +add_random_yurt_external_building_effect = { + random_list = { + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = herd_welfare_yurt_01 } + } + add_domicile_building = herd_welfare_yurt_01 + } + 1 = { + trigger = { + NOT = { has_domicile_building_or_higher = character_warfare_yurt_01 } + } + add_domicile_building = character_warfare_yurt_01 + } + 1 = { + trigger = { + NOT = { has_domicile_building_or_higher = mass_warfare_yurt_01 } + } + add_domicile_building = mass_warfare_yurt_01 + } + 1 = { + trigger = { + NOT = { has_domicile_building_or_higher = court_yurt_01 } + } + add_domicile_building = court_yurt_01 + } + 1 = { + trigger = { + NOT = { has_domicile_building_or_higher = family_yurt_01 } + } + add_domicile_building = family_yurt_01 + } + 1 = { + trigger = { + NOT = { has_domicile_building_or_higher = mystical_yurt_01 } + } + add_domicile_building = mystical_yurt_01 + } + } +} + +#Called from game start on action +#Limited to lvl 3 to offer more variety and prevent startup errors +#inside domicile scope +upgrade_random_yurt_external_building_effect = { + random_list = { + 10 = { + trigger = { + has_domicile_building_or_higher = herd_welfare_yurt_01 + NOT = { + has_domicile_building_or_higher = herd_welfare_yurt_03 + } + } + switch = { + trigger = has_domicile_building + herd_welfare_yurt_01 = { add_domicile_building = herd_welfare_yurt_02 } + herd_welfare_yurt_02 = { add_domicile_building = herd_welfare_yurt_03 } + } + } + 1 = { + trigger = { + has_domicile_building_or_higher = character_warfare_yurt_01 + NOT = { + has_domicile_building_or_higher = character_warfare_yurt_03 + } + } + switch = { + trigger = has_domicile_building + character_warfare_yurt_01 = { add_domicile_building = character_warfare_yurt_02 } + character_warfare_yurt_02 = { add_domicile_building = character_warfare_yurt_03 } + } + } + 1 = { + trigger = { + has_domicile_building_or_higher = mass_warfare_yurt_01 + NOT = { + has_domicile_building_or_higher = mass_warfare_yurt_03 + } + } + switch = { + trigger = has_domicile_building + mass_warfare_yurt_01 = { add_domicile_building = mass_warfare_yurt_02 } + mass_warfare_yurt_02 = { add_domicile_building = mass_warfare_yurt_03 } + } + } + 1 = { + trigger = { + has_domicile_building_or_higher = court_yurt_01 + NOT = { + has_domicile_building_or_higher = court_yurt_03 + } + } + switch = { + trigger = has_domicile_building + court_yurt_01 = { add_domicile_building = court_yurt_02 } + court_yurt_02 = { add_domicile_building = court_yurt_03 } + } + } + 1 = { + trigger = { + has_domicile_building_or_higher = family_yurt_01 + NOT = { + has_domicile_building_or_higher = family_yurt_03 + } + } + switch = { + trigger = has_domicile_building + family_yurt_01 = { add_domicile_building = family_yurt_02 } + family_yurt_02 = { add_domicile_building = family_yurt_03 } + } + } + 1 = { + trigger = { + has_domicile_building_or_higher = mystical_yurt_01 + NOT = { + has_domicile_building_or_higher = mystical_yurt_03 + } + } + switch = { + trigger = has_domicile_building + mystical_yurt_01 = { add_domicile_building = mystical_yurt_02 } + mystical_yurt_02 = { add_domicile_building = mystical_yurt_03 } + } + } + } +} + +#Used to distribute the Dynasty of Many Khans dynasty_court_yurt_06 reward +#Called from yearly_on_action +#root is character +mpo_yearly_dynasty_of_many_khans_effect = { + if = { + limit = { + this = dynasty.dynast + dynasty = { + has_dynasty_modifier = dynasty_of_many_crowns_nomad + } + domicile ?= { + has_domicile_parameter = nomad_yurt_dynasty_many_khans + } + } + send_interface_toast = { + type = event_toast_effect_good + title = dynasty_many_khans_yearly_tt + set_variable = { + name = temp_dynn_prestige + value = 1 + } + dynasty = { + every_dynasty_member = { + limit = { + primary_title.tier >= tier_kingdom + } + root = { + change_variable = { + name = temp_dynn_prestige + add = minor_dynasty_prestige_gain + } + } + } + add_dynasty_prestige = root.var:temp_dynn_prestige + } + remove_variable = temp_dynn_prestige + } + } +} + +#Used to distribute yurt domicile rewards +#Called from yearly_on_action +#inside domicile scope +#root is the character +mpo_yearly_yurt_rewards_effect = { + if = { + limit = { + has_domicile_building_or_higher = hostage_ward_yurt_01 + } + switch = { + trigger = has_domicile_parameter + nomad_yurt_hostage_bonus_lvl_1 = { + hostage_ward_yurt_effect = { + CHANCE = 2 + } + } + nomad_yurt_hostage_bonus_lvl_2 = { + hostage_ward_yurt_effect = { + CHANCE = 3 + } + } + nomad_yurt_hostage_bonus_lvl_3 = { + hostage_ward_yurt_effect = { + CHANCE = 5 + } + } + } + } + if = { + limit = { + has_domicile_building_or_higher = language_yurt_01 + } + switch = { + trigger = has_domicile_parameter + nomad_yurt_yearly_bonus_per_language_lvl_1 = { + language_yurt_effect = { + CHANCE = 0.5 + } + } + nomad_yurt_yearly_bonus_per_language_lvl_2 = { + language_yurt_effect = { + CHANCE = 1 + } + } + nomad_yurt_yearly_bonus_per_language_lvl_3 = { + language_yurt_effect = { + CHANCE = 2 + } + } + } + } + if = { + limit = { + has_domicile_building_or_higher = omen_yurt_01 + } + } + switch = { + trigger = has_domicile_parameter + nomad_yurt_children_bonus_per_piety_lvl_1 = { + omen_yurt_effect = { + CHANCE = 0.5 + } + } + nomad_yurt_children_bonus_per_piety_lvl_2 = { + omen_yurt_effect = { + CHANCE = 1 + } + } + nomad_yurt_children_bonus_per_piety_lvl_3 = { + omen_yurt_effect = { + CHANCE = 2 + } + } + } + if = { + limit = { + has_domicile_building_or_higher = friend_yurt_01 + } + switch = { + trigger = has_domicile_parameter + nomad_yurt_friend_bonus_lvl_1 = { + friend_yurt_effect = { + CHANCE = 1 + } + } + nomad_yurt_friend_bonus_lvl_2= { + friend_yurt_effect = { + CHANCE = 2 + } + } + nomad_yurt_friend_bonus_lvl_3 = { + friend_yurt_effect = { + CHANCE = 3 + } + } + } + } + if = { + limit = { + has_domicile_building_or_higher = better_children_yurt_01 + } + switch = { + trigger = has_domicile_parameter + nomad_yurt_better_children_lvl_1 = { + better_children_yurt_effect = { + CHANCE = 5 + } + } + nomad_yurt_better_children_lvl_2 = { + better_children_yurt_effect = { + CHANCE = 10 + } + } + nomad_yurt_better_children_lvl_3 = { + better_children_yurt_effect = { + CHANCE = 15 + } + } + } + } + if = { + limit = { + has_domicile_building_or_higher = dynasty_court_yurt_01 + } + switch = { + trigger = has_domicile_parameter + nomad_yurt_same_dynasty_bonus_lvl_1 = { + dynasty_court_yurt_effect = { + CHANCE = 1 + } + } + nomad_yurt_same_dynasty_bonus_lvl_2 = { + dynasty_court_yurt_effect = { + CHANCE = 2 + } + } + nomad_yurt_same_dynasty_bonus_lvl_3 = { + dynasty_court_yurt_effect = { + CHANCE = 3 + } + } + } + } + if = { + limit = { + has_domicile_building_or_higher = culture_court_yurt_01 + } + switch = { + trigger = has_domicile_parameter + nomad_yurt_many_cultures_bonus_lvl_1 = { + culture_court_yurt_effect = { + CHANCE = 1 + PERCENT = 5 + } + } + nomad_yurt_many_cultures_bonus_lvl_2 = { + culture_court_yurt_effect = { + CHANCE = 2 + PERCENT = 5 + } + } + nomad_yurt_many_cultures_bonus_lvl_3 = { + culture_court_yurt_effect = { + CHANCE = 2 + PERCENT = 10 + } + } + } + } + if = { + limit = { + has_domicile_building_or_higher = fertility_mystical_yurt_01 + } + switch = { + trigger = has_domicile_parameter + nomad_yurt_herd_per_piety_fertility_mystical_lvl_1 = { + fertility_mystical_yurt_effect = { + CHANCE = 1 + PERCENT = 5 + } + } + nomad_yurt_herd_per_piety_fertility_mystical_lvl_2 = { + fertility_mystical_yurt_effect = { + CHANCE = 2 + PERCENT = 5 + } + } + nomad_yurt_herd_per_piety_fertility_mystical_lvl_3 = { + fertility_mystical_yurt_effect = { + CHANCE = 2 + PERCENT = 10 + } + } + } + } + if = { + limit = { + has_domicile_building_or_higher = knight_mystical_yurt_01 + } + switch = { + trigger = has_domicile_parameter + knight_skill_increase_per_piety_lvl_1 = { + knight_mystical_yurt_effect = { + CHANCE = 1 + PROWESS = 1 + } + } + knight_skill_increase_per_piety_lvl_2 = { + knight_mystical_yurt_effect = { + CHANCE = 2 + PROWESS = 1 + } + } + knight_skill_increase_per_piety_lvl_3 = { + knight_mystical_yurt_effect = { + CHANCE = 2 + PROWESS = 2 + } + } + } + } +} + +hostage_ward_yurt_effect = { + root = { + every_courtier = { + limit = { + is_hostage_of = root + } + add_to_list = temp_yurt_hostages + } + } + random = { + chance = { + value = "list_size(temp_yurt_hostages)" + multiply = $CHANCE$ + min = 0 + } + root = { + random_courtier = { + limit = { + is_hostage_of = root + } + save_scope_as = yurt_hostage + } + random_relation = { + type = ward + save_scope_as = yurt_ward + } + if = { + limit = { + exists = scope:yurt_ward + } + send_interface_message = { + title = hostage_ward_yurt_effect_tt + desc = hostage_ward_yurt_effect_desc + left_icon = scope:yurt_ward + right_icon = scope:yurt_hostage + scope:yurt_ward = { + random_list = { + 1 = { add_diplomacy_skill = 1 } + 1 = { add_stewardship_skill = 1 } + 1 = { add_intrigue_skill = 1 } + 1 = { add_learning_skill = 1 } + 1 = { add_martial_skill = 1 } + } + } + scope:yurt_hostage = { + increase_wounds_no_death_effect = { REASON = beaten } + } + root = { + add_prestige = 200 + } + } + } + } + } +} +language_yurt_effect = { + random = { + chance = { + value = root.num_of_known_languages + multiply = $CHANCE$ + min = 0 + } + root = { + send_interface_message = { + title = language_yurt_effect_tt + desc = language_yurt_effect_desc + left_icon = root + random_list = { + 1 = { add_diplomacy_skill = 1 } + 1 = { add_stewardship_skill = 1 } + 1 = { add_intrigue_skill = 1 } + 1 = { add_learning_skill = 1 } + 1 = { add_martial_skill = 1 } + } + } + } + } +} +de_jure_shifting_effect = { + while = { + count = 25 + limit = { + OR = { + any_realm_de_jure_$LOWER_TIER$ = { + mpo_de_jure_shifting_triggers = { UPPER_TIER = $UPPER_TIER$ } + } + any_tributary = { + highest_held_title_tier < root.highest_held_title_tier + any_realm_de_jure_$LOWER_TIER$ = { + mpo_de_jure_shifting_triggers = { UPPER_TIER = $UPPER_TIER$ } + } + } + } + } + random_realm_de_jure_$LOWER_TIER$ = { + limit = { + mpo_de_jure_shifting_triggers = { UPPER_TIER = $UPPER_TIER$ } + } + set_de_jure_liege_title = root.primary_title + add_to_list = de_jure_shifted_title + } + random_tributary = { + limit = { + highest_held_title_tier < root.highest_held_title_tier + any_realm_de_jure_$LOWER_TIER$ = { + mpo_de_jure_shifting_triggers = { UPPER_TIER = $UPPER_TIER$ } + } + } + random_realm_de_jure_$LOWER_TIER$ = { + limit = { + mpo_de_jure_shifting_triggers = { UPPER_TIER = $UPPER_TIER$ } + } + set_de_jure_liege_title = root.primary_title + add_to_list = de_jure_shifted_title + } + } + } + while = { + count = 25 + limit = { + list_size = { + name = de_jure_shifted_title + value >= 1 + } + } + root = { + send_interface_message = { + type = msg_mpo_de_jure_shifting + title = msg_mpo_de_jure_shifting + left_icon = root + ordered_in_list = { + order_by = { + value = 1 + } + max = 3 + list = de_jure_shifted_title + show_as_tooltip = { + set_de_jure_liege_title = root.primary_title + } + remove_from_list = de_jure_shifted_title + } + } + } + } +} + +omen_yurt_effect = { + random = { + chance = { + value = root.piety_level + multiply = $CHANCE$ + min = 0 + } + root = { + random_child = { + save_scope_as = improved_child + } + if = { + limit = { + exists = scope:improved_child + } + send_interface_message = { + title = omen_yurt_effect_tt + desc = omen_yurt_effect_desc + left_icon = scope:improved_child + scope:improved_knight = { + random_list = { + 1 = { add_diplomacy_skill = 1 } + 1 = { add_stewardship_skill = 1 } + 1 = { add_intrigue_skill = 1 } + 1 = { add_learning_skill = 1 } + 1 = { add_martial_skill = 1 } + } + } + } + } + } + } +} + +friend_yurt_effect = { + root = { + every_relation = { + type = friend + add_to_list = temp_yurt_friends + } + } + random = { + chance = { + value = "list_size(temp_yurt_friends)" + multiply = $CHANCE$ + min = 0 + } + root = { + random_relation = { + type = friend + save_scope_as = yurt_friend + } + send_interface_message = { + title = friend_yurt_effect_tt + desc = friend_yurt_effect_desc + left_icon = scope:yurt_friend + scope:yurt_friend = { + random_list = { + 1 = { add_diplomacy_skill = 1 } + 1 = { add_stewardship_skill = 1 } + 1 = { add_intrigue_skill = 1 } + 1 = { add_learning_skill = 1 } + 1 = { add_martial_skill = 1 } + } + } + root = { + random_list = { + 1 = { add_diplomacy_skill = 1 } + 1 = { add_stewardship_skill = 1 } + 1 = { add_intrigue_skill = 1 } + 1 = { add_learning_skill = 1 } + 1 = { add_martial_skill = 1 } + } + } + } + } + } +} + +better_children_yurt_effect = { + random = { + chance = $CHANCE$ + root = { + random_heir = { + limit = { + age < 17 + } + save_scope_as = yurt_heir + } + if = { + limit = { + exists = scope:yurt_heir + } + } + send_interface_message = { + title = better_children_yurt_effect_tt + desc = better_children_yurt_effect_desc + left_icon = scope:yurt_heir + scope:yurt_heir = { + random_list = { + 1 = { add_diplomacy_skill = 1 } + 1 = { add_stewardship_skill = 1 } + 1 = { add_intrigue_skill = 1 } + 1 = { add_learning_skill = 1 } + 1 = { add_martial_skill = 1 } + } + } + } + } + } +} + +dynasty_court_yurt_effect = { + root = { + every_councillor = { + limit = { + is_kurultai_trigger = yes + dynasty = root.dynasty + } + add_to_temporary_list = yurt_kurultai_list + } + } + random = { + chance = { + value = "list_size(yurt_kurultai_list)" + multiply = $CHANCE$ + min = 0 + } + root = { + send_interface_message = { + title = dynasty_court_yurt_effect_tt + desc = dynasty_court_yurt_effect_desc + domicile ?= { + change_herd = { + value = max_herd + multiply = 0.1 + } + } + } + } + } +} + +culture_court_yurt_effect = { + root = { + every_tributary = { + culture = { add_to_temporary_list = yurt_culture_list } + } + every_vassal = { + culture = { add_to_temporary_list = yurt_culture_list } + } + } + + random = { + chance = { + value = "list_size(yurt_culture_list)" + multiply = $CHANCE$ + min = 0 + } + root = { + send_interface_message = { + title = culture_court_yurt_effect_tt + desc = culture_court_yurt_effect_desc + domicile ?= { + change_herd = { + value = max_herd + multiply = 0.01 + multiply = $PERCENT$ + } + } + } + } + } +} + +knight_mystical_yurt_effect = { + random = { + chance = { + value = root.piety_level + multiply = $CHANCE$ + min = 0 + } + root = { + random_knight = { + save_scope_as = improved_knight + } + if = { + limit = { + exists = scope:improved_knight + } + send_interface_message = { + title = knight_mystical_yurt_effect_tt + desc = knight_mystical_yurt_effect_desc + left_icon = scope:improved_knight + scope:improved_knight = { + add_prowess_skill = $PROWESS$ + } + } + } + } + } +} + +fertility_mystical_yurt_effect = { + random = { + chance = { + value = root.piety_level + multiply = $CHANCE$ + min = 0 + } + root = { + send_interface_message = { + title = fertility_mystical_yurt_effect_tt + desc = fertility_mystical_yurt_effect_desc + domicile ?= { + change_herd = { + value = max_herd + multiply = 0.01 + multiply = $PERCENT$ + } + } + } + } + } +} + +clean_up_ai_nomad_effect = { + save_temporary_scope_as = nomad_capital_ruler + if = { + limit = { + is_ai = yes + is_at_war = no + domicile.herd < 500 + is_landed = no + any_held_title = { + exists = title_domicile + NOT = { exists = var:player_domicile_title } + } + is_imprisoned = no + OR = { + is_independent_ruler = yes + liege ?= { is_ai = yes } + } + is_migrating = no + NOT = { exists = involved_activity } + } + domicile.domicile_location = { save_scope_as = place_to_stay } + if = { + limit = { + location = scope:place_to_stay + } + add_to_list = movers + } + every_courtier = { + limit = { + location = scope:place_to_stay + } + add_to_list = movers + } + every_held_title = { + limit = { + exists = title_domicile + NOT = { exists = var:player_domicile_title } + } + scope:nomad_capital_ruler = { destroy_title = prev } + } + every_in_list = { + list = movers + limit = { + is_imprisoned = no + NOR = { + this = scope:nomad_capital_ruler + is_in_pool_at = scope:place_to_stay + } + } + move_to_pool_at = scope:place_to_stay + } + + random = { + chance = { + value = 20 + if = { + limit = { + any_player = { + OR = { + is_close_or_extended_family_of = scope:nomad_capital_ruler + is_consort_of = scope:nomad_capital_ruler + has_important_relationship_with_character_trigger = { CHARACTER = scope:nomad_capital_ruler } + is_allied_in_war = scope:nomad_capital_ruler + is_allied_to = scope:nomad_capital_ruler + is_at_war_with = scope:nomad_capital_ruler + } + } + } + add = 80 + } + } + if = { + limit = { + has_dlc_feature = roads_to_power + is_physically_able_adult = yes + exists = location.county + ai_can_valid_to_create_laamp_trigger = yes + } + create_landless_adventurer_title_effect = { + REASON = flag:voluntary + FLAVOR_CHAR = root + } + every_in_list = { + list = movers + limit = { + NOR = { + this = scope:nomad_capital_ruler + is_courtier_of = scope:nomad_capital_ruler + is_in_pool_at = scope:place_to_stay + } + } + move_to_pool_at = scope:place_to_stay + } + if = { + limit = { + NOT = { + exists = global_var:nomad_adventurer_spawn + } + } + set_global_variable = { + name = nomad_adventurer_spawn + value = 1 + } + } + else = { + change_global_variable = { + name = nomad_adventurer_spawn + add = 1 + } + } + } + } + + if = { + limit = { + scope:nomad_capital_ruler = { + is_ruler = no + } + } + every_in_list = { + list = movers + limit = { + is_imprisoned = no + this = scope:nomad_capital_ruler + NOT = { + is_in_pool_at = scope:place_to_stay + } + } + move_to_pool_at = scope:place_to_stay + } + } + } +} + +expanding_steppe_effect = { + switch = { + trigger = yes + # West + scope:ghw_region_anatolia = { + expanding_steppe_add_region_effect = { + SUB_REGION = west + REGION = ghw_region_anatolia + } + tgp_silk_road_expand_steppe_effect = { SUB_REGION = occident } + } + scope:custom_eastern_balkans = { + expanding_steppe_add_region_effect = { + SUB_REGION = west + REGION = custom_eastern_balkans + } + } + scope:ghw_region_northern_russia = { + expanding_steppe_add_region_effect = { + SUB_REGION = west + REGION = ghw_region_northern_russia + } + } + scope:ghw_region_southern_russia = { + expanding_steppe_add_region_effect = { + SUB_REGION = west + REGION = ghw_region_southern_russia + } + } + scope:custom_hungary = { + expanding_steppe_add_region_effect = { + SUB_REGION = west + REGION = custom_hungary + } + } + scope:ghw_region_poland = { + expanding_steppe_add_region_effect = { + SUB_REGION = west + REGION = ghw_region_poland + } + } + scope:ghw_region_baltic = { + expanding_steppe_add_region_effect = { + SUB_REGION = west + REGION = ghw_region_baltic + } + } + scope:dlc_mpo_steppe_caucasus_expansion = { + expanding_steppe_add_region_effect = { + SUB_REGION = west + REGION = dlc_mpo_steppe_caucasus_expansion + } + tgp_silk_road_expand_steppe_effect = { SUB_REGION = transcaspia } + tgp_silk_road_expand_steppe_effect = { SUB_REGION = occident } + } + # Central + scope:world_transoxiana = { + expanding_steppe_add_region_effect = { + SUB_REGION = central + REGION = world_transoxiana + } + tgp_silk_road_expand_steppe_effect = { SUB_REGION = transcaspia } + tgp_silk_road_expand_steppe_effect = { SUB_REGION = central_asia } + tgp_silk_road_expand_steppe_effect = { SUB_REGION = occident } + } + scope:world_khorasan = { + expanding_steppe_add_region_effect = { + SUB_REGION = central + REGION = world_khorasan + } + tgp_silk_road_expand_steppe_effect = { SUB_REGION = central_asia } + tgp_silk_road_expand_steppe_effect = { SUB_REGION = occident } + } + scope:dlc_mpo_steppe_persia_expansion = { + expanding_steppe_add_region_effect = { + SUB_REGION = central + REGION = dlc_mpo_steppe_persia_expansion + } + tgp_silk_road_expand_steppe_effect = { SUB_REGION = occident } + } + scope:dlc_mpo_steppe_siberia_further_expansion = { + expanding_steppe_add_region_effect = { + SUB_REGION = central + REGION = dlc_mpo_steppe_siberia_further_expansion + } + } + # East + scope:world_steppe_tarim = { + expanding_steppe_add_region_effect = { + SUB_REGION = east + REGION = world_steppe_tarim + } + tgp_silk_road_expand_steppe_effect = { SUB_REGION = central_asia } + tgp_silk_road_expand_steppe_effect = { SUB_REGION = transcaspia } + tgp_silk_road_expand_steppe_effect = { SUB_REGION = occident } + } + } +} + +expanding_steppe_add_region_effect = { + situation:the_great_steppe = { + situation_sub_region:steppe_$SUB_REGION$ = { + add_geographical_region = $REGION$ + } + } +} + +nomadic_heir_cleanup_realm_effect = { + if = { + limit = { + is_landed = yes + } + create_title_and_vassal_change = { + type = granted + save_scope_as = change + } + if = { + limit = { + exists = liege + } + liege = { + save_scope_as = old_liege + } + } + create_character = { + location = $CLEANUP_SCOPE_CHAR$.location + template = nomadic_chieftain_character + save_scope_as = inheritor_char + } + every_held_title = { + limit = { + is_landless_type_title = no + } + change_title_holder = { + holder = scope:inheritor_char + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + if = { + limit = { + exists = scope:old_liege + } + scope:inheritor_char = { + create_title_and_vassal_change = { + type = swear_fealty + save_scope_as = change + } + scope:recipient = { + change_liege = { + liege = scope:old_liege + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + } + } + } + if = { + limit = { + top_liege != $CLEANUP_SCOPE_CHAR$ + } + create_title_and_vassal_change = { + type = independency + save_scope_as = going_independent + add_claim_on_loss = no + } + becomes_independent = { + change = scope:going_independent + } + resolve_title_and_vassal_change = scope:going_independent + } +} + +nomadic_realm_split_effect = { + $ORIGINAL_REALM_HOLDER$ = { + save_scope_as = root_scope + } + $NEW_RULER$ = { + save_scope_as = new_ruler_scope + } + primary_title = { + every_in_de_jure_hierarchy = { + limit = { + tier = tier_county + holder.top_liege = scope:root_scope + } + add_to_list = de_jure_realm_counties_of_primary + add_to_list = combined_counties_of_primary + } + every_in_de_jure_hierarchy = { + limit = { + tier = tier_county + holder.top_liege != scope:root_scope + } + add_to_list = de_jure_realm_counties_of_primary_outside_realm + } + every_in_de_jure_hierarchy = { + limit = { + tier = tier_county + } + add_to_list = de_jure_realm_counties_of_primary_combined + } + every_in_de_facto_hierarchy = { + limit = { + tier = tier_county + holder.top_liege ?= scope:root_scope + NOT = { is_in_list = de_jure_realm_counties_of_primary } + } + add_to_list = de_facto_realm_counties_of_primary + add_to_list = combined_counties_of_primary + } + } + # Pick a suitable capital County, as far away from your capital as possible + ordered_in_list = { + list = de_jure_realm_counties_of_primary + limit = { + NOT = { + this = scope:root_scope.capital_county + } + } + order_by = { + value = "title_province.squared_distance(scope:root_scope.capital_province)" + } + save_scope_as = new_capital + } + + # Mark the capital duchy + scope:new_ruler_scope = { + scope:new_capital = { + add_to_list = counties_given_to_sibling + } + scope:new_capital.duchy = { + save_scope_as = capital_duchy + add_to_list = duchies_given_to_sibling + add_to_list = duchies_to_de_jure_shift + if = { + limit = { + holder.top_liege = scope:root_scope + holder.primary_title.tier < tier_kingdom + } + holder = { + add_to_list = rulers_transferred + } + } + every_in_de_jure_hierarchy = { + limit = { + is_in_list = combined_counties_of_primary + } + add_to_list = capital_duchy_counties + if = { + limit = { + NOT = { + is_in_list = counties_given_to_sibling + } + } + add_to_list = counties_given_to_sibling + } + if = { + limit = { + holder.top_liege = scope:root_scope + holder.primary_title.tier < tier_kingdom + } + holder = { + add_to_list = rulers_transferred + } + } + } + } + # Expand in a 'ring' first + scope:new_capital.duchy = { + every_title_to_title_neighboring_duchy = { + limit = { + any_in_de_jure_hierarchy = { + OR = { + is_in_list = de_jure_realm_counties_of_primary + is_in_list = de_jure_realm_counties_of_primary_outside_realm + } + } + } + add_to_list = duchies_to_de_jure_shift + if = { + limit = { + any_in_de_jure_hierarchy = { + is_in_list = de_jure_realm_counties_of_primary + } + } + add_to_list = duchies_given_to_sibling + if = { + limit = { + holder = { + top_liege = scope:root_scope + primary_title.tier < tier_kingdom + NOT = { is_in_list = rulers_transferred } + } + } + holder = { + add_to_list = rulers_transferred + } + } + every_in_de_jure_hierarchy = { + limit = { + is_in_list = de_jure_realm_counties_of_primary + } + add_to_list = counties_given_to_sibling + if = { + limit = { + holder = { + top_liege = scope:root_scope + primary_title.tier < tier_kingdom + NOT = { is_in_list = rulers_transferred } + } + } + holder = { + add_to_list = rulers_transferred + } + } + } + every_in_de_jure_hierarchy = { + limit = { + NOT = { is_in_list = de_jure_realm_counties_of_primary } + } + add_to_list = counties_de_jure_shifted_to_sibling + } + } + } + } + while = { + count = 50 + limit = { + "list_size(counties_given_to_sibling)" < { + value = "list_size(de_jure_realm_counties_of_primary)" + multiply = $SPLIT_VALUE$ + } + } + ordered_in_list = { + list = de_jure_realm_counties_of_primary_combined + limit = { + NOR = { + duchy = scope:root_scope.capital_county.duchy + duchy = { is_in_list = duchies_to_de_jure_shift } + is_in_list = counties_given_to_sibling + } + any_neighboring_county = { + OR = { + is_in_list = counties_given_to_sibling + duchy = { is_in_list = duchies_to_de_jure_shift } + } + } + } + order_by = { + value = "title_province.squared_distance(scope:root_scope.capital_province)" + } + duchy = { + add_to_list = duchies_to_de_jure_shift + if = { + limit = { + any_in_de_jure_hierarchy = { + is_in_list = de_jure_realm_counties_of_primary + } + } + add_to_list = duchies_given_to_sibling + if = { + limit = { + holder = { + top_liege = scope:root_scope + primary_title.tier < tier_kingdom + NOT = { is_in_list = rulers_transferred } + } + } + holder = { + add_to_list = rulers_transferred + } + } + every_in_de_jure_hierarchy = { + limit = { + is_in_list = de_jure_realm_counties_of_primary + } + add_to_list = counties_given_to_sibling + if = { + limit = { + holder = { + top_liege = scope:root_scope + primary_title.tier < tier_kingdom + NOT = { is_in_list = rulers_transferred } + } + } + holder = { + add_to_list = rulers_transferred + } + } + } + every_in_de_jure_hierarchy = { + limit = { + NOT = { is_in_list = de_jure_realm_counties_of_primary } + } + add_to_list = counties_de_jure_shifted_to_sibling + } + } + } + } + } + + # Hand out the titles properly + create_title_and_vassal_change = { + type = swear_fealty + add_claim_on_loss = yes + save_scope_as = change + } + + # Give capital + capital duchy + scope:capital_duchy = { + change_title_holder = { + holder = scope:new_ruler_scope + change = scope:change + } + } + every_in_list = { + list = capital_duchy_counties + change_title_holder = { + holder = scope:new_ruler_scope + change = scope:change + } + } + + # Form a new kingdom + save_scope_as = founder + scope:capital_duchy = { + save_scope_as = old_title + } + create_dynamic_title = { + tier = kingdom + name = NEW_CREATED_TITLE_NAME + } + scope:new_title = { + save_scope_as = new_kingdom_title + change_title_holder = { + holder = scope:new_ruler_scope + change = scope:change + } + generate_coa = yes + set_de_jure_liege_title = scope:root_scope.primary_title.empire + } + + # Do everything else + every_in_list = { + list = counties_given_to_sibling + if = { + limit = { + holder = { + NOT = { + this = scope:new_ruler_scope + } + OR = { + this = scope:root_scope + primary_title.tier >= tier_kingdom + } + } + } + change_title_holder = { + holder = scope:new_ruler_scope + change = scope:change + } + } + if = { + limit = { + NOT = { + this = scope:new_ruler_scope + } + holder = { + liege = scope:root_scope + primary_title.tier < tier_kingdom + } + } + holder = { + change_liege = { + liege = scope:new_ruler_scope + change = scope:change + } + } + } + } + + resolve_title_and_vassal_change = scope:change + + every_in_list = { + list = duchies_to_de_jure_shift + set_de_jure_liege_title = scope:new_kingdom_title + } + } +} + +mpo_abuse_authority_county_effect = { + location.duchy = { + every_de_jure_county = { + limit = { + county_ready_for_abuse_trigger = yes + } + change_county_fertility = -100 + change_county_control = -40 + add_county_modifier = { + modifier = mpo_paiza_abused_county_modifier + years = 4 + } + add_to_temporary_list = counties_to_abuse + } + every_de_jure_county = { + limit = { + county_ready_for_abuse_trigger = yes + } + holder = { + add_opinion = { + modifier = angry_opinion + target = root + opinion = -30 + } + } + } + every_de_jure_county = { + limit = { + county_ready_for_abuse_trigger = yes + } + custom = custom.mpo_resources_gained_abuse + root.domicile ?= { + change_herd = medium_herd_value + } + root = { + add_gold = medium_gold_value + add_prestige = medium_prestige_value + } + } + } +} diff --git a/N3OW/common/scripted_effects/09_mpo_greatest_of_khans_effects.txt b/N3OW/common/scripted_effects/09_mpo_greatest_of_khans_effects.txt new file mode 100644 index 00000000..59fa62ae --- /dev/null +++ b/N3OW/common/scripted_effects/09_mpo_greatest_of_khans_effects.txt @@ -0,0 +1,7274 @@ +# Form the actual Mongol Empire... +form_the_greatest_khan_empire_effect = { + save_scope_as = gok + + hidden_effect = { + if = { + limit = { + culture = culture:mongol + } + #Create the title + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + add_claim_on_loss = no + } + + title:e_mongol_empire = { + change_title_holder = { + holder = scope:gok + change = scope:title_change + } + save_scope_as = gok_title + } + resolve_title_and_vassal_change = scope:title_change + + assert_if = { + limit = { NOT = { exists = title:e_mongol_empire } } + text = "Mongol Empire title was not created!" + } + } + else = { + #You never know if they've switched government in the meantime just to ruin this whole thing... + if = { + limit = { + government_has_flag = government_is_nomadic + exists = domicile + } + create_dynamic_title = { + tier = empire + name = GREATEST_OF_KHANS_TITLE_DOMICILE_NAME + adj = GREATEST_OF_KHANS_TITLE_DOMICILE_NAME_ADJ + article = article_CONFEDERATION_CULTURE_NAME + } + scope:new_title = { + save_scope_as = gok_title + } + } + else = { + create_dynamic_title = { + tier = empire + name = GREATEST_OF_KHANS_TITLE_NAME + adj = GREATEST_OF_KHANS_TITLE_NAME_ADJ + article = article_CONFEDERATION_CULTURE_NAME + } + scope:new_title = { + save_scope_as = gok_title + } + } + + scope:gok_title = { + set_color_from_title = root.capital_county + set_definitive_form = yes + set_can_be_named_after_dynasty = no + set_can_use_nomadic_naming = no + } + + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + scope:gok_title = { + change_title_holder = { + holder = root + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + scope:gok_title = { + if = { + limit = { + exists = root.house + } + set_coa = root.house + } + else = { + generate_coa = yes + } + } + assert_if = { + limit = { NOT = { exists = scope:gok_title } } + text = "Greatest of Khan's title was not created!" + } + } + + if = { + limit = { NOT = { has_realm_law = single_heir_succession_kurultai_law } } + add_realm_law_skip_effects = single_heir_succession_kurultai_law + } + + set_primary_title_to = scope:gok_title + every_held_title = { + limit = { + tier = tier_empire + NOT = { this = scope:gok_title } + } + scope:gok = { + destroy_title = prev + } + } + if = { + limit = { + exists = capital_county.empire + capital_county.empire = { + NOT = { + exists = holder + } + } + } + capital_county.empire = { + save_scope_as = old_gok_empire + every_in_de_jure_hierarchy = { + limit = { + tier = tier_kingdom + } + set_de_jure_liege_title = scope:gok_title + } + } + } + } + + + spawn_gok_troops_effect = yes + + set_global_variable = { + name = mongol_empire_has_spawned + value = yes + } +} + +spawn_gok_troops_effect = { + #Cultural MaA armies + random_list = { + #Mangudai armies + 2 = { + trigger = { + trigger_if = { + limit = { + exists = domicile.domicile_culture + } + domicile.domicile_culture = { + has_cultural_parameter = unlock_maa_mangudai + } + } + trigger_else = { + culture = { + has_cultural_parameter = unlock_maa_mangudai + } + } + } + spawn_army = { + uses_supply = no + inheritable = yes + name = gok_event_troops + men_at_arms = { + type = nomadic_riders + stacks = gok_nomadic_riders_large_value + } + men_at_arms = { + type = mangudai + stacks = gok_maa_largish_value + } + men_at_arms = { + type = mangudai + stacks = gok_maa_largish_value + } + men_at_arms = { + type = steppe_raiders + stacks = gok_maa_largish_value + } + men_at_arms = { + type = nomad_lancers + stacks = gok_maa_smallish_value + } + location = capital_province + origin = capital_province + } + spawn_army = { + uses_supply = no + inheritable = yes + name = gok_event_troops + men_at_arms = { + type = nomadic_riders + stacks = gok_nomadic_riders_large_value + } + men_at_arms = { + type = mangudai + stacks = gok_maa_largish_value + } + men_at_arms = { + type = mangudai + stacks = gok_maa_largish_value + } + men_at_arms = { + type = steppe_raiders + stacks = gok_maa_largish_value + } + men_at_arms = { + type = nomad_lancers + stacks = gok_maa_smallish_value + } + location = capital_province + origin = capital_province + } + } + #Cataphract archers armies + 2 = { + trigger = { + trigger_if = { + limit = { + exists = domicile.domicile_culture + } + domicile.domicile_culture = { + has_cultural_parameter = unlock_maa_cataphract_archers + } + } + trigger_else = { + culture = { + has_cultural_parameter = unlock_maa_cataphract_archers + } + } + } + spawn_army = { + uses_supply = no + inheritable = yes + name = gok_event_troops + men_at_arms = { + type = nomadic_riders + stacks = gok_nomadic_riders_large_value + } + men_at_arms = { + type = cataphract_archers + stacks = gok_maa_smallish_value + } + men_at_arms = { + type = cataphract_archers + stacks = gok_maa_smallish_value + } + men_at_arms = { + type = steppe_raiders + stacks = gok_maa_largish_value + } + men_at_arms = { + type = nomad_lancers + stacks = gok_maa_smallish_value + } + location = capital_province + origin = capital_province + } + spawn_army = { + uses_supply = no + inheritable = yes + name = gok_event_troops + men_at_arms = { + type = nomadic_riders + stacks = gok_nomadic_riders_large_value + } + men_at_arms = { + type = cataphract_archers + stacks = gok_maa_smallish_value + } + men_at_arms = { + type = cataphract_archers + stacks = gok_maa_smallish_value + } + men_at_arms = { + type = steppe_raiders + stacks = gok_maa_largish_value + } + men_at_arms = { + type = nomad_lancers + stacks = gok_maa_smallish_value + } + location = capital_province + origin = capital_province + } + } + #Maturkan warriors armies + 1 = { + trigger = { + trigger_if = { + limit = { + exists = domicile.domicile_culture + } + domicile.domicile_culture = { + has_cultural_parameter = unlock_maa_maturkan_warriors + } + } + trigger_else = { + culture = { + has_cultural_parameter = unlock_maa_maturkan_warriors + } + } + + } + spawn_army = { + uses_supply = no + inheritable = yes + name = gok_event_troops + men_at_arms = { + type = nomadic_riders + stacks = gok_nomadic_riders_large_value + } + men_at_arms = { + type = horse_archers + stacks = gok_maa_medium_value + } + men_at_arms = { + type = maturkan_warriors + stacks = gok_maa_large_value + } + men_at_arms = { + type = steppe_raiders + stacks = gok_maa_medium_value + } + men_at_arms = { + type = nomad_lancers + stacks = gok_maa_smallish_value + } + location = capital_province + origin = capital_province + } + spawn_army = { + uses_supply = no + inheritable = yes + name = gok_event_troops + men_at_arms = { + type = nomadic_riders + stacks = gok_nomadic_riders_large_value + } + men_at_arms = { + type = horse_archers + stacks = gok_maa_medium_value + } + men_at_arms = { + type = maturkan_warriors + stacks = gok_maa_large_value + } + men_at_arms = { + type = steppe_raiders + stacks = gok_maa_medium_value + } + men_at_arms = { + type = nomad_lancers + stacks = gok_maa_smallish_value + } + location = capital_province + origin = capital_province + } + } + #Mulathamun + 2 = { + trigger = { + trigger_if = { + limit = { + exists = domicile.domicile_culture + } + domicile.domicile_culture = { + has_cultural_parameter = unlock_maa_mulaththamun + } + } + trigger_else = { + culture = { + has_cultural_parameter = unlock_maa_mulaththamun + } + } + } + spawn_army = { + uses_supply = no + inheritable = yes + name = gok_event_troops + men_at_arms = { + type = nomadic_riders + stacks = gok_nomadic_riders_large_value + } + men_at_arms = { + type = horse_archers + stacks = gok_maa_largish_value + } + men_at_arms = { + type = mulaththamun + stacks = gok_maa_largish_value + } + men_at_arms = { + type = mulaththamun + stacks = gok_maa_largish_value + } + men_at_arms = { + type = nomad_lancers + stacks = gok_maa_smallish_value + } + location = capital_province + origin = capital_province + } + spawn_army = { + uses_supply = no + inheritable = yes + name = gok_event_troops + men_at_arms = { + type = nomadic_riders + stacks = gok_nomadic_riders_large_value + } + men_at_arms = { + type = horse_archers + stacks = gok_maa_largish_value + } + men_at_arms = { + type = mulaththamun + stacks = gok_maa_largish_value + } + men_at_arms = { + type = mulaththamun + stacks = gok_maa_largish_value + } + men_at_arms = { + type = nomad_lancers + stacks = gok_maa_smallish_value + } + location = capital_province + origin = capital_province + } + } + #Camel cavalry + 1 = { + trigger = { + trigger_if = { + limit = { + exists = domicile.domicile_culture + } + domicile.domicile_culture = { + has_innovation = innovation_war_camels + } + } + trigger_else = { + culture = { + has_innovation = innovation_war_camels + } + } + } + spawn_army = { + uses_supply = no + inheritable = yes + name = gok_event_troops + men_at_arms = { + type = nomadic_riders + stacks = gok_nomadic_riders_large_value + } + men_at_arms = { + type = horse_archers + stacks = gok_maa_largish_value + } + men_at_arms = { + type = camel_rider + stacks = gok_maa_large_value + } + men_at_arms = { + type = steppe_raiders + stacks = gok_maa_medium_value + } + men_at_arms = { + type = nomad_lancers + stacks = gok_maa_smallish_value + } + location = capital_province + origin = capital_province + } + spawn_army = { + uses_supply = no + inheritable = yes + name = gok_event_troops + men_at_arms = { + type = nomadic_riders + stacks = gok_nomadic_riders_large_value + } + men_at_arms = { + type = horse_archers + stacks = gok_maa_largish_value + } + men_at_arms = { + type = camel_rider + stacks = gok_maa_large_value + } + men_at_arms = { + type = steppe_raiders + stacks = gok_maa_medium_value + } + men_at_arms = { + type = nomad_lancers + stacks = gok_maa_smallish_value + } + location = capital_province + origin = capital_province + } + } + #Generic fallback + 1 = { + trigger = { + trigger_if = { + limit = { + exists = domicile.domicile_culture + } + domicile.domicile_culture = { + NOR = { + has_cultural_parameter = unlock_maa_mangudai + has_cultural_parameter = unlock_maa_cataphract_archers + has_cultural_parameter = unlock_maa_maturkan_warriors + has_cultural_parameter = unlock_maa_mulaththamun + has_innovation = innovation_war_camels + } + } + } + trigger_else = { + culture = { + NOR = { + has_cultural_parameter = unlock_maa_mangudai + has_cultural_parameter = unlock_maa_cataphract_archers + has_cultural_parameter = unlock_maa_maturkan_warriors + has_cultural_parameter = unlock_maa_mulaththamun + has_innovation = innovation_war_camels + } + } + } + } + spawn_army = { + uses_supply = no + inheritable = yes + name = gok_event_troops + men_at_arms = { + type = nomadic_riders + stacks = gok_nomadic_riders_large_value + } + men_at_arms = { + type = horse_archers + stacks = gok_maa_largish_value + } + men_at_arms = { + type = heavy_horse_archers + stacks = gok_maa_medium_value + } + men_at_arms = { + type = steppe_raiders + stacks = gok_maa_largish_value + } + men_at_arms = { + type = nomad_lancers + stacks = gok_maa_smallish_value + } + location = capital_province + origin = capital_province + } + spawn_army = { + uses_supply = no + inheritable = yes + name = gok_event_troops + men_at_arms = { + type = nomadic_riders + stacks = gok_nomadic_riders_large_value + } + men_at_arms = { + type = horse_archers + stacks = gok_maa_largish_value + } + men_at_arms = { + type = heavy_horse_archers + stacks = gok_maa_medium_value + } + men_at_arms = { + type = steppe_raiders + stacks = gok_maa_largish_value + } + men_at_arms = { + type = nomad_lancers + stacks = gok_maa_smallish_value + } + location = capital_province + origin = capital_province + } + } + } + #Siege weapon armies + #Bombards + if = { + limit = { + OR = { + any_maa_regiment = { + is_maa_type = bombard + } + trigger_if = { + limit = { + exists = domicile.domicile_culture + } + domicile.domicile_culture = { + has_innovation = innovation_gunpowder + } + } + culture = { + has_innovation = innovation_gunpowder + } + #Any neighbor + any_land_neighboring_realm_with_tributaries_owner = { + culture = { + has_innovation = innovation_gunpowder + } + } + #Any culture in same empire as realm + any_culture_global = { + any_culture_empire = { + any_de_jure_county = { + OR = { + holder.top_suzerain = root + holder.top_liege = root + } + } + } + has_innovation = innovation_gunpowder + } + } + } + spawn_army = { + uses_supply = no + inheritable = yes + name = gok_event_troops + men_at_arms = { + type = nomadic_riders + stacks = gok_nomadic_riders_small_value + } + men_at_arms = { + type = horse_archers + stacks = gok_maa_medium_value + } + men_at_arms = { + type = heavy_horse_archers + stacks = gok_maa_smallish_value + } + men_at_arms = { + type = steppe_raiders + stacks = gok_maa_medium_value + } + men_at_arms = { + type = nomad_lancers + stacks = gok_maa_small_value + } + men_at_arms = { + type = bombard + stacks = gok_maa_smallish_value + } + men_at_arms = { + type = bombard + stacks = gok_maa_smallish_value + } + location = capital_province + origin = capital_province + } + spawn_army = { + uses_supply = no + inheritable = yes + name = gok_event_troops + men_at_arms = { + type = nomadic_riders + stacks = gok_nomadic_riders_small_value + } + men_at_arms = { + type = horse_archers + stacks = gok_maa_medium_value + } + men_at_arms = { + type = heavy_horse_archers + stacks = gok_maa_smallish_value + } + men_at_arms = { + type = steppe_raiders + stacks = gok_maa_medium_value + } + men_at_arms = { + type = nomad_lancers + stacks = gok_maa_small_value + } + men_at_arms = { + type = bombard + stacks = gok_maa_smallish_value + } + men_at_arms = { + type = bombard + stacks = gok_maa_smallish_value + } + location = capital_province + origin = capital_province + } + } + #Trebuchets + else_if = { + limit = { + OR = { + any_maa_regiment = { + is_maa_type = trebuchet + } + trigger_if = { + limit = { + exists = domicile.domicile_culture + } + domicile.domicile_culture = { + has_innovation = innovation_trebuchet + } + } + culture = { + has_innovation = innovation_trebuchet + } + #Any neighbor + any_land_neighboring_realm_with_tributaries_owner = { + culture = { + has_innovation = innovation_trebuchet + } + } + #Any culture in same kingdom as realm + any_culture_global = { + any_culture_kingdom = { + any_de_jure_county = { + OR = { + holder.top_suzerain = root + holder.top_liege = root + } + } + } + has_innovation = innovation_trebuchet + } + } + } + spawn_army = { + uses_supply = no + inheritable = yes + name = gok_event_troops + men_at_arms = { + type = nomadic_riders + stacks = gok_nomadic_riders_small_value + } + men_at_arms = { + type = horse_archers + stacks = gok_maa_medium_value + } + men_at_arms = { + type = heavy_horse_archers + stacks = gok_maa_smallish_value + } + men_at_arms = { + type = steppe_raiders + stacks = gok_maa_medium_value + } + men_at_arms = { + type = nomad_lancers + stacks = gok_maa_small_value + } + men_at_arms = { + type = trebuchet + stacks = gok_maa_smallish_value + } + men_at_arms = { + type = trebuchet + stacks = gok_maa_smallish_value + } + location = capital_province + origin = capital_province + } + spawn_army = { + uses_supply = no + inheritable = yes + name = gok_event_troops + men_at_arms = { + type = nomadic_riders + stacks = gok_nomadic_riders_small_value + } + men_at_arms = { + type = horse_archers + stacks = gok_maa_medium_value + } + men_at_arms = { + type = heavy_horse_archers + stacks = gok_maa_smallish_value + } + men_at_arms = { + type = steppe_raiders + stacks = gok_maa_medium_value + } + men_at_arms = { + type = nomad_lancers + stacks = gok_maa_small_value + } + men_at_arms = { + type = trebuchet + stacks = gok_maa_smallish_value + } + men_at_arms = { + type = trebuchet + stacks = gok_maa_smallish_value + } + location = capital_province + origin = capital_province + } + } + #Mangonels + else_if = { + limit = { + OR = { + any_maa_regiment = { + is_maa_type = mangonel + } + trigger_if = { + limit = { + exists = domicile.domicile_culture + } + domicile.domicile_culture = { + has_innovation = innovation_mangonel + } + } + culture = { + has_innovation = innovation_mangonel + } + #Any neighbor + any_land_neighboring_realm_with_tributaries_owner = { + culture = { + has_innovation = innovation_mangonel + } + } + #Any culture in same kingdom as realm + any_culture_global = { + any_culture_kingdom = { + any_de_jure_county = { + OR = { + holder.top_suzerain = root + holder.top_liege = root + } + } + } + has_innovation = innovation_mangonel + } + } + } + spawn_army = { + uses_supply = no + inheritable = yes + name = gok_event_troops + men_at_arms = { + type = nomadic_riders + stacks = gok_nomadic_riders_small_value + } + men_at_arms = { + type = horse_archers + stacks = gok_maa_medium_value + } + men_at_arms = { + type = heavy_horse_archers + stacks = gok_maa_smallish_value + } + men_at_arms = { + type = steppe_raiders + stacks = gok_maa_medium_value + } + men_at_arms = { + type = nomad_lancers + stacks = gok_maa_small_value + } + men_at_arms = { + type = mangonel + stacks = gok_maa_smallish_value + } + men_at_arms = { + type = mangonel + stacks = gok_maa_smallish_value + } + location = capital_province + origin = capital_province + } + spawn_army = { + uses_supply = no + inheritable = yes + name = gok_event_troops + men_at_arms = { + type = nomadic_riders + stacks = gok_nomadic_riders_small_value + } + men_at_arms = { + type = horse_archers + stacks = gok_maa_medium_value + } + men_at_arms = { + type = heavy_horse_archers + stacks = gok_maa_smallish_value + } + men_at_arms = { + type = steppe_raiders + stacks = gok_maa_medium_value + } + men_at_arms = { + type = nomad_lancers + stacks = gok_maa_small_value + } + men_at_arms = { + type = mangonel + stacks = gok_maa_smallish_value + } + men_at_arms = { + type = mangonel + stacks = gok_maa_smallish_value + } + location = capital_province + origin = capital_province + } + } + #Onagers (sorry) + else = { + spawn_army = { + uses_supply = no + inheritable = yes + name = gok_event_troops + men_at_arms = { + type = nomadic_riders + stacks = gok_nomadic_riders_small_value + } + men_at_arms = { + type = horse_archers + stacks = gok_maa_medium_value + } + men_at_arms = { + type = heavy_horse_archers + stacks = gok_maa_smallish_value + } + men_at_arms = { + type = steppe_raiders + stacks = gok_maa_medium_value + } + men_at_arms = { + type = nomad_lancers + stacks = gok_maa_small_value + } + men_at_arms = { + type = onager + stacks = gok_maa_smallish_value + } + men_at_arms = { + type = onager + stacks = gok_maa_smallish_value + } + location = capital_province + origin = capital_province + } + spawn_army = { + uses_supply = no + inheritable = yes + name = gok_event_troops + men_at_arms = { + type = nomadic_riders + stacks = gok_nomadic_riders_small_value + } + men_at_arms = { + type = horse_archers + stacks = gok_maa_medium_value + } + men_at_arms = { + type = heavy_horse_archers + stacks = gok_maa_smallish_value + } + men_at_arms = { + type = steppe_raiders + stacks = gok_maa_medium_value + } + men_at_arms = { + type = nomad_lancers + stacks = gok_maa_small_value + } + men_at_arms = { + type = onager + stacks = gok_maa_smallish_value + } + men_at_arms = { + type = onager + stacks = gok_maa_smallish_value + } + location = capital_province + origin = capital_province + } + } +} + +mpo_gok_war_of_defiance_cleanup_effect = { + scope:defender = { + remove_character_modifier = aspiring_great_khan_modifier + } +} + +mpo_find_powerful_opponent_for_gurkhan_effect = { + #Ok we're going to save all the valid options to a list and then pick the strongest of them + #Neighbors + every_land_neighboring_realm_with_tributaries_owner = { + limit = { + mpo_gok_coalition_member_trigger = yes + } + add_to_list = potential_gok_opponents + } + #All valid suzerains of neighbors + every_land_neighboring_realm_with_tributaries_owner = { + limit = { + is_tributary = yes + top_suzerain = { + mpo_gok_coalition_member_trigger = yes + } + } + top_suzerain = { + add_to_list = potential_gok_opponents + } + } + #People who hate you + every_relation = { + type = rival + limit = { + is_ruler = yes + mpo_gok_coalition_member_trigger = yes + } + add_to_list = potential_gok_opponents + } + #Those within same de jure empire + capital_county ?= { + empire = { + every_de_jure_county = { + limit = { + holder.top_Liege = { + mpo_gok_coalition_member_trigger = yes + } + } + holder.top_liege = { + add_to_list = potential_gok_opponents + } + } + every_de_jure_county = { + limit = { + holder.top_suzerain = { + mpo_gok_coalition_member_trigger = yes + } + } + holder.top_suzerain = { + add_to_list = potential_gok_opponents + } + } + } + } + #Those with capital within range + #Have to do a fallback in case everyone's military strength hasn't been calc'd yet + if = { + limit = { + any_independent_ruler = { + current_military_strength > 0 + } + } + every_independent_ruler = { + limit = { + highest_held_title_tier >= tier_duchy + exists = root.capital_county + realm_to_title_distance_squared = { + target = root.capital_county + value <= squared_distance_almost_massive + } + + mpo_gok_coalition_member_trigger = yes + } + add_to_list = potential_gok_opponents + } + } + else = { + every_independent_ruler = { + limit = { + highest_held_title_tier >= tier_duchy + exists = root.capital_county + realm_to_title_distance_squared = { + target = root.capital_county + value <= squared_distance_almost_massive + } + mpo_gok_coalition_member_trigger = yes + } + add_to_list = potential_gok_opponents + } + } + #Ideally we find someone at least half as strong as the Gurkhan... + if = { + limit = { + NOT = { + any_in_list = { + list = potential_gok_opponents + #THIS SHOULD CHECK THEIR STRENGTH IS MORE THAN HALF ROOT'S + confederation_worthy_foe_strength_ratio_value_root <= 2 + } + } + } + #expand search radius + if = { + limit = { + any_independent_ruler = { + current_military_strength > 0 + } + } + every_independent_ruler = { + limit = { + highest_held_title_tier >= tier_duchy + exists = root.capital_county + realm_to_title_distance_squared = { + target = root.capital_county + value <= squared_distance_massive + } + + mpo_gok_coalition_member_trigger = yes + } + add_to_list = potential_gok_opponents + } + } + else = { + every_independent_ruler = { + limit = { + highest_held_title_tier >= tier_duchy + exists = root.capital_county + realm_to_title_distance_squared = { + target = root.capital_county + value <= squared_distance_massive + } + mpo_gok_coalition_member_trigger = yes + } + add_to_list = potential_gok_opponents + } + } + } + if = { + limit = { + any_in_list = { + list = potential_gok_opponents + current_military_strength > 0 + } + } + ordered_in_list = { + list = potential_gok_opponents + limit = { + NOT = { + this = root + } + } + order_by = current_military_strength + add_to_list = anti_gok_coalition_members + save_scope_as = gok_opponent + } + } + else = { + ordered_in_list = { + list = potential_gok_opponents + limit = { + NOT = { + this = root + } + } + order_by = sub_realm_size + add_to_list = anti_gok_coalition_members + save_scope_as = gok_opponent + } + } +} + +gok_war_of_defiance_heir_transfer_effect = { + if = { + limit = { + has_variable = fought_for_gok_alone + } + save_scope_value_as = { + name = fought_for_gok_alone_value + value = var:fought_for_gok_alone + } + primary_heir = { + set_variable = { + name = fought_for_gok_alone + value = scope:fought_for_gok_alone_value + } + } + } +} + +mpo_gok_offer_submission_effect = { + #If emperor... loses titles + if = { + limit = { + scope:recipient = { + highest_held_title_tier >= tier_empire + } + } + scope:recipient = { + hidden_effect = { + every_vassal = { + limit = { + highest_held_title_tier = tier_kingdom + } + create_title_and_vassal_change = { + type = swear_fealty + save_scope_as = change + } + change_liege = { + liege = scope:actor + change = scope:change + } + add_opinion = { + modifier = became_vassal + target = scope:actor + opinion = 10 + } + resolve_title_and_vassal_change = scope:change + } + } + #Have to grant them a kingdom if they don't have any... + if = { + limit = { + NOT = { + any_held_title = { + tier = tier_kingdom + } + } + } + if = { + limit = { + capital_county.kingdom ?= { + NOT = { + exists = holder + } + } + } + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + capital_county.kingdom = { + change_title_holder = { + holder = scope:recipient + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + } + else = { + primary_title = { + save_scope_as = old_title + } + hidden_effect = { + #create some bullshit kingdom + create_dynamic_title = { + tier = kingdom + name = GOK_SUBJECT_TITLE_NAME + adj = GOK_SUBJECT_TITLE_NAME_ADJ + article = article_CONFEDERATION_CULTURE_NAME + } + scope:new_title = { + set_color_from_title = scope:recipient.capital_county + set_definitive_form = yes + generate_coa = yes + } + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + scope:new_title = { + change_title_holder = { + holder = scope:recipient + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + } + } + } + every_held_title = { + limit = { + tier >= tier_empire + } + scope:recipient = { + destroy_title = prev + } + } + } + } + + create_title_and_vassal_change = { + type = swear_fealty + save_scope_as = change + } + scope:recipient = { + change_liege = { + liege = scope:actor + change = scope:change + } + hidden_effect = { + add_opinion = { + modifier = became_vassal + target = scope:actor + opinion = 10 + } + } + } + resolve_title_and_vassal_change = scope:change + + #If GoK is a pluralist, they always get religious freedom + scope:recipient = { + if = { + limit = { + #Actor is still nomadic or pluralist and thus doesn't care about religion + scope:actor = { + faith = { + has_doctrine = doctrine_pluralism_pluralistic + } + } + OR = { + government_has_flag = government_is_feudal + government_has_flag = government_is_clan + } + } + hidden_effect = { + if = { + limit = { is_independent_ruler = no } # To avoid errors during tooltip generation (prior to the contract being generated) + vassal_contract_set_obligation_level = { type = religious_rights level = 1 } + } + } + custom_tooltip = religious_protection_tt + } + } + + # Special terms for feudal contracts + scope:recipient = { + if = { + limit = { + government_has_flag = government_is_feudal + } + if = { + limit = { + scope:send_tribute = yes + } + hidden_effect = { + if = { + limit = { is_independent_ruler = no } # To avoid errors during tooltip generation (prior to the contract being generated) + vassal_contract_set_obligation_level = { type = feudal_government_taxes level = 3 } + vassal_contract_set_obligation_level = { type = feudal_government_levies level = 3 } + } + } + custom_tooltip = high_obligations_taxes + custom_tooltip = high_obligations_levies + } + else_if = { + limit = { scope:low_obligations = yes } + hidden_effect = { + if = { + limit = { is_independent_ruler = no } # To avoid errors during tooltip generation (prior to the contract being generated) + vassal_contract_set_obligation_level = { type = feudal_government_taxes level = 1 } + vassal_contract_set_obligation_level = { type = feudal_government_levies level = 1 } + } + } + custom_tooltip = low_obligations_taxes + custom_tooltip = low_obligations_levies + } + else = { + hidden_effect = { + if = { + limit = { is_independent_ruler = no } # To avoid errors during tooltip generation (prior to the contract being generated) + vassal_contract_set_obligation_level = { type = feudal_government_taxes level = 2 } + vassal_contract_set_obligation_level = { type = feudal_government_levies level = 2 } + } + } + custom_tooltip = normal_obligations_taxes + custom_tooltip = normal_obligations_levies + } + } + else_if = { + limit = { + government_has_flag = government_is_nomadic + } + if = { + limit = { + scope:send_tribute = yes + } + hidden_effect = { + if = { + limit = { is_independent_ruler = no } # To avoid errors during tooltip generation (prior to the contract being generated) + vassal_contract_set_obligation_level = { type = nomad_government_herd level = 3 } + } + } + custom_tooltip = high_obligations_herds + } + else_if = { + limit = { scope:low_obligations = yes } + hidden_effect = { + if = { + limit = { is_independent_ruler = no } # To avoid errors during tooltip generation (prior to the contract being generated) + vassal_contract_set_obligation_level = { type = nomad_government_herd level = 1 } + } + } + custom_tooltip = low_obligations_herds + } + else = { + hidden_effect = { + if = { + limit = { is_independent_ruler = no } # To avoid errors during tooltip generation (prior to the contract being generated) + vassal_contract_set_obligation_level = { type = nomad_government_herd level = 2 } + } + } + custom_tooltip = normal_obligations_herds + } + } + #Demand payments payments + #Costs more for those who aren't paying increased taxes + if = { + limit = { + NOR = { + government_has_flag = government_is_feudal + government_has_flag = government_is_nomadic + government_has_flag = government_is_herder + } + } + if = { + limit = { + scope:send_tribute = yes + } + pay_short_term_gold = { + target = scope:actor + gold = monumental_gold_value + } + } + else_if = { + limit = { + NOT = { scope:low_obligations = yes } + } + pay_short_term_gold = { + target = scope:actor + gold = major_gold_value + } + } + } + else_if = { + limit = { + government_has_flag = government_is_nomadic + scope:send_tribute = yes + } + pay_herd = { + target = scope:actor + value = domicile.massive_herd_value + } + } + else_if = { + limit = { + scope:send_tribute = yes + } + pay_short_term_gold = { + target = scope:actor + gold = massive_gold_value + } + } + #special soldiers + #Pay some gold or herd to signify giving them up + if = { + limit = { + OR = { + scope:send_army = yes + scope:send_siege_weapons = yes + } + } + if = { + limit = { + government_has_flag = government_is_nomadic + } + domicile = { + change_herd = medium_herd_loss + } + } + else_if = { + limit = { + government_has_flag = government_is_tribal + } + add_prestige = medium_prestige_loss + } + else = { + remove_short_term_gold = medium_gold_value + } + } + if = { + limit = { + scope:send_army = yes + } + scope:actor = { + gok_spawn_subjugated_quality_army_effect = { CHARACTER = scope:recipient } + } + } + if = { + limit = { + scope:send_siege_weapons = yes + } + scope:actor = { + gok_spawn_subjugated_siege_army_effect = { CHARACTER = scope:recipient } + } + } + } + + # Struggle catalysts. + hidden_effect = { + fp3_struggle_apply_independent_vassalage_catalyst_effect = { + NEW_LIEGE = scope:actor + NEW_VASSAL = scope:recipient + } + } +} + +mpo_gok_offer_submission_refusal_effect = { + save_scope_as = actor + start_war = { + cb = mpo_gok_onslaught_cb + target = scope:recipient + target_title = scope:recipient.primary_title + } + custom_tooltip = gok_on_victory_tt + show_as_tooltip = { + rightfully_imprison_character_less_verbose_effect = { + TARGET = scope:recipient + IMPRISONER = scope:actor + } + } + custom_tooltip = gok_ruin_additional_destruction_tt + custom_tooltip = gok_gain_dread_tt + if = { + limit = { + government_has_flag = government_is_nomadic + scope:recipient.capital_county = { + any_county_province = { + OR = { + has_holding_type = nomad_holding + has_holding_type = herder_holding + } + } + } + } + custom_tooltip = gok_gain_herd_tt + } + else = { + custom_tooltip = gok_gain_gold_tt + } + if = { + limit = { + scope:send_army = yes + } + save_scope_as = requested_quality_army + custom_tooltip = gok_cb_event_troops_quality_tt + } + else_if = { + limit = { + scope:send_siege_weapons = yes + } + save_scope_as = requested_siege_army + custom_tooltip = gok_cb_event_troops_siege_tt + } + else = { + custom_tooltip = gok_cb_event_troops_tt + } + + custom_tooltip = gok_offer_submission_acceptance_bonus_tt + scope:recipient.primary_title = { + set_variable = { + name = refused_submission + value = yes + } + } +} + +gok_spawn_subjugated_siege_army_effect = { + $CHARACTER$ = { save_scope_as = army_giver } + custom_tooltip = gok_siege_army_gain_tt + if = { + limit = { + exists = $CHARACTER$.primary_title + } + $CHARACTER$.primary_title = { + save_scope_as = army_origin_realm + } + } + else = { + $CHARACTER$.location.county.kingdom = { + save_scope_as = army_origin_realm + } + } + hidden_effect = { + if = { + limit = {#s + OR = { + $CHARACTER$.culture = { + has_innovation = innovation_gunpowder + } + $CHARACTER$.capital_county.culture ?= { + has_innovation = innovation_gunpowder + } + } + } + random_list = { + #Heavy Infantry + 1 = { + trigger = { + OR = { + $CHARACTER$.culture = { + has_innovation = innovation_quilted_armor + } + $CHARACTER$.capital_county.culture ?= { + has_innovation = innovation_quilted_armor + } + } + } + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = heavy_infantry + value > 0 + } + } + add = 10 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_heavy_infantry_maa = yes + } + add = 10 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_heavy_infantry_maa = yes + } + add = 10 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = armored_footmen + stacks = gok_subjugated_army_maa_value_very_small + } + men_at_arms = { + type = bombard + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Pikemen + 1 = { + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = pikemen + value > 0 + } + } + add = 10 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_pikemen_maa = yes + } + add = 10 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_pikemen_maa = yes + } + add = 10 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = pikemen_unit + stacks = gok_subjugated_army_maa_value_very_small + } + men_at_arms = { + type = bombard + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Crossbowmen + 1 = { + trigger = { + OR = { + $CHARACTER$.culture = { + has_innovation = innovation_advanced_bowmaking + } + $CHARACTER$.capital_county.culture ?= { + has_innovation = innovation_advanced_bowmaking + } + } + } + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_type = { + target = crossbowmen + value > 0 + } + } + add = 10 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_archer_maa = yes + } + add = 10 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_archer_maa = yes + } + add = 10 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = crossbowmen + stacks = gok_subjugated_army_maa_value_very_small + } + men_at_arms = { + type = bombard + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Light Cavalry + 1 = { + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = light_cavalry + value > 0 + } + } + add = 10 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_light_cavalry_maa = yes + } + add = 10 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_light_cavalry_maa = yes + } + add = 10 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = light_horsemen + stacks = gok_subjugated_army_maa_value_very_small + } + men_at_arms = { + type = bombard + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Bowmen + 1 = { + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = archers + value > 0 + } + } + add = 10 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_archer_maa = yes + } + add = 10 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_archer_maa = yes + } + add = 10 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = bowmen + stacks = gok_subjugated_army_maa_value_small + } + men_at_arms = { + type = bombard + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Light Footmen + 1 = { + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = skirmishers + value > 0 + } + } + add = 10 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_skirmisher_maa = yes + } + add = 10 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_skirmisher_maa = yes + } + add = 10 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = light_footmen + stacks = gok_subjugated_army_maa_value_small + } + men_at_arms = { + type = bombard + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + } + } + else_if = { + limit = { + OR = { + $CHARACTER$.culture = { + has_innovation = innovation_trebuchet + } + $CHARACTER$.capital_county.culture ?= { + has_innovation = innovation_trebuchet + } + } + } + random_list = { + #Heavy Infantry + 1 = { + trigger = { + OR = { + $CHARACTER$.culture = { + has_innovation = innovation_quilted_armor + } + $CHARACTER$.capital_county.culture ?= { + has_innovation = innovation_quilted_armor + } + } + } + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = heavy_infantry + value > 0 + } + } + add = 10 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_heavy_infantry_maa = yes + } + add = 10 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_heavy_infantry_maa = yes + } + add = 10 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = armored_footmen + stacks = gok_subjugated_army_maa_value_very_small + } + men_at_arms = { + type = trebuchet + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Pikemen + 1 = { + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = pikemen + value > 0 + } + } + add = 10 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_pikemen_maa = yes + } + add = 10 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_pikemen_maa = yes + } + add = 10 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = pikemen_unit + stacks = gok_subjugated_army_maa_value_very_small + } + men_at_arms = { + type = trebuchet + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Crossbowmen + 1 = { + trigger = { + OR = { + $CHARACTER$.culture = { + has_innovation = innovation_advanced_bowmaking + } + $CHARACTER$.capital_county.culture ?= { + has_innovation = innovation_advanced_bowmaking + } + } + } + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_type = { + target = crossbowmen + value > 0 + } + } + add = 10 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_archer_maa = yes + } + add = 10 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_archer_maa = yes + } + add = 10 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = crossbowmen + stacks = gok_subjugated_army_maa_value_very_small + } + men_at_arms = { + type = trebuchet + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Light Cavalry + 1 = { + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = light_cavalry + value > 0 + } + } + add = 10 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_light_cavalry_maa = yes + } + add = 10 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_light_cavalry_maa = yes + } + add = 10 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = light_horsemen + stacks = gok_subjugated_army_maa_value_very_small + } + men_at_arms = { + type = trebuchet + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Bowmen + 1 = { + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = archers + value > 0 + } + } + add = 10 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_archer_maa = yes + } + add = 10 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_archer_maa = yes + } + add = 10 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = bowmen + stacks = gok_subjugated_army_maa_value_small + } + men_at_arms = { + type = trebuchet + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Light Footmen + 1 = { + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = skirmishers + value > 0 + } + } + add = 10 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_skirmisher_maa = yes + } + add = 10 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_skirmisher_maa = yes + } + add = 10 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = light_footmen + stacks = gok_subjugated_army_maa_value_small + } + men_at_arms = { + type = trebuchet + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + } + } + + else_if = { + limit = { + OR = { + $CHARACTER$.culture = { + has_innovation = innovation_mangonel + } + $CHARACTER$.capital_county.culture ?= { + has_innovation = innovation_mangonel + } + } + } + random_list = { + #Heavy Infantry + 1 = { + trigger = { + OR = { + $CHARACTER$.culture = { + has_innovation = innovation_quilted_armor + } + $CHARACTER$.capital_county.culture ?= { + has_innovation = innovation_quilted_armor + } + } + } + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = heavy_infantry + value > 0 + } + } + add = 10 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_heavy_infantry_maa = yes + } + add = 10 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_heavy_infantry_maa = yes + } + add = 10 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = armored_footmen + stacks = gok_subjugated_army_maa_value_very_small + } + men_at_arms = { + type = mangonel + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Pikemen + 1 = { + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = pikemen + value > 0 + } + } + add = 10 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_pikemen_maa = yes + } + add = 10 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_pikemen_maa = yes + } + add = 10 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = pikemen_unit + stacks = gok_subjugated_army_maa_value_very_small + } + men_at_arms = { + type = mangonel + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Crossbowmen + 1 = { + trigger = { + OR = { + $CHARACTER$.culture = { + has_innovation = innovation_advanced_bowmaking + } + $CHARACTER$.capital_county.culture ?= { + has_innovation = innovation_advanced_bowmaking + } + } + } + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_type = { + target = crossbowmen + value > 0 + } + } + add = 10 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_archer_maa = yes + } + add = 10 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_archer_maa = yes + } + add = 10 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = crossbowmen + stacks = gok_subjugated_army_maa_value_very_small + } + men_at_arms = { + type = mangonel + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Light Cavalry + 1 = { + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = light_cavalry + value > 0 + } + } + add = 10 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_light_cavalry_maa = yes + } + add = 10 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_light_cavalry_maa = yes + } + add = 10 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = light_horsemen + stacks = gok_subjugated_army_maa_value_very_small + } + men_at_arms = { + type = mangonel + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Bowmen + 1 = { + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = archers + value > 0 + } + } + add = 10 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_archer_maa = yes + } + add = 10 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_archer_maa = yes + } + add = 10 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = bowmen + stacks = gok_subjugated_army_maa_value_small + } + men_at_arms = { + type = mangonel + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Light Footmen + 1 = { + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = skirmishers + value > 0 + } + } + add = 10 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_skirmisher_maa = yes + } + add = 10 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_skirmisher_maa = yes + } + add = 10 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = light_footmen + stacks = gok_subjugated_army_maa_value_small + } + men_at_arms = { + type = mangonel + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + } + } + else = { + random_list = { + #Heavy Infantry + 1 = { + trigger = { + OR = { + $CHARACTER$.culture = { + has_innovation = innovation_quilted_armor + } + $CHARACTER$.capital_county.culture ?= { + has_innovation = innovation_quilted_armor + } + } + } + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = heavy_infantry + value > 0 + } + } + add = 10 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_heavy_infantry_maa = yes + } + add = 10 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_heavy_infantry_maa = yes + } + add = 10 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = armored_footmen + stacks = gok_subjugated_army_maa_value_very_small + } + men_at_arms = { + type = onager + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Pikemen + 1 = { + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = pikemen + value > 0 + } + } + add = 10 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_pikemen_maa = yes + } + add = 10 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_pikemen_maa = yes + } + add = 10 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = pikemen_unit + stacks = gok_subjugated_army_maa_value_very_small + } + men_at_arms = { + type = onager + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Crossbowmen + 1 = { + trigger = { + OR = { + $CHARACTER$.culture = { + has_innovation = innovation_advanced_bowmaking + } + $CHARACTER$.capital_county.culture ?= { + has_innovation = innovation_advanced_bowmaking + } + } + } + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_type = { + target = crossbowmen + value > 0 + } + } + add = 10 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_archer_maa = yes + } + add = 10 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_archer_maa = yes + } + add = 10 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = crossbowmen + stacks = gok_subjugated_army_maa_value_very_small + } + men_at_arms = { + type = onager + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Light Cavalry + 1 = { + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = light_cavalry + value > 0 + } + } + add = 10 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_light_cavalry_maa = yes + } + add = 10 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_light_cavalry_maa = yes + } + add = 10 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = light_horsemen + stacks = gok_subjugated_army_maa_value_very_small + } + men_at_arms = { + type = onager + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Bowmen + 1 = { + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = archers + value > 0 + } + } + add = 10 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_archer_maa = yes + } + add = 10 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_archer_maa = yes + } + add = 10 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = bowmen + stacks = gok_subjugated_army_maa_value_small + } + men_at_arms = { + type = onager + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Light Footmen + 1 = { + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = skirmishers + value > 0 + } + } + add = 10 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_skirmisher_maa = yes + } + add = 10 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_skirmisher_maa = yes + } + add = 10 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = light_footmen + stacks = gok_subjugated_army_maa_value_small + } + men_at_arms = { + type = onager + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + } + } + } +} + +gok_spawn_subjugated_quality_army_effect = { + $CHARACTER$ = { + save_scope_as = army_giver + } + custom_tooltip = gok_quality_army_gain_tt + if = { + limit = { + exists = $CHARACTER$.primary_title + } + $CHARACTER$.primary_title = { + save_scope_as = army_origin_realm + } + } + else = { + $CHARACTER$.location.county.kingdom = { + save_scope_as = army_origin_realm + } + } + hidden_effect = { + random_list = { + #Paiks + 200 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_innovation = innovation_bamboo_bows + } + capital_county.culture = { + has_innovation = innovation_bamboo_bows + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = paiks + stacks = gok_subjugated_army_maa_value_very_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Sahel Horsemen + 200 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_innovation = innovation_sahel_horsemen + } + capital_county.culture = { + has_innovation = innovation_sahel_horsemen + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = sahel_horsemen + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #WAR ELEPHANTS... I mean, come on + 200 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_innovation = innovation_elephantry + } + capital_county.culture = { + has_innovation = innovation_elephantry + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = war_elephant + stacks = gok_subjugated_army_maa_value_very_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Abudrar + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_abudrar + } + capital_county.culture = { + has_cultural_parameter = unlock_maa_abudrar + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = abudrar + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Ayyar + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_ayyar + } + capital_county.culture = { + has_cultural_parameter = unlock_maa_ayyar + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = ayyar + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Druzhina + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_druzhina + } + capital_county.culture = { + has_cultural_parameter = unlock_maa_druzhina + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = druzhina + stacks = gok_subjugated_army_maa_value_medium + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Chausseurs + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_innovation = innovation_desert_tactics + } + capital_county.culture = { + has_innovation = innovation_desert_tactics + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = chasseur + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Guinean Uplanders + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_guinea_warrior + } + capital_county.culture = { + has_cultural_parameter = unlock_maa_guinea_warrior + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = guinea_warrior + stacks = gok_subjugated_army_maa_value_very_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Khandayat + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_khandayat + } + capital_county.culture = { + has_cultural_parameter = unlock_maa_khandayat + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = khandayat + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Lenkas + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_garudas + } + capital_county.culture = { + has_cultural_parameter = unlock_maa_garudas + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = garudas + stacks = gok_subjugated_army_maa_value_medium + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Mountaineers + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_mountaineer + } + capital_county.culture = { + has_cultural_parameter = unlock_maa_mountaineer + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = mountaineer + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Mulathanum + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_mulaththamun + } + capital_county.culture = { + has_cultural_parameter = unlock_maa_mulaththamun + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = mulaththamun + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Nile Archers + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_archers_of_the_nile + } + capital_county.culture = { + has_cultural_parameter = unlock_maa_archers_of_the_nile + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = archers_of_the_nile + stacks = gok_subjugated_army_maa_value_very_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Palace Guards + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_palace_guards + } + capital_county.culture = { + has_cultural_parameter = unlock_maa_palace_guards + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = palace_guards + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Sarawit + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_innovation = innovation_sarawit + } + capital_county.culture = { + has_innovation = innovation_sarawit + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = sarawit + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Shomer + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_shomer + } + capital_county.culture = { + has_cultural_parameter = unlock_maa_shomer + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = shomer + stacks = gok_subjugated_army_maa_value_very_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Zbrojnosh + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_zbrojnosh + } + capital_county.culture = { + has_cultural_parameter = unlock_maa_zbrojnosh + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = zbrojnosh + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Bondi + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_bondi + } + capital_county.culture = { + has_cultural_parameter = unlock_maa_bondi + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = bondi + stacks = gok_subjugated_army_maa_value_very_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Vigmen + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_vigmen + } + capital_county.culture = { + has_cultural_parameter = unlock_maa_vigmen + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = vigmen + stacks = gok_subjugated_army_maa_value_very_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Tarkhans + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_tarkhan + } + capital_county.culture = { + has_cultural_parameter = unlock_maa_tarkhan + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = tarkhan + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Tawashi + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_tawashi + } + capital_county.culture = { + has_cultural_parameter = unlock_maa_tawashi + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = tawashi + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Zupin Spearmen + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_zupin_warrior + } + capital_county.culture = { + has_cultural_parameter = unlock_maa_zupin_warrior + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = zupin_warrior + stacks = gok_subjugated_army_maa_value_very_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Cho ko nu + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_innovation = innovation_repeating_crossbow + } + capital_county.culture = { + has_innovation = innovation_repeating_crossbow + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = shenbigong + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Palatini + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_innovation = innovation_legionnaires + } + capital_county.culture = { + has_innovation = innovation_legionnaires + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = praetorian + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Vaulter Infantry + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_innovation = innovation_pole_vault + } + capital_county.culture = { + has_innovation = innovation_pole_vault + } + } + } + } + + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = guanch_vaulter + stacks = gok_subjugated_army_maa_value_very_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #WARBAND + #Bush Hunters + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_bush_hunter + } + capital_county.culture = { + has_cultural_parameter = unlock_maa_bush_hunter + } + } + } + } + if = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_bush_hunter + } + } + scope:army_giver.culture = { save_scope_as = army_culture } + } + else = { + scope:army_giver.capital_county.culture = { save_scope_as = army_culture } + } + + spawn_army = { + name = greek_anarchy_war_nomad_army_name + uses_supply = no + inheritable = yes + + men_at_arms = { + type = bush_hunter + stacks = gok_subjugated_army_maa_value_very_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Horn Warriors + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_horn_warrior + } + capital_county.culture = { + has_cultural_parameter = unlock_maa_horn_warrior + } + } + } + } + if = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_horn_warrior + } + } + scope:army_giver.culture = { save_scope_as = army_culture } + } + else = { + scope:army_giver.capital_county.culture = { save_scope_as = army_culture } + } + + spawn_army = { + name = greek_anarchy_war_nomad_army_name + uses_supply = no + inheritable = yes + + men_at_arms = { + type = horn_warrior + stacks = gok_subjugated_army_maa_value_very_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Metsanvartija + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_metsanvartija + } + capital_county.culture = { + has_cultural_parameter = unlock_maa_metsanvartija + } + } + } + } + if = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_metsanvartija + } + } + scope:army_giver.culture = { save_scope_as = army_culture } + } + else = { + scope:army_giver.capital_county.culture = { save_scope_as = army_culture } + } + + spawn_army = { + name = greek_anarchy_war_nomad_army_name + uses_supply = no + inheritable = yes + + men_at_arms = { + type = metsanvartija + stacks = gok_subjugated_army_maa_value_very_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + + #Greeks + 300 = { + trigger = { + OR = { + scope:army_giver = { + capital_county = { + culture = { + has_cultural_parameter = unlock_maa_cataphract + } + } + } + scope:army_giver = { + culture = { + has_cultural_parameter = unlock_maa_cataphract + } + } + } + scope:army_giver = { + highest_held_title_tier >= tier_kingdom + } + } + if = { + limit = { + scope:army_giver = { + culture = { + has_cultural_parameter = unlock_maa_cataphract + } + } + } + scope:army_giver.culture = { save_scope_as = army_culture } + } + else_if = { + limit = { + scope:army_giver = { + capital_county = { + culture = { + has_cultural_parameter = unlock_maa_cataphract + } + } + } + } + scope:army_giver = { + capital_county = { + culture = { save_scope_as = army_culture } + } + } + } + else = { + culture = { + save_scope_as = army_culture + } + } + spawn_army = { + name = greek_anarchy_war_greek_army_name + uses_supply = no + inheritable = yes + + men_at_arms = { + type = cataphract + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + 100 = { + trigger = { + OR = { + scope:army_giver = { + culture = { + has_cultural_parameter = unlock_maa_ballistrai + } + } + scope:army_giver = { + capital_county = { + culture = { + has_cultural_parameter = unlock_maa_ballistrai + } + } + } + } + } + if = { + limit = { + scope:army_giver = { + culture = { + has_cultural_parameter = unlock_maa_ballistrai + } + } + } + scope:army_giver.culture = { save_scope_as = army_culture } + } + else_if = { + limit = { + scope:army_giver = { + capital_county = { + culture = { + has_cultural_parameter = unlock_maa_ballistrai + } + } + } + } + scope:army_giver = { + capital_county = { + culture = { save_scope_as = army_culture } + } + } + } + else = { + culture = { + save_scope_as = army_culture + } + } + spawn_army = { + name = greek_anarchy_war_greek_army_name + uses_supply = no + inheritable = yes + + men_at_arms = { + type = ballistrai + stacks = gok_subjugated_army_maa_value_very_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + 100 = { + trigger = { + OR = { + scope:army_giver = { + capital_county = { + culture = { + has_cultural_parameter = unlock_maa_skoutatoi + } + } + } + scope:army_giver = { + culture = { + has_cultural_parameter = unlock_maa_skoutatoi + } + } + } + } + if = { + limit = { + scope:army_giver = { + culture = { + has_cultural_parameter = unlock_maa_skoutatoi + } + } + } + scope:army_giver.culture = { save_scope_as = army_culture } + } + else_if = { + limit = { + scope:army_giver = { + capital_county = { + culture = { + has_cultural_parameter = unlock_maa_skoutatoi + } + } + } + } + scope:army_giver = { + capital_county = { + culture = { save_scope_as = army_culture } + } + } + } + else = { + culture = { + save_scope_as = army_culture + } + } + spawn_army = { + name = greek_anarchy_war_greek_army_name + uses_supply = no + inheritable = yes + + men_at_arms = { + type = skoutatoi + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + 100 = { + trigger = { + OR = { + scope:army_giver = { + capital_county = { + culture = { + has_cultural_parameter = unlock_maa_akritai + } + any_county_province = { + terrain = mountains + } + } + } + scope:army_giver = { + culture = { + has_cultural_parameter = unlock_maa_akritai + } + } + } + } + if = { + limit = { + scope:army_giver = { + culture = { + has_cultural_parameter = unlock_maa_akritai + } + } + } + scope:army_giver.culture = { save_scope_as = army_culture } + } + else_if = { + limit = { + scope:army_giver = { + capital_county = { + culture = { + has_cultural_parameter = unlock_maa_akritai + } + } + } + } + scope:army_giver = { + capital_county = { + culture = { save_scope_as = army_culture } + } + } + } + else = { + culture = { + save_scope_as = army_culture + } + } + spawn_army = { + name = greek_anarchy_war_greek_army_name + uses_supply = no + inheritable = yes + + men_at_arms = { + type = akritai + stacks = gok_subjugated_army_maa_value_very_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Armenians + 100 = { + trigger = { + OR = { + scope:army_giver = { + culture = { + has_cultural_parameter = unlock_maa_ayrudzi + } + } + scope:army_giver = { + capital_county = { + culture = { + has_cultural_parameter = unlock_maa_ayrudzi + } + } + } + } + } + if = { + limit = { + scope:army_giver = { + culture = { + has_cultural_parameter = unlock_maa_ayrudzi + } + } + } + scope:army_giver.culture = { save_scope_as = army_culture } + } + else_if = { + limit = { + scope:army_giver = { + capital_county = { + culture = { + has_cultural_parameter = unlock_maa_ayrudzi + } + } + } + } + scope:army_giver = { + capital_county = { + culture = { save_scope_as = army_culture } + } + } + } + else = { + culture = { + save_scope_as = army_culture + } + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = ayrudzi + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Georgians + 100 = { + trigger = { + OR = { + scope:army_giver = { + culture = { + has_cultural_parameter = unlock_maa_monaspa + } + } + scope:army_giver = { + capital_county = { + culture = { + has_cultural_parameter = unlock_maa_monaspa + } + } + } + } + } + if = { + limit = { + scope:army_giver = { + culture = { + has_cultural_parameter = unlock_maa_monaspa + } + } + } + scope:army_giver.culture = { save_scope_as = army_culture } + } + else_if = { + limit = { + scope:army_giver = { + capital_county = { + culture = { + has_cultural_parameter = unlock_maa_monaspa + } + } + } + } + scope:army_giver = { + capital_county = { + culture = { save_scope_as = army_culture } + } + } + } + else = { + culture = { + save_scope_as = army_culture + } + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = monaspa + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Cataphract archers + 100 = { + trigger = { + OR = { + scope:army_giver = { + culture = { + has_cultural_parameter = unlock_maa_cataphract_archers + } + } + scope:army_giver = { + capital_county = { + culture = { + has_cultural_parameter = unlock_maa_cataphract_archers + } + } + } + } + scope:army_giver = { + highest_held_title_tier >= tier_kingdom + } + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = cataphract_archers + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Konni folk get konni + 100 = { + trigger = { + OR = { + scope:army_giver = { + culture = { + has_cultural_parameter = unlock_maa_hussar + } + } + scope:army_giver = { + capital_county = { + culture = { + has_cultural_parameter = unlock_maa_hussar + } + } + } + } + } + if = { + limit = { + scope:army_giver = { + culture = { + has_cultural_parameter = unlock_maa_hussar + } + } + } + scope:army_giver.culture = { save_scope_as = army_culture } + } + else_if = { + limit = { + scope:army_giver = { + capital_county = { + culture = { + has_cultural_parameter = unlock_maa_hussar + } + } + } + } + scope:army_giver = { + capital_county = { + culture = { save_scope_as = army_culture } + } + } + } + else = { + culture = { + save_scope_as = army_culture + } + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = hussar + stacks = gok_subjugated_army_maa_value_medium + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Varangians + 100 = { + trigger = { + OR = { + culture = { + any_parent_culture_or_above = { + this = culture:greek + } + } + scope:army_giver = { + culture = { + has_cultural_parameter = unlock_maa_varangian_veterans + } + } + scope:army_giver = { + capital_county = { + culture = { + has_cultural_parameter = unlock_maa_varangian_veterans + } + } + } + } + } + modifier = { + OR = { + culture = { + this = culture:greek + } + culture = { + any_parent_culture_or_above = { + this = culture:greek + } + } + } + highest_held_title_tier <= tier_duchy + add = -8 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = varangian_veterans + stacks = gok_subjugated_army_maa_value_medium + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Horse archers + 2 = { + trigger = { + OR = { + scope:army_giver = { + capital_county = { + culture = { + culture_has_archer_cavalry_maa = yes + } + } + } + scope:army_giver = { + any_vassal = { + OR = { + culture = { culture_has_archer_cavalry_maa = yes } + mpo_can_recruit_nomad_maa_trigger = yes + } + } + } + scope:army_giver = { + OR = { + culture = { culture_has_archer_cavalry_maa = yes } + mpo_can_recruit_nomad_maa_trigger = yes + } + } + } + } + if = { + limit = { + scope:army_giver = { + capital_county = { + culture = { + culture_has_archer_cavalry_maa = yes + } + } + } + } + scope:army_giver = { + capital_county = { + culture = { save_scope_as = army_culture } + } + } + } + else_if = { + limit = { + scope:army_giver = { + OR = { + culture = { culture_has_archer_cavalry_maa = yes } + mpo_can_recruit_nomad_maa_trigger = yes + } + } + } + scope:army_giver = { + culture = { + save_scope_as = army_culture + } + } + } + else_if = { + limit = { + scope:army_giver = { + any_vassal = { + OR = { + culture = { culture_has_archer_cavalry_maa = yes } + mpo_can_recruit_nomad_maa_trigger = yes + } + } + } + } + scope:army_giver = { + random_vassal = { + limit = { + OR = { + culture = { culture_has_archer_cavalry_maa = yes } + mpo_can_recruit_nomad_maa_trigger = yes + } + } + culture = { save_scope_as = army_culture } + } + } + } + else = { + culture = { + save_scope_as = army_culture + } + } + spawn_army = { + name = greek_anarchy_war_nomad_army_name + uses_supply = no + inheritable = yes + + men_at_arms = { + type = horse_archers + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Crossbowmen + 5 = { + trigger = { + OR = { + scope:army_giver = { + culture = { + OR = { + has_innovation = innovation_advanced_bowmaking + has_innovation = innovation_repeating_crossbow + } + } + } + scope:army_giver = { + capital_county = { + culture = { + OR = { + has_innovation = innovation_advanced_bowmaking + has_innovation = innovation_repeating_crossbow + } + } + } + } + } + } + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_type = { + target = crossbowmen + value > 0 + } + } + add = 2 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_archer_maa = yes + } + add = 2 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_archer_maa = yes + } + add = 2 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + uses_supply = no + inheritable = yes + + men_at_arms = { + type = crossbowmen + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Norman knights + 100 = { + trigger = { + OR = { + scope:army_giver.culture = { + has_cultural_parameter = unlock_maa_conrois + } + scope:army_giver.capital_county = { + culture = { + has_cultural_parameter = unlock_maa_conrois + } + } + } + } + modifier = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_conrois + } + top_liege = { + any_vassal = { + highest_held_title_tier >= tier_county + culture = { + has_cultural_parameter = unlock_maa_conrois + } + } + } + capital_county = { + culture = { + has_cultural_parameter = unlock_maa_conrois + } + } + } + add = 18 + } + if = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_conrois + } + } + culture = { + save_scope_as = army_culture + } + } + else_if = { + limit = { + top_liege = { + any_vassal = { + culture = { + has_cultural_parameter = unlock_maa_conrois + } + } + } + } + top_liege = { + random_vassal = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_conrois + } + } + culture = { + save_scope_as = army_culture + } + } + } + } + else_if = { + limit = { + capital_county = { + culture = { + has_cultural_parameter = unlock_maa_conrois + } + } + } + capital_county = { + culture = { + save_scope_as = army_culture + } + } + } + else = { + culture:norman = { + save_scope_as = army_culture + } + } + spawn_army = { + name = greek_anarchy_war_crusaders_army_name + uses_supply = no + inheritable = yes + + men_at_arms = { + type = conrois + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Longbowmen + 100 = { + trigger = { + OR = { + top_liege = { + any_vassal = { + highest_held_title_tier >= tier_county + culture = { + has_cultural_parameter = unlock_maa_longbowmen + } + } + } + capital_county = { + culture = { + has_cultural_parameter = unlock_maa_longbowmen + } + } + } + } + if = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_longbowmen + } + } + culture = { + save_scope_as = army_culture + } + } + else_if = { + limit = { + top_liege = { + any_vassal = { + culture = { + has_cultural_parameter = unlock_maa_longbowmen + } + } + } + } + top_liege = { + random_vassal = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_longbowmen + } + } + culture = { + save_scope_as = army_culture + } + } + } + } + else = { + capital_county = { + culture = { + save_scope_as = army_culture + } + } + } + spawn_army = { + name = greek_anarchy_war_crusaders_army_name + uses_supply = no + inheritable = yes + + men_at_arms = { + type = longbowmen + stacks = gok_subjugated_army_maa_value_very_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Picchieri + 100 = { + trigger = { + OR = { + top_liege = { + any_vassal = { + highest_held_title_tier >= tier_county + culture = { + has_innovation = innovation_pike_columns + } + } + } + capital_county = { + culture = { + has_innovation = innovation_pike_columns + } + } + } + } + if = { + limit = { + culture = { + has_innovation = innovation_pike_columns + } + } + culture = { + save_scope_as = army_culture + } + } + else_if = { + limit = { + top_liege = { + any_vassal = { + culture = { + has_innovation = innovation_pike_columns + } + } + } + } + top_liege = { + random_vassal = { + limit = { + culture = { + has_innovation = innovation_pike_columns + } + } + culture = { + save_scope_as = army_culture + } + } + } + } + else = { + capital_county = { + culture = { + save_scope_as = army_culture + } + } + } + spawn_army = { + name = greek_anarchy_war_crusaders_army_name + uses_supply = no + inheritable = yes + + men_at_arms = { + type = picchieri + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Goedendag + 100 = { + trigger = { + OR = { + top_liege = { + any_vassal = { + highest_held_title_tier >= tier_county + culture = { + has_innovation = innovation_adaptive_militia + } + } + } + capital_county = { + culture = { + has_innovation = innovation_adaptive_militia + } + } + } + } + if = { + limit = { + culture = { + has_innovation = innovation_adaptive_militia + } + } + culture = { + save_scope_as = army_culture + } + } + else_if = { + limit = { + top_liege = { + any_vassal = { + culture = { + has_innovation = innovation_adaptive_militia + } + } + } + } + top_liege = { + random_vassal = { + limit = { + culture = { + has_innovation = innovation_adaptive_militia + } + } + culture = { + save_scope_as = army_culture + } + } + } + } + else = { + capital_county = { + culture = { + save_scope_as = army_culture + } + } + } + spawn_army = { + name = greek_anarchy_war_crusaders_army_name + uses_supply = no + inheritable = yes + + men_at_arms = { + type = goedendag + stacks = gok_subjugated_army_maa_value_very_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Caballeros + 100 = { + trigger = { + OR = { + top_liege = { + any_vassal = { + highest_held_title_tier >= tier_county + culture = { + has_innovation = innovation_caballeros + } + } + } + capital_county = { + culture = { + has_innovation = innovation_caballeros + } + } + } + } + if = { + limit = { + culture = { + has_innovation = innovation_caballeros + } + } + culture = { + save_scope_as = army_culture + } + } + else_if = { + limit = { + top_liege = { + any_vassal = { + culture = { + has_innovation = innovation_caballeros + } + } + } + } + top_liege = { + random_vassal = { + limit = { + culture = { + has_innovation = innovation_caballeros + } + } + culture = { + save_scope_as = army_culture + } + } + } + } + else = { + capital_county = { + culture = { + save_scope_as = army_culture + } + } + } + spawn_army = { + name = greek_anarchy_war_crusaders_army_name + uses_supply = no + inheritable = yes + + men_at_arms = { + type = caballero + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Hobbies + 100 = { + trigger = { + OR = { + top_liege = { + any_vassal = { + highest_held_title_tier >= tier_county + culture = { + has_innovation = innovation_hobbies + } + } + } + capital_county = { + culture = { + has_innovation = innovation_hobbies + } + } + } + } + if = { + limit = { + culture = { + has_innovation = innovation_hobbies + } + } + culture = { + save_scope_as = army_culture + } + } + else_if = { + limit = { + top_liege = { + any_vassal = { + culture = { + has_innovation = innovation_hobbies + } + } + } + } + top_liege = { + random_vassal = { + limit = { + culture = { + has_innovation = innovation_hobbies + } + } + culture = { + save_scope_as = army_culture + } + } + } + } + else = { + capital_county = { + culture = { + save_scope_as = army_culture + } + } + } + spawn_army = { + name = greek_anarchy_war_crusaders_army_name + uses_supply = no + inheritable = yes + + men_at_arms = { + type = hobelar + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Schiltron + 100 = { + trigger = { + OR = { + top_liege = { + any_vassal = { + highest_held_title_tier >= tier_county + culture = { + has_innovation = innovation_rectilinear_schiltron + } + } + } + capital_county = { + culture = { + has_innovation = innovation_rectilinear_schiltron + } + } + } + } + if = { + limit = { + culture = { + has_innovation = innovation_rectilinear_schiltron + } + } + culture = { + save_scope_as = army_culture + } + } + else_if = { + limit = { + top_liege = { + any_vassal = { + culture = { + has_innovation = innovation_rectilinear_schiltron + } + } + } + } + top_liege = { + random_vassal = { + limit = { + culture = { + has_innovation = innovation_rectilinear_schiltron + } + } + culture = { + save_scope_as = army_culture + } + } + } + } + else = { + capital_county = { + culture = { + save_scope_as = army_culture + } + } + } + spawn_army = { + name = greek_anarchy_war_crusaders_army_name + uses_supply = no + inheritable = yes + + men_at_arms = { + type = schiltron + stacks = gok_subjugated_army_maa_value_medium + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Valets + 100 = { + trigger = { + OR = { + top_liege = { + any_vassal = { + highest_held_title_tier >= tier_county + culture = { + has_innovation = innovation_valets + } + } + } + capital_county = { + culture = { + has_innovation = innovation_valets + } + } + } + scope:army_giver = { + highest_held_title_tier >= tier_kingdom + } + } + if = { + limit = { + culture = { + has_innovation = innovation_valets + } + } + culture = { + save_scope_as = army_culture + } + } + else_if = { + limit = { + top_liege = { + any_vassal = { + culture = { + has_innovation = innovation_valets + } + } + } + } + top_liege = { + random_vassal = { + limit = { + culture = { + has_innovation = innovation_valets + } + } + culture = { + save_scope_as = army_culture + } + } + } + } + else = { + capital_county = { + culture = { + save_scope_as = army_culture + } + } + } + spawn_army = { + name = greek_anarchy_war_crusaders_army_name + uses_supply = no + inheritable = yes + + men_at_arms = { + type = gendarme + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #landsknecht + 100 = { + trigger = { + OR = { + top_liege = { + any_vassal = { + highest_held_title_tier >= tier_county + culture = { + has_innovation = innovation_zweihanders + } + } + } + capital_county = { + culture = { + has_innovation = innovation_zweihanders + } + } + } + } + if = { + limit = { + culture = { + has_innovation = innovation_zweihanders + } + } + culture = { + save_scope_as = army_culture + } + } + else_if = { + limit = { + top_liege = { + any_vassal = { + culture = { + has_innovation = innovation_zweihanders + } + } + } + } + top_liege = { + random_vassal = { + limit = { + culture = { + has_innovation = innovation_zweihanders + } + } + culture = { + save_scope_as = army_culture + } + } + } + } + else = { + capital_county = { + culture = { + save_scope_as = army_culture + } + } + } + spawn_army = { + name = greek_anarchy_war_crusaders_army_name + uses_supply = no + inheritable = yes + + men_at_arms = { + type = landsknecht + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Huscarls + 100 = { + trigger = { + OR = { + top_liege = { + any_vassal = { + highest_held_title_tier >= tier_county + culture = { + has_cultural_parameter = unlock_maa_huscarls + } + } + } + capital_county = { + culture = { + has_cultural_parameter = unlock_maa_huscarls + } + } + } + } + if = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_huscarls + } + } + culture = { + save_scope_as = army_culture + } + } + else_if = { + limit = { + top_liege = { + any_vassal = { + culture = { + has_cultural_parameter = unlock_maa_huscarls + } + } + } + } + top_liege = { + random_vassal = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_huscarls + } + } + culture = { + save_scope_as = army_culture + } + } + } + } + else = { + capital_county = { + culture = { + save_scope_as = army_culture + } + } + } + spawn_army = { + name = greek_anarchy_war_crusaders_army_name + uses_supply = no + inheritable = yes + + men_at_arms = { + type = huscarl + stacks = gok_subjugated_army_maa_value_medium + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Camels + 3 = { + trigger = { + OR = { + scope:army_giver = { + capital_county = { + culture = { + has_innovation = innovation_war_camels + } + any_county_province = { + OR = { + terrain = drylands + terrain = desert + } + } + } + } + } + } + if = { + limit = { + scope:army_giver = { + capital_county = { + culture = { + has_innovation = innovation_war_camels + } + any_county_province = { + OR = { + terrain = drylands + terrain = desert + } + } + } + } + } + scope:army_giver = { + capital_county = { + culture = { + save_scope_as = army_culture + } + } + } + } + else = { + culture = { + save_scope_as = army_culture + } + } + spawn_army = { + name = greek_anarchy_war_nomad_army_name + uses_supply = no + inheritable = yes + + men_at_arms = { + type = camel_rider + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Heavy cav + 3 = { + trigger = { + OR = { + scope:army_giver = { + culture = { + has_innovation = innovation_arched_saddle + } + } + scope:army_giver = { + capital_county = { + culture = { + has_innovation = innovation_arched_saddle + } + } + } + } + scope:army_giver = { + highest_held_title_tier >= tier_kingdom + } + OR = { + scope:army_giver = { + NOT = { + government_has_flag = government_is_nomadic + } + } + scope:army_giver = { + capital_county = { + NOT = { + any_county_province = { + OR = { + has_holding_type = nomad_holding + has_holding_type = herder_holding + } + } + } + } + } + } + } + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = heavy_cavalry + value > 0 + } + } + add = 2 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_heavy_cavalry_maa = yes + } + add = 2 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_heavy_cavalry_maa = yes + } + add = 2 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = armored_horsemen + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Heavy Infantry + 1 = { + trigger = { + OR = { + scope:army_giver = { + culture = { + has_innovation = innovation_quilted_armor + } + } + scope:army_giver = { + capital_county = { + culture = { + has_innovation = innovation_quilted_armor + } + } + } + } + OR = { + scope:army_giver = { + NOT = { + government_has_flag = government_is_nomadic + } + } + scope:army_giver = { + capital_county = { + NOT = { + any_county_province = { + OR = { + has_holding_type = nomad_holding + has_holding_type = herder_holding + } + } + } + } + } + } + } + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = heavy_infantry + value > 0 + } + } + add = 2 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_heavy_infantry_maa = yes + } + add = 2 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_heavy_infantry_maa = yes + } + add = 2 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = armored_footmen + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Pikemen + 1 = { + trigger = { + scope:army_giver = { + capital_county = { + any_county_province = { + terrain = mountains + } + } + } + OR = { + scope:army_giver = { + NOT = { + government_has_flag = government_is_nomadic + } + } + scope:army_giver = { + capital_county = { + NOT = { + any_county_province = { + OR = { + has_holding_type = nomad_holding + has_holding_type = herder_holding + } + } + } + } + } + } + } + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = pikemen + value > 0 + } + } + add = 2 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_pikemen_maa = yes + } + add = 2 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_pikemen_maa = yes + } + add = 2 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = pikemen_unit + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Archers + 1 = { + trigger = { + scope:army_giver = { + capital_county = { + any_county_province = { + terrain = forest + } + } + } + OR = { + scope:army_giver = { + NOT = { + government_has_flag = government_is_nomadic + } + } + scope:army_giver = { + capital_county = { + NOT = { + any_county_province = { + OR = { + has_holding_type = nomad_holding + has_holding_type = herder_holding + } + } + } + } + } + } + } + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = archers + value > 0 + } + } + add = 2 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_archer_maa = yes + } + add = 2 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_archer_maa = yes + } + add = 2 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = bowmen + stacks = gok_subjugated_army_maa_value_very_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Light Horsemen + 1 = { + trigger = { + OR = { + scope:army_giver = { + NOT = { + government_has_flag = government_is_nomadic + } + } + scope:army_giver = { + capital_county = { + NOT = { + any_county_province = { + OR = { + has_holding_type = nomad_holding + has_holding_type = herder_holding + } + } + } + } + } + } + } + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = light_cavalry + value > 0 + } + } + add = 2 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_light_cavalry_maa = yes + } + add = 2 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_light_cavalry_maa = yes + } + add = 2 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = light_horsemen + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Light Footmen + 1 = { + trigger = { + OR = { + scope:army_giver = { + NOT = { + government_has_flag = government_is_nomadic + } + } + scope:army_giver = { + capital_county = { + NOT = { + any_county_province = { + OR = { + has_holding_type = nomad_holding + has_holding_type = herder_holding + } + } + } + } + } + } + } + modifier = { + $CHARACTER$ = { + number_maa_regiments_of_base_type = { + type = skirmishers + value > 0 + } + } + add = 2 + } + modifier = { + $CHARACTER$.culture = { + culture_specializes_in_skirmisher_maa = yes + } + add = 2 + } + modifier = { + $CHARACTER$.capital_county.culture ?= { + culture_specializes_in_skirmisher_maa = yes + } + add = 2 + } + spawn_army = { + name = gok_subjugated_army_name_subject_troops + inheritable = yes + uses_supply = no + + men_at_arms = { + type = light_footmen + stacks = gok_subjugated_army_maa_value_very_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Steppe Raiders + 2 = { + trigger = { + scope:army_giver = { + mpo_can_recruit_nomad_maa_trigger = yes + } + } + scope:army_giver.culture = { save_scope_as = army_culture } + + spawn_army = { + name = greek_anarchy_war_nomad_army_name + uses_supply = no + inheritable = yes + + men_at_arms = { + type = steppe_raiders + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Heavy Horse Archers + 10 = { + trigger = { + scope:army_giver = { + exists = domicile + domicile = { + has_domicile_parameter = unlock_maa_heavy_horse_archers + } + } + } + scope:army_giver.culture = { save_scope_as = army_culture } + + spawn_army = { + name = greek_anarchy_war_nomad_army_name + uses_supply = no + inheritable = yes + + men_at_arms = { + type = heavy_horse_archers + stacks = gok_subjugated_army_maa_value_medium + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Nomad Lancers + 2 = { + trigger = { + scope:army_giver = { + mpo_can_recruit_nomad_maa_trigger = yes + highest_held_title_tier >= tier_duchy + } + } + scope:army_giver.culture = { save_scope_as = army_culture } + + spawn_army = { + name = mpo_war_nomad_army_name + uses_supply = no + inheritable = yes + + men_at_arms = { + type = nomad_lancers + stacks = gok_subjugated_army_maa_value_small + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Mangudai + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_mangudai + } + capital_county.culture = { + has_cultural_parameter = unlock_maa_mangudai + } + } + + } + } + if = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_mangudai + } + } + scope:army_giver.culture = { save_scope_as = army_culture } + } + else = { + scope:army_giver.capital_county.culture = { save_scope_as = army_culture } + } + + spawn_army = { + name = greek_anarchy_war_nomad_army_name + uses_supply = no + inheritable = yes + + men_at_arms = { + type = mangudai + stacks = gok_subjugated_army_maa_value_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + #Maturkan Warriors + 100 = { + trigger = { + scope:army_giver = { + OR = { + culture = { + has_cultural_parameter = unlock_maa_maturkan_warriors + } + capital_county.culture = { + has_cultural_parameter = unlock_maa_maturkan_warriors + } + } + + } + } + if = { + limit = { + culture = { + has_cultural_parameter = unlock_maa_maturkan_warriors + } + } + scope:army_giver.culture = { save_scope_as = army_culture } + } + else = { + scope:army_giver.capital_county.culture = { save_scope_as = army_culture } + } + + spawn_army = { + name = greek_anarchy_war_nomad_army_name + uses_supply = no + inheritable = yes + + men_at_arms = { + type = maturkan_warriors + stacks = gok_subjugated_army_maa_value_very_large + } + location = scope:gok.capital_province + origin = $CHARACTER$.capital_province + } + } + } + } +} + +gok_realm_devastation_effect = { + #Minor issues targeting the general realm, but REALLY focus in on the capital area for revenge + add_to_list = defender_realm_vassals + #defender domain specifically targeted + every_in_list = { + list = target_titles + limit = { + tier = tier_county + is_landless_type_title = no + } + add_to_list = devastation_area + } + #and area of capital + capital_county.duchy = { + every_de_jure_county = { + limit = { + holder = { + top_liege = scope:defender + NOR = { + is_ai = no + is_at_war_with = scope:defender + } + } + } + add_to_list = devastation_area + } + } + every_vassal_or_below = { + add_to_list = defender_realm_vassals + } + #is this violent retribution for refusing the khan's generosity? + if = { + limit = { + exists = scope:khans_retribution_target + } + scope:attacker = { + custom_tooltip = gok_gain_dread_tt + } + custom_tooltip = gok_ruin_additional_destruction_tt + if = { + limit = { + government_has_flag = government_is_nomadic + scope:defender.capital_county = { + any_county_province = { + OR = { + has_holding_type = nomad_holding + has_holding_type = herder_holding + } + } + } + } + scope:attacker = { + custom_tooltip = gok_gain_herd_tt + } + } + else = { + scope:attacker = { + custom_tooltip = gok_gain_gold_tt + } + } + hidden_effect = { + scope:attacker = { + #First off, gain dread + add_dread = gok_retribution_dread_value + #Gain herd or gold + if = { + limit = { + government_has_flag = government_is_nomadic + scope:defender.capital_county = { + any_county_province = { + OR = { + has_holding_type = nomad_holding + has_holding_type = herder_holding + } + } + } + } + domicile = { + change_herd = gok_retribution_herd_value + } + } + else = { + add_short_term_gold = gok_retribution_gold_value + } + } + #Tank control everywhere + every_sub_realm_county = { + limit = { + NOT = { + is_in_list = devastation_area + } + } + change_county_control = massive_county_control_loss + change_development_level = { + subtract = development_level + multiply = 0.2 + floor = yes + } + } + #Destroy the holdings + every_in_list = { + list = devastation_area + limit = { + any_county_province = { + has_holding = yes + is_county_capital = no + } + } + every_county_province = { + limit = { + has_holding = yes + is_county_capital = no + } + random = { + chance = 50 + remove_holding = yes + add_to_list = destroyed_holdings + } + + } + } + + scope:attacker = { + save_scope_as = mongol_emperor + } + #Kick the shit out of capital area + every_in_list = { + list = devastation_area + save_scope_as = county + + change_county_control = massive_county_control_loss + holder = { + send_interface_message = { + type = event_war_bad + title = mongols_sieged_county.t + left_icon = scope:mongol_emperor + right_icon = scope:county + + scope:county = { + change_development_level = { + subtract = scope:county.development_level + multiply = 0.5 + floor = yes + } + every_county_province = { + limit = { + has_holding = yes + num_buildings >= 2 + } + destroy_random_building_variable_effect = yes + destroy_random_building_effect = yes + } + every_county_province = { + limit = { + has_holding = yes + num_buildings >= 2 + } + destroy_random_building_variable_effect = yes + destroy_random_building_effect = yes + } + every_county_province = { + limit = { + has_holding = yes + num_buildings >= 2 + } + destroy_random_building_variable_effect = yes + destroy_random_building_effect = yes + } + } + + } + } + + hidden_effect = { + mpo_gok_civilian_slaughter_totalling_effect = yes + } + if = { + limit = { + culture = { + cultural_acceptance = { + target = scope:attacker.culture + value > 0 + } + } + } + culture = { + change_cultural_acceptance = { + target = scope:attacker.culture + value = major_cultural_acceptance_loss + desc = gok_sacking_cultural_acceptance + } + } + } + } + if = { + limit = { + "list_size(destroyed_holdings)" > 1 + } + #Holding notification + save_scope_value_as = { + name = destroyed_holdings + value = "list_size(destroyed_holdings)" + } + #Send notification message + if = { + limit = { + scope:defender = { + trigger_if = { + limit = { + highest_held_title_tier >= tier_kingdom + } + sub_realm_size >= 2 + } + trigger_else = { + highest_held_title_tier >= tier_duchy + sub_realm_size >= 5 + } + } + } + every_player = { + limit = { + OR = { + in_diplomatic_range = scope:defender + this = scope:defender + } + } + send_interface_message = { + type = msg_gok_destruction + title = gok_destruction.t + left_icon = scope:gok + desc = gok_destruction.tooltip + } + } + } + #Be more discerning with rulers that aren't significant + else = { + every_player = { + limit = { + OR = { + this = scope:attacker + this = scope:defender + has_any_scripted_relation = scope:defender + is_close_or_extended_family_of = scope:defender + is_consort_of = scope:defender + is_allied_to = scope:defender + } + } + send_interface_message = { + type = msg_gok_destruction + title = gok_destruction.t + left_icon = scope:gok + desc = gok_destruction.tooltip + } + } + } + } + #Slaughter notification + if = { + limit = { + "list_size(gok_slaughter_victims)" > 1 + } + save_scope_value_as = { + name = gok_slaughter_value + value = "list_size(gok_slaughter_victims)" + } + if = { + limit = { + scope:defender = { + trigger_if = { + limit = { + highest_held_title_tier >= tier_kingdom + } + sub_realm_size >= 2 + } + trigger_else = { + highest_held_title_tier >= tier_duchy + sub_realm_size >= 5 + } + } + } + every_player = { + limit = { + OR = { + this = scope:attacker + this = scope:defender + in_diplomatic_range = scope:defender + has_any_scripted_relation = scope:defender + is_close_or_extended_family_of = scope:defender + is_consort_of = scope:defender + is_allied_to = scope:defender + } + } + send_interface_message = { + type = msg_gok_slaughter + title = gok_slaughter.t + left_icon = scope:gok + desc = gok_slaughter.tooltip + } + } + every_player = { + every_in_list = { + list = gok_slaughter_victims + limit = { + OR = { + has_any_scripted_relation = prev + is_close_or_extended_family_of = prev + is_consort_of = prev + is_allied_to = prev + } + } + save_scope_as = victim + prev = { + send_interface_message = { + type = msg_gok_slaughter + title = gok_slaughter_victim.t + left_icon = scope:victim + desc = gok_slaughter_victim.tooltip + } + } + } + } + } + else = { + every_player = { + limit = { + OR = { + this = scope:attacker + this = scope:defender + has_any_scripted_relation = scope:defender + is_close_or_extended_family_of = scope:defender + is_consort_of = scope:defender + is_allied_to = scope:defender + } + } + send_interface_message = { + type = msg_gok_slaughter + title = gok_slaughter.t + left_icon = scope:gok + desc = gok_slaughter.tooltip + } + } + every_player = { + every_in_list = { + list = gok_slaughter_victims + limit = { + OR = { + has_any_scripted_relation = prev + is_close_or_extended_family_of = prev + is_consort_of = prev + is_allied_to = prev + } + } + save_scope_as = victim + prev = { + send_interface_message = { + type = msg_gok_slaughter + title = gok_slaughter_victim.t + left_icon = scope:victim + desc = gok_slaughter_victim.tooltip + } + } + } + } + } + } + hidden_effect = { + every_in_list = { + list = gok_slaughter_victims + death = { + death_reason = death_gok_slaughter + } + } + } + } + } + else = { + every_sub_realm_county = { + custom = custom.every_taken_county + change_county_control = medium_county_control_loss + change_development_level = { + subtract = development_level + multiply = 0.1 + floor = yes + } + } + } +} + +mpo_gok_civilian_slaughter_totalling_effect = { + every_in_list = { + list = devastation_area + if = { + limit = { + this = holder.capital_county + } + holder = { + if = { + limit = { + NOR = { + this = scope:defender + is_ai = no + } + } + add_to_list = potential_victims + } + every_courtier_or_guest = { + add_to_list = potential_victims + } + } + #Local pool characters + every_pool_character = { + province = prev.holder.capital_province + add_to_list = potential_victims + } + } + } + scope:defender = { + #ai landless house heads in the capital + every_vassal = { + limit = { + is_ai = yes + is_landless_administrative = yes + domicile ?= { + domicile_location.county = { + this = scope:defender.capital_county + } + } + } + add_to_list = potential_victims + } + #Courtiers of landless house heads in the capital + every_vassal = { + limit = { + is_landless_administrative = yes + domicile ?= { + domicile_location.county = { + this = scope:defender.capital_county + } + } + } + every_courtier_or_guest = { + add_to_list = potential_victims + } + } + } + ordered_in_list = { + order_by = { + value = 1 + #I suppose they would probably try to avoid killing their own + if = { + limit = { + NOT = { + faith = scope:attacker.faith + } + } + add = 1 + } + if = { + limit = { + NOT = { + culture = scope:attacker.culture + } + } + add = 1 + } + } + list = potential_victims + max = { + value = "list_size(potential_victims)" + divide = 2 + } + add_to_list = gok_slaughter_victims + } +} + +gok_retribution_cleanup_effect = { + if = { + limit = { + exists = scope:khans_retribution_target + } + scope:defender = { + every_held_title = { + limit = { + has_variable = refused_submission + } + remove_variable = refused_submission + } + every_vassal_or_below = { + limit = { + any_held_title = { + has_variable = refused_submission + } + } + remove_variable = refused_submission + } + } + } +} + +gok_world_conquest_generic_rewards_effect = { + custom_tooltip = gok_gain_hegemony + hidden_effect = { + #CENGIZ KHAGANATE + if = { + limit = { + culture = { + has_cultural_pillar = language_turkic + } + OR = { + has_nickname = nick_cengiz_khan + primary_title = { + any_past_holder = { + has_nickname = nick_cengiz_khan + } + } + } + } + #Create a hegemony for the GoK! + create_dynamic_title = { + tier = hegemony + name = GREATEST_OF_KHANS_HEGEMONY_NAME_CENGIZ + adj = GREATEST_OF_KHANS_HEGEMONY_NAME_CENGIZ_ADJ + article = article_CONFEDERATION_CULTURE_NAME + } + } + #YEKHE KHAGANATE + else_if = { + limit = { + culture = { + has_cultural_pillar = language_mongolic + } + OR = { + has_nickname = nick_yekhe_khagan + primary_title = { + any_past_holder = { + has_nickname = nick_yekhe_khagan + } + } + } + } + #Create a hegemony for the GoK! + create_dynamic_title = { + tier = hegemony + name = GREATEST_OF_KHANS_HEGEMONY_NAME_YEKHE + adj = GREATEST_OF_KHANS_HEGEMONY_NAME_YEKHE_ADJ + article = article_CONFEDERATION_CULTURE_NAME + } + } + #DORT YONLUG KHAGANATE + else_if = { + limit = { + culture = { + has_cultural_pillar = language_turkic + } + OR = { + has_nickname = nick_dort_yonlug_khagan + primary_title = { + any_past_holder = { + has_nickname = nick_dort_yonlug_khagan + } + } + } + } + #Create a hegemony for the GoK! + create_dynamic_title = { + tier = hegemony + name = GREATEST_OF_KHANS_HEGEMONY_NAME_DORT_YONLUG + adj = GREATEST_OF_KHANS_HEGEMONY_NAME_DORT_YONLUG_ADJ + article = article_CONFEDERATION_CULTURE_NAME + } + } + #MAR SARGIS KHAGANATE + else_if = { + limit = { + faith = faith:nestorian + OR = { + has_nickname = nick_mar_sargis + primary_title = { + any_past_holder = { + has_nickname = nick_mar_sargis + } + } + } + } + #Create a hegemony for the GoK! + create_dynamic_title = { + tier = hegemony + name = GREATEST_OF_KHANS_HEGEMONY_NAME_MAR_SARGIS + adj = GREATEST_OF_KHANS_HEGEMONY_NAME_MAR_SARGIS_ADJ + article = article_CONFEDERATION_CULTURE_NAME + } + } + #XORMUSTA KHAGANATE + else_if = { + limit = { + OR = { + faith = faith:nestorian + faith.religion = faith:manichean.religion + } + OR = { + has_nickname = nick_xormuzta + primary_title = { + any_past_holder = { + has_nickname = nick_xormuzta + } + } + } + } + #Create a hegemony for the GoK! + create_dynamic_title = { + tier = hegemony + name = GREATEST_OF_KHANS_HEGEMONY_NAME_XORMUZTA + adj = GREATEST_OF_KHANS_HEGEMONY_NAME_XORMUZTA_ADJ + article = article_CONFEDERATION_CULTURE_NAME + } + } + #CIHANGIR KHAGANATE + else_if = { + limit = { + faith.religion = religion:islam_religion + capital_province ?= { + OR = { + geographical_region = world_middle_east + geographical_region = world_asia_minor + geographical_region = world_steppe_tarim + geographical_region = world_steppe_central + } + } + current_date >= 1250 + OR = { + has_nickname = nick_cihangir + primary_title = { + any_past_holder = { + has_nickname = nick_cihangir + } + } + } + } + #Create a hegemony for the GoK! + create_dynamic_title = { + tier = hegemony + name = GREATEST_OF_KHANS_HEGEMONY_NAME_CIHANGIR + adj = GREATEST_OF_KHANS_HEGEMONY_NAME_CIHANGIR_ADJ + article = article_CONFEDERATION_CULTURE_NAME + } + } + #AKHSHUNWAR KHAGANATE + else_if = { + limit = { + culture = { + OR = { + has_cultural_pillar = language_iranian + has_cultural_pillar = language_scythian + } + } + OR = { + has_nickname = nick_akhshunwar + primary_title = { + any_past_holder = { + has_nickname = nick_akhshunwar + } + } + } + } + #Create a hegemony for the GoK! + create_dynamic_title = { + tier = hegemony + name = GREATEST_OF_KHANS_HEGEMONY_NAME_AKHSHUNWAR + adj = GREATEST_OF_KHANS_HEGEMONY_NAME_AKHSHUNWAR_ADJ + article = article_CONFEDERATION_CULTURE_NAME + } + } + #TENGRI KHAGANATE + else_if = { + limit = { + NOR = { + faith.religion = religion:christianity_religion + faith.religion = religion:islam_religion + } + OR = { + has_nickname = nick_tengri_khagan + primary_title = { + any_past_holder = { + has_nickname = nick_tengri_khagan + } + } + } + } + #Create a hegemony for the GoK! + create_dynamic_title = { + tier = hegemony + name = GREATEST_OF_KHANS_HEGEMONY_NAME_TENGRI + adj = GREATEST_OF_KHANS_HEGEMONY_NAME_TENGRI_ADJ + article = article_CONFEDERATION_CULTURE_NAME + } + } + #CHINGGISID KHAGANATE + else_if = { + limit = { + NOT = { + culture = { + has_cultural_pillar = language_turkic + } + } + OR = { + has_nickname = nick_genghis_khan + primary_title = { + any_past_holder = { + has_nickname = nick_genghis_khan + } + } + } + } + #Create a hegemony for the GoK! + create_dynamic_title = { + tier = hegemony + name = GREATEST_OF_KHANS_HEGEMONY_NAME_CHINGGIS + adj = GREATEST_OF_KHANS_HEGEMONY_NAME_CHINGGIS_ADJ + article = article_CONFEDERATION_CULTURE_NAME + } + } + #FALLBACK OPTIONS + else_if = { + limit = { + culture = { + has_cultural_pillar = heritage_turkic + } + } + #Create a hegemony for the GoK! + create_dynamic_title = { + tier = hegemony + name = GREATEST_OF_KHANS_HEGEMONY_NAME_TURKIC + adj = GREATEST_OF_KHANS_HEGEMONY_NAME_TURKIC_ADJ + article = article_CONFEDERATION_CULTURE_NAME + } + } + else_if = { + limit = { + culture = { + has_cultural_pillar = heritage_mongolic + } + } + #Create a hegemony for the GoK! + create_dynamic_title = { + tier = hegemony + name = GREATEST_OF_KHANS_HEGEMONY_NAME_MONGOLIC + adj = GREATEST_OF_KHANS_HEGEMONY_NAME_MONGOLIC_ADJ + article = article_CONFEDERATION_CULTURE_NAME + } + } + else = { + #Create a hegemony for the GoK! + create_dynamic_title = { + tier = hegemony + name = GREATEST_OF_KHANS_HEGEMONY_NAME + adj = GREATEST_OF_KHANS_HEGEMONY_NAME_ADJ + article = article_CONFEDERATION_CULTURE_NAME + } + } + scope:new_title = { + save_scope_as = gok_hegemony + } + scope:gok_hegemony = { + set_color_from_title = root.capital_county.kingdom + set_can_be_named_after_dynasty = no + set_can_use_nomadic_naming = no + set_definitive_form = yes + } + + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = no + } + scope:gok_hegemony = { + change_title_holder = { + holder = root + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + scope:gok_hegemony = { + generate_coa = yes + } + save_scope_value_as = { + name = gok_empire_crumble_date + value = global_var:gok_empire_crumble_date + } + } + + #Give the GoK hegemony all of the steppe as de jure + hidden_effect = { + situation:the_great_steppe ?= { + every_situation_county = { + limit = { + holder.top_liege ?= root + } + empire = { + add_to_list = steppe_empires + } + } + } + every_in_list = { + list = steppe_empires + limit = { + #Check Chinese empires aren't swapped + NAND = { + exists = hegemony + OR = { + this = title:e_zhongyuan + this = title:e_yongliang + this = title:e_jingyang + this = title:e_liangyi + this = title:e_lingnan + } + } + } + set_de_jure_liege_title = scope:gok_hegemony + } + } + + if = { + limit = { + exists = dynasty + } + dynasty = { + add_dynasty_prestige = monumental_dynasty_prestige_gain + } + } + + if = { + limit = { + has_education_martial_trigger = yes + NOT = { + has_trait = education_martial_5 + } + } + remove_trait = education_martial_1 + remove_trait = education_martial_2 + remove_trait = education_martial_3 + remove_trait = education_martial_4 + custom_tooltip = { + text = gain_5th_lvl_education_martial_tt + add_trait = education_martial_5 + } + + } + else_if = { + limit = { + has_education_diplomacy_trigger = yes + NOT = { + has_trait = education_diplomacy_5 + } + } + remove_trait = education_diplomacy_1 + remove_trait = education_diplomacy_2 + remove_trait = education_diplomacy_3 + remove_trait = education_diplomacy_4 + custom_tooltip = { + text = gain_5th_lvl_education_diplomacy_tt + add_trait = education_diplomacy_5 + } + } + else_if = { + limit = { + has_education_stewardship_trigger = yes + NOT = { + has_trait = education_stewardship_5 + } + } + remove_trait = education_stewardship_1 + remove_trait = education_stewardship_2 + remove_trait = education_stewardship_3 + remove_trait = education_stewardship_4 + custom_tooltip = { + text = gain_5th_lvl_education_stewardship_tt + add_trait = education_stewardship_5 + } + } + else_if = { + limit = { + has_education_intrigue_trigger = yes + NOT = { + has_trait = education_intrigue_5 + } + } + remove_trait = education_intrigue_1 + remove_trait = education_intrigue_2 + remove_trait = education_intrigue_3 + remove_trait = education_intrigue_4 + custom_tooltip = { + text = gain_5th_lvl_education_intrigue_tt + add_trait = education_intrigue_5 + } + } + else_if = { + limit = { + has_education_learning_trigger = yes + NOT = { + has_trait = education_learning_5 + } + } + remove_trait = education_learning_1 + remove_trait = education_learning_2 + remove_trait = education_learning_3 + remove_trait = education_learning_4 + custom_tooltip = { + text = gain_5th_lvl_education_learning_tt + add_trait = education_learning_5 + } + } + else = { + add_trait = shrewd + } +} + +gok_upgrade_realm_and_government_effect = { + if = { + limit = { + exists = scope:realm_culture_1 + } + culture = { + get_random_innovation_from = scope:realm_culture_1 + } + } + if = { + limit = { + exists = scope:realm_culture_2 + } + culture = { + get_random_innovation_from = scope:realm_culture_2 + } + } + if = { + limit = { + exists = scope:realm_culture_3 + } + culture = { + get_random_innovation_from = scope:realm_culture_3 + } + } + + capital_county = { + if = { + limit = { + any_county_province = { + OR = { + has_holding_type = nomad_holding + has_holding_type = herder_holding + } + } + } + add_county_modifier = { + modifier = great_khans_capital_modifier + years = 30 + } + } + custom_tooltip = gok_capital_holdings_switch_tt + + hidden_effect = { + every_county_province = { + limit = { + has_holding = yes + OR = { + has_holding_type = nomad_holding + has_holding_type = herder_holding + } + } + set_holding_type = castle_holding + add_building = castle_02 + if = { + limit = { + any_culture_global = { + has_cultural_era_or_later = culture_era_high_medieval + } + } + add_building = castle_03 + } + if = { + limit = { + any_culture_global = { + has_cultural_era_or_later = culture_era_late_medieval + } + } + add_building = castle_04 + } + } + random_county_province = { + limit = { + has_holding = no + } + save_scope_as = capital_prov_1 + set_holding_type = church_holding + + if = { + limit = { + any_culture_global = { + has_cultural_era_or_later = culture_era_high_medieval + } + } + add_building = temple_03 + } + if = { + limit = { + any_culture_global = { + has_cultural_era_or_later = culture_era_late_medieval + } + } + add_building = temple_02 + } + } + random_county_province = { + limit = { + exists = scope:capital_prov_1 + has_holding = no + NOT = { + this = scope:capital_prov_1 + } + } + set_holding_type = city_holding + + if = { + limit = { + any_culture_global = { + has_cultural_era_or_later = culture_era_high_medieval + } + } + add_building = city_03 + } + if = { + limit = { + any_culture_global = { + has_cultural_era_or_later = culture_era_late_medieval + } + } + add_building = city_02 + } + } + } + } + custom_tooltip = gok_every_held_title_gains_castles + custom_tooltip = gok_some_nomad_vassals_holdings_switch + hidden_effect = { + every_held_title = { + limit = { + tier = tier_county + any_county_province = { + is_county_capital = yes + OR = { + has_holding_type = nomad_holding + has_holding_type = herder_holding + } + } + } + every_county_province = { + limit = { + is_county_capital = yes + OR = { + has_holding_type = nomad_holding + has_holding_type = herder_holding + } + } + set_holding_type = castle_holding + } + } + every_realm_county = { + limit = { + any_county_province = { + is_county_capital = yes + OR = { + has_holding_type = nomad_holding + has_holding_type = herder_holding + } + } + holder = { + is_in_list = switching_vassals + } + } + every_county_province = { + limit = { + is_county_capital = yes + OR = { + has_holding_type = nomad_holding + has_holding_type = herder_holding + } + } + set_holding_type = castle_holding + #holder is a high lord, upgrade their castle a bit + if = { + limit = { + county.holder = { + highest_held_title_tier >= tier_duchy + } + this = county.holder.capital_province + } + if = { + limit = { + any_culture_global = { + has_cultural_era_or_later = culture_era_high_medieval + } + } + add_building = castle_02 + } + if = { + limit = { + any_culture_global = { + has_cultural_era_or_later = culture_era_late_medieval + } + } + add_building = castle_03 + } + } + } + #Holder is a king, give capital some extra holdings + if = { + limit = { + holder = { + highest_held_title_tier >= tier_kingdom + } + this = holder.capital_county + } + random_county_province = { + limit = { + has_holding = no + } + save_scope_as = capital_prov_1 + begin_create_holding = church_holding + } + random_county_province = { + limit = { + exists = scope:capital_prov_1 + has_holding = no + NOT = { + this = scope:capital_prov_1 + } + } + begin_create_holding = city_holding + } + } + } + } +} + +gok_final_decision_list_setup = { + #Switching vassals to feudalism or clan + every_vassal_or_below = { + limit = { + gok_gov_switch_valid_vassal_trigger = yes + mpo_greatest_of_khans_0030_willing_nomad_vassal = yes + } + add_to_list = switching_vassals + } + save_scope_value_as = { + name = switching_vassals_value + value = "list_size(switching_vassals)" + } + #Switching vassals TO nomadism + every_vassal_or_below = { + limit = { + NOR = { + government_has_flag = government_is_nomadic + government_has_flag = government_is_herder + } + gok_gov_switch_valid_vassal_trigger = yes + } + #ones willing to switch can remain in power + if = { + limit = { + OR = { + has_trait = nomadic_philosophy + culture = { + has_cultural_tradition = tradition_horse_lords + } + culture = { + has_cultural_tradition = tradition_devoted_horsemanship + } + AND = { + highest_held_title_tier >= tier_kingdom + mpo_greatest_of_khans_0030_dominated_sedentary_vassal = yes + } + AND = { + highest_held_title_tier >= tier_duchy + mpo_greatest_of_khans_0030_willing_sedentary_vassal = yes + } + highest_held_title_tier = tier_county + } + } + add_to_list = sedentary_to_nomad_vassals + } + #The others must go + else = { + add_to_list = city_state_vassals + } + } + save_scope_value_as = { + name = sedentary_to_nomad_vassals_value + value = "list_size(sedentary_to_nomad_vassals)" + } + save_scope_value_as = { + name = city_state_vassals_value + value = "list_size(city_state_vassals)" + } + #counties that will be switched from non-nomadic to nomadic + every_realm_county = { + limit = { + NOR = { + #Already nomadic + any_county_province = { + OR = { + has_holding_type = nomad_holding + has_holding_type = herder_holding + } + } + #Holder is invalid for switching + holder = { gok_gov_switch_valid_vassal_trigger = no } + #De jure kingdom capital (probably important) + this = kingdom.title_capital_county + AND = { + holder = { + is_in_list = city_state_vassals + } + this = holder.capital_county + } + } + } + add_to_list = burned_to_nomadism + } + save_scope_value_as = { + name = burned_to_nomadism_value + value = "list_size(burned_to_nomadism)" + } +} + +### GoK will automatically declare DEVASTATING wars +gok_war_target_evaluation_and_declaration_effect = { + save_scope_as = actor + if = { + limit = { + mpo_offer_submission_or_ruin_shown_actor_trigger = yes + mpo_offer_submission_or_ruin_valid_actor_trigger = yes + } + # Set the Mongol Emperor as reference point + save_scope_as = mongol_emperor + add_character_flag = { + flag = free_mongol_cb + days = 14 + } + # Select a new target + random_neighboring_top_liege_realm_owner = { + limit = { + NOT = { is_at_war_with = scope:mongol_emperor } + NOT = { is_allied_to = scope:mongol_emperor } + NOT = { this = scope:mongol_emperor } + NOT = { top_liege = scope:mongol_emperor } + save_temporary_scope_as = truce_check + NOT = { + scope:mongol_emperor = { + any_truce_target = { + this = scope:truce_check + } + } + } + trigger_if = { # We don't want the Byzantine empire to get annihilated immediately + limit = { + OR = { + has_primary_title = title:e_byzantium + has_primary_title = title:e_latin_empire + } + } + OR = { + # This is not the 'historical' Mongol Empire, all bets are off + NOT = { + scope:mongol_emperor = { + any_held_title = { + this = title:e_mongol_empire + } + } + } + current_year < 1178 + current_year >= 1279 # Roughly when the mongols should fracture historically + scope:mongol_emperor = { + completely_controls_region = special_mongol_empire_golden_horde_region # Controls all of Russia and the Steppe + } + any_realm_county = { # Byzantium is expansionist + count >= 50 + title_province = { + OR = { + geographical_region = special_mongol_empire_conquest_region_prio_5 + geographical_region = special_mongol_empire_conquest_region_prio_4 + geographical_region = special_mongol_empire_conquest_region_prio_3 + geographical_region = special_mongol_empire_conquest_region_prio_2 + geographical_region = special_mongol_empire_conquest_region_prio_1 + geographical_region = special_mongol_empire_conquest_region_prio_1_alpha + } + } + } + } + } + save_temporary_scope_as = recipient + mpo_offer_submission_or_ruin_shown_recipient_trigger = yes + mpo_offer_submission_or_ruin_valid_recipient_trigger = yes + } + weight = { + base = 0 + modifier = { + add = mongol_invasion_target_character_weight + always = yes + } + #Should only attack China when very strong + modifier = { + factor = 0.1 + primary_title = title:h_china + current_military_strength >= scope:mongol_emperor.half_current_military_strength + } + } + save_temporary_scope_as = next_invasion_target + primary_title = { + save_temporary_scope_as = next_invasion_title_target + } + } + if = { + limit = { + exists = scope:next_invasion_target + } + if = { + limit = { # Declare war on every same-tier count or duke in same empire + scope:next_invasion_target = { + OR = { + highest_held_title_tier = tier_county + highest_held_title_tier = tier_duchy + } + } + } + scope:next_invasion_title_target = { + add_to_temporary_list = all_titles_to_declare_on + empire = { + every_in_de_jure_hierarchy = { # Find all other same-tier titles in same de jure empire + continue = { + tier > tier_county + # Stop searching if you hit the Mongol Emperor's territory at any point + trigger_if = { + limit = { exists = holder } + NOT = { holder = scope:mongol_emperor } + NOT = { holder.top_liege = scope:mongol_emperor } + } + } + limit = { + exists = this + OR = { + tier = tier_county + tier = tier_duchy + } + exists = holder + holder = { + is_independent_ruler = yes + NOT = { this = scope:mongol_emperor } + NOT = { top_liege = scope:mongol_emperor } + NOT = { is_at_war_with = scope:mongol_emperor } + NOT = { is_allied_to = scope:mongol_emperor } + NOT = { is_at_war_with = scope:mongol_emperor } + save_temporary_scope_as = truce_check + NOT = { + scope:mongol_emperor = { + any_truce_target = { + this = scope:truce_check + } + } + } + save_temporary_scope_as = recipient + mpo_offer_submission_or_ruin_shown_recipient_trigger = yes + mpo_offer_submission_or_ruin_valid_recipient_trigger = yes + in_diplomatic_range = scope:mongol_emperor + } + } + + add_to_temporary_list = all_titles_to_declare_on + } + } + every_in_list = { + list = all_titles_to_declare_on + limit = { + holder = { + # An extra check to make sure we haven't snuck any Mongol territory in + NOT = { this = scope:mongol_emperor } + NOT = { top_liege = scope:mongol_emperor } + + # Standard conditions + NOT = { is_at_war_with = scope:mongol_emperor } + NOT = { + is_in_list = has_been_sent_subjugation_offer + } + save_temporary_scope_as = truce_check + + save_temporary_scope_as = recipient + mpo_offer_submission_or_ruin_shown_recipient_trigger = yes + mpo_offer_submission_or_ruin_valid_recipient_trigger = yes + in_diplomatic_range = scope:mongol_emperor + } + NOT = { + scope:mongol_emperor = { + any_truce_target = { + this = scope:truce_check + } + } + } + } + holder = { + add_to_list = title_holders_declared_on + } + } + every_in_list = { + list = title_holders_declared_on + save_scope_as = recipient + scope:mongol_emperor = { + run_interaction = { + interaction = mpo_offer_submission_or_ruin + actor = scope:mongol_emperor + recipient = scope:recipient + send_threshold = decline + } + } + } + } + } + else = { + scope:next_invasion_target = { + save_scope_as = recipient + } + scope:mongol_emperor = { + run_interaction = { + interaction = mpo_offer_submission_or_ruin + actor = scope:mongol_emperor + recipient = scope:recipient + send_threshold = decline + } + } + } + } + } +} + +mpo_add_golden_lineage_effect = { + add_trait = golden_lineage + if = { + limit = { + exists = dynasty + } + custom_tooltip = descendants_gain_golden_lineage + hidden_effect = { + dynasty = { + every_dynasty_member = { + custom = custom + limit = { + any_ancestor = { + this = $CHARACTER$ + } + } + add_trait = golden_lineage + } + } + } + } + every_child = { + limit = { + NOR = { + has_trait = bastard + has_trait = legitimized_bastard + } + NOT = { + has_trait = golden_lineage + } + } + add_trait = golden_lineage + if = { + limit = { + is_male = yes + } + every_child = { + add_trait = golden_lineage + } + } + } +} + +mpo_gok_onslaught_admin_vassal_reorganization = { + #Make a list of admin vassals high enough tier to survive + every_vassal_or_below = { + limit = { + is_landed = yes + #This should be duke or count based on gov type + highest_held_title_tier >= main_administrative_tier + government_allows = administrative + } + add_to_list = protected_admin_vassals + } + #Make a list of admin vassals that must be moved or purged + every_vassal_or_below = { + limit = { + is_landed = yes + highest_held_title_tier < main_administrative_tier + government_allows = administrative + highest_held_title_tier > tier_barony + NOT = { + any_liege_or_above = { + is_in_list = protected_admin_vassals + } + } + } + add_to_list = vulnerable_admin_vassals + } + #Make a list of the highest surviving admin in their vassalship chain + every_in_list = { + list = protected_admin_vassals + limit = { + OR = { + liege = scope:defender + liege = { + NOT = { + government_allows = administrative + } + } + } + } + add_to_list = top_protected_admins + } + #Find a liege for every vulnerable we can + every_in_list = { + list = vulnerable_admin_vassals + #Move de jure vulnerable vassals to empires + if = { + limit = { + capital_county.empire.holder ?= { + is_in_list = top_protected_admins + } + } + capital_county.empire.holder = { + save_scope_as = landless_admin_liege + } + create_title_and_vassal_change = { + type = swear_fealty + save_scope_as = change + add_claim_on_loss = yes + } + change_liege = { + liege = scope:landless_admin_liege + change = scope:change + } + resolve_title_and_vassal_change = scope:change + remove_from_list = vulnerable_admin_vassals + } + #Move de jure vulnerable vassals to kingdoms + if = { + limit = { + capital_county.kingdom.holder ?= { + is_in_list = top_protected_admins + } + } + capital_county.kingdom.holder = { + save_scope_as = landless_admin_liege + } + create_title_and_vassal_change = { + type = swear_fealty + save_scope_as = change + add_claim_on_loss = yes + } + change_liege = { + liege = scope:landless_admin_liege + change = scope:change + } + resolve_title_and_vassal_change = scope:change + remove_from_list = vulnerable_admin_vassals + } + #Move de jure vulnerable vassals to duchies + if = { + limit = { + capital_county.duchy.holder ?= { + is_in_list = top_protected_admins + } + } + capital_county.duchy.holder = { + save_scope_as = landless_admin_liege + } + create_title_and_vassal_change = { + type = swear_fealty + save_scope_as = change + add_claim_on_loss = yes + } + change_liege = { + liege = scope:landless_admin_liege + change = scope:change + } + resolve_title_and_vassal_change = scope:change + remove_from_list = vulnerable_admin_vassals + } + #Move landed vulnerable neighbors + else_if = { + limit = { + is_landed = yes + any_sub_realm_county = { + any_neighboring_county = { + holder = { + OR = { + is_in_list = top_protected_admins + any_liege_or_above = { + is_in_list = top_protected_admins + } + } + } + } + } + } + save_scope_as = vulnerable_neighbor + ordered_in_list = { + order_by = current_military_strength + list = top_protected_admins + limit = { + any_sub_realm_county = { + any_neighboring_county = { + holder = { + OR = { + this = scope:vulnerable_neighbor + any_liege_or_above = { + this = scope:vulnerable_neighbor + } + } + } + } + } + } + save_scope_as = landless_admin_liege + } + create_title_and_vassal_change = { + type = swear_fealty + save_scope_as = change + add_claim_on_loss = yes + } + change_liege = { + liege = scope:landless_admin_liege + change = scope:change + } + resolve_title_and_vassal_change = scope:change + remove_from_list = vulnerable_admin_vassals + } + #Move landless to random top tiers in list + else_if = { + limit = { + is_landless_administrative = yes + #Lower tier than potential liege + any_in_list = { + list = top_protected_admins + highest_held_title_tier > prev.highest_held_title_tier + } + } + ordered_in_list = { + list = top_protected_admins + order_by = highest_held_title_tier + save_scope_as = landless_admin_liege + } + create_title_and_vassal_change = { + type = swear_fealty + save_scope_as = change + add_claim_on_loss = yes + } + change_liege = { + liege = scope:landless_admin_liege + change = scope:change + } + resolve_title_and_vassal_change = scope:change + remove_from_list = vulnerable_admin_vassals + } + } +} + +gok_government_change_story_end_effect = { + if = { + limit = { + any_owned_story = { + story_type = story_greatest_of_khans + } + } + custom_tooltip = gok_ending_warning_offer_sub_or_ruin + custom_tooltip = gok_ending_warning_onslaught + custom_tooltip = gok_ending_warning_end_decision + hidden_effect = { + every_owned_story = { + limit = { story_type = story_greatest_of_khans } + end_story = yes + } + trigger_event = { + id = mpo_greatest_of_khans.0041 + days = 3 + } + } + } +} diff --git a/N3OW/common/scripted_effects/09_mpo_settlement_issue_effects.txt b/N3OW/common/scripted_effects/09_mpo_settlement_issue_effects.txt new file mode 100644 index 00000000..1f18bbdc --- /dev/null +++ b/N3OW/common/scripted_effects/09_mpo_settlement_issue_effects.txt @@ -0,0 +1,234 @@ +settlement_issue_on_accepted_default_effect = { + save_scope_as = task_contract + task_contract_taker = { + set_variable = nomadic_migration_contract_$NUMBER$ + if = { + limit = { + location = root.task_contract_location + } + trigger_event = { + id = mpo_contract_events.$ARRIVAL_ID$ + } + } + else = { + start_travel_plan = { + destination = root.task_contract_location + on_arrival_event = mpo_contract_events.$ARRIVAL_ID$ + return_trip = yes + on_travel_planner_cancel_event = mpo_contract_events.$RESET_ID$ + } + } + } +} + +settlement_issue_on_invalidated_default_effect = { + task_contract_location.county = { + remove_county_modifier = ongoing_settlement_contract + } +} + +settlement_issue_on_create_effect = { + scope:contract.task_contract_location.county = { + add_county_modifier = ongoing_settlement_contract + } + scope:contract.task_contract_taker = { + if = { + limit = { + is_ai = yes + is_available = yes + } + accept_task_contract = scope:contract + } + else_if = { + limit = { + is_ai = yes + } + scope:contract = { + invalidate_contract = yes + } + } + } +} + +settlement_issue_after_completing_effect = { + hidden_effect = { + scope:task_contract = { + complete_task_contract = control + } + scope:task_contract.task_contract_location.county = { + remove_county_modifier = ongoing_settlement_contract + } + } +} + +settlement_issue_control_reward_effect = { + show_as_tooltip = { + task_contract_location.county = { + change_county_control = settlement_issue_control_reward + } + } +} + +settlement_issue_herd_reward_effect = { + show_as_tooltip = { + task_contract_taker.domicile = { + change_herd = settlement_issue_herd_reward + } + } +} + +settlement_issue_culture_reward_effect = { + show_as_tooltip = { + task_contract_location.county.var:migration_previous_culture = { + change_cultural_acceptance = { + target = root.task_contract_taker.culture + value = 5 + desc = cultural_acceptance_gain_event + } + } + } +} + +settlement_issue_gold_reward_effect = { + show_as_tooltip = { + task_contract_taker = { + add_gold = minor_gold_value + } + } +} + +settlement_issue_opinion_reward_effect = { + show_as_tooltip = { + task_contract_taker = { + add_character_modifier = $MODIFIER$ + } + } +} + +settlement_issue_character_opinion_reward_effect = { + show_as_tooltip = { + $CHARACTER$ = { + add_opinion = { + modifier = friendliness_opinion + target = root.task_contract_taker + opinion = 10 + } + } + } +} + +settlement_issue_fertility_reward_effect = { + show_as_tooltip = { + task_contract_location.county = { + change_county_fertility = tiny_county_fertility_level_gain + } + } +} + +mpo_invalidating_settlement_contract_effect = { + switch = { + trigger = has_variable + nomadic_migration_contract_1 = { + random_character_active_contract = { + limit = { + has_task_contract_type = nomadic_migration_contract_1 + } + save_scope_as = task_contract + } + trigger_event = { id = mpo_contract_events.0003 } + } + nomadic_migration_contract_2 = { + random_character_active_contract = { + limit = { + has_task_contract_type = nomadic_migration_contract_2 + } + save_scope_as = task_contract + } + trigger_event = { id = mpo_contract_events.0013 } + } + nomadic_migration_contract_3 = { + random_character_active_contract = { + limit = { + has_task_contract_type = nomadic_migration_contract_3 + } + save_scope_as = task_contract + } + trigger_event = { id = mpo_contract_events.0023 } + } + } +} + +mpo_settlement_issue_reset_effect = { + scope:task_contract.task_contract_employer ?= { + if = { + limit = { + NOT = { exists = scope:new_employer } + is_alive = yes + OR = { + liege_or_court_owner = root + employer = root + } + } + save_scope_as = new_employer + } + } + if = { + limit = { + NOT = { exists = scope:contract_province } + OR = { + scope:task_contract.task_contract_location.province_owner ?= root + scope:task_contract.task_contract_location.province_owner.top_liege ?= root + } + } + scope:task_contract.task_contract_location ?= { + save_scope_as = contract_province + } + } + + scope:task_contract ?= { invalidate_contract = yes } + + remove_variable = nomadic_migration_contract_$NUMBER$ + + trigger_event = { + id = mpo_contract_events.$ID$ + days = 1 + } +} + +mpo_settlement_issue_own_lands_effect = { + if = { + limit = { + NOT = { exists = scope:contract_province } + } + random_held_county = { + limit = { + is_landless_type_title = no + exists = title_province + county_control < 90 + NOT = { has_county_modifier = ongoing_settlement_contract } + } + title_province = { save_scope_as = contract_province } + } + } + + if = { + limit = { + NOT = { exists = scope:new_employer } + } + random_knight = { + limit = { + is_landed = no + is_ai = yes + } + alternative_limit = { is_ai = yes } + save_scope_as = new_employer + } + } + + create_task_contract = { + task_contract_type = nomadic_migration_contract_$NUMBER$ + task_contract_tier = $TIER$ + location = scope:contract_province + task_contract_employer = scope:new_employer + } +} diff --git a/N3OW/common/scripted_effects/10_ach_effects.txt b/N3OW/common/scripted_effects/10_ach_effects.txt new file mode 100644 index 00000000..d6923f94 --- /dev/null +++ b/N3OW/common/scripted_effects/10_ach_effects.txt @@ -0,0 +1,6953 @@ +#Coronation End Effect +# root is the current attending character +# current scope is the host of the activity, also available as scope:activity.host + +# Activity Base Effects +coronation_busy_effect = { + if = { + limit = { + is_ai = no + has_multiple_players = yes + } + involved_activity ?= { + add_to_variable_list = { + name = coronation_list_busy + target = root + } + } + } +} + +coronation_ready_effect = { + if = { + limit = { + is_ai = no + has_multiple_players = yes + } + involved_activity ?= { + remove_list_variable = { + name = coronation_list_busy + target = root + } + } + } +} + +# Realm Laws +coronation_reset_realm_law_effect = { + trigger_event = ach_maintenance_events.0001 +} + +coronation_reset_realm_law_variable_effect = { + if = { + limit = { + root.highest_held_title_tier <= tier_empire + } + remove_variable = crowned_king_var + remove_variable = crowned_emperor_var + } + else_if = { + limit = { + root.highest_held_title_tier <= tier_kingdom + } + remove_variable = crowned_king_var + } +} + +coronation_change_law_effect = { + if = { + limit = { + involved_activity = { + has_activity_option = { + category = special_type + option = coronation_type_anointment + } + } + } + if = { + limit = { + NOT = { + has_game_rule = coronation_laws_off + } + } + add_realm_law = crowned_emperor + } + set_variable = crowned_emperor_var + } + else = { + if = { + limit = { + NOT = { + has_game_rule = coronation_laws_off + } + } + add_realm_law = crowned_king + } + set_variable = crowned_king_var + } +} + +# Oaths +coronation_set_oath_effect = { + save_scope_value_as = { + name = $OATH$ + value = flag:$OATH$ + } + scope:$OATH$ ?= { + add_to_list = chosen_oaths + } +} + +coronation_set_oath_alternatives_effect = { + # Find up to 11 fitting oaths the ruler might choose from + random_list = { + pick = 11 + unique = yes + ## Diplomacy + # Alliances + 1 = { + trigger = { + is_ai = no + NOR = { + has_variable = diplomacy_oath_1 + has_character_modifier = oath_of_alliances + } + any_ally = { + count <= 1 + } + } + coronation_set_oath_effect = { OATH = diplomacy_oath_1 } + } + # Children + 1 = { + trigger = { + NOR = { + has_variable = diplomacy_oath_2 + has_character_modifier = oath_of_children + } + fertility >= 0.5 + trigger_if = { + limit = { + is_ai = yes + } + OR = { + is_married = no + any_spouse = { + fertility >= 0.5 + } + } + } + age <= 30 + any_child = { + count <= 2 + } + } + coronation_set_oath_effect = { OATH = diplomacy_oath_2 } + } + ## Martial + # Reconquering Lands in your De Jure + 1 = { + trigger = { + OR = { + is_ai = no + ai_has_conqueror_personality = yes + } + NOR = { + has_variable = martial_oath_1 + has_character_modifier = oath_of_reconquest + government_has_flag = government_is_mandala + } + primary_title ?= { + any_de_jure_county = { + percent >= 0.35 + holder = { + NOR = { + target_is_liege_or_above = root + this = root + } + } + } + } + } + coronation_set_oath_effect = { OATH = martial_oath_1 } + } + # General Conquer lands Oath + 1 = { + trigger = { + OR = { + is_ai = no + ai_has_conqueror_personality = yes + ai_has_warlike_personality = yes + } + NOR = { + has_variable = martial_oath_2 + has_character_modifier = oath_of_conquest + government_has_flag = government_is_mandala + } + } + coronation_set_oath_effect = { OATH = martial_oath_2 } + } + ## Stewardship + # Peace Oath + 1 = { + trigger = { + NOR = { + has_variable = stewardship_oath_1 + has_character_modifier = oath_of_peace + } + days_of_continuous_peace <= 365 + } + coronation_set_oath_effect = { OATH = stewardship_oath_1 } + } + # Building Oath + 1 = { + trigger = { + OR = { + is_ai = no + ai_has_economical_boom_personality = yes + } + NOR = { + has_variable = stewardship_oath_2 + has_character_modifier = oath_of_buildings + government_has_flag = government_is_nomadic + government_has_flag = government_is_tribal + } + } + coronation_set_oath_effect = { OATH = stewardship_oath_2 } + } + ## Intrigue + ## Learning + # University Oath + 50 = { + trigger = { + is_ai = no + NOT = { has_variable = learning_oath_1 } + any_realm_county = { + title_province = { has_special_building = no } + development_level >= 25 + } + } + coronation_set_oath_effect = { OATH = learning_oath_1 } + } + # Purge Pretenders + 1 = { + trigger = { + is_ai = no + NOR = { + has_variable = purge_pretenders_oath + has_character_modifier = oath_of_purge_pretenders + has_realm_law = single_heir_succession_law + has_realm_law = clan_harmonious_partition_succession_law + has_realm_law = single_heir_succession_law_youngest + has_realm_law = single_heir_dynasty_house + government_has_flag = government_is_mandala + } + trigger_if = { + limit = { + culture = { + has_cultural_era_or_later = culture_era_late_medieval + } + } + primary_title ?= { + any_claimant = { + count >= 12 + NOT = { + is_child_of = root + } + } + } + } + trigger_else_if = { + limit = { + culture = { + has_cultural_era_or_later = culture_era_high_medieval + } + } + primary_title ?= { + any_claimant = { + count >= 10 + NOT = { + is_child_of = root + } + } + } + } + trigger_else_if = { + limit = { + culture = { + has_cultural_era_or_later = culture_era_early_medieval + } + } + primary_title ?= { + any_claimant = { + count >= 8 + NOT = { + is_child_of = root + } + } + } + } + trigger_else = { + primary_title ?= { + any_claimant = { + count >= 6 + NOT = { + is_child_of = root + } + } + } + } + } + coronation_set_oath_effect = { OATH = purge_pretenders_oath } + } + + # End the struggle + 100 = { + trigger = { + is_ai = no + NOR = { + has_variable = end_the_struggle_oath + has_character_modifier = oath_of_end_the_struggle + } + OR = { + exists = struggle:iberian_struggle + exists = struggle:persian_struggle + } + OR = { + any_character_struggle = { is_struggle_type = iberian_struggle } + any_character_struggle = { is_struggle_type = persian_struggle } + } + } + coronation_set_oath_effect = { OATH = end_the_struggle_oath } + } + + ## Greatest Hunter + 1 = { + trigger = { + is_ai = no + NOR = { + has_variable = greatest_hunter_oath + has_character_modifier = oath_greatest_hunter + culture ?= { has_cultural_tradition = tradition_vegetarianism } + } + } + coronation_set_oath_effect = { OATH = greatest_hunter_oath } + } + + ## Heir Preparation + 1 = { + trigger = { + is_ai = no + age >= 50 + NOR = { + has_variable = heir_preparation_oath + has_character_modifier = oath_heir_preparation + primary_heir ?= { + is_child_of = prev + } + } + } + coronation_set_oath_effect = { OATH = heir_preparation_oath } + } + + ## Install Claimants + 1 = { + trigger = { + is_ai = no + NOR = { + has_variable = install_claimants_oath + has_character_modifier = oath_install_claimants + government_has_flag = government_is_mandala + } + } + coronation_set_oath_effect = { OATH = install_claimants_oath } + } + + ## Mend the Fracture + 1 = { + trigger = { + always = no + NOR = { + has_variable = mend_the_fracture_oath + has_character_modifier = oath_mend_the_fracture + } + any_sub_realm_county = { + percent >= 0.4 + culture != root.culture + culture = { + cultural_acceptance = { + target = root.culture + value <= 20 + } + any_culture_county = { + count >= 6 + holder = { + target_is_liege_or_above = root + } + } + any_culture_county = { + percent >= 0.6 + holder = { + target_is_liege_or_above = root + } + } + } + } + } + coronation_set_oath_effect = { OATH = mend_the_fracture_oath } + } + + ## Provide for Warriors + 1 = { + trigger = { + OR = { + is_ai = no + ai_has_economical_boom_personality = yes + } + NOR = { + has_variable = provide_for_the_warriors_oath + has_character_modifier = oath_provide_for_the_warriors + government_has_flag = government_is_nomadic + government_has_flag = government_is_tribal + } + any_directly_owned_province = { + count >= 3 + free_building_slots >= 1 + NOT = { + has_building_or_higher = oath_warriors_building_01 + } + } + } + coronation_set_oath_effect = { OATH = provide_for_the_warriors_oath } + } + + ## Provide for the Faithful + 1 = { + trigger = { + OR = { + is_ai = no + ai_has_economical_boom_personality = yes + } + NOR = { + has_variable = provide_for_the_faithful_oath + has_character_modifier = oath_provide_for_the_faithful + government_has_flag = government_is_nomadic + government_has_flag = government_is_tribal + } + any_directly_owned_province = { + count >= 3 + free_building_slots >= 1 + NOT = { + has_building_or_higher = oath_faithful_building_01 + } + } + } + coronation_set_oath_effect = { OATH = provide_for_the_faithful_oath } + } + + ## Provide for the Poor + 1 = { + trigger = { + OR = { + is_ai = no + ai_has_economical_boom_personality = yes + } + NOR = { + has_variable = provide_for_the_poor_oath + has_character_modifier = oath_provide_for_the_poor + government_has_flag = government_is_nomadic + government_has_flag = government_is_tribal + } + any_directly_owned_province = { + count >= 3 + free_building_slots >= 1 + NOT = { + has_building_or_higher = oath_poor_building_01 + } + } + } + coronation_set_oath_effect = { OATH = provide_for_the_poor_oath } + } + + ## Repent + 1 = { + trigger = { + is_ai = no + NOR = { + has_variable = repent_oath + has_character_modifier = oath_repent + } + num_sinful_traits >= 1 + } + coronation_set_oath_effect = { OATH = repent_oath } + } + } +} + +coronation_chosen_oath_setup_effect = { + custom_tooltip = $VAR$_tooltip + set_variable = { + name = $VAR$ + value = 0 + } + set_variable = { + name = $VAR$_timer + days = $TIME$ + } + trigger_event = { + on_action = coronation_failed_oath_on_action + days = $TIME$ + } + scope:activity = { + set_variable = { + name = $VAR$ + value = 0 + } + } +} + +coronation_upgrade_oath_value_effect = { + save_scope_value_as = { + name = value_of_oath + value = { + value = 0 + add = { + value = scope:activity.var:activity_special_type_progression + divide = 20 + ceiling = yes + } + min = 1 + } + } + # Diplomacy + if = { + limit = { + has_variable = diplomacy_oath_1 + var:diplomacy_oath_1 = 0 + } + set_variable = { + name = diplomacy_oath_1 + value = scope:value_of_oath + } + } + if = { + limit = { + has_variable = diplomacy_oath_2 + var:diplomacy_oath_2 = 0 + } + set_variable = { + name = diplomacy_oath_2 + value = scope:value_of_oath + } + } + # Martial + else_if = { + limit = { + has_variable = martial_oath_1 + var:martial_oath_1 = 0 + } + set_variable = { + name = martial_oath_1 + value = scope:value_of_oath + } + } + else_if = { + limit = { + has_variable = martial_oath_2 + var:martial_oath_2 = 0 + } + set_variable = { + name = martial_oath_2 + value = scope:value_of_oath + } + } + # Stewardship + else_if = { + limit = { + has_variable = stewardship_oath_1 + var:stewardship_oath_1 = 0 + } + set_variable = { + name = stewardship_oath_1 + value = scope:value_of_oath + } + } + else_if = { + limit = { + has_variable = stewardship_oath_2 + var:stewardship_oath_2 = 0 + } + set_variable = { + name = stewardship_oath_2 + value = scope:value_of_oath + } + } + # Intrigue + # Learning + else_if = { + limit = { + has_variable = learning_oath_1 + var:learning_oath_1 = 0 + } + set_variable = { + name = learning_oath_1 + value = scope:value_of_oath + } + } + + # De Jure rights + else_if = { + limit = { + has_variable = purge_pretenders_oath + var:purge_pretenders_oath = 0 + } + set_variable = { + name = purge_pretenders_oath + value = scope:value_of_oath + } + } + + # End the struggle + else_if = { + limit = { + has_variable = end_the_struggle_oath + var:end_the_struggle_oath = 0 + } + set_variable = { + name = end_the_struggle_oath + value = scope:value_of_oath + } + } + + # Greatest Hunter + else_if = { + limit = { + has_variable = greatest_hunter_oath + var:greatest_hunter_oath = 0 + } + set_variable = { + name = greatest_hunter_oath + value = scope:value_of_oath + } + } + + # Heir Preparation + else_if = { + limit = { + has_variable = heir_preparation_oath + var:heir_preparation_oath = 0 + } + set_variable = { + name = heir_preparation_oath + value = scope:value_of_oath + } + } + + # Install Claimants + else_if = { + limit = { + has_variable = install_claimants_oath + var:install_claimants_oath = 0 + } + set_variable = { + name = install_claimants_oath + value = scope:value_of_oath + } + } + + # Mend the Fracture + else_if = { + limit = { + has_variable = mend_the_fracture_oath + var:mend_the_fracture_oath = 0 + } + set_variable = { + name = mend_the_fracture_oath + value = scope:value_of_oath + } + } + + # Provide for the Warriors + else_if = { + limit = { + has_variable = provide_for_the_warriors_oath + var:provide_for_the_warriors_oath = 0 + } + set_variable = { + name = provide_for_the_warriors_oath + value = scope:value_of_oath + } + } + + # Provide for the Faithful + else_if = { + limit = { + has_variable = provide_for_the_faithful_oath + var:provide_for_the_faithful_oath = 0 + } + set_variable = { + name = provide_for_the_faithful_oath + value = scope:value_of_oath + } + } + + # Provide for the Poor + else_if = { + limit = { + has_variable = provide_for_the_poor_oath + var:provide_for_the_poor_oath = 0 + } + set_variable = { + name = provide_for_the_poor_oath + value = scope:value_of_oath + } + } + + # Repent + else_if = { + limit = { + has_variable = repent_oath + var:repent_oath = 0 + } + set_variable = { + name = repent_oath + value = scope:value_of_oath + } + } +} + +coronation_oath_reward_effect = { + save_scope_value_as = { + name = oath_base_value + value = { + value = 200 + switch = { + trigger = var:$VARIABLE$ + 2 = { + multiply = { + value = 1 + add = 0.4 + } + } + 3 = { + multiply = { + value = 1 + add = { + value = 0.4 + multiply = 2 + } + } + } + 4 = { + multiply = { + value = 1 + add = { + value = 0.4 + multiply = 3 + } + } + } + 5 = { + multiply = { + value = 1 + add = { + value = 0.4 + multiply = 4 + } + } + } + 6 = { + multiply = { + value = 1 + add = { + value = 0.4 + multiply = 5 + } + } + } + 7 = { + multiply = { + value = 1 + add = { + value = 0.4 + multiply = 6 + } + } + } + } + } + } + coronation_oath_legitimacy_effect = { VALUE = scope:oath_base_value } + coronation_oath_prestige_effect = { + VALUE = scope:oath_base_value + PRESTIGE_MULTIPLIER = 2 + } + remove_variable = $VARIABLE$ +} + +coronation_oath_legitimacy_effect = { + save_scope_value_as = { + name = base_value + value = { + value = $VALUE$ + if = { # With higher legitimacy level, you are less in need of legitimacy, so we reduce the amount. In turn, we increase prestige gains later + limit = { + root.legitimacy_level >= 5 + } + multiply = 0.5 + } + #Balancing down because wow + multiply = 0.2 + } + } + add_legitimacy = scope:base_value +} + +coronation_oath_prestige_effect = { + save_scope_value_as = { + name = base_value + value = { + value = $VALUE$ + multiply = $PRESTIGE_MULTIPLIER$ + if = { # When Legitimacy gain goes down, Prestige gain goes up + limit = { + root.legitimacy_level >= 5 + } + multiply = 1.5 + } + #Balancing down because wow + multiply = 0.5 + } + } + add_prestige = scope:base_value +} + +coronation_oath_success_effect = { + save_scope_value_as = { + name = find_oath + value = flag:$OATH$ + } + show_as_tooltip = { + coronation_oath_reward_effect = { VARIABLE = $OATH$ } + } + + trigger_event = coronation_events.0175 +} + +coronation_oath_remove_variable_on_failure_effect = { + if = { + limit = { + has_variable = $VAR$ + NOT = { has_variable = $VAR$_timer } + } + save_scope_value_as = { + name = find_oath + value = flag:$VAR$ + } + remove_variable = $VAR$ + } +} + +coronation_oath_cleanup_effect = { + # Diplomacy + if = { + limit = { + NOT = { has_variable = diplomacy_oath_1 } + } + remove_variable = diplomacy_oath_1_timer + } + if = { + limit = { + NOT = { has_variable = diplomacy_oath_2 } + } + remove_variable = diplomacy_oath_2_timer + } + # Martial + if = { + limit = { + NOT = { has_variable = martial_oath_1 } + } + remove_variable = martial_oath_1_timer + remove_variable = oath_reconquest_title + } + if = { + limit = { + NOT = { has_variable = martial_oath_2 } + } + remove_variable = martial_oath_2_timer + remove_variable = oath_conquest_size + } + # Stewardship + if = { + limit = { + NOT = { has_variable = stewardship_oath_1 } + } + remove_variable = stewardship_oath_1_timer + } + if = { + limit = { + NOT = { has_variable = stewardship_oath_2 } + } + remove_variable = stewardship_oath_2_timer + } + # Learning + if = { + limit = { + NOT = { has_variable = learning_oath_1 } + } + remove_variable = learning_oath_1_timer + remove_variable = learning_oath_cost + } + # De Jure rights + if = { + limit = { + NOT = { has_variable = purge_pretenders_oath } + } + remove_variable = purge_pretenders_oath_timer + remove_variable = purge_pretenders_target_title + } + # End the struggle + if = { + limit = { + NOT = { has_variable = end_the_struggle_oath } + } + remove_variable = end_the_struggle_oath_timer + remove_variable = end_the_struggle_oath_type_var + } + # Greatest Hunter + if = { + limit = { + NOT = { has_variable = greatest_hunter_oath } + } + remove_variable = greatest_hunter_oath_timer + remove_variable = greatest_hunter_oath_l_counter + remove_variable = greatest_hunter_oath_r_counter + } + # Heir Preparation + if = { + limit = { + NOT = { has_variable = heir_preparation_oath } + } + remove_variable = heir_preparation_oath_timer + } + # Install Claimants + if = { + limit = { + NOT = { has_variable = install_claimants_oath } + } + remove_variable = install_claimants_oath_timer + } + # Mend the Fracture + if = { + limit = { + NOT = { has_variable = mend_the_fracture_oath } + } + remove_variable = mend_the_fracture_oath_timer + } + # Provide for the Warriors + if = { + limit = { + NOT = { has_variable = provide_for_the_warriors_oath } + } + remove_variable = provide_for_the_warriors_oath_timer + } + # Provide for the Faithful + if = { + limit = { + NOT = { has_variable = provide_for_the_faithful_oath } + } + remove_variable = provide_for_the_faithful_oath_timer + } + # Provide for the Poor + if = { + limit = { + NOT = { has_variable = provide_for_the_poor_oath } + } + remove_variable = provide_for_the_poor_oath_timer + } + # Repent + if = { + limit = { + NOT = { has_variable = repent_oath } + } + remove_variable = repent_oath_timer + } + +} + +coronation_hof_visit_effect = { + involved_activity = { + add_activity_log_entry = { + key = activity_hof_arrival_log + tags = { good } + score = 20 + character = activity_host + target = scope:hof + } + # Small boost to Magnificence + activity_special_type_progression_tiny = yes + custom_tooltip = coronation_tt_positive_tiny + activity_host = { + # Hosts get a bit of legitimacy and piety from having the HoF show up + add_legitimacy_effect = { LEGITIMACY = minor_legitimacy_gain } + add_piety = minor_piety_gain + } + activity_location = { + show_as_tooltip = { + add_province_modifier = { + modifier = ach_hof_visit_modifier + years = 10 + } + } + if = { # Add the Papal visit modifier + limit = { + NOT = { has_province_modifier = ach_hof_visit_modifier } + } + hidden_effect = { + add_province_modifier = { + modifier = ach_hof_visit_modifier + years = 10 + } + + # Toast the divine trinity of those who care: the host, the local baron and the holy count + scope:host = { + send_interface_toast = { + title = ach_coronation.0001.tt.hof_visit.title + left_icon = scope:hof + custom_tooltip = ach_coronation.0001.tt.hof_visit + } + } + } + } + } + } +} + +create_proper_coronation_artifact_setup = { + if = { + limit = { + coronation_proper_artifact_crown_trigger = yes + } + save_scope_value_as = { + name = coronation_artifact + value = flag:smith_type_crown + } + } + else_if = { + limit = { + coronation_proper_artifact_regalia_trigger = yes + } + save_scope_value_as = { + name = coronation_artifact + value = flag:smith_type_regalia + } + } + else = { + save_scope_value_as = { + name = coronation_artifact + value = flag:smith_type_crown + } + } + + if = { #first we check for an antiquarian + limit = { + employs_court_position = antiquarian_court_position + } + random_court_position_holder = { + type = antiquarian_court_position + save_scope_as = crownmaker + } + } + else_if = { + limit = { + any_pool_character = { + province = root.capital_province + has_no_particular_noble_roots_trigger = yes + is_available_healthy_ai_adult = yes + NOR = { + exists = inspiration + has_trait = peasant_leader + } + } + } + + random_pool_character = { + province = root.capital_province + limit = { + has_no_particular_noble_roots_trigger = yes + is_available_healthy_ai_adult = yes + NOR = { + exists = inspiration + has_trait = peasant_leader + } + } + save_scope_as = crownmaker + } + hidden_effect = { root = { add_courtier = scope:crownmaker } } + } + else = { + hidden_effect = { + create_character = { + template = local_artisan_template + location = root.capital_province + gender_female_chance = root_faith_dominant_gender_adjusted_female_chance + save_scope_as = crownmaker + } + root = { add_courtier = scope:crownmaker } + } + } + + add_character_flag = waiting_for_a_crown + + scope:crownmaker = { + set_variable = { + name = artifact_smith_type + value = scope:coronation_artifact + } + create_inspiration = smith_inspiration + } +} + +create_proper_coronation_artifact_creation = { + if = { + limit = { scope:coronation_artifact = flag:smith_type_crown } + custom_tooltip = court_maintenance.0011.crown_needed.tooltip + } + else = { + custom_tooltip = court_maintenance.0011.regalia_needed.tooltip + } + sponsor_inspiration = scope:crownmaker.inspiration +} + +create_proper_coronation_artifact = { + create_proper_coronation_artifact_setup = yes + hidden_effect = { sponsor_inspiration = scope:crownmaker.inspiration } +} + +coronation_ceremony_magnificence_effect = { + if = { + limit = { + coronation_ceremony_magnificence_adjustment_value >= 3 + } + custom_tooltip = coronation_tt_positive_major + scope:activity = { activity_special_type_progression_major = yes } + } + else_if = { + limit = { + coronation_ceremony_magnificence_adjustment_value >= 2 + } + custom_tooltip = coronation_tt_positive_medium + scope:activity = { activity_special_type_progression_medium = yes } + } + else_if = { + limit = { + coronation_ceremony_magnificence_adjustment_value >= 1 + } + custom_tooltip = coronation_tt_positive_tiny + scope:activity = { activity_special_type_progression_tiny = yes } + } + else_if = { + limit = { + coronation_ceremony_magnificence_adjustment_value >= 0 + } + custom_tooltip = coronation_tt_positive_miniscule + scope:activity = { activity_special_type_progression_miniscule = yes } + } + else_if = { + limit = { + coronation_ceremony_magnificence_adjustment_value >= -1 + } + custom_tooltip = coronation_tt_negative_tiny + scope:activity = { activity_special_type_progression_negative_tiny = yes } + } + else = { + custom_tooltip = coronation_tt_negative + scope:activity = { activity_special_type_progression_negative = yes } + } + if = { + limit = { + has_activity_intent = coronation_impress_attendees + } + custom_tooltip = improved_because_intent_tt + } + if = { + limit = { + scope:activity = { + has_activity_option = { + category = ceremony_size + option = coronation_large_ceremony + } + } + } + custom_tooltip = improved_by_coronation_large_ceremony_tt + } + if = { + limit = { + scope:activity = { + has_activity_option = { + category = ceremony_size + option = coronation_small_ceremony + } + } + } + custom_tooltip = degraded_by_coronation_small_ceremony_tt + } +} + +#For flavor and adjusting piety in coronation ceremony the clergy's approval event +coronation_ceremony_piety_effect = { + if = { + limit = { + coronation_clergy_approval_value >= 3 + } + add_piety = { + value = massive_piety_gain + if = { + limit = { + scope:activity = { + has_activity_option = { + category = special_type + option = coronation_type_anointment + } + } + } + multiply = 1.5 + } + } + } + else_if = { + limit = { + coronation_clergy_approval_value >= 2 + } + add_piety = { + value = major_piety_gain + if = { + limit = { + scope:activity = { + has_activity_option = { + category = special_type + option = coronation_type_anointment + } + } + } + multiply = 1.5 + } + } + } + else_if = { + limit = { + coronation_clergy_approval_value >= 1 + } + add_piety = { + value = medium_piety_gain + if = { + limit = { + scope:activity = { + has_activity_option = { + category = special_type + option = coronation_type_anointment + } + } + } + multiply = 1.5 + } + } + } + else_if = { + limit = { + coronation_clergy_approval_value >= 0 + } + add_piety = { + value = minor_piety_gain + if = { + limit = { + scope:activity = { + has_activity_option = { + category = special_type + option = coronation_type_anointment + } + } + } + multiply = 1.5 + } + } + } + else_if = { + limit = { + coronation_clergy_approval_value >= -1 + } + add_piety = { + value = miniscule_piety_gain + if = { + limit = { + scope:activity = { + has_activity_option = { + category = special_type + option = coronation_type_anointment + } + } + } + multiply = 1.5 + } + } + } + else_if = { + limit = { + coronation_clergy_approval_value >= -2 + } + add_piety = minor_piety_loss + } + else_if = { + limit = { + coronation_clergy_approval_value >= -3 + } + add_piety = major_piety_loss + } + else_if = { + limit = { + coronation_clergy_approval_value >= -4 + } + add_piety = major_piety_loss + } + else = { + add_piety = massive_piety_loss + } + #Custom tooltip triggers need to match coronation_clergy_approval_value + if = { + limit = { + OR = { + scope:activity.special_guest:priest ?= { + opinion = { + target = scope:host + value >= 90 + } + } + faith.religious_head ?= { + opinion = { + target = scope:host + value >= 40 + } + } + } + } + custom_tooltip = coronation_piety_improved_by_clerics + } + if = { + limit = { + OR = { + scope:activity.special_guest:priest ?= { + opinion = { + target = scope:host + value <= -90 + } + } + faith.religious_head ?= { + opinion = { + target = scope:host + value <= -40 + } + } + } + } + custom_tooltip = coronation_piety_harmed_by_clerics + } + if = { + limit = { + OR = { + num_virtuous_traits >= 1 + has_trait = zealous + has_trait = saint + has_trait = saoshyant_descendant + has_trait = sayyid + has_trait = divine_blood + has_trait = consecrated_blood + has_trait = order_member + has_trait = faith_warrior + has_trait = saoshyant + has_trait = paragon + has_trait = savior + has_trait = crusader_king + has_trait = theologian + } + } + custom_tooltip = coronation_piety_improved_by_virtuous_traits + } + if = { + limit = { + OR = { + num_sinful_traits >= 1 + has_trait = cynical + has_trait = excommunicated + has_any_shunned_or_criminal_trait_in_faith_trigger = { + CHARACTER = scope:host + FAITH = scope:host.faith + } + has_trait = despoiler_of_byzantium + has_trait = bastard + has_trait = gallowsbait + has_trait = decadent + num_sinful_traits >= 2 + } + } + custom_tooltip = coronation_piety_harmed_by_sinful_traits + } + if = { + limit = { + piety_level >= 3 + } + custom_tooltip = coronation_piety_improved_by_piety_level + } + if = { + limit = { + piety_level < 1 + } + custom_tooltip = coronation_piety_harmed_by_piety_level + } +} + +#For flavor and adjusting prestige in coronation ceremony the vassals' approval event +coronation_ceremony_prestige_effect = { + if = { + limit = { + coronation_vassals_approval_value >= 3 + } + add_prestige = massive_prestige_gain + } + else_if = { + limit = { + coronation_vassals_approval_value >= 2 + } + add_prestige = major_prestige_gain + } + else_if = { + limit = { + coronation_vassals_approval_value >= 1 + } + add_prestige = medium_prestige_gain + } + else_if = { + limit = { + coronation_vassals_approval_value >= 0 + } + add_prestige = minor_prestige_gain + } + else_if = { + limit = { + coronation_vassals_approval_value >= -1 + } + add_prestige = miniscule_prestige_gain + } + else_if = { + limit = { + coronation_vassals_approval_value >= -2 + } + add_prestige = minor_prestige_loss + } + else_if = { + limit = { + coronation_vassals_approval_value >= -3 + } + add_prestige = medium_prestige_loss + } + else_if = { + limit = { + coronation_vassals_approval_value >= -4 + } + add_prestige = major_prestige_loss + } + else = { + add_prestige = massive_prestige_loss + } + #Custom tooltip triggers need to match coronation_vassals_approval_value + #Tooltip major reasons why or why not + if = { + limit = { + has_activity_intent = coronation_embrace_supporters + } + custom_tooltip = coronation_prestige_embrace_supporters + } + if = { + limit = { + combined_supporter_vassal_strength > combined_detractor_vassal_strength + } + custom_tooltip = coronation_prestige_improved_by_supporters + } + if = { + limit = { + combined_detractor_vassal_strength > combined_supporter_vassal_strength + } + custom_tooltip = coronation_prestige_harmed_by_detractors + } + if = { + limit = { + OR = { + any_targeting_faction = { + faction_power >= scope:host.current_military_strength + NOT = { + faction_is_type = peasant_faction + } + } + any_targeting_faction = { + count >= 2 + NOT = { + faction_is_type = peasant_faction + } + } + } + } + custom_tooltip = coronation_prestige_harmed_by_factions + } + if = { + limit = { + OR = { + has_trait = bastard + has_trait = denounced + has_trait = wild_oat + has_trait = legitimized_bastard + has_trait = gallivanter + has_trait = disinherited + has_trait = bastard_founder + has_trait = disloyal + } + } + custom_tooltip = coronation_prestige_harmed_by_ignoble_traits + } + if = { + limit = { + OR = { + AND = { + tyranny >= high_tyranny + dread < high_dread + } + AND = { + tyranny >= medium_tyranny + dread < medium_dread + } + } + } + custom_tooltip = coronation_prestige_harmed_by_tyranny + } + if = { + limit = { + OR = { + has_trait = august + has_trait = family_first + has_trait = knight_errant + AND = { + has_trait = lifestyle_hunter + OR = { + has_trait_xp = { + trait = lifestyle_hunter + track = hunter + value >= 25 + } + has_trait_xp = { + trait = lifestyle_hunter + track = falconer + value >= 25 + } + } + } + AND = { + has_trait = governor + has_trait_xp = { + trait = governor + value >= 50 + } + } + has_trait = violet_poet + has_trait = diplomat + has_trait = extolled + has_trait = augustus + has_trait = greatest_of_khans + has_trait = gallant + } + } + custom_tooltip = coronation_prestige_improved_by_noble_traits + } + if = { + limit = { + legitimacy_level >= 5 + } + custom_tooltip = coronation_prestige_improved_by_legitimacy + } +} + +#For flavor and adjusting legitimacy in coronation ceremony the people's approval event +coronation_ceremony_legitimacy_effect = { + if = { + limit = { + has_legitimacy = yes + } + if = { + limit = { + coronation_popular_approval_value >= 3 + } + add_legitimacy = major_legitimacy_gain + } + else_if = { + limit = { + coronation_popular_approval_value >= 2 + } + add_legitimacy = medium_legitimacy_gain + } + else_if = { + limit = { + coronation_popular_approval_value >= 1 + } + add_legitimacy = minor_legitimacy_gain + } + else_if = { + limit = { + coronation_popular_approval_value >= 0 + } + add_legitimacy = miniscule_legitimacy_gain + } + else_if = { + limit = { + coronation_popular_approval_value >= -1 + } + add_legitimacy = minor_legitimacy_loss + } + else_if = { + limit = { + coronation_popular_approval_value >= -2 + } + add_legitimacy = medium_legitimacy_loss + } + else = { + add_legitimacy = major_legitimacy_loss + } + } + #Tooltip major reasons why or why not + #coronation_popular_approval_value needs to be updated with these + if = { + limit = { + has_activity_intent = coronation_impress_attendees + } + custom_tooltip = coronation_legit_impress_attendees + } + if = { + limit = { + OR = { + has_trait = peasant_leader + has_trait = populist_leader + has_trait = education_republican_knowledge_1 + has_trait = education_republican_knowledge_2 + has_trait = education_republican_knowledge_3 + has_trait = education_republican_knowledge_4 + } + } + custom_tooltip = coronation_legit_improved_by_peasant_leader + } + if = { + limit = { + location.county = { + county_opinion >= 25 + } + } + custom_tooltip = coronation_legit_improved_by_county_opinion + } + if = { + limit = { + involved_activity = { + has_activity_option = { + category = special_type + option = coronation_type_anointment + } + } + } + custom_tooltip = coronation_legit_improved_by_anointment + } + if = { + limit = { + location.county = { + county_opinion < 0 + holder = { + OR = { + this = root + any_liege_or_above = { + this = root + } + } + } + } + } + custom_tooltip = coronation_legit_harmed_by_county_opinion + } + if = { + limit = { + location.county = { + county_control < 100 + holder = { + OR = { + this = root + any_liege_or_above = { + this = root + } + } + } + } + } + custom_tooltip = coronation_legit_harmed_by_county_control + } + if = { + limit = { + #county is in faction against liege + location.county = { + holder = { + OR = { + this = scope:host + any_liege_or_above = { + this = scope:host + } + } + } + title_is_a_faction_member = yes + } + } + custom_tooltip = coronation_legit_harmed_by_county_faction + } + if = { + limit = { + OR = { + AND = { + tyranny >= high_tyranny + dread < high_dread + } + AND = { + tyranny >= medium_tyranny + dread < medium_dread + } + } + } + custom_tooltip = coronation_legitimacy_harmed_by_tyranny + } + if = { + limit = { + location = { + any_province_epidemic = { + exists = this + } + } + } + custom_tooltip = coronation_legit_harmed_by_disease + } +} + +#Increases or reduces attendee opinion based on coronation magnificence +#Used in ceremony phase +coronation_ceremony_opinion_effect = { + scope:activity = { + if = { + limit = { + scope:activity.var:activity_special_type_progression >= 75 + } + every_attending_character = { + custom = custom.every_attending_character + limit = { + NOT = { + this = scope:host + } + } + add_opinion = { + target = scope:host + opinion = 10 + modifier = impressed_opinion + } + } + scope:host = { + custom_tooltip = coronation_ceremony_opinion_effect_tt + } + } + else_if = { + limit = { + scope:activity.var:activity_special_type_progression >= 50 + } + every_attending_character = { + custom = custom.every_attending_character + limit = { + NOT = { + this = scope:host + } + } + add_opinion = { + target = scope:host + opinion = 5 + modifier = impressed_opinion + } + } + scope:host = { + custom_tooltip = coronation_ceremony_opinion_effect_tt + } + } + else_if = { + limit = { + scope:activity.var:activity_special_type_progression < 25 + } + every_attending_character = { + custom = custom.every_attending_character + limit = { + NOT = { + this = scope:host + } + } + add_opinion = { + target = scope:host + opinion = -10 + modifier = contempt_opinion + } + } + scope:host = { + custom_tooltip = coronation_ceremony_opinion_effect_tt + } + } + } +} + +#Only going to do anything in root's realm, during beginning of coronation ceremony +coronation_ceremony_county_effect = { + scope:activity = { + if = { + limit = { + activity_location.county.holder = { + OR = { + this = scope:host + any_liege_or_above = { + this = scope:host + } + } + } + } + if = { + limit = { + scope:activity.var:activity_special_type_progression >= 75 + } + activity_location.county = { + if = { + limit = { + county_control < 100 + } + change_county_control = major_county_control_gain + } + if = { + limit = { uses_county_fertility = yes } + add_county_modifier = { + modifier = major_coronation_approval_unsettled_modifier + years = 10 + desc = coronation_modifier_removed_on_title_transfer_desc + } + } + else = { + add_county_modifier = { + modifier = major_coronation_approval_modifier + years = 10 + desc = coronation_modifier_removed_on_title_transfer_desc + } + } + custom_tooltip = county_modifier_excellent_magnificence + custom_tooltip = coronation_modifier_removed_on_title_transfer_tt + custom_tooltip = coronation_modifier_negative_on_title_transfer_tt + } + } + else_if = { + limit = { + scope:activity.var:activity_special_type_progression >= 50 + } + activity_location.county = { + if = { + limit = { + county_control < 100 + } + change_county_control = medium_county_control_gain + } + if = { + limit = { uses_county_fertility = yes } + add_county_modifier = { + modifier = medium_coronation_approval_unsettled_modifier + years = 10 + desc = coronation_modifier_removed_on_title_transfer_desc + } + } + else = { + add_county_modifier = { + modifier = medium_coronation_approval_modifier + years = 10 + desc = coronation_modifier_removed_on_title_transfer_desc + } + } + custom_tooltip = county_modifier_good_magnificence + custom_tooltip = coronation_modifier_removed_on_title_transfer_tt + custom_tooltip = coronation_modifier_negative_on_title_transfer_tt + } + } + else_if = { + limit = { + scope:activity.var:activity_special_type_progression >= 25 + } + activity_location.county = { + if = { + limit = { + county_control < 100 + } + change_county_control = minor_county_control_gain + } + if = { + limit = { uses_county_fertility = yes } + add_county_modifier = { + modifier = minor_coronation_approval_unsettled_modifier + years = 10 + desc = coronation_modifier_removed_on_title_transfer_desc + } + } + else = { + add_county_modifier = { + modifier = minor_coronation_approval_modifier + years = 10 + desc = coronation_modifier_removed_on_title_transfer_desc + } + } + custom_tooltip = county_modifier_decent_magnificence + custom_tooltip = coronation_modifier_removed_on_title_transfer_tt + custom_tooltip = coronation_modifier_negative_on_title_transfer_tt + } + } + } + } +} + +coronation_move_towards_supporter_effect = { + $CHARACTER$ = { + if = { + limit = { + scope:activity = { + is_target_in_variable_list = { + name = major_detractor + target = $CHARACTER$ + } + } + } + scope:activity = { + remove_list_variable = { + name = major_detractor + target = $CHARACTER$ + } + } + } + #Are you a detractor? Stop that + if = { + limit = { + is_in_guest_subset = { + name = detractor + } + } + if = { + limit = { + root = scope:host + } + custom_tooltip = buddy_leaves_detractors_tt + } + else = { + custom_tooltip = buddy_leaves_detractors_tt.guest + } + scope:activity = { + remove_from_guest_subset = { + name = detractor + target = $CHARACTER$ + } + add_to_variable_list = { + name = blocked_from_detractors + target = $CHARACTER$ + } + if = { + limit = { + has_variable_list = locked_into_detractors + } + remove_list_variable = { + name = locked_into_detractors + target = $CHARACTER$ + } + } + } + + } + #Not a supporter? Make them a supporter + else_if = { + limit = { + NOT = { + is_in_guest_subset = { + name = supporter + } + } + } + if = { + limit = { + root = scope:host + } + custom_tooltip = buddy_becomes_supporter_tt + } + else = { + custom_tooltip = buddy_becomes_supporter_tt.guest + } + scope:activity = { + add_to_guest_subset = { + name = supporter + target = $CHARACTER$ + } + add_to_variable_list = { + name = locked_into_supporters + target = $CHARACTER$ + } + if = { + limit = { + has_variable_list = blocked_from_supporters + } + remove_list_variable = { + name = blocked_from_supporters + target = $CHARACTER$ + } + } + } + } + if = { + limit = { + NOT = { + scope:activity = { + any_in_list = { + variable = major_supporter + count = all + coronation_supporter_sort_value > $CHARACTER$.coronation_supporter_sort_value + } + } + } + } + scope:activity = { + ordered_in_list = { + variable = major_supporter + order_by = { + value = coronation_supporter_sort_value + multiply = -1 + } + scope:activity = { + remove_list_variable = { + name = major_supporter + target = prev + } + } + } + add_to_variable_list = { + name = major_supporter + target = $CHARACTER$ + } + } + } + } +} +coronation_move_towards_detractor_effect = { + $CHARACTER$ = { + if = { + limit = { + scope:activity = { + is_target_in_variable_list = { + name = major_supporter + target = $CHARACTER$ + } + } + } + scope:activity = { + remove_list_variable = { + name = major_supporter + target = $CHARACTER$ + } + } + } + #re you a detractor? Stop that + if = { + limit = { + is_in_guest_subset = { + name = supporter + } + } + if = { + limit = { + root = scope:host + } + custom_tooltip = hater_leaves_supporters_tt + } + else = { + custom_tooltip = hater_leaves_supporters_tt.guest + } + scope:activity = { + remove_from_guest_subset = { + name = supporter + target = $CHARACTER$ + } + add_to_variable_list = { + name = blocked_from_supporters + target = $CHARACTER$ + } + if = { + limit = { + has_variable_list = locked_into_detractors + } + remove_list_variable = { + name = locked_into_detractors + target = $CHARACTER$ + } + } + } + } + #Not a supporter? Make them a supporter + else_if = { + limit = { + NOT = { + is_in_guest_subset = { + name = detractor + } + } + } + if = { + limit = { + root = scope:host + } + custom_tooltip = hater_becomes_detractor_tt + } + else = { + custom_tooltip = hater_becomes_detractor_tt.guest + } + scope:activity = { + add_to_guest_subset = { + name = detractor + target = $CHARACTER$ + } + add_to_variable_list = { + name = locked_into_detractors + target = $CHARACTER$ + } + if = { + limit = { + has_variable_list = blocked_from_detractors + } + remove_list_variable = { + name = blocked_from_detractors + target = $CHARACTER$ + } + } + } + } + if = { + limit = { + NOT = { + scope:activity = { + any_in_list = { + variable = major_detractor + count = all + coronation_detractor_sort_value > $CHARACTER$.coronation_detractor_sort_value + } + } + } + } + scope:activity = { + ordered_in_list = { + variable = major_detractor + order_by = { + value = coronation_detractor_sort_value + multiply = -1 + } + scope:activity = { + remove_list_variable = { + name = major_detractor + target = prev + } + } + } + add_to_variable_list = { + name = major_detractor + target = $CHARACTER$ + } + } + } + } +} + +coronation_save_crowning_artifact_effect = { + if = { + limit = { + coronation_proper_artifact_regalia_trigger = no + } + ordered_character_artifact = { + order_by = artifact_rarity + limit = { + artifact_slot_type = helmet + has_variable = artifact_succession_title + var:artifact_succession_title = { + this = $HOST$.primary_title + } + } + alternative_limit = { + artifact_slot_type = helmet + NOT = { has_variable = artifact_succession_title } + } + alternative_limit = { + artifact_slot_type = helmet + } + save_scope_as = crowning_artifact + } + } + else = { + ordered_character_artifact = { + order_by = artifact_rarity + limit = { + artifact_slot_type = regalia + has_variable = artifact_succession_title + var:artifact_succession_title = { + this = $HOST$.primary_title + } + } + alternative_limit = { + artifact_slot_type = regalia + NOT = { has_variable = artifact_succession_title } + } + alternative_limit = { + artifact_slot_type = regalia + } + save_scope_as = crowning_artifact + } + } +} + +coronation_weaken_detractors_opinion_effect = { + involved_activity = { + if = { + limit = { + any_attending_character = { + is_vassal_of = root + has_vassal_stance = belligerent + NOT = { is_in_guest_subset = { name = detractor } } + } + } + every_attending_character = { + limit = { + is_vassal_of = root + has_vassal_stance = belligerent + NOT = { is_in_guest_subset = { name = detractor } } + opinion = { + target = root + value < 100 + } + } + custom = weaken_detractors_opinion + add_opinion = { + target = root + modifier = impressed_opinion + opinion = 5 + } + } + } + } +} + +coronation_exalt_crown_opinion_effect = { + involved_activity = { + if = { + limit = { + any_attending_character = { + is_vassal_of = root + has_vassal_stance = parochial + } + } + every_attending_character = { + limit = { + is_vassal_of = root + has_vassal_stance = parochial + } + custom = exalt_crown_opinion + add_opinion = { + target = root + modifier = impressed_opinion + opinion = 5 + } + } + } + } +} + +coronation_embrace_supporters_opinion_effect = { + involved_activity = { + if = { + limit = { + any_attending_character = { + is_vassal_of = root + OR = { + has_vassal_stance = glory_hound + has_vassal_stance = zealot + } + opinion = { + target = root + value < 100 + } + } + } + every_attending_character = { + limit = { + is_vassal_of = root + OR = { + has_vassal_stance = glory_hound + has_vassal_stance = zealot + } + opinion = { + target = root + value < 100 + } + } + custom = embrace_supporters_opinion + add_opinion = { + target = root + modifier = impressed_opinion + opinion = 5 + } + } + } + } +} + +coronation_impress_attendees_opinion_effect = { + involved_activity = { + if = { + limit = { + any_attending_character = { + is_vassal_of = root + OR = { + has_vassal_stance = courtly + has_vassal_stance = minority + } + opinion = { + target = root + value < 100 + } + } + } + every_attending_character = { + limit = { + is_vassal_of = root + OR = { + has_vassal_stance = courtly + has_vassal_stance = minority + } + opinion = { + target = root + value < 100 + } + } + custom = impress_attendees_opinion + add_opinion = { + target = root + modifier = impressed_opinion + opinion = 5 + } + } + } + } +} +coronation_save_anointer_effect = { + scope:host = { + if = { + limit = { + coronation_living_officiator_trigger = yes + NOT = { + scope:activity.var:officiator = { + this = scope:host + } + } + } + scope:activity.var:officiator = { + save_scope_as = anointer + } + } + if = { + limit = { + NOT = { exists = scope:anointer } + scope:activity = { + any_attending_character = { + this = faith.religious_head + NOT = { + this = scope:host + } + faith = scope:host.faith + is_alive = yes + } + } + } + faith.religious_head = { + save_scope_as = anointer + } + } + if = { + limit = { + NOT = { exists = scope:anointer } + cp:councillor_court_chaplain ?= { + is_alive = yes + is_imprisoned = no + is_incapable = no + has_contagious_deadly_disease_trigger = no + } + } + cp:councillor_court_chaplain ?= { + save_scope_as = anointer + } + } + if = { + limit = { + NOT = { exists = scope:anointer } + } + ordered_vassal = { + order_by = max_military_strength + limit = { + involved_activity ?= scope:activity + government_has_flag = government_is_theocracy + is_alive = yes + } + save_scope_as = anointer + } + } + if = { + limit = { + NOT = { exists = scope:anointer } + } + create_character = { + template = priest_character_template + location = scope:host.location + culture = scope:host.location.culture + faith = scope:host.faith + save_scope_as = anointer + } + scope:anointer = { + add_character_flag = anointer_destroy_me + } + } + } +} + +coronation_disburse_rewards_effect = { + if = { #Highest Magnificence Rewards + limit = { + scope:activity = { var:activity_special_type_progression >= 100 } + } + + #Oath Legitimacy and Prestige upgrade notificiation + custom_tooltip = coronation_oath_upgrade_100 + + custom_tooltip = coronation_reward_100 + save_scope_value_as = { + name = coronation_reward_mult + value = 2.5 + } + + ach_coronation_ceremony_intent_modifiers_giveaway_effect = yes + save_scope_value_as = { + name = coronation_vassal_opinion_gain + value = 20 + } + } + else_if = { #High Magnificence Rewards + limit = { + scope:activity = { var:activity_special_type_progression >= 75 } + } + + #Intent rewards + + ach_coronation_ceremony_intent_modifiers_giveaway_effect = yes + + #Oath Legitimacy and Prestige upgrade notificiation + custom_tooltip = coronation_oath_upgrade_75 + + custom_tooltip = coronation_reward_75 + save_scope_value_as = { + name = coronation_reward_mult + value = 1.75 + } + + save_scope_value_as = { + name = coronation_vassal_opinion_gain + value = 15 + } + } + else_if = { #Medium Magnificence Rewards + limit = { + scope:activity = { var:activity_special_type_progression >= 50 } + } + + #Oath Legitimacy and Prestige upgrade notificiation + custom_tooltip = coronation_oath_upgrade_50 + + custom_tooltip = coronation_reward_50 + save_scope_value_as = { + name = coronation_reward_mult + value = 1.5 + } + + save_scope_value_as = { + name = coronation_vassal_opinion_gain + value = 10 + } + } + else_if = { #Low Magnificence Rewards + limit = { + scope:activity = { var:activity_special_type_progression >= 25 } + } + + #Oath Legitimacy and Prestige upgrade notificiation + custom_tooltip = coronation_oath_upgrade_25 + + save_scope_value_as = { + name = coronation_vassal_opinion_gain + value = 5 + } + + save_scope_value_as = { + name = coronation_reward_mult + value = 1.25 + } + } + else = { + save_scope_value_as = { + name = coronation_reward_mult + value = 1 + } + } + + if = { + limit = { exists = scope:coronation_vassal_opinion_gain root = root.involved_activity.activity_host } + switch = { + trigger = has_activity_intent + coronation_exalt_crown = { + involved_activity = { + every_attending_character = { + limit = { + is_vassal_of = root + has_vassal_stance = parochial + } + custom = exalt_crown_opinion + add_opinion = { + target = root + modifier = impressed_opinion + opinion = scope:coronation_vassal_opinion_gain + } + } + } + } + coronation_embrace_supporters = { + involved_activity = { + every_attending_character = { + limit = { + is_vassal_of = root + OR = { + has_vassal_stance = glory_hound + has_vassal_stance = zealot + } + } + custom = embrace_supporters_opinion + add_opinion = { + target = root + modifier = impressed_opinion + opinion = scope:coronation_vassal_opinion_gain + } + } + } + } + coronation_weaken_detractors = { + involved_activity = { + every_attending_character = { + limit = { + is_vassal_of = root + has_vassal_stance = belligerent + NOT = { is_in_guest_subset = { name = detractor } } + } + custom = weaken_detractors_opinion + add_opinion = { + target = root + modifier = impressed_opinion + opinion = scope:coronation_vassal_opinion_gain + } + } + } + } + coronation_impress_attendees = { + involved_activity = { + every_attending_character = { + limit = { + is_vassal_of = root + OR = { + has_vassal_stance = courtly + has_vassal_stance = minority + } + } + custom = impress_attendees_opinion + add_opinion = { + target = root + modifier = impressed_opinion + opinion = scope:coronation_vassal_opinion_gain + } + } + } + } + } + } + + + save_scope_value_as = { + name = tribal_prestige_mult + value = 1 + } + switch = { + trigger = government_has_flag + government_is_administrative = { + change_influence = { + value = medium_influence_value + multiply = scope:coronation_reward_mult + } + save_scope_value_as = { + name = coronation_reward_mult + value = { + value = scope:coronation_reward_mult + multiply = 0.8 + } + } + } + government_is_nomadic = { + save_scope_value_as = { + name = coronation_herd_value + value = { + value = scope:host.domicile.medium_herd_value + multiply = scope:coronation_reward_mult + } + } + hidden_effect = { + domicile ?= { + change_herd = { + value = scope:coronation_herd_value + } + } + } + save_scope_value_as = { + name = coronation_reward_mult + value = { + value = scope:coronation_reward_mult + multiply = 0.8 + } + } + custom_tooltip = coronation_nomadic_herd_reward + } + government_is_clan = { + scope:activity = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + house ?= scope:host.house + is_ai = yes + } + switch = { + trigger = scope:coronation_reward_mult + 1 = { + save_scope_value_as = { + name = clan_unity_gain + value = miniscule_unity_loss + } + } + 1.25 = { + save_scope_value_as = { + name = clan_unity_gain + value = miniscule_unity_gain + } + } + 1.5 = { + save_scope_value_as = { + name = clan_unity_gain + value = minor_unity_gain + } + } + 1.75 = { + save_scope_value_as = { + name = clan_unity_gain + value = medium_unity_gain + } + } + 2.5 = { + save_scope_value_as = { + name = clan_unity_gain + value = major_unity_gain + } + } + } + save_scope_as = unity_character + add_clan_unity_interaction_effect = { + CHARACTER = scope:unity_character + TARGET = scope:host + VALUE = scope:clan_unity_gain + DESC = clan_unity_coronation_reward.desc + REVERSE_NON_HOUSE_TARGET = no + } + } + } + save_scope_value_as = { + name = coronation_reward_mult + value = { + value = scope:coronation_reward_mult + multiply = 0.8 + } + } + } + government_is_tribal = { + save_scope_value_as = { + name = tribal_prestige_mult + value = { + value = scope:coronation_reward_mult + subtract = 1 + multiply = 0.4 + add = 1 + min = 1 + } + } + } + } + + # Prestige and Legitimacy Rewards for host after coronation ceremony + + add_prestige = { + value = 100 + multiply = { + value = number_of_vassal_supporters + min = 1 + } + multiply = scope:coronation_reward_mult + multiply = scope:tribal_prestige_mult + min = 100 + max = { + value = 4000 + multiply = scope:tribal_prestige_mult + } + } + + add_legitimacy = { + value = 25 + multiply = { + value = number_of_vassal_supporters + min = 1 + } + multiply = scope:coronation_reward_mult + min = 25 + max = 1000 + } + + # Renown if you have the Exalt the Crown Intent + if = { + limit = { has_activity_intent = coronation_exalt_crown } + dynasty = { add_dynasty_prestige = minor_dynasty_prestige_gain } + } +} + + +ach_coronation_ceremony_intent_modifiers_giveaway_effect = { + switch = { + trigger = has_activity_intent + coronation_exalt_crown = { + if = { + limit = { + government_has_flag = government_is_settled + } + add_character_modifier = { + modifier = bp4_exalted_coronation + years = 20 + } + } + else = { + add_character_modifier = { + modifier = bp4_exalted_coronation_alt + years = 20 + } + } + } + coronation_embrace_supporters = { + if = { + limit = { + government_has_flag = government_is_settled + } + add_character_modifier = { + modifier = bp4_supported_coronation + years = 20 + } + } + else = { + add_character_modifier = { + modifier = bp4_supported_coronation_alt + years = 20 + } + } + } + coronation_weaken_detractors = { + if = { + limit = { + government_has_flag = government_is_settled + } + add_character_modifier = { + modifier = bp4_asserting_coronation + years = 20 + } + } + else = { + add_character_modifier = { + modifier = bp4_asserting_coronation_alt + years = 20 + } + } + } + coronation_impress_attendees = { + if = { + limit = { + government_has_flag = government_is_settled + } + add_character_modifier = { + modifier = bp4_impressive_coronation + years = 20 + } + } + else = { + add_character_modifier = { + modifier = bp4_impressive_coronation_alt + years = 20 + } + } + } + } +} + +coronation_completed_log_entry_effect = { + involved_activity = { + add_activity_log_entry = { + key = coronation_completed_log_entry_effect + tags = { completed } + score = 100 + show_in_conclusion = yes + character = scope:activity.activity_host + #Effects + show_as_tooltip = { + scope:activity.activity_host = { + custom_tooltip = coronation_completed_log_oath_tt + coronation_change_law_effect = yes + coronation_disburse_rewards_effect = yes + } + } + } + } +} + + +coronation_create_artifact_game_start_effect = { + save_scope_as = owner + if = { + limit = { + OR = { + realm_size >= 60 + highest_held_title_tier >= tier_empire + } + } + set_artifact_rarity_famed = yes + } + else = { + set_artifact_rarity_masterwork = yes + } + + if = { + limit = { + coronation_proper_artifact_crown_trigger = yes + } + save_scope_value_as = { + name = artifact_type + value = flag:crown + } + } + else_if = { + limit = { + coronation_proper_artifact_regalia_trigger = yes + } + save_scope_value_as = { + name = artifact_type + value = flag:regalia + } + } + else = { + random_list = { + 1 = { + save_scope_value_as = { + name = artifact_type + value = flag:crown + } + } + 1 = { + save_scope_value_as = { + name = artifact_type + value = flag:regalia + } + } + } + } + primary_title = { + save_scope_as = crown_title + ordered_past_holder = { + limit = { + NOT = { this = scope:owner } + house = scope:owner.house + time_since_death ={ + years >= 80 + } + } + alternative_limit = { + NOT = { this = scope:owner } + dynasty = scope:owner.dynasty + time_since_death ={ + years >= 80 + } + } + alternative_limit = { + NOT = { this = scope:owner } + culture = scope:owner.culture + time_since_death ={ + years >= 80 + } + } + alternative_limit = { + NOT = { this = scope:owner } + faith = scope:owner.faith + time_since_death ={ + years >= 80 + } + } + alternative_limit = { + NOT = { this = scope:owner } + dynasty = scope:owner.dynasty + } + alternative_limit = { + NOT = { this = scope:owner } + culture = scope:owner.culture + } + alternative_limit = { + NOT = { this = scope:owner } + faith = scope:owner.faith + } + alternative_limit = { + NOT = { this = scope:owner } + } + alternative_limit = { + always = yes + } + save_scope_as = title_founder + } + } + + if = { + limit = { + game_start_date >= 1170.1.1 + } + coronation_create_artifact_date_effect = { + DATE_CREATION = 1060.1.1 + DATE_INHERITANCE = 1070.1.1 + } + } + else_if = { + limit = { + game_start_date >= 1066.1.1 + } + coronation_create_artifact_date_effect = { + DATE_CREATION = 940.1.1 + DATE_INHERITANCE = 960.1.1 + } + } + else_if = { + limit = { + game_start_date < 868.1.1 + } + coronation_create_artifact_date_effect = { + DATE_CREATION = 740.1.1 + DATE_INHERITANCE = 760.1.1 + } + } +} + +coronation_create_artifact_date_effect = { + if = { + limit = { + scope:artifact_type = flag:crown + } + create_artifact = { + name = ach_spawned_crown_name + description = ach_spawned_crown_desc + type = helmet + visuals = crown + template = crown_wearable_template + wealth = scope:wealth + quality = scope:quality + decaying = no + modifier = artifact_monthly_minor_prestige_2_modifier + modifier = artifact_legitimacy_gain_mult_4_modifier + history = { + type = created + date = $DATE_CREATION$ + recipient = scope:title_founder + location = scope:crown_title.title_capital_county.title_province + } + save_scope_as = newly_created_artifact + } + scope:newly_created_artifact = { + add_artifact_title_history = { + target = scope:crown_title + date = $DATE_INHERITANCE$ + } + set_variable = { + name = artifact_succession_title + value = scope:crown_title + } + add_scaled_artifact_modifier_rulership_effect = yes + } + } + else_if = { + limit = { + scope:artifact_type = flag:regalia + } + create_artifact = { + name = ach_spawned_regalia_name + description = ach_spawned_regalia_desc + type = regalia + visuals = regalia + wealth = scope:wealth + quality = scope:quality + template = regalia_template + decaying = no + modifier = artifact_monthly_minor_prestige_2_modifier + modifier = artifact_legitimacy_gain_mult_4_modifier + history = { + type = created + date = $DATE_CREATION$ + recipient = scope:title_founder + location = scope:crown_title.title_capital_county.title_province + } + save_scope_as = newly_created_artifact + } + scope:newly_created_artifact = { + add_artifact_title_history = { + target = scope:crown_title + date = $DATE_INHERITANCE$ + } + set_variable = { + name = artifact_succession_title + value = scope:crown_title + } + add_scaled_artifact_modifier_rulership_effect = yes + } + } +} + + +coronation_add_magnificence_log_effect = { + if = { + limit = { + $CHAR$ != involved_activity.activity_host + } + save_scope_value_as = { + name = magnificence_level + value = $VALUE$ + } + $CHAR$ = { + save_scope_as = char + } + hidden_effect = { + involved_activity = { + switch = { + trigger = scope:magnificence_level + flag:positive_massive = { + add_activity_log_entry = { + key = coronation_tt_positive_massive_log + score = 10 + tags = { positive } + character = scope:char + custom_tooltip = coronation_tt_positive_massive + } + } + flag:positive_major = { + add_activity_log_entry = { + key = coronation_tt_positive_major_log + score = 10 + tags = { positive } + character = scope:char + custom_tooltip = coronation_tt_positive_major + } + } + flag:positive_medium = { + add_activity_log_entry = { + key = coronation_tt_positive_medium_log + score = 10 + tags = { positive } + character = scope:char + custom_tooltip = coronation_tt_positive_medium + } + } + flag:positive_tiny = { + add_activity_log_entry = { + key = coronation_tt_positive_tiny_log + score = 10 + tags = { positive } + character = scope:char + custom_tooltip = coronation_tt_positive_tiny + } + } + flag:positive_miniscule = { + add_activity_log_entry = { + key = coronation_tt_positive_miniscule_log + score = 10 + tags = { positive } + character = scope:char + custom_tooltip = coronation_tt_positive_miniscule + } + } + flag:negative_tiny = { + add_activity_log_entry = { + key = coronation_tt_negative_tiny_log + score = 10 + tags = { negative } + character = scope:char + custom_tooltip = coronation_tt_negative_tiny + } + } + flag:negative = { + add_activity_log_entry = { + key = coronation_tt_negative_log + score = 10 + tags = { negative } + character = scope:char + custom_tooltip = coronation_tt_negative + } + } + flag:negative_major = { + add_activity_log_entry = { + key = coronation_tt_negative_major_log + score = 10 + tags = { negative } + character = scope:char + custom_tooltip = coronation_tt_negative_major + } + } + } + } + } + } +} + +ach_host_intent_rewards_tooltip_effect = { + if = { + limit = { + scope:activity.activity_host = { has_variable = host_had_intent_reward } + } + scope:activity.activity_host = { + switch = { + trigger = var:host_had_intent_reward + flag:cultural_acceptance = { + custom_tooltip = coronation_cultural_acceptance_reward_tt + } + flag:opinion_gain = { + custom_tooltip = coronation_opinion_gain_reward_tt + } + flag:legitimacy_and_prestige_gain = { + custom_tooltip = coronation_legitimacy_and_prestige_gain_reward_tt + } + flag:prevent_faction_joining = { + custom_tooltip = coronation_prevent_faction_joining_reward_tt + } + flag:easier_imprisonment = { + custom_tooltip = coronation_easier_imprisonment_reward_tt + } + flag:stress = { + custom_tooltip = coronation_stress_reward_tt + } + flag:better_councillors = { + custom_tooltip = coronation_better_councillors_reward_tt + } + flag:vassal_development_boost = { + custom_tooltip = coronation_vassal_development_boost_reward_tt + } + flag:vassal_defensive_boost = { + custom_tooltip = coronation_vassal_defensive_boost_reward_tt + } + flag:artifact_boost = { + custom_tooltip = coronation_artifact_boost_reward_tt + } + flag:host_development_boost = { + custom_tooltip = coronation_host_development_boost_reward_tt + } + flag:host_defense_boost = { + custom_tooltip = coronation_host_defense_boost_reward_tt + } + } + switch = { + trigger = var:reward_tier + 1 = { + custom_tooltip = coronation_host_reward_tier_one_tt + } + 2 = { + custom_tooltip = coronation_host_reward_tier_two_tt + } + 3 = { + custom_tooltip = coronation_host_reward_tier_three_tt + } + 4 = { + custom_tooltip = coronation_host_reward_tier_four_tt + } + 5 = { + custom_tooltip = coronation_host_reward_tier_five_tt + } + } + } + } +} + +ach_host_intent_rewards_effect = { + if = { + limit = { + scope:activity.activity_host = { has_variable = host_had_intent_reward } + } + switch = { + trigger = scope:activity.activity_host.var:host_had_intent_reward + flag:cultural_acceptance = { + ach_cultural_acceptance_host_reward_effect = yes + } + flag:opinion_gain = { + ach_opinion_gain_host_reward_effect = yes + } + flag:legitimacy_and_prestige_gain = { + ach_legitimacy_and_prestige_gain_host_reward_effect = yes + } + flag:prevent_faction_joining = { + ach_prevent_faction_joining_host_reward_effect = yes + } + flag:easier_imprisonment = { + ach_easier_imprisonment_host_reward_effect = yes + } + flag:stress = { + ach_stress_host_reward_effect = yes + } + flag:better_councillors = { + ach_better_councillors_host_reward_effect = yes + } + flag:vassal_development_boost = { + ach_vassal_development_boost_host_reward_effect = yes + } + flag:vassal_defensive_boost = { + ach_vassal_defensive_boost_host_reward_effect = yes + } + flag:artifact_boost = { + root = { ach_artifact_boost_host_reward_effect = yes } + } + flag:host_development_boost = { + root = { ach_host_development_boost_host_reward_effect = yes } + } + flag:host_defense_boost = { + root = { ach_host_defense_boost_host_reward_effect = yes } + } + } + + } +} + +ach_cultural_acceptance_host_reward_effect = { + switch = { + trigger = scope:activity.activity_host.var:reward_tier + 1 = { + scope:activity = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + culture != scope:activity.activity_host.culture + } + culture = { save_scope_as = first_reward_target add_to_list = culture_rewards } + } + } + } + 2 = { + scope:activity = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + culture != scope:activity.activity_host.culture + } + culture = { save_scope_as = first_reward_target add_to_list = culture_rewards } + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + culture != scope:activity.activity_host.culture + culture != scope:first_reward_target + } + culture = { save_scope_as = second_reward_target add_to_list = culture_rewards } + } + } + } + 3 = { + scope:activity = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + culture != scope:activity.activity_host.culture + } + culture = { save_scope_as = first_reward_target add_to_list = culture_rewards } + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + culture != scope:activity.activity_host.culture + culture != scope:first_reward_target + } + culture = { save_scope_as = second_reward_target add_to_list = culture_rewards} + add_to_list = culture_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + culture != scope:activity.activity_host.culture + culture != scope:first_reward_target + culture != scope:second_reward_target + } + culture = { save_scope_as = third_reward_target add_to_list = culture_rewards } + } + } + } + 4 = { + scope:activity = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + culture != scope:activity.activity_host.culture + } + culture = { save_scope_as = first_reward_target add_to_list = culture_rewards } + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + culture != scope:activity.activity_host.culture + culture != scope:first_reward_target + } + culture = { save_scope_as = second_reward_target add_to_list = culture_rewards } + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + culture != scope:activity.activity_host.culture + culture != scope:first_reward_target + culture != scope:second_reward_target + } + culture = { save_scope_as = third_reward_target add_to_list = culture_rewards } + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + culture != scope:activity.activity_host.culture + culture != scope:first_reward_target + culture != scope:second_reward_target + culture != scope:third_reward_target + } + culture = { save_scope_as = fourth_reward_target add_to_list = culture_rewards } + } + } + if = { + limit = { + NOT = { exists = scope:fourth_reward_target } + } + random_culture_global = { + limit = { + this != scope:activity.activity_host.culture + has_same_culture_heritage = scope:activity.activity_host.culture + } + alternative_limit = { + this != scope:activity.activity_host.culture + } + save_scope_as = fourth_reward_target + add_to_list = culture_rewards + } + } + } + 5 = { + scope:activity = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + culture != scope:activity.activity_host.culture + } + culture = { save_scope_as = first_reward_target add_to_list = culture_rewards } + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + culture != scope:activity.activity_host.culture + culture != scope:first_reward_target + } + culture = { save_scope_as = second_reward_target add_to_list = culture_rewards } + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + culture != scope:activity.activity_host.culture + culture != scope:first_reward_target + culture != scope:second_reward_target + } + culture = { save_scope_as = third_reward_target add_to_list = culture_rewards } + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + culture != scope:activity.activity_host.culture + culture != scope:first_reward_target + culture != scope:second_reward_target + culture != scope:third_reward_target + } + culture = { save_scope_as = fourth_reward_target add_to_list = culture_rewards } + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + culture != scope:activity.activity_host.culture + culture != scope:first_reward_target + culture != scope:second_reward_target + culture != scope:third_reward_target + culture != scope:fourth_reward_target + } + culture = { save_scope_as = fifth_reward_target add_to_list = culture_rewards } + } + } + if = { + limit = { + NOT = { exists = scope:fourth_reward_target } + } + random_culture_global = { + limit = { + culture != scope:activity.activity_host.culture + has_same_culture_heritage = scope:activity.activity_host.culture + } + alternative_limit = { + culture != scope:activity.activity_host.culture + } + save_scope_as = fourth_reward_target + add_to_list = culture_rewards + } + } + if = { + limit = { + NOT = { exists = scope:fifth_reward_target } + } + random_culture_global = { + limit = { + culture != scope:activity.activity_host.culture + has_same_culture_heritage = scope:activity.activity_host.culture + culture != scope:fourth_reward_target + } + alternative_limit = { + culture != scope:activity.activity_host.culture + culture != scope:fourth_reward_target + } + save_scope_as = fifth_reward_target + add_to_list = culture_rewards + } + } + } + } + every_in_list = { + list = culture_rewards + change_cultural_acceptance = { + target = scope:activity.activity_host.culture + value = medium_positive_culture_acceptance + desc = cultural_acceptance_gain_coronation_host_reward + } + } +} + +ach_opinion_gain_host_reward_effect = { + switch = { + trigger = scope:activity.activity_host.var:reward_tier + 1 = { + scope:activity = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + is_ai = yes + } + save_scope_as = first_reward_target + add_to_list = opinion_rewards + } + } + } + 2 = { + scope:activity = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + is_ai = yes + } + save_scope_as = first_reward_target + add_to_list = opinion_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + } + save_scope_as = second_reward_target + add_to_list = opinion_rewards + } + } + } + 3 = { + scope:activity = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + is_ai = yes + } + save_scope_as = first_reward_target + add_to_list = opinion_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + } + save_scope_as = second_reward_target + add_to_list = opinion_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + is_ai = yes + } + save_scope_as = third_reward_target + add_to_list = opinion_rewards + } + } + } + 4 = { + scope:activity = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + is_ai = yes + } + save_scope_as = first_reward_target + add_to_list = opinion_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + } + save_scope_as = second_reward_target + add_to_list = opinion_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + is_ai = yes + } + save_scope_as = third_reward_target + add_to_list = opinion_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + is_ai = yes + } + save_scope_as = fourth_reward_target + add_to_list = opinion_rewards + } + } + } + 5 = { + scope:activity = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + is_ai = yes + } + save_scope_as = first_reward_target + add_to_list = opinion_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + } + save_scope_as = second_reward_target + add_to_list = opinion_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + is_ai = yes + } + save_scope_as = third_reward_target + add_to_list = opinion_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + is_ai = yes + } + save_scope_as = fourth_reward_target + add_to_list = opinion_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + this != scope:fourth_reward_target + is_ai = yes + } + save_scope_as = fifth_reward_target + add_to_list = opinion_rewards + } + } + } + } + every_in_list = { + list = opinion_rewards + add_opinion = { + target = scope:activity.activity_host + modifier = ach_intent_opinion + opinion = 25 + } + } +} + +ach_legitimacy_and_prestige_gain_host_reward_effect = { + switch = { + trigger = scope:activity.activity_host.var:reward_tier + 1 = { + scope:activity = { + activity_host = { + add_character_modifier = { + modifier = ach_intent_prestige_modifier + years = 10 + } + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + is_ai = yes + } + save_scope_as = first_reward_target + add_to_list = prestige_rewards + } + } + } + 2 = { + scope:activity = { + activity_host = { + add_character_modifier = { + modifier = ach_intent_prestige_modifier + years = 20 + } + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + is_ai = yes + } + save_scope_as = first_reward_target + add_to_list = prestige_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + } + save_scope_as = second_reward_target + add_to_list = prestige_rewards + } + } + } + 3 = { + scope:activity = { + activity_host = { + add_character_modifier = { + modifier = ach_intent_prestige_modifier + years = 30 + } + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + is_ai = yes + } + save_scope_as = first_reward_target + add_to_list = prestige_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + } + save_scope_as = second_reward_target + add_to_list = prestige_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + is_ai = yes + } + save_scope_as = third_reward_target + add_to_list = prestige_rewards + } + } + } + 4 = { + scope:activity = { + activity_host = { + add_character_modifier = { + modifier = ach_intent_prestige_modifier + years = 40 + } + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + is_ai = yes + } + save_scope_as = first_reward_target + add_to_list = prestige_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + } + save_scope_as = second_reward_target + add_to_list = prestige_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + is_ai = yes + } + save_scope_as = third_reward_target + add_to_list = prestige_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + is_ai = yes + } + save_scope_as = fourth_reward_target + add_to_list = prestige_rewards + } + } + } + 5 = { + scope:activity = { + activity_host = { + add_character_modifier = { + modifier = ach_intent_prestige_modifier + years = 50 + } + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + is_ai = yes + } + save_scope_as = first_reward_target + add_to_list = prestige_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + } + save_scope_as = second_reward_target + add_to_list = prestige_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + is_ai = yes + } + save_scope_as = third_reward_target + add_to_list = prestige_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + is_ai = yes + } + save_scope_as = fourth_reward_target + add_to_list = prestige_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + this != scope:fourth_reward_target + is_ai = yes + } + save_scope_as = fifth_reward_target + add_to_list = prestige_rewards + } + } + } + } + every_in_list = { + list = prestige_rewards + add_character_modifier = { + modifier = ach_intent_prestige_guest_modifier + years = 5 + } + } +} + +ach_prevent_faction_joining_host_reward_effect = { + switch = { + trigger = scope:activity.activity_host.var:reward_tier + 1 = { + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = detractor } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + } + 2 = { + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = detractor } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 4 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = detractor } + } + save_scope_as = second_reward_target + add_to_list = faction_rewards + } + } + 3 = { + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = detractor } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 4 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = detractor } + } + save_scope_as = second_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 3 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = detractor } + } + save_scope_as = third_reward_target + add_to_list = faction_rewards + } + } + 4 = { + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = detractor } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 4 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = detractor } + } + save_scope_as = second_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 3 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = detractor } + } + save_scope_as = third_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 2 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = detractor } + } + save_scope_as = fourth_reward_target + add_to_list = faction_rewards + } + } + 5 = { + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = detractor } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 4 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = detractor } + } + save_scope_as = second_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 3 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = detractor } + } + save_scope_as = third_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 2 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = detractor } + } + save_scope_as = fourth_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 1 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + this != scope:fourth_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = detractor } + } + save_scope_as = fifth_reward_target + add_to_list = faction_rewards + } + } + } + every_in_list = { + list = faction_rewards + add_character_modifier = { + modifier = ach_intent_faction_joining_prevention_modifier + years = 10 + } + } +} + +ach_easier_imprisonment_host_reward_effect = { + switch = { + trigger = scope:activity.activity_host.var:reward_tier + 1 = { + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + is_in_guest_subset = { name = detractor } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + } + 2 = { + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + is_in_guest_subset = { name = detractor } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 4 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + is_in_guest_subset = { name = detractor } + } + save_scope_as = second_reward_target + add_to_list = faction_rewards + } + } + 3 = { + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + is_in_guest_subset = { name = detractor } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 4 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + is_in_guest_subset = { name = detractor } + } + save_scope_as = second_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 3 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + is_ai = yes + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + is_in_guest_subset = { name = detractor } + } + save_scope_as = third_reward_target + add_to_list = faction_rewards + } + } + 4 = { + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + is_in_guest_subset = { name = detractor } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 4 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + is_in_guest_subset = { name = detractor } + } + save_scope_as = second_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 3 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + is_ai = yes + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + is_in_guest_subset = { name = detractor } + } + save_scope_as = third_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 2 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + is_ai = yes + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + is_in_guest_subset = { name = detractor } + } + save_scope_as = fourth_reward_target + add_to_list = faction_rewards + } + } + 5 = { + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + is_in_guest_subset = { name = detractor } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 4 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + is_in_guest_subset = { name = detractor } + } + save_scope_as = second_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 3 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + is_ai = yes + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + is_in_guest_subset = { name = detractor } + } + save_scope_as = third_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 2 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + is_ai = yes + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + is_in_guest_subset = { name = detractor } + } + save_scope_as = fourth_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 1 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + this != scope:fourth_reward_target + is_ai = yes + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + is_in_guest_subset = { name = detractor } + } + save_scope_as = fifth_reward_target + add_to_list = faction_rewards + } + } + } + every_in_list = { + list = faction_rewards + add_character_modifier = { + modifier = ach_intent_imprisonment_modifier + years = 10 + } + } +} + +ach_stress_host_reward_effect = { + switch = { + trigger = scope:activity.activity_host.var:reward_tier + 1 = { + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_in_guest_subset = { name = detractor } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + } + 2 = { + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_in_guest_subset = { name = detractor } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 4 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + is_in_guest_subset = { name = detractor } + } + save_scope_as = second_reward_target + add_to_list = faction_rewards + } + } + 3 = { + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_in_guest_subset = { name = detractor } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 4 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + is_in_guest_subset = { name = detractor } + } + save_scope_as = second_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 3 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + is_ai = yes + is_in_guest_subset = { name = detractor } + } + save_scope_as = third_reward_target + add_to_list = faction_rewards + } + } + 4 = { + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_in_guest_subset = { name = detractor } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 4 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + is_in_guest_subset = { name = detractor } + } + save_scope_as = second_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 3 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + is_ai = yes + is_in_guest_subset = { name = detractor } + } + save_scope_as = third_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 2 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + is_ai = yes + is_in_guest_subset = { name = detractor } + } + save_scope_as = fourth_reward_target + add_to_list = faction_rewards + } + } + 5 = { + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_in_guest_subset = { name = detractor } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 4 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + is_in_guest_subset = { name = detractor } + } + save_scope_as = second_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 3 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + is_ai = yes + is_in_guest_subset = { name = detractor } + } + save_scope_as = third_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 2 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + is_ai = yes + is_in_guest_subset = { name = detractor } + } + save_scope_as = fourth_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_detractor_sort_value + position = 1 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + this != scope:fourth_reward_target + is_ai = yes + is_in_guest_subset = { name = detractor } + } + save_scope_as = fifth_reward_target + add_to_list = faction_rewards + } + } + } + every_in_list = { + list = faction_rewards + add_stress = major_stress_gain + } +} + +ach_better_councillors_host_reward_effect = { + switch = { + trigger = scope:activity.activity_host.var:reward_tier + 1 = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_in_guest_subset = { name = supporter } + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + } + 2 = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_in_guest_subset = { name = supporter } + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 4 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + is_in_guest_subset = { name = supporter } + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + } + save_scope_as = second_reward_target + add_to_list = faction_rewards + } + } + 3 = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_in_guest_subset = { name = supporter } + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 4 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + is_in_guest_subset = { name = supporter } + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + } + save_scope_as = second_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 3 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + is_ai = yes + is_in_guest_subset = { name = supporter } + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + } + save_scope_as = third_reward_target + add_to_list = faction_rewards + } + } + 4 = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_in_guest_subset = { name = supporter } + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 4 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + is_in_guest_subset = { name = supporter } + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + } + save_scope_as = second_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 3 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + is_ai = yes + is_in_guest_subset = { name = supporter } + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + } + save_scope_as = third_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 2 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + is_ai = yes + is_in_guest_subset = { name = supporter } + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + } + save_scope_as = fourth_reward_target + add_to_list = faction_rewards + } + } + 5 = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_in_guest_subset = { name = supporter } + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 4 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + is_in_guest_subset = { name = supporter } + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + } + save_scope_as = second_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 3 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + is_ai = yes + is_in_guest_subset = { name = supporter } + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + } + save_scope_as = third_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 2 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + is_ai = yes + is_in_guest_subset = { name = supporter } + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + } + save_scope_as = fourth_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 1 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + this != scope:fourth_reward_target + is_ai = yes + is_in_guest_subset = { name = supporter } + OR = { + is_vassal_of = scope:activity.activity_host + is_courtier_of = scope:activity.activity_host + } + } + save_scope_as = fifth_reward_target + add_to_list = faction_rewards + } + } + } + every_in_list = { + list = faction_rewards + add_character_modifier = { + modifier = ach_intent_better_councillors_modifier + years = 20 + } + } +} + +ach_vassal_development_boost_host_reward_effect = { + switch = { + trigger = scope:activity.activity_host.var:reward_tier + 1 = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + } + 2 = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 4 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = second_reward_target + add_to_list = faction_rewards + } + } + 3 = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 4 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = second_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 3 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = third_reward_target + add_to_list = faction_rewards + } + } + 4 = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 4 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = second_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 3 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = third_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 2 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = fourth_reward_target + add_to_list = faction_rewards + } + } + 5 = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 4 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = second_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 3 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = third_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 2 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = fourth_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 1 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + this != scope:fourth_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = fifth_reward_target + add_to_list = faction_rewards + } + } + } + every_in_list = { + list = faction_rewards + add_character_modifier = { + modifier = ach_intent_vassal_development_boost_modifier + years = 20 + } + } +} + +ach_vassal_defensive_boost_host_reward_effect = { + switch = { + trigger = scope:activity.activity_host.var:reward_tier + 1 = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + } + 2 = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 4 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = second_reward_target + add_to_list = faction_rewards + } + } + 3 = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 4 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = second_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 3 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = third_reward_target + add_to_list = faction_rewards + } + } + 4 = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 4 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = second_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 3 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = third_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 2 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = fourth_reward_target + add_to_list = faction_rewards + } + } + 5 = { + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 5 + limit = { + this != scope:activity.activity_host + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = first_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 4 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = second_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 3 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = third_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 2 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = fourth_reward_target + add_to_list = faction_rewards + } + ordered_attending_character = { + order_by = coronation_supporter_sort_value + position = 1 + limit = { + this != scope:activity.activity_host + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + this != scope:fourth_reward_target + is_ai = yes + is_vassal_of = scope:activity.activity_host + is_in_guest_subset = { name = supporter } + } + save_scope_as = fifth_reward_target + add_to_list = faction_rewards + } + } + } + every_in_list = { + list = faction_rewards + add_character_modifier = { + modifier = ach_intent_vassal_defensive_boost_modifier + years = 20 + } + } +} + +ach_artifact_boost_host_reward_effect = { + switch = { + trigger = scope:activity.activity_host.var:reward_tier + 1 = { + ordered_character_artifact = { + order_by = artifact_age + limit = { + is_equipped = yes + } + alternative_limit = { + always = yes + } + save_scope_as = first_reward_target + add_to_list = artifact_rewards + } + } + 2 = { + ordered_character_artifact = { + order_by = artifact_age + limit = { + is_equipped = yes + } + alternative_limit = { + always = yes + } + save_scope_as = first_reward_target + add_to_list = artifact_rewards + } + ordered_character_artifact = { + order_by = artifact_age + limit = { + is_equipped = yes + this != scope:first_reward_target + } + alternative_limit = { + always = yes + this != scope:first_reward_target + } + save_scope_as = second_reward_target + add_to_list = artifact_rewards + } + } + 3 = { + ordered_character_artifact = { + order_by = artifact_age + limit = { + is_equipped = yes + } + alternative_limit = { + always = yes + } + save_scope_as = first_reward_target + add_to_list = artifact_rewards + } + ordered_character_artifact = { + order_by = artifact_age + limit = { + is_equipped = yes + this != scope:first_reward_target + } + alternative_limit = { + always = yes + this != scope:first_reward_target + } + save_scope_as = second_reward_target + add_to_list = artifact_rewards + } + ordered_character_artifact = { + order_by = artifact_age + limit = { + is_equipped = yes + this != scope:first_reward_target + this != scope:second_reward_target + } + alternative_limit = { + always = yes + this != scope:first_reward_target + this != scope:second_reward_target + } + save_scope_as = third_reward_target + add_to_list = artifact_rewards + } + } + 4 = { + ordered_character_artifact = { + order_by = artifact_age + limit = { + is_equipped = yes + } + alternative_limit = { + always = yes + } + save_scope_as = first_reward_target + add_to_list = artifact_rewards + } + ordered_character_artifact = { + order_by = artifact_age + limit = { + is_equipped = yes + this != scope:first_reward_target + } + alternative_limit = { + always = yes + this != scope:first_reward_target + } + save_scope_as = second_reward_target + add_to_list = artifact_rewards + } + ordered_character_artifact = { + order_by = artifact_age + limit = { + is_equipped = yes + this != scope:first_reward_target + this != scope:second_reward_target + } + alternative_limit = { + always = yes + this != scope:first_reward_target + this != scope:second_reward_target + } + save_scope_as = third_reward_target + add_to_list = artifact_rewards + } + ordered_character_artifact = { + order_by = artifact_age + limit = { + is_equipped = yes + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + } + alternative_limit = { + always = yes + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + } + save_scope_as = fourth_reward_target + add_to_list = artifact_rewards + } + } + 5 = { + ordered_character_artifact = { + order_by = artifact_age + limit = { + is_equipped = yes + } + alternative_limit = { + always = yes + } + save_scope_as = first_reward_target + add_to_list = artifact_rewards + } + ordered_character_artifact = { + order_by = artifact_age + limit = { + is_equipped = yes + this != scope:first_reward_target + } + alternative_limit = { + always = yes + this != scope:first_reward_target + } + save_scope_as = second_reward_target + add_to_list = artifact_rewards + } + ordered_character_artifact = { + order_by = artifact_age + limit = { + is_equipped = yes + this != scope:first_reward_target + this != scope:second_reward_target + } + alternative_limit = { + always = yes + this != scope:first_reward_target + this != scope:second_reward_target + } + save_scope_as = third_reward_target + add_to_list = artifact_rewards + } + ordered_character_artifact = { + order_by = artifact_age + limit = { + is_equipped = yes + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + } + alternative_limit = { + always = yes + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + } + save_scope_as = fourth_reward_target + add_to_list = artifact_rewards + } + ordered_character_artifact = { + order_by = artifact_age + limit = { + is_equipped = yes + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + this != scope:fourth_reward_target + } + alternative_limit = { + always = yes + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + this != scope:fourth_reward_target + } + save_scope_as = fifth_reward_target + add_to_list = artifact_rewards + } + } + } + save_scope_as = liege + save_scope_as = antiquarian_from_task + add_character_flag = { + flag = ach_intent_artifact_boost_flag + days = 6 + } + every_in_list = { + list = artifact_rewards + save_scope_as = artifact_target + antiquarian_improve_artifact_effect = yes + } +} + +ach_host_development_boost_host_reward_effect = { + switch = { + trigger = scope:activity.activity_host.var:reward_tier + 1 = { + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + save_scope_as = first_reward_target + add_to_list = county_rewards + } + } + 2 = { + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + save_scope_as = first_reward_target + add_to_list = county_rewards + } + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + this != scope:first_reward_target + } + save_scope_as = second_reward_target + add_to_list = county_rewards + } + } + 3 = { + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + save_scope_as = first_reward_target + add_to_list = county_rewards + } + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + this != scope:first_reward_target + } + save_scope_as = second_reward_target + add_to_list = county_rewards + } + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + this != scope:first_reward_target + this != scope:second_reward_target + } + save_scope_as = third_reward_target + add_to_list = county_rewards + } + } + 4 = { + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + save_scope_as = first_reward_target + add_to_list = county_rewards + } + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + this != scope:first_reward_target + } + save_scope_as = second_reward_target + add_to_list = county_rewards + } + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + this != scope:first_reward_target + this != scope:second_reward_target + } + save_scope_as = third_reward_target + add_to_list = county_rewards + } + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + } + save_scope_as = fourth_reward_target + add_to_list = county_rewards + } + } + 5 = { + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + save_scope_as = first_reward_target + add_to_list = county_rewards + } + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + this != scope:first_reward_target + } + save_scope_as = second_reward_target + add_to_list = county_rewards + } + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + this != scope:first_reward_target + this != scope:second_reward_target + } + save_scope_as = third_reward_target + add_to_list = county_rewards + } + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + } + save_scope_as = fourth_reward_target + add_to_list = county_rewards + } + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + this != scope:fourth_reward_target + } + save_scope_as = fifth_reward_target + add_to_list = county_rewards + } + } + } + if = { + limit = { + NOT = { + exists = scope:second_reward_target + } + } + ordered_realm_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + holder = { + is_ai = yes + this != scope:first_reward_target + } + } + save_scope_as = second_reward_target + add_to_list = county_rewards + } + } + if = { + limit = { + NOT = { + exists = scope:third_reward_target + } + } + ordered_realm_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + holder = { + is_ai = yes + this != scope:second_reward_target + this != scope:first_reward_target + } + } + save_scope_as = third_reward_target + add_to_list = county_rewards + } + } + if = { + limit = { + NOT = { + exists = scope:fourth_reward_target + } + } + ordered_realm_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + holder = { + is_ai = yes + this != scope:second_reward_target + this != scope:first_reward_target + this != scope:third_reward_target + } + } + save_scope_as = fourth_reward_target + add_to_list = county_rewards + } + } + if = { + limit = { + NOT = { + exists = scope:fifth_reward_target + } + } + ordered_realm_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + holder = { + is_ai = yes + this != scope:second_reward_target + this != scope:first_reward_target + this != scope:third_reward_target + this != scope:fourth_reward_target + } + } + save_scope_as = fifth_reward_target + add_to_list = county_rewards + } + } + every_in_list = { + list = county_rewards + change_development_level = 2 + add_county_modifier = { + modifier = ach_intent_development_boost_modifier + years = 20 + } + } +} + +ach_host_defense_boost_host_reward_effect = { + switch = { + trigger = scope:activity.activity_host.var:reward_tier + 1 = { + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + save_scope_as = first_reward_target + add_to_list = county_rewards + } + } + 2 = { + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + save_scope_as = first_reward_target + add_to_list = county_rewards + } + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + this != scope:first_reward_target + } + save_scope_as = second_reward_target + add_to_list = county_rewards + } + } + 3 = { + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + save_scope_as = first_reward_target + add_to_list = county_rewards + } + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + this != scope:first_reward_target + } + save_scope_as = second_reward_target + add_to_list = county_rewards + } + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + this != scope:first_reward_target + this != scope:second_reward_target + } + save_scope_as = third_reward_target + add_to_list = county_rewards + } + } + 4 = { + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + save_scope_as = first_reward_target + add_to_list = county_rewards + } + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + this != scope:first_reward_target + } + save_scope_as = second_reward_target + add_to_list = county_rewards + } + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + this != scope:first_reward_target + this != scope:second_reward_target + } + save_scope_as = third_reward_target + add_to_list = county_rewards + } + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + } + save_scope_as = fourth_reward_target + add_to_list = county_rewards + } + } + 5 = { + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + save_scope_as = first_reward_target + add_to_list = county_rewards + } + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + this != scope:first_reward_target + } + save_scope_as = second_reward_target + add_to_list = county_rewards + } + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + this != scope:first_reward_target + this != scope:second_reward_target + } + save_scope_as = third_reward_target + add_to_list = county_rewards + } + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + } + save_scope_as = fourth_reward_target + add_to_list = county_rewards + } + ordered_held_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + this != scope:first_reward_target + this != scope:second_reward_target + this != scope:third_reward_target + this != scope:fourth_reward_target + } + save_scope_as = fifth_reward_target + add_to_list = county_rewards + } + } + } + if = { + limit = { + NOT = { + exists = scope:second_reward_target + } + } + ordered_realm_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + holder = { + is_ai = yes + this != scope:first_reward_target + } + } + save_scope_as = second_reward_target + add_to_list = county_rewards + } + } + if = { + limit = { + NOT = { + exists = scope:third_reward_target + } + } + ordered_realm_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + holder = { + is_ai = yes + this != scope:second_reward_target + this != scope:first_reward_target + } + } + save_scope_as = third_reward_target + add_to_list = county_rewards + } + } + if = { + limit = { + NOT = { + exists = scope:fourth_reward_target + } + } + ordered_realm_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + holder = { + is_ai = yes + this != scope:second_reward_target + this != scope:first_reward_target + this != scope:third_reward_target + } + } + save_scope_as = fourth_reward_target + add_to_list = county_rewards + } + } + if = { + limit = { + NOT = { + exists = scope:fifth_reward_target + } + } + ordered_realm_county = { + order_by = { + value = development_level + multiply = -1 + } + limit = { + holder = { + is_ai = yes + this != scope:second_reward_target + this != scope:first_reward_target + this != scope:third_reward_target + this != scope:fourth_reward_target + } + } + save_scope_as = fifth_reward_target + add_to_list = county_rewards + } + } + every_in_list = { + list = county_rewards + add_county_modifier = { + modifier = ach_intent_defense_boost_modifier + years = 20 + } + } +} + +coronation_create_artifact_yearly_effect = { + save_scope_as = owner + if = { + limit = { + highest_held_title_tier >= tier_empire + realm_size >= 120 + } + set_artifact_rarity_famed = yes + } + else = { + set_artifact_rarity_masterwork = yes + } + + if = { + limit = { + coronation_proper_artifact_crown_trigger = yes + } + save_scope_value_as = { + name = artifact_type + value = flag:crown + } + } + else_if = { + limit = { + coronation_proper_artifact_regalia_trigger = yes + } + save_scope_value_as = { + name = artifact_type + value = flag:regalia + } + } + else = { + random_list = { + 1 = { + save_scope_value_as = { + name = artifact_type + value = flag:crown + } + } + 1 = { + save_scope_value_as = { + name = artifact_type + value = flag:regalia + } + } + } + } + if = { + limit = { + scope:artifact_type = flag:crown + } + create_artifact = { + name = ach_yearly_crown_name + description = ach_yearly_crown_desc + type = helmet + visuals = crown + wealth = scope:wealth + template = crown_wearable_template + quality = scope:quality + decaying = no + modifier = artifact_parochial_vassal_opinion_3_modifier + creator = scope:owner + save_scope_as = newly_created_artifact + } + hidden_effect_new_object = { + scope:newly_created_artifact = { + add_scaled_artifact_modifier_rulership_effect = yes + } + } + } + else_if = { + limit = { + scope:artifact_type = flag:regalia + } + create_artifact = { + name = ach_yearly_regalia_name + description = ach_yearly_regalia_desc + type = regalia + template = regalia_template + visuals = regalia + wealth = scope:wealth + quality = scope:quality + decaying = no + modifier = artifact_parochial_vassal_opinion_3_modifier + creator = scope:owner + save_scope_as = newly_created_artifact + } + hidden_effect_new_object = { + scope:newly_created_artifact = { + add_scaled_artifact_modifier_rulership_effect = yes + } + } + } +} + +coronation_broken_oath_punishment_effect = { + + set_variable = { + name = scale_of_oath_failure + value = 0 + } + + every_vassal = { + add_to_list = disappointed_vassals + root = { + change_variable = { + name = scale_of_oath_failure + add = prev.sub_realm_size + } + } + } + + every_courtier_or_guest = { + add_to_list = disappointed_vassals + } + + change_variable = { + name = scale_of_oath_failure + add = sub_realm_size + } + + if = { + limit = { + culture = { has_cultural_era_or_later = culture_era_late_medieval } + } + change_variable = { + name = scale_of_oath_failure + multiply = 2 + } + } + else_if = { + limit = { + culture = { has_cultural_era_or_later = culture_era_high_medieval } + } + change_variable = { + name = scale_of_oath_failure + multiply = 1.6 + } + } + else_if = { + limit = { + culture = { has_cultural_era_or_later = culture_era_early_medieval } + } + change_variable = { + name = scale_of_oath_failure + multiply = 1.2 + } + } + else = { + change_variable = { + name = scale_of_oath_failure + multiply = 0.8 + } + } + + if = { + limit = { + has_trait = ambitious + } + change_variable = { + name = scale_of_oath_failure + multiply = 1.2 + } + } + + if = { + limit = { + is_ai = no + } + if = { + limit = { + has_game_rule = very_hard_difficulty + } + add_prestige_level = -3 + change_variable = { + name = scale_of_oath_failure + multiply = 2 + } + save_scope_value_as = { + name = failure_opinion_value + value = -60 + } + if = { + limit = { + has_trait = ambitious + } + add_stress = 200 + } + else = { + add_stress = 100 + } + } + else_if = { + limit = { + has_game_rule = hard_difficulty + } + add_prestige_level = -2 + change_variable = { + name = scale_of_oath_failure + multiply = 1.5 + } + save_scope_value_as = { + name = failure_opinion_value + value = -40 + } + if = { + limit = { + has_trait = ambitious + } + add_stress = 150 + } + else = { + add_stress = 75 + } + } + else_if = { + limit = { + has_game_rule = easy_difficulty + } + change_variable = { + name = scale_of_oath_failure + multiply = 0.7 + } + save_scope_value_as = { + name = failure_opinion_value + value = -10 + } + if = { + limit = { + has_trait = ambitious + } + add_stress = medium_stress_gain + } + else = { + add_stress = minor_stress_gain + } + } + else_if = { + limit = { + has_game_rule = very_easy_difficulty + } + change_variable = { + name = scale_of_oath_failure + multiply = 0.7 + } + save_scope_value_as = { + name = failure_opinion_value + value = -5 + } + if = { + limit = { + has_trait = ambitious + } + add_stress = minor_stress_gain + } + else = { + add_stress = miniscule_stress_gain + } + } + else = { + add_prestige_level = -1 + save_scope_value_as = { + name = failure_opinion_value + value = -15 + } + if = { + limit = { + has_trait = ambitious + } + add_stress = massive_stress_gain + } + else = { + add_stress = major_stress_gain + } + } + } + else = { + set_variable = { + name = scale_of_oath_failure + value = 1 + } + save_scope_value_as = { + name = failure_opinion_value + value = -1 + } + } + + save_scope_value_as = { + name = scale_of_oath_failure_scope + value = var:scale_of_oath_failure + } + + every_in_list = { + list = disappointed_vassals + custom = coronation_events.150.custom_list_tooltip + add_opinion = { + modifier = disappointed_opinion + target = root + opinion = scope:failure_opinion_value + } + } +} + +coronation_update_supporters_detractors_effect = { + #Add appropriate characters to detractors + every_attending_character = { + limit = { + NOR = { + is_in_guest_subset = { name = detractor } + government_has_flag = government_is_herder + this = scope:host + has_activity_intent = coronation_offer_support + } + trigger_if = { + limit = { + has_activity_intent = coronation_disrupt_loyalists + } + has_activity_intent = coronation_disrupt_loyalists + } + trigger_else = { + #Opinion combined with a less direct reason + opinion = { + target = scope:host + value < -10 + } + OR = { + opinion = { + target = scope:host + value < -50 + } + AND = { + is_a_faction_member = yes + is_vassal_of = scope:host + } + has_activity_intent = coronation_seize_advantages + is_causing_raid_hostility_towards = scope:host + scope:host = { + is_causing_raid_hostility_towards = prev + } + is_at_war_with = scope:host + has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:host } + } + } + scope:activity = { + trigger_if = { + limit = { + has_variable_list = blocked_from_detractors + } + NOT = { + is_target_in_variable_list = { + name = blocked_from_detractors + target = prev + } + } + } + trigger_if = { + limit = { + has_variable_list = locked_into_supporters + } + NOT = { + is_target_in_variable_list = { + name = locked_into_supporters + target = prev + } + } + } + } + #Players should have a reason they can see for their assignment + trigger_if = { + limit = { + is_ai = no + } + OR = { + has_activity_intent = coronation_disrupt_loyalists + AND = { + is_a_faction_member = yes + is_vassal_of = scope:host + } + is_causing_raid_hostility_towards = scope:host + scope:host = { + is_causing_raid_hostility_towards = prev + } + is_at_war_with = scope:host + has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:host } + reverse_opinion = { + target = scope:host + value < -80 + } + } + } + } + scope:activity = { + add_to_guest_subset = { + name = detractor + target = prev + } + } + } + #Remove inappropriate detractors + every_guest_subset = { + name = detractor + limit = { + scope:activity = { + trigger_if = { + limit = { + has_variable_list = locked_into_detractors + } + NOT = { + is_target_in_variable_list = { + name = locked_into_detractors + target = prev + } + } + } + } + OR = { + government_has_flag = government_is_herder + this = scope:host + has_activity_intent = coronation_offer_support + NOR = { + has_activity_intent = coronation_disrupt_loyalists + opinion = { + target = scope:host + value < -10 + } + } + } + } + scope:activity = { + remove_from_guest_subset = { + name = detractor + target = prev + } + } + } + #Clear and then re-save major detractors + clear_variable_list = major_detractor + if = { + limit = { + any_guest_subset = { + name = detractor + count >= 3 + } + } + ordered_guest_subset = { + name = detractor + max = 3 + order_by = coronation_detractor_sort_value + scope:activity = { + add_to_variable_list = { + name = major_detractor + target = prev + } + } + } + } + else_if = { + limit = { + any_guest_subset = { + name = detractor + count = 2 + } + } + ordered_guest_subset = { + name = detractor + max = 2 + order_by = coronation_detractor_sort_value + scope:activity = { + add_to_variable_list = { + name = major_detractor + target = prev + } + } + } + } + else_if = { + limit = { + any_guest_subset = { + name = detractor + count = 1 + } + } + ordered_guest_subset = { + name = detractor + max = 1 + order_by = coronation_detractor_sort_value + scope:activity = { + add_to_variable_list = { + name = major_detractor + target = prev + } + } + } + } + #SUPPORTERS + #Add appropriate characters to supporters + every_attending_character = { + limit = { + NOR = { + is_in_guest_subset = { name = detractor } + government_has_flag = government_is_herder + this = scope:host + has_activity_intent = coronation_disrupt_loyalists + AND = { + is_vassal_of = scope:host + is_a_faction_member = yes + } + is_at_war_with = scope:host + is_causing_raid_hostility_towards = scope:host + scope:host = { + is_causing_raid_hostility_towards = prev + } + } + trigger_if = { + limit = { + has_activity_intent = coronation_offer_support + } + has_activity_intent = coronation_offer_support + } + trigger_else = { + OR = { + opinion = { + target = scope:host + value > 50 + } + is_allied_to = scope:host + has_any_good_relationship_with_character_trigger = { CHARACTER = scope:host } + is_obedient_to = scope:host + } + opinion = { + target = scope:host + value >= 20 + } + } + + NOT = { this = scope:host } + scope:activity = { + trigger_if = { + limit = { + has_variable_list = blocked_from_supporters + } + NOT = { + is_target_in_variable_list = { + name = blocked_from_supporters + target = prev + } + } + } + trigger_if = { + limit = { + has_variable_list = locked_into_detractors + } + NOT = { + is_target_in_variable_list = { + name = locked_into_detractors + target = prev + } + } + } + } + #Players should have a reason they can see for their assignment + trigger_if = { + limit = { + is_ai = no + } + OR = { + has_activity_intent = coronation_offer_support + AND = { + any_tributary = { + this = scope:host + } + reverse_opinion = { + target = scope:host + value > 60 + } + } + AND = { + any_vassal = { + this = scope:host + } + reverse_opinion = { + target = scope:host + value > 60 + } + } + AND = { + exists = scope:host.house + house ?= scope:host.house + reverse_opinion = { + target = scope:host + value > 60 + } + } + is_allied_to = scope:host + has_any_good_relationship_with_character_trigger = { CHARACTER = scope:host } + reverse_opinion = { + target = scope:host + value > 80 + } + } + } + } + scope:activity = { + add_to_guest_subset = { + name = supporter + target = prev + } + } + } + #Remove inappropriate supporters + every_guest_subset = { + name = supporter + limit = { + scope:activity = { + trigger_if = { + limit = { + has_variable_list = locked_into_supporters + } + NOT = { + is_target_in_variable_list = { + name = locked_into_supporters + target = prev + } + } + } + } + OR = { + government_has_flag = government_is_herder + this = scope:host + has_activity_intent = coronation_disrupt_loyalists + AND = { + is_vassal_of = scope:host + is_a_faction_member = yes + } + is_at_war_with = scope:host + is_causing_raid_hostility_towards = scope:host + scope:host = { + is_causing_raid_hostility_towards = prev + } + NOR = { + has_activity_intent = coronation_offer_support + opinion = { + target = scope:host + value > 10 + } + } + } + } + scope:activity = { + remove_from_guest_subset = { + name = supporter + target = prev + } + } + } + #Clear and then re-save major supporters + clear_variable_list = major_supporter + if = { + limit = { + any_guest_subset = { + name = supporter + count >= 3 + } + } + ordered_guest_subset = { + name = supporter + max = 3 + order_by = coronation_supporter_sort_value + scope:activity = { + add_to_variable_list = { + name = major_supporter + target = prev + } + } + } + } + else_if = { + limit = { + any_guest_subset = { + name = supporter + count = 2 + } + } + ordered_guest_subset = { + name = supporter + max = 2 + order_by = coronation_supporter_sort_value + scope:activity = { + add_to_variable_list = { + name = major_supporter + target = prev + } + } + } + } + else_if = { + limit = { + any_guest_subset = { + name = supporter + count = 1 + } + } + ordered_guest_subset = { + name = supporter + max = 1 + order_by = coronation_supporter_sort_value + scope:activity = { + add_to_variable_list = { + name = major_supporter + target = prev + } + } + } + } +} +play_coronation_ceremony_music_effect = { + if = { + limit = { + involved_activity.activity_location.culture = { has_graphical_india_culture_group_trigger = yes } + } + play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tours/ep2_event_grand_tour_set_india" + } + else_if = { + limit = { + involved_activity.activity_location.culture = { has_graphical_mena_culture_group_trigger = yes } + } + play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tours/ep2_event_grand_tour_set_mena" + } + else = { + play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tours/ep2_event_grand_tour_set_west" + } + if = { + limit = { + scope:activity.var:activity_special_type_progression >= 50 + } + play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tours/ep2_event_grand_tour_arrival_welcome" + } + else_if = { + limit = { + scope:activity.var:activity_special_type_progression >= 25 + } + play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tours/ep2_event_grand_tour_arrival_neutral" + } + else = { + play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tours/ep2_event_grand_tour_arrival_suspicious" + } +} +ach_remove_oaths_on_king_minus_effect = { + if = { + limit = { + has_variable = diplomacy_oath_1 + } + remove_variable = diplomacy_oath_1 + remove_variable = diplomacy_oath_1_timer + } + if = { + limit = { + has_variable = diplomacy_oath_2 + } + remove_variable = diplomacy_oath_2 + remove_variable = diplomacy_oath_2_timer + } + # Martial + if = { + limit = { + has_variable = martial_oath_1 + } + remove_variable = martial_oath_1 + remove_variable = martial_oath_1_timer + remove_variable = oath_reconquest_title + } + if = { + limit = { + has_variable = martial_oath_2 + } + remove_variable = martial_oath_2 + remove_variable = martial_oath_2_timer + remove_variable = oath_conquest_size + } + # Stewardship + if = { + limit = { + has_variable = stewardship_oath_1 + } + remove_variable = stewardship_oath_1 + remove_variable = stewardship_oath_1_timer + } + if = { + limit = { + has_variable = stewardship_oath_2 + } + remove_variable = stewardship_oath_2 + remove_variable = stewardship_oath_2_timer + } + # Learning + if = { + limit = { + has_variable = learning_oath_1 + } + remove_variable = learning_oath_1 + remove_variable = learning_oath_1_timer + remove_variable = learning_oath_cost + } + # De Jure rights + if = { + limit = { + has_variable = purge_pretenders_oath + } + remove_variable = purge_pretenders_oath + remove_variable = purge_pretenders_oath_timer + remove_variable = purge_pretenders_target_title + } + # End the struggle + if = { + limit = { + has_variable = end_the_struggle_oath + } + remove_variable = end_the_struggle_oath + remove_variable = end_the_struggle_oath_timer + remove_variable = end_the_struggle_oath_type_var + } + # Greatest Hunter + if = { + limit = { + has_variable = greatest_hunter_oath + } + remove_variable = greatest_hunter_oath + remove_variable = greatest_hunter_oath_timer + remove_variable = greatest_hunter_oath_l_counter + remove_variable = greatest_hunter_oath_r_counter + } + # Heir Preparation + if = { + limit = { + has_variable = heir_preparation_oath + } + remove_variable = heir_preparation_oath + remove_variable = heir_preparation_oath_timer + } + # Install Claimants + if = { + limit = { + has_variable = install_claimants_oath + } + remove_variable = install_claimants_oath + remove_variable = install_claimants_oath_timer + } + # Mend the Fracture + if = { + limit = { + has_variable = mend_the_fracture_oath + } + remove_variable = mend_the_fracture_oath + remove_variable = mend_the_fracture_oath_timer + } + # Provide for the Warriors + if = { + limit = { + has_variable = provide_for_the_warriors_oath + } + remove_variable = provide_for_the_warriors_oath + remove_variable = provide_for_the_warriors_oath_timer + } + # Provide for the Faithful + if = { + limit = { + has_variable = provide_for_the_faithful_oath + } + remove_variable = provide_for_the_faithful_oath + remove_variable = provide_for_the_faithful_oath_timer + } + # Provide for the Poor + if = { + limit = { + has_variable = provide_for_the_poor_oath + } + remove_variable = provide_for_the_poor_oath + remove_variable = provide_for_the_poor_oath_timer + } + # Repent + if = { + limit = { + has_variable = repent_oath + } + remove_variable = repent_oath + remove_variable = repent_oath_timer + } +} + diff --git a/N3OW/common/scripted_effects/10_dlc_tgp_dynastic_cycle_scripted_effects.txt b/N3OW/common/scripted_effects/10_dlc_tgp_dynastic_cycle_scripted_effects.txt new file mode 100644 index 00000000..5e689038 --- /dev/null +++ b/N3OW/common/scripted_effects/10_dlc_tgp_dynastic_cycle_scripted_effects.txt @@ -0,0 +1,1493 @@ +################################################## +# Dynastic Cycle Scripted Effects +################################################## + +# Effect called when claiming the Mandate of Heaven +tgp_claim_mandate_of_heaven_effect = { + save_temporary_scope_as = new_emperor_temp + set_variable = { + name = claimed_mandate_var + value = yes + days = 30 + } + # Grant the Hegemon title + create_title_and_vassal_change = { + type = created + save_scope_as = mandate_change + add_claim_on_loss = no + } + title:h_china = { + change_title_holder = { + holder = scope:new_emperor_temp + change = scope:mandate_change + } + } + resolve_title_and_vassal_change = scope:mandate_change + # Adjust tributaries + if = { + limit = { + number_of_tributaries > 0 + } + # Vassalize tributaries within China (except if it's a player) + create_title_and_vassal_change = { + type = swear_fealty + save_scope_as = mandate_vassalize_tributaries_change + } + every_tributary = { + limit = { + is_ai = yes + primary_title = { + target_is_de_jure_liege_or_above = title:h_china + } + } + hidden_effect = { end_tributary = yes } + change_liege = { + liege = scope:new_emperor_temp + change = scope:mandate_vassalize_tributaries_change + } + } + resolve_title_and_vassal_change = scope:mandate_vassalize_tributaries_change + # Turn your other tributaries into hegemonic + every_tributary = { + custom = custom.every_tributary + limit = { + NAND = { + is_ai = yes + primary_title = { + target_is_de_jure_liege_or_above = title:h_china + } + } + } + start_tributary = { + contract_group = tributary_celestial + suzerain = scope:new_emperor_temp + } + } + } + scope:new_emperor_temp = { + # Get some gold back from any owned domicile + nomad_domicile_refund_effect = yes + # Become celestial + if = { + limit = { + NOT = { has_government = celestial_government } + } + tgp_domicile_conversion_when_changing_government_type = { + NEW_DOMICILE_TYPE = east_asian_estate + NEW_GOVERNMENT_TYPE = celestial_government + } + change_government = celestial_government + } + # Get the de jure capital if possible + if = { + limit = { + title:h_china.title_capital_county.holder ?= { + OR = { + any_liege_or_above = { this = scope:new_emperor_temp } + this = scope:new_emperor_temp + } + } + } + if = { + limit = { + title:h_china.title_capital_county.holder = { + this != scope:new_emperor_temp + } + } + create_title_and_vassal_change = { + type = revoked + save_scope_as = mandate_capital_change + add_claim_on_loss = no + } + title:h_china.title_capital_county = { + change_title_holder = { + holder = scope:new_emperor_temp + change = scope:mandate_capital_change + } + } + resolve_title_and_vassal_change = scope:mandate_capital_change + } + set_realm_capital = title:h_china.title_capital_county + } + # Provide the new emperor with suitable rewards + hidden_effect = { + add_treasury = { + value = gold + min = 1000 + } + change_influence = { + value = monumental_influence_gain + multiply = 4 + } + add_legitimacy = mandate_legitimacy_max + } + dynasty = { + add_dynasty_prestige = excessive_dynasty_prestige_value + } + add_character_modifier = claim_mandate_decision_modifier + # Increase control of every owned county within China + hidden_effect = { + every_realm_county = { + custom = custom_every_realm_county + limit = { + target_is_de_jure_liege_or_above = title:h_china + } + change_county_control = 25 + } + } + show_as_tooltip = { # We show this as a tooltip because it looks better than the above effect + title:h_china = { change_county_control = 25 } + } + # Populate the emperor's court with high merit characters + hidden_effect = { + while = { + count = 5 + + create_character = { + template = tgp_minister_administrator_template + employer = scope:new_emperor_temp + faith = scope:new_emperor_temp.faith + culture = scope:new_emperor_temp.culture + save_scope_as = mandate_new_administrator_temp + } + scope:mandate_new_administrator_temp ?= { + change_merit = empire_starting_merit_value + assign_completed_exams_based_on_merit_effect = yes + } + create_character = { + template = tgp_minister_diplomat_template + employer = scope:new_emperor_temp + faith = scope:new_emperor_temp.faith + culture = scope:new_emperor_temp.culture + save_scope_as = mandate_new_diplomat_temp + } + scope:mandate_new_diplomat_temp ?= { + change_merit = empire_starting_merit_value + assign_completed_exams_based_on_merit_effect = yes + } + create_character = { + template = tgp_minister_scholar_template + employer = scope:new_emperor_temp + faith = scope:new_emperor_temp.faith + culture = scope:new_emperor_temp.culture + save_scope_as = mandate_new_scholar_temp + } + scope:mandate_new_scholar_temp ?= { + change_merit = empire_starting_merit_value + assign_completed_exams_based_on_merit_effect = yes + } + create_character = { + template = tgp_minister_scholar_template + employer = scope:new_emperor_temp + faith = scope:new_emperor_temp.faith + culture = scope:new_emperor_temp.culture + save_scope_as = mandate_new_scholar_temp + } + scope:mandate_new_scholar_temp ?= { + change_merit = empire_starting_merit_value + assign_completed_exams_based_on_merit_effect = yes + } + create_character = { + template = tgp_minister_commander_template + employer = scope:new_emperor_temp + faith = scope:new_emperor_temp.faith + culture = scope:new_emperor_temp.culture + save_scope_as = mandate_new_commander_temp + } + scope:mandate_new_commander_temp ?= { + change_merit = empire_starting_merit_value + assign_completed_exams_based_on_merit_effect = yes + } + } + every_courtier = { + limit = { + merit >= 3000 + } + random = { + chance = 50 + create_noble_family_effect = { GOVERNMENT_GIVER = scope:new_emperor_temp } + } + } + } + } + # Convert eligible vassals to celestial + custom_tooltip = { + text = claim_mandate_turn_vassal_celestial_desc + every_vassal_or_below = { + limit = { + highest_held_title_tier >= tier_county + NOR = { + # Don't change republics or theocracies + government_has_flag = government_is_republic + government_has_flag = government_is_theocracy + # And just in case, don't change any unfit governments + government_has_flag = cannot_be_vassal_or_liege + # No need to change if they are celestial already + government_has_flag = government_is_celestial + } + capital_province = { + OR = { + has_holding_type = castle_holding + has_holding_type = city_holding + has_holding_type = temple_citadel_holding + } + } + } + change_to_administrative_effect = yes + # Give characters some merit and exams based on their position + change_merit = { + value = assign_merit_based_on_tier_value + add = { + value = age + multiply = 2 + } + add = { + value = sum_of_all_skills_value + multiply = 2 + } + } + assign_completed_exams_based_on_merit_effect = yes + } + } + hidden_effect = { + # Vassalize any stray celestial noble families - we also give them merit to fill out the candidate pools + create_title_and_vassal_change = { + type = swear_fealty + save_scope_as = mandate_vassalize_celestial_families_change + } + every_independent_ruler = { + limit = { + government_has_flag = government_is_celestial + primary_title = { is_noble_family_title = yes } + NOT = { + any_held_title = { is_noble_family_title = no } + } + capital_province.county = { + target_is_de_jure_liege_or_above = title:h_china + } + } + change_liege = { + liege = scope:new_emperor_temp + change = scope:mandate_vassalize_celestial_families_change + } + change_merit = { + value = { 3000 8000 } + add = { + value = age + multiply = 2 + } + add = { + value = sum_of_all_skills_value + multiply = 2 + } + } + assign_completed_exams_based_on_merit_effect = yes + } + resolve_title_and_vassal_change = scope:mandate_vassalize_celestial_families_change + # Ensure that we get a family title and a domicile if we don't + change_to_administrative_effect = yes + # Make sure ministers are assigned correctly + fill_the_ministry_effect = yes + } +} + +# Effect called when entering the Chaos Phase +tgp_chaos_shattering_effect = { + hidden_effect = { + title:h_china = { + holder = { save_temporary_scope_as = old_emperor_temp } + # Reset imperial examination activity + set_variable = { + name = years_since_imperial_examination + value = 0 + } + } + #put every vassal of the current hegemon in a list + situation:dynastic_cycle = { + every_situation_participant = { + limit = { + top_liege = scope:old_emperor_temp + } + add_to_list = former_vassals + } + } + scope:old_emperor_temp = { + #destroy the title of china and all Empires that the Hegemon holds + every_held_title = { + limit = { + tier > tier_kingdom + } + scope:old_emperor_temp = { + destroy_title = prev + } + } + create_title_and_vassal_change = { + type = independency + save_scope_as = chaos_change + add_claim_on_loss = yes + } + every_vassal = { + limit = { + #breakaway all non-dejure vassals + primary_title = { + NOT = { target_is_de_jure_liege_or_above = scope:old_emperor_temp.primary_title } + } + } + becomes_independent = { change = scope:chaos_change } + } + resolve_title_and_vassal_change = scope:chaos_change + } + # destroy all empire and king level titles if holders have not enough power + every_in_list = { + list = former_vassals + if = { + limit = { + is_landed = yes + is_ai = yes + OR = { + AND = { + highest_held_title_tier = tier_empire + var:movement_power_individual < high_movement_power_value + } + AND = { + highest_held_title_tier = tier_kingdom + var:movement_power_individual < decent_movement_power_value + } + } + } + every_held_title = { + limit = { + tier > tier_duchy + } + prev = { + destroy_title = prev + } + } + } + } + every_in_list = { + list = former_vassals + # Destroy any held minister title + destroy_held_ministry_titles_effect = yes + } + every_in_list = { + list = former_vassals + # let the former vassals of the hegemon become regular conquerors + ai_chance_to_become_conqueror_effect = yes + # put movement leaders and elders into a list + if = { + limit = { + OR = { + num_of_relation_disciple > 0 + has_variable = former_movement_leader + } + is_independent_ruler = yes + is_landed = yes + } + add_to_list = new_lieges + } + } + # remake the hierarchy by vassalizing or tributarizing non-leader movement members and disciples + every_in_list = { + list = new_lieges + save_scope_as = new_liege + every_in_list = { + list = former_vassals + limit = { + OR = { + scope:new_liege.var:former_movement_leader ?= var:former_movement_member + has_relation_elder = scope:new_liege + } + this != scope:new_liege + } + save_scope_as = member + # if lower tier than the potential new liege and is neighboring them or anyone that is also neighboring new liege, vassalize them + if = { + limit = { + highest_held_title_tier < scope:new_liege.highest_held_title_tier + OR = { + primary_title = { is_neighbor_to_realm = scope:new_liege } + any_in_list = { + list = former_vassals + this != scope:new_liege + this != scope:member + primary_title = { + is_neighbor_to_realm = scope:new_liege + is_neighbor_to_realm = scope:member + } + is_tributary_of = scope:new_liege + } + } + } + create_title_and_vassal_change = { + type = swear_fealty + save_scope_as = elder_hierarchy_change + add_claim_on_loss = no + } + change_liege = { + liege = scope:new_liege + change = scope:elder_hierarchy_change + } + resolve_title_and_vassal_change = scope:elder_hierarchy_change + } + # otherwise turn into tributary + else_if = { + limit = { + top_liege = scope:member + } + start_tributary_interaction_effect = { + TRIBUTARY = scope:member + SUZERAIN = scope:new_liege + } + } + } + } + # Assign unlanded family heads to a suitable realm + every_in_list = { + list = former_vassals + if = { + limit = { + any_held_title = { is_noble_family_title = yes } + is_landed = no + this = top_liege + } + create_title_and_vassal_change = { + type = swear_fealty + save_scope_as = unlanded_liege_change + add_claim_on_loss = no + } + # Save the top liege of the domicile's location - If ruler's tier is above county + if = { + limit = { + domicile.domicile_location.county.holder.top_liege = { + highest_held_title_tier > tier_county + } + } + domicile.domicile_location.county.holder.top_liege = { + save_temporary_scope_as = unlanded_new_liege + } + } + # Otherwise - Try and find a neighboring ruler + else_if = { + limit = { + domicile.domicile_location.county.holder = { + any_neighboring_top_liege_realm_owner = { + highest_held_title_tier > tier_county + } + } + } + domicile.domicile_location.county.holder = { + random_neighboring_top_liege_realm_owner = { + limit = { + highest_held_title_tier > tier_county + } + save_temporary_scope_as = unlanded_new_liege + } + } + } + change_liege = { + liege = scope:unlanded_new_liege + change = scope:unlanded_liege_change + } + resolve_title_and_vassal_change = scope:unlanded_liege_change + } + } + # create a story that will make characters pursue taking the mandate + situation:dynastic_cycle = { + every_situation_participant = { + if = { + limit = { + NOR = { + has_trait = conqueror + any_owned_story = { + story_type = story_conqueror + } + any_owned_story = { + story_type = story_greatest_of_khans + } + any_owned_story = { + story_type = story_mongol_invasion + } + } + is_landed = yes + highest_held_title_tier >= tier_duchy + is_tributary = no + is_adult = yes + is_incapable = no + # run the ai personality triggers only for non elders and non movement leaders + trigger_if = { + limit = { + NOT = { + is_in_list = new_lieges + } + } + ai_has_cautious_personality = no + ai_boldness >= 0 + ai_greed >= 0 + } + } + create_story = story_take_mandate_of_heaven + } + } + } + } + #depose the previous hegemon from all landed titles + scope:old_emperor_temp = { + force_step_down_landed_titles = yes + } + hidden_effect = { + situation:dynastic_cycle = { + every_situation_participant = { + remove_variable = movement_member + recalculate_participant_group = situation:dynastic_cycle + } + } + } +} + +# Saves Chinese Emperor, or the last one +tgp_save_son_of_heaven_or_previous_effect = { + title:h_china.holder ?= { save_scope_as = situation_liege } + if = { + limit = { NOT = { exists = scope:situation_liege } } + title:h_china.previous_holder ?= { save_scope_as = situation_liege } + } +} + +# Advances Dynastic Wuking element +tgp_update_wuking_element_effect = { + situation:dynastic_cycle = { + if = { + limit = { exists = var:wuking_element } + switch = { + trigger = var:wuking_element + flag:metal = { + tgp_set_wuking_element_effect = { ELEMENT = water } + } + flag:water = { + tgp_set_wuking_element_effect = { ELEMENT = wood } + } + flag:wood = { + tgp_set_wuking_element_effect = { ELEMENT = fire } + } + flag:fire = { + tgp_set_wuking_element_effect = { ELEMENT = earth } + } + flag:earth = { + tgp_set_wuking_element_effect = { ELEMENT = metal } + } + } + } + } +} + +# Adds Wuking element variable +tgp_set_wuking_element_effect = { + # Set from new creation + if = { + limit = { + NOT = { exists = title:h_china.holder.house.var:wuking_element } + } + title:h_china.holder.house ?= { + set_variable = { name = wuking_element value = flag:$ELEMENT$ } + } + } + # Set from the new or returning dynasty + set_variable = { name = wuking_element value = flag:$ELEMENT$ } +} + +tgp_treasury_raided_effect = { + if = { + limit = { + exists = title:h_china + scope:county = { + this = title:h_china.title_capital_county + holder ?= { + has_treasury = yes + treasury > 0 + } + } + } + add_loot = treasury_raided_loot_value + title:h_china.holder = { + remove_treasury = treasury_raided_loot_value + add_legitimacy_effect = { LEGITIMACY = medium_legitimacy_loss } + } + if = { + limit = { + situation:dynastic_cycle ?= { + situation_top_has_catalyst = catalyst_imperial_treasury_raided + } + } + trigger_situation_catalyst = catalyst_imperial_treasury_raided + } + } +} + +tgp_activate_catalyst_against_hegemon_effect = { + if = { + limit = { + exists = title:h_china + title:h_china.holder ?= $HEGEMON$ + any_character_situation = { + situation:dynastic_cycle ?= this + situation_top_has_catalyst = $CATALYST$ + } + } + situation:dynastic_cycle = { + trigger_situation_catalyst = $CATALYST$ + } + } +} + +tgp_assign_china_realm_name_options_effect = { + random_list = { + pick = 3 + unique = yes + 0 = { # Ba + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_ba_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_ba + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_ba } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_ba } + } + 0 = { # Cai + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_cai_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_cai + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_cai } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_cai } + } + 0 = { # Cao + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_cao_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_cao + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_cao } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_cao } + } + 0 = { # Chen + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_chen_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_chen + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_chen } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_chen } + } + 0 = { # Chu + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_chu_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_chu + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_chu } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_chu } + } + 0 = { # Dai + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_dai_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_dai + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_dai } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_dai } + } + 0 = { # Dian + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_dian_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_dian + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_dian } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_dian } + } + 0 = { # Gan + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_gan_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_gan + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_gan } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_gan } + } + 0 = { # Gui + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_gui_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_gui + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_gui } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_gui } + } + 0 = { # Han + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_han_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_han + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_han } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_han } + } + 0 = { # Huai + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_huai_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_huai + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_huai } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_huai } + } + 0 = { # Jin + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_jin_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_jin + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_jin } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_jin } + } + 0 = { # Jing + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_jing_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_jing + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_jing } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_jing } + } + 0 = { # Lai + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_lai_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_lai + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_lai } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_lai } + } + 0 = { # Liang + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_liang_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_liang + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_liang } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_liang } + } + 0 = { # Lu + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_lu_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_lu + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_lu } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_lu } + } + 0 = { # Min + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_min_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_min + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_min } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_min } + } + 0 = { # Qi + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_qi_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_qi + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_qi } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_qi } + } + 0 = { # Qian + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_qian_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_qian + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_qian } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_qian } + } + 0 = { # Shu + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_shu_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_shu + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_shu } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_shu } + } + 0 = { # Song + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_song_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_song + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_song } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_song } + } + 0 = { # Sui + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_sui_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_sui + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_sui } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_sui } + } + 0 = { # Tang + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_tang_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_tang + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_tang } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_tang } + } + 0 = { # Wei + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_wei_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_wei + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_wei } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_wei } + } + 0 = { # Wu + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_wu_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_wu + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_wu } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_wu } + } + 0 = { # Xia + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_xia_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_xia + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_xia } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_xia } + } + 0 = { # Xiang + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_xiang_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_xiang + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_xiang } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_xiang } + } + 0 = { # Xing + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_xing_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_xing + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_xing } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_xing } + } + 0 = { # Xu + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_xu_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_xu + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_xu } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_xu } + } + 0 = { # Yang + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_yang_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_yang + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_yang } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_yang } + } + 0 = { # Yin + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_yin_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_yin + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_yin } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_yin } + } + 0 = { # Yong + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_yong_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_yong + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_yong } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_yong } + } + 0 = { # Yue + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_yue_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_yue + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_yue } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_yue } + } + 0 = { # Zhao + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_zhao_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_zhao + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_zhao } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_zhao } + } + 0 = { # Zheng + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_zheng_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_zheng + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_zheng } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_zheng } + } + 0 = { # Zhou + modifier = { + add = 100 + capital_province ?= { + geographical_region = tgp_zhou_region + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_zhou + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_zhou } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_zhou } + } + 0 = { # Yuan + modifier = { + add = 1000 + culture = { + has_cultural_pillar = heritage_mongolic + } + } + modifier = { + factor = 0 + OR = { + is_title_localization_key_used = dynn_title_yuan + is_target_in_variable_list = { name = realm_title_names target = flag:dynn_title_yuan } + } + } + add_to_variable_list = { name = realm_title_names target = flag:dynn_title_yuan } + } + } +} + +# Custom situation history entry setup on phase change +tgp_dynastic_cycle_record_history_phase_change_effect = { + + # protect from double history entries + if = { + limit = { + situation:dynastic_cycle = { + OR = { + NOT = { exists = var:last_recorded_phase_change } + AND = { + exists = var:last_recorded_phase_change + OR = { + var:last_recorded_phase_change != $PHASE_NUMBER$ + var:last_recorded_phase_change = 4 + } + } + } + } + } + # When we enter Division, we only want to show the old hegemon + if = { + limit = { + situation:dynastic_cycle = { + situation_current_phase = situation_dynastic_cycle_phase_chaos + } + } + situation:dynastic_cycle = { + record_situation_special_event = { + key = situation_dynastic_cycle_era_change_history_entry + phase = $PHASE$ + variables = { + old_hegemon = title:h_china.previous_holder + } + } + } + } + # When we restore China after division, we only show the new hegemon + else_if = { + limit = { + #exists = title:h_china.holder + #title:h_china.holder = { is_valid_celestial_dynasty = yes } + situation:dynastic_cycle = { + exists = var:last_recorded_phase_change + var:last_recorded_phase_change = 6 + } + } + situation:dynastic_cycle = { + record_situation_special_event = { + key = situation_dynastic_cycle_era_change_history_entry + phase = $PHASE$ + variables = { + new_hegemon = title:h_china.holder + } + } + } + } + # If we replace the ruling dynasty, show new and old hegemon + else_if = { + limit = { + exists = title:h_china.holder + exists = title:h_china.previous_holder + title:h_china.holder.dynasty != title:h_china.previous_holder.dynasty + } + situation:dynastic_cycle = { + record_situation_special_event = { + key = situation_dynastic_cycle_era_change_history_entry + phase = $PHASE$ + variables = { + new_hegemon = title:h_china.holder + old_hegemon = title:h_china.previous_holder + } + } + } + } + # Else, show none + else = { + situation:dynastic_cycle = { + record_situation_special_event = { + key = situation_dynastic_cycle_era_change_history_entry + phase = $PHASE$ + } + } + } + situation:dynastic_cycle = { + set_variable = { + name = last_recorded_phase_change + value = $PHASE_NUMBER$ + } + } + } +} + +tgp_dynastic_cycle_add_to_movement_effect = { + $CHAR$ = { save_temporary_scope_as = other_ruler } + custom_tooltip = tgp_movement_events_0010_add_to_movement_effect_tt + if = { + limit = { + top_participant_group:dynastic_cycle ?= { + participant_group_type = expansion_movement + } + } + $CHAR$ = { + set_variable = { + name = movement_member + value = flag:expansion + } + } + } + else_if = { + limit = { + top_participant_group:dynastic_cycle ?= { + participant_group_type = advancement_movement + } + } + $CHAR$ = { + set_variable = { + name = movement_member + value = flag:advancement + } + } + } + else_if = { + limit = { + top_participant_group:dynastic_cycle ?= { + participant_group_type = pro_hegemon_movement + } + } + $CHAR$ = { + set_variable = { + name = movement_member + value = flag:pro_hegemon + } + } + } + else_if = { + limit = { + top_participant_group:dynastic_cycle ?= { + participant_group_type = conservative_movement + } + } + $CHAR$ = { + set_variable = { + name = movement_member + value = flag:conservative + } + } + } + else_if = { + limit = { + top_participant_group:dynastic_cycle ?= { + participant_group_type = undecided_movement + } + } + $CHAR$ = { + set_variable = { + name = movement_member + value = flag:undecided + } + } + } +} + +tgp_catalyst_from_decision_effect = { + switch = { + trigger = participant_group_type + pro_hegemon_movement = { + situation:dynastic_cycle = { + if = { + limit = { + situation_top_has_catalyst = catalyst_house_head_consulted_heaven_advancement_positive + root.top_liege.hegemon_favored_stability_phase_value >= 0 + } + trigger_situation_catalyst = catalyst_house_head_consulted_heaven_advancement_positive + } + else_if = { + limit = { + situation_top_has_catalyst = catalyst_house_head_consulted_heaven_expansion_positive + root.top_liege.hegemon_favored_stability_phase_value < 0 + } + trigger_situation_catalyst = catalyst_house_head_consulted_heaven_expansion_positive + } + else = { + trigger_situation_catalyst = catalyst_house_head_consulted_heaven_chaos_negative + } + } + } + advancement_movement = { + situation:dynastic_cycle = { + if = { + limit = { + situation_top_has_catalyst = catalyst_house_head_consulted_heaven_advancement_positive + } + trigger_situation_catalyst = catalyst_house_head_consulted_heaven_advancement_positive + } + else_if = { + limit = { + situation_current_phase = situation_dynastic_cycle_phase_stability_advancement + } + trigger_situation_catalyst = catalyst_house_head_consulted_heaven_chaos_negative + } + else = { + trigger_situation_catalyst = catalyst_house_head_consulted_heaven_chaos_positive + } + } + } + expansion_movement = { + situation:dynastic_cycle = { + if = { + limit = { + situation_top_has_catalyst = catalyst_house_head_consulted_heaven_expansion_positive + } + trigger_situation_catalyst = catalyst_house_head_consulted_heaven_expansion_positive + } + else_if = { + limit = { + situation_current_phase = situation_dynastic_cycle_phase_stability_expansion + } + trigger_situation_catalyst = catalyst_house_head_consulted_heaven_chaos_negative + } + else = { + trigger_situation_catalyst = catalyst_house_head_consulted_heaven_chaos_positive + } + } + } + conservative_movement = { + situation:dynastic_cycle = { + if = { + limit = { + situation_top_has_catalyst = catalyst_house_head_consulted_heaven_advancement_positive + root.top_liege.hegemon_favored_stability_phase_value < 0 #flipped on purpose + } + trigger_situation_catalyst = catalyst_house_head_consulted_heaven_advancement_positive + } + else_if = { + limit = { + situation_top_has_catalyst = catalyst_house_head_consulted_heaven_expansion_positive + root.top_liege.hegemon_favored_stability_phase_value >= 0 #flipped on purpose + } + trigger_situation_catalyst = catalyst_house_head_consulted_heaven_expansion_positive + } + else = { + trigger_situation_catalyst = catalyst_house_head_consulted_heaven_chaos_positive + } + } + } + undecided_movement = { + situation:dynastic_cycle = { + trigger_situation_catalyst = catalyst_house_head_consulted_heaven_chaos_negative + } + } + } +} diff --git a/N3OW/common/scripted_effects/10_dlc_tgp_house_bloc_scripted_effects.txt b/N3OW/common/scripted_effects/10_dlc_tgp_house_bloc_scripted_effects.txt new file mode 100644 index 00000000..9e6f9ab1 --- /dev/null +++ b/N3OW/common/scripted_effects/10_dlc_tgp_house_bloc_scripted_effects.txt @@ -0,0 +1,1368 @@ +#### Japanese Bloc effects + +## Create Japanese Bloc +# +# Create an appropriately named block (i.e. Japanese style confederation), +# with the root scoped characters house as the leading house. +# +# root: house which will lead the bloc +# TYPE: flag representing the confederation (and by extension aspiration) type +# +tgp_create_house_bloc_effect = { + save_scope_as = bloc_creator + save_scope_value_as = { + name = type + value = flag:$TYPE$ + } + custom_description = { + text = create_house_bloc_effect + subject = scope:bloc_creator.house_head + if = { + limit = { + OR = { + has_house_power_parameter = ceremony_cheaper_feasts + scope:type = flag:ceremony + } + } + house_head = { + create_confederation = { + name = CONFEDERATION_HOUSE_NAME + type = confederation_type:house_bloc_ceremony + leader = house + } + } + } + else_if = { + limit = { + OR = { + has_house_power_parameter = unlocks_japanese_manor_watch_house + scope:type = flag:determination + } + } + house_head = { + create_confederation = { + name = CONFEDERATION_HOUSE_NAME + type = confederation_type:house_bloc_determination + leader = house + } + } + } + else_if = { + limit = { + OR = { + has_house_power_parameter = unlocks_japanese_manor_shrine + scope:type = flag:humility + } + } + house_head = { + create_confederation = { + name = CONFEDERATION_HOUSE_NAME + type = confederation_type:house_bloc_humility + leader = house + } + } + } + else_if = { + limit = { + OR = { + has_house_power_parameter = unlocks_japanese_manor_brewery + scope:type = flag:prosperity + } + } + house_head = { + create_confederation = { + name = CONFEDERATION_HOUSE_NAME + type = confederation_type:house_bloc_prosperity + leader = house + } + } + } + else_if = { + limit = { + OR = { + has_house_power_parameter = unlocks_japanese_manor_archive + scope:type = flag:service + } + } + house_head = { + create_confederation = { + name = CONFEDERATION_HOUSE_NAME + type = confederation_type:house_bloc_service + leader = house + } + } + } + else_if = { + limit = { + OR = { + has_house_power_parameter = unlocks_japanese_manor_armory + scope:type = flag:strength + } + } + house_head = { + create_confederation = { + name = CONFEDERATION_HOUSE_NAME + type = confederation_type:house_bloc_strength + leader = house + } + } + } + house_confederation ?= { + save_scope_as = bloc + set_coa = scope:bloc_creator + } + } +} + +## Add additional character, and all members of their house, to a 'block'. +# +# root: house - who was invited +# INVITER: house - who is a member of the bloc to join +# +tgp_join_house_bloc_effect = { + save_scope_as = joiner + house_confederation ?= { save_scope_as = old_bloc } + $INVITER$ ?= { + save_scope_as = inviter + house_confederation ?= { save_scope_as = bloc } + } + if = { # Tooltip for interaction + limit = { NOT = { exists = scope:bloc } } + scope:joiner.house_head = { custom_tooltip = join_house_bloc_tt_no_scope } + } + else_if = { + limit = { + exists = scope:joiner + exists = scope:inviter + exists = scope:bloc + trigger_if = { + limit = { exists = scope:old_bloc } + scope:old_bloc != scope:bloc + } + } + # ADD MEMBER HOUSE + custom_description = { + text = join_house_bloc_effect + subject = scope:joiner.house_head + object = scope:inviter.house_head + scope:bloc ?= { + hidden_effect = { add_confederation_member_house = scope:joiner } + } + } + # OPINION + if = { + limit = { + $OPINION$ = flag:yes + exists = scope:joiner + scope:inviter != scope:joiner + } + scope:inviter ?= { + house_head ?= { + if = { # Hide for players + limit = { is_ai = yes } + if = { + limit = { + has_opinion_modifier = { + modifier = left_house_bloc_opinion + target = scope:joiner.house_head + } + } + remove_opinion = { + modifier = left_house_bloc_opinion + target = scope:joiner.house_head + } + } + add_opinion = { + modifier = joined_house_bloc_opinion + target = scope:joiner.house_head + opinion = 15 + } + } + } + change_house_relation_effect = { + HOUSE = scope:joiner + VALUE = house_relation_improve_medium_value + REASON = joined_bloc + CHAR = scope:joiner.house_head + TARGET_CHAR = scope:inviter.house_head + TITLE = scope:dummy_gender + } + } + } + } +} + + +## Leave block taking all rulers of the same house with you +# +# root: house - leaving the bloc +# +tgp_leave_house_bloc_effect = { + save_scope_as = leaver + house_confederation ?= { + save_scope_as = bloc + leading_house ?= { save_scope_as = leader } + } + if = { + limit = { + exists = scope:bloc + scope:leaver.house_head.house.house_confederation ?= scope:bloc + } + if = { # DISBAND + limit = { + scope:bloc = { + any_confederation_member_house = { count <= 2 } + } + } + custom_description = { + text = leave_house_bloc_effect + subject = scope:leaver.house_head + object = scope:bloc.leading_house.house_head + } + custom_description = { + text = disband_house_bloc_effect + subject = scope:bloc.leading_house.house_head + } + } + else_if = { # COOLDOWN + limit = { scope:leader != scope:leaver } + custom_description = { + text = leave_house_bloc_cooldown_effect + subject = scope:leaver.house_head + object = scope:bloc.leading_house.house_head + add_to_variable_list = { + name = left_bloc_cooldown + target = scope:bloc + years = tgp_leave_house_bloc_cooldown_years_value + } + } + } + if = { + limit = { scope:leader = scope:leaver } + # NEW LEADER TOOLTIP + scope:bloc = { + show_as_tooltip = { tgp_find_new_house_bloc_leader_effect = yes } + } + } + else = { + # OPINION + if = { + limit = { $OPINION$ = flag:yes } + scope:leader ?= { + house_head ?= { + if = { + limit = { + has_opinion_modifier = { + target = scope:leaver.house_head + modifier = joined_house_bloc_opinion + } + } + remove_opinion = { + target = scope:leaver.house_head + modifier = joined_house_bloc_opinion + } + } + add_opinion = { + target = scope:leaver.house_head + modifier = left_house_bloc_opinion + opinion = -15 + } + } + change_house_relation_effect = { + HOUSE = scope:leaver + VALUE = house_relation_damage_medium_value + REASON = left_bloc + CHAR = scope:leaver.house_head + TARGET_CHAR = scope:leader.house_head + TITLE = scope:dummy_gender + } + } + } + # TRUCE + if = { + limit = { $TRUCE$ = flag:yes } + scope:leaver.house_head = { + custom_tooltip = { + text = tgp_leave_house_bloc_truce_tt + scope:bloc = { + every_confederation_member_house = { + every_house_member = { + limit = { + top_liege = scope:leaver.house_head.top_liege + is_landed = yes + } + if = { + limit = { house != scope:leaver } + add_to_list = truce_targets + } + else = { add_to_list = truce_getters } + } + } + every_in_list = { + list = truce_targets + save_temporary_scope_as = truce_target_temp + every_in_list = { + list = truce_getters + add_truce_one_way = { + character = scope:truce_target_temp + years = tgp_leave_house_bloc_truce_years_value + name = TRUCE_LEFT_BLOC + } + } + } + } + } + } + } + } + # REMOVE MEMBER HOUSE + scope:bloc ?= { + hidden_effect = { remove_confederation_member_house = scope:leaver } + } + } +} + + +## Clear bloc membership related flags +# +# root: character +# +tgp_clear_house_bloc_flags_effect = { + if = { + limit = { has_character_flag = forced_bloc_membership } + remove_character_flag = forced_bloc_membership + } + if = { + limit = { has_character_flag = recently_joined_bloc } + remove_character_flag = recently_joined_bloc + } +} + + +## Find new leading house if necessary +# +# root: confederation - to find a new leader for +# +tgp_find_new_house_bloc_leader_effect = { + save_scope_as = bloc_temp + ordered_confederation_member_house = { + limit = { + exists = house_head + save_temporary_scope_as = house_temp + } + order_by = { # Most members + value = 1 + scope:house_temp.house_head.top_liege = { + every_vassal = { + limit = { + highest_held_title_tier > tier_barony + is_landed = yes + exists = house + house = { has_same_house_power_as = scope:house_temp } + house = scope:house_temp + } + add = 1 + } + } + } + save_temporary_scope_as = new_leader_temp + scope:bloc_temp = { + tgp_set_house_bloc_leading_house_effect = { LEADER = scope:new_leader_temp } + } + } +} + +# Set house leading a 'bloc' (i.e. Japanese style confederation) +# +# root: confederation - bloc getting a new leading house +# LEADER: house - new leading house +# +# +tgp_set_house_bloc_leading_house_effect = { + save_scope_as = bloc + leading_house = { save_scope_as = old_leader } + $LEADER$ ?= { save_scope_as = leader } + if = { + limit = { + exists = scope:leader + exists = scope:bloc + trigger_if = { + limit = { exists = scope:old_leader } + scope:old_leader != scope:leader + } + } + custom_description = { + text = change_house_bloc_leader_effect + subject = scope:leader.house_head + object = scope:old_leader.house_head + scope:bloc ?= { + hidden_effect = { + tgp_bloc_set_leading_house_effect = { HOUSE = scope:leader } + } + if = { + limit = { exists = scope:old_leader } + set_variable = { + name = recent_leader_change + value = scope:old_leader + years = 5 + } + } + hidden_effect = { + every_player = { + limit = { confederation ?= scope:bloc } + send_interface_message = { + type = msg_house_bloc_leader + title = msg_bloc_new_leading_house + desc = msg_bloc_new_leading_house_desc + left_icon = scope:leader.house_head + right_icon = scope:leader + custom_description = { + text = change_house_bloc_leader_effect + subject = scope:leader.house_head + object = scope:old_leader.house_head + } + } + } + } + } + } + } +} + + +## Create historical blocs and add members at game start +# +# root: none +# +tgp_setup_historical_house_bloc_effect = { + ### 867 + if = { + limit = { game_start_date = 867.1.1 } + # Ceremony + dynasty:japanese_fujiwara.dynasty_founder.house ?= { + tgp_create_historical_house_bloc_effect = { TYPE = ceremony } # Northern Fujiwara + # Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_kyo_ke } # Capital Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_nan_ke } # Southern Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_shiki_ke } # Ceremonial Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_yamakage } # Yamakage Fujiwara + # Taira + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_taira_kanmu.dynasty_founder.house } # Kanmu Taira + } + # Service + dynasty:japanese_sugawara.dynasty_founder.house ?= { + tgp_create_historical_house_bloc_effect = { TYPE = service } # Sugawara + # Minamoto + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_minamoto_ninmyo.dynasty_founder.house } # Ninmyo Minamoto + # Other + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_ariwara.dynasty_founder.house } # Ariwara + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_harusumi.dynasty_founder.house } # Harusumi + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_ki.dynasty_founder.house } # Ki + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_kudara.dynasty_founder.house } # Kudara + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_oe.dynasty_founder.house } # Oe + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_shimada.dynasty_founder.house } # Shimada + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_yamato.dynasty_founder.house } # Yamato + } + # Prosperity + dynasty:japanese_minamoto_saga.dynasty_founder.house ?= { + tgp_create_historical_house_bloc_effect = { TYPE = prosperity } # Saga Minamoto + # Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_manatsu } # Manatsu Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_uona } # Uona Fujiwara + # Minamoto + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_minamoto_montoku.dynasty_founder.house } # Montoku Minamoto + # Other + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_kiyohara.dynasty_founder.house } # Kiyohara + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_tachibana.dynasty_founder.house } # Tachibana + } + # Strength + dynasty:japanese_yoshimine.dynasty_founder.house ?= { + tgp_create_historical_house_bloc_effect = { TYPE = strength } # Yoshmine + # Other + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_abe.dynasty_founder.house } # Abe + } + # Humility + dynasty:japanese_onakatomi.dynasty_founder.house ?= { + tgp_create_historical_house_bloc_effect = { TYPE = humility } # Onakatomi + # Other + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_koremune.dynasty_founder.house } # Koremune + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_tomo.dynasty_founder.house } # Tomo + } + } + ### 1066 + else_if = { + limit = { game_start_date = 1066.9.15 } + # Ceremony + dynasty:japanese_fujiwara.dynasty_founder.house ?= { + tgp_create_historical_house_bloc_effect = { TYPE = ceremony } # Northern Fujiwara + # Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_koichijo } # Koichijo Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_manatsu } # Manatsu Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_nakamikado } # Nakamikado Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_nan_ke } # Southern Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_ononomiya } # Ononomiya Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_sesonji } # Sesonji Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_shiki_ke } # Ceremonial Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_yamakage } # Yamakage Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_yoshikado } # Yoshikado Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_yoshiyo } # Yoshiyo Fujiwara + # Other + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_koremune.dynasty_founder.house } # Koremune + } + # Service + dynasty:japanese_minamoto_murakami.dynasty_founder.house ?= { # Murakami Minamoto + tgp_create_historical_house_bloc_effect = { TYPE = service } + # Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_kajuji } # Kajuji + # Minamoto + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_minamoto_daigo.dynasty_founder.house } # Daigo Minamoto + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_minamoto_sanjo.dynasty_founder.house } # Sanjo Minamoto + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_minamoto_uda.dynasty_founder.house } # Uda Minamoto + # Other + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_ki.dynasty_founder.house } # Ki + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_oe.dynasty_founder.house } # Oe + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_sugawara.dynasty_founder.house } # Sugawara + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_takashina.dynasty_founder.house } # Takashina + } + # Strength + house:house_minamoto_kawachi ?= { + tgp_create_historical_house_bloc_effect = { TYPE = strength } # Kawachi Minamoto + # Minamoto + tgp_join_historical_house_bloc_effect = { JOINER = house:house_minamoto_mino } # Mino Minamoto + tgp_join_historical_house_bloc_effect = { JOINER = house:house_minamoto_settsu } # Settsu Minamoto + tgp_join_historical_house_bloc_effect = { JOINER = house:house_minamoto_shinano } # Shinano Minamoto + # Taira + tgp_join_historical_house_bloc_effect = { JOINER = house:house_taira_boso } # Boso Taira + tgp_join_historical_house_bloc_effect = { JOINER = house:house_taira_chichibu } # Chichibu Taira + tgp_join_historical_house_bloc_effect = { JOINER = house:house_taira_hitachi } # Daijo Taira + tgp_join_historical_house_bloc_effect = { JOINER = house:house_taira_miura } # Miura Taira + tgp_join_historical_house_bloc_effect = { JOINER = house:house_taira_iwaki } # Iwaki Taira + } + # Prosperity + dynasty:japanese_kiyohara.dynasty_founder.house ?= { + tgp_create_historical_house_bloc_effect = { TYPE = prosperity } # Kiyohara + # Taira + tgp_join_historical_house_bloc_effect = { JOINER = house:house_taira_echigo } # Echigo Taira + } + # Determination + dynasty:japanese_kikuchi.dynasty_founder.house ?= { + tgp_create_historical_house_bloc_effect = { TYPE = determination } # Kikuchi + # Minamoto + tgp_join_historical_house_bloc_effect = { JOINER = house:house_minamoto_watanabe } # Watanabe Minamoto + # Taira + tgp_join_historical_house_bloc_effect = { JOINER = house:house_taira_satsuma } # Satsuma Taira + # Other + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_abiru.dynasty_founder.house } # Abiru + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_kimotsuki.dynasty_founder.house } # Kimotsuki + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_omiwa.dynasty_founder.house } # Omiwa + } + } + ### 1178 ### + else_if = { + limit = { game_start_date = 1178.10.1 } + # Ceremony + house:house_fujiwara_matsudono = { + tgp_create_historical_house_bloc_effect = { TYPE = ceremony } # Matsudono Fujiwara + # Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_fujiwara.dynasty_founder.house } # Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_hamuro } # Hamuro Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_kajuji } # Kajuji Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_kasannoin } # Kasannoin Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_kujo } # Kujo Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_mikohida } # Mikohida Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_oinomikado } # Oinomikado Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_rokujo } # Rokujo Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_shijo } # Shijo Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_yoshikado } # Yoshikado Fujiwara + # Minamoto + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_minamoto_uda.dynasty_founder.house } # Uda Minamoto + # Taira + tgp_join_historical_house_bloc_effect = { JOINER = house:house_taira_takamune } # Takamune Taira + } + # Determination + dynasty:japanese_taira_kanmu.dynasty_founder.house = { + tgp_create_historical_house_bloc_effect = { TYPE = determination } # Kanmu Taira + # Fujiwara + tgp_join_historical_house_bloc_effect = { JOINER = house:house_fujiwara_ashikaga } # Fujiwara Ashikaga + # Minamoto + tgp_join_historical_house_bloc_effect = { JOINER = house:house_minamoto_hitachi } # Satake Minamoto + # Taira + tgp_join_historical_house_bloc_effect = { JOINER = house:house_taira_echigo } # Jo Taira + tgp_join_historical_house_bloc_effect = { JOINER = house:house_taira_kawagoe } # Kawagoe Taira + tgp_join_historical_house_bloc_effect = { JOINER = house:house_taira_oba } # Oba Taira + # Other + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_ito.dynasty_founder.house } # Ito + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_osada.dynasty_founder.house } # Osada + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_saeki_sanyo.dynasty_founder.house } # Saeki + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_senoo.dynasty_founder.house } # Seno'o + tgp_join_historical_house_bloc_effect = { JOINER = house:house_tachibana_tokai } # Tachibana Tokai + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_taguchi.dynasty_founder.house } # Taguchi + tgp_join_historical_house_bloc_effect = { JOINER = dynasty:japanese_yuasa.dynasty_founder.house } # Yuasa + } + # Strength + house:house_minamoto_settsu ?= { + tgp_create_historical_house_bloc_effect = { TYPE = strength } + # Minamoto + tgp_join_historical_house_bloc_effect = { JOINER = house:house_minamoto_ishikawa } # Ishikawa Minamoto + tgp_join_historical_house_bloc_effect = { JOINER = house:house_minamoto_kai } # Kai Minamoto (Takeda) + tgp_join_historical_house_bloc_effect = { JOINER = house:house_minamoto_kawachi } # Kawachi Minamoto + tgp_join_historical_house_bloc_effect = { JOINER = house:house_minamoto_kiso } # Kiso Minamoto + tgp_join_historical_house_bloc_effect = { JOINER = house:house_minamoto_kozuke } # Kozuke Minamoto (Nitta) + tgp_join_historical_house_bloc_effect = { JOINER = house:house_minamoto_toki } # Toki Minamoto + tgp_join_historical_house_bloc_effect = { JOINER = house:house_minamoto_yamamoto } # Yamamoto Minamoto + tgp_join_historical_house_bloc_effect = { JOINER = house:house_minamoto_yamato } # Yamato Minamoto + # Taira + tgp_join_historical_house_bloc_effect = { JOINER = house:house_taira_chiba } # Chiba Taira + tgp_join_historical_house_bloc_effect = { JOINER = house:house_taira_kazusa } # Kazusa Taira + tgp_join_historical_house_bloc_effect = { JOINER = house:house_taira_miura } # Miura Taira + } + # Prosperity + dynasty:japanese_fujiwara_oshu.dynasty_founder.house = { + tgp_create_historical_house_bloc_effect = { TYPE = prosperity } # Oshu Fujiwara + # Minamoto + tgp_join_historical_house_bloc_effect = { JOINER = house:house_minamoto_oshu_ishikawa } # Oshu Ishikawa Minamoto + } + } + # Fix cooldowns + every_confederation = { + every_confederation_member_house = { remove_variable = recently_joined_bloc } + } +} + + +## Create historical bloc +# +# root: house - initial leader of bloc +# +tgp_create_historical_house_bloc_effect = { + house_head ?= { + save_temporary_scope_as = bloc_creator + if = { + limit = { + is_alive = yes + NOT = { exists = house.house_confederation } + } + if = { + limit = { is_ruler = yes } + house = { + tgp_create_house_bloc_effect = { TYPE = $TYPE$ } + add_to_list = historical_house_bloc_house_list + } + } + } + } + clear_saved_scope = bloc_creator +} + + +## Add a house to this Japanese Bloc +# +# In addition to adding the house (and thereby all eligible rulers in it), +# a friendly relation will be established between the involved houses. +# +# root: the leading house of the bloc +# JOINER: the house to add +# +tgp_join_historical_house_bloc_effect = { + if = { + limit = { exists = house_confederation } + save_temporary_scope_as = leader_temp + house_confederation = { save_temporary_scope_as = historical_bloc_temp } + $JOINER$ = { save_temporary_scope_as = joiner_temp } + scope:joiner_temp ?= { + if = { + limit = { + exists = house_head + NOT = { exists = house_confederation } + exists = scope:leader_temp + exists = scope:historical_bloc_temp + } + scope:historical_bloc_temp = { add_confederation_member_house = scope:joiner_temp } + scope:leader_temp = { + tgp_set_historical_house_relation_effect = { + OTHER_HOUSE = scope:joiner_temp + LEVEL = cordial + } + } + if = { + limit = { NOT = { exists = scope:joiner_temp.house_confederation } } + assert_if = { + limit = { always = yes } + text = "tgp_join_historical_house_bloc_effect: joiner did not join!" + } + debug_log = "tgp_join_historical_house_bloc_effect: joiner did not join!" + } + } + } + clear_saved_scope = leader_temp + clear_saved_scope = historical_bloc_temp + clear_saved_scope = joiner_temp + } +} + +tgp_on_member_joined_shared_effect = { + save_scope_as = bloc + scope:character = { + save_scope_as = joiner + add_character_flag = { + flag = bloc_message_flag + days = 1 + } + trigger_event = { + id = tgp_house_blocs.0002 + days = 1 + } + # JOIN LEADERS FACTION + if = { + limit = { + scope:bloc.leading_house.house_head.joined_faction.faction_leader ?= scope:bloc.leading_house.house_head + can_join_faction = scope:bloc.leading_house.house_head.joined_faction + } + join_faction = scope:bloc.leading_house.house_head.joined_faction + } + } + # Message setup + scope:bloc = { + add_to_variable_list = { + name = joining_house_members + target = scope:joiner + days = 1 + } + } +} + +tgp_on_member_left_shared_effect = { + save_scope_as = bloc + scope:character = { + save_scope_as = leaver + if = { + limit = { is_alive = yes } + add_character_flag = { + flag = bloc_message_flag + days = 1 + } + } + # Clear flags + tgp_clear_house_bloc_flags_effect = yes + trigger_event = { + id = tgp_house_blocs.0001 + days = 1 + } + # LEAVE LEADERS FACTION + joined_faction ?= { + save_temporary_scope_as = faction_temp + if = { + limit = { + faction_leader = { + NOT = { house = scope:character.house } + } + } + scope:vassal_house_temp = { leave_faction = scope:faction_temp } + } + } + } + # Message setup + scope:bloc = { + add_to_variable_list = { + name = leaving_house_members + target = scope:leaver + days = 1 + } + } +} + +tgp_on_member_house_joined_shared_effect = { + save_scope_as = bloc + scope:house ?= { + save_scope_as = joiner + set_variable = { + name = recently_joined_bloc + years = 5 + } + } + # MESSAGES + every_player = { + limit = { house.house_confederation ?= scope:bloc } + if = { + limit = { + house = scope:bloc.leading_house + scope:bloc = { + any_confederation_member_house = { count = 2 } + } + } + send_interface_message = { + type = msg_house_bloc_created + title = msg_house_bloc_created + desc = msg_house_bloc_created_desc + left_icon = scope:bloc.leading_house.house_head + right_icon = scope:bloc.leading_house + custom_description = { + text = create_house_bloc_effect + subject = scope:bloc.leading_house.house_head + } + } + } + else = { + send_interface_message = { + type = msg_house_joined_house_bloc + title = msg_house_joined_bloc + desc = msg_house_joined_bloc_desc + left_icon = scope:joiner + right_icon = scope:bloc.leading_house + custom_description = { + text = join_house_bloc_effect + subject = scope:joiner.house_head + object = scope:bloc.leading_house.house_head + } + # MEMBER LIST TOOLTIP + #show_as_tooltip = { + # scope:bloc = { + # every_in_list = { + # variable = joining_house_members + # limit = { house = scope:joiner } + # custom = house_joined_bloc_member_custom + # custom_tooltip = house_bloc_member_tt + # } + # } + #} + } + } + } + every_in_list = { + variable = joining_house_members + limit = { house = scope:joiner } + save_temporary_scope_as = house_member_temp + remove_character_flag = bloc_message_flag + scope:bloc = { + remove_list_variable = { + name = joining_house_members + target = scope:house_member_temp + } + } + # Find Sub-Vassal houses of joining Vassal Houses + if = { + limit = { + house.house_head = { is_independent_ruler = no } + } + every_vassal_or_below = { + limit = { + is_house_head = yes + any_held_title = { is_noble_family_title = yes } + is_independent_ruler = no + house = { + NOR = { + this = scope:house + house_confederation ?= scope:bloc + is_in_list = joining_vassal_houses + } + } + } + house = { add_to_list = joining_vassal_houses } + } + } + } + every_in_list = { + list = joining_vassal_houses + save_temporary_scope_as = vassal_house_temp + scope:bloc = { add_confederation_member_house = scope:vassal_house_temp } + } + if = { + limit = { debug_only = yes } + debug_log = "house joined bloc" + debug_log_scopes = yes + } +} + +tgp_on_member_house_left_shared_effect = { + save_scope_as = bloc + scope:house = { + save_scope_as = leaver + if = { + limit = { has_variable = recently_joined_bloc } + remove_variable = recently_joined_bloc + } + house_head ?= { + save_scope_as = house_head + } + } + # MESSAGES + every_player = { + limit = { + OR = { + house = scope:house + confederation ?= scope:bloc + } + } + # Inform Members of Leavers + send_interface_toast = { + type = msg_house_left_house_bloc + title = msg_house_left_bloc + desc = msg_house_left_bloc_desc + left_icon = scope:leaver + right_icon = scope:bloc.leading_house + custom_tooltip = msg_house_left_bloc_desc + # MEMBER LIST TOOLTIP + #show_as_tooltip = { + # scope:bloc = { + # every_in_list = { + # variable = leaving_house_members + # limit = { house = scope:leaver } + # #custom = house_left_bloc_member_custom + # custom_tooltip = house_bloc_member_tt + # } + # } + #} + } + } + every_in_list = { + variable = leaving_house_members + limit = { house = scope:leaver } + save_temporary_scope_as = house_member_temp + if = { + limit = { is_alive = yes } + remove_character_flag = bloc_message_flag + } + scope:bloc = { + remove_list_variable = { + name = leaving_house_members + target = scope:house_member_temp + } + } + # Find sub-Vassal houses of leaving vassal Houses + if = { + limit = { + house.house_head = { is_independent_ruler = no } + } + scope:bloc = { + every_confederation_member_house = { + limit = { + house_head = { + is_independent_ruler = no + liege.house ?= scope:house + } + NOR = { + this = scope:house + is_in_list = leaving_vassal_houses + } + } + add_to_list = leaving_vassal_houses + } + } + } + } + # Find leader if necessary + if = { + limit = { NOT = { exists = leading_house } } + if = { + limit = { + any_confederation_member = { has_title = title:e_japan } + } + random_confederation_member = { + limit = { has_title = title:e_japan } + save_scope_as = new_leader_scope + } + tgp_set_house_bloc_leading_house_effect = { LEADER = scope:new_leader_scope } + } + else = { + tgp_find_new_house_bloc_leader_effect = yes + } + } + # Remove Vassal houses of leaving Houses from above + every_in_list = { + list = leaving_vassal_houses + save_temporary_scope_as = vassal_house_temp + scope:bloc = { remove_confederation_member_house = scope:vassal_house_temp } + } + # Disband if necessary + if = { + limit = { + OR = { + NOT = { exists = leading_house } + any_confederation_member_house = { count = 1 } + } + } + every_player = { + limit = { + house.house_confederation ?= scope:bloc + NOT = { house = scope:leaver } + } + send_interface_message = { + type = msg_house_bloc_disbanded + title = msg_house_bloc_disbanded + desc = msg_house_bloc_disbanded_desc + left_icon = scope:leaver.house_head + right_icon = scope:leaver + show_as_tooltip = { + scope:bloc ?= { disband_confederation = yes } + } + } + } + hidden_effect = { disband_confederation = yes } + } + if = { + limit = { debug_only = yes } + debug_log = "house left bloc" + debug_log_scopes = yes + } +} + +bloc_leader_change_aspiration_cohesion_effect = { + if = { + limit = { exists = scope:house.house_confederation } + if = { + limit = { scope:house.house_confederation.leading_house ?= scope:house } + scope:house.house_confederation = { + tgp_bloc_change_cohesion_effect = { + VALUE = bloc_leader_change_aspiration_cohesion_value + ICON = scope:house.house_head + REASON = leader_aspiration + } + } + } + else_if = { + limit = { + scope:house = { has_same_house_power_as = scope:house.house_confederation.leading_house } + } + # Message + every_player = { + limit = { house.house_confederation ?= scope:house.house_confederation } + send_interface_message = { + type = msg_house_bloc_cohesion_change_good + title = msg_bloc_member_aspiration_changed + left_icon = scope:house.house_head + right_icon = scope:house + desc = msg_bloc_member_aspiration_changed_tt + custom_tooltip = msg_bloc_member_aspiration_match_tt + } + } + } + else = { + # Message + every_player = { + limit = { house.house_confederation ?= scope:house.house_confederation } + send_interface_message = { + type = msg_house_bloc_cohesion_change_bad + title = msg_bloc_member_aspiration_changed + left_icon = scope:house.house_head + right_icon = scope:house + desc = msg_bloc_member_aspiration_changed_tt + custom_tooltip = msg_bloc_member_aspiration_diverge_tt + } + } + } + } +} + +add_attacker_bloc_members_on_declared_effect = { + scope:attacker.house.house_confederation ?= { + every_confederation_member_house = { + every_house_member = { + limit = { + top_liege = scope:attacker.top_liege + is_landed = yes + } + save_temporary_scope_as = bloc_member_temp + scope:war = { add_attacker = scope:bloc_member_temp } + } + } + } +} + +tgp_bloc_war_defeat_member_effect = { + $WINNER$ = { + save_temporary_scope_as = winner_temp + house.house_confederation = { save_temporary_scope_as = winner_bloc_temp } + } + $LOSER$ = { + save_temporary_scope_as = loser_temp + house.house_confederation = { save_temporary_scope_as = loser_bloc_temp } + } + custom_description_no_bullet = { text = tgp_bloc_war_defeat_member_description } + scope:loser_bloc_temp = { + every_confederation_member_house = { + limit = { + house_head = { + tgp_bloc_war_transfer_trigger = { BLOC_LEADER = scope:loser_temp } + } + } + custom_description_no_bullet = { + text = tgp_bloc_war_defeat_member_house_description + subject = house_head + } + hidden_effect = { + if = { # LEAVE OLD BLOC IF NECESSARY + limit = { exists = house_confederation } + set_variable = { + name = bloc_leaving_reason + value = flag:reason_war + days = 4 + } + tgp_leave_house_bloc_effect = { + OPINION = flag:no + TRUCE = flag:yes + } + tgp_join_house_bloc_effect = { + INVITER = scope:winner_temp.house + OPINION = flag:no + } + } + } + } + } +} + +tgp_bloc_change_cohesion_effect = { + save_temporary_scope_as = bloc_temp + $ICON$ = { save_scope_as = icon } + save_scope_value_as = { + name = cohesion_change + value = $VALUE$ + } + hidden_effect = { + if = { + limit = { scope:cohesion_change >= 0 } + every_player = { + limit = { house.house_confederation ?= scope:bloc_temp } + send_interface_message = { + type = msg_house_bloc_cohesion_change_good + title = msg_bloc_cohesion_increased + left_icon = scope:icon + right_icon = scope:bloc_temp.leading_house + desc = tgp_bloc_change_cohesion_$REASON$_tt + show_as_tooltip = { + scope:bloc_temp = { change_cohesion = scope:cohesion_change } + } + } + } + } + else = { + every_player = { + limit = { house.house_confederation ?= scope:bloc_temp } + send_interface_message = { + type = msg_house_bloc_cohesion_change_bad + title = msg_bloc_cohesion_decreased + left_icon = scope:icon + right_icon = scope:bloc_temp.leading_house + desc = tgp_bloc_change_cohesion_$REASON$_tt + show_as_tooltip = { + scope:bloc_temp = { change_cohesion = scope:cohesion_change } + } + } + } + } + } + change_cohesion = scope:cohesion_change +} + +tgp_bloc_set_leading_house_effect = { + $HOUSE$ = { save_scope_as = bloc_creator } + set_leading_house = scope:bloc_creator + set_coa = scope:bloc_creator + set_confederation_name = "CONFEDERATION_HOUSE_NAME" +} + +tgp_on_bloc_destroyed_shared_effect = { + save_scope_as = bloc + every_confederation_member_house = { add_to_list = members } + leading_house = { save_scope_as = leader } + every_player = { + limit = { top_liege = scope:bloc.leading_house.house_head.top_liege } + if = { + limit = { + house = { is_in_list = members } + } + send_interface_message = { + type = msg_house_bloc_destroyed + title = msg_house_bloc_disbanded + desc = msg_house_bloc_disbanded_desc + left_icon = scope:bloc.leading_house.house_head + right_icon = scope:bloc.leading_house + house = { save_temporary_scope_as = player_house_temp } + show_as_tooltip = { + scope:bloc = { + remove_confederation_member_house = scope:player_house_temp + disband_confederation = yes + } + } + } + } + else = { + send_interface_message = { + type = msg_house_bloc_disbanded + title = msg_house_bloc_disbanded + desc = msg_house_bloc_disbanded_desc + left_icon = scope:bloc.leading_house.house_head + right_icon = scope:bloc.leading_house + show_as_tooltip = { + scope:bloc = { disband_confederation = yes } + } + } + } + } + if = { + limit = { debug_only = yes } + debug_log = "bloc destroyed" + debug_log_scopes = yes + } +} + +set_cadet_aspiration_cooldown_effect = { + hidden_effect = { + save_temporary_scope_as = house_temp + scope:old_house.house_confederation.leading_house = { + switch = { + trigger = has_house_power_parameter + ceremony_cheaper_feasts = { + scope:house_temp = { set_house_aspiration = { type = ceremony } } + } + unlocks_japanese_manor_watch_house = { + scope:house_temp = { set_house_aspiration = { type = determination } } + } + unlocks_japanese_manor_shrine = { + scope:house_temp = { set_house_aspiration = { type = humility } } + } + unlocks_japanese_manor_brewery = { + scope:house_temp = { set_house_aspiration = { type = prosperity } } + } + unlocks_japanese_manor_archive = { + scope:house_temp = { set_house_aspiration = { type = service } } + } + unlocks_japanese_manor_armory = { + scope:house_temp = { set_house_aspiration = { type = strength } } + } + } + } + if = { + limit = { house_head = { is_ai = yes } } + set_variable = { + name = recently_changed_aspiration + years = 5 + } + } + } +} + +tgp_save_bloc_leaving_reason_effect = { + if = { + limit = { NOT = { has_variable = bloc_leaving_reason } } + if = { + limit = { scope:joiner.house_head ?= { is_ai = no } } + set_variable = { + name = bloc_leaving_reason + value = flag:reason_player + days = 4 + } + } + else = { + if = { + limit = { NOT = { exists = scope:inviter } } + scope:leaver = { save_scope_as = inviter } #If there is no bloc join, we compare to the inviter + } + if = { + limit = { exists = scope:joiner_temp.confederation.leading_house.house_head } + scope:joiner_temp.confederation.leading_house.house_head = { save_scope_as = prev_bloc_leader } + if = { # PRESTIGE LEVEL + limit = { + OR = { + scope:leaver.prestige_level > scope:prev_bloc_leader.prestige_level + scope:inviter.prestige_level > scope:prev_bloc_leader.prestige_level + } + } + set_variable = { + name = bloc_leaving_reason + value = flag:reason_prestige + days = 4 + } + } + else_if = { # INFLUENCE LEVEL + limit = { + OR = { + scope:leaver.influence_level > scope:prev_bloc_leader.influence_level + scope:inviter.influence_level > scope:prev_bloc_leader.influence_level + } + } + set_variable = { + name = bloc_leaving_reason + value = flag:reason_influence + days = 4 + } + } + else_if = { # MILITARY POWER + limit = { + OR = { + scope:leaver.military_power > scope:prev_bloc_leader.military_power + scope:inviter.military_power > scope:prev_bloc_leader.military_power + } + } + set_variable = { + name = bloc_leaving_reason + value = flag:reason_military_strength + days = 4 + } + } + else_if = { # INVITER OPINION + limit = { + scope:leaver != scope:inviter + scope:leaver = { + opinion = { + target = scope:inviter + value >= 40 + } + } + } + set_variable = { + name = bloc_leaving_reason + value = flag:reason_inviter_bloc_opinion + days = 4 + } + } + else_if = { # PREV LEADER OPINION + limit = { + scope:leaver = { + opinion = { + target = scope:prev_bloc_leader + value < 0 + } + } + } + set_variable = { + name = bloc_leaving_reason + value = flag:reason_current_bloc_opinion + days = 4 + } + } + else_if = { # DYNASTY + limit = { + scope:leaver != scope:inviter + scope:leaver.dynasty = scope:inviter.dynasty + } + set_variable = { + name = bloc_leaving_reason + value = flag:reason_dynasty + days = 4 + } + } + else_if = { # ASPIRATIONS + limit = { + NOT = { + scope:leaver.house = { has_same_house_power_as = scope:prev_bloc_leader.house } + } + } + set_variable = { + name = bloc_leaving_reason + value = flag:reason_aspirations + days = 4 + } + } + else_if = { # COHESION + limit = { scope:joiner_temp.house.house_confederation ?= { cohesion <= 25 } } + set_variable = { + name = bloc_leaving_reason + value = flag:reason_cohesion + days = 4 + } + } + } + } + } +} diff --git a/N3OW/common/scripted_effects/10_dlc_tgp_house_relation_scripted_effects.txt b/N3OW/common/scripted_effects/10_dlc_tgp_house_relation_scripted_effects.txt new file mode 100644 index 00000000..ace92ec6 --- /dev/null +++ b/N3OW/common/scripted_effects/10_dlc_tgp_house_relation_scripted_effects.txt @@ -0,0 +1,561 @@ +### HOUSE RELATION SCRIPTED EFFECTS + +set_house_relation_level_effect = { + save_scope_as = house + $HOUSE$ ?= { save_scope_as = other_house } + if = { + limit = { + exists = scope:house + exists = scope:other_house + scope:house != scope:other_house + } + set_house_relation = { + target = scope:other_house + level = $LEVEL$ + description = house_relation_reason_$REASON$_desc + save_scope_as = house_relation + } + } +} + +increase_house_relation_level_effect = { + save_scope_as = house + $HOUSE$ ?= { save_scope_as = other_house } + if = { + limit = { + exists = house + exists = scope:other_house + scope:house != scope:other_house + } + if = { + limit = { has_house_relation_with = scope:other_house } + random_house_relation = { + limit = { + any_relation_house = { scope:other_house = this } + } + save_scope_as = house_relation + if = { + limit = { has_house_relation_level = feud } + scope:house = { + set_house_relation_level_effect = { + HOUSE = scope:other_house + REASON = $REASON$ + LEVEL = rivalry + } + } + } + else_if = { + limit = { has_house_relation_level = rivalry } + scope:house = { + set_house_relation_level_effect = { + HOUSE = scope:other_house + REASON = $REASON$ + LEVEL = quarrel + } + } + } + else_if = { + limit = { has_house_relation_level = quarrel } + scope:house = { + set_house_relation_level_effect = { + HOUSE = scope:other_house + REASON = $REASON$ + LEVEL = neutral + } + } + } + else_if = { + limit = { has_house_relation_level = neutral } + scope:house = { + set_house_relation_level_effect = { + HOUSE = scope:other_house + REASON = $REASON$ + LEVEL = cordial + } + } + } + else_if = { + limit = { has_house_relation_level = cordial } + scope:house = { + set_house_relation_level_effect = { + HOUSE = scope:other_house + REASON = $REASON$ + LEVEL = friendly + } + } + } + else_if = { + limit = { has_house_relation_level = friendly } + scope:house = { + set_house_relation_level_effect = { + HOUSE = scope:other_house + REASON = $REASON$ + LEVEL = amity + } + } + } + } + } + else = { + set_house_relation_level_effect = { + HOUSE = scope:other_house + REASON = $REASON$ + LEVEL = cordial + } + random_house_relation = { + limit = { any_relation_house = { this = scope:other_house } } + save_scope_as = house_relation + } + } + } +} + +decrease_house_relation_level_effect = { + save_scope_as = house + $HOUSE$ ?= { save_scope_as = other_house } + scope:house ?= { + if = { + limit = { + exists = scope:other_house + scope:other_house != this + } + if = { + limit = { has_house_relation_with = scope:other_house } + random_house_relation = { + limit = { + any_relation_house = { scope:other_house = this } + } + save_scope_as = house_relation + if = { + limit = { has_house_relation_level = amity } + scope:house = { + set_house_relation_level_effect = { + HOUSE = scope:other_house + REASON = $REASON$ + LEVEL = friendly + } + } + } + else_if = { + limit = { has_house_relation_level = friendly } + scope:house = { + set_house_relation_level_effect = { + HOUSE = scope:other_house + REASON = $REASON$ + LEVEL = cordial + } + } + } + else_if = { + limit = { has_house_relation_level = cordial } + scope:house = { + set_house_relation_level_effect = { + HOUSE = scope:other_house + REASON = $REASON$ + LEVEL = neutral + } + } + } + else_if = { + limit = { has_house_relation_level = neutral } + scope:house = { + set_house_relation_level_effect = { + HOUSE = scope:other_house + REASON = $REASON$ + LEVEL = quarrel + } + } + } + else_if = { + limit = { has_house_relation_level = quarrel } + scope:house = { + set_house_relation_level_effect = { + HOUSE = scope:other_house + REASON = $REASON$ + LEVEL = rivalry + } + } + } + else_if = { + limit = { has_house_relation_level = rivalry } + scope:house = { + set_house_relation_level_effect = { + HOUSE = scope:other_house + REASON = $REASON$ + LEVEL = feud + } + } + } + } + } + else = { + set_house_relation_level_effect = { + HOUSE = scope:other_house + REASON = $REASON$ + LEVEL = quarrel + } + random_house_relation = { + limit = { any_relation_house = { this = scope:other_house } } + save_scope_as = house_relation + } + } + } + } +} + +# Effect for incrementing towards a level change - used actual gameplay effects, e.g. war declarations +# Required parameters: HOUSE, CHAR, TARGET_CHAR, TITLE, VALUE, REASON +change_house_relation_effect = { + # SAVE USEFUL SCOPES + save_scope_as = house + $HOUSE$ ?= { save_scope_as = other_house } + $CHAR$ ?= { save_scope_as = char } + $TARGET_CHAR$ ?= { save_scope_as = target_char } + $TITLE$ ?= { save_scope_as = title } + if = { + limit = { + exists = scope:house + exists = scope:other_house + scope:house != scope:other_house + } + save_scope_value_as = { + name = steps + value = $VALUE$ + } + # IF A HOUSE RELATION ALREADY EXISTS, MODIFY IT + if = { + limit = { + scope:house = { + any_house_relation = { + any_relation_house = { scope:other_house = this } + # EASIER TO JUMP VIA TEMP SCOPE + save_temporary_scope_as = relation_temp + } + } + } + scope:relation_temp = { save_scope_as = house_relation } + if = { + limit = { + house_relation_is_valid_to_keep_trigger = { + HOUSE = scope:house + OTHER_HOUSE = scope:other_house + } + } + scope:relation_temp = { + if = { + limit = { + scope:steps < 0 + NOT = { has_house_relation_level = feud } # already at min + } + change_house_relation_level = { + steps = scope:steps + description = house_relation_reason_$REASON$_desc + } + } + else_if = { + limit = { + NOT = { has_house_relation_level = amity } # already at max + } + change_house_relation_level = { + steps = scope:steps + description = house_relation_reason_$REASON$_desc + } + } + } + # INFORM PLAYERS OF CHANGE + every_player = { + limit = { + OR = { + house ?= scope:house + house ?= scope:other_house + } + } + house = { save_temporary_scope_as = house_temp } + scope:house_relation = { + random_relation_house = { + limit = { NOT = { this = scope:house_temp } } + save_temporary_scope_as = other_house_temp + } + } + } + } + else = { + scope:relation_temp = { save_scope_as = house_relation } + # INFORM PLAYERS OF CHANGE + every_player = { + limit = { + OR = { + house ?= scope:house + house ?= scope:other_house + } + } + house = { save_temporary_scope_as = house_temp } + scope:house_relation = { + random_relation_house = { + limit = { NOT = { this = scope:house_temp } } + save_temporary_scope_as = other_house_temp + } + } + send_interface_toast = { + type = msg_house_relation_cleared + title = house_relation_cleared_message_title + desc = house_relation_cleared_message_desc + left_icon = scope:house_temp + right_icon = scope:other_house_temp + } + } + scope:house_relation = { clear_house_relation = yes } + } + } + # OTHERWISE, SET STARTING + else_if = { + limit = { + house_relation_is_valid_to_start_trigger = { + HOUSE = scope:house + OTHER_HOUSE = scope:other_house + } + } + scope:house = { + if = { + limit = { scope:steps < 0 } + set_house_relation_level_effect = { + HOUSE = scope:other_house + REASON = $REASON$ + LEVEL = quarrel + } + } + else = { + set_house_relation_level_effect = { + HOUSE = scope:other_house + REASON = $REASON$ + LEVEL = cordial + } + } + } + } + } +} + +change_house_relation_feud_score_effect = { + save_scope_as = house + $TARGET$ ?= { save_scope_as = other_house } + random_house_relation = { + limit = { + has_bp1_dlc_trigger = yes + has_house_relation_level = feud + any_relation_house = { scope:other_house ?= this } + } + save_scope_as = relation + if = { + limit = { + exists = var:house_feud_house_1 + exists = var:house_feud_house_2 + exists = var:house_feud_house_1_score + exists = var:house_feud_house_2_score + } + if = { + limit = { var:house_feud_house_1 = scope:house } + change_variable = { name = house_feud_house_1_score add = $VALUE$ } + } + else = { + change_variable = { name = house_feud_house_2_score add = $VALUE$ } + } + } + else = { + set_variable = { name = house_feud_house_1 value = scope:house } + set_variable = { name = house_feud_house_2 value = scope:other_house } + set_variable = { name = house_feud_house_1_score value = $VALUE$ } + set_variable = { name = house_feud_house_2_score value = 0 } + } + hidden_effect = { + scope:house ?= { + every_house_member = { + limit = { is_ai = no } + send_interface_message = { + type = house_feud_$REASON$_good_message + left_icon = scope:house.house_head + right_icon = scope:other_house.house_head + if = { + limit = { $VALUE$ >= house_feud_major_counter_value } + custom_tooltip = house_feud_tipped_scales_pos_big + } + else_if = { + limit = { $VALUE$ >= house_feud_medium_counter_value } + custom_tooltip = house_feud_tipped_scales_pos_medium + } + else = { custom_tooltip = house_feud_tipped_scales_pos_small } + } + } + } + scope:other_house ?= { + every_house_member = { + limit = { is_ai = no } + send_interface_message = { + type = house_feud_$REASON$_bad_message + left_icon = scope:house.house_head + right_icon = scope:other_house.house_head + if = { + limit = { $VALUE$ >= house_feud_major_counter_value } + custom_tooltip = house_feud_tipped_scales_neg_big + } + else_if = { + limit = { $VALUE$ >= house_feud_medium_counter_value } + custom_tooltip = house_feud_tipped_scales_neg_medium + } + else = { custom_tooltip = house_feud_tipped_scales_neg_small } + } + } + } + } + } +} + +# Save targeting Feud scope for reference +save_ongoing_house_relation_effect = { + house ?= { + random_house_relation = { + limit = { + any_relation_house = { $TARGET$.house ?= this } + } + save_scope_as = relation + } + } +} + +# Promoting someone not of the same noble family as the current heir (with active investment) +promote_appointment_house_relation_effect = { + $TITLE$ ?= { save_temporary_scope_as = title_temp } + $CANDIDATE$ ?= { save_temporary_scope_as = candidate_temp } + $INVESTOR$ ?= { save_temporary_scope_as = investor_temp } + if = { # DAMAGE WITH CURRENT HEIR + limit = { + scope:investor_temp.house.house_head = { + # Investor belongs to a noble family + any_held_title = { is_noble_family_title = yes } + } + scope:title_temp = { + current_heir ?= { + # Heir has been invested in + has_succession_appointment_investors = $TITLE$ + # Candidate is not the heir + NOT = { scope:candidate_temp ?= this } + house ?= { + NOR = { # HEIR IS NOT FROM CANDIDATE OR INVESTOR HOUSES + scope:candidate_temp.house ?= this + scope:investor_temp.house ?= this + } + house_head ?= { + # HEIR HOUSE HEAD IN SAME REALM AS INVESTOR + scope:investor_temp.top_liege ?= top_liege + # HEIR HOUSE IS A NOBLE FAMILY + any_held_title = { is_noble_family_title = yes } + # SAME REALM AS HEIR + top_liege = scope:title_temp.current_heir.top_liege + # SAME REALM AS INVESTOR + top_liege = scope:investor_temp.top_liege + } + } + } + # CANDIDATE IS ACTUALLY MUSCLING IN + place_in_line_of_succession = { + target = scope:candidate_temp + value <= 5 + } + } + } + scope:investor_temp.house = { + change_house_relation_effect = { + HOUSE = scope:title_temp.current_heir.house + VALUE = house_relation_damage_minor_value + REASON = appointment_competition + CHAR = scope:investor_temp + TARGET_CHAR = scope:title_temp.current_heir + TITLE = scope:title_temp + } + } + } + if = { # IMPROVE WITH CANDIDATE + limit = { + scope:investor_temp.house ?= { + # Investor is of a different house than the candidate + NOT = { scope:candidate_temp.house ?= this } + house_head ?= { + # Investor in same realm as candidate + top_liege = scope:candidate_temp.house.house_head.top_liege + # Investor belongs to a noble family + any_held_title = { is_noble_family_title = yes } + } + } + scope:candidate_temp ?= { + # Candidate in same realm as their house head + top_liege = scope:candidate_temp.house.house_head.top_liege + # Candidate belongs to a noble family + house.house_head ?= { + any_held_title = { is_noble_family_title = yes } + # SAME REALM + top_liege = scope:investor_temp.top_liege + } + # Candidate has been invested in + has_succession_appointment_investors = scope:title_temp + } + scope:title_temp = { + # Not promoting another member of the house that is already winning the succession + NOT = { current_heir.house ?= scope:candidate_temp.house } + # Candidate has a good chance + place_in_line_of_succession = { + target = scope:candidate_temp + value <= 3 + } + } + } + scope:investor_temp.house = { + change_house_relation_effect = { + HOUSE = scope:candidate_temp.house + VALUE = house_relation_improve_minor_value + REASON = appointment_support + CHAR = scope:investor_temp + TARGET_CHAR = scope:candidate_temp + TITLE = scope:title_temp + } + } + } +} + +# Damaging an invested candidate of another noble family +damage_appointment_house_relation_effect = { + $TITLE$ ?= { save_temporary_scope_as = title_temp } + $CANDIDATE$ ?= { save_temporary_scope_as = candidate_temp } + $INVESTOR$ ?= { save_temporary_scope_as = investor_temp } + if = { + limit = { + scope:candidate_temp ?= { + NOT = { this = scope:investor_temp } + house ?= { + house_head ?= { + top_liege = scope:investor_temp.top_liege + any_held_title = { is_noble_family_title = yes } + } + NOT = { scope:investor_temp.house ?= this } + } + has_succession_appointment_investors = scope:title_temp + } + # CANDIDATE IS ACTUALLY MUSCLING IN + scope:title_temp = { + place_in_line_of_succession = { + target = scope:candidate_temp + value <= 5 + } + } + } + scope:investor_temp.house = { + change_house_relation_effect = { + HOUSE = scope:candidate_temp.house + VALUE = house_relation_damage_minor_value + REASON = appointment_competition + CHAR = scope:investor_temp + TARGET_CHAR = scope:candidate_temp + TITLE = scope:title_temp + } + } + } +} diff --git a/N3OW/common/scripted_effects/10_dlc_tgp_japan_scripted_effects.txt b/N3OW/common/scripted_effects/10_dlc_tgp_japan_scripted_effects.txt new file mode 100644 index 00000000..4dcd425d --- /dev/null +++ b/N3OW/common/scripted_effects/10_dlc_tgp_japan_scripted_effects.txt @@ -0,0 +1,3794 @@ +japan_establish_house_fief_effect = { + save_scope_as = house_fiefer + save_scope_as = new_head + # Dynasty + if = { + limit = { tgp_japan_cadet_creates_dynasty_trigger = yes } + if = { + limit = { exists = var:new_japanese_house_name } + create_dynasty = { + name = { + first_valid = { + triggered_desc = { + trigger = { scope:new_head.var:new_japanese_house_name ?= flag:japanese_house_random_barony } + desc = japanese_house_random_barony + } + triggered_desc = { + trigger = { scope:new_head.var:new_japanese_house_name ?= flag:japanese_house_primary_county } + desc = japanese_house_primary_county + } + triggered_desc = { + trigger = { scope:new_head.var:new_japanese_house_name ?= flag:japanese_house_domicile_barony } + desc = japanese_house_domicile_barony + } + triggered_desc = { + trigger = { scope:new_head.var:new_japanese_house_name ?= flag:japanese_house_domicile_county } + desc = japanese_house_domicile_county + } + triggered_desc = { + trigger = { scope:new_head.var:new_japanese_house_name ?= flag:japanese_house_first_name } + desc = japanese_house_first_name + } + triggered_desc = { + trigger = { scope:new_head.var:new_japanese_house_name ?= flag:custom } + desc = japanese_house_name_custom + } + desc = japanese_house_name_flag + } + } + save_scope_as = new_dynasty + } + } + else = { + create_dynasty = { save_scope_as = new_dynasty } + } + house = { + set_house_name = japanese_dynasty_name + save_scope_as = new_house + } + } + # House + else_if = { + limit = { is_house_head = no } + if = { + limit = { exists = var:new_japanese_house_name } + found_cadet_house_decision_effect = { + CHARACTER = root + PRESTIGE = 0 + } + house = { save_scope_as = new_house } + } + else = { + create_cadet_branch = { save_scope_as = new_house } + } + } + # Government + change_government = japan_feudal_government + # Old Dynasty + if = { + limit = { exists = scope:new_house } + # Rename old NF title + if = { + limit = { + scope:old_head ?= this + exists = scope:old_nf_title + } + #scope:old_nf_title = { set_title_name_dynamic = japanese_noble_family_name } + } + else = { + create_noble_family_effect = { GOVERNMENT_GIVER = this } + scope:new_title = { + #set_title_name_dynamic = japanese_noble_family_name + set_coa = scope:new_house + } + } + # Upset old Clan Head + scope:old_head ?= { + if = { + limit = { is_ai = yes } + add_opinion = { + modifier = established_house_fief_old_clan_head_opinion + target = root + } + } + trigger_event = tgp_japan_decision.9005 + } + } + # Crime to Regent + top_liege ?= { + if = { + limit = { + scope:new_head = { + is_landed = yes + NOR = { + var:petition_liege_house_fief_allowed_flag ?= scope:new_head.top_liege + top_liege = { + government_has_flag = government_is_japan_feudal + } + } + } + } + show_as_tooltip = { + add_opinion = { + modifier = established_house_fief_regent_crime + target = scope:new_head + } + } + hidden_effect = { + send_interface_message = { + type = event_toast_effect_bad + title = tgp_japan_establish_house_fief_kampaku_toast + left_icon = scope:new_head + right_icon = scope:new_head.primary_title + show_as_tooltip = { + scope:new_head = { change_government = japan_feudal_government } + } + add_opinion = { + modifier = established_house_fief_regent_crime + target = scope:new_head + } + } + } + } + } + create_character_memory = { type = establish_house_fief_memory } + ordered_memory = { + memory_type = establish_house_fief_memory + order_by = memory_creation_date + set_variable = { + name = title + value = root.primary_title + } + } + add_achievement_flag_effect = { FLAG = achievement_a_house_of_my_own_flag } +} + +set_house_of_all_descendants_effect = { + if = { + limit = { any_child = { count >= 1 } } + every_child = { # Children + limit = { house ?= $OLD_HOUSE$ } + set_house = $NEW_HOUSE$ + every_child = { # Grandchildren + limit = { house ?= $OLD_HOUSE$ } + set_house = $NEW_HOUSE$ + every_child = { # Great-grandchildren + limit = { house ?= $OLD_HOUSE$ } + set_house = $NEW_HOUSE$ + every_child = { # Great-grandchildren + limit = { house ?= $OLD_HOUSE$ } + set_house = $NEW_HOUSE$ + } + } + } + } + } +} + +japan_set_house_effect = { + house = { save_scope_as = old_house } + $NEW_HOUSE$ = { save_scope_as = new_house } + set_house = scope:new_house + custom_tooltip = { + text = tgp_japan_establish_house_fief_direct_descendents_effect + if = { + limit = { exists = $NEW_HOUSE$ } + set_house_of_all_descendants_effect = { + OLD_HOUSE = scope:old_house + NEW_HOUSE = scope:new_house + } + } + } +} + +japan_dynasty_tracker_setup_effect = { + # FUJIWARA + dynasty:japanese_fujiwara ?= { add_to_list = fujiwara_list } + dynasty:japanese_fujiwara_oshu ?= { add_to_list = fujiwara_list } + every_in_list = { + list = fujiwara_list + set_variable = { name = fujiwara_flag } + } + # MINAMOTO + dynasty:japanese_minamoto_daigo ?= { add_to_list = minamoto_list } + dynasty:japanese_minamoto_kazan ?= { add_to_list = minamoto_list } + dynasty:japanese_minamoto_koko ?= { add_to_list = minamoto_list } + dynasty:japanese_minamoto_gosanjo ?= { add_to_list = minamoto_list } + dynasty:japanese_minamoto_montoku ?= { add_to_list = minamoto_list } + dynasty:japanese_minamoto_murakami ?= { add_to_list = minamoto_list } + dynasty:japanese_minamoto_ninmyo ?= { add_to_list = minamoto_list } + dynasty:japanese_minamoto_saga ?= { add_to_list = minamoto_list } + dynasty:japanese_minamoto_sanjo ?= { add_to_list = minamoto_list } + dynasty:japanese_minamoto_seiwa ?= { add_to_list = minamoto_list } + dynasty:japanese_minamoto_uda ?= { add_to_list = minamoto_list } + dynasty:japanese_minamoto_yozei ?= { add_to_list = minamoto_list } + every_in_list = { + list = minamoto_list + set_variable = { name = minamoto_flag } + #dynasty_founder.house ?= { set_house_name = "dynn_Minamoto" } # For easier parsing of house names + } + # TAIRA + dynasty:japanese_taira_kanmu ?= { add_to_list = taira_list } + dynasty:japanese_taira_koko ?= { add_to_list = taira_list } + dynasty:japanese_taira_montoku ?= { add_to_list = taira_list } + dynasty:japanese_taira_ninmyo ?= { add_to_list = taira_list } + every_in_list = { + list = taira_list + set_variable = { name = taira_flag } + #dynasty_founder.house ?= { set_house_name = "dynn_Taira" } # For easier parsing of house names + } +} + +fill_external_japanese_manor_building_effect = { + switch = { + trigger = has_domicile_building_or_higher + japanese_manor_main_05 = { + while = { + limit = { free_external_domicile_building_slots >= 1 } + add_random_external_estate_building = yes + } + } + japanese_manor_main_04 = { + while = { + limit = { free_external_domicile_building_slots >= 2 } + add_random_external_japanese_manor_building = yes + } + } + japanese_manor_main_03 = { + while = { + limit = { free_external_domicile_building_slots >= 3 } + add_random_external_japanese_manor_building = yes + } + } + japanese_manor_main_02 = { + while = { + limit = { free_external_domicile_building_slots >= 4 } + add_random_external_japanese_manor_building = yes + } + } + japanese_manor_main_01 = { + while = { + limit = { free_external_domicile_building_slots >= 5 } + add_random_external_japanese_manor_building = yes + } + } + } +} + +add_random_external_japanese_manor_building = { + if = { + limit = { free_external_domicile_building_slots >= 1 } + random_list = { + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = japanese_fields_01 } + } + add_domicile_building = japanese_fields_01 + if = { + limit = { + has_domicile_building_or_higher = japanese_fields_01 + has_domicile_building_or_higher = japanese_manor_main_03 + } + add_domicile_building = japanese_fields_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = japanese_shrine_01 } + owner.house = { has_house_power_parameter = unlocks_japanese_manor_shrine } + } + add_domicile_building = japanese_shrine_01 + if = { + limit = { + has_domicile_building_or_higher = japanese_shrine_01 + has_domicile_building_or_higher = japanese_manor_main_03 + } + add_domicile_building = japanese_shrine_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = japanese_brewery_01 } + owner.house = { has_house_power_parameter = unlocks_japanese_manor_brewery } + } + add_domicile_building = japanese_brewery_01 + if = { + limit = { + has_domicile_building_or_higher = japanese_brewery_01 + has_domicile_building_or_higher = japanese_manor_main_03 + } + add_domicile_building = japanese_brewery_02 + } + } + 10 = { + trigger = { + owner = { government_has_flag = government_is_administrative } + NOT = { has_domicile_building_or_higher = japanese_archive_01 } + owner.house = { has_house_power_parameter = unlocks_japanese_manor_archive } + } + add_domicile_building = japanese_archive_01 + if = { + limit = { + has_domicile_building_or_higher = japanese_archive_01 + has_domicile_building_or_higher = japanese_manor_main_03 + } + add_domicile_building = japanese_archive_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = japanese_armory_01 } + owner.house = { has_house_power_parameter = unlocks_japanese_manor_armory } + } + add_domicile_building = japanese_armory_01 + if = { + limit = { + has_domicile_building_or_higher = japanese_armory_01 + has_domicile_building_or_higher = japanese_manor_main_03 + } + add_domicile_building = japanese_armory_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = japanese_watch_house_01 } + owner.house = { has_house_power_parameter = unlocks_japanese_manor_watch_house } + } + add_domicile_building = japanese_watch_house_01 + if = { + limit = { + has_domicile_building_or_higher = japanese_watch_house_01 + has_domicile_building_or_higher = japanese_manor_main_03 + } + add_domicile_building = japanese_watch_house_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = japanese_horse_pastures_01 } + } + add_domicile_building = japanese_horse_pastures_01 + if = { + limit = { + has_domicile_building_or_higher = japanese_horse_pastures_01 + has_domicile_building_or_higher = japanese_manor_main_03 + } + add_domicile_building = japanese_horse_pastures_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = japanese_tea_plantation_01 } + } + add_domicile_building = japanese_tea_plantation_01 + if = { + limit = { + has_domicile_building_or_higher = japanese_tea_plantation_01 + has_domicile_building_or_higher = japanese_manor_main_03 + } + add_domicile_building = japanese_tea_plantation_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = japanese_stables_01 } + } + add_domicile_building = japanese_stables_01 + if = { + limit = { + has_domicile_building_or_higher = japanese_stables_01 + has_domicile_building_or_higher = japanese_manor_main_03 + } + add_domicile_building = japanese_stables_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = japanese_workshop_01 } + } + add_domicile_building = japanese_workshop_01 + if = { + limit = { + has_domicile_building_or_higher = japanese_workshop_01 + has_domicile_building_or_higher = japanese_manor_main_03 + } + add_domicile_building = japanese_workshop_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = japanese_tea_house_01 } + owner.house = { has_house_power_parameter = unlocks_japanese_manor_tea_house } + } + add_domicile_building = japanese_tea_house_01 + if = { + limit = { + has_domicile_building_or_higher = japanese_tea_house_01 + has_domicile_building_or_higher = japanese_manor_main_03 + } + add_domicile_building = japanese_tea_house_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = japanese_garden_01 } + } + add_domicile_building = japanese_garden_01 + if = { + limit = { + has_domicile_building_or_higher = japanese_garden_01 + has_domicile_building_or_higher = japanese_manor_main_03 + } + add_domicile_building = japanese_garden_02 + } + } + } + } +} + +add_random_internal_japanese_manor_building = { + random_list = { + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = japanese_main_tax_collectors_01 } + } + add_domicile_building = japanese_main_tax_collectors_01 + if = { + limit = { has_domicile_building = japanese_manor_main_03 } + add_domicile_building = japanese_main_tax_collectors_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = japanese_main_carpenter_01 } + } + add_domicile_building = japanese_main_carpenter_01 + if = { + limit = { has_domicile_building = japanese_manor_main_03 } + add_domicile_building = japanese_main_carpenter_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = sarugaku_stage_01 } + } + add_domicile_building = sarugaku_stage_01 + if = { + limit = { has_domicile_building = japanese_manor_main_03 } + add_domicile_building = sarugaku_stage_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = japanese_manor_office_01 } + } + add_domicile_building = japanese_manor_office_01 + if = { + limit = { has_domicile_building = japanese_manor_main_03 } + add_domicile_building = japanese_manor_office_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = japanese_manor_servants_quarters_01 } + } + add_domicile_building = japanese_manor_servants_quarters_01 + if = { + limit = { has_domicile_building = japanese_manor_main_03 } + add_domicile_building = japanese_manor_servants_quarters_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = japanese_manor_library_confucian_01 } + } + add_domicile_building = japanese_manor_library_confucian_01 + if = { + limit = { has_domicile_building = japanese_manor_main_03 } + add_domicile_building = japanese_manor_library_confucian_02 + } + } + } +} + +japan_clear_flavour_flags_effect = { + remove_global_variable = shogunate_established + remove_global_variable = tenno_restored + remove_character_flag = shogun_flag + remove_character_flag = ceremonial_liege_flag + remove_character_flag = joko_flag +} + +japanese_become_shogun_reward_effect = { + # Setup + japan_clear_flavour_flags_effect = yes + set_global_variable = { + name = shogunate_established + value = yes + } + add_character_flag = shogun_flag + + # Rewards + if = { + limit = { has_dlc_feature = legends } + create_legend_seed = { + type = legitimizing + quality = illustrious + chronicle = great_deed_dynasty + properties = { + dynasty = root.dynasty + founder = root + title = primary_title + } + } + } + add_dread = massive_dread_gain + add_legitimacy = monumental_legitimacy_gain + dynasty = { add_dynasty_prestige = monumental_dynasty_prestige_gain } + culture = { + if = { + limit = { has_cultural_tradition = tradition_tgp_imperial_peace } + custom_tooltip = { + text = tradition_tgp_bushido_tt + remove_culture_tradition = tradition_tgp_imperial_peace + add_culture_tradition = tradition_tgp_bushido + } + } + else = { custom_tooltip = unlocks_bushido_tradition_tooltip } + } + every_vassal = { + custom = every_japan_admin_vassal_custom_bullet + limit = { + government_has_flag = government_is_japan_administrative + } + show_as_tooltip = { change_government = japan_feudal_government } + } +} + +restore_ceremonial_liege_faction_reward_effect = { + top_liege = { save_temporary_scope_as = regent_temp } + top_liege.primary_title = { + save_temporary_scope_as = realm_temp + var:administrative_ui_special_title.holder = { save_temporary_scope_as = ceremonial_liege_temp } + } + # GLOBAL VAR + if = { + limit = { top_liege.primary_title = title:e_japan } + japan_clear_flavour_flags_effect = yes + set_global_variable = { + name = tenno_restored + value = yes + } + } + # TRANSFER TITLES + scope:regent_temp = { + every_held_title = { + title_tier > barony + limit = { + is_landless_type_title = no + } + add_to_list = target_titles + } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = change + add_claim_on_loss = yes + } + every_in_list = { + list = target_titles + change_title_holder_include_vassals = { + holder = scope:ceremonial_liege_temp + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + scope:ceremonial_liege_temp = { + if = { + limit = { has_legitimacy = yes } + add_legitimacy = major_legitimacy_gain + } + add_realm_law_skip_effects = single_heir_succession_law + } +} + +restore_ceremonial_liege_faction_reward_and_titles_effect = { + restore_ceremonial_liege_faction_reward_effect = yes + create_title_and_vassal_change = { + type = appointment + save_scope_as = title_change + add_claim_on_loss = no + } + show_as_tooltip = { + scope:realm_temp = { # Give top liege title to the Emperor + change_title_holder_include_vassals = { + holder = scope:ceremonial_liege_temp + change = scope:title_change + } + } + } + hidden_effect = { + scope:realm_temp.holder ?= { + every_held_title = { + limit = { + is_landless_type_title = no + is_noble_family_title = no + } + change_title_holder_include_vassals = { + holder = scope:ceremonial_liege_temp + change = scope:title_change + } + } + } + } + resolve_title_and_vassal_change = scope:title_change +} + +assign_japanese_house_name_options_effect = { + random_list = { + ### AKI + ### AKITA (NUSHIRO) + 1 = { # OKAWA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_O_kawa TITLE = title:c_nushiro } } + japanese_new_house_name_modifiers = { TITLE = title:c_nushiro } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_O_kawa } + } + 1 = { # YURI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Yuri TITLE = title:c_nushiro } } + japanese_new_house_name_modifiers = { TITLE = title:c_nushiro } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Yuri } + } + ### AWA + 1 = { # MIYOSHI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Miyoshi TITLE = title:c_awa } } + japanese_new_house_name_modifiers = { TITLE = title:c_awa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Miyoshi } + } + 1 = { # TAGUCHI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Taguchi TITLE = title:c_awa } } + japanese_new_house_name_modifiers = { TITLE = title:c_awa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Taguchi } + } + ### BINGO + 1 = { # OTA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_O_ta TITLE = title:c_bingo } } + japanese_new_house_name_modifiers = { TITLE = title:c_bingo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_O_ta } + } + ### BITCHU + 1 = { # SENOO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Seno_o TITLE = title:c_bitchu } } + japanese_new_house_name_modifiers = { TITLE = title:c_bitchu } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Seno_o } + } + ### BIZEN + 1 = { # NAMBA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Namba TITLE = title:c_bizen } } + japanese_new_house_name_modifiers = { TITLE = title:c_bizen } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Namba } + } + ### BUNGO + 1 = { # ANAMI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Anami TITLE = title:c_bungo } } + japanese_new_house_name_modifiers = { TITLE = title:c_bungo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Anami } + } + 1 = { # HONDA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Honda TITLE = title:c_bungo } } + japanese_new_house_name_modifiers = { TITLE = title:c_bungo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Honda } + } + 1 = { # MITAI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Mitai TITLE = title:c_bungo } } + japanese_new_house_name_modifiers = { TITLE = title:c_bungo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Mitai } + } + 1 = { # OGATA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Ogata TITLE = title:c_bungo } } + japanese_new_house_name_modifiers = { TITLE = title:c_bungo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Ogata } + } + 1 = { # ONO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_O_no TITLE = title:c_bungo } } + japanese_new_house_name_modifiers = { TITLE = title:c_bungo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_O_no } + } + 1 = { # SHIGA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Shiga TITLE = title:c_bungo } } + japanese_new_house_name_modifiers = { TITLE = title:c_bungo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Shiga } + } + 1 = { # WASADA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Wasada TITLE = title:c_bungo } } + japanese_new_house_name_modifiers = { TITLE = title:c_bungo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Wasada } + } + 1 = { # USUKI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Usuki TITLE = title:c_bungo } } + japanese_new_house_name_modifiers = { TITLE = title:c_bungo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Usuki } + } + ### BUZEN + 1 = { # YAMAGA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Yamaga TITLE = title:c_buzen } } + japanese_new_house_name_modifiers = { TITLE = title:c_buzen } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Yamaga } + } + ### CHIKUGO + 1 = { # KAMACHI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kamachi TITLE = title:c_chikugo } } + japanese_new_house_name_modifiers = { TITLE = title:c_chikugo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kamachi } + } + ### CHIKUZEN + 1 = { # AKIZUKI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Akizuki TITLE = title:c_chikugo } } + japanese_new_house_name_modifiers = { TITLE = title:c_chikugo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Akizuki } + } + 1 = { # HARADA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Harada TITLE = title:c_chikugo } } + japanese_new_house_name_modifiers = { TITLE = title:c_chikugo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Harada } + } + ### DEWA (TOKISARA) + 1 = { # SAGAE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Sagae TITLE = title:c_tokisara } } + japanese_new_house_name_modifiers = { TITLE = title:c_tokisara } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Sagae } + } + ### ECHIGO + 1 = { # HANJO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kanazu TITLE = title:c_echigo } } + japanese_new_house_name_modifiers = { TITLE = title:c_echigo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kanazu } + } + 1 = { # IROBE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Irobe TITLE = title:c_echigo } } + japanese_new_house_name_modifiers = { TITLE = title:c_echigo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Irobe } + } + 1 = { # KAJI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kaji TITLE = title:c_echigo } } + japanese_new_house_name_modifiers = { TITLE = title:c_echigo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kaji } + } + 1 = { # KANAZU + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kanazu TITLE = title:c_echigo } } + japanese_new_house_name_modifiers = { TITLE = title:c_echigo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kanazu } + } + 1 = { # NAKAJO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_NakajO_ TITLE = title:c_echigo } } + japanese_new_house_name_modifiers = { TITLE = title:c_echigo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_NakajO_ } + } + 1 = { # OGUNI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Oguni TITLE = title:c_echigo } } + japanese_new_house_name_modifiers = { TITLE = title:c_echigo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Oguni } + } + 1 = { # SADO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Sado TITLE = title:c_echigo } } + japanese_new_house_name_modifiers = { TITLE = title:c_echigo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Sado } + } + 1 = { # YASUDA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Yasuda TITLE = title:c_echigo } } + japanese_new_house_name_modifiers = { TITLE = title:c_echigo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Yasuda } + } + ### ECHIZEN + 1 = { # AKATSUKA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Akatsuka TITLE = title:c_echizen } } + japanese_new_house_name_modifiers = { TITLE = title:c_echizen } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Akatsuka } + } + 1 = { # ICHIJI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Ichiji TITLE = title:c_echizen } } + japanese_new_house_name_modifiers = { TITLE = title:c_echizen } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Ichiji } + } + 1 = { # MIKATA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Mikata TITLE = title:c_echizen } } + japanese_new_house_name_modifiers = { TITLE = title:c_echizen } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Mikata } + } + 1 = { # ODA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Oda TITLE = title:c_echizen } } + japanese_new_house_name_modifiers = { TITLE = title:c_echizen } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Oda } + } + 1 = { # NANJO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_NanjO_ TITLE = title:c_echizen } } + japanese_new_house_name_modifiers = { TITLE = title:c_echizen } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_NanjO_ } + } + 1 = { # TSUTSUMI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Tsutsumi TITLE = title:c_echizen } } + japanese_new_house_name_modifiers = { TITLE = title:c_echizen } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Tsutsumi } + } + ### ETCHU + ### HARIMA + 1 = { # AKAMATSU + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Akamatsu TITLE = title:c_harima } } + japanese_new_house_name_modifiers = { TITLE = title:c_harima } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Akamatsu } + } + 1 = { # BESSHO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Bessho TITLE = title:c_harima } } + japanese_new_house_name_modifiers = { TITLE = title:c_harima } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Bessho } + } + 1 = { # URAKAMI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Urakami TITLE = title:c_harima } } + japanese_new_house_name_modifiers = { TITLE = title:c_harima } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Urakami } + } + ### HIDA + 1 = { # USHIMARU + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Ushimaru TITLE = title:c_hida } } + japanese_new_house_name_modifiers = { TITLE = title:c_hida } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Ushimaru } + } + ### HIGO + 1 = { # ASO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Aso TITLE = title:c_higo } } + japanese_new_house_name_modifiers = { TITLE = title:c_higo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Aso } + } + 1 = { # KIKUCHI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kikuchi TITLE = title:c_higo } } + japanese_new_house_name_modifiers = { TITLE = title:c_higo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kikuchi } + } + 1 = { # KUMABE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kumabe TITLE = title:c_higo } } + japanese_new_house_name_modifiers = { TITLE = title:c_higo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kumabe } + } + 1 = { # TAKEZAKI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Takezaki TITLE = title:c_higo } } + japanese_new_house_name_modifiers = { TITLE = title:c_higo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Takezaki } + } + ### HITACHI + 1 = { # AKASU + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Akasu TITLE = title:c_hitachi } } + japanese_new_house_name_modifiers = { TITLE = title:c_hitachi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Akasu } + } + 1 = { # ASABA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Asaba TITLE = title:c_hitachi } } + japanese_new_house_name_modifiers = { TITLE = title:c_hitachi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Asaba } + } + 1 = { # HATTA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Hatta TITLE = title:c_hitachi } } + japanese_new_house_name_modifiers = { TITLE = title:c_hitachi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Hatta } + } + 1 = { # ISA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Isa TITLE = title:c_hitachi } } + japanese_new_house_name_modifiers = { TITLE = title:c_hitachi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Isa } + } + 1 = { # KATAOKA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kataoka TITLE = title:c_hitachi } } + japanese_new_house_name_modifiers = { TITLE = title:c_hitachi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kataoka } + } + 1 = { # MIMURA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Mimura TITLE = title:c_hitachi } } + japanese_new_house_name_modifiers = { TITLE = title:c_hitachi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Mimura } + } + 1 = { # NAMEKATA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Namekata TITLE = title:c_hitachi } } + japanese_new_house_name_modifiers = { TITLE = title:c_hitachi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Namekata } + } + 1 = { # NEMOTO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Nemoto TITLE = title:c_hitachi } } + japanese_new_house_name_modifiers = { TITLE = title:c_hitachi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Nemoto } + } + 1 = { # NISSAI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Nissai TITLE = title:c_hitachi } } + japanese_new_house_name_modifiers = { TITLE = title:c_hitachi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Nissai } + } + 1 = { # ONOZAKI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Onozaki TITLE = title:c_hitachi } } + japanese_new_house_name_modifiers = { TITLE = title:c_hitachi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Onozaki } + } + 1 = { # SATAKE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Satake TITLE = title:c_hitachi } } + japanese_new_house_name_modifiers = { TITLE = title:c_hitachi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Satake } + } + 1 = { # SHIDA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Shida TITLE = title:c_hitachi } } + japanese_new_house_name_modifiers = { TITLE = title:c_hitachi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Shida } + } + 1 = { # TAKEDA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Takeda TITLE = title:c_hitachi } } + japanese_new_house_name_modifiers = { TITLE = title:c_hitachi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Takeda } + } + 1 = { # TOMURA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Tomura TITLE = title:c_hitachi } } + japanese_new_house_name_modifiers = { TITLE = title:c_hitachi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Tomura } + } + ### HIZEN + 1 = { # MATSURA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Matsura TITLE = title:c_hizen } } + japanese_new_house_name_modifiers = { TITLE = title:c_hizen } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Matsura } + } + 1 = { # YASUTOMI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Yasutomi TITLE = title:c_hizen } } + japanese_new_house_name_modifiers = { TITLE = title:c_hizen } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Yasutomi } + } + ### HOKI + ### HYUGA + ### INABA + 1 = { # HIKIDA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Hikida TITLE = title:c_inaba } } + japanese_new_house_name_modifiers = { TITLE = title:c_inaba } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Hikida } + } + 1 = { # SAJI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Saji TITLE = title:c_inaba } } + japanese_new_house_name_modifiers = { TITLE = title:c_inaba } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Saji } + } + ### ISAWA + 1 = { # SHIBA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Shiba TITLE = title:c_isawa } } + japanese_new_house_name_modifiers = { TITLE = title:c_isawa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Shiba } + } + ### ISE + 1 = { # HATTORI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Hattori TITLE = title:c_yamato } } + japanese_new_house_name_modifiers = { TITLE = title:c_yamato } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Hattori } + } + 1 = { # IGA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Iga TITLE = title:c_ise } } + japanese_new_house_name_modifiers = { TITLE = title:c_ise } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Iga } + } + 1 = { # ITO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_ItO_ TITLE = title:c_izu } } + japanese_new_house_name_modifiers = { TITLE = title:c_izu } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_ItO_ } + } + 1 = { # KANBE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kanbe TITLE = title:c_ise } } + japanese_new_house_name_modifiers = { TITLE = title:c_ise } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kanbe } + } + 1 = { # KUKI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kuki TITLE = title:c_ise } } + japanese_new_house_name_modifiers = { TITLE = title:c_ise } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kuki } + } + 1 = { # SEKI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Seki TITLE = title:c_ise } } + japanese_new_house_name_modifiers = { TITLE = title:c_ise } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Seki } + } + 1 = { # SHIMA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Shima TITLE = title:c_ise } } + japanese_new_house_name_modifiers = { TITLE = title:c_ise } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Shima } + } + ### IWAKI + 1 = { # TAMURA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Tamura TITLE = title:c_iwaki } } + japanese_new_house_name_modifiers = { TITLE = title:c_iwaki } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Tamura } + } + 1 = { # WATARI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Watari TITLE = title:c_iwaki } } + japanese_new_house_name_modifiers = { TITLE = title:c_iwaki } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Watari } + } + ### IWASHIRO + 1 = { # DATE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Date TITLE = title:c_iwase } } + japanese_new_house_name_modifiers = { TITLE = title:c_iwase } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Date } + } + 1 = { # SUGIME + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Sugime TITLE = title:c_iwase } } + japanese_new_house_name_modifiers = { TITLE = title:c_iwase } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Sugime } + } + ### IWASE + 1 = { # ASAKA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Asaka TITLE = title:c_iwase } } + japanese_new_house_name_modifiers = { TITLE = title:c_iwase } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Asaka } + } + ### IYO + 1 = { # KONO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kono TITLE = title:c_iyo } } + japanese_new_house_name_modifiers = { TITLE = title:c_iyo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kono } + } + ### IZU + 1 = { # AKAZAWA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Akazawa TITLE = title:c_izu } } + japanese_new_house_name_modifiers = { TITLE = title:c_izu } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Akazawa } + } + 1 = { # AMANO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Amano TITLE = title:c_izu } } + japanese_new_house_name_modifiers = { TITLE = title:c_izu } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Amano } + } + 1 = { # EMA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Ema TITLE = title:c_izu } } + japanese_new_house_name_modifiers = { TITLE = title:c_izu } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Ema } + } + 1 = { # HOJO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_HO_jO_ TITLE = title:c_izu } } + japanese_new_house_name_modifiers = { TITLE = title:c_izu } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_HO_jO_ } + } + 1 = { # ITO 2 + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_ItO__2 TITLE = title:c_izu } } + japanese_new_house_name_modifiers = { TITLE = title:c_izu } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_ItO__2 } + } + 1 = { # KANO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kano TITLE = title:c_izu } } + japanese_new_house_name_modifiers = { TITLE = title:c_izu } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kano } + } + 1 = { # KAWAZU + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kawazu TITLE = title:c_izu } } + japanese_new_house_name_modifiers = { TITLE = title:c_izu } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kawazu } + } + 1 = { # OMI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_O_mi TITLE = title:c_izu } } + japanese_new_house_name_modifiers = { TITLE = title:c_izu } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_O_mi } + } + 1 = { # TASHIRO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Tashiro TITLE = title:c_izu } } + japanese_new_house_name_modifiers = { TITLE = title:c_izu } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Tashiro } + } + 1 = { # USAMI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Usami TITLE = title:c_izu } } + japanese_new_house_name_modifiers = { TITLE = title:c_izu } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Usami } + } + ### IWAMI + 1 = { # MASUDA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Masuda TITLE = title:c_iwami } } + japanese_new_house_name_modifiers = { TITLE = title:c_iwami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Masuda } + } + ### IZUMO + 1 = { # MISAWA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Misawa TITLE = title:c_izumo } } + japanese_new_house_name_modifiers = { TITLE = title:c_izumo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Misawa } + } + 1 = { # MITOYA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Mitoya TITLE = title:c_izumo } } + japanese_new_house_name_modifiers = { TITLE = title:c_izumo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Mitoya } + } + 1 = { # NOGI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Nogi TITLE = title:c_izumo } } + japanese_new_house_name_modifiers = { TITLE = title:c_izumo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Nogi } + } + ### KAGA + 1 = { # KUMASAKA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kumasaka TITLE = title:c_kaga } } + japanese_new_house_name_modifiers = { TITLE = title:c_kaga } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kumasaka } + } + 1 = { # TOGASHI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Togashi TITLE = title:c_kaga } } + japanese_new_house_name_modifiers = { TITLE = title:c_kaga } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Togashi } + } + ### KAI + 1 = { # AKIYAMA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Akiyama TITLE = title:c_kai } } + japanese_new_house_name_modifiers = { TITLE = title:c_kai } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Akiyama } + } + 1 = { # ASARI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Asari TITLE = title:c_kai } } + japanese_new_house_name_modifiers = { TITLE = title:c_kai } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Asari } + } + 1 = { # ICHIJO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_IchijO_ TITLE = title:c_kai } } + japanese_new_house_name_modifiers = { TITLE = title:c_kai } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_IchijO_ } + } + 1 = { # ITSUMI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Henmi TITLE = title:c_kai } } + japanese_new_house_name_modifiers = { TITLE = title:c_kai } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Henmi } + } + 1 = { # KAGAMI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kagami TITLE = title:c_kai } } + japanese_new_house_name_modifiers = { TITLE = title:c_kai } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kagami } + } + 1 = { # NANBU + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Nanbu TITLE = title:c_kai } } + japanese_new_house_name_modifiers = { TITLE = title:c_kai } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Nanbu } + } + 1 = { # OGASAWARA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Ogasawara TITLE = title:c_kai } } + japanese_new_house_name_modifiers = { TITLE = title:c_kai } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Ogasawara } + } + ### KAWACHI + 1 = { # IZUMI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Izumi TITLE = title:c_kawachi } } + japanese_new_house_name_modifiers = { TITLE = title:c_kawachi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Izumi } + } + 1 = { # TAKAYASU + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Takayasu TITLE = title:c_kawachi } } + japanese_new_house_name_modifiers = { TITLE = title:c_kawachi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Takayasu } + } + ### KAZUSA + 1 = { # ANZAI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Anzai TITLE = title:c_kazusa } } + japanese_new_house_name_modifiers = { TITLE = title:c_kazusa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Anzai } + } + 1 = { # HANYU 2 + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_HanyU__2 TITLE = title:c_kazusa } } + japanese_new_house_name_modifiers = { TITLE = title:c_kazusa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_HanyU__2 } + } + 1 = { # INTO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_IntO_ TITLE = title:c_kazusa } } + japanese_new_house_name_modifiers = { TITLE = title:c_kazusa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_IntO_ } + } + 1 = { # KANEDA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kaneda TITLE = title:c_kazusa } } + japanese_new_house_name_modifiers = { TITLE = title:c_kazusa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kaneda } + } + 1 = { # NAGASA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Nagasa TITLE = title:c_awa } } + japanese_new_house_name_modifiers = { TITLE = title:c_awa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Nagasa } + } + 1 = { # OBU + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Obu TITLE = title:c_kazusa } } + japanese_new_house_name_modifiers = { TITLE = title:c_kazusa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Obu } + } + 1 = { # SAKUMA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Sakuma TITLE = title:c_kazusa } } + japanese_new_house_name_modifiers = { TITLE = title:c_kazusa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Sakuma } + } + ### KII + 1 = { # AKATA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Akata TITLE = title:c_kii } } + japanese_new_house_name_modifiers = { TITLE = title:c_kii } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Akata } + } + 1 = { # ITOGA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Itoga TITLE = title:c_kii } } + japanese_new_house_name_modifiers = { TITLE = title:c_kii } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Itoga } + } + 1 = { # HOZUMI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Hozumi TITLE = title:c_kii } } + japanese_new_house_name_modifiers = { TITLE = title:c_kii } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Hozumi } + } + 1 = { # SHINGU + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_ShingU_ TITLE = title:c_kii } } + japanese_new_house_name_modifiers = { TITLE = title:c_kii } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_ShingU_ } + } + 1 = { # SUZUKI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Suzuki TITLE = title:c_kii } } + japanese_new_house_name_modifiers = { TITLE = title:c_kii } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Suzuki } + } + 1 = { # UI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Ui TITLE = title:c_kii } } + japanese_new_house_name_modifiers = { TITLE = title:c_kii } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Ui } + } + 1 = { # YAMAMOTO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Yamamoto TITLE = title:c_kii } } + japanese_new_house_name_modifiers = { TITLE = title:c_kii } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Yamamoto } + } + 1 = { # YUASA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Yuasa TITLE = title:c_kii } } + japanese_new_house_name_modifiers = { TITLE = title:c_kii } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Yuasa } + } + ### KOZUKE + 1 = { # AKAHORI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Akahori TITLE = title:c_kozuke } } + japanese_new_house_name_modifiers = { TITLE = title:c_kozuke } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Akahori } + } + 1 = { # AOYAMA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Aoyama TITLE = title:c_kozuke } } + japanese_new_house_name_modifiers = { TITLE = title:c_kozuke } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Aoyama } + } + 1 = { # IWAMATSU + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Iwamatsu TITLE = title:c_kozuke } } + japanese_new_house_name_modifiers = { TITLE = title:c_kozuke } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Iwamatsu } + } + 1 = { # JINBO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Jinbo TITLE = title:c_kozuke } } + japanese_new_house_name_modifiers = { TITLE = title:c_kozuke } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Jinbo } + } + 1 = { # MOMONOI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Momonoi TITLE = title:c_kozuke } } + japanese_new_house_name_modifiers = { TITLE = title:c_kozuke } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Momonoi } + } + 1 = { # NITTA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Nitta TITLE = title:c_kozuke } } + japanese_new_house_name_modifiers = { TITLE = title:c_kozuke } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Nitta } + } + 1 = { # OBATA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Obata TITLE = title:c_kozuke } } + japanese_new_house_name_modifiers = { TITLE = title:c_kozuke } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Obata } + } + 1 = { # SATOMI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Satomi TITLE = title:c_mino } } + japanese_new_house_name_modifiers = { TITLE = title:c_mino } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Satomi } + } + 1 = { # TOKUGAWA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Tokugawa TITLE = title:c_kozuke } } + japanese_new_house_name_modifiers = { TITLE = title:c_kozuke } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Tokugawa } + } + 1 = { # YAMANA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Yamana TITLE = title:c_kozuke } } + japanese_new_house_name_modifiers = { TITLE = title:c_kozuke } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Yamana } + } + ### MIKAWA + 1 = { # ASUKE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Asuke TITLE = title:c_mikawa } } + japanese_new_house_name_modifiers = { TITLE = title:c_mikawa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Asuke } + } + 1 = { # HOSOKAWA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Hosokawa TITLE = title:c_mikawa } } + japanese_new_house_name_modifiers = { TITLE = title:c_mikawa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Hosokawa } + } + 1 = { # IMAGAWA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Imagawa TITLE = title:c_mikawa } } + japanese_new_house_name_modifiers = { TITLE = title:c_mikawa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Imagawa } + } + 1 = { # ISSHIKI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Isshiki TITLE = title:c_higo } } + japanese_new_house_name_modifiers = { TITLE = title:c_higo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Isshiki } + } + 1 = { # KIRA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kira TITLE = title:c_mikawa } } + japanese_new_house_name_modifiers = { TITLE = title:c_mikawa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kira } + } + 1 = { # MAKINO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Makino TITLE = title:c_mikawa } } + japanese_new_house_name_modifiers = { TITLE = title:c_mikawa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Makino } + } + 1 = { # MATSUDAIRA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Matsudaira TITLE = title:c_mikawa } } + japanese_new_house_name_modifiers = { TITLE = title:c_mikawa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Matsudaira } + } + 1 = { # NIKI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Niki TITLE = title:c_mikawa } } + japanese_new_house_name_modifiers = { TITLE = title:c_mikawa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Niki } + } + ### MIMASAKA + 1 = { # KATSUTA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Katsuta TITLE = title:c_mimasaka } } + japanese_new_house_name_modifiers = { TITLE = title:c_mimasaka } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Katsuta } + } + 1 = { # SHINMEN + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Shinmen TITLE = title:c_mimasaka } } + japanese_new_house_name_modifiers = { TITLE = title:c_mimasaka } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Shinmen } + } + ### MINO + 1 = { # ASANO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Asano TITLE = title:c_mino } } + japanese_new_house_name_modifiers = { TITLE = title:c_mino } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Asano } + } + 1 = { # FUKUSHIMA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Fukushima TITLE = title:c_mino } } + japanese_new_house_name_modifiers = { TITLE = title:c_mino } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Fukushima } + } + 1 = { # IKEDA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Ikeda TITLE = title:c_mino } } + japanese_new_house_name_modifiers = { TITLE = title:c_mino } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Ikeda } + } + 1 = { # KIDA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kida TITLE = title:c_mino } } + japanese_new_house_name_modifiers = { TITLE = title:c_mino } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kida } + } + 1 = { # TOKI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Toki_JP TITLE = title:c_mino } } + japanese_new_house_name_modifiers = { TITLE = title:c_mino } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Toki_JP } + } + 1 = { # TOYOYAMA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Toyoyama TITLE = title:c_mino } } + japanese_new_house_name_modifiers = { TITLE = title:c_mino } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Toyoyama } + } + ### MUSASHI + 1 = { # ADACHI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Adachi TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Adachi } + } + 1 = { # ASAMI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Asami TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Asami } + } + 1 = { # CHICHIBU + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Chichibu TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Chichibu } + } + 1 = { # INAGE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Inage TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Inage } + } + 1 = { # INOMATA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Inomata TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Inomata } + } + 1 = { # KANEKO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kaneko TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kaneko } + } + 1 = { # KASAI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kasai TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kasai } + } + 1 = { # KASUKABE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kasukabe TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kasukabe } + } + 1 = { # KAWAGOE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kawagoe TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kawagoe } + } + 1 = { # KAWASAKI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kawasaki TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kawasaki } + } + 1 = { # KUMAGAI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kumagai TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kumagai } + } + 1 = { # HATAKEYAMA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Hatakeyama TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Hatakeyama } + } + 1 = { # HIKI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Hiki TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Hiki } + } + 1 = { # HIRUKAWA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Hirukawa TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Hirukawa } + } + 1 = { # INAZAWA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Inazawa TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Inazawa } + } + 1 = { # MOKUSAI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Mokusai TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Mokusai } + } + 1 = { # MURAYAMA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Murayama TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Murayama } + } + 1 = { # NARITA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Narita TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Narita } + } + 1 = { # NOMOTO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Nomoto TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Nomoto } + } + 1 = { # NOYO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Noyo TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Noyo } + } + 1 = { # OI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_O_i TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_O_i } + } + 1 = { # OYAMADA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Oyamada TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Oyamada } + } + 1 = { # TOSHIMA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Toshima TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Toshima } + } + 1 = { # SHINAGAWA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Shinagawa TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Shinagawa } + } + 1 = { # USHIODA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Ushioda TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Ushioda } + } + 1 = { # YOKOYAMA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Yokoyama TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Yokoyama } + } + 1 = { # YOMODA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Yomoda TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Yomoda } + } + ### NAGATO + ### NOTO + 1 = { # TOKUDA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Tokuda TITLE = title:c_noto } } + japanese_new_house_name_modifiers = { TITLE = title:c_noto } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Tokuda } + } + ### OKI + ### OMI + 1 = { # AMAGO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Amago TITLE = title:c_omi } } + japanese_new_house_name_modifiers = { TITLE = title:c_omi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Amago } + } + 1 = { # AMENOMORI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Amenomori TITLE = title:c_omi } } + japanese_new_house_name_modifiers = { TITLE = title:c_omi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Amenomori } + } + 1 = { # HAYAMI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Hayami TITLE = title:c_omi } } + japanese_new_house_name_modifiers = { TITLE = title:c_omi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Hayami } + } + 1 = { # IBA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Iba_JP TITLE = title:c_omi } } + japanese_new_house_name_modifiers = { TITLE = title:c_omi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Iba_JP } + } + 1 = { # KUTSUKI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kutsuki TITLE = title:c_omi } } + japanese_new_house_name_modifiers = { TITLE = title:c_omi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kutsuki } + } + 1 = { # MIKI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Miki TITLE = title:c_omi } } + japanese_new_house_name_modifiers = { TITLE = title:c_omi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Miki } + } + 1 = { # OHARA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_O_hara TITLE = title:c_omi } } + japanese_new_house_name_modifiers = { TITLE = title:c_omi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_O_hara } + } + 1 = { # SASAKI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Sasaki TITLE = title:c_omi } } + japanese_new_house_name_modifiers = { TITLE = title:c_omi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Sasaki } + } + 1 = { # TANAKA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Tanaka TITLE = title:c_omi } } + japanese_new_house_name_modifiers = { TITLE = title:c_omi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Tanaka } + } + ### OSUMI + 1 = { # KIMOTSUKI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kimotsuki TITLE = title:c_osumi } } + japanese_new_house_name_modifiers = { TITLE = title:c_osumi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kimotsuki } + } + 1 = { # KITAHARA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kitahara TITLE = title:c_osumi } } + japanese_new_house_name_modifiers = { TITLE = title:c_osumi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kitahara } + } + ### OWARI + 1 = { # HACHISUKA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Hachisuka TITLE = title:c_owari } } + japanese_new_house_name_modifiers = { TITLE = title:c_owari } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Hachisuka } + } + 1 = { # HOTTA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Hotta TITLE = title:c_owari } } + japanese_new_house_name_modifiers = { TITLE = title:c_owari } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Hotta } + } + 1 = { # NIWA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Niwa TITLE = title:c_owari } } + japanese_new_house_name_modifiers = { TITLE = title:c_owari } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Niwa } + } + 1 = { # OGAWA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Ogawa TITLE = title:c_owari } } + japanese_new_house_name_modifiers = { TITLE = title:c_owari } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Ogawa } + } + 1 = { # OKADA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Okada TITLE = title:c_owari } } + japanese_new_house_name_modifiers = { TITLE = title:c_owari } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Okada } + } + 1 = { # OSADA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Osada TITLE = title:c_owari } } + japanese_new_house_name_modifiers = { TITLE = title:c_owari } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Osada } + } + 1 = { # YAMADA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Yamada TITLE = title:c_owari } } + japanese_new_house_name_modifiers = { TITLE = title:c_owari } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Yamada } + } + 1 = { # YASUDA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Yasuda TITLE = title:c_owari } } + japanese_new_house_name_modifiers = { TITLE = title:c_owari } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Yasuda } + } + ### SAGAMI + 1 = { # AIHARA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Aihara TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Aihara } + } + 1 = { # AIKO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_AikO_ TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_AikO_ } + } + 1 = { # ASHINA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Ashina TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Ashina } + } + 1 = { # DOI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Doi TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Doi } + } + 1 = { # EBINA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Ebina TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Ebina } + } + 1 = { # HATANO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Hatano TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Hatano } + } + 1 = { # KAGAWA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kagawa TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kagawa } + } + 1 = { # KAJIWARA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kajiwara TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kajiwara } + } + 1 = { # KOBAYAKAWA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kobayakawa TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kobayakawa } + } + 1 = { # MATANO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Matano TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Matano } + } + 1 = { # MIURA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Miura TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Miura } + } + 1 = { # MORI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Mori_JP TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Mori_JP } + } + 1 = { # NAGAE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Nagae TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Nagae } + } + 1 = { # NAGAO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Nagao TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Nagao } + } + 1 = { # NAKAMURA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Nakamura TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Nakamura } + } + 1 = { # NIKAIDO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Nikaido TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Nikaido } + } + 1 = { # OBA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_O_ba TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_O_ba } + } + 1 = { # OKAZAKI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Okazaki TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Okazaki } + } + 1 = { # OTAWA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_O_tawa TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_O_tawa } + } + 1 = { # OTOMO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_O_tomo TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_O_tomo } + } + 1 = { # SAWARA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Sawara TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Sawara } + } + 1 = { # SHIBUYA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Shibuya TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Shibuya } + } + 1 = { # SOGA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Soga TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Soga } + } + 1 = { # SUGIMOTO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Sugimoto TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Sugimoto } + } + 1 = { # TOKIWA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Tokiwa TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Tokiwa } + } + 1 = { # TSUCHIYA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Tsuchiya TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Tsuchiya } + } + 1 = { # YAMAUCHI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Yamauchi TITLE = title:c_sagami } } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Yamauchi } + } + ### SANUKI + 1 = { # SOGO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_SogO_ TITLE = title:c_sanuki } } + japanese_new_house_name_modifiers = { TITLE = title:c_sanuki } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_SogO_ } + } + ### SATSUMA + 1 = { # SHIMAZU + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Shimazu TITLE = title:c_satsuma } } + japanese_new_house_name_modifiers = { TITLE = title:c_satsuma } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Shimazu } + } + 1 = { # TOGO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_TO_gO_ TITLE = title:c_satsuma } } + japanese_new_house_name_modifiers = { TITLE = title:c_satsuma } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_TO_gO_ } + } + 1 = { # YAMADA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Yamada TITLE = title:c_satsuma } } + japanese_new_house_name_modifiers = { TITLE = title:c_satsuma } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Yamada } + } + ### SETTSU + 1 = { # MINASE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Minase TITLE = title:c_settsu } } + japanese_new_house_name_modifiers = { TITLE = title:c_settsu } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Minase } + } + 1 = { # MIZOKUI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Mizokui TITLE = title:c_settsu } } + japanese_new_house_name_modifiers = { TITLE = title:c_settsu } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Mizokui } + } + 1 = { # NOSE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Nose TITLE = title:c_settsu } } + japanese_new_house_name_modifiers = { TITLE = title:c_settsu } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Nose } + } + 1 = { # TADA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Tada TITLE = title:c_settsu } } + japanese_new_house_name_modifiers = { TITLE = title:c_settsu } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Tada } + } + 1 = { # WATANABE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Watanabe TITLE = title:c_settsu } } + japanese_new_house_name_modifiers = { TITLE = title:c_settsu } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Watanabe } + } + ### SHINANO + 1 = { # AIDA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Aida TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Aida } + } + 1 = { # ATOBE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Atobe TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Atobe } + } + 1 = { # DEURA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Deura TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Deura } + } + 1 = { # HIGUCHI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Higuchi TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Higuchi } + } + 1 = { # HOSHINA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Hoshina TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Hoshina } + } + 1 = { # IIDA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Iida TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Iida } + } + 1 = { # IINUMA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Iinuma TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Iinuma } + } + 1 = { # IMAI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Imai TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Imai } + } + 1 = { # INA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Ina TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Ina } + } + 1 = { # INOUE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Inoue TITLE = title:c_musashi } } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Inoue } + } + 1 = { # KATAGIRI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Katagiri TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Katagiri } + } + 1 = { # KOSAKA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kosaka TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kosaka } + } + 1 = { # KISO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kiso TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kiso } + } + 1 = { # KURITA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kurita TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kurita } + } + 1 = { # MOCHIZUKI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Mochizuki TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Mochizuki } + } + 1 = { # MURAKAMI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Murakami TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Murakami } + } + 1 = { # NAKANO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Nakano TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Nakano } + } + 1 = { # NATSUME + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Natsume TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Natsume } + } + 1 = { # NEZU + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Nezu TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Nezu } + } + 1 = { # NISHINA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Nishina TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Nishina } + } + 1 = { # ODAGIRI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Odagiri TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Odagiri } + } + 1 = { # SANADA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Sanada TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Sanada } + } + 1 = { # SHIODA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Shioda TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Shioda } + } + 1 = { # TOMONO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Tomono TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Tomono } + } + 1 = { # UEDA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Ueda TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Ueda } + } + 1 = { # UNNO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Unno TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Unno } + } + 1 = { # YASHIRO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Yashiro TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Yashiro } + } + 1 = { # YODA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Yoda TITLE = title:c_shinano } } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Yoda } + } + ### SHIMOSA + 1 = { # CHIBA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Chiba TITLE = title:c_shimosa } } + japanese_new_house_name_modifiers = { TITLE = title:c_shimosa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Chiba } + } + 1 = { # HARA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Hara TITLE = title:c_shimosa } } + japanese_new_house_name_modifiers = { TITLE = title:c_shimosa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Hara } + } + 1 = { # KOKUBU + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kokubu TITLE = title:c_shimosa } } + japanese_new_house_name_modifiers = { TITLE = title:c_shimosa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kokubu } + } + 1 = { # OSUGA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_O_suga TITLE = title:c_shimosa } } + japanese_new_house_name_modifiers = { TITLE = title:c_shimosa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_O_suga } + } + 1 = { # SHIMOKOBE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_ShimokO_be TITLE = title:c_shimosa } } + japanese_new_house_name_modifiers = { TITLE = title:c_shimosa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_ShimokO_be } + } + 1 = { # SOMA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_SO_ma TITLE = title:c_shimosa } } + japanese_new_house_name_modifiers = { TITLE = title:c_shimosa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_SO_ma } + } + 1 = { # SOSA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_SO_sa TITLE = title:c_shimosa } } + japanese_new_house_name_modifiers = { TITLE = title:c_shimosa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_SO_sa } + } + 1 = { # TAKEISHI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Takeishi TITLE = title:c_shimosa } } + japanese_new_house_name_modifiers = { TITLE = title:c_shimosa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Takeishi } + } + 1 = { # TO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_TO_ TITLE = title:c_shimosa } } + japanese_new_house_name_modifiers = { TITLE = title:c_shimosa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_TO_ } + } + 1 = { # YUKI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_YU_ki TITLE = title:c_shimosa } } + japanese_new_house_name_modifiers = { TITLE = title:c_shimosa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_YU_ki } + } + ### SHIMOTSUKE + 1 = { # ASHIKAGA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Ashikaga TITLE = title:c_shimotsuke } } + japanese_new_house_name_modifiers = { TITLE = title:c_shimotsuke } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Ashikaga } + } + 1 = { # HAGA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Haga TITLE = title:c_shimotsuke } } + japanese_new_house_name_modifiers = { TITLE = title:c_shimotsuke } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Haga } + } + 1 = { # ITAKURA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Itakura TITLE = title:c_shimotsuke } } + japanese_new_house_name_modifiers = { TITLE = title:c_shimotsuke } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Itakura } + } + 1 = { # NASU + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Nasu TITLE = title:c_shimotsuke } } + japanese_new_house_name_modifiers = { TITLE = title:c_shimotsuke } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Nasu } + } + 1 = { # ONODERA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Onodera TITLE = title:c_shimotsuke } } + japanese_new_house_name_modifiers = { TITLE = title:c_shimotsuke } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Onodera } + } + 1 = { # OYAMA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Oyama TITLE = title:c_shimotsuke } } + japanese_new_house_name_modifiers = { TITLE = title:c_shimotsuke } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Oyama } + } + 1 = { # SANO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Sano TITLE = title:c_shimotsuke } } + japanese_new_house_name_modifiers = { TITLE = title:c_shimotsuke } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Sano } + } + 1 = { # SHIONOYA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Shionoya TITLE = title:c_shimotsuke } } + japanese_new_house_name_modifiers = { TITLE = title:c_shimotsuke } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Shionoya } + } + 1 = { # UJIIE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Uji_ie TITLE = title:c_shimotsuke } } + japanese_new_house_name_modifiers = { TITLE = title:c_shimotsuke } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Uji_ie } + } + ### SUO + 1 = { # MIGATA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Migata TITLE = title:c_suo } } + japanese_new_house_name_modifiers = { TITLE = title:c_suo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Migata } + } + 1 = { # OUCHI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_O_uchi TITLE = title:c_suo } } + japanese_new_house_name_modifiers = { TITLE = title:c_suo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_O_uchi } + } + 1 = { # TOIDA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Toida TITLE = title:c_suo } } + japanese_new_house_name_modifiers = { TITLE = title:c_suo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Toida } + } + 1 = { # WASHIZU + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Washizu TITLE = title:c_suo } } + japanese_new_house_name_modifiers = { TITLE = title:c_suo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Washizu } + } + 1 = { # YAMAGUCHI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Yamaguchi TITLE = title:c_suo } } + japanese_new_house_name_modifiers = { TITLE = title:c_suo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Yamaguchi } + } + ### SURUGA + 1 = { # ABE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Abe TITLE = title:c_suruga } } + japanese_new_house_name_modifiers = { TITLE = title:c_suruga } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Abe } + } + 1 = { # ANO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Ano TITLE = title:c_suruga } } + japanese_new_house_name_modifiers = { TITLE = title:c_suruga } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Ano } + } + 1 = { # IRIE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Irie TITLE = title:c_suruga } } + japanese_new_house_name_modifiers = { TITLE = title:c_suruga } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Irie } + } + 1 = { # KAMBARA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kambara TITLE = title:c_suruga } } + japanese_new_house_name_modifiers = { TITLE = title:c_suruga } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kambara } + } + 1 = { # KIKKAWA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kikkawa TITLE = title:c_suruga } } + japanese_new_house_name_modifiers = { TITLE = title:c_suruga } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kikkawa } + } + 1 = { # MAKI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Maki TITLE = title:c_suruga } } + japanese_new_house_name_modifiers = { TITLE = title:c_suruga } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Maki } + } + 1 = { # OKABE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Okabe TITLE = title:c_suruga } } + japanese_new_house_name_modifiers = { TITLE = title:c_suruga } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Okabe } + } + ### TAGA + 1 = { # HIZUME + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Hizume TITLE = title:c_korehari } } + japanese_new_house_name_modifiers = { TITLE = title:c_korehari } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Hizume } + } + ### TAJIMA + 1 = { # ASAKURA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Asakura TITLE = title:c_tajima } } + japanese_new_house_name_modifiers = { TITLE = title:c_tajima } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Asakura } + } + ### TANBA + 1 = { # ASHIDA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Ashida TITLE = title:c_tanba } } + japanese_new_house_name_modifiers = { TITLE = title:c_tanba } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Ashida } + } + 1 = { # OTA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_O_ta TITLE = title:c_tanba } } + japanese_new_house_name_modifiers = { TITLE = title:c_tanba } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_O_ta } + } + 1 = { # UESUGI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Uesugi TITLE = title:c_tanba } } + japanese_new_house_name_modifiers = { TITLE = title:c_tanba } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Uesugi } + } + ### TOSA + 1 = { # CHOSOKABE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_ChO_sokabe TITLE = title:c_tosa } } + japanese_new_house_name_modifiers = { TITLE = title:c_tosa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_ChO_sokabe } + } + 1 = { # HASUIKE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Hasuike TITLE = title:c_tosa } } + japanese_new_house_name_modifiers = { TITLE = title:c_tosa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Hasuike } + } + 1 = { # KOSOKABE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_KO_sokabe TITLE = title:c_tosa } } + japanese_new_house_name_modifiers = { TITLE = title:c_tosa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_KO_sokabe } + } + 1 = { # SOGABE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Sogabe TITLE = title:c_tosa } } + japanese_new_house_name_modifiers = { TITLE = title:c_tosa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Sogabe } + } + 1 = { # YASU + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Yasu TITLE = title:c_tosa } } + japanese_new_house_name_modifiers = { TITLE = title:c_tosa } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Yasu } + } + ### TOTOMI + 1 = { # HARAISHI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Haraishi TITLE = title:c_totomi } } + japanese_new_house_name_modifiers = { TITLE = title:c_totomi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Haraishi } + } + 1 = { # II + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Ii TITLE = title:c_totomi } } + japanese_new_house_name_modifiers = { TITLE = title:c_totomi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Ii } + } + 1 = { # ISHITANI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Ishitani TITLE = title:c_totomi } } + japanese_new_house_name_modifiers = { TITLE = title:c_totomi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Ishitani } + } + 1 = { # SAGARA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Sagara TITLE = title:c_totomi } } + japanese_new_house_name_modifiers = { TITLE = title:c_totomi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Sagara } + } + 1 = { # TOYODA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Toyoda TITLE = title:c_totomi } } + japanese_new_house_name_modifiers = { TITLE = title:c_totomi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Toyoda } + } + ### TSUGARU + ### TSUSHIMA + 1 = { # SO + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_SO_ TITLE = title:c_tsushima } } + japanese_new_house_name_modifiers = { TITLE = title:c_tsushima } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_SO_ } + } + ### UGO + ### UZEN + 1 = { # MOGAMI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Mogami TITLE = title:c_tokisara } } + japanese_new_house_name_modifiers = { TITLE = title:c_tokisara } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Mogami } + } + 1 = { # OZONE + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_O_zone TITLE = title:c_tokisara } } + japanese_new_house_name_modifiers = { TITLE = title:c_tokisara } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_O_zone } + } + 1 = { # SHIRATORI + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Shiratori TITLE = title:c_tokisara } } + japanese_new_house_name_modifiers = { TITLE = title:c_tokisara } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Shiratori } + } + ### YAMATO + 1 = { # KASUGA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Kasuga TITLE = title:c_yamato } } + japanese_new_house_name_modifiers = { TITLE = title:c_yamato } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kasuga } + } + 1 = { # IKOMA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_Ikoma TITLE = title:c_yamato } } + japanese_new_house_name_modifiers = { TITLE = title:c_yamato } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Ikoma } + } + 1 = { # OMIYA + trigger = { japan_house_name_county_trigger = { FLAG = flag:dynn_O_miya TITLE = title:c_yamato } } + japanese_new_house_name_modifiers = { TITLE = title:c_yamato } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_O_miya } + } + ### OTHER / SHARED + 1 = { # FURUICHI + trigger = { + OR = { + japan_house_name_county_trigger = { FLAG = flag:dynn_Furuichi TITLE = title:c_kawachi } + japan_house_name_county_trigger = { FLAG = flag:dynn_Furuichi TITLE = title:c_omi } + japan_house_name_county_trigger = { FLAG = flag:dynn_Furuichi TITLE = title:c_settsu } + japan_house_name_county_trigger = { FLAG = flag:dynn_Furuichi TITLE = title:c_yamato } + } + } + japanese_new_house_name_modifiers = { TITLE = title:c_kawachi } + japanese_new_house_name_modifiers = { TITLE = title:c_omi } + japanese_new_house_name_modifiers = { TITLE = title:c_settsu } + japanese_new_house_name_modifiers = { TITLE = title:c_yamato } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Furuichi } + } + 1 = { # HAYASHI + trigger = { + OR = { + japan_house_name_county_trigger = { FLAG = flag:dynn_Hayashi TITLE = title:c_kaga } + japan_house_name_county_trigger = { FLAG = flag:dynn_Hayashi TITLE = title:c_owari } + } + } + japanese_new_house_name_modifiers = { TITLE = title:c_kaga } + japanese_new_house_name_modifiers = { TITLE = title:c_owari } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Hayashi } + } + 1 = { # HONJO + trigger = { + OR = { + japan_house_name_county_trigger = { FLAG = flag:dynn_Furuichi TITLE = title:c_echigo } + japan_house_name_county_trigger = { FLAG = flag:dynn_Furuichi TITLE = title:c_musashi } + } + } + japanese_new_house_name_modifiers = { TITLE = title:c_echigo } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_HonjO_ } + } + 1 = { # HIRAGA + trigger = { + OR = { + japan_house_name_county_trigger = { FLAG = flag:dynn_Hiraga TITLE = title:c_shinano } + japan_house_name_county_trigger = { FLAG = flag:dynn_Hiraga TITLE = title:c_tokisara } + } + } + japanese_new_house_name_modifiers = { TITLE = title:c_shinano } + japanese_new_house_name_modifiers = { TITLE = title:c_tokisara } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Hiraga } + } + 1 = { # ISHIKAWA + trigger = { + OR = { + japan_house_name_county_trigger = { FLAG = flag:dynn_Ishikawa TITLE = title:c_kawachi } + japan_house_name_county_trigger = { FLAG = flag:dynn_Ishikawa TITLE = title:c_iwaki } + } + } + japanese_new_house_name_modifiers = { TITLE = title:c_kawachi } + japanese_new_house_name_modifiers = { TITLE = title:c_iwaki } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Ishikawa } + } + 1 = { # KODAMA + trigger = { + OR = { + japan_house_name_county_trigger = { FLAG = flag:dynn_Kodama TITLE = title:c_hoki } + japan_house_name_county_trigger = { FLAG = flag:dynn_Kodama TITLE = title:c_musashi } + } + } + japanese_new_house_name_modifiers = { TITLE = title:c_hoki } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kodama } + } + 1 = { # NAKAMURA + trigger = { + OR = { + japan_house_name_county_trigger = { FLAG = flag:dynn_Nakamura TITLE = title:c_hitachi } + japan_house_name_county_trigger = { FLAG = flag:dynn_Nakamura TITLE = title:c_sagami } + japan_house_name_county_trigger = { FLAG = flag:dynn_Nakamura TITLE = title:c_shimotsuke } + } + } + japanese_new_house_name_modifiers = { TITLE = title:c_hitachi } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + japanese_new_house_name_modifiers = { TITLE = title:c_shimotsuke } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Nakamura } + } + 1 = { # SHINGU + trigger = { + OR = { + japan_house_name_county_trigger = { FLAG = flag:dynn_ShingU_ TITLE = title:c_kii } + japan_house_name_county_trigger = { FLAG = flag:dynn_ShingU_ TITLE = title:c_iwase } + } + } + japanese_new_house_name_modifiers = { TITLE = title:c_kii } + japanese_new_house_name_modifiers = { TITLE = title:c_iwase } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_ShingU_ } + } + 1 = { # TAKAOKA + trigger = { + OR = { + japan_house_name_county_trigger = { FLAG = flag:dynn_Takaoka TITLE = title:c_hitachi } + japan_house_name_county_trigger = { FLAG = flag:dynn_Takaoka TITLE = title:c_izumo } + } + } + japanese_new_house_name_modifiers = { TITLE = title:c_hitachi } + japanese_new_house_name_modifiers = { TITLE = title:c_izumo } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Takaoka } + } + 1 = { # WADA + trigger = { + OR = { + japan_house_name_county_trigger = { FLAG = flag:dynn_Wada TITLE = title:c_kawachi } + japan_house_name_county_trigger = { FLAG = flag:dynn_Wada TITLE = title:c_sagami } + } + } + japanese_new_house_name_modifiers = { TITLE = title:c_kawachi } + japanese_new_house_name_modifiers = { TITLE = title:c_sagami } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Wada } + } + 1 = { # YAMAGATA + trigger = { + OR = { + japan_house_name_county_trigger = { FLAG = flag:dynn_Yamagata TITLE = title:c_aki } + japan_house_name_county_trigger = { FLAG = flag:dynn_Yamagata TITLE = title:c_mino } + } + } + japanese_new_house_name_modifiers = { TITLE = title:c_aki } + japanese_new_house_name_modifiers = { TITLE = title:c_mino } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Yamagata } + } + 1 = { # YOSHIDA + trigger = { + OR = { + japan_house_name_county_trigger = { FLAG = flag:dynn_Yoshida TITLE = title:c_musashi } + japan_house_name_county_trigger = { FLAG = flag:dynn_Yoshida TITLE = title:c_omi } + } + } + japanese_new_house_name_modifiers = { TITLE = title:c_musashi } + japanese_new_house_name_modifiers = { TITLE = title:c_omi } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Yoshida } + } + ### FUJIWARA + 3 = { # ANDO + trigger = { dynasty ?= { exists = var:fujiwara_flag } } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_AndO_ } + } + 3 = { # ENDO + trigger = { dynasty ?= { exists = var:fujiwara_flag } } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_EndO_ } + } + 3 = { # GOTO + trigger = { dynasty ?= { exists = var:fujiwara_flag } } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_GotO_ } + } + 3 = { # KATO + trigger = { dynasty ?= { exists = var:fujiwara_flag } } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_KatO_ } + } + 3 = { # KONDO + trigger = { dynasty ?= { exists = var:fujiwara_flag } } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_KondO_ } + } + 3 = { # KUDO + trigger = { dynasty ?= { exists = var:fujiwara_flag } } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_KudO_ } + } + 3 = { # MUTO + trigger = { dynasty ?= { exists = var:fujiwara_flag } } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_MutO_ } + } + 3 = { # SAITO + trigger = { dynasty ?= { exists = var:fujiwara_flag } } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_SaitO_ } + } + 3 = { # SATO + trigger = { dynasty ?= { exists = var:fujiwara_flag } } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_SatO_ } + } + } +} + +assign_japanese_house_name_options_kyoto_effect = { + ### YAMASHIRO (KYOTO) + random_list = { + 1 = { + trigger = { japan_house_name_trigger = { FLAG = flag:dynn_Awata } } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Awata } + } + 1 = { + trigger = { japan_house_name_trigger = { FLAG = flag:dynn_Awataguchi } } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Awataguchi } + } + 1 = { + trigger = { japan_house_name_trigger = { FLAG = flag:dynn_GojO_ } } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_GojO_ } + } + 1 = { + trigger = { japan_house_name_trigger = { FLAG = flag:dynn_IchijO_ } } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_IchijO_ } + } + 1 = { + trigger = { japan_house_name_trigger = { FLAG = flag:dynn_Kitabatake } } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Kitabatake } + } + 1 = { + trigger = { japan_house_name_trigger = { FLAG = flag:dynn_Konoe } } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Konoe } + } + 1 = { + trigger = { japan_house_name_trigger = { FLAG = flag:dynn_KyO_goku } } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_KyO_goku } + } + 1 = { + trigger = { japan_house_name_trigger = { FLAG = flag:dynn_Nakamikado } } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Nakamikado } + } + 1 = { + trigger = { japan_house_name_trigger = { FLAG = flag:dynn_NijO_ } } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_NijO_ } + } + 1 = { + trigger = { japan_house_name_trigger = { FLAG = flag:dynn_O_inomikado } } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_O_inomikado } + } + 1 = { + trigger = { japan_house_name_trigger = { FLAG = flag:dynn_Rokkaku } } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Rokkaku } + } + 1 = { + trigger = { japan_house_name_trigger = { FLAG = flag:dynn_RokujO_ } } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_RokujO_ } + } + 1 = { + trigger = { japan_house_name_trigger = { FLAG = flag:dynn_SanjO_ } } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_SanjO_ } + } + 1 = { + trigger = { japan_house_name_trigger = { FLAG = flag:dynn_ShijO_ } } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_ShijO_ } + } + 1 = { + trigger = { japan_house_name_trigger = { FLAG = flag:dynn_Tsuchimikado } } + add_to_variable_list = { name = japanese_house_names target = flag:dynn_Tsuchimikado } + } + } +} + +faction_demand_regent_transfer_effect = { + top_liege = { + save_temporary_scope_as = old_regent_temp + primary_title = { + save_temporary_scope_as = primary_title_temp + title_capital_county = { save_temporary_scope_as = preferred_capital_temp } + } + } + $NEW_REGENT$ = { + save_temporary_scope_as = new_regent_temp + if = { + limit = { government_has_flag = government_is_japan_feudal } + save_temporary_scope_as = japan_feudal + } + } + # COUNTIES + create_title_and_vassal_change = { + type = faction_demand + save_scope_as = title_change + add_claim_on_loss = no + } + scope:old_regent_temp = { # Give landed titles to the new Regent + show_as_tooltip = { + primary_title = { # Give top liege title to the new Regent + change_title_holder_include_vassals = { + holder = scope:new_regent_temp + change = scope:title_change + } + } + } + hidden_effect = { + every_held_title = { + limit = { + is_landless_type_title = no + is_noble_family_title = no + } + change_title_holder_include_vassals = { + holder = scope:new_regent_temp + change = scope:title_change + } + } + change_liege = { + liege = scope:new_regent_temp + change = scope:title_change + } + } + } + resolve_title_and_vassal_change = scope:title_change + scope:new_regent_temp = { + if = { + limit = { capital_county != scope:preferred_capital_temp } + set_capital_county = scope:preferred_capital_temp + } + # GOVERNMENT + if = { + limit = { + exists = scope:japan_feudal + NOT = { government_has_flag = government_is_japan_feudal } + } + change_government = japan_feudal_government + } + # SUCCESSION LAWS + if = { + limit = { + government_has_flag = government_is_japan_administrative + tgp_has_ceremonial_liege_title_trigger = no + NOT = { + scope:primary_title_temp.holder = { has_realm_law = japanese_regency_succession_law } + } + } + scope:primary_title_temp.holder = { add_realm_law_skip_effects = japanese_regency_succession_law } + } + else = { + scope:primary_title_temp.holder = { add_realm_law_skip_effects = single_heir_succession_law } + } + } +} + +tgp_japan_schoolhouse_education_boost_effect = { + save_scope_as = student + house.house_head.domicile ?= { + if = { + limit = { has_domicile_parameter = education_boost } + switch = { + trigger = has_domicile_building + japanese_schoolhouse_01 = { scope:student = { education_point_add_general_effect = { VALUE = 1 } } } + japanese_schoolhouse_02 = { scope:student = { education_point_add_general_effect = { VALUE = 2 } } } + japanese_schoolhouse_03 = { scope:student = { education_point_add_general_effect = { VALUE = 3 } } } + japanese_schoolhouse_04 = { scope:student = { education_point_add_general_effect = { VALUE = 4 } } } + japanese_schoolhouse_04 = { scope:student = { education_point_add_general_effect = { VALUE = 5 } } } + japanese_schoolhouse_04 = { scope:student = { education_point_add_general_effect = { VALUE = 6 } } } + } + } + } +} + +tgp_restore_japanese_monarchy_decision_effect = { + save_scope_as = kampaku + tgp_restore_japanese_monarchy_yamato_scion_effect = yes + add_prestige = major_prestige_value + if = { + limit = { government_allows = administrative } + change_influence = major_influence_value + } + else = { add_piety = medium_piety_value } + if = { + limit = { exists = scope:scion } + add_hook = { + type = strong_favor_hook + target = scope:scion + } + } + else = { custom_tooltip = tgp_restore_japanese_monarchy_decision_hook_tt } +} + +tgp_restore_japanese_monarchy_yamato_scion_effect = { + title:k_chrysanthemum_throne.previous_holder ?= { save_scope_as = last_tenno } + dynasty:japanese_yamato.dynasty_founder.house ?= { + save_scope_as = house_yamato + if = { + limit = { this = scope:kampaku.house } + if = { # Avoid display of short tooltips after creation + limit = { NOT = { exists = scope:scion } } + custom_tooltip = tgp_restore_japanese_monarchy_yamato_scion_kampaku_tt + } + scope:kampaku = { save_scope_as = scion } + } + else_if = { + limit = { + scope:last_tenno ?= { tgp_japan_valid_restore_monarchy_scion_trigger = yes } + } + if = { # Avoid display of short tooltips after creation + limit = { NOT = { exists = scope:scion } } + custom_tooltip = tgp_restore_japanese_monarchy_yamato_scion_last_tt + } + scope:last_tenno = { save_scope_as = scion } + } + else_if = { + limit = { + scope:last_tenno ?= { + any_child = { tgp_japan_valid_restore_monarchy_scion_trigger = yes } + } + } + if = { # Avoid display of short tooltips after creation + limit = { NOT = { exists = scope:scion } } + custom_tooltip = tgp_restore_japanese_monarchy_yamato_scion_last_child_tt + } + scope:last_tenno = { + ordered_child = { + limit = { tgp_japan_valid_restore_monarchy_scion_trigger = yes } + order_by = age + save_scope_as = scion + } + } + } + else_if = { + limit = { + scope:last_tenno ?= { + any_close_family_member = { tgp_japan_valid_restore_monarchy_scion_trigger = yes } + } + } + if = { # Avoid display of short tooltips after creation + limit = { NOT = { exists = scope:scion } } + custom_tooltip = tgp_restore_japanese_monarchy_yamato_scion_last_close_family_tt + } + scope:last_tenno = { + ordered_close_family_member = { + limit = { tgp_japan_valid_restore_monarchy_scion_trigger = yes } + order_by = age + save_scope_as = scion + } + } + } + else_if = { + limit = { + any_house_member = { + is_ruler = no + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root.top_liege } + is_healthy = yes + } + } + if = { # Avoid display of short tooltips after creation + limit = { NOT = { exists = scope:scion } } + custom_tooltip = tgp_restore_japanese_monarchy_yamato_scion_found_tt + } + ordered_house_member = { + limit = { + top_liege = root.top_liege + is_ruler = no + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root.top_liege } + is_healthy = yes + } + order_by = age + save_scope_as = scion + } + } + else = { + tgp_restore_japanese_monarchy_yamato_creation_effect = yes + if = { # Avoid display of short tooltips after creation + limit = { NOT = { exists = scope:scion } } + custom_tooltip = tgp_restore_japanese_monarchy_yamato_scion_created_tt + } + } + # Save children for portraits + scope:scion = { + save_scope_as = background_throne_room_scope + ordered_child = { + limit = { house = scope:scion.house } + max = 3 + check_range_bounds = no + order_by = age + switch = { + trigger = exists + scope:scion_child_2 = { save_scope_as = scion_child_3 } + scope:scion_child_1 = { save_scope_as = scion_child_2 } + fallback = { save_scope_as = scion_child_1 } + } + } + } + } +} + +tgp_restore_japanese_monarchy_yamato_restoration_effect = { + add_character_flag = tgp_japan_restore_japanese_monarchy_flag + if = { + limit = { exists = scope:scion } + if = { + limit = { exists = title:k_chrysanthemum_throne.holder } + create_title_and_vassal_change = { + type = usurped + save_scope_as = change + add_claim_on_loss = yes + } + } + else = { + create_title_and_vassal_change = { + type = created + save_scope_as = change + } + } + title:k_chrysanthemum_throne ?= { + change_title_holder = { + holder = scope:scion + change = scope:change + } + } + if = { + limit = { + scope:scion.liege != scope:kampaku + scope:scion != scope:kampaku + } + scope:scion ?= { + change_liege = { + liege = scope:kampaku + change = scope:change + } + } + } + resolve_title_and_vassal_change = scope:change + } + remove_character_flag = tgp_japan_restore_japanese_monarchy_flag + hidden_effect = { + scope:scion = { + if = { + limit = { + NOT = { government_has_flag = government_is_japan_administrative } + } + change_government = japan_administrative_government + } + } + } +} + +tgp_restore_japanese_monarchy_yamato_creation_effect = { + create_character = { + template = tgp_japan_imperial_scion_template + location = scope:kampaku.capital_province + age = { 16 38 } + save_scope_as = scion + } + scope:scion ?= { + if = { + limit = { is_female = yes } + create_character = { + template = tgp_japan_imperial_scion_template + location = scope:kampaku.capital_province + mother = scope:scion + age = { 11 12 } + } + create_character = { + template = tgp_japan_imperial_scion_template + location = scope:kampaku.capital_province + mother = scope:scion + age = { 7 8 } + } + create_character = { + template = tgp_japan_imperial_scion_template + location = scope:kampaku.capital_province + mother = scope:scion + age = { 3 4 } + } + } + else = { + create_character = { + template = tgp_japan_imperial_scion_template + location = scope:kampaku.capital_province + father = scope:scion + age = { 11 12 } + } + create_character = { + template = tgp_japan_imperial_scion_template + location = scope:kampaku.capital_province + father = scope:scion + age = { 7 8 } + } + create_character = { + template = tgp_japan_imperial_scion_template + location = scope:kampaku.capital_province + father = scope:scion + age = { 3 4 } + } + } + } +} + +tgp_restore_japanese_government_decision_effect = { + japan_clear_flavour_flags_effect = yes + save_scope_as = kampaku + save_scope_as = background_throne_room_scope + add_character_flag = tgp_japan_restore_japanese_government_flag + # Change government if relevant + change_government = japan_administrative_government + if = { + limit = { + NOT = { has_realm_law = japanese_regency_succession_law } + } + add_realm_law_skip_effects = japanese_regency_succession_law + } + # Inform vassals and convert governments if relevant + every_vassal = { + custom = every_japan_feudal_vassal_custom + limit = { government_has_flag = government_is_japan_feudal } + add_opinion = { + target = scope:kampaku + modifier = restored_ritsuryo_opinion + } + } + if = { + limit = { NOT = { exists = scope:vassal } } + custom_tooltip = tgp_japan_restore_japanese_government_decision_civil_war_tt + } + hidden_effect = { + ordered_powerful_vassal = { + limit = { + is_ai = yes + NOR = { + government_allows = administrative + is_allied_to = scope:kampaku + } + opinion = { + target = scope:kampaku + value < 25 + } + save_temporary_scope_as = vassal_temp + NOT = { + scope:kampaku = { has_usable_hook = scope:vassal_temp } + } + } + order_by = military_power + save_scope_as = rebel + } + if = { + limit = { + NOT = { exists = scope:rebel } + } + ordered_vassal = { + limit = { + is_ai = yes + NOT = { government_allows = administrative } + opinion = { + target = scope:kampaku + value < 25 + } + save_temporary_scope_as = vassal_temp + NOT = { + scope:kampaku = { has_usable_hook = scope:vassal_temp } + } + } + order_by = military_power + save_scope_as = rebel + } + } + if = { + limit = { exists = scope:rebel } + tgp_restore_ritsuryo_civil_war_effect = { + REBEL = scope:rebel + LIEGE = scope:kampaku + } + } + } + custom_tooltip = { + text = tgp_japan_restore_japanese_government_decision_vassal_tt + every_vassal_or_below = { + limit = { + primary_title.tier >= tier_county + culture = { has_same_culture_heritage = scope:kampaku.culture } + } + trigger_event = { + id = tgp_japan_decision.9912 + delayed = yes + } + } + } + remove_character_flag = tgp_japan_restore_japanese_government_flag +} + +tgp_destroy_ceremonial_throne_effect = { + liege = { save_scope_as = liege } + save_scope_as = vassal + scope:vassal ?= { + if = { + limit = { + any_held_title = { exists = var:ceremonial_title } + } + tgp_destroy_ceremonial_liege_title_effect = yes + } + every_held_title = { + limit = { exists = var:administrative_ui_special_title } + var:administrative_ui_special_title.holder = { tgp_destroy_ceremonial_liege_title_effect = yes } + } + } +} + +tgp_destroy_ceremonial_liege_title_effect = { + save_scope_as = ceremonial_liege + random_held_title = { + limit = { exists = var:ceremonial_title } + save_scope_as = ceremonial_title + } + random_held_title = { + limit = { is_noble_family_title = yes } + save_scope_as = nf_title + } + # Destroy the Ceremonial Title if linked title has no holder, or is in another realm, or is a sub vassal + if = { + limit = { + OR = { + NOT = { exists = scope:ceremonial_title.var:ceremonial_title.holder } + scope:ceremonial_title.holder.top_liege != scope:ceremonial_title.var:ceremonial_title.holder.top_liege + scope:ceremonial_title.holder.top_liege != scope:ceremonial_title.holder.liege + } + } + # MESSAGE + every_player = { + limit = { top_liege = scope:vassal.top_liege } + send_interface_message = { + type = event_generic_bad + title = tgp_destroy_ceremonial_liege_throne_title + left_icon = scope:ceremonial_liege + right_icon = scope:liege + show_as_tooltip = { + scope:liege = { destroy_title = scope:ceremonial_title } + scope:ceremonial_liege = { add_trait = former_emperor } + } + } + } + # Actually destroy + scope:ceremonial_liege = { add_trait = former_emperor } + scope:liege = { destroy_title = scope:ceremonial_title } + } +} + +tgp_japan_demand_administrative_refusal_effect = { + if = { + limit = { + scope:actor = { government_has_flag = government_is_japan_administrative } + scope:recipient = { government_has_flag = government_is_japan_feudal } + } + scope:actor = { + start_war = { + casus_belli = japan_demand_administrative_cb + target = scope:recipient + } + } + custom_tooltip = japan_demand_administrative_cb_warning_japan_tt + } +} + +tgp_restore_ritsuryo_civil_war_effect = { + $REBEL$ = { + save_scope_as = actor + save_scope_value_as = { + name = war_for_hoken_flavour + value = yes + } + start_war = { + casus_belli = japan_refused_ritsuryo_cb + target = $LIEGE$ + } + } + $LIEGE$ = { + save_scope_as = recipient + every_vassal = { #Vassals joining the rebel. + custom = vassals_joining_war_tt + limit = { + government_has_flag = government_is_japan_feudal + NOR = { + this = $REBEL$ + is_ai = no + has_trait = incapable + is_imprisoned = yes + dread_modified_ai_boldness = { #Too scared to do anything. + dreaded_character = $LIEGE$ + value <= -50 + } + opinion = { # People who really, really like you will still back you + target = $LIEGE$ + value >= 80 + } + is_allied_to = $LIEGE$ + is_at_war_with = $REBEL$ + is_at_war_with = $LIEGE$ + } + highest_held_title_tier > tier_barony + OR = { + #Lovers and friends always back rebel (unless also lovers/friends of the liege) + AND = { + OR = { + is_allied_to = $REBEL$ + has_relation_lover = $REBEL$ + has_relation_friend = $REBEL$ + } + NOR = { + is_allied_to = $LIEGE$ + has_relation_lover = $LIEGE$ + has_relation_friend = $LIEGE$ + } + } + #Vassals that either like recipient or have high honor will rally if the liege is being tyrannical. + AND = { + # If they can't join a faction against the liege they should not revolt + NOR = { + has_relation_lover = $LIEGE$ + has_relation_friend = $LIEGE$ + is_allied_to = $LIEGE$ + is_primary_heir_of = $LIEGE$ + $LIEGE$ = { has_strong_hook = prev } + has_dread_level_towards = { + target = $LIEGE$ + level = 2 + } + } + OR = { + ai_boldness >= 25 + ai_honor >= 25 + opinion = { + target = $REBEL$ + value >= 40 + } + } + NOR = { + $LIEGE$ = { has_revoke_title_reason = $REBEL$ } + trigger_if = { + limit = { exists = scope:landed_title } + $LIEGE$ = { has_claim_on = scope:landed_title } + } + faith = { + faith_hostility_level = { + target = $REBEL$.faith + value >= faith_hostile_level + } + } + } + } + #And finally, vassals that really hate their liege will join regardless (provided that they also do not hate recipient). + AND = { + opinion = { + target = $REBEL$ + value >= -25 + } + OR = { + #default threshold + opinion = { + target = $LIEGE$ + value <= -50 + } + #If tyrannical, the default threshold will be reached if at this level + AND = { + $LIEGE$ = { + title_revocation_is_tyrannical_trigger = { VASSAL = $REBEL$ } + } + opinion = { + target = $LIEGE$ + value <= -30 #revoke_title_tyranny_gain adds -20 + } + } + } + } + } + } + save_scope_as = joining_vassal + custom_tooltip = tooltip_fellow_vassal_joins_war #The war has not started when viewing the interaction screen. + hidden_effect = { + $REBEL$ = { + every_character_war = { + limit = { + using_cb = japan_refused_ritsuryo_cb + casus_belli = { + primary_attacker = $REBEL$ + primary_defender = $LIEGE$ + } + } + add_to_list = war_to_join + } + } + every_in_list = { + list = war_to_join + limit = { + NOT = { is_defender = prev } + } + hidden_effect = { set_called_to = prev } + add_attacker = prev + } + } + hidden_effect = { + $LIEGE$ = { + add_opinion = { + target = prev + modifier = rebellious_vassal_opinion + } + } + } + } + every_vassal = { + limit = { + is_ai = no + NOT = { this = $REBEL$ } + is_imprisoned = no + } + $REBEL$ = { save_scope_as = recipient } + $LIEGE$ = { save_scope_as = actor } + trigger_event = tgp_japan_decision.9913 + } + } +} + +tgp_set_historical_house_relation_effect = { + if = { + limit = { + house_relation_is_valid_to_start_trigger = { + HOUSE = this + OTHER_HOUSE = $OTHER_HOUSE$ + } + } + set_house_relation = { + target = $OTHER_HOUSE$ + level = $LEVEL$ + description = house_relation_reason_historical_desc + } + } +} + +tgp_setup_historical_house_relation_effect = { + ### 867 ### + if = { + limit = { game_start_date = 867.1.1 } + house:house_fujiwara_ashikaga = { + tgp_set_historical_house_relation_effect = { # + OTHER_HOUSE = house:house_minamoto_kozuke + LEVEL = rivalry + } + } + } + ### 1066 ### + else_if = { + limit = { game_start_date = 1066.9.15 } + dynasty:japanese_minamoto_murakami.dynasty_founder.house = { + tgp_set_historical_house_relation_effect = { # + OTHER_HOUSE = dynasty:japanese_fujiwara.dynasty_founder.house + LEVEL = friendly + } + } + } + ### 1178 ### + else_if = { + limit = { game_start_date = 1178.10.1 } + dynasty:japanese_sugawara.dynasty_founder.house = { + tgp_set_historical_house_relation_effect = { # + OTHER_HOUSE = dynasty:japanese_ki.dynasty_founder.house + LEVEL = friendly + } + } + house:house_minamoto_kiso = { + tgp_set_historical_house_relation_effect = { # Yoshikata killed by Yoshihira + OTHER_HOUSE = dynasty:japanese_nakahara_kiso.dynasty_founder.house + LEVEL = friendly + } + } + house:house_minamoto_kawachi = { + tgp_set_historical_house_relation_effect = { # Yoritomo's brothers killed by Kiyomori + OTHER_HOUSE = dynasty:japanese_nakahara_kiso.dynasty_founder.house + LEVEL = rivalry + } + tgp_set_historical_house_relation_effect = { # Marriage and historical alliance + OTHER_HOUSE = house:house_taira_hojo + LEVEL = friendly + } + } + house:house_kudo_kawazu = { + tgp_set_historical_house_relation_effect = { # Soga brothers + OTHER_HOUSE = house:house_kudo_ito_2 + LEVEL = rivalry + } + } + house:house_taira_wada = { + tgp_set_historical_house_relation_effect = { # Yoshimune killed by Tsunetomo + OTHER_HOUSE = dynasty:japanese_nagasa.dynasty_founder.house + LEVEL = rivalry + } + } + house:house_taira_chichibu = { + tgp_set_historical_house_relation_effect = { # Shigetaka killed by Yoshihira + OTHER_HOUSE = house:house_minamoto_kawachi + LEVEL = rivalry + } + } + house:house_taira_soga = { + tgp_set_historical_house_relation_effect = { # Soga brothers + OTHER_HOUSE = house:house_minamoto_kawachi + LEVEL = rivalry + } + } + dynasty:japanese_ito.dynasty_founder.house = { + tgp_set_historical_house_relation_effect = { # Tadanao killed by Tametomo + OTHER_HOUSE = house:house_minamoto_kawachi + LEVEL = rivalry + } + } + house:house_kudo_ito_2 = { + tgp_set_historical_house_relation_effect = { # Sukeyasu_2 killed by Suketsune_2 + OTHER_HOUSE = house:house_kudo_kawazu + LEVEL = rivalry + } + } + house:house_fujiwara_shijo = { + tgp_set_historical_house_relation_effect = { # Takasue's brothers killed by Kiyomori + OTHER_HOUSE = dynasty:japanese_taira_kanmu.dynasty_founder.house + LEVEL = rivalry + } + } + dynasty:japanese_fujiwara.dynasty_founder.house = { + tgp_set_historical_house_relation_effect = { # Yorinaga killed by Shigesada + OTHER_HOUSE = house:house_minamoto_mitsumasa + LEVEL = rivalry + } + } + } +} + +tgp_liege_change_bloc_management_effect = { + $VASSAL$ = { + if = { # Leave if not a valid member anymore + limit = { + OR = { + exists = confederation.leading_house + exists = house.house_confederation + } + } + save_temporary_scope_as = vassal_temp + house ?= { save_temporary_scope_as = vassal_house_temp } + liege ?= { save_temporary_scope_as = new_liege } + confederation ?= { + save_temporary_scope_as = current_bloc_temp + leading_house = { save_temporary_scope_as = current_bloc_leader_temp } + } + house.house_confederation ?= { + save_temporary_scope_as = current_house_bloc_temp + leading_house = { save_temporary_scope_as = current_house_bloc_leader_temp } + } + if = { + limit = { + exists = scope:current_bloc_temp + exists = scope:old_liege + trigger_if = { # If a vassal + limit = { is_independent_ruler = no } + scope:new_liege.liege != scope:old_liege.liege + scope:new_liege = { + is_independent_ruler = no + } + } + trigger_else = { + NOT = { scope:vassal_temp = scope:old_liege.top_liege } + } + } + scope:current_bloc_temp = { + if = { + limit = { + scope:vassal_temp = { + is_house_head = yes + house.house_confederation = scope:current_bloc_temp + scope:new_liege = { + is_independent_ruler = no + } + } + } + remove_confederation_member_house = scope:vassal_house_temp + } + else_if = { + limit = { scope:vassal_temp.confederation = scope:current_bloc_temp } + remove_confederation_member = scope:vassal_temp + } + } + debug_log = "Bloc liege change member leave" + debug_log_scopes = yes + } + if = { # Join if not a member of valid + limit = { + is_house_head = no + exists = scope:current_house_bloc_temp + scope:vassal_house_temp.house_head.liege ?= liege + NOT = { confederation = scope:vassal_house_temp.house_confederation } + } + confederation ?= { + save_temporary_scope_as = current_bloc_temp + remove_confederation_member = scope:vassal_temp + } + house.house_confederation = { + save_temporary_scope_as = house_bloc_temp + add_confederation_member = scope:vassal_temp + } + debug_log = "Bloc liege change member join" + debug_log_scopes = yes + } + } + } +} + +tgp_japan_assert_regional_dominion_government_decision_effect = { + save_scope_as = super_soryo + scope:super_soryo.primary_title.duchy ?= { save_scope_as = title_scope } + # Crime to Kampaku + if = { + limit = { + top_liege = { government_allows = administrative } + } + # Message for attacker + send_interface_toast = { + type = event_war_bad + title = tgp_japan_soryo_war_is_crime_title + left_icon = top_liege + right_icon = scope:title_scope + top_liege = { + send_interface_toast = { + type = event_war_bad + title = tgp_japan_soryo_war_is_crime_kampaku_title + left_icon = scope:super_soryo + right_icon = scope:title_scope + add_opinion = { + target = scope:super_soryo + modifier = admin_soryo_conquest_crime + } + } + } + } + } + if = { + limit = { exists = scope:title_scope.holder } + hidden_effect = { + scope:title_scope.holder = { save_scope_as = main_defender } + scope:super_soryo = { + if = { + limit = { + any_truce_target = { this = scope:main_defender } + } + cancel_truce_both_ways = scope:main_defender + } + } + start_war = { + #lets make sure this is appropriate for Japan + cb = domination_cb + target = scope:main_defender + target_title = scope:title_scope + } + random_character_war = { + limit = { + using_cb = domination_cb + primary_defender = scope:main_defender + } + save_scope_as = war + } + } + tgp_bloc_members_join_war_effect = { WAR = scope:war } + custom_tooltip = domination_war_holder_custom_tooltip + } + else_if = { + limit = { + scope:super_soryo = { + NOR = { + prestige_level >= 4 + legitimacy_level >= 3 + } + } + scope:title_scope ?= { + any_de_jure_county_holder = { + is_landed = yes + NOR = { + top_liege = scope:super_soryo + top_suzerain ?= scope:super_soryo + is_allied_to = scope:super_soryo + government_has_flag = government_is_herder + trigger_if = { + limit = { + exists = scope:super_soryo.confederation + } + confederation ?= scope:super_soryo.confederation + } + } + #They wont join if you're too scary + has_dread_level_towards = { + target = scope:super_soryo + level < 2 + } + #Must be strong enough to feel like they can fight you + current_military_strength >= { + value = scope:super_soryo.current_military_strength + multiply = 0.5 + } + } + } + } + hidden_effect = { + scope:title_scope = { + every_de_jure_county_holder = { + limit = { + top_liege != scope:super_soryo + is_landed = yes + } + if = { + limit = { + NOR = { + top_suzerain ?= scope:super_soryo + is_allied_to = scope:super_soryo + government_has_flag = government_is_herder + trigger_if = { + limit = { + exists = scope:super_soryo.confederation + } + confederation ?= scope:super_soryo.confederation + } + } + + #They wont join if you're too scary + has_dread_level_towards = { + target = scope:super_soryo + level < 2 + } + #Must be strong enough to feel like they can fight you + current_military_strength >= { + value = scope:super_soryo.current_military_strength + multiply = 0.5 + } + } + add_to_list = war_targets + } + else = { + add_to_list = potential_vassals + } + + } + ordered_in_list = { + list = war_targets + order_by = current_military_strength + save_scope_as = main_defender + } + } + scope:super_soryo = { + if = { + limit = { + any_truce_target = { this = scope:main_defender } + } + cancel_truce_both_ways = scope:main_defender + } + } + start_war = { + cb = domination_cb + target = scope:main_defender + target_title = scope:title_scope + } + #find ai for war + random_character_war = { + limit = { + primary_attacker = scope:super_soryo + primary_defender = scope:main_defender + using_cb = domination_cb + } + save_scope_as = super_soryo_war + every_in_list = { + list = war_targets + limit = { + NOT = { is_participant_in_war = scope:super_soryo_war } + is_ai = yes + } + save_scope_as = super_soryo_war_target + scope:super_soryo_war = { + hidden_effect = { + set_called_to = scope:super_soryo_war_target + } + add_defender = scope:super_soryo_war_target + } + } + } + #send players letter to join war or bend the knee + every_in_list = { + list = war_targets + limit = { + is_ai = no + } + trigger_event = tgp_japan_decision.9963 + } + } + if = { + limit = { exists = scope:war } + tgp_bloc_members_join_war_effect = { WAR = scope:war } + } + save_scope_value_as = { + name = super_soryo_war_current_enemy_strength + value = { + value = 0 + every_in_list = { + list = war_targets + add = { + value = current_military_strength + every_tributary = { + limit = { + vassal_contract_has_flag = tributary_contract_tributary_forced_war_override + } + add = current_military_strength + } + if = { + limit = { this = scope:main_defender } + every_ally = { add = current_military_strength } + if = { + limit = { exists = house.house_confederation } + top_liege = { + every_vassal = { + limit = { + highest_held_title_tier > tier_barony + house.house_confederation = scope:main_defender.house.house_confederation + NOT = { is_allied_to = scope:main_defender } + } + add = current_military_strength + } + } + } + } + } + } + } + } + custom_tooltip = super_soryo_war_no_holder_custom_tooltip + custom_tooltip = super_soryo_potential_peaceful + } + else = { + scope:title_scope = { + create_title_and_vassal_change = { + type = created + save_scope_as = change + } + change_title_holder = { + holder = scope:super_soryo + change = scope:change + } + every_de_jure_county = { + limit = { + holder.top_liege = root.top_liege # in same realm + holder.liege = root.top_liege # is not already a sub-vassal + NOR = { + holder = root # held my me + holder.liege = root # or my vassal + } + } + if = { + limit = { + holder = { + NOT = { government_allows = administrative } + highest_held_title_tier <= tier_county + } + } + hidden_effect = { + holder = { + change_liege = { + liege = root + change = scope:change + } + } + } + } + else_if = { + limit = { + holder = { + OR = { + government_allows = administrative + this = root.top_liege + } + } + } + change_title_holder = { + holder = scope:super_soryo + change = scope:change + } + } + } + resolve_title_and_vassal_change = scope:change + } + add_dread = 15 + add_legitimacy = 50 + dynasty = { add_dynasty_prestige = 150 } + custom_tooltip = super_soryo_reward_peaceful + } +} + +tgp_set_minamoto_taira_dynasty_prestige_effect = { + holder.dynasty ?= { + while = { + limit = { dynasty_prestige_level < 5 } + add_dynasty_prestige_level = 1 + } + } +} + +tgp_japan_soryo_eradicate_cb_transfer_effect = { + + create_title_and_vassal_change = { + type = conquest + save_scope_as = change + add_claim_on_loss = yes + } + + scope:loser = { + every_held_title = { + limit = { + is_landless_type_title = no + tier > tier_barony + } + + change_title_holder = { + holder = scope:winner + change = scope:change + } + } + } + resolve_title_and_vassal_change = scope:change +} + +japanese_establish_soryo_administration_reward_effect = { + save_temporary_scope_as = winner_temp + scope:winner_temp = { + if = { + limit = { + NOT = { has_government = japan_feudal_government } + } + change_government = japan_feudal_government + } + add_realm_law = japanese_bureaucracy_0 + house.house_confederation ?= { + custom_tooltip = { + text = japanese_establish_soryo_administration_vassal_government_tt + scope:winner_temp = { + every_vassal_or_below = { + limit = { + house.house_confederation ?= scope:winner_temp.house.house_confederation + highest_held_title_tier > tier_county + NOT = { has_government = japan_feudal_government } + } + change_government = japan_feudal_government + } + } + } + } + custom_tooltip = japanese_establish_soryo_administration_imprison_tt + } +} + +tgp_learn_chinese_effect_game_start = { + if = { + limit = { + should_learn_chinese_trigger = yes + } + learn_language = language_chinese + } +} +tgp_learn_chinese_effect_birthday = { + if = { + limit = { + should_learn_chinese_trigger = yes + } + learn_language = language_chinese + every_player = { + limit = { + OR = { + is_parent_of = scope:child_learned_chinese + this = scope:child_learned_chinese + has_relation_guardian = scope:child_learned_chinese + has_relation_elder = scope:child_learned_chinese + } + } + send_interface_toast = { + type = event_childhood_good_with_text + title = japanese_korean_child_learned_chinese_title + desc = japanese_korean_child_learned_chinese_effect + left_icon = scope:child_learned_chinese + show_as_tooltip = { + scope:child_learned_chinese = { + learn_language = language_chinese + } + } + } + } + } +} + +create_love_artifact_poetry_effect = { + $OWNER$ = { save_scope_as = owner } + + hidden_effect_new_object = { + get_artifact_quality_effect = yes + get_artifact_wealth_effect = yes + + scope:owner = { + create_artifact = { + name = love_artifact_poetry_name + creator = scope:owner + description = love_artifact_poetry_description + visuals = scroll + type = miscellaneous + modifier = artifact_monthly_minor_prestige_1_modifier + modifier = artifact_attraction_opinion_1_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + } + } + + scope:newly_created_artifact = { + add_scaled_artifact_modifier_minor_prestige_effect = yes + add_scaled_artifact_modifier_majesty_effect = yes + } + } +} + +tgp_bloc_members_join_faction_effect = { + if = { # Japanese blocs + limit = { scope:faction.faction_leader.house.house_confederation.leading_house ?= scope:faction.faction_leader.house } + scope:faction.faction_leader.house.house_confederation ?= { + every_confederation_member = { + limit = { can_join_faction = scope:faction } + join_faction = scope:faction + } + } + } +} + +tgp_bloc_members_join_war_effect = { + custom_tooltip = { + text = tgp_bloc_members_join_war_effect_tt + if = { + limit = { house.house_confederation.leading_house.house_head = this } + house.house_confederation ?= { + every_confederation_member = { + limit = { + NOT = { is_participant_in_war = $WAR$ } + } + save_temporary_scope_as = war_participant_temp + scope:war = { add_attacker = scope:war_participant_temp } + } + } + } + } +} + +tgp_japan_become_a_monk_decision_effect = { + if = { + limit = { is_ai = no } + random_held_title = { + limit = { is_noble_family_title = yes } + current_heir = { save_scope_as = new_player } + } + } + add_character_modifier = { modifier = ep3_renounced_estate } + custom_tooltip = { + text = renounce_noble_family_title_decision_tt + depose = yes + } + if = { + limit = { exists = scope:new_player } + house = { set_house_head = scope:new_player } + set_player_character = scope:new_player + progress_towards_friend_effect = { + REASON = friend_retired_from_governorship + CHARACTER = scope:new_player + OPINION = default_friend_opinion + } + } + tgp_step_down_title_recipient_tooltip_effect = yes + set_variable = { + name = appointment_trait_override + value = trait:intellect_good_3 + } +} + +tgp_dynasty_house_name_setup_effect = { + # Fujiwara + dynasty:japanese_fujiwara.dynasty_founder.house ?= { set_house_name = "dynn_Fujiwara_Hok_ke" } + dynasty:japanese_fujiwara_oshu.dynasty_founder.house ?= { set_house_name = "dynn_Fujiwara_O_shU_" } + # Kiyohara + dynasty:japanese_kiyohara_hirozumi.dynasty_founder.house ?= { set_house_name = "dynn_Kiyohara_Hirozumi" } + # Minamoto + dynasty:japanese_minamoto_daigo.dynasty_founder.house ?= { set_house_name = "dynn_Minamoto_Daigo" } + dynasty:japanese_minamoto_kazan.dynasty_founder.house ?= { set_house_name = "dynn_Minamoto_Kazan" } + dynasty:japanese_minamoto_koko.dynasty_founder.house ?= { set_house_name = "dynn_Minamoto_KO_kO_" } + dynasty:japanese_minamoto_gosanjo.dynasty_founder.house ?= { set_house_name = "dynn_Minamoto_Go_SanjO_" } + dynasty:japanese_minamoto_montoku.dynasty_founder.house ?= { set_house_name = "dynn_Minamoto_Montoku" } + dynasty:japanese_minamoto_murakami.dynasty_founder.house ?= { set_house_name = "dynn_Minamoto_Murakami" } + dynasty:japanese_minamoto_ninmyo.dynasty_founder.house ?= { set_house_name = "dynn_Minamoto_NinmyO_" } + dynasty:japanese_minamoto_saga.dynasty_founder.house ?= { set_house_name = "dynn_Minamoto_Saga" } + dynasty:japanese_minamoto_sanjo.dynasty_founder.house ?= { set_house_name = "dynn_Minamoto_SanjO_" } + dynasty:japanese_minamoto_seiwa.dynasty_founder.house ?= { set_house_name = "dynn_Minamoto_Seiwa" } + dynasty:japanese_minamoto_uda.dynasty_founder.house ?= { set_house_name = "dynn_Minamoto_Uda" } + dynasty:japanese_minamoto_yozei.dynasty_founder.house ?= { set_house_name = "dynn_Minamoto_YO_zei" } + # Taira + dynasty:japanese_taira_kanmu.dynasty_founder.house ?= { set_house_name = "dynn_Taira_Kanmu" } + dynasty:japanese_taira_koko.dynasty_founder.house ?= { set_house_name = "dynn_Taira_KO_kO_" } + dynasty:japanese_taira_montoku.dynasty_founder.house ?= { set_house_name = "dynn_Taira_Montoku" } + dynasty:japanese_taira_ninmyo.dynasty_founder.house ?= { set_house_name = "dynn_Taira_NinmyO_" } +} diff --git a/N3OW/common/scripted_effects/10_dlc_tgp_korea_scripted_effects.txt b/N3OW/common/scripted_effects/10_dlc_tgp_korea_scripted_effects.txt new file mode 100644 index 00000000..717eef1b --- /dev/null +++ b/N3OW/common/scripted_effects/10_dlc_tgp_korea_scripted_effects.txt @@ -0,0 +1,107 @@ + +korea_unify_goryeo_reward_effect = { + # Legend Seed + gain_heroic_legend_seed_tooltip_effect = yes + # Create new titles + create_title_and_vassal_change = { + type = created + save_scope_as = title_change + } + title:e_goryeo = { + change_title_holder = { + holder = scope:king_of_goryeo + change = scope:title_change + } + } + resolve_title_and_vassal_change = scope:title_change + tgp_setup_ceremonial_regent_title_effect = { + FOUNDER = this + CEREMONIAL_TITLE = title:k_yongson_throne + } + # Destroy old titles + title:k_silla = { add_to_list = korea_kingdoms } + title:k_baekje = { add_to_list = korea_kingdoms } + title:k_goguryeo = { add_to_list = korea_kingdoms } + every_in_list = { + list = korea_kingdoms + limit = { holder = scope:king_of_goryeo } + save_scope_as = korean_kingdom + scope:king_of_goryeo = { destroy_title = scope:korean_kingdom } + } + # Cultural acceptance (move towards Goryeo culture) + every_culture_global = { + limit = { + NOT = { this = scope:king_of_goryeo.culture } + OR = { + has_cultural_pillar = heritage_buyeo + has_cultural_pillar = heritage_korean + any_parent_culture = { + OR = { + has_cultural_pillar = heritage_buyeo + has_cultural_pillar = heritage_korean + } + } + } + any_culture_county = { + any_county_province = { geographical_region = world_asia_korea } + } + } + add_to_list = goryeo_cultures + } + every_in_list = { + list = goryeo_cultures + change_cultural_acceptance = { + target = root.culture + value = 25 + desc = cultural_acceptance_gain_unify_goryeo + } + } +} + +tgp_create_ceremonial_regent_title_effect = { + $FOUNDER$ = { save_scope_as = founder } + create_dynamic_title = { + tier = kingdom + name = MERITOCRATIC_CEREMONIAL_LIEGE_TITLE + } + scope:new_title = { + set_variable = { + name = ceremonial_title + value = scope:founder.primary_title + } + set_definitive_form = yes + set_coa = scope:founder.house + } + tgp_setup_ceremonial_regent_title_effect = { + FOUNDER = scope:founder + CEREMONIAL_TITLE = scope:new_title + } +} + +tgp_setup_ceremonial_regent_title_effect = { + $CEREMONIAL_TITLE$ = { save_scope_as = new_title } + $FOUNDER$ = { save_scope_as = founder } + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = yes + } + scope:new_title = { + change_title_holder = { + holder = scope:founder + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + scope:new_title = { add_title_law = single_heir_succession_law } # Regency inherited separately + scope:founder.primary_title = { + save_scope_as = regent_title + set_variable = { + name = administrative_ui_special_title + value = scope:new_title + } + } + scope:founder = { + add_realm_law_skip_effects = single_heir_succession_law # Regency inherited separately + } +} diff --git a/N3OW/common/scripted_effects/10_dlc_tgp_natural_disaster_scripted_effects.txt b/N3OW/common/scripted_effects/10_dlc_tgp_natural_disaster_scripted_effects.txt new file mode 100644 index 00000000..fe59ab55 --- /dev/null +++ b/N3OW/common/scripted_effects/10_dlc_tgp_natural_disaster_scripted_effects.txt @@ -0,0 +1,997 @@ +##################################################################### +# EFFECTS +##################################################################### + +spawn_earthquake_in_region_effect = { + random_county_in_region = { + region = $REGION$ + limit = { + development_level >= 10 + NOT = { + any_county_situation = { + situation_type = natural_disaster_earthquake + } + } + } + alternative_limit = { + development_level >= 5 + NOT = { + any_county_situation = { + situation_type = natural_disaster_earthquake + } + } + } + alternative_limit = { + development_level >= 2 + NOT = { + any_county_situation = { + situation_type = natural_disaster_earthquake + } + } + } + weight = { + base = 1 + modifier = { + any_county_province = { terrain = mountains } + add = 1 + } + modifier = { + any_county_province = { terrain = desert_mountains } + add = 1 + } + # Distribution + modifier = { + save_temporary_scope_as = county_temp + any_in_global_list = { + variable = ongoing_earthquakes + var:epicenter_county.kingdom ?= scope:county_temp.kingdom + } + factor = 0.5 + } + modifier = { + save_temporary_scope_as = county_temp + any_in_global_list = { + variable = ongoing_earthquakes + var:epicenter_county.duchy ?= scope:county_temp.duchy + } + factor = 0.5 + } + modifier = { + save_temporary_scope_as = county_temp + any_in_global_list = { + variable = ongoing_earthquakes + var:epicenter_county ?= scope:county_temp + } + factor = 0.1 + } + } + + spawn_earthquake_in_county_effect = { COUNTY = this } + } +} + +spawn_earthquake_in_county_effect = { + $COUNTY$ = { save_scope_as = epicenter_county } + + # Track globally for exclusivity and distribution + start_situation = { + type = natural_disaster_earthquake + save_scope_as = situation + } + + scope:situation ?= { + set_situation_center_province = scope:epicenter_county.title_province + add_to_global_variable_list = { + name = ongoing_earthquakes + target = this + } + set_variable = { + name = fatalities + value = 0 + } + + # Potentially overridden below based on region + save_scope_value_as = { + name = min_severity + value = 1 + } + save_scope_value_as = { + name = max_severity + value = 3 + } + + scope:epicenter_county.title_province ?= { + switch = { + trigger = geographical_region + geographical_region:world_europe_west_britannia = { save_scope_value_as = { name = max_severity value = 1 } } + geographical_region:world_europe_north = { save_scope_value_as = { name = max_severity value = 1 } } + geographical_region:world_middle_east_arabia = { save_scope_value_as = { name = max_severity value = 1 } } + geographical_region:world_india_deccan = { save_scope_value_as = { name = max_severity value = 1 } } + geographical_region:world_india_rajastan = { save_scope_value_as = { name = max_severity value = 1 } } + geographical_region:custom_lanka = { save_scope_value_as = { name = max_severity value = 1 } } + geographical_region:world_africa_west = { save_scope_value_as = { name = max_severity value = 1 } } + geographical_region:world_steppe_west = { save_scope_value_as = { name = max_severity value = 1 } } + geographical_region:world_siberia = { save_scope_value_as = { name = max_severity value = 1 } } + geographical_region:world_asia_korea = { save_scope_value_as = { name = max_severity value = 1 } } + geographical_region:world_asia_borneo = { save_scope_value_as = { name = max_severity value = 1 } } + } + } + scope:epicenter_county.title_province ?= { + switch = { + trigger = geographical_region + geographical_region:world_europe_south = { save_scope_value_as = { name = min_severity value = 2 } } + geographical_region:world_asia_minor = { save_scope_value_as = { name = min_severity value = 2 } } + geographical_region:world_middle_east = { save_scope_value_as = { name = min_severity value = 2 } } + geographical_region:world_tibet = { save_scope_value_as = { name = min_severity value = 2 } } + geographical_region:world_burma = { save_scope_value_as = { name = min_severity value = 2 } } + geographical_region:custom_arakan_mountains = { save_scope_value_as = { name = min_severity value = 2 } } + geographical_region:world_asia = { save_scope_value_as = { name = min_severity value = 2 } } + geographical_region:custom_bactria = { save_scope_value_as = { name = min_severity value = 2 } } + geographical_region:world_himalaya = { save_scope_value_as = { name = min_severity value = 2 } } + } + } + + set_variable = { + name = severity + value = { + add = { + fixed_range = { + min = 1 + max = 3 + } + min = scope:min_severity + max = scope:max_severity + } + } + } + + set_variable = { + name = epicenter_county + value = scope:epicenter_county + } + + situation_sub_region:disaster_area = { add_dejure_title_to_sub_region = scope:epicenter_county } + # Add neighbours to sub_region + scope:epicenter_county = { + every_neighboring_county = { + add_to_temporary_list = neighbouring_counties + save_temporary_scope_as = neighbouring_county + scope:situation.situation_sub_region:disaster_area = { add_dejure_title_to_sub_region = scope:neighbouring_county } + # Cleanup for simpler debugging + clear_saved_scope = neighbouring_county + } + } + log_natural_disaster = "started" + } +} + +spawn_flood_in_region_effect = { + $REGION$ = { save_scope_as = river_region } + + random_county_in_region = { + region = $REGION$ + limit = { development_level >= 10 } + alternative_limit = { development_level >= 5 } + alternative_limit = { development_level >= 2 } + weight = { + base = 1 + modifier = { + any_county_province = { terrain = farmlands } + add = 1 + } + modifier = { + any_county_province = { terrain = plains } + add = 1 + } + # Distribution + modifier = { + save_temporary_scope_as = county_temp + any_in_global_list = { + variable = ongoing_floods + var:epicenter_county.kingdom ?= scope:county_temp.kingdom + } + factor = 0.5 + } + modifier = { + save_temporary_scope_as = county_temp + any_in_global_list = { + variable = ongoing_floods + var:epicenter_county.duchy ?= scope:county_temp.duchy + } + factor = 0.5 + } + modifier = { + save_temporary_scope_as = county_temp + any_in_global_list = { + variable = ongoing_floods + var:epicenter_county ?= scope:county_temp + } + factor = 0.1 + } + } + spawn_flood_in_county_effect = { COUNTY = this } + } +} + +spawn_flood_in_county_effect = { + $COUNTY$ = { save_scope_as = flood_county } + + if = { + limit = { NOT = { exists = scope:river_region } } + random_in_global_list = { + variable = flood_region_list + limit = { + save_temporary_scope_as = region_temp + NOT = { + any_in_global_list = { + variable = ongoing_floods + scope:region_temp = this + } + } + scope:flood_county.title_province = { geographical_region = scope:region_temp } + } + save_scope_as = river_region + } + } + + start_situation = { + type = natural_disaster_flood + save_scope_as = situation + } + + # Track globally for exclusivity and distribution + scope:situation ?= { + set_situation_center_province = scope:flood_county.title_province + add_to_global_variable_list = { + name = ongoing_floods + target = this + } + + # Save region for exclusivity checks and Situation naming + set_variable = { + name = river_region + value = scope:river_region + } + + set_variable = { + name = fatalities + value = 0 + } + + # Potentially overridden below based on region + save_scope_value_as = { + name = min_severity + value = 1 + } + save_scope_value_as = { + name = max_severity + value = 3 + } + + scope:flood_county.title_province ?= { + switch = { + trigger = geographical_region + geographical_region:yellow_river_region = { save_scope_value_as = { name = min_severity value = 2 } } + geographical_region:nile_river_region = { save_scope_value_as = { name = min_severity value = 2 } } + } + } + + set_variable = { + name = severity + value = { + add = { + fixed_range = { + min = 1 + max = 3 + } + min = scope:min_severity + max = scope:max_severity + } + } + } + + random_situation_sub_region = { add_geographical_region = scope:river_region } + log_natural_disaster = "started" + } +} + +# Requires the following scopes: +# this = character +# scope:situation +# scope:situation_sub_region +natural_disaster_ruler_start_effect = { + save_scope_as = ruler + scope:situation.situation_center_province ?= { + if = { + limit = { scope:ruler = county.holder.top_liege } + save_scope_as = disaster_province + } + } + + if = { + limit = { NOT = { exists = scope:disaster_province } } + scope:situation_sub_region = { + random_situation_sub_region_county = { + limit = { scope:ruler = holder.top_liege } + title_province = { + save_scope_as = disaster_province + } + } + } + } + tgp_activate_catalyst_against_hegemon_effect = { + HEGEMON = scope:ruler.top_liege + CATALYST = catalyst_hegemon_natural_disaster + } + scope:situation = { + switch = { + trigger = situation_type + natural_disaster_earthquake = { + scope:ruler = { natural_disaster_start_great_project_effect = { TYPE = earthquake } } + } + natural_disaster_flood = { + scope:ruler = { natural_disaster_start_great_project_effect = { TYPE = flood } } + } + } + } + scope:great_project ?= { + set_variable = { + name = situation + value = scope:situation + } + scope:situation = { # Nested to prevent errors from non-existence + add_to_variable_list = { + name = great_projects + target = scope:great_project + } + } + } +} + +natural_disaster_start_great_project_effect = { + natural_disaster_save_disaster_province_effect = yes + if = { # make sure this ruler doesn't already have a great project for this disaster + limit = { + NOT = { + any_great_project = { + great_project_type = great_project_$TYPE$ + great_project_owner = scope:ruler + var:situation = scope:situation + } + } + } + scope:disaster_province ?= { + plan_great_project = { + great_project_type = great_project_$TYPE$ + founder = scope:ruler + save_scope_as = great_project + } + } + } +} + +great_projects_ensure_unique_disaster_recovery_projects_effect = { + save_scope_as = title_holder + every_character_situation = { + limit = { tgp_natural_disaster_situation_is_disaster_trigger = yes } + every_great_project = { + limit = { + OR = { + great_project_type = great_project_earthquake + great_project_type = great_project_flood + } + great_project_owner = scope:title_holder + var:situation = prev + } + add_to_list = recovery_projects + } + random_in_list = { # find the one to keep + list = recovery_projects + limit = { scope:founder = scope:title_holder } + alternative_limit = { scope:founder.house = scope:title_holder.house } + alternative_limit = { always = yes } # basically random + save_scope_as = project_to_keep + } + every_in_list = { # destroy the rest + list = recovery_projects + limit = { this != scope:project_to_keep } + cancel_great_project = this + } + } +} + +natural_disaster_vassal_recovery_start_effect = { + show_as_tooltip = { + custom_tooltip = natural_disaster_vassal_recovery_start_tt + } +} + +natural_disaster_vassal_start_effect = { + show_as_tooltip = { + root.top_liege = { + if = { + limit = { has_legitimacy = yes } + add_legitimacy = natural_disaster_legitimacy_loss_value + } + } + scope:existing_great_project.great_project_location ?= { + plan_great_project = { + great_project_type = natural_disaster_$TYPE$ + founder = root.top_liege + } + } + + } +} + +# Effect to manage spacing of warning events +natural_disaster_fire_warning_event_effect = { + trigger_event = { + id = natural_disaster.9001 + days = 20 + } +} + +# Effect to manage spacing of impact events +natural_disaster_fire_spaced_impact_events_effect = { + natural_disaster_impact_effect = yes + + # Event for travellers through the affected region + every_situation_sub_region = { + every_situation_sub_region_county = { + every_county_province = { + every_character_in_location = { + trigger_event = natural_disaster_flavor_events.0005 + } + } + } + } + + # Later random impact/death events + trigger_event = { + id = natural_disaster.9010 # Random + days = 7 + } + trigger_event = { + id = natural_disaster.9010 # Random + days = 14 + } + trigger_event = { + id = natural_disaster.9010 # Random + days = 21 + } +} + +try_remove_disaster_vars_effect = { + if = { + limit = { + NOT = { + any_character_situation = { + tgp_natural_disaster_situation_is_disaster_trigger = yes + } + } + } + if = { + limit = { has_diarchy_type = temporary_regency } + end_diarchy = yes + } + remove_variable = natural_disaster_received_first_warning + remove_variable = natural_disaster_5102_count + if = { + limit = { has_variable = natural_disaster_contribution_discount } + remove_variable = natural_disaster_contribution_discount + } + } +} + +natural_disaster_death_damage_roll_effect = { + save_scope_as = situation + every_situation_county = { + every_county_province = { + every_character_in_location = { add_to_list = killable_characters } + every_army_in_location = { add_to_list = damageable_armies } + } + } + # Risk of characters to die or their armies to get damaged + every_in_list = { + list = killable_characters + if = { + limit = { is_pool_character = yes } + add_to_list = killed_characters + commanding_army ?= { add_to_list = damaged_armies } + knight_army ?= { add_to_list = damaged_armies } + } + else = { + random = { + chance = natural_disaster_base_death_chance_value + add_to_list = killed_characters + commanding_army ?= { add_to_list = damaged_armies } + knight_army ?= { add_to_list = damaged_armies } + } + } + } + # Risk of armies to get damaged if they weren't already from their leader commander/knight dying + every_in_list = { + list = damageable_armies + limit = { + NOT = { is_in_list = damaged_armies } + } + random = { # 25% to 50% base risk of getting damaged depending on size, plus more from type and severity + chance = 25 + modifier = { + add = { + value = army_size + divide = 1000 + max = 25 + } + } + modifier = { # Earthquakes are more deadly + scope:situation = { situation_type = natural_disaster_earthquake } + factor = 1.5 + } + modifier = { # Earthquake epicenters are more deadly + scope:situation.var:epicenter_county ?= location.county + factor = 1.5 + } + add_to_list = damaged_armies + } + } + + # EVENTS + # Inform players they may die. + every_player = { + limit = { is_in_list = killed_characters } + add_to_list = informees + trigger_event = natural_disaster.5101 + } + + # Otherwise inform players of any deaths. + every_in_list = { + list = killed_characters + save_scope_as = killed_character + every_player = { + if = { + limit = { + scope:killed_character = { is_travelling = yes } + this = current_travel_plan.travel_plan_owner + } + save_scope_as = message_receiver_temp + } + else_if = { + limit = { + scope:killed_character = { is_in_army = yes } + this = knight_army.army_commander + } + save_scope_as = message_receiver_temp + } + else_if = { + limit = { + scope:killed_character = { exists = involved_activity } + involved_activity ?= scope:killed_character.involved_activity + } + save_scope_as = message_receiver_temp + } + else_if = { + limit = { + scope:killed_character = { liege_or_court_owner = prev } + } + save_scope_as = message_receiver_temp + } + else_if = { + limit = { + OR = { + is_of_major_interest_trigger = { CHARACTER = scope:killed_character } + is_of_minor_interest_trigger = { CHARACTER = scope:killed_character } + } + } + save_scope_as = message_receiver_temp + } + } + scope:message_receiver_temp ?= { + if = { + limit = { + any_character_situation = { this = scope:situation } # we literally do not care if we aren't subject to the disaster + NOT = { is_in_list = informees } + } + add_to_list = informees + + if = { + limit = { + any_in_list = { + list = killed_characters + location = prev.location + } + } + save_scope_as = local_death + } + + trigger_event = { + id = natural_disaster.5102 + } + } + } + } + + # Inform players their army is damaged. + every_in_list = { + list = damaged_armies + army_commander ?= { + if = { + limit = { + is_ai = no + NOT = { is_in_list = informees } + } + add_to_list = informees + trigger_event = natural_disaster.5111 + } + } + } + # Otherwise inform players of any damaged armies. + every_in_list = { + list = damaged_armies + limit = { + NOR = { + army_commander = { is_in_list = informees } + save_temporary_scope_as = army_temp + any_in_list = { + list = killed_characters + knight_army ?= scope:army_temp + } + } + } + save_scope_as = army + army_owner = { + if = { + limit = { + NOT = { this = scope:army.army_commander } + } + send_interface_message = { + type = msg_natural_disaster_army_damaged_bad + title = natural_disaster_army_damaged_title + right_icon = scope:army.army_commander + show_as_tooltip = { + scope:army = { natural_disaster_army_damage_effect = yes } + every_in_list = { + list = killed_characters + limit = { knight_army ?= scope:army } + save_scope_as = victim_temp + natural_disaster_death_effect = { VICTIM = scope:victim_temp } + } + } + } + } + every_war_ally = { + send_interface_message = { + type = msg_natural_disaster_army_damaged_bad + title = natural_disaster_allied_army_damaged_title + right_icon = scope:army.army_commander + show_as_tooltip = { + scope:army = { natural_disaster_army_damage_effect = yes } + every_in_list = { + list = killed_characters + limit = { knight_army ?= scope:army } + save_scope_as = victim_temp + natural_disaster_death_effect = { VICTIM = scope:victim_temp } + } + } + } + } + every_war_enemy = { + send_interface_message = { + type = msg_natural_disaster_army_damaged_good + title = natural_disaster_enemy_army_damaged_title + right_icon = scope:army.army_commander + show_as_tooltip = { + scope:army = { natural_disaster_army_damage_effect = yes } + every_in_list = { + list = killed_characters + limit = { knight_army ?= scope:army } + save_scope_as = victim_temp + natural_disaster_death_effect = { VICTIM = scope:victim_temp } + } + } + } + } + } + } + # Actually kill people. + every_in_list = { + list = killed_characters + limit = { + is_ai = yes # Players who die will do so in events + is_alive = yes + } + save_scope_as = victim_temp + natural_disaster_death_effect = { VICTIM = scope:victim_temp } + } + # Actually damage armies. + every_in_list = { + list = damaged_armies + save_scope_as = army_temp + natural_disaster_army_damage_effect = yes + } + debug_log_scopes = yes +} + +natural_disaster_survival_memory_effect = { + if = { + limit = { + any_memory = { + memory_type = survived_disaster_memory + memory_age_years < 1 + } + } + # Don't add duplicates + } + else = { + create_character_memory = { type = survived_disaster_memory } + ordered_memory = { + order_by = memory_creation_date + save_scope_as = memory + scope:situation = { + switch = { + trigger = situation_type + natural_disaster_flood = { + scope:memory = { + set_variable = { name = disaster value = flag:flood } + set_variable = { name = river_region value = scope:situation.var:river_region } + } + } + natural_disaster_earthquake = { + scope:memory = { + set_variable = { name = disaster value = flag:earthquake } + set_variable = { name = epicenter_county value = scope:situation.situation_center_province.county } + } + } + } + } + set_variable = { name = location value = memory_owner.location } + } + } +} + +# Effect to apply the correct death reason to a killed character +natural_disaster_death_effect = { + scope:situation = { + change_variable = { + name = fatalities + add = 1 + } + switch = { + trigger = situation_type + natural_disaster_earthquake = { + $VICTIM$ = { + death = { death_reason = death_consumed_by_earthquake } + } + } + natural_disaster_flood = { + $VICTIM$ = { + death = { death_reason = death_swept_away_by_flash_flood } + } + } + } + } +} + +# Effect to damage an army +natural_disaster_army_damage_effect = { + subtract_supply = natural_disaster_army_supply_loss_value + deplete_army_by_percentage = natural_disaster_army_deplete_value +} + +# Save base useful event scopes +natural_disaster_save_base_scopes_effect = { + situation_center_province.county ?= { save_scope_as = epicenter_county } + var:river_region ?= { save_scope_as = river_region } + scope:situation_sub_region ?= { save_scope_as = situation_sub_region } +} + +natural_disaster_save_disaster_province_effect = { + save_scope_as = disaster_province_ruler + scope:situation = { + every_situation_sub_region = { + every_situation_sub_region_county = { + limit = { holder.top_liege ?= scope:disaster_province_ruler } + add_to_list = disaster_counties + } + } + random_in_list = { + list = disaster_counties + limit = { situation_center_province.county ?= this } + alternative_limit = { holder ?= scope:disaster_province_ruler } + alternative_limit = { holder.liege ?= scope:disaster_province_ruler } + alternative_limit = { always = yes } + title_province = { save_scope_as = disaster_province } + } + } +} + +natural_disaster_impact_effect = { + scope:situation = { + switch = { + trigger = situation_type + natural_disaster_earthquake = { + every_situation_county = { + custom = every_disaster_county_custom + change_county_control = natural_disaster_earthquake_control_loss_value + if = { + limit = { scope:situation.var:severity >= 2.5 } + add_county_modifier = { + modifier = tgp_natural_disaster_earthquake_3_county_modifier + duration_desc = until_the_disaster_is_over + years = 25 + } + } + else_if = { + limit = { scope:situation.var:severity >= 1.5 } + add_county_modifier = { + modifier = tgp_natural_disaster_earthquake_2_county_modifier + duration_desc = until_the_disaster_is_over + years = 25 + } + } + else = { + add_county_modifier = { + modifier = tgp_natural_disaster_earthquake_1_county_modifier + duration_desc = until_the_disaster_is_over + years = 25 + } + } + } + } + natural_disaster_flood = { + every_situation_county = { + custom = every_disaster_county_custom + change_county_control = natural_disaster_flood_control_loss_value + if = { + limit = { scope:situation.var:severity >= 2.5 } + add_county_modifier = { + modifier = tgp_natural_disaster_flood_3_county_modifier + duration_desc = until_the_disaster_is_over + years = 25 + } + } + else_if = { + limit = { scope:situation.var:severity >= 1.5 } + add_county_modifier = { + modifier = tgp_natural_disaster_flood_2_county_modifier + duration_desc = until_the_disaster_is_over + years = 25 + } + } + else = { + add_county_modifier = { + modifier = tgp_natural_disaster_flood_1_county_modifier + duration_desc = until_the_disaster_is_over + years = 25 + } + } + } + } + } + } +} + +natural_disaster_great_project_mandatory_investment_reward_effect = { + if = { + limit = { this = scope:owner } + if = { + limit = { is_valid_for_legitimacy_change = yes } + add_legitimacy = natural_disaster_great_project_mandatory_investment_legitimacy_gain_value + } + else = { + add_prestige = minor_prestige_gain + add_piety = minor_piety_gain + } + } + else_if = { + limit = { is_governor = yes } + change_influence = minor_influence_gain + increase_governance_effect = { VALUE = 2 } + } + else = { + add_prestige = medium_prestige_gain + add_piety = medium_prestige_gain + } + if = { + limit = { + government_allows = merit + this != title:h_china.holder # Chinese Emperor does not "use" merit + } + change_merit = { + value = medium_merit_gain + } + } +} + +natural_disaster_assign_councillor_to_manage_effect = { + if = { + limit = { government_has_flag = government_is_nomadic } + random_councillor = { + limit = { is_kurultai_trigger = yes } + save_scope_as = councillor + } + } + else_if = { + limit = { government_has_flag = government_is_landless_adventurer } + random_entourage_character = { + save_scope_as = councillor + } + } + else_if = { + limit = { government_has_flag = government_is_celestial } + cp:minister_works = { save_scope_as = councillor } + } + else = { + cp:councillor_steward = { save_scope_as = councillor } + } + $GREAT_PROJECT$ = { + set_variable = { + name = managing_councillor + value = scope:councillor + } + } +} + +natural_disaster_great_project_optional_investment_reward_effect = { + if = { + limit = { this = scope:owner } + if = { + limit = { is_valid_for_legitimacy_change = yes } + add_legitimacy = natural_disaster_great_project_optional_investment_legitimacy_gain_value + } + else = { + add_prestige = medium_prestige_gain + add_piety = medium_piety_gain + } + } + else_if = { + limit = { is_governor = yes } + change_influence = medium_influence_gain + increase_governance_effect = { VALUE = 5 } + } + else = { + add_prestige = major_prestige_gain + add_piety = major_prestige_gain + } + if = { + limit = { + government_allows = merit + this != title:h_china.holder # Chinese Emperor does not "use" merit + } + change_merit = { + value = major_merit_gain + } + } +} + +# OPERATION: 'add' or 'remove' modifier +# MODIFIER: which modifier to add/remove +# YEARS: duration in years, or negative value for permanent +natural_disaster_all_counties_investment_modifier_effect = { + scope:situation ?= { + every_situation_county = { + limit = { holder.top_liege = scope:owner } + custom = every_realm_disaster_county_great_project_custom + if = { + limit = { exists = $YEARS$ } + $OPERATION$_county_modifier = { + modifier = $MODIFIER$ + years = $YEARS$ + } + } + else = { + $OPERATION$_county_modifier = { + modifier = $MODIFIER$ + } + } + } + } +} + +natural_disaster_great_project_save_scopes_effect = { + scope:great_project.var:situation ?= { + save_scope_as = situation + situation_sub_region:disaster_area = { save_scope_as = situation_sub_region } + } +} diff --git a/N3OW/common/scripted_effects/10_dlc_tgp_scripted_effects.txt b/N3OW/common/scripted_effects/10_dlc_tgp_scripted_effects.txt new file mode 100644 index 00000000..ef92b0d1 --- /dev/null +++ b/N3OW/common/scripted_effects/10_dlc_tgp_scripted_effects.txt @@ -0,0 +1,9155 @@ +spawn_celestial_governance_contract_effect = { + save_scope_as = governor + # Select the Contract Tier (somewhat randomized, based on your experience as a governor) + random_list = { + 30 = { + save_scope_value_as = { + name = governance_task_contract_tier + value = define:NTaskContract|LOW_TASK_CONTRACT_TIER + } + } + 20 = { + save_scope_value_as = { + name = governance_task_contract_tier + value = define:NTaskContract|MEDIUM_TASK_CONTRACT_TIER + } + + modifier = { + add = 10 + has_trait = governor + } + modifier = { + add = 10 + has_trait = governor + has_trait_xp = { + trait = governor + value >= 40 + } + } + } + 10 = { + save_scope_value_as = { + name = governance_task_contract_tier + value = define:NTaskContract|HIGH_TASK_CONTRACT_TIER + } + + modifier = { + add = 10 + has_trait = governor + } + modifier = { + add = 10 + has_trait = governor + has_trait_xp = { + trait = governor + value >= 40 + } + } + modifier = { + add = 20 + has_trait = governor + has_trait_xp = { + trait = governor + value >= 80 + } + } + } + } + + # Select which contract to create + trigger_event = { + on_action = spawn_celestial_governance_contract_on_action + } + + play_sound_effect = "event:/DLC/EP4/SFX/UI/domicile_buildings/tgp_ui_domicile_building_archives_japanese" +} + +remove_other_grand_guardian_modifiers_effect = { + hidden_effect = { # No need to show this + # Let's check for the county opinion modifier first + scope:liege ?= { + # We check and scope to all counties to make sure we remove any stray modifiers in case the capital is moved, etc. + every_realm_county = { + limit = { + any_county_province = { + has_province_modifier = grand_guardian_guard_the_capital_modifier + } + } + every_county_province = { + limit = { + has_province_modifier = grand_guardian_guard_the_capital_modifier + } + remove_province_modifier = grand_guardian_guard_the_capital_modifier + } + } + } + } +} + +### Grand Mentor Task Effects ### +grand_mentor_mentoring_skill_effect = { + send_interface_toast = { + type = event_royal_court_good_with_text + title = grand_mentor_mentoring_title + desc = grand_mentor_mentoring_notification_desc + left_icon = root + right_icon = scope:target_character + + scope:target_character = { add_$SKILL$_skill = 1 } + } +} + +grand_mentor_mentoring_merit_effect = { + send_interface_toast = { + type = event_royal_court_good_with_text + title = grand_mentor_mentoring_title + desc = grand_mentor_mentoring_notification_desc + left_icon = root + right_icon = scope:target_character + + scope:target_character = { change_merit = major_merit_gain } + } +} + +grand_mentor_mentoring_trait_xp_effect = { + send_interface_toast = { + type = event_royal_court_good_with_text + title = grand_mentor_mentoring_title + desc = grand_mentor_mentoring_notification_desc + left_icon = root + right_icon = scope:target_character + + scope:target_character = { + add_trait_xp = { + trait = $TRAIT$ + value = 5 + } + } + } +} + +grand_mentor_mentoring_trait_track_xp_effect = { + send_interface_toast = { + type = event_royal_court_good_with_text + title = grand_mentor_mentoring_title + desc = grand_mentor_mentoring_notification_desc + left_icon = root + right_icon = scope:target_character + + scope:target_character = { + add_trait_xp = { + trait = $TRAIT$ + track = $TRACK$ + value = 5 + } + } + } +} + +# Rewards for contributing to upgrading the great wall +contributor_great_wall_reward_effect = { + if = { + limit = { + this != scope:owner + is_alive = yes + } + send_interface_toast = { + title = great_project_contribution_msg_t + left_icon = root + right_icon = scope:owner + + if = { + limit = { + government_allows = merit + } + change_merit = monumental_merit_gain + } + if = { + limit = { + government_allows = administrative + } + change_influence = monumental_influence_gain + } + else = { + add_prestige = major_prestige_gain + } + } + } +} + +great_project_notify_completion = { + $CHARACTER$ ?= { + send_interface_toast = { + type = event_generic_neutral_text + title = great_project_completed_msg_t + left_icon = scope:founder + right_icon = scope:province.county + desc = great_project_completed_msg_desc + } + } +} + +# root = contributor +great_project_notify_contribution = { + if = { + limit = { + this != scope:owner + } + scope:owner ?= { + send_interface_toast = { + type = event_generic_good_with_text + title = great_project_contributed_msg_t + desc = great_project_contributed_msg_desc + left_icon = root + right_icon = scope:great_project.great_project_location.county + } + } + } +} + +# If both owner and contributor are part of the Dynastic Cycle, trigger the contribution catalyst +great_project_contribution_catalyst_effect = { + if = { + limit = { + this != scope:owner + scope:owner ?= { + any_character_situation = { + situation_type = dynastic_cycle + } + } + OR = { + scope:great_project.great_project_type = great_project_type:great_wall + scope:great_project.great_project_type = great_project_type:great_wall_extend_to_shanhai_pass + scope:great_project.great_project_type = great_project_type:great_wall_extend_to_liaodong + scope:great_project.great_project_type = great_project_type:minister_project_establish_control + } + } + random_character_situation = { + limit = { situation_type = dynastic_cycle } + switch = { + trigger = scope:great_project.great_project_type + great_project_type:great_wall = { trigger_situation_catalyst = catalyst_great_project_great_wall_contribution } + great_project_type:great_wall_extend_to_shanhai_pass = { trigger_situation_catalyst = catalyst_great_project_great_wall_contribution } + great_project_type:great_wall_extend_to_liaodong = { trigger_situation_catalyst = catalyst_great_project_great_wall_contribution } + great_project_type:minister_project_establish_control = { trigger_situation_catalyst = catalyst_great_project_establish_control_contribution } + } + } + } +} + +# root = contributor +great_project_reward_contribution_completion_notification_effect = { + if = { + limit = { this != scope:owner } + send_interface_toast = { + title = great_project_contribution_msg_t + left_icon = root + right_icon = scope:owner + + great_project_contribution_completion_reward_$LEVEL$_effect = { EXTRA_EFFECT = $NON_OWNER_REWARD_EFFECT$ } + } + } + else = { + send_interface_toast = { + title = great_project_contribution_msg_t + left_icon = root + right_icon = scope:province + + great_project_contribution_completion_reward_$LEVEL$_effect = { EXTRA_EFFECT = $OWNER_REWARD_EFFECT$ } + } + } +} + +great_project_contribution_completion_reward_major_effect = { + great_project_reward_contribution_completion_actual_reward_effect = { + LEGITIMACY_GAIN = minor_legitimacy_gain + INFLUENCE_GAIN = medium_influence_gain + GOVERNANCE_GAIN = 5 + PRESTIGE_GAIN_WITH_GOVERNANCE = minor_prestige_gain + PRESTIGE_GAIN_FALLBACK = major_prestige_gain + MERIT_GAIN = minor_merit_gain + EXTRA_EFFECT = $EXTRA_EFFECT$ + } +} + +great_project_contribution_completion_reward_minor_effect = { + great_project_reward_contribution_completion_actual_reward_effect = { + LEGITIMACY_GAIN = miniscule_legitimacy_gain + INFLUENCE_GAIN = minor_influence_gain + GOVERNANCE_GAIN = 2 + PRESTIGE_GAIN_WITH_GOVERNANCE = miniscule_prestige_gain + PRESTIGE_GAIN_FALLBACK = minor_prestige_gain + MERIT_GAIN = miniscule_merit_gain + EXTRA_EFFECT = $EXTRA_EFFECT$ + } +} + +great_project_reward_contribution_completion_actual_reward_effect = { + if = { + limit = { + is_valid_for_legitimacy_change = yes + } + add_legitimacy = { + value = $LEGITIMACY_GAIN$ + if = { + limit = { + any_character_situation = { + situation_type = dynastic_cycle + has_situation_top_phase_parameter = dynastic_cycle_great_projects_increased_legitimacy + } + } + multiply = 2 + } + } + } + else = { + if = { + limit = { government_allows = administrative } + change_influence = $INFLUENCE_GAIN$ + } + + if = { + limit = { is_governor = yes } + increase_governance_effect = { VALUE = $GOVERNANCE_GAIN$ } + add_prestige = $PRESTIGE_GAIN_WITH_GOVERNANCE$ + } + else = { + add_prestige = $PRESTIGE_GAIN_FALLBACK$ + } + if = { + limit = { + government_allows = merit + this != title:h_china.holder # Chinese Emperor does not "use" merit + } + change_merit = $MERIT_GAIN$ + } + } + $EXTRA_EFFECT$ = yes +} + +great_project_reward_contribution_completion_stewardship_xp = { + add_stewardship_lifestyle_xp = medium_lifestyle_xp +} + +# This is cursed but necessary for the string substitution in great_project_reward_contribution_completion effects to work +great_project_reward_contribution_completion_null = {} + +spawn_natural_disaster_contract_effect = { + if = { + limit = { + is_governor = yes + trigger_if = { + limit = { is_ai = yes } + is_available = yes + } + } + save_scope_as = governor + # Select the Contract Tier (somewhat randomized, based on your experience as a governor) + random_list = { + 30 = { + save_scope_value_as = { + name = governance_task_contract_tier + value = define:NTaskContract|LOW_TASK_CONTRACT_TIER + } + } + 20 = { + save_scope_value_as = { + name = governance_task_contract_tier + value = define:NTaskContract|MEDIUM_TASK_CONTRACT_TIER + } + + modifier = { + add = 10 + has_trait = governor + } + modifier = { + add = 10 + has_trait = governor + has_trait_xp = { + trait = governor + value >= 40 + } + } + } + 10 = { + save_scope_value_as = { + name = governance_task_contract_tier + value = define:NTaskContract|HIGH_TASK_CONTRACT_TIER + } + + modifier = { + add = 10 + has_trait = governor + } + modifier = { + add = 10 + has_trait = governor + has_trait_xp = { + trait = governor + value >= 40 + } + } + modifier = { + add = 20 + has_trait = governor + has_trait_xp = { + trait = governor + value >= 80 + } + } + } + } + + # Select which contract to create + trigger_event = { + on_action = spawn_natural_disaster_contract_on_action + } + + play_sound_effect = "event:/DLC/EP4/SFX/UI/domicile_buildings/tgp_ui_domicile_building_archives_japanese" + } +} +# root = scope:character +# requires a scope:situation_participant_group to be saved beforehand +# ran on game start through the dynastic cycle script and on character joining a movement +set_movement_leader_and_power_effect = { + save_scope_as = char + bring_disciples_to_movement_effect = yes + scope:situation_participant_group = { + # set root as leader if leader doesn't exist yet + if = { + limit = { + NOT = { exists = var:movement_leader } + } + set_variable = { + name = movement_leader + value = scope:char + } + } + # update movement power + set_variable = { + name = movement_power + value = movement_power_value + } + } +} +# root = scope:character +# requires a scope:situation_participant_group to be saved beforehand +bring_disciples_to_movement_effect = { + #all of your disciples should always follow you + save_temporary_scope_as = recipient #for loc + every_relation = { + type = disciple + custom = every_disciple_joins_movement + scope:situation_participant_group = { + switch = { + trigger = participant_group_type + expansion_movement = { + custom_tooltip = celestial_switch_movement_to_expansion_tt + prev = { + if = { + limit = { + is_ai = no + } + run_interaction = { + interaction = celestial_ask_to_switch_movements_interaction + actor = scope:recipient + recipient = this + send_threshold = decline + } + } + else = { + set_variable = { + name = movement_member + value = flag:expansion + } + } + } + } + advancement_movement = { + custom_tooltip = celestial_switch_movement_to_advancement_tt + prev = { + if = { + limit = { + is_ai = no + } + run_interaction = { + interaction = celestial_ask_to_switch_movements_interaction + actor = scope:recipient + recipient = this + send_threshold = decline + } + } + else = { + set_variable = { + name = movement_member + value = flag:advancement + } + } + } + } + pro_hegemon_movement = { + custom_tooltip = celestial_switch_movement_to_pro_hegemon_tt + prev = { + if = { + limit = { + is_ai = no + } + run_interaction = { + interaction = celestial_ask_to_switch_movements_interaction + actor = scope:recipient + recipient = this + send_threshold = decline + } + } + else = { + set_variable = { + name = movement_member + value = flag:pro_hegemon + } + } + } + } + conservative_movement = { + custom_tooltip = celestial_switch_movement_to_conservative_tt + prev = { + if = { + limit = { + is_ai = no + } + run_interaction = { + interaction = celestial_ask_to_switch_movements_interaction + actor = scope:recipient + recipient = this + send_threshold = decline + } + } + else = { + set_variable = { + name = movement_member + value = flag:conservative + } + } + } + } + } + } + custom_tooltip = every_disciple_adds_movement_power_tt + hidden_effect = { recalculate_participant_group = situation:dynastic_cycle } + } +} + +# root = scope:situation_participant_group +# Fallback configuration of making sure we have a movement leader +# We run this on the yearly pulse through the dynastic cycle script and on character leaving a movement +update_movement_leader_effect = { + ordered_situation_group_participant = { + order_by = var:movement_power # just set the character with highest movement_power + scope:situation_participant_group = { + set_variable = { + name = movement_leader + value = prev + } + } + } +} + +# For when a character becomes the new movement leader +# Use in a character scope +make_movement_leader_effect = { + save_temporary_scope_as = new_movement_leader + if = { + limit = { + any_character_situation = { + situation_type = dynastic_cycle + any_participant_group = { + participant_group_has_character = scope:new_movement_leader + NOR = { # Is not a group without a leader + participant_group_type = hegemon_ruler + participant_group_type = undecided_movement + participant_group_type = other_rulers + } + save_temporary_scope_as = leaders_movement + } + } + } + custom_description = { + text = make_movement_leader_effect_desc + subject = scope:new_movement_leader + object = scope:leaders_movement + situation:dynastic_cycle ?= { + random_participant_group = { + limit = { + participant_group_has_character = scope:new_movement_leader + } + set_variable = { + name = movement_leader + value = scope:new_movement_leader + } + } + } + } + if = { + limit = { + scope:debate_loser ?= { + this != scope:new_movement_leader + var:movement_power < scope:new_movement_leader.var:movement_power + } + } + switch = { + trigger = scope:leaders_movement + situation:dynastic_cycle.situation_participant_group:expansion_movement = { + tgp_activate_catalyst_against_hegemon_effect = { + HEGEMON = scope:new_movement_leader.top_liege + CATALYST = catalyst_movement_gained_power_expansion + } + } + situation:dynastic_cycle.situation_participant_group:advancement_movement = { + tgp_activate_catalyst_against_hegemon_effect = { + HEGEMON = scope:new_movement_leader.top_liege + CATALYST = catalyst_movement_gained_power_advancement + } + } + situation:dynastic_cycle.situation_participant_group:conservative_movement = { + tgp_activate_catalyst_against_hegemon_effect = { + HEGEMON = scope:new_movement_leader.top_liege + CATALYST = catalyst_movement_gained_power_conservative + } + } + situation:dynastic_cycle.situation_participant_group:pro_hegemon_movement = { + tgp_activate_catalyst_against_hegemon_effect = { + HEGEMON = scope:new_movement_leader.top_liege + CATALYST = catalyst_movement_gained_power_pro_hegemon + } + } + } + } + } +} + +# root = scope:situation_participant_group +# ran on yearly pulse through the dynastic cycle script and on character leaving a movement +update_movement_power_effect = { + set_variable = { + name = movement_power + value = movement_power_value + } +} + +# root = scope:character +update_character_movement_power_individual_effect = { + set_variable = { + name = movement_power_individual + value = movement_power_character_individual_value + } +} + +# root = scope:characte +update_character_movement_power_disciples_effect = { + set_variable = { + name = movement_power_disciples + value = { + value = every_disciple_movement_power_value + multiply = 0.25 + } + } +} + +# root = scope:character +# ran on yearly pulse through the dynastic cycle script and on character leaving a movement +update_character_movement_power_effect = { + update_character_movement_power_individual_effect = yes + update_character_movement_power_disciples_effect = yes + set_variable = { + name = movement_power + value = { + add = { + value = var:movement_power_individual + } + add = { + value = var:movement_power_disciples + } + } + } +} + +change_bureaucracy_laws_increase_effect = { + scope:hegemon = { + change_realm_law_level = { law_group = celestial_bureaucracy change = 1 } + } +} +change_bureaucracy_laws_decrease_effect = { + scope:hegemon = { + change_realm_law_level = { law_group = celestial_bureaucracy change = -1 } + } +} +change_army_laws_increase_effect = { + scope:hegemon = { + change_realm_law_level = { law_group = celestial_army_liege_law change = 1 } + } +} +change_army_laws_decrease_effect = { + scope:hegemon = { + change_realm_law_level = { law_group = celestial_army_liege_law change = -1 } + } +} +change_province_metropolitan_effect = { + if = { + limit = { + NOT = { exists = scope:province_change_recipient } + } + custom_tooltip = change_province_metropolitan_effect.no_scope + } + else = { + scope:province_change_recipient = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 2 + } + hidden_effect = { + set_vassal_contract_modification_blocked = yes + add_realm_law_skip_effects = celestial_appointment_succession_law + } + } + } +} +change_province_industrial_effect = { + if = { + limit = { + NOT = { exists = scope:province_change_recipient } + } + custom_tooltip = change_province_industrial_effect.no_scope + } + else = { + scope:province_change_recipient = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 1 + } + hidden_effect = { + set_vassal_contract_modification_blocked = yes + add_realm_law_skip_effects = celestial_appointment_succession_law + } + } + } +} +change_province_military_effect = { + if = { + limit = { + NOT = { exists = scope:province_change_recipient } + } + custom_tooltip = change_province_military_effect.no_scope + } + else = { + scope:province_change_recipient = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 3 + } + hidden_effect = { + set_vassal_contract_modification_blocked = yes + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + } +} +change_province_protectorate_effect = { + if = { + limit = { + NOT = { exists = scope:province_change_recipient } + } + custom_tooltip = change_province_protectorate_effect.no_scope + } + else = { + scope:province_change_recipient = { + vassal_contract_set_obligation_level = { + type = celestial_provinces + level = 4 + } + hidden_effect = { + set_vassal_contract_modification_blocked = yes + add_realm_law_skip_effects = celestial_military_appointment_succession_law + } + } + } +} +hold_examinations_effect = { + custom_tooltip = celestial_movement_demands_interaction.tt.hold_examinations_effect + hidden_effect = { + scope:hegemon = { + add_character_flag = { + flag = examinations_ai_override + } + ai_attempt_to_host_activity = activity_imperial_examination + } + } +} +change_retirement_law_increase_effect = { + scope:hegemon = { + change_realm_law_level = { law_group = celestial_retirement_law change = -1 } + } +} +change_retirement_law_decrease_effect = { + scope:hegemon = { + change_realm_law_level = { law_group = celestial_retirement_law change = 1 } + } +} +change_candidate_score_law_effect = { + scope:hegemon = { + if = { + limit = { + has_realm_law = candidate_score_merit_law + } + add_realm_law_skip_effects = candidate_score_prestige_law + } + else = { + add_realm_law_skip_effects = candidate_score_merit_law + } + } +} +increase_budget_salary_effect = { + scope:hegemon = { + if = { + limit = { + scope:petitioner.var:budget_change ?= flag:decrease_ministry + } + change_realm_law_level = { law_group = budget_allocation_salary_law change = 1 } + change_realm_law_level = { law_group = budget_allocation_ministry_law change = -1 } + } + else = { + change_realm_law_level = { law_group = budget_allocation_salary_law change = 1 } + change_realm_law_level = { law_group = budget_allocation_military_law change = -1 } + + } + enact_treasury_budgets_no_costs = yes + } +} +increase_budget_ministry_effect = { + scope:hegemon = { + if = { + limit = { + scope:petitioner.var:budget_change ?= flag:decrease_salary + } + change_realm_law_level = { law_group = budget_allocation_ministry_law change = 1 } + change_realm_law_level = { law_group = budget_allocation_salary_law change = -1 } + } + else = { + change_realm_law_level = { law_group = budget_allocation_ministry_law change = 1 } + change_realm_law_level = { law_group = budget_allocation_military_law change = -1 } + + } + enact_treasury_budgets_no_costs = yes + } +} +increase_budget_military_effect = { + scope:hegemon = { + if = { + limit = { + scope:petitioner.var:budget_change ?= flag:decrease_ministry + } + change_realm_law_level = { law_group = budget_allocation_military_law change = 1 } + change_realm_law_level = { law_group = budget_allocation_ministry_law change = -1 } + } + else = { + change_realm_law_level = { law_group = budget_allocation_military_law change = 1 } + change_realm_law_level = { law_group = budget_allocation_salary_law change = -1 } + + } + enact_treasury_budgets_no_costs = yes + } +} + +grant_movement_petition_tooltip_effect = { + show_as_tooltip = { + switch = { + trigger = scope:movement_petition_effect + flag:change_bureaucracy_laws_increase = { + change_bureaucracy_laws_increase_effect = yes + } + flag:change_bureaucracy_laws_decrease = { + change_bureaucracy_laws_decrease_effect = yes + } + flag:change_army_laws_increase = { + change_army_laws_increase_effect = yes + } + flag:change_army_laws_decrease = { + change_army_laws_decrease_effect = yes + } + flag:change_province_metropolitan = { + change_province_metropolitan_effect = yes + } + flag:change_province_industrial = { + change_province_industrial_effect = yes + } + flag:change_province_military = { + change_province_military_effect = yes + } + flag:change_province_protectorate = { + change_province_protectorate_effect = yes + } + flag:hold_examinations = { + hold_examinations_effect = yes + } + flag:change_retirement_law_increase = { + change_retirement_law_increase_effect = yes + } + flag:change_retirement_law_decrease = { + change_retirement_law_decrease_effect = yes + } + flag:change_candidate_score_law = { + change_candidate_score_law_effect = yes + } + flag:increase_budget_salary = { + increase_budget_salary_effect = yes + } + flag:increase_budget_ministry = { + increase_budget_ministry_effect = yes + } + flag:increase_budget_military = { + increase_budget_military_effect = yes + } + } + situation:dynastic_cycle ?= { + if = { + limit = { + situation_top_has_catalyst = catalyst_hegemon_influenced_by_interaction + } + trigger_situation_catalyst = { + catalyst = catalyst_hegemon_influenced_by_interaction + character = scope:petitioner + } + } + } + scope:hegemon = { + add_legitimacy_effect = { LEGITIMACY = miniscule_legitimacy_gain } + } + #set a cooldown variable in case the leader changes + scope:actors_movement = { + petition_change_movement_power_effect = { + VALUE = 100 + } + set_variable = { + name = recent_movement_petition + value = scope:petitioner + years = 3 + } + } + } +} +grant_movement_petition_effect = { + switch = { + trigger = scope:petitioner.var:movement_petition + flag:change_bureaucracy_laws_increase = { + change_bureaucracy_laws_increase_effect = yes + } + flag:change_bureaucracy_laws_decrease = { + change_bureaucracy_laws_decrease_effect = yes + } + flag:change_army_laws_increase = { + change_army_laws_increase_effect = yes + } + flag:change_army_laws_decrease = { + change_army_laws_decrease_effect = yes + } + flag:change_province_metropolitan = { + change_province_metropolitan_effect = yes + } + flag:change_province_industrial = { + change_province_industrial_effect = yes + } + flag:change_province_military = { + change_province_military_effect = yes + } + flag:change_province_protectorate = { + change_province_protectorate_effect = yes + } + flag:hold_examinations = { + hold_examinations_effect = yes + } + flag:change_retirement_law_increase = { + change_retirement_law_increase_effect = yes + } + flag:change_retirement_law_decrease = { + change_retirement_law_decrease_effect = yes + } + flag:change_candidate_score_law = { + change_candidate_score_law_effect = yes + } + flag:increase_budget_salary = { + increase_budget_salary_effect = yes + } + flag:increase_budget_ministry = { + increase_budget_ministry_effect = yes + } + flag:increase_budget_military = { + increase_budget_military_effect = yes + } + } + situation:dynastic_cycle ?= { + if = { + limit = { + situation_top_has_catalyst = catalyst_hegemon_influenced_by_interaction + } + trigger_situation_catalyst = { + catalyst = catalyst_hegemon_influenced_by_interaction + character = scope:petitioner + } + } + } + scope:hegemon = { + add_legitimacy_effect = { LEGITIMACY = miniscule_legitimacy_gain } + } + #set a cooldown variable in case the leader changes + scope:actors_movement = { + petition_change_movement_power_effect = { + VALUE = 100 + } + set_variable = { + name = recent_movement_petition + value = scope:petitioner + years = 3 + } + } +} + +refuse_movement_petition_effect = { + send_interface_message = { + type = event_diplomacy_bad + title = tgp_decision_events.0103.b_title + left_icon = scope:petition_recipient + add_opinion = { + modifier = hegemon_refused_faction_demands_modifier + target = scope:petition_recipient + years = 5 + } + scope:hegemon = { + add_legitimacy_effect = { LEGITIMACY = miniscule_legitimacy_loss } + if = { + limit = { + scope:petitioner.var:movement_petition ?= flag:hold_examinations + } + situation:dynastic_cycle = { + if = { + limit = { + situation_top_has_catalyst = catalyst_imperial_examinations_gap_short_yearly + exists = title:h_china.var:years_since_imperial_examination + title:h_china.var:years_since_imperial_examination >= catalyst_imperial_examinations_gap_short_yearly_value + } + trigger_situation_catalyst = { + catalyst = catalyst_imperial_examinations_gap_short_yearly + character = scope:petitioner + } + } + if = { + limit = { + situation_top_has_catalyst = catalyst_imperial_examinations_gap_long_yearly + exists = title:h_china.var:years_since_imperial_examination + title:h_china.var:years_since_imperial_examination >= catalyst_imperial_examinations_gap_long_yearly_value + } + trigger_situation_catalyst = { + catalyst = catalyst_imperial_examinations_gap_long_yearly + character = scope:petitioner + } + } + } + } + } + scope:actors_movement = { + petition_change_movement_power_effect = { + VALUE = -100 + } + } + } +} + +display_movement_petition_recipient_acceptance_chance_effect = { + if = { + limit = { + movement_demands_acceptance_value > 100 + } + custom_tooltip = movement_petition_decision.recipient_will_accept + } + else_if = { + limit = { + movement_demands_acceptance_value >= 50 + } + custom_tooltip = movement_petition_decision.recipient_may_accept + } + else_if = { + limit = { + movement_demands_acceptance_value >= 0 + } + custom_tooltip = movement_petition_decision.recipient_may_refuse + } + else = { + custom_tooltip = movement_petition_decision.recipient_will_refuse + } +} + +display_movement_petition_recipient_acceptance_effect = { + display_movement_petition_recipient_acceptance_chance_effect = yes + show_as_tooltip = { + random_list = { + 1 = { + show_chance = no + desc = tgp_decision_events.0102.petition_accepted + grant_movement_petition_tooltip_effect = yes + } + 1 = { + show_chance = no + desc = tgp_decision_events.0102.petition_refused + refuse_movement_petition_effect = yes + } + } + } +} + +# Makes the targeted movement become empowered +# Scope is situation_participant_group +make_movement_favored_effect = { + save_scope_as = movement_to_be_favored + custom_description = { + text = new_movement_becomes_favored_desc + object = scope:movement_to_be_favored + situation:dynastic_cycle ?= { + random_participant_group = { + limit = { + has_variable = movement_favored + } + set_variable = { + name = movement_unfavored + days = 1 + } + remove_variable = movement_favored + } + scope:movement_to_be_favored = { + set_variable = movement_favored + } + } + } + custom_tooltip = new_movement_becomes_favored_power_increase + + situation:dynastic_cycle ?= { + random_participant_group = { + limit = { + has_variable = movement_unfavored + } + save_scope_as = movement_to_be_unfavored + } + } + if = { + limit = { + exists = scope:movement_to_be_unfavored + } + custom_tooltip = new_movement_becomes_favored_power_decrease + } +} + +# ELDER = scope:character that should become the elder of the relation +# DISCIPLE = scope:character that should become the disciple of the relation +# MERIT = amount of merit the Elder will gain, can be set to 0 for no gain +set_elder_relation_effect = { + $DISCIPLE$ = { + save_scope_as = new_disciple + random_relation = { + type = elder + save_scope_as = old_elder + } + } + $ELDER$ = { + save_scope_as = new_elder + } + if = { + limit = { + # no circular relations please + NOT = { + scope:new_disciple = { + has_relation_elder = scope:new_elder + } + } + # Disciple does not have a higher merit rank than the elder + # The elder can have more disciples + scope:new_elder = { + eligible_for_elder_trigger = { + DISCIPLE = scope:new_disciple + } + } + } + scope:new_disciple = { + # in case you already had an elder, remove the relation and send them a letter + if = { + limit = { + exists = scope:old_elder + } + remove_relation_elder = scope:old_elder + save_scope_as = actor #for loc in tgp_interaction_event.0030 + scope:old_elder = { + add_opinion = { + target = scope:new_disciple + modifier = refused_to_be_disciple_opinion + opinion = -50 + } + save_scope_as = recipient #for loc in tgp_interaction_event.0030 + trigger_event = tgp_interaction_event.0030 + } + } + set_relation_elder = scope:new_elder + } + scope:new_elder = { + add_merit_if_relevant_effect = { + MERIT = $MERIT$ + } + } + } +} + +# Skips the opinion loss and the breakup event +set_elder_relation_no_breakup_effect = { + $DISCIPLE$ = { + save_scope_as = new_disciple + random_relation = { + type = elder + save_scope_as = old_elder + } + } + $ELDER$ = { + save_scope_as = new_elder + } + if = { + limit = { + # no circular relations please + NOT = { + scope:new_disciple = { + has_relation_elder = scope:new_elder + } + } + # Disciple does not have a higher merit rank than the elder + # The elder can have more disciples + scope:new_elder = { + eligible_for_elder_trigger = { + DISCIPLE = scope:new_disciple + } + } + } + scope:new_disciple = { + # in case you already had an elder, remove the relation and send them a letter + if = { + limit = { + exists = scope:old_elder + } + remove_relation_elder = scope:old_elder + } + set_relation_elder = scope:new_elder + } + scope:new_elder = { + add_merit_if_relevant_effect = { + MERIT = minor_merit_value + } + } + } +} + +# This effect improves Development in Celestial Tributaries' capital provinces, for as long as they have the Trade Investiture and as long as it's below the Development level of China's capital province +develop_celestial_tributaries = { + if = { + limit = { + subject_contract_has_flag = celestial_investiture_trade + capital_county.development_level < overlord.capital_county.development_level + subject_standing > 10 + } + save_scope_value_as = { + name = tributary_capital_development_growth + value = { + add = { # ratio of how close they are in development + add = capital_county.development_level + divide = overlord.capital_county.development_level + } + subtract = 1 + multiply = -1 + multiply = { # ratio of subject standing, with a minimum value to make at least something happen + add = subject_standing + divide = 100 + min = 0.2 + } + multiply = celestial_investiture_trade_bonus_max + add = { # to make it feel a bit more dynamic + fixed_range = { + min = -5 + max = 5 + } + } + } + } + if = { + limit = { scope:tributary_capital_development_growth >= 1 } + send_interface_message = { + type = msg_tributary_capital_province_development_growth + title = msg_tributary_capital_province_development_growth_title + desc = msg_tributary_capital_province_development_growth_desc + + left_icon = root + right_icon = overlord + + capital_county = { + change_development_progress_with_overflow = scope:tributary_capital_development_growth + } + } + } + } +} + +pledge_loyalty_to_liege_refund_and_cleanup_effect = { + send_interface_toast = { + type = event_toast_effect_neutral + title = pledge_loyalty_to_liege_costs_refunded + left_icon = root + # Remove variable preventing you from kneeling before liege again + if = { + limit = { + has_variable = pledge_loyalty_to_liege_grace + exists = liege + var:pledge_loyalty_to_liege_grace = liege + } + remove_variable = pledge_loyalty_to_liege_grace + } + # refund any costs + if = { + limit = { + has_variable = pledge_loyalty_to_liege_gold_value + } + add_gold = var:pledge_loyalty_to_liege_gold_value + } + switch = { + trigger = has_trait + shy = { add_stress = medium_stress_impact_loss } + arrogant = { add_stress = medium_stress_impact_loss } + } + } + # Variable cleanup + if = { + limit = { has_variable = homage_type } + remove_variable = homage_type + } + # Contract + if = { + limit = { has_variable = pledge_loyalty_to_liege_contract_type } + remove_variable = pledge_loyalty_to_liege_contract_type + } + # Liege + if = { + limit = { has_variable = pledge_loyalty_to_liege_scope } + remove_variable = pledge_loyalty_to_liege_scope + } + if = { + limit = { has_variable = pledge_loyalty_to_liege_gold_value } + remove_variable = pledge_loyalty_to_liege_gold_value + } +} + +#Adds Merit if your government has it +#Required Parameter MERIT +#Reminder, the values are +#miniscule_merit_value +#minor_merit_value +#medium_merit_value +#major_merit_value +#massive_merit_value +#monumental_merit_value +add_merit_if_relevant_effect = { + if = { + limit = { + government_has_flag = government_has_merit + top_liege != this + $MERIT$ != 0 + } + change_merit = $MERIT$ + } +} + +#use this in SCHEMES to temporarily increase or decrease movement power of a character or movement +scheme_change_movement_power_effect = { + save_scope_value_as = { + name = movement_power_scheme_effect_value + value = { + value = $VALUE$ + multiply = 100 + } + } + if = { + limit = { + scope:movement_power_scheme_effect_value >= 0 + } + if = { + limit = { + exists = var:movement_power_increased_scheme + } + set_variable = { + name = movement_power_increased_scheme + value = { + value = var:movement_power_increased_scheme + add = $VALUE$ + } + } + } + else = { + set_variable = { + name = movement_power_increased_scheme + value = $VALUE$ + } + } + } + else = { + if = { + limit = { + exists = var:movement_power_decreased_scheme + } + set_variable = { + name = movement_power_decreased_scheme + value = { + value = var:movement_power_decreased_scheme + add = $VALUE$ + } + } + } + else = { + set_variable = { + name = movement_power_decreased_scheme + value = $VALUE$ + } + } + } + #force the update of variables to immediately show changes + if = { #for characters + limit = { + exists = var:movement_power_individual + } + if = { + limit = { + scope:movement_power_scheme_effect_value >= 0 + } + custom_tooltip = movement_power_scheme.tt.increased_character + } + else = { + custom_tooltip = movement_power_scheme.tt.decreased_character + } + update_character_movement_power_effect = yes + top_participant_group:dynastic_cycle ?= { + update_movement_power_effect = yes + } + } + else = { #for movements + if = { + limit = { + scope:movement_power_scheme_effect_value >= 0 + } + custom_tooltip = movement_power_scheme.tt.increased_movement + } + else = { + custom_tooltip = movement_power_scheme.tt.decreased_movement + } + update_movement_power_effect = yes + } +} + +#use this in EVENTS to temporarily increase or decrease movement power of a character or movement +event_change_movement_power_effect = { + if = { + limit = { + $VALUE$ >= 0 + } + if = { + limit = { + exists = var:movement_power_increased_event + } + set_variable = { + name = movement_power_increased_event + value = { + value = var:movement_power_increased_event + add = $VALUE$ + } + } + } + else = { + set_variable = { + name = movement_power_increased_event + value = $VALUE$ + } + } + + } + else = { + if = { + limit = { + exists = var:movement_power_decreased_event + } + set_variable = { + name = movement_power_decreased_event + value = { + value = var:movement_power_decreased_event + add = $VALUE$ + } + } + } + else = { + set_variable = { + name = movement_power_decreased_event + value = $VALUE$ + } + } + } + #force the update of variables to immediately show changes + if = { #for characters + limit = { + exists = var:movement_power_individual + } + update_character_movement_power_effect = yes + top_participant_group:dynastic_cycle ?= { + update_movement_power_effect = yes + } + } + else = { #for movements + update_movement_power_effect = yes + } +} + +#use this in PETITION to temporarily increase or decrease movement power of a character or movement +petition_change_movement_power_effect = { + save_scope_value_as = { + name = petition_modifies_movement_power_value + value = $VALUE$ + } + if = { + limit = { + NOT = { + participant_group_type = undecided_movement + } + } + if = { + limit = { + $VALUE$ >= 0 + } + custom_tooltip = { + text = petition_increase_movement_power_effect_tooltip + if = { + limit = { + exists = var:movement_power_increased_petition + } + set_variable = { + name = movement_power_increased_petition + value = { + value = var:movement_power_increased_petition + add = $VALUE$ + } + } + } + else = { + set_variable = { + name = movement_power_increased_petition + value = $VALUE$ + } + } + } + } + else = { + custom_tooltip = { + text = petition_decrease_movement_power_effect_tooltip + if = { + limit = { + exists = var:movement_power_decreased_petition + } + set_variable = { + name = movement_power_decreased_petition + value = { + value = var:movement_power_decreased_petition + add = $VALUE$ + } + } + } + else = { + set_variable = { + name = movement_power_decreased_petition + value = $VALUE$ + } + } + } + } + #force the update of variables to immediately show changes + if = { #for characters + limit = { + exists = var:movement_power_individual + } + update_character_movement_power_effect = yes + top_participant_group:dynastic_cycle ?= { + update_movement_power_effect = yes + } + } + else = { #for movements + update_movement_power_effect = yes + } + } +} + +# update the variables on yearly pulse towards 0 and remove it if they reach it +update_modified_movement_power_effect = { + if = { + limit = { + exists = var:movement_power_increased_scheme + } + change_variable = { + name = movement_power_increased_scheme + add = movement_power_increased_scheme_decay_value + } + if = { + limit = { var:movement_power_increased_scheme <= 0 } + remove_variable = movement_power_increased_scheme + } + } + if = { + limit = { + exists = var:movement_power_decreased_scheme + } + change_variable = { + name = movement_power_decreased_scheme + add = movement_power_decreased_scheme_decay_value + } + if = { + limit = { var:movement_power_decreased_scheme >= 0 } + remove_variable = movement_power_decreased_scheme + } + } + if = { + limit = { + exists = var:movement_power_increased_event + } + change_variable = { + name = movement_power_increased_event + add = movement_power_increased_event_decay_value + } + if = { + limit = { var:movement_power_increased_event <= 0 } + remove_variable = movement_power_increased_event + } + } + if = { + limit = { + exists = var:movement_power_decreased_event + } + change_variable = { + name = movement_power_decreased_event + add = movement_power_decreased_event_decay_value + } + if = { + limit = { var:movement_power_decreased_event >= 0 } + remove_variable = movement_power_decreased_event + } + } + if = { + limit = { + exists = var:movement_power_increased_petition + } + change_variable = { + name = movement_power_increased_petition + add = movement_power_increased_petition_decay_value + } + if = { + limit = { var:movement_power_increased_petition <= 0 } + remove_variable = movement_power_increased_petition + } + } + if = { + limit = { + exists = var:movement_power_decreased_petition + } + change_variable = { + name = movement_power_decreased_petition + add = movement_power_decreased_petition_decay_value + } + if = { + limit = { var:movement_power_decreased_petition >= 0 } + remove_variable = movement_power_decreased_petition + } + } +} + + +# When scoped character is appointed as a minister +got_minister_position_effect = { + save_scope_as = new_minister + if = { # If your liege has a ministry, set up titles if needed + limit = { + liege = { + this != scope:new_minister + tgp_has_access_to_ministry_trigger = yes + } + } + # Grant the ministry title if councillor doesn't have it + if = { + limit = { + NOT = { has_title = title:$MINISTER_TITLE$ } + } + create_title_and_vassal_change = { + type = appointment + save_scope_as = minister_title_change + add_claim_on_loss = no + } + title:$MINISTER_TITLE$ = { + change_title_holder = { + holder = scope:new_minister + change = scope:minister_title_change + } + } + resolve_title_and_vassal_change = scope:minister_title_change + } + # Add the correct title law if it doesn't have it already + if = { + limit = { + exists = title:$MINISTER_TITLE$.holder + title:$MINISTER_TITLE$ = title:e_minister_grand_marshal + NOT = { + title:$MINISTER_TITLE$ = { + has_title_law = celestial_grand_marshal_appointment_succession_law + } + } + } + title:$MINISTER_TITLE$ = { + add_title_law = celestial_grand_marshal_appointment_succession_law + } + } + else_if = { + limit = { + exists = title:$MINISTER_TITLE$.holder + NOR = { + title:$MINISTER_TITLE$ = title:e_minister_grand_marshal + title:$MINISTER_TITLE$ = { + has_title_law = celestial_ministry_appointment_succession_law + } + } + } + title:$MINISTER_TITLE$ = { + add_title_law = celestial_ministry_appointment_succession_law + } + } + # Make them a minister if they don't have the council position + if = { + limit = { + NOT = { has_council_position = $MINISTER_POSITION$ } + } + liege = { + assign_councillor_type = { + type = $MINISTER_POSITION$ + target = scope:new_minister + remove_existing_councillor = yes + } + } + } + # If we have any noble family vassals remaining, let's move them to where they are supposed to be + if = { + limit = { + vassal_count > 0 + } + create_title_and_vassal_change = { + type = granted + save_scope_as = minister_vassal_change + } + every_vassal = { + limit = { + any_held_title = { + is_noble_family_title = yes + } + NOT = { + any_held_title = { + is_noble_family_title = no + } + } + } + change_liege = { + liege = scope:new_minister.liege # I.e. the top liege + change = scope:minister_vassal_change + } + } + resolve_title_and_vassal_change = scope:minister_vassal_change + } + # If the new minister should be the diarch, make it so + if = { + limit = { + OR = { + AND = { + top_liege ?= { + has_realm_law = grand_chancellor_law + } + title:e_minister_chancellor = { + this = title:$MINISTER_TITLE$ + holder = scope:new_minister + } + } + AND = { + top_liege ?= { + has_realm_law = grand_marshal_law + } + title:e_minister_grand_marshal = { + this = title:$MINISTER_TITLE$ + holder = scope:new_minister + } + } + AND = { + top_liege ?= { + has_realm_law = grand_censor_law + } + title:e_minister_censor = { + this = title:$MINISTER_TITLE$ + holder = scope:new_minister + } + } + } + } + top_liege = { + if = { + limit = { + diarch != scope:new_minister + } + if = { + limit = { + NOT = { has_diarchy_type = grand_secretariat } + } + try_start_diarchy = grand_secretariat + } + set_diarch = scope:new_minister + } + } + } + + # Save and track accomplishment for the Gate domicile building + if = { + limit = { + title:e_minister_chancellor = { + this = title:$MINISTER_TITLE$ + holder = scope:new_minister + } + } + scope:new_minister.house ?= { + house_head ?= { + if = { + limit = { + exists = domicile + } + domicile ?= { + set_family_accomplishment_effect = { ACCOMPLISHMENT = family_accomplishment_minister } + } + } + } + } + } + if = { + limit = { + title:e_minister_grand_marshal = { + this = title:$MINISTER_TITLE$ + holder = scope:new_minister + } + } + scope:new_minister.house ?= { + house_head ?= { + if = { + limit = { + exists = domicile + } + domicile ?= { + set_family_accomplishment_effect = { ACCOMPLISHMENT = family_accomplishment_grand_marshal } + } + } + } + } + } + if = { # make sure the minister is participant in the Dynastic Cycle situation + limit = { + NOT = { + any_character_situation = { + situation_type = dynastic_cycle + } + } + top_liege ?= { + any_character_situation = { + situation_type = dynastic_cycle + } + } + } + recalculate_participant_group = situation:dynastic_cycle + } + } +} + +fired_minister_position_effect = { + if = { + limit = { + liege = { + tgp_has_access_to_ministry_trigger = yes + } + } + switch = { + trigger = primary_title + title:e_minister_chancellor = { + if = { + limit = { + exists = title:e_minister_chancellor.current_heir + } + title:e_minister_chancellor.current_heir = { + got_minister_position_effect = { MINISTER_TITLE = e_minister_chancellor MINISTER_POSITION = councillor_chancellor } + } + } + else = { + holder = { + destroy_title = title:e_minister_chancellor + } + } + } + title:e_minister_censor = { + if = { + limit = { + exists = title:e_minister_censor.current_heir + } + title:e_minister_censor.current_heir = { + got_minister_position_effect = { MINISTER_TITLE = e_minister_censor MINISTER_POSITION = councillor_spymaster } + } + } + else = { + holder = { + destroy_title = title:e_minister_censor + } + } + } + title:e_minister_grand_marshal = { + if = { + limit = { + exists = title:e_minister_grand_marshal.current_heir + } + title:e_minister_grand_marshal.current_heir = { + got_minister_position_effect = { MINISTER_TITLE = e_minister_grand_marshal MINISTER_POSITION = minister_grand_marshal } + } + } + else = { + holder = { + destroy_title = title:e_minister_grand_marshal + } + } + } + title:e_minister_of_personnel = { + if = { + limit = { + exists = title:e_minister_of_personnel.current_heir + } + title:e_minister_of_personnel.current_heir = { + got_minister_position_effect = { MINISTER_TITLE = e_minister_of_personnel MINISTER_POSITION = minister_personnel } + } + } + else = { + holder = { + destroy_title = title:e_minister_of_personnel + } + } + } + title:e_minister_of_revenue = { + if = { + limit = { + exists = title:e_minister_of_revenue.current_heir + } + title:e_minister_of_revenue.current_heir = { + got_minister_position_effect = { MINISTER_TITLE = e_minister_of_revenue MINISTER_POSITION = councillor_steward } + } + } + else = { + holder = { + destroy_title = title:e_minister_of_revenue + } + } + } + title:e_minister_of_rites = { + if = { + limit = { + exists = title:e_minister_of_rites.current_heir + } + title:e_minister_of_rites.current_heir = { + got_minister_position_effect = { MINISTER_TITLE = e_minister_of_rites MINISTER_POSITION = councillor_court_chaplain } + } + } + else = { + holder = { + destroy_title = title:e_minister_of_rites + } + } + } + title:e_minister_of_war = { + if = { + limit = { + exists = title:e_minister_of_war.current_heir + } + title:e_minister_of_war.current_heir = { + got_minister_position_effect = { MINISTER_TITLE = e_minister_of_war MINISTER_POSITION = councillor_marshal } + } + } + else = { + holder = { + destroy_title = title:e_minister_of_war + } + } + } + title:e_minister_of_justice = { + if = { + limit = { + exists = title:e_minister_of_justice.current_heir + } + title:e_minister_of_justice.current_heir = { + got_minister_position_effect = { MINISTER_TITLE = e_minister_of_justice MINISTER_POSITION = minister_justice } + } + } + else = { + holder = { + destroy_title = title:e_minister_of_justice + } + } + } + title:e_minister_of_works = { + if = { + limit = { + exists = title:e_minister_of_works.current_heir + } + title:e_minister_of_works.current_heir = { + got_minister_position_effect = { MINISTER_TITLE = e_minister_of_works MINISTER_POSITION = minister_works } + } + } + else = { + holder = { + destroy_title = title:e_minister_of_works + } + } + } + } + } +} + +# Destroy any held ministry title - Use this on a character +destroy_held_ministry_titles_effect = { + save_scope_as = minister_should_lose_ministry_title + if = { + limit = { + OR = { + has_title = title:e_minister_chancellor + has_title = title:e_minister_censor + has_title = title:e_minister_grand_marshal + has_title = title:e_minister_of_personnel + has_title = title:e_minister_of_revenue + has_title = title:e_minister_of_rites + has_title = title:e_minister_of_war + has_title = title:e_minister_of_justice + has_title = title:e_minister_of_works + } + } + every_held_title = { + switch = { + trigger = this + title:e_minister_chancellor = { + scope:minister_should_lose_ministry_title = { destroy_title = title:e_minister_chancellor } + } + title:e_minister_censor = { + scope:minister_should_lose_ministry_title = { destroy_title = title:e_minister_censor } + } + title:e_minister_grand_marshal = { + scope:minister_should_lose_ministry_title = { destroy_title = title:e_minister_grand_marshal } + } + title:e_minister_of_personnel = { + scope:minister_should_lose_ministry_title = { destroy_title = title:e_minister_of_personnel } + } + title:e_minister_of_revenue = { + scope:minister_should_lose_ministry_title = { destroy_title = title:e_minister_of_revenue } + } + title:e_minister_of_rites = { + scope:minister_should_lose_ministry_title = { destroy_title = title:e_minister_of_rites } + } + title:e_minister_of_war = { + scope:minister_should_lose_ministry_title = { destroy_title = title:e_minister_of_war } + } + title:e_minister_of_justice = { + scope:minister_should_lose_ministry_title = { destroy_title = title:e_minister_of_justice } + } + title:e_minister_of_works = { + scope:minister_should_lose_ministry_title = { destroy_title = title:e_minister_of_works } + } + } + } + } +} + +# Fill the ministry with valid characters +fill_the_ministry_effect = { + save_scope_as = emperor_of_china + # Assign a grand chancellor + if = { + limit = { + OR = { + NOT = { exists = cp:councillor_chancellor } + cp:councillor_chancellor ?= { + NOT = { has_title = title:e_minister_chancellor } + } + } + } + random_vassal = { + limit = { + tgp_can_be_a_minister_trigger = { COURT_OWNER = scope:emperor_of_china } + tgp_is_any_minister = no + } + weight = { + base = 1 + modifier = { + add = diplomacy + } + } + got_minister_position_effect = { MINISTER_TITLE = e_minister_chancellor MINISTER_POSITION = councillor_chancellor } + } + } + # Assign an imperial censor + if = { + limit = { + OR = { + NOT = { exists = cp:councillor_spymaster } + cp:councillor_spymaster ?= { + NOT = { has_title = title:e_minister_censor } + } + } + } + random_vassal = { + limit = { + tgp_can_be_a_minister_trigger = { COURT_OWNER = scope:emperor_of_china } + tgp_is_any_minister = no + } + weight = { + base = 1 + modifier = { + add = intrigue + } + } + got_minister_position_effect = { MINISTER_TITLE = e_minister_censor MINISTER_POSITION = councillor_spymaster } + } + } + # Assign a grand marshal + if = { + limit = { + OR = { + NOT = { exists = cp:minister_grand_marshal } + cp:minister_grand_marshal ?= { + NOT = { has_title = title:e_minister_grand_marshal } + } + } + } + random_vassal = { + limit = { + tgp_can_be_a_minister_trigger = { COURT_OWNER = scope:emperor_of_china } + tgp_is_any_minister = no + } + weight = { + base = 1 + modifier = { + add = martial + } + } + got_minister_position_effect = { MINISTER_TITLE = e_minister_grand_marshal MINISTER_POSITION = minister_grand_marshal } + } + } + # Assign a minister of personnel + if = { + limit = { + OR = { + NOT = { exists = cp:minister_personnel } + cp:minister_personnel ?= { + NOT = { has_title = title:e_minister_of_personnel } + } + } + } + random_vassal = { + limit = { + tgp_can_be_a_minister_trigger = { COURT_OWNER = scope:emperor_of_china } + tgp_is_any_minister = no + } + weight = { + base = 1 + modifier = { + add = diplomacy + } + } + got_minister_position_effect = { MINISTER_TITLE = e_minister_of_personnel MINISTER_POSITION = minister_personnel } + } + } + # Assign a minister of revenue + if = { + limit = { + OR = { + NOT = { exists = cp:councillor_steward } + cp:councillor_steward ?= { + NOT = { has_title = title:e_minister_of_revenue } + } + } + } + random_vassal = { + limit = { + tgp_can_be_a_minister_trigger = { COURT_OWNER = scope:emperor_of_china } + tgp_is_any_minister = no + } + weight = { + base = 1 + modifier = { + add = stewardship + } + } + got_minister_position_effect = { MINISTER_TITLE = e_minister_of_revenue MINISTER_POSITION = councillor_steward } + } + } + # Assign a minister of rites + if = { + limit = { + OR = { + NOT = { exists = cp:councillor_court_chaplain } + cp:councillor_court_chaplain ?= { + NOT = { has_title = title:e_minister_of_rites } + } + } + } + random_vassal = { + limit = { + tgp_can_be_a_minister_trigger = { COURT_OWNER = scope:emperor_of_china } + tgp_is_any_minister = no + } + weight = { + base = 1 + modifier = { + add = learning + } + } + got_minister_position_effect = { MINISTER_TITLE = e_minister_of_rites MINISTER_POSITION = councillor_court_chaplain } + } + } + # Assign a minister of war + if = { + limit = { + OR = { + NOT = { exists = cp:councillor_marshal } + cp:councillor_marshal ?= { + NOT = { has_title = title:e_minister_of_war } + } + } + } + random_vassal = { + limit = { + tgp_can_be_a_minister_trigger = { COURT_OWNER = scope:emperor_of_china } + tgp_is_any_minister = no + } + weight = { + base = 1 + modifier = { + add = martial + } + } + got_minister_position_effect = { MINISTER_TITLE = e_minister_of_war MINISTER_POSITION = councillor_marshal } + } + } + # Assign a minister of justice + if = { + limit = { + OR = { + NOT = { exists = cp:minister_justice } + cp:minister_justice ?= { + NOT = { has_title = title:e_minister_of_justice } + } + } + } + random_vassal = { + limit = { + tgp_can_be_a_minister_trigger = { COURT_OWNER = scope:emperor_of_china } + tgp_is_any_minister = no + } + weight = { + base = 1 + modifier = { + add = learning + } + } + got_minister_position_effect = { MINISTER_TITLE = e_minister_of_justice MINISTER_POSITION = minister_justice } + } + } + # Assign a minister of works + if = { + limit = { + OR = { + NOT = { exists = cp:minister_works } + cp:minister_works ?= { + NOT = { has_title = title:e_minister_of_works } + } + } + } + random_vassal = { + limit = { + tgp_can_be_a_minister_trigger = { COURT_OWNER = scope:emperor_of_china } + tgp_is_any_minister = no + } + weight = { + base = 1 + modifier = { + add = stewardship + } + } + got_minister_position_effect = { MINISTER_TITLE = e_minister_of_works MINISTER_POSITION = minister_works } + } + } +} + +# Minister courtier recruitment effect +minister_courtier_recruitment_effect = { + while = { + count = minister_recruit_courtier_value + + save_scope_as = minister + create_character = { + employer = scope:minister + template = $COURTIER_TEMPLATE$ + faith = scope:minister.top_liege.capital_county.faith + culture = scope:minister.top_liege.capital_county.culture + save_scope_as = new_courtier + } + if = { + limit = { exists = scope:new_courtier } + scope:new_courtier = { + assign_completed_exams_based_on_merit_effect = yes + add_character_flag = { + flag = blocked_from_leaving + years = 25 + } + } + if = { + limit = { + scope:new_courtier = { + NOT = { is_courtier_of = scope:minister } + } + } + add_courtier = scope:new_courtier + } + send_interface_message = { + title = minister_courtier_recruited_t + left_icon = scope:new_courtier + custom_tooltip = minister_courtier_recruited_desc + } + } + } +} + +# Effect to keep track of family accomplishments for the Ancestral Gate domicile building +set_family_accomplishment_effect = { + # ACCOMPLISHMENT = the accomplishment you want to save + if = { + limit = { + NOT = { has_variable = $ACCOMPLISHMENT$ } + } + set_variable = { + name = $ACCOMPLISHMENT$ + value = yes + } + if = { + limit = { + has_variable = family_accomplishments + } + change_variable = { + name = family_accomplishments + add = 1 + } + } + else = { + set_variable = { + name = family_accomplishments + value = 1 + } + } + } +} + +## GRAND CAMPAIGN great project effects +set_duchies_to_attack_effect = { + while = { + count = 20 #as for tgp France holds the record for the most duchies with 17 + limit = { + list_size:duchies_to_attack > 0 + } + ordered_in_list = { + list = duchies_to_attack + order_by = { + value = holder.realm_size + multiply = -1 + } + switch = { + trigger = list_size:duchies_to_attack + 1 = { + set_duchies_to_attack_variable_effect = { + VALUE = 1 + } + } + 2 = { + set_duchies_to_attack_variable_effect = { + VALUE = 2 + } + } + 3 = { + set_duchies_to_attack_variable_effect = { + VALUE = 3 + } + } + 4 = { + set_duchies_to_attack_variable_effect = { + VALUE = 4 + } + } + 5 = { + set_duchies_to_attack_variable_effect = { + VALUE = 5 + } + } + 6 = { + set_duchies_to_attack_variable_effect = { + VALUE = 6 + } + } + 7 = { + set_duchies_to_attack_variable_effect = { + VALUE = 7 + } + } + 8 = { + set_duchies_to_attack_variable_effect = { + VALUE = 8 + } + } + 9 = { + set_duchies_to_attack_variable_effect = { + VALUE = 9 + } + } + 10 = { + set_duchies_to_attack_variable_effect = { + VALUE = 10 + } + } + 11 = { + set_duchies_to_attack_variable_effect = { + VALUE = 11 + } + } + 12 = { + set_duchies_to_attack_variable_effect = { + VALUE = 12 + } + } + 13 = { + set_duchies_to_attack_variable_effect = { + VALUE = 13 + } + } + 14 = { + set_duchies_to_attack_variable_effect = { + VALUE = 14 + } + } + 15 = { + set_duchies_to_attack_variable_effect = { + VALUE = 15 + } + } + 16 = { + set_duchies_to_attack_variable_effect = { + VALUE = 16 + } + } + 17 = { + set_duchies_to_attack_variable_effect = { + VALUE = 17 + } + } + 18 = { + set_duchies_to_attack_variable_effect = { + VALUE = 18 + } + } + 19 = { + set_duchies_to_attack_variable_effect = { + VALUE = 19 + } + } + 20 = { + set_duchies_to_attack_variable_effect = { + VALUE = 20 + } + } + } + } + } +} +set_duchies_to_attack_variable_effect = { + save_temporary_scope_as = duchy + scope:grand_campaign_project = { + set_variable = { + name = attack_$VALUE$ + value = scope:duchy + } + add_to_variable_list = { + name = grand_campaign_targets + target = scope:duchy + } + } + remove_from_list = duchies_to_attack +} +display_duchy_to_attack = { + prev.var:attack_$ID$ ?= { + add_to_list = target_titles + } +} + +grand_campaign_contribution_effect = { + save_scope_as = contributor + scope:great_project.var:$TITLE$ = { + save_scope_as = target_title + } + # the grand marshal should always be the war leader + title:e_minister_grand_marshal.holder = { + save_scope_as = war_leader + } + custom_tooltip = great_project_type_grand_campaign_project_contribution_tt + custom_tooltip = grand_campaign_$TITLE$ + scope:great_project = { + add_to_variable_list = { + name = grand_campaign_titles + target = scope:target_title + } + } + # if war does not exist yet, declare it + if = { + limit = { + NOT = { exists = scope:great_project.var:grand_campaign_war } + } + scope:war_leader = { + trigger_event = tgp_china_ministry.0001 + } + } + # if war exists, pull everyone in + else = { + trigger_event = tgp_china_ministry.0004 + } +} + +grand_campaign_contribution_complete_effect = { + save_scope_as = contributor + if = { + limit = { + exists = scope:contributor + } + custom_tooltip = great_project_type_grand_campaign_project_contribution_win_named_tt + } + else = { + custom_tooltip = great_project_type_grand_campaign_project_contribution_win_tt + } +} + +# Chinese Estate building effects +add_random_internal_east_asian_estate_building = { + random_list = { + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_servants_quarters_01 } + } + add_domicile_building = east_asian_estate_servants_quarters_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_servants_quarters_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_library_01 } + } + add_domicile_building = east_asian_estate_library_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_library_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_bath_01 } + } + add_domicile_building = east_asian_estate_bath_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_bath_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_courtyard_01 } + } + add_domicile_building = east_asian_estate_courtyard_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_courtyard_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_prison_01 } + } + add_domicile_building = east_asian_estate_prison_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_prison_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_living_quarters_01 } + } + add_domicile_building = east_asian_estate_living_quarters_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_living_quarters_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_study_01 } + } + add_domicile_building = east_asian_estate_study_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_study_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_guest_room_01 } + } + add_domicile_building = east_asian_estate_guest_room_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_guest_room_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_wine_cellar_01 } + } + add_domicile_building = east_asian_estate_wine_cellar_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_wine_cellar_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_taxation_01 } + } + add_domicile_building = east_asian_estate_taxation_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_taxation_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_drafting_room_01 } + } + add_domicile_building = east_asian_estate_drafting_room_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_drafting_room_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_clerks_hall_01 } + } + add_domicile_building = east_asian_estate_clerks_hall_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_clerks_hall_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_revenue_audit_desk_01 } + } + add_domicile_building = east_asian_estate_revenue_audit_desk_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_revenue_audit_desk_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_block_printing_hall_01 } + } + add_domicile_building = east_asian_estate_block_printing_hall_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_block_printing_hall_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_xuan_paper_stores_01 } + } + add_domicile_building = east_asian_estate_xuan_paper_stores_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_xuan_paper_stores_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_water_clock_room_01 } + } + add_domicile_building = east_asian_estate_water_clock_room_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_water_clock_room_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_examination_room_01 } + } + add_domicile_building = east_asian_estate_examination_room_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_examination_room_02 + } + } + } +} + +fill_external_east_asian_estate_building_effect = { + switch = { + trigger = has_domicile_building_or_higher + east_asian_estate_main_05 = { + while = { + limit = { free_external_domicile_building_slots >= 2 } + add_random_external_east_asian_estate_building = yes + } + } + east_asian_estate_main_04 = { + while = { + limit = { free_external_domicile_building_slots >= 3 } + add_random_external_east_asian_estate_building = yes + } + } + east_asian_estate_main_03 = { + while = { + limit = { free_external_domicile_building_slots >= 4 } + add_random_external_east_asian_estate_building = yes + } + } + east_asian_estate_main_02 = { + while = { + limit = { free_external_domicile_building_slots >= 5 } + add_random_external_east_asian_estate_building = yes + } + } + east_asian_estate_main_01 = { + while = { + limit = { free_external_domicile_building_slots >= 6 } + add_random_external_east_asian_estate_building = yes + } + } + } +} + +add_random_external_east_asian_estate_building = { + if = { + limit = { + free_external_domicile_building_slots >= 1 + } + random_list = { + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_ancestral_shrine_01 } + } + add_domicile_building = east_asian_estate_ancestral_shrine_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_ancestral_shrine_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_barracks_01 } + } + add_domicile_building = east_asian_estate_barracks_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_barracks_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_watchtower_01 } + } + add_domicile_building = east_asian_estate_watchtower_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_watchtower_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_garden_01 } + } + add_domicile_building = east_asian_estate_garden_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_garden_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_storage_01 } + } + add_domicile_building = east_asian_estate_storage_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_storage_02 + } + } + 10 = { + trigger = { + NOT = { + has_domicile_building_or_higher = east_asian_estate_rice_field_01 + } + } + add_domicile_building = east_asian_estate_rice_field_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_rice_field_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_stable_01 } + } + add_domicile_building = east_asian_estate_stable_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_stable_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_workshop_01 } + } + add_domicile_building = east_asian_estate_workshop_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_workshop_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_market_01 } + } + add_domicile_building = east_asian_estate_market_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_market_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_grazing_land_01 } + } + add_domicile_building = east_asian_estate_grazing_land_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_grazing_land_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_tea_01 } + } + add_domicile_building = east_asian_estate_tea_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_tea_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_health_01 } + } + add_domicile_building = east_asian_estate_health_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_health_02 + } + } + 10 = { + trigger = { + NOT = { has_domicile_building_or_higher = east_asian_estate_silk_01 } + owner = { + OR = { + custom_tooltip = { + house = { has_house_modifier = ep3_unlocked_silk } + text = has_unlocked_estate_silk + } + culture = { has_cultural_parameter = unlocks_silk_buildings_parameter } + } + } + } + add_domicile_building = east_asian_estate_silk_01 + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + add_domicile_building = east_asian_estate_silk_02 + } + } + } + } +} + +# Use this effect to set what exams a characters should have passed, based on their merit +# Used on game start, but can also be used for generated characters +assign_completed_exams_based_on_merit_effect = { + # Empire merit ranked vassals have always passed the palace exams + if = { + limit = { + merit >= empire_starting_merit_value + } + add_character_flag = passed_child_exam + add_character_flag = passed_provincial_exam + add_character_modifier = { + modifier = tgp_passed_provincial_exam_modifier + } + add_character_flag = passed_metropolitan_exam + add_character_modifier = { + modifier = tgp_passed_metropolitan_exam_modifier + } + add_character_flag = passed_palace_exam + add_character_modifier = { + modifier = tgp_passed_palace_exam_modifier + } + } + # Kingdom merit ranked vassals have always passed the metropolitan exams + else_if = { + limit = { + merit >= kingdom_starting_merit_value + } + add_character_flag = passed_child_exam + add_character_flag = passed_provincial_exam + add_character_modifier = { + modifier = tgp_passed_provincial_exam_modifier + } + add_character_flag = passed_metropolitan_exam + add_character_modifier = { + modifier = tgp_passed_metropolitan_exam_modifier + } + if = { # The AI has a chance to start with having passed additional exams + limit = { + is_ai = yes + } + random = { + chance = 50 + add_character_flag = passed_palace_exam + add_character_modifier = { + modifier = tgp_passed_palace_exam_modifier + } + } + } + change_merit = merit_starting_boost_value + } + # Duchy merit ranked vassals have always passed the provincial exams + else_if = { + limit = { + merit >= duchy_starting_merit_value + } + add_character_flag = passed_child_exam + add_character_flag = passed_provincial_exam + add_character_modifier = { + modifier = tgp_passed_provincial_exam_modifier + } + if = { # The AI has a chance to start with having passed additional exams + limit = { + is_ai = yes + } + random = { + chance = 60 + add_character_flag = passed_metropolitan_exam + add_character_modifier = { + modifier = tgp_passed_metropolitan_exam_modifier + } + + random = { + chance = 30 + add_character_flag = passed_palace_exam + add_character_modifier = { + modifier = tgp_passed_palace_exam_modifier + } + } + } + } + change_merit = merit_starting_boost_value + } + # Everyone else have a chance to having passed the provincial exams + else = { + if = { # The AI has a chance to start with having passed the provincial exams + limit = { + is_ai = yes + } + random_list = { + 10 = {} + 50 = { + add_character_flag = passed_provincial_exam + add_character_modifier = { + modifier = tgp_passed_provincial_exam_modifier + } + change_merit = { + value = county_starting_merit_value + add = age + add = learning + } + } + 25 = { + add_character_flag = passed_provincial_exam + add_character_modifier = { + modifier = tgp_passed_provincial_exam_modifier + } + add_character_flag = passed_metropolitan_exam + add_character_modifier = { + modifier = tgp_passed_metropolitan_exam_modifier + } + change_merit = { + value = county_starting_merit_value + add = age + add = learning + } + } + 15 = { + add_character_flag = passed_provincial_exam + add_character_modifier = { + modifier = tgp_passed_provincial_exam_modifier + } + add_character_flag = passed_metropolitan_exam + add_character_modifier = { + modifier = tgp_passed_metropolitan_exam_modifier + } + add_character_flag = passed_palace_exam + add_character_modifier = { + modifier = tgp_passed_palace_exam_modifier + } + change_merit = { + value = county_starting_merit_value + add = age + add = learning + } + } + } + # Chance to start with having passed child exams (for flavor) + random = { + chance = 60 + add_character_flag = passed_child_exam + } + } + } +} + +meritocratic_assign_completed_exams_based_on_merit_effect = { + if = { + limit = { + merit >= duchy_starting_merit_value + } + add_character_flag = passed_provincial_exam + add_character_modifier = { + modifier = tgp_passed_provincial_exam_modifier + } + } + # Everyone else have a chance to having passed the provincial exams + else = { + if = { # The AI has a chance to start with having passed the provincial exams + limit = { + is_ai = yes + } + random = { + chance = { + value = 40 + if = { + limit = { + is_ruler = yes + } + add = 20 + } + } + add_character_flag = passed_provincial_exam + add_character_modifier = { + modifier = tgp_passed_provincial_exam_modifier + } + } + } + } +} + +tgp_save_realm_ceremonial_liege_effect = { + if = { + limit = { tgp_realm_has_ceremonial_liege_trigger = yes } + top_liege.primary_title.var:administrative_ui_special_title.holder = { save_scope_as = ceremonial_liege } + } +} + +tgp_imperial_policy_event_effect = { + save_scope_as = liege + every_player = { + limit = { top_liege = scope:liege } + trigger_event = tgp_japan_general.9300 + } +} + +tgp_treasury_setup_effect = { + if = { + limit = { has_treasury = yes } + enact_treasury_budgets_init = yes + } +} + +# Enact treasury template effect +# If you update these, remember to update the corresponding tooltip! +tgp_treasury_enact_salary_budget_effect = { + custom_tooltip = { + text = tgp_treasury_enact_salary_budget_desc + if = { + limit = { + NOT = { has_realm_law = budget_allocation_salary_40 } + } + add_realm_law = budget_allocation_salary_40 + } + if = { + limit = { + NOT = { has_realm_law = budget_allocation_ministry_25 } + } + add_realm_law = budget_allocation_ministry_25 + } + if = { + limit = { + NOT = { has_realm_law = budget_allocation_military_15 } + } + add_realm_law = budget_allocation_military_15 + } + + enact_treasury_budgets_no_costs = yes + } +} + +tgp_treasury_enact_ministry_budget_effect = { + custom_tooltip = { + text = tgp_treasury_enact_ministry_budget_desc + if = { + limit = { + NOT = { has_realm_law = budget_allocation_salary_25 } + } + add_realm_law = budget_allocation_salary_25 + } + if = { + limit = { + NOT = { has_realm_law = budget_allocation_ministry_40 } + } + add_realm_law = budget_allocation_ministry_40 + } + if = { + limit = { + NOT = { has_realm_law = budget_allocation_military_15 } + } + add_realm_law = budget_allocation_military_15 + } + + enact_treasury_budgets_no_costs = yes + } +} + +tgp_treasury_enact_military_budget_effect = { + custom_tooltip = { + text = tgp_treasury_enact_military_budget_desc + if = { + limit = { + NOT = { has_realm_law = budget_allocation_salary_30 } + } + add_realm_law = budget_allocation_salary_30 + } + if = { + limit = { + NOT = { has_realm_law = budget_allocation_ministry_20 } + } + add_realm_law = budget_allocation_ministry_20 + } + if = { + limit = { + NOT = { has_realm_law = budget_allocation_military_30 } + } + add_realm_law = budget_allocation_military_30 + } + + enact_treasury_budgets_no_costs = yes + } +} + +tgp_treasury_enact_hegemon_budget_effect = { + custom_tooltip = { + text = tgp_treasury_enact_hegemon_budget_desc + if = { + limit = { + NOT = { has_realm_law = budget_allocation_salary_25 } + } + add_realm_law = budget_allocation_salary_25 + } + if = { + limit = { + NOT = { has_realm_law = budget_allocation_ministry_25 } + } + add_realm_law = budget_allocation_ministry_25 + } + if = { + limit = { + NOT = { has_realm_law = budget_allocation_military_20 } + } + add_realm_law = budget_allocation_military_20 + } + + enact_treasury_budgets_no_costs = yes + } +} + +tgp_treasury_enact_balanced_budget_effect = { + custom_tooltip = { + text = tgp_treasury_enact_balanced_budget_desc + if = { + limit = { + NOT = { has_realm_law = budget_allocation_salary_35 } + } + add_realm_law = budget_allocation_salary_35 + } + if = { + limit = { + NOT = { has_realm_law = budget_allocation_ministry_25 } + } + add_realm_law = budget_allocation_ministry_25 + } + if = { + limit = { + NOT = { has_realm_law = budget_allocation_military_20 } + } + add_realm_law = budget_allocation_military_20 + } + + enact_treasury_budgets_no_costs = yes + } +} + +tgp_treasury_enact_meritocratic_salary_budget_effect = { + custom_tooltip = { + text = tgp_treasury_enact_meritocratic_salary_budget_desc + if = { + limit = { + NOT = { has_realm_law = budget_allocation_salary_50 } + } + add_realm_law = budget_allocation_salary_50 + } + if = { + limit = { + NOT = { has_realm_law = budget_allocation_military_30 } + } + add_realm_law = budget_allocation_military_30 + } + + enact_treasury_budgets_no_costs = yes + } +} + +tgp_treasury_enact_meritocratic_military_budget_effect = { + custom_tooltip = { + text = tgp_treasury_enact_meritocratic_military_budget_desc + if = { + limit = { + NOT = { has_realm_law = budget_allocation_salary_30 } + } + add_realm_law = budget_allocation_salary_30 + } + if = { + limit = { + NOT = { has_realm_law = budget_allocation_military_50 } + } + add_realm_law = budget_allocation_military_50 + } + + enact_treasury_budgets_no_costs = yes + } +} + +tgp_treasury_enact_meritocratic_balanced_budget_effect = { + custom_tooltip = { + text = tgp_treasury_enact_meritocratic_balanced_budget_desc + if = { + limit = { + NOT = { has_realm_law = budget_allocation_salary_40 } + } + add_realm_law = budget_allocation_salary_40 + } + if = { + limit = { + NOT = { has_realm_law = budget_allocation_military_40 } + } + add_realm_law = budget_allocation_military_40 + } + + enact_treasury_budgets_no_costs = yes + } +} + +tgp_save_opposing_power_effect = { + if = { # You are the Regent + limit = { + tgp_is_ceremonial_regent_trigger = yes + } + primary_title.var:administrative_ui_special_title.holder = { save_scope_as = opposing_power } + } + else = { # You are the liege + top_liege = { save_scope_as = opposing_power } + } +} + +tgp_one_up_activity_effect = { + tgp_save_opposing_power_effect = yes + add_prestige = massive_prestige_gain + if = { + limit = { + government_has_flag = government_is_administrative + } + change_influence = massive_influence_gain + } + scope:opposing_power = { + add_prestige = massive_prestige_loss + if = { + limit = { + government_has_flag = government_is_administrative + } + change_influence = massive_influence_loss + } + } +} + +destroy_landless_title_no_tgp_dlc_effect = { + if = { + limit = { + NOT = { has_dlc_feature = all_under_heaven } + game_start_date = $DATE$ + } + holder = { destroy_title = prev } + } +} + +coup_ceremonial_liege_scheme_success_effect = { + # scope:target = ceremonial liege + # scope:owner = ceremonial regent + scope:owner.top_liege.primary_title.var:administrative_ui_special_title = { save_scope_as = ceremonial_title } + scope:target = { + save_scope_as = background_dungeon_scope + save_scope_as = background_courtyard_scope + save_scope_as = background_throne_room_scope + } + # Old ruler's fate + if = { + limit = { exists = scope:death } + scope:target = { + death = { death_reason = death_fight } + } + } + else_if = { + limit = { exists = scope:imprison } + scope:target = { add_character_flag = was_abducted_block_notification_event } + rightfully_imprison_character_less_verbose_effect = { + TARGET = scope:target + IMPRISONER = scope:owner + } + } + create_title_and_vassal_change = { + type = conquest + save_scope_as = change + add_claim_on_loss = yes + } + scope:target = { + every_held_title = { + limit = { + tier > tier_barony + OR = { + scope:owner.top_liege.primary_title.var:administrative_ui_special_title = this + exists = var:ceremonial_title + is_landless_type_title = no + } + } + change_title_holder_include_vassals = { + holder = scope:owner + change = scope:change + } + } + } + resolve_title_and_vassal_change = scope:change + rightfully_imprison_character_less_verbose_effect = { + TARGET = scope:target + IMPRISONER = scope:owner + } + add_clan_unity_interaction_effect = { + CHARACTER = scope:owner + TARGET = scope:target + VALUE = medium_unity_loss + DESC = clan_unity_coup_ceremonial_liege_attempted.desc + REVERSE_NON_HOUSE_TARGET = no + } + successful_coup_ceremonial_liege_opinion_effect = { + VICTIM = scope:target + PLOTTER = scope:owner + } + scope:owner = { + create_character_memory = { + type = seized_throne_memory + participants = { deposed = scope:target } + } + ordered_memory = { + memory_type = seized_throne_memory + order_by = memory_creation_date + if = { + limit = { + NOT = { exists = var:ceremonial_title } + } + set_variable = { + name = ceremonial_title + value = scope:ceremonial_title + } + } + } + } + scope:target = { + create_character_memory = { + type = throne_seized_memory + participants = { deposer = scope:owner } + } + ordered_memory = { + memory_type = throne_seized_memory + order_by = memory_creation_date + if = { + limit = { + NOT = { exists = var:ceremonial_title } + } + set_variable = { + name = ceremonial_title + value = scope:ceremonial_title + } + } + } + } +} + +coup_ceremonial_liege_scheme_failure_effect = { + scope:owner.top_liege.primary_title.var:administrative_ui_special_title = { save_scope_as = ceremonial_title } + scope:scheme = { end_scheme = yes } + #Add Watchful Modifier to the target + scope:target = { + save_scope_as = background_dungeon_scope + save_scope_as = background_courtyard_scope + save_scope_as = background_throne_room_scope + show_as_tooltip = { + add_character_modifier = { + modifier = watchful_modifier + days = watchful_modifier_duration + } + } + } + scope:owner = { + create_character_memory = { + type = seized_throne_failed_memory + participants = { deposed = scope:target } + } + ordered_memory = { + memory_type = seized_throne_failed_memory + order_by = memory_creation_date + if = { + limit = { + NOT = { exists = var:ceremonial_title } + } + set_variable = { + name = ceremonial_title + value = scope:ceremonial_title + } + } + } + add_character_flag = was_abducted_block_notification_event + create_title_and_vassal_change = { + type = conquest + save_scope_as = change + add_claim_on_loss = yes + } + every_held_title = { + limit = { + is_landless_type_title = no + tier > tier_barony + } + change_title_holder_include_vassals = { + holder = scope:target + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + } + hidden_effect = { change_prison_type = dungeon } + rightfully_imprison_character_less_verbose_effect = { + TARGET = scope:owner + IMPRISONER = scope:target + } + attempted_coup_ceremonial_liege_opinion_effect = { + VICTIM = scope:target + PLOTTER = scope:owner + } + # If we're a clan this affects unity + add_clan_unity_interaction_effect = { + CHARACTER = scope:owner + TARGET = scope:target + VALUE = medium_unity_loss + DESC = clan_unity_coup_ceremonial_liege_attempted.desc + REVERSE_NON_HOUSE_TARGET = no + } + scope:target = { + create_character_memory = { + type = throne_seized_failed_memory + participants = { deposer = scope:owner } + } + ordered_memory = { + memory_type = throne_seized_failed_memory + order_by = memory_creation_date + if = { + limit = { + NOT = { exists = var:ceremonial_title } + } + set_variable = { + name = ceremonial_title + value = scope:ceremonial_title + } + } + } + } +} + +successful_coup_ceremonial_liege_opinion_effect = { + $VICTIM$ = { + if = { + limit = { is_alive = yes } + add_opinion = { + target = $PLOTTER$ + modifier = seized_my_throne_crime + } + set_relation_rival = { + target = scope:owner + reason = rival_seized_throne_reason + } + } + every_spouse = { + limit = { + NOR = { + this = $PLOTTER$ + is_spouse_of = $PLOTTER$ + is_close_family_of = $PLOTTER$ + } + } + add_to_temporary_list = close_family_coup_ceremonial_liege_opinion_list + } + every_close_family_member = { + limit = { + NOR = { + this = $PLOTTER$ + is_spouse_of = $PLOTTER$ + is_close_family_of = $PLOTTER$ + } + } + add_to_temporary_list = close_family_coup_ceremonial_liege_opinion_list + } + every_in_list = { + list = close_family_coup_ceremonial_liege_opinion_list + limit = { top_liege = scope:owner.top_liege } + rightfully_imprison_character_less_verbose_effect = { + TARGET = this + IMPRISONER = scope:owner + } + } + every_in_list = { + list = close_family_coup_ceremonial_liege_opinion_list + custom = all_close_family_and_spouses + add_opinion = { + target = $PLOTTER$ + modifier = seized_close_family_throne_crime + } + } + } +} + +attempted_coup_ceremonial_liege_opinion_effect = { + $VICTIM$ = { + if = { + limit = { is_alive = yes } + add_opinion = { + target = $PLOTTER$ + modifier = attempted_to_seize_my_throne_crime + } + } + every_spouse = { + limit = { NOT = { this = $PLOTTER$ } } + add_to_temporary_list = close_family_coup_ceremonial_liege_opinion_list + } + every_close_family_member = { + limit = { NOT = { this = $PLOTTER$ } } + add_to_temporary_list = close_family_coup_ceremonial_liege_opinion_list + } + if = { + limit = { + any_in_list = { list = close_family_coup_ceremonial_liege_opinion_list } + } + every_in_list = { + list = close_family_coup_ceremonial_liege_opinion_list + custom = all_close_family_and_spouses + add_opinion = { + target = $PLOTTER$ + modifier = attempted_to_seize_throne_close_family_crime + } + } + } + } +} + +nomad_domicile_refund_treasury_or_gold_effect = { + #Domicile buildings give cash refund + if = { + limit = { + has_domicile = yes + } + save_scope_as = former_nomad + custom_tooltip = nomad_domicile_buildings_converted_for_treasury_or_gold + hidden_effect = { + save_scope_value_as = { + name = domicile_refund_treasury_or_gold_value + value = { + value = medium_gold_value + switch = { + trigger = domicile.num_domicile_buildings + 7 = { multiply = 7 } + 6 = { multiply = 6 } + 5 = { multiply = 5 } + 4 = { multiply = 4 } + 3 = { multiply = 3 } + 2 = { multiply = 2 } + } + } + } + } + } +} + +nomad_convert_herds_to_treasury_or_gold_special_troops_effect = { + save_scope_as = former_nomad + custom_tooltip = treasury_or_gold_army_for_herd_tt + hidden_effect = { + if = { + limit = { + domicile.herd >= 50 + } + save_scope_as = army_getter + save_scope_value_as = { + name = nomad_convert_herds_to_treasury_or_gold_value + value = { + value = domicile.herd + multiply = 0.3 + min = 100 + max = 10000 + } + } + spawn_army = { + levies = 200 + men_at_arms = { + type = horse_archers + men = { value = domicile.herd multiply = 0.02 min = 100 max = 10000 } + } + men_at_arms = { + type = steppe_raiders + men = { value = domicile.herd multiply = 0.01 min = 100 max = 10000 } + } + men_at_arms = { + type = nomad_lancers + men = { value = domicile.herd multiply = 0.01 min = 100 max = 10000 } + } + men_at_arms = { + type = nomadic_riders + men = { value = domicile.herd multiply = 0.1 min = 100 max = 10000 } + } + location = capital_province + inheritable = yes + uses_supply = yes + name = former_nomad_army_name + } + } + } +} + +empty_treasury_when_abandoning_landed_life_effect = { + if = { + limit = { + treasury > 0 + } + save_scope_value_as = { + name = current_treasury + value = treasury + } + remove_treasury = { + value = scope:current_treasury + } + } +} + +refund_noble_family_domicile_buildings_effect = { + if = { + limit = { + has_domicile = yes + } + save_scope_as = former_noble_family_head + custom_tooltip = noble_family_domicile_buildings_converted + hidden_effect = { + add_gold = { + value = { + value = medium_gold_value + switch = { + trigger = domicile.num_domicile_buildings + 7 = { multiply = 7 } + 6 = { multiply = 6 } + 5 = { multiply = 5 } + 4 = { multiply = 4 } + 3 = { multiply = 3 } + 2 = { multiply = 2 } + } + } + } + } + } +} + +refund_vassal_noble_families_and_make_them_nomads_effect = { + if = { + limit = { + any_vassal = { + is_landless_ruler = yes + culture = { + has_same_culture_heritage = root.culture + } + any_held_title = { + is_noble_family_title = yes + } + } + } + every_vassal = { + limit = { + is_landless_ruler = yes + culture = { + has_same_culture_heritage = root.culture + } + any_held_title = { + is_noble_family_title = yes + } + } + if = { + limit = { + has_domicile = yes + } + add_gold = { + value = { + value = medium_gold_value + switch = { + trigger = domicile.num_domicile_buildings + 7 = { multiply = 7 } + 6 = { multiply = 6 } + 5 = { multiply = 5 } + 4 = { multiply = 4 } + 3 = { multiply = 3 } + 2 = { multiply = 2 } + } + } + } + } + change_government = nomad_government + if = { + limit = { NOT = { has_trait = nomadic_philosophy } } + add_trait = nomadic_philosophy + } + every_held_title = { + limit = { + is_noble_family_title = yes + } + holder = { + destroy_title = prev + } + } + } + } +} + +rehome_noble_families_to_compatible_liege_effect = { + if = { + limit = { + any_vassal = { + is_landless_ruler = yes + NOT = { + culture = { + has_same_culture_heritage = root.culture + } + } + any_held_title = { + is_noble_family_title = yes + } + } + } + if = { + limit = { + any_vassal = { + is_landed = yes + highest_held_title_tier >= tier_kingdom + government_has_flag = government_has_merit + } + } + random_vassal = { + limit = { + is_landed = yes + highest_held_title_tier >= tier_kingdom + government_has_flag = government_has_merit + } + save_scope_as = new_liege_for_homeless_families + } + } + else_if = { + limit = { + any_tributary = { + highest_held_title_tier >= tier_kingdom + government_has_flag = government_has_merit + } + } + random_tributary = { + limit = { + highest_held_title_tier >= tier_kingdom + government_has_flag = government_has_merit + } + save_scope_as = new_liege_for_homeless_families + } + } + else_if = { + limit = { + any_neighboring_top_liege_realm_owner = { + government_has_flag = government_has_merit + highest_held_title_tier >= tier_empire + } + } + random_neighboring_top_liege_realm_owner = { + limit = { + government_has_flag = government_has_merit + highest_held_title_tier >= tier_hegemony + } + save_scope_as = new_liege_for_homeless_families + } + } + else_if = { + limit = { + any_independent_ruler = { + NOT = { + this = root + } + in_diplomatic_range = root + government_has_flag = government_has_merit + highest_held_title_tier >= tier_empire + } + } + random_independent_ruler = { + limit = { + NOT = { + this = root + } + in_diplomatic_range = root + government_has_flag = government_has_merit + highest_held_title_tier >= tier_empire + } + save_scope_as = new_liege_for_homeless_families + } + } + else_if = { + limit = { + any_independent_ruler = { + NOT = { + this = root + } + in_diplomatic_range = root + government_has_flag = government_has_merit + highest_held_title_tier >= tier_kingdom + } + } + random_independent_ruler = { + limit = { + NOT = { + this = root + } + in_diplomatic_range = root + government_has_flag = government_has_merit + highest_held_title_tier >= tier_kingdom + } + save_scope_as = new_liege_for_homeless_families + } + } + if = { + limit = { + exists = scope:new_liege_for_homeless_families + } + every_vassal = { + limit = { + is_landless_ruler = yes + NOT = { + culture = { + has_same_culture_heritage = root.culture + } + } + any_held_title = { + is_noble_family_title = yes + } + } + create_title_and_vassal_change = { + type = swear_fealty + save_scope_as = title_change + } + change_liege = { + liege = scope:new_liege_for_homeless_families + change = scope:title_change + } + resolve_title_and_vassal_change = scope:title_change + domicile = { + move_domicile = scope:new_liege_for_homeless_families.capital_province + } + } + } + else = { + every_vassal = { + limit = { + is_landless_ruler = yes + NOT = { + culture = { + has_same_culture_heritage = root + } + } + any_held_title = { + is_noble_family_title = yes + } + } + every_held_title = { + limit = { + is_noble_family_title = yes + } + holder = { + destroy_title = prev + } + } + move_to_pool_effect = yes + } + } + } +} + +convert_steppe_admin_vassals_to_meritocratic_effect = { + if = { + limit = { + any_vassal_or_below = { + government_has_flag = government_is_steppe_admin + } + } + every_vassal_or_below = { + limit = { + government_has_flag = government_is_steppe_admin + } + change_government = meritocratic_government + } + } +} + +nomad_to_steppe_admin_new_capital_effect = { + every_sub_realm_county = { + limit = { + title_province = { + NOR = { + has_holding_type = nomad_holding + has_holding_type = herder_holding + has_holding_type = tribal_holding + } + } + } + add_to_list = potential_new_capitals + } + every_held_title = { + limit = { + tier = tier_county + title_province = { + NOR = { + has_holding_type = nomad_holding + has_holding_type = herder_holding + has_holding_type = tribal_holding + } + } + } + add_to_list = potential_new_capitals + } + ordered_in_list = { + order_by = development_level + list = potential_new_capitals + save_scope_as = new_capital + } + if = { + limit = { + capital_county = { + title_province = { + NOR = { + has_holding_type = nomad_holding + has_holding_type = herder_holding + has_holding_type = tribal_holding + } + } + } + } + capital_county = { + save_scope_as = new_capital + } + } + if = { + limit = { + exists = scope:new_capital + capital_county != scope:new_capital + } + if = { + limit = { + scope:new_capital.holder != root + } + create_title_and_vassal_change = { + type = usurped + save_scope_as = change + add_claim_on_loss = yes + } + scope:new_capital = { + change_title_holder = { + holder = root + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + } + set_realm_capital = scope:new_capital + } + scope:new_capital.duchy = { save_scope_as = nomad_duchy_for_name } + #Should gain target title, if possible + if = { + limit = { + scope:new_capital.kingdom = { + NOT = { + exists = holder + } + } + } + create_title_and_vassal_change = { + type = created + save_scope_as = change + add_claim_on_loss = yes + } + scope:new_capital.kingdom = { + save_scope_as = new_primary + change_title_holder = { + holder = root + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + } + if = { + limit = { + scope:new_capital.duchy = { + NOT = { + exists = holder + } + } + } + hidden_effect = { + create_title_and_vassal_change = { + type = created + save_scope_as = change_1 + add_claim_on_loss = yes + } + scope:new_capital.duchy = { + change_title_holder = { + holder = root + change = scope:change_1 + } + } + resolve_title_and_vassal_change = scope:change_1 + } + } + #For GoK, they keep using their Gok Title + if = { + limit = { + AND = { + exists = global_var:greatest_of_khans_title + primary_title = global_var:greatest_of_khans_title + } + } + primary_title = { + set_can_be_named_after_dynasty = yes + set_definitive_form = yes + save_scope_as = new_primary + save_scope_as = new_title + set_capital_county = scope:new_capital + } + } + #Otherwise, gain titular empire + else = { + hidden_effect = { + create_dynamic_title = { + tier = empire + name = SETTLED_NOMAD_STEPPE_ADMIN_EMPIRE_NAME + adj = SETTLED_NOMAD_STEPPE_ADMIN_EMPIRE_ADJ + } + scope:new_title = { + save_scope_as = new_primary + set_definitive_form = yes + } + create_title_and_vassal_change = { + type = created + save_scope_as = change_2 + add_claim_on_loss = no + } + scope:new_title = { + set_can_be_named_after_dynasty = yes + change_title_holder = { + holder = root + change = scope:change_2 + } + } + resolve_title_and_vassal_change = scope:change_2 + scope:new_title = { generate_coa = yes } + } + #Make this their primary title, if highest tier + hidden_effect = { + if = { + limit = { + exists = scope:new_primary + NOT = { + highest_held_title_tier > scope:new_primary.tier + } + } + set_primary_title_to = scope:new_primary + scope:new_primary = { + set_capital_county = scope:new_capital + } + } + } + } +} + +generate_new_steppe_admin_families_effect = { + while = { + count = 10 + create_character = { + template = tgp_steppe_admin_family_head_template + culture = root.capital_county.culture + faith = root.capital_county.faith + location = root.location + dynasty = generate + after_creation = { + add_to_list = new_steppe_admin_family_heads + set_employer = root + } + } + } + every_in_list = { + list = new_steppe_admin_family_heads + give_noble_family_title = { + name = noble_family_name + tier = county + article = DEFAULT_TITLE_NAME_ARTICLE + government = steppe_admin_government + save_scope_as = new_title + } + } + create_title_and_vassal_change = { + type = created + save_scope_as = change + } + every_in_list = { + list = new_steppe_admin_family_heads + change_liege = { + liege = root + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + scope:new_title = { + set_coa = holder.house + } +} + +tgp_cranial_trophies_beheading_effect = { + $KILLER$ = { + save_temporary_scope_as = the_killer # for the Artifact localization + } + $DEAD$ = { + save_temporary_scope_as = dead_one # for the Artifact localization + save_scope_as = dead_character + } + if = { + limit = { + $DEAD$ = { + highest_held_title_tier = tier_hegemony + } + } + $KILLER$ = { + create_artifact = { + name = tgp_cranial_trophy_artifact + description = tgp_cranial_trophy_artifact_desc + rarity = illustrious + type = miscellaneous + modifier = cranial_trophy_modifier_t6 + decaying = yes + template = tgp_severed_head_template + visuals = pocket_severed_head + creator = $DEAD$ + } + } + } + else_if = { + limit = { + $DEAD$ = { + highest_held_title_tier = tier_empire + } + } + $KILLER$ = { + create_artifact = { + name = tgp_cranial_trophy_artifact + description = tgp_cranial_trophy_artifact_desc + rarity = illustrious + type = miscellaneous + modifier = cranial_trophy_modifier_t5 + decaying = yes + template = tgp_severed_head_template + visuals = pocket_severed_head + creator = $DEAD$ + } + } + } + else_if = { + limit = { + $DEAD$ = { + highest_held_title_tier = tier_kingdom + } + } + $KILLER$ = { + create_artifact = { + name = tgp_cranial_trophy_artifact + description = tgp_cranial_trophy_artifact_desc + rarity = famed + type = miscellaneous + modifier = cranial_trophy_modifier_t4 + decaying = yes + template = tgp_severed_head_template + visuals = pocket_severed_head + creator = $DEAD$ + } + } + } + else_if = { + limit = { + $DEAD$ = { + highest_held_title_tier = tier_duchy + } + } + $KILLER$ = { + create_artifact = { + name = tgp_cranial_trophy_artifact + description = tgp_cranial_trophy_artifact_desc + rarity = famed + type = miscellaneous + modifier = cranial_trophy_modifier_t3 + decaying = yes + template = tgp_severed_head_template + visuals = pocket_severed_head + creator = $DEAD$ + } + } + } + else_if = { + limit = { + $DEAD$ = { + highest_held_title_tier = tier_county + } + } + $KILLER$ = { + create_artifact = { + name = tgp_cranial_trophy_artifact + description = tgp_cranial_trophy_artifact_desc + rarity = masterwork + type = miscellaneous + modifier = cranial_trophy_modifier_t2 + decaying = yes + template = tgp_severed_head_template + visuals = pocket_severed_head + creator = $DEAD$ + } + } + } + else_if = { + limit = { + $DEAD$ = { + highest_held_title_tier = tier_barony + } + } + $KILLER$ = { + create_artifact = { + name = tgp_cranial_trophy_artifact + description = tgp_cranial_trophy_artifact_desc + rarity = masterwork + type = miscellaneous + modifier = cranial_trophy_modifier_t1 + decaying = yes + template = tgp_severed_head_template + visuals = pocket_severed_head + creator = $DEAD$ + } + } + } + else = { + $KILLER$ = { + create_artifact = { + name = tgp_cranial_trophy_artifact + description = tgp_cranial_trophy_artifact_desc + rarity = common + type = miscellaneous + modifier = cranial_trophy_modifier_t0 + decaying = yes + template = tgp_severed_head_template + visuals = pocket_severed_head + creator = $DEAD$ + } + } + } + $KILLER$ = { + add_piety = { + value = cranial_trophies_stolen_prestige_value + } + } +} + +generate_ci_poem_title_effect = { + #For use with the [SCOPE.Custom('GetCiPoemName')] loc key. This sets a poem. + #Only needed if you want a randomized but persistent name - otherwise we just use the custom loc key directly and it works out of the box. + random_list = { + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:riverside_city + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:green_jade_bowl + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:scent_fills_the_hall + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:lady_yu + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:butterflies_love_blossoms + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:plucking_mulberry_leafs + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:rivertown_man + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:fragrance_filling_the_hall + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:butterflies_kiss_flowers + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:spring_in_the_han_palace + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:winds_between_pine_trees + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:memories_of_the_past_at_red_cliff + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:my_wrath_bristles_through_my_helmet + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:thinking_of_the_past_at_beigu_pavilion + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:dream_song + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:picking_mulberry + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:as_in_a_dream + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:immortal_by_the_river + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:longing_for_qin_e + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:new_chrysanthemum_flowers + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:poluomen_son + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:pouring_out_deep_emotions + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:rain_hits_a_bell + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:spring_in_the_tower_of_jade + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:drunk_in_the_fairyland + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:anxiety_of_a_beauty + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:writing_of_my_sorrow + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:sad_remembrance + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:on_the_advent_of_spring + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:silk_washing_stream + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:at_an_inn_in_xinshi + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:on_red_lotus_petals + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:pusa_man + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:a_quiet_night + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:huanxi_sand + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:overlapping_golden_light_of_small_hills + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:the_river_is_red + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:the_road_is_difficult + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:phoenix_hairpin + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:boating_on_tai_lake + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:prelude_to_the_water_song + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:rambling_young_man + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:king_of_lanling + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:washing_creek_sands + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:magnolia_blossoms + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:petals_falling_in_the_river + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:my_way_passed_ancient_tombs + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:the_water_clock_sings_at_night + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:dreaming_of_the_south_side_of_the_river + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:beautiful_barbarian + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:missing_the_emperors_hometown + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:daoist_priestess + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:a_bushel_of_pearls + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:bodhisattva_barbarian + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:clear_and_even_music + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:lost_battle + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:beauty_yu + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:crows_cry_at_night + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:phoenix_perched_on_the_parasol_tree + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:imperial_avenue_procession + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:rain_hits_a_bell + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:divination_song + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:attached_to_her_skirt + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:partridge_sky + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:mountain_hawthorn + } + } + 1 = { + save_scope_value_as = { + name = poem_tune + value = flag:the_song_of_tangduo + } + } + } +} + +tgp_step_down_title_recipient_tooltip_effect = { + if = { + limit = { is_independent_ruler = no } + top_liege = { save_temporary_scope_as = fallback_temp } + } + else = { + primary_title.current_heir = { save_temporary_scope_as = fallback_temp } + } + show_as_tooltip = { + create_title_and_vassal_change = { + type = appointment + save_scope_as = change + } + every_held_title = { + limit = { + is_landless_type_title = no + tier > tier_barony + } + save_temporary_scope_as = lost_title_temp + current_heir ?= { save_temporary_scope_as = heir_temp } + if = { + limit = { NOT = { exists = scope:heir_temp } } + scope:fallback_temp = { save_temporary_scope_as = heir_temp } + } + change_title_holder = { + holder = scope:heir_temp + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + } +} + +tgp_domicile_conversion_when_changing_government_type = { + hidden_effect = { + if = { + limit = { + any_held_title = { + is_noble_family_title = yes + } + has_domicile = yes + NOT = { + domicile ?= { + is_domicile_type = $NEW_DOMICILE_TYPE$ + } + } + } + random_held_title = { + limit = { + is_noble_family_title = yes + } + save_scope_as = old_nf_title + } + tgp_wipe_domicile_effect = yes + if = { + limit = { + has_character_flag = new_government_is_byz_admin + } + give_noble_family_title = { + name = noble_family_name + tier = duchy + article = DEFAULT_TITLE_NAME_ARTICLE + government = $NEW_GOVERNMENT_TYPE$ + save_scope_as = new_title + } + } + else = { + give_noble_family_title = { + name = noble_family_name + tier = county + article = DEFAULT_TITLE_NAME_ARTICLE + government = $NEW_GOVERNMENT_TYPE$ + save_scope_as = new_title + } + } + scope:new_title = { + copy_title_history = scope:old_nf_title + } + destroy_title = scope:old_nf_title + domicile ?= { + set_up_domicile_estate_effect = yes + } + } + } +} + +tgp_wipe_domicile_effect = { + domicile ?= { + if = { + limit = { has_domicile_building = east_asian_estate_main_01 } + remove_domicile_building = east_asian_estate_main_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_main_02 } + remove_domicile_building = east_asian_estate_main_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_main_03 } + remove_domicile_building = east_asian_estate_main_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_main_04 } + remove_domicile_building = east_asian_estate_main_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_main_05 } + remove_domicile_building = east_asian_estate_main_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_library_01 } + remove_domicile_building = east_asian_estate_library_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_library_02 } + remove_domicile_building = east_asian_estate_library_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_library_education_03 } + remove_domicile_building = east_asian_estate_library_education_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_library_education_04 } + remove_domicile_building = east_asian_estate_library_education_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_taxation_01 } + remove_domicile_building = east_asian_estate_taxation_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_taxation_02 } + remove_domicile_building = east_asian_estate_taxation_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_taxation_03 } + remove_domicile_building = east_asian_estate_taxation_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_taxation_04 } + remove_domicile_building = east_asian_estate_taxation_04 + } + if = { + limit = { has_domicile_building = east_asian_peasant_quarters_01 } + remove_domicile_building = east_asian_peasant_quarters_01 + } + if = { + limit = { has_domicile_building = east_asian_peasant_quarters_02 } + remove_domicile_building = east_asian_peasant_quarters_02 + } + if = { + limit = { has_domicile_building = east_asian_peasant_quarters_03 } + remove_domicile_building = east_asian_peasant_quarters_03 + } + if = { + limit = { has_domicile_building = east_asian_peasant_quarters_04 } + remove_domicile_building = east_asian_peasant_quarters_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_minister_office_01 } + remove_domicile_building = east_asian_estate_minister_office_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_minister_office_02 } + remove_domicile_building = east_asian_estate_minister_office_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_minister_office_03 } + remove_domicile_building = east_asian_estate_minister_office_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_minister_office_04 } + remove_domicile_building = east_asian_estate_minister_office_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_movement_study_01 } + remove_domicile_building = east_asian_estate_movement_study_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_movement_study_02 } + remove_domicile_building = east_asian_estate_movement_study_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_movement_study_03 } + remove_domicile_building = east_asian_estate_movement_study_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_movement_study_04 } + remove_domicile_building = east_asian_estate_movement_study_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_archive_01 } + remove_domicile_building = east_asian_estate_archive_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_archive_02 } + remove_domicile_building = east_asian_estate_archive_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_archive_03 } + remove_domicile_building = east_asian_estate_archive_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_archive_04 } + remove_domicile_building = east_asian_estate_archive_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_cartography_office_01 } + remove_domicile_building = east_asian_estate_cartography_office_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_cartography_office_02 } + remove_domicile_building = east_asian_estate_cartography_office_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_cartography_office_03 } + remove_domicile_building = east_asian_estate_cartography_office_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_cartography_office_04 } + remove_domicile_building = east_asian_estate_cartography_office_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_drafting_room_01 } + remove_domicile_building = east_asian_estate_drafting_room_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_drafting_room_02 } + remove_domicile_building = east_asian_estate_drafting_room_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_drafting_room_03 } + remove_domicile_building = east_asian_estate_drafting_room_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_drafting_room_04 } + remove_domicile_building = east_asian_estate_drafting_room_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_clerks_hall_01 } + remove_domicile_building = east_asian_estate_clerks_hall_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_clerks_hall_02 } + remove_domicile_building = east_asian_estate_clerks_hall_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_clerks_hall_03 } + remove_domicile_building = east_asian_estate_clerks_hall_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_clerks_hall_04 } + remove_domicile_building = east_asian_estate_clerks_hall_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_revenue_audit_desk_01 } + remove_domicile_building = east_asian_estate_revenue_audit_desk_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_revenue_audit_desk_02 } + remove_domicile_building = east_asian_estate_revenue_audit_desk_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_revenue_audit_desk_03 } + remove_domicile_building = east_asian_estate_revenue_audit_desk_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_revenue_audit_desk_04 } + remove_domicile_building = east_asian_estate_revenue_audit_desk_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_block_printing_hall_01 } + remove_domicile_building = east_asian_estate_block_printing_hall_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_block_printing_hall_02 } + remove_domicile_building = east_asian_estate_block_printing_hall_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_block_printing_hall_03 } + remove_domicile_building = east_asian_estate_block_printing_hall_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_block_printing_hall_04 } + remove_domicile_building = east_asian_estate_block_printing_hall_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_xuan_paper_stores_01 } + remove_domicile_building = east_asian_estate_xuan_paper_stores_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_xuan_paper_stores_02 } + remove_domicile_building = east_asian_estate_xuan_paper_stores_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_xuan_paper_stores_03 } + remove_domicile_building = east_asian_estate_xuan_paper_stores_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_xuan_paper_stores_04 } + remove_domicile_building = east_asian_estate_xuan_paper_stores_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_water_clock_room_01 } + remove_domicile_building = east_asian_estate_water_clock_room_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_water_clock_room_02 } + remove_domicile_building = east_asian_estate_water_clock_room_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_water_clock_room_03 } + remove_domicile_building = east_asian_estate_water_clock_room_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_water_clock_room_04 } + remove_domicile_building = east_asian_estate_water_clock_room_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_examination_room_01 } + remove_domicile_building = east_asian_estate_examination_room_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_examination_room_02 } + remove_domicile_building = east_asian_estate_examination_room_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_examination_room_03 } + remove_domicile_building = east_asian_estate_examination_room_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_examination_room_04 } + remove_domicile_building = east_asian_estate_examination_room_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_living_quarters_01 } + remove_domicile_building = east_asian_estate_living_quarters_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_living_quarters_02 } + remove_domicile_building = east_asian_estate_living_quarters_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_living_quarters_03 } + remove_domicile_building = east_asian_estate_living_quarters_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_living_quarters_04 } + remove_domicile_building = east_asian_estate_living_quarters_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_study_01 } + remove_domicile_building = east_asian_estate_study_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_study_02 } + remove_domicile_building = east_asian_estate_study_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_study_03 } + remove_domicile_building = east_asian_estate_study_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_study_04 } + remove_domicile_building = east_asian_estate_study_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_commander_study_01 } + remove_domicile_building = east_asian_estate_commander_study_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_commander_study_02 } + remove_domicile_building = east_asian_estate_commander_study_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_commander_study_03 } + remove_domicile_building = east_asian_estate_commander_study_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_commander_study_04 } + remove_domicile_building = east_asian_estate_commander_study_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_office_01 } + remove_domicile_building = east_asian_estate_office_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_office_02 } + remove_domicile_building = east_asian_estate_office_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_office_03 } + remove_domicile_building = east_asian_estate_office_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_office_04 } + remove_domicile_building = east_asian_estate_office_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_servants_quarters_01 } + remove_domicile_building = east_asian_estate_servants_quarters_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_servants_quarters_02 } + remove_domicile_building = east_asian_estate_servants_quarters_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_servants_quarters_03 } + remove_domicile_building = east_asian_estate_servants_quarters_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_servants_quarters_04 } + remove_domicile_building = east_asian_estate_servants_quarters_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_bath_01 } + remove_domicile_building = east_asian_estate_bath_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_bath_02 } + remove_domicile_building = east_asian_estate_bath_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_bath_03 } + remove_domicile_building = east_asian_estate_bath_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_bath_04 } + remove_domicile_building = east_asian_estate_bath_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_guest_room_01 } + remove_domicile_building = east_asian_estate_guest_room_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_guest_room_02 } + remove_domicile_building = east_asian_estate_guest_room_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_guest_room_03 } + remove_domicile_building = east_asian_estate_guest_room_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_guest_room_04 } + remove_domicile_building = east_asian_estate_guest_room_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_wine_cellar_01 } + remove_domicile_building = east_asian_estate_wine_cellar_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_wine_cellar_02 } + remove_domicile_building = east_asian_estate_wine_cellar_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_wine_cellar_03 } + remove_domicile_building = east_asian_estate_wine_cellar_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_courtyard_01 } + remove_domicile_building = east_asian_estate_courtyard_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_courtyard_02 } + remove_domicile_building = east_asian_estate_courtyard_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_courtyard_03 } + remove_domicile_building = east_asian_estate_courtyard_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_courtyard_04 } + remove_domicile_building = east_asian_estate_courtyard_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_prison_01 } + remove_domicile_building = east_asian_estate_prison_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_prison_02 } + remove_domicile_building = east_asian_estate_prison_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_prison_03 } + remove_domicile_building = east_asian_estate_prison_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_prison_04 } + remove_domicile_building = east_asian_estate_prison_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_reception_hall_01 } + remove_domicile_building = east_asian_estate_reception_hall_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_reception_hall_02 } + remove_domicile_building = east_asian_estate_reception_hall_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_reception_hall_03 } + remove_domicile_building = east_asian_estate_reception_hall_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_reception_hall_04 } + remove_domicile_building = east_asian_estate_reception_hall_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_reception_hall_05 } + remove_domicile_building = east_asian_estate_reception_hall_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_cabinet_of_curiosities_01 } + remove_domicile_building = east_asian_estate_cabinet_of_curiosities_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_cabinet_of_curiosities_02 } + remove_domicile_building = east_asian_estate_cabinet_of_curiosities_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_cabinet_of_curiosities_03 } + remove_domicile_building = east_asian_estate_cabinet_of_curiosities_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_rice_field_01 } + remove_domicile_building = east_asian_estate_rice_field_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_rice_field_02 } + remove_domicile_building = east_asian_estate_rice_field_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_rice_field_03 } + remove_domicile_building = east_asian_estate_rice_field_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_rice_field_04 } + remove_domicile_building = east_asian_estate_rice_field_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_rice_field_05 } + remove_domicile_building = east_asian_estate_rice_field_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_rice_field_06 } + remove_domicile_building = east_asian_estate_rice_field_06 + } + if = { + limit = { has_domicile_building = east_asian_estate_tea_01 } + remove_domicile_building = east_asian_estate_tea_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_tea_02 } + remove_domicile_building = east_asian_estate_tea_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_tea_03 } + remove_domicile_building = east_asian_estate_tea_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_tea_04 } + remove_domicile_building = east_asian_estate_tea_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_tea_05 } + remove_domicile_building = east_asian_estate_tea_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_tea_06 } + remove_domicile_building = east_asian_estate_tea_06 + } + if = { + limit = { has_domicile_building = east_asian_estate_market_01 } + remove_domicile_building = east_asian_estate_market_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_market_02 } + remove_domicile_building = east_asian_estate_market_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_market_03 } + remove_domicile_building = east_asian_estate_market_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_market_04 } + remove_domicile_building = east_asian_estate_market_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_market_05 } + remove_domicile_building = east_asian_estate_market_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_market_06 } + remove_domicile_building = east_asian_estate_market_06 + } + if = { + limit = { has_domicile_building = east_asian_estate_health_01 } + remove_domicile_building = east_asian_estate_health_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_health_02 } + remove_domicile_building = east_asian_estate_health_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_health_03 } + remove_domicile_building = east_asian_estate_health_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_health_04 } + remove_domicile_building = east_asian_estate_health_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_health_05 } + remove_domicile_building = east_asian_estate_health_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_health_06 } + remove_domicile_building = east_asian_estate_health_06 + } + if = { + limit = { has_domicile_building = east_asian_estate_silk_01 } + remove_domicile_building = east_asian_estate_silk_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_silk_02 } + remove_domicile_building = east_asian_estate_silk_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_silk_03 } + remove_domicile_building = east_asian_estate_silk_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_silk_04 } + remove_domicile_building = east_asian_estate_silk_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_silk_05 } + remove_domicile_building = east_asian_estate_silk_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_silk_06 } + remove_domicile_building = east_asian_estate_silk_06 + } + if = { + limit = { has_domicile_building = east_asian_estate_ancestral_shrine_01 } + remove_domicile_building = east_asian_estate_ancestral_shrine_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_ancestral_shrine_02 } + remove_domicile_building = east_asian_estate_ancestral_shrine_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_ancestral_shrine_03 } + remove_domicile_building = east_asian_estate_ancestral_shrine_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_ancestral_shrine_04 } + remove_domicile_building = east_asian_estate_ancestral_shrine_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_ancestral_shrine_05 } + remove_domicile_building = east_asian_estate_ancestral_shrine_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_ancestral_shrine_06 } + remove_domicile_building = east_asian_estate_ancestral_shrine_06 + } + if = { + limit = { has_domicile_building = east_asian_estate_temple_01 } + remove_domicile_building = east_asian_estate_temple_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_temple_02 } + remove_domicile_building = east_asian_estate_temple_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_temple_03 } + remove_domicile_building = east_asian_estate_temple_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_temple_04 } + remove_domicile_building = east_asian_estate_temple_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_temple_05 } + remove_domicile_building = east_asian_estate_temple_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_temple_06 } + remove_domicile_building = east_asian_estate_temple_06 + } + if = { + limit = { has_domicile_building = east_asian_estate_barracks_01 } + remove_domicile_building = east_asian_estate_barracks_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_barracks_02 } + remove_domicile_building = east_asian_estate_barracks_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_barracks_03 } + remove_domicile_building = east_asian_estate_barracks_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_barracks_04 } + remove_domicile_building = east_asian_estate_barracks_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_barracks_05 } + remove_domicile_building = east_asian_estate_barracks_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_barracks_06 } + remove_domicile_building = east_asian_estate_barracks_06 + } + if = { + limit = { has_domicile_building = east_asian_estate_watchtower_01 } + remove_domicile_building = east_asian_estate_watchtower_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_watchtower_02 } + remove_domicile_building = east_asian_estate_watchtower_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_watchtower_03 } + remove_domicile_building = east_asian_estate_watchtower_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_watchtower_04 } + remove_domicile_building = east_asian_estate_watchtower_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_watchtower_05 } + remove_domicile_building = east_asian_estate_watchtower_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_watchtower_06 } + remove_domicile_building = east_asian_estate_watchtower_06 + } + if = { + limit = { has_domicile_building = east_asian_estate_garden_01 } + remove_domicile_building = east_asian_estate_garden_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_garden_02 } + remove_domicile_building = east_asian_estate_garden_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_garden_03 } + remove_domicile_building = east_asian_estate_garden_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_garden_leisure_04 } + remove_domicile_building = east_asian_estate_garden_leisure_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_garden_leisure_05 } + remove_domicile_building = east_asian_estate_garden_leisure_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_garden_leisure_06 } + remove_domicile_building = east_asian_estate_garden_leisure_06 + } + if = { + limit = { has_domicile_building = east_asian_estate_garden_fruit_04 } + remove_domicile_building = east_asian_estate_garden_fruit_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_garden_fruit_05 } + remove_domicile_building = east_asian_estate_garden_fruit_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_garden_fruit_06 } + remove_domicile_building = east_asian_estate_garden_fruit_06 + } + if = { + limit = { has_domicile_building = east_asian_estate_stable_01 } + remove_domicile_building = east_asian_estate_stable_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_stable_02 } + remove_domicile_building = east_asian_estate_stable_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_stable_03 } + remove_domicile_building = east_asian_estate_stable_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_stable_grand_04 } + remove_domicile_building = east_asian_estate_stable_grand_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_stable_grand_05 } + remove_domicile_building = east_asian_estate_stable_grand_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_stable_grand_06 } + remove_domicile_building = east_asian_estate_stable_grand_06 + } + if = { + limit = { has_domicile_building = east_asian_estate_stable_kennel_04 } + remove_domicile_building = east_asian_estate_stable_kennel_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_stable_kennel_05 } + remove_domicile_building = east_asian_estate_stable_kennel_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_stable_kennel_06 } + remove_domicile_building = east_asian_estate_stable_kennel_06 + } + if = { + limit = { has_domicile_building = east_asian_estate_workshop_01 } + remove_domicile_building = east_asian_estate_workshop_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_workshop_02 } + remove_domicile_building = east_asian_estate_workshop_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_workshop_carpenter_03 } + remove_domicile_building = east_asian_estate_workshop_carpenter_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_workshop_carpenter_04 } + remove_domicile_building = east_asian_estate_workshop_carpenter_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_workshop_carpenter_05 } + remove_domicile_building = east_asian_estate_workshop_carpenter_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_workshop_carpenter_06 } + remove_domicile_building = east_asian_estate_workshop_carpenter_06 + } + if = { + limit = { has_domicile_building = east_asian_estate_workshop_mason_03 } + remove_domicile_building = east_asian_estate_workshop_mason_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_workshop_mason_04 } + remove_domicile_building = east_asian_estate_workshop_mason_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_workshop_mason_05 } + remove_domicile_building = east_asian_estate_workshop_mason_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_workshop_mason_06 } + remove_domicile_building = east_asian_estate_workshop_mason_06 + } + if = { + limit = { has_domicile_building = east_asian_estate_workshop_textile_03 } + remove_domicile_building = east_asian_estate_workshop_textile_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_workshop_textile_04 } + remove_domicile_building = east_asian_estate_workshop_textile_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_workshop_textile_05 } + remove_domicile_building = east_asian_estate_workshop_textile_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_workshop_textile_06 } + remove_domicile_building = east_asian_estate_workshop_textile_06 + } + if = { + limit = { has_domicile_building = east_asian_estate_storage_01 } + remove_domicile_building = east_asian_estate_storage_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_storage_02 } + remove_domicile_building = east_asian_estate_storage_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_storage_warehouse_03 } + remove_domicile_building = east_asian_estate_storage_warehouse_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_storage_warehouse_04 } + remove_domicile_building = east_asian_estate_storage_warehouse_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_storage_warehouse_05 } + remove_domicile_building = east_asian_estate_storage_warehouse_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_storage_warehouse_06 } + remove_domicile_building = east_asian_estate_storage_warehouse_06 + } + if = { + limit = { has_domicile_building = east_asian_estate_storage_granary_03 } + remove_domicile_building = east_asian_estate_storage_granary_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_storage_granary_04 } + remove_domicile_building = east_asian_estate_storage_granary_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_storage_granary_05 } + remove_domicile_building = east_asian_estate_storage_granary_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_storage_granary_06 } + remove_domicile_building = east_asian_estate_storage_granary_06 + } + if = { + limit = { has_domicile_building = east_asian_estate_grazing_land_01 } + remove_domicile_building = east_asian_estate_grazing_land_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_grazing_land_02 } + remove_domicile_building = east_asian_estate_grazing_land_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_grazing_land_03 } + remove_domicile_building = east_asian_estate_grazing_land_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_grazing_land_04 } + remove_domicile_building = east_asian_estate_grazing_land_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_grazing_land_05 } + remove_domicile_building = east_asian_estate_grazing_land_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_grazing_land_06 } + remove_domicile_building = east_asian_estate_grazing_land_06 + } + if = { + limit = { has_domicile_building = east_asian_estate_horse_pasture_04 } + remove_domicile_building = east_asian_estate_horse_pasture_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_horse_pasture_05 } + remove_domicile_building = east_asian_estate_horse_pasture_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_horse_pasture_06 } + remove_domicile_building = east_asian_estate_horse_pasture_06 + } + if = { + limit = { has_domicile_building = east_asian_estate_camel_pasture_04 } + remove_domicile_building = east_asian_estate_camel_pasture_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_camel_pasture_05 } + remove_domicile_building = east_asian_estate_camel_pasture_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_camel_pasture_06 } + remove_domicile_building = east_asian_estate_camel_pasture_06 + } + if = { + limit = { has_domicile_building = east_asian_estate_elephant_pasture_04 } + remove_domicile_building = east_asian_estate_elephant_pasture_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_elephant_pasture_05 } + remove_domicile_building = east_asian_estate_elephant_pasture_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_elephant_pasture_06 } + remove_domicile_building = east_asian_estate_elephant_pasture_06 + } + if = { + limit = { has_domicile_building = east_asian_estate_gate_01 } + remove_domicile_building = east_asian_estate_gate_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_gate_02 } + remove_domicile_building = east_asian_estate_gate_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_gate_03 } + remove_domicile_building = east_asian_estate_gate_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_gate_04 } + remove_domicile_building = east_asian_estate_gate_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_gate_05 } + remove_domicile_building = east_asian_estate_gate_05 + } + if = { + limit = { has_domicile_building = east_asian_estate_gate_06 } + remove_domicile_building = east_asian_estate_gate_06 + } + if = { + limit = { has_domicile_building = east_asian_estate_waterways_office_01 } + remove_domicile_building = east_asian_estate_waterways_office_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_waterways_office_02 } + remove_domicile_building = east_asian_estate_waterways_office_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_waterways_office_03 } + remove_domicile_building = east_asian_estate_waterways_office_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_waterways_office_04 } + remove_domicile_building = east_asian_estate_waterways_office_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_field_surveyors_office_01 } + remove_domicile_building = east_asian_estate_field_surveyors_office_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_field_surveyors_office_02 } + remove_domicile_building = east_asian_estate_field_surveyors_office_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_field_surveyors_office_03 } + remove_domicile_building = east_asian_estate_field_surveyors_office_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_field_surveyors_office_04 } + remove_domicile_building = east_asian_estate_field_surveyors_office_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_buffer_stock_granary_01 } + remove_domicile_building = east_asian_estate_buffer_stock_granary_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_buffer_stock_granary_02 } + remove_domicile_building = east_asian_estate_buffer_stock_granary_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_buffer_stock_granary_03 } + remove_domicile_building = east_asian_estate_buffer_stock_granary_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_buffer_stock_granary_04 } + remove_domicile_building = east_asian_estate_buffer_stock_granary_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_rice_fish_duck_ponds_01 } + remove_domicile_building = east_asian_estate_rice_fish_duck_ponds_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_rice_fish_duck_ponds_02 } + remove_domicile_building = east_asian_estate_rice_fish_duck_ponds_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_rice_fish_duck_ponds_03 } + remove_domicile_building = east_asian_estate_rice_fish_duck_ponds_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_rice_fish_duck_ponds_04 } + remove_domicile_building = east_asian_estate_rice_fish_duck_ponds_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_militia_muster_green_01 } + remove_domicile_building = east_asian_estate_militia_muster_green_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_militia_muster_green_02 } + remove_domicile_building = east_asian_estate_militia_muster_green_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_militia_muster_green_03 } + remove_domicile_building = east_asian_estate_militia_muster_green_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_militia_muster_green_04 } + remove_domicile_building = east_asian_estate_militia_muster_green_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_ration_wine_stores_01 } + remove_domicile_building = east_asian_estate_ration_wine_stores_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_ration_wine_stores_02 } + remove_domicile_building = east_asian_estate_ration_wine_stores_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_ration_wine_stores_03 } + remove_domicile_building = east_asian_estate_ration_wine_stores_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_ration_wine_stores_04 } + remove_domicile_building = east_asian_estate_ration_wine_stores_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_vintner_halls_01 } + remove_domicile_building = east_asian_estate_vintner_halls_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_vintner_halls_02 } + remove_domicile_building = east_asian_estate_vintner_halls_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_vintner_halls_03 } + remove_domicile_building = east_asian_estate_vintner_halls_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_vintner_halls_04 } + remove_domicile_building = east_asian_estate_vintner_halls_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_wine_press_01 } + remove_domicile_building = east_asian_estate_wine_press_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_wine_press_02 } + remove_domicile_building = east_asian_estate_wine_press_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_wine_press_03 } + remove_domicile_building = east_asian_estate_wine_press_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_wine_press_04 } + remove_domicile_building = east_asian_estate_wine_press_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_cellar_cave_01 } + remove_domicile_building = east_asian_estate_cellar_cave_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_cellar_cave_02 } + remove_domicile_building = east_asian_estate_cellar_cave_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_cellar_cave_03 } + remove_domicile_building = east_asian_estate_cellar_cave_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_cellar_cave_04 } + remove_domicile_building = east_asian_estate_cellar_cave_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_jar_kiln_01 } + remove_domicile_building = east_asian_estate_jar_kiln_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_jar_kiln_02 } + remove_domicile_building = east_asian_estate_jar_kiln_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_jar_kiln_03 } + remove_domicile_building = east_asian_estate_jar_kiln_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_jar_kiln_04 } + remove_domicile_building = east_asian_estate_jar_kiln_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_weighing_house_01 } + remove_domicile_building = east_asian_estate_weighing_house_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_weighing_house_02 } + remove_domicile_building = east_asian_estate_weighing_house_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_weighing_house_03 } + remove_domicile_building = east_asian_estate_weighing_house_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_weighing_house_04 } + remove_domicile_building = east_asian_estate_weighing_house_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_meeting_houses_01 } + remove_domicile_building = east_asian_estate_meeting_houses_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_meeting_houses_02 } + remove_domicile_building = east_asian_estate_meeting_houses_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_meeting_houses_03 } + remove_domicile_building = east_asian_estate_meeting_houses_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_meeting_houses_04 } + remove_domicile_building = east_asian_estate_meeting_houses_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_night_watch_01 } + remove_domicile_building = east_asian_estate_night_watch_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_night_watch_02 } + remove_domicile_building = east_asian_estate_night_watch_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_night_watch_03 } + remove_domicile_building = east_asian_estate_night_watch_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_night_watch_04 } + remove_domicile_building = east_asian_estate_night_watch_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_fire_brigade_01 } + remove_domicile_building = east_asian_estate_fire_brigade_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_fire_brigade_02 } + remove_domicile_building = east_asian_estate_fire_brigade_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_fire_brigade_03 } + remove_domicile_building = east_asian_estate_fire_brigade_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_fire_brigade_04 } + remove_domicile_building = east_asian_estate_fire_brigade_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_courier_posthouse_01 } + remove_domicile_building = east_asian_estate_courier_posthouse_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_courier_posthouse_02 } + remove_domicile_building = east_asian_estate_courier_posthouse_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_courier_posthouse_03 } + remove_domicile_building = east_asian_estate_courier_posthouse_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_courier_posthouse_04 } + remove_domicile_building = east_asian_estate_courier_posthouse_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_dye_works_01 } + remove_domicile_building = east_asian_estate_dye_works_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_dye_works_02 } + remove_domicile_building = east_asian_estate_dye_works_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_dye_works_03 } + remove_domicile_building = east_asian_estate_dye_works_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_dye_works_04 } + remove_domicile_building = east_asian_estate_dye_works_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_sericulture_school_01 } + remove_domicile_building = east_asian_estate_sericulture_school_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_sericulture_school_02 } + remove_domicile_building = east_asian_estate_sericulture_school_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_sericulture_school_03 } + remove_domicile_building = east_asian_estate_sericulture_school_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_sericulture_school_04 } + remove_domicile_building = east_asian_estate_sericulture_school_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_inspection_office_01 } + remove_domicile_building = east_asian_estate_inspection_office_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_inspection_office_02 } + remove_domicile_building = east_asian_estate_inspection_office_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_inspection_office_03 } + remove_domicile_building = east_asian_estate_inspection_office_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_inspection_office_04 } + remove_domicile_building = east_asian_estate_inspection_office_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_mulberry_nursery_01 } + remove_domicile_building = east_asian_estate_mulberry_nursery_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_mulberry_nursery_02 } + remove_domicile_building = east_asian_estate_mulberry_nursery_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_mulberry_nursery_03 } + remove_domicile_building = east_asian_estate_mulberry_nursery_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_mulberry_nursery_04 } + remove_domicile_building = east_asian_estate_mulberry_nursery_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_silk_storage_01 } + remove_domicile_building = east_asian_estate_silk_storage_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_silk_storage_02 } + remove_domicile_building = east_asian_estate_silk_storage_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_silk_storage_03 } + remove_domicile_building = east_asian_estate_silk_storage_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_silk_storage_04 } + remove_domicile_building = east_asian_estate_silk_storage_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_roasting_house_01 } + remove_domicile_building = east_asian_estate_roasting_house_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_roasting_house_02 } + remove_domicile_building = east_asian_estate_roasting_house_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_roasting_house_03 } + remove_domicile_building = east_asian_estate_roasting_house_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_roasting_house_04 } + remove_domicile_building = east_asian_estate_roasting_house_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_grading_hall_01 } + remove_domicile_building = east_asian_estate_grading_hall_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_grading_hall_02 } + remove_domicile_building = east_asian_estate_grading_hall_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_grading_hall_03 } + remove_domicile_building = east_asian_estate_grading_hall_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_grading_hall_04 } + remove_domicile_building = east_asian_estate_grading_hall_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_tea_horse_road_office_01 } + remove_domicile_building = east_asian_estate_tea_horse_road_office_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_tea_horse_road_office_02 } + remove_domicile_building = east_asian_estate_tea_horse_road_office_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_tea_horse_road_office_03 } + remove_domicile_building = east_asian_estate_tea_horse_road_office_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_tea_horse_road_office_04 } + remove_domicile_building = east_asian_estate_tea_horse_road_office_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_tea_tax_office_01 } + remove_domicile_building = east_asian_estate_tea_tax_office_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_tea_tax_office_02 } + remove_domicile_building = east_asian_estate_tea_tax_office_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_tea_tax_office_03 } + remove_domicile_building = east_asian_estate_tea_tax_office_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_tea_tax_office_04 } + remove_domicile_building = east_asian_estate_tea_tax_office_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_teahouse_01 } + remove_domicile_building = east_asian_estate_teahouse_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_teahouse_02 } + remove_domicile_building = east_asian_estate_teahouse_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_teahouse_03 } + remove_domicile_building = east_asian_estate_teahouse_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_teahouse_04 } + remove_domicile_building = east_asian_estate_teahouse_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_pharmacy_01 } + remove_domicile_building = east_asian_estate_pharmacy_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_pharmacy_02 } + remove_domicile_building = east_asian_estate_pharmacy_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_pharmacy_03 } + remove_domicile_building = east_asian_estate_pharmacy_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_pharmacy_04 } + remove_domicile_building = east_asian_estate_pharmacy_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_hot_baths_01 } + remove_domicile_building = east_asian_estate_hot_baths_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_hot_baths_02 } + remove_domicile_building = east_asian_estate_hot_baths_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_hot_baths_03 } + remove_domicile_building = east_asian_estate_hot_baths_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_hot_baths_04 } + remove_domicile_building = east_asian_estate_hot_baths_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_medical_library_01 } + remove_domicile_building = east_asian_estate_medical_library_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_medical_library_02 } + remove_domicile_building = east_asian_estate_medical_library_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_medical_library_03 } + remove_domicile_building = east_asian_estate_medical_library_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_medical_library_04 } + remove_domicile_building = east_asian_estate_medical_library_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_field_surgeon_cart_01 } + remove_domicile_building = east_asian_estate_field_surgeon_cart_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_field_surgeon_cart_02 } + remove_domicile_building = east_asian_estate_field_surgeon_cart_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_field_surgeon_cart_03 } + remove_domicile_building = east_asian_estate_field_surgeon_cart_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_field_surgeon_cart_04 } + remove_domicile_building = east_asian_estate_field_surgeon_cart_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_herb_drying_terrace_01 } + remove_domicile_building = east_asian_estate_herb_drying_terrace_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_herb_drying_terrace_02 } + remove_domicile_building = east_asian_estate_herb_drying_terrace_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_herb_drying_terrace_03 } + remove_domicile_building = east_asian_estate_herb_drying_terrace_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_herb_drying_terrace_04 } + remove_domicile_building = east_asian_estate_herb_drying_terrace_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_bell_drum_tower_01 } + remove_domicile_building = east_asian_estate_bell_drum_tower_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_bell_drum_tower_02 } + remove_domicile_building = east_asian_estate_bell_drum_tower_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_bell_drum_tower_03 } + remove_domicile_building = east_asian_estate_bell_drum_tower_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_bell_drum_tower_04 } + remove_domicile_building = east_asian_estate_bell_drum_tower_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_temple_land_office_01 } + remove_domicile_building = east_asian_estate_temple_land_office_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_temple_land_office_02 } + remove_domicile_building = east_asian_estate_temple_land_office_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_temple_land_office_03 } + remove_domicile_building = east_asian_estate_temple_land_office_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_temple_land_office_04 } + remove_domicile_building = east_asian_estate_temple_land_office_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_lecture_pavilion_01 } + remove_domicile_building = east_asian_estate_lecture_pavilion_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_lecture_pavilion_02 } + remove_domicile_building = east_asian_estate_lecture_pavilion_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_lecture_pavilion_03 } + remove_domicile_building = east_asian_estate_lecture_pavilion_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_lecture_pavilion_04 } + remove_domicile_building = east_asian_estate_lecture_pavilion_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_guesthouse_01 } + remove_domicile_building = east_asian_estate_guesthouse_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_guesthouse_02 } + remove_domicile_building = east_asian_estate_guesthouse_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_guesthouse_03 } + remove_domicile_building = east_asian_estate_guesthouse_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_guesthouse_04 } + remove_domicile_building = east_asian_estate_guesthouse_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_chanting_hall_01 } + remove_domicile_building = east_asian_estate_chanting_hall_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_chanting_hall_02 } + remove_domicile_building = east_asian_estate_chanting_hall_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_chanting_hall_03 } + remove_domicile_building = east_asian_estate_chanting_hall_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_chanting_hall_04 } + remove_domicile_building = east_asian_estate_chanting_hall_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_genealogy_hall_01 } + remove_domicile_building = east_asian_estate_genealogy_hall_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_genealogy_hall_02 } + remove_domicile_building = east_asian_estate_genealogy_hall_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_genealogy_hall_03 } + remove_domicile_building = east_asian_estate_genealogy_hall_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_genealogy_hall_04 } + remove_domicile_building = east_asian_estate_genealogy_hall_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_history_school_01 } + remove_domicile_building = east_asian_estate_history_school_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_history_school_02 } + remove_domicile_building = east_asian_estate_history_school_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_history_school_03 } + remove_domicile_building = east_asian_estate_history_school_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_history_school_04 } + remove_domicile_building = east_asian_estate_history_school_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_ancestral_orchard_01 } + remove_domicile_building = east_asian_estate_ancestral_orchard_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_ancestral_orchard_02 } + remove_domicile_building = east_asian_estate_ancestral_orchard_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_ancestral_orchard_03 } + remove_domicile_building = east_asian_estate_ancestral_orchard_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_ancestral_orchard_04 } + remove_domicile_building = east_asian_estate_ancestral_orchard_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_rites_office_01 } + remove_domicile_building = east_asian_estate_rites_office_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_rites_office_02 } + remove_domicile_building = east_asian_estate_rites_office_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_rites_office_03 } + remove_domicile_building = east_asian_estate_rites_office_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_rites_office_04 } + remove_domicile_building = east_asian_estate_rites_office_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_memorial_archway_01 } + remove_domicile_building = east_asian_estate_memorial_archway_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_memorial_archway_02 } + remove_domicile_building = east_asian_estate_memorial_archway_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_memorial_archway_03 } + remove_domicile_building = east_asian_estate_memorial_archway_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_memorial_archway_04 } + remove_domicile_building = east_asian_estate_memorial_archway_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_armorer_01 } + remove_domicile_building = east_asian_estate_armorer_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_armorer_02 } + remove_domicile_building = east_asian_estate_armorer_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_armorer_03 } + remove_domicile_building = east_asian_estate_armorer_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_armorer_04 } + remove_domicile_building = east_asian_estate_armorer_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_veterans_hall_01 } + remove_domicile_building = east_asian_estate_veterans_hall_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_veterans_hall_02 } + remove_domicile_building = east_asian_estate_veterans_hall_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_veterans_hall_03 } + remove_domicile_building = east_asian_estate_veterans_hall_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_veterans_hall_04 } + remove_domicile_building = east_asian_estate_veterans_hall_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_quartermaster_01 } + remove_domicile_building = east_asian_estate_quartermaster_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_quartermaster_02 } + remove_domicile_building = east_asian_estate_quartermaster_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_quartermaster_03 } + remove_domicile_building = east_asian_estate_quartermaster_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_quartermaster_04 } + remove_domicile_building = east_asian_estate_quartermaster_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_sergeants_school_01 } + remove_domicile_building = east_asian_estate_sergeants_school_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_sergeants_school_02 } + remove_domicile_building = east_asian_estate_sergeants_school_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_sergeants_school_03 } + remove_domicile_building = east_asian_estate_sergeants_school_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_sergeants_school_04 } + remove_domicile_building = east_asian_estate_sergeants_school_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_drill_yard_01 } + remove_domicile_building = east_asian_estate_drill_yard_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_drill_yard_02 } + remove_domicile_building = east_asian_estate_drill_yard_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_drill_yard_03 } + remove_domicile_building = east_asian_estate_drill_yard_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_drill_yard_04 } + remove_domicile_building = east_asian_estate_drill_yard_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_pass_office_01 } + remove_domicile_building = east_asian_estate_pass_office_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_pass_office_02 } + remove_domicile_building = east_asian_estate_pass_office_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_pass_office_03 } + remove_domicile_building = east_asian_estate_pass_office_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_pass_office_04 } + remove_domicile_building = east_asian_estate_pass_office_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_gunpowder_storage_01 } + remove_domicile_building = east_asian_estate_gunpowder_storage_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_gunpowder_storage_02 } + remove_domicile_building = east_asian_estate_gunpowder_storage_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_gunpowder_storage_03 } + remove_domicile_building = east_asian_estate_gunpowder_storage_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_gunpowder_storage_04 } + remove_domicile_building = east_asian_estate_gunpowder_storage_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_signal_fires_01 } + remove_domicile_building = east_asian_estate_signal_fires_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_signal_fires_02 } + remove_domicile_building = east_asian_estate_signal_fires_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_signal_fires_03 } + remove_domicile_building = east_asian_estate_signal_fires_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_signal_fires_04 } + remove_domicile_building = east_asian_estate_signal_fires_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_regular_patrols_01 } + remove_domicile_building = east_asian_estate_regular_patrols_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_regular_patrols_02 } + remove_domicile_building = east_asian_estate_regular_patrols_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_regular_patrols_03 } + remove_domicile_building = east_asian_estate_regular_patrols_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_regular_patrols_04 } + remove_domicile_building = east_asian_estate_regular_patrols_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_crossbow_storage_01 } + remove_domicile_building = east_asian_estate_crossbow_storage_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_crossbow_storage_02 } + remove_domicile_building = east_asian_estate_crossbow_storage_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_crossbow_storage_03 } + remove_domicile_building = east_asian_estate_crossbow_storage_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_crossbow_storage_04 } + remove_domicile_building = east_asian_estate_crossbow_storage_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_aviary_01 } + remove_domicile_building = east_asian_estate_aviary_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_aviary_02 } + remove_domicile_building = east_asian_estate_aviary_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_aviary_03 } + remove_domicile_building = east_asian_estate_aviary_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_aviary_04 } + remove_domicile_building = east_asian_estate_aviary_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_four_gentlemen_01 } + remove_domicile_building = east_asian_estate_four_gentlemen_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_four_gentlemen_02 } + remove_domicile_building = east_asian_estate_four_gentlemen_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_four_gentlemen_03 } + remove_domicile_building = east_asian_estate_four_gentlemen_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_four_gentlemen_04 } + remove_domicile_building = east_asian_estate_four_gentlemen_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_scholars_rocks_01 } + remove_domicile_building = east_asian_estate_scholars_rocks_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_scholars_rocks_02 } + remove_domicile_building = east_asian_estate_scholars_rocks_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_scholars_rocks_03 } + remove_domicile_building = east_asian_estate_scholars_rocks_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_scholars_rocks_04 } + remove_domicile_building = east_asian_estate_scholars_rocks_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_lotus_pond_01 } + remove_domicile_building = east_asian_estate_lotus_pond_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_lotus_pond_02 } + remove_domicile_building = east_asian_estate_lotus_pond_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_lotus_pond_03 } + remove_domicile_building = east_asian_estate_lotus_pond_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_lotus_pond_04 } + remove_domicile_building = east_asian_estate_lotus_pond_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_fruit_trees_01 } + remove_domicile_building = east_asian_estate_fruit_trees_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_fruit_trees_02 } + remove_domicile_building = east_asian_estate_fruit_trees_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_fruit_trees_03 } + remove_domicile_building = east_asian_estate_fruit_trees_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_fruit_trees_04 } + remove_domicile_building = east_asian_estate_fruit_trees_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_foaling_pens_01 } + remove_domicile_building = east_asian_estate_foaling_pens_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_foaling_pens_02 } + remove_domicile_building = east_asian_estate_foaling_pens_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_foaling_pens_03 } + remove_domicile_building = east_asian_estate_foaling_pens_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_foaling_pens_04 } + remove_domicile_building = east_asian_estate_foaling_pens_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_riding_arena_01 } + remove_domicile_building = east_asian_estate_riding_arena_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_riding_arena_02 } + remove_domicile_building = east_asian_estate_riding_arena_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_riding_arena_03 } + remove_domicile_building = east_asian_estate_riding_arena_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_riding_arena_04 } + remove_domicile_building = east_asian_estate_riding_arena_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_farriers_office_01 } + remove_domicile_building = east_asian_estate_farriers_office_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_farriers_office_02 } + remove_domicile_building = east_asian_estate_farriers_office_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_farriers_office_03 } + remove_domicile_building = east_asian_estate_farriers_office_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_farriers_office_04 } + remove_domicile_building = east_asian_estate_farriers_office_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_bloodline_records_office_01 } + remove_domicile_building = east_asian_estate_bloodline_records_office_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_bloodline_records_office_02 } + remove_domicile_building = east_asian_estate_bloodline_records_office_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_bloodline_records_office_03 } + remove_domicile_building = east_asian_estate_bloodline_records_office_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_bloodline_records_office_04 } + remove_domicile_building = east_asian_estate_bloodline_records_office_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_fodder_reserves_01 } + remove_domicile_building = east_asian_estate_fodder_reserves_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_fodder_reserves_02 } + remove_domicile_building = east_asian_estate_fodder_reserves_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_fodder_reserves_03 } + remove_domicile_building = east_asian_estate_fodder_reserves_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_fodder_reserves_04 } + remove_domicile_building = east_asian_estate_fodder_reserves_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_paper_mill_01 } + remove_domicile_building = east_asian_estate_paper_mill_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_paper_mill_02 } + remove_domicile_building = east_asian_estate_paper_mill_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_paper_mill_03 } + remove_domicile_building = east_asian_estate_paper_mill_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_paper_mill_04 } + remove_domicile_building = east_asian_estate_paper_mill_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_ink_brush_makers_01 } + remove_domicile_building = east_asian_estate_ink_brush_makers_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_ink_brush_makers_02 } + remove_domicile_building = east_asian_estate_ink_brush_makers_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_ink_brush_makers_03 } + remove_domicile_building = east_asian_estate_ink_brush_makers_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_ink_brush_makers_04 } + remove_domicile_building = east_asian_estate_ink_brush_makers_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_ceramics_kiln_01 } + remove_domicile_building = east_asian_estate_ceramics_kiln_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_ceramics_kiln_02 } + remove_domicile_building = east_asian_estate_ceramics_kiln_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_ceramics_kiln_03 } + remove_domicile_building = east_asian_estate_ceramics_kiln_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_ceramics_kiln_04 } + remove_domicile_building = east_asian_estate_ceramics_kiln_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_lacquer_studio_01 } + remove_domicile_building = east_asian_estate_lacquer_studio_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_lacquer_studio_02 } + remove_domicile_building = east_asian_estate_lacquer_studio_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_lacquer_studio_03 } + remove_domicile_building = east_asian_estate_lacquer_studio_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_lacquer_studio_04 } + remove_domicile_building = east_asian_estate_lacquer_studio_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_leatherworks_01 } + remove_domicile_building = east_asian_estate_leatherworks_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_leatherworks_02 } + remove_domicile_building = east_asian_estate_leatherworks_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_leatherworks_03 } + remove_domicile_building = east_asian_estate_leatherworks_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_leatherworks_04 } + remove_domicile_building = east_asian_estate_leatherworks_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_ever_normal_granaries_01 } + remove_domicile_building = east_asian_estate_ever_normal_granaries_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_ever_normal_granaries_02 } + remove_domicile_building = east_asian_estate_ever_normal_granaries_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_ever_normal_granaries_03 } + remove_domicile_building = east_asian_estate_ever_normal_granaries_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_ever_normal_granaries_04 } + remove_domicile_building = east_asian_estate_ever_normal_granaries_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_millhouse_01 } + remove_domicile_building = east_asian_estate_millhouse_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_millhouse_02 } + remove_domicile_building = east_asian_estate_millhouse_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_millhouse_03 } + remove_domicile_building = east_asian_estate_millhouse_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_millhouse_04 } + remove_domicile_building = east_asian_estate_millhouse_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_ledger_office_01 } + remove_domicile_building = east_asian_estate_ledger_office_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_ledger_office_02 } + remove_domicile_building = east_asian_estate_ledger_office_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_ledger_office_03 } + remove_domicile_building = east_asian_estate_ledger_office_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_ledger_office_04 } + remove_domicile_building = east_asian_estate_ledger_office_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_drying_loft_01 } + remove_domicile_building = east_asian_estate_drying_loft_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_drying_loft_02 } + remove_domicile_building = east_asian_estate_drying_loft_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_drying_loft_03 } + remove_domicile_building = east_asian_estate_drying_loft_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_drying_loft_04 } + remove_domicile_building = east_asian_estate_drying_loft_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_weights_measures_bench_01 } + remove_domicile_building = east_asian_estate_weights_measures_bench_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_weights_measures_bench_02 } + remove_domicile_building = east_asian_estate_weights_measures_bench_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_weights_measures_bench_03 } + remove_domicile_building = east_asian_estate_weights_measures_bench_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_weights_measures_bench_04 } + remove_domicile_building = east_asian_estate_weights_measures_bench_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_seasonal_shelters_01 } + remove_domicile_building = east_asian_estate_seasonal_shelters_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_seasonal_shelters_02 } + remove_domicile_building = east_asian_estate_seasonal_shelters_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_seasonal_shelters_03 } + remove_domicile_building = east_asian_estate_seasonal_shelters_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_seasonal_shelters_04 } + remove_domicile_building = east_asian_estate_seasonal_shelters_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_veterinary_shed_01 } + remove_domicile_building = east_asian_estate_veterinary_shed_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_veterinary_shed_02 } + remove_domicile_building = east_asian_estate_veterinary_shed_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_veterinary_shed_03 } + remove_domicile_building = east_asian_estate_veterinary_shed_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_veterinary_shed_04 } + remove_domicile_building = east_asian_estate_veterinary_shed_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_watering_ditches_01 } + remove_domicile_building = east_asian_estate_watering_ditches_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_watering_ditches_02 } + remove_domicile_building = east_asian_estate_watering_ditches_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_watering_ditches_03 } + remove_domicile_building = east_asian_estate_watering_ditches_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_watering_ditches_04 } + remove_domicile_building = east_asian_estate_watering_ditches_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_salt_lick_terraces_01 } + remove_domicile_building = east_asian_estate_salt_lick_terraces_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_salt_lick_terraces_02 } + remove_domicile_building = east_asian_estate_salt_lick_terraces_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_salt_lick_terraces_03 } + remove_domicile_building = east_asian_estate_salt_lick_terraces_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_salt_lick_terraces_04 } + remove_domicile_building = east_asian_estate_salt_lick_terraces_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_rotation_paddocks_01 } + remove_domicile_building = east_asian_estate_rotation_paddocks_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_rotation_paddocks_02 } + remove_domicile_building = east_asian_estate_rotation_paddocks_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_rotation_paddocks_03 } + remove_domicile_building = east_asian_estate_rotation_paddocks_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_rotation_paddocks_04 } + remove_domicile_building = east_asian_estate_rotation_paddocks_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_disciples_hall_01 } + remove_domicile_building = east_asian_estate_disciples_hall_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_disciples_hall_02 } + remove_domicile_building = east_asian_estate_disciples_hall_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_disciples_hall_03 } + remove_domicile_building = east_asian_estate_disciples_hall_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_disciples_hall_04 } + remove_domicile_building = east_asian_estate_disciples_hall_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_donation_box_01 } + remove_domicile_building = east_asian_estate_donation_box_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_donation_box_02 } + remove_domicile_building = east_asian_estate_donation_box_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_donation_box_03 } + remove_domicile_building = east_asian_estate_donation_box_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_donation_box_04 } + remove_domicile_building = east_asian_estate_donation_box_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_gate_plaques_01 } + remove_domicile_building = east_asian_estate_gate_plaques_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_gate_plaques_02 } + remove_domicile_building = east_asian_estate_gate_plaques_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_gate_plaques_03 } + remove_domicile_building = east_asian_estate_gate_plaques_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_gate_plaques_04 } + remove_domicile_building = east_asian_estate_gate_plaques_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_pavilion_01 } + remove_domicile_building = east_asian_estate_pavilion_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_pavilion_02 } + remove_domicile_building = east_asian_estate_pavilion_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_pavilion_03 } + remove_domicile_building = east_asian_estate_pavilion_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_pavilion_04 } + remove_domicile_building = east_asian_estate_pavilion_04 + } + if = { + limit = { has_domicile_building = east_asian_estate_performance_stage_01 } + remove_domicile_building = east_asian_estate_performance_stage_01 + } + if = { + limit = { has_domicile_building = east_asian_estate_performance_stage_02 } + remove_domicile_building = east_asian_estate_performance_stage_02 + } + if = { + limit = { has_domicile_building = east_asian_estate_performance_stage_03 } + remove_domicile_building = east_asian_estate_performance_stage_03 + } + if = { + limit = { has_domicile_building = east_asian_estate_performance_stage_04 } + remove_domicile_building = east_asian_estate_performance_stage_04 + } + if = { + limit = { has_domicile_building = estate_main_01 } + remove_domicile_building = estate_main_01 + } + if = { + limit = { has_domicile_building = estate_main_02 } + remove_domicile_building = estate_main_02 + } + if = { + limit = { has_domicile_building = estate_main_03 } + remove_domicile_building = estate_main_03 + } + if = { + limit = { has_domicile_building = estate_main_04 } + remove_domicile_building = estate_main_04 + } + if = { + limit = { has_domicile_building = estate_main_05 } + remove_domicile_building = estate_main_05 + } + if = { + limit = { has_domicile_building = living_quarters_01 } + remove_domicile_building = living_quarters_01 + } + if = { + limit = { has_domicile_building = living_quarters_02 } + remove_domicile_building = living_quarters_02 + } + if = { + limit = { has_domicile_building = living_quarters_03 } + remove_domicile_building = living_quarters_03 + } + if = { + limit = { has_domicile_building = living_quarters_04 } + remove_domicile_building = living_quarters_04 + } + if = { + limit = { has_domicile_building = trophy_room_01 } + remove_domicile_building = trophy_room_01 + } + if = { + limit = { has_domicile_building = trophy_room_02 } + remove_domicile_building = trophy_room_02 + } + if = { + limit = { has_domicile_building = trophy_room_03 } + remove_domicile_building = trophy_room_03 + } + if = { + limit = { has_domicile_building = trophy_room_04 } + remove_domicile_building = trophy_room_04 + } + if = { + limit = { has_domicile_building = office_01 } + remove_domicile_building = office_01 + } + if = { + limit = { has_domicile_building = office_02 } + remove_domicile_building = office_02 + } + if = { + limit = { has_domicile_building = office_03 } + remove_domicile_building = office_03 + } + if = { + limit = { has_domicile_building = office_04 } + remove_domicile_building = office_04 + } + if = { + limit = { has_domicile_building = servants_quarters_01 } + remove_domicile_building = servants_quarters_01 + } + if = { + limit = { has_domicile_building = servants_quarters_02 } + remove_domicile_building = servants_quarters_02 + } + if = { + limit = { has_domicile_building = servants_quarters_03 } + remove_domicile_building = servants_quarters_03 + } + if = { + limit = { has_domicile_building = servants_quarters_04 } + remove_domicile_building = servants_quarters_04 + } + if = { + limit = { has_domicile_building = library_01 } + remove_domicile_building = library_01 + } + if = { + limit = { has_domicile_building = library_02 } + remove_domicile_building = library_02 + } + if = { + limit = { has_domicile_building = library_observatory_03 } + remove_domicile_building = library_observatory_03 + } + if = { + limit = { has_domicile_building = library_observatory_04 } + remove_domicile_building = library_observatory_04 + } + if = { + limit = { has_domicile_building = library_education_03 } + remove_domicile_building = library_education_03 + } + if = { + limit = { has_domicile_building = library_education_04 } + remove_domicile_building = library_education_04 + } + if = { + limit = { has_domicile_building = bath_01 } + remove_domicile_building = bath_01 + } + if = { + limit = { has_domicile_building = bath_02 } + remove_domicile_building = bath_02 + } + if = { + limit = { has_domicile_building = bath_03 } + remove_domicile_building = bath_03 + } + if = { + limit = { has_domicile_building = bath_04 } + remove_domicile_building = bath_04 + } + if = { + limit = { has_domicile_building = guest_room_01 } + remove_domicile_building = guest_room_01 + } + if = { + limit = { has_domicile_building = guest_room_02 } + remove_domicile_building = guest_room_02 + } + if = { + limit = { has_domicile_building = guest_room_03 } + remove_domicile_building = guest_room_03 + } + if = { + limit = { has_domicile_building = guest_room_04 } + remove_domicile_building = guest_room_04 + } + if = { + limit = { has_domicile_building = guest_room_05 } + remove_domicile_building = guest_room_05 + } + if = { + limit = { has_domicile_building = guest_room_06 } + remove_domicile_building = guest_room_06 + } + if = { + limit = { has_domicile_building = wine_cellar_01 } + remove_domicile_building = wine_cellar_01 + } + if = { + limit = { has_domicile_building = wine_cellar_02 } + remove_domicile_building = wine_cellar_02 + } + if = { + limit = { has_domicile_building = wine_cellar_03 } + remove_domicile_building = wine_cellar_03 + } + if = { + limit = { has_domicile_building = courtyard_01 } + remove_domicile_building = courtyard_01 + } + if = { + limit = { has_domicile_building = courtyard_02 } + remove_domicile_building = courtyard_02 + } + if = { + limit = { has_domicile_building = courtyard_03 } + remove_domicile_building = courtyard_03 + } + if = { + limit = { has_domicile_building = courtyard_04 } + remove_domicile_building = courtyard_04 + } + if = { + limit = { has_domicile_building = prison_01 } + remove_domicile_building = prison_01 + } + if = { + limit = { has_domicile_building = prison_02 } + remove_domicile_building = prison_02 + } + if = { + limit = { has_domicile_building = prison_03 } + remove_domicile_building = prison_03 + } + if = { + limit = { has_domicile_building = prison_04 } + remove_domicile_building = prison_04 + } + if = { + limit = { has_domicile_building = reception_hall_01 } + remove_domicile_building = reception_hall_01 + } + if = { + limit = { has_domicile_building = reception_hall_02 } + remove_domicile_building = reception_hall_02 + } + if = { + limit = { has_domicile_building = reception_hall_03 } + remove_domicile_building = reception_hall_03 + } + if = { + limit = { has_domicile_building = reception_hall_04 } + remove_domicile_building = reception_hall_04 + } + if = { + limit = { has_domicile_building = reception_hall_05 } + remove_domicile_building = reception_hall_05 + } + if = { + limit = { has_domicile_building = cabinet_of_curiosities_01 } + remove_domicile_building = cabinet_of_curiosities_01 + } + if = { + limit = { has_domicile_building = cabinet_of_curiosities_02 } + remove_domicile_building = cabinet_of_curiosities_02 + } + if = { + limit = { has_domicile_building = cabinet_of_curiosities_03 } + remove_domicile_building = cabinet_of_curiosities_03 + } + if = { + limit = { has_domicile_building = grand_solar_01 } + remove_domicile_building = grand_solar_01 + } + if = { + limit = { has_domicile_building = grand_solar_02 } + remove_domicile_building = grand_solar_02 + } + if = { + limit = { has_domicile_building = grand_solar_03 } + remove_domicile_building = grand_solar_03 + } + if = { + limit = { has_domicile_building = grand_solar_04 } + remove_domicile_building = grand_solar_04 + } + if = { + limit = { has_domicile_building = temple_small_01 } + remove_domicile_building = temple_small_01 + } + if = { + limit = { has_domicile_building = temple_small_02 } + remove_domicile_building = temple_small_02 + } + if = { + limit = { has_domicile_building = temple_small_03 } + remove_domicile_building = temple_small_03 + } + if = { + limit = { has_domicile_building = temple_crypt_04 } + remove_domicile_building = temple_crypt_04 + } + if = { + limit = { has_domicile_building = temple_crypt_05 } + remove_domicile_building = temple_crypt_05 + } + if = { + limit = { has_domicile_building = temple_crypt_06 } + remove_domicile_building = temple_crypt_06 + } + if = { + limit = { has_domicile_building = temple_large_04 } + remove_domicile_building = temple_large_04 + } + if = { + limit = { has_domicile_building = temple_large_05 } + remove_domicile_building = temple_large_05 + } + if = { + limit = { has_domicile_building = temple_large_06 } + remove_domicile_building = temple_large_06 + } + if = { + limit = { has_domicile_building = temple_monastery_04 } + remove_domicile_building = temple_monastery_04 + } + if = { + limit = { has_domicile_building = temple_monastery_05 } + remove_domicile_building = temple_monastery_05 + } + if = { + limit = { has_domicile_building = temple_monastery_06 } + remove_domicile_building = temple_monastery_06 + } + if = { + limit = { has_domicile_building = barracks_01 } + remove_domicile_building = barracks_01 + } + if = { + limit = { has_domicile_building = barracks_02 } + remove_domicile_building = barracks_02 + } + if = { + limit = { has_domicile_building = barracks_03 } + remove_domicile_building = barracks_03 + } + if = { + limit = { has_domicile_building = barracks_04 } + remove_domicile_building = barracks_04 + } + if = { + limit = { has_domicile_building = barracks_05 } + remove_domicile_building = barracks_05 + } + if = { + limit = { has_domicile_building = barracks_06 } + remove_domicile_building = barracks_06 + } + if = { + limit = { has_domicile_building = watchtower_01 } + remove_domicile_building = watchtower_01 + } + if = { + limit = { has_domicile_building = watchtower_02 } + remove_domicile_building = watchtower_02 + } + if = { + limit = { has_domicile_building = watchtower_03 } + remove_domicile_building = watchtower_03 + } + if = { + limit = { has_domicile_building = watchtower_04 } + remove_domicile_building = watchtower_04 + } + if = { + limit = { has_domicile_building = watchtower_05 } + remove_domicile_building = watchtower_05 + } + if = { + limit = { has_domicile_building = watchtower_06 } + remove_domicile_building = watchtower_06 + } + if = { + limit = { has_domicile_building = guardhouse_01 } + remove_domicile_building = guardhouse_01 + } + if = { + limit = { has_domicile_building = guardhouse_02 } + remove_domicile_building = guardhouse_02 + } + if = { + limit = { has_domicile_building = guardhouse_03 } + remove_domicile_building = guardhouse_03 + } + if = { + limit = { has_domicile_building = guardhouse_04 } + remove_domicile_building = guardhouse_04 + } + if = { + limit = { has_domicile_building = garden_01 } + remove_domicile_building = garden_01 + } + if = { + limit = { has_domicile_building = garden_02 } + remove_domicile_building = garden_02 + } + if = { + limit = { has_domicile_building = garden_03 } + remove_domicile_building = garden_03 + } + if = { + limit = { has_domicile_building = garden_leisure_04 } + remove_domicile_building = garden_leisure_04 + } + if = { + limit = { has_domicile_building = garden_leisure_05 } + remove_domicile_building = garden_leisure_05 + } + if = { + limit = { has_domicile_building = garden_leisure_06 } + remove_domicile_building = garden_leisure_06 + } + if = { + limit = { has_domicile_building = garden_fruit_04 } + remove_domicile_building = garden_fruit_04 + } + if = { + limit = { has_domicile_building = garden_fruit_05 } + remove_domicile_building = garden_fruit_05 + } + if = { + limit = { has_domicile_building = garden_fruit_06 } + remove_domicile_building = garden_fruit_06 + } + if = { + limit = { has_domicile_building = stable_01 } + remove_domicile_building = stable_01 + } + if = { + limit = { has_domicile_building = stable_02 } + remove_domicile_building = stable_02 + } + if = { + limit = { has_domicile_building = stable_03 } + remove_domicile_building = stable_03 + } + if = { + limit = { has_domicile_building = stable_grand_04 } + remove_domicile_building = stable_grand_04 + } + if = { + limit = { has_domicile_building = stable_grand_05 } + remove_domicile_building = stable_grand_05 + } + if = { + limit = { has_domicile_building = stable_grand_06 } + remove_domicile_building = stable_grand_06 + } + if = { + limit = { has_domicile_building = stable_kennel_04 } + remove_domicile_building = stable_kennel_04 + } + if = { + limit = { has_domicile_building = stable_kennel_05 } + remove_domicile_building = stable_kennel_05 + } + if = { + limit = { has_domicile_building = stable_kennel_06 } + remove_domicile_building = stable_kennel_06 + } + if = { + limit = { has_domicile_building = stable_chariot_04 } + remove_domicile_building = stable_chariot_04 + } + if = { + limit = { has_domicile_building = stable_chariot_05 } + remove_domicile_building = stable_chariot_05 + } + if = { + limit = { has_domicile_building = stable_chariot_06 } + remove_domicile_building = stable_chariot_06 + } + if = { + limit = { has_domicile_building = workshop_01 } + remove_domicile_building = workshop_01 + } + if = { + limit = { has_domicile_building = workshop_02 } + remove_domicile_building = workshop_02 + } + if = { + limit = { has_domicile_building = workshop_carpenter_03 } + remove_domicile_building = workshop_carpenter_03 + } + if = { + limit = { has_domicile_building = workshop_carpenter_04 } + remove_domicile_building = workshop_carpenter_04 + } + if = { + limit = { has_domicile_building = workshop_carpenter_05 } + remove_domicile_building = workshop_carpenter_05 + } + if = { + limit = { has_domicile_building = workshop_carpenter_06 } + remove_domicile_building = workshop_carpenter_06 + } + if = { + limit = { has_domicile_building = workshop_mason_03 } + remove_domicile_building = workshop_mason_03 + } + if = { + limit = { has_domicile_building = workshop_mason_04 } + remove_domicile_building = workshop_mason_04 + } + if = { + limit = { has_domicile_building = workshop_mason_05 } + remove_domicile_building = workshop_mason_05 + } + if = { + limit = { has_domicile_building = workshop_mason_06 } + remove_domicile_building = workshop_mason_06 + } + if = { + limit = { has_domicile_building = workshop_textile_03 } + remove_domicile_building = workshop_textile_03 + } + if = { + limit = { has_domicile_building = workshop_textile_04 } + remove_domicile_building = workshop_textile_04 + } + if = { + limit = { has_domicile_building = workshop_textile_05 } + remove_domicile_building = workshop_textile_05 + } + if = { + limit = { has_domicile_building = workshop_textile_06 } + remove_domicile_building = workshop_textile_06 + } + if = { + limit = { has_domicile_building = storage_01 } + remove_domicile_building = storage_01 + } + if = { + limit = { has_domicile_building = storage_02 } + remove_domicile_building = storage_02 + } + if = { + limit = { has_domicile_building = storage_warehouse_03 } + remove_domicile_building = storage_warehouse_03 + } + if = { + limit = { has_domicile_building = storage_warehouse_04 } + remove_domicile_building = storage_warehouse_04 + } + if = { + limit = { has_domicile_building = storage_granary_03 } + remove_domicile_building = storage_granary_03 + } + if = { + limit = { has_domicile_building = storage_granary_04 } + remove_domicile_building = storage_granary_04 + } + if = { + limit = { has_domicile_building = market_01 } + remove_domicile_building = market_01 + } + if = { + limit = { has_domicile_building = market_02 } + remove_domicile_building = market_02 + } + if = { + limit = { has_domicile_building = market_03 } + remove_domicile_building = market_03 + } + if = { + limit = { has_domicile_building = market_04 } + remove_domicile_building = market_04 + } + if = { + limit = { has_domicile_building = market_05 } + remove_domicile_building = market_05 + } + if = { + limit = { has_domicile_building = market_06 } + remove_domicile_building = market_06 + } + if = { + limit = { has_domicile_building = grazing_land_01 } + remove_domicile_building = grazing_land_01 + } + if = { + limit = { has_domicile_building = grazing_land_02 } + remove_domicile_building = grazing_land_02 + } + if = { + limit = { has_domicile_building = grazing_land_03 } + remove_domicile_building = grazing_land_03 + } + if = { + limit = { has_domicile_building = grazing_land_04 } + remove_domicile_building = grazing_land_04 + } + if = { + limit = { has_domicile_building = grazing_land_05 } + remove_domicile_building = grazing_land_05 + } + if = { + limit = { has_domicile_building = grazing_land_06 } + remove_domicile_building = grazing_land_06 + } + if = { + limit = { has_domicile_building = horse_pasture_04 } + remove_domicile_building = horse_pasture_04 + } + if = { + limit = { has_domicile_building = horse_pasture_05 } + remove_domicile_building = horse_pasture_05 + } + if = { + limit = { has_domicile_building = horse_pasture_06 } + remove_domicile_building = horse_pasture_06 + } + if = { + limit = { has_domicile_building = camel_pasture_04 } + remove_domicile_building = camel_pasture_04 + } + if = { + limit = { has_domicile_building = camel_pasture_05 } + remove_domicile_building = camel_pasture_05 + } + if = { + limit = { has_domicile_building = camel_pasture_06 } + remove_domicile_building = camel_pasture_06 + } + if = { + limit = { has_domicile_building = elephant_pasture_04 } + remove_domicile_building = elephant_pasture_04 + } + if = { + limit = { has_domicile_building = elephant_pasture_05 } + remove_domicile_building = elephant_pasture_05 + } + if = { + limit = { has_domicile_building = elephant_pasture_06 } + remove_domicile_building = elephant_pasture_06 + } + if = { + limit = { has_domicile_building = grain_field_01 } + remove_domicile_building = grain_field_01 + } + if = { + limit = { has_domicile_building = grain_field_02 } + remove_domicile_building = grain_field_02 + } + if = { + limit = { has_domicile_building = grain_field_03 } + remove_domicile_building = grain_field_03 + } + if = { + limit = { has_domicile_building = grain_field_04 } + remove_domicile_building = grain_field_04 + } + if = { + limit = { has_domicile_building = grain_field_05 } + remove_domicile_building = grain_field_05 + } + if = { + limit = { has_domicile_building = grain_field_06 } + remove_domicile_building = grain_field_06 + } + if = { + limit = { has_domicile_building = rice_field_01 } + remove_domicile_building = rice_field_01 + } + if = { + limit = { has_domicile_building = rice_field_02 } + remove_domicile_building = rice_field_02 + } + if = { + limit = { has_domicile_building = rice_field_03 } + remove_domicile_building = rice_field_03 + } + if = { + limit = { has_domicile_building = rice_field_04 } + remove_domicile_building = rice_field_04 + } + if = { + limit = { has_domicile_building = rice_field_05 } + remove_domicile_building = rice_field_05 + } + if = { + limit = { has_domicile_building = rice_field_06 } + remove_domicile_building = rice_field_06 + } + if = { + limit = { has_domicile_building = vineyard_01 } + remove_domicile_building = vineyard_01 + } + if = { + limit = { has_domicile_building = vineyard_02 } + remove_domicile_building = vineyard_02 + } + if = { + limit = { has_domicile_building = vineyard_03 } + remove_domicile_building = vineyard_03 + } + if = { + limit = { has_domicile_building = vineyard_04 } + remove_domicile_building = vineyard_04 + } + if = { + limit = { has_domicile_building = vineyard_05 } + remove_domicile_building = vineyard_05 + } + if = { + limit = { has_domicile_building = vineyard_06 } + remove_domicile_building = vineyard_06 + } + if = { + limit = { has_domicile_building = tea_01 } + remove_domicile_building = tea_01 + } + if = { + limit = { has_domicile_building = tea_02 } + remove_domicile_building = tea_02 + } + if = { + limit = { has_domicile_building = tea_03 } + remove_domicile_building = tea_03 + } + if = { + limit = { has_domicile_building = tea_04 } + remove_domicile_building = tea_04 + } + if = { + limit = { has_domicile_building = tea_05 } + remove_domicile_building = tea_05 + } + if = { + limit = { has_domicile_building = tea_06 } + remove_domicile_building = tea_06 + } + if = { + limit = { has_domicile_building = olive_01 } + remove_domicile_building = olive_01 + } + if = { + limit = { has_domicile_building = olive_02 } + remove_domicile_building = olive_02 + } + if = { + limit = { has_domicile_building = olive_03 } + remove_domicile_building = olive_03 + } + if = { + limit = { has_domicile_building = olive_04 } + remove_domicile_building = olive_04 + } + if = { + limit = { has_domicile_building = olive_05 } + remove_domicile_building = olive_05 + } + if = { + limit = { has_domicile_building = olive_06 } + remove_domicile_building = olive_06 + } + if = { + limit = { has_domicile_building = silk_01 } + remove_domicile_building = silk_01 + } + if = { + limit = { has_domicile_building = silk_02 } + remove_domicile_building = silk_02 + } + if = { + limit = { has_domicile_building = silk_03 } + remove_domicile_building = silk_03 + } + if = { + limit = { has_domicile_building = silk_04 } + remove_domicile_building = silk_04 + } + if = { + limit = { has_domicile_building = silk_05 } + remove_domicile_building = silk_05 + } + if = { + limit = { has_domicile_building = silk_06 } + remove_domicile_building = silk_06 + } + if = { + limit = { has_domicile_building = japanese_manor_main_01 } + remove_domicile_building = japanese_manor_main_01 + } + if = { + limit = { has_domicile_building = japanese_manor_main_02 } + remove_domicile_building = japanese_manor_main_02 + } + if = { + limit = { has_domicile_building = japanese_manor_main_03 } + remove_domicile_building = japanese_manor_main_03 + } + if = { + limit = { has_domicile_building = japanese_manor_main_04 } + remove_domicile_building = japanese_manor_main_04 + } + if = { + limit = { has_domicile_building = japanese_manor_main_05 } + remove_domicile_building = japanese_manor_main_05 + } + if = { + limit = { has_domicile_building = japanese_manor_main_06 } + remove_domicile_building = japanese_manor_main_06 + } + if = { + limit = { has_domicile_building = japanese_main_tax_collectors_01 } + remove_domicile_building = japanese_main_tax_collectors_01 + } + if = { + limit = { has_domicile_building = japanese_main_tax_collectors_02 } + remove_domicile_building = japanese_main_tax_collectors_02 + } + if = { + limit = { has_domicile_building = japanese_main_tax_collectors_03 } + remove_domicile_building = japanese_main_tax_collectors_03 + } + if = { + limit = { has_domicile_building = japanese_main_tax_collectors_04 } + remove_domicile_building = japanese_main_tax_collectors_04 + } + if = { + limit = { has_domicile_building = japanese_main_tax_collectors_05 } + remove_domicile_building = japanese_main_tax_collectors_05 + } + if = { + limit = { has_domicile_building = japanese_main_tax_collectors_06 } + remove_domicile_building = japanese_main_tax_collectors_06 + } + if = { + limit = { has_domicile_building = japanese_main_carpenter_01 } + remove_domicile_building = japanese_main_carpenter_01 + } + if = { + limit = { has_domicile_building = japanese_main_carpenter_02 } + remove_domicile_building = japanese_main_carpenter_02 + } + if = { + limit = { has_domicile_building = japanese_main_carpenter_03 } + remove_domicile_building = japanese_main_carpenter_03 + } + if = { + limit = { has_domicile_building = japanese_main_carpenter_04 } + remove_domicile_building = japanese_main_carpenter_04 + } + if = { + limit = { has_domicile_building = japanese_main_carpenter_05 } + remove_domicile_building = japanese_main_carpenter_05 + } + if = { + limit = { has_domicile_building = japanese_main_carpenter_06 } + remove_domicile_building = japanese_main_carpenter_06 + } + if = { + limit = { has_domicile_building = japanese_manor_poetry_library_01 } + remove_domicile_building = japanese_manor_poetry_library_01 + } + if = { + limit = { has_domicile_building = japanese_manor_poetry_library_02 } + remove_domicile_building = japanese_manor_poetry_library_02 + } + if = { + limit = { has_domicile_building = japanese_manor_poetry_library_03 } + remove_domicile_building = japanese_manor_poetry_library_03 + } + if = { + limit = { has_domicile_building = japanese_manor_poetry_library_04 } + remove_domicile_building = japanese_manor_poetry_library_04 + } + if = { + limit = { has_domicile_building = japanese_manor_poetry_library_05 } + remove_domicile_building = japanese_manor_poetry_library_05 + } + if = { + limit = { has_domicile_building = japanese_manor_poetry_library_06 } + remove_domicile_building = japanese_manor_poetry_library_06 + } + if = { + limit = { has_domicile_building = sarugaku_stage_01 } + remove_domicile_building = sarugaku_stage_01 + } + if = { + limit = { has_domicile_building = sarugaku_stage_02 } + remove_domicile_building = sarugaku_stage_02 + } + if = { + limit = { has_domicile_building = sarugaku_stage_03 } + remove_domicile_building = sarugaku_stage_03 + } + if = { + limit = { has_domicile_building = sarugaku_stage_04 } + remove_domicile_building = sarugaku_stage_04 + } + if = { + limit = { has_domicile_building = sarugaku_stage_05 } + remove_domicile_building = sarugaku_stage_05 + } + if = { + limit = { has_domicile_building = sarugaku_stage_06 } + remove_domicile_building = sarugaku_stage_06 + } + if = { + limit = { has_domicile_building = japanese_manor_trophy_room_01 } + remove_domicile_building = japanese_manor_trophy_room_01 + } + if = { + limit = { has_domicile_building = japanese_manor_trophy_room_02 } + remove_domicile_building = japanese_manor_trophy_room_02 + } + if = { + limit = { has_domicile_building = japanese_manor_trophy_room_03 } + remove_domicile_building = japanese_manor_trophy_room_03 + } + if = { + limit = { has_domicile_building = japanese_manor_trophy_room_04 } + remove_domicile_building = japanese_manor_trophy_room_04 + } + if = { + limit = { has_domicile_building = japanese_manor_trophy_room_05 } + remove_domicile_building = japanese_manor_trophy_room_05 + } + if = { + limit = { has_domicile_building = japanese_manor_trophy_room_06 } + remove_domicile_building = japanese_manor_trophy_room_06 + } + if = { + limit = { has_domicile_building = japanese_manor_office_01 } + remove_domicile_building = japanese_manor_office_01 + } + if = { + limit = { has_domicile_building = japanese_manor_office_02 } + remove_domicile_building = japanese_manor_office_02 + } + if = { + limit = { has_domicile_building = japanese_manor_office_03 } + remove_domicile_building = japanese_manor_office_03 + } + if = { + limit = { has_domicile_building = japanese_manor_office_04 } + remove_domicile_building = japanese_manor_office_04 + } + if = { + limit = { has_domicile_building = japanese_manor_office_05 } + remove_domicile_building = japanese_manor_office_05 + } + if = { + limit = { has_domicile_building = japanese_manor_office_06 } + remove_domicile_building = japanese_manor_office_06 + } + if = { + limit = { has_domicile_building = japanese_manor_servants_quarters_01 } + remove_domicile_building = japanese_manor_servants_quarters_01 + } + if = { + limit = { has_domicile_building = japanese_manor_servants_quarters_02 } + remove_domicile_building = japanese_manor_servants_quarters_02 + } + if = { + limit = { has_domicile_building = japanese_manor_servants_quarters_03 } + remove_domicile_building = japanese_manor_servants_quarters_03 + } + if = { + limit = { has_domicile_building = japanese_manor_servants_quarters_04 } + remove_domicile_building = japanese_manor_servants_quarters_04 + } + if = { + limit = { has_domicile_building = japanese_manor_servants_quarters_05 } + remove_domicile_building = japanese_manor_servants_quarters_05 + } + if = { + limit = { has_domicile_building = japanese_manor_servants_quarters_06 } + remove_domicile_building = japanese_manor_servants_quarters_06 + } + if = { + limit = { has_domicile_building = japanese_manor_library_confucian_01 } + remove_domicile_building = japanese_manor_library_confucian_01 + } + if = { + limit = { has_domicile_building = japanese_manor_library_confucian_02 } + remove_domicile_building = japanese_manor_library_confucian_02 + } + if = { + limit = { has_domicile_building = japanese_manor_library_confucian_03 } + remove_domicile_building = japanese_manor_library_confucian_03 + } + if = { + limit = { has_domicile_building = japanese_manor_library_confucian_04 } + remove_domicile_building = japanese_manor_library_confucian_04 + } + if = { + limit = { has_domicile_building = japanese_manor_library_confucian_05 } + remove_domicile_building = japanese_manor_library_confucian_05 + } + if = { + limit = { has_domicile_building = japanese_manor_library_confucian_06 } + remove_domicile_building = japanese_manor_library_confucian_06 + } + if = { + limit = { has_domicile_building = japanese_manor_retainer_accomodations_01 } + remove_domicile_building = japanese_manor_retainer_accomodations_01 + } + if = { + limit = { has_domicile_building = japanese_manor_retainer_accomodations_02 } + remove_domicile_building = japanese_manor_retainer_accomodations_02 + } + if = { + limit = { has_domicile_building = japanese_manor_retainer_accomodations_03 } + remove_domicile_building = japanese_manor_retainer_accomodations_03 + } + if = { + limit = { has_domicile_building = japanese_manor_retainer_accomodations_04 } + remove_domicile_building = japanese_manor_retainer_accomodations_04 + } + if = { + limit = { has_domicile_building = japanese_manor_retainer_accomodations_05 } + remove_domicile_building = japanese_manor_retainer_accomodations_05 + } + if = { + limit = { has_domicile_building = japanese_fields_01 } + remove_domicile_building = japanese_fields_01 + } + if = { + limit = { has_domicile_building = japanese_fields_02 } + remove_domicile_building = japanese_fields_02 + } + if = { + limit = { has_domicile_building = japanese_fields_03 } + remove_domicile_building = japanese_fields_03 + } + if = { + limit = { has_domicile_building = japanese_fields_04 } + remove_domicile_building = japanese_fields_04 + } + if = { + limit = { has_domicile_building = japanese_fields_05 } + remove_domicile_building = japanese_fields_05 + } + if = { + limit = { has_domicile_building = japanese_fields_06 } + remove_domicile_building = japanese_fields_06 + } + if = { + limit = { has_domicile_building = japanese_granary_01 } + remove_domicile_building = japanese_granary_01 + } + if = { + limit = { has_domicile_building = japanese_granary_02 } + remove_domicile_building = japanese_granary_02 + } + if = { + limit = { has_domicile_building = japanese_granary_03 } + remove_domicile_building = japanese_granary_03 + } + if = { + limit = { has_domicile_building = japanese_granary_04 } + remove_domicile_building = japanese_granary_04 + } + if = { + limit = { has_domicile_building = japanese_granary_05 } + remove_domicile_building = japanese_granary_05 + } + if = { + limit = { has_domicile_building = japanese_granary_06 } + remove_domicile_building = japanese_granary_06 + } + if = { + limit = { has_domicile_building = japanese_rice_broker_01 } + remove_domicile_building = japanese_rice_broker_01 + } + if = { + limit = { has_domicile_building = japanese_rice_broker_02 } + remove_domicile_building = japanese_rice_broker_02 + } + if = { + limit = { has_domicile_building = japanese_rice_broker_03 } + remove_domicile_building = japanese_rice_broker_03 + } + if = { + limit = { has_domicile_building = japanese_rice_broker_04 } + remove_domicile_building = japanese_rice_broker_04 + } + if = { + limit = { has_domicile_building = japanese_rice_broker_05 } + remove_domicile_building = japanese_rice_broker_05 + } + if = { + limit = { has_domicile_building = japanese_rice_broker_06 } + remove_domicile_building = japanese_rice_broker_06 + } + if = { + limit = { has_domicile_building = japanese_tenant_farmers_01 } + remove_domicile_building = japanese_tenant_farmers_01 + } + if = { + limit = { has_domicile_building = japanese_tenant_farmers_02 } + remove_domicile_building = japanese_tenant_farmers_02 + } + if = { + limit = { has_domicile_building = japanese_tenant_farmers_03 } + remove_domicile_building = japanese_tenant_farmers_03 + } + if = { + limit = { has_domicile_building = japanese_tenant_farmers_04 } + remove_domicile_building = japanese_tenant_farmers_04 + } + if = { + limit = { has_domicile_building = japanese_tenant_farmers_05 } + remove_domicile_building = japanese_tenant_farmers_05 + } + if = { + limit = { has_domicile_building = japanese_tenant_farmers_06 } + remove_domicile_building = japanese_tenant_farmers_06 + } + if = { + limit = { has_domicile_building = japanese_shrine_01 } + remove_domicile_building = japanese_shrine_01 + } + if = { + limit = { has_domicile_building = japanese_shrine_02 } + remove_domicile_building = japanese_shrine_02 + } + if = { + limit = { has_domicile_building = japanese_shrine_03 } + remove_domicile_building = japanese_shrine_03 + } + if = { + limit = { has_domicile_building = japanese_shrine_04 } + remove_domicile_building = japanese_shrine_04 + } + if = { + limit = { has_domicile_building = japanese_shrine_05 } + remove_domicile_building = japanese_shrine_05 + } + if = { + limit = { has_domicile_building = japanese_shrine_06 } + remove_domicile_building = japanese_shrine_06 + } + if = { + limit = { has_domicile_building = japanese_cemetery_01 } + remove_domicile_building = japanese_cemetery_01 + } + if = { + limit = { has_domicile_building = japanese_cemetery_02 } + remove_domicile_building = japanese_cemetery_02 + } + if = { + limit = { has_domicile_building = japanese_cemetery_03 } + remove_domicile_building = japanese_cemetery_03 + } + if = { + limit = { has_domicile_building = japanese_cemetery_04 } + remove_domicile_building = japanese_cemetery_04 + } + if = { + limit = { has_domicile_building = japanese_cemetery_05 } + remove_domicile_building = japanese_cemetery_05 + } + if = { + limit = { has_domicile_building = japanese_cemetery_06 } + remove_domicile_building = japanese_cemetery_06 + } + if = { + limit = { has_domicile_building = japanese_shokubo_01 } + remove_domicile_building = japanese_shokubo_01 + } + if = { + limit = { has_domicile_building = japanese_shokubo_02 } + remove_domicile_building = japanese_shokubo_02 + } + if = { + limit = { has_domicile_building = japanese_shokubo_03 } + remove_domicile_building = japanese_shokubo_03 + } + if = { + limit = { has_domicile_building = japanese_shokubo_04 } + remove_domicile_building = japanese_shokubo_04 + } + if = { + limit = { has_domicile_building = japanese_shokubo_05 } + remove_domicile_building = japanese_shokubo_05 + } + if = { + limit = { has_domicile_building = japanese_shokubo_06 } + remove_domicile_building = japanese_shokubo_06 + } + if = { + limit = { has_domicile_building = japanese_monastery_01 } + remove_domicile_building = japanese_monastery_01 + } + if = { + limit = { has_domicile_building = japanese_monastery_02 } + remove_domicile_building = japanese_monastery_02 + } + if = { + limit = { has_domicile_building = japanese_monastery_03 } + remove_domicile_building = japanese_monastery_03 + } + if = { + limit = { has_domicile_building = japanese_monastery_04 } + remove_domicile_building = japanese_monastery_04 + } + if = { + limit = { has_domicile_building = japanese_monastery_05 } + remove_domicile_building = japanese_monastery_05 + } + if = { + limit = { has_domicile_building = japanese_monastery_06 } + remove_domicile_building = japanese_monastery_06 + } + if = { + limit = { has_domicile_building = japanese_brewery_01 } + remove_domicile_building = japanese_brewery_01 + } + if = { + limit = { has_domicile_building = japanese_brewery_02 } + remove_domicile_building = japanese_brewery_02 + } + if = { + limit = { has_domicile_building = japanese_brewery_03 } + remove_domicile_building = japanese_brewery_03 + } + if = { + limit = { has_domicile_building = japanese_brewery_04 } + remove_domicile_building = japanese_brewery_04 + } + if = { + limit = { has_domicile_building = japanese_brewery_05 } + remove_domicile_building = japanese_brewery_05 + } + if = { + limit = { has_domicile_building = japanese_brewery_06 } + remove_domicile_building = japanese_brewery_06 + } + if = { + limit = { has_domicile_building = japanese_koshu_cellars_01 } + remove_domicile_building = japanese_koshu_cellars_01 + } + if = { + limit = { has_domicile_building = japanese_koshu_cellars_02 } + remove_domicile_building = japanese_koshu_cellars_02 + } + if = { + limit = { has_domicile_building = japanese_koshu_cellars_03 } + remove_domicile_building = japanese_koshu_cellars_03 + } + if = { + limit = { has_domicile_building = japanese_koshu_cellars_04 } + remove_domicile_building = japanese_koshu_cellars_04 + } + if = { + limit = { has_domicile_building = japanese_koshu_cellars_05 } + remove_domicile_building = japanese_koshu_cellars_05 + } + if = { + limit = { has_domicile_building = japanese_koshu_cellars_06 } + remove_domicile_building = japanese_koshu_cellars_06 + } + if = { + limit = { has_domicile_building = japanese_gambling_den_01 } + remove_domicile_building = japanese_gambling_den_01 + } + if = { + limit = { has_domicile_building = japanese_gambling_den_02 } + remove_domicile_building = japanese_gambling_den_02 + } + if = { + limit = { has_domicile_building = japanese_gambling_den_03 } + remove_domicile_building = japanese_gambling_den_03 + } + if = { + limit = { has_domicile_building = japanese_gambling_den_04 } + remove_domicile_building = japanese_gambling_den_04 + } + if = { + limit = { has_domicile_building = japanese_gambling_den_05 } + remove_domicile_building = japanese_gambling_den_05 + } + if = { + limit = { has_domicile_building = japanese_gambling_den_06 } + remove_domicile_building = japanese_gambling_den_06 + } + if = { + limit = { has_domicile_building = japanese_sumo_hall_01 } + remove_domicile_building = japanese_sumo_hall_01 + } + if = { + limit = { has_domicile_building = japanese_sumo_hall_02 } + remove_domicile_building = japanese_sumo_hall_02 + } + if = { + limit = { has_domicile_building = japanese_sumo_hall_03 } + remove_domicile_building = japanese_sumo_hall_03 + } + if = { + limit = { has_domicile_building = japanese_sumo_hall_04 } + remove_domicile_building = japanese_sumo_hall_04 + } + if = { + limit = { has_domicile_building = japanese_sumo_hall_05 } + remove_domicile_building = japanese_sumo_hall_05 + } + if = { + limit = { has_domicile_building = japanese_sumo_hall_06 } + remove_domicile_building = japanese_sumo_hall_06 + } + if = { + limit = { has_domicile_building = japanese_archive_01 } + remove_domicile_building = japanese_archive_01 + } + if = { + limit = { has_domicile_building = japanese_archive_02 } + remove_domicile_building = japanese_archive_02 + } + if = { + limit = { has_domicile_building = japanese_archive_03 } + remove_domicile_building = japanese_archive_03 + } + if = { + limit = { has_domicile_building = japanese_archive_04 } + remove_domicile_building = japanese_archive_04 + } + if = { + limit = { has_domicile_building = japanese_archive_05 } + remove_domicile_building = japanese_archive_05 + } + if = { + limit = { has_domicile_building = japanese_archive_06 } + remove_domicile_building = japanese_archive_06 + } + if = { + limit = { has_domicile_building = japanese_schoolhouse_01 } + remove_domicile_building = japanese_schoolhouse_01 + } + if = { + limit = { has_domicile_building = japanese_schoolhouse_02 } + remove_domicile_building = japanese_schoolhouse_02 + } + if = { + limit = { has_domicile_building = japanese_schoolhouse_03 } + remove_domicile_building = japanese_schoolhouse_03 + } + if = { + limit = { has_domicile_building = japanese_schoolhouse_04 } + remove_domicile_building = japanese_schoolhouse_04 + } + if = { + limit = { has_domicile_building = japanese_schoolhouse_05 } + remove_domicile_building = japanese_schoolhouse_05 + } + if = { + limit = { has_domicile_building = japanese_schoolhouse_06 } + remove_domicile_building = japanese_schoolhouse_06 + } + if = { + limit = { has_domicile_building = japanese_law_library_01 } + remove_domicile_building = japanese_law_library_01 + } + if = { + limit = { has_domicile_building = japanese_law_library_02 } + remove_domicile_building = japanese_law_library_02 + } + if = { + limit = { has_domicile_building = japanese_law_library_03 } + remove_domicile_building = japanese_law_library_03 + } + if = { + limit = { has_domicile_building = japanese_law_library_04 } + remove_domicile_building = japanese_law_library_04 + } + if = { + limit = { has_domicile_building = japanese_law_library_05 } + remove_domicile_building = japanese_law_library_05 + } + if = { + limit = { has_domicile_building = japanese_law_library_06 } + remove_domicile_building = japanese_law_library_06 + } + if = { + limit = { has_domicile_building = japanese_messenger_service_01 } + remove_domicile_building = japanese_messenger_service_01 + } + if = { + limit = { has_domicile_building = japanese_messenger_service_02 } + remove_domicile_building = japanese_messenger_service_02 + } + if = { + limit = { has_domicile_building = japanese_messenger_service_03 } + remove_domicile_building = japanese_messenger_service_03 + } + if = { + limit = { has_domicile_building = japanese_messenger_service_04 } + remove_domicile_building = japanese_messenger_service_04 + } + if = { + limit = { has_domicile_building = japanese_messenger_service_05 } + remove_domicile_building = japanese_messenger_service_05 + } + if = { + limit = { has_domicile_building = japanese_messenger_service_06 } + remove_domicile_building = japanese_messenger_service_06 + } + if = { + limit = { has_domicile_building = japanese_armory_01 } + remove_domicile_building = japanese_armory_01 + } + if = { + limit = { has_domicile_building = japanese_armory_02 } + remove_domicile_building = japanese_armory_02 + } + if = { + limit = { has_domicile_building = japanese_armory_03 } + remove_domicile_building = japanese_armory_03 + } + if = { + limit = { has_domicile_building = japanese_armory_04 } + remove_domicile_building = japanese_armory_04 + } + if = { + limit = { has_domicile_building = japanese_armory_05 } + remove_domicile_building = japanese_armory_05 + } + if = { + limit = { has_domicile_building = japanese_armory_06 } + remove_domicile_building = japanese_armory_06 + } + if = { + limit = { has_domicile_building = japanese_bladesmith_01 } + remove_domicile_building = japanese_bladesmith_01 + } + if = { + limit = { has_domicile_building = japanese_bladesmith_02 } + remove_domicile_building = japanese_bladesmith_02 + } + if = { + limit = { has_domicile_building = japanese_bladesmith_03 } + remove_domicile_building = japanese_bladesmith_03 + } + if = { + limit = { has_domicile_building = japanese_bladesmith_04 } + remove_domicile_building = japanese_bladesmith_04 + } + if = { + limit = { has_domicile_building = japanese_bladesmith_05 } + remove_domicile_building = japanese_bladesmith_05 + } + if = { + limit = { has_domicile_building = japanese_bladesmith_06 } + remove_domicile_building = japanese_bladesmith_06 + } + if = { + limit = { has_domicile_building = japanese_armorer_01 } + remove_domicile_building = japanese_armorer_01 + } + if = { + limit = { has_domicile_building = japanese_armorer_02 } + remove_domicile_building = japanese_armorer_02 + } + if = { + limit = { has_domicile_building = japanese_armorer_03 } + remove_domicile_building = japanese_armorer_03 + } + if = { + limit = { has_domicile_building = japanese_armorer_04 } + remove_domicile_building = japanese_armorer_04 + } + if = { + limit = { has_domicile_building = japanese_armorer_05 } + remove_domicile_building = japanese_armorer_05 + } + if = { + limit = { has_domicile_building = japanese_armorer_06 } + remove_domicile_building = japanese_armorer_06 + } + if = { + limit = { has_domicile_building = japanese_barracks_01 } + remove_domicile_building = japanese_barracks_01 + } + if = { + limit = { has_domicile_building = japanese_barracks_02 } + remove_domicile_building = japanese_barracks_02 + } + if = { + limit = { has_domicile_building = japanese_barracks_03 } + remove_domicile_building = japanese_barracks_03 + } + if = { + limit = { has_domicile_building = japanese_barracks_04 } + remove_domicile_building = japanese_barracks_04 + } + if = { + limit = { has_domicile_building = japanese_barracks_05 } + remove_domicile_building = japanese_barracks_05 + } + if = { + limit = { has_domicile_building = japanese_barracks_06 } + remove_domicile_building = japanese_barracks_06 + } + if = { + limit = { has_domicile_building = japanese_watch_house_01 } + remove_domicile_building = japanese_watch_house_01 + } + if = { + limit = { has_domicile_building = japanese_watch_house_02 } + remove_domicile_building = japanese_watch_house_02 + } + if = { + limit = { has_domicile_building = japanese_watch_house_03 } + remove_domicile_building = japanese_watch_house_03 + } + if = { + limit = { has_domicile_building = japanese_watch_house_04 } + remove_domicile_building = japanese_watch_house_04 + } + if = { + limit = { has_domicile_building = japanese_watch_house_05 } + remove_domicile_building = japanese_watch_house_05 + } + if = { + limit = { has_domicile_building = japanese_watch_house_06 } + remove_domicile_building = japanese_watch_house_06 + } + if = { + limit = { has_domicile_building = japanese_spy_network_01 } + remove_domicile_building = japanese_spy_network_01 + } + if = { + limit = { has_domicile_building = japanese_spy_network_02 } + remove_domicile_building = japanese_spy_network_02 + } + if = { + limit = { has_domicile_building = japanese_spy_network_03 } + remove_domicile_building = japanese_spy_network_03 + } + if = { + limit = { has_domicile_building = japanese_spy_network_04 } + remove_domicile_building = japanese_spy_network_04 + } + if = { + limit = { has_domicile_building = japanese_spy_network_05 } + remove_domicile_building = japanese_spy_network_05 + } + if = { + limit = { has_domicile_building = japanese_spy_network_06 } + remove_domicile_building = japanese_spy_network_06 + } + if = { + limit = { has_domicile_building = japanese_infiltrators_01 } + remove_domicile_building = japanese_infiltrators_01 + } + if = { + limit = { has_domicile_building = japanese_infiltrators_02 } + remove_domicile_building = japanese_infiltrators_02 + } + if = { + limit = { has_domicile_building = japanese_infiltrators_03 } + remove_domicile_building = japanese_infiltrators_03 + } + if = { + limit = { has_domicile_building = japanese_infiltrators_04 } + remove_domicile_building = japanese_infiltrators_04 + } + if = { + limit = { has_domicile_building = japanese_infiltrators_05 } + remove_domicile_building = japanese_infiltrators_05 + } + if = { + limit = { has_domicile_building = japanese_infiltrators_06 } + remove_domicile_building = japanese_infiltrators_06 + } + if = { + limit = { has_domicile_building = japanese_prison_01 } + remove_domicile_building = japanese_prison_01 + } + if = { + limit = { has_domicile_building = japanese_prison_02 } + remove_domicile_building = japanese_prison_02 + } + if = { + limit = { has_domicile_building = japanese_prison_03 } + remove_domicile_building = japanese_prison_03 + } + if = { + limit = { has_domicile_building = japanese_prison_04 } + remove_domicile_building = japanese_prison_04 + } + if = { + limit = { has_domicile_building = japanese_prison_05 } + remove_domicile_building = japanese_prison_05 + } + if = { + limit = { has_domicile_building = japanese_prison_06 } + remove_domicile_building = japanese_prison_06 + } + if = { + limit = { has_domicile_building = japanese_horse_pastures_01 } + remove_domicile_building = japanese_horse_pastures_01 + } + if = { + limit = { has_domicile_building = japanese_horse_pastures_02 } + remove_domicile_building = japanese_horse_pastures_02 + } + if = { + limit = { has_domicile_building = japanese_horse_pastures_03 } + remove_domicile_building = japanese_horse_pastures_03 + } + if = { + limit = { has_domicile_building = japanese_horse_pastures_04 } + remove_domicile_building = japanese_horse_pastures_04 + } + if = { + limit = { has_domicile_building = japanese_horse_pastures_05 } + remove_domicile_building = japanese_horse_pastures_05 + } + if = { + limit = { has_domicile_building = japanese_horse_pastures_06 } + remove_domicile_building = japanese_horse_pastures_06 + } + if = { + limit = { has_domicile_building = japanese_stud_farm_01 } + remove_domicile_building = japanese_stud_farm_01 + } + if = { + limit = { has_domicile_building = japanese_stud_farm_02 } + remove_domicile_building = japanese_stud_farm_02 + } + if = { + limit = { has_domicile_building = japanese_stud_farm_03 } + remove_domicile_building = japanese_stud_farm_03 + } + if = { + limit = { has_domicile_building = japanese_stud_farm_04 } + remove_domicile_building = japanese_stud_farm_04 + } + if = { + limit = { has_domicile_building = japanese_stud_farm_05 } + remove_domicile_building = japanese_stud_farm_05 + } + if = { + limit = { has_domicile_building = japanese_stud_farm_06 } + remove_domicile_building = japanese_stud_farm_06 + } + if = { + limit = { has_domicile_building = japanese_ox_breeder_01 } + remove_domicile_building = japanese_ox_breeder_01 + } + if = { + limit = { has_domicile_building = japanese_ox_breeder_02 } + remove_domicile_building = japanese_ox_breeder_02 + } + if = { + limit = { has_domicile_building = japanese_ox_breeder_03 } + remove_domicile_building = japanese_ox_breeder_03 + } + if = { + limit = { has_domicile_building = japanese_ox_breeder_04 } + remove_domicile_building = japanese_ox_breeder_04 + } + if = { + limit = { has_domicile_building = japanese_ox_breeder_05 } + remove_domicile_building = japanese_ox_breeder_05 + } + if = { + limit = { has_domicile_building = japanese_ox_breeder_06 } + remove_domicile_building = japanese_ox_breeder_06 + } + if = { + limit = { has_domicile_building = japanese_riding_school_01 } + remove_domicile_building = japanese_riding_school_01 + } + if = { + limit = { has_domicile_building = japanese_riding_school_02 } + remove_domicile_building = japanese_riding_school_02 + } + if = { + limit = { has_domicile_building = japanese_riding_school_03 } + remove_domicile_building = japanese_riding_school_03 + } + if = { + limit = { has_domicile_building = japanese_riding_school_04 } + remove_domicile_building = japanese_riding_school_04 + } + if = { + limit = { has_domicile_building = japanese_riding_school_05 } + remove_domicile_building = japanese_riding_school_05 + } + if = { + limit = { has_domicile_building = japanese_riding_school_06 } + remove_domicile_building = japanese_riding_school_06 + } + if = { + limit = { has_domicile_building = japanese_tea_plantation_01 } + remove_domicile_building = japanese_tea_plantation_01 + } + if = { + limit = { has_domicile_building = japanese_tea_plantation_02 } + remove_domicile_building = japanese_tea_plantation_02 + } + if = { + limit = { has_domicile_building = japanese_tea_plantation_03 } + remove_domicile_building = japanese_tea_plantation_03 + } + if = { + limit = { has_domicile_building = japanese_tea_plantation_04 } + remove_domicile_building = japanese_tea_plantation_04 + } + if = { + limit = { has_domicile_building = japanese_tea_plantation_05 } + remove_domicile_building = japanese_tea_plantation_05 + } + if = { + limit = { has_domicile_building = japanese_tea_plantation_06 } + remove_domicile_building = japanese_tea_plantation_06 + } + if = { + limit = { has_domicile_building = japanese_matcha_factory_01 } + remove_domicile_building = japanese_matcha_factory_01 + } + if = { + limit = { has_domicile_building = japanese_matcha_factory_02 } + remove_domicile_building = japanese_matcha_factory_02 + } + if = { + limit = { has_domicile_building = japanese_matcha_factory_03 } + remove_domicile_building = japanese_matcha_factory_03 + } + if = { + limit = { has_domicile_building = japanese_matcha_factory_04 } + remove_domicile_building = japanese_matcha_factory_04 + } + if = { + limit = { has_domicile_building = japanese_matcha_factory_05 } + remove_domicile_building = japanese_matcha_factory_05 + } + if = { + limit = { has_domicile_building = japanese_matcha_factory_06 } + remove_domicile_building = japanese_matcha_factory_06 + } + if = { + limit = { has_domicile_building = japanese_medicine_house_01 } + remove_domicile_building = japanese_medicine_house_01 + } + if = { + limit = { has_domicile_building = japanese_medicine_house_02 } + remove_domicile_building = japanese_medicine_house_02 + } + if = { + limit = { has_domicile_building = japanese_medicine_house_03 } + remove_domicile_building = japanese_medicine_house_03 + } + if = { + limit = { has_domicile_building = japanese_medicine_house_04 } + remove_domicile_building = japanese_medicine_house_04 + } + if = { + limit = { has_domicile_building = japanese_medicine_house_05 } + remove_domicile_building = japanese_medicine_house_05 + } + if = { + limit = { has_domicile_building = japanese_medicine_house_06 } + remove_domicile_building = japanese_medicine_house_06 + } + if = { + limit = { has_domicile_building = japanese_roastery_01 } + remove_domicile_building = japanese_roastery_01 + } + if = { + limit = { has_domicile_building = japanese_roastery_02 } + remove_domicile_building = japanese_roastery_02 + } + if = { + limit = { has_domicile_building = japanese_roastery_03 } + remove_domicile_building = japanese_roastery_03 + } + if = { + limit = { has_domicile_building = japanese_roastery_04 } + remove_domicile_building = japanese_roastery_04 + } + if = { + limit = { has_domicile_building = japanese_roastery_05 } + remove_domicile_building = japanese_roastery_05 + } + if = { + limit = { has_domicile_building = japanese_roastery_06 } + remove_domicile_building = japanese_roastery_06 + } + if = { + limit = { has_domicile_building = japanese_stables_01 } + remove_domicile_building = japanese_stables_01 + } + if = { + limit = { has_domicile_building = japanese_stables_02 } + remove_domicile_building = japanese_stables_02 + } + if = { + limit = { has_domicile_building = japanese_stables_03 } + remove_domicile_building = japanese_stables_03 + } + if = { + limit = { has_domicile_building = japanese_stables_04 } + remove_domicile_building = japanese_stables_04 + } + if = { + limit = { has_domicile_building = japanese_stables_05 } + remove_domicile_building = japanese_stables_05 + } + if = { + limit = { has_domicile_building = japanese_stables_06 } + remove_domicile_building = japanese_stables_06 + } + if = { + limit = { has_domicile_building = japanese_yabusame_ground_01 } + remove_domicile_building = japanese_yabusame_ground_01 + } + if = { + limit = { has_domicile_building = japanese_yabusame_ground_02 } + remove_domicile_building = japanese_yabusame_ground_02 + } + if = { + limit = { has_domicile_building = japanese_yabusame_ground_03 } + remove_domicile_building = japanese_yabusame_ground_03 + } + if = { + limit = { has_domicile_building = japanese_yabusame_ground_04 } + remove_domicile_building = japanese_yabusame_ground_04 + } + if = { + limit = { has_domicile_building = japanese_yabusame_ground_05 } + remove_domicile_building = japanese_yabusame_ground_05 + } + if = { + limit = { has_domicile_building = japanese_yabusame_ground_06 } + remove_domicile_building = japanese_yabusame_ground_06 + } + if = { + limit = { has_domicile_building = japanese_farrier_01 } + remove_domicile_building = japanese_farrier_01 + } + if = { + limit = { has_domicile_building = japanese_farrier_02 } + remove_domicile_building = japanese_farrier_02 + } + if = { + limit = { has_domicile_building = japanese_farrier_03 } + remove_domicile_building = japanese_farrier_03 + } + if = { + limit = { has_domicile_building = japanese_farrier_04 } + remove_domicile_building = japanese_farrier_04 + } + if = { + limit = { has_domicile_building = japanese_farrier_05 } + remove_domicile_building = japanese_farrier_05 + } + if = { + limit = { has_domicile_building = japanese_farrier_06 } + remove_domicile_building = japanese_farrier_06 + } + if = { + limit = { has_domicile_building = japanese_hunting_lodge_01 } + remove_domicile_building = japanese_hunting_lodge_01 + } + if = { + limit = { has_domicile_building = japanese_hunting_lodge_02 } + remove_domicile_building = japanese_hunting_lodge_02 + } + if = { + limit = { has_domicile_building = japanese_hunting_lodge_03 } + remove_domicile_building = japanese_hunting_lodge_03 + } + if = { + limit = { has_domicile_building = japanese_hunting_lodge_04 } + remove_domicile_building = japanese_hunting_lodge_04 + } + if = { + limit = { has_domicile_building = japanese_hunting_lodge_05 } + remove_domicile_building = japanese_hunting_lodge_05 + } + if = { + limit = { has_domicile_building = japanese_hunting_lodge_06 } + remove_domicile_building = japanese_hunting_lodge_06 + } + if = { + limit = { has_domicile_building = japanese_workshop_01 } + remove_domicile_building = japanese_workshop_01 + } + if = { + limit = { has_domicile_building = japanese_workshop_02 } + remove_domicile_building = japanese_workshop_02 + } + if = { + limit = { has_domicile_building = japanese_workshop_03 } + remove_domicile_building = japanese_workshop_03 + } + if = { + limit = { has_domicile_building = japanese_workshop_04 } + remove_domicile_building = japanese_workshop_04 + } + if = { + limit = { has_domicile_building = japanese_workshop_05 } + remove_domicile_building = japanese_workshop_05 + } + if = { + limit = { has_domicile_building = japanese_workshop_06 } + remove_domicile_building = japanese_workshop_06 + } + if = { + limit = { has_domicile_building = japanese_bowyer_01 } + remove_domicile_building = japanese_bowyer_01 + } + if = { + limit = { has_domicile_building = japanese_bowyer_02 } + remove_domicile_building = japanese_bowyer_02 + } + if = { + limit = { has_domicile_building = japanese_bowyer_03 } + remove_domicile_building = japanese_bowyer_03 + } + if = { + limit = { has_domicile_building = japanese_bowyer_04 } + remove_domicile_building = japanese_bowyer_04 + } + if = { + limit = { has_domicile_building = japanese_bowyer_05 } + remove_domicile_building = japanese_bowyer_05 + } + if = { + limit = { has_domicile_building = japanese_bowyer_06 } + remove_domicile_building = japanese_bowyer_06 + } + if = { + limit = { has_domicile_building = japanese_lacquerer_01 } + remove_domicile_building = japanese_lacquerer_01 + } + if = { + limit = { has_domicile_building = japanese_lacquerer_02 } + remove_domicile_building = japanese_lacquerer_02 + } + if = { + limit = { has_domicile_building = japanese_lacquerer_03 } + remove_domicile_building = japanese_lacquerer_03 + } + if = { + limit = { has_domicile_building = japanese_lacquerer_04 } + remove_domicile_building = japanese_lacquerer_04 + } + if = { + limit = { has_domicile_building = japanese_lacquerer_05 } + remove_domicile_building = japanese_lacquerer_05 + } + if = { + limit = { has_domicile_building = japanese_lacquerer_06 } + remove_domicile_building = japanese_lacquerer_06 + } + if = { + limit = { has_domicile_building = japanese_carpenter_01 } + remove_domicile_building = japanese_carpenter_01 + } + if = { + limit = { has_domicile_building = japanese_carpenter_02 } + remove_domicile_building = japanese_carpenter_02 + } + if = { + limit = { has_domicile_building = japanese_carpenter_03 } + remove_domicile_building = japanese_carpenter_03 + } + if = { + limit = { has_domicile_building = japanese_carpenter_04 } + remove_domicile_building = japanese_carpenter_04 + } + if = { + limit = { has_domicile_building = japanese_carpenter_05 } + remove_domicile_building = japanese_carpenter_05 + } + if = { + limit = { has_domicile_building = japanese_carpenter_06 } + remove_domicile_building = japanese_carpenter_06 + } + if = { + limit = { has_domicile_building = japanese_tea_house_01 } + remove_domicile_building = japanese_tea_house_01 + } + if = { + limit = { has_domicile_building = japanese_tea_house_02 } + remove_domicile_building = japanese_tea_house_02 + } + if = { + limit = { has_domicile_building = japanese_tea_house_03 } + remove_domicile_building = japanese_tea_house_03 + } + if = { + limit = { has_domicile_building = japanese_tea_house_04 } + remove_domicile_building = japanese_tea_house_04 + } + if = { + limit = { has_domicile_building = japanese_tea_house_05 } + remove_domicile_building = japanese_tea_house_05 + } + if = { + limit = { has_domicile_building = japanese_tea_house_06 } + remove_domicile_building = japanese_tea_house_06 + } + if = { + limit = { has_domicile_building = japanese_guest_house_01 } + remove_domicile_building = japanese_guest_house_01 + } + if = { + limit = { has_domicile_building = japanese_guest_house_02 } + remove_domicile_building = japanese_guest_house_02 + } + if = { + limit = { has_domicile_building = japanese_guest_house_03 } + remove_domicile_building = japanese_guest_house_03 + } + if = { + limit = { has_domicile_building = japanese_guest_house_04 } + remove_domicile_building = japanese_guest_house_04 + } + if = { + limit = { has_domicile_building = japanese_guest_house_05 } + remove_domicile_building = japanese_guest_house_05 + } + if = { + limit = { has_domicile_building = japanese_guest_house_06 } + remove_domicile_building = japanese_guest_house_06 + } + if = { + limit = { has_domicile_building = japanese_performance_stage_01 } + remove_domicile_building = japanese_performance_stage_01 + } + if = { + limit = { has_domicile_building = japanese_performance_stage_02 } + remove_domicile_building = japanese_performance_stage_02 + } + if = { + limit = { has_domicile_building = japanese_performance_stage_03 } + remove_domicile_building = japanese_performance_stage_03 + } + if = { + limit = { has_domicile_building = japanese_performance_stage_04 } + remove_domicile_building = japanese_performance_stage_04 + } + if = { + limit = { has_domicile_building = japanese_performance_stage_05 } + remove_domicile_building = japanese_performance_stage_05 + } + if = { + limit = { has_domicile_building = japanese_performance_stage_06 } + remove_domicile_building = japanese_performance_stage_06 + } + if = { + limit = { has_domicile_building = japanese_asobi_colony_01 } + remove_domicile_building = japanese_asobi_colony_01 + } + if = { + limit = { has_domicile_building = japanese_asobi_colony_02 } + remove_domicile_building = japanese_asobi_colony_02 + } + if = { + limit = { has_domicile_building = japanese_asobi_colony_03 } + remove_domicile_building = japanese_asobi_colony_03 + } + if = { + limit = { has_domicile_building = japanese_asobi_colony_04 } + remove_domicile_building = japanese_asobi_colony_04 + } + if = { + limit = { has_domicile_building = japanese_asobi_colony_05 } + remove_domicile_building = japanese_asobi_colony_05 + } + if = { + limit = { has_domicile_building = japanese_asobi_colony_06 } + remove_domicile_building = japanese_asobi_colony_06 + } + if = { + limit = { has_domicile_building = japanese_garden_01 } + remove_domicile_building = japanese_garden_01 + } + if = { + limit = { has_domicile_building = japanese_garden_02 } + remove_domicile_building = japanese_garden_02 + } + if = { + limit = { has_domicile_building = japanese_garden_03 } + remove_domicile_building = japanese_garden_03 + } + if = { + limit = { has_domicile_building = japanese_garden_04 } + remove_domicile_building = japanese_garden_04 + } + if = { + limit = { has_domicile_building = japanese_garden_05 } + remove_domicile_building = japanese_garden_05 + } + if = { + limit = { has_domicile_building = japanese_garden_06 } + remove_domicile_building = japanese_garden_06 + } + if = { + limit = { has_domicile_building = japanese_rock_garden_01 } + remove_domicile_building = japanese_rock_garden_01 + } + if = { + limit = { has_domicile_building = japanese_rock_garden_02 } + remove_domicile_building = japanese_rock_garden_02 + } + if = { + limit = { has_domicile_building = japanese_rock_garden_03 } + remove_domicile_building = japanese_rock_garden_03 + } + if = { + limit = { has_domicile_building = japanese_rock_garden_04 } + remove_domicile_building = japanese_rock_garden_04 + } + if = { + limit = { has_domicile_building = japanese_rock_garden_05 } + remove_domicile_building = japanese_rock_garden_05 + } + if = { + limit = { has_domicile_building = japanese_rock_garden_06 } + remove_domicile_building = japanese_rock_garden_06 + } + if = { + limit = { has_domicile_building = japanese_kazan_display_01 } + remove_domicile_building = japanese_kazan_display_01 + } + if = { + limit = { has_domicile_building = japanese_kazan_display_02 } + remove_domicile_building = japanese_kazan_display_02 + } + if = { + limit = { has_domicile_building = japanese_kazan_display_03 } + remove_domicile_building = japanese_kazan_display_03 + } + if = { + limit = { has_domicile_building = japanese_kazan_display_04 } + remove_domicile_building = japanese_kazan_display_04 + } + if = { + limit = { has_domicile_building = japanese_kazan_display_05 } + remove_domicile_building = japanese_kazan_display_05 + } + if = { + limit = { has_domicile_building = japanese_kazan_display_06 } + remove_domicile_building = japanese_kazan_display_06 + } + if = { + limit = { has_domicile_building = japanese_orchard_01 } + remove_domicile_building = japanese_orchard_01 + } + if = { + limit = { has_domicile_building = japanese_orchard_02 } + remove_domicile_building = japanese_orchard_02 + } + if = { + limit = { has_domicile_building = japanese_orchard_03 } + remove_domicile_building = japanese_orchard_03 + } + if = { + limit = { has_domicile_building = japanese_orchard_04 } + remove_domicile_building = japanese_orchard_04 + } + if = { + limit = { has_domicile_building = japanese_orchard_05 } + remove_domicile_building = japanese_orchard_05 + } + if = { + limit = { has_domicile_building = japanese_orchard_06 } + remove_domicile_building = japanese_orchard_06 + } + } +} diff --git a/N3OW/common/scripted_effects/10_dlc_tgp_silk_road_scripted_effects.txt b/N3OW/common/scripted_effects/10_dlc_tgp_silk_road_scripted_effects.txt new file mode 100644 index 00000000..eb561b08 --- /dev/null +++ b/N3OW/common/scripted_effects/10_dlc_tgp_silk_road_scripted_effects.txt @@ -0,0 +1,644 @@ +################################################## +# Silk Road Scripted Effects +################################################## + +tgp_silk_road_downstream_player_sub_region_effect = { + save_temporary_scope_as = player_temp + scope:origin_sub_region_temp = { + if = { + limit = { any_situation_sub_region_participant = { this = scope:player_temp } } + save_temporary_scope_as = player_sub_region_temp + } + } + if = { + limit = { NOT = { exists = scope:player_sub_region_temp } } + random_in_list = { + list = second_sub_regions + limit = { any_situation_sub_region_participant = { this = scope:player_temp } } + save_temporary_scope_as = player_sub_region_temp + } + } + if = { + limit = { NOT = { exists = scope:player_sub_region_temp } } + random_in_list = { + list = third_sub_regions + limit = { any_situation_sub_region_participant = { this = scope:player_temp } } + save_temporary_scope_as = player_sub_region_temp + } + } +} + +tgp_silk_road_downstream_effect = { + save_temporary_scope_as = origin_sub_region_temp + switch = { + trigger = scope:origin_sub_region_temp + # China + situation:silk_road_situation.situation_sub_region:region_silk_road_proper_china = { + situation:silk_road_situation = { + # Secondary + situation_sub_region:region_silk_road_proper_tibet = { add_to_temporary_list = second_sub_regions } + situation_sub_region:region_silk_road_proper_central_asia = { add_to_temporary_list = second_sub_regions } + # Tertiary + situation_sub_region:region_silk_road_proper_india = { add_to_temporary_list = third_sub_regions } + situation_sub_region:region_silk_road_proper_transcaspia = { add_to_temporary_list = third_sub_regions } + situation_sub_region:region_silk_road_proper_occident = { add_to_temporary_list = third_sub_regions } + } + } + # Tibet + situation:silk_road_situation.situation_sub_region:region_silk_road_proper_tibet = { + situation:silk_road_situation = { + # Secondary + situation_sub_region:region_silk_road_proper_india = { add_to_temporary_list = second_sub_regions } + # Tertiary + situation_sub_region:region_silk_road_proper_occident = { add_to_temporary_list = third_sub_regions } + } + } + # Central Asia + situation:silk_road_situation.situation_sub_region:region_silk_road_proper_central_asia = { + situation:silk_road_situation = { + # Secondary + situation_sub_region:region_silk_road_proper_transcaspia = { add_to_temporary_list = second_sub_regions } + # Tertiary + situation_sub_region:region_silk_road_proper_occident = { add_to_temporary_list = third_sub_regions } + } + } + # India + situation:silk_road_situation.situation_sub_region:region_silk_road_proper_india = { + situation:silk_road_situation = { + # Secondary + situation_sub_region:region_silk_road_proper_occident = { add_to_temporary_list = second_sub_regions } + } + } + # Transcaspia + situation:silk_road_situation.situation_sub_region:region_silk_road_proper_transcaspia = { + situation:silk_road_situation = { + # Secondary + situation_sub_region:region_silk_road_proper_occident = { add_to_temporary_list = second_sub_regions } + } + } + # Occident + situation:silk_road_situation.situation_sub_region:region_silk_road_proper_occident = {} # Terminus + } + # Fire changes/messages + scope:origin_sub_region_temp ?= { + if = { + limit = { silk_road_sub_region_conflict_trigger = yes } + tgp_silk_road_downstream_war_effect = yes + } + else = { tgp_silk_road_downstream_peace_effect = yes } + } + # Cleanup + clear_saved_scope = origin_sub_region_temp + every_in_list = { + list = second_sub_regions + remove_from_list = second_sub_regions + } + every_in_list = { + list = third_sub_regions + remove_from_list = third_sub_regions + } +} + +# Effects to move sub regions towards Hardship +tgp_silk_road_downstream_war_effect = { + # Disabled for now + #tgp_silk_road_downstream_war_message_effect = yes + scope:origin_sub_region_temp ?= { + trigger_sub_region_catalyst = { catalyst = catalyst_silk_road_region_peace } + } + every_in_list = { + list = second_sub_regions + trigger_sub_region_catalyst = { catalyst = catalyst_silk_road_adjacent_upstream_region_peace } + } + every_in_list = { + list = third_sub_regions + trigger_sub_region_catalyst = { catalyst = catalyst_silk_road_distant_upstream_region_peace } + } +} + +tgp_silk_road_downstream_war_message_effect = { + every_player = { + tgp_silk_road_downstream_player_sub_region_effect = yes + if = { + limit = { exists = scope:player_sub_region_temp } + send_interface_message = { + type = msg_silk_road_prosperity_war_bad + title = msg_silk_road_prosperity_upstream_war + desc = tgp_silk_road_move_sub_region_towards_hardship_tt + scope:player_sub_region_temp = { + if = { + limit = { sub_region_current_phase = phase_exceptional_bounty } + if = { + limit = { this = scope:origin_sub_region_temp } + custom_tooltip = tgp_silk_road_move_sub_region_towards_steady_trading_primary_tt + } + else_if = { + limit = { is_in_list = second_sub_regions } + custom_tooltip = tgp_silk_road_move_sub_region_towards_steady_trading_secondary_tt + } + else = { custom_tooltip = tgp_silk_road_move_sub_region_towards_steady_trading_tertiary_tt } + } + else_if = { + limit = { + NOT = { sub_region_current_phase = phase_hardship } + } + if = { + limit = { this = scope:origin_sub_region_temp } + custom_tooltip = tgp_silk_road_move_sub_region_towards_hardship_primary_tt + } + else_if = { + limit = { is_in_list = second_sub_regions } + custom_tooltip = tgp_silk_road_move_sub_region_towards_hardship_secondary_tt + } + else = { custom_tooltip = tgp_silk_road_move_sub_region_towards_hardship_tertiary_tt } + } + } + } + } + } +} + +# Effects to move sub regions towards Prosperity +tgp_silk_road_downstream_peace_effect = { + # Disabled for now + #tgp_silk_road_downstream_peace_message_effect = yes + scope:origin_sub_region_temp ?= { + trigger_sub_region_catalyst = { catalyst = catalyst_silk_road_region_war } + } + every_in_list = { + list = second_sub_regions + trigger_sub_region_catalyst = { catalyst = catalyst_silk_road_adjacent_upstream_region_war } + } + every_in_list = { + list = third_sub_regions + trigger_sub_region_catalyst = { catalyst = catalyst_silk_road_distant_upstream_region_war } + } +} + +tgp_silk_road_downstream_peace_message_effect = { + every_player = { + tgp_silk_road_downstream_player_sub_region_effect = yes + if = { + limit = { exists = scope:player_sub_region_temp } + send_interface_message = { + type = msg_silk_road_prosperity_peace_good + title = msg_silk_road_prosperity_upstream_peace + desc = tgp_silk_road_move_sub_region_towards_exceptional_bounty_tt + scope:player_sub_region_temp = { + if = { + limit = { sub_region_current_phase = phase_hardship } + if = { + limit = { this = scope:origin_sub_region_temp } + custom_tooltip = tgp_silk_road_move_sub_region_towards_steady_trading_primary_tt + } + else_if = { + limit = { is_in_list = second_sub_regions } + custom_tooltip = tgp_silk_road_move_sub_region_towards_steady_trading_secondary_tt + } + else = { custom_tooltip = tgp_silk_road_move_sub_region_towards_steady_trading_tertiary_tt } + } + else_if = { + limit = { + NOT = { sub_region_current_phase = phase_exceptional_bounty } + } + if = { + limit = { this = scope:origin_sub_region_temp } + custom_tooltip = tgp_silk_road_move_sub_region_towards_exceptional_bounty_primary_tt + } + else_if = { + limit = { is_in_list = second_sub_regions } + custom_tooltip = tgp_silk_road_move_sub_region_towards_exceptional_bounty_secondary_tt + } + else = { custom_tooltip = tgp_silk_road_move_sub_region_towards_exceptional_bounty_tertiary_tt } + } + } + } + } + } +} + +tgp_silk_road_innovation_setup_add_effect = { + add_to_variable_list = { name = silk_road_unlocked_innovations target = culture_innovation:innovation_$INNOVATION$ } + add_innovation = innovation_$INNOVATION$ +} + +tgp_silk_road_innovation_setup_effect = { + if = { + limit = { has_tgp_dlc_trigger = yes } + # CHAM + culture:cham = { + tgp_silk_road_innovation_setup_add_effect = { INNOVATION = champa_rice } + } + # VIET + culture:viet = { + if = { + limit = { + game_start_date >= 1066.1.1 + } + tgp_silk_road_innovation_setup_add_effect = { INNOVATION = champa_rice } + } + } + # JAPAN + culture:japanese = { + tgp_silk_road_innovation_setup_add_effect = { INNOVATION = lacquered_armor } + } + # KOREA + culture:baekje = { + tgp_silk_road_innovation_setup_add_effect = { INNOVATION = lacquered_armor } + } + culture:goguryeo = { + tgp_silk_road_innovation_setup_add_effect = { INNOVATION = lacquered_armor } + } + culture:silla = { + tgp_silk_road_innovation_setup_add_effect = { INNOVATION = lacquered_armor } + } + culture:goryeo = { + if = { + limit = { + game_start_date >= 1066.1.1 + } + tgp_silk_road_innovation_setup_add_effect = { INNOVATION = lacquered_armor } + } + } + # CHINA + culture:han = { + # Woodblock scrolls by 868 + tgp_silk_road_innovation_setup_add_effect = { INNOVATION = block_printing } + # Coking by 9th century + tgp_silk_road_innovation_setup_add_effect = { INNOVATION = coking } + # Woodblock scrolls by 868 + tgp_silk_road_innovation_setup_add_effect = { INNOVATION = composite_crossbow } + # Pre-Tang + tgp_silk_road_innovation_setup_add_effect = { INNOVATION = cupellation } + # Pre-Tang + tgp_silk_road_innovation_setup_add_effect = { INNOVATION = dragon_kiln } + # Pre-Tang + tgp_silk_road_innovation_setup_add_effect = { INNOVATION = lacquered_armor } + # Pre-Tang + tgp_silk_road_innovation_setup_add_effect = { INNOVATION = pharmacopoeia } + # Pre-Tang + tgp_silk_road_innovation_setup_add_effect = { INNOVATION = sericulture } + # Pre-Tang + tgp_silk_road_innovation_setup_add_effect = { INNOVATION = waterworks } + if = { + limit = { + game_start_date >= 1066.1.1 + } + # Known by Song + tgp_silk_road_innovation_setup_add_effect = { INNOVATION = bulkheads } + # Introduced to the Song court by 977 + tgp_silk_road_innovation_setup_add_effect = { INNOVATION = champa_rice } + # Lodestone compasses by 1088 + tgp_silk_road_innovation_setup_add_effect = { INNOVATION = compass } + # 10-11th century + tgp_silk_road_innovation_setup_add_effect = { INNOVATION = double_entry_bookkeeping } + # First edition of the Wujing Zongyao and the first written formulation of weaponized gunpowder + tgp_silk_road_innovation_setup_add_effect = { INNOVATION = fire_medicine } + # 震天雷 by 1044 + tgp_silk_road_innovation_setup_add_effect = { INNOVATION = grenades } + } + } + } +} + +tgp_silk_road_movement_stream_effect = { + $SUB_REGION$ ?= { + save_temporary_scope_as = sub_region_temp + var:innovation ?= { save_temporary_scope_as = old_innovation_temp } + } + $UPSTREAM_SUB_REGION$ = { + save_temporary_scope_as = upstream_sub_region_temp + var:innovation ?= { save_temporary_scope_as = new_innovation_temp } + } + scope:sub_region_temp = { + every_player = { + limit = { + save_temporary_scope_as = player_temp + scope:sub_region_temp = { any_situation_sub_region_participant = { this = scope:player_temp } } + } + send_interface_message = { + type = msg_silk_road_innovation_movement + title = msg_silk_road_innovation_movement_stream_title + desc = msg_silk_road_innovation_movement_stream_desc + custom_tooltip = msg_silk_road_innovation_movement_tt + } + } + set_variable = { + name = innovation + value = scope:new_innovation_temp + } + } +} + +tgp_silk_road_movement_china_effect = { + situation_sub_region:region_silk_road_proper_china = { save_temporary_scope_as = sub_region_temp } + + # Find the culture of the province the market of Chang'an is located in + title:c_jingzhao = { + culture = { + save_temporary_scope_as = region_silk_road_proper_china_market_culture + random_culture_innovation = { + limit = { + has_innovation_parameter = silk_road_innovation_parameter + is_known_by_culture = scope:region_silk_road_proper_china_market_culture + NOR = { + this = situation_sub_region:region_silk_road_proper_occident.var:innovation + this = situation_sub_region:region_silk_road_proper_transcaspia.var:innovation + this = situation_sub_region:region_silk_road_proper_india.var:innovation + this = situation_sub_region:region_silk_road_proper_central_asia.var:innovation + this = situation_sub_region:region_silk_road_proper_tibet.var:innovation + this = situation_sub_region:region_silk_road_proper_china.var:innovation + } + } + save_scope_as = new_innovation_temp + } + } + } + scope:sub_region_temp = { + every_player = { + limit = { + save_temporary_scope_as = player_temp + scope:sub_region_temp = { any_situation_sub_region_participant = { this = scope:player_temp } } + } + send_interface_message = { + type = msg_silk_road_innovation_movement + title = msg_silk_road_innovation_movement_china_title + desc = msg_silk_road_innovation_movement_china_desc + custom_tooltip = msg_silk_road_innovation_movement_tt + } + } + set_variable = { + name = innovation + value = scope:new_innovation_temp + } + } +} + +tgp_silk_road_decision_scope_effect = { + save_scope_as = market_temp + title_province = { + save_scope_as = destination_province + save_scope_as = background_market_scope + save_scope_as = silk_road_market_town + } + random_county_situation_sub_region = { + limit = { + situation_sub_region_has_county = scope:market_temp + OR = { + sub_region_current_phase = phase_exceptional_bounty + sub_region_current_phase = phase_steady_trading + sub_region_current_phase = phase_hardship + } + } + save_scope_as = sub_region_temp + var:innovation ?= { save_scope_as = innovation_temp } + } +} + +tgp_silk_road_market_built_effect = { + county = { + save_temporary_scope_as = county_temp + random_county_situation = { + limit = { + situation_type = silk_road_situation + situation_has_catalyst = catalyst_silk_road_famous_market_built + } + trigger_situation_catalyst = { + catalyst = catalyst_silk_road_famous_market_built + county = scope:county_temp + character = scope:character + } + } + } +} + +tgp_silk_road_canal_built_effect = { + situation:silk_road_situation ?= { + if = { + limit = { situation_has_catalyst = catalyst_silk_road_china_grand_canal_expanded } + situation_sub_region:region_silk_road_proper_china ?= { + trigger_sub_region_catalyst = { + catalyst = catalyst_silk_road_china_grand_canal_expanded + character = scope:owner + } + } + } + if = { + limit = { situation_has_catalyst = catalyst_silk_road_china_grand_canal_expanded_secondary } + situation_sub_region:region_silk_road_proper_tibet ?= { + trigger_sub_region_catalyst = { + catalyst = catalyst_silk_road_china_grand_canal_expanded_secondary + character = scope:owner + } + } + situation_sub_region:region_silk_road_proper_central_asia ?= { + trigger_sub_region_catalyst = { + catalyst = catalyst_silk_road_china_grand_canal_expanded_secondary + character = scope:owner + } + } + } + if = { + limit = { situation_has_catalyst = catalyst_silk_road_china_grand_canal_expanded_tertiary } + situation_sub_region:region_silk_road_proper_india ?= { + trigger_sub_region_catalyst = { + catalyst = catalyst_silk_road_china_grand_canal_expanded_tertiary + character = scope:owner + } + } + situation_sub_region:region_silk_road_proper_transcaspia ?= { + trigger_sub_region_catalyst = { + catalyst = catalyst_silk_road_china_grand_canal_expanded_tertiary + character = scope:owner + } + } + } + } +} + +tgp_silk_road_expand_steppe_effect = { + situation:silk_road_situation = { + if = { + limit = { situation_has_catalyst = catalyst_silk_road_mpo_region_to_steppe } + situation_sub_region:region_silk_road_proper_$SUB_REGION$ = { + trigger_sub_region_catalyst = { + catalyst = catalyst_silk_road_mpo_region_to_steppe + character = scope:steppe_expander + } + } + } + } +} + +tgp_silk_road_raid_effect = { # county scope + if = { + limit = { + title_province = { geographical_region = dlc_tgp_silk_road_route_region } # the actual route + } + save_temporary_scope_as = county_temp + random_county_situation = { + limit = { + situation_type = silk_road_situation + situation_has_catalyst = catalyst_silk_road_raided + } + trigger_situation_catalyst = { + catalyst = catalyst_silk_road_raided + county = scope:county_temp + character = scope:raider + } + } + } +} + +tgp_silk_road_mongol_devastation_effect = { # county scope + if = { + limit = { + title_province = { geographical_region = dlc_tgp_silk_road_route_region } # the actual route + } + save_temporary_scope_as = county_temp + random_county_situation = { + limit = { + situation_type = silk_road_situation + situation_has_catalyst = catalyst_silk_road_mongol_devastation + } + trigger_situation_catalyst = { + catalyst = catalyst_silk_road_mongol_devastation + county = scope:county_temp + character = scope:mongol_emperor + } + } + } +} + +tgp_silk_road_iranian_intermezzo_yearly_effect = { + if = { + limit = { + struggle:persian_struggle ?= { is_struggle_phase = struggle_persia_phase_unrest } + situation:silk_road_situation ?= { situation_has_catalyst = catalyst_silk_road_iranian_intermezzo_in_unrest } + } + situation:silk_road_situation.situation_sub_region:region_silk_road_proper_occident ?= { + trigger_sub_region_catalyst = { catalyst = catalyst_silk_road_iranian_intermezzo_in_unrest } + } + } +} + +tgp_silk_road_iranian_intermezzo_ending_effect = { + save_scope_as = struggle_ender + situation:silk_road_situation ?= { + if = { + limit = { situation_has_catalyst = catalyst_silk_road_iranian_intermezzo_ending_reached } + situation_sub_region:region_silk_road_proper_occident ?= { + trigger_sub_region_catalyst = { + catalyst = catalyst_silk_road_iranian_intermezzo_ending_reached + character = scope:struggle_ender + } + } + } + } +} + +tgp_silk_road_china_consolidation_effect = { + situation:silk_road_situation ?= { + if = { + limit = { situation_has_catalyst = catalyst_silk_road_china_consolidation } + every_situation_sub_region = { + trigger_sub_region_catalyst = { + catalyst = catalyst_silk_road_china_consolidation + character = scope:huangdi + } + } + } + } +} + +tgp_silk_road_china_stability_effect = { + if = { + limit = { + situation:dynastic_cycle = { + OR = { + situation_current_phase = situation_dynastic_cycle_phase_stability + situation_current_phase = situation_dynastic_cycle_phase_stability_expansion + situation_current_phase = situation_dynastic_cycle_phase_stability_advancement + } + } + } + situation:silk_road_situation ?= { + if = { + limit = { situation_has_catalyst = catalyst_silk_road_china_stability } + every_situation_sub_region = { + trigger_sub_region_catalyst = { + catalyst = catalyst_silk_road_china_stability + character = scope:huangdi + } + } + } + } + } +} + +tgp_silk_road_feudalize_holding_effect = { + save_temporary_scope_as = county_temp + random_county_situation = { + limit = { + situation_type = silk_road_situation + situation_has_catalyst = catalyst_silk_road_mpo_region_resettled + } + trigger_situation_catalyst = { + catalyst = catalyst_silk_road_mpo_region_resettled + county = scope:county_temp + character = scope:actor + } + } +} + +tgp_silk_road_byzantium_destroyed_effect = { + situation:silk_road_situation = { + if = { + limit = { situation_has_catalyst = catalyst_silk_road_byzantium_blew_up } + situation_sub_region:region_silk_road_proper_occident = { + trigger_sub_region_catalyst = { + catalyst = catalyst_silk_road_byzantium_blew_up + character = title:e_byzantium.previous_holder + } + } + } + } +} + +tgp_silk_road_phase_message_effect = { + every_player = { + limit = { + save_temporary_scope_as = player_temp + scope:situation_sub_region ?= { + any_situation_sub_region_participant_group = { participant_group_has_character = scope:player_temp } + } + } + if = { + limit = { + scope:situation_sub_region = { sub_region_current_phase = phase_exceptional_bounty } + } + send_interface_message = { + type = msg_silk_road_good + title = msg_silk_road_phase_change_title + custom_tooltip = msg_silk_road_phase_change_tt + } + } + else_if = { + limit = { + scope:situation_sub_region = { sub_region_current_phase = phase_hardship} + } + send_interface_message = { + type = msg_silk_road_bad + title = msg_silk_road_phase_change_title + custom_tooltip = msg_silk_road_phase_change_tt + } + } + else = { + send_interface_message = { + type = msg_silk_road_neutral + title = msg_silk_road_phase_change_title + custom_tooltip = msg_silk_road_phase_change_tt + } + } + } +} diff --git a/N3OW/common/scripted_effects/20_health_balancing_effects.txt b/N3OW/common/scripted_effects/20_health_balancing_effects.txt new file mode 100644 index 00000000..ba05da7b --- /dev/null +++ b/N3OW/common/scripted_effects/20_health_balancing_effects.txt @@ -0,0 +1,2 @@ +### HEALTH BALANCING EFFECTS ### +# Along with the health balancing triggers, these effects are only used to get data output used for balancing diseases. diff --git a/N3OW/common/scripted_effects/20_health_effects.txt b/N3OW/common/scripted_effects/20_health_effects.txt new file mode 100644 index 00000000..169b55af --- /dev/null +++ b/N3OW/common/scripted_effects/20_health_effects.txt @@ -0,0 +1,4103 @@ +#health effects list# + +################### +# DISEASE EFFECTS # +################### + +### GENERAL CONTRACT/RECOVER EFFECTS ### +# contract_disease_effect - Adds disease trait, sends treatment and notification events etc. NO contraction event. Needs argument DISEASE (trait name) and TREATMENT_EVENT (yes/no). +# contract_disease_notify_effect - Sends a "contracted disease" event in 5-15 days. The event checks if the disease is valid and runs contract_disease_effect to apply the disease trait. Needs argument DISEASE (trait name). +# recover_from_disease_effect - Checks if has disease, removes it and sets any immunity, and sends appropriate notifications to other characters. Needs argument DISEASE (trait name). Does not send event to character who contracts disease. +#recover_from_disease_notify_effect - Checks if has disease, removes it and sets any immunity in an event for the character in question, and sends appropriate notifications to other characters. Needs argument DISEASE (trait name). + +### STD EFFECTS ### +# contract_lovers_pox_from - sends the scoped character "contracted lover's pox" event if argument PARTNER has lover's pox. Uses PARTNER in event. +# contract_great_pox_from - sends the scoped character "contracted early lover's pox" event if argument PARTNER has great pox. Uses PARTNER in event. +# risk_of_std_from_effect - 50% chance of running contract_lovers_pox_from effect and 30% chance of running contract_great_pox_from effect + +### CONTAGIOUS DISEASE ### +# create_contagion_list_effect - Creates a list of characters who might contract contagious disease (smallpox/plague) from scope + +### SIDE EFFECTS ### +# epilepsy_fever_risk_effect +# epilepsy_brain_trauma_risk_effect + + + +############################### +# GAIN/INCREASE WOUND EFFECTS # +############################### + +# increase_wounds_no_death_effect - increases wound level without killing +# increase_wounds_effect - increases wound level with chance of death +# maimed_in_battle_effect + + +######################################## +#EFFECTS FOR WEIGHT GAIN/LOSS # +######################################## + +#target_weight_modifier_effect - Increases character variable that's used in the weight balancing + + +######################################## +#EFFECTS FOR COURT PHYSICIAN TREATMENT # +######################################## + +### COURT PHYSICIAN MANAGEMENT ### +# set_court_physician_effect +# fire_court_physician_effect +# save_court_physician_as +# invalidate_physician_effect + +### COURT PHYSICIAN RANK UP ### +#physician_level_up_chance_effect +#mystic_level_up_chance_effect +#physician_rank_up_tooltip_effect + +### DISEASE TREATMENT OPTIONS ### +# safe_disease_treatment_effect +# risky_disease_treatment_effect +# mystic_disease_treatment_effect +# no_disease_treatment_effect +# find_court_physician_effect +# deny_disease_treatment_effect + +### WOUND TREATMENT OPTIONS ### +# safe_wound_treatment_effect +# risky_wound_treatment_effect + +### DISEASE TREATMENT OUTCOMES ### +# set_worst_disease_effect +# add_disease_treatment_modifier_effect +# disease_treatment_results_effect +# disease_treatment_result_tooltip_effect +# remove_disease_treatment_effect + +### WOUND TREATMENT OUTCOMES ### +# add_wound_treatment_modifier_effect +# wound_treatment_result_tooltip_effect +# wound_treatment_results_effect + +### DISEASE TREATMENT LOGIC ### +# save_health_court_owner_effect +# pick_own_disease_treatment_effect +# decide_who_picks_disease_treatment_effect +# liege_picks_treatment_effect + +### WOUND LOGIC ### +# pick_own_wound_treatment_effect +# decide_who_picks_wound_treatment_effect + +### FAILED TREAMENT EFFECTS ### +# add_failed_treatment_of_me_opinions_effect +# add_failed_treatment_of_kin_opinions_effect +# downgrade_failed_treatment_of_me_opinions_effect +# downgrade_failed_treatment_of_kin_opinions_effect +# execute_physician_effect +# imprison_physician_effect +# chastise_physician_effect +# forgive_physician_effect + + +### DISEASE MESSAGES ### +# inform_liege_about_disease_treatment_effect +# activate_outbreak_story_effect + +### WOUND MESSAGES ### +# inform_liege_about_wound_treatment_effect + + +###################### +#EFFECTS FOR SUICIDE # +###################### +# committed_suicide_effect +# attempted_suicide_effect + + +############################################################################################## +# LIST ENDS HERE + + +#################### +# DISEASE EFFECTS # +#################### + +#Adds the disease in question and sends notifications to everyone who should know. Checks validity and sends treatment event. Needs the arguments DISEASE (trait name, only exception is early_great_pox - it should be added as great_pox and then the effect will figure out whether the character should have early_great_pox first) and TREATMENT_EVENT (yes/no). Does NOT send an event to the character who gets the disease. +contract_disease_effect = { + if = { #Is the disease valid? + limit = { can_contract_disease_trigger = { DISEASE = $DISEASE$ } } + + hidden_effect = { + #SET SCOPES + save_scope_as = sick_character + + save_scope_value_as = { + name = disease_type + value = flag:$DISEASE$ + } + + save_temporary_scope_value_as = { + name = treatment_event + value = flag:$TREATMENT_EVENT$ + } + + if = { + limit = { #Should I get early great pox instead of great pox? + scope:disease_type = flag:great_pox + NOR = { + has_trait = lovers_pox + has_trait = early_great_pox + } + } + save_scope_value_as = { + name = disease_type + value = flag:early_great_pox + } + } + + #Data collection + disease_data_save_contraction_effect = { DISEASE = $DISEASE$ } + + + #TREATMENT EVENT + if = { + limit = { + scope:treatment_event = flag:yes + } + + trigger_event = { + id = health.3100 + days = 5 + } + } + else_if = { + limit = { scope:treatment_event = flag:no } #This is just here to stop errors + } + } + + + #NON-CONTAGIOUS DISEASES + if = { + limit = { + OR = { + scope:disease_type = flag:ill + scope:disease_type = flag:pneumonic + scope:disease_type = flag:gout_ridden + scope:disease_type = flag:leper + scope:disease_type = flag:cancer + scope:disease_type = flag:ergotism + } + } + + if = { #Removes ill if progressing to pneumonia + limit = { + scope:disease_type = flag:pneumonic + has_trait = ill + } + remove_trait = ill + } + + add_trait_force_tooltip = $DISEASE$ + } + + #CONTAGIOUS DISEASES + if = { + limit = { + OR = { + scope:disease_type = flag:smallpox + scope:disease_type = flag:measles + scope:disease_type = flag:dysentery + scope:disease_type = flag:bubonic_plague + scope:disease_type = flag:typhus + scope:disease_type = flag:consumption + } + } + + add_trait_force_tooltip = $DISEASE$ + } + + #STD DISEASES + else_if = { #Lover's pox + limit = { scope:disease_type = flag:lovers_pox } + add_trait_force_tooltip = lovers_pox + + hidden_effect = { + #Trigger regular contagion checks + trigger_event = { + id = health.1200 + days = { 60 1000 } #This first one can happen quite fast, the following checks are delayed 250-10000 days depending on traits + } + } + } + else_if = { #Early great pox + limit = { scope:disease_type = flag:early_great_pox } + add_trait_force_tooltip = early_great_pox + + hidden_effect = { + trigger_event = { + id = health.1013 #Reveals the true disease + days = { 90 150 } + } + } + } + else_if = { #Great pox + limit = { scope:disease_type = flag:great_pox } + + hidden_effect = { + remove_trait = lovers_pox #If you get Great Pox and already have lover's pox, we pretend that lover's pox was the first symptoms + remove_trait = early_great_pox + } + add_trait_force_tooltip = great_pox + + hidden_effect = { + #Trigger regular contagion checks + trigger_event = { + id = health.1201 + days = { 250 1500 } #This first one can happen quite fast, the following checks are delayed 350-10000 days depending on traits + } + } + } + + #RECOVERY + if = { #Ill + limit = { scope:disease_type = flag:ill } + trigger_event = { + id = health.1101 + days = { ill_recovery_min ill_recovery_max } + } + } + else_if = { #Pneumonic + limit = { scope:disease_type = flag:pneumonic } + trigger_event = { + id = health.1102 + days = { pneumonic_recovery_min pneumonic_recovery_max } + } + } + else_if = { #Gout + limit = { scope:disease_type = flag:gout_ridden } + random = { + chance = 25 + modifier = { + has_trait = gluttonous + add = -15 + } + modifier = { + has_trait = temperate + add = 15 + } + trigger_event = { + id = health.1103 + days = { gout_ridden_recovery_min gout_ridden_recovery_max } #1 to 30 years + } + } + } + else_if = { #Typhus + limit = { scope:disease_type = flag:typhus } + trigger_event = { + id = health.1105 + days = { 45 150 } + } + } + else_if = { #Consumption + limit = { scope:disease_type = flag:consumption } + trigger_event = { + id = health.1106 + days = { 365 2190 } #1 to 6 years + } + } + else_if = { #Cancer + limit = { scope:disease_type = flag:cancer } + random = { + chance = 1 + trigger_event = { + id = health.1107 + days = { 365 3650 } #1 to 10 years + } + } + } + else_if = { #Great pox + limit = { + OR = { + scope:disease_type = flag:early_great_pox + scope:disease_type = flag:great_pox + } + } + trigger_event = { + id = health.1109 + days = { 730 5475 } #2 to 15 years (note that early pox progresses into great pox in 60-150 days and great pox leads to lunacy after 5 to 15 years) + } + } + else_if = { #Smallpox + limit = { scope:disease_type = flag:smallpox } + trigger_event = { + id = health.1110 + days = { smallpox_min_recovery_time smallpox_max_recovery_time } + } + } + else_if = { #Bubonic Plague + limit = { scope:disease_type = flag:bubonic_plague } + trigger_event = { + id = health.1111 + days = { bubonic_plague_min_recovery_time bubonic_plague_max_recovery_time } + } + } + else_if = { #Measles + limit = { scope:disease_type = flag:measles } + trigger_event = { + id = health.1112 + days = { measles_min_recovery_time measles_max_recovery_time } + } + } + else_if = { #Dysentery + limit = { scope:disease_type = flag:dysentery } + trigger_event = { + id = health.1113 + days = { dysentery_min_recovery_time dysentery_max_recovery_time } + } + } + else_if = { #Ergotism + limit = { scope:disease_type = flag:ergotism } + trigger_event = { + id = health.1114 + days = { ergotism_min_recovery_time ergotism_max_recovery_time } + } + } + #No recovery for leper and lover's pox + + + #EPILEPSY RISK + if = { + limit = { scope:disease_type = flag:ill } + epilepsy_fever_risk_effect = { CHANCE = 1 } + } + else_if = { + limit = { + OR = { + scope:disease_type = flag:pneumonic + scope:disease_type = flag:typhus + scope:disease_type = flag:consumption + scope:disease_type = flag:measles + scope:disease_type = flag:dysentery + scope:disease_type = flag:smallpox + scope:disease_type = flag:bubonic_plague + } + } + epilepsy_fever_risk_effect = { CHANCE = 5 } + } + + #NOTIFICATIONS: CONTAGIOUS DISEASE, FAMILY & SEX PARTNER STD, NOTIFICATIONS & LIEGE TREATMENT EVENTS + + #List creation: + #Imprisoner/court owner if contagious + if = { + limit = { + OR = { + scope:disease_type = flag:smallpox + scope:disease_type = flag:bubonic_plague + scope:disease_type = flag:measles + scope:disease_type = flag:dysentery + scope:disease_type = flag:typhus + scope:disease_type = flag:consumption + } + is_ruler = no + has_health_court_owner_trigger = yes #Imprisoner or court owner + } + save_health_court_owner_effect = { SCOPE_NAME = health_court_owner }#Imprisoner or court owner + + scope:health_court_owner = { + add_to_temporary_list = disase_notification_list + } + } + #Sex partners if STD + if = { + limit = { + OR = { + scope:disease_type = flag:lovers_pox + scope:disease_type = flag:early_great_pox + scope:disease_type = flag:great_pox + } + } + every_consort = { + add_to_temporary_list = disase_notification_list + } + every_relation = { + type = lover + add_to_temporary_list = disase_notification_list + } + } + #Family if the disease is somewhat dangerous + if = { + limit = { + sick_enough_for_relative_to_care_trigger = yes + } + every_parent = { + limit = { + is_playable_character = yes + } + add_to_temporary_list = disase_notification_list + } + every_spouse = { + limit = { + is_playable_character = yes + } + add_to_temporary_list = disase_notification_list + } + every_heir_title = { + limit = { + exists = holder + } + holder = { + if = { + limit = { + player_heir = scope:sick_character + } + add_to_temporary_list = disase_notification_list + } + } + } + } + + #Go through list and send notifications + every_in_list = { + list = disase_notification_list + + #Send a STD warning event + if = { + limit = { + OR = { + scope:disease_type = flag:lovers_pox + scope:disease_type = flag:early_great_pox + scope:disease_type = flag:great_pox + } + OR = { + is_consort_of = scope:sick_character + has_relation_lover = scope:sick_character + } + } + scope:sick_character = { save_scope_as = std_partner } + if = { + limit = { scope:disease_type = flag:great_pox } + trigger_event = { + id = health.2002 #Partner has great pox + days = { 7 14 } + } + } + else = { + trigger_event = { + id = health.2001 #Partner has lover's pox/early great great pox + days = { 7 14 } + } + } + } + #Send a notification/treatment event to family + else_if = { + limit = { + OR = { + #It's a player heir + trigger_if = { + limit = { exists = player_heir } + player_heir = scope:sick_character + } + #Or a child/spouse who is really sick or this character has to pick their treatment + AND = { + is_spouse_of = scope:sick_character #we only send you your spouse and primary heir to avoid event spam with plagues + OR = { + #The sick character is dying + health < death_chance_dying_health + #This character gets to pick sick character's treatment + trigger_if = { + limit = { exists = scope:sick_character.liege } + this = scope:sick_character.liege + scope:sick_character = { liege_picks_treatment_trigger = yes } + } + } + } + } + } + trigger_event = { + id = health.2201 #Important character is sick + days = 3 + } + #set a variable, so you are sure to get a follow-up + if = { + limit = { is_ai = no } + scope:sick_character = { + add_to_variable_list = { + name = recovery_event_receivers + target = prev + } + } + } + } + else_if = { + limit = { + exists = scope:epidemic + is_target_in_variable_list = { + name = notified_of_epidemics + target = scope:epidemic + } + } + # Don't get spammed by courtiers and guests falling sick during epidemics + } + #Send a feed message + else = { + send_interface_message = { + type = msg_disease_contraction + left_icon = scope:sick_character + localization_values = { + disease_trait = trait:$DISEASE$ + message_receiver = this + } + show_as_tooltip = { + scope:sick_character = { + if = { + limit = { scope:disease_type = flag:early_great_pox } + add_trait_force_tooltip = early_great_pox + } + else = { + add_trait_force_tooltip = $DISEASE$ + } + } + } + } + if = { + limit = { is_ai = no } + add_to_variable_list = { + name = notified_of_epidemics + target = scope:epidemic + } + } + } + } + } + hidden_effect = { + if = { + limit = { + exists = scope:epidemic + } + give_epidemic_immunity = { EPIDEMIC = scope:epidemic } + # Give appropriate memory + if = { + limit = { + scope:disease_type ?= flag:bubonic_plague + } + create_character_memory = { + type = ce1_contracted_black_death + } + } + else = { + create_character_memory = { + type = ce1_contracted_epidemic + } + scope:new_memory = { + if = { + limit = { + NOT = { exists = var:epidemic_infected } + } + set_variable = { + name = epidemic_infected + value = scope:epidemic.epidemic_type.epidemic_trait + } + } + } + } + } + } +} + + + + +#Triggers an event giving you the disease (if you meet the conditions) and notifying everyone who should know. Needs the arguments DISEASE trait name, only exception is early_great_pox - it should be added as great_pox and then the effect will figure out whether the character should have early_great_pox first) +contract_disease_notify_effect = { + save_scope_value_as = { + name = disease_type + value = flag:$DISEASE$ + } + + #Ill + if = { + limit = { scope:disease_type = flag:ill } + trigger_event = { id = health.1001 days = { 5 15 } } + } + else_if = { + limit = { scope:disease_type = flag:pneumonic } + trigger_event = { id = health.1002 days = { 5 15 } } + } + else_if = { + limit = { scope:disease_type = flag:gout_ridden } + trigger_event = { id = health.1003 days = { 5 15 } } + } + else_if = { + limit = { scope:disease_type = flag:leper } + trigger_event = { id = health.1004 days = { 5 15 } } + } + else_if = { + limit = { scope:disease_type = flag:typhus } + trigger_event = { id = health.1005 days = { 5 15 } } + } + else_if = { + limit = { scope:disease_type = flag:consumption } + trigger_event = { id = health.1006 days = { 5 15 } } + } + else_if = { + limit = { scope:disease_type = flag:cancer } + trigger_event = { id = health.1007 days = { 5 15 } } + } + else_if = { + limit = { scope:disease_type = flag:lovers_pox } + trigger_event = { id = health.1008 days = { 5 15 } } + } + else_if = { + limit = { scope:disease_type = flag:great_pox } + trigger_event = { id = health.1009 days = { 5 15 } } + } + else_if = { + limit = { scope:disease_type = flag:smallpox } + trigger_event = { id = health.1010 days = { 5 15 } } + } + else_if = { + limit = { scope:disease_type = flag:measles } + trigger_event = { id = health.1015 days = { 5 15 } } + } + else_if = { + limit = { scope:disease_type = flag:dysentery } + trigger_event = { id = health.1016 days = { 5 15 } } + } + else_if = { + limit = { scope:disease_type = flag:ergotism } + trigger_event = { id = health.1017 days = { 5 15 } } + } + else_if = { + limit = { scope:disease_type = flag:bubonic_plague } + trigger_event = { id = health.1011 days = { 5 15 } } + } +} + +#Removes the disease in question and sends notifications to everyone who should know. Needs the arguments DISEASE (trait name, only exception is early_great_pox - it should be removed as great_pox). Does NOT send an event to the character who gets the disease. +recover_from_disease_effect = { + hidden_effect = { + save_scope_value_as = { + name = disease_type + value = flag:$DISEASE$ + } + + if = { + limit = { + has_trait = early_great_pox + scope:disease_type = flag:great_pox + } + save_scope_value_as = { + name = disease_type + value = flag:early_great_pox + } + } + } + + if = { #They actually have the disease you want to remove + limit = { has_trait = $DISEASE$ } + + save_scope_as = sick_character + + #Notifications (first, because some notifications need to check health which are changed when traits are removed) + hidden_effect = { + + #IMPORTANT CHARACTER (add to list) + if = { + limit = { #The disease has to be somewhat dangerous + OR = { + health < death_chance_dying_health + NOR = { + scope:disease_type = flag:ill + scope:disease_type = flag:gout_ridden + scope:disease_type = flag:lovers_pox + scope:disease_type = flag:early_great_pox + } + } + } + every_parent = { + limit = { is_playable_character = yes } + add_to_temporary_list = disase_notification_list + } + every_child = { + limit = { is_playable_character = yes } + add_to_temporary_list = disase_notification_list + } + every_spouse = { + limit = { + is_playable_character = yes + NOT = { is_in_list = disase_notification_list } + } + add_to_temporary_list = disase_notification_list + } + every_heir_title = { + limit = { + exists = holder + } + holder = { + if = { + limit = { + player_heir ?= scope:sick_character + NOT = { is_in_list = disase_notification_list } + } + add_to_temporary_list = disase_notification_list + } + } + } + } + + #PARTNERS WHO WANT TO KNOW ABOUT STDS (add to list) + if = { + limit = { + OR = { + scope:disease_type = flag:great_pox + scope:disease_type = flag:lovers_pox + scope:disease_type = flag:early_great_pox + } + } + every_relation = { + type = lover + limit = { + is_playable_character = yes + NOT = { is_in_list = disase_notification_list } + } + add_to_temporary_list = disase_notification_list + } + every_concubine = { + limit = { + is_playable_character = yes + NOT = { is_in_list = disase_notification_list } + } + add_to_temporary_list = disase_notification_list + } + } + + #IMPOTANT CHARACTER NOTIFICATION EVENT + every_parent = { + limit = { + inform_about_relative_recovery_trigger = yes + } + add_to_temporary_list = disase_notification_list + } + every_spouse = { + limit = { + inform_about_relative_recovery_trigger = yes + NOT = { is_in_list = disase_notification_list } + } + add_to_temporary_list = disase_notification_list + } + every_heir_title = { + limit = { + exists = holder + } + holder = { + if = { + limit = { + player_heir = scope:sick_character + inform_about_relative_recovery_trigger = yes + NOT = { is_in_list = disase_notification_list } + } + add_to_temporary_list = disase_notification_list + } + } + } + + #Go through list and send notifications + every_in_list = { + list = disase_notification_list + + if = { + limit = { + OR = { + #This character received an event when + scope:sick_character = { + is_target_in_variable_list = { + name = recovery_event_receivers + target = prev + } + } + #It's your player heir + trigger_if = { + limit = { exists = player_heir } + player_heir = scope:sick_character + } + } + } + trigger_event = health.2202 + } + else = { + save_scope_as = message_receiver + send_interface_message = { + type = msg_disease_recovery + left_icon = scope:sick_character + title = disease_recovery_feed_message.t + show_as_tooltip = { + scope:sick_character = { + if = { + limit = { scope:disease_type = flag:early_great_pox } + remove_trait_force_tooltip = early_great_pox + } + else = { + remove_trait_force_tooltip = $DISEASE$ + } + } + } + } + } + } + } + + clear_variable_list = recovery_event_receivers + + #TRAIT REMOVAL + remove_trait = $DISEASE$ + + #IMMUNITY + hidden_effect = { + if = { + limit = { scope:disease_type = flag:smallpox } + add_character_flag = disease_immunity_smallpox + } + else_if = { + limit = { scope:disease_type = flag:measles } + add_character_flag = disease_immunity_measles + } + else_if = { + limit = { scope:disease_type = flag:bubonic_plague } + add_character_flag = disease_immunity_bubonic_plague + } + } + } +} + + +#Triggers an event removing the disease (if you meet the conditions) and notifying everyone who should know. Needs the arguments DISEASE trait name. No events exist for leper, lovers_pox and early_great_pox. + +recover_from_disease_notify_effect = { + save_scope_value_as = { + name = disease_type + value = flag:$DISEASE$ + } + + if = { + limit = { scope:disease_type = flag:ill } + trigger_event = { id = health.1101 days = { 5 15 } } + } + else_if = { + limit = { scope:disease_type = flag:pneumonic } + trigger_event = { id = health.1102 days = { 5 15 } } + } + else_if = { + limit = { scope:disease_type = flag:gout_ridden } + trigger_event = { id = health.1103 days = { 5 15 } } + } + else_if = { + limit = { scope:disease_type = flag:typhus } + trigger_event = { id = health.1105 days = { 5 15 } } + } + else_if = { + limit = { scope:disease_type = flag:consumption } + trigger_event = { id = health.1106 days = { 5 15 } } + } + else_if = { + limit = { scope:disease_type = flag:cancer } + trigger_event = { id = health.1107 days = { 5 15 } } + } + else_if = { + limit = { scope:disease_type = flag:great_pox } + trigger_event = { id = health.1109 days = { 5 15 } } + } + else_if = { + limit = { scope:disease_type = flag:smallpox } + trigger_event = { id = health.1110 days = { 5 15 } } + } + else_if = { + limit = { scope:disease_type = flag:bubonic_plague } + trigger_event = { id = health.1111 days = { 5 15 } } + } +} + +#If partner has lover's pox, the character gets it through an event. Needs argument PARTNER +contract_lovers_pox_from = { + $PARTNER$ = { save_scope_as = infecting_partner } + if = { + limit = { scope:infecting_partner = { has_trait = lovers_pox } } + contract_disease_notify_effect = { DISEASE = lovers_pox } + } +} + +#If partner has great pox, the character gets it through an event. Needs argument PARTNER +contract_great_pox_from = { + $PARTNER$ = { save_scope_as = infecting_partner } + if = { + limit = { + scope:infecting_partner = { + OR = { + has_trait = early_great_pox + has_trait = great_pox + } + } + } + contract_disease_notify_effect = { DISEASE = great_pox } + } +} + +#50% risk of herpes (if partner has it) and 30% risk of great pox (if partner has it). Added through event. Needs argument PARTNER +risk_of_std_from_effect = { + random = { + chance = 50 + modifier = { + add = -30 + has_perk = wash_your_hands_perk + } + contract_lovers_pox_from = { PARTNER = $PARTNER$ } + } + random = { + chance = 30 + modifier = { + add = -10 + has_perk = wash_your_hands_perk + } + modifier = { + add = -30 + has_character_flag = contraction_cooldown_great_pox + } + contract_great_pox_from = { PARTNER = $PARTNER$ } + } +} + +#Creates a list of characters which might contract a disease from you (for plague and smallpox) +create_contagion_list_effect = { + $CONTAGION_COURT_OWNER$ = { + if = { + limit = { + NOR = { + this = $SICK_CHARACTER$ + is_in_list = contagion_list + } + } + add_to_temporary_list = contagion_list + } + every_courtier_or_guest = { + limit = { + NOR = { + this = $SICK_CHARACTER$ + is_in_list = contagion_list + } + } + add_to_temporary_list = contagion_list + } + every_prisoner = { + limit = { + NOR = { + this = $SICK_CHARACTER$ + is_in_list = contagion_list + } + } + add_to_temporary_list = contagion_list + } + } + $SICK_CHARACTER$ = { + every_scheme = { + limit = { + friendly_scheme_trigger = yes + NOT = { scheme_target_character = { is_in_list = contagion_list } } + } + scheme_target_character = { add_to_temporary_list = contagion_list } + } + every_targeting_scheme = { + limit = { + friendly_scheme_trigger = yes + NOT = { scheme_owner = { is_in_list = contagion_list } } + } + scheme_owner = { add_to_temporary_list = contagion_list } + } + } +} + +### SIDE EFFECTS ### +epilepsy_fever_risk_effect = { + hidden_effect = { + if = { + limit = { age <= 12 } + random = { + chance = $CHANCE$ + modifier = { + age >= 9 + factor = 0.7 + } + debug_log = "Epilepsy: fever" + trigger_event = { + id = trait_specific.2001 #Gain "possessed" + days = { 30 300 } + } + } + } + } +} + +epilepsy_brain_trauma_risk_effect = { + hidden_effect = { + random = { + chance = $CHANCE$ + debug_log = "Epilepsy: brain trauma" + trigger_event = { + id = trait_specific.2001 #Gain "possessed" + days = { 30 300 } + } + } + } +} + + +############################### +############################### +# GAIN/INCREASE WOUND EFFECTS # +############################### +############################### + + +increase_wounds_no_death_effect = { + save_temporary_scope_value_as = { + name = treatment_type + value = flag:$REASON$ + } + + change_trait_rank = { + trait = wounded + rank = 1 + max = 3 + } + + if = { #Wounds from treatments give no infection and no additional treatment + limit = { NOT = { scope:treatment_type = flag:treatment } } + + #CHANCE OF INFECTION + hidden_effect = { + random = { + chance = 10 + trigger_event = { + id = health.0201 + days = { 30 60 } + } + } + } + + #HANDLE TREATMENT + if = { #To send notification message or trigger the right event + limit = { + has_trait_rank = { + trait = wounded + rank = 1 + } + court_physician_available_trigger = yes + } + save_scope_as = sick_character + safe_wound_treatment_effect = yes #Wounded 1 only gives a "result of treatment" notification" if you have a physician, i.e. you get no events about it. + } + else_if = { + limit = { + has_trait_rank = { + trait = wounded + rank = 2 + } + has_recent_wound_treatment_trigger = no + } + #A "real" event if you're not receiving treatment + #Nothing happens if you're already being treated for wounds + trigger_event = { + id = health.0102 + days = { 2 3 } + } + } + else_if = { + limit = { + has_trait_rank = { + trait = wounded + rank = 3 + } + has_recent_wound_treatment_trigger = no + } + #A "real" event if you're not receiving treatment + #Nothing happens if you're already being treated for wounds + trigger_event = { + id = health.0104 + days = { 2 3 } + } + + #Epilepsy risk + epilepsy_brain_trauma_risk_effect = { CHANCE = 5 } + } + } + + # To stop the game from complaining about unused character flags since we only specifically check + # the treatment reason for risk of further or infection + if = { + limit = { + exists = flag:$REASON$ + } + } +} + + +increase_wounds_children_no_death_effect = { + hidden_effect = { + random_list = { + 75 = { + if = { + limit = { + has_character_modifier = scratched_and_bruised + } + remove_character_modifier = scratched_and_bruised + } + add_character_modifier = { + modifier = scratched_and_bruised + years = 3 + } + } + 25 = { + increase_wounds_no_death_effect = { REASON = wounds } + } + } + } +} + +#increase_wounds_effect +increase_wounds_effect = { + if = { + limit = { + has_trait_rank = { + trait = wounded + rank < 3 + } + } + increase_wounds_no_death_effect = { REASON = $REASON$ } + } + else_if = { #Using an if because this needs to never go wrong + limit = { + has_trait_rank = { + trait = wounded + rank = 3 + } + } + death = { + death_reason = death_$REASON$ + } + } +} + +maimed_in_battle_effect = { + random_list = { + 4 = { + trigger = { + NOT = { + has_trait = one_legged + } + } + add_trait_force_tooltip = one_legged + increase_wounds_effect = { REASON = fight } + } + 2 = { + trigger = { + NOT = { + has_trait = disfigured + } + } + add_trait_force_tooltip = disfigured + increase_wounds_effect = { REASON = fight } + epilepsy_brain_trauma_risk_effect = { CHANCE = 5 } + } + 4 = { + trigger = { + NOT = { + has_trait = one_eyed + } + } + add_trait_force_tooltip = one_eyed + increase_wounds_effect = { REASON = fight } + epilepsy_brain_trauma_risk_effect = { CHANCE = 5 } + } + 4 = { + trigger = { + NOT = { + has_trait = maimed + } + } + apply_maimed_trait_and_modifier_effect = yes + epilepsy_brain_trauma_risk_effect = { CHANCE = 5 } + } + } +} + +apply_maimed_trait_and_modifier_effect = { + add_trait = maimed + add_character_modifier = { + modifier = recently_maimed_modifier + years = 1 + } +} + + +######################################### +# EFFECTS FOR WEIGHT GAIN/LOSS # +######################################### + +target_weight_modifier_effect = { + if = { + limit = { + NOT = { has_variable = character_weight_variable } + } + set_variable = { + name = character_weight_variable + value = 0 + } + } + change_variable = { + name = character_weight_variable + add = $VALUE$ + } +} + + +######################################### +# EFFECTS FOR COURT PHYSICIAN TREATMENT # +######################################### + + + +### COURT PHYSICIAN MANAGEMENT ### + +set_court_physician_effect = { + $PHYSICIAN$ = { + if = { + limit = { + NOT = { liege = $EMPLOYER$ } + } + $EMPLOYER$ = { add_courtier = $PHYSICIAN$ } + } + } + $EMPLOYER$ = { + #Replace existing court physician if one exists + if = { + limit = { + employs_court_position = court_physician_court_position + any_court_position_holder = { + type = court_physician_court_position + count > 0 + } + } + every_court_position_holder = { + type = court_physician_court_position + save_temporary_scope_as = old_physician + + $EMPLOYER$ = { + replace_court_position = { + recipient = $PHYSICIAN$ + holder = scope:old_physician + court_position = court_physician_court_position + } + reverse_add_opinion = { + target = scope:old_physician + modifier = disappointed_opinion + opinion = -15 + } + reverse_add_opinion = { + target = $PHYSICIAN$ + modifier = hired_me_opinion + } + } + } + } + #Else just straight up appoint + else = { + appoint_court_position = { + recipient = $PHYSICIAN$ + court_position = court_physician_court_position + } + reverse_add_opinion = { + target = $PHYSICIAN$ + modifier = hired_me_opinion + } + } + + #Trigger treatments if needed + hidden_effect = { + if = { + limit = { + has_treatable_disease_trigger = yes + has_recent_treatment_trigger = no + } + save_scope_as = sick_character + trigger_event = { + id = health.3101 + days = { physician_treatment_delay_ruler_min physician_treatment_delay_ruler_max } + } + } + else_if = { + limit = { + has_recent_wound_treatment_trigger = no + has_wounds_trigger = yes + } + save_scope_as = sick_character + trigger_event = { + id = health.4001 + days = { physician_treatment_delay_ruler_min physician_treatment_delay_ruler_max } + } + } + every_courtier_or_guest = { + if = { + limit = { + has_treatable_disease_trigger = yes + has_recent_treatment_trigger = no + } + set_worst_disease_effect = yes + save_scope_as = sick_character + decide_who_picks_disease_treatment_effect = yes #Sends health.3101 to them or 3102 to liege (you) + } + else_if = { + limit = { + has_recent_wound_treatment_trigger = no + has_wounds_trigger = yes + } + save_scope_as = sick_character + decide_who_picks_wound_treatment_effect = yes + } + } + } + } +} + +save_court_physician_as_effect = { + hidden_effect = { + if = { + limit = { exists = court_owner } + court_owner = { + random_court_position_holder = { + type = court_physician_court_position + limit = { + is_physically_able = yes + } + save_scope_as = $SCOPE_NAME$ + } + } + } + } +} + + + +###COURT PHYSICIAN RANK UP### + +physician_rank_up_tooltip_effect = { + scope:physician = { + if = { + limit = { + exists = var:physician_level_up + } + show_as_tooltip = { + if = { + limit = { var:physician_level_up = flag:physician } + if = { + limit = { + has_trait_xp = { + trait = lifestyle_physician + value > 5 + } + } + add_trait_xp = { + trait = lifestyle_physician + value = 10 + } + } + else = { add_trait_force_tooltip = lifestyle_physician } + } + else_if = { + limit = { var:physician_level_up = flag:mystic } + if = { + limit = { + has_trait_xp = { + trait = lifestyle_mystic + value > 5 + } + } + add_trait_xp = { + trait = lifestyle_mystic + value = 10 + } + } + else = { add_trait_force_tooltip = lifestyle_mystic } + } + } + } + } +} + +#Needs argument CHANCE +physician_level_up_chance_effect = { + if = { + limit = { + is_alive = yes + NAND = { + has_trait = lifestyle_physician + has_trait_xp = { + trait = lifestyle_physician + value >= 100 + } + } + } + random = { + chance = $CHANCE$ + physician_lifestyle_rank_up_effect = yes + + #Used by physician_rank_up_tooltip_effect, to be shown in treatment outcome... + set_variable = { name = physician_level_up value = flag:physician days = 15 } + + #...or in notification + if = { + limit = { + liege ?= { this != scope:sick_character } + } + liege = { + send_interface_message = { #Should be feed message, because it's not hugely important + type = event_court_physician_good + title = physician_level_up_chance_effect.t + left_icon = scope:physician + physician_rank_up_tooltip_effect = yes + } + } + } + } + } +} + +#Needs argument CHANCE +mystic_level_up_chance_effect = { + if = { + limit = { + NAND = { + has_trait = lifestyle_mystic + has_trait_xp = { + trait = lifestyle_mystic + value >= 100 + } + } + is_alive = yes + } + random = { + chance = $CHANCE$ + ai_mystic_lifestyle_rank_up_effect = yes + + #Used by physician_rank_up_tooltip_effect, to be shown in treatment outcome... + set_variable = { name = physician_level_up value = flag:mystic days = 15 } + + #...or in notification + if = { + limit = { + liege ?= { this != scope:sick_character } + } + liege = { + send_interface_message = { + type = event_court_physician_good + title = physician_level_up_chance_effect.t + left_icon = scope:physician + physician_rank_up_tooltip_effect = yes + } + } + } + + #Have a tiny chance to become witch + hidden_effect = { + if = { + limit = { + is_ai = yes + NOR = { + any_secret = { type = secret_witch } + has_trait = witch + } + } + random = { + modifier = { + factor = 0 + ai_zeal >= medium_positive_ai_value + } + modifier = { + factor = 2 + ai_zeal <= high_negative_ai_value #high and not medium because mystic traits already remove some ai_zeal + } + chance = 5 + give_witch_secret_or_trait_effect = yes + } + } + } + } + } +} + + + + +###DISEASE TREATMENT OPTIONS### + +safe_disease_treatment_effect = { + $TREATMENT_PICKER$ = { save_scope_as = treatment_picker } + $PATIENT$ = { + custom_tooltip = safe_diseaste_treatment.tt + + hidden_effect = { + save_court_physician_as_effect = { SCOPE_NAME = physician } + + if = { + limit = { + NOT = { exists = scope:sick_character } + } + save_scope_as = sick_character + } #If a sick character was not already saved we save the patient as Sick Character here + + if = { + limit = { + exists = scope:physician + court_physician_available_trigger = yes + } + + #Physician skill up + scope:physician = { + random_list = { + 90 = { #physician + trigger = { + NAND = { + has_trait = lifestyle_physician + has_trait_xp = { + trait = lifestyle_physician + value >= 100 + } + } + } + physician_level_up_chance_effect = { CHANCE = 10 } + } + 10 = { #Mystic + trigger = { + NOR = { + AND = { + has_trait = lifestyle_mystic + has_trait_xp = { + trait = lifestyle_mystic + value >= 100 + } + } + AND = { #Because then this would be the only option which is weird + has_trait = lifestyle_physician + has_trait_xp = { + trait = lifestyle_physician + value >= 100 + } + } + } + OR = { + NAND = { #Either, this is my first rank up + has_trait = lifestyle_physician + has_trait = lifestyle_mystic + } + has_trait = lifestyle_mystic #I have already chosen this path + } + } + modifier = { + has_trait = lifestyle_mystic + factor = 2 + } + modifier = { + ai_zeal >= medium_positive_ai_value + factor = 0 + } + mystic_level_up_chance_effect = { CHANCE = 10 } + } + } + } + + # OUTCOME RANDOMIZATION + random_list = { + 70 = { # Success + modifier = { + factor = scope:physician.physician_safe_treatment_skill_factor + # 1 for an average learning skill character without traits + # 0.2 min for low learning + # ~3 for high skill character without traits + # ~12 for high skill character with best trait (physician_3) + } + modifier = { # Bump the death numbers a bit + $PATIENT$ = { is_ruler = no } + factor = 0.8 + } + modifier = { # Pool characters should die more + $PATIENT$ = { is_pool_character = yes } + factor = 0.2 + } + trigger_event = health.3103 #Safe treatment sucess + } + 30 = { # Failure + trigger_event = health.3104 #Safe treatment failure + } + 70 = { # Failure on purpose + trigger = { + court_physician_can_fail_on_purpose_trigger = yes + } + opinion_modifier = { + who = scope:physician + opinion_target = scope:sick_character + multiplier = -1 # Adds 100 for -100 opinion + } + modifier = { + factor = { #To keep it scaling with success + add = scope:physician.physician_safe_treatment_skill_factor + divide = 2 + } + } + modifier = { #Are they already trying to kill you? + add = 40 + scope:sick_character = { + any_targeting_scheme = { + scheme_type = murder + OR = { + scheme_owner = scope:physician + any_scheme_agent_character = { this = scope:physician } + } + } + } + } + + trigger_event = health.3104 #Safe treatment failure + } + } + } + } + } +} + + +risky_disease_treatment_effect = { + $TREATMENT_PICKER$ = { save_scope_as = treatment_picker } + $PATIENT$ = { + custom_tooltip = risky_diseaste_treatment.tt + + scope:treatment_picker = { + stress_impact = { + craven = medium_stress_impact_gain + content = minor_stress_impact_gain + } + } + + hidden_effect = { + save_court_physician_as_effect = { SCOPE_NAME = physician } + + if = { + limit = { + exists = scope:physician + court_physician_available_trigger = yes + } + + #Physician skill up + scope:physician = { + physician_level_up_chance_effect = { CHANCE = 10 } + } + + random_list = { + 1 = { #Success + modifier = { + scope:physician = { + learning >= mediocre_skill_rating + learning < medium_skill_rating + } + factor = 2 + } + modifier = { + scope:physician = { + learning >= medium_skill_rating + learning < decent_skill_rating + } + factor = 4 + } + modifier = { + scope:physician = { + learning >= decent_skill_rating + learning < high_skill_rating + } + factor = 7 + } + modifier = { + scope:physician = { + learning >= high_skill_rating + } + factor = 10 + } + modifier = { + scope:physician = { has_trait = lifestyle_physician } + factor = 2 + } + modifier = { + scope:physician = { + has_trait = lifestyle_physician + has_trait_xp = { + trait = lifestyle_physician + value >= 50 + } + } + factor = 5 + } + modifier = { + scope:physician = { + has_trait = lifestyle_physician + has_trait_xp = { + trait = lifestyle_physician + value >= 100 + } + } + factor = 5 + } + # Liege Perk bonus + modifier = { + exists = scope:physician.liege + scope:physician.liege = { + has_perk = anatomical_studies_perk + } + factor = 2 + } + modifier = { # Bump the death numbers a bit + $PATIENT$ = { is_ruler = no } + factor = 0.8 + } + modifier = { # Pool characters should die more + $PATIENT$ = { is_pool_character = yes } + factor = 0.2 + } + + #Critical or normal success? + random_list = { + 1 = { + modifier = { + scope:physician = { has_trait = lifestyle_physician } + factor = 2 + } + modifier = { + scope:physician = { + has_trait = lifestyle_physician + has_trait_xp = { + trait = lifestyle_physician + value >= 50 + } + } + factor = 2 + } + modifier = { + scope:physician = { + has_trait = lifestyle_physician + has_trait_xp = { + trait = lifestyle_physician + value >= 100 + } + } + factor = 2 + } + modifier = { + scope:disease_type = flag:leper + factor = 0 + } + modifier = { + scope:disease_type = flag:cancer + factor = 0.2 + } + # Liege Perk bonus + modifier = { + exists = scope:physician.liege + scope:physician.liege = { + has_perk = anatomical_studies_perk + } + factor = 2 + } + trigger_event = health.3105 #Critical success + } + 5 = { + trigger_event = health.3106 #Normal success + } + } + } + 10 = { #Failure + trigger_event = health.3107 #Failure + } + 5 = { #Failure on purpose + trigger = { + court_physician_can_fail_on_purpose_trigger = yes + } + modifier = { + OR = { + has_relation_rival = scope:physician + reverse_opinion = { + target = scope:physician + value <= -20 + } + } + factor = 2 + } + modifier = { #Are they already trying to kill you? + add = 40 + scope:sick_character = { + any_targeting_scheme = { + scheme_type = murder + OR = { + scheme_owner = scope:physician + any_scheme_agent_character = { this = scope:physician } + } + } + } + } + trigger_event = health.3107 #Risky treatment failure + } + } + } + } + } +} + +mystic_disease_treatment_effect = { + $TREATMENT_PICKER$ = { save_scope_as = treatment_picker } + $PATIENT$ = { + custom_tooltip = mystic_diseaste_treatment.tt + + scope:treatment_picker = { + stress_impact = { + paranoid = minor_stress_impact_gain + zealous = major_stress_impact_gain + craven = medium_stress_impact_gain + } + } + + hidden_effect = { + save_court_physician_as_effect = { SCOPE_NAME = physician } + + if = { + limit = { + exists = scope:physician + court_physician_available_trigger = yes + } + #Physician skill up + scope:physician = { + mystic_level_up_chance_effect = { CHANCE = 15 } + } + } + else = { + debug_log = "No Physician existed in a mystic_treatment_effect! Why was the option even available?" + } + + random_list = { + 1 = { #Success + modifier = { + scope:physician = { + learning >= mediocre_skill_rating + learning < medium_skill_rating + } + factor = 2 + } + modifier = { + scope:physician = { + learning >= medium_skill_rating + learning < decent_skill_rating + } + factor = 4 + } + modifier = { + scope:physician = { + learning >= decent_skill_rating + learning < high_skill_rating + } + factor = 7 + } + modifier = { + scope:physician = { + learning >= high_skill_rating + } + factor = 10 + } + modifier = { + scope:physician = { has_trait = lifestyle_mystic } + factor = 2 + } + modifier = { + scope:physician = { + has_trait = lifestyle_mystic + has_trait_xp = { + trait = lifestyle_mystic + value >= 50 + } + } + factor = 5 + } + modifier = { + scope:physician = { + has_trait = lifestyle_mystic + has_trait_xp = { + trait = lifestyle_mystic + value >= 50 + } + } + factor = 5 + } + # Liege Perk bonus + modifier = { + scope:physician.liege = { + has_perk = anatomical_studies_perk + } + factor = 2 + } + modifier = { # Bump the death numbers a bit + $PATIENT$ = { is_ruler = no } + factor = 0.8 + } + modifier = { # Pool characters should die more + $PATIENT$ = { is_pool_character = yes } + factor = 0.2 + } + + #Critical or normal success? + random_list = { + 1 = { + modifier = { + scope:physician = { has_trait = lifestyle_physician } + factor = 1.5 + } + modifier = { + scope:physician = { + has_trait = lifestyle_physician + has_trait_xp = { + trait = lifestyle_physician + value >= 50 + } + } + factor = 2 + } + modifier = { + scope:physician = { + has_trait = lifestyle_physician + has_trait_xp = { + trait = lifestyle_physician + value >= 50 + } + } + factor = 3 + } + modifier = { + is_adult = no + factor = 0 + } + modifier = { + scope:disease_type = flag:leper + factor = 0 + } + modifier = { + scope:disease_type = flag:cancer + factor = 0.1 + } + + # Liege Perk bonus + modifier = { + scope:physician.liege = { + has_perk = anatomical_studies_perk + } + factor = 2 + } + + trigger_event = health.3108 #Critical success + } + 5 = { + trigger_event = health.3109 #Normal success + } + } + } + 10 = { #Failure + trigger_event = health.3110 #Failure + } + 5 = { #Failure on purpose + trigger = { + court_physician_can_fail_on_purpose_trigger = yes + } + modifier = { + OR = { + has_relation_rival = scope:physician + reverse_opinion = { + target = scope:physician + value <= -20 + } + } + factor = 2 + } + modifier = { #Are they already trying to kill you? + add = 40 + scope:sick_character = { + any_targeting_scheme = { + scheme_type = murder + OR = { + scheme_owner = scope:physician + any_scheme_agent_character = { this = scope:physician } + } + } + } + } + trigger_event = health.3110 #Failure + } + } + } + } +} + +no_disease_treatment_effect = { + custom_tooltip = no_treatment_effect.tt +} + +find_court_physician_effect = { + custom_tooltip = health.3101.e.tt + hidden_effect = { + # Stop AI taking physicians via event, since they've got an AI prioritisation system to work with. + ## We do this in the effect rather than elsewhere for script hygiene. + if = { + limit = { is_ai = no } + add_character_flag = { flag = already_sick days = 30 } + add_character_flag = { flag = searching_for_physician days = court_physician_search_max } + trigger_event = { + id = health.3001 days = { court_physician_search_min court_physician_search_max } + } + } + } +} + +deny_treatment_effect = { + $TREATMENT_PICKER$ = { save_scope_as = treatment_picker } + $PATIENT$ = { + custom_tooltip = deny_treatment_effect.tt + + add_opinion = { + target = root + modifier = cruelty_opinion + opinion = -20 + } + } +} + + +###WOUND TREATMENT OPTIONS### + +safe_wound_treatment_effect = { + custom_tooltip = safe_wound_treatment.tt + + hidden_effect = { + save_court_physician_as_effect = { SCOPE_NAME = physician } + + if = { + limit = { + exists = scope:physician + court_physician_available_trigger = yes + } + + #Physician skill up + scope:physician = { + if = { + limit = { + NAND = { + has_trait = lifestyle_physician + has_trait_xp = { + trait = lifestyle_physician + value >= 100 + } + } + } + physician_level_up_chance_effect = { CHANCE = 10 } + } + } + + random_list = { + 10 = { #Success + modifier = { + scope:physician = { + learning >= mediocre_skill_rating + learning < medium_skill_rating + } + factor = 2 + } + modifier = { + scope:physician = { + learning >= medium_skill_rating + learning < decent_skill_rating + } + factor = 4 + } + modifier = { + scope:physician = { + learning >= decent_skill_rating + learning < high_skill_rating + } + factor = 7 + } + modifier = { + scope:physician = { + learning >= high_skill_rating + } + factor = 10 + } + modifier = { + scope:physician = { has_trait = lifestyle_physician } + factor = 2 + } + modifier = { + scope:physician = { + has_trait = lifestyle_physician + has_trait_xp = { + trait = lifestyle_physician + value >= 50 + } + } + factor = 2 + } + modifier = { + scope:physician = { + has_trait = lifestyle_physician + has_trait_xp = { + trait = lifestyle_physician + value >= 100 + } + } + factor = 4 + } + if = { + limit = { + has_trait = wounded_1 + } + trigger_event = { + id = health.0100 + days = { 2 3 } + } + } + else = { + trigger_event = health.4101 #Safe treatment success + } + } + 50 = { #Failure + if = { + limit = { + has_trait = wounded_1 + } + trigger_event = { + id = health.0101 + days = { 2 3 } + } + } + else = { + trigger_event = health.4102 #Safe treatment failure + } + } + } + } + } +} + + +risky_wound_treatment_effect = { + custom_tooltip = risky_wound_treatment.tt + + hidden_effect = { + save_court_physician_as_effect = { SCOPE_NAME = physician } + + if = { + limit = { + exists = scope:physician + court_physician_available_trigger = yes + } + + #Physician skill up + scope:physician = { + physician_level_up_chance_effect = { CHANCE = 10 } + } + + random_list = { + 1 = { #Success + modifier = { + scope:physician = { + learning >= mediocre_skill_rating + learning < medium_skill_rating + } + factor = 2 + } + modifier = { + scope:physician = { + learning >= medium_skill_rating + learning < decent_skill_rating + } + factor = 4 + } + modifier = { + scope:physician = { + learning >= decent_skill_rating + learning < high_skill_rating + } + factor = 7 + } + modifier = { + scope:physician = { + learning >= high_skill_rating + } + factor = 10 + } + modifier = { + scope:physician = { has_trait = lifestyle_physician } + factor = 2 + } + modifier = { + scope:physician = { + has_trait = lifestyle_physician + has_trait_xp = { + trait = lifestyle_physician + value >= 50 + } + } + factor = 2 + } + modifier = { + scope:physician = { + has_trait = lifestyle_physician + has_trait_xp = { + trait = lifestyle_physician + value >= 100 + } + } + factor = 4 + } + + modifier = { #Gangrene! Lower chance of success + factor = 0.5 + has_character_modifier = gangrene_modifier + } + + #Critical or normal success? + random_list = { + 1 = { + modifier = { + scope:physician = { has_trait = lifestyle_physician } + factor = 2 + } + modifier = { + scope:physician = { + has_trait = lifestyle_physician + has_trait_xp = { + trait = lifestyle_physician + value >= 50 + } + } + factor = 2 + } + modifier = { + scope:physician = { + has_trait = lifestyle_physician + has_trait_xp = { + trait = lifestyle_physician + value >= 100 + } + } + factor = 2 + } + modifier = { + has_character_modifier = infected_wound_modifier + factor = 0.7 + } + modifier = { #Gangrene! Lower chance of critical success + has_character_modifier = gangrene_modifier + factor = 0.7 + } + trigger_event = health.4103 #Critical success + } + 5 = { + trigger_event = health.4104 #Normal success + } + } + } + 10 = { #Failure + trigger_event = health.4105 #Failure + } + } + } + } +} + + + +###DISEASE TREATMENT OUTCOMES### + +set_worst_disease_effect = { + if = { + limit = { has_trait = bubonic_plague } + save_scope_value_as = { + name = disease_type + value = flag:bubonic_plague + } + } + else_if = { + limit = { has_trait = cancer } + save_scope_value_as = { + name = disease_type + value = flag:cancer + } + } + else_if = { + limit = { has_trait = smallpox } + save_scope_value_as = { + name = disease_type + value = flag:smallpox + } + } + else_if = { + limit = { has_trait = measles } + save_scope_value_as = { + name = disease_type + value = flag:measles + } + } + else_if = { + limit = { has_trait = dysentery } + save_scope_value_as = { + name = disease_type + value = flag:dysentery + } + } + else_if = { + limit = { has_trait = ergotism } + save_scope_value_as = { + name = disease_type + value = flag:ergotism + } + } + else_if = { + limit = { has_trait = consumption } + save_scope_value_as = { + name = disease_type + value = flag:consumption + } + } + else_if = { + limit = { has_trait = typhus } + save_scope_value_as = { + name = disease_type + value = flag:typhus + } + } + else_if = { + limit = { has_trait = great_pox } + save_scope_value_as = { + name = disease_type + value = flag:great_pox + } + } + else_if = { + limit = { has_trait = pneumonic } + save_scope_value_as = { + name = disease_type + value = flag:pneumonic + } + } + else_if = { + limit = { has_trait = leper } + save_scope_value_as = { + name = disease_type + value = flag:leper + } + } + else_if = { + limit = { has_trait = gout_ridden } + save_scope_value_as = { + name = disease_type + value = flag:gout_ridden + } + } + else_if = { + limit = { has_trait = ill } + save_scope_value_as = { + name = disease_type + value = flag:ill + } + } +} + +add_disease_treatment_modifier_effect = { + #Treatment length depends on whether the disease has a short or long duration + #Successful treatments come in two strengths per treatment type, low for diseases with low health penalty and high for diseases with high health penalty + #Negative treatments only have one strength per treatment type + #Successful safe treatments remove most of the penalty for low -health diseases but only 1/2-1/4 of penalty for high -health diseases + #Successful risky/mystic treatments remove almost all of the penalty for all diseases (with plague being the main exception, that penalty is roughly halved) + #Safe treatment:success + + save_temporary_scope_value_as = { + name = treatment_result_treatment + value = flag:$TREATMENT$ + } + save_temporary_scope_value_as = { + name = treatment_result_outcome + value = flag:$OUTCOME$ + } + + #SAFE TREATMENT: SUCCESS + if = { + limit = { + scope:treatment_result_treatment = flag:safe + scope:treatment_result_outcome = flag:success + } + if = { + limit = { + has_short_disease_type_trigger = yes + has_high_health_penalty_disease_type_trigger = yes + } + add_character_modifier = { modifier = safe_disease_treatment_success_high_modifier days = disease_treatment_short_duration } + } + else_if = { + limit = { + has_short_disease_type_trigger = no + has_high_health_penalty_disease_type_trigger = yes + } + add_character_modifier = { modifier = safe_disease_treatment_success_high_modifier days = disease_treatment_long_duration } + } + else_if = { + limit = { + has_short_disease_type_trigger = yes + has_high_health_penalty_disease_type_trigger = no + } + add_character_modifier = { modifier = safe_disease_treatment_success_low_modifier days = disease_treatment_short_duration } + } + else_if = { + limit = { + has_short_disease_type_trigger = no + has_high_health_penalty_disease_type_trigger = no + } + add_character_modifier = { modifier = safe_disease_treatment_success_low_modifier days = disease_treatment_long_duration } + } + } + #SAFE TREATMENT: FAILURE + else_if = { + limit = { + scope:treatment_result_treatment = flag:safe + scope:treatment_result_outcome = flag:failure + } + if = { + limit = { has_short_disease_type_trigger = yes } + add_character_modifier = { modifier = safe_disease_treatment_failure_modifier days = disease_treatment_short_duration } + } + else_if = { + limit = { has_short_disease_type_trigger = no } + add_character_modifier = { modifier = safe_disease_treatment_failure_modifier days = disease_treatment_long_duration } + } + } + #RISKY & MYSTIC TREATMENT: CRITICAL SUCCESS + else_if = { + limit = { + OR = { + scope:treatment_result_treatment = flag:risky + scope:treatment_result_treatment = flag:mystic #A succcessful mystic treatment shouldn't be noticeable from the outside, so using same modifiers + } + scope:treatment_result_outcome = flag:critical_success + } + + #General cooldown + add_character_flag = { + flag = contraction_cooldown_general + years = 2 + } + + if = { + limit = { scope:disease_type = flag:consumption } + remove_trait_force_tooltip = consumption + add_character_flag = { flag = contraction_cooldown_consumption years = 20 } + } + else_if = { + limit = { scope:disease_type = flag:cancer } + remove_trait_force_tooltip = cancer + add_character_flag = { flag = contraction_cooldown_cancer years = 20 } + } + else_if = { + limit = { scope:disease_type = flag:great_pox } + remove_trait_force_tooltip = great_pox + add_character_flag = { flag = contraction_cooldown_great_pox years = 20 } + } + else_if = { + limit = { scope:disease_type = flag:gout_ridden } + remove_trait_force_tooltip = gout_ridden + add_character_flag = { flag = contraction_cooldown_gout_ridden years = 20 } + } + else_if = { + limit = { scope:disease_type = flag:ill } + remove_trait_force_tooltip = ill + #No cooldown, common disease + } + else_if = { + limit = { scope:disease_type = flag:pneumonic } + remove_trait_force_tooltip = pneumonic + add_character_flag = { flag = contraction_cooldown_pneumonic years = 20 } + } + else_if = { + limit = { scope:disease_type = flag:typhus } + remove_trait_force_tooltip = typhus + add_character_flag = { flag = contraction_cooldown_typhus years = 20 } + } + else_if = { + limit = { scope:disease_type = flag:measles } + remove_trait_force_tooltip = measles + #No cooldown, immunity + } + else_if = { + limit = { scope:disease_type = flag:dysentery } + remove_trait_force_tooltip = dysentery + add_character_flag = { flag = contraction_cooldown_dysentery years = 20 } + } + else_if = { + limit = { scope:disease_type = flag:ergotism } + remove_trait_force_tooltip = ergotism + add_character_flag = { flag = contraction_cooldown_ergotism years = 20 } + } + else_if = { + limit = { scope:disease_type = flag:smallpox } + remove_trait_force_tooltip = smallpox + #No cooldown, immunity + } + else_if = { + limit = { scope:disease_type = flag:bubonic_plague } + remove_trait_force_tooltip = bubonic_plague + #No cooldown, immunity + } + } + + #RISKY & MYSTIC TREATMENT: SUCCESS + else_if = { + limit = { + OR = { + scope:treatment_result_treatment = flag:risky + scope:treatment_result_treatment = flag:mystic #A succcessful mystic treatment shouldn't be noticeable from the outside, so using same modifiers + } + scope:treatment_result_outcome = flag:success + } + if = { + limit = { + has_short_disease_type_trigger = yes + has_high_health_penalty_disease_type_trigger = yes + } + add_character_modifier = { modifier = risky_disease_treatment_success_high_modifier days = disease_treatment_short_duration } + } + else_if = { + limit = { + has_short_disease_type_trigger = no + has_high_health_penalty_disease_type_trigger = yes + } + add_character_modifier = { modifier = risky_disease_treatment_success_high_modifier days = disease_treatment_long_duration } + } + else_if = { + limit = { + has_short_disease_type_trigger = yes + has_high_health_penalty_disease_type_trigger = no + } + add_character_modifier = { modifier = risky_disease_treatment_success_low_modifier days = disease_treatment_short_duration } + } + else_if = { + limit = { + has_short_disease_type_trigger = no + has_high_health_penalty_disease_type_trigger = no + } + add_character_modifier = { modifier = risky_disease_treatment_success_low_modifier days = disease_treatment_long_duration } + } + } + # RISKY TREATMENT FAILURE + else_if = { + limit = { + scope:treatment_result_treatment = flag:risky + scope:treatment_result_outcome = flag:failure + } + if = { + limit = { has_short_disease_type_trigger = yes } + add_character_modifier = { modifier = risky_disease_treatment_failure_modifier days = disease_treatment_short_duration } + } + else_if = { + limit = { has_short_disease_type_trigger = no } + add_character_modifier = { modifier = risky_disease_treatment_failure_modifier days = disease_treatment_long_duration } + } + } +} + + +disease_treatment_result_tooltip_effect = { + save_temporary_scope_value_as = { + name = treatment_result_treatment + value = flag:$TREATMENT$ + } + save_temporary_scope_value_as = { + name = treatment_result_outcome + value = flag:$OUTCOME$ + } + #Show death or treatment outcome + if = { + limit = { scope:sick_character = { is_alive = no } } + custom_tooltip = health.3200.death.tt + } + else = { + show_as_tooltip = { + scope:sick_character = { + add_disease_treatment_modifier_effect = { TREATMENT = $TREATMENT$ OUTCOME = $OUTCOME$ } + + #Risky + if = { + limit = { has_variable = treatment_strategy } + if = { + limit = { var:treatment_strategy = flag:amputation } + add_trait_force_tooltip = one_legged + } + else_if = { + limit = { var:treatment_strategy = flag:disfigurement } + add_trait_force_tooltip = disfigured + } + else_if = { + limit = { var:treatment_strategy = flag:eye } + add_trait_force_tooltip = one_eyed + } + else_if = { + limit = { + var:treatment_strategy = flag:castration + age >= 12 + } + add_trait_force_tooltip = eunuch_1 + } + else_if = { + limit = { + var:treatment_strategy = flag:castration + age < 12 + } + add_trait_force_tooltip = beardless_eunuch + } + } + if = { + limit = { has_variable = mystic_side_effect } + #Mystic + if = { + limit = { var:mystic_side_effect = flag:lunatic } + add_trait_force_tooltip = lunatic_1 + } + else_if = { + limit = { var:mystic_side_effect = flag:possessed } + add_trait_force_tooltip = possessed_1 + } + else_if = { + limit = { var:mystic_side_effect = flag:dull } + add_trait_force_tooltip = dull + } + else_if = { + limit = { var:mystic_side_effect = flag:craven } + add_trait_force_tooltip = craven + } + else_if = { + limit = { var:mystic_side_effect = flag:paranoid } + add_trait_force_tooltip = paranoid + } + else_if = { + limit = { var:mystic_side_effect = flag:massive_stress_gain } + add_stress = massive_stress_gain + } + } + } + } + } +} + +disease_treatment_results_effect = { + save_temporary_scope_value_as = { + name = treatment_result_treatment + value = flag:$TREATMENT$ + } + save_temporary_scope_value_as = { + name = treatment_result_outcome + value = flag:$OUTCOME$ + } + + #APPLY MODIFIERS (OR REMOVE TRAITS) + add_disease_treatment_modifier_effect = { TREATMENT = $TREATMENT$ OUTCOME = $OUTCOME$ } + + #RISKY TREATMENT: DETERMINING TREATMENT STRATEGY AND REMOVING BODY PART + if = { + limit = { scope:treatment_result_treatment = flag:risky } + random_list = { + 1 = { #Medicine + trigger = { + OR = { #Only use for cancer if no body part can be removed + NOT = { scope:disease_type ?= flag:cancer } + AND = { + scope:disease_type ?= flag:cancer + has_trait = one_eyed + has_trait = one_legged + has_trait = disfigured + OR = { + is_female = yes + is_eunuch_trigger = yes + } + } + } + } + set_variable = { + name = treatment_strategy + value = flag:medicine + days = 30 + } + } + 1 = { #Amputation + trigger = { + NOT = { has_trait = one_legged } + OR = { + has_amputation_type_disease_trigger = yes + AND = { + scope:treatment_result_outcome = flag:failure + scope:physician = { NOT = { has_trait = lifestyle_physician } } + } + } + } + add_trait_force_tooltip = one_legged + increase_wounds_no_death_effect = { REASON = treatment } + set_variable = { + name = treatment_strategy + value = flag:amputation + days = 30 + } + if = { + limit = { has_amputation_type_disease_trigger = no } + add_character_flag = { flag = physician_used_wrong_method days = 30 } + } + } + 1 = { #Disfigurement + trigger = { + NOT = { has_trait = disfigured } + OR = { + has_disfigurement_type_disease_trigger = yes + AND = { + scope:treatment_result_outcome = flag:failure + scope:physician = { NOT = { has_trait = lifestyle_physician } } + } + } + } + add_trait_force_tooltip = disfigured + increase_wounds_no_death_effect = { REASON = treatment } + set_variable = { + name = treatment_strategy + value = flag:disfigurement + days = 30 + } + if = { + limit = { has_disfigurement_type_disease_trigger = no } + add_character_flag = { flag = physician_used_wrong_method days = 30 } + } + } + 1 = { #Castration + trigger = { + is_male = yes + is_eunuch_trigger = no + OR = { + scope:disease_type ?= flag:cancer + AND = { + scope:treatment_result_outcome = flag:failure + scope:physician = { NOT = { has_trait = lifestyle_physician } } + } + } + } + if = { + limit = { + age >= 12 + } + add_trait_force_tooltip = eunuch_1 + } + else = { + add_trait_force_tooltip = beardless_eunuch + } + + increase_wounds_no_death_effect = { REASON = treatment } + set_variable = { + name = treatment_strategy + value = flag:castration + days = 30 + } + if = { + limit = { NOT = { scope:disease_type ?= flag:cancer } } + add_character_flag = { flag = physician_used_wrong_method days = 30 } + } + } + 1 = { #Remove eye + trigger = { + NOT = { has_trait = one_eyed } + OR = { + scope:disease_type ?= flag:cancer + AND = { + scope:treatment_result_outcome = flag:failure + scope:physician = { NOT = { has_trait = lifestyle_physician } } + } + } + } + add_trait_force_tooltip = one_eyed + increase_wounds_no_death_effect = { REASON = treatment } + set_variable = { + name = treatment_strategy + value = flag:eye + days = 30 + } + if = { + limit = { NOT = { scope:disease_type ?= flag:cancer } } + add_character_flag = { flag = physician_used_wrong_method days = 30 } + } + } + } + } + + #RISKY TREATMENT FAILURE: DEATH? + if = { + limit = { + scope:treatment_result_treatment = flag:risky + scope:treatment_result_outcome = flag:failure + } + if = { + limit = { + OR = { + AND = { #Dies from wound upgrading past lvl 3 + has_trait = wounded_3 + AND = { + has_variable = treatment_strategy + OR = { + var:treatment_strategy = flag:amputation + var:treatment_strategy = flag:disfigurement + var:treatment_strategy = flag:eye + var:treatment_strategy = flag:castration + } + } + } + AND = { + is_ai = yes + health <= 0 + } + } + } + add_character_flag = die_risky_treatment + } + } + + #MYSTIC TREATMENT: OCCULT OR SIMPLY QUESTIONABLE TREATMENT + if = { + limit = { scope:treatment_result_treatment = flag:mystic } + random_list = { + 100 = { #Occult + modifier = { + scope:physician = { + OR = { + any_secret = { type = secret_witch } + has_trait = witch + } + } + factor = 10 + } + random_list = { + 10 = { #Regular occult + hidden_effect = { + set_variable = { + name = treatment_strategy + value = flag:occult + days = 30 + } + } + } + 2 = { #Cannibal occult + trigger = { + NOR = { + has_trait = cannibal + any_secret = { type = secret_cannibal } + } + } + hidden_effect = { + set_variable = { + name = treatment_strategy + value = flag:occult_cannibal + days = 30 + } + } + give_cannibal_secret_or_trait_effect = yes + } + 2 = { #Deviant occult + trigger = { + is_adult = yes + NOR = { + has_trait = deviant + any_secret = { type = secret_deviant } + } + NOT = { scope:treatment_result_outcome = flag:failure } + } + hidden_effect = { + set_variable = { + name = treatment_strategy + value = flag:occult_deviant + days = 30 + } + } + give_deviant_secret_or_trait_effect = yes + } + } + } + 50 = { #Questionable + hidden_effect = { + set_variable = { + name = treatment_strategy + value = flag:questionable + days = 30 + } + } + } + } + + #MYSTIC TREATMENT: SPECIAL EFFECTS + if = { + limit = { scope:treatment_result_outcome = flag:failure } + random_list = { + 10 = { + trigger = { NOT = { has_trait = lunatic } } + set_variable = { + name = mystic_side_effect + value = flag:lunatic + days = 30 + } + add_trait_force_tooltip = lunatic_1 + } + 10 = { + trigger = { NOT = { has_trait = possessed } } + set_variable = { + name = mystic_side_effect + value = flag:possessed + days = 30 + } + add_trait_force_tooltip = possessed_1 + } + 10 = { + trigger = { + NOR = { + has_trait = dull + has_trait = intellect_good + has_trait = shrewd + } + } + set_variable = { + name = mystic_side_effect + value = flag:dull + days = 30 + } + add_trait_force_tooltip = dull + } + 10 = { + trigger = { NOT = { has_trait = craven } } + set_variable = { + name = mystic_side_effect + value = flag:craven + days = 30 + } + add_trait_force_tooltip = craven + } + 10 = { + trigger = { NOT = { has_trait = paranoid } } + set_variable = { + name = mystic_side_effect + value = flag:paranoid + days = 30 + } + add_trait_force_tooltip = paranoid + } + 15 = { + set_variable = { + name = mystic_side_effect + value = flag:massive_stress_gain + days = 30 + } + add_stress = massive_stress_gain + } + } + } + + #Stress for occult treatments + if = { + limit = { has_variable = treatment_strategy } + if = { + limit = { var:treatment_strategy = flag:occult } + stress_impact = { + zealous = major_stress_impact_gain + } + } + else_if = { + limit = { var:treatment_strategy = flag:occult_cannibal } + stress_impact = { + zealous = major_stress_impact_gain + compassionate = major_stress_impact_gain + } + } + else_if = { + limit = { var:treatment_strategy = flag:occult_deviant } + stress_impact = { + zealous = major_stress_impact_gain + chaste = major_stress_impact_gain + } + } + } + } + + #RETURN VISIT TO THE DOCTOR! + hidden_effect = { + if = { + limit = { + NOT = { #Risky/mystic critical success cures completely, no need for another visit + scope:treatment_result_outcome = flag:critical_success + } + } + if = { + limit = { has_short_disease_type_trigger = yes } + trigger_event = { + id = health.3100 #Sends health.3101 to me or 3102 to liege + days = disease_treatment_short_duration_plus_1 + } + } + else = { + trigger_event = { + id = health.3100 #Sends health.3101 to me or 3102 to liege + days = disease_treatment_long_duration_plus_1 + } + } + } + } + + #FAILED TREATMENT OPINIONS + if = { + limit = { + scope:treatment_result_outcome = flag:failure + OR = { + scope:treatment_result_treatment = flag:risky + scope:treatment_result_treatment = flag:mystic + } + } + add_failed_treatment_of_kin_opinions_effect = yes + } + + physician_rank_up_tooltip_effect = yes #Shows trait gain if physician ranked up +} + + + + + +###WOUND TREATMENT OUTCOMES### + +add_wound_treatment_modifier_effect = { + save_temporary_scope_value_as = { + name = treatment_result_treatment + value = flag:$TREATMENT$ + } + save_temporary_scope_value_as = { + name = treatment_result_outcome + value = flag:$OUTCOME$ + } + + + ###SUCCESS### + if = { + limit = { + OR = { + scope:treatment_result_outcome = flag:success + scope:treatment_result_outcome = flag:critical_success + } + } + #Infection is always removed + if = { + limit = { has_character_modifier = infected_wound_modifier } + remove_character_modifier = infected_wound_modifier + save_scope_value_as = { + name = infection + value = yes + } + } + #Gangrene is removed if you picked risky + else_if = { + limit = { + has_character_modifier = gangrene_modifier + scope:treatment_result_treatment = flag:risky + } + remove_character_modifier = gangrene_modifier + save_scope_value_as = { + name = gangrene + value = yes + } + } + + + #Applying correct modifier or removing correct trait (unless there's still an active treatment, could happen if you got treated for a wound and then got infection/gangrene) + if = { + limit = { has_recent_wound_treatment_trigger = no } + + #Safe treatment + if = { + limit = { scope:treatment_result_treatment = flag:safe } + + #Add modifier or remove wounded_1 trait + if = { + limit = { has_character_modifier = gangrene_modifier } + add_character_modifier = { modifier = safe_wound_treatment_success_high_modifier days = wound_treatment_success_duration } + } + else_if = { + limit = { has_trait = wounded_1 } + remove_trait = wounded_1 + } + else_if = { + limit = { + OR = { + has_trait = wounded_2 + has_trait = wounded_3 + } + } + add_character_modifier = { modifier = safe_wound_treatment_success_low_modifier days = wound_treatment_success_duration } + } + } + + #Risky treatment critical success + else_if = { + limit = { + scope:treatment_result_treatment = flag:risky + scope:treatment_result_outcome = flag:critical_success + } + #Remove a trait level + if = { + limit = { has_trait = wounded_1 } + remove_trait = wounded_1 + } + else_if = { + limit = { has_trait = wounded_2 } + remove_trait = wounded_2 #We do it like this so you can see the trait you've lost + add_trait = wounded_1 + } + else_if = { + limit = { has_trait = wounded_3 } + remove_trait = wounded_3 + add_trait = wounded_2 + } + } + + #Risky treatment regular success + else_if = { + limit = { + scope:treatment_result_treatment = flag:risky + scope:treatment_result_outcome = flag:critical_success + } + add_character_modifier = { modifier = risky_wound_treatment_success_modifier days = wound_treatment_success_duration } + } + } + } + ###FAILURE### + else_if = { + limit = { scope:treatment_result_outcome = flag:failure } + + #Safe treatment failure + if = { + limit = { scope:treatment_result_treatment = flag:safe } + add_character_modifier = { modifier = safe_wound_treatment_failure_modifier days = wound_treatment_failure_duration } + } + if = { + limit = { scope:treatment_result_treatment = flag:risky } + add_character_modifier = { modifier = risky_wound_treatment_failure_modifier days = wound_treatment_failure_duration } + } + } +} + + + +wound_treatment_result_tooltip_effect = { + save_temporary_scope_value_as = { + name = treatment_result_treatment + value = flag:$TREATMENT$ + } + save_temporary_scope_value_as = { + name = treatment_result_outcome + value = flag:$OUTCOME$ + } + #Show death or treatment outcome + if = { + limit = { scope:sick_character = { is_alive = no } } + custom_tooltip = health.3200.death.tt + } + else = { + show_as_tooltip = { + scope:sick_character = { + add_wound_treatment_modifier_effect = { TREATMENT = $TREATMENT$ OUTCOME = $OUTCOME$ } + + if = { + limit = { has_variable = treatment_strategy } + if = { + limit = { var:treatment_strategy = flag:amputation } + add_trait_force_tooltip = one_legged + } + else_if = { + limit = { var:treatment_strategy = flag:disfigurement } + add_trait_force_tooltip = disfigured + } + else_if = { + limit = { var:treatment_strategy = flag:eye } + add_trait_force_tooltip = one_eyed + } + else_if = { + limit = { + var:treatment_strategy = flag:castration + age >= 12 + } + add_trait_force_tooltip = eunuch_1 + } + else_if = { + limit = { + var:treatment_strategy = flag:castration + age < 12 + } + add_trait_force_tooltip = beardless_eunuch + } + } + } + } + } +} + +wound_treatment_results_effect = { + save_temporary_scope_value_as = { + name = treatment_result_treatment + value = flag:$TREATMENT$ + } + save_temporary_scope_value_as = { + name = treatment_result_outcome + value = flag:$OUTCOME$ + } + + #APPLY MODIFIERS (OR REMOVE TRAITS) + add_wound_treatment_modifier_effect = { TREATMENT = $TREATMENT$ OUTCOME = $OUTCOME$ } + + #RISKY TREATMENT: DETERMINING TREATMENT STRATEGY AND REMOVING BODY PART + if = { + limit = { scope:treatment_result_treatment = flag:risky } + random_list = { + 1 = { #Medicine + trigger = { + OR = { #Only use for gangrene if no body part can be removed + NOT = { has_character_modifier = gangrene_modifier } + AND = { + has_character_modifier = gangrene_modifier + has_trait = one_eyed + has_trait = one_legged + has_trait = disfigured + OR = { + is_female = yes + is_eunuch_trigger = yes + } + } + } + } + set_variable = { + name = treatment_strategy + value = flag:medicine + days = 30 + } + } + 1 = { #Amputation + trigger = { + NOT = { has_trait = one_legged } + OR = { + has_infected_or_gangrenous_wound_trigger = yes + AND = { + scope:treatment_result_outcome = flag:failure + scope:physician = { NOT = { has_trait = lifestyle_physician } } + } + } + } + add_trait_force_tooltip = one_legged + increase_wounds_no_death_effect = { REASON = treatment } + set_variable = { + name = treatment_strategy + value = flag:amputation + days = 30 + } + if = { + limit = { has_infected_or_gangrenous_wound_trigger = no } + add_character_flag = { flag = physician_used_wrong_method days = 30 } + } + } + 1 = { #Disfigurement + trigger = { + NOT = { has_trait = disfigured } + scope:treatment_result_outcome = flag:failure + scope:physician = { NOT = { has_trait = lifestyle_physician } } + } + add_trait_force_tooltip = disfigured + increase_wounds_no_death_effect = { REASON = treatment } + set_variable = { + name = treatment_strategy + value = flag:disfigurement + days = 30 + } + } + 1 = { #Castration + trigger = { + is_male = yes + is_eunuch_trigger = no + OR = { + has_infected_or_gangrenous_wound_trigger = yes + AND = { + scope:treatment_result_outcome = flag:failure + scope:physician = { NOT = { has_trait = lifestyle_physician } } + } + } + } + if = { + limit = { + age >= 12 + } + add_trait_force_tooltip = eunuch_1 + } + else = { + add_trait_force_tooltip = beardless_eunuch + } + increase_wounds_no_death_effect = { REASON = treatment } + set_variable = { + name = treatment_strategy + value = flag:castration + days = 30 + } + if = { + limit = { has_infected_or_gangrenous_wound_trigger = no } + add_character_flag = { flag = physician_used_wrong_method days = 30 } + } + } + 1 = { #Remove eye + trigger = { + NOT = { has_trait = one_eyed } + OR = { + has_infected_or_gangrenous_wound_trigger = yes + AND = { + scope:treatment_result_outcome = flag:failure + scope:physician = { NOT = { has_trait = lifestyle_physician } } + } + } + } + add_trait_force_tooltip = one_eyed + increase_wounds_no_death_effect = { REASON = treatment } + set_variable = { + name = treatment_strategy + value = flag:eye + days = 30 + } + if = { + limit = { has_infected_or_gangrenous_wound_trigger = no } + add_character_flag = { flag = physician_used_wrong_method days = 30 } + } + } + } + + #Fallback + if = { + limit = { NOT = { exists = var:treatment_strategy } } + set_variable = { + name = treatment_strategy + value = flag:medicine + days = 30 + } + } + } + + #RISKY TREATMENT FAILURE: DEATH? + if = { + limit = { + scope:treatment_result_treatment = flag:risky + scope:treatment_result_outcome = flag:failure + OR = { + AND = { #Dies from wound upgrading past lvl 3 + has_trait = wounded_3 + OR = { + var:treatment_strategy = flag:amputation + var:treatment_strategy = flag:disfigurement + var:treatment_strategy = flag:eye + var:treatment_strategy = flag:castration + } + } + AND = { #AIs die immediately if their health is reduced to 0 or below + is_ai = yes + health <= 0 + } + } + } + add_character_flag = die_surgery + } + + #RETURN VISIT TO THE DOCTOR! + hidden_effect = { + if = { + limit = { + has_trait = wounded + NOT = { has_character_flag = die_surgery } + } + if = { + limit = { scope:treatment_result_outcome = flag:failure } + trigger_event = { + id = health.4999 #Sends health.4001 to me or 4002 to liege + days = wound_treatment_failure_duration_plus_1 + } + } + else = { + trigger_event = { + id = health.4999 #Sends health.4001 to me or 4002 to liege + days = wound_treatment_success_duration_plus_1 + } + } + } + } + + #FAILED TREATMENT OPINIONS + if = { + limit = { + scope:treatment_result_outcome = flag:failure + OR = { + scope:treatment_result_treatment = flag:risky + scope:treatment_result_treatment = flag:mystic + } + } + add_failed_treatment_of_kin_opinions_effect = yes + } + + physician_rank_up_tooltip_effect = yes #Shows trait gain if physician ranked up +} + + + + + + + + +###DISEASE TREATMENT LOGIC### +save_health_court_owner_effect = { #Should match has_health_court_owner_trigger + if = { + limit = { exists = imprisoner } + imprisoner = { save_scope_as = $SCOPE_NAME$ } + } + else_if = { + limit = { exists = court_owner } #Courtiers: liege. Guest: host. Ruler: themselves. + court_owner = { save_scope_as = $SCOPE_NAME$ } + } +} + +pick_own_disease_treatment_effect = { + if = { + limit = { is_adult = yes } + custom_tooltip = pick_own_treatment_effect.adult.tt + } + else = { + custom_tooltip = pick_own_treatment_effect.child.tt + } + + hidden_effect = { + trigger_event = { + id = health.3101 + days = { 5 10 } + } + } +} + +#Who treats a sick character? +decide_who_picks_disease_treatment_effect = { + if = { + limit = { + liege_picks_treatment_trigger = yes + } + liege = { + trigger_event = { + id = health.3102 #Liege decides + days = { physician_treatment_delay_subject_min physician_treatment_delay_subject_max } + } + } + } + else = { + trigger_event = { + id = health.3101 #I decide + days = { physician_treatment_delay_ruler_min physician_treatment_delay_ruler_max } + } + } +} + +liege_picks_treatment_effect = { + if = { + limit = { + liege_picks_treatment_trigger = yes + } + liege = { + trigger_event = { + id = health.3102 #Liege decides + days = { 5 10 } + } + } + } +} + +remove_disease_treatment_effect = { + hidden_effect = { + if = { + limit = { + has_treatable_disease_trigger = no + } + remove_character_modifier = safe_disease_treatment_success_high_modifier + remove_character_modifier = safe_disease_treatment_success_low_modifier + remove_character_modifier = safe_disease_treatment_failure_modifier + remove_character_modifier = risky_disease_treatment_success_high_modifier + remove_character_modifier = risky_disease_treatment_success_low_modifier + remove_character_modifier = risky_disease_treatment_failure_modifier + + } + } +} + +###WOUNDS TREATMENT LOGIC### + +pick_own_wound_treatment_effect = { + if = { + limit = { is_adult = yes } + custom_tooltip = pick_own_treatment_effect.adult.tt + } + else = { + custom_tooltip = pick_own_treatment_effect.child.tt + } + + hidden_effect = { + trigger_event = { + id = health.4001 + days = { 5 10 } + } + } +} + +decide_who_picks_wound_treatment_effect = { + if = { + limit = { + liege_picks_treatment_trigger = yes + } + liege = { + trigger_event = { + id = health.4002 #Liege decides + days = { 10 20 } + } + } + } + else = { + trigger_event = { + id = health.4001 #I decide + days = { 5 15 } + } + } +} + + + +###FAILED TREAMENT EFFECTS### + +add_failed_treatment_of_me_opinions_effect = { +#Physician scope is set in the events that reference this effect + if = { + limit = { + scope:physician = { + is_alive = yes + } + court_physician_available_trigger = yes + this != scope:physician + } + if = { + limit = { + OR = { + has_character_flag = physician_used_wrong_method + scope:physician = { has_character_modifier = chastised_physician_modifier } + scope:sick_character = { + exists = var:treatment_strategy + OR = { + var:treatment_strategy = flag:amputation + var:treatment_strategy = flag:disfigurement + var:treatment_strategy = flag:eye + var:treatment_strategy = flag:castration + } + } + } + } + hidden_effect = { + add_opinion = { + target = scope:physician + modifier = botched_my_treatment_crime_opinion + } + } + show_as_tooltip = { + add_opinion = { + target = scope:physician + modifier = botched_my_treatment_crime_opinion + } + } + } + else = { + hidden_effect = { + add_opinion = { + target = scope:physician + modifier = failed_to_treat_me_crime_opinion + } + } + show_as_tooltip = { + add_opinion = { + target = scope:physician + modifier = failed_to_treat_me_opinion + } + } + } + } +} + +add_failed_treatment_of_kin_opinions_effect = { +#Physician scope is set in the events that reference this effect + hidden_effect = { + if = { + limit = { + scope:physician = { + is_alive = yes + } + court_physician_available_trigger = yes + this != scope:physician + } + every_close_family_member = { + add_to_temporary_list = failed_treatment_opinion + } + every_heir_title = { + limit = { + exists = holder + } + holder = { + if = { + limit = { + player_heir = scope:sick_character + NOT = { is_in_list = failed_treatment_opinion } + } + add_to_temporary_list = failed_treatment_opinion + } + } + } + every_in_list = { + list = failed_treatment_opinion + limit = { + this != scope:physician + } + if = { + limit = { + scope:sick_character = { + has_character_flag = die_risky_treatment + is_alive = no + has_character_flag = physician_used_wrong_method + scope:physician = { has_character_modifier = chastised_physician_modifier } + trigger_if = { + limit = { has_variable = treatment_strategy } + OR = { + var:treatment_strategy = flag:amputation + var:treatment_strategy = flag:disfigurement + var:treatment_strategy = flag:eye + var:treatment_strategy = flag:castration + var:treatment_strategy = flag:occult + var:treatment_strategy = flag:occult_cannibal + var:treatment_strategy = flag:occult_deviant + } + } + } + } + + add_opinion = { + target = scope:physician + modifier = botched_treatment_of_kin_crime_opinion + } + } + else = { + add_opinion = { + target = scope:physician + modifier = failed_to_treat_kin_crime_opinion + } + } + } + } + } +} + + +downgrade_failed_treatment_of_me_opinions_effect = { + #Physician scope is set in the events that reference this effect + hidden_effect = { + if = { + limit = { + scope:physician = { + is_alive = yes + } + court_physician_available_trigger = yes + } + if = { + limit = { + has_opinion_modifier = { + target = scope:physician + modifier = botched_my_treatment_crime_opinion + } + } + remove_opinion = { + target = scope:physician + modifier = botched_my_treatment_crime_opinion + } + add_opinion = { + #add nice opinion version + target = scope:physician + modifier = botched_my_treatment_crime_opinion + } + } + if = { + limit = { + has_opinion_modifier = { + target = scope:physician + modifier = failed_to_treat_me_crime_opinion + } + } + remove_opinion = { + target = scope:physician + modifier = failed_to_treat_me_crime_opinion + } + add_opinion = { + target = scope:physician + modifier = failed_to_treat_me_opinion + } + } + } + } +} + +downgrade_failed_treatment_of_kin_opinions_effect = { + hidden_effect = { + if = { + limit = { + has_opinion_modifier = { + target = scope:physician + modifier = botched_treatment_of_kin_crime_opinion + } + } + remove_opinion = { + target = scope:physician + modifier = botched_treatment_of_kin_crime_opinion + } + add_opinion = { + #add nice opinion version + target = scope:physician + modifier = botched_treatment_of_kin_opinion + } + } + if = { + limit = { + has_opinion_modifier = { + target = scope:physician + modifier = failed_to_treat_kin_crime_opinion + } + } + remove_opinion = { + target = scope:physician + modifier = failed_to_treat_kin_crime_opinion + } + add_opinion = { + target = scope:physician + modifier = failed_to_treat_kin_opinion + } + } + } +} + + +execute_physician_effect = { + execute_prisoner_effect = { + VICTIM = scope:physician + EXECUTIONER = root + } + + + stress_impact = { + compassionate = major_stress_impact_gain + just = minor_stress_impact_gain + forgiving = medium_stress_impact_gain + } +} + +imprison_physician_effect = { + custom_tooltip = health.3107.d.tt + + imprison_character_effect = { + TARGET = scope:physician + IMPRISONER = root + } + + root = { remove_relation_court_physician = scope:physician } + + stress_impact = { + compassionate = medium_stress_impact_gain + just = minor_stress_impact_gain + forgiving = minor_stress_impact_gain + } +} + +chastise_physician_effect = { + scope:physician = { + add_character_modifier = { + modifier = chastised_physician_modifier + years = 5 + } + } + if = { + limit = { + exists = scope:sick_character + scope:sick_character = { this = root } + } + downgrade_failed_treatment_of_me_opinions_effect = yes #You can no longer punish them + } + else_if = { + limit = { + exists = scope:sick_character + } + downgrade_failed_treatment_of_kin_opinions_effect = yes #You can no longer punish them + } + + stress_impact = { + vengeful = medium_stress_impact_gain + } +} + +forgive_physician_effect = { + if = { + limit = { + exists = scope:sick_character + scope:sick_character = { this = root } + } + downgrade_failed_treatment_of_me_opinions_effect = yes #You can no longer punish them + } + else_if = { + limit = { + exists = scope:sick_character + } + downgrade_failed_treatment_of_kin_opinions_effect = yes #You can no longer punish them + } + + reverse_add_opinion = { + target = scope:physician + modifier = grateful_opinion + opinion = 15 + } + + stress_impact = { + vengeful = major_stress_impact_gain + wrathful = medium_stress_impact_gain + } +} + +###DISEASE MESSAGES### + +inform_liege_about_disease_treatment_effect = { + hidden_effect = { + save_scope_value_as = { + name = treatment + value = flag:$TREATMENT$ + } + save_scope_value_as = { + name = outcome + value = flag:$OUTCOME$ + } + + #To save scope for portrait + if = { + limit = { + scope:physician != scope:sick_character + } + scope:physician = { save_scope_as = portrait } + } + + #Is liege generally responsible for our treatment? + if = { + limit = { liege_is_responsible_for_treatment_trigger = yes } + + #Toast messages for success and minor failures: only if liege actually picked the treatment + #Event for major failures and death: always + + liege = { + #CRITICAL SUCCESS & SUCCESS (TOAST) + if = { + limit = { + exists = scope:treatment_picker + this = scope:treatment_picker + OR = { + scope:outcome = flag:success + scope:outcome = flag:critical_success + } + } + send_interface_toast = { + title = court_physician_treatment_success_message_title + left_icon = scope:sick_character + right_icon = scope:portrait + disease_treatment_result_tooltip_effect = { TREATMENT = $TREATMENT$ OUTCOME = $OUTCOME$ } + } + } + #FAILURE + else_if = { + limit = { scope:outcome = flag:failure } + #SAFE FAILURE (TOAST) + if = { + limit = { + exists = scope:treatment_picker + this = scope:treatment_picker + scope:treatment = flag:safe + } + send_interface_toast = { + title = court_physician_treatment_failure_message_title + left_icon = scope:sick_character + right_icon = scope:portrait + wound_treatment_result_tooltip_effect = { TREATMENT = $TREATMENT$ OUTCOME = $OUTCOME$ } + } + } + #RISKY FAILURE (EVENT) + else_if = { + limit = { scope:treatment = flag:risky } + save_scope_value_as = { + name = disease_or_wound + value = flag:disease + } + trigger_event = health.3200 + } + #MYSTIC FAILURE (EVENT) + else_if = { + limit = { scope:treatment = flag:mystic } + trigger_event = health.3201 + #reveal secret in this event + } + } + #DEATH (EVENT) + else_if = { + limit = { scope:outcome = flag:death } + + add_character_flag = { + flag = sent_relevant_death_event #This blocks further death events triggered by death_management.0001 + days = 5 + } + trigger_event = health.3200 + } + } + } + } +} + +### WOUND MESSAGES ### + +inform_liege_about_wound_treatment_effect = { + hidden_effect = { + save_scope_value_as = { + name = treatment + value = flag:$TREATMENT$ + } + save_scope_value_as = { + name = outcome + value = flag:$OUTCOME$ + } + + + #Is liege generally responsible for our treatment? + if = { + limit = { liege_is_responsible_for_treatment_trigger = yes } + + #Success and minor failure: no message + #Major failure and death: event + + liege = { + #RISKY FAILURE + if = { + limit = { + scope:outcome = flag:failure + scope:treatment = flag:risky + } + save_scope_value_as = { + name = disease_or_wound + value = flag:wound + } + trigger_event = health.3200 + } + #RISKY DEATH + else_if = { + limit = { scope:outcome = flag:death } + + save_scope_value_as = { + name = disease_or_wound + value = flag:wound + } + add_character_flag = { + flag = sent_relevant_death_event #This blocks further death events triggered by death_management.0001 + days = 5 + } + trigger_event = health.3200 + } + } + } + } +} + +#Currently no message to liege because liege never picks wound treatment and safe success is not noteworthy + + +#Effect run when you commit suicide +committed_suicide_effect = { + if = { + limit = { + any_vassal = { } + } + every_vassal = { + custom = all_vassals + add_opinion = { + modifier = suicide_opinion + target = root + opinion = -30 + } + } + } + if = { + limit = { + is_ai = yes + exists = dynasty + } + dynasty = { + add_dynasty_prestige = medium_dynasty_prestige_loss + } + } + else_if = { + limit = { exists = dynasty } + dynasty = { + add_dynasty_prestige_level = -1 + } + } + add_piety_level = -1 + death = { + death_reason = death_suicide + } +} + +#Effect run when you attempt to commit suicide +attempted_suicide_effect = { + add_piety_level = -1 +} + +# Remove infirm when adding incapable so that the player doesn't just immediately die. +upgrade_infirm_to_incapable_effect = { + # Stealthily remove infirm + hidden_effect = { + if = { + limit = { has_trait = infirm } + remove_trait = infirm + } + } + # And add in capable. + add_trait = incapable + # Logging. + log_harm_event_incapability_as_variable_effect = yes +} diff --git a/N3OW/common/scripted_effects/tgp_debate_scripted_effects.txt b/N3OW/common/scripted_effects/tgp_debate_scripted_effects.txt new file mode 100644 index 00000000..8abd17dc --- /dev/null +++ b/N3OW/common/scripted_effects/tgp_debate_scripted_effects.txt @@ -0,0 +1,699 @@ +# Find debate target +set_debate_target_effect = { + save_scope_as = debate_contender + if = { + limit = { + scope:activity = { + has_activity_option = { + category = special_type + option = debate_type_favor + } + } + } + #Save current empowered movement. + situation:dynastic_cycle ?= { + random_participant_group = { + limit = { exists = var:movement_favored } + save_scope_as = current_empowered_movement + } + } + if = { # Grab the movement leader if available + limit = { + scope:current_empowered_movement = { + var:movement_leader = { involved_activity = scope:activity } + } + } + scope:current_empowered_movement = { + var:movement_leader = { save_scope_as = challenged_movement_leader } + } + } + else_if = { # Else grab a proxy + limit = { + scope:activity = { + any_attending_character = { + top_participant_group:dynastic_cycle ?= scope:current_empowered_movement + } + } + } + scope:activity = { + ordered_attending_character = { + order_by = movement_power_character_value + check_range_bounds = no + limit = { + top_participant_group:dynastic_cycle ?= scope:current_empowered_movement + } + save_scope_as = challenged_movement_leader + } + } + } + else_if = { # Else grab a character from _another_ movement + limit = { + scope:activity = { + any_attending_character = { + NOR = { + top_participant_group:dynastic_cycle ?= { participant_group_type = undecided_movement } + top_participant_group:dynastic_cycle ?= scope:host.top_participant_group:dynastic_cycle + } + } + } + } + scope:activity = { + ordered_attending_character = { + order_by = movement_power_character_value + check_range_bounds = no + limit = { + NOR = { + top_participant_group:dynastic_cycle ?= { participant_group_type = undecided_movement } + top_participant_group:dynastic_cycle ?= scope:host.top_participant_group:dynastic_cycle + } + } + save_scope_as = challenged_movement_leader + } + } + } + else = { # Invalidate activity + trigger_event = activity_system.0552 + } + } + else_if = { + limit = { + scope:activity = { + has_activity_option = { + category = special_type + option = debate_type_leadership + } + } + } + scope:activity.special_guest:movement_leader ?= { save_scope_as = challenged_movement_leader } + } + scope:activity = { + set_variable = { + name = challenged_movement_leader + value = scope:challenged_movement_leader + } + set_variable = { + name = debate_contender + value = scope:debate_contender + } + } +} + +# > 0 contender won and will become new leader +# <= 0 movement leader won and defended position +debate_determine_outcome_effect = { + random_list = { + 10 = { # Contender is winner + modifier = { + add = 240 + scope:activity.debate_outcome_value = 3 + } + modifier = { + add = 70 + scope:activity.debate_outcome_value = 2 + } + modifier = { + add = 10 + scope:activity.debate_outcome_value = 1 + } + modifier = { # If opponents score is TOO high, you cannot win + factor = 0 + scope:activity.debate_outcome_value <= -3 + } + scope:activity.var:debate_contender = { + save_scope_as = debate_winner + } + scope:activity.var:challenged_movement_leader = { + save_scope_as = debate_loser + } + if = { + limit = { + scope:activity.debate_outcome_value < 0 + } + save_scope_as = debate_unexpected_win + } + } + 10 = { # challenged leader is winner + modifier = { + add = 240 + scope:activity.debate_outcome_value = -3 + } + modifier = { + add = 70 + scope:activity.debate_outcome_value = -2 + } + modifier = { + add = 10 + scope:activity.debate_outcome_value = -1 + } + modifier = { # If opponents score is TOO high, you cannot win + factor = 0 + scope:activity.debate_outcome_value >= 3 + } + + scope:activity.var:debate_contender = { + save_scope_as = debate_loser + } + scope:activity.var:challenged_movement_leader = { + save_scope_as = debate_winner + } + if = { + limit = { + scope:activity.debate_outcome_value > 0 + } + save_scope_as = debate_unexpected_win + } + } + } + # Apply effects + # Seize movement leadership success + if = { + limit = { + scope:activity = { + has_activity_option = { + category = special_type + option = debate_type_leadership + } + } + } + # Set variables for activity conclusion desc - note that for the favor special option, these are set in the hegemon's follow up event. + scope:activity = { + set_variable = { + name = debate_winner + value = scope:debate_winner + } + } + scope:activity = { + set_variable = { + name = debate_loser + value = scope:debate_loser + } + } + # Record it + involved_activity = { + if = { + limit = { + scope:debate_winner = { + is_any_movement_leader = no + } + } + add_activity_log_entry = { + key = debate_become_movement_leader_reward + score = 80 + tags = { completed } + character = scope:debate_winner + location = scope:debate_winner.location + } + } + else = { + add_activity_log_entry = { + key = debate_remain_movement_leader_reward + score = 80 + tags = { completed } + character = scope:debate_winner + location = scope:debate_winner.location + } + } + } + } +} + +debate_disburse_activity_ai_guest_rewards = { + if = { + limit = { + NOT = { exists = var:tgp_debate_success_score } + } + set_variable = { + name = tgp_debate_success_score + value = tgp_debate_success_score_value + } + } + if = { + limit = { + has_activity_intent = debate_increase_movement_power_intent + } + top_participant_group:dynastic_cycle ?= { + save_scope_as = my_movement + } + random = { + chance = { + value = 25 + if = { + limit = { var:tgp_debate_success_score >= 100 } + add = 75 + } + else_if = { + limit = { var:tgp_debate_success_score >= 75 } + add = 50 + } + else_if = { + limit = { var:tgp_debate_success_score >= 50 } + add = 25 + } + } + if = { + limit = { var:tgp_debate_success_score >= 100 } + change_influence = major_influence_gain + scope:my_movement = { + event_change_movement_power_effect = { + VALUE = event_increase_movement_power_major_value + } + } + } + else_if = { + limit = { var:tgp_debate_success_score >= 75 } + change_influence = medium_influence_gain + scope:my_movement = { + event_change_movement_power_effect = { + VALUE = event_increase_movement_power_medium_value + } + } + } + else = { + change_influence = minor_influence_gain + scope:my_movement = { + event_change_movement_power_effect = { + VALUE = event_increase_movement_power_minor_value + } + } + } + } + } + else = { + save_scope_as = ai_guest + if = { + limit = { + NOT = { + any_relation = { + type = elder + is_ai = no + } + } + } + random = { + chance = { + value = 25 + } + scope:activity = { + random_attending_character = { + limit = { + is_ai = yes + merit > scope:ai_guest.merit + num_of_relation_disciple < disciples_limit_value + NOR = { + has_relation_elder = scope:ai_guest + has_relation_disciple = scope:ai_guest + } + # Not busy with their own things. + this != scope:host + this != scope:activity.var:challenged_movement_leader + } + weight = { + base = 100 + modifier = { + any_relation = { + type = disciple + count > 0 + } + # even out the distribution of disciples + add = { + every_relation = { + type = disciple + add = -5 + } + } + } + } + save_scope_as = elder + set_elder_relation_effect = { + ELDER = scope:elder + DISCIPLE = scope:ai_guest + MERIT = minor_merit_gain + } + } + } + } + } + } +} + +debate_host_rewards_effect = { + if = { + # Host won debate + limit = { + this = scope:activity.var:debate_winner + } + # Activity is imperial debate (determines favored movement) + if = { + limit = { + scope:activity = { + has_activity_option = { + category = special_type + option = debate_type_favor + } + } + } + root.top_participant_group:dynastic_cycle ?= { + # Make favored movement + save_scope_as = my_movement + } + # We raise our own Movement Power + custom_tooltip = event_increase_movement_power_major_effect_tooltip + scope:my_movement = { + make_movement_favored_effect = yes + event_change_movement_power_effect = { + VALUE = event_increase_movement_power_major_value + } + switch = { + trigger = participant_group_type + pro_hegemon_movement = { + if = { + limit = { + situation:dynastic_cycle = { + situation_top_has_catalyst = catalyst_movement_gained_power_pro_hegemon + } + } + trigger_situation_catalyst = catalyst_movement_gained_power_pro_hegemon + } + } + advancement_movement = { + if = { + limit = { + situation:dynastic_cycle = { + situation_top_has_catalyst = catalyst_movement_gained_power_advancement + } + } + trigger_situation_catalyst = catalyst_movement_gained_power_advancement + } + } + expansion_movement = { + if = { + limit = { + situation:dynastic_cycle = { + situation_top_has_catalyst = catalyst_movement_gained_power_expansion + } + } + trigger_situation_catalyst = catalyst_movement_gained_power_expansion + } + } + conservative_movement = { + if = { + limit = { + situation:dynastic_cycle = { + situation_top_has_catalyst = catalyst_movement_gained_power_conservative + } + } + trigger_situation_catalyst = catalyst_movement_gained_power_conservative + } + } + } + } + } + else = { + make_movement_leader_effect = yes + } + } + # Then dole out secondary rewards + if = { + # We have the intent to gain disciples and gained at least one. + limit = { has_variable_list = debate_disciples } + if = { + # Code math starts at 0 + limit = { + variable_list_size = { + name = debate_disciples + value = 1 + } + num_of_relation_disciple >= 1 + } + ordered_in_list = { + variable = debate_disciples + order_by = learning + save_scope_as = disciple_1 + } + } + if = { + limit = { + variable_list_size = { + name = debate_disciples + value = 2 + } + num_of_relation_disciple >= 2 + } + ordered_in_list = { + variable = debate_disciples + order_by = learning + position = 1 + save_scope_as = disciple_2 + } + } + if = { + limit = { + variable_list_size = { + name = debate_disciples + value = 3 + } + num_of_relation_disciple >= 3 + } + ordered_in_list = { + variable = debate_disciples + order_by = learning + position = 2 + save_scope_as = disciple_3 + } + } + if = { + limit = { + exists = scope:disciple_3 + } + custom_tooltip = gained_many_disciples + } + else_if = { + limit = { + exists = scope:disciple_2 + } + custom_tooltip = gained_few_disciples + } + else_if = { + limit = { + exists = scope:disciple_1 + } + custom_tooltip = gained_one_disciple + } + } + change_influence = { + # Modest reward as a base - you're the host after all! + value = major_influence_value + if = { + limit = { + scope:activity = { + has_activity_option = { + category = special_type + option = debate_type_favor + } + } + this = scope:activity.var:debate_winner + } + add = monumental_influence_value + } + if = { + limit = { + scope:activity = { + has_activity_option = { + category = special_type + option = debate_type_leadership + } + } + this = scope:activity.var:debate_winner + } + add = major_influence_value + } + } + add_prestige = { + # Modest reward as a base - you're the host after all! + value = major_prestige_value + if = { + limit = { + scope:activity = { + has_activity_option = { + category = special_type + option = debate_type_favor + } + } + this = scope:activity.var:debate_winner + } + add = monumental_prestige_value + } + if = { + limit = { + scope:activity = { + has_activity_option = { + category = special_type + option = debate_type_leadership + } + } + this = scope:activity.var:debate_winner + } + add = major_prestige_value + } + } +} + +debate_disburse_activity_host_rewards = { + # Regardless of outcome for intents, you should receive some influence and prestige from having hosted debate. + if = { + limit = { this = scope:host } + # Record it + involved_activity = { + add_activity_log_entry = { + key = debate_host_rewards + score = 80 + tags = { completed } + show_in_conclusion = yes + character = scope:host + location = scope:host.location + scope:host = { debate_host_rewards_effect = yes } + } + } + } + else = { + show_as_tooltip = { debate_host_rewards_effect = yes } + } +} + +debate_guest_rewards = { + if = { + limit = { + this = scope:activity.var:challenged_movement_leader + this = scope:activity.var:debate_winner + } + add_prestige = major_prestige_value + change_influence = major_influence_value + } + if = { + limit = { + has_activity_intent = debate_gain_elder_intent + } + if = { + limit = { + has_variable = new_elder + } + custom_tooltip = gained_new_elder_tt + } + change_influence = debate_guest_influence_reward_value + } + if = { + limit = { + has_activity_intent = debate_increase_movement_power_intent + exists = var:tgp_debate_success_score + } + top_participant_group:dynastic_cycle ?= { + save_scope_as = my_movement + } + random = { + chance = { + value = 25 + if = { + limit = { var:tgp_debate_success_score >= 100 } + add = 75 + } + else_if = { + limit = { var:tgp_debate_success_score >= 75 } + add = 50 + } + else_if = { + limit = { var:tgp_debate_success_score >= 50 } + add = 25 + } + } + if = { + limit = { var:tgp_debate_success_score >= 100 } + change_influence = major_influence_gain + scope:my_movement = { + event_change_movement_power_effect = { + VALUE = event_increase_movement_power_major_value + } + } + } + else_if = { + limit = { var:tgp_debate_success_score >= 75 } + change_influence = medium_influence_gain + scope:my_movement = { + event_change_movement_power_effect = { + VALUE = event_increase_movement_power_medium_value + } + } + } + else = { + change_influence = minor_influence_gain + scope:my_movement = { + event_change_movement_power_effect = { + VALUE = event_increase_movement_power_minor_value + } + } + } + } + change_influence = debate_guest_influence_reward_value + } + add_trait_xp = { + trait = confucian_education + value = { + value = lifestyle_confucian_education_xp_gain_minor_value + #High Score + if = { + limit = { + has_variable = tgp_debate_success_score + var:tgp_debate_success_score >= 75 + } + multiply = 3 + } + #Good Score + else_if = { + limit = { + has_variable = tgp_debate_success_score + var:tgp_debate_success_score < 75 + var:tgp_debate_success_score >= 50 + } + multiply = 1.5 + } + #Poor Score + else_if = { + limit = { + has_variable = tgp_debate_success_score + var:tgp_debate_success_score < 50 + } + multiply = 0.8 + } + } + } +} + +debate_disburse_activity_guest_rewards = { + save_scope_as = guest + involved_activity = { + add_activity_log_entry = { + key = debate_guest_rewards + score = 80 + tags = { completed } + show_in_conclusion = yes + character = scope:guest + location = scope:guest.location + scope:guest = { debate_guest_rewards = yes } + } + } +} + +debate_cleanup_effect = { + if = { + limit = { + has_variable = tgp_debate_success_score + } + set_variable = { + name = tgp_debate_success_score + value = var:tgp_debate_success_score + days = 60 + } + } + # Debates + remove_variable ?= debate_selected_tactic + remove_variable ?= debate_crowd_sentiment +} diff --git a/N3OW/common/scripted_effects/tgp_imperial_examination_scripted_effects.txt b/N3OW/common/scripted_effects/tgp_imperial_examination_scripted_effects.txt new file mode 100644 index 00000000..bb8ba401 --- /dev/null +++ b/N3OW/common/scripted_effects/tgp_imperial_examination_scripted_effects.txt @@ -0,0 +1,1928 @@ + +#Tweak exam advantage variable +imperial_examination_adjust_advantage_variable_effect = { + if = { + limit = { + NOT = { has_variable = has_exam_advantage } + } + set_variable = { + name = has_exam_advantage + value = 1 + } + } + else = { + change_variable = { + name = has_exam_advantage + add = 1 + } + } +} + +imperial_examination_adjust_advantage_variable_neg_effect = { + if = { + limit = { + NOT = { has_variable = has_exam_advantage } + } + set_variable = { + name = has_exam_advantage + value = 0 + } + } + else = { + change_variable = { + name = has_exam_advantage + add = -1 + } + } +} + +#Is run in the imperial_examination_cheat_washing_effect +imperial_examination_update_cheat_washing_effect = { + if = { + limit = { has_variable = washed_cheater } + change_variable = { + name = washed_cheater + add = 1 + } + } + else = { + set_variable = { + name = washed_cheater + value = 1 + } + } +} + +imperial_examination_cheat_washing_effect = { + #What a relief. + stress_impact = { base = major_stress_impact_loss } + #Gonzo! + custom_tooltip = imperial_examination.cheat_wash.tt + remove_variable ?= been_caught_cheating + remove_variable ?= been_caught_cheating_longterm + #How many times have we washed out cheat, exactly? + imperial_examination_update_cheat_washing_effect = yes +} + + +#Rewards +imperial_examination_disburse_activity_host_rewards = { + involved_activity = { + add_activity_log_entry = { + key = imperial_examination_host_rewards + score = 100 + tags = { completed } + show_in_conclusion = yes + character = scope:host + location = scope:host.location + + scope:host = { + #Legend spread + if = { + limit = { + has_dlc_feature = legends + exists = promoted_legend + #Lots of entrants + scope:activity = { activity_has_imperial_exams_trigger = yes } + } + promoted_legend ?= { + change_legend_quality_effect = { VALUE = medium_legend_quality_increase } + } + } + + #Influence based on your... setup + change_influence = { + value = imperial_examination_influence_base_reward_value + #Lots of entrants + if = { + limit = { scope:activity = { activity_has_imperial_exams_trigger = yes } } + multiply = 4 + } + #Smaller amount of entrants + else_if = { + limit = { scope:activity = { activity_has_grand_exams_trigger = yes } } + multiply = 2 + } + } + + #Legitimacy + add_legitimacy = { + value = imperial_examination_legitimacy_base_reward_value + #Extreme Grade + if = { + limit = { scope:activity = { activity_has_extreme_grade_trigger = yes } } + multiply = 2 + } + #High Grade is the default, as it were, so no post for that case + #Mediocre Grade + else_if = { + limit = { scope:activity = { activity_has_mediocre_grade_trigger = yes } } + multiply = 0.8 + } + #Low Grade + else = { + limit = { scope:activity = { activity_has_low_grade_trigger = yes } } + multiply = 0.5 + } + } + + #Prestige + add_prestige = { + value = imperial_examination_prestige_base_reward_value + #Extreme Grade + if = { + limit = { scope:activity = { activity_has_extreme_grade_trigger = yes } } + multiply = 4 + } + #High Grade + else_if = { + limit = { scope:activity = { activity_has_high_grade_trigger = yes } } + multiply = 2 + } + #Mediocre Grade + #Low Grade + else = { + limit = { scope:activity = { activity_has_low_grade_trigger = yes } } + multiply = 0.8 + } + } + } + } + } +} + +local_examination_disburse_activity_host_rewards = { + involved_activity = { + add_activity_log_entry = { + key = imperial_examination_host_rewards + score = 100 + tags = { completed } + show_in_conclusion = yes + character = scope:host + location = scope:host.location + + scope:host = { + #Influence based on your... setup + change_influence = { + value = local_examination_influence_base_reward_value + #Lots of entrants + if = { + limit = { scope:activity = { activity_has_imperial_exams_trigger = yes } } + multiply = 4 + } + #Smaller amount of entrants + else_if = { + limit = { scope:activity = { activity_has_grand_exams_trigger = yes } } + multiply = 2 + } + } + + if = { + limit = { has_legitimacy = yes } + #Legitimacy (for those who have it) + add_legitimacy = { + value = local_examination_legitimacy_base_reward_value + #Extreme Grade + if = { + limit = { scope:activity = { activity_has_extreme_grade_trigger = yes } } + multiply = 2 + } + #High Grade is the default, as it were, so no post for that case + #Mediocre Grade + else_if = { + limit = { scope:activity = { activity_has_mediocre_grade_trigger = yes } } + multiply = 0.8 + } + #Low Grade + else = { + limit = { scope:activity = { activity_has_low_grade_trigger = yes } } + multiply = 0.5 + } + } + } + else = { + # Merit for the rest + change_merit = { + value = local_examination_legitimacy_base_reward_value + #Extreme Grade + if = { + limit = { scope:activity = { activity_has_extreme_grade_trigger = yes } } + multiply = 2 + } + #High Grade is the default, as it were, so no post for that case + #Mediocre Grade + else_if = { + limit = { scope:activity = { activity_has_mediocre_grade_trigger = yes } } + multiply = 0.8 + } + #Low Grade + else = { + limit = { scope:activity = { activity_has_low_grade_trigger = yes } } + multiply = 0.5 + } + } + } + + #Prestige + add_prestige = { + value = local_examination_prestige_base_reward_value + #Extreme Grade + if = { + limit = { scope:activity = { activity_has_extreme_grade_trigger = yes } } + multiply = 4 + } + #High Grade + else_if = { + limit = { scope:activity = { activity_has_high_grade_trigger = yes } } + multiply = 2 + } + #Mediocre Grade + #Low Grade + else = { + limit = { scope:activity = { activity_has_low_grade_trigger = yes } } + multiply = 0.8 + } + } + } + } + } +} + +imperial_examination_disburse_activity_examiner_rewards = { + #Add some influence & prestige + change_influence = imperial_examination_influence_base_reward_value + add_prestige = imperial_examination_prestige_base_reward_value + #Change some opinion + add_opinion = { + modifier = examiner_opinion + target = scope:host + opinion = 25 + } +} + +imperial_examination_disburse_activity_entrant_rewards = { + save_temporary_scope_as = entrant + #This variable is set to track the loc we show players when notifying them of their family's results. + + #Cheaters + if = { + limit = { has_variable = been_caught_cheating_longterm } + #No influence for cheaters + change_merit = { + value = imperial_examination_merit_base_reward_value + multiply = 0.1 + } + } + #Entrants + else_if = { + limit = { + OR = { + is_in_guest_subset = { name = entrants } + is_in_guest_subset = { name = palace_entrants } + } + } + #Influence based on your score + if = { + limit = { is_ai = no } + #Record it + involved_activity = { + add_activity_log_entry = { + key = imperial_examination_entrant_rewards + score = 80 + tags = { completed } + show_in_conclusion = yes + character = scope:entrant + location = scope:entrant.location + scope:entrant = { + if = { + limit = { + NOT = { has_character_modifier = tgp_passed_provincial_exam_modifier } + } + add_character_flag = passed_provincial_exam + add_character_modifier = { + modifier = tgp_bypassed_provincial_exam_modifier + } + } + change_influence = imperial_examination_entrant_influence_reward_value + #Merit based on your score + change_merit = imperial_examination_entrant_merit_reward_value + # Gain Prestige if you have the relevant flag + if = { + limit = { has_character_flag = examination_prestige_reward } + remove_character_flag = examination_prestige_reward + add_prestige = major_prestige_gain + } + } + } + } + } + else = { + if = { + limit = { + NOT = { has_character_modifier = tgp_passed_provincial_exam_modifier } + } + add_character_flag = passed_provincial_exam + add_character_modifier = { + modifier = tgp_bypassed_provincial_exam_modifier + } + if = { + limit = { is_lowborn = no } + change_merit = local_examination_merit_base_reward_value + } + } + if = { + limit = { + OR = { + is_lowborn = no + has_perfect_score_trigger = { SCORE_VAR = imperial_examination_score } + } + + } + change_influence = imperial_examination_entrant_influence_reward_value + #Merit based on your score + change_merit = imperial_examination_entrant_merit_reward_value + # Gain Prestige if you have the relevant flag + if = { + limit = { has_character_flag = examination_prestige_reward } + remove_character_flag = examination_prestige_reward + add_prestige = major_prestige_gain + } + } + } + if = { + limit = { + is_in_guest_subset = { name = palace_entrants } + } + if = { + limit = { + NOT = { has_character_flag = passed_metropolitan_exam } + } + add_character_flag = passed_metropolitan_exam + add_character_modifier = { + modifier = tgp_passed_metropolitan_exam_modifier + } + } + add_character_flag = passed_palace_exam + add_character_modifier = { + modifier = tgp_passed_palace_exam_modifier + } + create_character_memory = { + type = passed_metropolitan_exam_memory + } + create_character_memory = { + type = passed_palace_exam_memory + } + # Notify close family members + every_close_family_member = { + # House head is notified separately + limit = { is_house_head = no } + send_interface_message = { + type = event_msg_merit_effect_good + title = palace_exam_close_family_passed + right_icon = root + desc = msg_palace_exam_close_family_passed_desc + } + } + } + else_if = { + limit = { + is_in_guest_subset = { name = entrants } + } + save_temporary_scope_as = temp_scope + add_character_flag = passed_metropolitan_exam + add_character_modifier = { + modifier = tgp_passed_metropolitan_exam_modifier + } + if = { + limit = { + # Let's give metropolitan entrants the chance to pass Palace as well. + is_ai = yes + is_lowborn = no + # We don't mess with any player families + NOT = { + any_close_or_extended_family_member = { is_ai = no } + } + } + random = { + chance = 20 + add_character_flag = passed_palace_exam + add_character_modifier = { + modifier = tgp_passed_palace_exam_modifier + } + change_merit = empire_starting_merit_value + } + } + create_character_memory = { + type = passed_metropolitan_exam_memory + } + # Notify close family members + every_close_family_member = { + # House head is notified separately + limit = { is_house_head = no } + send_interface_message = { + type = event_msg_merit_effect_good + title = metropolitan_exam_close_family_passed + right_icon = root + desc = msg_metropolitan_exam_close_family_passed_desc + } + } + } + #Remove failed_imperial_examination flags for those who have it + if = { + limit = { + has_character_flag = failed_imperial_examination + } + remove_character_flag = failed_imperial_examination + } + } + #Failees + else = { + if = { + limit = { is_ai = no } + #Record it + involved_activity = { + add_activity_log_entry = { + key = imperial_examination_entrant_rewards + score = 80 + tags = { completed } + show_in_conclusion = yes + character = scope:entrant + location = scope:entrant.location + scope:entrant = { + #Dwindling influence & merit for failees + change_influence = imperial_examination_failee_influence_reward_value + change_merit = imperial_examination_failee_merit_reward_value + # Gain Prestige if you have the relevant flag + if = { + limit = { has_character_flag = examination_prestige_reward } + remove_character_flag = examination_prestige_reward + add_prestige = major_prestige_loss + } + } + failee_chance_to_gain_elder_effect = yes + } + } + } + else = { + #Dwindling influence & merit for failees + change_influence = imperial_examination_failee_influence_reward_value + change_merit = imperial_examination_failee_merit_reward_value + involved_activity = { + failee_chance_to_gain_elder_effect = yes + } + # Gain Prestige if you have the relevant flag + if = { + limit = { has_character_flag = examination_prestige_reward } + remove_character_flag = examination_prestige_reward + add_prestige = major_prestige_loss + } + } + #Set "failed examination" flags + add_character_flag = failed_imperial_examination + create_character_memory = { + type = failed_metropolitan_exam_memory + } + # Notify close family members + every_close_family_member = { + # House head is notified separately + limit = { is_house_head = no } + send_interface_message = { + type = event_msg_merit_effect_bad + title = metropolitan_exam_close_family_failed + right_icon = root + desc = msg_metropolitan_exam_close_family_failed_desc + } + } + } + scope:entrant = { add_to_list = exam_entrants } +} + +local_examination_disburse_activity_entrant_rewards = { + save_temporary_scope_as = entrant + #This variable is set to track the loc we show players when notifying them of their family's results. + + #Cheaters + if = { + limit = { has_variable = been_caught_cheating_longterm } + #No influence for cheaters + change_merit = { + value = imperial_examination_merit_base_reward_value + multiply = 0.1 + } + } + #Entrants + else_if = { + limit = { + is_in_guest_subset = { name = entrants } + } + #Influence based on your score + if = { + limit = { is_ai = no } + #Record it + involved_activity = { + add_activity_log_entry = { + key = imperial_examination_entrant_rewards + score = 80 + tags = { completed } + show_in_conclusion = yes + character = scope:entrant + location = scope:entrant.location + scope:entrant = { + change_influence = local_examination_entrant_influence_reward_value + #Merit based on your score + change_merit = local_examination_merit_base_reward_value + # Gain Prestige if you have the relevant flag + if = { + limit = { has_character_flag = examination_prestige_reward } + remove_character_flag = examination_prestige_reward + add_prestige = major_prestige_gain + } + } + } + } + } + else = { + change_influence = local_examination_entrant_influence_reward_value + #Merit based on your score + change_merit = local_examination_merit_base_reward_value + # Gain Prestige if you have the relevant flag + if = { + limit = { has_character_flag = examination_prestige_reward } + remove_character_flag = examination_prestige_reward + add_prestige = major_prestige_gain + } + } + + #Save flags + add_character_flag = passed_provincial_exam + add_character_modifier = { + modifier = tgp_passed_provincial_exam_modifier + } + #Create memory of passing the exam + create_character_memory = { + type = passed_provincial_exam_memory + } + ordered_memory = { + order_by = memory_creation_date + set_variable = { name = location value = memory_owner.location } + } + #Send interface_message to relevant chars to notify them + every_close_family_member = { + send_interface_message = { + type = event_msg_merit_effect_good + title = provincial_exam_close_family_passed + right_icon = root + desc = msg_provincial_exam_close_family_passed_desc + } + } + } + #Failees + else = { + if = { + limit = { is_ai = no } + #Record it + involved_activity = { + add_activity_log_entry = { + key = imperial_examination_entrant_rewards + score = 80 + tags = { completed } + show_in_conclusion = yes + character = scope:entrant + location = scope:entrant.location + scope:entrant = { + #Dwindling influence & merit for failees + change_influence = imperial_examination_failee_influence_reward_value + change_merit = imperial_examination_failee_merit_reward_value + # Lose Prestige if you have the relevant flag + if = { + limit = { has_character_flag = examination_prestige_reward } + remove_character_flag = examination_prestige_reward + add_prestige = major_prestige_loss + } + } + failee_chance_to_gain_elder_effect = yes + } + } + } + else = { + #Dwindling influence & merit for failees + change_influence = imperial_examination_failee_influence_reward_value + change_merit = imperial_examination_failee_merit_reward_value + involved_activity = { + failee_chance_to_gain_elder_effect = yes + } + # Lose Prestige if you have the relevant flag + if = { + limit = { has_character_flag = examination_prestige_reward } + remove_character_flag = examination_prestige_reward + add_prestige = major_prestige_loss + } + } + create_character_memory = { + type = failed_provincial_exam_memory + } + ordered_memory = { + order_by = memory_creation_date + set_variable = { name = location value = memory_owner.location } + } + #Send interface_message to relevant chars to notify them + every_close_family_member = { + send_interface_message = { + type = event_msg_merit_effect_bad + title = provincial_exam_close_family_failed + right_icon = root + desc = msg_provincial_exam_close_family_failed_desc + } + } + } + # Everyone should get Confucian Education XP + if = { + limit = { + NOT = { has_trait = confucian_education } + } + add_trait = confucian_education + } + add_trait_xp = { + trait = confucian_education + value = { + value = lifestyle_confucian_education_xp_gain_minor_value + #High Score + if = { + limit = { has_perfect_score_trigger = { SCORE_VAR = imperial_examination_score } } + multiply = 3 + } + #Good Score + else_if = { + limit = { has_good_score_trigger = { SCORE_VAR = imperial_examination_score } } + multiply = 1.5 + } + #Poor Score + else_if = { + limit = { has_questionable_score_trigger = { SCORE_VAR = imperial_examination_score } } + multiply = 0.8 + } + } + } + scope:entrant = { + add_to_list = exam_entrants + } +} + +#a chance to set an elder/disciple relation between examiners and failees +failee_chance_to_gain_elder_effect = { + random = { + chance = { + value = 25 + scope:entrant = { + every_held_title = { + add = 5 + } + if = { + limit = { + # No Elders for known cheaters + has_character_flag = been_caught_cheating + } + add = -25 + } + } + } + random_guest_subset = { + name = imperial_examiners + limit = { + merit > scope:entrant.merit + } + weight = { + base = 100 + modifier = { + any_relation = { + type = disciple + count > 0 + } + # even out the distribution of disciples + add = { + every_relation = { + type = disciple + add = -5 + } + } + } + } + save_scope_as = elder + set_elder_relation_effect = { + ELDER = scope:elder + DISCIPLE = scope:entrant + MERIT = minor_merit_gain + } + scope:entrant = { add_character_flag = exam_got_elder } + } + } +} + +imperial_examination_create_appropriate_examiner_effect = { + scope:activity.activity_location = { save_scope_as = location } + if = { + limit = { + scope:host = { + involved_activity = { has_activity_type = activity_imperial_examination } + } + } + if = { + limit = { + scope:activity = { activity_is_martial_focus_trigger = yes } + } + create_character = { + template = tgp_examiner_martial_template + location = scope:location + save_scope_as = new_examiner + } + } + else_if = { + limit = { + scope:activity = { activity_is_stewardship_focus_trigger = yes } + } + create_character = { + template = tgp_examiner_stewardship_template + location = scope:location + save_scope_as = new_examiner + } + } + else = { + create_character = { + template = tgp_examiner_learning_template + location = scope:location + save_scope_as = new_examiner + } + } + } + else = { + create_character = { + template = tgp_examiner_learning_template + location = scope:location + save_scope_as = new_examiner + } + } +} + +#Grab any eligible examiners, pre-Activity +imperial_examination_set_up_examiners_effect = { + scope:activity.activity_location = { save_scope_as = location } + #Got anyone else we can invite to be an examiner? + $HOST$ = { + ordered_courtier = { + limit = { + has_trait = confucian_education + trigger_if = { + limit = { + scope:activity = { + has_activity_type = activity_imperial_examination + } + } + has_character_flag = passed_metropolitan_exam + } + trigger_else = { + has_character_flag = passed_provincial_exam + } + is_available_imperial_examiner_trigger = { ATTENDING_CHAR = $HOST$ } + #It's not one of our dedicated examiners + save_temporary_scope_as = char_check + scope:activity = { + NOT = { + is_target_in_variable_list = { + name = imperial_examiners_list + target = scope:char_check + } + } + } + } + order_by = imperial_examination_entry_value + max = examiners_amount + check_range_bounds = no #Don't care if this is 0 + save_temporary_scope_as = temp_char + #Yes we do it this way to pull in people who might not be interested in being Entrants + scope:activity = { + add_to_variable_list = { + name = imperial_examiners_list + target = scope:temp_char + } + } + } + } + #Check for available landed rulers visiting the event (AI only) + if = { + limit = { + scope:activity = { + OR = { + NOT = { has_variable_list = imperial_examiners_list } + variable_list_size = { + name = imperial_examiners_list + value < examiners_amount + } + } + } + } + #List exists + scope:activity = { + if = { + limit = { + has_variable_list = imperial_examiners_list + variable_list_size = { + name = imperial_examiners_list + value < examiners_amount + } + } + while = { + limit = { + variable_list_size = { + name = imperial_examiners_list + value < examiners_amount + } + any_attending_character = { + location = scope:activity_location + this != scope:host + is_ai = yes + tgp_gender_can_be_exam_entrant_trigger = yes + trigger_if = { + limit = { + scope:activity = { + has_activity_type = activity_imperial_examination + } + } + has_character_flag = passed_metropolitan_exam + } + trigger_else = { + has_character_flag = passed_provincial_exam + } + } + } + random_attending_character = { + limit = { + location = scope:activity_location + is_ai = yes + this != scope:host + tgp_gender_can_be_exam_entrant_trigger = yes + trigger_if = { + limit = { + scope:activity = { + has_activity_type = activity_imperial_examination + } + } + has_character_flag = passed_metropolitan_exam + } + trigger_else = { + has_character_flag = passed_provincial_exam + } + } + save_scope_as = new_examiner + } + #Yes we do it this way to pull in people who might not be interested in being Entrants + add_to_variable_list = { + name = imperial_examiners_list + target = scope:new_examiner + } + } + } + #List doesn't exist + else = { + while = { + count = examiners_amount + limit = { + any_attending_character = { + location = scope:activity.activity_location + is_ai = yes + #tgp_gender_can_be_exam_entrant_trigger = yes + trigger_if = { + limit = { + scope:activity = { + has_activity_type = activity_imperial_examination + } + } + has_character_flag = passed_metropolitan_exam + } + trigger_else = { + has_character_flag = passed_provincial_exam + } + } + } + random_attending_character = { + limit = { + location = scope:activity.activity_location + is_ai = yes + #tgp_gender_can_be_exam_entrant_trigger = yes + trigger_if = { + limit = { + scope:activity = { + has_activity_type = activity_imperial_examination + } + } + has_character_flag = passed_metropolitan_exam + } + trigger_else = { + has_character_flag = passed_provincial_exam + } + } + save_scope_as = new_examiner + } + #Yes we do it this way to pull in people who might not be interested in being Entrants + add_to_variable_list = { + name = imperial_examiners_list + target = scope:new_examiner + } + } + } + } + } + + #Check for available pool examiners first + if = { + limit = { + scope:activity = { + OR = { + NOT = { has_variable_list = imperial_examiners_list } + variable_list_size = { + name = imperial_examiners_list + value < examiners_amount + } + } + } + } + #List exists + if = { + limit = { + scope:activity = { + has_variable_list = imperial_examiners_list + variable_list_size = { + name = imperial_examiners_list + value < examiners_amount + } + } + } + while = { + limit = { + scope:activity = { + variable_list_size = { + name = imperial_examiners_list + value < examiners_amount + } + } + any_pool_character = { + province = scope:location + has_trait = confucian_education + trigger_if = { + limit = { + scope:activity = { + has_activity_type = activity_imperial_examination + } + } + has_character_flag = passed_metropolitan_exam + } + trigger_else = { + has_character_flag = passed_provincial_exam + } + is_available_imperial_examiner_trigger = { ATTENDING_CHAR = $HOST$ } + } + } + random_pool_character = { + province = scope:location + limit = { + has_trait = confucian_education + trigger_if = { + limit = { + scope:activity = { + has_activity_type = activity_imperial_examination + } + } + has_character_flag = passed_metropolitan_exam + } + trigger_else = { + has_character_flag = passed_provincial_exam + } + is_available_imperial_examiner_trigger = { ATTENDING_CHAR = $HOST$ } + } + save_scope_as = new_examiner + #Add as courtier, if possible + if = { + limit = { + NOT = { is_courtier_of = $HOST$ } + } + $HOST$ = { add_courtier = scope:new_examiner } + } + } + #Yes we do it this way to pull in people who might not be interested in being Entrants + scope:activity = { + add_to_variable_list = { + name = imperial_examiners_list + target = scope:new_examiner + } + } + } + } + #List doesn't exist + else = { + while = { + count = examiners_amount + limit = { + any_pool_character = { + province = scope:location + has_trait = confucian_education + trigger_if = { + limit = { + scope:activity = { + has_activity_type = activity_imperial_examination + } + } + has_character_flag = passed_metropolitan_exam + } + trigger_else = { + has_character_flag = passed_provincial_exam + } + is_available_imperial_examiner_trigger = { ATTENDING_CHAR = $HOST$ } + } + } + random_pool_character = { + province = scope:location + limit = { + has_trait = confucian_education + trigger_if = { + limit = { + scope:activity = { + has_activity_type = activity_imperial_examination + } + } + has_character_flag = passed_metropolitan_exam + } + trigger_else = { + has_character_flag = passed_provincial_exam + } + is_available_imperial_examiner_trigger = { ATTENDING_CHAR = $HOST$ } + } + save_scope_as = new_examiner + #Add as courtier, if possible + if = { + limit = { + NOT = { is_courtier_of = $HOST$ } + } + $HOST$ = { add_courtier = scope:new_examiner } + } + } + #Yes we do it this way to pull in people who might not be interested in being Entrants + scope:activity = { + add_to_variable_list = { + name = imperial_examiners_list + target = scope:new_examiner + } + } + } + } + } + #Then start creating them + if = { + limit = { + scope:activity = { + OR = { + NOT = { has_variable_list = imperial_examiners_list } + variable_list_size = { + name = imperial_examiners_list + value < examiners_amount + } + } + } + } + #List exists + if = { + limit = { + scope:activity = { + has_variable_list = imperial_examiners_list + variable_list_size = { + name = imperial_examiners_list + value < examiners_amount + } + } + } + while = { + limit = { + scope:activity = { + variable_list_size = { + name = imperial_examiners_list + value < examiners_amount + } + } + } + imperial_examination_create_appropriate_examiner_effect = yes + scope:new_examiner = { + if = { + limit = { + scope:activity = { + has_activity_type = activity_imperial_examination + } + } + add_character_flag = passed_metropolitan_exam + } + else = { + add_character_flag = passed_provincial_exam + } + } + $HOST$ = { add_courtier = scope:new_examiner } + scope:activity = { + add_to_variable_list = { + name = imperial_examiners_list + target = scope:new_examiner + } + } + } + } + #List doesn't exist + else = { + while = { + count = examiners_amount + imperial_examination_create_appropriate_examiner_effect = yes + scope:new_examiner = { + if = { + limit = { + scope:activity = { + has_activity_type = activity_imperial_examination + } + } + add_character_flag = passed_metropolitan_exam + } + else = { + add_character_flag = passed_provincial_exam + } + } + $HOST$ = { add_courtier = scope:new_examiner } + scope:activity = { + add_to_variable_list = { + name = imperial_examiners_list + target = scope:new_examiner + } + } + } + } + } + #Add 'em to the activity + every_in_list = { + variable = imperial_examiners_list + limit = { + NOR = { + exists = involved_activity + scope:activity = { + any_attending_character = { this = scope:new_examiner } + } + any_invited_activity = { this = scope:activity } + } + } + add_to_activity = scope:activity + } +} + +#When the Activity is concluded +imperial_examination_clean_up_variables_effect = { + #Exams + remove_variable ?= had_essay_examination + remove_variable ?= had_classics_examination + remove_variable ?= had_poetry_examination + remove_variable ?= had_archery_examination + remove_variable ?= had_polearm_examination + remove_variable ?= had_riding_examination + remove_variable ?= been_caught_cheating + remove_variable ?= been_caught_cheating_longterm + remove_variable ?= imperial_examination_score + remove_variable ?= temporary_exam_score + remove_variable ?= discovering_examiner + remove_character_flag ?= exam_cheat_intent + remove_character_flag ?= exam_perform_intent + remove_character_flag ?= set_activity_intent + remove_variable ?= has_perfect_score + remove_variable ?= has_great_score + remove_variable ?= has_decent_score + remove_variable ?= has_questionable_score + #Cheats + remove_variable ?= has_exam_taker + remove_variable ?= has_bribed_examiner + remove_variable ?= has_blackmailed_examiner + remove_variable ?= has_planted_answers + remove_variable ?= parent_has_bribed_examiner + #Advantages + remove_variable ?= has_exam_advantage + remove_variable ?= has_stayed_up_studying + remove_variable ?= has_studied_with_friend + #Palace Flags + remove_character_flag ?= palace_success + remove_character_flag ?= palace_great_success + remove_character_flag ?= palace_critical_success + remove_character_flag ?= safe_start +} + +#Run at the beginning of the Activity +imperial_examination_gather_examiners_effect = { + scope:activity = { + every_attending_character = { + limit = { + scope:activity = { + is_target_in_variable_list = { + name = imperial_examiners_list + target = prev + } + } + } + save_temporary_scope_as = temp_char + scope:temp_char = { + add_character_flag = imperial_examiner + } + scope:activity = { + add_to_guest_subset = { + name = imperial_examiners + target = scope:temp_char + } + } + } + } +} + +imperial_examination_gather_guests_effect = { + scope:activity = { + every_attending_character = { + limit = { + # You should get as many shots at the Palace Exam as you want. + has_character_flag = passed_palace_exam + NOR = { + this = scope:host + is_in_guest_subset = { name = imperial_examiners } + is_in_guest_subset = { name = entrants } + } + } + save_temporary_scope_as = temp_character + scope:activity = { + add_to_guest_subset = { + name = guests + target = scope:temp_character + } + } + } + } +} + +imperial_examination_gather_entrants_effect = { + scope:activity = { + set_variable = { + name = num_initial_entrants + value = 0 + } + every_attending_character = { + limit = { + is_landed = no + tgp_gender_can_be_exam_entrant_trigger = yes + trigger_if = { + limit = { + exists = primary_title + } + primary_title = { + is_mercenary_company = no + is_holy_order = no + } + } + NOR = { + this = scope:host + is_in_guest_subset = { name = imperial_examiners } + has_court_position = travel_leader_court_position + has_court_position = bodyguard_court_position + # If you are a player, you should get as many shots at the Palace Exam as you want. + has_character_flag = passed_palace_exam + has_trait = devoted + has_trait = eunuch + } + # Remove diarchs from the list. + bannable_serving_diarch_trigger = no + is_adult = yes + } + save_temporary_scope_as = temp_character + scope:activity = { + add_to_guest_subset = { + name = entrants + target = scope:temp_character + } + } + set_variable = { + name = imperial_examination_score + value = imperial_examination_score_value + } + if = { + limit = { + is_ai = yes + } + set_activity_intent = imperial_exam_taker_intent + } + } + #Run seperately to make sure we include characters added to the entrants subset through edge cases. + every_guest_subset = { + name = entrants + #Record the initial amount of entrants + scope:activity = { + change_variable = { + name = num_initial_entrants + add = 1 + } + } + } + #Set the base amount of failees we expect during the entire activity + set_variable = { + name = failee_quota + value = imperial_examination_failee_quota_value + } + if = { limit = { exists = var:failee_quota } } + } +} + +local_examination_gather_entrants_effect = { + scope:activity = { + set_variable = { + name = num_initial_entrants + value = 0 + } + every_attending_character = { + limit = { + is_landed = no + tgp_gender_can_be_exam_entrant_trigger = yes + trigger_if = { + limit = { + exists = primary_title + } + primary_title = { + is_mercenary_company = no + is_holy_order = no + } + } + NOR = { + this = scope:host + is_in_guest_subset = { name = imperial_examiners } + has_court_position = travel_leader_court_position + has_court_position = bodyguard_court_position + # You have passed the any of the higher level exams + has_character_flag = passed_metropolitan_exam + # You have already passed the Provincial + has_character_flag = passed_provincial_exam + has_trait = devoted + has_trait = eunuch + } + # Remove diarchs from the list. + bannable_serving_diarch_trigger = no + is_adult = yes + } + save_temporary_scope_as = temp_character + scope:activity = { + add_to_guest_subset = { + name = entrants + target = scope:temp_character + } + } + set_variable = { + name = imperial_examination_score + value = imperial_examination_score_value + } + if = { + limit = { + is_ai = yes + } + set_activity_intent = local_exam_taker_intent + } + } + #Run seperately to make sure we include characters added to the entrants subset through edge cases. + every_guest_subset = { + name = entrants + scope:activity = { + change_variable = { + name = num_initial_entrants + add = 1 + } + } + } + #Set the base amount of failees we expect during the entire activity + set_variable = { + name = failee_quota + value = imperial_examination_failee_quota_value + } + if = { limit = { exists = var:failee_quota } } + } +} + +imperial_examination_gather_stray_entrants_effect = { + if = { + # Before we add anyone to the activity, we have to make sure it is not already full. + limit = { + scope:activity = { + OR = { + AND = { + has_activity_option = { + category = imperial_examination_breadth + option = imperial_examination_breadth_exclusive + } + any_attending_character = { + count < exclusive_exam_guests_full_calc + } + } + AND = { + has_activity_option = { + category = imperial_examination_breadth + option = imperial_examination_breadth_restricted + } + any_attending_character = { + count < restricted_exam_guests_full_calc + } + } + AND = { + has_activity_option = { + category = imperial_examination_breadth + option = imperial_examination_breadth_open + } + any_attending_character = { + count < open_exam_guests_full_calc + } + } + } + } + } + every_courtier = { + limit = { + involved_activity ?= scope:activity + this != root + is_landed = no + trigger_if = { + limit = { + scope:activity = { + has_activity_type = activity_imperial_examination + } + } + NOT = { has_character_flag = passed_palace_exam} + } + trigger_else = { + NOR = { + has_character_flag = passed_provincial_exam + has_character_flag = passed_metropolitan_exam + } + } + # To make sure no characters appear that shouldn't. + NOR = { + has_trait = devoted + has_trait = eunuch + } + trigger_if = { + limit = { + exists = primary_title + } + primary_title = { + is_mercenary_company = no + is_holy_order = no + } + } + # Remove diarchs from the list. + bannable_serving_diarch_trigger = no + tgp_gender_can_be_exam_entrant_trigger = yes + } + add_to_list = entourage_entrants + } + current_travel_plan ?= { + every_entourage_character = { + limit = { + this != root + is_landed = no + trigger_if = { + limit = { + scope:activity = { + has_activity_type = activity_imperial_examination + } + } + NOT = { has_character_flag = passed_palace_exam} + } + trigger_else = { + NOR = { + has_character_flag = passed_provincial_exam + has_character_flag = passed_metropolitan_exam + } + } + # To make sure no characters appear that shouldn't. + NOR = { + has_trait = devoted + has_trait = eunuch + } + trigger_if = { + limit = { + exists = primary_title + } + primary_title = { + is_mercenary_company = no + is_holy_order = no + } + } + # Remove diarchs from the list. + bannable_serving_diarch_trigger = no + tgp_gender_can_be_exam_entrant_trigger = yes + } + add_to_list = entourage_entrants + } + } + every_in_list = { + list = entourage_entrants + if = { + limit = { + can_join_activity = scope:activity + NOT = { + involved_activity ?= scope:activity + } + location = scope:activity.activity_location + } + add_to_activity_without_travel = scope:activity + } + if = { + limit = { + involved_activity ?= scope:activity + } + scope:activity = { + add_to_guest_subset = { + name = entrants + target = prev + } + } + set_variable = { + name = imperial_examination_score + value = imperial_examination_score_value + } + } + } + } +} + +metropolitan_examination_scoreboard_setup_effect = { + #Do we actually have 10 entrants for the scoreboard? + set_variable = { + name = scoreboard_size + value = 0 + } + if = { + limit = { + any_guest_subset = { + name = entrants + count >= 10 + } + } + change_variable = { + name = scoreboard_size + add = 10 + } + } + #Otherwise set the scoreboard size to the amount of entrants + else = { + every_guest_subset = { + name = entrants + scope:activity = { + change_variable = { + name = scoreboard_size + add = 1 + } + } + } + } + #Add the fresh entrants to the scoreboard + while = { + count = 1 + ordered_attending_character = { + limit = { + or = { + is_in_guest_subset = { name = entrants } + } + NOR = { + is_in_guest_subset = { name = scoreboard } + scope:activity = { + any_guest_subset = { + name = scoreboard + count = scope:activity.var:scoreboard_size + } + } + } + } + order_by = imperial_examination_score_value + save_temporary_scope_as = temp_character + scope:activity = { + add_to_guest_subset = { + name = scoreboard + target = scope:temp_character + } + } + } + } +} + +palace_examination_scoreboard_setup_effect = { + #Do we actually have 10 entrants for the scoreboard? + set_variable = { + name = scoreboard_size + value = 0 + } + if = { + limit = { + any_guest_subset = { + name = palace_entrants + count >= 10 + } + } + change_variable = { + name = scoreboard_size + add = 10 + } + } + #Otherwise set the scoreboard size to the amount of entrants + else = { + every_guest_subset = { + name = palace_entrants + scope:activity = { + change_variable = { + name = scoreboard_size + add = 1 + } + } + } + } + #Add the fresh entrants to the scoreboard + while = { + count = 1 + ordered_attending_character = { + limit = { + is_in_guest_subset = { name = palace_entrants } + NOR = { + is_in_guest_subset = { name = scoreboard } + scope:activity = { + any_guest_subset = { + name = scoreboard + count = scope:activity.var:scoreboard_size + } + } + } + } + order_by = imperial_examination_score_value + save_temporary_scope_as = temp_character + scope:activity = { + add_to_guest_subset = { + name = scoreboard + target = scope:temp_character + } + } + } + } +} + + +#Run at the end of each Phase +imperial_examination_determine_exam_outcome_effect = { + #Get the people in the last place and fail them + scope:activity = { + #Account for the cheating AI entrants + every_guest_subset = { + name = entrants + limit = { has_variable = been_caught_cheating } + set_variable = failee_to_be_removed + } + #Otherwise run through the list and trim it from the bottom up + if = { + limit = { imperial_examination_failee_quota_value > 0 } + ordered_guest_subset = { + name = entrants + limit = { + NOT = { has_variable = failee_to_be_removed } + } + order_by = { + value = temporary_exam_score_value + multiply = -1 + } + max = imperial_examination_failee_quota_value + check_range_bounds = no + set_variable = failee_to_be_removed + } + } + } +} + +imperial_examination_prune_failees_effect = { + if = { + limit = { has_variable = failee_to_be_removed } + save_temporary_scope_as = temp_char + #Don't fail players + if = { + limit = { is_ai = yes } + scope:activity = { + remove_from_guest_subset = { + name = entrants + target = scope:temp_char + } + add_to_guest_subset = { + name = failees + target = scope:temp_char + } + } + } + remove_variable ?= failee_to_be_removed + } +} + +#After each Phase +imperial_examination_clean_up_phase_variables_effect = { + scope:activity = { + every_attending_character = { + #Exams + remove_variable ?= had_essay_examination + remove_variable ?= had_classics_examination + remove_variable ?= had_poetry_examination + remove_variable ?= been_caught_cheating + #Cheats + remove_variable ?= has_exam_taker + remove_variable ?= has_bribed_examiner + #Advantages + remove_variable ?= has_exam_advantage + remove_variable ?= has_stayed_up_studying + remove_variable ?= has_studied_with_friend + #Events + remove_variable ?= has_greeted_palace_entrants + } + } +} + +imperial_examination_guest_sort_effect = { + save_scope_value_as = { + name = exam_invited_guests_amount + value = { + value = 0 + add = exam_invited_guests_amount_calc + } + } + while = { + count = scope:exam_invited_guests_amount + random_in_list = { + list = potential_exam_guest_list + limit = { + NOT = { is_in_list = characters } + } + add_to_list = characters + } + } +} + +imperial_examination_entrants_sort_effect = { + save_scope_value_as = { + name = exam_invited_guests_amount + value = { + value = 0 + add = exam_invited_entrants_amount_calc + } + } + while = { + count = scope:exam_invited_guests_amount + random_in_list = { + list = potential_exam_entrants_list + limit = { + NOT = { is_in_list = characters } + } + add_to_list = characters + } + } +} + +examination_clear_timeout_effect = { + if = { # If we still have a short duration remaining on our appointment timeout, clear it + limit = { + appointment_timeout_days > 0 + appointment_timeout_days < 365 + } + clear_appointment_timeout = yes + } +} + +imperial_examination_grab_nr_of_family_entrants_effect = { + set_variable = { + name = num_exam_family_entrants + value = 0 + } + every_in_list = { + list = parent_relevant_entrants + root = { + change_variable = { + name = num_exam_family_entrants + add = 1 + } + } + } + # Then measure how many characters did pass the exam + set_variable = { + name = num_exam_family_entrants_passed + value = 0 + } + every_in_list = { + list = parent_relevant_entrants + limit = { + OR = { + has_character_flag = passed_palace_exam + has_character_flag = passed_metropolitan_exam + } + } + root = { + change_variable = { + name = num_exam_family_entrants_passed + add = 1 + } + } + } + # More specifically, how many passed the Metropolitan exam + set_variable = { + name = num_exam_family_passed_metropolitan + value = 0 + } + every_in_list = { + list = parent_relevant_entrants + limit = { + has_character_flag = passed_metropolitan_exam + NOT = { has_character_flag = passed_palace_exam } + } + root = { + change_variable = { + name = num_exam_family_passed_metropolitan + add = 1 + } + } + } + # And how many made it to the Palace exam + set_variable = { + name = num_exam_family_passed_palace + value = 0 + } + every_in_list = { + list = parent_relevant_entrants + limit = { + has_character_flag = passed_palace_exam + } + root = { + change_variable = { + name = num_exam_family_passed_palace + add = 1 + } + } + } + # Finally, how many did bitterly disappoint... + set_variable = { + name = num_exam_family_entrants_failed + value = 0 + } + every_in_list = { + list = parent_relevant_entrants + limit = { has_character_flag = failed_imperial_examination } + root = { + change_variable = { + name = num_exam_family_entrants_failed + add = 1 + } + } + } +} + +local_examination_grab_nr_of_family_entrants_effect = { + set_variable = { + name = num_exam_family_entrants + value = 0 + } + every_in_list = { + list = parent_relevant_entrants + root = { + change_variable = { + name = num_exam_family_entrants + add = 1 + } + } + } + # Then measure how many characters did pass the exam + set_variable = { + name = num_exam_family_entrants_passed + value = 0 + } + every_in_list = { + list = parent_relevant_entrants + limit = { has_character_flag = passed_provincial_exam } + root = { + change_variable = { + name = num_exam_family_entrants_passed + add = 1 + } + } + } + # Finally, how many did bitterly disappoint... + set_variable = { + name = num_exam_family_entrants_failed + value = 0 + } + every_in_list = { + list = parent_relevant_entrants + limit = { + NOT = { has_character_flag = passed_provincial_exam } + } + root = { + change_variable = { + name = num_exam_family_entrants_failed + add = 1 + } + } + } +} \ No newline at end of file diff --git a/N3OW/common/scripted_effects/tgp_mandala_scripted_effects.txt b/N3OW/common/scripted_effects/tgp_mandala_scripted_effects.txt new file mode 100644 index 00000000..389e3e8e --- /dev/null +++ b/N3OW/common/scripted_effects/tgp_mandala_scripted_effects.txt @@ -0,0 +1,3736 @@ + + + +##Mandala Capital Great Project Contribution Rewards +mandala_owner_reward_01_effect = { + add_prestige = major_prestige_value + dynasty = { add_dynasty_prestige = major_dynasty_prestige_gain } + add_legitimacy = medium_legitimacy_gain +} + +mandala_contributor_reward_effect = { + add_prestige = major_prestige_value + add_legitimacy = miniscule_legitimacy_gain +} + +mandala_contributor_opinion_reward_effect = { + $OVERLORD$ = { save_scope_as = overlord_scope } + add_prestige = major_prestige_value + add_legitimacy = miniscule_legitimacy_gain +} + +gather_contributors_in_list_effect = { + every_contribution = { + limit = { contribution_is_funded = yes } + contributor = { + if = { + limit = { + scope:great_project = { + trigger_if = { + limit = { has_variable = plundered_contributors } + NOT = { + is_target_in_variable_list = { + name = plundered_contributors + target = prev + } + } + } + } + } + add_to_list = contributors_to_reward + } + } + } +} + +determine_if_contributed_and_save_scope_effect = { + scope:great_project = { + if = { + limit = { + any_contribution = { + contribution_id = $CONTRIBUTION$ + contribution_is_funded = yes + } + } + every_contribution = { + limit = { + contribution_id = $CONTRIBUTION$ + contribution_is_funded = yes + } + contributor = { + if = { + limit = { + is_alive = no + house = scope:owner.house + } + scope:owner = { save_scope_as = contributed_$CONTRIBUTION$ } + } + else = { + save_scope_as = contributed_$CONTRIBUTION$ + } + } + } + } + } +} + + +### Capital 01 Breakdown Effects ### +mandala_contributor_minor_rite_reward_effect = { + add_legitimacy = mandala_contribution_minor_legitimacy_reward + add_piety_experience = mandala_contribution_medium_dynasty_reward +} +contributed_rites_of_worthiness_effect = { + custom_description_no_bullet = { text = contributed_rite_of_worthiness } + mandala_contributor_minor_rite_reward_effect = yes +} + +mandala_contributor_slabs_of_sandstone_reward_effect = { add_prestige = mandala_contribution_major_prestige_reward } +contributed_slabs_of_sandstone_effect = { + custom_description_no_bullet = { text = contributed_slabs_of_sandstone } + mandala_contributor_slabs_of_sandstone_reward_effect = yes +} + +mandala_contributor_laterite_blocks_reward_effect = { + add_prestige = mandala_contribution_medium_prestige_reward + add_piety_experience = mandala_contribution_minor_dynasty_reward +} +contributed_laterite_blocks_effect = { + custom_description_no_bullet = { text = contributed_laterite_blocks } + mandala_contributor_laterite_blocks_reward_effect = yes +} + +mandala_contributor_timber_reward_effect = { add_prestige_experience = mandala_contribution_minor_prestige_reward } +contributed_timber_effect = { + custom_description_no_bullet = { text = contributed_timber } + mandala_contributor_timber_reward_effect = yes +} + +mandala_contributor_work_force_reward_effect = { + add_character_modifier = { + modifier = mandala_strong_workers_modifier + years = 15 + } +} +contributed_work_force_effect = { + custom_description_no_bullet = { text = contributed_work_force } + mandala_contributor_work_force_reward_effect = yes +} + +mandala_contributor_woodcarvings_reward_effect = { + add_legitimacy = { + value = { + add = mandala_contribution_minor_legitimacy_reward + multiply = 1.5 + #Rounds up to the closest number divisible by 5 + divide = 5 + ceiling = yes + multiply = 5 + } + } +} +contributed_woodcarvings_effect = { + custom_description_no_bullet = { text = contributed_woodcarvings } + mandala_contributor_woodcarvings_reward_effect = yes +} + +mandala_contributor_sanctified_domes_reward_effect = { + custom_tooltip = mandala_contributor_sanctified_domes_reward_effect_tt + if = { + limit = { this != scope:owner } + add_prestige = { + value = { + add = mandala_contribution_medium_prestige_reward + multiply = 1.5 + #Rounds up to the closest number divisible by 5 + divide = 5 + ceiling = yes + multiply = 5 + } + } + } + hidden_effect = { + scope:owner.dynasty = { + add_dynasty_modifier = { modifier = mandala_sanctified_domes_dynasty_modifier } + } + } +} +contributed_sanctified_domes_effect = { + custom_description_no_bullet = { text = contributed_sanctified_domes } + mandala_contributor_sanctified_domes_reward_effect = yes +} + +mandala_contributor_ornate_reliefs_reward_effect = { + if = { + limit = { this = scope:owner } + if = { + limit = { exists = scope:province } + scope:province = { + add_province_modifier = { modifier = mandala_ornate_reliefs_tax_province_modifier } + } + } + else = { + scope:owner.capital_province = { + add_province_modifier = { modifier = mandala_ornate_reliefs_tax_province_modifier } + } + } + } + else = { + add_character_modifier = { + modifier = mandala_ornate_reliefs_tax_modifier + years = 10 + } + } +} +contributed_ornate_reliefs_effect = { + custom_description_no_bullet = { text = contributed_ornate_reliefs } + mandala_contributor_ornate_reliefs_reward_effect = yes +} + +mandala_contributor_family_shrine_reward_effect = { + dynasty = { add_dynasty_prestige = medium_dynasty_prestige_value } + player_heir ?= { add_piety_experience = medium_piety_value } +} +contributed_family_shrine_effect = { + custom_description_no_bullet = { text = contributed_family_shrine } + mandala_contributor_family_shrine_reward_effect = yes +} + +#The actual effect +check_and_reward_contributions_01_effect = { + if = { + limit = { scope:contributed_rite_of_worthiness ?= root } + contributed_rites_of_worthiness_effect = yes + } + if = { + limit = { scope:contributed_slabs_of_sandstone ?= root } + contributed_slabs_of_sandstone_effect = yes + } + if = { + limit = { scope:contributed_laterite_blocks ?= root } + contributed_laterite_blocks_effect = yes + } + if = { + limit = { scope:contributed_timber ?= root } + contributed_timber_effect = yes + } + if = { + limit = { scope:contributed_work_force ?= root } + contributed_work_force_effect = yes + } + if = { + limit = { scope:contributed_woodcarvings ?= root } + contributed_woodcarvings_effect = yes + } + if = { + limit = { scope:contributed_sanctified_domes ?= root } + contributed_sanctified_domes_effect = yes + } + if = { + limit = { scope:contributed_ornate_reliefs ?= root } + contributed_ornate_reliefs_effect = yes + } + if = { + limit = { scope:contributed_family_shrine ?= root } + contributed_family_shrine_effect = yes + } +} + + +### Capital 02 Breakdown Effects ### + +#mandala_contributor_minor_rite_reward_effect Reused from Capital 01 +#contributed_rites_of_worthiness_effect Reused from Capital 01 + +mandala_contributor_brick_reward_effect = { add_prestige = mandala_contribution_major_prestige_reward } +contributed_brick_effect = { + custom_description_no_bullet = { text = contributed_brick } + mandala_contributor_brick_reward_effect = yes +} + +mandala_contributor_tiles_reward_effect = { + add_prestige = { + value = { + add = mandala_contribution_medium_prestige_reward + multiply = 1.5 + #Rounds up to the closest number divisible by 5 + divide = 5 + ceiling = yes + multiply = 5 + } + } + add_piety_experience = mandala_contribution_medium_dynasty_reward +} +contributed_tiles_effect = { + custom_description_no_bullet = { text = contributed_tiles } + mandala_contributor_tiles_reward_effect = yes +} + +mandala_contributor_shallow_pools_reward_effect = { + if = { + limit = { this != scope:owner } + add_prestige = { + value = { + add = mandala_contribution_medium_prestige_reward + multiply = 1.5 + } + } + } + if = { + limit = { exists = scope:province } + custom_tooltip = mandala_contributor_shallow_pools_reward_province_effect_tt + hidden_effect = { + scope:province = { + add_province_modifier = { modifier = mandala_shallow_pools_defense_modifier } + } + } + } + else = { + custom_tooltip = mandala_contributor_shallow_pools_reward_effect_tt + hidden_effect = { + scope:owner.capital_province = { + add_province_modifier = { modifier = mandala_shallow_pools_defense_modifier } + } + } + } +} +contributed_shallow_pools_effect = { + custom_description_no_bullet = { text = contributed_shallow_pools } + mandala_contributor_shallow_pools_reward_effect = yes +} + +#mandala_contributor_work_force_reward_effect Reused from Capital 01 +#contributed_work_force_effect Reused from Capital 01 + +mandala_contributor_decorative_tiles_reward_effect = { + add_legitimacy = { + value = { + add = mandala_contribution_minor_legitimacy_reward + multiply = 1.5 + #Rounds up to the closest number divisible by 5 + divide = 5 + ceiling = yes + multiply = 5 + } + } +} +contributed_decorative_tiles_effect = { + custom_description_no_bullet = { text = contributed_decorative_tiles } + mandala_contributor_decorative_tiles_reward_effect = yes +} + +mandala_contributor_decorated_domes_reward_effect = { + if = { + limit = { this != scope:owner } + add_prestige = mandala_contribution_major_prestige_reward + } + scope:owner.dynasty = { + if = { + limit = { has_dynasty_modifier = mandala_sanctified_domes_dynasty_modifier } + scope:owner = { custom_tooltip = mandala_contributor_decorated_domes_reward_effect_tt_replaced } + hidden_effect = { + remove_dynasty_modifier = mandala_sanctified_domes_dynasty_modifier + add_dynasty_modifier = { modifier = mandala_decorated_domes_dynasty_modifier } + } + } + else = { + scope:owner = { custom_tooltip = mandala_contributor_decorated_domes_reward_effect_tt } + hidden_effect = { + add_dynasty_modifier = { modifier = mandala_decorated_domes_dynasty_modifier } + } + } + } +} +contributed_decorated_domes_effect = { + custom_description_no_bullet = { text = contributed_decorated_domes } + mandala_contributor_decorated_domes_reward_effect = yes +} + +mandala_contributor_family_statues_reward_effect = { + dynasty = { add_dynasty_prestige = major_dynasty_prestige_value } + player_heir ?= { + add_piety_experience = major_piety_value + } +} +contributed_family_statues_effect = { + custom_description_no_bullet = { text = contributed_family_statues } + mandala_contributor_family_statues_reward_effect = yes +} + +#The actual effect +check_and_reward_contributions_02_effect = { + if = { + limit = { scope:contributed_rite_of_worthiness ?= root } + contributed_rites_of_worthiness_effect = yes + } + if = { + limit = { scope:contributed_brick ?= root } + contributed_brick_effect = yes + } + if = { + limit = { scope:contributed_tiles ?= root } + contributed_tiles_effect = yes + } + if = { + limit = { scope:contributed_shallow_pools ?= root } + contributed_shallow_pools_effect = yes + } + if = { + limit = { scope:contributed_work_force ?= root } + contributed_work_force_effect = yes + } + if = { + limit = { scope:contributed_decorative_tiles ?= root } + contributed_decorative_tiles_effect = yes + } + if = { + limit = { scope:contributed_decorated_domes ?= root } + contributed_decorated_domes_effect = yes + } + if = { + limit = { scope:contributed_family_statues ?= root } + contributed_family_statues_effect = yes + } +} + + +### Capital 03 Breakdown Effects ### +mandala_contributor_medium_rite_reward_effect = { + add_legitimacy = mandala_contribution_medium_legitimacy_reward + add_piety_experience = mandala_contribution_major_dynasty_reward +} +contributed_rites_of_worthiness_02_effect = { + custom_description_no_bullet = { text = contributed_rite_of_worthiness } + mandala_contributor_medium_rite_reward_effect = yes +} + +mandala_contributor_volcanic_stone_reward_effect = { + add_prestige = { + value = { + add = mandala_contribution_major_prestige_reward + multiply = 1.25 + #Rounds up to the closest number divisible by 5 + divide = 5 + ceiling = yes + multiply = 5 + } + } +} +contributed_volcanic_stone_effect = { + custom_description_no_bullet = { text = contributed_volcanic_stone } + mandala_contributor_volcanic_stone_reward_effect = yes +} + +mandala_contributor_corbel_gateways_reward_effect = { + add_prestige = { + value = { + add = mandala_contribution_medium_prestige_reward + multiply = 1.75 + #Rounds up to the closest number divisible by 5 + divide = 5 + ceiling = yes + multiply = 5 + } + } + add_piety_experience = { + value = { + add = mandala_contribution_medium_dynasty_reward + multiply = 1.75 + #Rounds up to the closest number divisible by 5 + divide = 5 + ceiling = yes + multiply = 5 + } + } +} +contributed_corbel_gateways_effect = { + custom_description_no_bullet = { text = contributed_corbel_gateways } + mandala_contributor_corbel_gateways_reward_effect = yes +} + +mandala_contributor_divine_statues_reward_effect = { + if = { + limit = { this != scope:owner } + add_prestige = { + value = { + add = mandala_contribution_medium_prestige_reward + multiply = 1.5 + } + } + add_piety_experience = mandala_contribution_medium_dynasty_reward + } + if = { + limit = { exists = scope:province } + custom_tooltip = mandala_contributor_divine_statues_reward_province_effect_tt + hidden_effect = { + scope:province = { + add_province_modifier = { modifier = mandala_divine_statues_province_modifier } + } + } + } + else = { + custom_tooltip = mandala_contributor_divine_statues_reward_effect_tt + hidden_effect = { + scope:owner.capital_province = { + add_province_modifier = { modifier = mandala_divine_statues_province_modifier } + } + } + } +} +contributed_divine_statues_effect = { + custom_description_no_bullet = { text = contributed_divine_statues } + mandala_contributor_divine_statues_reward_effect = yes +} + +#mandala_contributor_work_force_reward_effect Reused from Capital 01 +#contributed_work_force_effect Reused from Capital 01 + +mandala_contributor_creation_aspect_reward_effect = { + add_stewardship_skill = 1 + if = { + limit = { exists = scope:province } + custom_tooltip = mandala_contributor_creation_aspect_statues_reward_province_effect_tt + hidden_effect = { + scope:province = { + add_province_modifier = { modifier = mandala_creation_aspect_statues_modifier } + } + } + } + else = { + custom_tooltip = mandala_contributor_creation_aspect_statues_reward_effect_tt + hidden_effect = { + scope:owner.capital_province = { + add_province_modifier = { modifier = mandala_creation_aspect_statues_modifier } + } + } + } +} +contributed_creation_aspect_effect = { + custom_description_no_bullet = { text = contributed_creation_aspect } + mandala_contributor_creation_aspect_reward_effect = yes +} + +mandala_contributor_serenity_aspect_reward_effect = { + add_diplomacy_skill = 1 + if = { + limit = { exists = scope:province } + custom_tooltip = mandala_contributor_serenity_aspect_statues_reward_province_effect_tt + hidden_effect = { + scope:province = { + add_province_modifier = { modifier = mandala_serenity_aspect_statues_modifier } + } + } + } + else = { + custom_tooltip = mandala_contributor_serenity_aspect_statues_reward_effect_tt + hidden_effect = { + scope:owner.capital_province = { + add_province_modifier = { modifier = mandala_serenity_aspect_statues_modifier } + } + } + } +} +contributed_serenity_aspect_effect = { + custom_description_no_bullet = { text = contributed_serenity_aspect } + mandala_contributor_serenity_aspect_reward_effect = yes +} + +mandala_contributor_destruction_aspect_reward_effect = { + add_martial_skill = 1 + if = { + limit = { exists = scope:province } + custom_tooltip = mandala_contributor_destruction_aspect_statues_reward_province_effect_tt + hidden_effect = { + scope:province = { + add_province_modifier = { modifier = mandala_destruction_aspect_statues_modifier } + } + } + } + else = { + custom_tooltip = mandala_contributor_destruction_aspect_statues_reward_effect_tt + hidden_effect = { + scope:owner.capital_province = { + add_province_modifier = { modifier = mandala_destruction_aspect_statues_modifier } + } + } + } +} +contributed_destruction_aspect_effect = { + custom_description_no_bullet = { text = contributed_destruction_aspect } + mandala_contributor_destruction_aspect_reward_effect = yes +} + +mandala_contributor_trickery_aspect_reward_effect = { + add_intrigue_skill = 1 + if = { + limit = { exists = scope:province } + custom_tooltip = mandala_contributor_trickery_aspect_statues_reward_province_effect_tt + hidden_effect = { + scope:province = { + add_province_modifier = { modifier = mandala_trickery_aspect_statues_modifier } + } + } + } + else = { + custom_tooltip = mandala_contributor_trickery_aspect_statues_reward_effect_tt + hidden_effect = { + scope:owner.capital_province = { + add_province_modifier = { modifier = mandala_trickery_aspect_statues_modifier } + } + } + } +} +contributed_trickery_aspect_effect = { + custom_description_no_bullet = { text = contributed_trickery_aspect } + mandala_contributor_trickery_aspect_reward_effect = yes +} + +mandala_contributor_gilded_domes_reward_effect = { + if = { + limit = { this != scope:owner } + add_prestige = mandala_contribution_major_prestige_reward + } + scope:owner.dynasty = { + if = { + limit = { has_dynasty_modifier = mandala_sanctified_domes_dynasty_modifier } + scope:owner = { custom_tooltip = mandala_contributor_sanctified_gilded_domes_reward_effect_tt_replaced } + hidden_effect = { + remove_dynasty_modifier = mandala_sanctified_domes_dynasty_modifier + add_dynasty_modifier = { modifier = mandala_gilded_domes_dynasty_modifier } + } + } + else_if = { + limit = { has_dynasty_modifier = mandala_decorated_domes_dynasty_modifier } + scope:owner = { custom_tooltip = mandala_contributor_decorated_gilded_domes_reward_effect_tt_replaced } + hidden_effect = { + remove_dynasty_modifier = mandala_decorated_domes_dynasty_modifier + add_dynasty_modifier = { modifier = mandala_gilded_domes_dynasty_modifier } + } + } + else = { + scope:owner = { custom_tooltip = mandala_contributor_gilded_domes_reward_effect_tt } + hidden_effect = { + add_dynasty_modifier = { modifier = mandala_gilded_domes_dynasty_modifier } + } + } + } +} +contributed_gilded_domes_effect = { + custom_description_no_bullet = { text = contributed_gilded_domes } + mandala_contributor_gilded_domes_reward_effect = yes +} + +mandala_contributor_family_temple_compound_reward_effect = { + dynasty = { add_dynasty_prestige = major_dynasty_prestige_value } + player_heir ?= { + add_piety_experience = massive_piety_value + } +} +contributed_family_temple_compound_effect = { + custom_description_no_bullet = { text = contributed_family_temple_compound } + mandala_contributor_family_temple_compound_reward_effect = yes +} + +#The actual effect +check_and_reward_contributions_03_effect = { + if = { + limit = { scope:contributed_rite_of_worthiness ?= root } + contributed_rites_of_worthiness_02_effect = yes + } + if = { + limit = { scope:contributed_volcanic_stone ?= root } + contributed_volcanic_stone_effect = yes + } + if = { + limit = { scope:contributed_corbel_gateways ?= root } + contributed_corbel_gateways_effect = yes + } + if = { + limit = { scope:contributed_divine_statues ?= root } + contributed_divine_statues_effect = yes + } + if = { + limit = { scope:contributed_work_force ?= root } + contributed_work_force_effect = yes + } + if = { + limit = { scope:contributed_creation_aspect ?= root } + contributed_creation_aspect_effect = yes + } + if = { + limit = { scope:contributed_serenity_aspect ?= root } + contributed_serenity_aspect_effect = yes + } + if = { + limit = { scope:contributed_destruction_aspect ?= root } + contributed_destruction_aspect_effect = yes + } + if = { + limit = { scope:contributed_trickery_aspect ?= root } + contributed_trickery_aspect_effect = yes + } + if = { + limit = { scope:contributed_gilded_domes ?= root } + contributed_gilded_domes_effect = yes + } + if = { + limit = { scope:contributed_family_temple_compound ?= root } + contributed_family_temple_compound_effect = yes + } +} + + +### Capital 04 Breakdown Effects ### + +#mandala_contributor_medium_rite_reward_effect Reused from Capital 03 +#contributed_rites_of_worthiness_02_effect Reused from Capital 03 + +mandala_contributor_slabs_of_granite_reward_effect = { + add_prestige = { + value = { + add = mandala_contribution_major_prestige_reward + multiply = 1.25 + #Rounds up to the closest number divisible by 5 + divide = 5 + ceiling = yes + multiply = 5 + } + } +} +contributed_slabs_of_granite_effect = { + custom_description_no_bullet = { text = contributed_slabs_of_granite } + mandala_contributor_slabs_of_granite_reward_effect = yes +} + +mandala_contributor_zaungdans_reward_effect = { + add_prestige = { + value = { + add = mandala_contribution_medium_prestige_reward + multiply = 1.75 + #Rounds up to the closest number divisible by 5 + divide = 5 + ceiling = yes + multiply = 5 + } + } + add_piety_experience = { + value = { + add = mandala_contribution_medium_dynasty_reward + multiply = 1.75 + #Rounds up to the closest number divisible by 5 + divide = 5 + ceiling = yes + multiply = 5 + } + } +} +contributed_zaungdans_effect = { + custom_description_no_bullet = { text = contributed_zaungdans } + mandala_contributor_zaungdans_reward_effect = yes +} + +mandala_contributor_gilded_shrines_reward_effect = { + if = { + limit = { this != scope:owner } + add_prestige = { + value = { + add = mandala_contribution_medium_prestige_reward + multiply = 1.5 + } + } + add_piety_experience = mandala_contribution_medium_dynasty_reward + } + if = { + limit = { exists = scope:province } + custom_tooltip = mandala_contributor_gilded_shrines_reward_province_effect_tt + hidden_effect = { + scope:province = { + add_province_modifier = { modifier = mandala_gilded_shrines_province_modifier } + } + } + } + else = { + custom_tooltip = mandala_contributor_gilded_shrines_reward_effect_tt + hidden_effect = { + scope:owner.capital_province = { + add_province_modifier = { modifier = mandala_gilded_shrines_province_modifier } + } + } + } +} +contributed_gilded_shrines_effect = { + custom_description_no_bullet = { text = contributed_gilded_shrines } + mandala_contributor_gilded_shrines_reward_effect = yes +} + +#mandala_contributor_work_force_reward_effect Reused from Capital 01 +#contributed_work_force_effect Reused from Capital 01 + +mandala_contributor_bell_stupas_reward_effect = { + add_character_modifier = { modifier = mandala_bell_stupas_modifier } +} +contributed_bell_stupas_effect = { + custom_description_no_bullet = { text = contributed_bell_stupas } + mandala_contributor_bell_stupas_reward_effect = yes +} + +mandala_contributor_bejeweled_domes_reward_effect = { + if = { + limit = { this != scope:owner } + add_prestige = mandala_contribution_major_prestige_reward + } + scope:owner.dynasty = { + if = { + limit = { has_dynasty_modifier = mandala_sanctified_domes_dynasty_modifier } + scope:owner = { custom_tooltip = mandala_contributor_sanctified_bejeweled_domes_reward_effect_tt_replaced } + hidden_effect = { + remove_dynasty_modifier = mandala_sanctified_domes_dynasty_modifier + add_dynasty_modifier = { modifier = mandala_bejeweled_domes_dynasty_modifier } + } + } + else_if = { + limit = { has_dynasty_modifier = mandala_decorated_domes_dynasty_modifier } + scope:owner = { custom_tooltip = mandala_contributor_decorated_bejeweled_domes_reward_effect_tt_replaced } + hidden_effect = { + remove_dynasty_modifier = mandala_decorated_domes_dynasty_modifier + add_dynasty_modifier = { modifier = mandala_bejeweled_domes_dynasty_modifier } + } + } + else_if = { + limit = { has_dynasty_modifier = mandala_gilded_domes_dynasty_modifier } + scope:owner = { custom_tooltip = mandala_contributor_gilded_bejeweled_domes_reward_effect_tt_replaced } + hidden_effect = { + remove_dynasty_modifier = mandala_gilded_domes_dynasty_modifier + add_dynasty_modifier = { modifier = mandala_bejeweled_domes_dynasty_modifier } + } + } + else = { + scope:owner = { custom_tooltip = mandala_contributor_bejeweled_domes_reward_effect_tt } + hidden_effect = { + add_dynasty_modifier = { modifier = mandala_bejeweled_domes_dynasty_modifier } + } + } + } +} +contributed_bejeweled_domes_effect = { + custom_description_no_bullet = { text = contributed_bejeweled_domes } + mandala_contributor_bejeweled_domes_reward_effect = yes +} + +mandala_contributor_family_temple_complex_reward_effect = { + dynasty = { add_dynasty_prestige = monumental_dynasty_prestige_value } + player_heir ?= { + add_piety_experience = monumental_piety_value + } +} +contributed_family_temple_complex_effect = { + custom_description_no_bullet = { text = contributed_family_temple_complex } + mandala_contributor_family_temple_complex_reward_effect = yes +} + + +#The actual effect +check_and_reward_contributions_04_effect = { + if = { + limit = { scope:contributed_rite_of_worthiness ?= root } + contributed_rites_of_worthiness_02_effect = yes + } + if = { + limit = { scope:contributed_slabs_of_granite ?= root } + contributed_slabs_of_granite_effect = yes + } + if = { + limit = { scope:contributed_zaungdans ?= root } + contributed_zaungdans_effect = yes + } + if = { + limit = { scope:contributed_gilded_shrines ?= root } + contributed_gilded_shrines_effect = yes + } + if = { + limit = { scope:contributed_work_force ?= root } + contributed_work_force_effect = yes + } + if = { + limit = { scope:contributed_bell_stupas ?= root } + contributed_bell_stupas_effect = yes + } + if = { + limit = { scope:contributed_bejeweled_domes ?= root } + contributed_bejeweled_domes_effect = yes + } + if = { + limit = { scope:contributed_family_temple_complex ?= root } + contributed_family_temple_complex_effect = yes + } +} + + +### Capital 05 Breakdown Effects ### + +#mandala_contributor_medium_rite_reward_effect Reused from Capital 03 +#contributed_rites_of_worthiness_02_effect Reused from Capital 03 + +mandala_contributor_marble_foundation_reward_effect = { + add_prestige = { + value = { + add = mandala_contribution_major_prestige_reward + multiply = 1.5 + #Rounds up to the closest number divisible by 5 + divide = 5 + ceiling = yes + multiply = 5 + } + } + add_piety_experience = { + value = { + add = mandala_contribution_medium_dynasty_reward + multiply = 1.5 + #Rounds up to the closest number divisible by 5 + divide = 5 + ceiling = yes + multiply = 5 + } + } + add_legitimacy = mandala_contribution_medium_legitimacy_reward +} +contributed_marble_foundation_effect = { + custom_description_no_bullet = { text = contributed_marble_foundation } + mandala_contributor_marble_foundation_reward_effect = yes +} + +mandala_contributor_divine_barays_reward_effect = { + if = { + limit = { this != scope:owner } + add_prestige = { + value = { + add = mandala_contribution_medium_prestige_reward + multiply = 1.5 + } + } + } + if = { + limit = { exists = scope:province } + custom_tooltip = mandala_contributor_divine_barays_reward_province_effect_tt + hidden_effect = { + scope:province = { + add_province_modifier = { modifier = mandala_divine_barays_defense_modifier } + } + } + } + else = { + custom_tooltip = mandala_contributor_divine_barays_reward_effect_tt + hidden_effect = { + scope:owner.capital_province = { + add_province_modifier = { modifier = mandala_divine_barays_defense_modifier } + } + } + } +} +contributed_divine_barays_effect = { + custom_description_no_bullet = { text = contributed_divine_barays } + mandala_contributor_divine_barays_reward_effect = yes +} + +#mandala_contributor_work_force_reward_effect Reused from Capital 01 +#contributed_work_force_effect Reused from Capital 01 + +mandala_contributor_bejeweled_reliefs_reward_effect = { + #Before Planning has started + if = { + limit = { + scope:owner ?= { + any_character_artifact = { has_variable = mandala_capital_05_unconfirmed_talisman } + } + } + scope:owner = { + random_character_artifact = { + limit = { has_variable = mandala_capital_05_unconfirmed_talisman } + save_scope_as = target_talisman + } + } + if = { + limit = { + scope:owner = { + house ?= { has_house_power_parameter = aspect_of_creation } + } + } + custom_tooltip = mandala_contributor_bejeweled_reliefs_creator_reward_artifact_effect_tt + #Set the modifiers + hidden_effect = { + scope:target_talisman = { + set_artifact_description = mandala_capital_05_creation_talisman_desc + add_artifact_modifier = artifact_health_gain_2_modifier + add_artifact_modifier = artifact_fertility_gain_2_modifier + } + } + } + else_if = { + limit = { + scope:owner = { + house ?= { has_house_power_parameter = aspect_of_serenity } + } + } + custom_tooltip = mandala_contributor_bejeweled_reliefs_serenity_reward_artifact_effect_tt + #Set the modifiers + hidden_effect = { + scope:target_talisman = { + set_artifact_description = mandala_capital_05_serenity_talisman_desc + add_artifact_modifier = artifact_vassal_limit_1_modifier + add_artifact_modifier = artifact_short_reign_duration_mult_3_modifier + } + } + } + else_if = { + limit = { + scope:owner = { + house ?= { has_house_power_parameter = aspect_of_destruction } + } + } + custom_tooltip = mandala_contributor_bejeweled_reliefs_destruction_reward_artifact_effect_tt + #Set the modifiers + hidden_effect = { + scope:target_talisman = { + set_artifact_description = mandala_capital_05_destruction_talisman_desc + add_artifact_modifier = artifact_dread_baseline_add_2_modifier + add_artifact_modifier = artifact_pursue_efficiency_2_modifier + add_artifact_modifier = artifact_controlled_province_advantage_5_modifier + } + } + } + else_if = { + limit = { + scope:owner = { + house ?= { has_house_power_parameter = aspect_of_trickery } + } + } + custom_tooltip = mandala_contributor_bejeweled_reliefs_trickery_reward_artifact_effect_tt + #Set the modifiers + hidden_effect = { + scope:target_talisman = { + set_artifact_description = mandala_capital_05_trickery_talisman_desc + add_artifact_modifier = artifact_negate_health_penalty_add_2_modifier + add_artifact_modifier = artifact_scheme_resistance_add_3_modifier + } + } + } + scope:target_talisman = { + remove_variable = mandala_capital_05_unconfirmed_talisman + set_variable = mandala_capital_05_talisman + if = { + limit = { has_variable = mandala_capital_05_talisman } + #To prevent 'unused except in loc' errors :catto: + } + hidden_effect = { + set_artifact_rarity = famed + remove_artifact_modifier = artifact_monthly_piety_gain_mult_1_modifier + add_artifact_modifier = artifact_monthly_piety_gain_mult_5_modifier + } + } + } + #After planning has started + else_if = { + limit = { + this = { + house ?= { has_house_power_parameter = aspect_of_creation } + } + } + custom_tooltip = mandala_contributor_bejeweled_reliefs_creator_reward_pre_artifact_effect_tt + } + else_if = { + limit = { + this = { + house ?= { has_house_power_parameter = aspect_of_serenity } + } + } + custom_tooltip = mandala_contributor_bejeweled_reliefs_serenity_reward_pre_artifact_effect_tt + } + else_if = { + limit = { + this = { + house ?= { has_house_power_parameter = aspect_of_destruction } + } + } + custom_tooltip = mandala_contributor_bejeweled_reliefs_destruction_reward_pre_artifact_effect_tt + } + else_if = { + limit = { + this = { + house ?= { has_house_power_parameter = aspect_of_trickery } + } + } + custom_tooltip = mandala_contributor_bejeweled_reliefs_trickery_reward_pre_artifact_effect_tt + } + else = { custom_tooltip = mandala_contributor_bejeweled_reliefs_reward_artifact_effect_none_tt } + + #And set the owner, if the project owner neglected to do this Contribution + if = { + limit = { + NOT = { this = scope:owner } + exists = scope:target_talisman + } + if = { + limit = { exists = scope:target_talisman } + scope:target_talisman = { set_owner = prev } + } + else = { custom_tooltip = mandala_contributor_bejeweled_reliefs_reward_gain_artifact_effect_tt } + } + +} +contributed_bejeweled_reliefs_effect = { + custom_description_no_bullet = { text = contributed_bejeweled_reliefs } + mandala_contributor_bejeweled_reliefs_reward_effect = yes +} + +mandala_contributor_bunga_mas_forest_reward_effect = { + if = { + limit = { this != scope:owner } + add_prestige_experience = mandala_contribution_major_prestige_reward + if = { + limit = { + can_add_hook = { + target = scope:owner + type = strong_contribution_hook + } + } + add_hook = { + target = scope:owner + type = strong_contribution_hook + } + } + } + custom_tooltip = mandala_contributor_bunga_mas_forest_reward_effect_tt + hidden_effect = { + scope:owner.dynasty = { + add_dynasty_modifier = { modifier = mandala_forest_of_bunga_mas_modifier } + } + } +} +contributed_bunga_mas_forest_effect = { + custom_description_no_bullet = { text = contributed_bunga_mas_forest } + mandala_contributor_bunga_mas_forest_reward_effect = yes +} + +mandala_contributor_dynastic_temple_complex_reward_effect = { + dynasty = { add_dynasty_prestige = monumental_dynasty_prestige_value } + player_heir ?= { + add_piety_experience = { + value = monumental_piety_value + add = massive_piety_value + } + } +} +contributed_dynastic_temple_complex_effect = { + custom_description_no_bullet = { text = contributed_family_temple_complex } + mandala_contributor_family_temple_complex_reward_effect = yes +} + +#The actual effect +check_and_reward_contributions_05_effect = { + if = { + limit = { scope:contributed_rite_of_worthiness ?= root } + contributed_rites_of_worthiness_02_effect = yes + } + if = { + limit = { scope:contributed_marble_foundation ?= root } + contributed_marble_foundation_effect = yes + } + if = { + limit = { scope:contributed_divine_barays ?= root } + contributed_divine_barays_effect = yes + } + if = { + limit = { scope:contributed_work_force ?= root } + contributed_work_force_effect = yes + } + if = { + limit = { scope:contributed_bejeweled_reliefs ?= root } + contributed_bejeweled_reliefs_effect = yes + } + if = { + limit = { scope:contributed_bunga_mas_forest ?= root } + contributed_bunga_mas_forest_effect = yes + } + if = { + limit = { scope:contributed_dynastic_temple_complex ?= root } + contributed_dynastic_temple_complex_effect = yes + } +} + + + + + +##War Effects +mandala_war_victory_effects = { + scope:attacker = { + if = { + limit = { has_realm_law_flag = piety_devotion_from_offensive_wars } + add_piety = { + value = medium_piety_value + multiply = scope:defender.primary_title.tier + } + } + } + scope:defender = { + if = { + limit = { has_realm_law_flag = piety_devotion_from_defensive_wars } + add_piety_experience = medium_piety_loss + } + } +} + +mandala_war_defeat_effects = { + scope:attacker = { + if = { + limit = { has_realm_law_flag = piety_devotion_from_offensive_wars } + add_piety_experience = medium_piety_loss + } + } + scope:defender = { + if = { + limit = { has_realm_law_flag = piety_devotion_from_defensive_wars } + add_piety_experience = { + value = minor_piety_value + multiply = scope:defender.primary_title.tier + } + } + } +} + +mandala_rebel_attacker_independency_effect = { + create_title_and_vassal_change = { + type = independency + save_scope_as = change + } + becomes_independent = { change = scope:change } + resolve_title_and_vassal_change = scope:change +} + +mandala_not_quite_depose_effect = { + #Your piety + add_piety_level = remove_piety_levels_value + add_piety = -5000 + #Your tributaries + if = { + limit = { number_of_tributaries > 0 } + custom_tooltip = { + text = mandala_depose_war_leaving_tributaries.tt + every_tributary = { end_tributary = yes } + } + } + #Your radiance + add_character_modifier = { + modifier = recently_tarnished_mandala_modifier + years = 10 + } +} + +mandala_peacemaker_perk_serenity_effect = { + if = { + limit = { + government_has_flag = government_is_mandala + house ?= { has_house_power_parameter = aspect_of_serenity } + is_house_head = yes + has_perk = peacemaker_perk + } + add_piety_experience = mandala_peacemaker_perk_piety_value + } +} + + +##Change to Mandala Government effects +change_to_mandala_government_effect = { + change_government = mandala_government + change_to_mandala_government_decree_effect = yes +} + +change_to_mandala_government_and_citadel_effect = { + if = { + limit = { government_has_flag = government_is_tribal } + change_tribal_holdings_to_citadels_effect = yes #Includes change_to_mandala_government_effect + } + else = { + change_capital_holding_to_citadel_effect = yes #Includes change_to_mandala_government_effect + } + show_as_tooltip = { change_to_mandala_government_effect = yes } +} + +change_capital_holding_to_citadel_effect = { + custom_tooltip = realm_capital_will_change_to_citadel + save_scope_as = current_holder + hidden_effect_new_object = { + capital_province = { + if = { + limit = { + NOT = { has_holding_type = temple_citadel_holding } + } + set_variable = { + name = generic_to_mandala_building_level + value = combined_building_level + days = 1 + } + set_holding_type = temple_citadel_holding + #Did any buildings invalidate? Calculate! + set_variable = { + name = new_generic_to_mandala_building_level + value = combined_building_level + days = 1 + } + if = { + limit = { var:new_generic_to_mandala_building_level < var:generic_to_mandala_building_level } + change_variable = { + name = generic_to_mandala_building_level + subtract = var:new_generic_to_mandala_building_level + } + } + #We need to set the holding type BEFORE we can change to the government, lest it invalidates + scope:current_holder = { + if = { + limit = { + NOT = { government_has_flag = government_is_mandala } + } + change_to_mandala_government_effect = yes + } + } + #We need to set the government type BEFORE we generate buildings, otherwise basically none are valid + while = { + limit = { var:generic_to_mandala_building_level > 0 } + generate_building = yes + change_variable = { + name = generic_to_mandala_building_level + subtract = 1 + } + } + remove_variable = generic_to_mandala_building_level + remove_variable = new_generic_to_mandala_building_level + } + } + } +} + +change_tribal_holdings_to_citadels_effect = { + custom_tooltip = all_tribal_holdings_will_change_to_citadels + save_scope_as = current_tribal_holder + hidden_effect_new_object = { + every_realm_province = { + limit = { has_holding_type = tribal_holding } + set_variable = { + name = tribal_to_mandala_building_level + value = combined_building_level + days = 1 + } + set_holding_type = temple_citadel_holding + #We need to set the holding type BEFORE we can change to the government, lest it invalidates + scope:current_tribal_holder = { + if = { + limit = { + NOT = { government_has_flag = government_is_mandala } + } + change_to_mandala_government_effect = yes + } + } + #We need to set the government type BEFORE we generate buildings, otherwise basically none are valid + while = { + limit = { var:tribal_to_mandala_building_level > 0 } + generate_building = yes + change_variable = { + name = tribal_to_mandala_building_level + subtract = 1 + } + } + remove_variable = tribal_to_mandala_building_level + } + } +} + +mandala_nuke_realm_laws_effect = { + hidden_effect = { + #Tribal + if = { + limit = { has_realm_law = tribal_authority_0 } + remove_realm_law = tribal_authority_0 + } + if = { + limit = { has_realm_law = tribal_authority_1 } + remove_realm_law = tribal_authority_1 + } + if = { + limit = { has_realm_law = tribal_authority_2 } + remove_realm_law = tribal_authority_2 + } + if = { + limit = { has_realm_law = tribal_authority_3 } + remove_realm_law = tribal_authority_3 + } + #Feudal + if = { + limit = { has_realm_law = crown_authority_0 } + remove_realm_law = crown_authority_0 + } + if = { + limit = { has_realm_law = crown_authority_1 } + remove_realm_law = crown_authority_1 + } + if = { + limit = { has_realm_law = crown_authority_2 } + remove_realm_law = crown_authority_2 + } + if = { + limit = { has_realm_law = crown_authority_3 } + remove_realm_law = crown_authority_3 + } + #Admin + if = { + limit = { has_realm_law = imperial_bureaucracy_0 } + remove_realm_law = imperial_bureaucracy_0 + } + if = { + limit = { has_realm_law = imperial_bureaucracy_1 } + remove_realm_law = imperial_bureaucracy_1 + } + if = { + limit = { has_realm_law = imperial_bureaucracy_2 } + remove_realm_law = imperial_bureaucracy_2 + } + if = { + limit = { has_realm_law = imperial_bureaucracy_3 } + remove_realm_law = imperial_bureaucracy_3 + } + #Nomads + if = { + limit = { has_realm_law = nomadic_authority_1 } + remove_realm_law = nomadic_authority_1 + } + if = { + limit = { has_realm_law = nomadic_authority_2 } + remove_realm_law = nomadic_authority_2 + } + if = { + limit = { has_realm_law = nomadic_authority_3 } + remove_realm_law = nomadic_authority_3 + } + if = { + limit = { has_realm_law = nomadic_authority_4 } + remove_realm_law = nomadic_authority_4 + } + if = { + limit = { has_realm_law = nomadic_authority_5 } + remove_realm_law = nomadic_authority_5 + } + #Celestial + if = { + limit = { has_realm_law = celestial_bureaucracy_0 } + remove_realm_law = celestial_bureaucracy_0 + } + if = { + limit = { has_realm_law = celestial_bureaucracy_1 } + remove_realm_law = celestial_bureaucracy_1 + } + if = { + limit = { has_realm_law = celestial_bureaucracy_2 } + remove_realm_law = celestial_bureaucracy_2 + } + if = { + limit = { has_realm_law = celestial_bureaucracy_3 } + remove_realm_law = celestial_bureaucracy_3 + } + #Confucian + if = { + limit = { has_realm_law = meritocratic_bureaucracy_0 } + remove_realm_law = meritocratic_bureaucracy_0 + } + if = { + limit = { has_realm_law = meritocratic_bureaucracy_1 } + remove_realm_law = meritocratic_bureaucracy_1 + } + if = { + limit = { has_realm_law = meritocratic_bureaucracy_2 } + remove_realm_law = meritocratic_bureaucracy_2 + } + if = { + limit = { has_realm_law = meritocratic_bureaucracy_3 } + remove_realm_law = meritocratic_bureaucracy_3 + } + #Japanese + if = { + limit = { has_realm_law = japanese_bureaucracy_0 } + remove_realm_law = japanese_bureaucracy_0 + } + if = { + limit = { has_realm_law = japanese_bureaucracy_1 } + remove_realm_law = japanese_bureaucracy_1 + } + if = { + limit = { has_realm_law = japanese_bureaucracy_2 } + remove_realm_law = japanese_bureaucracy_2 + } + if = { + limit = { has_realm_law = japanese_bureaucracy_3 } + remove_realm_law = japanese_bureaucracy_3 + } + } +} + +mandala_nuke_mandala_decrees_effect = { + hidden_effect = { + if = { + limit = { has_realm_law = mandala_decree_prosperity } + remove_realm_law = mandala_decree_prosperity + } + if = { + limit = { has_realm_law = mandala_decree_expansion } + remove_realm_law = mandala_decree_expansion + } + if = { + limit = { has_realm_law = mandala_decree_reverence } + remove_realm_law = mandala_decree_reverence + } + } +} + +change_to_mandala_government_decree_effect = { + #Nuke all laws + mandala_nuke_realm_laws_effect = yes + if = { + limit = { + NOT = { has_realm_law = mandala_decree_none } + } + add_realm_law_skip_effects = mandala_decree_none + } +} + +divine_happenstance_adopt_mandala_effect = { + send_interface_message = { + type = msg_mandala_good_with_text + title = divine_happenstance_fulfilled + desc = divine_happenstance_fulfilled_desc + left_icon = root + add_piety = { + value = major_piety_value + multiply = 1.5 + } + if = { + limit = { government_has_flag = government_is_mandala } + add_legitimacy_effect = { LEGITIMACY = major_legitimacy_gain } + } + else = { + #Add legitimacy sans displaying levels (only for show, we shouldn't end up here outside of show_as_tooltip) + add_major_legitimacy_no_tier_effect = yes + } + } + if = { + limit = { has_variable = vying_for_mandala_divinity } + create_character_memory = { type = ascended_as_divined_mandala_devaraja_memory } + } + else = { + create_character_memory = { type = ascended_as_mandala_devaraja_memory } + } +} + +mandala_adopt_clan_government_effect = { + #Remove Mandala Decrees + mandala_nuke_mandala_decrees_effect = yes + #Check if capital holding is castle or temple citadel otherwise convert + hidden_effect = { + capital_province = { + if = { + limit = { + NOR = { + has_holding_type = temple_citadel_holding + has_holding_type = castle_holding + } + } + custom_tooltip = realm_capital_will_change_to_castle + set_holding_type = castle_holding + } + } + } + change_government = clan_government + #Start off crown authorities + hidden_effect = { + if = { + limit = { + NOT = { has_realm_law = crown_authority_0 } + } + add_realm_law_skip_effects = crown_authority_0 + } + } + #All muslim vassals swap to Clan + if = { + limit = { + any_vassal = { + primary_title = { + target_is_de_jure_liege_or_above = root.primary_title #We only auto convert de jure vassals + } + NOR = { + government_has_flag = government_is_theocracy + government_has_flag = government_is_republic + government_has_flag = government_is_landless_adventurer + government_has_flag = government_is_tribal + government_has_flag = government_is_clan + government_has_flag = government_is_nomadic + government_has_flag = government_is_herder + } + faith.religion = religion:islam_religion + } + } + custom_tooltip = all_muslim_vassals_change_to_clan + hidden_effect = { + every_vassal_or_below = { + limit = { + primary_title = { + target_is_de_jure_liege_or_above = root.primary_title #We only auto convert de jure vassals + } + NOR = { + government_has_flag = government_is_theocracy + government_has_flag = government_is_republic + government_has_flag = government_is_landless_adventurer + government_has_flag = government_is_tribal + government_has_flag = government_is_clan + government_has_flag = government_is_nomadic + government_has_flag = government_is_herder + } + faith.religion = religion:islam_religion + } + if = { + limit = { + capital_province = { + NOR = { + has_holding_type = temple_citadel_holding + has_holding_type = castle_holding + } + } + } + capital_province = { set_holding_type = castle_holding } + } + change_government = clan_government + #Nuke all laws + mandala_nuke_realm_laws_effect = yes + #Remove Mandala Decrees + mandala_nuke_mandala_decrees_effect = yes + #Start off crown authorities + if = { + limit = { + NOT = { has_realm_law = crown_authority_0 } + } + add_realm_law_skip_effects = crown_authority_0 + } + #Notify them of what just happened + if = { + limit = { is_ai = no } + trigger_event = tgp_east_asia_decision_events.0030 + } + set_variable = { + name = changed_government_recently + years = 5 + } + } + } + } + set_variable = { + name = changed_government_recently + years = 5 + } +} + + + +##Conversion Effects +mandala_converter_piety_effect = { + #Mandala conversion! + if = { + limit = { government_has_flag = government_is_mandala } + if = { + limit = { has_realm_law = mandala_decree_reverence } + add_piety = { + add = medium_piety_gain + multiply = 1.5 + } + } + else = { add_piety = medium_piety_gain } + } +} + +mandala_assimilation_effect = { + overlord = { + send_interface_message = { + type = event_conversion_good + title = subject_assimilated_under_your_rule_msg + left_icon = root + right_icon = overlord + show_as_tooltip = { + root = { + if = { + limit = { + NOT = { has_government = mandala_government } + } + change_government = mandala_government + } + if = { + limit = { + NOR = { + faith = overlord.faith + faith.religious_head ?= root + } + } + set_character_faith = overlord.faith + } + } + } + if = { + limit = { has_realm_law = mandala_decree_reverence } + mandala_converter_piety_effect = yes + } + } + } + #The Decree + show_as_tooltip = { change_to_mandala_government_decree_effect = yes } +} + +mandala_clean_up_variables_effect = { + remove_variable = mandala_assimilation_devaraja + remove_variable = mandala_assimilation_devaraja_piety_level + remove_character_flag = assimilation_payout_t1 + remove_character_flag = assimilation_payout_t2 + remove_character_flag = assimilation_payout_t3 +} + + + +##Building Effects +mandala_built_piety_building_effect = { + if = { + limit = { + NOT = { exists = scope:character } + } + county.holder = { save_scope_as = character } + } + scope:character = { + #Liege paid for the building + if = { + limit = { + root.county.holder = { is_independent_ruler = no } + this = scope:character + government_has_flag = government_is_mandala + } + add_piety = { + value = minor_piety_value + multiply = 1.5 + } + root.county.holder = { + if = { + limit = { government_has_flag = government_is_mandala } + } + add_piety = { + value = miniscule_piety_value + multiply = 1.5 + } + } + } + #Vassal paid for the building + else_if = { + limit = { + government_has_flag = government_is_mandala + is_alive = yes + } + add_piety = { + value = minor_piety_value + multiply = 1.5 + } + } + } +} + +mandala_built_piety_duchy_building_t1_effect = { + if = { + limit = { + NOT = { exists = scope:character } + } + county.holder = { save_scope_as = character } + } + scope:character = { + #Liege paid for the building + if = { + limit = { + root.county.holder = { is_independent_ruler = no } + this = scope:character + government_has_flag = government_is_mandala + } + add_piety = { + value = medium_piety_value + multiply = 1.5 + } + root.county.holder = { + if = { + limit = { government_has_flag = government_is_mandala } + } + add_piety = { + value = minor_piety_value + multiply = 1.5 + } + } + } + #Vassal paid for the building + else_if = { + limit = { government_has_flag = government_is_mandala } + add_piety = { + value = medium_piety_value + multiply = 1.5 + } + } + } +} + +mandala_built_piety_duchy_building_t2_effect = { + if = { + limit = { + NOT = { exists = scope:character } + } + county.holder = { save_scope_as = character } + } + scope:character = { + #Liege paid for the building + if = { + limit = { + root.county.holder = { is_independent_ruler = no } + this = scope:character + government_has_flag = government_is_mandala + } + add_piety = { + value = major_piety_value + multiply = 1.5 + } + root.county.holder = { + if = { + limit = { government_has_flag = government_is_mandala } + } + add_piety = { + value = medium_piety_value + multiply = 1.5 + } + } + } + #Vassal paid for the building + else_if = { + limit = { government_has_flag = government_is_mandala } + add_piety = { + value = major_piety_value + multiply = 1.5 + } + } + } +} + +mandala_built_piety_duchy_building_t3_effect = { + if = { + limit = { + NOT = { exists = scope:character } + } + county.holder = { save_scope_as = character } + } + scope:character = { + #Liege paid for the building + if = { + limit = { + root.county.holder = { is_independent_ruler = no } + this = scope:character + government_has_flag = government_is_mandala + } + add_piety = { + value = massive_piety_value + multiply = 1.5 + } + root.county.holder = { + if = { + limit = { government_has_flag = government_is_mandala } + } + add_piety = { + value = major_piety_value + multiply = 1.5 + } + } + } + #Vassal paid for the building + else_if = { + limit = { government_has_flag = government_is_mandala } + add_piety = { + value = massive_piety_value + multiply = 1.5 + } + } + } +} + +mandala_built_temple_holding_effect = { + if = { + limit = { + NOT = { exists = scope:character } + } + save_scope_as = character + } + scope:character = { + #Liege paid for the holding + if = { + limit = { + root.county.holder = { is_independent_ruler = no } + this = scope:character + government_has_flag = government_is_mandala + } + add_piety = { + value = massive_piety_value + multiply = { + value = 1.5 + } + if = { + limit = { + culture = { has_cultural_parameter = founding_temple_citadels_gives_more_piety } + } + multiply = 2 + } + } + root.county.holder = { + if = { + limit = { government_has_flag = government_is_mandala } + } + add_piety = { + value = major_piety_value + multiply = 1.5 + } + } + } + #Vassal paid for the holding + else_if = { + limit = { government_has_flag = government_is_mandala } + add_piety = { + value = massive_piety_value + multiply = { + value = 1.5 + } + if = { + limit = { + culture = { has_cultural_parameter = founding_temple_citadels_gives_more_piety } + } + multiply = 2 + } + } + } + } +} + +mandala_upgraded_temple_holding_effect = { + if = { + limit = { + NOT = { exists = scope:character } + } + county.holder = { save_scope_as = character } + } + scope:character = { + #Liege paid for the holding + if = { + limit = { + root.county.holder = { is_independent_ruler = no } + this = scope:character + government_has_flag = government_is_mandala + } + add_piety = { + value = medium_piety_value + multiply = 1.5 + } + root.county.holder = { + if = { + limit = { government_has_flag = government_is_mandala } + } + add_piety = { + value = minor_piety_value + multiply = 1.5 + } + } + } + #Vassal paid for the holding + else_if = { + limit = { government_has_flag = government_is_mandala } + add_piety = { + value = medium_piety_value + multiply = 1.5 + } + } + } +} + + +creator_mandala_built_regular_building_piety_effect = { + if = { + limit = { + NOT = { exists = scope:character } + } + county.holder = { save_scope_as = character } + } + scope:character = { + if = { + limit = { + government_has_flag = government_is_mandala + house ?= { has_house_power_parameter = aspect_of_creation } + is_house_head = yes + } + add_piety = { + value = minor_piety_value + multiply = { value = creator_mandala_piety_gain_scale } + } + } + } +} + +creator_mandala_built_regular_duchy_building_t1_piety_effect = { + if = { + limit = { + NOT = { exists = scope:character } + } + county.holder = { save_scope_as = character } + } + scope:character = { + if = { + limit = { + government_has_flag = government_is_mandala + house ?= { has_house_power_parameter = aspect_of_creation } + is_house_head = yes + } + add_piety = { + value = medium_piety_value + multiply = { value = creator_mandala_piety_gain_scale } + } + } + } +} + +creator_mandala_built_regular_duchy_building_t2_piety_effect = { + if = { + limit = { + NOT = { exists = scope:character } + } + county.holder = { save_scope_as = character } + } + scope:character = { + if = { + limit = { + government_has_flag = government_is_mandala + house ?= { has_house_power_parameter = aspect_of_creation } + is_house_head = yes + } + add_piety = { + value = major_piety_value + multiply = { value = creator_mandala_piety_gain_scale } + } + } + } +} + +creator_mandala_built_regular_duchy_building_t3_piety_effect = { + if = { + limit = { + NOT = { exists = scope:character } + } + county.holder = { save_scope_as = character } + } + scope:character = { + if = { + limit = { + government_has_flag = government_is_mandala + house ?= { has_house_power_parameter = aspect_of_creation } + is_house_head = yes + } + add_piety = { + value = massive_piety_value + multiply = { value = creator_mandala_piety_gain_scale } + } + } + } +} + +creator_mandala_built_regular_holding_piety_effect = { + if = { + limit = { + NOT = { exists = scope:character } + } + county.holder = { save_scope_as = character } + } + scope:character = { + if = { + limit = { + government_has_flag = government_is_mandala + house ?= { has_house_power_parameter = aspect_of_creation } + is_house_head = yes + } + add_piety = { + value = massive_piety_value + multiply = { value = creator_mandala_piety_gain_scale } + } + } + } +} + +creator_mandala_upgraded_regular_holding_piety_effect = { + if = { + limit = { + NOT = { exists = scope:character } + } + county.holder = { save_scope_as = character } + } + scope:character = { + if = { + limit = { + government_has_flag = government_is_mandala + house ?= { has_house_power_parameter = aspect_of_creation } + is_house_head = yes + } + add_piety = { + value = medium_piety_value + multiply = { value = creator_mandala_piety_gain_scale } + } + } + } +} + + + +##Interaction Effects +mandala_end_tributary_with_notification_effect = { + save_scope_as = leaving_tributary + suzerain = { trigger_event = tgp_east_asia_interaction_events.0010 } + end_tributary = yes +} + +mandala_embrace_tributary_effect = { + scope:recipient = { + add_opinion = { + modifier = accepted_tributary_status_opinion # this opinion also acts as a built-in cooldown + target = scope:actor + opinion = 20 + } + } + start_tributary_interaction_effect = { + TRIBUTARY = scope:recipient + SUZERAIN = scope:actor + } + scope:actor = { + trigger_event = char_interaction.0362 + } + consume_all_criminal_reasons_effect = { + LIEGE = scope:actor + CRIMINAL = scope:recipient + } +} + +decommission_temple_accept_effect = { + custom_tooltip = { + text = decommission_mandala_temple_effect_tt + capital_province = { + if = { + limit = { has_building_with_flag = mandala_capital_building } + ruin_great_building = yes + } + } + } + if = { + limit = { has_character_flag = devaraja_flag } + remove_character_flag = devaraja_flag + } + if = { + limit = { has_character_modifier = mandala_rise_from_the_ashes_modifier } + remove_character_modifier = mandala_rise_from_the_ashes_modifier + } + add_opinion = { + target = scope:actor + modifier = ruined_my_temple_opinion + opinion = -50 + } +} + +decommission_temple_decline_effect = { + if = { + limit = { is_vassaL_of = scope:actor } + start_war = { + casus_belli = independence_war + target = scope:actor + } + } + else = { + mandala_end_tributary_with_notification_effect = yes + } + progress_towards_rival_effect = { + REASON = rival_ruined_temple_building + CHARACTER = scope:actor + OPINION = -100 + } +} + + + +##Aspect Effects +mandala_apply_10_year_modifier = { + add_character_modifier = { + modifier = mandala_creator_modifier + years = 10 + } + trigger_event = { + id = tgp_east_asia_mandala_events.0010 + days = 3651 # 10 years and 1 day + } +} + +mandala_apply_20_year_modifier = { + add_character_modifier = { + modifier = mandala_creator_modifier + years = 20 + } + trigger_event = { + id = tgp_east_asia_mandala_events.0010 + days = 7301 # 20 years and 1 day + } +} + +mandala_apply_30_year_modifier = { + add_character_modifier = { + modifier = mandala_creator_modifier + years = 30 + } + trigger_event = { + id = tgp_east_asia_mandala_events.0010 + days = 10951 # 30 years and 1 day + } +} + +mandala_upgrade_creator_effect = { + if = { + limit = { has_variable = mandala_house_power_accumulated_creator } + #Save what we gained so far so we can add it to the refreshed variable + save_temporary_scope_value_as = { + name = accumulated_creator_increments + value = var:mandala_house_power_accumulated_creator + } + remove_variable = mandala_house_power_accumulated_creator + #Clean up any existing modifier + hidden_effect = { + if = { + limit = { has_character_modifier = mandala_creator_modifier } + remove_character_modifier = mandala_creator_modifier + } + } + #What cadence are we on? + if = { + limit = { + house = { has_house_head_parameter = creator_30_year_modifier } + } + set_variable = { + name = mandala_house_power_accumulated_creator + value = { + value = 1 + add = scope:accumulated_creator_increments + } + years = 30 + } + hidden_effect = { + send_interface_message = { + type = msg_mandala_good_with_text + title = mandala_creator_streak_accumulated + desc = mandala_creator_streak_accumulated_desc + left_icon = root + mandala_apply_30_year_modifier = yes + } + } + } + else_if = { + limit = { + house = { house_has_creator_20_years_trigger = yes } + } + set_variable = { + name = mandala_house_power_accumulated_creator + value = { + value = 1 + add = scope:accumulated_creator_increments + } + years = 20 + } + hidden_effect = { + send_interface_message = { + type = msg_mandala_good_with_text + title = mandala_creator_streak_accumulated + desc = mandala_creator_streak_accumulated_desc + left_icon = root + mandala_apply_20_year_modifier = yes + } + } + } + else_if = { + limit = { + house = { house_has_creator_10_years_trigger = yes } #This is just to stop some scope errors + } + set_variable = { + name = mandala_house_power_accumulated_creator + value = { + value = 1 + add = scope:accumulated_creator_increments + } + years = 10 + } + hidden_effect = { + send_interface_message = { + type = msg_mandala_good_with_text + title = mandala_creator_streak_accumulated + desc = mandala_creator_streak_accumulated_desc + left_icon = root + mandala_apply_10_year_modifier = yes + } + } + } + } + else = { + #Clean up any existing modifier + hidden_effect = { + if = { + limit = { has_character_modifier = mandala_creator_modifier } + remove_character_modifier = mandala_creator_modifier + } + } + #Start from the beginning + if = { + limit = { + house = { has_house_head_parameter = creator_30_year_modifier } + } + set_variable = { + name = mandala_house_power_accumulated_creator + value = 1 + years = 30 + } + hidden_effect = { + send_interface_message = { + type = msg_mandala_good_with_text + title = mandala_creator_streak_accumulated + desc = mandala_creator_streak_accumulated_desc + left_icon = root + mandala_apply_30_year_modifier = yes + } + } + } + else_if = { + limit = { + house = { house_has_creator_20_years_trigger = yes } + } + set_variable = { + name = mandala_house_power_accumulated_creator + value = 1 + years = 20 + } + hidden_effect = { + send_interface_message = { + type = msg_mandala_good_with_text + title = mandala_creator_streak_accumulated + desc = mandala_creator_streak_accumulated_desc + left_icon = root + mandala_apply_20_year_modifier = yes + } + } + } + else = { + set_variable = { + name = mandala_house_power_accumulated_creator + value = 1 + years = 10 + } + hidden_effect = { + send_interface_message = { + type = msg_mandala_good_with_text + title = mandala_creator_streak_accumulated + desc = mandala_creator_streak_accumulated_desc + left_icon = root + mandala_apply_10_year_modifier = yes + } + } + } + } +} + + +mandala_upgrade_increment_of_peace_effect = { + if = { + limit = { has_variable = mandala_house_power_accumulated_increments_of_peace } + change_variable = { + name = mandala_house_power_accumulated_increments_of_peace + add = 1 + } + hidden_effect = { + remove_character_modifier = mandala_increments_of_peace_modifier + send_interface_message = { + type = msg_mandala_good_with_text + title = mandala_increments_of_peace_accumulated + desc = mandala_increments_of_peace_accumulated_desc + left_icon = root + add_character_modifier = { modifier = mandala_increments_of_peace_modifier } + } + } + } +} + +mandala_reset_increment_of_peace_effect = { + remove_variable = mandala_house_power_accumulated_increments_of_peace + set_variable = { + name = mandala_house_power_accumulated_increments_of_peace + value = 1 + } + hidden_effect = { + send_interface_message = { + type = msg_mandala_bad_with_text + title = mandala_increments_of_peace_broken + desc = mandala_increments_of_peace_broken_desc + left_icon = root + remove_character_modifier = mandala_increments_of_peace_modifier + remove_variable = mandala_house_power_accumulated_increments_of_peace + } + add_character_modifier = mandala_increments_of_peace_modifier + } +} + +mandala_remove_increment_of_peace_effect = { + send_interface_message = { + type = msg_mandala_neutral_with_text + title = mandala_increments_of_peace_invalid + desc = mandala_increments_of_peace_invalid_desc + left_icon = root + remove_character_modifier = mandala_increments_of_peace_modifier + remove_variable = mandala_house_power_accumulated_increments_of_peace + } +} + + +mandala_change_between_aspects_effect = { + if = { + limit = { + NOT = { + house = { has_default_house_aspiration = yes } + } + } + if = { + limit = { has_variable = changed_aspect_once } + add_piety_level = -1 + } + else = { + custom_tooltip = { + text = change_aspect_once_per_lifetime.tt + set_variable = changed_aspect_once + } + } + if = { + limit = { + NOT = { has_character_flag = devaraja_flag } + } + add_character_flag = devaraja_flag + } + } +} + + +##Reverence Decree Effects +mandala_piety_gain_effect = { + if = { + limit = { has_realm_law = mandala_decree_reverence } + add_piety = { + add = $PIETY_AMOUNT$ + multiply = 1.5 + } + } + else = { add_piety = $PIETY_AMOUNT$ } +} + + +mandala_trickster_increment_successful_schemes_effect = { + if = { + limit = { + government_has_flag = government_is_mandala + house ?= { has_house_power_parameter = aspect_of_trickery } + } + increment_variable_effect = { + VAR = num_successful_schemes + VAL = 1 + } + } +} + +mandala_trickster_increment_gold_ransomed_effect = { + if = { + limit = { + government_has_flag = government_is_mandala + house ?= { has_house_power_parameter = aspect_of_trickery } + } + increment_variable_effect = { + VAR = amount_of_gold_ransomed + VAL = $GOLD_AMOUNT$ + } + } +} + + +##Task Contracts +# Select the Contract Tier (somewhat randomized, based on your Radiance) +spawn_mandala_realm_task_contract_effect = { + save_scope_as = mandala_ruler + # Select which contract to create + trigger_event = { + on_action = spawn_mandala_realm_contract_on_action + } + +} + +manage_new_mandala_contract_effect = { + if = { + limit = { exists = scope:target_province } + send_interface_message = { + type = msg_mandala_contracts_text_neutral + title = msg_mandala_realm_contract_appear.t + desc = msg_mandala_realm_contract_appear.desc + right_icon = scope:target_province.county + } + } + if = { + limit = { + is_ai = yes + exists = scope:new_mandala_visit + } + accept_task_contract = scope:new_mandala_visit + } + + #play_sound_effect = "event:/DLC/EP3/SFX/Stingers/Byzantine_Flavor/ep3_mx_sting_byzantineflavor_become_governor" +} + +mandala_travel_to_contract_location_effect = { + save_scope_as = court_owner + random_courtier = { + limit = { + is_available = yes + NOT = { has_court_position = travel_leader_court_position } + } + weight = { + base = 1 + modifier = { + add = 100 + scope:court_owner.house = { + has_house_power_parameter = aspect_of_creation + } + OR = { + is_child_of = scope:court_owner + is_grandchild_of = scope:court_owner + is_great_grandchild_of = scope:court_owner + is_consort_of = scope:court_owner + } + } + modifier = { + add = 10 + scope:court_owner.house = { + has_house_power_parameter = aspect_of_creation + } + is_close_or_extended_family_of = scope:court_owner + } + modifier = { + add = diplomacy + scope:court_owner.house = { + has_house_power_parameter = aspect_of_serenity + } + } + modifier = { + add = prowess + scope:court_owner.house = { + has_house_power_parameter = aspect_of_destruction + } + } + modifier = { + add = intrigue + scope:court_owner.house = { + has_house_power_parameter = aspect_of_trickery + } + } + modifier = { + add = 1000 + has_court_position = court_physician_court_position + } + } + save_scope_as = follower_1 + } + if = { + limit = { + exists = scope:follower_1 + } + random_courtier = { + limit = { + is_available = yes + this != scope:follower_1 + NOT = { has_court_position = travel_leader_court_position } + } + weight = { + base = 1 + modifier = { + add = 100 + scope:court_owner.house = { + has_house_power_parameter = aspect_of_creation + } + OR = { + is_child_of = scope:court_owner + is_grandchild_of = scope:court_owner + is_great_grandchild_of = scope:court_owner + is_consort_of = scope:court_owner + } + } + modifier = { + add = 10 + scope:court_owner.house = { + has_house_power_parameter = aspect_of_creation + } + is_close_or_extended_family_of = scope:court_owner + } + modifier = { + add = diplomacy + scope:court_owner.house = { + has_house_power_parameter = aspect_of_serenity + } + } + modifier = { + add = prowess + scope:court_owner.house = { + has_house_power_parameter = aspect_of_destruction + } + } + modifier = { + add = intrigue + scope:court_owner.house = { + has_house_power_parameter = aspect_of_trickery + } + } + } + save_scope_as = follower_2 + } + } + if = { + limit = { + exists = scope:follower_2 + } + random_courtier = { + limit = { + is_available = yes + this != scope:follower_1 + this != scope:follower_2 + NOT = { has_court_position = travel_leader_court_position } + } + weight = { + base = 1 + modifier = { + add = 100 + scope:court_owner.house = { + has_house_power_parameter = aspect_of_creation + } + OR = { + is_child_of = scope:court_owner + is_grandchild_of = scope:court_owner + is_great_grandchild_of = scope:court_owner + is_consort_of = scope:court_owner + } + } + modifier = { + add = 10 + scope:court_owner.house = { + has_house_power_parameter = aspect_of_creation + } + is_close_or_extended_family_of = scope:court_owner + } + modifier = { + add = diplomacy + scope:court_owner.house = { + has_house_power_parameter = aspect_of_serenity + } + } + modifier = { + add = prowess + scope:court_owner.house = { + has_house_power_parameter = aspect_of_destruction + } + } + modifier = { + add = intrigue + scope:court_owner.house = { + has_house_power_parameter = aspect_of_trickery + } + } + } + save_scope_as = follower_3 + } + } + if = { + limit = { + exists = scope:follower_3 + } + random_courtier = { + limit = { + is_available = yes + this != scope:follower_1 + this != scope:follower_2 + this != scope:follower_3 + NOT = { has_court_position = travel_leader_court_position } + } + weight = { + base = 1 + modifier = { + add = 100 + scope:court_owner.house = { + has_house_power_parameter = aspect_of_creation + } + OR = { + is_child_of = scope:court_owner + is_grandchild_of = scope:court_owner + is_great_grandchild_of = scope:court_owner + is_consort_of = scope:court_owner + } + } + modifier = { + add = 10 + scope:court_owner.house = { + has_house_power_parameter = aspect_of_creation + } + is_close_or_extended_family_of = scope:court_owner + } + modifier = { + add = diplomacy + scope:court_owner.house = { + has_house_power_parameter = aspect_of_serenity + } + } + modifier = { + add = prowess + scope:court_owner.house = { + has_house_power_parameter = aspect_of_destruction + } + } + modifier = { + add = intrigue + scope:court_owner.house = { + has_house_power_parameter = aspect_of_trickery + } + } + } + save_scope_as = follower_4 + } + } + if = { + limit = { + exists = scope:follower_4 + } + random_courtier = { + limit = { + is_available = yes + this != scope:follower_1 + this != scope:follower_2 + this != scope:follower_3 + this != scope:follower_4 + NOT = { has_court_position = travel_leader_court_position } + } + weight = { + base = 1 + modifier = { + add = 100 + scope:court_owner.house = { + has_house_power_parameter = aspect_of_creation + } + OR = { + is_child_of = scope:court_owner + is_grandchild_of = scope:court_owner + is_great_grandchild_of = scope:court_owner + is_consort_of = scope:court_owner + } + } + modifier = { + add = 10 + scope:court_owner.house = { + has_house_power_parameter = aspect_of_creation + } + is_close_or_extended_family_of = scope:court_owner + } + modifier = { + add = diplomacy + scope:court_owner.house = { + has_house_power_parameter = aspect_of_serenity + } + } + modifier = { + add = prowess + scope:court_owner.house = { + has_house_power_parameter = aspect_of_destruction + } + } + modifier = { + add = intrigue + scope:court_owner.house = { + has_house_power_parameter = aspect_of_trickery + } + } + } + save_scope_as = follower_5 + } + } + if = { + limit = { + exists = scope:follower_1 + exists = scope:follower_2 + exists = scope:follower_3 + exists = scope:follower_4 + exists = scope:follower_5 + } + start_travel_plan = { + destination = $DESTINATION$ + on_arrival_event = $ARRIVAL_EVENT$ + companion = scope:follower_1 + companion = scope:follower_2 + companion = scope:follower_3 + companion = scope:follower_4 + companion = scope:follower_5 + on_travel_planner_cancel_event = tgp_east_asia_mandala_task_contract_events.0990 + on_arrival_destinations = all_but_last + } + } + else_if = { + limit = { + exists = scope:follower_1 + exists = scope:follower_2 + exists = scope:follower_3 + exists = scope:follower_4 + } + start_travel_plan = { + destination = $DESTINATION$ + on_arrival_event = $ARRIVAL_EVENT$ + companion = scope:follower_1 + companion = scope:follower_2 + companion = scope:follower_3 + companion = scope:follower_4 + on_travel_planner_cancel_event = tgp_east_asia_mandala_task_contract_events.0990 + on_arrival_destinations = all_but_last + } + } + else_if = { + limit = { + exists = scope:follower_1 + exists = scope:follower_2 + exists = scope:follower_3 + } + start_travel_plan = { + destination = $DESTINATION$ + on_arrival_event = $ARRIVAL_EVENT$ + companion = scope:follower_1 + companion = scope:follower_2 + companion = scope:follower_3 + on_travel_planner_cancel_event = tgp_east_asia_mandala_task_contract_events.0990 + on_arrival_destinations = all_but_last + } + } + else_if = { + limit = { + exists = scope:follower_1 + exists = scope:follower_2 + } + start_travel_plan = { + destination = $DESTINATION$ + on_arrival_event = $ARRIVAL_EVENT$ + companion = scope:follower_1 + companion = scope:follower_2 + on_travel_planner_cancel_event = tgp_east_asia_mandala_task_contract_events.0990 + on_arrival_destinations = all_but_last + } + } + else_if = { + limit = { + exists = scope:follower_1 + } + start_travel_plan = { + destination = $DESTINATION$ + on_arrival_event = $ARRIVAL_EVENT$ + companion = scope:follower_1 + on_travel_planner_cancel_event = tgp_east_asia_mandala_task_contract_events.0990 + on_arrival_destinations = all_but_last + } + } + else = { + start_travel_plan = { + destination = $DESTINATION$ + on_arrival_event = $ARRIVAL_EVENT$ + on_travel_planner_cancel_event = tgp_east_asia_mandala_task_contract_events.0990 + on_arrival_destinations = all_but_last + } + } +} + +mandala_contract_clean_up_location_effect = { + task_contract_location = { + remove_variable = requested_mandala_ritual + } + task_contract_taker = { + increment_variable_remove_at_zero_effect = { + VAR = available_mandala_rituals + VALUE = -1 + } + } +} + +mandala_invalidate_contracts_effect = { + if = { + limit = { + any_character_active_contract = { is_a_mandala_contract_trigger = yes } + } + random_character_active_contract = { + limit = { is_a_mandala_contract_trigger = yes } + save_scope_as = invalidating_task_contract + task_contract_taker = { + save_scope_as = task_contract_character + send_interface_message = { + type = event_generic_bad_with_text + title = mandala_contract_invalidated_title + left_icon = scope:task_contract_character + desc = mandala_contract_invalidated_desc + } + scope:invalidating_task_contract = { invalidate_contract = yes } + } + } + } + if = { + limit = { has_character_flag = recently_completed_mandala_contract } + remove_character_flag = recently_completed_mandala_contract + } +} + +mandala_contract_complete_contract_effect = { + hidden_effect = { + scope:task_contract = { complete_task_contract = common_mandala } + current_travel_plan ?= { + if = { + limit = { is_paused = yes } + resume_travel_plan = yes + } + } + } + add_character_flag = recently_completed_mandala_contract +} + +mandala_contract_piety_reward_display_effect = { + save_scope_as = task_contract + task_contract_taker = { + if = { + limit = { contract_is_tier_3_contract_trigger = yes } + custom_tooltip = mandala_realm_contract_piety_high_reward_tt + } + else_if = { + limit = { contract_is_tier_2_contract_trigger = yes } + custom_tooltip = mandala_realm_contract_piety_mid_reward_tt + } + else = { + custom_tooltip = mandala_realm_contract_piety_reward_tt + } + } + +} + +mandala_contract_legitimacy_reward_display_effect = { + save_scope_as = task_contract + task_contract_taker = { + if = { + limit = { scope:task_contract.task_contract_tier = define:NTaskContract|HIGH_TASK_CONTRACT_TIER } + custom_tooltip = mandala_realm_contract_legitimacy_high_reward_tt + } + else_if = { + limit = { scope:task_contract.task_contract_tier = define:NTaskContract|MEDIUM_TASK_CONTRACT_TIER } + custom_tooltip = mandala_realm_contract_legitimacy_mid_reward_tt + } + else = { + custom_tooltip = mandala_realm_contract_legitimacy_reward_tt + } + } +} + +add_all_valid_mandala_contract_provinces_to_list_effect = { + every_sub_realm_county = { + every_county_province = { + limit = { + has_holding = yes + is_occupied = no + NOR = { + this = scope:mandala_ruler.capital_province + has_variable = requested_mandala_ritual + has_variable = mandala_ritual_cooldown + } + } + add_to_list = valid_target_provinces + } + } + every_tributary = { + every_sub_realm_county = { + every_county_province = { + limit = { + has_holding = yes + is_occupied = no + NOR = { + this = scope:mandala_ruler.capital_province + has_variable = requested_mandala_ritual + has_variable = mandala_ritual_cooldown + } + } + add_to_list = valid_target_provinces + } + } + } +} + +add_all_valid_mandala_contract_provinces_with_crocodiles_to_list_effect = { + every_sub_realm_county = { + every_county_province = { + limit = { + has_holding = yes + is_occupied = no + hunt_animal_crocodile_trigger = yes + NOR = { + this = scope:mandala_ruler.capital_province + has_variable = requested_mandala_ritual + has_variable = mandala_ritual_cooldown + } + } + add_to_list = valid_target_provinces + } + } + every_tributary = { + every_sub_realm_county = { + every_county_province = { + limit = { + has_holding = yes + is_occupied = no + hunt_animal_crocodile_trigger = yes + NOR = { + this = scope:mandala_ruler.capital_province + has_variable = requested_mandala_ritual + has_variable = mandala_ritual_cooldown + } + } + add_to_list = valid_target_provinces + } + } + } +} + +add_all_valid_mandala_contract_provinces_with_neighbor_to_list_effect = { + every_sub_realm_county = { + limit = { + any_neighboring_county = { + holder = { + is_ai = yes + } + title_province = { + has_holding = yes + } + } + } + every_county_province = { + limit = { + has_holding = yes + is_occupied = no + NOR = { + this = scope:mandala_ruler.capital_province + has_variable = requested_mandala_ritual + has_variable = mandala_ritual_cooldown + } + } + add_to_list = valid_target_provinces + } + } + every_tributary = { + every_sub_realm_county = { + limit = { + any_neighboring_county = { + holder = { + is_ai = yes + } + title_province = { + has_holding = yes + } + } + } + every_county_province = { + limit = { + has_holding = yes + is_occupied = no + NOR = { + this = scope:mandala_ruler.capital_province + has_variable = requested_mandala_ritual + has_variable = mandala_ritual_cooldown + } + } + add_to_list = valid_target_provinces + } + } + } +} + +add_all_valid_mandala_contract_provinces_no_holding_to_list_effect = { + every_sub_realm_county = { + every_county_province = { + limit = { + has_holding = no + is_occupied = no + NOR = { + this = scope:mandala_ruler.capital_province + has_variable = requested_mandala_ritual + has_variable = mandala_ritual_cooldown + } + } + add_to_list = valid_target_provinces + } + } + every_tributary = { + every_sub_realm_county = { + every_county_province = { + limit = { + has_holding = no + is_occupied = no + NOR = { + this = scope:mandala_ruler.capital_province + has_variable = requested_mandala_ritual + has_variable = mandala_ritual_cooldown + } + } + add_to_list = valid_target_provinces + } + } + } +} + +set_mandala_contract_tier_effect = { + #Consider county_opinion as a factor + random_list = { + 30 = { + save_scope_value_as = { + name = mandala_task_contract_tier + value = define:NTaskContract|LOW_TASK_CONTRACT_TIER + } + } + 10 = { + save_scope_value_as = { + name = mandala_task_contract_tier + value = define:NTaskContract|MEDIUM_TASK_CONTRACT_TIER + } + + modifier = { + add = 10 + scope:target_province.county.county_opinion >= 10 + } + modifier = { + add = 10 + scope:target_province.county.county_opinion >= 20 + } + } + 5 = { + save_scope_value_as = { + name = mandala_task_contract_tier + value = define:NTaskContract|HIGH_TASK_CONTRACT_TIER + } + + modifier = { + add = 10 + scope:target_province.county.county_opinion >= 40 + } + modifier = { + add = 10 + scope:target_province.county.county_opinion >= 60 + } + modifier = { + add = 10 + scope:target_province.county.county_opinion >= 80 + } + modifier = { + add = 10 + scope:target_province.county.county_opinion >= 100 + } + } + } +} + +choose_address_mandala_effect = { + random_list = { + 1 = { + set_variable = { + name = loc_compliment + value = flag:holy_compliment_almighty + } + } + 1 = { + set_variable = { + name = loc_compliment + value = flag:holy_compliment_most_omnipotent + } + } + 1 = { + set_variable = { + name = loc_compliment + value = flag:holy_compliment_divine + } + } + 1 = { + set_variable = { + name = loc_compliment + value = flag:holy_compliment_venerable + } + } + 1 = { + set_variable = { + name = loc_compliment + value = flag:holy_compliment_reverent + } + } + } + #Error suppression + if = { + limit = { + OR = { + var:loc_desc ?= flag:mandala_provincial_ritual_desc_01 + var:loc_desc ?= flag:mandala_provincial_ritual_desc_02 + var:loc_compliment ?= flag:holy_compliment_almighty + var:loc_compliment ?= flag:holy_compliment_most_omnipotent + var:loc_compliment ?= flag:holy_compliment_divine + var:loc_compliment ?= flag:holy_compliment_venerable + var:loc_compliment ?= flag:holy_compliment_reverent + } + } + } +} + +mandala_set_ritual_variables_effect = { + task_contract_location = { + set_variable = requested_mandala_ritual + set_variable = { + name = mandala_ritual_cooldown + years = mandala_ritual_cooldown_years + } + } + task_contract_taker = { + increment_variable_effect = { + VAR = available_mandala_rituals + VAL = 1 + } + } +} + +big_mandala_piety_reward_effect = { + add_piety = { + value = mandala_contract_piety + if = { + limit = { contract_is_tier_3_contract_trigger = yes } + multiply = 1.5 + } + else_if = { + limit = { contract_is_tier_2_contract_trigger = yes } + multiply = 1.25 + } + multiply = 1.5 + } +} + +mandala_piety_reward_effect = { + add_piety = { + value = mandala_contract_piety + if = { + limit = { contract_is_tier_3_contract_trigger = yes } + multiply = 1.5 + } + else_if = { + limit = { contract_is_tier_2_contract_trigger = yes } + multiply = 1.25 + } + multiply = 0.75 + } +} + +small_mandala_piety_reward_effect = { + add_piety = { + value = mandala_contract_piety + if = { + limit = { contract_is_tier_3_contract_trigger = yes } + multiply = 2 + } + else_if = { + limit = { contract_is_tier_2_contract_trigger = yes } + multiply = 1.5 + } + multiply = 0.25 + } +} + +big_mandala_legitimacy_reward_effect = { + add_legitimacy = { + value = mandala_contract_legitimacy + if = { + limit = { contract_is_tier_3_contract_trigger = yes } + multiply = 2 + } + else_if = { + limit = { contract_is_tier_2_contract_trigger = yes } + multiply = 1.5 + } + multiply = 2 + } +} + +mandala_legitimacy_reward_effect = { + add_legitimacy = { + value = mandala_contract_legitimacy + if = { + limit = { contract_is_tier_3_contract_trigger = yes } + multiply = 2 + } + else_if = { + limit = { contract_is_tier_2_contract_trigger = yes } + multiply = 1.5 + } + } +} + +small_mandala_legitimacy_reward_effect = { + add_legitimacy = { + value = mandala_contract_legitimacy + if = { + limit = { contract_is_tier_3_contract_trigger = yes } + multiply = 2 + } + else_if = { + limit = { contract_is_tier_2_contract_trigger = yes } + multiply = 1.5 + } + multiply = 0.25 + } +} + +mandala_contract_failure_standard_reward_effect = { + if = { + limit = { is_ai = no } + add_piety = { + value = mandala_contract_piety + multiply = -1.5 + } + add_piety_experience = { + value = mandala_contract_piety + multiply = -1.5 + } + add_legitimacy = { + value = mandala_contract_legitimacy + multiply = -1.5 + } + } +} + + +change_to_mandala_interaction_effect = { + scope:actor = { + pay_short_term_gold = { + target = scope:recipient + gold = { + value = 50 + scope:recipient = { + if = { + limit = { highest_held_title_tier >= tier_kingdom } + multiply = 10 + } + else_if = { + limit = { highest_held_title_tier >= tier_duchy } + multiply = 6 + } + else_if = { + limit = { highest_held_title_tier >= tier_county } + multiply = 3 + } + } + if = { + limit = { scope:gold ?= yes } + add = scope:actor.medium_gold_value + } + } + } + } + scope:recipient = { change_to_mandala_government_and_citadel_effect = yes } + if = { + limit = { + scope:hook = yes + scope:actor = { has_usable_hook = scope:recipient } + } + scope:actor = { use_hook = scope:recipient } + } + if = { + limit = { scope:piety = yes } + scope:actor = { + add_piety = { + value = { + subtract = piety_bribe_value + } + } + } + } +} + + +mandala_no_longer_polytheist_effect = { + if = { + limit = { + government_has_flag = government_is_mandala + faith = { + NOT = { has_doctrine = doctrine_polytheist } + } + } + convert_whole_realm_to_feudalism_effect = yes + hidden_effect = { + every_vassal = { + trigger_event = { + id = major_decisions.0002 + days = 3 + } + } + } + every_tributary = { end_tributary = yes } + } +} + + +### STORY CYCLE +mandala_story_go_on_pilgrimage_effect = { + if = { + limit = { can_host_activity = activity_pilgrimage } + ai_attempt_to_host_activity = activity_pilgrimage + } + else = { + move_budget_gold = { gold = short_term_gold from = budget_war_chest to = budget_short_term } + move_budget_gold = { gold = long_term_gold from = budget_long_term to = budget_short_term } + } +} + +mandala_story_creation_aspect_get_kids_effect = { + if = { + limit = { + is_adult = yes + is_available = yes + } + if = { + limit = { is_female = no } + if = { + limit = { + any_consort = { + is_adult = yes + is_available = yes + fertility > 0 + is_pregnant = no + } + } + random_consort = { + limit = { + is_adult = yes + is_available = yes + fertility > 0 + is_pregnant = no + } + make_pregnant = { father = scope:root_scope } + } + } + } + if = { + limit = { is_female = yes } + if = { + limit = { + is_pregnant = no + any_consort = { + is_adult = yes + is_available = yes + fertility > 0 + } + } + random_consort = { + limit = { + is_adult = yes + is_available = yes + fertility > 0 + } + scope:root_scope = { + make_pregnant = { father = prev } + } + } + } + } + } +} + +mandala_story_serenity_aspect_befriend_effect = { + if = { + limit = { + any_courtier = { + can_set_relation_friend_trigger = { CHARACTER = scope:root_scope } + } + any_vassal = { + can_set_relation_friend_trigger = { CHARACTER = scope:root_scope } + } + } + every_courtier = { + limit = { + can_set_relation_friend_trigger = { CHARACTER = scope:root_scope } + } + add_to_list = serenity_potential_friends + } + every_vassal = { + limit = { + can_set_relation_friend_trigger = { CHARACTER = scope:root_scope } + } + add_to_list = serenity_potential_friends + } + ordered_in_list = { + list = serenity_potential_friends + order_by = "opinion(scope:root_scope)" + random = { + chance = 10 + set_relation_friend = scope:root_scope + } + } + } + else = { + mandala_story_befriend_scheme_effect = yes + } +} + +mandala_story_befriend_scheme_effect = { + if = { + limit = { + OR = { + house = { has_house_head_parameter = unlock_befriend_scheme } + has_perk = befriend_perk + } + OR = { + NOT = { + any_scheme = { + OR = { + scheme_type = befriend + scheme_type = sway + scheme_type = seduce + scheme_type = courting + scheme_type = elope + scheme_type = learn_language + } + } + } + AND = { + OR = { + dynasty ?= { has_dynasty_perk = glory_legacy_5 } + AND = { + has_royal_court = yes + has_dlc_feature = royal_court + has_court_type = court_diplomatic + court_grandeur_current_level >= 10 + } + } + any_scheme = { + count < 2 + OR = { + scheme_type = befriend + scheme_type = sway + scheme_type = seduce + scheme_type = courting + scheme_type = elope + scheme_type = learn_language + } + } + } + AND = { + dynasty ?= { has_dynasty_perk = glory_legacy_5 } + has_royal_court = yes + has_dlc_feature = royal_court + has_court_type = court_diplomatic + court_grandeur_current_level >= 10 + any_scheme = { + count < 3 + OR = { + scheme_type = befriend + scheme_type = sway + scheme_type = seduce + scheme_type = courting + scheme_type = elope + scheme_type = learn_language + } + } + } + } + } + every_courtier = { + limit = { + has_council_position = councillor_spymaster + opinion = { + target = scope:root_scope + value < 100 + } + save_temporary_scope_as = courtier_check + scope:root_scope = { + can_start_scheme = { + type = befriend + target_character = scope:courtier_check + } + } + } + add_to_list = befriend_targets + } + every_tributary = { + limit = { + opinion = { + target = scope:root_scope + value < 100 + } + save_temporary_scope_as = tributary_check + scope:root_scope = { + can_start_scheme = { + type = befriend + target_character = scope:tributary_check + } + } + } + add_to_list = befriend_targets + } + every_vassal = { + limit = { + highest_held_title_tier >= tier_county + opinion = { + target = scope:root_scope + value < 100 + } + save_temporary_scope_as = vassal_check + scope:root_scope = { + can_start_scheme = { + type = befriend + target_character = scope:vassal_check + } + } + } + add_to_list = befriend_targets + } + every_neighboring_and_across_water_top_liege_realm_owner = { + limit = { + highest_held_title_tier >= tier_county + opinion = { + target = scope:root_scope + value < 100 + } + save_temporary_scope_as = ruler_check + scope:root_scope = { + can_start_scheme = { + type = befriend + target_character = scope:ruler_check + } + } + } + every_tributary = { + limit = { + highest_held_title_tier >= tier_county + opinion = { + target = scope:root_scope + value < 100 + } + save_temporary_scope_as = ruler_tributary_check + scope:root_scope = { + can_start_scheme = { + type = befriend + target_character = scope:ruler_tributary_check + } + } + } + add_to_list = befriend_targets + } + add_to_list = befriend_targets + } + random_in_list = { + list = befriend_targets + limit = { + save_temporary_scope_as = befriend_check + NOT = { + scope:root_scope = { + any_scheme = { + is_hostile = yes + scheme_target_character = scope:befriend_check + } + } + } + } + weight = { + base = 1 + modifier = { + add = 10 + opinion = { + target = scope:root_scope + value < 100 + } + } + modifier = { + is_tributary = no + add = 150 + } + modifier = { + OR = { + realm_size <= scope:root_scope.realm_size + primary_title.tier <= scope:root_scope.primary_title.tier + } + add = 250 + } + modifier = { + primary_title ?= { is_neighbor_to_realm = scope:root_scope } + add = 250 + } + modifier = { + scope:root_scope = { + is_character_interaction_potentially_accepted = { + recipient = prev + interaction = offer_tributary_status_interaction + ai_accept = -30 + } + } + add = 1000 + } + } + save_scope_as = befriend_target + } + if = { + limit = { exists = scope:befriend_target } + start_scheme = { + type = befriend + target_character = scope:befriend_target + } + } + } +} + +mandala_story_destruction_aspect_declare_war_effect = { + if = { + limit = { + is_at_war = no + war_chest_gold >= war_chest_gold_maximum + } + add_stress = major_stress_loss + ai_start_best_war = { + cb = { + make_tributary_cb + mandala_raze_capital_structure_cb + } + is_valid = { + scope:target_character = { + current_military_strength < root.current_military_strength + OR = { + gold < root.gold + current_military_strength <= root.fifty_percent_of_current_military_strength + } + } + } + } + } +} + +mandala_story_destruction_aspect_buff_skill_effect = { + random = { + chance = 30 + add_$SKILL$_skill = 1 + } +} diff --git a/N3OW/common/scripted_effects/tgp_tribute_mission_scripted_effects.txt b/N3OW/common/scripted_effects/tgp_tribute_mission_scripted_effects.txt new file mode 100644 index 00000000..c7990de4 --- /dev/null +++ b/N3OW/common/scripted_effects/tgp_tribute_mission_scripted_effects.txt @@ -0,0 +1,270 @@ +tribute_mission_clean_up_variables_effect = { + remove_variable = tribute_mission_target_scope + remove_variable = offered_gold_value + remove_variable = tribute_mission_type + remove_variable = offered_herd_value + remove_variable = offered_concubine + remove_variable = offered_eunuch + remove_variable = offered_artifact + remove_variable = tribute_reward_fascination_progress + + if = { + limit = { + has_character_flag = tribute_mission_character_flag # Under select circumstances it's possible this will be rerun, so this avoids an error + } + remove_character_flag = tribute_mission_character_flag + } + + if = { + limit = { exists = scope:receiving_character } + scope:receiving_character = { + if = { + limit = { has_character_flag = created_attendant } + silent_disappearance_effect = yes + } + } + } +} + +tribute_mission_clean_up_request_variables_effect = { + remove_variable = requested_tribute_mission + remove_variable = requested_tribute_mission_type_gold + remove_variable = requested_tribute_mission_type_herd + remove_variable = requested_tribute_mission_type_artifact + remove_variable = requested_tribute_mission_type_concubine + remove_variable = requested_tribute_mission_type_eunuch + remove_variable = declined_requested_tribute_recently + remove_variable = predetermined_concubine_tribute + remove_variable = predetermined_eunuch_tribute + remove_variable = predetermined_artifact_tribute +} + +requested_tribute_mission_clean_up_variables_effect = { + remove_variable = requested_tribute_mission + remove_variable = invalidation_should_fail_ongoing_requested_tribute_mission +} + +set_or_change_offered_tribute_value_effect = { + if = { + limit = { has_variable = offered_$TYPE$_value } + change_variable = { + name = offered_$TYPE$_value + add = $VALUE$ + } + } + else = { + set_variable = { + name = offered_$TYPE$_value + value = $VALUE$ + } + } +} + +save_tribute_mission_target_scope_effect = { + if = { + limit = { is_tributary_or_independent_neighbor_of_china_trigger = yes } + title:h_china.holder = { + save_scope_as = tribute_mission_target + } + } + else = { + overlord = { + save_scope_as = tribute_mission_target + } + } + if = { + limit = { + NOT = { exists = scope:tribute_mission_target } + scope:tribute_mission_target = this + } + error_log = "Failed to set tribute_mission_target or character has no overlord!" + } +} + +tribute_mission_set_up_tribute_travel_effect = { + #Saving the tribute_mission_target, in case something happens along the way + set_variable = { + name = tribute_mission_target_scope + value = scope:tribute_mission_target + } + #Travel posted first should look neater in tooltip + hidden_effect = { # ensure we subtract everything we've offered + if = { + limit = { has_variable = offered_gold_value } + remove_short_term_gold = var:offered_gold_value + } + if = { + limit = { has_variable = offered_herd_value } + domicile ?= { + change_herd = { subtract = prev.var:offered_herd_value } + } + } + } + trigger_event = { on_action = tribute_mission_start } + if = { + limit = { location = scope:tribute_mission_target.capital_province } + trigger_event = tribute_mission.0002 + } + #Add the concubine + else_if = { + limit = { has_variable = offered_concubine } + start_travel_plan = { + destination = scope:tribute_mission_target.capital_province + companion = var:offered_concubine + on_travel_planner_cancel_on_action = tribute_mission_travel_planner_exit + on_arrival_event = tribute_mission.0002 + } + } + #Add the eunuch + else_if = { + limit = { has_variable = offered_eunuch } + start_travel_plan = { + destination = scope:tribute_mission_target.capital_province + companion = var:offered_eunuch + on_travel_planner_cancel_on_action = tribute_mission_travel_planner_exit + on_arrival_event = tribute_mission.0002 + } + } + else = { + custom_tooltip = tribute_mission.travel_to.tt + start_travel_plan = { + destination = scope:tribute_mission_target.capital_province + on_travel_planner_cancel_on_action = tribute_mission_travel_planner_exit + on_arrival_event = tribute_mission.0002 + } + } +} + +tribute_mission_invalidation_effect = { + if = { + limit = { has_variable = tribute_mission_type } + if = { + limit = { # sanity check to ensure we're still a valid tribute provider + OR = { + is_independent_ruler = no # if we have a liege we cannot also pay tribute to someone else + AND = { # if we're not a tributary we are only valid if we're paying tribute to China + is_tributary = no + var:tribute_mission_target_scope != title:h_china.holder + } + } + } + #Return home and refund + trigger_event = tribute_mission.9800 + } + else_if = { #If our offerings have perished or been imprisoned along the way, maybe swap to gold + limit = { + has_variable = tribute_mission_type + OR = { + AND = { + has_variable = offered_concubine + OR = { + var:offered_concubine = { is_alive = no } + var:offered_concubine = { is_imprisoned = yes } + } + } + AND = { + has_variable = offered_eunuch + OR = { + var:offered_eunuch = { is_alive = no } + var:offered_eunuch = { is_imprisoned = yes } + } + } + } + } + trigger_event = tribute_mission.9750 + } + else_if = { + #We're still a tributary on our way to pay tribute, but our suzerain is not the person we were going to pay tribute to + limit = { + has_variable = tribute_mission_target_scope + OR = { + AND = { + is_tributary = yes + var:tribute_mission_target_scope != suzerain + } + AND = { + is_tributary = no + var:tribute_mission_target_scope != title:h_china.holder + } + } + } + var:tribute_mission_target_scope = { save_scope_as = old_overlord } + suzerain = { save_scope_as = new_overlord } + #Clean up Requested Tribute Mission variables + requested_tribute_mission_clean_up_variables_effect = yes + #The new Overlord is in the same place and can accept the tribute + if = { + limit = { + #Make sure they can still accept our offerings; if so, just set the new target + current_travel_plan.next_destination_province = scope:new_overlord.capital_province + has_variable = tribute_mission_type + trigger_if = { + limit = { + OR = { + has_variable = offered_concubine + has_variable = offered_eunuch + } + } + OR = { + AND = { + has_variable = offered_concubine + var:offered_concubine = { + can_become_concubine_of_character_valid_trigger = { CHARACTER = scope:new_overlord } + } + } + AND = { + has_variable = offered_eunuch + scope:new_overlord = { + culture = { has_cultural_parameter = can_appoint_chief_eunuch } + } + } + } + } + } + send_interface_message = { + type = msg_mandala_neutral_text + title = tribute_mission_notification.new_overlord.title + left_icon = scope:new_overlord + desc = tribute_mission_notification.new_overlord.desc + } + set_variable = { + name = tribute_mission_target_scope + value = scope:new_overlord + } + } + #The Overlord is somewhere else; please try again + else_if = { + limit = { + current_travel_plan.next_destination_province != scope:new_overlord.capital_province + } + set_variable = new_overlord_somewhere_else + #Return home and refund + trigger_event = tribute_mission.9800 + } + else = { + set_variable = new_overlord_unable_to_accept_tribute + #Return home and refund + trigger_event = tribute_mission.9800 + } + } + } +} + +tribute_mission_mandala_piety_effect = { + if = { + limit = { government_has_flag = government_is_mandala } + overlord = { add_piety = minor_piety_gain } + } +} + +requested_tribute_mission_penalty_effect = { + if = { + limit = { + has_variable = invalidation_should_fail_ongoing_requested_tribute_mission + } + trigger_event = { + id = tribute_mission.9500 + delayed = yes + } + } +} diff --git a/N3OW/common/succession_appointment/_succession_appointment.info b/N3OW/common/succession_appointment/_succession_appointment.info index 75528bc5..38916e69 100644 --- a/N3OW/common/succession_appointment/_succession_appointment.info +++ b/N3OW/common/succession_appointment/_succession_appointment.info @@ -1,6 +1,6 @@  ####################################################################### -# Structure +# Structure ####################################################################### key = { @@ -13,20 +13,27 @@ key = { } # categories of people that are by default eligible to be in succession for the title + # default_candidates = { holder_close_family landed_vassal } - # categories of people that can be additionally nominated for the title - # people from default_candidates are eligible by default already - invested_candidates = { holder_councilor holder_court_position } + # Meritocratic appointment where default candidates are all eligible people of certain level + # Supported level sources are currencies with levels + # If level is set, default_candidates are ignored + # + level = merit/prestige/piety/influence ### brief: allow_children ( bool ) - # Whether or not to allow children to be evaluated for this - # sucession + # Whether or not to allow children to be evaluated for this succession # allow_children = no + + ### brief: allow_same_tier_candidates ( bool ) + # Whether or not to allow candidates that already hold a title of the same tier + # + allow_same_tier_candidates = no } -#Available categories for candidates are: +# Available categories for candidates are: # holder_close_family # holder_close_extended_family # holder_house_member diff --git a/N3OW/common/succession_appointment/admin_emperor.txt b/N3OW/common/succession_appointment/admin_emperor.txt index a644bbb9..2c263ac9 100644 --- a/N3OW/common/succession_appointment/admin_emperor.txt +++ b/N3OW/common/succession_appointment/admin_emperor.txt @@ -1,6 +1,5 @@ admin_emperor = { - default_candidates = { holder_close_family landed_vassal } - invested_candidates = { holder_close_family holder_close_extended_family holder_house_member landed_vassal landed_vassal_close_family landed_vassal_close_extended_family holder_court_position holder_councilor } + default_candidates = { holder_close_family holder_close_extended_family holder_house_member holder_councilor landed_vassal } allow_children = yes @@ -342,7 +341,7 @@ if = { limit = { top_liege.primary_title.state_faith ?= { - NOT = { this = root.faith } + this != root.faith faith_hostility_level = { target = root.faith value = faith_fully_accepted_level @@ -424,6 +423,16 @@ desc = county_holder_opinion_desc } } + if = { # Score for house members of the emperor is affected by the capital's popular opinion + limit = { + exists = top_liege.house + house ?= top_liege.house + } + add = { + value = top_liege.capital_county.county_holder_opinion + desc = popular_opinion_in_capital_desc + } + } # LIFESTYLE PERKS if = { @@ -434,7 +443,7 @@ } } - #TITLE TIER + # TITLE TIER if = { limit = { is_landed = yes @@ -456,7 +465,7 @@ } } - #LOWBORN? EW no + # LOWBORN? EW no if = { limit = { is_lowborn = yes @@ -467,19 +476,10 @@ } } - #INFLUENCE LEVEL + # INFLUENCE LEVEL if = { limit = { - influence_level = 0 - } - subtract = { - value = 20 - desc = "[influence_level|E]" - } - } - if = { - limit = { - influence_level >= 2 + influence_level != 1 } add = { value = 20 @@ -491,11 +491,11 @@ } } - #DIFFERENT CULTURE FROM IMPERIAL CAPITAL + # DIFFERENT CULTURE FROM IMPERIAL CAPITAL if = { limit = { root.top_liege.capital_county.culture ?= { - NOT = { this = root.culture } + this != root.culture cultural_acceptance = { target = root.culture value = 0 @@ -510,7 +510,7 @@ else_if = { limit = { root.top_liege.capital_county.culture ?= { - NOT = { this = root.culture } + this != root.culture cultural_acceptance = { target = root.culture value <= 20 @@ -525,7 +525,7 @@ else_if = { limit = { root.top_liege.capital_county.culture ?= { - NOT = { this = root.culture } + this != root.culture cultural_acceptance = { target = root.culture value <= 40 @@ -540,7 +540,7 @@ else_if = { limit = { root.top_liege.capital_county.culture ?= { - NOT = { this = root.culture } + this != root.culture cultural_acceptance = { target = root.culture value <= 60 @@ -555,7 +555,7 @@ else_if = { limit = { root.top_liege.capital_county.culture ?= { - NOT = { this = root.culture } + this != root.culture cultural_acceptance = { target = root.culture value <= 80 @@ -568,7 +568,7 @@ } } - #ELDEST ELIGIBLE CHILD OF EMPEROR + # ELDEST ELIGIBLE CHILD OF EMPEROR if = { limit = { scope:title.holder = { @@ -640,7 +640,7 @@ desc = eldest_imperial_child_desc } } - #CLOSE FAMILY + # CLOSE FAMILY else_if = { limit = { is_close_family_of = scope:title.holder @@ -651,7 +651,7 @@ desc = imperial_close_family_desc } } - #EXTENDED FAMILY + # EXTENDED FAMILY else_if = { limit = { is_close_or_extended_family_of = scope:title.holder @@ -662,8 +662,19 @@ desc = imperial_close_extended_family_desc } } + # SAME HOUSE + else_if = { + limit = { + house = top_liege.house + } + add = { + value = 10 + multiply = scope:title.holder.legitimacy_level + desc = imperial_same_house_desc + } + } - #SPOUSE AND THEIR FAMILY + # SPOUSE AND THEIR FAMILY if = { limit = { is_spouse_of = scope:title.holder @@ -688,7 +699,7 @@ } } - #FRIENDS OF THE EMPEROR + # FRIENDS OF THE EMPEROR if = { limit = { has_relation_friend = scope:title.holder @@ -719,7 +730,19 @@ desc = imperial_guardian_desc } } - #CO-EMPEROR OF EMPEROR + if = { + limit = { + exists = house + } + # All get to use their Family Rating + add = { + value = house.house_power_score + multiply = 0.5 + desc = "[powerful_family_rating|E]" + } + } + + # CO-EMPEROR OF EMPEROR if = { limit = { is_diarch_of_target = scope:title.holder @@ -736,7 +759,7 @@ desc = imperial_diarch_desc } } - #OTHER DIARCHS OF EMPEROR + # OTHER DIARCHS OF EMPEROR else_if = { limit = { is_diarch_of_target = scope:title.holder @@ -816,7 +839,33 @@ desc = scheme_promoted_modifier } } - + + # Renounced imperial aspriations (from decision) + if = { + limit = { + OR = { + has_character_modifier = ep3_admin_renounce_throne_personal + house ?= { has_house_modifier = ep3_admin_renounce_throne_house } + } + } + add = { + value = -1000 + desc = admin_renounced_throne + } + } + + # ACH PURGE PRETENDERS OATH + if = { + limit = { + house ?= { + has_house_modifier = oath_of_purge_pretenders_house + } + } + add = { + value = 50 + desc = oath_of_purge_pretenders_house + } + } # ADJUST BASED ON GENDER LAW - MUST GO AT THE END save_temporary_value_as = pre_gender_law_calc diff --git a/N3OW/common/succession_appointment/admin_governor.txt b/N3OW/common/succession_appointment/admin_governor.txt index f51dc161..c0b5e5b4 100644 --- a/N3OW/common/succession_appointment/admin_governor.txt +++ b/N3OW/common/succession_appointment/admin_governor.txt @@ -1,6 +1,5 @@ admin_governor = { - default_candidates = { holder_close_family } - invested_candidates = { holder_close_family holder_close_extended_family holder_house_member landed_vassal landed_vassal_close_family landed_vassal_close_extended_family holder_court_position holder_councilor } + default_candidates = { holder_close_family holder_close_extended_family holder_house_member holder_councilor } candidate_score = { value = { @@ -164,7 +163,6 @@ } add = { value = 20 - multiply = scope:title.holder.governor_efficiency desc = councillor_position_governor_desc } } @@ -178,8 +176,7 @@ } } add = { - value = 5 - multiply = scope:title.holder.governor_efficiency + value = 10 desc = court_position_succession_governor_desc } } @@ -261,7 +258,7 @@ limit = { has_perk = ducal_conquest_perk } add = { value = 30 - desc = ducal_conquest_perk_name + desc = ducal_conquest_perk_name_desc } } @@ -315,8 +312,7 @@ scope:title.holder ?= { is_close_family_of = root } } add = { - value = 10 - multiply = scope:title.holder.governor_efficiency + value = 15 desc = "close_family_holder_desc" } } @@ -339,8 +335,7 @@ scope:title.holder ?= { has_relation_friend = root } } add = { - value = 5 - multiply = scope:title.holder.governor_efficiency + value = 10 desc = governor_friend_desc } } @@ -350,7 +345,6 @@ } add = { value = 15 - multiply = scope:title.holder.governor_efficiency desc = governor_best_friend_desc } } @@ -393,31 +387,37 @@ } } - # EXISTING GOVERNORSHIPS + # PETITION if = { - limit = { - scope:title = { tier = tier_kingdom } - is_governor = yes - highest_held_title_tier = tier_kingdom - } + limit = { scope:title.var:petition_house_rights ?= house } add = { - value = -1000 - desc = already_a_kingdom_governor_tt + value = 250 + desc = petition_liege_house_province_rights_value_desc } } + # EXISTING GOVERNORSHIPS if = { - limit = { - scope:title = { tier = tier_duchy } - is_governor = yes - highest_held_title_tier = tier_duchy - } + limit = { is_governor = yes } add = { value = -1000 desc = already_a_governor_tt } } + # ACH PURGE PRETENDERS OATH + if = { + limit = { + house ?= { + has_house_modifier = oath_of_purge_pretenders_house + } + } + add = { + value = 50 + desc = oath_of_purge_pretenders_house + } + } + #ADJUST BASED ON GENDER LAW - MUST GO AT THE END if = { limit = { @@ -471,11 +471,11 @@ desc = appointment_female_only_desc } } - + # We remove all score from the emperor, to make sure you don't inherit governorships needlessly if = { limit = { - is_independent_ruler = yes + top_liege = this } multiply = { value = 0 diff --git a/N3OW/common/succession_appointment/celestial_governor.txt b/N3OW/common/succession_appointment/celestial_governor.txt new file mode 100644 index 00000000..0faf2326 --- /dev/null +++ b/N3OW/common/succession_appointment/celestial_governor.txt @@ -0,0 +1,1402 @@ +celestial_civic_governor = { + allow_same_tier_candidates = yes + + level = merit + + candidate_score = { + value = { + if = { + limit = { + top_liege = { + has_realm_law = candidate_score_prestige_law + } + } + # Base score gained from prestige rank + add = { + value = 10 + multiply = prestige_level + desc = PRESTIGE_LEVEL_CONCEPT + } + if = { + limit = { + exists = dynasty + } + # Base score gained from prestige rank + add = { + value = 10 + multiply = dynasty.dynasty_prestige_level + desc = DYNASTY_PRESTIGE_CONCEPT + } + } + } + + # Age - With age comes experience. We provide a rather small bonus for the elderly, to exist as a potential tie-breaker. + if = { # Too old + limit = { + age >= retirement_age_1_value + tgp_is_above_retirement_age_trigger = { REALM_OWNER = root } + } + add = { + value = { + value = retirement_age_current_value + subtract = age + divide = 2 + round = yes + } + desc = is_above_retirement_age_desc + } + } + else_if = { # Old and experienced + limit = { + age >= 40 + } + add = { + value = 15 + desc = old_age_desc + } + } + else_if = { # Too young + limit = { + age < 30 + } + add = { + value = -10 + desc = young_age_desc + } + } + + # Skills + add = { + value = learning + multiply = 0.5 + round = yes + desc = "[learning_skill|E]" + } + add = { + value = diplomacy + multiply = 0.25 + round = yes + desc = "[diplomacy_skill|E]" + } + add = { + value = stewardship + multiply = 0.25 + round = yes + desc = "[stewardship_skill|E]" + } + + # Education traits + if = { + limit = { + OR = { + has_trait = education_diplomacy_5 + has_trait = education_stewardship_5 + has_trait = education_learning_5 + } + } + add = { + value = 10 + desc = has_rank_5_education_desc + } + } + if = { + limit = { + has_trait = confucian_education + } + add = { + value = "has_trait_xp(confucian_education)" + divide = 4 + round = yes + min = 5 + desc = court_position_confucian_education_trait + } + } + + # Influenced career score + if = { + limit = { + exists = var:merit_civilian_career_score_bonus + } + add = { + value = var:merit_civilian_career_score_bonus + desc = merit_career_score_bonus_desc + } + } + + # Domicile + if = { + limit = { + exists = scope:title + root.dynasty.dynast ?= { + has_domicile = yes + } + scope:title = { + is_de_jure_liege_or_above_target = root.dynasty.dynast.domicile.domicile_location.county + } + } + subtract = { + value = 20 + desc = estate_location_in_area + } + } + if = { + limit = { + domicile ?= { + has_domicile_parameter = celestial_civilian_score_bonus_1 + } + } + add = { + value = celestial_civilian_score_bonus_1_value + desc = "[GetDomicileBuilding('east_asian_estate_office_01').GetName]" + } + } + else_if = { + limit = { + domicile ?= { + has_domicile_parameter = celestial_civilian_score_bonus_2 + } + } + add = { + value = celestial_civilian_score_bonus_2_value + desc = "[GetDomicileBuilding('east_asian_estate_office_02').GetName]" + } + } + else_if = { + limit = { + domicile ?= { + has_domicile_parameter = celestial_civilian_score_bonus_3 + } + } + add = { + value = celestial_civilian_score_bonus_3_value + desc = "[GetDomicileBuilding('east_asian_estate_office_03').GetName]" + } + } + else_if = { + limit = { + domicile ?= { + has_domicile_parameter = celestial_civilian_score_bonus_4 + } + } + add = { + value = celestial_civilian_score_bonus_4_value + desc = "[GetDomicileBuilding('east_asian_estate_office_04').GetName]" + } + } + + # Piety level + if = { + limit = { + piety_level != 1 + } + add = { + value = 10 + multiply = { + value = piety_level + subtract = 1 # Baseline is at 1, so we want the bonus to start at 2 + } + desc = PIETY_LEVEL_CONCEPT + } + } + + # Traits + if = { + limit = { has_trait = disinherited } + subtract = { + value = 200 + desc = trait_disinherited + } + } + if = { + limit = { has_trait = gallivanter } + subtract = { + value = 200 + desc = trait_gallivanter + } + } + + # Same dynasty as holder penalty + if = { + limit = { + root.dynasty ?= scope:title.holder.dynasty + } + subtract = { + value = 50 + desc = too_closely_related + } + } + + # CRIMINAL + if = { + limit = { + has_trait = deviant + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = deviant FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -50 + desc = "deviant_and_criminal_desc" + } + } + if = { + limit = { + has_trait = incestuous + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = incestuous FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -50 + desc = "incestuous_and_criminal_desc" + } + } + if = { + limit = { + has_trait = sodomite + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = sodomite FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -50 + desc = "sodomite_and_criminal_desc" + } + } + if = { + limit = { + has_trait = cannibal + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = cannibal FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -50 + desc = "cannibal_and_criminal_desc" + } + } + if = { + limit = { + has_trait = kinslayer_1 + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = kinslayer_1 FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -50 + desc = "kinslayer_1_and_criminal_desc" + } + } + if = { + limit = { + has_trait = kinslayer_2 + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = kinslayer_2 FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -50 + desc = "kinslayer_2_and_criminal_desc" + } + } + if = { + limit = { + has_trait = kinslayer_3 + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = kinslayer_3 FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -50 + desc = "kinslayer_3_and_criminal_desc" + } + } + if = { + limit = { + has_trait = witch + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = witch FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -50 + desc = "witch_and_criminal_desc" + } + } + if = { + limit = { + has_trait = adulterer + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = adulterer FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -50 + desc = "adulterer_and_criminal_desc" + } + } + if = { + limit = { + has_trait = fornicator + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = fornicator FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -50 + desc = "fornicator_and_criminal_desc" + } + } + if = { + limit = { + OR = { + has_trait = lunatic + has_trait = possessed + has_trait = incapable + has_trait = intellect_bad_3 + } + } + add = { + value = -100 + desc = "unsound_mind_desc" + } + } + + # FAITH HOSTILITY + if = { + limit = { + scope:title.holder.primary_title.state_faith ?= { + faith_hostility_level = { + target = root.faith + value = faith_astray_level + } + } + } #Change to faith acceptance + subtract = { + value = 10 + desc = astray_faith_succession_desc + } + } + if = { + limit = { + scope:title.holder.primary_title.state_faith ?= { + faith_hostility_level = { + target = root.faith + value = faith_hostile_level + } + } + } #Change to faith acceptance + subtract = { + value = 20 + desc = hostile_faith_succession_desc + } + } + if = { + limit = { + scope:title.holder.primary_title.state_faith ?= { + faith_hostility_level = { + target = root.faith + value >= faith_evil_level + } + } + } #Change to faith acceptance + subtract = { + value = 30 + desc = evil_faith_sucession_desc + } + } + + # CLAIMS + if = { + limit = { + exists = scope:title + } + if = { + limit = { has_strong_claim_on = scope:title } + add = { + value = 20 + desc = title_claim_desc + } + } + else_if = { + limit = { has_weak_claim_on = scope:title } + add = { + value = 10 + desc = title_weak_claim_desc + } + } + } + + # POPULAR OPINION + if = { + limit = { is_landed = yes } + add = { + value = { + value = capital_county.county_holder_opinion + multiply = 0.25 + round = yes + } + desc = county_holder_opinion_desc + } + } + + # PERKS + if = { + limit = { + NOT = { + government_has_flag = government_is_celestial + } + has_perk = ducal_conquest_perk + } + add = { + value = 30 + desc = ducal_conquest_perk_name_desc + } + } + + # Dynasty Legacy + if = { + limit = { + dynasty ?= { + has_dynasty_perk = tgp_chinese_legacy_4 + } + } + add = { + value = legacy_candidate_score_bonus + desc = "[GetDynastyPerk('tgp_chinese_legacy_4').GetName]" + } + } + + # Aspirations + if = { + limit = { + house ?= { has_house_power_parameter = poet_trait_provides_candidate_score_1 } + } + add = { + value = "has_trait_xp(lifestyle_poet)" + multiply = poet_trait_provides_candidate_score_1_value + desc = celestial_governor_poet_trait_desc + } + } + else_if = { + limit = { + house ?= { has_house_power_parameter = poet_trait_provides_candidate_score_2 } + } + add = { + value = "has_trait_xp(lifestyle_poet)" + multiply = poet_trait_provides_candidate_score_2_value + desc = celestial_governor_poet_trait_desc + } + } + else_if = { + limit = { + house ?= { has_house_power_parameter = poet_trait_provides_candidate_score_3 } + } + add = { + value = "has_trait_xp(lifestyle_poet)" + multiply = poet_trait_provides_candidate_score_3_value + desc = celestial_governor_poet_trait_desc + } + } + else_if = { + limit = { + house ?= { has_house_power_parameter = poet_trait_provides_candidate_score_4 } + } + add = { + value = "has_trait_xp(lifestyle_poet)" + desc = celestial_governor_poet_trait_desc + } + } + + # LOWBORN? EW no + if = { + limit = { + is_lowborn = yes + } + subtract = { + value = 25 + desc = lowborn_desc_succession + } + } + + # RELATIONS + if = { # Is a friend + limit = { + scope:title.holder ?= { has_relation_friend = root } + } + add = { + value = 15 + desc = governor_friend_desc + } + } + if = { # Is a elder + limit = { + scope:title.holder ?= { has_relation_elder = root } + } + add = { + value = 15 + desc = governor_elder_desc + } + } + if = { # Is a disciple + limit = { + scope:title.holder ?= { has_relation_disciple = root } + } + add = { + value = 10 + desc = governor_disciple_desc + } + } + + # REGENT OF EMPEROR + if = { + limit = { scope:title.holder.diarch ?= root } + add = { + value = scope:title.holder.diarchy_swing + desc = governor_diarch_desc + } + } + + # Schemes + if = { + limit = { has_character_modifier = scheme_slandered_modifier } + add = { + value = slander_appointment_score_value + desc = scheme_slandered_modifier + } + } + if = { + limit = { has_character_modifier = scheme_promoted_modifier } + add = { + value = promote_appointment_score_value # Keep this balanced if more values are added! + desc = scheme_promoted_modifier + } + } + + # Decisions + if = { + limit = { + has_character_modifier = ep3_integration_promoter_modifier + has_variable = integration_promoted_in + var:integration_promoted_in.duchy ?= scope:title + } + add = { + value = 30 + desc = ep3_integration_promoter_modifier + } + } + + # Conquest Dynasty has a favored culture + if = { + limit = { + top_liege ?= { has_title = title:h_china } + situation:dynastic_cycle ?= { + has_variable = dynastic_cycle_favored_culture + root.culture = var:dynastic_cycle_favored_culture + } + } + add = { + value = 100 + desc = dynastic_cycle_conquerer_promoted_culture + } + } + + # PETITION + if = { + limit = { scope:title.var:petition_house_rights ?= house } + add = { + value = 250 + desc = petition_liege_house_province_rights_value_desc + } + } + + # MOVEMENTS + if = { + limit = { + situation:dynastic_cycle ?= { + situation_participant_group:expansion_movement = { + participant_group_has_character = root + is_movement_in_power = { MOVEMENT = expansion_movement } + } + } + } + add = { + value = 20 + desc = expansion_movement_is_favored_appointment_desc + } + } + if = { + limit = { + situation:dynastic_cycle ?= { + situation_participant_group:advancement_movement = { + participant_group_has_character = root + is_movement_in_power = { MOVEMENT = advancement_movement } + } + } + } + add = { + value = 20 + desc = advancement_movement_is_favored_appointment_desc + } + } + if = { + limit = { + situation:dynastic_cycle ?= { + situation_participant_group:pro_hegemon_movement = { + participant_group_has_character = root + #they don't have to be in power + } + } + } + add = { + value = 20 + desc = pro_hegemon_movement_appointment_desc + } + } + if = { + limit = { + situation:dynastic_cycle ?= { + situation_participant_group:conservative_movement = { + participant_group_has_character = root + NOT = { is_movement_in_power = { MOVEMENT = conservative_movement } } + #they have to be in power to remove the malus + } + } + } + add = { + value = -20 + desc = conservative_movement_appointment_value + } + } + + ### EXPANDED POWER BASE + save_temporary_value_as = temp_total + if = { + limit = { has_character_modifier = ep3_expanded_power_base_minor_modifier } + add = { + value = scope:temp_total + multiply = 0.10 + round = yes + min = 25 + desc = ep3_expanded_power_base_minor_modifier + } + } + if = { + limit = { has_character_modifier = ep3_expanded_power_base_medium_modifier } + add = { + value = scope:temp_total + multiply = 0.20 + round = yes + min = 50 + desc = ep3_expanded_power_base_medium_modifier + } + } + if = { + limit = { has_character_modifier = ep3_expanded_power_base_major_modifier } + add = { + value = scope:temp_total + multiply = 0.30 + round = yes + min = 75 + desc = ep3_expanded_power_base_major_modifier + } + } + + # ADJUST BASED ON GENDER LAW - MUST GO AT THE END + if = { + limit = { + scope:title.holder.top_liege ?= { has_realm_law = male_preference_law } + is_female = yes + } + multiply = { + value = { + value = 1 + subtract = appointment_non_preferred_gender_penalty_value + } + desc = appointment_male_preference_desc + } + } + else_if = { + limit = { + scope:title.holder.top_liege ?= { has_realm_law = male_only_law } + is_female = yes + } + multiply = { + value = { + value = 1 + subtract = appointment_opposite_gender_penalty_value + } + desc = appointment_male_only_desc + } + } + else_if = { + limit = { + scope:title.holder.top_liege ?= { has_realm_law = female_preference_law } + is_female = no + } + multiply = { + value = { + value = 1 + subtract = appointment_non_preferred_gender_penalty_value + } + desc = appointment_female_preference_desc + } + } + else_if = { + limit = { + scope:title.holder.top_liege ?= { has_realm_law = female_only_law } + is_female = no + } + multiply = { + value = { + value = 1 + subtract = appointment_opposite_gender_penalty_value + } + desc = appointment_female_only_desc + } + } + + # We remove all score from the emperor, to make sure you don't inherit governorships needlessly + if = { + limit = { + is_independent_ruler = yes + } + multiply = { + value = 0 + desc = appointment_is_top_liege + } + } + } + } +} + +celestial_military_governor = { + default_candidates = { direct_landed_vassal holder_close_family } + allow_same_tier_candidates = yes + + level = merit + + candidate_score = { + value = { + if = { + limit = { + top_liege = { + has_realm_law = candidate_score_prestige_law + } + } + # Base score gained from prestige rank + add = { + value = 10 + multiply = prestige_level + desc = PRESTIGE_LEVEL_CONCEPT + } + if = { + limit = { + exists = dynasty + } + # Base score gained from prestige rank + add = { + value = 10 + multiply = dynasty.dynasty_prestige_level + desc = DYNASTY_PRESTIGE_CONCEPT + } + } + } + + # Martial skill - We use this as additional base for the overall score + add = { + value = martial + multiply = 2 + desc = "[martial_skill|E]" + } + + # Learning skill - We use this as additional base for the overall score if you have the correct cultural parameter + if = { + limit = { + culture = { + has_cultural_parameter = military_governor_appointment_score + } + } + add = { + value = learning + multiply = 0.5 + round = yes + desc = "[learning_skill|E]" + } + } + + # Martial education provides additional score + if = { + limit = { + has_trait = education_martial + } + if = { + limit = { + has_trait = education_martial_5 + } + add = { + value = 100 + desc = has_trait_education_martial_5 + } + } + else_if = { + limit = { + has_trait = education_martial_4 + } + add = { + value = 80 + desc = has_trait_education_martial_4 + } + } + else_if = { + limit = { + has_trait = education_martial_3 + } + add = { + value = 60 + desc = has_trait_education_martial_3 + } + } + else_if = { + limit = { + has_trait = education_martial_2 + } + add = { + value = 40 + desc = has_trait_education_martial_2 + } + } + else_if = { + limit = { + has_trait = education_martial_1 + } + add = { + value = 20 + desc = has_trait_education_martial_1 + } + } + } + + # Commander traits + add = { + value = number_of_commander_traits + multiply = 20 + desc = number_of_commander_traits_desc + } + + # Prowess + add = { + value = prowess + desc = prowess_concept + } + + # Influenced career + if = { + limit = { + exists = var:merit_military_career_score_bonus + } + add = { + value = var:merit_military_career_score_bonus + desc = merit_career_score_bonus_desc + } + } + + # Warfare Legacy + add = { + value = 10 + multiply = dynasty.warfare_legacy_track_perks + desc = has_warfare_legacy_track_desc + } + + # Dynasty Legacy + if = { + limit = { + dynasty ?= { + has_dynasty_perk = tgp_chinese_legacy_4 + } + } + add = { + value = legacy_candidate_score_bonus + desc = "[GetDynastyPerk('tgp_chinese_legacy_4').GetName]" + } + } + + # Aspirations + if = { + limit = { + house ?= { has_house_power_parameter = poet_trait_provides_candidate_score_1 } + } + add = { + value = "has_trait_xp(lifestyle_poet)" + multiply = poet_trait_provides_candidate_score_1_value + desc = celestial_governor_poet_trait_desc + } + } + else_if = { + limit = { + house ?= { has_house_power_parameter = poet_trait_provides_candidate_score_2 } + } + add = { + value = "has_trait_xp(lifestyle_poet)" + multiply = poet_trait_provides_candidate_score_2_value + desc = celestial_governor_poet_trait_desc + } + } + else_if = { + limit = { + house ?= { has_house_power_parameter = poet_trait_provides_candidate_score_3 } + } + add = { + value = "has_trait_xp(lifestyle_poet)" + multiply = poet_trait_provides_candidate_score_3_value + desc = celestial_governor_poet_trait_desc + } + } + else_if = { + limit = { + house ?= { has_house_power_parameter = poet_trait_provides_candidate_score_4 } + } + add = { + value = "has_trait_xp(lifestyle_poet)" + desc = celestial_governor_poet_trait_desc + } + } + + # Influence + if = { + limit = { + influence_level != 1 + } + add = { + value = 10 + multiply = { + value = influence_level + subtract = 1 # Baseline is at 1, so we want the bonus to start at 2 + } + desc = "[influence_level|E]" + } + } + + # Traits + if = { + limit = { has_trait = disinherited } + subtract = { + value = 200 + desc = trait_disinherited + } + } + if = { + limit = { has_trait = gallivanter } + subtract = { + value = 200 + desc = trait_gallivanter + } + } + + # CRIMINAL + if = { + limit = { + has_trait = deviant + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = deviant FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "deviant_and_criminal_desc" + } + } + if = { + limit = { + has_trait = incestuous + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = incestuous FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "incestuous_and_criminal_desc" + } + } + if = { + limit = { + has_trait = sodomite + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = sodomite FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "sodomite_and_criminal_desc" + } + } + if = { + limit = { + has_trait = cannibal + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = cannibal FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "cannibal_and_criminal_desc" + } + } + if = { + limit = { + has_trait = kinslayer_1 + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = kinslayer_1 FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "kinslayer_1_and_criminal_desc" + } + } + if = { + limit = { + has_trait = kinslayer_2 + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = kinslayer_2 FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "kinslayer_2_and_criminal_desc" + } + } + if = { + limit = { + has_trait = kinslayer_3 + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = kinslayer_3 FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "kinslayer_3_and_criminal_desc" + } + } + if = { + limit = { + has_trait = witch + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = witch FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "witch_and_criminal_desc" + } + } + if = { + limit = { + has_trait = adulterer + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = adulterer FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "adulterer_and_criminal_desc" + } + } + if = { + limit = { + has_trait = fornicator + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = fornicator FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "fornicator_and_criminal_desc" + } + } + + # FAITH HOSTILITY + if = { + limit = { + scope:title.holder.primary_title.state_faith ?= { + faith_hostility_level = { + target = root.faith + value = faith_astray_level + } + } + } #Change to faith acceptance + subtract = { + value = 10 + desc = astray_faith_succession_desc + } + } + if = { + limit = { + scope:title.holder.primary_title.state_faith ?= { + faith_hostility_level = { + target = root.faith + value = faith_hostile_level + } + } + } #Change to faith acceptance + subtract = { + value = 20 + desc = hostile_faith_succession_desc + } + } + if = { + limit = { + scope:title.holder.primary_title.state_faith ?= { + faith_hostility_level = { + target = root.faith + value >= faith_evil_level + } + } + } #Change to faith acceptance + subtract = { + value = 30 + desc = evil_faith_sucession_desc + } + } + + # PERKS + if = { + limit = { has_perk = ducal_conquest_perk } + add = { + value = 30 + desc = ducal_conquest_perk_name_desc + } + } + + # LOWBORN? EW no + if = { + limit = { + is_lowborn = yes + } + subtract = { + value = 25 + desc = lowborn_desc_succession + } + } + + # RELATIONS + if = { # Is child of holder + limit = { + scope:title.holder ?= { is_parent_of = root } + } + add = { + value = 30 + desc = "parent_holder_desc" + } + } + else_if = { # Is family of holder + limit = { + scope:title.holder ?= { is_close_family_of = root } + } + add = { + value = 20 + desc = "close_family_holder_desc" + } + } + else_if = { # Is family of holder's spouse + limit = { + scope:title.holder ?= { + any_spouse = { is_close_family_of = root } + NOT = { is_close_family_of = root } + } + } + add = { + value = 10 + desc = "close_family_married_to_holder_desc" + } + } + if = { # Is a friend + limit = { + scope:title.holder ?= { has_relation_friend = root } + } + add = { + value = 15 + desc = governor_friend_desc + } + } + if = { # Is a elder + limit = { + scope:title.holder ?= { has_relation_elder = root } + } + add = { + value = 15 + desc = governor_elder_desc + } + } + if = { # Is a disciple + limit = { + scope:title.holder ?= { has_relation_disciple = root } + } + add = { + value = 10 + desc = governor_disciple_desc + } + } + + # REGENT OF EMPEROR + if = { + limit = { scope:title.holder.diarch ?= root } + add = { + value = scope:title.holder.diarchy_swing + desc = governor_diarch_desc + } + } + + # Schemes + if = { + limit = { has_character_modifier = scheme_slandered_modifier } + add = { + value = slander_appointment_score_value + desc = scheme_slandered_modifier + } + } + if = { + limit = { has_character_modifier = scheme_promoted_modifier } + add = { + value = promote_appointment_score_value # Keep this balanced if more values are added! + desc = scheme_promoted_modifier + } + } + + # Decisions + if = { + limit = { + has_character_modifier = ep3_integration_promoter_modifier + has_variable = integration_promoted_in + var:integration_promoted_in.duchy ?= scope:title + } + add = { + value = 30 + desc = ep3_integration_promoter_modifier + } + } + + # Conquest Dynasty has a favored culture + if = { + limit = { + top_liege = { has_title = title:h_china } + situation:dynastic_cycle ?= { + has_variable = dynastic_cycle_favored_culture + root.culture = var:dynastic_cycle_favored_culture + } + } + add = { + value = 100 + desc = dynastic_cycle_conquerer_promoted_culture + } + } + + # PETITION + if = { + limit = { scope:title.var:petition_house_rights ?= house } + add = { + value = 250 + desc = petition_liege_house_province_rights_value_desc + } + } + + # MOVEMENTS + if = { + limit = { + situation:dynastic_cycle ?= { + situation_participant_group:expansion_movement = { + participant_group_has_character = root + is_movement_in_power = { MOVEMENT = expansion_movement } + } + } + } + add = { + value = 20 + desc = expansion_movement_is_favored_appointment_desc + } + } + if = { + limit = { + situation:dynastic_cycle ?= { + situation_participant_group:advancement_movement = { + participant_group_has_character = root + is_movement_in_power = { MOVEMENT = advancement_movement } + } + } + } + add = { + value = 20 + desc = advancement_movement_is_favored_appointment_desc + } + } + if = { + limit = { + situation:dynastic_cycle ?= { + situation_participant_group:pro_hegemon_movement = { + participant_group_has_character = root + #they don't have to be in power + } + } + } + add = { + value = 20 + desc = pro_hegemon_movement_appointment_desc + } + } + if = { + limit = { + situation:dynastic_cycle ?= { + situation_participant_group:conservative_movement = { + participant_group_has_character = root + NOT = { is_movement_in_power = { MOVEMENT = conservative_movement } } + #they have to be in power to remove the malus + } + } + } + add = { + value = -20 + desc = conservative_movement_appointment_value + } + } + + + + ### EXPANDED POWER BASE + save_temporary_value_as = temp_total + if = { + limit = { has_character_modifier = ep3_expanded_power_base_minor_modifier } + add = { + value = scope:temp_total + multiply = 0.10 + round = yes + min = 25 + desc = ep3_expanded_power_base_minor_modifier + } + } + if = { + limit = { has_character_modifier = ep3_expanded_power_base_medium_modifier } + add = { + value = scope:temp_total + multiply = 0.20 + round = yes + min = 50 + desc = ep3_expanded_power_base_medium_modifier + } + } + if = { + limit = { has_character_modifier = ep3_expanded_power_base_major_modifier } + add = { + value = scope:temp_total + multiply = 0.30 + round = yes + min = 75 + desc = ep3_expanded_power_base_major_modifier + } + } + + # Must be eligible as a commander + if = { + limit = { + NOT = { + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = top_liege } + } + } + add = { + value = -1000 + desc = cannot_be_commander + } + } + + # We remove all score from the emperor, to make sure you don't inherit governorships needlessly + if = { + limit = { + is_independent_ruler = yes + } + multiply = { + value = 0 + desc = appointment_is_top_liege + } + } + } + } +} diff --git a/N3OW/common/succession_appointment/celestial_minister.txt b/N3OW/common/succession_appointment/celestial_minister.txt new file mode 100644 index 00000000..f3ae3710 --- /dev/null +++ b/N3OW/common/succession_appointment/celestial_minister.txt @@ -0,0 +1,443 @@ +celestial_minister = { + default_candidates = { landed_vassal unlanded_noble_house_head } + + allow_same_tier_candidates = yes + + level = merit + + candidate_score = { + value = { + # Age - With age comes experience. We provide a rather small bonus for the elderly, to exist as a potential tie-breaker. + if = { # Too old + limit = { + tgp_is_above_retirement_age_trigger = { REALM_OWNER = root } + } + add = { + value = { + value = retirement_age_current_value + subtract = age + divide = 4 + round = yes + } + desc = is_above_retirement_age_desc + } + } + else_if = { # Old and experienced + limit = { + age >= 40 + } + add = { + value = 10 + desc = old_age_desc + } + } + else_if = { # Too young + limit = { + age < 30 + } + add = { + value = -5 + desc = young_age_desc + } + } + + # Influence + if = { + limit = { + influence_level != 1 + } + add = { + value = 10 + multiply = { + value = influence_level + subtract = 1 # Baseline is at 1, so we want the bonus to start at 2 + } + desc = "[influence_level|E]" + } + } + + # Domicile Buildings + if = { + limit = { + domicile ?= { has_domicile_parameter = celestial_minister_score_bonus_1 } + } + add = { + value = celestial_ministry_score_bonus_1_value + desc = "[GetDomicileBuilding('east_asian_minister_office_01').GetName]" + } + } + else_if = { + limit = { + domicile ?= { has_domicile_parameter = celestial_minister_score_bonus_2 } + } + add = { + value = celestial_ministry_score_bonus_2_value + desc = "[GetDomicileBuilding('east_asian_minister_office_02').GetName]" + } + } + else_if = { + limit = { + domicile ?= { has_domicile_parameter = celestial_minister_score_bonus_3 } + } + add = { + value = celestial_ministry_score_bonus_3_value + desc = "[GetDomicileBuilding('east_asian_minister_office_03').GetName]" + } + } + else_if = { + limit = { + domicile ?= { has_domicile_parameter = celestial_minister_score_bonus_4 } + } + add = { + value = celestial_ministry_score_bonus_4_value + desc = "[GetDomicileBuilding('east_asian_minister_office_04').GetName]" + } + } + + # Aspirations + if = { + limit = { + house ?= { has_house_power_parameter = poet_trait_provides_candidate_score_1 } + } + add = { + value = "has_trait_xp(lifestyle_poet)" + multiply = poet_trait_provides_candidate_score_1_value + desc = celestial_governor_poet_trait_desc + } + } + else_if = { + limit = { + house ?= { has_house_power_parameter = poet_trait_provides_candidate_score_2 } + } + add = { + value = "has_trait_xp(lifestyle_poet)" + multiply = poet_trait_provides_candidate_score_2_value + desc = celestial_governor_poet_trait_desc + } + } + else_if = { + limit = { + house ?= { has_house_power_parameter = poet_trait_provides_candidate_score_3 } + } + add = { + value = "has_trait_xp(lifestyle_poet)" + multiply = poet_trait_provides_candidate_score_3_value + desc = celestial_governor_poet_trait_desc + } + } + else_if = { + limit = { + house ?= { has_house_power_parameter = poet_trait_provides_candidate_score_4 } + } + add = { + value = "has_trait_xp(lifestyle_poet)" + desc = celestial_governor_poet_trait_desc + } + } + + # Relations + if = { # Is holder's elder + limit = { + scope:title.holder ?= { has_relation_elder = root } + } + add = { + value = 20 + desc = governor_elder_desc + } + } + if = { # Is holder's disciple + limit = { + scope:title.holder ?= { has_relation_disciple = root } + } + add = { + value = 10 + desc = governor_disciple_desc + } + } + + # Schemes + if = { + limit = { has_character_modifier = scheme_slandered_modifier } + add = { + value = slander_appointment_score_value + desc = scheme_slandered_modifier + } + } + if = { + limit = { has_character_modifier = scheme_promoted_modifier } + add = { + value = promote_appointment_score_value # Keep this balanced if more values are added! + desc = scheme_promoted_modifier + } + } + + # Conquest Dynasty has a favored culture + if = { + limit = { + top_liege = { has_title = title:h_china } + situation:dynastic_cycle ?= { + has_variable = dynastic_cycle_favored_culture + root.culture = var:dynastic_cycle_favored_culture + } + } + add = { + value = 100 + desc = dynastic_cycle_conquerer_promoted_culture + } + } + + # Movements + # Movement leader + if = { + limit = { + is_any_movement_leader = yes + } + add = { + value = 100 + desc = is_a_movement_leader_desc + } + } + # Part of the favored movement + if = { + limit = { + situation:dynastic_cycle ?= { + situation_participant_group:expansion_movement = { + participant_group_has_character = root + is_movement_in_power = { MOVEMENT = expansion_movement } + } + } + } + add = { + value = 25 + desc = expansion_movement_is_favored_appointment_desc + } + } + if = { + limit = { + situation:dynastic_cycle ?= { + situation_participant_group:advancement_movement = { + participant_group_has_character = root + is_movement_in_power = { MOVEMENT = advancement_movement } + } + } + } + add = { + value = 25 + desc = advancement_movement_is_favored_appointment_desc + } + } + if = { + limit = { + situation:dynastic_cycle ?= { + situation_participant_group:pro_hegemon_movement = { + participant_group_has_character = root + NOT = { is_movement_in_power = { MOVEMENT = pro_hegemon_movement } } + } + } + } + add = { + value = 10 + desc = pro_hegemon_movement_appointment_desc + } + } + if = { + limit = { + situation:dynastic_cycle ?= { + situation_participant_group:pro_hegemon_movement = { + participant_group_has_character = root + is_movement_in_power = { MOVEMENT = pro_hegemon_movement } + } + } + } + add = { + value = 25 + desc = pro_hegemon_movement_is_favored_appointment_desc + } + } + if = { + limit = { + situation:dynastic_cycle ?= { + situation_participant_group:conservative_movement = { + participant_group_has_character = root + is_movement_in_power = { MOVEMENT = conservative_movement } + } + } + } + add = { + value = 25 + desc = conservative_movement_is_favored_appointment_desc + } + } + + # Minister specific score + if = { + limit = { + scope:title = { + OR = { + this = title:e_minister_chancellor + this = title:e_minister_of_personnel + } + } + } + if = { + limit = { + scope:title = title:e_minister_chancellor + tgp_is_any_minister = yes + } + add = { + value = 100 + desc = is_a_minister_desc + } + } + add = { + value = diplomacy + desc = diplomacy_concept + } + } + else_if = { + limit = { + scope:title = title:e_minister_censor + } + add = { + value = intrigue + desc = intrigue_concept + } + } + else_if = { + limit = { + scope:title = title:e_minister_of_war + } + add = { + value = martial + desc = martial_concept + } + } + else_if = { + limit = { + scope:title = { + OR = { + this = title:e_minister_of_revenue + this = title:e_minister_of_works + } + } + } + add = { + value = stewardship + desc = stewardship_concept + } + } + else_if = { + limit = { + scope:title = { + OR = { + this = title:e_minister_of_rites + this = title:e_minister_of_justice + } + } + } + add = { + value = learning + desc = learning_concept + } + } + + ### EXPANDED POWER BASE + save_temporary_value_as = temp_total + if = { + limit = { has_character_modifier = ep3_expanded_power_base_minor_modifier } + add = { + value = scope:temp_total + multiply = 0.10 + round = yes + min = 25 + desc = ep3_expanded_power_base_minor_modifier + } + } + if = { + limit = { has_character_modifier = ep3_expanded_power_base_medium_modifier } + add = { + value = scope:temp_total + multiply = 0.20 + round = yes + min = 50 + desc = ep3_expanded_power_base_medium_modifier + } + } + if = { + limit = { has_character_modifier = ep3_expanded_power_base_major_modifier } + add = { + value = scope:temp_total + multiply = 0.30 + round = yes + min = 75 + desc = ep3_expanded_power_base_major_modifier + } + } + + # ADJUST BASED ON GENDER LAW - MUST GO AT THE END + if = { + limit = { + scope:title.holder.top_liege ?= { has_realm_law = male_preference_law } + is_female = yes + } + multiply = { + value = { + value = 1 + subtract = appointment_non_preferred_gender_penalty_value + } + desc = appointment_male_preference_desc + } + } + else_if = { + limit = { + scope:title.holder.top_liege ?= { has_realm_law = male_only_law } + is_female = yes + } + multiply = { + value = { + value = 1 + subtract = appointment_opposite_gender_penalty_value + } + desc = appointment_male_only_desc + } + } + else_if = { + limit = { + scope:title.holder.top_liege ?= { has_realm_law = female_preference_law } + is_female = no + } + multiply = { + value = { + value = 1 + subtract = appointment_non_preferred_gender_penalty_value + } + desc = appointment_female_preference_desc + } + } + else_if = { + limit = { + scope:title.holder.top_liege ?= { has_realm_law = female_only_law } + is_female = no + } + multiply = { + value = { + value = 1 + subtract = appointment_opposite_gender_penalty_value + } + desc = appointment_female_only_desc + } + } + + # We remove all score from the emperor, to make sure you don't inherit governorships needlessly + if = { + limit = { + is_independent_ruler = yes + } + multiply = { + value = -1000 + desc = appointment_is_top_liege + } + } + } + } +} diff --git a/N3OW/common/succession_appointment/japanese_admin_governor.txt b/N3OW/common/succession_appointment/japanese_admin_governor.txt new file mode 100644 index 00000000..a7362c94 --- /dev/null +++ b/N3OW/common/succession_appointment/japanese_admin_governor.txt @@ -0,0 +1,1126 @@ +japanese_governor = { + allow_children = no + + default_candidates = { holder_close_family landed_vassal holder_councilor holder_court_position } + + candidate_score = { + value = { + # Base - Based on skills + add = { + value = martial + add = diplomacy + add = stewardship + add = intrigue + add = learning + multiply = 1 + desc = sum_of_skills_desc + } + # TRAITS + if = { + limit = { has_trait = governor } + add = { + value = 5 + if = { + limit = { + has_trait_xp = { trait = governor value >= 25 } + } + add = 5 + } + if = { + limit = { + has_trait_xp = { trait = governor value >= 50 } + } + add = 5 + } + if = { + limit = { + has_trait_xp = { trait = governor value >= 75 } + } + add = 5 + } + desc = governor_trait_desc_short + } + } + if = { + limit = { + OR = { + has_trait = blind + has_trait = incapable + has_trait = infirm + } + } + subtract = { + value = 50 + desc = negative_trait_succession + } + } + if = { + limit = { has_trait = disinherited } + subtract = { + value = 200 + desc = trait_disinherited + } + } + if = { + limit = { has_trait = gallivanter } + subtract = { + value = 200 + desc = trait_gallivanter + } + } + if = { + limit = { has_trait = devoted } + subtract = { + value = 250 + desc = trait_devoted + } + } + else_if = { + limit = { is_clergy = yes } + subtract = { + value = 250 + desc = IS_CLERGY_TRIGGER + } + } + # CRIMINAL + if = { + limit = { + has_trait = deviant + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = deviant FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "deviant_and_criminal_desc" + } + } + if = { + limit = { + has_trait = incestuous + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = incestuous FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "incestuous_and_criminal_desc" + } + } + if = { + limit = { + has_trait = sodomite + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = sodomite FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "sodomite_and_criminal_desc" + } + } + if = { + limit = { + has_trait = cannibal + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = cannibal FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "cannibal_and_criminal_desc" + } + } + if = { + limit = { + has_trait = kinslayer_1 + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = kinslayer_1 FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "kinslayer_1_and_criminal_desc" + } + } + if = { + limit = { + has_trait = kinslayer_2 + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = kinslayer_2 FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "kinslayer_2_and_criminal_desc" + } + } + if = { + limit = { + has_trait = kinslayer_3 + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = kinslayer_3 FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "kinslayer_3_and_criminal_desc" + } + } + if = { + limit = { + has_trait = witch + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = witch FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "witch_and_criminal_desc" + } + } + if = { + limit = { + has_trait = adulterer + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = adulterer FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "adulterer_and_criminal_desc" + } + } + if = { + limit = { + has_trait = fornicator + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = fornicator FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "fornicator_and_criminal_desc" + } + } + # COUNCIL POSITIONS + if = { + limit = { + scope:title.holder ?= { + any_councillor ?= { this = root } + } + } + add = { + value = 20 + multiply = scope:title.holder.governor_efficiency + desc = councillor_position_governor_desc + } + } + # COURT POSITIONS + if = { + limit = { + scope:title.holder ?= { + any_court_position_holder ?= { + this = root + } + } + } + add = { + value = 5 + multiply = scope:title.holder.governor_efficiency + desc = court_position_succession_governor_desc + } + } + # FAITH HOSTILITY + if = { + limit = { + scope:title.holder.primary_title.state_faith ?= { + faith_hostility_level = { + target = root.faith + value = faith_astray_level + } + } + } #Change to faith acceptance + subtract = { + value = 10 + desc = astray_faith_succession_desc + } + } + if = { + limit = { + scope:title.holder.primary_title.state_faith ?= { + faith_hostility_level = { + target = root.faith + value = faith_hostile_level + } + } + } #Change to faith acceptance + subtract = { + value = 25 + desc = hostile_faith_succession_desc + } + } + if = { + limit = { + scope:title.holder.primary_title.state_faith ?= { + faith_hostility_level = { + target = root.faith + value >= faith_evil_level + } + } + } #Change to faith acceptance + subtract = { + value = 50 + desc = evil_faith_sucession_desc + } + } + # CLAIMS + if = { + limit = { has_strong_claim_on = scope:title } + add = { + value = 25 + desc = title_claim_desc + } + } + else_if = { + limit = { has_weak_claim_on = scope:title } + add = { + value = 15 + desc = title_weak_claim_desc + } + } + # POPULAR OPINION + if = { + limit = { is_landed = yes } + add = { + value = { + value = capital_county.county_holder_opinion + multiply = 0.25 + } + desc = county_holder_opinion_desc + } + } + # PERKS + if = { + limit = { has_perk = ducal_conquest_perk } + add = { + value = 30 + desc = ducal_conquest_perk_name + } + } + # LOWBORN? EW no + if = { + limit = { is_lowborn = yes } + subtract = { + value = 25 + desc = lowborn_desc_succession + } + } + # INFLUENCE LEVEL + if = { + limit = { influence_level = 0 } + subtract = { + value = 10 + desc = "[influence_level|E]" + } + } + if = { + limit = { influence_level >= 2 } + add = { + value = 10 + multiply = { + value = influence_level + subtract = 1 # Base value should start at 2 + } + desc = "[influence_level|E]" + } + } + #SAME CULTURE AS REGION + if = { + limit = { culture ?= scope:title.holder.capital_county.culture } + add = { + value = 10 + desc = of_local_culture_succession_desc + } + } + # PERSONAL REASONS + if = { + limit = { + scope:title.holder ?= { is_close_family_of = root } + } + add = { + value = 10 + multiply = scope:title.holder.governor_efficiency + desc = "close_family_holder_desc" + } + } + else_if = { + limit = { + scope:title.holder ?= { + any_spouse = { is_close_family_of = root } + NOT = { is_close_family_of = root } + } + } + add = { + value = 10 + desc = "close_family_married_to_holder_desc" + } + } + #FRIENDS OF THE HOLDER + if = { + limit = { + scope:title.holder ?= { has_relation_friend = root } + } + add = { + value = 5 + multiply = scope:title.holder.governor_efficiency + desc = governor_friend_desc + } + } + if = { + limit = { + scope:title.holder ?= { has_relation_best_friend = root } + } + add = { + value = 15 + multiply = scope:title.holder.governor_efficiency + desc = governor_best_friend_desc + } + } + #REGENT OF KAMPAKU + if = { + limit = { scope:title.holder.diarch ?= root } + add = { + value = scope:title.holder.diarchy_swing + desc = governor_diarch_desc + } + } + # PETITION + if = { + limit = { + exists = house.var:petition_liege_appointment_support + top_liege.primary_title.var:administrative_ui_special_title.holder ?= house.var:petition_liege_appointment_support + NOT = { scope:title = top_liege.primary_title } # Only governorships + } + multiply = { + value = 1.15 + desc = ceremonial_liege_appointment_support_desc + } + } + # SCHEMES + if = { + limit = { has_character_modifier = scheme_slandered_modifier } + add = { + value = slander_appointment_score_value + desc = scheme_slandered_modifier + } + } + if = { + limit = { has_character_modifier = scheme_promoted_modifier } + add = { + value = promote_appointment_score_value # Keep this balanced if more values are added! + desc = scheme_promoted_modifier + } + } + # DECISIONS + if = { + limit = { + has_character_modifier = ep3_integration_promoter_modifier + has_variable = integration_promoted_in + var:integration_promoted_in.duchy ?= scope:title + } + add = { + value = 30 + desc = ep3_integration_promoter_modifier + } + } + # PETITION + if = { + limit = { scope:title.var:petition_house_rights ?= house } + add = { + value = 250 + desc = petition_liege_house_province_rights_value_desc + } + } + # CEREMONIAL LIEGE + if = { + limit = { + tgp_is_ceremonial_liege_trigger = yes + NOT = { scope:title = top_liege.primary_title } + } + add = { + value = -1000 + desc = ceremonial_liege_desc + } + } + # PERKS + if = { + limit = { has_title = title:e_japan } + add = { + value = -1000 + desc = is_kampaku_tt + } + } + # Age + if = { + limit = { age < 50 } + add = { + value = 50 + subtract = age + multiply = -2 + desc = japanese_kampaku_age_desc + } + } + else = { + add = { + value = age + subtract = 50 + multiply = 2 + desc = japanese_kampaku_age_desc + } + } + # CLIMBING TOO EARLY - AT END + if = { + limit = { + trigger_if = { + limit = { is_governor = yes } + scope:title.tier > main_administrative_tier + trigger_if = { + limit = { scope:title.tier = tier_county } + always = no + } + trigger_if = { + limit = { scope:title.tier = tier_duchy } + highest_held_title_tier <= tier_barony + } + trigger_else_if = { + limit = { scope:title.tier = tier_kingdom } + highest_held_title_tier <= tier_county + } + trigger_else_if = { + limit = { scope:title.tier = tier_empire } + highest_held_title_tier <= tier_duchy + } + trigger_else = { + limit = { scope:title.tier = tier_hegemony } + highest_held_title_tier <= tier_kingdom + } + } + trigger_else = { scope:title.tier > scope:title.holder.main_administrative_tier } + } + multiply = { + value = 0.5 + desc = should_hold_a_lower_tier_governorship_first + } + } + # HOUSE BLOC + if = { + limit = { + confederation ?= { has_cohesion_level_parameter = any_member_house_governor_appointment_score } + } + multiply = 1.1 + } + if = { + limit = { + exists = scope:title.holder.confederation + confederation ?= { + this = scope:title.holder.confederation + has_cohesion_level_parameter = any_member_house_continued_appointment_score + } + } + multiply = 1.1 + } + #ADJUST BASED ON GENDER LAW - MUST GO BEFORE EXCLUSIONS + if = { + limit = { + scope:title.holder ?= { has_realm_law = male_preference_law } + is_female = yes + } + multiply = { + value = 0.25 + desc = male_preference_law + } + } + else_if = { + limit = { + scope:title.holder ?= { has_realm_law = male_only_law } + is_female = yes + } + multiply = { + value = 0 + desc = male_only_law + } + } + else_if = { + limit = { + scope:title.holder ?= { has_realm_law = female_preference_law } + is_female = no + } + multiply = { + value = 0.25 + desc = female_preference_law + } + } + else_if = { + limit = { + scope:title.holder ?= { has_realm_law = female_only_law } + is_female = no + } + multiply = { + value = 0 + desc = female_only_law + } + } + ### TOTAL EXCLUSIONS - MUST GO AT END + # Already a governor + if = { + limit = { + is_governor = yes + scope:title.tier = highest_held_title_tier + } + multiply = { + value = 0 + desc = already_a_governor_tt + } + } + # Ceremonial Liege + if = { + limit = { + tgp_is_ceremonial_liege_trigger = yes + NOT = { scope:title = top_liege.primary_title } + } + multiply = { + value = 0 + desc = ceremonial_liege_desc + } + } + # Top liege (emperor/kampaku) + if = { + limit = { is_independent_ruler = yes } + multiply = { + value = 0 + desc = appointment_is_top_liege + } + } + } + } +} + +japanese_military_governor = { + allow_children = no + + default_candidates = { holder_close_family landed_vassal holder_councilor holder_court_position } + + candidate_score = { + value = { + # Martial skill - We use this as the base for the overall score + add = { + value = martial + multiply = 2 + desc = "[martial_skill|E]" + } + # Martial education provides additional score + if = { + limit = { has_trait = education_martial } + if = { + limit = { has_trait = education_martial_1 } + add = { + value = 20 + desc = has_trait_education_martial_1 + } + } + else_if = { + limit = { has_trait = education_martial_2 } + add = { + value = 40 + desc = has_trait_education_martial_2 + } + } + else_if = { + limit = { has_trait = education_martial_3 } + add = { + value = 60 + desc = has_trait_education_martial_3 + } + } + else_if = { + limit = { has_trait = education_martial_4 } + add = { + value = 80 + desc = has_trait_education_martial_4 + } + } + else = { + add = { + value = 100 + desc = has_trait_education_martial_5 + } + } + } + # Commander traits + add = { + value = number_of_commander_traits + multiply = 20 + desc = number_of_commander_traits_desc + } + # Prowess + add = { + value = prowess + desc = prowess_concept + } + # Warfare Legacy + add = { + value = 10 + multiply = dynasty.warfare_legacy_track_perks + desc = has_warfare_legacy_track_desc + } + # Prestige + if = { + limit = { prestige_level != 1 } + add = { + value = 10 + multiply = { + value = prestige_level + subtract = 1 # Baseline is at 1, so we want the bonus to start at 2 + } + desc = PRESTIGE_LEVEL_CONCEPT + } + } + # Traits + if = { + limit = { has_trait = governor } + add = { + value = 5 + if = { + limit = { + has_trait_xp = { trait = governor value >= 25 } + } + add = 5 + } + if = { + limit = { + has_trait_xp = { trait = governor value >= 50 } + } + add = 5 + } + if = { + limit = { + has_trait_xp = { trait = governor value >= 75 } + } + add = 5 + } + desc = governor_trait_desc_short + } + } + if = { + limit = { has_trait = disinherited } + subtract = { + value = 200 + desc = trait_disinherited + } + } + if = { + limit = { has_trait = gallivanter } + subtract = { + value = 200 + desc = trait_gallivanter + } + } + if = { + limit = { has_trait = devoted } + subtract = { + value = 250 + desc = trait_devoted + } + } + else_if = { + limit = { is_clergy = yes } + subtract = { + value = 250 + desc = IS_CLERGY_TRIGGER + } + } + # CRIMINAL + if = { + limit = { + has_trait = deviant + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = deviant FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "deviant_and_criminal_desc" + } + } + if = { + limit = { + has_trait = incestuous + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = incestuous FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "incestuous_and_criminal_desc" + } + } + if = { + limit = { + has_trait = sodomite + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = sodomite FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "sodomite_and_criminal_desc" + } + } + if = { + limit = { + has_trait = cannibal + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = cannibal FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "cannibal_and_criminal_desc" + } + } + if = { + limit = { + has_trait = kinslayer_1 + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = kinslayer_1 FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "kinslayer_1_and_criminal_desc" + } + } + if = { + limit = { + has_trait = kinslayer_2 + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = kinslayer_2 FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "kinslayer_2_and_criminal_desc" + } + } + if = { + limit = { + has_trait = kinslayer_3 + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = kinslayer_3 FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "kinslayer_3_and_criminal_desc" + } + } + if = { + limit = { + has_trait = witch + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = witch FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "witch_and_criminal_desc" + } + } + if = { + limit = { + has_trait = adulterer + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = adulterer FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "adulterer_and_criminal_desc" + } + } + if = { + limit = { + has_trait = fornicator + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = fornicator FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "fornicator_and_criminal_desc" + } + } + # COUNCIL POSITIONS + if = { # Is the marshal of current holder + limit = { scope:title.holder.cp:councillor_marshal ?= root } + add = { + value = 20 + desc = marshal_governor_desc + } + } + # COURT POSITIONS + if = { # Has a court position with current holder + limit = { + scope:title.holder ?= { + any_court_position_holder ?= { this = root } + } + } + add = { + value = 5 + desc = court_position_succession_governor_desc + } + } + # FAITH HOSTILITY + if = { + limit = { + scope:title.holder.primary_title.state_faith ?= { + faith_hostility_level = { + target = root.faith + value = faith_astray_level + } + } + } #Change to faith acceptance + subtract = { + value = 10 + desc = astray_faith_succession_desc + } + } + if = { + limit = { + scope:title.holder.primary_title.state_faith ?= { + faith_hostility_level = { + target = root.faith + value = faith_hostile_level + } + } + } #Change to faith acceptance + subtract = { + value = 20 + desc = hostile_faith_succession_desc + } + } + if = { + limit = { + scope:title.holder.primary_title.state_faith ?= { + faith_hostility_level = { + target = root.faith + value >= faith_evil_level + } + } + } #Change to faith acceptance + subtract = { + value = 30 + desc = evil_faith_sucession_desc + } + } + # PERKS + if = { + limit = { has_perk = ducal_conquest_perk } + add = { + value = 30 + desc = ducal_conquest_perk_name_desc + } + } + # LOWBORN? EW no + if = { + limit = { is_lowborn = yes } + subtract = { + value = 25 + desc = lowborn_desc_succession + } + } + # RELATIONS + if = { # Is child of holder + limit = { + scope:title.holder ?= { is_parent_of = root } + } + add = { + value = 30 + desc = "parent_holder_desc" + } + } + else_if = { # Is family of holder + limit = { + scope:title.holder ?= { is_close_family_of = root } + } + add = { + value = 20 + desc = "close_family_holder_desc" + } + } + else_if = { # Is family of holder's spouse + limit = { + scope:title.holder ?= { + any_spouse = { is_close_family_of = root } + NOT = { is_close_family_of = root } + } + } + add = { + value = 10 + desc = "close_family_married_to_holder_desc" + } + } + if = { # Is a friend + limit = { + scope:title.holder ?= { has_relation_friend = root } + } + add = { + value = 15 + desc = governor_friend_desc + } + } + # REGENT OF EMPEROR + if = { + limit = { scope:title.holder.diarch ?= root } + add = { + value = scope:title.holder.diarchy_swing + desc = governor_diarch_desc + } + } + # PETITION + if = { + limit = { + exists = house.var:petition_liege_appointment_support + top_liege.primary_title.var:administrative_ui_special_title.holder ?= house.var:petition_liege_appointment_support + NOT = { scope:title = top_liege.primary_title } # Only governorships + } + multiply = { + value = 1.15 + desc = ceremonial_liege_appointment_support_desc + } + } + # Schemes + if = { + limit = { has_character_modifier = scheme_slandered_modifier } + add = { + value = slander_appointment_score_value + desc = scheme_slandered_modifier + } + } + if = { + limit = { has_character_modifier = scheme_promoted_modifier } + add = { + value = promote_appointment_score_value # Keep this balanced if more values are added! + desc = scheme_promoted_modifier + } + } + # Decisions + if = { + limit = { + has_character_modifier = ep3_integration_promoter_modifier + has_variable = integration_promoted_in + var:integration_promoted_in.duchy ?= scope:title + } + add = { + value = 30 + desc = ep3_integration_promoter_modifier + } + } + # PETITION + if = { + limit = { scope:title.var:petition_house_rights ?= house } + add = { + value = 250 + desc = petition_liege_house_province_rights_value_desc + } + } + # CLIMBING TOO EARLY - AT END + if = { + limit = { + trigger_if = { + limit = { is_governor = yes } + scope:title.tier > main_administrative_tier + trigger_if = { + limit = { scope:title.tier = tier_county } + always = no + } + trigger_if = { + limit = { scope:title.tier = tier_duchy } + highest_held_title_tier <= tier_barony + } + trigger_else_if = { + limit = { scope:title.tier = tier_kingdom } + highest_held_title_tier <= tier_county + } + trigger_else_if = { + limit = { scope:title.tier = tier_empire } + highest_held_title_tier <= tier_duchy + } + trigger_else = { + limit = { scope:title.tier = tier_hegemony } + highest_held_title_tier <= tier_kingdom + } + } + trigger_else = { scope:title.tier > scope:title.holder.main_administrative_tier } + } + multiply = { + value = 0.5 + desc = should_hold_a_lower_tier_governorship_first + } + } + #ADJUST BASED ON GENDER LAW - MUST GO BEFORE EXCLUSIONS + if = { + limit = { + scope:title.holder ?= { has_realm_law = male_preference_law } + is_female = yes + } + multiply = { + value = 0.25 + desc = male_preference_law + } + } + else_if = { + limit = { + scope:title.holder ?= { has_realm_law = male_only_law } + is_female = yes + } + multiply = { + value = 0 + desc = male_only_law + } + } + else_if = { + limit = { + scope:title.holder ?= { has_realm_law = female_preference_law } + is_female = no + } + multiply = { + value = 0.25 + desc = female_preference_law + } + } + else_if = { + limit = { + scope:title.holder ?= { has_realm_law = female_only_law } + is_female = no + } + multiply = { + value = 0 + desc = female_only_law + } + } + ### TOTAL EXCLUSIONS - MUST GO AT END + # Already a governor + if = { + limit = { + is_governor = yes + scope:title.tier = highest_held_title_tier + } + multiply = { + value = 0 + desc = already_a_governor_tt + } + } + # Ceremonial Liege + if = { + limit = { + tgp_is_ceremonial_liege_trigger = yes + NOT = { scope:title = top_liege.primary_title } + } + multiply = { + value = 0 + desc = ceremonial_liege_desc + } + } + # Top liege (emperor/kampaku) + if = { + limit = { is_independent_ruler = yes } + multiply = { + value = 0 + desc = appointment_is_top_liege + } + } + } + } +} diff --git a/N3OW/common/succession_appointment/japanese_admin_regent.txt b/N3OW/common/succession_appointment/japanese_admin_regent.txt new file mode 100644 index 00000000..709d9768 --- /dev/null +++ b/N3OW/common/succession_appointment/japanese_admin_regent.txt @@ -0,0 +1,584 @@ +japanese_regent = { + default_candidates = { holder_close_family landed_vassal unlanded_noble_house_head } + + candidate_score = { + value = { + # Base - Based on skills + add = { + value = martial + add = diplomacy + add = stewardship + add = intrigue + add = learning + multiply = 1 + desc = sum_of_skills_desc + } + # TRAITS + if = { + limit = { has_trait = governor } + add = { + value = 5 + if = { + limit = { + has_trait_xp = { trait = governor value >= 25 } + } + add = 5 + } + if = { + limit = { + has_trait_xp = { trait = governor value >= 50 } + } + add = 5 + } + if = { + limit = { + has_trait_xp = { trait = governor value >= 75 } + } + add = 5 + } + desc = governor_trait_desc_short + } + } + if = { + limit = { + OR = { + has_trait = blind + has_trait = incapable + has_trait = infirm + } + } + subtract = { + value = 50 + desc = negative_trait_succession + } + } + if = { + limit = { has_trait = disinherited } + subtract = { + value = 200 + desc = trait_disinherited + } + } + if = { + limit = { has_trait = gallivanter } + subtract = { + value = 200 + desc = trait_gallivanter + } + } + if = { + limit = { has_trait = devoted } + subtract = { + value = 250 + desc = trait_devoted + } + } + else_if = { + limit = { is_clergy = yes } + subtract = { + value = 250 + desc = IS_CLERGY_TRIGGER + } + } + # CRIMINAL + if = { + limit = { + has_trait = deviant + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = deviant FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "deviant_and_criminal_desc" + } + } + if = { + limit = { + has_trait = incestuous + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = incestuous FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "incestuous_and_criminal_desc" + } + } + if = { + limit = { + has_trait = sodomite + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = sodomite FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "sodomite_and_criminal_desc" + } + } + if = { + limit = { + has_trait = cannibal + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = cannibal FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "cannibal_and_criminal_desc" + } + } + if = { + limit = { + has_trait = kinslayer_1 + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = kinslayer_1 FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "kinslayer_1_and_criminal_desc" + } + } + if = { + limit = { + has_trait = kinslayer_2 + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = kinslayer_2 FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "kinslayer_2_and_criminal_desc" + } + } + if = { + limit = { + has_trait = kinslayer_3 + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = kinslayer_3 FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "kinslayer_3_and_criminal_desc" + } + } + if = { + limit = { + has_trait = witch + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = witch FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "witch_and_criminal_desc" + } + } + if = { + limit = { + has_trait = adulterer + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = adulterer FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "adulterer_and_criminal_desc" + } + } + if = { + limit = { + has_trait = fornicator + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = fornicator FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "fornicator_and_criminal_desc" + } + } + # COUNCIL POSITIONS + if = { + limit = { + scope:title.holder ?= { + any_councillor ?= { this = root } + } + } + add = { + value = 20 + multiply = scope:title.holder.governor_efficiency + desc = councillor_position_governor_desc + } + } + # COURT POSITIONS + if = { + limit = { + scope:title.holder ?= { + any_court_position_holder ?= { + this = root + } + } + } + add = { + value = 5 + multiply = scope:title.holder.governor_efficiency + desc = court_position_succession_governor_desc + } + } + # FAITH HOSTILITY + if = { + limit = { + scope:title.holder.primary_title.state_faith ?= { + faith_hostility_level = { + target = root.faith + value = faith_astray_level + } + } + } #Change to faith acceptance + subtract = { + value = 10 + desc = astray_faith_succession_desc + } + } + if = { + limit = { + scope:title.holder.primary_title.state_faith ?= { + faith_hostility_level = { + target = root.faith + value = faith_hostile_level + } + } + } #Change to faith acceptance + subtract = { + value = 25 + desc = hostile_faith_succession_desc + } + } + if = { + limit = { + scope:title.holder.primary_title.state_faith ?= { + faith_hostility_level = { + target = root.faith + value >= faith_evil_level + } + } + } #Change to faith acceptance + subtract = { + value = 50 + desc = evil_faith_sucession_desc + } + } + # LOWBORN? EW no + if = { + limit = { is_lowborn = yes } + subtract = { + value = 25 + desc = lowborn_desc_succession + } + } + # INFLUENCE LEVEL + if = { + limit = { influence_level = 0 } + subtract = { + value = 10 + desc = "[influence_level|E]" + } + } + if = { + limit = { influence_level >= 2 } + add = { + value = 10 + multiply = { + value = influence_level + subtract = 1 # Base value should start at 2 + } + desc = "[influence_level|E]" + } + } + # SAME CULTURE AS REGION + if = { + limit = { + tgp_is_in_ceremonial_house_trigger = no + NOR = { + culture = scope:title.holder.capital_county.culture + top_liege.primary_title.var:administrative_ui_special_title.holder.culture = culture + } + } + add = { + value = -50 + desc = not_of_local_culture_succession_desc + } + } + # PERSONAL REASONS + if = { + limit = { + scope:title.holder ?= { is_parent_of = root } + } + add = { + value = 30 + multiply = scope:title.holder.governor_efficiency + desc = "parent_holder_desc" + } + } + else_if = { + limit = { + scope:title.holder ?= { is_sibling_of = root } + } + add = { + value = 20 + multiply = scope:title.holder.governor_efficiency + desc = "sibling_holder_desc" + } + } + else_if = { + limit = { + scope:title.holder ?= { is_grandparent_of = root } + } + add = { + value = 15 + multiply = scope:title.holder.governor_efficiency + desc = "grandparent_holder_desc" + } + } + else_if = { + limit = { + scope:title.holder ?= { is_close_family_of = root } + } + add = { + value = 10 + multiply = scope:title.holder.governor_efficiency + desc = "close_family_holder_desc" + } + } + else_if = { + limit = { + scope:title.holder ?= { + any_spouse = { is_close_family_of = root } + NOT = { is_close_family_of = root } + } + } + add = { + value = 10 + desc = "close_family_married_to_holder_desc" + } + } + else_if = { + limit = { + scope:title.holder ?= { is_extended_family_of = root } + } + add = { + value = 5 + multiply = scope:title.holder.governor_efficiency + desc = "extended_family_holder_desc" + } + } + #FRIENDS OF THE HOLDER + if = { + limit = { + scope:title.holder ?= { has_relation_friend = root } + } + add = { + value = 5 + multiply = scope:title.holder.governor_efficiency + desc = governor_friend_desc + } + } + if = { + limit = { + scope:title.holder ?= { has_relation_best_friend = root } + } + add = { + value = 15 + multiply = scope:title.holder.governor_efficiency + desc = governor_best_friend_desc + } + } + # DIARCH + if = { + limit = { scope:title.holder.diarch ?= root } + add = { + value = scope:title.holder.diarchy_swing + desc = governor_diarch_desc + } + } + # SCHEMES + if = { + limit = { has_character_modifier = scheme_slandered_modifier } + add = { + value = slander_appointment_score_value + desc = scheme_slandered_modifier + } + } + if = { + limit = { has_character_modifier = scheme_promoted_modifier } + add = { + value = promote_appointment_score_value # Keep this balanced if more values are added! + desc = scheme_promoted_modifier + } + } + ### JAPAN + # Dynasty Renown + if = { + limit = { + dynasty ?= { dynasty_prestige_level >= 1 } + } + add = { + value = { + value = dynasty.dynasty_prestige_level + multiply = { + value = 5 + if = { + limit = { + dynasty.dynast.house = root.house + } + add = 5 + } + } + } + desc = japanese_kampaku_dynasty_splendor_desc + } + } + # BONUSES FOR NON-IMPERIAL FAMILY + if = { + limit = { + tgp_realm_has_ceremonial_liege_trigger = yes + tgp_is_in_ceremonial_house_trigger = no + } + # Emperor's opinion + add = { + value = "top_liege.primary_title.var:administrative_ui_special_title.holder.opinion(root)" + desc = ceremonial_liege_opinion_desc + } + } + # BONUSES FOR NON-IMPERIAL FAMILY + if = { + limit = { + exists = top_liege.primary_title.var:administrative_ui_special_title.holder.house + house != top_liege.primary_title.var:administrative_ui_special_title.holder.house + } + # PAST KAMPAKU OF YOUR DYNASTY + add = { + value = japanese_kampaku_house_past_kampaku_value_actual + desc = japanese_kampaku_house_past_kampaku_desc + } + # Number of House children with Imperial dynasty parents (e.g. Fujiwara born to a Yamato mother) + add = { + value = japanese_kampaku_house_imperial_parent_value_actual + desc = japanese_kampaku_house_imperial_parent_desc + } + # Number of Imperial dynasty members with House parents (e.g. Yamato born to a Fujiwara mother) + add = { + value = japanese_kampaku_house_imperial_child_score_value + desc = japanese_kampaku_house_imperial_child_desc + } + # Number of Imperial spouse House members (e.g. Emperor married to a Fujiwara) + add = { + value = japanese_kampaku_imperial_spouse_score_value + desc = japanese_kampaku_imperial_spouse_desc + } + # Number of Imperial dynasty members married to House members (e.g. Yamato married to a Fujiwara) + add = { + value = japanese_kampaku_house_imperial_spouse_score_value + desc = japanese_kampaku_house_imperial_spouse_desc + } + } + # Number of Governorships held by House + add = { + value = japanese_kampaku_house_governorship_score_value + desc = japanese_kampaku_house_governorship_desc + } + # Number of Devoted House members (monks/nuns) + add = { + value = japanese_kampaku_house_devoted_score_value + desc = japanese_kampaku_house_devoted_desc + } + # Age + if = { + limit = { age < 50 } + add = { + value = 50 + subtract = age + multiply = -2 + desc = japanese_kampaku_age_desc + } + } + else = { + add = { + value = age + subtract = 50 + multiply = 2 + desc = japanese_kampaku_age_desc + } + } + # Domicile is in the capital + if = { + limit = { + house ?= { + any_house_member = { + any_held_title = { is_noble_family_title = yes } + domicile ?= { + is_domicile_type = japanese_manor + domicile_location.county ?= title:e_japan.holder.capital_county + } + } + } + } + add = 25 + } + # Block non-admin + if = { + limit = { + NOT = { government_allows = administrative } + } + add = -2500 + } + # Petition + if = { + limit = { + exists = var:petition_liege_regent_support + top_liege.primary_title.var:administrative_ui_special_title.holder ?= var:petition_liege_regent_support + scope:title = top_liege.primary_title # Only top liege title + } + multiply = { + value = 1.1 + desc = petition_liege_regent_support_desc + } + } + #ADJUST BASED ON GENDER LAW - MUST GO AT THE END + if = { + limit = { + scope:title.holder ?= { has_realm_law = male_preference_law } + is_female = yes + } + multiply = { + value = 0.33 + desc = male_preference_law + } + } + else_if = { + limit = { + scope:title.holder ?= { has_realm_law = male_only_law } + is_female = yes + } + multiply = { + value = 0 + desc = male_only_law + } + } + else_if = { + limit = { + scope:title.holder ?= { has_realm_law = female_preference_law } + is_female = no + } + multiply = { + value = 0.33 + desc = female_preference_law + } + } + else_if = { + limit = { + scope:title.holder ?= { has_realm_law = female_only_law } + is_female = no + } + multiply = { + value = 0 + desc = female_only_law + } + } + } + } +} diff --git a/N3OW/common/succession_appointment/meritocratic_governor.txt b/N3OW/common/succession_appointment/meritocratic_governor.txt new file mode 100644 index 00000000..34cc6058 --- /dev/null +++ b/N3OW/common/succession_appointment/meritocratic_governor.txt @@ -0,0 +1,1166 @@ +meritocratic_civic_governor = { + allow_same_tier_candidates = yes + + level = merit + + candidate_score = { + value = { + + # Same dynasty as holder bonus + if = { + limit = { + root.house ?= scope:title.holder.house + } + add = { + value = 50 + desc = closely_related + } + } + + if = { + limit = { + root.dynasty.dynast ?= { + has_domicile = yes + } + scope:title = { + is_de_jure_liege_or_above_target = root.dynasty.dynast.domicile.domicile_location.county + } + } + add = { + value = 25 + desc = ancestral_home + } + } + + # Influenced career score + if = { + limit = { + exists = var:merit_civilian_career_score_bonus + } + add = { + value = var:merit_civilian_career_score_bonus + desc = merit_career_score_bonus_desc + } + } + + # Age - With age comes experience. We provide a rather small bonus for the elderly, to exist as a potential tie-breaker. + add = { + value = age + divide = 2 + round = yes + desc = appointment_investment_cap_age # Reused loc + } + if = { + limit = { + tgp_is_above_retirement_age_trigger = { REALM_OWNER = root } + } + add = { + value = retirement_age_current_value + subtract = age + multiply = 3 + desc = is_above_retirement_age_desc + } + } + + # Influence + if = { + limit = { + influence_level != 1 + } + add = { + value = 10 + multiply = { + value = influence_level + subtract = 1 # Baseline is at 1, so we want the bonus to start at 2 + } + desc = "[influence_level|E]" + } + } + + # Traits + if = { + limit = { has_trait = disinherited } + subtract = { + value = 200 + desc = trait_disinherited + } + } + if = { + limit = { has_trait = gallivanter } + subtract = { + value = 200 + desc = trait_gallivanter + } + } + # CRIMINAL + if = { + limit = { + has_trait = deviant + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = deviant FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -50 + desc = "deviant_and_criminal_desc" + } + } + if = { + limit = { + has_trait = incestuous + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = incestuous FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -50 + desc = "incestuous_and_criminal_desc" + } + } + if = { + limit = { + has_trait = sodomite + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = sodomite FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -50 + desc = "sodomite_and_criminal_desc" + } + } + if = { + limit = { + has_trait = cannibal + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = cannibal FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -50 + desc = "cannibal_and_criminal_desc" + } + } + if = { + limit = { + has_trait = kinslayer_1 + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = kinslayer_1 FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -50 + desc = "kinslayer_1_and_criminal_desc" + } + } + if = { + limit = { + has_trait = kinslayer_2 + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = kinslayer_2 FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -50 + desc = "kinslayer_2_and_criminal_desc" + } + } + if = { + limit = { + has_trait = kinslayer_3 + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = kinslayer_3 FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -50 + desc = "kinslayer_3_and_criminal_desc" + } + } + if = { + limit = { + has_trait = witch + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = witch FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -50 + desc = "witch_and_criminal_desc" + } + } + if = { + limit = { + has_trait = adulterer + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = adulterer FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -50 + desc = "adulterer_and_criminal_desc" + } + } + if = { + limit = { + has_trait = fornicator + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = fornicator FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -50 + desc = "fornicator_and_criminal_desc" + } + } + if = { + limit = { + OR = { + has_trait = lunatic + has_trait = possessed + has_trait = incapable + has_trait = intellect_bad_3 + } + } + add = { + value = -100 + desc = "unsound_mind_desc" + } + } + + # COUNCIL POSITIONS + if = { # Is a councillor of current holder + limit = { + scope:title.holder ?= { + any_councillor ?= { this = root } + } + } + add = { + value = 20 + desc = councillor_position_governor_desc + } + } + # COURT POSITIONS + if = { # Has a court position with current holder + limit = { + scope:title.holder ?= { + any_court_position_holder ?= { + this = root + } + } + } + add = { + value = 5 + desc = court_position_succession_governor_desc + } + } + + # FAITH HOSTILITY + if = { + limit = { + scope:title.holder.primary_title.state_faith ?= { + faith_hostility_level = { + target = root.faith + value = faith_astray_level + } + } + } #Change to faith acceptance + subtract = { + value = 10 + desc = astray_faith_succession_desc + } + } + if = { + limit = { + scope:title.holder.primary_title.state_faith ?= { + faith_hostility_level = { + target = root.faith + value = faith_hostile_level + } + } + } #Change to faith acceptance + subtract = { + value = 20 + desc = hostile_faith_succession_desc + } + } + if = { + limit = { + scope:title.holder.primary_title.state_faith ?= { + faith_hostility_level = { + target = root.faith + value >= faith_evil_level + } + } + } #Change to faith acceptance + subtract = { + value = 30 + desc = evil_faith_sucession_desc + } + } + + # CLAIMS + if = { + limit = { has_strong_claim_on = scope:title } + add = { + value = 20 + desc = title_claim_desc + } + } + else_if = { + limit = { has_weak_claim_on = scope:title } + add = { + value = 10 + desc = title_weak_claim_desc + } + } + + # POPULAR OPINION + if = { + limit = { is_landed = yes } + add = { + value = { + value = capital_county.county_holder_opinion + multiply = 0.25 + } + desc = county_holder_opinion_desc + } + } + + # PERKS + if = { + limit = { + NOT = { + government_has_flag = government_is_meritocratic + } + has_perk = ducal_conquest_perk + } + add = { + value = 30 + desc = ducal_conquest_perk_name_desc + } + } + + # Dynasty Legacy + if = { + limit = { + dynasty ?= { + has_dynasty_perk = tgp_chinese_legacy_4 + } + } + add = { + value = legacy_candidate_score_bonus + desc = "[GetDynastyPerk('tgp_chinese_legacy_4').GetName]" + } + } + + # LOWBORN? EW no + if = { + limit = { + is_lowborn = yes + } + subtract = { + value = 25 + desc = lowborn_desc_succession + } + } + + # RELATIONS + if = { # Is a friend + limit = { + scope:title.holder ?= { has_relation_friend = root } + } + add = { + value = 15 + desc = governor_friend_desc + } + } + if = { # Is a elder + limit = { + scope:title.holder ?= { has_relation_elder = root } + } + add = { + value = 15 + desc = governor_elder_desc + } + } + if = { # Is a disciple + limit = { + scope:title.holder ?= { has_relation_disciple = root } + } + add = { + value = 10 + desc = governor_disciple_desc + } + } + + # REGENT OF EMPEROR + if = { + limit = { scope:title.holder.diarch ?= root } + add = { + value = scope:title.holder.diarchy_swing + desc = governor_diarch_desc + } + } + + # Schemes + if = { + limit = { has_character_modifier = scheme_slandered_modifier } + add = { + value = slander_appointment_score_value + desc = scheme_slandered_modifier + } + } + if = { + limit = { has_character_modifier = scheme_promoted_modifier } + add = { + value = promote_appointment_score_value # Keep this balanced if more values are added! + desc = scheme_promoted_modifier + } + } + + # Decisions + if = { + limit = { + has_character_modifier = ep3_integration_promoter_modifier + has_variable = integration_promoted_in + var:integration_promoted_in.duchy ?= scope:title + } + add = { + value = 30 + desc = ep3_integration_promoter_modifier + } + } + + # PETITION + if = { + limit = { scope:title.var:petition_house_rights ?= house } + add = { + value = 250 + desc = petition_liege_house_province_rights_value_desc + } + } + + # MOVEMENTS + if = { + limit = { + situation:dynastic_cycle ?= { + situation_participant_group:expansion_movement = { + participant_group_has_character = root + is_movement_in_power = { MOVEMENT = expansion_movement } + } + } + } + add = { + value = 20 + desc = expansion_movement_is_favored_appointment_desc + } + } + if = { + limit = { + situation:dynastic_cycle ?= { + situation_participant_group:advancement_movement = { + participant_group_has_character = root + is_movement_in_power = { MOVEMENT = advancement_movement } + } + } + } + add = { + value = 20 + desc = advancement_movement_is_favored_appointment_desc + } + } + if = { + limit = { + situation:dynastic_cycle ?= { + situation_participant_group:pro_hegemon_movement = { + participant_group_has_character = root + #they don't have to be in power + } + } + } + add = { + value = 20 + desc = pro_hegemon_movement_appointment_desc + } + } + if = { + limit = { + situation:dynastic_cycle ?= { + situation_participant_group:conservative_movement = { + participant_group_has_character = root + NOT = { is_movement_in_power = { MOVEMENT = conservative_movement } } + #they have to be in power to remove the malus + } + } + } + add = { + value = -20 + desc = conservative_movement_appointment_value + } + } + # PETITION + if = { + limit = { + exists = house.var:petition_liege_appointment_support + top_liege.primary_title.var:administrative_ui_special_title.holder ?= house.var:petition_liege_appointment_support + NOT = { scope:title = top_liege.primary_title } # Only governorships + } + multiply = { + value = 1.15 + desc = ceremonial_liege_appointment_support_desc + } + } + + ### EXPANDED POWER BASE + save_temporary_value_as = temp_total + if = { + limit = { has_character_modifier = ep3_expanded_power_base_minor_modifier } + add = { + value = scope:temp_total + multiply = 0.10 + round = yes + min = 25 + desc = ep3_expanded_power_base_minor_modifier + } + } + if = { + limit = { has_character_modifier = ep3_expanded_power_base_medium_modifier } + add = { + value = scope:temp_total + multiply = 0.20 + round = yes + min = 50 + desc = ep3_expanded_power_base_medium_modifier + } + } + if = { + limit = { has_character_modifier = ep3_expanded_power_base_major_modifier } + add = { + value = scope:temp_total + multiply = 0.30 + round = yes + min = 75 + desc = ep3_expanded_power_base_major_modifier + } + } + + # ADJUST BASED ON GENDER LAW - MUST GO AT THE END + if = { + limit = { + scope:title.holder.top_liege ?= { has_realm_law = male_preference_law } + is_female = yes + } + multiply = { + value = { + value = 1 + subtract = appointment_non_preferred_gender_penalty_value + } + desc = appointment_male_preference_desc + } + } + else_if = { + limit = { + scope:title.holder.top_liege ?= { has_realm_law = male_only_law } + is_female = yes + } + multiply = { + value = { + value = 1 + subtract = appointment_opposite_gender_penalty_value + } + desc = appointment_male_only_desc + } + } + else_if = { + limit = { + scope:title.holder.top_liege ?= { has_realm_law = female_preference_law } + is_female = no + } + multiply = { + value = { + value = 1 + subtract = appointment_non_preferred_gender_penalty_value + } + desc = appointment_female_preference_desc + } + } + else_if = { + limit = { + scope:title.holder.top_liege ?= { has_realm_law = female_only_law } + is_female = no + } + multiply = { + value = { + value = 1 + subtract = appointment_opposite_gender_penalty_value + } + desc = appointment_female_only_desc + } + } + + # We remove all score from the emperor, to make sure you don't inherit governorships needlessly + if = { + limit = { + is_independent_ruler = yes + } + multiply = { + value = 0 + desc = appointment_is_top_liege + } + } + } + } +} + +meritocratic_military_governor = { + allow_same_tier_candidates = yes + + level = merit + + candidate_score = { + value = { + + # Martial skill - We use this as the base for the overall score + add = { + value = martial + multiply = 2 + desc = "[martial_skill|E]" + } + + # Learning skill - We use this as additional base for the overall score if you have the correct cultural parameter + if = { + limit = { + culture = { + has_cultural_parameter = military_governor_appointment_score + } + } + add = { + value = learning + multiply = 0.5 + desc = "[learning_skill|E]" + } + } + + # Martial education provides additional score + if = { + limit = { + has_trait = education_martial + } + if = { + limit = { + has_trait = education_martial_5 + } + add = { + value = 100 + desc = has_trait_education_martial_5 + } + } + else_if = { + limit = { + has_trait = education_martial_4 + } + add = { + value = 80 + desc = has_trait_education_martial_4 + } + } + else_if = { + limit = { + has_trait = education_martial_3 + } + add = { + value = 60 + desc = has_trait_education_martial_3 + } + } + else_if = { + limit = { + has_trait = education_martial_2 + } + add = { + value = 40 + desc = has_trait_education_martial_2 + } + } + else_if = { + limit = { + has_trait = education_martial_1 + } + add = { + value = 20 + desc = has_trait_education_martial_1 + } + } + } + + # Commander traits + add = { + value = number_of_commander_traits + multiply = 20 + desc = number_of_commander_traits_desc + } + + # Prowess + add = { + value = prowess + desc = prowess_concept + } + + # Influenced career + if = { + limit = { + exists = var:merit_military_career_score_bonus + } + add = { + value = var:merit_military_career_score_bonus + desc = merit_career_score_bonus_desc + } + } + + # Warfare Legacy + add = { + value = 10 + multiply = dynasty.warfare_legacy_track_perks + desc = has_warfare_legacy_track_desc + } + + # Influence + if = { + limit = { + influence_level != 1 + } + add = { + value = 10 + multiply = { + value = influence_level + subtract = 1 # Baseline is at 1, so we want the bonus to start at 2 + } + desc = "[influence_level|E]" + } + } + + # Same dynasty as holder bonus + if = { + limit = { + root.house ?= scope:title.holder.house + } + add = { + value = 50 + desc = closely_related + } + } + + if = { + limit = { + root.dynasty.dynast ?= { + has_domicile = yes + } + scope:title = { + is_de_jure_liege_or_above_target = root.dynasty.dynast.domicile.domicile_location.county + } + } + add = { + value = 25 + desc = ancestral_home + } + } + + # Traits + if = { + limit = { has_trait = disinherited } + subtract = { + value = 200 + desc = trait_disinherited + } + } + if = { + limit = { has_trait = gallivanter } + subtract = { + value = 200 + desc = trait_gallivanter + } + } + # CRIMINAL + if = { + limit = { + has_trait = deviant + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = deviant FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "deviant_and_criminal_desc" + } + } + if = { + limit = { + has_trait = incestuous + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = incestuous FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "incestuous_and_criminal_desc" + } + } + if = { + limit = { + has_trait = sodomite + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = sodomite FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "sodomite_and_criminal_desc" + } + } + if = { + limit = { + has_trait = cannibal + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = cannibal FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "cannibal_and_criminal_desc" + } + } + if = { + limit = { + has_trait = kinslayer_1 + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = kinslayer_1 FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "kinslayer_1_and_criminal_desc" + } + } + if = { + limit = { + has_trait = kinslayer_2 + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = kinslayer_2 FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "kinslayer_2_and_criminal_desc" + } + } + if = { + limit = { + has_trait = kinslayer_3 + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = kinslayer_3 FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "kinslayer_3_and_criminal_desc" + } + } + if = { + limit = { + has_trait = witch + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = witch FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "witch_and_criminal_desc" + } + } + if = { + limit = { + has_trait = adulterer + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = adulterer FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "adulterer_and_criminal_desc" + } + } + if = { + limit = { + has_trait = fornicator + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = fornicator FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "fornicator_and_criminal_desc" + } + } + + # COUNCIL POSITIONS + if = { # Is the marshal of current holder + limit = { + scope:title.holder ?= { + cp:councillor_marshal ?= { this = root } + } + } + add = { + value = 20 + desc = marshal_governor_desc + } + } + # COURT POSITIONS + if = { # Has a court position with current holder + limit = { + scope:title.holder ?= { + any_court_position_holder ?= { + this = root + } + } + } + add = { + value = 5 + desc = court_position_succession_governor_desc + } + } + + # FAITH HOSTILITY + if = { + limit = { + scope:title.holder.primary_title.state_faith ?= { + faith_hostility_level = { + target = root.faith + value = faith_astray_level + } + } + } #Change to faith acceptance + subtract = { + value = 10 + desc = astray_faith_succession_desc + } + } + if = { + limit = { + scope:title.holder.primary_title.state_faith ?= { + faith_hostility_level = { + target = root.faith + value = faith_hostile_level + } + } + } #Change to faith acceptance + subtract = { + value = 20 + desc = hostile_faith_succession_desc + } + } + if = { + limit = { + scope:title.holder.primary_title.state_faith ?= { + faith_hostility_level = { + target = root.faith + value >= faith_evil_level + } + } + } #Change to faith acceptance + subtract = { + value = 30 + desc = evil_faith_sucession_desc + } + } + + # PERKS + if = { + limit = { has_perk = ducal_conquest_perk } + add = { + value = 30 + desc = ducal_conquest_perk_name_desc + } + } + + # Dynasty Legacy + if = { + limit = { + dynasty ?= { + has_dynasty_perk = tgp_chinese_legacy_4 + } + } + add = { + value = legacy_candidate_score_bonus + desc = "[GetDynastyPerk('tgp_chinese_legacy_4').GetName]" + } + } + + # LOWBORN? EW no + if = { + limit = { + is_lowborn = yes + } + subtract = { + value = 25 + desc = lowborn_desc_succession + } + } + + # RELATIONS + if = { # Is child of holder + limit = { + scope:title.holder ?= { is_parent_of = root } + } + add = { + value = 30 + desc = "parent_holder_desc" + } + } + else_if = { # Is family of holder + limit = { + scope:title.holder ?= { is_close_family_of = root } + } + add = { + value = 20 + desc = "close_family_holder_desc" + } + } + else_if = { # Is family of holder's spouse + limit = { + scope:title.holder ?= { + any_spouse = { is_close_family_of = root } + NOT = { is_close_family_of = root } + } + } + add = { + value = 10 + desc = "close_family_married_to_holder_desc" + } + } + if = { # Is a friend + limit = { + scope:title.holder ?= { has_relation_friend = root } + } + add = { + value = 15 + desc = governor_friend_desc + } + } + if = { # Is a elder + limit = { + scope:title.holder ?= { has_relation_elder = root } + } + add = { + value = 15 + desc = governor_elder_desc + } + } + if = { # Is a disciple + limit = { + scope:title.holder ?= { has_relation_disciple = root } + } + add = { + value = 10 + desc = governor_disciple_desc + } + } + + # REGENT OF EMPEROR + if = { + limit = { scope:title.holder.diarch ?= root } + add = { + value = scope:title.holder.diarchy_swing + desc = governor_diarch_desc + } + } + # PETITION + if = { + limit = { + exists = house.var:petition_liege_appointment_support + top_liege.primary_title.var:administrative_ui_special_title.holder ?= house.var:petition_liege_appointment_support + NOT = { scope:title = top_liege.primary_title } # Only governorships + } + multiply = { + value = 1.15 + desc = ceremonial_liege_appointment_support_desc + } + } + + # Schemes + if = { + limit = { has_character_modifier = scheme_slandered_modifier } + add = { + value = slander_appointment_score_value + desc = scheme_slandered_modifier + } + } + if = { + limit = { has_character_modifier = scheme_promoted_modifier } + add = { + value = promote_appointment_score_value # Keep this balanced if more values are added! + desc = scheme_promoted_modifier + } + } + + # Decisions + if = { + limit = { + has_character_modifier = ep3_integration_promoter_modifier + has_variable = integration_promoted_in + var:integration_promoted_in.duchy ?= scope:title + } + add = { + value = 30 + desc = ep3_integration_promoter_modifier + } + } + + # PETITION + if = { + limit = { scope:title.var:petition_house_rights ?= house } + add = { + value = 250 + desc = petition_liege_house_province_rights_value_desc + } + } + + # Must be eligible as a commander + if = { + limit = { + NOT = { + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = top_liege } + } + } + add = { + value = -1000 + desc = cannot_be_commander + } + } + + ### EXPANDED POWER BASE + save_temporary_value_as = temp_total + if = { + limit = { has_character_modifier = ep3_expanded_power_base_minor_modifier } + add = { + value = scope:temp_total + multiply = 0.10 + round = yes + min = 25 + desc = ep3_expanded_power_base_minor_modifier + } + } + if = { + limit = { has_character_modifier = ep3_expanded_power_base_medium_modifier } + add = { + value = scope:temp_total + multiply = 0.20 + round = yes + min = 50 + desc = ep3_expanded_power_base_medium_modifier + } + } + if = { + limit = { has_character_modifier = ep3_expanded_power_base_major_modifier } + add = { + value = scope:temp_total + multiply = 0.30 + round = yes + min = 75 + desc = ep3_expanded_power_base_major_modifier + } + } + + # We remove all score from the emperor, to make sure you don't inherit governorships needlessly + if = { + limit = { + is_independent_ruler = yes + } + multiply = { + value = 0 + desc = appointment_is_top_liege + } + } + } + } +} diff --git a/N3OW/common/succession_appointment/meritocratic_regent.txt b/N3OW/common/succession_appointment/meritocratic_regent.txt new file mode 100644 index 00000000..54b4d454 --- /dev/null +++ b/N3OW/common/succession_appointment/meritocratic_regent.txt @@ -0,0 +1,597 @@ +meritocratic_regent = { + default_candidates = { holder_close_family landed_vassal unlanded_noble_house_head } + allow_same_tier_candidates = yes + + candidate_score = { + value = { + # Base - Based on skills + add = { + value = martial + add = diplomacy + add = stewardship + add = intrigue + add = learning + multiply = 1 + desc = sum_of_skills_desc + } + # TRAITS + if = { + limit = { has_trait = governor } + add = { + value = 5 + if = { + limit = { + has_trait_xp = { trait = governor value >= 25 } + } + add = 5 + } + if = { + limit = { + has_trait_xp = { trait = governor value >= 50 } + } + add = 5 + } + if = { + limit = { + has_trait_xp = { trait = governor value >= 75 } + } + add = 5 + } + desc = governor_trait_desc_short + } + } + if = { + limit = { + OR = { + has_trait = blind + has_trait = incapable + has_trait = infirm + } + } + subtract = { + value = 50 + desc = negative_trait_succession + } + } + if = { + limit = { has_trait = disinherited } + subtract = { + value = 200 + desc = trait_disinherited + } + } + if = { + limit = { has_trait = gallivanter } + subtract = { + value = 200 + desc = trait_gallivanter + } + } + if = { + limit = { has_trait = devoted } + subtract = { + value = 250 + desc = trait_devoted + } + } + else_if = { + limit = { is_clergy = yes } + subtract = { + value = 250 + desc = IS_CLERGY_TRIGGER + } + } + # CRIMINAL + if = { + limit = { + has_trait = deviant + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = deviant FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "deviant_and_criminal_desc" + } + } + if = { + limit = { + has_trait = incestuous + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = incestuous FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "incestuous_and_criminal_desc" + } + } + if = { + limit = { + has_trait = sodomite + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = sodomite FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "sodomite_and_criminal_desc" + } + } + if = { + limit = { + has_trait = cannibal + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = cannibal FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "cannibal_and_criminal_desc" + } + } + if = { + limit = { + has_trait = kinslayer_1 + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = kinslayer_1 FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "kinslayer_1_and_criminal_desc" + } + } + if = { + limit = { + has_trait = kinslayer_2 + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = kinslayer_2 FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "kinslayer_2_and_criminal_desc" + } + } + if = { + limit = { + has_trait = kinslayer_3 + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = kinslayer_3 FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "kinslayer_3_and_criminal_desc" + } + } + if = { + limit = { + has_trait = witch + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = witch FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "witch_and_criminal_desc" + } + } + if = { + limit = { + has_trait = adulterer + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = adulterer FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "adulterer_and_criminal_desc" + } + } + if = { + limit = { + has_trait = fornicator + exists = top_liege.primary_title.state_faith + trait_is_criminal_in_faith_trigger = { TRAIT = fornicator FAITH = top_liege.primary_title.state_faith GENDER_CHARACTER = root } + } + add = { + value = -30 + desc = "fornicator_and_criminal_desc" + } + } + # COUNCIL POSITIONS + if = { + limit = { + scope:title.holder ?= { + any_councillor ?= { this = root } + } + } + add = { + value = 20 + multiply = scope:title.holder.governor_efficiency + desc = councillor_position_governor_desc + } + } + # COURT POSITIONS + if = { + limit = { + scope:title.holder ?= { + any_court_position_holder ?= { + this = root + } + } + } + add = { + value = 5 + multiply = scope:title.holder.governor_efficiency + desc = court_position_succession_governor_desc + } + } + # FAITH HOSTILITY + if = { + limit = { + scope:title.holder.primary_title.state_faith ?= { + faith_hostility_level = { + target = root.faith + value = faith_astray_level + } + } + } #Change to faith acceptance + subtract = { + value = 10 + desc = astray_faith_succession_desc + } + } + if = { + limit = { + scope:title.holder.primary_title.state_faith ?= { + faith_hostility_level = { + target = root.faith + value = faith_hostile_level + } + } + } #Change to faith acceptance + subtract = { + value = 25 + desc = hostile_faith_succession_desc + } + } + if = { + limit = { + scope:title.holder.primary_title.state_faith ?= { + faith_hostility_level = { + target = root.faith + value >= faith_evil_level + } + } + } #Change to faith acceptance + subtract = { + value = 50 + desc = evil_faith_sucession_desc + } + } + # LOWBORN? EW no + if = { + limit = { is_lowborn = yes } + subtract = { + value = 25 + desc = lowborn_desc_succession + } + } + # INFLUENCE LEVEL + if = { + limit = { influence_level = 0 } + subtract = { + value = 10 + desc = "[influence_level|E]" + } + } + if = { + limit = { influence_level >= 2 } + add = { + value = 10 + multiply = { + value = influence_level + subtract = 1 # Base value should start at 2 + } + desc = "[influence_level|E]" + } + } + # SAME CULTURE AS REGION + if = { + limit = { + tgp_is_in_ceremonial_house_trigger = no + culture != scope:title.holder.capital_county.culture + } + add = { + value = -50 + desc = not_of_local_culture_succession_desc + } + } + # PERSONAL REASONS + if = { + limit = { + scope:title.holder ?= { is_parent_of = root } + } + add = { + value = 30 + multiply = scope:title.holder.governor_efficiency + desc = "parent_holder_desc" + } + } + else_if = { + limit = { + scope:title.holder ?= { is_sibling_of = root } + } + add = { + value = 20 + multiply = scope:title.holder.governor_efficiency + desc = "sibling_holder_desc" + } + } + else_if = { + limit = { + scope:title.holder ?= { is_grandparent_of = root } + } + add = { + value = 15 + multiply = scope:title.holder.governor_efficiency + desc = "grandparent_holder_desc" + } + } + else_if = { + limit = { + scope:title.holder ?= { is_close_family_of = root } + } + add = { + value = 10 + multiply = scope:title.holder.governor_efficiency + desc = "close_family_holder_desc" + } + } + else_if = { + limit = { + scope:title.holder ?= { + any_spouse = { is_close_family_of = root } + NOT = { is_close_family_of = root } + } + } + add = { + value = 10 + desc = "close_family_married_to_holder_desc" + } + } + else_if = { + limit = { + scope:title.holder ?= { is_extended_family_of = root } + } + add = { + value = 5 + multiply = scope:title.holder.governor_efficiency + desc = "extended_family_holder_desc" + } + } + #FRIENDS OF THE HOLDER + if = { + limit = { + scope:title.holder ?= { has_relation_friend = root } + } + add = { + value = 5 + multiply = scope:title.holder.governor_efficiency + desc = governor_friend_desc + } + } + if = { + limit = { + scope:title.holder ?= { has_relation_best_friend = root } + } + add = { + value = 15 + multiply = scope:title.holder.governor_efficiency + desc = governor_best_friend_desc + } + } + # DIARCH + if = { + limit = { scope:title.holder.diarch ?= root } + add = { + value = scope:title.holder.diarchy_swing + desc = governor_diarch_desc + } + } + # SCHEMES + if = { + limit = { has_character_modifier = scheme_slandered_modifier } + add = { + value = slander_appointment_score_value + desc = scheme_slandered_modifier + } + } + if = { + limit = { has_character_modifier = scheme_promoted_modifier } + add = { + value = promote_appointment_score_value # Keep this balanced if more values are added! + desc = scheme_promoted_modifier + } + } + # MERITOCRATIC + # Dynasty Renown + if = { + limit = { + dynasty ?= { dynasty_prestige_level >= 1 } + } + add = { + value = { + value = dynasty.dynasty_prestige_level + multiply = 10 + } + desc = japanese_kampaku_dynasty_splendor_desc + } + } + # Emperor's opinion + if = { + limit = { + exists = top_liege.primary_title.var:administrative_ui_special_title.holder + this != top_liege.primary_title.var:administrative_ui_special_title.holder + } + add = { + value = "top_liege.primary_title.var:administrative_ui_special_title.holder.opinion(root)" + desc = ceremonial_liege_opinion_desc + } + } + # BONUSES FOR IMPERIAL FAMILY + if = { + limit = { + tgp_realm_has_ceremonial_liege_trigger = yes + tgp_is_in_ceremonial_house_trigger = yes + } + if = { # Emperor + limit = { this = top_liege.primary_title.var:administrative_ui_special_title.holder } + add = { + value = 100 + desc = ceremonial_liege_desc + } + } + else_if = { + limit = { this = top_liege.primary_title.var:administrative_ui_special_title.holder.player_heir } + add = { + value = 50 + desc = ceremonial_house_heir_desc + } + } + else = { + add = { + value = -150 + desc = ceremonial_house_non_heir_desc + } + } + } + # BONUSES FOR NON-IMPERIAL FAMILY + else_if = { + limit = { tgp_realm_has_ceremonial_liege_trigger = yes } + # PAST REGENT OF YOUR DYNASTY + add = { + value = japanese_kampaku_house_past_kampaku_value + desc = japanese_kampaku_house_past_kampaku_desc + } + # Number of House children with Imperial dynasty parents (e.g. Fujiwara born to a Yamato mother) + add = { + value = japanese_kampaku_house_imperial_parent_value_actual + desc = japanese_kampaku_house_imperial_parent_desc + } + # Number of Imperial dynasty members with House parents (e.g. Yamato born to a Fujiwara mother) + add = { + value = japanese_kampaku_house_imperial_child_score_value + desc = japanese_kampaku_house_imperial_child_desc + } + # Number of Imperial spouse House members (e.g. Emperor married to a Fujiwara) + add = { + value = japanese_kampaku_imperial_spouse_score_value + desc = japanese_kampaku_imperial_spouse_desc + } + # Number of Imperial dynasty members married to House members (e.g. Yamato married to a Fujiwara) + add = { + value = japanese_kampaku_house_imperial_spouse_score_value + desc = japanese_kampaku_house_imperial_spouse_desc + } + } + # Age + else_if = { + limit = { age < 50 } + add = { + value = 50 + subtract = age + multiply = -2 + desc = japanese_kampaku_age_desc + } + } + else = { + add = { + value = age + subtract = 50 + multiply = 2 + desc = japanese_kampaku_age_desc + } + } + # Number of Governorships held by House + add = { + value = japanese_kampaku_house_governorship_score_value + desc = japanese_kampaku_house_governorship_desc + } + # Number of Devoted House members (monks/nuns) + add = { + value = japanese_kampaku_house_devoted_score_value + desc = japanese_kampaku_house_devoted_desc + } + # Domicile is in the capital + if = { + limit = { + house ?= { + any_house_member = { + any_held_title = { is_noble_family_title = yes } + domicile ?= { + is_domicile_type = japanese_manor + domicile_location.county ?= title:e_japan.holder.capital_county + } + } + } + } + add = 25 + } + # Block non-admin + if = { + limit = { + NOT = { government_allows = administrative } + } + add = -2500 + } + # Petition + if = { + limit = { + exists = var:petition_liege_regent_support + top_liege.primary_title.var:administrative_ui_special_title.holder ?= var:petition_liege_regent_support + scope:title = top_liege.primary_title # Only top liege title + } + multiply = { + value = 1.1 + desc = petition_liege_regent_support_desc + } + } + #ADJUST BASED ON GENDER LAW - MUST GO AT THE END + if = { + limit = { + scope:title.holder ?= { has_realm_law = male_preference_law } + is_female = yes + } + multiply = { + value = 0.33 + desc = male_preference_law + } + } + else_if = { + limit = { + scope:title.holder ?= { has_realm_law = male_only_law } + is_female = yes + } + multiply = { + value = 0 + desc = male_only_law + } + } + else_if = { + limit = { + scope:title.holder ?= { has_realm_law = female_preference_law } + is_female = no + } + multiply = { + value = 0.33 + desc = female_preference_law + } + } + else_if = { + limit = { + scope:title.holder ?= { has_realm_law = female_only_law } + is_female = no + } + multiply = { + value = 0 + desc = female_only_law + } + } + } + } +} diff --git a/N3OW/common/succession_election/00_feudal_elective.txt b/N3OW/common/succession_election/00_feudal_elective.txt index d6c2d56d..d8b9d44d 100644 --- a/N3OW/common/succession_election/00_feudal_elective.txt +++ b/N3OW/common/succession_election/00_feudal_elective.txt @@ -43,14 +43,14 @@ feudal_elective = { add = 1 } } - NOT = { this = scope:holder } + this != scope:holder is_powerful_vassal = yes liege = scope:holder } modifier = { #Clerical Influence desc = tooltip_feudal_vote_strength_theocrat add = 1 - NOT = { this = scope:holder } + this != scope:holder OR = { government_has_flag = government_is_theocracy has_council_position = councillor_court_chaplain @@ -87,7 +87,7 @@ feudal_elective = { } OR = { #Either de facto direct vassal, or independent ruler who is de jure vassal. (no sub-vassals) is_vassal_of = scope:holder - is_independent_ruler = yes + top_liege = this } any_held_title = { #Elector title must be a de jure vassal of the title being voted on; multi-Dukes (or similar) might have two duchies in multiple electoral domains, which they should be able to vote on. This is only valid for the highest-tier title (so a Duke-Elector who also owns a County which is an electoral title for another title does not get a vote from that county). tier = root.highest_held_title_tier @@ -133,7 +133,7 @@ feudal_elective = { add = { type = title_dejure_vassals limit = { - is_independent_ruler = yes #De jure vassals of the title who are not de facto vassals of the current ruler. + top_liege = this #De jure vassals of the title who are not de facto vassals of the current ruler. feudal_elective_potential_landed_candidate_trigger = yes } } diff --git a/N3OW/common/succession_election/01_princely_elective.txt b/N3OW/common/succession_election/01_princely_elective.txt index c57ce43b..3e5c3d95 100644 --- a/N3OW/common/succession_election/01_princely_elective.txt +++ b/N3OW/common/succession_election/01_princely_elective.txt @@ -30,26 +30,26 @@ princely_elective = { #HRE Elective. add = 2 } } - NOT = { this = scope:holder } + this != scope:holder is_powerful_vassal = yes liege = scope:holder } modifier = { #Clerical Influence desc = tooltip_feudal_vote_strength_theocrat add = 2 - NOT = { this = scope:holder } + this != scope:holder OR = { government_has_flag = government_is_theocracy has_council_position = councillor_court_chaplain } faith = scope:holder.faith faith = { has_doctrine = doctrine_theocracy_lay_clergy } - NOT = { root = scope:holder.faith.religious_head } + root != scope:holder.faith.religious_head } modifier = { #Papal Influence desc = tooltip_feudal_vote_strength_pope add = 4 #If the Pope is an elector, his vote is the most important of all. - NOT = { this = scope:holder } + this != scope:holder root = scope:holder.faith.religious_head } modifier = { #Regent Influence @@ -73,7 +73,7 @@ princely_elective = { #HRE Elective. } OR = { #Either de facto direct vassal, or independent ruler who is de jure vassal. (no sub-vassals) is_vassal_of = scope:holder - is_independent_ruler = yes + top_liege = this } trigger_if = { #Must be true priests limit = { government_has_flag = government_is_theocracy } @@ -128,7 +128,7 @@ princely_elective = { #HRE Elective. } if = { #Malus for other governments. limit = { - government_has_flag = government_is_special_republic + government_has_flag = government_is_republic } subtract = 5 } @@ -205,7 +205,7 @@ princely_elective = { #HRE Elective. add = { type = title_dejure_vassals limit = { - is_independent_ruler = yes #De jure vassals of the title who are not de facto vassals of the current ruler. + top_liege = this #De jure vassals of the title who are not de facto vassals of the current ruler. feudal_elective_potential_landed_candidate_trigger = yes } } diff --git a/N3OW/common/succession_election/02_gaelic_elective.txt b/N3OW/common/succession_election/02_gaelic_elective.txt index 9c440872..7ef9976b 100644 --- a/N3OW/common/succession_election/02_gaelic_elective.txt +++ b/N3OW/common/succession_election/02_gaelic_elective.txt @@ -37,7 +37,7 @@ gaelic_elective = { #Tanistry add = 1 } } - NOT = { this = scope:holder } + this != scope:holder is_powerful_vassal = yes liege = scope:holder } diff --git a/N3OW/common/succession_election/04_saxon_elective.txt b/N3OW/common/succession_election/04_saxon_elective.txt index 95c82cd0..259a8ea1 100644 --- a/N3OW/common/succession_election/04_saxon_elective.txt +++ b/N3OW/common/succession_election/04_saxon_elective.txt @@ -35,7 +35,7 @@ saxon_elective = { #Witenagemot add = 1 } } - NOT = { this = scope:holder } + this != scope:holder is_powerful_vassal = yes liege = scope:holder } diff --git a/N3OW/common/succession_election/05_scandinavian_elective.txt b/N3OW/common/succession_election/05_scandinavian_elective.txt index 8ffceed7..75160970 100644 --- a/N3OW/common/succession_election/05_scandinavian_elective.txt +++ b/N3OW/common/succession_election/05_scandinavian_elective.txt @@ -14,14 +14,14 @@ scandinavian_elective = { #Thing is_landed_or_landless_administrative = yes domain_size >= 1 any_held_title = { - tier = tier_county + title_tier = county development_level > 0 target_is_de_jure_liege_or_above = scope:title } add = { every_held_title = { + title_tier = county limit = { - tier = tier_county development_level > 0 target_is_de_jure_liege_or_above = scope:title } @@ -29,7 +29,7 @@ scandinavian_elective = { #Thing value = this.development_level if = { limit = { - NOT = { this.faith = root.faith } + this.faith != root.faith } divide = 2 } diff --git a/N3OW/common/succession_election/06_tribal_elective.txt b/N3OW/common/succession_election/06_tribal_elective.txt index 06838257..32e846d8 100644 --- a/N3OW/common/succession_election/06_tribal_elective.txt +++ b/N3OW/common/succession_election/06_tribal_elective.txt @@ -16,14 +16,14 @@ tribal_elective = { #Loya Jirga is_landed_or_landless_administrative = yes domain_size >= 1 any_held_title = { - tier = tier_county + title_tier = county development_level > 0 target_is_de_jure_liege_or_above = scope:title } add = { every_held_title = { + title_tier = county limit = { - tier = tier_county development_level > 0 target_is_de_jure_liege_or_above = scope:title } @@ -31,7 +31,7 @@ tribal_elective = { #Loya Jirga value = this.development_level if = { limit = { - NOT = { this.faith = root.faith } + this.faith != root.faith } divide = 2 } diff --git a/N3OW/common/succession_election/09_confederation_elective.txt b/N3OW/common/succession_election/09_confederation_elective.txt new file mode 100644 index 00000000..5b7aba5e --- /dev/null +++ b/N3OW/common/succession_election/09_confederation_elective.txt @@ -0,0 +1,155 @@ +# The entry should be named in the same way that the elective succession law is named to define it's voter's logic. +# Root scope - Elector, the character voting in the election. +# scope:candidate scope - Candidate, Character considered for the title. +# scope:title scope - Title, The title the nomination is for. +# scope:holder scope - Ruler, The ruler currently holding the title. +# scope:holder_candidate scope - Favored Candidate, The title owner's candidate. +# The voter will vote for the top score candidate calculated from this script. + +#Addition for MPO + +confederation_elective = { + elector_vote_strength = { + base = 0 + modifier = { #Each voter represents their tribe and those under them + desc = tooltip_confederation_elective_vassals + add = { + every_vassal = { + limit = { + NOT = { + is_vassal_of = scope:holder + } + custom_tooltip = { + OR = { + government_has_flag = government_is_nomadic + government_has_flag = government_is_tribal + } + text = is_nomadic_or_tribal_tt + } + highest_held_title_tier >= tier_county + } + add = 1 + } + } + } + modifier = { #Additional sway from prestige level + desc = tooltip_confederation_elective_prestige_levels + add = { + value = prestige_level + } + } + modifier = { #Additional sway from piety level + desc = tooltip_confederation_elective_piety_levels + add = { + value = piety_level + } + } + modifier = { #Regent Influence + desc = tooltip_feudal_vote_strength_is_diarch + add = 1 + is_diarch_of_target = scope:holder + } + modifier = { #Coronation event + desc = tooltip_confederation_vote_strength_coronation + add = 1 + has_character_flag = confederation_politicking_vote + } + modifier = { #Coronation event + desc = tooltip_confederation_vote_strength_coronation + add = 2 + has_character_flag = confederation_politicking_vote_2 + } + min = 1 + } + + electors = { + add = holder + add = { + type = holder_direct_vassals + limit = { + highest_held_title_tier >= tier_county + NOR = { + has_trait = incapable + is_at_war_with = scope:holder + } + custom_tooltip = { + OR = { + government_has_flag = government_is_nomadic + government_has_flag = government_is_tribal + } + text = is_nomadic_or_tribal_tt + } + NOT = { + government_has_flag = government_is_herder + } + } + } + } + + candidate_score = { + base = 0 + ###################### Elector self-voting pattern ########################## + elector_self_voting_pattern_feudal_elective_modifier = yes + + ########################## Holder voting pattern ########################## + holder_voting_pattern_feudal_elective_modifier = yes + + ########################## Elector voting patterns (circumstances) ########################## + elector_voting_pattern_circumstances_feudal_elective_modifier = yes + + ########################## Elector voting patterns (prestige/piety) ########################## + elector_voting_pattern_prestige_piety_feudal_elective_modifier = yes + + ########################## Elector voting patterns (traits) ########################## + elector_voting_pattern_traits_feudal_elective_modifier = yes + + ########################## Elector voting patterns (opinion) ########################## + elector_voting_pattern_opinion_feudal_elective_modifier = yes + + ########################## Elector voting patterns (misc) ########################## + elector_voting_pattern_circumstances_misc_elective_modifier = yes + elector_voting_pattern_confederation_modifier = yes + } + + #scope:candidate = Candidate, scope:title = Title, scope:holder_candidate = Candidate currently selected by ruler. + candidates = { + add = { + type = holder_direct_vassals + limit = { + feudal_elective_potential_landed_candidate_trigger = yes + highest_held_title_tier >= tier_county + custom_tooltip = { + custom_tooltip = { + OR = { + government_has_flag = government_is_nomadic + government_has_flag = government_is_tribal + } + text = is_nomadic_or_tribal_tt + } + text = is_nomadic_or_tribal_tt + } + } + } + add = { + type = holder_close_or_extended_family + limit = { + feudal_elective_potential_landless_dynastic_candidate_trigger = yes + OR = { + is_close_family_of = scope:holder + is_grandchild_of = scope:holder + } + OR = { + is_landed = no + custom_tooltip = { + OR = { + government_has_flag = government_is_nomadic + government_has_flag = government_is_tribal + } + text = is_nomadic_or_tribal_tt + } + } + + } + } + } +} diff --git a/N3OW/common/succession_election/_succession_election.info b/N3OW/common/succession_election/_succession_election.info index adac1c3d..a3820c9e 100644 --- a/N3OW/common/succession_election/_succession_election.info +++ b/N3OW/common/succession_election/_succession_election.info @@ -43,3 +43,5 @@ feudal_elective = { - holder_close_family - holder_close_or_extended_family - holder_dynasty +- holder_council_members +- holder_tributaries