﻿add_namespace = crystalemp

add_namespace = cryscr

############################################################
############################################################
############### Scroup Rudely Interrupts ######################
############################################################
############################################################

country_event = {
        id = cryscr.1
        title = cryscr.1.t
        desc = cryscr.1.d
        picture = GFX_event_winter_sun

        is_triggered_only = yes

        option = {
            name = cryscr.1.a
            add_political_power = 10
            set_country_flag = winter_solstice_planned
        }
    }
country_event = {
        id = cryscr.2
        title = cryscr.2.t
        desc = cryscr.2.d
        picture = GFX_event_winter_sun

        is_triggered_only = yes

        option = {
            name = cryscr.2.a
            add_political_power = 10
            add_popularity = { ideology = fascism popularity = 0.03 }
            add_popularity = { ideology = communism popularity = 0.05 }
            swap_ideas = { remove_idea = royal_family add_idea = royal_family2 }
        }
    }
country_event = {
        id = cryscr.3
        title = cryscr.3.t
        desc = cryscr.3.d
        picture = GFX_event_winter_sun

        trigger = {
            tag = CRY
            has_country_flag = winter_solstice_planned
            date > 1007.12.20
        }
        mean_time_to_happen =  { days = 1 }
        fire_only_once = yes

        option = {
            name = cryscr.3.a
            add_political_power = 250
            add_national_unity = 0.03
        }
    }
country_event = {
        id = cryscr.4
        title = cryscr.4.t
        desc = cryscr.4.d
        picture = GFX_event_winter_sun

        is_triggered_only = yes

        option = {
            name = cryscr.4.a
            add_political_power = 16
        }
    }
country_event = { ## Crysal Empire asks Equestria for Crysal Fair
        id = cryscr.5
        title = cryscr.5.t
        desc = cryscr.5.d
        picture = GFX_event_crystal_fair

        is_triggered_only = yes

        option = {
            name = cryscr.5.a
            EQS = {
                country_event = { id = cryscr.6 days = 1 }
            }
        }
    }
country_event = { ## Equestrian event from above
        id = cryscr.6
        title = cryscr.6.t
        desc = cryscr.6.d
        picture = GFX_event_crystal_fair

        is_triggered_only = yes

        option = {
            name = cryscr.6.a
            ai_chance = {
            base = 50
            modifier = {
                factor = 100
                is_historical_focus_on = yes
                }
            }
            CRY = {
                country_event = { id = cryscr.7 days = 1 }
            }
            add_political_power = -50
        }
        option = {
            name = cryscr.6.b
            ai_chance = {
            base = 50
            modifier = {
                factor = 0
                is_historical_focus_on = yes
                }
            }
            CRY = {
                country_event = { id = cryscr.8 days = 1 }
                add_opinion_modifier = { target = EQS modifier = eqs_refused_holding_games }
            }
        }
    }
country_event = { ## Equestria agrees
        id = cryscr.7
        title = cryscr.7.t
        desc = cryscr.7.d
        picture = GFX_event_crystal_fair

        is_triggered_only = yes

        option = {
            name = cryscr.7.a
            add_popularity = { ideology = democratic popularity = 0.1 }
            add_political_power = 50
            hidden_effect = {
                news_event = { id = news.4 days = 10 }
            }
        }
    }
country_event = { ## Equestria disagrees
        id = cryscr.8
        title = cryscr.8.t
        desc = cryscr.8.d
        picture = GFX_event_crystal_fair

        is_triggered_only = yes

        option = {
            name = cryscr.8.a
            trigger = { NOT = { has_dlc = "Together for Victory"} }
            add_political_power = -50
            add_national_unity = -0.05
            add_popularity = { ideology = fascism popularity = 0.05 }
            add_popularity = { ideology = communism popularity = 0.05 }
            add_popularity = { ideology = neutrality popularity = 0.05 }
        }
        option = {
            name = cryscr.8.a
            trigger = { has_dlc = "Together for Victory"}
            CRY = {
                add_autonomy_ratio = { value = -0.1 } }
            add_political_power = -50
            add_national_unity = -0.05
            add_popularity = { ideology = fascism popularity = 0.05 }
            add_popularity = { ideology = communism popularity = 0.05 }
            add_popularity = { ideology = neutrality popularity = 0.05 }
        }
    }
country_event = { ## Mi Amore Family Story
        id = cryscr.9
        title = cryscr.9.t
        desc = cryscr.9.d
        picture = GFX_event_mi_amore

        is_triggered_only = yes

        option = {
            name = cryscr.9.a
            swap_ideas = { remove_idea = royal_family2 add_idea = royal_family3 }
        }
    }
country_event = { ## GrandFestival
        id = cryscr.10
        title = cryscr.10.t
        desc = cryscr.10.d
        picture = GFX_event_mi_amore

        is_triggered_only = yes

        option = {
            name = cryscr.10.a
        }
    }
    ######################################################
country_event = { ## The Return of Sombra event chain
        id = cryscr.11
        title = cryscr.11.t
        desc = cryscr.11.d
        picture = GFX_event_crystal_city

        trigger = {
            tag = CRY
            has_completed_focus = CRY_crystallinganniversary
        }
        mean_time_to_happen = { days = 30 }
        fire_only_once = yes
        option = {
            name = cryscr.11.a
            hidden_effect = {
                country_event = { id = cryscr.12 days = 16 }
            }
        }
    }
country_event = { ## The Return of Sombra event chain
        id = cryscr.12
        title = cryscr.12.t
        desc = cryscr.12.d
        picture = GFX_event_crystal_city

        is_triggered_only = yes

        option = {
            name = cryscr.12.a
            custom_effect_tooltip = invitation_taken
            ai_chance = {
            base = 30
            modifier = {
                factor = 0
                is_historical_focus_on = yes
            }
        }
        hidden_effect = {
            country_event = {
                id = cryscr.13 hours = 1
                }
            }
        }
        option = {
            name = cryscr.12.b
            custom_effect_tooltip = invitation_decline
            ai_chance = {
            base = 70
            modifier = {
                factor = 100
                is_historical_focus_on = yes
            }
        }
        hidden_effect = {
            country_event = {
                id = cryscr.14 hours = 1
                }
            }
        }
    }
country_event = { ## Take the invitation
        id = cryscr.13
        title = cryscr.13.t
        desc = cryscr.13.d
        picture = GFX_event_crystal_city

        is_triggered_only = yes

        option = {
            name = cryscr.13.a
            custom_effect_tooltip = invitation_saved
            set_country_flag = invitation_to_join_the_club
            ai_chance = {
            base = 70
            modifier = {
                factor = 0
                is_historical_focus_on = yes
                }
            }
        }
        option = {
            name = cryscr.13.b
            custom_effect_tooltip = invitation_thrown_away
            ai_chance = {
            base = 30
            modifier = {
                factor = 100
                is_historical_focus_on = yes
                }
            }
        }
    }
country_event = { ## Decline the invitation
        id = cryscr.14
        title = cryscr.14.t
        desc = cryscr.14.d
        picture = GFX_event_crystal_city

        is_triggered_only = yes

        option = {
            name = cryscr.14.a
        }
    }
country_event = { ## Walk to the club place
        id = cryscr.15
        title = cryscr.15.t
        desc = cryscr.15.d
        picture = GFX_event_apartment_club

        is_triggered_only = yes

        option = {
            name = cryscr.15.a
            custom_effect_tooltip = walk_into_the_club
            hidden_effect = {
                country_event = { id = cryscr.16 hours = 1 }
            }
            ai_chance = { factor = 100 }
        }
        option = {
            name = cryscr.15.b
            custom_effect_tooltip = walk_away
            ai_chance = { factor = 0 }
        }
    }
country_event = { ## Into the club
        id = cryscr.16
        title = cryscr.16.t
        desc = cryscr.16.d
        picture = GFX_event_apartment_club

        is_triggered_only = yes

        option = {
            name = cryscr.16.a
            hidden_effect = {
                country_event = { id = cryscr.17 hours = 1 }
            }
        }
    }
country_event = { ## Inside the club
        id = cryscr.17
        title = cryscr.17.t
        desc = cryscr.17.d
        picture = GFX_event_apartment_club

        is_triggered_only = yes

        option = {
            name = cryscr.17.a
            hidden_effect = {
                country_event = { id = cryscr.18 hours = 1 }
            }
        }
    }
country_event = { ## The Story
        id = cryscr.18
        title = cryscr.18.t
        desc = cryscr.18.d
        picture = GFX_event_crystal_city

        is_triggered_only = yes

        option = {
            name = cryscr.18.a
            hidden_effect = {
                country_event = { id = cryscr.19 hours = 1 }
            }
            ai_chance = { factor = 100 }
        }
    }
country_event = { ## Post-Story
        id = cryscr.19
        title = cryscr.19.t
        desc = cryscr.19.d
        picture = GFX_event_apartment_club

        is_triggered_only = yes

        option = {
            name = cryscr.19.a
            hidden_effect = {
                country_event = { id = cryscr.20 hours = 2 }
            }
        }
    }
country_event = { ## Out of the club
        id = cryscr.20
        title = cryscr.20.t
        desc = cryscr.20.d
        picture = GFX_event_crystal_city

        is_triggered_only = yes

        option = {
            name = cryscr.20.a
            custom_effect_tooltip = join_the_club_tlp
            set_country_flag = joined_the_club
            ai_chance = { factor = 100 }
        }
        option = {
            name = cryscr.20.b
            custom_effect_tooltip = reported_sombras
            ai_chance = { factor = 0 }
            hidden_effect = {
                country_event = {
                    id = cryscr.21 hours = 10
                }
            }
        }
        option = {
            name = cryscr.20.c
            custom_effect_tooltip = not_reported_sombras
            set_country_flag = club_not_arrested
            hidden_effect = {
                swap_ideas = { remove_idea = sombra_threat add_idea = sombra_threat2 }
            }
            ai_chance = { factor = 0 }
        }
    }
country_event = { ## Organization Arrested
        id = cryscr.21
        title = cryscr.21.t
        desc = cryscr.21.d
        picture = GFX_event_crystal_city

        is_triggered_only = yes

        option = {
            name = cryscr.21.a
            add_political_power = 20
            ai_chance = { factor = 100 }
            custom_effect_tooltip = less_sombra_tlp
            hidden_effect = {
                swap_ideas = { remove_idea = sombra_threat add_idea = sombra_threat_reported }
            }
        }
    }
country_event = { ## Sombra Civil War if fascism support is high enough after not reporting the club
        id = cryscr.22
        title = cryscr.22.t
        desc = cryscr.22.d
        picture = GFX_event_sombra_return

        trigger = {
            tag = CRY
            fascism > 0.5
            has_country_flag = club_not_arrested
        }
        mean_time_to_happen = { days = 5 }
        fire_only_once = yes
        option = {
            name = cryscr.22.a
            start_civil_war = {
                ideology = fascism
                ruling_party = democratic
                size = 0.5
            }
        }
    }
country_event = { ## Library Work Focus
        id = cryscr.23
        title = cryscr.23.t
        desc = cryscr.23.d
        picture = GFX_event_apartment_club

        is_triggered_only = yes

        option = {
            name = cryscr.23.a
            hidden_effect = {
                country_event = { id = cryscr.24 hours = 5 }
            }
        }
    }
country_event = { ## Into the library
        id = cryscr.24
        title = cryscr.24.t
        desc = cryscr.24.d
        picture = GFX_event_apartment_club

        is_triggered_only = yes

        option = {
            name = cryscr.24.a
            hidden_effect = {
                country_event = { id = cryscr.25 hours = 23 }
            }
        }
    }
country_event = { ## Into the library
        id = cryscr.25
        title = cryscr.25.t
        desc = cryscr.25.d
        picture = GFX_event_crystal_library

        is_triggered_only = yes

        option = {
            name = cryscr.25.a
            hidden_effect = {
                country_event = { id = cryscr.26 hours = 1 }
            }
        }
    }
############################################################
############################################################
############### Scroup Finishes ##############################
############################################################
############################################################

country_event = {
    id = crystalemp.1
    title = crystalemp.1.t
    desc = crystalemp.1.d
    picture = GFX_event_crystal_fair
 
    trigger = {
        has_global_flag = crystal_fair
        tag = CRY
    }
    mean_time_to_happen = { days = 5 }

    fire_only_once = yes
 
    option = {
    name = crystalemp.1.a
    add_political_power = 300
    add_national_unity = 0.07
    }
}
## Case of Com Civil War in EQS
country_event = {
    id = crystalemp.2
    title = crystalemp.2.t
    desc = crystalemp.2.d
    picture = report_event_technical
 
    trigger = {
        tag = CRY
        EQS = {
            has_civil_war = yes
            has_government = communism
        }
    }
    mean_time_to_happen = { days = 2 }

    fire_only_once = yes
 
    option = {
    name = crystalemp.2.a
    trigger = { is_ai = no }
    set_cosmetic_tag = CRY_COM
    hidden_effect = {
        set_capital = 152
        start_civil_war = {
                ruling_party = communism
                ideology = democratic
                size = 0.6
                states = { 147 144 142 141 55 77 64 98 236 150 }
                capital = 53
            }
        random_other_country = {
            limit = {
                has_government = democratic
                original_tag = CRY
                has_civil_war = yes
            }
            set_cosmetic_tag = CRY_DEM
            }
        }
    }
    option = {
    name = crystalemp.2.b
    trigger = { is_ai = no }
    hidden_effect = {
        start_civil_war = {
                ruling_party = democratic
                ideology = communism
                size = 0.4
                capital = 152
                states = { 145 152 151 149 146 324 143 140 139 318 }
            }
        random_other_country = {
            limit = {
                has_government = communism
                original_tag = CRY
                has_civil_war = yes
            }
            set_cosmetic_tag = CRY_COM
            }
        }
    }
}
country_event = { ## STG/EQS asks of Union
    id = crystalemp.3
    title = crystalemp.3.t
    desc = crystalemp.3.d
    picture = report_event_technical
 
    is_triggered_only = yes
 
    option = {
    name = crystalemp.3.a
    STG = {
        country_event = {
            id = stalliongrad.63 days = 2
            }
        }  
    }
}
country_event = { ## STG/EQS asks of Union
    id = crystalemp.4
    title = crystalemp.4.t
    desc = crystalemp.4.d
    picture = report_event_technical
 
    is_triggered_only = yes
 
    option = {
    name = crystalemp.4.a
    ai_chance = { factor = 100 }
    EQS = {
        country_event = { id = eqscom.16 days = 1 }
        }
    }
    option = {
    name = crystalemp.4.b
    ai_chance = { factor = 0 }
    add_political_power = 200
    }
}
###Sombra Events (revolt)
country_event = { #cry_umbruminitial info
	id = crystalemp.5
	title = crystalemp.5.t
	desc = crystalemp.5.d
	picture = report_event_technical

	is_triggered_only = yes

	option = {
	name = crystalemp.5.a 
	country_event = { id = crystalemp.6 days = 7}
	}
}
country_event = { #Possesed ponies. What to do?
	id = crystalemp.6
	title = crystalemp.6.t
	desc = crystalemp.6.d
	picture = report_event_technical

	is_triggered_only = yes
	fire_only_once = yes

	option = { #Look for cure
	name = crystalemp.6.a
	ai_chance = { factor = 100 }
	set_country_flag = cry_cured
	country_event = { id = crystalemp.11 days = 21}
	}

	option = { #Isolate ponies
	name = crystalemp.6.b
	ai_chance = { factor = 0 }
	set_country_flag = cry_isolated
	country_event = { id = crystalemp.7 days = 1}
	}
}
country_event = { #More possesed
	id = crystalemp.7
	title = crystalemp.7.t
	desc = crystalemp.7.d
	picture = report_event_technical

	is_triggered_only = yes
	fire_only_once = yes

	option = {
	name = crystalemp.7.a
	complete_national_focus = cry_umbrummilitia
	add_ideas = sombrish_resistance
	}
}
country_event = {
	id = crystalemp.8
	title = crystalemp.8.t
	desc = crystalemp.8.d
	picture = report_event_technical

	is_triggered_only = yes

	option = {
	name = crystalemp.8.a
	
	}
}

    country_event = { # Revolution
        id = crystalemp.9
        title = crystalemp.9.t
        desc = crystalemp.9.d
        picture = report_event_technical

        is_triggered_only = yes

        option = {
            name = crystalemp.9.a
            set_politics = {
                ruling_party = neutrality 
                elections_allowed = no 
            }
            remove_ideas = political_turmoil
            add_ideas = royalfamily_imprisioned
            swap_ideas = { remove_idea = idea_old_dignity add_idea = idea_old_dignity_restored } 

            remove_unit_leader = 1043

            EQS = { country_event = { id = equestria.45 days = 10 } }
            if = {
               limit = { has_completed_focus = CRY_aristocracy }
               swap_ideas = { remove_idea = royal_family add_idea = aristrocrats_ruling } 
               set_cosmetic_tag = CRY_neutrality 
            }
            if = {
               limit = { has_completed_focus = CRY_militia }
               swap_ideas = { remove_idea = royal_family add_idea = militia_ruling } 
               set_cosmetic_tag = CRY_communism
            }
        }
    }

    country_event = {
        id = crystalemp.10
        title = crystalemp.10.t
        desc = crystalemp.10.d
        picture = report_event_technical

        is_triggered_only = yes

        option = {
            name = crystalemp.10.a
            remove_ideas = royalfamily_imprisioned
            EQS = { add_opinion_modifier  = { target = CRY modifier = cry_accepted_demmands } }
            ai_chance = { factor = 60 }

        }
        option = {
            name = crystalemp.10.b
            EQS = { 
                add_opinion_modifier  = { 
                    target = CRY 
                    modifier = cry_refused_demmands 
                }
            }
            
            custom_effect_tooltip = crystalemp.10.b.tt
            ai_chance = { factor = 40 }
        }
    }

    country_event = {
        id = crystalemp.11
        title = crystalemp.11.t
        desc = crystalemp.11.d
        picture = report_event_technical

        is_triggered_only = yes

        trigger = { has_country_flag = cry_cured}

        option = {
            name = crystalemp.11.a
            complete_national_focus = CRY_umbrumdefeat
        }
    }

    country_event = { #Independence Event / SEND TO EQS!
        id = crystalemp.12
        title = crystalemp.12.t
        desc = crystalemp.12.d
        picture = report_event_technical

        is_triggered_only = yes

        option = {
            name = crystalemp.12.a
            end_puppet = CRY
            set_autonomy = { target = CRY autonomy_state = autonomy_free }
            ai_chance = { factor = 70 }
        }
        option = {
            name = crystalemp.12.b
            end_puppet = CRY
            set_autonomy = { target = CRY autonomy_state = autonomy_free }
            create_wargoal = { type = puppet_wargoal_focus target = CRY }
            ai_chance = { factor = 30 }
        }
    }

    country_event = { # Equestria isolates
        id = crystalemp.13
        title = crystalemp.13.t
        desc = crystalemp.13.d
        picture = report_event_technical

        is_triggered_only = yes

        option = {
            name = crystalemp.13.a
            add_ideas = { isolated }
        }

        option = {
            name = crystalemp.13.b
            remove_ideas = royalfamily_imprisioned
        }
    }
    }
