crisis = {

	draft_dodging = {

		icon = generic_civil_support

		allowed = {
			always = yes
		}

		available = {
			OR = {
				has_civil_war = yes
				has_country_flag = crisis_in_progress
			}
			NOT = {
				has_country_flag = crisis_solution_in_progress
			}
			OR = {
				has_idea = draft_dodging
				has_idea = draft_dodging_2
				has_idea = draft_dodging_3
			}
		}

		cost = 0
		ai_will_do = {
			factor = 1
		}

		visible = {
			OR = {
				has_civil_war = yes
				has_country_flag = crisis_in_progress
			}
			NOT = {
				has_country_flag = crisis_solution_in_progress
			}
			OR = {
				has_idea = draft_dodging
				has_idea = draft_dodging_2
				has_idea = draft_dodging_3
			}
									
		}

		complete_effect = {
			country_event = stability.21
		}
	}

	strikes_1 = {

		icon = generic_civil_support

		allowed = {
			always = yes
		}

		available = {
			OR = {
				has_civil_war = yes
				has_country_flag = crisis_in_progress
			}
			NOT = {
				has_country_flag = crisis_solution_in_progress
			}
			OR = {
				has_idea = strikes_1
				has_idea = strikes_2
				has_idea = strikes_3
			}
		}

		cost = 0
		ai_will_do = {
			factor = 1
			modifier = {
				has_idea = strikes_3
				factor = 500
			}
		}
		
		visible = {
			OR = {
				has_idea = strikes_1
				has_idea = strikes_2
				has_idea = strikes_3
			}
			OR = {
				has_country_flag = crisis_in_progress
				has_civil_war = yes
			}
			NOT = {
				has_country_flag = crisis_solution_in_progress
			}
		}


		complete_effect = {
			country_event = stability.22
		}
	}
	
	draft_dodging_mission = {

		icon = generic_civil_support
		
		available = {
			NOT = {
				OR = {
					has_idea = draft_dodging
					has_idea = draft_dodging_2
					has_idea = draft_dodging_3
				}
			}
		}

		days_mission_timeout = 120

		activation = {
			OR = {
				has_idea = draft_dodging
				has_idea = draft_dodging_2
				has_idea = draft_dodging_3
			}
		}
		visible = {
			OR = {
				has_idea = draft_dodging
				has_idea = draft_dodging_2
				has_idea = draft_dodging_3
			}
		}
		complete_effect = {
			
		}
		timeout_effect = {
			if = {
				limit = {
					has_idea = draft_dodging_3
					has_stability < 0.21
					NOT = {
						has_government = communism
					}
				}
				start_civil_war = {
					ideology = communism
				}
			}
			if = {
				limit = {
					has_idea = draft_dodging_3
					has_stability < 0.21
					has_government = communism
					
				}
				start_civil_war = {
					ideology = democratic
				}
			}
			if = {
				limit = {
					has_idea = draft_dodging_3
					has_stability < 0.41
					NOT = {
						has_government = communism
					}
				}
				add_popularity = { ideology = communism popularity = 0.1}
			}
			if = {
				limit = {
					has_idea = draft_dodging_3
					has_stability < 0.41
					has_government = communism
					
				}
				add_popularity = { ideology = democratic popularity = 0.1}
			}
			if = {
				limit = {
					has_idea = draft_dodging_3
					has_stability > 0.4
				}
				add_stability = -0.05
			}
			if = {
				limit = { 
					has_idea = draft_dodging_2
				}
				swap_ideas = {
					remove_idea = draft_dodging_2
					add_idea = draft_dodging_3
				}
			}
			if = {
				limit = { 
					has_idea = draft_dodging
				}
				swap_ideas = {
					remove_idea = draft_dodging
					add_idea = draft_dodging_2
				}
			}	
		}
	}
	strikes_mission = {

		icon = generic_civil_support
		
		available = {
			NOT = {
				OR = {
					has_idea = strikes_1
					has_idea = strikes_2
					has_idea = strikes_3
				}
				has_country_flag = crisis_in_progress
			}
		}

		days_mission_timeout = 120

		activation = {
			OR = {
				has_idea = strikes_1
				has_idea = strikes_2
				has_idea = strikes_3
			}
			OR = {
				has_country_flag = crisis_in_progress #needed to avoid doubling up with demob strikes
				has_civil_war = yes
			}
		}
		visible = {
			OR = {
				has_idea = strikes_1 
				has_idea = strikes_2
				has_idea = strikes_3	
			}
			OR = {
				has_country_flag = crisis_in_progress
				has_civil_war = yes
			}
		}
		complete_effect = {
			
		}
		timeout_effect = {
			if = {
				limit = {
					has_idea = strikes_3
					has_stability < 0.21
					NOT = {
						has_government = communism
					}
				}
				start_civil_war = {
					ideology = communism
				}
			}
			if = {
				limit = {
					has_idea = strikes_3
					has_stability < 0.21
					has_government = communism
					
				}
				start_civil_war = {
					ideology = democratic
				}
			}
			if = {
				limit = {
					has_idea = strikes_3
					has_stability < 0.41
					NOT = {
						has_government = communism
					}
				}
				add_popularity = { ideology = communism popularity = 0.1}
			}
			if = {
				limit = {
					has_idea = strikes_3
					has_stability < 0.41
					has_government = communism
					
				}
				add_popularity = { ideology = democratic popularity = 0.1}
			}
			if = {
				limit = {
					has_idea = strikes_3
					has_stability > 0.4
				}
				add_stability = -0.05
			}
			if = {
				limit = { 
					has_idea = strikes_2
				}
				swap_ideas = {
					remove_idea = strikes_2
					add_idea = strikes_3
				}
			}
			if = {
				limit = { 
					has_idea = strikes_1
				}
				swap_ideas = {
					remove_idea = strikes_1
					add_idea = strikes_2
				}
			}	
		}
	}
	mutiny_1 = {

		icon = generic_civil_support

		allowed = {
			always = yes
		}

		available = {
			OR = {
				has_country_flag = crisis_in_progress #needed to avoid doubling up with demob strikes
				has_civil_war = yes
			}
			OR = {
				has_idea = mutiny_1
				has_idea = mutiny_2
				has_idea = mutiny_3
			}
		}

		cost = 5
		ai_will_do = {
			factor = 1
		}

		visible = {
			OR = {
				has_country_flag = crisis_in_progress #needed to avoid doubling up with demob strikes
				has_civil_war = yes
			}
			NOT = {
				has_country_flag = crisis_solution_in_progress
			}
			OR = {
				has_idea = mutiny_1
				has_idea = mutiny_2
				has_idea = mutiny_3
			}
		}

		complete_effect = {
			country_event = stability.23
		}
	}
	mutiny_mission = {

		icon = generic_civil_support
		
		available = {
			NOT = {
				OR = {
					has_idea = mutiny_1
					has_idea = mutiny_2
					has_idea = mutiny_3
				}
				has_country_flag = crisis_in_progress
			}
		}

		days_mission_timeout = 120

		activation = {
			OR = {
				has_idea = mutiny_1
				has_idea = mutiny_2
				has_idea = mutiny_3
			}
			OR = {
				has_country_flag = crisis_in_progress #needed to avoid doubling up with demob strikes
				has_civil_war = yes
			} 
		}
		visible = {
			OR = {
				has_idea = mutiny_1 
				has_idea = mutiny_2
				has_idea = mutiny_3	
			}
			OR = {
				has_country_flag = crisis_in_progress #needed to avoid doubling up with demob strikes
				has_civil_war = yes
			}
		}
		complete_effect = {
			
		}
		timeout_effect = {
			if = {
				limit = {
					has_idea = mutiny_3
					has_stability < 0.21
					NOT = {
						has_government = communism
					}
				}
				start_civil_war = {
					ideology = communism
				}
			}
			if = {
				limit = {
					has_idea = mutiny_3
					has_stability < 0.21
					has_government = communism
					
				}
				start_civil_war = {
					ideology = democratic
				}
			}
			if = {
				limit = {
					has_idea = mutiny_3
					has_stability < 0.41
					NOT = {
						has_government = communism
					}
				}
				add_popularity = { ideology = communism popularity = 0.1}
			}
			if = {
				limit = {
					has_idea = mutiny_3
					has_stability < 0.41
					has_government = communism
					
				}
				add_popularity = { ideology = democratic popularity = 0.1}
			}
			if = {
				limit = {
					has_idea = mutiny_3
					has_stability > 0.4
				}
				add_stability = -0.1
			}
			if = {
				limit = { 
					has_idea = mutiny_2
				}
				swap_ideas = {
					remove_idea = mutiny_2
					add_idea = mutiny_3
				}
			}
			if = {
				limit = { 
					has_idea = mutiny_1
				}
				swap_ideas = {
					remove_idea = mutiny_1
					add_idea = mutiny_2
				}
			}	
		}
	}
}
demobilization = {
	demobilization_economic = {

		icon = generic_industry
		
		is_good = no

		available = {
			has_unsupported_economic_law = yes
			has_war = no
		}

		activation = {
			has_unsupported_economic_law = yes
			has_war = no
		}
		cost = 25

		visible = {
			has_war = no
			has_unsupported_economic_law = yes
		}
		complete_effect = {
			if = {
				limit = {
					has_war_support < 0.15
				}
				add_ideas = civilian_economy
			}
			else_if = {
				limit = {
					has_war_support < 0.25
				}
				add_ideas = low_economic_mobilisation
			}
			else_if = {
				limit = {
					has_war_support < 0.5
				}
				add_ideas = partial_economic_mobilisation
			}
			else_if = {
				limit = {
				   OR = { has_war_support < 0.8 has_war = no }
				}
				add_ideas = war_economy
			}
			if = {
				limit = {
					has_idea = strikes_1
				}
				remove_ideas = strikes_1
			}
			if = {
				limit = {
					has_idea = strikes_2
				}
				remove_ideas = strikes_2
			}
			if = {
				limit = {
					has_idea = strikes_3
				}
				remove_ideas = strikes_3
			}
		}
		ai_will_do = {
			factor = 500 #should really get on this
		}
		
	}
	demob_economic_mission = {
		available = {
			OR = {
				has_unsupported_economic_law = no
				has_war = yes
			}
		}

		activation = {
			has_unsupported_economic_law = yes
			has_war = no
			NOT = {
				original_tag = SWE
				SWE = { has_completed_focus = SWE_totalforsvar }
			}
		}
		icon = revolt
		is_good = no
		days_mission_timeout = 180
		complete_effect = {
			if = {
				limit = {
					has_idea = strikes_1
				}
				remove_ideas = strikes_1
			}
			if = {
				limit = {
					has_idea = strikes_2
				}
				remove_ideas = strikes_2
			}
			if = {
				limit = {
					has_idea = strikes_3
				}
				remove_ideas = strikes_3
			}
		}
		timeout_effect = {
			activate_mission = demob_economic_mission
			if = {
				limit = {
					has_idea = strikes_3
					has_stability < 0.21
					NOT = {
						has_government = communism
					}
				}
				start_civil_war = {
					ideology = communism
				}
			}
			if = {
				limit = {
					has_idea = strikes_3
					has_stability < 0.21
					has_government = communism
					
				}
				start_civil_war = {
					ideology = democratic
				}
			}
			if = {
				limit = {
					has_idea = strikes_3
					has_stability < 0.41
					NOT = {
						has_government = communism
					}
				}
				add_popularity = { ideology = communism popularity = 0.1}
			}
			if = {
				limit = {
					has_idea = strikes_3
					has_stability < 0.41
					has_government = communism
					
				}
				add_popularity = { ideology = democratic popularity = 0.1}
			}
			if = {
				limit = {
					has_idea = strikes_3
					has_stability > 0.4
				}
				add_stability = -0.05
			}
			if = {
				limit = { 
					has_idea = strikes_2
				}
				swap_ideas = {
					remove_idea = strikes_2
					add_idea = strikes_3
				}
			}
			if = {
				limit = { 
					has_idea = strikes_1
				}
				swap_ideas = {
					remove_idea = strikes_1
					add_idea = strikes_2
				}
			}
			if = {
				limit = { 
					NOT = { 
						OR = {
							has_idea = strikes_1
							has_idea = strikes_2
							has_idea = strikes_3
						}
					}
				}
				add_ideas = strikes_1
			}	
		}
	}
	demobilization_manpower = {

		icon = generic_prepare_civil_war

		icon = revolt
		is_good = no

		available = {
			has_unsupported_manpower_law = yes
			has_war = no
		}

		allowed = {
			always = yes
		}

		cost = 25
		ai_will_do = {
			factor = 500
		}
		

		visible = {
			has_unsupported_manpower_law = yes
			has_war = no
			if = {
				limit = { original_tag = GRE }
				NOT = {
					has_completed_focus = GRE_request_communist_support
				}
			}

		}
		complete_effect = {
			if = {
				limit = {
					has_war_support < 0.15
				}
				add_ideas = volunteer_only
			}
			else_if = {
				limit = {
					has_war_support < 0.3
				}
				add_ideas = limited_conscription
			}
			else_if = {
				limit = {
					has_war_support < 0.7
				}
				add_ideas = extensive_conscription
			}
			else_if = {
				limit = {
					has_war_support < 0.95
				}
				add_ideas = service_by_requirement
			}
		}

		

	}
	demob_manpower_mission = {

		icon = revolt
		is_good = no
		days_mission_timeout = 180
		available = {
			OR = {
				has_unsupported_manpower_law = no
				has_war = yes
			}
		}
		activation = {
			has_unsupported_manpower_law = yes
			has_war = no
			if = {
				limit = {
					original_tag = GRE
				}
				NOT = {
					has_completed_focus = GRE_request_communist_support
				}
			}
		}
		visible = {
			if = {
				limit = {
					original_tag = GRE
				}
				NOT = {
					has_completed_focus = GRE_request_communist_support #put here in lieu of a cancel trigger
				}
			}		
		}
		cancel_if_not_visible = yes
		timeout_effect = {
			if = {
				limit = {
					has_government = communism
					has_stability < 0.2
				}
				start_civil_war = {
					ideology = democratic
				}
			}
			if = {
				limit = {
					NOT = { has_government = communism }
					has_stability < 0.3
				}
				start_civil_war = {
					ideology = communism
				}
			}
			if = {
				limit = {
					has_stability > 0.2
				}
				add_stability = -0.05
			}
			if = {
				limit = {
					has_government = communism
				}
				add_popularity = { ideology = democratic popularity = 0.05 }
			}
			if = {
				limit = {
					NOT = { has_government = communism }
				}
				add_popularity = { ideology = communism popularity = 0.05 }
			}
		}
	}
}