﻿##### WEST SLAVIC DECISIONS #####

##### GENERAL DECISIONS #####

invite_german_settlers = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_smith.dds"
	}
    title = invite_german_settlers_txt
    decision_group_type = major
    desc = invite_german_settlers_desc
    confirm_text = invite_german_settlers_confirm
	ai_check_interval = 120
	
	cooldown = { years = 10 }
	
    is_shown = {
        is_ruler = yes
		is_landed = yes
		any_held_county = {
			development_level <= 25
		}
		highest_held_title_tier > tier_barony
		exists = capital_province
		capital_province = {
			geographical_region = ce_custom_wendia_germania
		}
		current_date >= 1050.1.1
		OR = {
			culture = {
				has_cultural_pillar = heritage_central_germanic
			}
			culture = {
				has_cultural_pillar = heritage_west_slavic
			}
		}
		OR = {
			any_held_title = {
				tier = tier_county
				culture = { has_cultural_pillar = heritage_central_germanic }
				NOT = { exists = var:had_new_settler_settlement }
			}
			any_held_title = {
				tier = tier_county
				culture = { has_cultural_pillar = heritage_west_slavic }
				NOT = { exists = var:had_german_settlement }
			}
		}
		NOT = {
			is_target_in_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:consolidate_polabian_identity_decision
			}
		}
    }
    is_valid = {
		culture = {
			has_cultural_era_or_later = culture_era_high_medieval
		}
		any_held_county = {
			development_level <= 30
		}
		gold >= 50
		OR = {
			AND = {
				culture = {
					has_cultural_pillar = heritage_central_germanic
				}
				culture = {
					has_innovation = innovation_east_settling
				}
			}
			AND = {
				culture = {
					has_cultural_pillar = heritage_west_slavic
				}
				OR = {
					stewardship >= 9
					culture = { has_cultural_tradition = tradition_xenophilic }
				}
			}
		}
    }

	is_valid_showing_failures_only = {
		is_capable_adult = yes
		is_imprisoned = no
	}

    effect = {
		custom_tooltip = invite_german_settlers.preview.tta
		custom_tooltip = invite_german_settlers.preview.ttb
        hidden_effect = {
			
			
			remove_short_term_gold = 50
			
			every_held_title = {
				limit = {
					tier = tier_county 
					title_province = {	
						geographical_region = ce_custom_wendia_germania
					}
					OR = {
						NOT = { exists = var:had_german_settlement }
						NOT = { exists = var:had_new_settler_settlement }
					}
				}
				add_to_list = counties_to_be_settled
			}
			
			random_in_list = {
				list = counties_to_be_settled
		
				if = {
					limit = {
						culture = {
							has_cultural_pillar = heritage_central_germanic
						}
						title_province = {	
							geographical_region = ce_custom_wendia_germania
						}
						NOT = { exists = var:had_new_settler_settlement }
					}
					set_variable = {
						name = had_new_settler_settlement
						value = yes
					}
					add_county_modifier = {
						modifier = ce_gs_new_settlement_modifier
						years = 10
					}
				}
		
				else_if = {
					limit = {
						culture = {
							has_cultural_pillar = heritage_west_slavic
						}
						title_province = {	
							geographical_region = ce_custom_pomoria
						}
						NOT = { exists = var:had_german_settlement }
					}
					set_variable = {
						name = had_german_settlement
						value = yes
					}
					add_county_modifier = {
						modifier = ce_gs_german_settlement_modifier
						years = 10
					}
					random = {
						chance = 10
						set_county_culture = culture:pomeranian
						set_county_faith = faith:catholic
					}
				}
				
				else_if = {
					limit = {
						culture = {
							has_cultural_pillar = heritage_west_slavic
						}
						title_province = {	
							geographical_region = ce_custom_margravia
						}
						NOT = { exists = var:had_german_settlement }
					}
					set_variable = {
						name = had_german_settlement
						value = yes
					}
					add_county_modifier = {
						modifier = ce_gs_german_settlement_modifier
						years = 10
					}
					random = {
						chance = 10
						set_county_culture = culture:markish
						set_county_faith = faith:catholic
					}
				}
				
				else_if = {
					limit = {
						culture = {
							has_cultural_pillar = heritage_west_slavic
						}
						title_province = {	
							geographical_region = ce_custom_estphalia_saxonia
						}
						NOT = { exists = var:had_german_settlement }
					}
					set_variable = {
						name = had_german_settlement
						value = yes
					}
					add_county_modifier = {
						modifier = ce_gs_german_settlement_modifier
						years = 10
					}
					random = {
						chance = 80
						set_county_culture = culture:saxon
						set_county_faith = faith:catholic
					}
				}
				
				else_if = {
					limit = {
						culture = {
							has_cultural_pillar = heritage_west_slavic
						}
						title_province = {	
							geographical_region = ce_custom_upper_saxonia
						}
						NOT = { exists = var:had_german_settlement }
					}
					set_variable = {
						name = had_german_settlement
						value = yes
					}
					add_county_modifier = {
						modifier = ce_gs_german_settlement_modifier
						years = 10
					}
					random = {
						chance = 10
						set_county_culture = culture:meissener
						set_county_faith = faith:catholic
					}
				}
				
				else_if = {
					limit = {
						culture = {
							has_cultural_pillar = heritage_west_slavic
						}
						title_province = {	
							geographical_region = ce_custom_german_silesia
						}
						NOT = { exists = var:had_german_settlement }
					}
					set_variable = {
						name = had_german_settlement
						value = yes
					}
					add_county_modifier = {
						modifier = ce_gs_german_settlement_modifier
						years = 10
					}
					random = {
						chance = 10
						set_county_culture = culture:lausitzian
						set_county_faith = faith:catholic
					}
				}
				
			}
        }
    }

	ai_potential = {
		always = yes
	}

	ai_will_do = {
		base = 100
	}
}


### POLAND ###

consolidate_polish_identity = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_destiny_goal.dds"
	}
    title = consolidate_polish_identity_txt
    decision_group_type = major
    desc = consolidate_polish_identity_desc
    confirm_text = consolidate_polish_identity_confirm
	ai_check_interval = 36
	
	
	is_shown = {
        culture = {
			has_cultural_pillar = heritage_west_slavic
		}
		OR = {
			culture = culture:polish
			culture = culture:vistulan
			culture = culture:lendian
			culture = culture:masovian
			culture = culture:silesian
		}
		exists = capital_province
		capital_province = {
			geographical_region = ce_custom_poland
		}
		exists = title:k_poland
		NOT = {
			is_target_in_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:unite_the_polans_decision
			}
		}
    }
    is_valid = {
		is_independent_ruler = yes
		has_title = title:k_poland
		prestige_level >= high_prestige_level
		culture = {
			trigger_if = {
				limit = {
					this = culture:polish
				}
				cultural_acceptance = { target = culture:silesian value >= 50 }
				cultural_acceptance = { target = culture:masovian value >= 50 }
				cultural_acceptance = { target = culture:vistulan value >= 50 }
				cultural_acceptance = { target = culture:lendian value >= 50 }
			}
			trigger_if = {
				limit = {
					this = culture:silesian
				}
				cultural_acceptance = { target = culture:polish value >= 50 }
				cultural_acceptance = { target = culture:masovian value >= 50 }
				cultural_acceptance = { target = culture:lendian value >= 50 }
				cultural_acceptance = { target = culture:vistulan value >= 50 }
			}
			trigger_if = {
				limit = {
					this = culture:masovian
				}
				cultural_acceptance = { target = culture:polish value >= 50 }
				cultural_acceptance = { target = culture:silesian value >= 50 }
				cultural_acceptance = { target = culture:lendian value >= 50 }
				cultural_acceptance = { target = culture:vistulan value >= 50 }
			}
			trigger_if = {
				limit = {
					this = culture:vistulan
				}
				cultural_acceptance = { target = culture:polish value >= 50 }
				cultural_acceptance = { target = culture:silesian value >= 50 }
				cultural_acceptance = { target = culture:lendian value >= 50 }
				cultural_acceptance = { target = culture:masovian value >= 50 }
			}
			trigger_if = {
				limit = {
					this = culture:lendian
				}
				cultural_acceptance = { target = culture:polish value >= 50 }
				cultural_acceptance = { target = culture:silesian value >= 50 }
				cultural_acceptance = { target = culture:vistulan value >= 50 }
				cultural_acceptance = { target = culture:masovian value >= 50 }
			}
		}
    }

	is_valid_showing_failures_only = {
		is_capable_adult = yes
		is_imprisoned = no
		is_at_war = no
	}

    effect = {
		custom_tooltip = consolidate_polish_identity.preview.tta
		custom_tooltip = consolidate_polish_identity.preview.ttb
		custom_tooltip = consolidate_polish_identity.preview.ttc
        hidden_effect = {
			
			
			
			if = {
                limit = {
					culture = culture:polish
                }
                culture:polish = {
					set_culture_name = {
						noun = n_polan_noun
						collective_noun = n_polan_c_noun
						prefix = n_polan_prefix
					}
				}
				title:k_poland = {
					set_title_name = k_poland_original
				}
            }
			else_if = {
                limit = {
					culture = culture:silesian
                }
                culture:silesian = {
					set_culture_name = {
						noun = n_polan_noun
						collective_noun = n_polan_c_noun
						prefix = n_polan_prefix
					}
				}
				title:k_poland = {
					set_title_name = k_poland_original
				}
            }
			else_if = {
                limit = {
					culture = culture:vistulan
                }
                culture:vistulan = {
					set_culture_name = {
						noun = n_vislan_noun
						collective_noun = n_vislan_c_noun
						prefix = n_vislan_prefix
					}
				}
				title:k_poland = {
					set_title_name = k_poland_vistuland
				}
            }
			else_if = {
                limit = {
					culture = culture:lendian
                }
                culture:lendian = {
					set_culture_name = {
						noun = n_lendish_noun
						collective_noun = n_lendish_c_noun
						prefix = n_lendish_prefix
					}
				}
				title:k_poland = {
					set_title_name = k_poland_lendia
				}
            }
			else_if = {
                limit = {
					culture = culture:masovian
                }
                culture:masovian = {
					set_culture_name = {
						noun = n_mazurian_noun
						collective_noun = n_mazurian_c_noun
						prefix = n_mazurian_prefix
					}
				}
				title:k_poland = {
					set_title_name = k_poland_masovia
				}
				title:d_mazovia = {
					set_title_name = d_mazovia_masuria
				}
            }
			
			every_county = {
				limit = {
					culture = { has_cultural_pillar = heritage_west_slavic }
					title_province = {	
						geographical_region = ce_custom_poland
					}
				}
				add_to_list = polish_counties
			}
			
			every_in_list = {
				list = polish_counties
		
				if = {
					limit = {
						culture = { has_cultural_pillar = heritage_west_slavic }
						title_province = {	
							geographical_region = ce_custom_poland
						}
					}
					random = {
						chance = 100
						set_county_culture = root.culture
					}
				}
				
			}
				
			every_vassal_or_below = {
				limit = {
					culture = { has_cultural_pillar = heritage_west_slavic }
					capital_province = {
						geographical_region = ce_custom_poland
					}
				}
				set_culture = root.culture
				every_courtier = {
					limit = {
						culture = { has_cultural_pillar = heritage_west_slavic }
					}
					set_culture = root.culture
				}
			}
			
			every_courtier = {
				limit = {
					culture = { has_cultural_pillar = heritage_west_slavic }
				}
				set_culture = root.culture
			}
			
			add_to_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:unite_the_polans_decision
			}
        }
    }

	ai_potential = {
		always = yes
	}

	ai_will_do = {
		base = 100
	}
}


### POLABIANS & POMORIANS ###

consolidate_polabian_identity = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_destiny_goal.dds"
	}
    title = consolidate_polabian_identity_txt
    decision_group_type = major
    desc = consolidate_polabian_identity_desc
    confirm_text = consolidate_polabian_identity_confirm
	ai_check_interval = 36
	
    is_shown = {
        culture = {
			has_cultural_pillar = heritage_west_slavic
		}
		OR = {
			culture = culture:polabian
			culture = culture:obotrite
			culture = culture:ranian
			culture = culture:lutician
			culture = culture:sorbian
		}
		exists = capital_province
		capital_province = {
			geographical_region = ce_custom_wendia
		}
		OR = {
			exists = title:k_wendia
			exists = title:k_sorbia
		}
		NOT = {
			is_target_in_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:consolidate_polabian_identity_decision
			}
		}
    }
    is_valid = {
		is_independent_ruler = yes
		prestige_level >= high_prestige_level
		completely_controls_region = ce_custom_wendia
		OR = {
			has_title = title:k_wendia
			has_title = title:k_sorbia
		}
    }

	is_valid_showing_failures_only = {
		is_capable_adult = yes
		is_imprisoned = no
		is_at_war = no
	}

    effect = {
		custom_tooltip = consolidate_polabian_identity.preview.tta
		custom_tooltip = consolidate_polabian_identity.preview.ttb
        hidden_effect = {
			
            root.culture = {
                set_culture_name = {
                    noun = n_wendish_noun
                    collective_noun = n_wendish_c_noun
                    prefix = n_wendish_prefix
                }
            }
			
			every_county = {
				limit = {
					culture = {
						has_cultural_pillar = heritage_west_slavic
					}
					title_province = {	
						geographical_region = ce_custom_wendia
					}
				}
				add_to_list = wendish_counties
			}
			
			every_in_list = {
				list = wendish_counties
		
				if = {
					limit = {
						culture = {
							has_cultural_pillar = heritage_west_slavic
						}
						title_province = {	
							geographical_region = ce_custom_wendia
						}
					}
					random = {
						chance = 100 #debugging
						set_county_culture = root.culture
					}
				}
				
			}
				
			every_vassal_or_below = {
				limit = {
					culture = {
						has_cultural_pillar = heritage_west_slavic
					}
					capital_province = {
						geographical_region = ce_custom_wendia
					}
				}
				set_culture = root.culture
				every_courtier = {
					limit = {
						culture = {
							has_cultural_pillar = heritage_west_slavic
						}
					}
					set_culture = root.culture
				}
			}
			
			every_courtier = {
				limit = {
					culture = {
						has_cultural_pillar = heritage_west_slavic
					}
				}
				set_culture = root.culture
			}
			
			add_to_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:consolidate_polabian_identity_decision
			}
        }
    }

	ai_potential = {
		always = yes
	}

	ai_will_do = {
		base = 100
	}
}

