﻿aureliani_civic_open_capital_choice_effect = {
	if = {
		limit = {
			aureliani_civic_authority_trigger = yes
			aureliani_civic_capital_predecessor_trigger = yes
			has_title = title:c_roma
			NOT = { has_character_flag = aureliani_civic_rome_choice_pending }
			house = { NOT = { has_variable = aureliani_civic_rome_secured } }
		}
		if = { limit = { NOT = { has_variable = aureliani_civic_choice_serial } } set_variable = { name = aureliani_civic_choice_serial value = 0 } }
		change_variable = { name = aureliani_civic_choice_serial add = 1 }
		save_scope_value_as = { name = aureliani_civic_choice_attempt value = var:aureliani_civic_choice_serial }
		add_character_flag = aureliani_civic_rome_choice_pending
		trigger_event = aureliani_civic.0001
		trigger_event = { id = aureliani_civic.0098 days = 60 }
	}
}

aureliani_civic_open_culture_choice_effect = {
	if = {
		limit = {
			aureliani_civic_authority_trigger = yes
			aureliani_civic_culture_predecessor_trigger = yes
			capital_county = title:c_roma
			has_title = title:c_roma
			NOT = { has_character_flag = aureliani_civic_culture_choice_pending }
			OR = { NOT = { culture = culture:roman } title:c_roma = { NOT = { culture = culture:roman } } }
		}
		if = { limit = { NOT = { has_variable = aureliani_civic_choice_serial } } set_variable = { name = aureliani_civic_choice_serial value = 0 } }
		change_variable = { name = aureliani_civic_choice_serial add = 1 }
		save_scope_value_as = { name = aureliani_civic_choice_attempt value = var:aureliani_civic_choice_serial }
		add_character_flag = aureliani_civic_culture_choice_pending
		clear_saved_scope = aureliani_civic_scholar
		random_courtier = {
			limit = { is_alive = yes is_adult = yes learning >= 10 NOT = { culture = culture:roman } }
			save_scope_as = aureliani_civic_scholar
		}
		trigger_event = aureliani_civic.0002
		trigger_event = { id = aureliani_civic.0099 days = 60 }
	}
}

aureliani_civic_close_capital_choice_effect = {
	if = {
		limit = { has_character_flag = aureliani_civic_rome_choice_pending var:aureliani_civic_choice_serial = scope:aureliani_civic_choice_attempt }
		remove_character_flag = aureliani_civic_rome_choice_pending
	}
}

aureliani_civic_close_culture_choice_effect = {
	if = {
		limit = { has_character_flag = aureliani_civic_culture_choice_pending var:aureliani_civic_choice_serial = scope:aureliani_civic_choice_attempt }
		remove_character_flag = aureliani_civic_culture_choice_pending
	}
}

aureliani_civic_apply_rome_move_effect = {
	if = {
		limit = {
			aureliani_civic_capital_pending_trigger = yes
			has_title = title:c_roma
			NOT = { capital_county = title:c_roma }
			gold >= 300
			prestige >= 500
		}
		remove_short_term_gold = 300
		add_prestige = -500
		set_realm_capital = title:c_roma
		title:c_roma = { add_county_modifier = { modifier = aureliani_rome_capital_investment years = 10 } }
		house = { set_variable = { name = aureliani_civic_rome_secured value = 1 } }
		aureliani_civic_close_capital_choice_effect = yes
		trigger_event = aureliani_civic.0003
	}
	else = { aureliani_civic_close_capital_choice_effect = yes }
}

aureliani_civic_acknowledge_rome_effect = {
	if = {
		limit = { aureliani_civic_capital_pending_trigger = yes has_title = title:c_roma capital_county = title:c_roma }
		title:c_roma = { add_county_modifier = { modifier = aureliani_rome_capital_charter years = 5 } }
		house = { set_variable = { name = aureliani_civic_rome_secured value = 1 } }
		aureliani_civic_close_capital_choice_effect = yes
		trigger_event = aureliani_civic.0003
	}
	else = { aureliani_civic_close_capital_choice_effect = yes }
}

aureliani_civic_adopt_roman_culture_effect = {
	if = {
		limit = {
			aureliani_civic_culture_pending_trigger = yes
			NOT = { culture = culture:roman }
			title:c_roma = { NOT = { culture = culture:roman } }
			gold >= 100
			prestige >= 200
		}
		remove_short_term_gold = 100
		add_prestige = -200
		set_culture = culture:roman
		title:c_roma = { set_county_culture = culture:roman }
		add_character_modifier = { modifier = aureliani_roman_court_patronage years = 10 }
		title:c_roma = { add_county_modifier = { modifier = aureliani_roman_civic_institution } }
		house = { set_variable = { name = aureliani_civic_roman_customs value = 1 } set_variable = { name = aureliani_civic_customs_method value = 1 } }
		aureliani_civic_close_culture_choice_effect = yes
		trigger_event = aureliani_civic.0003
	}
	else = { aureliani_civic_close_culture_choice_effect = yes }
}

aureliani_civic_adopt_roman_self_effect = {
	if = {
		limit = { aureliani_civic_culture_pending_trigger = yes NOT = { culture = culture:roman } gold >= 75 prestige >= 150 }
		remove_short_term_gold = 75
		add_prestige = -150
		set_culture = culture:roman
		add_character_modifier = { modifier = aureliani_roman_court_patronage years = 10 }
		house = { set_variable = { name = aureliani_civic_roman_customs value = 1 } set_variable = { name = aureliani_civic_customs_method value = 2 } }
		aureliani_civic_close_culture_choice_effect = yes
		trigger_event = aureliani_civic.0003
	}
	else = { aureliani_civic_close_culture_choice_effect = yes }
}

aureliani_civic_adopt_roman_county_effect = {
	if = {
		limit = {
			aureliani_civic_culture_pending_trigger = yes
			culture = culture:roman
			title:c_roma = { NOT = { culture = culture:roman } }
			gold >= 75
		}
		remove_short_term_gold = 75
		title:c_roma = { set_county_culture = culture:roman }
		title:c_roma = { add_county_modifier = { modifier = aureliani_roman_civic_institution } }
		house = { set_variable = { name = aureliani_civic_roman_customs value = 1 } set_variable = { name = aureliani_civic_customs_method value = 3 } }
		aureliani_civic_close_culture_choice_effect = yes
		trigger_event = aureliani_civic.0003
	}
	else = { aureliani_civic_close_culture_choice_effect = yes }
}
