###########################
# Ukrainian Anarchists Events
###########################

add_namespace = makhno

# Start uprising
country_event = {
	id = makhno.1
	title = makhno.1.t
	desc = makhno.1.d
	picture = GFX_report_event_makhnovist_attack

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			add_victory_points = {
				province = 429
				value = 1
			}
			set_province_name = { id = 429 name = UKR_huliaipole }
			DKR = {
				# creating and tuning of Free Territory
				add_state_core = 196
				add_state_core = 200
				add_state_core = 221
				add_state_core = 226
				add_state_core = 227
				add_state_core = 228
				transfer_state = 196
				transfer_state = 200
				transfer_state = 221
				transfer_state = 226
				transfer_state = 227
				transfer_state = 228
				set_capital = { state = 226 }
				
				set_party_name = { ideology = neutrality name = DKR_anarchy_party_short long_name = DKR_anarchy_party_long }
				add_popularity = {
					ideology = neutrality
					popularity = 0.10
				}
				add_dynamic_modifier = { modifier = UKR_anarchy_society	}
				add_dynamic_modifier = { modifier = UKR_anarchy_black_army }
				set_rule = {
					can_puppet = no
					can_create_factions = no
					can_join_factions = no
					can_boost_own_ideology = no
					can_generate_female_aces = yes
					can_create_collaboration_government = no
				}
				set_country_flag = UKR_anarchy_uprising_go
				set_cosmetic_tag = UKR_FT
				load_focus_tree = anarchy_ukraine_focus
				add_command_power = 30
				inherit_technology = UKR
				add_ideas = {
					DKR_anarchy_in_army
					DKR_anarchy_limits
					closed_economy
					war_economy
					DKR_bonus_for_AI
				} 
				# Create leaders
				promote_character = DKR_otaman_zelenyi
				add_field_marshal_role = {
					character = DKR_otaman_zelenyi
					traits = { war_hero inflexible_strategist trait_reckless }
					skill = 3
					attack_skill = 3
					defense_skill = 2
					planning_skill = 2
					logistics_skill = 3
				}
				add_corps_commander_role = {
					character = DKR_fedir_shchus
					traits = { UKR_makhnovist_insurgent cavalry_leader harsh_leader skilled_staffer }
					skill = 3
					attack_skill = 4
					defense_skill = 2
					planning_skill = 2
					logistics_skill = 2
					legacy_id = 674
				}
				add_corps_commander_role = {
					character = DKR_vasily_sharovskyi
					traits = { UKR_makhnovist_insurgent bearer_of_artillery }
					skill = 2
					attack_skill = 2
					defense_skill = 2
					planning_skill = 1
					logistics_skill = 2
				}
				add_corps_commander_role = {
					character = DKR_oleksander_taranovskyi
					traits = { UKR_makhnovist_insurgent skilled_staffer }
					skill = 1
					attack_skill = 1
					defense_skill = 1
					planning_skill = 1
					logistics_skill = 1
				}
				if = {
					limit = {
						has_dlc = "La Resistance"
					}
					create_operative_leader = {
						name = "Mishka Yaponchik"
						GFX = GFX_Portrait_Mishka_Yaponchik
						traits = { operative_tough operative_demolition_expert operative_escape_artist }
						bypass_recruitment = no
						available_to_spy_master = yes
						nationalities = { DKR }
					}
					create_operative_leader = {
						name = "Fanya Baron"
						GFX = GFX_Portrait_Fanya_Baron
						traits = { operative_linguist operative_infiltrator }
						bypass_recruitment = no
						available_to_spy_master = yes
						nationalities = { DKR }
					}
					if = { 
						limit = { UKR = { has_country_flag = UKR_arrival_of_yakov_blyumkin_flag } }
						UKR_recruting_of_yakov_blyumkin = yes
					}
				}
				# Create additional divisions
				division_template = {
					name = "Samooborona anarhistiv"
					template_counter = 0
					priority = 1
					is_locked = yes
					regiments = {
						militia = { x = 0 y = 0 }
						militia = { x = 0 y = 1 }
						militia = { x = 0 y = 2 }
						militia = { x = 0 y = 3 }
					}
				}
				every_owned_state = {
					create_unit = {
						division = "division_template = \"Samooborona anarhistiv\" start_experience_factor = 0 start_equipment_factor = 0.50" 
						owner = DKR
					}
				}
				# Flags for selected AI paths
				if = {
					limit = {
						UKR = {
							has_game_rule = {
								rule = UKR_ai_behavior
								option = ANARCHY_LEFT
							}
						}
					}
					set_country_flag = DKR_AI_RANDOM_ANARCHY_LEFT
					log = "DKR_AI_RANDOM_ANARCHY_LEFT"
				}
				else_if = {
					limit = {
						UKR = {
							has_game_rule = {
								rule = UKR_ai_behavior
								option = ANARCHY_RIGHT
							}
						}
					}
					set_country_flag = DKR_AI_RANDOM_ANARCHY_RIGHT
					log = "DKR_AI_RANDOM_ANARCHY_RIGHT"
				}
				# Initialising of variables
				set_variable = { var_integrate_commune_cost = 30 }
				set_variable = { var_aba_conscription = 0 }
				set_variable = { var_aba_training = 0 }
				set_variable = { var_aba_organization = 0 }
				set_variable = { var_aba_morale = 0 }
				set_variable = { var_aba_core_defence = 0 }
				set_variable = { var_aba_speed = 0 }
				set_variable = { var_aba_cav_attack = 0 }
				set_variable = { var_aba_cav_defence = 0 }
				set_variable = { var_aba_supply = 0 }
				set_variable = { var_aba_dig_speed = 0 }
				set_variable = { var_aba_resistance_damage = 0 }
				set_variable = { var_aba_leaders_cost = 0 }
				set_variable = { var_aba_start_planning = 0 }
				set_variable = { var_aba_mines_factor = 0 }
				set_variable = { var_aba_network_gain = 0 }
				set_variable = { var_aba_out_of_supply = 0 }
				set_variable = { var_aba_female_commanders = 0 }
				set_variable = { var_as_ncmanpower = 0 }
				set_variable = { var_as_conscription_factor = 0 }
				set_variable = { var_as_build_slots = 0 }
				set_variable = { var_as_surrender = 0 }
				set_variable = { var_as_research_speed = 0 }
				set_variable = { var_as_drift_defence = 0 }
				set_variable = { var_as_build_speed = 0 }
				set_variable = { var_as_industry_capacity = 0 }
				set_variable = { var_as_consumer_goods = 0 }
				set_variable = { var_as_max_efficiency = 0 }
				set_variable = { var_as_start_efficiency = 0 }
				set_variable = { var_as_resources = 0 }
				set_variable = { var_as_oil_refinery_build = 0 }
				set_variable = { var_as_wargoal_time = 0 }
				set_variable = { var_as_resistance = 0 }
				set_variable = { var_as_compliance_gain = 0 }
				set_variable = { var_as_politpower = 0 }
				set_variable = { var_as_bunkers = 0 }
			}
			# Transfer army and settings for Ukraine
			set_country_flag = UKR_start_of_anarchy_rebellion
			transfer_units_fraction = {
				target = DKR
				stockpile_ratio = 0.2
				army_ratio = 0.4
				navy_ratio = 0
				air_ratio = 0.3
				keep_unit_leaders = { 
				#655 661 657 658 668 673 
				}
				keep_unit_leaders_trigger = {
					OR = {
						has_id = 655
						has_id = 661
						has_id = 657
						has_id = 658
						has_id = 668
						has_id = 673
					}
				}
			}
			declare_war_on = {
				target = DKR
				type = civil_war
			}
			add_ideas = mutiny_1
			set_country_flag = UKR_altdem_branch_is_available
			set_politics = { ruling_party = democratic elections_allowed = no }
			mark_focus_tree_layout_dirty = yes
			if = { #defence from abusers
				limit = { num_divisions < 5 }
				division_template = {
					name = "Nacionalnyi zagin"
					template_counter = 0
					priority = 1
					regiments = {
						militia = { x = 0 y = 0 }
						militia = { x = 0 y = 1 }
						militia = { x = 0 y = 2 }
						militia = { x = 0 y = 3 }
					}
				}
				every_owned_state = {
					create_unit = {
						division = "division_template = \"Nacionalnyi zagin\" start_experience_factor = 0 start_equipment_factor = 0.50" 
						owner = UKR
					}
				}
			}
			country_lock_all_division_template = yes
			#flag for long war - biggest debuff after war
			DKR = { country_event = { id = makhno.16 days = 90 } }
		}
	}

	option = {
		name = makhno.1.a
		ai_chance = {
			base = 100
		}
		add_war_support = 0.05
		custom_effect_tooltip = UKR_altdem_branch_is_available_tt
		hidden_effect = {
			country_lock_all_division_template = no
			if = { # remove AI bonus if human is on Ukraine or Ukrainian AI has option of altdem branch
				limit = {
					OR = {
						is_ai = no
						has_game_rule = {
							rule = UKR_ai_behavior
							option = ALTDEM
						}
					} 
				}
				DKR = { remove_ideas = DKR_bonus_for_AI }
			}
			if = { # remove bonus trait of DKR for altdem AI
				limit = {
					is_ai = yes
					has_game_rule = {
						rule = UKR_ai_behavior
						option = ALTDEM
					}
				}
				DKR = { remove_country_leader_trait = peoples_otaman }
			}
			
		}
	}

	option = {
		name = makhno.1.b
		ai_chance = {
			base = 0
		}
		hidden_effect = {
			country_lock_all_division_template = no
			DKR = { remove_ideas = DKR_bonus_for_AI }
		}
		DKR = { change_tag_from = ROOT }
	}
}
# Choice leader and future politic
country_event = {
	id = makhno.2
	title = makhno.2.t
	desc = makhno.2.d
	picture = GFX_report_event_generic_rally

	is_triggered_only = yes

	option = { #left
		name = makhno.2.a
		ai_chance = {
			base = 50
			modifier = {
				factor = 0
				has_country_flag = DKR_AI_RANDOM_ANARCHY_RIGHT
			}
		}
		promote_character = DKR_peter_arshinov
		set_cosmetic_tag = UKR_ALEFT
		complete_national_focus = DKR_left_side
	}

	option = { #right
		name = makhno.2.b
		ai_chance = {
			base = 50
			modifier = {
				factor = 0
				has_country_flag = DKR_AI_RANDOM_ANARCHY_LEFT
			}
		}
		promote_character = DKR_viktor_belash
		set_cosmetic_tag = UKR_ARIGHT
		complete_national_focus = DKR_right_side
	}
}
# Request support from USSR
country_event = {
	id = makhno.3
	title = makhno.3.t
	desc = makhno.3.d
	picture = GFX_report_event_stalin_meeting

	is_triggered_only = yes

	option = {
		name = makhno.3.a
		ai_chance = {
			factor = 80
		}
		add_equipment_to_stockpile = { type = infantry_equipment amount = 2000 producer = SOV }
		set_country_flag = DKR_accepted_soviet_support
		SOV = {
			add_ai_strategy = {
				type = send_volunteers_desire
				id = DKR
				value = 200
			}
			add_ai_strategy = {
				type = support
				id = DKR
				value = 200
			} 
		}
		hidden_effect = {
			if = {
				limit = { 
					CRM = {
						exists = yes
						NOT = { has_government = communism }
						NOT = { has_war_with = DKR }
					}
				}
				CRM = { country_event = { id = makhno.8 days = 1 } }
			}
		}
	}

	option = {
		name = makhno.3.b
		ai_chance = {
			factor = 20
		}
		add_political_power = 50
		add_war_support = 0.05
	}
}
# Keeping promises to USSR - Crimea is captured
country_event = {
	id = makhno.4
	title = makhno.4.t
	desc = makhno.4.d
	
	trigger = {
		tag = DKR
		has_government = neutrality
		has_country_flag = DKR_accepted_soviet_support
		NOT = { has_war_with = UKR }
		NOT = { has_war_with = CRM }
		OR = {
			137 = { is_owned_and_controlled_by = ROOT }
			CRM = { is_puppet_of = ROOT }
		}
	}

	fire_only_once = yes
	
	mean_time_to_happen = {	days = 20	}

	immediate = {
		SOV = {
			add_ai_strategy = {
				type = send_volunteers_desire
				id = DKR
				value = -200
			}
			add_ai_strategy = {
				type = support
				id = DKR
				value = -200
			} 
		}
	}

	option = {
		ai_chance = {
			base = 100
		}
		name = makhno.4.a
		effect_tooltip = { SOV = { transfer_state = 137 } }
		SOV = { country_event = makhno.5 }
	}
	option = {
		ai_chance = {
			base = 0
		}
		name = makhno.4.b
		SOV = { country_event = makhno.6 }
	}
}
# Free Territory transfer Crimea to USSR
country_event = {
	id = makhno.5
	title = makhno.5.t
	desc = makhno.5.d

	is_triggered_only = yes

	option = {
		name = makhno.5.a
		transfer_state = 137
		if = {
			limit = {
				1020 = { is_owned_and_controlled_by = DKR }
			}
			transfer_state = 1020
		}
	}
}
# Free Territory refuses transfer Crimea to USSR
country_event = {
	id = makhno.6
	title = makhno.6.t
	desc = makhno.6.d

	is_triggered_only = yes

	option = {
		name = makhno.6.a
		add_ai_strategy = {
			type = antagonize
			id = DKR
			value = 200
		}
		add_state_claim = 227
		add_state_claim = 228
	}
}
# Keeping promises to USSR - Crimea is not captured
country_event = {
	id = makhno.7
	title = makhno.7.t
	desc = makhno.7.d
	
	trigger = {
		tag = DKR
		has_government = neutrality
		has_country_flag = DKR_accepted_soviet_support
		NOT = { has_war_with = UKR }
		NOT = { has_war_with = CRM }
		CRM = { 
			exists = yes
			is_puppet = no
		}

	}

	fire_only_once = yes
	
	mean_time_to_happen = {	days = 20	}

	option = {
		ai_chance = {
			base = 85
		}
		name = makhno.7.a
		create_wargoal = {
			type = annex_everything
			target = CRM
		}
		
	}
	option = {
		ai_chance = {
			base = 15
		}
		name = makhno.7.b
		SOV = { country_event = makhno.6 }
	}
}
# DKR cooperates with SOV - choice for Crimea
country_event = {
	id = makhno.8
	title = makhno.8.t
	desc = makhno.8.d
	
	is_triggered_only = yes

	trigger = {
		CRM = { NOT = { has_completed_focus = CRM_emergency_measures_on_perekop } }
	}

	option = {
		ai_chance = {
			base = 85
		}
		name = makhno.8.a #prevent strike
		declare_war_on = {
			target = DKR
			type = annex_everything
		}
		DKR = { country_event = makhno.9 }
	}
	option = { #do nothing
		ai_chance = {
			base = 15
		}
		name = makhno.8.b
	}
}
# Prevent strike of Crimea - new participant in civil war
country_event = {
	id = makhno.9
	title = makhno.9.t
	desc = makhno.9.d
	
	is_triggered_only = yes

	option = {
		name = makhno.9.a 
	}
}
#Rename of Dnipro
country_event = {
	id = makhno.10
	title = makhno.10.t
	desc = makhno.10.d
	picture = GFX_report_event_dnipro_railway_station

	fire_only_once = yes

	trigger = {
		tag = DKR
		DKR = {
			has_government = neutrality
			owns_state = 226
			controls_state = 226
		}
		NOT = { has_war_with = UKR }
	}

	option = { #a great idea!
		name = makhno.10.a
		ai_chance = {
			base = 50
		}
		226 = { set_state_name = UKR_makhnovia }
		set_province_name = { id = 11437 name = UKR_makhnovsk }
	}

	option = { #rather not
		name = makhno.10.b
		ai_chance = {
			base = 50
		}
	}
}
# Jewish pogroms in Ukraine
country_event = {
	id = makhno.11
	title = makhno.11.t
	desc = makhno.11.d

	is_triggered_only = yes

	trigger = {
		has_war_with = DKR
	}

	option = { 
		name = makhno.11.a
		ai_chance = {
			base = 0
			modifier = {
				add = 100
				has_game_rule = {
					rule = UKR_ai_behavior
					option = ALTDEM
				}
			}
		}
		add_command_power = -25
		add_political_power = -50
		add_power_balance_value = {
			id = UKR_power_balance
			value = -0.10
		}
	}

	option = {
		name = makhno.11.b
		ai_chance = {
			base = 0
			modifier = {
				add = 100
				OR = {
					has_game_rule = {
						rule = UKR_ai_behavior
						option = ANARCHY_LEFT
					}
					has_game_rule = {
						rule = UKR_ai_behavior
						option = ANARCHY_RIGHT
					}
				}
			}
		}
		add_power_balance_value = {
			id = UKR_power_balance
			value = 0.10
		}
		DKR = { country_event = { id = makhno.12 days = 5 } }
	}
}
# Jewish pogroms in Ukraine - new division for rebels
country_event = {
	id = makhno.12
	title = makhno.12.t
	desc = makhno.11.d
	picture = GFX_report_event_makhnovist_infantry

	is_triggered_only = yes

	trigger = {
		has_war_with = UKR
	}

	option = { 
		name = makhno.12.a
		division_template = {
			name = "Yevreiska brihada"
			template_counter = 0
			priority = 1
			is_locked = yes
			regiments = {
				infantry = { x = 0 y = 0 }
				infantry = { x = 0 y = 1 }
				infantry = { x = 0 y = 2 }
				infantry = { x = 0 y = 3 }
			}
		}
		capital_scope = {
			create_unit = {
				division = "division_template = \"Yevreiska brihada\" start_experience_factor = 0.2 start_equipment_factor = 1" 
				owner = DKR
			}
		}
	}
}
# Raid - fail
country_event = {
	id = makhno.13
	title = makhno.13.t
	desc = makhno.13.d
	picture = GFX_report_event_makhnovist_cavalery

	is_triggered_only = yes

	trigger = {
		has_war_with = UKR
	}

	option = { 
		name = makhno.13.a
		add_manpower = 300
		army_experience = 10
	}
}
# Raid - partial success
country_event = {
	id = makhno.14
	title = makhno.14.t
	desc = makhno.14.d
	picture = GFX_report_event_makhnovist_cavalery

	is_triggered_only = yes

	trigger = {
		has_war_with = UKR
	}

	option = { 
		name = makhno.14.a
		add_manpower = 600
		army_experience = 5
		add_equipment_to_stockpile = { type = infantry_equipment amount = 500 producer = UKR }
		add_equipment_to_stockpile = { type = artillery_equipment amount = 20 producer = UKR }
		add_equipment_to_stockpile = { type = support_equipment amount = 50 producer = UKR }
		UKR = {
			random_owned_controlled_state = {
				damage_building = {
					type = infrastructure
					damage = 1
				}
			}
		}
	}
}
# Raid - full success
country_event = {
	id = makhno.15
	title = makhno.15.t
	desc = makhno.15.d
	picture = GFX_report_event_makhnovist_cavalery

	is_triggered_only = yes

	trigger = {
		has_war_with = UKR
	}

	option = { 
		name = makhno.15.a
		add_manpower = 800
		add_equipment_to_stockpile = { type = infantry_equipment amount = 1000 producer = UKR }
		add_equipment_to_stockpile = { type = artillery_equipment amount = 40 producer = UKR }
		add_equipment_to_stockpile = { type = support_equipment amount = 100 producer = UKR }
		UKR = {
			random_owned_controlled_state = {
				limit = {
					arms_factory > 0
				}
				damage_building = {
					type = arms_factory
					damage = 1
				}
			}
		}
	}
}
# hidden event for flag of long civil war
country_event = {
	id = makhno.16
	
	hidden = yes

	is_triggered_only = yes

	immediate = {
		if = { 
			limit = { has_war_with = UKR } 
			set_country_flag = DKR_has_long_civil_war
		}
		else = {
			set_country_flag = cua_steppen_storm_flag
		}
	}
}
# Ultimatum to Poland for anarchists
country_event = {
	id = makhno.17
	title = makhno.17.t
	desc = makhno.17.d

	is_triggered_only = yes

	
	option = {
		name = makhno.17.a
		ai_chance = {
			factor = 40
			modifier = {
				factor = 2
				has_war = yes
				surrender_progress > 0
			}
			modifier = {
				factor = 0.5
				807 = { NOT = { is_owned_and_controlled_by = ROOT } }
			}
		}
		FROM = { country_event = { id = makhno.18 hours = 6 } }
		effect_tooltip = {
			FROM = {
				transfer_state = 89
				transfer_state = 91
				transfer_state = 93
				transfer_state = 1052
				if = {
				    limit = {
					    DKR = { controls_state = 194 }
					}
				    transfer_state = 1056
				
				}
				give_guarantee = POL
			}
			add_timed_idea = {
				idea = DKR_profit_for_cedes_lands
				days = 365
			}
		}
	}
	
	option = {
		name = makhno.17.b
		ai_chance = {
			factor = 60
			modifier = {
				factor = 2
				strength_ratio = {
					tag = FROM
					ratio > 0.75
				}
			}
			modifier = {
				factor = 2
				any_other_country = {
					is_major = yes
					is_in_faction_with = POL
				}
			}
		}
		FROM = { country_event = { id = makhno.19 hours = 6 } }
		effect_tooltip = {
			FROM = {
				create_wargoal = {
					target = POL
					type = take_state_focus
					generator = { 89 91 93 1052 }
				}
			}
		}
	}
}
# Poland Cedes West Ukraine
country_event = {
	id = makhno.18
	title = makhno.18.t
	desc = makhno.18.d
	picture = GFX_report_event_generic_peaceful_annexation

	is_triggered_only = yes
	
	option = {
		name = makhno.18.a
		if = {
			limit = { 89 = { is_owned_and_controlled_by = POL } }
			transfer_state = 89
			89 = { add_compliance = 25 }
		}
		if = {
			limit = { 91 = { is_owned_and_controlled_by = POL } }
			transfer_state = 91
			91 = { add_compliance = 25 }
		}
		if = {
			limit = {
				DKR = { controls_state = 194 }
			}
			transfer_state = 1056
		}
		if = {
			limit = { 93 = { is_owned_and_controlled_by = POL } }
			transfer_state = 93
			93 = { add_compliance = 25 }
		}
		if = {
			limit = { 1052 = { is_owned_and_controlled_by = POL } }
			transfer_state = 1052
			1052 = { add_compliance = 25 }
		}
		add_timed_idea = {
			idea = DKR_pay_for_cedes_lands_pol
			days = 365
		}
		give_guarantee = FROM
		FROM = {
			add_timed_idea = {
				idea = DKR_profit_for_cedes_lands
				days = 365
			}
		}
	}
}
# Poland Refuses to Cede West Ukraine
country_event = {
	id = makhno.19
	title = makhno.19.t
	desc = makhno.19.d
	picture = GFX_report_event_polish_tanks_02

	is_triggered_only = yes
	
	option = {
		name = makhno.19.a
		create_wargoal = {
			target = POL
			type = take_state_focus
			generator = { 89 91 93 1052 }
		}
		add_state_claim = 834
	}
}
# Ultimatum to Romania for anarchists
country_event = {
	id = makhno.20
	title = makhno.20.t
	desc = makhno.20.d

	is_triggered_only = yes

	
	option = {
		name = makhno.20.a
		ai_chance = {
			factor = 40
			modifier = {
				factor = 2
				has_war = yes
				surrender_progress > 0
			}
			modifier = {
				factor = 0.5
				76 = { NOT = { is_owned_and_controlled_by = ROOT } }
			}
		}
		FROM = { country_event = { id = makhno.21 hours = 6 } }
		effect_tooltip = {
			FROM = {
				transfer_state = 78
				transfer_state = 80
				transfer_state = 766
				give_guarantee = ROM
			}
			add_timed_idea = {
				idea = DKR_profit_for_cedes_lands
				days = 365
			}
		}
	}
	
	option = {
		name = makhno.20.b
		ai_chance = {
			factor = 60
			modifier = {
				factor = 2
				strength_ratio = {
					tag = FROM
					ratio > 0.75
				}
			}
			modifier = {
				factor = 2
				any_other_country = {
					is_major = yes
					is_in_faction_with = ROM
				}
			}
		}
		FROM = { country_event = { id = makhno.22 hours = 6 } }
		effect_tooltip = {
			FROM = {
				create_wargoal = {
					target = ROM
					type = take_state_focus
					generator = { 78 80 766 }
				}
			}
		}
	}
}
# Romania Cedes Bucovina and Bessarabia
country_event = {
	id = makhno.21
	title = makhno.21.t
	desc = makhno.21.d
	picture = GFX_report_event_annexation_of_bukovina_and_bessarabia1

	is_triggered_only = yes
	
	option = {
		name = makhno.21.a
		if = {
			limit = { 78 = { is_owned_and_controlled_by = ROM } }
			transfer_state = 78
			78 = { add_compliance = 25 }
		}
		if = {
			limit = { 80 = { is_owned_and_controlled_by = ROM } }
			transfer_state = 80
			80 = { add_compliance = 25 }
		}
		if = {
			limit = { 766 = { is_owned_and_controlled_by = ROM } }
			transfer_state = 766
			766 = { add_compliance = 25 }
		}
		add_timed_idea = {
			idea = DKR_pay_for_cedes_lands
			days = 365
		}
		give_guarantee = FROM
		FROM = {
			add_timed_idea = {
				idea = DKR_profit_for_cedes_lands
				days = 365
			}
		}
	}
}
# Romania Refuses to Cede Bucovina and Bessarabia
country_event = {
	id = makhno.22
	title = makhno.22.t
	desc = makhno.22.d
	picture = GFX_report_event_romanian_soldiers

	is_triggered_only = yes
	
	option = {
		name = makhno.22.a
		add_state_claim = 1024
		create_wargoal = {
			target = ROM
			type = take_state_focus
			generator = { 78 80 766 1024 }
		}
	}
}
# Offer to spain anarchists for union
country_event = {
	id = makhno.23
	title = makhno.23.t
	desc = makhno.23.d

	is_triggered_only = yes
	
	option = { # accept union
		name = makhno.23.a
		ai_chance = {
			factor = 40
		}
		FROM = { country_event = makhno.24 }
		effect_tooltip = {
			every_unit_leader = {
				set_nationality = FROM
			}
			every_navy_leader = {
				set_nationality = FROM
			}
			FROM = {
				annex_country = { target = ROOT transfer_troops = yes }
				every_owned_state = {
					limit = { is_core_of = ROOT }
					add_core_of	= FROM
				}
				set_cosmetic_tag = DKR_united
			}
		}
		custom_effect_tooltip = GAME_OVER_TT
	}
	option = { # decline union
		name = makhno.23.b
		ai_chance = {
			factor = 60
			modifier = {
				add = -15
				FROM = { has_country_flag = DKR_equipment_support_flag } 
			}
			modifier = {
				add = -15
				FROM = { has_country_flag = DKR_volunteers_support_flag } 
			}
			modifier = {
				add = -15
				FROM = { has_country_flag = DKR_air_support_flag } 
			}
			modifier = {
				add = -15
				FROM = { has_country_flag = DKR_industry_support_flag } 
			}
		}
		FROM = { country_event = makhno.25 }
	}
}
# Offer to spain anarchists for union - FROM accept union
country_event = {
	id = makhno.24
	title = makhno.24.t
	desc = makhno.24.d
	picture = GFX_report_event_spr_anarchist_success

	is_triggered_only = yes

	option = {
		name = makhno.24.a
		set_country_flag = DKR_union_with_spain
		every_other_country = {
			limit = { has_war_with = ROOT }
			declare_war_on = {
				target = DKR
				type = annex_everything
			}
		}
		FROM = {
			every_unit_leader = {
				set_nationality = ROOT
			}
			every_navy_leader = {
				set_nationality = ROOT
			}
		}
		annex_country = { target = FROM transfer_troops = yes }
		every_owned_state = {
			limit = { is_core_of = FROM }
			add_core_of	= ROOT
		}
		set_cosmetic_tag = DKR_united
		add_to_variable = { var_as_compliance_gain = 0.03 }
		set_variable = { var_integrate_commune_cost = 30 }
		custom_effect_tooltip = DKR_form_united_anarchist_communes_tt
		#hidden_effect = {
		#	news_event = { hours = 1 id = news.... }
		#}
	}
	
}
# Offer to spain anarchists for union - FROM reject union
country_event = {
	id = makhno.25
	title = makhno.25.t
	desc = makhno.25.d
	picture = GFX_report_event_spr_anarchist_uprising

	is_triggered_only = yes
	
	option = {
		name = makhno.25.a
	}
}
# Anarchy seeding: start civil war
country_event = {
	id = makhno.26
	title = makhno.26.t
	desc = makhno.26.d
	picture = GFX_report_event_spr_anarchist_uprising2

	trigger = {
		THIS = {
			exists = yes
			has_capitulated = no
			NOT = { is_in_faction_with = DKR }
			NOT = { is_puppet_of = DKR }
		}
	}

	is_triggered_only = yes
	
	option = {
		name = makhno.26.a
		set_country_flag = anarchy_seeding_from_ukraine
		if = {
			limit = { has_government = neutrality }
			start_civil_war = {
				ideology = communism
				size = 0.3
				states_filter = {
					is_capital = no
					any_neighbor_state = { is_controlled_by = DKR }
				}
			}
			random_other_country = {
				limit = {
					original_tag = PREV
					has_government = communism
					has_civil_war = yes
				}
				retire_country_leader = yes
				set_country_leader_ideology = anarchist_communism
				set_cosmetic_tag = DKR_ANARCHY_REBELS
				add_ideas = DKR_death_before_surrender
				set_rule = {
					can_join_factions = no
				}
				save_event_target_as = anarchy_seeding_from_ukraine_target
				DKR = { 
					add_to_war = { targeted_alliance = PREV enemy = ROOT } 
					country_event = { id = makhno.27 hours = 6 }
				}
			}
		}
		else = {
			start_civil_war = {
				ideology = neutrality
				size = 0.3
				states_filter = {
					is_capital = no
					any_neighbor_state = { is_controlled_by = DKR }
				}
			}
			random_other_country = {
				limit = {
					original_tag = PREV
					has_government = neutrality
					has_civil_war = yes
				}
				retire_country_leader = yes
				set_country_leader_ideology = anarchism	
				set_cosmetic_tag = DKR_ANARCHY_REBELS
				add_ideas = DKR_death_before_surrender
				set_rule = {
					can_join_factions = no
				}
				save_event_target_as = anarchy_seeding_from_ukraine_target
				DKR = { 
					add_to_war = { targeted_alliance = PREV enemy = ROOT } 
					country_event = { id = makhno.27 hours = 6 }
				}
			}
		}
		#ANR = {
		#	original_tag = PREV
		#	has_country_flag = anarchy_seeding_from_ukraine
		#}
	}
}
# Anarchy seeding: intervention in civil war of DKR
country_event = {
	id = makhno.27
	title = makhno.27.t
	desc = makhno.27.d
	picture = report_event_spr_anarchist_uprising2

	is_triggered_only = yes
	
	option = {
		name = makhno.27.a
		annex_country = { target = event_target:anarchy_seeding_from_ukraine_target transfer_troops = yes }
		#diplomatic_relation = {
		#	country = FROM
		#	relation = military_access
		#	active = yes
		#}
		#diplomatic_relation = {
		#	country = FROM
		#	relation = non_aggression_pact
		#	active = yes
		#}
	}
}
#New volunteers for defence of anarchy bastion 
country_event = {
	id = makhno.28
	title = makhno.28.t
	desc = makhno.28.d
	picture = GFX_report_event_makhnovist_infantry

	trigger = {
		tag = DKR
		has_completed_focus = DKR_right_side
		NOT = { has_idea = DKR_new_volunteers }
		has_war = yes
		surrender_progress > 0
		has_manpower < 50000	
	}

	fire_only_once = no

	mean_time_to_happen = {	days = 20 }

	option = {
		name = makhno.28.a
		add_ideas = DKR_new_volunteers
	}
}
# New demand of Shchus
country_event = {
	id = makhno.29
	title = makhno.29.t
	desc = makhno.29.d
	picture = GFX_report_event_fedir_shchus
	
	trigger = {
		tag = DKR
		#has_unit_leader = 674
		NOT = { has_completed_focus = DKR_free_waves }
		focus_progress = {
			focus = DKR_free_waves
			progress > 0.25
		}
	}

	fire_only_once = yes
	
	mean_time_to_happen = {	days = 1	}

	option = {
		name = makhno.29.a
		ai_chance = {
			base = 80
		}
		DKR_fedir_shchus = {
		 	remove_unit_leader_role = yes
		 	remove_advisor_role = { slot = army_chief }
		}
		add_naval_commander_role = {
			character = DKR_fedir_shchus
			traits = { cuts_corners bold navy_media_personality caustic_personality }
			skill = 1
			attack_skill = 1
			defense_skill = 1
			maneuvering_skill = 1
			coordination_skill = 1
		}
		add_command_power = -15
	}
	option = {
		name = makhno.29.b
		ai_chance = {
			base = 20
		}
		DKR_increase_army_anarchy = yes
	}
}
# White peace with USSR for Belash after success offensive
country_event = {
	id = makhno.30
	title = makhno.30.t
	desc = makhno.30.d
	picture = GFX_report_event_stalin_meeting
	
	trigger = {
		tag = DKR
		has_war_with = SOV
		has_completed_focus = DKR_right_side
		has_completed_focus = DKR_whitening_of_reds
		surrender_progress < 0.01
		any_war_score > 10
		SOV = { 
			surrender_progress > 0.3 
			has_government = communism
			is_puppet = no
		}
	}

	fire_only_once = yes
	
	mean_time_to_happen = {	days = 10	}

	option = {
		name = makhno.30.a
		ai_chance = {
			base = 100
		}
		effect_tooltip = {
			white_peace = SOV
			transfer_state = 234
			transfer_state = 238
			transfer_state = 245
			transfer_state = 218
			transfer_state = 235
		}
		SOV = { country_event = { id = makhno.31 days = 1 } }
	}
	option = {
		name = makhno.30.b
		ai_chance = {
			base = 0
		}
		add_war_support = -0.30
		add_political_power = -200
		DKR_increase_army_anarchy = yes
	}
}
# White peace with USSR - choice for Stalin
country_event = {
	id = makhno.31
	title = makhno.31.t
	desc = makhno.31.d
	
	is_triggered_only = yes

	option = {
		ai_chance = {
			base = 100
		}
		name = makhno.31.a
		white_peace = FROM
		if = { #for spain anarchists, if the guaranted with DKR
			limit = { has_war_with = SPC }
			white_peace = SPC
		}
		every_other_country = {
			limit = { 
				OR = {
					is_in_faction_with = SOV
					is_puppet_of = SOV
				}
				has_war_with = SOV
			}
			white_peace = FROM
		}
		if = {
			limit = { 137 = { is_owned_and_controlled_by = SOV } }
			FROM = { transfer_state = 137 }
		}
		if = {
			limit = { 1021 = { is_owned_and_controlled_by = SOV } }
			FROM = { transfer_state = 1021 }
		}
		if = {
			limit = { 234 = { is_owned_and_controlled_by = SOV } }
			FROM = { transfer_state = 234 }
		}
		if = {
			limit = { 238 = { is_owned_and_controlled_by = SOV } }
			FROM = { transfer_state = 238 }
		}
		if = {
			limit = { 245 = { is_owned_and_controlled_by = SOV } }
			FROM = { transfer_state = 245 }
		}
		if = {
			limit = { 240 = { is_owned_and_controlled_by = SOV } }
			FROM = { transfer_state = 240 }
		}
		if = {
			limit = { 1023 = { is_owned_and_controlled_by = SOV } }
			FROM = { transfer_state = 1023 }
		}
		if = {
			limit = { 218 = { is_owned_and_controlled_by = SOV } }
			FROM = { transfer_state = 218 }
		}
		if = {
			limit = { 235 = { is_owned_and_controlled_by = SOV } }
			FROM = { transfer_state = 235 }
		}
		if = {
			limit = { 1018 = { is_owned_and_controlled_by = SOV } }
			FROM = { transfer_state = 1018 }
		}
		if = {
			limit = { 1020 = { is_owned_and_controlled_by = SOV } }
			FROM = { transfer_state = 1020 }
		}
		if = {
			limit = { has_war = no }
			if = {
				limit = { 204 = { is_owned_and_controlled_by = SOV } }
				204 = { set_demilitarized_zone = yes }
			}
			if = {
				limit = { 243 = { is_owned_and_controlled_by = SOV } }
				243 = { set_demilitarized_zone = yes }
			}
			if = {
				limit = { 224 = { is_owned_and_controlled_by = SOV } }
				224 = { set_demilitarized_zone = yes }
			}
			if = {
				limit = { 220 = { is_owned_and_controlled_by = SOV } }
				220 = { set_demilitarized_zone = yes }
			}
			if = {
				limit = { 260 = { is_owned_and_controlled_by = SOV } }
				260 = { set_demilitarized_zone = yes }
			}
			if = {
				limit = { 265 = { is_owned_and_controlled_by = SOV } }
				265 = { set_demilitarized_zone = yes }
			}
			if = {
				limit = { 217 = { is_owned_and_controlled_by = SOV } }
				217 = { set_demilitarized_zone = yes }
			}
			if = {
				limit = { 237 = { is_owned_and_controlled_by = SOV } }
				237 = { set_demilitarized_zone = yes }
			}
			if = {
				limit = { 232 = { is_owned_and_controlled_by = SOV } }
				232 = { set_demilitarized_zone = yes }
			}
			if = {
				limit = { 233 = { is_owned_and_controlled_by = SOV } }
				233 = { set_demilitarized_zone = yes }
			}
		}
		FROM = { country_event = { id = makhno.32 } }
	}
	option = {
		name = makhno.31.b
		ai_chance = {
			base = 0
		}
		FROM = { country_event = { id = makhno.33 } }
	}
}
# Stalin agree
country_event = {
	id = makhno.32
	title = makhno.32.t
	desc = makhno.32.d
	picture = GFX_report_event_stalin_meeting

	is_triggered_only = yes
	
	option = {
		name = makhno.32.a
	}
}
# Stalin refuse
country_event = {
	id = makhno.33
	title = makhno.33.t
	desc = makhno.33.d
	picture = GFX_report_event_stalin_meeting

	is_triggered_only = yes
	
	option = {
		name = makhno.33.a
	}
}
# Ultimatum to Crimea
country_event = {
	id = makhno.34
	title = makhno.34.t
	desc = makhno.34.d
	
	is_triggered_only = yes

	option = {
		name = makhno.34.a
		ai_chance = {
			factor = 80
			modifier = {
				factor = 0.5
				naval_strength_ratio = {
				    tag = FROM
				    ratio > 1
				}
			}
		}
		FROM = {
			country_event = { id = makhno.35 days = 1}
		}
		effect_tooltip = {
			FROM = {
				annex_country = { target = CRM }
			}
		}
	}
	option = {
		name = makhno.34.b
		ai_chance = {
			factor = 20
			modifier = {
				factor = 2
				has_government = fascism
			}
		}
		FROM = {
			country_event = { id = makhno.36 days = 1}
		}
		effect_tooltip = {
			FROM = {
				create_wargoal = {
					type = take_state_focus
					target = CRM
					generator = { 137 1020 }
				}
			}
		}
	}
}
# Crimea accept ultimatum of DKR
country_event = {
	id = makhno.35
	title = makhno.35.t
	desc = makhno.35.d
	picture = GFX_report_event_generic_peaceful_annexation

	
	is_triggered_only = yes

	option = {
		name = makhno.35.a
		if = {
			limit = {
				137 = { is_owned_and_controlled_by = CRM }
			}
			transfer_state = 137
		}
		if = {
			limit = {
				1021 = { is_owned_and_controlled_by = CRM }
			}
			transfer_state = 1021
		}
	}
}
# Crimea decline ultimatum of DKR
country_event = {
	id = makhno.36
	title = makhno.36.t
	desc = makhno.36.d
	
	is_triggered_only = yes

	option = {
		name = makhno.36.a
		create_wargoal = {
			type = take_state_focus
			target = CRM
			generator = { 137 1021 }
		}
	}
}
# Ultimatum for Transcarpathia
country_event = {
	id = makhno.37
	title = makhno.37.t
	desc = makhno.37.d
	
	is_triggered_only = yes

	trigger = {
		NOT = { has_war_with = FROM }
	}

	option = {
		name = makhno.37.a
		ai_chance = {
			factor = 40
			modifier = {
				factor = 0.5
				naval_strength_ratio = {
				    tag = DKR
				    ratio > 1
				}
			}
			modifier = {
				factor = 2
				CUA = { is_puppet_of = ROOT }
				NOT = { tag = HUN }
				NOT = { tag = CZE }
			}
		}
		FROM = {
			country_event = makhno.38
		}
		effect_tooltip = {
			FROM = {
				transfer_state = 73
			}
		}
	}
	option = {
		name = makhno.37.b
		ai_chance = {
			factor = 60
			modifier = {
				factor = 1.5
				73 = {
					OR = {
						is_core_of = ROOT
						is_claimed_by = ROOT 
					}
				}
			}
		}
		FROM = {
			country_event = makhno.39
		}
		effect_tooltip = {
			FROM = {
				create_wargoal = {
					type = take_state_focus
					target = ROOT
					generator = { 73 }
				}
			}
		}
	}
}
# FROM accept carpathian ultimatum of DKR
country_event = {
	id = makhno.38
	title = makhno.38.t
	desc = makhno.38.d
	picture = GFX_report_event_carphatian_ukraine

	
	is_triggered_only = yes

	option = {
		name = makhno.38.a
		if = {
			limit = { country_exists = CUA }
			annex_country = { target = CUA }
		}
		else = {
			transfer_state = 73
		}
		73 = { add_compliance = 25 }
	}
}
# FROM decline carpathian ultimatum of DKR
country_event = {
	id = makhno.39
	title = makhno.39.t
	desc = makhno.39.d
	
	is_triggered_only = yes

	option = {
		name = makhno.39.a
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 73 }
		}
		add_state_claim = 1019
	}
}
# Free competitions research - industry&electronics - outdated
country_event = {
	id = makhno.40
	
	hidden = yes
	is_triggered_only = yes

	trigger = {
		date < 1948.1.1
	}

	immediate = {
		add_tech_bonus = {
			name = DKR_free_competitions
			bonus = 0.75
			uses = 1
			category = industry
			category = electronics
		}
		random_list = {
			35 = {
				country_event = { id = makhno.41 days = 50 random_days = 25 }
			}
			30 = {
				country_event = { id = makhno.42 days = 50 random_days = 25 }
			}
			35 = {
				country_event = { id = makhno.43 days = 50 random_days = 25 }
			}
		}
		log = "makhno.40"
	}
}
# Free competitions research - infantry weapons&artillery - outdated
country_event = {
	id = makhno.41
	
	hidden = yes
	is_triggered_only = yes

	trigger = {
		date < 1948.1.1
	}

	immediate = {
		add_tech_bonus = {
			name = DKR_free_competitions
			bonus = 0.75
			uses = 1
			category = infantry_weapons
			category = artillery
		}
		random_list = {
			35 = {
				country_event = { id = makhno.40 days = 50 random_days = 25 }
			}
			30 = {
				country_event = { id = makhno.42 days = 50 random_days = 25 }
			}
			35 = {
				country_event = { id = makhno.43 days = 50 random_days = 25 }
			}
		}
		log = "makhno.41"
	}
}

# Free competitions research - armor&motorized - outdated
country_event = {
	id = makhno.42
	
	hidden = yes
	is_triggered_only = yes

	trigger = {
		date < 1948.1.1
	}

	immediate = {
		add_tech_bonus = {
			name = DKR_free_competitions
			bonus = 0.75
			uses = 1
			category = armor
			category = motorized_equipment
		}
		random_list = {
			35 = {
				country_event = { id = makhno.40 days = 50 random_days = 25 }
			}
			30 = {
				country_event = { id = makhno.41 days = 50 random_days = 25 }
			}
			35 = {
				country_event = { id = makhno.43 days = 50 random_days = 25 }
			}
		}
		log = "makhno.42"
	}
}

# Free competitions research - naval equipment - outdated
country_event = {
	id = makhno.43
	
	hidden = yes
	is_triggered_only = yes

	trigger = {
		date < 1948.1.1
	}

	immediate = {
		add_tech_bonus = {
			name = DKR_free_competitions
			bonus = 0.75
			uses = 1
			category = naval_equipment
		}
		random_list = {
			35 = {
				country_event = { id = makhno.40 days = 50 random_days = 25 }
			}
			35 = {
				country_event = { id = makhno.41 days = 50 random_days = 25 }
			}
			30 = {
				country_event = { id = makhno.42 days = 50 random_days = 25 }
			}
		}
		log = "makhno.43"
	}
}
# Free competitions buildings - industrial complex - outdated
country_event = {
	id = makhno.44
	
	hidden = yes
	is_triggered_only = yes

	trigger = {
		any_owned_state = {
			is_owned_and_controlled_by = ROOT
			OR = {
				is_core_of = ROOT
				compliance > 50
			}
			free_building_slots = {
				building = industrial_complex
				size > 0
				include_locked = yes
			}
		}
	}

	immediate = {
		random_owned_controlled_state = {
			limit = {
				OR = {
					is_core_of = ROOT
					compliance > 50
				}
				free_building_slots = {
					building = industrial_complex
					size > 0
					include_locked = yes
				}
			}
			add_extra_state_shared_building_slots = 1
			add_building_construction = {
			    type = industrial_complex
			    level = 1
			    instant_build = yes
			}
		}	
		random_list = {
			40 = {
				country_event = { id = makhno.45 days = 30 random_days = 15 }
			}
			40 = {
				country_event = { id = makhno.46 days = 30 random_days = 15 }
			}
			20 = {
				modifier = {
					factor = 2
					num_of_naval_factories < 6
				}
				country_event = { id = makhno.47 days = 30 random_days = 15 }
			}
		}
		log = "makhno.44"
	}
}
# Free competitions buildings - arms factory - outdated
country_event = {
	id = makhno.45

	hidden = yes
	is_triggered_only = yes

	trigger = {
		any_owned_state = {
			is_owned_and_controlled_by = ROOT
			OR = {
				is_core_of = ROOT
				compliance > 50
			}
			free_building_slots = {
				building = arms_factory
				size > 0
				include_locked = yes
			}
		}
	}

	immediate = {
		random_owned_controlled_state = {
			limit = {
				OR = {
					is_core_of = ROOT
					compliance > 50
				}
				free_building_slots = {
					building = arms_factory
					size > 0
					include_locked = yes
				}
			}
			add_extra_state_shared_building_slots = 1
			add_building_construction = {
			    type = arms_factory
			    level = 1
			    instant_build = yes
			}
		}	
		random_list = {
			40 = {
				country_event = { id = makhno.44 days = 30 random_days = 15 }
			}
			40 = {
				country_event = { id = makhno.46 days = 30 random_days = 15 }
			}
			20 = {
				modifier = {
					factor = 2
					num_of_naval_factories < 6
				}
				country_event = { id = makhno.47 days = 30 random_days = 15 }
			}
		}
		log = "makhno.45"
	}
}
# Free competitions buildings - infrastructure - outdated
country_event = {
	id = makhno.46

	hidden = yes
	is_triggered_only = yes

	trigger = {
		any_owned_state = {
			is_owned_and_controlled_by = ROOT
			OR = {
				is_core_of = ROOT
				compliance > 50
			}
			free_building_slots = {
				building = infrastructure
				size > 0
			}
		}
	}

	immediate = {
		random_owned_controlled_state = {
			limit = {
				OR = {
					is_core_of = ROOT
					compliance > 50
				}
				free_building_slots = {
					building = infrastructure
					size > 0
				}
			}
			add_extra_state_shared_building_slots = 1
			add_building_construction = {
			    type = infrastructure
			    level = 1
			    instant_build = yes
			}
		}	
		random_list = {
			40 = {
				country_event = { id = makhno.44 days = 30 random_days = 15 }
			}
			40 = {
				country_event = { id = makhno.45 days = 30 random_days = 15 }
			}
			20 = {
				modifier = {
					factor = 2
					num_of_naval_factories < 6
				}
				country_event = { id = makhno.47 days = 30 random_days = 15 }
			}
		}
		log = "makhno.46"
	}
}
# Free competitions buildings - dockyard - outdated
country_event = {
	id = makhno.47

	hidden = yes
	is_triggered_only = yes

	trigger = {
		any_owned_state = {
			is_owned_and_controlled_by = ROOT
			is_coastal = yes
			OR = {
				is_core_of = ROOT
				compliance > 50
			}
			free_building_slots = {
				building = dockyard
				size > 0
				include_locked = yes
			}
		}
	}

	immediate = {
		random_owned_controlled_state = {
			limit = {
				is_coastal = yes
				OR = {
					is_core_of = ROOT
					compliance > 50
				}
				free_building_slots = {
					building = dockyard
					size > 0
					include_locked = yes
				}
			}
			add_extra_state_shared_building_slots = 1
			add_building_construction = {
			    type = dockyard
			    level = 1
			    instant_build = yes
			}
		}	
		random_list = {
			35 = {
				country_event = { id = makhno.44 days = 30 random_days = 15 }
			}
			35 = {
				country_event = { id = makhno.45 days = 30 random_days = 15 }
			}
			30 = {
				country_event = { id = makhno.46 days = 30 random_days = 15 }
			}
		}
		log = "makhno.47"
	}
}
# Anarchy seeding: unrest for reduction stability
country_event = {
	id = makhno.48
	title = makhno.48.t
	desc = makhno.48.d
	picture = GFX_report_event_spr_anarchist_success

	is_triggered_only = yes
	
	option = {
		name = makhno.48.a
		add_stability = -0.25
		add_political_power = -100
	}
}
# Anarchy seeding: start biggest civil war
country_event = {
	id = makhno.49
	title = makhno.49.t
	desc = makhno.49.d
	picture = GFX_report_event_spr_anarchist_uprising2

	trigger = {
		THIS = {
			exists = yes
			has_capitulated = no
			NOT = { is_in_faction_with = DKR }
			NOT = { is_puppet_of = DKR }
		}
	}

	is_triggered_only = yes
	
	option = {
		name = makhno.26.a
		set_country_flag = anarchy_seeding_from_ukraine
		if = {
			limit = { has_government = neutrality }
			start_civil_war = {
				ideology = communism
				size = 0.5
				states_filter = {
					is_capital = no
					any_neighbor_state = { is_controlled_by = DKR }
				}
			}
			random_other_country = {
				limit = {
					original_tag = PREV
					has_government = communism
					has_civil_war = yes
				}
				retire_country_leader = yes
				set_country_leader_ideology = anarchist_communism
				set_cosmetic_tag = DKR_ANARCHY_REBELS
				add_ideas = DKR_death_before_surrender
				set_rule = {
					can_join_factions = no
				}
				save_event_target_as = anarchy_seeding_from_ukraine_target
				DKR = { 
					add_to_war = { targeted_alliance = PREV enemy = ROOT } 
					country_event = { id = makhno.27 hours = 6 }
				}
			}
		}
		else = {
			start_civil_war = {
				ideology = neutrality
				size = 0.5
				states_filter = {
					is_capital = no
					any_neighbor_state = { is_controlled_by = DKR }
				}
			}
			random_other_country = {
				limit = {
					original_tag = PREV
					has_government = neutrality
					has_civil_war = yes
				}
				retire_country_leader = yes
				set_country_leader_ideology = anarchism	
				set_cosmetic_tag = DKR_ANARCHY_REBELS
				add_ideas = DKR_death_before_surrender
				set_rule = {
					can_join_factions = no
				}
				save_event_target_as = anarchy_seeding_from_ukraine_target
				DKR = { 
					add_to_war = { targeted_alliance = PREV enemy = ROOT } 
					country_event = { id = makhno.27 hours = 6 }
				}
			}
		}
	}
}
# Anarchy seeding: unrest in target country
country_event = {
	id = makhno.50
	title = makhno.50.t
	desc = makhno.50.d
	picture = GFX_report_event_spr_anarchist_success

	is_triggered_only = yes
	
	option = {
		name = makhno.50.a
		#randomize_temp_variable = {
		#	var = var_anarchy_equip_infantry
		#	distribution = uniform
		#	min = 1000
		#	max = 3000
		#}
		#randomize_temp_variable = {
		#	var = var_anarchy_equip_support
		#	distribution = uniform
		#	min = 100
		#	max = 300
		#}
		add_equipment_to_stockpile = { type = infantry_equipment amount = 1000 producer = DKR }
		add_equipment_to_stockpile = { type = support_equipment amount = 200 producer = DKR }
	}
}
# Across the Straits - demand for Turkey
country_event = {
	id = makhno.51
	title = makhno.51.t
	desc = makhno.51.d

	is_triggered_only = yes
	
	option = {
		name = makhno.51.a
		ai_chance = {
			factor = 40
			modifier = {
				factor = 2
				has_war = yes
				surrender_progress > 0
			}
		}
		FROM = { country_event = makhno.52 }
		effect_tooltip = {
			diplomatic_relation = {
				country = FROM
				relation = military_access
				active = yes
			}
		}
	}
	
	option = {
		name = makhno.51.b
		ai_chance = {
			factor = 60
			modifier = {
				factor = 1.5
				naval_strength_ratio = {
					tag = FROM
					ratio > 1
				}
			}
			modifier = {
				factor = 1.5
				any_other_country = {
					is_major = yes
					OR = {
						is_in_faction_with = TUR
						has_guaranteed = TUR				
					}
				}
			}
		}
		FROM = { country_event = makhno.53 }
		effect_tooltip = {
			FROM = {
				create_wargoal = {
					target = TUR
					type = take_state_focus
					generator = { 341 797 }
				}
			}
		}
	}
}
# Turkey accept
country_event = {
	id = makhno.52
	title = makhno.52.t
	desc = makhno.52.d
	picture = GFX_report_event_tur_the_montreux_convention

	is_triggered_only = yes

	option = {
		name = makhno.52.a
		diplomatic_relation = {
			country = TUR
			relation = military_access
			active = yes
		}
		if = { 
			limit = { 340 = { is_demilitarized_zone = yes } } 
			340 = { set_demilitarized_zone = no }  
		}
		if = { 
			limit = { 341 = { is_demilitarized_zone = yes } } 
			341 = { set_demilitarized_zone = no }  
		}
		if = { 
			limit = { 797 = { is_demilitarized_zone = yes } } 
			797 = { set_demilitarized_zone = no }  
		}
	}
}
# Turkey refuse
country_event = {
	id = makhno.53
	title = makhno.53.t
	desc = makhno.53.d
	picture = GFX_report_event_tur_military_affair

	is_triggered_only = yes

	option = { 
		name = makhno.53.a
		ai_chance = {
			factor = 10
		}
		create_wargoal = {
			type = take_state_focus
			target = TUR
			generator = { 341 797 }
		}
		add_timed_idea = {
			idea = DKR_neptune_operation
			days = 60
		}
	}
	option = { 
		name = makhno.53.b
		trigger = {
			OR = {
				137 = { is_owned_and_controlled_by = ROOT }
				CRM = { is_puppet_of = ROOT }
			}
		}
		ai_chance = {
			factor = 50
		}
		FROM = { country_event = { id = makhno.54 hours = 8 } }
	}
	option = { 
		name = makhno.53.c
		trigger = {
			137 = { is_owned_and_controlled_by = CRM }
			CRM = {
				is_puppet = no
				NOT = { is_in_faction_with = ROOT }
			}
		}
		ai_chance = {
			factor = 50
		}
		FROM = { country_event = { id = makhno.54 hours = 8 } }
	}
}
# Across the Straits - offer transfer Crimea for Turkey 
country_event = {
	id = makhno.54
	title = makhno.54.t
	desc = makhno.54.d

	is_triggered_only = yes
	
	option = {
		name = makhno.54.a
		ai_chance = {
			factor = 75
		}
		FROM = { 
			set_country_flag = DKR_crimea_in_trade_for_straits
			country_event = makhno.55 
		}
		effect_tooltip = {
			transfer_state = 137
			transfer_state = 1021
		}
	}
	
	option = {
		name = makhno.54.b
		ai_chance = {
			factor = 25
		}
		FROM = { country_event = makhno.56 }
		effect_tooltip = {
			FROM = {
				create_wargoal = {
					target = TUR
					type = take_state_focus
					generator = { 341 797 }
				}
			}
		}
	}
}
# Turkey agree for Crimea
country_event = {
	id = makhno.55
	title = makhno.55.t
	desc = { 
		text = makhno.55.desc.a
		trigger = {
			OR = {
				137 = { is_owned_and_controlled_by = ROOT }
				CRM = { is_puppet_of = ROOT }
			}
		}
	}
	desc = { 
		text = makhno.55.desc.b
		trigger = {
			137 = { is_owned_and_controlled_by = CRM }
			CRM = {	is_puppet = no }
		}
	}

	is_triggered_only = yes

	option = { 
		name = makhno.55.a
		if = {
			limit = {
				OR = {
					137 = { is_owned_and_controlled_by = ROOT }
					CRM = { is_puppet_of = ROOT }
				}
			}
			CRI = {
				add_state_core = 137
				add_state_core = 1021
			}
			release = CRI
			FROM = { puppet = CRI }
			diplomatic_relation = {
				country = TUR
				relation = military_access
				active = yes
			}
			if = { 
				limit = { 340 = { is_demilitarized_zone = yes } } 
				340 = { set_demilitarized_zone = no }  
			}
			if = { 
				limit = { 341 = { is_demilitarized_zone = yes } } 
				341 = { set_demilitarized_zone = no }  
			}
			if = { 
				limit = { 797 = { is_demilitarized_zone = yes } } 
				797 = { set_demilitarized_zone = no }  
			}
		}
		else = {
			create_wargoal = {
				type = annex_everything
				target = CRM
			}
		}
	}
}
# Turkey again refuse - final decision
country_event = {
	id = makhno.56
	title = makhno.56.t
	desc = makhno.56.d

	is_triggered_only = yes

	option = { 
		name = makhno.56.a
		create_wargoal = {
			type = take_state_focus
			target = TUR
			generator = { 341 797 }
		}
		add_timed_idea = {
			idea = DKR_neptune_operation
			days = 60
		}
	}
}
# Keeping promises to Turkey - Crimea is captured
country_event = {
	id = makhno.57
	title = makhno.57.t
	desc = makhno.57.d
	
	trigger = {
		tag = DKR
		has_government = neutrality
		has_country_flag = DKR_crimea_in_trade_for_straits
		NOT = { has_war_with = TUR }
		OR = {
			137 = { is_owned_and_controlled_by = ROOT }
			CRM = { is_puppet_of = ROOT }
		}
	}

	fire_only_once = yes
	
	mean_time_to_happen = {	days = 7	}

	option = {
		name = makhno.57.a
		effect_tooltip = { TUR = { transfer_state = 137 } }
		diplomatic_relation = {
			country = TUR
			relation = military_access
			active = yes
		}
		if = { 
			limit = { 340 = { is_demilitarized_zone = yes } } 
			340 = { set_demilitarized_zone = no }  
		}
		if = { 
			limit = { 341 = { is_demilitarized_zone = yes } } 
			341 = { set_demilitarized_zone = no }  
		}
		if = { 
			limit = { 797 = { is_demilitarized_zone = yes } } 
			797 = { set_demilitarized_zone = no }  
		}
		TUR = { country_event = makhno.58 }
	}
}
# Keeping promises to Turkey - transfer state
country_event = {
	id = makhno.58
	title = makhno.58.t
	desc = makhno.58.d

	is_triggered_only = yes

	option = { 
		name = makhno.58.a
		CRI = {
			add_state_core = 137
			add_state_core = 1020
		}
		FROM = {
			release = CRI
		}
		puppet = CRI
	}
}
# Cooperation spain anarchist with DKR - message for Spain
country_event = {
	id = makhno.59
	title = makhno.59.t
	desc = makhno.59.d

	is_triggered_only = yes

	option = { 
		name = makhno.59.a
	}
}
# Anarchy on rising - trash lustration
country_event = {
	id = makhno.60
	title = makhno.60.t
	desc = makhno.60.d
	picture = GFX_report_event_worker_protests

	is_triggered_only = yes

	option = { 
		name = makhno.60.a
		add_stability = -0.02
		hidden_effect = {
			country_event = { id = makhno.61 days = 10 random_days = 5 }
		}
	}
}
# Anarchy on rising - Nabat
country_event = {
	id = makhno.61
	title = makhno.61.t
	desc = makhno.61.d
	picture = GFX_report_event_generic_conference

	is_triggered_only = yes

	option = { 
		name = makhno.61.a
		add_political_power = -25
		hidden_effect = {
			country_event = { id = makhno.62 days = 20 random_days = 10 }
		}
	}
}
# Anarchy on rising - massive unrest
country_event = {
	id = makhno.62
	title = makhno.62.t
	desc = makhno.62.d
	picture = GFX_report_event_generic_riot

	is_triggered_only = yes

	option = { 
		name = makhno.62.a
		add_stability = -0.05
		add_political_power = -25
		hidden_effect = {
			country_event = { id = makhno.1 days = 10 random_days = 5 }
		}
	}
}
# Ukrainian rebellion in poland civil war - message for DKR
country_event = {
	id = makhno.63
	title = makhno.63.t
	desc = makhno.63.d
	picture = GFX_report_event_west_ukrainian_rebels

	is_triggered_only = yes

	trigger = {
		exists = yes
	}

	option = {
		name = makhno.63.a
		if = {
			limit = { NOT = { has_idea = UKR_help_for_wua_rebels } }
			add_ideas = UKR_help_for_wua_rebels
		}
		WUA = { 
			add_timed_idea = {
				idea = WUA_stand_before_support
				days = 15
			} 
			add_opinion_modifier = { target = DKR modifier = UKR_great_motherland_opinion }
		}
		hidden_effect = {
			every_other_country = {
				limit = {
					original_tag = POL
					has_war_with = WUA
				}
				country_event = { id = ukraine.444 days = 75 }
			}
			WUA = { country_event = { id = makhno.64 days = 78 } }
		}
	}
}
# White peace POL with WUA - WUA is annexed by DKR
country_event = {
	id = makhno.64
	title = makhno.64.t
	desc = makhno.64.d

	is_triggered_only = yes

	trigger = {
		any_other_country = {
			original_tag = POL
			NOT = { has_war_with = WUA }
		}
	}

	option = {
		name = makhno.64.a
		ai_chance = {
			base = 100
		}
		clr_global_flag = DKR_intervention_in_poland_cw
		custom_effect_tooltip = GAME_OVER_TT
		remove_state_core = 89
		remove_state_core = 91
		remove_state_core = 93
		remove_state_core = 1052
		DKR = {
			country_event = makhno.65
			annex_country = { target = WUA transfer_troops = yes } 
		}
	}
	option = {
		name = makhno.64.a
		ai_chance = {
			base = 0
		}
		DKR = {
			create_wargoal = {
				type = annex_everything
				target = WUA
			} 
		}
	}
}
# Annexation of WUA - message for DKR
country_event = {
	id = makhno.65
	title = makhno.65.t
	desc = makhno.65.d
	picture = GFX_report_event_generic_peaceful_annexation

	is_triggered_only = yes

	option = { 
		name = makhno.65.a
		add_state_core = 89
		add_state_core = 91
		add_state_core = 93
		add_state_core = 1052
	}
}
# Further fate of militia units
country_event = {
	id = makhno.66
	title = makhno.66.t
	desc = makhno.66.d
	picture = GFX_report_event_makhnovist_militia

	is_triggered_only = yes

	option = {
		name = makhno.66.a
		ai_chance = {
			base = 100
		}
		DKR_increase_army_anarchy = yes
		add_war_support = 0.05
		set_division_template_lock = {
			division_template = "Samooborona anarhistiv"
			is_locked = no
		}
		if = {
			limit = { has_template = "Yevreiska brihada" }
			set_division_template_lock = {
				division_template = "Yevreiska brihada"
				is_locked = no
			}
		}
		if = {
			limit = { has_template = "Desertirska brihada" }
			set_division_template_lock = {
				division_template = "Desertirska brihada"
				is_locked = no
			}
		}
	}
	option = {
		name = makhno.66.b
		ai_chance = {
			base = 0
		}
		add_command_power = 25
		army_experience = 10
		add_war_support = -0.05
		delete_unit_template_and_units = {
			division_template = "Samooborona anarhistiv"
			disband = yes
		}
		if = {
			limit = { has_template = "Yevreiska brihada" }
			delete_unit_template_and_units = {
				division_template = "Yevreiska brihada"
				disband = yes
			}
		}
		if = {
			limit = { has_template = "Desertirska brihada" }
			delete_unit_template_and_units = {
				division_template = "Desertirska brihada"
				disband = yes
			}
		}
	}
}
# Political debates event
country_event = {
	id = makhno.67
	title = makhno.67.t
	desc = makhno.67.d

	is_triggered_only = yes

	option = {
		name = makhno.67.a
		ai_chance = {
			base = 50
		}
		set_country_flag = DKR_win_of_platformism
		custom_effect_tooltip = DKR_win_of_platformism_tt
	}
	option = {
		name = makhno.67.b
		ai_chance = {
			base = 50
		}
		set_country_flag = DKR_win_of_synthesism
		custom_effect_tooltip = DKR_win_of_synthesism_tt
	}
}
# Bands of anarcho-communists
country_event = {
	id = makhno.68
	title = makhno.68.t
	desc = makhno.68.d

	trigger = {
		is_ai = no
	}

	is_triggered_only = yes

	option = {
		name = makhno.68.a
		set_country_flag = DKR_east_opposition_of_anarcho_communists
		set_country_flag = DKR_south_opposition_of_anarcho_communists
		every_owned_state = {
			limit = {
				OR = {
					state = 227
					state = 228
					state = 221
					state = 196
					state = 200
				}
			}
			add_dynamic_modifier = {
				modifier = DKR_bands_of_anarcho_communists
				scope = DKR
			}
		}
		if = {
			limit = { has_country_flag = DKR_accepted_soviet_support }
			every_owned_state = {
				limit = {
					OR = {
						state = 193
						state = 225
					}
				}
				add_dynamic_modifier = {
					modifier = DKR_bands_of_anarcho_communists
					scope = DKR
				}
			}
			set_country_flag = DKR_north_opposition_of_anarcho_communists		
		}
		unlock_decision_category_tooltip = DKR_pacification_of_anarcho_communists
	}
}
# Request volunteers from Ethiopia
country_event = {
	id = makhno.69
	title = makhno.69.t
	desc = makhno.69.d

	is_triggered_only = yes

	option = {
		name = makhno.69.a
		add_relation_rule_override = {
			target = DKR
			can_send_volunteers = yes
		}
		if = {
			limit = { NOT = { has_idea = ETH_aid_SPC } }
			add_timed_idea = {
				idea = ETH_aid_SPC
				days = 365
			}
		}
		hidden_effect = {
			ROOT = {
				set_rule = { can_send_volunteers = yes }
				add_ai_strategy = {
					type = send_volunteers_desire
					id = DKR
					value = 200
				}
			}
		}			
	}	
}