#######################
# written by Aetherum #
#######################

namespace = row

country_event = {
	id = row.1
	title = row.1.t
	desc = row.1.d
	picture = GE_VATICAN_eventPicture
	
	fire_only_once = yes
	
	trigger = {
	tag = ROW
	OR = {
	owns_core_province = 118
	owns_core_province = 2976
	owns_core_province = 119
	owns_core_province = 2977
	owns_core_province = 114
	}
	}
	
	mean_time_to_happen = {
		months = 1	
	}
	
	option = {
		name = row.1.a
		ai_chance = { factor = 90 }
		if = {
			limit = { 104 = { owned_by = ROOT } }
		104 = {
				move_capital_effect = yes
			}
		}
		if = {
			limit = { 118 = { owned_by = ROW } }
			118 = { 
				cede_province = PAP
				add_core = PAP
				remove_core = ROW
			}
		}
		if = {
			limit = { 2976 = { owned_by = ROW } }
			2976 = { 
				cede_province = PAP
				add_core = PAP
				remove_core = ROW
			}
		}
		if = {
			limit = { 119 = { owned_by = ROW } }
			119 = { 
				cede_province = PAP
				add_core = PAP
				remove_core = ROW
			}
		}
		if = {
			limit = { 2977 = { owned_by = ROW } }
			2977 = { 
				cede_province = PAP
				add_core = PAP
				remove_core = ROW
			}
		}
		if = {
			limit = { 114 = { owned_by = ROW } }
			114 = { 
				cede_province = PAP
				add_core = PAP
				remove_core = ROW
			}
		}
		if = {
			limit = { is_religion_enabled = catholic }
			PAP = { change_religion = catholic }
		}
		add_prestige = 25
	}
	
	option = {
		name = row.1.b
		ai_chance = { factor = 10 }
		if = {
			limit = { 118 = { owned_by = ROW } }
			118 = { 
				add_core = PAP
			}
		}
		if = {
			limit = { 2976 = { owned_by = ROW } }
			2976 = { 
				add_core = PAP
			}
		}
		if = {
			limit = { 119 = { owned_by = ROW } }
			119 = { 
				add_core = PAP
			}
		}
		if = {
			limit = { 2977 = { owned_by = ROW } }
			2977 = { 
				add_core = PAP
			}
		}
		if = {
			limit = { 114 = { owned_by = ROW } }
			114 = { 
				add_core = PAP
			}
		}
		add_prestige = -100
	}
	
	
}

country_event = {
	id = row.2
	title = row.2.t
	desc = row.2.d
	picture = GE_NEW_HRE_CORONATION_eventPicture
	
	fire_only_once = yes
	
	trigger = {
	tag = ROW
	is_religion_enabled = catholic
	}
	
	mean_time_to_happen = {
		months = 1		
	}
	
	option = {
		name = row.2.a
		ai_chance = { factor = 50 }
		change_tag = HRE
		add_country_modifier = {
				name = "HRE"
				duration = -1
			} 
		PAP = {
			add_opinion = {
				who = HRE
				modifier = new_enemy
			}
		}
		add_opinion = {
				who = PAP
				modifier = new_enemy
			}
		italy_region = {
			add_permanent_claim = HRE
		}
		emperor = {
			add_opinion = {
				who = root
				modifier = new_enemy
				}
		}
		every_owned_province = {
				set_in_empire = no
				add_claim = emperor
			}
		elector = no
	}
	
	option = {
		name = row.2.b
		ai_chance = { factor = 50 }
		add_prestige = 25
		add_papal_influence = 100
		PAP = {
			add_opinion = {
				who = HRE
				modifier = ffriend
			}
		}
		add_opinion = {
				who = PAP
				modifier = ffriend
			}
	}
	
}

country_event = {
	id = row.3
	title = row.3.t
	desc = row.3.d
	picture = GE_HRE_CRUSADE_eventPicture
	
	trigger = {
	tag = HRE
	owns_core_province = 118
	NOT = { has_country_flag = conquest_of_rome_hre_flag }
	}
	
	mean_time_to_happen = {
		months = 1		
	}
	
	option = {
		name = row.3.a
		ai_chance = { factor = 50 }
		118 = {
				move_capital_effect = yes
			}
		add_country_modifier = {
				name = "THE_PAP"
				duration = -1
			} 
		set_papacy_active = no
		set_country_flag = conquest_of_rome_hre_flag
		every_known_country = {
				limit = { religion = catholic }
				add_opinion = {
					modifier = "eenemy"
					who = ROOT
				}
			add_casus_belli = {	
				target = ROOT
				type = cb_crusade
			}
			}
	}
	
	option = {
	name = row.3.b
	ai_chance = { factor = 50 }
	118 = { 
				cede_province = PAP
				add_core = PAP
				remove_core = HRE
			}
	PAP = {
			add_opinion = {
				who = HRE
				modifier = ffriend
			}
		}
		add_opinion = {
				who = PAP
				modifier = ffriend
			}
	}
	
}

country_event = {
	id = row.4
	title = row.4.t
	desc = row.4.d
	picture = GE_VATICAN_eventPicture
	
	trigger = {
	tag = HRE
	NOT = { owns_core_province = 118 }
    has_country_flag = conquest_of_rome_hre_flag
	}
	
	mean_time_to_happen = {
		months = 1		
	}
	
	option = {
		name = row.4.a
		remove_country_modifier = THE_PAP
		set_papacy_active = yes
		clr_country_flag = conquest_of_rome_hre_flag
		remove_casus_belli = {	
				target = ROOT
				type = cb_crusade
			}
	}
	
}

country_event = {
	id = row.5
	title = row.5.t
	desc = row.5.d
	picture = GE_HRE_REVOLUTION_eventPicture
	
	trigger = {
	OR = {
	tag = HRE
	tag = HLR
	}
	NOT = { government = monarchy  }
	}
	
	mean_time_to_happen = {
		months = 1		
	}
	
	option = {
		name = row.5.a
		if = {
			limit = { 104 = { owned_by = ROOT } }
		104 = {
				move_capital_effect = yes
			}
		}
		if = {
			limit = { 118 = { owned_by = HRE } }
			118 = { 
				cede_province = PAP
				add_core = PAP
				remove_core = HRE
			}
		}
		if = {
			limit = { 2976 = { owned_by = HRE } }
			2976 = { 
				cede_province = PAP
				add_core = PAP
				remove_core = HRE
			}
		}
		if = {
			limit = { 119 = { owned_by = HRE } }
			119 = { 
				cede_province = PAP
				add_core = PAP
				remove_core = HRE
			}
		}
		if = {
			limit = { 2977 = { owned_by = HRE } }
			2977 = { 
				cede_province = PAP
				add_core = PAP
				remove_core = HRE
			}
		}
		if = {
			limit = { 114 = { owned_by = HRE } }
			114 = { 
				cede_province = PAP
				add_core = PAP
				remove_core = HRE
			}
		}
		if = {
			limit = { 3129 = { owned_by = HRE } }
			3129 = { 
				cede_province = PAP
				add_core = PAP
				remove_core = HRE
			}
		}
		if = {
			limit = { 3128 = { owned_by = HRE } }
			3128 = { 
				cede_province = PAP
				add_core = PAP
				remove_core = HRE
			}
		}
		if = {
			limit = { is_religion_enabled = catholic }
			PAP = { change_religion = catholic }
		}
		remove_country_modifier = THE_PAP
		set_papacy_active = yes
		add_stability = -5
	    add_prestige = -25
		clr_country_flag = conquest_of_rome_hre_flag
		remove_casus_belli = {	
				target = ROOT
				type = cb_crusade
			}
		add_country_modifier = {
				name = "fall_of_hre"
				duration = -1
			}
	}
	
}