﻿unite_swedes = {
	picture = {
        reference = "gfx/interface/illustrations/decisions/decision_realm.dds"
    }
    title = unite_swedes_txt
    decision_group_type = major
    ai_check_interval = 36
    desc = unite_swedes_desc
    confirm_text = unite_swedes_confirm
    is_shown = {
        OR = {
            has_culture = culture:geat
            has_culture = culture:got
            has_culture = culture:svear
        }
        exists = capital_province
        capital_province = { geographical_region = custom_swedish }
        exists = title:k_sweden
        NOT = {
            exists = global_var:sweden_united
        }
    }

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

    is_valid = {
        prestige_level >= high_prestige_level
        has_title = title:k_sweden
        save_temporary_scope_as = effect_root
        culture = {
            trigger_if = {
                limit = {
                    this = culture:geat
                }
                cultural_acceptance = { target = culture:got value >= 75 }
                cultural_acceptance = { target = culture:svear value >= 75 }
            }
            trigger_if = {
                limit = {
                    this = culture:got
                }
                cultural_acceptance = { target = culture:geat value >= 75 }
                cultural_acceptance = { target = culture:svear value >= 75 }
            }
            trigger_if = {
                limit = {
                    this = culture:svear
                }
                cultural_acceptance = { target = culture:geat value >= 75 }
            cultural_acceptance = { target = culture:got value >= 75 }
            }
        }
		custom_description = {
			text = capital_in_sweden_region_tooltip
			capital_province = {
				geographical_region = custom_swedish
			}
		}
    }
    effect = {
        custom_description = {
            text = unite_swedes_effect
            save_scope_as = effect_root
            culture = {
                save_scope_as = based_swede
            }
            # # Prestige
            # add_prestige = 500
            # # Also gain a large amount of dynasty prestige.
            # dynasty = { 
            #     add_dynasty_prestige = 250 
            # }
            if = {
                limit = {
                    has_religion = religion:germanic_religion
                    any_vassal = {
                        has_faith = faith:catholic
                    }
                }
                give_nickname = nick_the_heathen_ce
            }
            else_if = {
                limit = {
                    OR = {
                        has_culture = culture:geat
                        has_culture = culture:got
                    }
                }
                give_nickname = nick_goth
            }
            else = {
                give_nickname = nick_swede 
            }
            culture:swedish = {
                reset_culture_creation_date = yes
                get_all_innovations_from = scope:based_swede
                copy_all_traditions_from = scope:based_swede
                if = {
                    limit = {
                        OR = {
                            scope:effect_root.culture = culture:geat
                            scope:effect_root.culture = culture:got
                        }
                    }
                    set_culture_name = {
                        noun = n_goth_noun
                        collective_noun = n_goth_c_noun
                        prefix = n_goth_prefix
                    }
                }
            }
            culture:geat = {
                every_culture_county = {
                    limit = {
                        exists = holder.top_liege
                        holder.top_liege = scope:effect_root
                    }
                    set_county_culture = culture:swedish
                }
            }
            culture:got = {
                every_culture_county = {
                    limit = {
                        exists = holder.top_liege
                        holder.top_liege = scope:effect_root
                    }
                    set_county_culture = culture:swedish
                }
            }
            culture:svear = {
                every_culture_county = {
                    limit = {
                        exists = holder.top_liege
                        holder.top_liege = scope:effect_root
                    }
                    set_county_culture = culture:swedish
                }
            }
            every_vassal_or_below = {
                limit = {
                    OR = {
                        culture = culture:geat
                        culture = culture:got
                        culture = culture:svear
                    }
                }
                set_culture = culture:swedish
                every_courtier = {
                    limit = {
                        OR = {
                            culture = culture:geat
                            culture = culture:got
                            culture = culture:svear
                        }
                    }
                    set_culture = culture:swedish
                }
            }
            every_courtier = {
                limit = {
                    OR = {
                        culture = culture:geat
                        culture = culture:got
                        culture = culture:svear
                    }
                }
                set_culture = culture:swedish
            }
            set_culture = culture:swedish
            set_global_variable = {
                name = sweden_united
                value = yes
            }
        }
        # show_as_tooltip = {
		# 	unite_swedes_decision_effect = yes 
		# }
    }

    ai_potential = {
		always = yes
	}

	ai_will_do = {
		base = 100
	}
}
unite_danes = {
	picture = {
        reference = "gfx/interface/illustrations/decisions/decision_realm.dds"
    }
    title = unite_danes_txt
    decision_group_type = major
    ai_check_interval = 36
    desc = unite_danes_desc
    confirm_text = unite_danes_confirm
    is_shown = {
        OR = {
            has_culture = culture:dane
            has_culture = culture:jute
        }
        exists = capital_province
        capital_province = { geographical_region = custom_danish }
        exists = title:k_denmark
        NOT = {
            exists = global_var:danjute_united
        }
    }

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

    is_valid = {
        prestige_level >= high_prestige_level
        has_title = title:k_denmark
        save_temporary_scope_as = effect_root
        culture = {
            trigger_if = {
                limit = {
                    this = culture:dane
                }
                cultural_acceptance = { target = culture:jute  value >= 75 }
            }
            trigger_if = {
                limit = {
                    this = culture:jute
                }
                cultural_acceptance = { target = culture:dane value >= 75 }
            }
        }
		custom_description = {
			text = capital_in_denmark_region_tooltip
			capital_province = {
				geographical_region = custom_danish
			}
		}
    }
    effect = {
        custom_description = {
            text = unite_danes_effect
            save_scope_as = effect_root
            # # Prestige
            # add_prestige = 500
            # # Also gain a large amount of dynasty prestige.
            # dynasty = { 
            #     add_dynasty_prestige = 250 
            # }
            culture = {
                save_scope_as = based_dan
            }
            if = {
                limit = {
                    has_culture = culture:jute
                }
                give_nickname = nick_jute
            }
            else = {
                give_nickname = nick_dane
            }
            culture:danish = {
                reset_culture_creation_date = yes
                get_all_innovations_from = scope:based_dan
                copy_all_traditions_from = scope:based_dan
                if = {
                    limit = {
                        scope:based_dan = culture:jute
                    }
                    set_culture_name = {
                        noun = n_jute_noun
                        collective_noun = n_jute_c_noun
                        prefix = n_jute_prefix
                    }
                }
            }
            culture:dane = {
                every_culture_county = {
                    limit = {
                        exists = holder.top_liege
                        holder.top_liege = scope:effect_root
                    }
                    set_county_culture = culture:danish
                }
            }
            culture:jute = {
                every_culture_county = {
                    limit = {
                        exists = holder.top_liege
                        holder.top_liege = scope:effect_root
                    }
                    set_county_culture = culture:danish
                }
            }
            every_vassal_or_below = {
                limit = {
                    OR = {
                        culture = culture:jute
                        culture = culture:dane
                    }
                }
                set_culture = culture:danish
                every_courtier = {
                    limit = {
                        OR = {
                            culture = culture:jute
                            culture = culture:dane
                        }
                    }
                    set_culture = culture:danish
                }
            }
            every_courtier = {
                limit = {
                    OR = {
                        culture = culture:jute
                        culture = culture:dane
                    }
                }
                set_culture = culture:danish
            }
            set_culture = culture:danish
            set_global_variable = {
                name = danjute_united
                value = yes
            }
        }
        # show_as_tooltip = {
		# 	unite_danes_decision_effect = yes 
		# }
    }

    ai_potential = {
		always = yes
	}

	ai_will_do = {
		base = 100
	}
}
unite_norweg = {
	picture = {
        reference = "gfx/interface/illustrations/decisions/decision_realm.dds"
    }
    title = unite_norweg_txt
    decision_group_type = major
    ai_check_interval = 36
    desc = unite_norweg_desc
    confirm_text = unite_norweg_confirm
    is_shown = {
        has_culture = culture:norse
        exists = capital_province
        capital_province = { geographical_region = custom_norwegian }
        exists = title:k_norway
        NOT = {
            exists = global_var:norwegian_united
        }
    }
    is_valid = {
        prestige_level >= high_prestige_level
        has_title = title:k_norway
		custom_description = {
			text = capital_in_norway_region_tooltip
			capital_province = {
				geographical_region = custom_norwegian
			}
		}
    }

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

    effect = {
        custom_description = {
            text = unite_norweg_effect
            save_scope_as = effect_root
            culture = {
                save_scope_as = based_norweg
            }
            # # Prestige
            # add_prestige = 500
            # # Also gain a large amount of dynasty prestige.
            # dynasty = { 
            #     add_dynasty_prestige = 250 
            # }
            give_nickname = nick_northman
            culture:norwegian = {
                reset_culture_creation_date = yes
                get_all_innovations_from = scope:based_norweg
                copy_all_traditions_from = scope:based_norweg
            }
            culture:norse = {
                every_culture_county = {
                    limit = {
                        exists = holder.top_liege
                        holder.top_liege = scope:effect_root
                    }
                    set_county_culture = culture:norwegian
                }
            }
            every_vassal_or_below = {
                limit = {
                    culture = culture:norse
                }
                set_culture = culture:norwegian
                every_courtier = {
                    limit = {
                        culture = culture:norse
                    }
                    set_culture = culture:norwegian
                }
            }
            every_courtier = {
                limit = {
                    culture = culture:norse
                }
                set_culture = culture:norwegian
            }
            set_culture = culture:norwegian
            set_global_variable = {
                name = norwegian_united
                value = yes
            }
        }
        # show_as_tooltip = {
		# 	unite_norwg_decision_effect = yes 
		# }
    }

    ai_potential = {
		always = yes
	}

	ai_will_do = {
		base = 100
	}
}