namespace = easycheats_main

easycheats_main.4 = { # Culture and Religion
	type = country_event
	title = "easycheats_main.4.title"
	desc = "easycheats_main.4.desc"
	
	left_portrait = root.current_ruler
	
	picture = easycheats_main_bg

	option = {
		name = "easycheats_exit"

		ai_chance = { 
            factor = 100 
        }
    }
    
	option = {
		name = "easycheats_back_to_common"

        trigger_event = {
            id = easycheats_main.3
        }

		ai_chance = { 
            factor = 0 
        }
    }

    option = {
		name = "easycheats_main_culture"
		trigger = {
			any_owned_province = {
				NOT = { culture = root.culture }
			}
		}		
        every_owned_province = {
            limit = { 
                NOT = { culture = root.culture }
            }
            every_pops_in_province = {
                set_pop_culture = root.culture
            }
        }

        trigger_event = {
            id = easycheats_main.4
        }
        
		ai_chance = { 
            factor = 0 
        }
	}

    option = {
		name = "easycheats_main_religion"

		trigger = {
			any_owned_province = {
                any_pops_in_province = {
                    NOT = { pop_religion = root.religion }
                }
			}
		}

        ordered_character = {
            limit = {
                NOT = { has_religion = root.religion }
                is_ruler = no
            } 

            max = {
                value = total_population
                divide = 1
            }

			order_by = prominence            
			set_character_religion = root.religion
        }

        every_owned_province = {
            limit = {                 
                any_pops_in_province = {
                    NOT = { pop_religion = root.religion }
                }
            }
            
            ordered_pops_in_province = {
                limit = {
                    NOT = { pop_religion = root.religion }
                }
                
				max = {
					value = total_population
					divide = 1
				}
                
                set_pop_religion = root.religion
            }
        }

        trigger_event = {
            id = easycheats_main.4
        }
        
		ai_chance = { 
            factor = 0 
        }
	}
}