country_decisions = {
	send_ruler_to_rome_for_coronation = {
		major = yes
		color = { 210 185 105 }
		potential = {
			is_emperor = yes
			has_regency = no
			religion = catholic
			NOT = { is_religion_enabled = protestant }
			NOT = { has_ruler_flag = zum_kaiser_gekroent }
			NOT = {
				any_owned_province = {
					has_province_modifier = preparations_for_travel_to_rome
				}
			}
			NOT = { has_ruler_flag = sent_ruler_to_rome_to_become_emperor }
		}
		allow = {
			months_of_ruling = 36
			if = {
				limit = {
					started_in = 1444.1.1
				}
				if = {
					limit = {
						NOT = { is_year = 1600 }
					}
					treasury = 250
				}
				else = {
					treasury = 500
				}
			}
			else_if = {
				limit = {
					started_in = 1200.1.1
				}
				if = {
					limit = {
						NOT = { is_year = 1300 }
					}
					treasury = 250
				}
				else_if = {
					limit = {
						NOT = { is_year = 1400 }
					}
					treasury = 500
				}
				else = {
					treasury = 750
				}
			}
			else = {
				if = {
					limit = {
						NOT = { is_year = 1000 }
					}
					treasury = 250
				}
				else_if = {
					limit = {
						NOT = { is_year = 1200 }
					}
					treasury = 500
				}
				else_if = {
					limit = {
						NOT = { is_year = 1400 }
					}
					treasury = 750
				}
				else = {
					treasury = 1000
				}
			}
			papal_influence = 10
			prestige = 10
			if = {
				limit = {
					exists = PAP
				}
				reverse_has_opinion = {
					who = PAP
					value = 25
				}
				PAP = {
					OR = {
						custom_trigger_tooltip = {
							tooltip = POPE_WAS_NOT_REPLACED_BY_EMPEROR
							has_ruler_flag = replaced_pope_by_emperor
						}
						AND = {
							NOT = { has_spawned_rebels = pretender_rebels }
							capital_scope = {
								has_siege = no
								NOT = { controlled_by = REB }
							}
						}
					}
				}
			}
			else = {
				OR = {
					is_papal_controller = yes
					any_country = {
						is_papal_controller = yes
						has_opinion = {
							who = ROOT
							value = 0
						}
					}
				}
			}
			custom_trigger_tooltip = {
				tooltip = POPE_DID_NOT_REFUSE_TO_CROWN_US_EMPEROR_WITHIN_LAST_5_YEARS
				NOT = { has_ruler_modifier = pope_refused_crown_emperor_cooldown }
			}
		}
		effect = {
			if = {
				limit = {
					started_in = 1444.1.1
				}
				if = {
					limit = {
						NOT = { is_year = 1600 }
					}
					add_treasury = -250
				}
				else = {
					add_treasury = -500
				}
			}
			else_if = {
				limit = {
					started_in = 1200.1.1
				}
				if = {
					limit = {
						NOT = { is_year = 1300 }
					}
					add_treasury = -250
				}
				else_if = {
					limit = {
						NOT = { is_year = 1400 }
					}
					add_treasury = -500
				}
				else = {
					add_treasury = -750
				}
			}
			else = {
				if = {
					limit = {
						NOT = { is_year = 1000 }
					}
					add_treasury = -250
				}
				else_if = {
					limit = {
						NOT = { is_year = 1200 }
					}
					add_treasury = -500
				}
				else_if = {
					limit = {
						NOT = { is_year = 1400 }
					}
					add_treasury = -750
				}
				else = {
					add_treasury = -1000
				}
			}
			add_papal_influence = -10
			custom_tooltip = " "
			if = {
				limit = {
					OR = {
						has_global_flag = hre_incident_investiture_controversy_emperor
						NOT = {
							OR = {
								AND = {
									exists = PAP
									PAP = {
										has_ruler_flag = replaced_pope_by_emperor
									}
								}
								AND = {
									exists = PAP
									PAP = {
										has_opinion = {
											who = ROOT
											value = 75
										}
									}
								}
								AND = {
									NOT = { exists = PAP }
									is_papal_controller = yes
									OR = {
										papal_influence = 25
										invested_papal_influence = 25
									}
								}
								AND = {
									NOT = { exists = PAP }
									is_papal_controller = no
									any_country = {
										is_papal_controller = yes
										has_opinion = {
											who = ROOT
											value = 50
										}
									}
								}
							}
						}
					}
				}
				custom_tooltip = THE_POPE_MAY_REFUSE_TO_CROWN_RULER
			}
			custom_tooltip = RULER_MAKES_PREPARATIONS_TO_TRAVEL_TO_ROME
			hidden_effect = {
				set_ruler_flag = sent_ruler_to_rome_to_become_emperor
				capital_scope = {
					add_province_triggered_modifier = preparations_for_travel_to_rome
				}
			}
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				NOT = {
					OR = {
						AND = {
							exists = PAP
							PAP = {
								has_ruler_flag = replaced_pope_by_emperor
							}
						}
						AND = {
							exists = PAP
							PAP = {
								has_opinion = {
									who = ROOT
									value = 75
								}
							}
						}
						AND = {
							NOT = { exists = PAP }
							is_papal_controller = yes
							OR = {
								papal_influence = 25
								invested_papal_influence = 25
							}
						}
						AND = {
							NOT = { exists = PAP }
							is_papal_controller = no
							any_country = {
								is_papal_controller = yes
								has_opinion = {
									who = ROOT
									value = 50
								}
							}
						}
					}
				}
				NOT = { ruler_age = 50 }
				NOT = { months_of_ruling = 180 }
			}
			modifier = {
				factor = 0
				has_global_flag = hre_incident_investiture_controversy_emperor
			}
		}
	}

	free_imprisoned_ruler_decision = {
		potential = {
			any_country = {
				is_lesser_in_union = no
				has_casus_belli = {
					type = cb_free_imprisoned_ruler
					target = ROOT
				}
			}
		}
		allow = {
			custom_trigger_tooltip = {
				tooltip = FREE_IMPRISONED_RULER_DECISION_TRIGGER_TT
				any_country = {
					is_lesser_in_union = no
					NOT = { war_with = ROOT }
					NOT = { truce_with = ROOT }
					has_casus_belli = {
						type = cb_free_imprisoned_ruler
						target = ROOT
					}
					OR = {
						ROOT = { ai = no }
						alliance_with = ROOT
						AND = {
							ROOT = { is_emperor = yes }
							is_elector = yes
							NOT = { preferred_emperor = ROOT }
							all_elector = {
								NOT = { preferred_emperor = PREV }
							}
						}
					}
					OR = {
						is_emperor = no
						AND = {
							is_emperor = yes
							NOT = {
								any_country = {
									NOT = { tag = PREV }
									is_elected_by_more_hre_electors_than = { who = emperor }
								}
							}
							ROOT = { is_elected_by_less_hre_electors_than = { who = emperor } }
						}
					}
				}
			}
		}
		effect = {
			add_prestige = 5
			custom_tooltip = " "
			if = {
				limit = {
					any_country = {
						is_lesser_in_union = no
						NOT = { war_with = ROOT }
						NOT = { truce_with = ROOT }
						has_casus_belli = {
							type = cb_free_imprisoned_ruler
							target = ROOT
						}
						OR = {
							ROOT = { ai = no }
							alliance_with = ROOT
							AND = {
								ROOT = { is_emperor = yes }
								is_elector = yes
								NOT = { preferred_emperor = ROOT }
								all_elector = {
									NOT = { preferred_emperor = PREV }
								}
							}
						}
						OR = {
							is_emperor = no
							AND = {
								is_emperor = yes
								NOT = {
									any_country = {
										NOT = { tag = PREV }
										is_elected_by_more_hre_electors_than = { who = emperor }
									}
								}
								ROOT = { is_elected_by_less_hre_electors_than = { who = emperor } }
							}
						}
					}
				}
				random_country = {
					limit = {
						is_lesser_in_union = no
						NOT = { war_with = ROOT }
						NOT = { truce_with = ROOT }
						has_casus_belli = {
							type = cb_free_imprisoned_ruler
							target = ROOT
						}
						OR = {
							ROOT = { ai = no }
							alliance_with = ROOT
							AND = {
								ROOT = { is_emperor = yes }
								is_elector = yes
								NOT = { preferred_emperor = ROOT }
								all_elector = {
									NOT = { preferred_emperor = PREV }
								}
							}
						}
						OR = {
							is_emperor = no
							AND = {
								is_emperor = yes
								NOT = {
									any_country = {
										NOT = { tag = PREV }
										is_elected_by_more_hre_electors_than = { who = emperor }
									}
								}
								ROOT = { is_elected_by_less_hre_electors_than = { who = emperor } }
							}
						}
					}
					hidden_effect = {
						if = {
							limit = {
								has_heir = yes
								has_regency = no
							}
							exile_heir_as = heir_comes_back_after_exiled_ruler_came_back_@ROOT
							set_country_flag = heir_exiled_for_short_time
						}
					}
					set_ruler = emperor_imprisoned_ruler_of_@THIS
					hidden_effect = {
						if = {
							limit = {
								has_country_flag = heir_exiled_for_short_time
							}
							set_heir = heir_comes_back_after_exiled_ruler_came_back_@ROOT
							clr_country_flag = heir_exiled_for_short_time
						}
					}
					tooltip = {
						remove_opinion = {
							who = ROOT
							modifier = imprisoned_ruler_opinion
						}
						add_opinion = {
							who = ROOT
							modifier = imprisoned_ruler_let_free_opinion
						}
						remove_casus_belli = {
							target = ROOT
							type = cb_free_imprisoned_ruler
						}
					}
					hidden_effect = {
						country_event = { id = besseres_hrr_anti_king_events.6 }
					}
				}
			}
			else = {
				if = {
					limit = {
						any_country = {
							is_lesser_in_union = no
							war_with = ROOT
							has_casus_belli = {
								type = cb_free_imprisoned_ruler
								target = ROOT
							}
							OR = {
								ROOT = { ai = no }
								alliance_with = ROOT
								AND = {
									ROOT = { is_emperor = yes }
									is_elector = yes
									NOT = { preferred_emperor = ROOT }
									all_elector = {
										NOT = { preferred_emperor = PREV }
									}
								}
							}
							OR = {
								is_emperor = no
								AND = {
									is_emperor = yes
									NOT = {
										any_country = {
											NOT = { tag = PREV }
											is_elected_by_more_hre_electors_than = { who = emperor }
										}
									}
									ROOT = { is_elected_by_less_hre_electors_than = { who = emperor } }
								}
							}
						}
					}
					custom_tooltip = CAN_NOT_RELEASE_RULER_OF_COUNTRY_WE_ARE_AT_WAR_WITH
				}
				if = {
					limit = {
						any_country = {
							is_lesser_in_union = no
							truce_with = ROOT
							has_casus_belli = {
								type = cb_free_imprisoned_ruler
								target = ROOT
							}
							OR = {
								ROOT = { ai = no }
								alliance_with = ROOT
								AND = {
									ROOT = { is_emperor = yes }
									is_elector = yes
									NOT = { preferred_emperor = ROOT }
									all_elector = {
										NOT = { preferred_emperor = PREV }
									}
								}
							}
							OR = {
								is_emperor = no
								AND = {
									is_emperor = yes
									NOT = {
										any_country = {
											NOT = { tag = PREV }
											is_elected_by_more_hre_electors_than = { who = emperor }
										}
									}
									ROOT = { is_elected_by_less_hre_electors_than = { who = emperor } }
								}
							}
						}
					}
					custom_tooltip = CAN_NOT_RELEASE_RULER_OF_COUNTRY_WE_HAVE_TRUCE_WITH
				}
				if = {
					limit = {
						any_country = {
							is_lesser_in_union = no
							has_casus_belli = {
								type = cb_free_imprisoned_ruler
								target = ROOT
							}
							OR = {
								ROOT = { ai = no }
								alliance_with = ROOT
								AND = {
									ROOT = { is_emperor = yes }
									is_elector = yes
									NOT = { preferred_emperor = ROOT }
									all_elector = {
										NOT = { preferred_emperor = PREV }
									}
								}
							}
							is_emperor = yes
							OR = {
								any_country = {
									is_elected_by_more_hre_electors_than = { who = emperor }
								}
								ROOT = { is_elected_by_more_hre_electors_than = { who = emperor } }
							}
						}
					}
					custom_tooltip = CAN_NOT_RELEASE_RULER_OF_CURRENT_EMPEROR_THAT_WOULD_NOT_BE_REELECTED
				}
			}
		}
		ai_will_do = {
			factor = 1
		}
	}

	emperor_enact_golden_bull = {
		major = yes
		color = { 210 185 105 }
		potential = {
			NOT = { has_dlc = "Emperor" }
			NOT = { has_global_flag = hre_golden_bull_enacted }
			is_emperor = yes
			NOT = { hre_reform_passed = erbkaisertum }
			OR = {
				current_age = late_middle_ages
				# 1356
				current_age = age_of_feudalism
				current_age = age_of_discovery
				current_age = age_of_reformation
			}
			OR = {
				AND = {
					has_dlc = "Art of War"
					NOT = { had_global_flag = { flag = evangelical_union_happened days = 1825 } }
				}
				AND = {
					NOT = { has_dlc = "Art of War" }
					NOT = { is_year = 1600 }
				}
			}
		}
		allow = {
			is_emperor = yes
			is_part_of_hre = yes
			is_at_war = no
			if = {
				limit = {
					has_dlc = "Art of War"
				}
				hre_leagues_enabled = no
			}
			imperial_influence = 25
			hre_reform_passed = reichsreform
			has_regency = no
			if = {
				limit = {
					has_reform = salic_reform
				}
				NOT = { has_reform = salic_reform }
			}
		}
		effect = {
			set_global_flag = hre_golden_bull_enacted
			custom_tooltip = ELECTORS_OPINION_CHANGE_BECAUSE_OF_GOLDEN_BULL
			custom_tooltip = MEMBERS_OPINION_CHANGE_BECAUSE_OF_GOLDEN_BULL
			add_ruler_modifier = {
				name = enacted_golden_bull
				duration = -1
			}
			custom_tooltip = ELECTORS_NOW_HAVE_TO_BE_SECULAR_AND_ECCLESIASTICAL
			custom_tooltip = CURRENT_ELECTORS_COMPOSITION_1
			custom_tooltip = CURRENT_ELECTORS_COMPOSITION_2
			custom_tooltip = CURRENT_ELECTORS_COMPOSITION_3
			custom_tooltip = " "
			custom_tooltip = GOLDEN_BULL_ENABLE_IMPERIAL_ARCHOFFICES
			custom_tooltip = GOLDEN_BULL_NO_ANTI_KING_CB
			if = {
				limit = {
					allows_female_emperor = yes
				}
				set_allow_female_emperor = no
				set_global_flag = hre_golden_bull_disallowed_female_emperor
			}
			else = {
				custom_tooltip = HRE_GOLDEN_BULL_ONLY_MALE_EMPERORS
			}
			custom_tooltip = EMPEROR_GAINS_THESE_BONUSES_BECAUSE_OF_THE_GOLDEN_BULL
			custom_tooltip = ELECTORS_GAIN_THESE_BONUSES_BECAUSE_OF_THE_GOLDEN_BULL
			custom_tooltip = MEMBERS_GAIN_THESE_BONUSES_BECAUSE_OF_THE_GOLDEN_BULL
			hidden_effect = {
				every_elector = {
					limit = {
						NOT = { tag = ROOT }
					}
					if = {
						limit = {
							has_reform = salic_reform
						}
						add_government_reform = feudalism_reform
					}
					add_opinion = {
						who = ROOT
						modifier = enacted_golden_bull_opinion
					}
					ROOT = { add_truce_with = PREV }
				}
				every_country = {
					limit = {
						NOT = { tag = ROOT }
						is_elector = no
						is_part_of_hre = yes
					}
					add_opinion = {
						who = ROOT
						modifier = enacted_golden_bull_member_opinion
					}
				}
				country_event = { id = besseres_hrr_events.10 }
			}
		}
		ai_will_do = {
			factor = 1

			modifier = {
				factor = 0
				# 1356
				NOT = { current_age = age_of_feudalism }
				NOT = { current_age = late_middle_ages }
				NOT = { current_age = high_middle_ages }
				NOT = { current_age = age_of_discovery }
			}

			modifier = {
				factor = 0

				OR = {
					NOT = {
						calc_true_if = {
							all_country = {
								is_part_of_hre = yes
								is_a_secular_country = yes
							}
							amount = 4
						}
					}
					NOT = {
						calc_true_if = {
							all_country = {
								is_part_of_hre = yes
								is_an_ecclesiastical_country = yes
							}
							amount = 3
						}
					}
				}
			}
		}
	}

	emperor_remove_golden_bull = {
		major = yes
		color = { 210 185 105 }
		potential = {
			has_global_flag = hre_golden_bull_enacted
			NOT = { has_global_flag = hre_golden_bull_removed }
			NOT = { has_ruler_modifier = enacted_golden_bull }
			is_emperor = yes
			NOT = { hre_reform_passed = erbkaisertum }
			NOT = { hre_reform_passed = emperor_erbkaisertum }
		}
		allow = {
			is_emperor = yes
			is_part_of_hre = yes
			is_at_war = no
			stability = 1
			imperial_influence = 10
			if = {
				limit = {
					has_dlc = "Emperor"
				}
				hre_reform_passed = emperor_reichsreform
			}
			else = {
				hre_reform_passed = reichsreform
			}
			has_regency = no
		}
		effect = {
			set_global_flag = hre_golden_bull_removed
			add_stability = -1
			add_imperial_influence = -10
			add_ruler_modifier = {
				name = removed_golden_bull
				duration = 2555
			}
			custom_tooltip = ELECTORS_DO_NOT_HAVE_TO_BE_SECULAR_AND_ECCLESIASTICAL_ANYMORE
			custom_tooltip = GOLDEN_BULL_DISABLE_IMPERIAL_ARCHOFFICES
			custom_tooltip = NO_GOLDEN_BULL_ANTI_KING_CB
			if = {
				limit = {
					allows_female_emperor = no
					OR = {
						has_global_flag = hre_golden_bull_disallowed_female_emperor
						has_country_flag = pragmatic_sanction
						any_country = {
							has_country_flag = pragmatic_sanction
						}
					}
				}
				set_allow_female_emperor = yes
				clr_global_flag = hre_golden_bull_disallowed_female_emperor
			}
			else = {
				custom_tooltip = HRE_GOLDEN_BULL_NOT_ONLY_MALE_EMPERORS
			}
			every_elector = {
				limit = { NOT = { tag = ROOT } }
				add_opinion = {
					who = ROOT
					modifier = removed_golden_bull_opinion
				}
			}
			custom_tooltip = HRE_GOLDEN_BULL_REMOVE_OPINION_HIT_WITH_MEMBERS
			hidden_effect = {
				every_country = {
					limit = {
						NOT = { tag = ROOT }
						is_elector = no
						is_part_of_hre = yes
					}
					add_opinion = {
						who = ROOT
						modifier = removed_golden_bull_member_opinion
					}
				}
				country_event = { id = besseres_hrr_events.12 }
				hree_clear_imperial_archoffices = yes
			}
		}
		ai_will_do = {
			factor = 1

			modifier = {
				factor = 0
				hre_has_all_electors_appointed = yes
			}
			modifier = {
				factor = 0
				NOT = { hre_has_all_electors_appointed = yes }
				OR = {
					AND = {
						NOT = {
							calc_true_if = {
								all_countries_including_self = {
									is_part_of_hre = yes
									is_elector = yes
									is_a_secular_country = yes
								}
								amount = 4
							}
						}
						calc_true_if = {
							all_countries_including_self = {
								is_part_of_hre = yes
								is_elector = yes
								is_a_secular_country = yes
							}
							amount = 3
						}
						calc_true_if = {
							all_countries_including_self = {
								is_part_of_hre = yes
								is_elector = no
								is_a_secular_country = yes
							}
							amount = 1
						}
					}
					AND = {
						NOT = {
							calc_true_if = {
								all_countries_including_self = {
									is_part_of_hre = yes
									is_elector = yes
									is_a_secular_country = yes
								}
								amount = 3
							}
						}
						calc_true_if = {
							all_countries_including_self = {
								is_part_of_hre = yes
								is_elector = yes
								is_a_secular_country = yes
							}
							amount = 2
						}
						calc_true_if = {
							all_countries_including_self = {
								is_part_of_hre = yes
								is_elector = no
								is_a_secular_country = yes
							}
							amount = 2
						}
					}
					AND = {
						NOT = {
							calc_true_if = {
								all_countries_including_self = {
									is_part_of_hre = yes
									is_elector = yes
									is_a_secular_country = yes
								}
								amount = 2
							}
						}
						calc_true_if = {
							all_countries_including_self = {
								is_part_of_hre = yes
								is_elector = yes
								is_a_secular_country = yes
							}
							amount = 1
						}
						calc_true_if = {
							all_countries_including_self = {
								is_part_of_hre = yes
								is_elector = no
								is_a_secular_country = yes
							}
							amount = 3
						}
					}
					AND = {
						NOT = {
							calc_true_if = {
								all_countries_including_self = {
									is_part_of_hre = yes
									is_elector = yes
									is_a_secular_country = yes
								}
								amount = 1
							}
						}
						calc_true_if = {
							all_countries_including_self = {
								is_part_of_hre = yes
								is_elector = no
								is_a_secular_country = yes
							}
							amount = 4
						}
					}
					AND = {
						num_of_max_electors = { value = 8 }
						OR = {
							AND = {
								NOT = {
									calc_true_if = {
										all_countries_including_self = {
											is_part_of_hre = yes
											is_elector = yes
											is_an_ecclesiastical_country = yes
										}
										amount = 4
									}
								}
								calc_true_if = {
									all_countries_including_self = {
										is_part_of_hre = yes
										is_elector = yes
										is_an_ecclesiastical_country = yes
									}
									amount = 3
								}
								calc_true_if = {
									all_countries_including_self = {
										is_part_of_hre = yes
										is_elector = no
										is_an_ecclesiastical_country = yes
									}
									amount = 1
								}
							}
							AND = {
								NOT = {
									calc_true_if = {
										all_countries_including_self = {
											is_part_of_hre = yes
											is_elector = yes
											is_an_ecclesiastical_country = yes
										}
										amount = 3
									}
								}
								calc_true_if = {
									all_countries_including_self = {
										is_part_of_hre = yes
										is_elector = yes
										is_an_ecclesiastical_country = yes
									}
									amount = 2
								}
								calc_true_if = {
									all_countries_including_self = {
										is_part_of_hre = yes
										is_elector = no
										is_an_ecclesiastical_country = yes
									}
									amount = 2
								}
							}
							AND = {
								NOT = {
									calc_true_if = {
										all_countries_including_self = {
											is_part_of_hre = yes
											is_elector = yes
											is_an_ecclesiastical_country = yes
										}
										amount = 2
									}
								}
								calc_true_if = {
									all_countries_including_self = {
										is_part_of_hre = yes
										is_elector = yes
										is_an_ecclesiastical_country = yes
									}
									amount = 1
								}
								calc_true_if = {
									all_countries_including_self = {
										is_part_of_hre = yes
										is_elector = no
										is_an_ecclesiastical_country = yes
									}
									amount = 3
								}
							}
							AND = {
								NOT = {
									calc_true_if = {
										all_countries_including_self = {
											is_part_of_hre = yes
											is_elector = yes
											is_an_ecclesiastical_country = yes
										}
										amount = 1
									}
								}
								calc_true_if = {
									all_countries_including_self = {
										is_part_of_hre = yes
										is_elector = no
										is_an_ecclesiastical_country = yes
									}
									amount = 4
								}
							}
						}
					}
					AND = {
						NOT = { num_of_max_electors = { value = 8 } }
						OR = {
							AND = {
								NOT = {
									calc_true_if = {
										all_countries_including_self = {
											is_part_of_hre = yes
											is_elector = yes
											is_an_ecclesiastical_country = yes
										}
										amount = 3
									}
								}
								calc_true_if = {
									all_countries_including_self = {
										is_part_of_hre = yes
										is_elector = yes
										is_an_ecclesiastical_country = yes
									}
									amount = 2
								}
								calc_true_if = {
									all_countries_including_self = {
										is_part_of_hre = yes
										is_elector = no
										is_an_ecclesiastical_country = yes
									}
									amount = 1
								}
							}
							AND = {
								NOT = {
									calc_true_if = {
										all_countries_including_self = {
											is_part_of_hre = yes
											is_elector = yes
											is_an_ecclesiastical_country = yes
										}
										amount = 2
									}
								}
								calc_true_if = {
									all_countries_including_self = {
										is_part_of_hre = yes
										is_elector = yes
										is_an_ecclesiastical_country = yes
									}
									amount = 1
								}
								calc_true_if = {
									all_countries_including_self = {
										is_part_of_hre = yes
										is_elector = no
										is_an_ecclesiastical_country = yes
									}
									amount = 2
								}
							}
							AND = {
								NOT = {
									calc_true_if = {
										all_countries_including_self = {
											is_part_of_hre = yes
											is_elector = yes
											is_an_ecclesiastical_country = yes
										}
										amount = 1
									}
								}
								calc_true_if = {
									all_countries_including_self = {
										is_part_of_hre = yes
										is_elector = no
										is_an_ecclesiastical_country = yes
									}
									amount = 3
								}
							}
						}
					}
				}
			}
		}
	}

	emperor_reichstuerkenhilfe = {
		potential = {
			is_emperor = yes
			hre_size = 2
			exists = TUR
			TUR = {
				religion_group = muslim
			}
		}
		allow = {
			imperial_influence = 3
			if = {
				limit = {
					has_dlc = "Emperor"
				}
				NOT = { hre_reform_passed = emperor_privilegia_de_non_appelando }
				NOT = { hre_reform_passed = emperor_reichskrieg }
			}
			else = {
				NOT = { hre_reform_passed = privilegia_de_non_appelando }
			}
			custom_trigger_tooltip = {
				tooltip = DID_NOT_RAISE_TUERKENHILFE_TAX_LAST_10_YEARS
				OR = {
					NOT = { has_country_flag = emperor_raised_tuerken_hilfe_tax }
					had_country_flag = { flag = emperor_raised_tuerken_hilfe_tax days = 3650 }
				}
			}
			TUR = {
				religion_group = muslim
				war_with = ROOT
			}
		}
		effect = {
			add_imperial_influence = -3
			clr_country_flag = emperor_raised_tuerken_hilfe_tax
			set_country_flag = emperor_raised_tuerken_hilfe_tax
			custom_tooltip = EMPEROR_GAINS_THIS_AMOUNT_OF_MONEY_BECAUSE_OF_TUERKENHILFE
			custom_tooltip = " "
			hidden_effect = {
				every_country = {
					limit = {
						is_part_of_hre = yes
						is_emperor = no
					}
					ROOT = { add_treasury = 50 }
				}
			}
			every_country = {
				limit = {
					is_part_of_hre = yes
					is_emperor = no
				}
				add_opinion = {
					who = ROOT
					modifier = raised_tuerkenhilfe_tax
				}
			}
		}
		ai_will_do = {
			factor = 1

			modifier = {
				factor = 0
				treasury = 10000
			}
			modifier = {
				factor = 0
				has_ruler_modifier = hre_additional_taxes
			}
		}
	}

	hree_change_hre_color = {
		major = yes
		color = { 210 185 105 }
		potential = {
			tag = HLR
			NOT = { has_country_flag = hree_changed_hre_color }
		}
		allow = {
			tag = HLR
		}
		effect = {
			set_country_flag = hree_changed_hre_color
			country_event = { id = besseres_hrr_events.37 }
			custom_tooltip = hree_change_hre_color_tt
		}
		ai_will_do = {
			factor = 100
		}
	}

	emperor_dismantle_hre = {
		potential = {
			is_emperor = yes
			is_elector = yes
			NOT = { hre_reform_passed = erbkaisertum }
			NOT = { hre_reform_passed = emperor_erbkaisertum }
			NOT = { hre_size = 10 }
		}
		allow = {
			if = {
				limit = {
					has_dlc = "Art of War"
				}
				OR = {
					hre_leagues_enabled = no
					is_in_league_war = no
				}
			}
			NOT = { hre_size = 2 }
			is_part_of_hre = yes
			OR = {
				is_papal_controller = yes
				papacy_active = no
				NOT = { religion = catholic }
			}
			prestige = 0
		}
		effect = {
			add_prestige = -25
			if = {
				limit = {
					religion = catholic
				}
				add_papal_influence = -25
			}
			else_if = {
				limit = {
					religion = protestant
				}
				add_church_power = -25
			}
			else_if = {
				limit = {
					religion = reformed
				}
				add_fervor = -25
			}
			dismantle_hre = yes
			set_government_rank = 3
			add_ruler_modifier = {
				name = "emperor_dismantled_hre"
				duration = -1
			}
		}
		ai_will_do = {
			factor = 0
		}
	}

	remove_salic_monarchy_from_subject = {
		major = yes
		potential = {
			ai = no
			has_global_flag = extended_timeline_mod
			is_subject = no
			NOT = { has_reform = salic_reform }
			adm_tech = 32
			any_subject_country = {
				has_reform = salic_reform
				NOT = { liberty_desire = 50 }
			}
		}
		allow = {
			NOT = { has_reform = salic_reform }
			adm_power = 50
			any_subject_country = {
				has_reform = salic_reform
				NOT = { liberty_desire = 50 }
			}
		}
		effect = {
			add_adm_power = -50
			random_subject_country = {
				limit = {
					has_reform = salic_reform
					NOT = { liberty_desire = 50 }
				}
				add_liberty_desire = 10
				add_government_reform = feudalism_reform
			}
		}
	}
}