custom_button = {
	name = ase_spend_additional_splendor_open_button
	potential = {
		ai = no
	}
	trigger = {
	}
	effect = {
		hidden_effect = {
			clr_country_flag = ase_spend_additional_splendor_recruit_advisor_adm_opened
			clr_country_flag = ase_spend_additional_splendor_recruit_advisor_adm_ate_opened
			clr_country_flag = ase_spend_additional_splendor_recruit_advisor_dip_opened
			clr_country_flag = ase_spend_additional_splendor_recruit_advisor_dip_ate_opened
			clr_country_flag = ase_spend_additional_splendor_recruit_advisor_mil_opened
			clr_country_flag = ase_spend_additional_splendor_recruit_advisor_mil_ate_opened
			set_variable = { which = ase_spend_additional_splendor_to_recruit_advisor_ate_page value = 0 }
			if = {
				limit = {
					has_country_flag = ase_spend_additional_splendor_opened
				}
				clr_country_flag = ase_spend_additional_splendor_opened
			}
			else = {
				clr_country_flag = ase_retain_age_ability_opened
				set_variable = { which = ase_retain_age_ability_page value = 0 }
				set_country_flag = ase_spend_additional_splendor_opened
			}
		}
	}
	tooltip = ase_spend_additional_splendor_open_button_tt
}

custom_window = {
	name = ase_spend_additional_splendor_window
	potential = {
		ai = no
		has_country_flag = ase_spend_additional_splendor_opened
	}
}

custom_text_box = {
	name = ase_spend_additional_splendor_header
	potential = {
		always = yes
	}
}
custom_button = {
	name = ase_spend_additional_splendor_close_button
	trigger = {
	}
	effect = {
		hidden_effect = {
			clr_country_flag = ase_spend_additional_splendor_recruit_advisor_adm_opened
			clr_country_flag = ase_spend_additional_splendor_recruit_advisor_adm_ate_opened
			clr_country_flag = ase_spend_additional_splendor_recruit_advisor_dip_opened
			clr_country_flag = ase_spend_additional_splendor_recruit_advisor_dip_ate_opened
			clr_country_flag = ase_spend_additional_splendor_recruit_advisor_mil_opened
			clr_country_flag = ase_spend_additional_splendor_recruit_advisor_mil_ate_opened
			set_variable = { which = ase_spend_additional_splendor_to_recruit_advisor_ate_page value = 0 }
			clr_country_flag = ase_spend_additional_splendor_opened
		}
	}
	tooltip = CLOSE
}

custom_text_box = {
	name = ase_spend_additional_splendor_entry_text_1
	potential = {
		always = yes
	}
}
custom_button = {
	name = ase_spend_additional_splendor_entry_button_1
	trigger = {
		splendor = 800
	}
	effect = {
		add_splendor = -800
		if = {
			limit = {
				OR = {
					uses_legitimacy = yes
					uses_republican_tradition = yes
					uses_horde_unity = yes
					uses_devotion = yes
					uses_meritocracy = yes
				}
			}
			add_legitimacy_equivalent = { amount = 10 republican_tradition = 3 }
		}
		else = {
			custom_tooltip = ase_spend_additional_splendor_entry_button_no_effect
		}
	}
	frame = {
		number = 2
		trigger = {
			uses_republican_tradition = yes
		}
	}
	frame = {
		number = 3
		trigger = {
			uses_devotion = yes
		}
	}
	frame = {
		number = 4
		trigger = {
			uses_horde_unity = yes
		}
	}
	frame = {
		number = 5
		trigger = {
			uses_meritocracy = yes
		}
	}
	frame = {
		number = 1
		trigger = {
			always = yes
		}
	}
	tooltip = ase_spend_additional_splendor_entry_button_1_tt
}

custom_text_box = {
	name = ase_spend_additional_splendor_entry_text_2
	potential = {
		always = yes
	}
}
custom_button = {
	name = ase_spend_additional_splendor_entry_button_2
	trigger = {
		splendor = 1200
	}
	effect = {
		add_splendor = -1200
		add_prestige = 10
	}
	tooltip = ase_spend_additional_splendor_entry_button_2_tt
}

custom_text_box = {
	name = ase_spend_additional_splendor_entry_text_3
	potential = {
		NOT = {
			OR = {
				uses_piety = yes
				uses_karma = yes
			}
		}
	}
}
custom_text_box = {
	name = ase_spend_additional_splendor_entry_text2_3
	potential = {
		OR = {
			uses_piety = yes
			uses_karma = yes
		}
	}
}
custom_button = {
	name = ase_spend_additional_splendor_entry_button_3
	potential = {
		OR = {
			uses_piety = yes
			uses_karma = yes
		}
	}
	trigger = {
		splendor = 1200
	}
	effect = {
		add_splendor = -1200
		if = {
			limit = {
				uses_piety = yes
			}
			add_piety = -0.50
		}
		else_if = {
			limit = {
				uses_karma = yes
			}
			add_karma = -25
		}
	}
	tooltip = ase_spend_additional_splendor_entry_button_3_tt
}
custom_button = {
	name = ase_spend_additional_splendor_entry_button2_3
	trigger = {
		splendor = 1200
	}
	effect = {
		add_splendor = -1200
		if = {
			limit = {
				uses_papacy = yes
			}
			add_papal_influence = 50
		}
		else_if = {
			limit = {
				uses_fervor = yes
			}
			add_fervor = 100
		}
		else_if = {
			limit = {
				uses_church_aspects = yes
			}
			add_church_power = 100
		}
		else_if = {
			limit = {
				uses_patriarch_authority = yes
			}
			add_patriarch_authority = 0.15
		}
		else_if = {
			limit = {
				uses_piety = yes
			}
			add_piety = 0.50
		}
		else_if = {
			limit = {
				uses_karma = yes
			}
			add_karma = 25
		}
		else_if = {
			limit = {
				religion = confucianism
			}
			add_harmony = 10
		}
		else_if = {
			limit = {
				OR = {
					is_religion_reformed = yes
					religion = dreamtime
					religion = totemism
					religion = tengri_pagan_reformed
					religion = norse_pagan_reformed
				}
			}
			create_general = {
				tradition = 50
			}
		}
		else_if = {
			limit = {
				uses_authority = yes
			}
			add_authority = 10
		}
		else_if = {
			limit = {
				uses_doom = yes
			}
			add_doom = -25
		}
		else_if = {
			limit = {
				religion = shinto
			}
			kill_ruler = yes
			add_stability = 1
			add_prestige = 10
		}
		else_if = {
			limit = {
				religion = animism
			}
			change_adm = 1
			change_dip = 1
			change_mil = 1
		}
		else_if = {
			limit = {
				religion = sikhism
			}
			random_owned_province = {
				limit = {
					NOT = { religion = ROOT }
					any_neighbor_province = {
						owned_by = ROOT
						religion = ROOT
					}
				}
				change_religion = ROOT
			}
		}
		else_if = {
			limit = {
				religion = hinduism
			}
			set_country_flag = brahmin_deity_interaction
			clr_country_flag = brahmin_hindu_deity_decision
			set_country_flag = brahmin_hindu_deity_decision
			country_event = { id = hindu_events.1 }
		}
		else_if = {
			limit = {
				religion = shamanism
			}
			set_country_flag = swaps_cult_flag
			country_event = { id = fetishist_flavor.603 }
		}
		else_if = {
			limit = {
				religion = mesoamerican_religion
			}
			if = {
				limit = {
					capital_scope = {
						NOT = { has_building = cathedral }
					}
				}
				capital_scope = {
					if = {
						limit = {
							has_building = temple
						}
						add_building = cathedral
					}
					else = {
						add_building = temple
					}
				}
			}
			else_if = {
				limit = {
					any_owned_province = {
						NOT = { has_building = cathedral }
					}
				}
				random_owned_province = {
					limit = {
						NOT = { has_building = cathedral }
					}
					if = {
						limit = {
							has_building = temple
						}
						add_building = cathedral
					}
					else = {
						add_building = temple
					}
				}
			}
		}
		else_if = {
			limit = {
				religion = coptic
			}
			if = {
				limit = {
					358 = {
						owned_by = ROOT
						NOT = { has_building = cathedral }
					}
				}
				358 = {
					if = {
						limit = {
							has_building = temple
						}
						add_building = cathedral
					}
					else = {
						add_building = temple
					}
				}
			}
			else_if = {
				limit = {
					1227 = {
						owned_by = ROOT
						NOT = { has_building = cathedral }
					}
				}
				1227 = {
					if = {
						limit = {
							has_building = temple
						}
						add_building = cathedral
					}
					else = {
						add_building = temple
					}
				}
			}
			else_if = {
				limit = {
					2313 = {
						owned_by = ROOT
						NOT = { has_building = cathedral }
					}
				}
				2313 = {
					if = {
						limit = {
							has_building = temple
						}
						add_building = cathedral
					}
					else = {
						add_building = temple
					}
				}
			}
			else_if = {
				limit = {
					1234 = {
						owned_by = ROOT
						NOT = { has_building = cathedral }
					}
				}
				1234 = {
					if = {
						limit = {
							has_building = temple
						}
						add_building = cathedral
					}
					else = {
						add_building = temple
					}
				}
			}
			else_if = {
				limit = {
					419 = {
						owned_by = ROOT
						NOT = { has_building = cathedral }
					}
				}
				419 = {
					if = {
						limit = {
							has_building = temple
						}
						add_building = cathedral
					}
					else = {
						add_building = temple
					}
				}
			}
			else_if = {
				limit = {
					capital_scope = {
						NOT = { has_building = cathedral }
					}
				}
				capital_scope = {
					if = {
						limit = {
							has_building = temple
						}
						add_building = cathedral
					}
					else = {
						add_building = temple
					}
				}
			}
			else_if = {
				limit = {
					any_owned_province = {
						NOT = { has_building = cathedral }
					}
				}
				random_owned_province = {
					limit = {
						NOT = { has_building = cathedral }
					}
					if = {
						limit = {
							has_building = temple
						}
						add_building = cathedral
					}
					else = {
						add_building = temple
					}
				}
			}
		}
		else_if = {
			limit = {
				religion = zoroastrian
			}
			if = {
				limit = {
					421 = {
						owned_by = ROOT
						NOT = { has_building = cathedral }
					}
				}
				421 = {
					if = {
						limit = {
							has_building = temple
						}
						add_building = cathedral
					}
					else = {
						add_building = temple
					}
				}
			}
			else_if = {
				limit = {
					4430 = {
						owned_by = ROOT
						NOT = { has_building = cathedral }
					}
				}
				4430 = {
					if = {
						limit = {
							has_building = temple
						}
						add_building = cathedral
					}
					else = {
						add_building = temple
					}
				}
			}
			else_if = {
				limit = {
					2223 = {
						owned_by = ROOT
						NOT = { has_building = cathedral }
					}
				}
				2223 = {
					if = {
						limit = {
							has_building = temple
						}
						add_building = cathedral
					}
					else = {
						add_building = temple
					}
				}
			}
			else_if = {
				limit = {
					441 = {
						owned_by = ROOT
						NOT = { has_building = cathedral }
					}
				}
				441 = {
					if = {
						limit = {
							has_building = temple
						}
						add_building = cathedral
					}
					else = {
						add_building = temple
					}
				}
			}
			else_if = {
				limit = {
					2235 = {
						owned_by = ROOT
						NOT = { has_building = cathedral }
					}
				}
				2235 = {
					if = {
						limit = {
							has_building = temple
						}
						add_building = cathedral
					}
					else = {
						add_building = temple
					}
				}
			}
			else_if = {
				limit = {
					capital_scope = {
						NOT = { has_building = cathedral }
					}
				}
				capital_scope = {
					if = {
						limit = {
							has_building = temple
						}
						add_building = cathedral
					}
					else = {
						add_building = temple
					}
				}
			}
			else_if = {
				limit = {
					any_owned_province = {
						NOT = { has_building = cathedral }
					}
				}
				random_owned_province = {
					limit = {
						NOT = { has_building = cathedral }
					}
					if = {
						limit = {
							has_building = temple
						}
						add_building = cathedral
					}
					else = {
						add_building = temple
					}
				}
			}
		}
		else = {
			rce_gain_religious_power_from_splendor = yes
		}
	}
	tooltip = ase_spend_additional_splendor_entry_button2_3_tt
}

custom_text_box = {
	name = ase_spend_additional_splendor_entry_text_4
	potential = {
		NOT = { is_expanded_mod_active = { mod = advisor_types } }
	}
}
custom_text_box = {
	name = ase_spend_additional_splendor_entry_text2_4
	potential = {
		is_expanded_mod_active = { mod = advisor_types }
	}
}
custom_button = {
	name = ase_spend_additional_splendor_entry_button_4
	potential = {
		is_expanded_mod_active = { mod = advisor_types }
	}
	trigger = {
		splendor = 400
	}
	effect = {
		hidden_effect = {
			set_country_flag = ase_spend_additional_splendor_recruit_advisor_adm_ate_opened
			set_variable = { which = ase_spend_additional_splendor_to_recruit_advisor_ate_page value = 1 }
			clr_country_flag = ase_spend_additional_splendor_opened
		}
		custom_tooltip = ase_spend_additional_splendor_entry_button_4_tt_effect
	}
	tooltip = ase_spend_additional_splendor_entry_button_4_tt
}
custom_button = {
	name = ase_spend_additional_splendor_entry_button2_4
	trigger = {
		splendor = 400
	}
	effect = {
		hidden_effect = {
			set_country_flag = ase_spend_additional_splendor_recruit_advisor_adm_opened
			clr_country_flag = ase_spend_additional_splendor_opened
		}
		custom_tooltip = ase_spend_additional_splendor_entry_button2_4_tt_effect
	}
	tooltip = ase_spend_additional_splendor_entry_button2_4_tt
}

custom_text_box = {
	name = ase_spend_additional_splendor_entry_text_5
	potential = {
		NOT = { is_expanded_mod_active = { mod = advisor_types } }
	}
}
custom_text_box = {
	name = ase_spend_additional_splendor_entry_text2_5
	potential = {
		is_expanded_mod_active = { mod = advisor_types }
	}
}
custom_button = {
	name = ase_spend_additional_splendor_entry_button_5
	potential = {
		is_expanded_mod_active = { mod = advisor_types }
	}
	trigger = {
		splendor = 400
	}
	effect = {
		hidden_effect = {
			set_country_flag = ase_spend_additional_splendor_recruit_advisor_dip_ate_opened
			set_variable = { which = ase_spend_additional_splendor_to_recruit_advisor_ate_page value = 1 }
			clr_country_flag = ase_spend_additional_splendor_opened
		}
		custom_tooltip = ase_spend_additional_splendor_entry_button_5_tt_effect
	}
	tooltip = ase_spend_additional_splendor_entry_button_5_tt
}
custom_button = {
	name = ase_spend_additional_splendor_entry_button2_5
	trigger = {
		splendor = 400
	}
	effect = {
		hidden_effect = {
			set_country_flag = ase_spend_additional_splendor_recruit_advisor_dip_opened
			clr_country_flag = ase_spend_additional_splendor_opened
		}
		custom_tooltip = ase_spend_additional_splendor_entry_button2_5_tt_effect
	}
	tooltip = ase_spend_additional_splendor_entry_button2_5_tt
}

custom_text_box = {
	name = ase_spend_additional_splendor_entry_text_6
	potential = {
		NOT = { is_expanded_mod_active = { mod = advisor_types } }
	}
}
custom_text_box = {
	name = ase_spend_additional_splendor_entry_text2_6
	potential = {
		is_expanded_mod_active = { mod = advisor_types }
	}
}
custom_button = {
	name = ase_spend_additional_splendor_entry_button_6
	potential = {
		is_expanded_mod_active = { mod = advisor_types }
	}
	trigger = {
		splendor = 400
	}
	effect = {
		hidden_effect = {
			set_country_flag = ase_spend_additional_splendor_recruit_advisor_mil_ate_opened
			set_variable = { which = ase_spend_additional_splendor_to_recruit_advisor_ate_page value = 1 }
			clr_country_flag = ase_spend_additional_splendor_opened
		}
		custom_tooltip = ase_spend_additional_splendor_entry_button_6_tt_effect
	}
	tooltip = ase_spend_additional_splendor_entry_button_6_tt
}
custom_button = {
	name = ase_spend_additional_splendor_entry_button2_6
	trigger = {
		splendor = 400
	}
	effect = {
		hidden_effect = {
			set_country_flag = ase_spend_additional_splendor_recruit_advisor_mil_opened
			clr_country_flag = ase_spend_additional_splendor_opened
		}
		custom_tooltip = ase_spend_additional_splendor_entry_button2_6_tt_effect
	}
	tooltip = ase_spend_additional_splendor_entry_button2_6_tt
}