###########################
# Gray Ukraine Events
###########################

add_namespace = grayukraine

# Proposition for Kazakhstan
country_event = {
	id = grayukraine.1
	title = grayukraine.1.t
	desc = grayukraine.1.d

	fire_only_once = yes

	mean_time_to_happen = {	days = 7	}

	trigger = {
		tag = KAZ
		any_other_country = {
			original_tag = SOV
			has_war_with = KAZ 
		}
		UKR = { 
			exists = yes
			NOT = { has_war_with = KAZ }
			NOT = { has_completed_focus = UKR_purge  }
		}
		KAZ = {
			OR = {
				controls_state = 583
				controls_state = 590
				controls_state = 882
			}
		}
	}

	option = { # yes
		name = grayukraine.1.a
		ai_chance = {
			base = 100
		}
		UKR = { country_event = { id = grayukraine.2 hours = 8 } }
	}

	option = { # no
		name = grayukraine.1.b
		ai_chance = {
			base = 0
		}
	}
}
# Choice for Ukraine
country_event = {
	id = grayukraine.2
	title = grayukraine.2.t
	desc = grayukraine.2.d

	is_triggered_only = yes

	option = {
		name = grayukraine.2.a
		ai_chance = {
			factor = 90
			modifier = {
				factor = 0
				has_completed_focus = UKR_purge
			}
		}
		set_country_flag = UKR_support_for_gray_ukraine
		custom_effect_tooltip = UKR_additional_decisions
	}

	option = {
		name = grayukraine.2.b
		ai_chance = {
			factor = 10
		}
	}
}
# Arrived equipment from Ukraine, forming SKL
country_event = {
	id = grayukraine.3
	title = grayukraine.3.t
	desc = grayukraine.3.d

	is_triggered_only = yes

	option = {
		name = grayukraine.3.a
		SKL = { 
			add_state_core = 882
			add_state_core = 583
			add_state_core = 590
		}
		division_template = {
			name = "Povstanskyi polk"
			priority = 1
			regiments = {
				militia = { x = 0 y = 0 }
				militia = { x = 0 y = 1 }
				militia = { x = 0 y = 2 }
				militia = { x = 0 y = 3 }
				militia = { x = 0 y = 4 }
			}
		}
		division_template = {
			name = "Kavaleriyska Brihada"
			priority = 1
			regiments = {
				cavalry = { x = 0 y = 0 }
				cavalry = { x = 0 y = 1 }
				cavalry = { x = 0 y = 2 }
			}
		}
		if = {
			limit = {
				583 = { is_owned_and_controlled_by = ROOT }
			}
			SKL = { 
				transfer_state = 583
			}
			583 = {
				create_unit = {
					division = "name = \"2iy Ukrainskyi striletskyi polk\" division_template = \"Povstanskyi polk\" start_experience_factor = 0.3 start_equipment_factor = 1"
					owner = SKL
					prioritize_location = 10312
				}
				create_unit = {
					division = "name = \"Kurin imeni T.Shevchenka\" division_template = \"Kavaleriyska Brihada\" start_experience_factor = 0.3 start_equipment_factor = 1"
					owner = SKL
					prioritize_location = 12170
				}
			}
		}
		if = {
			limit = {
				590 = { is_owned_and_controlled_by = ROOT }
			}
			SKL = { 
				transfer_state = 590
			}
			590 = {
				create_unit = {
					division = "name = \"1iy Ukrainskyi pihotnyi polk imeni P.Sahaidachnogo\" division_template = \"Povstanskyi polk\" start_experience_factor = 0.3 start_equipment_factor = 1"
					owner = SKL
					prioritize_location = 433
				}
				create_unit = {
					division = "name = \"Kurin imeni M.Zaliznyaka\" division_template = \"Kavaleriyska Brihada\" start_experience_factor = 0.3 start_equipment_factor = 1"
					owner = SKL
					prioritize_location = 1418
				}
			}
		}
		if = {
			limit = {
				882 = { is_owned_and_controlled_by = ROOT }
			}
			SKL = { 
				transfer_state = 882
			}
			882 = {
				create_unit = {
					division = "name = \"1iy Karpatsko-Russkyi polk\" division_template = \"Povstanskyi polk\" start_experience_factor = 0.3 start_equipment_factor = 1"
					owner = SKL
					prioritize_location = 7708
				}
				create_unit = {
					division = "name = \"Polk imeni P.Doroshenka\" division_template = \"Povstanskyi polk\" start_experience_factor = 0.3 start_equipment_factor = 1"
					owner = SKL
					prioritize_location = 4685
				}
			}
		}
		puppet = SKL
		SKL = {
			set_politics = { ruling_party = neutrality elections_allowed = no }
			set_cosmetic_tag = SKL_BEGIN
			add_ideas = KUB_ZKL_liberation_movement
			country_event = { id = grayukraine.16 days = 3 }
		}
		FROM = {
			add_ai_strategy = {
				type = send_volunteers_desire
				id = SKL
				value = 200
			}
			add_ai_strategy = {
				type = support
				id = SKL
				value = 200
			} 
		}
	}
}
# Election in Rada
country_event = {
	id = grayukraine.4
	title = grayukraine.4.t
	desc = grayukraine.4.d
	
	is_triggered_only = yes

	option = {
		name = grayukraine.4.a 
		ai_chance = {
			factor = 40
			modifier = {
				factor = 0
				NOT = { country_exists = UKR }
			}
			modifier = {
				factor = 2
				UKR = { is_major = yes }
			}
			modifier = {
				factor = 2
				has_opinion = { target = UKR value > 10 }
			}
		}
		complete_national_focus = SKL_ukrainian_path
	}
	option = {
		name = grayukraine.4.b
		ai_chance = {
			factor = 30
		}
		complete_national_focus = SKL_autonomy_path
	}
	option = {
		name = grayukraine.4.c
		ai_chance = {
			factor = 30
		}
		complete_national_focus = SKL_kazakhs_path
	}
}
# New wave of settlers
country_event = {
	id = grayukraine.5
	title = grayukraine.5.t
	desc = grayukraine.5.d
	
	is_triggered_only = yes

	option = {
		name = grayukraine.5.a 
		ai_chance = {
			factor = 30
		}
		if = {
			limit = { num_of_controlled_states > 0 }
			activate_decision = SKL_wave_of_settlers
		}
	}
}
# Gray Ukraine want be annexed by Ukraine
country_event = {
	id = grayukraine.6
	title = grayukraine.6.t
	desc = grayukraine.6.d
	picture = GFX_report_event_generic_peaceful_annexation

	is_triggered_only = yes
	
	option = {
		ai_chance = {
			base = 100
		}
		name = grayukraine.6.a
		effect_tooltip = {
			UKR = { annex_country = { target = SKL } }
		}
		if = {
			limit = {
				FROM = { 
					is_puppet = yes 
					NOT = { is_puppet_of = UKR }
				}
			}
			FROM = {
				OVERLORD = {
					country_event = { id = grayukraine.11 days = 1 }
				}
			}
		}
		FROM = { 
			country_event = { id = grayukraine.7 }
		}
		set_country_flag = UKR_can_integrated_siberia
		custom_effect_tooltip = UKR_additional_decisions
	}

	option = {
		ai_chance = {
			base = 0
		}
		name = grayukraine.6.b
		FROM = { 
			country_event = { id = grayukraine.8 }
		}
	}
}
# Gray Ukraine joined to Ukraine
country_event = {
	id = grayukraine.7
	title = grayukraine.7.t
	desc = grayukraine.7.d
	picture = GFX_report_event_generic_peaceful_annexation
	
	is_triggered_only = yes
	
	option = {
		name = grayukraine.7.a
		every_unit_leader = {
			set_nationality = UKR
		}
		every_navy_leader = {
			set_nationality = UKR
		}
		FROM = { annex_country = { target = ROOT transfer_troops = yes } }
		custom_effect_tooltip = GAME_OVER_TT
	}
}
# Ukraine refuse annexation
country_event = {
	id = grayukraine.8
	title = grayukraine.8.t
	desc = grayukraine.8.d

	is_triggered_only = yes

	option = {
		name = grayukraine.8.a
	}
}
# Bonus for overlord from poligons
country_event = {
	id = grayukraine.9
	title = grayukraine.9.t
	desc = grayukraine.9.d

	is_triggered_only = yes

	option = {
		name = grayukraine.9.a
		add_tech_bonus = {
			name = SKL_poligons_bonus
			bonus = 1.0
			uses = 1
			category = rocketry
			category = nuclear
		}
	}
}
# SKL is controller of new Siberian region and give core = message for SKL
country_event = {
	id = grayukraine.10
	title = grayukraine.10.t
	desc = grayukraine.10.d

	is_triggered_only = yes

	option = {
		name = grayukraine.10.a
	}
}
# Gray Ukraine want be annexed by Ukraine - choice for current OVERLORD
country_event = {
	id = grayukraine.11
	title = grayukraine.11.t
	desc = grayukraine.11.d

	is_triggered_only = yes
	
	option = {
		ai_chance = {
			factor = 30
			modifier = {
				factor = 0.5
				strength_ratio = {
					tag = FROM
					ratio < 0.7
				}
			}
		}
		name = grayukraine.11.a
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 583 590 882 }
		}
		add_ai_strategy = {
			type = antagonize
			id = FROM
			value = 200
		}
		FROM = { 
			country_event = { id = grayukraine.12 }
		}
	}

	option = {
		ai_chance = {
			factor = 70
		}
		name = grayukraine.11.b
		FROM = { 
			country_event = { id = grayukraine.13 }
		}
	}
}
# Former overlord of SKL want war - message for Ukraine
country_event = {
	id = grayukraine.12
	title = grayukraine.12.t
	desc = grayukraine.12.d

	is_triggered_only = yes

	option = {
		name = grayukraine.12.a
	}
}
# Former overlord of SKL agrees to annexation - message for Ukraine
country_event = {
	id = grayukraine.13
	title = grayukraine.13.t
	desc = grayukraine.13.d

	is_triggered_only = yes

	option = {
		name = grayukraine.13.a
	}
}
# Gray Ukraine is free - choise for former overlord
country_event = {
	id = grayukraine.14
	title = grayukraine.14.t
	desc = grayukraine.14.d

	is_triggered_only = yes
	
	option = {
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0.25
				strength_ratio = {
					tag = FROM
					ratio < 1
				}
			}
		}
		name = grayukraine.14.a
		create_wargoal = {
			type = annex_everything
			target = FROM
		}
		FROM = { 
			country_event = { id = grayukraine.15 }
		}
	}

	option = {
		ai_chance = {
			factor = 50
		}
		name = grayukraine.14.b
		
	}
}
# Overlord of SKL want war - message for SKL
country_event = {
	id = grayukraine.15
	title = grayukraine.15.t
	desc = grayukraine.15.d

	is_triggered_only = yes

	option = {
		name = grayukraine.15.a
	}
}
# Cost of freedom
country_event = {
	id = grayukraine.16
	title = grayukraine.16.t
	desc = grayukraine.16.d

	is_triggered_only = yes

	option = {
		name = grayukraine.16.a
		add_war_support = 0.05
	}
}
# Nomads going to stepp
country_event = {
	id = grayukraine.17
	title = grayukraine.17.t
	desc = grayukraine.17.d

	is_triggered_only = yes

	option = {
		name = grayukraine.17.a
		590 = {
			add_manpower = -30000
		}
		583 = {
			add_manpower = 30000
		}
	}
}