namespace = war_of_the_roses

# Start Event
country_event = {
	id = war_of_the_roses.1
	title = war_of_the_roses.1.t
	desc = war_of_the_roses.1.d
		
	picture = WAR_OF_THE_ROSES_eventPicture
	major = yes
	

	is_triggered_only = yes
	
	mean_time_to_happen = {
		days = 1
	}
		
	immediate = {
		set_country_flag = had_war_of_the_roses
		hidden_effect = {
			add_country_modifier = {
				name = wotr_one_year_timer
				duration = 365
				hidden = yes
			}
		}
	}
	
	option = {		# Support the House of Lancaster
		name = war_of_the_roses.1.a

		add_stability = -2
		set_country_flag = war_of_the_roses
		set_country_flag = supports_house_of_lancaster

		define_ruler = {
			dynasty = "000000"
			age = 31
		}
		if = {
			limit = {
				has_states_general_mechanic = yes
			}
			change_statists_vs_orangists = 1
		}
		if = {
			limit = {
				has_dlc = "Rights of Man" 
			}
			hidden_effect = { add_ruler_personality_ancestor = { key = well_connected } }
		}
		add_yearly_manpower = -2.5

		if = {
			limit = {
				owns = 245		# Yorkshire
				245 = {
					NOT = { units_in_province = 1 }
				}
			}
			245 = {
				add_province_modifier = {
					name = wotr_local_support_for_york
					duration = 3650
				}
				spawn_rebels = {
					type = pretender_rebels
					size = 3
					leader = "Richard"
					leader_dynasty = "York"
					win = yes
				}
			}
		}
		else = {
			random_owned_province = {
				limit = {
					region = british_isles_region
					OR = {
						NOT = {
							root = {
								any_owned_province = {
									region = british_isles_region
									NOT = { units_in_province = 1 }
								}
							}
						}
						NOT = { units_in_province = 1 }
					}
				}
				add_province_modifier = {
					name = wotr_local_support_for_york
					duration = 3650
				}
				spawn_rebels = {
					type = pretender_rebels
					size = 3
					leader = "Richard"
					leader_dynasty = "York"
					win = yes
				}
			}
		}
	}

	option = {		# Support the House of York
		name = war_of_the_roses.1.b

		add_stability = -2
		set_country_flag = supports_house_of_york
		define_ruler = {
			dynasty = "000"
			age = 31
		}
		if = {
			limit = {
				has_states_general_mechanic = yes
			}
			change_statists_vs_orangists = 1
		}
		if = {
			limit = {
				has_dlc = "Rights of Man" 
			}
			hidden_effect = { add_ruler_personality_ancestor = { key = tactical_genius } }
		}
		add_yearly_manpower = -2.5
		if = {
			limit = {
				owns = 244		# Lancashire
				244 = {
					NOT = { units_in_province = 1 }
				}
			}
			244 = {
				add_province_modifier = {
					name = wotr_local_support_for_lancaster
					duration = 3650
				}
				spawn_rebels = {
					type = pretender_rebels
					size = 3
					leader = "Edward"
					leader_dynasty = "Lancaster"
					win = yes
				}
			}
		}
		else = {
			random_owned_province = {
				limit = {
					region = british_isles_region
					OR = {
						NOT = {
							root = {
								any_owned_province = {
									region = british_isles_region
									NOT = { units_in_province = 1 }
								}
							}
						}
						NOT = { units_in_province = 1 }
					}
				}
				add_province_modifier = {
					name = wotr_local_support_for_lancaster
					duration = 3650
				}
				spawn_rebels = {
					type = pretender_rebels
					size = 3
					leader = "Edward"
					leader_dynasty = "Lancaster"
					win = yes
				}
			}
		}
	}
}


########################################
# Provinces Declare their Support
########################################

# Support in Province
country_event = {
	id = war_of_the_roses.2
	title = war_of_the_roses.2.t
	desc = war_of_the_roses.2.d
	picture = WAR_OF_THE_ROSES_eventPicture
	
	
	trigger = {
		any_owned_province = {
			is_overseas = no
			NOT = { has_province_modifier = wotr_local_support }
			NOT = { has_province_modifier = wotr_local_support_for_lancaster }
			NOT = { has_province_modifier = wotr_local_support_for_york }
			NOT = { has_province_modifier = disgruntled_nobles }
		}
	}
	
	is_triggered_only = yes
	
	mean_time_to_happen = {
		days = 1
	}
	
	
	
	option = {		# This is most welcomed
		name = war_of_the_roses.2.a
		random_owned_province = {
			limit = {
				is_overseas = no
				NOT = { has_province_modifier = wotr_local_support }
				NOT = { has_province_modifier = wotr_local_support_for_lancaster }
				NOT = { has_province_modifier = wotr_local_support_for_york }
				NOT = { has_province_modifier = disgruntled_nobles }
			}
			add_province_modifier = {
				name = wotr_local_support
				duration = 3650
			}
			every_neighbor_province = {
				limit = {	
					owned_by = ROOT
					NOT = { has_province_modifier = wotr_local_support }
					NOT = { has_province_modifier = wotr_local_support_for_lancaster }
					NOT = { has_province_modifier = wotr_local_support_for_york }
					NOT = { has_province_modifier = disgruntled_nobles }
				}
				add_province_modifier = {
					name = wotr_local_support
					duration = 3650
				}
			}
		}
		
	}
}

# Province Declares for Lancaster!
country_event = {
	id = war_of_the_roses.3
	title = war_of_the_roses.3.t
	desc = war_of_the_roses.3.d
	picture = WAR_OF_THE_ROSES_eventPicture
	
	
	trigger = {
		OR = {
			has_spawned_rebels = pretender_rebels
			has_country_flag = war_of_the_roses_pretender_fled
		}
		has_country_flag = supports_house_of_york
		any_owned_province = {
			is_overseas = no
			is_capital = no
			NOT = { has_province_modifier = wotr_local_support }
			NOT = { has_province_modifier = wotr_local_support_for_lancaster }
			NOT = { has_province_modifier = wotr_local_support_for_york }
		}
	}
	
	is_triggered_only = yes
	
	mean_time_to_happen = {
		days = 1
	}

	immediate = {
		hidden_effect = {
			random_owned_province = {
				limit = {
					is_overseas = no
					NOT = { has_province_modifier = wotr_local_support }
					NOT = { has_province_modifier = wotr_local_support_for_lancaster }
					NOT = { has_province_modifier = wotr_local_support_for_york }
				}
				save_event_target_as = disloyal_province
			}
		}
	}
	
	option = { # Dire news
		name = war_of_the_roses.3.a
	
		event_target:disloyal_province = {
			add_province_modifier = {
				name = wotr_local_support_for_lancaster
				duration = 3650
			}
			every_neighbor_province = {
				limit = {
					owned_by = ROOT
					NOT = { has_province_modifier = wotr_local_support }
					NOT = { has_province_modifier = wotr_local_support_for_lancaster }
					NOT = { has_province_modifier = wotr_local_support_for_york  }
				}
				add_province_modifier = {
					name = wotr_local_support_for_lancaster
					duration = 3650
				}
			}
		}
	}
}

# Province Declares for York!
country_event = {
	id = war_of_the_roses.4
	title = war_of_the_roses.4.t
	desc = war_of_the_roses.4.d
	picture = WAR_OF_THE_ROSES_eventPicture
	
	trigger = {
		OR = {
			has_spawned_rebels = pretender_rebels
			has_country_flag = war_of_the_roses_pretender_fled
		}
		has_country_flag = supports_house_of_lancaster
		any_owned_province = {
			is_overseas = no
			is_capital = no
			NOT = { has_province_modifier = wotr_local_support }
			NOT = { has_province_modifier = wotr_local_support_for_lancaster }
			NOT = { has_province_modifier = wotr_local_support_for_york }
		}
	}

	is_triggered_only = yes
	
	mean_time_to_happen = {
		days = 1
	}

	immediate = {
		hidden_effect = {
			random_owned_province = {
				limit = {
					is_overseas = no
					NOT = { has_province_modifier = wotr_local_support }
					NOT = { has_province_modifier = wotr_local_support_for_lancaster }
					NOT = { has_province_modifier = wotr_local_support_for_york }
				}
				save_event_target_as = disloyal_province
			}
		}
	}
	
	option = {		# Dire news
		name = war_of_the_roses.4.a
		
		event_target:disloyal_province = {
			add_province_modifier = {
				name = wotr_local_support_for_york
				duration = 3650
			}
			every_neighbor_province = {
				limit = {
					owned_by = ROOT
					NOT = { has_province_modifier = wotr_local_support }
					NOT = { has_province_modifier = wotr_local_support_for_lancaster }
				}
				add_province_modifier = {
					name = wotr_local_support_for_york
					duration = 3650
				}
			}
		}		
	}
}




########################################
# Internal Problems
########################################

# Nobles Disgruntled in Province
country_event = {
	id = war_of_the_roses.5
	title = war_of_the_roses.5.t
	desc = war_of_the_roses.5.d
	
	picture = WAR_OF_THE_ROSES_eventPicture
	
	trigger = {
		any_owned_province = {
			has_province_modifier = wotr_local_support
		}
	}
	
	is_triggered_only = yes
	
	mean_time_to_happen = {
		days = 1
	}
	
	option = {		# These gifts should show our gratitude
		name = war_of_the_roses.5.a
		ai_chance = { factor = 50 }
		add_years_of_income = -0.25
	}
	option = {		# It is nothing but their duty
		name = war_of_the_roses.5.b
		ai_chance = { factor = 50 }
		random_owned_province = {
			limit = {
				has_province_modifier = wotr_local_support
			}
			remove_province_modifier = wotr_local_support
			add_province_modifier = {
				name = disgruntled_nobles
				duration = 1825
			}
		}		
	}
}

# Rebel Leaders Captured
province_event = {
	id = war_of_the_roses.6
	title = war_of_the_roses.6.t
	desc = war_of_the_roses.6.d
	picture = WAR_OF_THE_ROSES_eventPicture

	is_triggered_only = yes
	fire_only_once = yes
	
	trigger = {
		FROM = { tag = REB }
		OR = { #so that is isn't unrelated rebels
			region = british_isles_region
			NOT = { nationalism = 1 }
		}
		owner = {
			has_disaster = war_of_the_roses
			tag = ENG
		}
	}
	
	option = {		# Pardon them
		name =  war_of_the_roses.6.a
		ai_chance = { factor = 50 }
		owner = {
			add_legitimacy = -10
			add_country_modifier = {
				name = benign_ruler
				duration = 1825
			}
		}
	}
	option = {		# Execute them
		name =  war_of_the_roses.6.b
		ai_chance = { factor = 50 }
		owner = {
			add_legitimacy = 10
			add_country_modifier = {
				name = rebel_leaders_executed
				duration = 1095
			}
		}
	}
}

# Soldiers Desert
country_event = {
	id =  war_of_the_roses.7
	title = war_of_the_roses.7.t
	desc = war_of_the_roses.7.d
	picture = WAR_OF_THE_ROSES_eventPicture
	
	trigger = { #otherwise option A is too easy
		manpower_percentage = 0.1
	}

	is_triggered_only = yes
	fire_only_once = yes
	
	mean_time_to_happen = {
		days = 1
	}
	
	option = {		# There is nothing we can do
		name = war_of_the_roses.7.a
		ai_chance = { factor = 10 }
		add_yearly_manpower = -2.5
		add_legitimacy = -5
	}
	option = {		# Import food from abroad
		name = war_of_the_roses.7.b
		ai_chance = { factor = 70 }
		add_country_modifier = {
			name = importing_food
			duration = 1825
		}
	}
	option = {		# Let them take from the local peasants
		name = war_of_the_roses.7.c
		ai_chance = { factor = 20 }
		add_country_modifier = {
			name = plundering_soldiers
			duration = 1825
		}
	}
}

# Legitimacy Questioned
country_event = {
	id =  war_of_the_roses.8
	title =  war_of_the_roses.8.t
	desc =  war_of_the_roses.8.d
	picture = WAR_OF_THE_ROSES_eventPicture
	
	trigger = {
		NOT = { legitimacy = 50 }
	}
	
	is_triggered_only = yes
	fire_only_once = yes
	
	mean_time_to_happen = {
		days = 1
	}
	

	option = {		# Buy their continued support
		name =  war_of_the_roses.8.a
		ai_chance = { factor = 50 }
		add_years_of_income = -0.25
	}
	option = {		# How dare they question me?
		name =  war_of_the_roses.8.b
		ai_chance = { factor = 50 }
		add_country_modifier = {
			name = legitimacy_questioned
			duration = 1825
		}
	}
}


########################################
# Rebel Stronghold & Invasion
########################################

# Rumors of Large Revolt in Province
country_event = {
	id = war_of_the_roses.9
	title = war_of_the_roses.9.t
	desc = war_of_the_roses.9.d
	picture = WAR_OF_THE_ROSES_eventPicture
	
	trigger = {
		any_owned_province = {
			NOT = { region = british_isles_region }
			unrest = 3
			OR = {
				has_province_modifier = wotr_local_support_for_lancaster
				has_province_modifier = wotr_local_support_for_york
			}
			NOT = { controlled_by = REB }
		}
	}
	
	is_triggered_only = yes
	fire_only_once = yes
	
	mean_time_to_happen = {
		days = 1
	}
	
	option = {		# Send money to help the local authorities
		name = war_of_the_roses.9.a
		ai_chance = { factor = 25 }
		add_years_of_income = -0.75
		add_dip_power = -50
	}
	option = {		# The money is better needed closer to home
		name = war_of_the_roses.9.b
		ai_chance = { factor = 75 }
		random_owned_province = {
			limit = {
				NOT = { region = british_isles_region }
				unrest = 3
				OR = {
					has_province_modifier = wotr_local_support_for_lancaster
					has_province_modifier = wotr_local_support_for_york
				}
				NOT = { controlled_by = REB }
			}
			spawn_rebels = {
				type = pretender_rebels
				size = 2
			}			
			add_province_modifier = {
				name = rebel_refugees
				duration = 3650
			}
		}
	}
}

# Lancaster Stronghold
province_event = {
	id = war_of_the_roses.10
	title = war_of_the_roses.10.t
	desc = war_of_the_roses.10.d
	picture = WAR_OF_THE_ROSES_eventPicture

	is_triggered_only = yes
	fire_only_once = yes
	
	trigger = {
		FROM = { tag = REB }
		has_province_modifier = rebel_refugees
		has_province_modifier = wotr_local_support_for_lancaster
	}
	
	
	option = {		# This is a serious threat
		name =  war_of_the_roses.10.a
		add_province_modifier = {
			name = rebel_stronghold
			duration = 1825
		}
	}
}

# York Stronghold
province_event = {
	id =   war_of_the_roses.11
	title =  war_of_the_roses.11.t
	desc =  war_of_the_roses.11.d
	picture = WAR_OF_THE_ROSES_eventPicture

	is_triggered_only = yes
	fire_only_once = yes
	
	trigger = {
		FROM = { tag = REB }
		has_province_modifier = rebel_refugees
		has_province_modifier = wotr_local_support_for_york
	}
	
	
	option = {		# This is a serious threat
		name = war_of_the_roses.11.a
		add_province_modifier = {
			name = rebel_stronghold
			duration = 1825
		}
	}
}


########################################
# Foreign Support
########################################

# Support House of Lancaster
country_event = {
	id = war_of_the_roses.12
	title = war_of_the_roses.12.t
	desc = war_of_the_roses.12.d
	picture = WAR_OF_THE_ROSES_eventPicture
	
	trigger = {
		ENG = {
			has_disaster = war_of_the_roses
			has_country_flag = supports_house_of_york
			has_spawned_rebels = pretender_rebels
		}
		NOT = { tag = ENG }
		OR = {
			is_neighbor_of = ENG
			AND = {
				num_of_cities = 2
				capital_scope = {
					region = british_isles_region
				}
			}
			AND = {
				OR = {
					is_rival = ENG
					ENG = { is_rival = prev }
				}
				any_owned_province = {
					has_port = yes
				}
				236 = { range = root }
			}
		}
		is_subject = no
		NOT = { alliance_with = ENG }
		NOT = { overlord_of = ENG }
		NOT = {
			has_opinion = {
				who = ENG
				value = 0
			}
		}
		NOT = { has_country_flag = support_for_war_of_the_roses }
		NOT = { has_country_flag = no_support_for_rose_rebels }
		ENG = {
			any_owned_province = {
				OR = {
					any_neighbor_province = {
						owned_by = ROOT
					}
					has_port = yes
				}
				if = {
					limit = {
						ROOT = {
							capital_scope = {
								region = british_isles_region
							}
						}
					}
					region = british_isles_region
				}
				unit_in_siege = no
			}
		}
	}
	
	mean_time_to_happen = {
		months = 24
		modifier = {
			factor = 0.75
			ENG = { has_country_modifier = rebel_leaders_executed }
		}
		modifier = {
			factor = 0.5
			ENG = { has_country_modifier = wotr_one_year_timer }
		}
		modifier = {
			factor = 2
			NOT = { num_of_cities = 2 }
		}
		modifier = {
			factor = 2
			NOT = { num_of_cities = 3 }
		}
		modifier = {
			factor = 3
			ENG = { num_of_rebel_armies = 3 }
		}
		modifier = {
			factor = 0.25
			ENG = { has_country_modifier = wotr_rebels_resurgent }
		}
	}
	
	option = {		# Send them a token force
		name = war_of_the_roses.12.a
		trigger = {
			manpower = 5
		}
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0.5
				NOT = { manpower = 7 }
			}
			modifier = {
				factor = 0.5
				is_at_war = yes
			}
			modifier = {
				factor = 2
				manpower = 20
			}
		}
		set_country_flag = support_for_war_of_the_roses
		add_manpower = -5
		hidden_effect = {
			ENG = {
				country_event = { id = war_of_the_roses.14 }
			}
		}
	}
	option = {		# Send them some money
		name = war_of_the_roses.12.b
		ai_chance = {
			factor = 25
			modifier = {
				factor = 0
				NOT = { years_of_income = 0.5 }
				num_of_loans = 5
			}
		}
		trigger = { is_bankrupt = no }
		set_country_flag = support_for_war_of_the_roses
		add_years_of_income = -0.5
		hidden_effect = {
			ENG = {
				country_event = { id = war_of_the_roses.14 }
			}
		}
	}
	option = {		# We will not support rebels
		name = war_of_the_roses.12.c
		ai_chance = {
			factor = 25
			modifier = {
				factor = 0.1
				OR = {
					is_rival = ENG
					ENG = { is_rival = prev }
				}
			}
			modifier = {
				factor = 2
				has_opinion = {
					who = ENG
					value = -15
				}
			}
			modifier = {
				factor = 1.5
				has_opinion = {
					who = ENG
					value = -25
				}
			}
		}
		set_country_flag = no_support_for_rose_rebels
		add_prestige = 10
	}
}

# Support House of York
country_event = {
	id = war_of_the_roses.13
	title = war_of_the_roses.13.t
	desc = war_of_the_roses.13.d
	picture = WAR_OF_THE_ROSES_eventPicture
	
	trigger = {
		ENG = {
			has_disaster = war_of_the_roses
			has_country_flag = supports_house_of_lancaster
			has_spawned_rebels = pretender_rebels
		}
		NOT = { tag = ENG }
		OR = {
			is_neighbor_of = ENG
			AND = {
				num_of_cities = 2
				capital_scope = {
					region = british_isles_region
				}
			}
			AND = {
				OR = {
					is_rival = ENG
					ENG = { is_rival = prev }
				}
				any_owned_province = {
					has_port = yes
				}
				236 = { range = root }
			}
		}
		is_subject = no
		NOT = { alliance_with = ENG }
		NOT = { overlord_of = ENG }
		NOT = {
			has_opinion = {
				who = ENG
				value = 0
			}
		}
		NOT = { has_country_flag = support_for_war_of_the_roses }
		NOT = { has_country_flag = no_support_for_rose_rebels }
		ENG = {
			any_owned_province = {
				OR = {
					any_neighbor_province = {
						owned_by = ROOT
					}
					has_port = yes
				}
				if = {
					limit = {
						ROOT = {
							capital_scope = {
								region = british_isles_region
							}
						}
					}
					region = british_isles_region
				}
				unit_in_siege = no
			}
		}
	}

	
	mean_time_to_happen = {
		months = 24
		modifier = {
			factor = 0.75
			ENG = { has_country_modifier = rebel_leaders_executed }
		}
		modifier = {
			factor = 0.5
			ENG = { has_country_modifier = wotr_one_year_timer }
		}
		modifier = {
			factor = 2
			NOT = { num_of_cities = 2 }
		}
		modifier = {
			factor = 2
			NOT = { num_of_cities = 3 }
		}
		modifier = {
			factor = 3
			ENG = { num_of_rebel_armies = 3 }
		}
		modifier = {
			factor = 0.25
			ENG = { has_country_modifier = wotr_rebels_resurgent }
		}
	}
	
	option = {		# Send them a token force
		name = war_of_the_roses.13.a
		trigger = {
			manpower = 5
		}
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0.5
				NOT = { manpower = 7 }
			}
			modifier = {
				factor = 0.5
				is_at_war = yes
			}
			modifier = {
				factor = 2
				manpower = 20
			}
		}
		set_country_flag = support_for_war_of_the_roses
		add_manpower = -5
		hidden_effect = {
			ENG = {
				country_event = { id = war_of_the_roses.14 }
			}
		}
	}
	option = {		# Send them some money
		name = war_of_the_roses.13.b
		ai_chance = {
			factor = 25
			modifier = {
				factor = 0
				NOT = { years_of_income = 0.5 }
				num_of_loans = 5
			}
		}
		trigger = { is_bankrupt = no }
		set_country_flag = support_for_war_of_the_roses
		add_years_of_income = -0.5
		hidden_effect = {
			ENG = {
				country_event = { id = war_of_the_roses.14 }
			}
		}
	}
	option = {		# We will not support rebels
		name = war_of_the_roses.13.c
		ai_chance = {
			factor = 25
			modifier = {
				factor = 0.1
				OR = {
					is_rival = ENG
					ENG = { is_rival = prev }
				}
			}
			modifier = {
				factor = 2
				has_opinion = {
					who = ENG
					value = -15
				}
			}
			modifier = {
				factor = 1.5
				has_opinion = {
					who = ENG
					value = -25
				}
			}
		}
		set_country_flag = no_support_for_rose_rebels
		add_prestige = 10
	}
}

# Country Intervenes!
country_event = {
	id = war_of_the_roses.14
	title = war_of_the_roses.14.t
	desc = war_of_the_roses.14.d
	picture = WAR_OF_THE_ROSES_eventPicture
	
	is_triggered_only = yes
	
	immediate = {
		hidden_effect = { #This is necessary because it breaks the whole disaster if you wait until you have defeated the initial pretender rebels before clicking the option.
			if = {
				limit = {
					any_owned_province = {
						any_neighbor_province = {
							owned_by = FROM
						}
						unit_in_siege = no
					}
				}
				random_owned_province = {
					limit = {
						any_neighbor_province = {
							owned_by = FROM
						}
						unit_in_siege = no
					}
					save_event_target_as = the_province
					spawn_rebels = {
						type = pretender_rebels
						size = 1
						friend = FROM
					}
				}
			}
			else_if = {
				limit = {
					NOT = {
						any_owned_province = {
							any_neighbor_province = {
								owned_by = FROM
							}
							unit_in_siege = no
						}
					}
					any_owned_province = {
						has_port = yes
						unit_in_siege = no
						if = {
							limit = {
								ROOT = {
									capital_scope = {
										region = british_isles_region
									}
								}
							}
							region = british_isles_region
						}
					}
				}
				random_owned_province = {
					limit = {
						has_port = yes
						unit_in_siege = no
						if = {
							limit = {
								ROOT = {
									capital_scope = {
										region = british_isles_region
									}
								}
							}
							region = british_isles_region
						}
					}
					save_event_target_as = the_province
					spawn_rebels = {
						type = pretender_rebels
						size = 1
						friend = FROM
					}
				}
			}
		}
	}

	option = {		# How dare they!
		name = war_of_the_roses.14.a
		tooltip = {
			event_target:the_province = {
				spawn_rebels = {
					type = pretender_rebels
					size = 1
					friend = FROM
				}
			}
		}
	}
}


########################################
# The End of the War
########################################

# The End of the War of the Roses
country_event = {
	id = war_of_the_roses.100
	title = war_of_the_roses.100.t
	desc = war_of_the_roses.100.d
	picture = WAR_OF_THE_ROSES_eventPicture
	
	major = yes
	
	is_triggered_only = yes
	
	immediate = {
		on_non_estate_disaster_end = yes
		hidden_effect = {
			
			# Clear Flags
			
			# Clear Country Modifiers
			remove_country_modifier = low_fertility
			remove_country_modifier = importing_food
			remove_country_modifier = plundering_soldiers
			remove_country_modifier = legitimacy_questioned

			# Clear Province Modifiers
			every_owned_province = {
				if = {
					limit = {
						has_province_modifier = wotr_local_support
					}
					remove_province_modifier = wotr_local_support
				}
				if = {
					limit = {
						has_province_modifier = wotr_local_support_for_lancaster
					}
					remove_province_modifier = wotr_local_support_for_lancaster
				}
				if = {
					limit = {
						has_province_modifier = wotr_local_support_for_york
					}
					remove_province_modifier = wotr_local_support_for_york
				}
				if = {
					limit = {
						has_province_modifier = rebel_refugees
					}
					remove_province_modifier = rebel_refugees
				}
				if = {
					limit = {
						has_province_modifier = rebel_stronghold
					}
					remove_province_modifier = rebel_stronghold
				}
			}
			
			set_country_flag = war_of_the_roses_ended
		}
	}
	
	option = {		# Order has finally been restored
		name = war_of_the_roses.100.a
		add_stability_or_adm_power = yes
		add_prestige = 50
		hidden_effect = {
			if = {
				limit = {
					has_country_flag = supports_house_of_york
				}
				every_country = {
					limit = {
						has_country_flag = support_for_war_of_the_roses
					}
					country_event = { id = war_of_the_roses.104 days = 1 }
				}
				clr_country_flag = supports_house_of_york
			}
			if = {
				limit = {
					has_country_flag = supports_house_of_lancaster
				}
				every_country = {
					limit = {
						has_country_flag = support_for_war_of_the_roses
					}
					country_event = { id = war_of_the_roses.105 days = 1 }
				}
				clr_country_flag = supports_house_of_lancaster
			}
			if = {
				limit = {
					has_country_flag = supports_house_of_york
				}
				every_country = {
					limit = {
						has_country_flag = no_support_for_rose_rebels
					}
					country_event = { id = war_of_the_roses.104 days = 1 }
				}
			}
			if = {
				limit = {
					has_country_flag = supports_house_of_lancaster
				}
				every_country = {
					limit = {
						has_country_flag = no_support_for_rose_rebels
					}
					country_event = { id = war_of_the_roses.105 days = 1 }
				}
			}
		}
	}
}

# House of Lancaster wins the War of the Roses
country_event = {
	id = war_of_the_roses.101
	title = war_of_the_roses.101.t
	desc = war_of_the_roses.101.d
	picture = WAR_OF_THE_ROSES_eventPicture

	major = yes
	is_triggered_only = yes
	fire_only_once = yes
	
	trigger = {
		tag = ENG
		has_disaster = war_of_the_roses
		has_country_flag = supports_house_of_york
		dynasty = "000000"
	}
	
	immediate = {
		hidden_effect = {
			
			# Clear Flags
			clr_country_flag = supports_house_of_lancaster
			clr_country_flag = supports_house_of_york

			# Clear Country Modifiers
			remove_country_modifier = importing_food
			remove_country_modifier = plundering_soldiers
			remove_country_modifier = legitimacy_questioned
			remove_country_modifier = low_fertility

			# Clear Province Modifiers
			every_owned_province = {
				if = {
					limit = {
						has_province_modifier = wotr_local_support
					}
					remove_province_modifier = wotr_local_support
				}
				if = {
					limit = {
						has_province_modifier = wotr_local_support_for_lancaster
					}
					remove_province_modifier = wotr_local_support_for_lancaster
				}
				if = {
					limit = {
						has_province_modifier = wotr_local_support_for_york
					}
					remove_province_modifier = wotr_local_support_for_york
				}
				if = {
					limit = {
						has_province_modifier = rebel_refugees
					}
					remove_province_modifier = rebel_refugees
				}
				if = {
					limit = {
						has_province_modifier = rebel_stronghold
					}
					remove_province_modifier = rebel_stronghold
				}
			}
		}
		set_country_flag = war_of_the_roses_ended
		end_disaster = war_of_the_roses
	}
	
	option = {		# Long live the House of Lancaster!
		name = war_of_the_roses.101.a
		add_stability_or_adm_power = yes
		add_prestige = -50
		hidden_effect = {
			every_country = {
				limit = {
					has_country_flag = support_for_war_of_the_roses
				}
				country_event = { id = war_of_the_roses.103 days = 1 }
			}
		}
	}
}

# House of York wins the War of the Roses
country_event = {
	id = war_of_the_roses.102
	title = war_of_the_roses.102.t
	desc = war_of_the_roses.102.d
	picture = WAR_OF_THE_ROSES_eventPicture
	
	major = yes
	is_triggered_only = yes
	fire_only_once = yes
	
	trigger = {
		tag = ENG
		has_disaster = war_of_the_roses
		has_country_flag = supports_house_of_lancaster
		dynasty = "000"	
	}
	
	immediate = {
		hidden_effect = {
			# Clear Flags
			clr_country_flag = supports_house_of_lancaster
			clr_country_flag = supports_house_of_york

			# Clear Country Modifiers
			remove_country_modifier = importing_food
			remove_country_modifier = plundering_soldiers
			remove_country_modifier = legitimacy_questioned
			remove_country_modifier = low_fertility

			# Clear Province Modifiers
			every_owned_province = {
				if = {
					limit = {
						has_province_modifier = wotr_local_support
					}
					remove_province_modifier = wotr_local_support
				}
				if = {
					limit = {
						has_province_modifier = wotr_local_support_for_lancaster
					}
					remove_province_modifier = wotr_local_support_for_lancaster
				}
				if = {
					limit = {
						has_province_modifier = wotr_local_support_for_york
					}
					remove_province_modifier = wotr_local_support_for_york
				}
				if = {
					limit = {
						has_province_modifier = rebel_refugees
					}
					remove_province_modifier = rebel_refugees
				}
				if = {
					limit = {
						has_province_modifier = rebel_stronghold
					}
					remove_province_modifier = rebel_stronghold
				}
			}
		}
		set_country_flag = war_of_the_roses_ended
		end_disaster = war_of_the_roses
	}
	
	option = {		# Long live the House of York!
		name = war_of_the_roses.102.a
		add_stability_or_adm_power = yes
		add_prestige = -50
		hidden_effect = {
			every_country = {
				limit = {
					has_country_flag = support_for_war_of_the_roses
				}
				country_event = { id = war_of_the_roses.103 days = 1 }
			}
		}
	}
}

# Improved Relations with England
country_event = {
	id = war_of_the_roses.103
	title = war_of_the_roses.103.t
	desc = war_of_the_roses.103.d
	picture = WAR_OF_THE_ROSES_eventPicture
	
	is_triggered_only = yes
	
	immediate = {
		clr_country_flag = support_for_war_of_the_roses
	}
	
	option = {		# Good news
		name = war_of_the_roses.103.a
		FROM = {
			add_opinion = {
				who = ROOT
				modifier = eng_support_during_war_of_the_roses
			}
		}
	}
}

# Relations Deteriorate with England
country_event = {
	id = war_of_the_roses.104
	title = war_of_the_roses.104.t
	desc = war_of_the_roses.104.d
	picture = WAR_OF_THE_ROSES_eventPicture
	
	is_triggered_only = yes
	
	immediate = {
		clr_country_flag = support_for_war_of_the_roses
	}
	
	option = {		# Oh...
		name = war_of_the_roses.104.a
		trigger = { NOT = { has_country_flag = no_support_for_rose_rebels } }
		FROM = {
			add_opinion = {
				who = ROOT
				modifier = eng_supported_rebels_during_war_of_the_roses
			}
		}
	}
	option = {		# Good thing we didn't!
		name = war_of_the_roses.104.b
		trigger = { has_country_flag = no_support_for_rose_rebels }
		FROM = {
			add_opinion = {
				who = ROOT
				modifier = eng_didnt_support_rebels
			}
		}
		clr_country_flag = no_support_for_rose_rebels
	}
}

# Relations Deteriorate with England
country_event = {
	id = war_of_the_roses.105
	title = war_of_the_roses.105.t
	desc = war_of_the_roses.105.d
	picture = WAR_OF_THE_ROSES_eventPicture
	
	is_triggered_only = yes
	
	immediate = {
		clr_country_flag = support_for_war_of_the_roses
	}
	
	option = {		# Oh...
		name = war_of_the_roses.105.a
		trigger = { NOT = { has_country_flag = no_support_for_rose_rebels } }
		FROM = {
			add_opinion = {
				who = ROOT
				modifier = eng_supported_rebels_during_war_of_the_roses
			}
		}
	}
	option = {		# Good thing we didn't!
		name = war_of_the_roses.104.b
		trigger = { has_country_flag = no_support_for_rose_rebels }
		FROM = {
			add_opinion = {
				who = ROOT
				modifier = eng_didnt_support_rebels
			}
		}
		clr_country_flag = no_support_for_rose_rebels
	}
}

# An unrelated dynasty triumphs in the war of the roses.
country_event = {
	id = war_of_the_roses.106
	title = war_of_the_roses.106.t
	desc = war_of_the_roses.106.d
	picture = WAR_OF_THE_ROSES_eventPicture
	
	major = yes
	is_triggered_only = yes
	fire_only_once = yes
	
	trigger = {
		tag = ENG
		has_disaster = war_of_the_roses
		NOT = { dynasty = "000" }
		NOT = { dynasty = "000000" }
	}
	
	immediate = {
		hidden_effect = {
			set_country_flag = war_of_the_roses_was_had
			# Clear Flags
			clr_country_flag = supports_house_of_lancaster
			clr_country_flag = supports_house_of_york

			# Clear Country Modifiers
			remove_country_modifier = importing_food
			remove_country_modifier = plundering_soldiers
			remove_country_modifier = legitimacy_questioned
			remove_country_modifier = low_fertility

			# Clear Province Modifiers
			every_owned_province = {
				if = {
					limit = {
						has_province_modifier = wotr_local_support
					}
					remove_province_modifier = wotr_local_support
				}
				if = {
					limit = {
						has_province_modifier = wotr_local_support_for_lancaster
					}
					remove_province_modifier = wotr_local_support_for_lancaster
				}
				if = {
					limit = {
						has_province_modifier = wotr_local_support_for_york
					}
					remove_province_modifier = wotr_local_support_for_york
				}
				if = {
					limit = {
						has_province_modifier = rebel_refugees
					}
					remove_province_modifier = rebel_refugees
				}
				if = {
					limit = {
						has_province_modifier = rebel_stronghold
					}
					remove_province_modifier = rebel_stronghold
				}
			}
			
		}
		set_country_flag = war_of_the_roses_ended
		end_disaster = war_of_the_roses
	}
	
	option = {		# Long Live the X dynasty
		name = war_of_the_roses.106.a
		add_stability = -1
		add_prestige = -50
		every_owned_province = {
			limit = {
				OR = {
					province_id = 245
					province_id = 244
				}
			}
			add_province_modifier = {
				name = add_unrest_5_modifier
				duration = 3650
			}
		}
	}
}


#####Pretender flees (prevents very fast end to the disaster)
#From on_battle_won_province
country_event = {
	id = war_of_the_roses.200
	title = war_of_the_roses.200.name
	desc = {
		trigger = {
			has_country_flag = supports_house_of_lancaster
		}
		desc = war_of_the_roses.200.desc.york
	}
	desc = {
		trigger = {
			has_country_flag = supports_house_of_york
		}
		desc = war_of_the_roses.200.desc.lancaster
	}
	picture = WAR_OF_THE_ROSES_eventPicture
	is_triggered_only = yes

	trigger = {
		OR = {
			NOT = { has_spawned_rebels = pretender_rebels }
			NOT = { num_of_rebel_armies = 1 }
		}
	}

	immediate = {
		hidden_effect = {
			set_country_flag = war_of_the_roses_pretender_fled
			country_event = { id = war_of_the_roses.201 days = 60 random = 45 }
			add_country_modifier = {
				name = wotr_rebels_resurgent
				duration = 30
				hidden = yes
			}
		}
	}

	option = {
		name = war_of_the_roses.200.opt
	}
}

country_event = {
	id = war_of_the_roses.201
	title = war_of_the_roses.201.name
	desc = {
		trigger = {
			has_country_flag = supports_house_of_lancaster
		}
		desc = war_of_the_roses.201.desc.york
	}
	desc = {
		trigger = {
			has_country_flag = supports_house_of_york
		}
		desc = war_of_the_roses.201.desc.lancaster
	}
	picture = WAR_OF_THE_ROSES_eventPicture
	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			if = {
				limit = {
					any_owned_province = {
						controlled_by = root
						OR = {
							has_province_modifier = wotr_local_support_for_lancaster
							has_province_modifier = wotr_local_support_for_york
							has_province_modifier = rebel_stronghold
						}
						NOT = { units_in_province = 1 }
					}
				}
				random_owned_province = {
					limit = {
						controlled_by = root
						OR = {
							has_province_modifier = wotr_local_support_for_lancaster
							has_province_modifier = wotr_local_support_for_york
							has_province_modifier = rebel_stronghold
						}
						NOT = { units_in_province = 1 }
					}
					save_event_target_as = new_revolt_province
				}
			}
			else_if = {
				limit = {
					any_owned_province = {
						controlled_by = root
						region = british_isles_region
						NOT = { units_in_province = 1 }
						NOT = { has_province_modifier = wotr_local_support }
					}
				}
				random_owned_province = {
					limit = {
						controlled_by = root
						region = british_isles_region
						NOT = { units_in_province = 1 }
						NOT = { has_province_modifier = wotr_local_support }
					}
					save_event_target_as = new_revolt_province
				}
			}
			else_if = {
				limit = {
					any_owned_province = {
						controlled_by = root
						NOT = { has_province_modifier = wotr_local_support }
					}
				}
				random_owned_province = {
					limit = {
						controlled_by = root
						NOT = { has_province_modifier = wotr_local_support }
					}
					save_event_target_as = new_revolt_province
				}
			}
			else = {
				random_owned_province = {
					save_event_target_as = new_revolt_province
				}
			}
		}
	}

	option = {
		name = war_of_the_roses.201.opt
		event_target:new_revolt_province = {
			if = {
				limit = {
					ROOT = { has_country_flag = supports_house_of_york }
				}
				spawn_rebels = {
					type = pretender_rebels
					size = 2
					leader = "Edward"
					leader_dynasty = "Lancaster"
					win = yes
				}
			}
			else = {
				spawn_rebels = {
					type = pretender_rebels
					size = 2
					leader = "Richard"
					leader_dynasty = "York"
					win = yes
				}
			}
		}
	}

	after = {
		hidden_effect = {
			clr_country_flag = war_of_the_roses_pretender_fled
			if = {
				limit = { has_country_modifier = wotr_one_year_timer }
				remove_country_modifier = wotr_one_year_timer
			}
		}
	}
}