namespace = easycheats_main

easycheats_main.3 = { # Common
    type = country_event
    title = "easycheats_main.3.title"
    desc = "easycheats_main.3.desc"

    left_portrait = root.current_ruler

    picture = easycheats_main_bg

    immediate = {
        if = {
            limit = {
                NOT = {
                    has_variable = easycheats_random_color
                }
            }            
            set_variable = {
                name = easycheats_random_color
                value = 0
            }
        }
        else = {
            if = {
                limit = {
                    var:easycheats_random_color >= 28
                }
                
                set_variable = {
                    name = easycheats_random_color
                    value = 0
                }
            }
            else = {                
                change_variable = {
                    name = easycheats_random_color
                    add = 1
                }
            }
        }     
    }

    option = {
        name = "easycheats_exit"

        ai_chance = { 
            factor = 100 
        }
    }

    option = {
        name = "easycheats_main_placeholder_1"
        
        trigger_event = {
            id = easycheats_main.3
        }

        ai_chance = { 
            factor = 0 
        }
    }

    option = {
        name = "easycheats_main_religions"
        
        trigger_event = {
            id = easycheats_main_religion.1
        }

        ai_chance = { 
            factor = 0 
        }
    }

    option = {
        name = "easycheats_main_provinces"
        
        trigger_event = {
            id = easycheats_main_province.1
        }

        ai_chance = { 
            factor = 0 
        }
    }    

    option = {
        name = "easycheats_main_pops"
        
        trigger_event = {
            id = easycheats_main.6
        }

        ai_chance = { 
            factor = 0 
        }
    }

    option = {
        name = "easycheats_main_government"
        
        trigger_event = {
            id = easycheats_main.9
        }

        ai_chance = { 
            factor = 0 
        }
    }

    option = {
        name = "easycheats_main_spawn"
        
        trigger_event = {
            id = easycheats_main_spawn.1
        }

        ai_chance = { 
            factor = 0 
        }
    }

    option = {
        name = "easycheats_main_placeholder_2"
        
        trigger_event = {
            id = easycheats_main.3
        }

        ai_chance = { 
            factor = 0 
        }
    }

    option = {
        name = "easycheats_main_modifiers"
        
        trigger_event = {
            id = easycheats_main.1
        }

        ai_chance = { 
            factor = 0 
        }
    }

    option = {
        name = "easycheats_main_break_alliance"
        
        random_neighbour_country = {
			limit = {               
                NOT = { alliance_with = root }
			}
			save_scope_as = easycheats_neighbor
		}

        if = {
            limit = {
                exists = scope:easycheats_neighbor
            }
            
            random_country = {                        
                limit = {
                    alliance_with = scope:easycheats_neighbor
                    NOT = { 
                        alliance_with = root
                    }
                }      
                save_scope_as = easycheats_ally    
            }
        } 

        if = {
            limit = {
                exists = scope:easycheats_neighbor
            }
            
            if = {
                limit = {
                    exists = scope:easycheats_ally
                }

                scope:easycheats_ally = {
                    break_alliance = scope:easycheats_neighbor
                } 
            }
        }
        trigger_event = {
            id = easycheats_main.3
        }

        ai_chance = { 
            factor = 0 
        }
    }

    option = {
        name = "easycheats_main_stats"
        
        trigger = {
            OR = {
                military_experience < 200
                political_influence < 500
                has_aggressive_expansion > 0
                has_war_exhaustion > 0
                tyranny > 0
                centralization < 100
                stability < 100
            }
        }

        if = {
            limit = {
                military_experience < 200
            }
            add_military_experience = 200
        } 
        if = {
            limit = {
                political_influence < 500
            }
            add_political_influence = 500
        } 
		if = {
            limit = {
                has_aggressive_expansion > 0
            }
            add_aggressive_expansion = -100
        }
        if = {
            limit = {
                has_war_exhaustion > 0
            }
            add_war_exhaustion = -100
        }
        if = {
            limit = {
                tyranny > 0
            }
            add_tyranny = -100
        }
        if = {
            limit = {
                centralization < 100
            }
            add_centralization = 100
        } 
        if = {
            limit = {
                stability < 100
            }
            add_stability = 100
        }
        trigger_event = {
            id = easycheats_main.3
        }

        ai_chance = { 
            factor = 0 
        }
    }

    option = {
        name = "easycheats_main_gold"
        
        add_treasury = 1000

        trigger_event = {
            id = easycheats_main.3
        }

        ai_chance = { 
            factor = 0 
        }
    }

    option = {
        name = "easycheats_main_manpower"
               
        add_manpower = 1000

        trigger_event = {
            id = easycheats_main.3
        }

        ai_chance = { 
            factor = 0 
        }
    }

    option = {
        name = "easycheats_common_random_colour"
        
        if = {
            limit = {
                var:easycheats_random_color = 0
            }
            change_country_color = "navy_blue"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 1
            }
            change_country_color = "ck2_blue"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 2
            }
            change_country_color = "ck2_red"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 3
            }
            change_country_color = "roman_red"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 4
            }
            change_country_color = "ck2_green"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 5
            }
            change_country_color = "green"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 6
            }
            change_country_color = "ck2_black"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 7
            }
            change_country_color = "dark_purple"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 8
            }
            change_country_color = "macedonian_blue"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 9
            }
            change_country_color = "samnite_green"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 10
            }
            change_country_color = "samnite_red"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 11
            }
            change_country_color = "athens_blue"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 12
            }
            change_country_color = "desaturated_green"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 13
            }
            change_country_color = "mid_grey"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 14
            }
            change_country_color = "dark_burgundy"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 15
            }
            change_country_color = "yellowish_grey"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 16
            }
            change_country_color = "red_nougat"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 17
            }
            change_country_color = "dark_chocolate"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 18
            }
            change_country_color = "rust_brown"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 19
            }
            change_country_color = "etruscan_blue"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 20
            }
            change_country_color = "phrygia_red"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 21
            }
            change_country_color = "pitch_black"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 22
            }
            change_country_color = "ocean_blue"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 23
            }
            change_country_color = "spartan_brown"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 24
            }
            change_country_color = "spartan_rust"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 25
            }
            change_country_color = "spartan_ocra"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 26
            }
            change_country_color = "dark_green"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 27
            }
            change_country_color = "maurya_brown"
        }
        else_if = {
            limit = {
                var:easycheats_random_color = 28
            }
            change_country_color = "dark_rust"
        }

        trigger_event = {
            id = easycheats_main.3
        }

        ai_chance = { 
            factor = 0 
        }
    }
}