###############
# AMBITIONS
###############

obj_amass_wealth_2 = {
	type = character
	
	potential = {
		is_ruler = yes
		lower_tier_than = KING
		NOT = { num_of_duke_titles = 4 }
		OR = {
			tier = DUKE
			num_of_count_titles = 4
		}
		NOT = { has_character_flag = obj_amass_wealth }
	}

	allow = {
		is_adult = yes
		NOT = { wealth = 500 }
		NOT = { trait = incapable }
		NOT = { trait = charitable }
		NOT = { has_character_modifier = loan_timer }
		NOT = { has_character_flag = loan_taken }
	}
	chance = {
		factor = 100

		modifier = {
			factor = 1.25
			trait = patient
		}
		modifier = {
			factor = 1.25
			trait = fortune_builder
		}
		modifier = {
			factor = 1.25
			trait = midas_touched
		}
		modifier = {
			factor = 10.0
			trait = greedy
		}
		modifier = {
			factor = 0
			trait = charitable
		}
		modifier = {
			factor = 0
			trait = content
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		wealth = 500
		NOT = { has_character_modifier = loan_timer }
		NOT = { has_character_flag = loan_taken }
	}
	abort = {
		OR = {
			trait = incapable
			trait = charitable
			has_character_modifier = loan_timer
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			change_variable = { which = "lifestyle_stewardship" value = 1 }
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		change_stewardship = 1
		set_character_flag = obj_amass_wealth
		if = {
			limit = { any_vassal = { leads_faction = faction_prosperity } }
			custom_tooltip = { text = PROSPERITYFACTIONMOODPLUS }
			hidden_tooltip = {
				random_vassal = { limit = { leads_faction = faction_prosperity } set_variable = { which = "faction_mood_increase" value = 2 } }
				character_event = { id = PlusFaction.200 days = 1 } #recalculate faction moods
			}
		}
	}
}

obj_amass_wealth_3 = {
	type = character
	
	potential = {
		is_ruler = yes
		lower_tier_than = EMPEROR
		NOT = { num_of_king_titles = 4 }
		OR = {
			tier = KING
			num_of_duke_titles = 4
		}
		NOT = { has_character_flag = obj_amass_wealth }
	}

	allow = {
		is_adult = yes
		NOT = { wealth = 750 }
		NOT = { trait = incapable }
		NOT = { trait = charitable }
		NOT = { has_character_modifier = loan_timer }
		NOT = { has_character_flag = loan_taken }
	}
	chance = {
		factor = 100

		modifier = {
			factor = 1.25
			trait = patient
		}
		modifier = {
			factor = 1.25
			trait = fortune_builder
		}
		modifier = {
			factor = 1.25
			trait = midas_touched
		}
		modifier = {
			factor = 10.0
			trait = greedy
		}
		modifier = {
			factor = 0
			trait = charitable
		}
		modifier = {
			factor = 0
			trait = content
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		wealth = 750
		NOT = { has_character_modifier = loan_timer }
		NOT = { has_character_flag = loan_taken }
	}
	abort = {
		OR = {
			trait = incapable
			trait = charitable
			has_character_modifier = loan_timer
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			change_variable = { which = "lifestyle_stewardship" value = 1 }
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		change_stewardship = 1
		set_character_flag = obj_amass_wealth
		if = {
			limit = { any_vassal = { leads_faction = faction_prosperity } }
			custom_tooltip = { text = PROSPERITYFACTIONMOODPLUS }
			hidden_tooltip = {
				random_vassal = { limit = { leads_faction = faction_prosperity } set_variable = { which = "faction_mood_increase" value = 2 } }
				character_event = { id = PlusFaction.200 days = 1 } #recalculate faction moods
			}
		}
	}
}

obj_amass_wealth_4 = {
	type = character
	
	potential = {
		is_ruler = yes
		OR = {
			tier = EMPEROR
			num_of_king_titles = 4
		}
		NOT = { has_character_flag = obj_amass_wealth }
	}

	allow = {
		is_adult = yes
		NOT = { wealth = 1000 }
		NOT = { trait = incapable }
		NOT = { trait = charitable }
		NOT = { has_character_modifier = loan_timer }
		NOT = { has_character_flag = loan_taken }
	}
	chance = {
		factor = 100

		modifier = {
			factor = 1.25
			trait = patient
		}
		modifier = {
			factor = 1.25
			trait = fortune_builder
		}
		modifier = {
			factor = 1.25
			trait = midas_touched
		}
		modifier = {
			factor = 10.0
			trait = greedy
		}
		modifier = {
			factor = 0
			trait = charitable
		}
		modifier = {
			factor = 0
			trait = content
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		wealth = 1000
		NOT = { has_character_modifier = loan_timer }
		NOT = { has_character_flag = loan_taken }
	}
	abort = {
		OR = {
			trait = incapable
			trait = charitable
			has_character_modifier = loan_timer
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			change_variable = { which = "lifestyle_stewardship" value = 1 }
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		change_stewardship = 1
		set_character_flag = obj_amass_wealth
		if = {
			limit = { any_vassal = { leads_faction = faction_prosperity } }
			custom_tooltip = { text = PROSPERITYFACTIONMOODPLUS }
			hidden_tooltip = {
				random_vassal = { limit = { leads_faction = faction_prosperity } set_variable = { which = "faction_mood_increase" value = 2 } }
				character_event = { id = PlusFaction.200 days = 1 } #recalculate faction moods
			}
		}
	}
}

obj_become_exalted_2 = {
	type = character
	
	potential = {
		is_ruler = yes
		NOR = {
			trait = exalted2
			trait = exalted3
			trait = exalted4
		}
		lower_tier_than = KING
		NOT = { num_of_duke_titles = 4 }
		OR = {
			tier = DUKE
			num_of_count_titles = 4
		}
	}

	allow = {
		is_adult = yes
		prestige = 0
		NOT = { prestige = 2000 }
		NOT = { trait = content }
		NOT = { trait = humble }
		NOT = { trait = incapable }
	}
	chance = {
		factor = 50

		modifier = {
			factor = 1.25
			trait = patient
		}
		modifier = {
			factor = 0
			NOT = { prestige = 500 }
		}
		modifier = {
			factor = 5.0
			trait = ambitious
		}
		modifier = {
			factor = 10.0
			trait = proud
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		prestige = 2000
	}
	abort = {
		OR = {
			is_ruler = no
			NOT = { prestige = 0 }
			trait = incapable
			trait = content
			trait = humble
			trait = exalted2
			trait = exalted3
			trait = exalted4
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		change_diplomacy = 1
		prestige = 100
		if = {
			limit = { any_vassal = { leads_faction = faction_glory } }
			custom_tooltip = { text = GLORYFACTIONMOODPLUS }
			hidden_tooltip = {
				random_vassal = { limit = { leads_faction = faction_glory } set_variable = { which = "faction_mood_increase" value = 4 } }
			}
		}
		if = {
			limit = { any_vassal = { leads_faction = faction_court } }
			custom_tooltip = { text = COURTFACTIONMOODPLUS }
			hidden_tooltip = {
				random_vassal = { limit = { leads_faction = faction_court } set_variable = { which = "faction_mood_increase" value = 2 } }
			}
		}
		hidden_tooltip = { character_event = { id = PlusFaction.200 days = 1 } } #recalculate faction moods
		if = {
			limit = {
				has_nickname = no
			}
			give_nickname = nick_the_great
		}
		add_trait = exalted2
	}
}

obj_become_exalted_3 = {
	type = character
	
	potential = {
		is_ruler = yes
		NOR = {
			trait = exalted3
			trait = exalted4
		}
		lower_tier_than = EMPEROR
		NOT = { num_of_king_titles = 4 }
		OR = {
			tier = KING
			num_of_duke_titles = 4
		}
	}

	allow = {
		is_adult = yes
		prestige = 0
		NOT = { prestige = 3000 }
		NOT = { trait = content }
		NOT = { trait = humble }
		NOT = { trait = incapable }
	}
	chance = {
		factor = 50

		modifier = {
			factor = 1.25
			trait = patient
		}
		modifier = {
			factor = 0
			NOT = { prestige = 1000 }
		}
		modifier = {
			factor = 5.0
			trait = ambitious
		}
		modifier = {
			factor = 10.0
			trait = proud
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		prestige = 3000
	}
	abort = {
		OR = {
			is_ruler = no
			NOT = { prestige = 0 }
			trait = incapable
			trait = content
			trait = humble
			trait = exalted3
			trait = exalted4
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		prestige = 100
		if = {
			limit = { any_vassal = { leads_faction = faction_glory } }
			custom_tooltip = { text = GLORYFACTIONMOODPLUS }
			hidden_tooltip = {
				random_vassal = { limit = { leads_faction = faction_glory } set_variable = { which = "faction_mood_increase" value = 4 } }
			}
		}
		if = {
			limit = { any_vassal = { leads_faction = faction_court } }
			custom_tooltip = { text = COURTFACTIONMOODPLUS }
			hidden_tooltip = {
				random_vassal = { limit = { leads_faction = faction_court } set_variable = { which = "faction_mood_increase" value = 2 } }
			}
		}
		hidden_tooltip = { character_event = { id = PlusFaction.200 days = 1 } } #recalculate faction moods
		if = {
			limit = {
				has_nickname = no
			}
			give_nickname = nick_the_great
		}
		add_trait = exalted3
	}
}

obj_become_exalted_4 = {
	type = character
	
	potential = {
		is_ruler = yes
		NOT = { trait = exalted4 }
		OR = {
			tier = EMPEROR
			num_of_king_titles = 4
		}
	}

	allow = {
		is_adult = yes
		prestige = 0
		NOT = { prestige = 4000 }
		NOT = { trait = content }
		NOT = { trait = humble }
		NOT = { trait = incapable }
	}
	chance = {
		factor = 50

		modifier = {
			factor = 0
			trait = humble
		}
		modifier = {
			factor = 0
			trait = content
		}
		modifier = {
			factor = 1.25
			trait = patient
		}
		modifier = {
			factor = 0
			NOT = { prestige = 2000 }
		}
		modifier = {
			factor = 5.0
			trait = ambitious
		}
		modifier = {
			factor = 10.0
			trait = proud
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		prestige = 4000
	}
	abort = {
		OR = {
			is_ruler = no
			NOT = { prestige = 0 }
			trait = incapable
			trait = content
			trait = humble
			trait = exalted4
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		prestige = 100
		if = {
			limit = { any_vassal = { leads_faction = faction_glory } }
			custom_tooltip = { text = GLORYFACTIONMOODPLUS }
			hidden_tooltip = {
				random_vassal = { limit = { leads_faction = faction_glory } set_variable = { which = "faction_mood_increase" value = 4 } }
			}
		}
		if = {
			limit = { any_vassal = { leads_faction = faction_court } }
			custom_tooltip = { text = COURTFACTIONMOODPLUS }
			hidden_tooltip = {
				random_vassal = { limit = { leads_faction = faction_court } set_variable = { which = "faction_mood_increase" value = 2 } }
			}
		}
		hidden_tooltip = { character_event = { id = PlusFaction.200 days = 1 } } #recalculate faction moods
		if = {
			limit = {
				has_nickname = no
			}
			give_nickname = nick_the_great
		}
		add_trait = exalted4
	}
}

obj_find_lover = {
	type = character
	
	potential = {
		has_lover = no
		OR = {
			is_ruler = no
			demesne_size = 1
		}
		OR = {
			ai = no
			NOT = { has_character_flag = obj_find_lover }
		}
		NOT = { has_landed_title = k_papal_state }
	}

	allow = {
		prisoner = no
		is_adult = yes
		is_priest = no
		NOT = { trait = celibate }
		NOT = { trait = eunuch }
		NOT = { trait = incapable }
	}
	chance = {
		factor = 100
		modifier = {
			factor = 0.5
			is_ruler = no
		}
		modifier = {
			factor = 2.0
			spouse = { age = 40 }
		}
		modifier = {
			factor = 0.5
			spouse = {
				NOT = { age = 30 }
			}
		}
		modifier = {
			factor = 0.5
			spouse = {
				reverse_opinion = {
					who = ROOT
					value = 25
				}
			}
		}
		modifier = {
			factor = 0.5
			spouse = {
				reverse_opinion = {
					who = ROOT
					value = 50
				}
			}
		}
		modifier = {
			factor = 0.5
			spouse = {
				reverse_opinion = {
					who = ROOT
					value = 75
				}
			}
		}
		modifier = {
			factor = 0.1
			trait = chaste
		}
		modifier = {
			factor = 0.5
			trait = shy
		}
		modifier = {
			factor = 2.0
			trait = lustful
		}
		modifier = {
			factor = 2.0
			trait = hedonist
		}
		modifier = {
			factor = 2.0
			trait = decadent
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		has_lover = yes
	}
	abort = {
		OR = {
			prisoner = yes
			is_priest = yes
			trait = celibate
			trait = eunuch
			trait = incapable
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			change_variable = { which = "lifestyle_diplomacy" value = 1 }
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		if = {
			limit = { NOT = { has_character_flag = obj_find_lover } }
			change_diplomacy = 1
		}
		if = {
			limit = { has_character_flag = obj_find_lover }
			prestige = 25
		}
		set_character_flag = obj_find_lover
	}
}

obj_become_independent = {
	type = character
	
	potential = {
		ai = no
		is_ruler = yes
		independent = no
	}

	allow = {
		prisoner = no
		is_adult = yes
		is_landed = yes
		liege = {
			independent = yes
			OR = {
				is_feudal = yes
				is_tribal = yes
			}
		}
		NOT = { trait = incapable }
	}
	chance = {
		factor = 0
	}
	success = {
		independent = yes
		war = no
	}
	abort = {
		OR = {
			prisoner = yes
			ai = yes
			trait = incapable
			is_ruler = no
		}
	}
	abort_effect = {
	}
	effect = {
		if = {
			limit = { NOT = { has_character_flag = obj_independence } }
			prestige = 200
		}
		if = {
			limit = { has_character_flag = obj_independence }
			prestige = 50
		}
		set_character_flag = obj_independence
	}
}

obj_five_children = {
	type = character

	fertility = 0.1
	
	potential = {
		is_adult = yes
		OR = {
			is_married = yes
			is_consort = yes
		}
		OR = {
			is_ruler = yes
			spouse = { is_ruler = yes }
		}
		num_of_children = 1
		NOT = { num_of_children = 5 }
		NOT = { has_character_flag = obj_have_child_3 }
	}

	allow = {
		prisoner = no
		OR = {
			NOT = { age = 45 }
			is_female = no
		}
		NOT = { age = 75 }
		NOT = { trait = celibate }
		NOT = { trait = eunuch }
		NOT = { trait = incapable }
	}
	chance = {
		factor = 50

		modifier = {
			factor = 0.5
			is_female = no
		}
		modifier = {
			factor = 2.0
			trait = lustful
		}
		modifier = {
			factor = 1.5
			num_of_children = 2
		}
		modifier = {
			factor = 1.5
			num_of_children = 3
		}
		modifier = {
			factor = 1.5
			num_of_children = 4
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		num_of_children = 5
	}
	abort = {
		OR = {
			prisoner = yes
			AND = {
				age = 45
				is_female = yes
			}
			AND = {
				age = 75
				is_female = no
			}
			is_married = no
			trait = celibate
			trait = eunuch
			trait = incapable
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		if = {
			limit = { any_vassal = { leads_faction = faction_court } }
			custom_tooltip = { text = COURTFACTIONMOODPLUS }
			hidden_tooltip = {
				random_vassal = { limit = { leads_faction = faction_court } set_variable = { which = "faction_mood_increase" value = 1 } }
				character_event = { id = PlusFaction.200 days = 1 } #recalculate faction moods
			}
		}
		if = {
			limit = {
				religion_group = muslim
			}
			prestige = 50
		}
		if = {
			limit = {
				NOT = { religion_group = muslim }
			}
			prestige = 100
		}
		set_character_flag = obj_have_child_3
	}
}

obj_ten_children = {
	type = character

	fertility = 0.1
	
	potential = {
		is_adult = yes
		is_married = yes
		num_of_children = 5
		NOT = { num_of_children = 10 }
		OR = {
			is_ruler = yes
			spouse = { is_ruler = yes }
		}
		NOT = { has_character_flag = obj_have_child_4 }
	}

	allow = {
		prisoner = no
		OR = {
			NOT = { age = 45 }
			is_female = no
		}
		NOT = { age = 75 }
		NOT = { trait = celibate }
		NOT = { trait = eunuch }
		NOT = { trait = incapable }
	}
	chance = {
		factor = 50

		modifier = {
			factor = 0.5
			is_female = no
		}
		modifier = {
			factor = 2.0
			trait = lustful
		}
		modifier = {
			factor = 1.5
			num_of_children = 6
		}
		modifier = {
			factor = 1.5
			num_of_children = 7
		}
		modifier = {
			factor = 1.5
			num_of_children = 8
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		num_of_children = 10
	}
	abort = {
		OR = {
			prisoner = yes
			AND = {
				age = 45
				is_female = yes
			}
			AND = {
				age = 75
				is_female = no
			}
			is_married = no
			trait = celibate
			trait = eunuch
			trait = incapable
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		if = {
			limit = { any_vassal = { leads_faction = faction_court } }
			custom_tooltip = { text = COURTFACTIONMOODPLUS }
			hidden_tooltip = {
				random_vassal = { limit = { leads_faction = faction_court } set_variable = { which = "faction_mood_increase" value = 1 } }
				character_event = { id = PlusFaction.200 days = 1 } #recalculate faction moods
			}
		}
		if = {
			limit = {
				religion_group = muslim
			}
			prestige = 50
		}
		if = {
			limit = {
				NOT = { religion_group = muslim }
			}
			prestige = 100
		}
		set_character_flag = obj_have_child_4
	}
}

obj_fifteen_children = {
	type = character

	fertility = 0.1
	
	potential = {
		is_adult = yes
		is_married = yes
		num_of_children = 10
		NOT = { num_of_children = 15 }
		OR = {
			is_ruler = yes
			spouse = { is_ruler = yes }
		}
		NOT = { has_character_flag = obj_have_child_5 }
	}

	allow = {
		prisoner = no
		OR = {
			NOT = { age = 45 }
			is_female = no
		}
		NOT = { age = 75 }
		NOT = { trait = celibate }
		NOT = { trait = eunuch }
		NOT = { trait = incapable }
	}
	chance = {
		factor = 50

		modifier = {
			factor = 0.5
			is_female = no
		}
		modifier = {
			factor = 2.0
			trait = lustful
		}
		modifier = {
			factor = 1.5
			num_of_children = 6
		}
		modifier = {
			factor = 1.5
			num_of_children = 7
		}
		modifier = {
			factor = 1.5
			num_of_children = 8
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		num_of_children = 15
	}
	abort = {
		OR = {
			prisoner = yes
			AND = {
				age = 45
				is_female = yes
			}
			AND = {
				age = 75
				is_female = no
			}
			is_married = no
			trait = celibate
			trait = eunuch
			trait = incapable
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		if = {
			limit = { any_vassal = { leads_faction = faction_court } }
			custom_tooltip = { text = COURTFACTIONMOODPLUS }
			hidden_tooltip = {
				random_vassal = { limit = { leads_faction = faction_court } set_variable = { which = "faction_mood_increase" value = 1 } }
				character_event = { id = PlusFaction.200 days = 1 } #recalculate faction moods
			}
		}
		if = {
			limit = {
				religion_group = muslim
			}
			prestige = 50
		}
		if = {
			limit = {
				NOT = { religion_group = muslim }
			}
			prestige = 100
		}
		set_character_flag = obj_have_child_5
	}
}

obj_twenty_children = {
	type = character

	fertility = 0.1
	
	potential = {
		is_adult = yes
		is_married = yes
		num_of_children = 15
		NOT = { num_of_children = 20 }
		OR = {
			is_ruler = yes
			spouse = { is_ruler = yes }
		}
		NOT = { has_character_flag = obj_have_child_6 }
	}

	allow = {
		prisoner = no
		OR = {
			NOT = { age = 45 }
			is_female = no
		}
		NOT = { age = 75 }
		NOT = { trait = celibate }
		NOT = { trait = eunuch }
		NOT = { trait = incapable }
	}
	chance = {
		factor = 50

		modifier = {
			factor = 0.5
			is_female = no
		}
		modifier = {
			factor = 2.0
			trait = lustful
		}
		modifier = {
			factor = 1.5
			num_of_children = 6
		}
		modifier = {
			factor = 1.5
			num_of_children = 7
		}
		modifier = {
			factor = 1.5
			num_of_children = 8
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		num_of_children = 20
	}
	abort = {
		OR = {
			prisoner = yes
			AND = {
				age = 45
				is_female = yes
			}
			AND = {
				age = 75
				is_female = no
			}
			is_married = no
			trait = celibate
			trait = eunuch
			trait = incapable
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		if = {
			limit = { any_vassal =  { leads_faction = faction_court } }
			custom_tooltip = { text = COURTFACTIONMOODPLUS }
			hidden_tooltip = {
				random_vassal = { limit = { leads_faction = faction_court } set_variable = { which = "faction_mood_increase" value = 2 } }
				character_event = { id = PlusFaction.200 days = 1 } #recalculate faction moods
			}
		}
		if = {
			limit = {
				has_nickname = no
				religion_group = christian
			}
			give_nickname = nick_the_quiverfull
		}
		if = {
			limit = {
				religion_group = muslim
			}
			prestige = 50
		}
		if = {
			limit = {
				NOT = { religion_group = muslim }
			}
			prestige = 100
		}
		set_character_flag = obj_have_child_6
	}
}

##############################################################
# CTA: Combat Trait Advancement: Ambitions                   #
# zijistark <azrinon@gmail.com>                              #
##############################################################

# no combat trait -> poor_warrior
obj_cta_0 = {
	type = character
	
	creation_effect = {
	}
	
	potential = {
		NOR = {
			trait = poor_warrior
			trait = trained_warrior
			trait = skilled_warrior
			trait = master_warrior
		}
		OR = {
			is_ruler = yes
			liege = { job_marshal = { character = ROOT } }
		}
		NOT = { has_character_flag = cta_done } # weird things happen (cta_done is not normally set for the 0->1 tier transition)
	}
	
	allow = {
		NOR = {
			is_adult = no
			age = 50
			prisoner = yes
			trait = incapable
			trait = blinded
		}
		# ladies, if you can command armies for your liege/yourself (and meet the base criteria),
		# then this ambition is for you too.
		OR = {
			is_female = no
			AND = {
				religion = norse_pagan
				liege = { religion = norse_pagan }
				trait = martial_lady_pagan
			}
			AND = {
				religion = norse_pagan_reformed
				liege = { religion = norse_pagan_reformed }
				trait = martial_lady_pagan
			}
			AND = {
				religion = german_pagan
				liege = { religion = german_pagan_reformed }
				trait = martial_lady_pagan
			}
			AND = {
				religion = german_pagan_reformed
				liege = { religion = german_pagan_reformed }
				trait = martial_lady_pagan
			}
			AND = {
				religion_group = zoroastrian_group
				culture_group = iranian
				any_dynasty_member = { higher_tier_than = baron }
				trait = martial_lady_tengri
				OR = {
					AND = {
						liege = { religion_group = zoroastrian_group }
						liege = {culture_group = iranian }
					}
					independent = yes
				}
			}
			AND = {
				is_ruler = yes
				independent = yes
				OR = {
					trait = martial_lady
					trait = martial_lady_tengri
					trait = martial_lady_pagan
					martial = 12
				}
			}
			liege = {
				OR = {
					has_law = true_cognatic_succession 
					has_law = enatic_cognatic_succession
					has_law = enatic_succession
				}
			}
			AND = {
				independent = yes
				OR = {
					has_law = true_cognatic_succession
					has_law = enatic_cognatic_succession
					has_law = enatic_succession
				}
			}
			has_character_flag = special_marshal
		}
	}
	chance = {
		factor = 100
		
		modifier = {
			factor = 0
			NOT = { martial = 8 }
		}
		modifier = {
			factor = 10
			liege = { job_marshal = { character = ROOT } }
		}
		modifier = {
			factor = 0.75
			age = 40
		}
		modifier = {
			factor = 0.333
			age = 45
		}
		modifier = {
			factor = 1.25
			trait = patient
		}
		modifier = {
			factor = 2
			trait = diligent
		}
		modifier = {
			factor = 2
			trait = diligent
			martial = 12
		}
		modifier = {
			factor = 1.5
			trait = ambitious
		}
		modifier = {
			factor = 1.5
			trait = ambitious
			martial = 12
		}
		modifier = {
			factor = 2.5
			trait = brave
		}
		modifier = {
			factor = 2.5
			trait = crusader
		}
		modifier = {
			factor = 2.5
			trait = mujahid
		}
		modifier = {
			factor = 1.75
			# already has proven battle experience, likely candidate to be in future battles
			OR = { 
				trait = scarred 
				trait = scarred_female
			}
		}
		modifier = {
			factor = 2
			is_strong_trigger = yes
		}
		modifier = {
			factor = 6
			trait = duelist
		}
		modifier = {
			factor = 2.5
			trait = hunter
		}
		modifier = {
			factor = 0.25
			trait = hedonist
		}
		modifier = {
			factor = 0.333
			is_weak_trigger = yes
		}
		modifier = {
			factor = 0.333
			trait = clubfooted
		}
		modifier = {
			factor = 0.75
			trait = content
		}
		modifier = {
			factor = 0.25
			trait = craven
		}
		modifier = {
			factor = 0.1
			trait = slothful
		}
		modifier = {
			factor = 0.667
			OR = {
				trait = elusive_shadow
				trait = intricate_webweaver
			}
		}
		modifier = {
			factor = 0.333
			OR = {
				trait = flamboyant_schemer
				trait = amateurish_plotter
			}
		}
		modifier = {
			factor = 8
			trait = brilliant_strategist
		}
		modifier = {
			factor = 5
			trait = skilled_tactician
		}
		modifier = {
			factor = 3
			trait = tough_soldier
		}
		modifier = {
			factor = 2
			trait = misguided_warrior
		}
		modifier = {
			factor = 0.75
			NOT = { martial = 10 } # implies martial = 8 or 9 (martial < 8 is disabled for AI)
		}
		# TODO: martial scaling should be less coarse-grained
		modifier = {
			factor = 1.5
			martial = 12
		}
		modifier = {
			factor = 1.5
			martial = 15
		}
		modifier = {
			factor = 1.5
			martial = 18
		}
		modifier = {
			factor = 1.5
			martial = 21
		}
		modifier = {
			factor = 1.5
			martial = 24
		}
	}
	success = {
		OR = { # CTA only advances 1 level, but external code or console might jump the trait higher
			trait = poor_warrior
			trait = trained_warrior
			trait = skilled_warrior
			trait = master_warrior
		}
	}
	abort = {
		OR = {
			NOR = {
				is_ruler = yes
				liege = { job_marshal = { character = ROOT } }
			}
			is_adult = no # weird stuff happens.
			age = 50
			prisoner = yes
			trait = incapable
			trait = blinded
			
			# and ladies should abort if conditions change such that they can no longer command armies
			NOR = {
				is_female = no
				AND = {
					religion = norse_pagan
					liege = { religion = norse_pagan }
					trait = martial_lady_pagan
				}
				AND = {
					religion = norse_pagan_reformed
					liege = { religion = norse_pagan_reformed }
					trait = martial_lady_pagan
				}
				AND = {
					religion = german_pagan
					liege = { religion = german_pagan_reformed }
					trait = martial_lady_pagan
				}
				AND = {
					religion = german_pagan_reformed
					liege = { religion = german_pagan_reformed }
					trait = martial_lady_pagan
				}
				AND = {
					religion_group = zoroastrian_group
					culture_group = iranian
					any_dynasty_member = { higher_tier_than = baron }
					trait = martial_lady_tengri
					OR = {
						AND = {
							liege = { religion_group = zoroastrian_group }
							liege = {culture_group = iranian }
						}
						independent = yes
					}
				}
				AND = {
					is_ruler = yes
					independent = yes
					OR = {
						trait = martial_lady
						trait = martial_lady_tengri
						trait = martial_lady_pagan
						martial = 12
					}
				}
				liege = {
					OR = {
						has_law = true_cognatic_succession 
						has_law = enatic_cognatic_succession
						has_law = enatic_succession
					}
				}
				AND = {
					independent = yes
					OR = {
						has_law = true_cognatic_succession
						has_law = enatic_cognatic_succession
						has_law = enatic_succession
					}
				}
				has_character_flag = special_marshal
			}
		}
	}
	abort_effect = {
		# (optional) possibly notify the player of why the ambition aborted in certain cases (prison, reaching age 50-- the rest is obvious)
	}
	effect = {
		prestige = 25
	}
}

# poor_warrior -> trained_warrior
obj_cta_1 = {
	type = character
	
	creation_effect = {
	}
	
	potential = {
		trait = poor_warrior
		NOR = {
			trait = trained_warrior
			trait = skilled_warrior
			trait = master_warrior
		}
		OR = {
			is_ruler = yes
			liege = { job_marshal = { character = ROOT } }
		}
		NOT = { has_character_flag = cta_done }
	}
	
	allow = {
		NOR = {
			is_adult = no
			age = 50
			prisoner = yes
			trait = incapable
			trait = blinded
		}
		# ladies, if you can command armies for your liege/yourself (and meet the base criteria),
		# then this ambition is for you too.
		OR = {
			is_female = no
			AND = {
				religion = norse_pagan
				liege = { religion = norse_pagan }
				trait = martial_lady_pagan
			}
			AND = {
				religion = norse_pagan_reformed
				liege = { religion = norse_pagan_reformed }
				trait = martial_lady_pagan
			}
			AND = {
				religion = german_pagan
				liege = { religion = german_pagan_reformed }
				trait = martial_lady_pagan
			}
			AND = {
				religion = german_pagan_reformed
				liege = { religion = german_pagan_reformed }
				trait = martial_lady_pagan
			}
			AND = {
				religion_group = zoroastrian_group
				culture_group = iranian
				any_dynasty_member = { higher_tier_than = baron }
				trait = martial_lady_tengri
				OR = {
					AND = {
						liege = { religion_group = zoroastrian_group }
						liege = {culture_group = iranian }
					}
					independent = yes
				}
			}
			AND = {
				is_ruler = yes
				independent = yes
				OR = {
					trait = martial_lady
					trait = martial_lady_tengri
					trait = martial_lady_pagan
					martial = 12
				}
			}
			liege = {
				OR = {
					has_law = true_cognatic_succession 
					has_law = enatic_cognatic_succession
					has_law = enatic_succession
				}
			}
			AND = {
				independent = yes
				OR = {
					has_law = true_cognatic_succession
					has_law = enatic_cognatic_succession
					has_law = enatic_succession
				}
			}
			has_character_flag = special_marshal
		}
	}
	chance = {
		factor = 100
		
		modifier = {
			factor = 0
			NOT = { martial = 8 }
		}
		modifier = {
			factor = 10
			liege = { job_marshal = { character = ROOT } }
		}
		modifier = {
			factor = 0.75
			age = 40
		}
		modifier = {
			factor = 0.333
			age = 45
		}
		modifier = {
			factor = 1.25
			trait = patient
		}
		modifier = {
			factor = 2
			trait = diligent
		}
		modifier = {
			factor = 2
			trait = diligent
			martial = 12
		}
		modifier = {
			factor = 1.5
			trait = ambitious
		}
		modifier = {
			factor = 1.5
			trait = ambitious
			martial = 12
		}
		modifier = {
			factor = 2.5
			trait = brave
		}
		modifier = {
			factor = 2.5
			trait = crusader
		}
		modifier = {
			factor = 2.5
			trait = mujahid
		}
		modifier = {
			factor = 1.75
			# already has proven battle experience, likely candidate to be in future battles
			OR = { 
				trait = scarred 
				trait = scarred_female
			}
		}
		modifier = {
			factor = 2
			is_strong_trigger = yes
		}
		modifier = {
			factor = 6
			trait = duelist
		}
		modifier = {
			factor = 2.5
			trait = hunter
		}
		modifier = {
			factor = 0.25
			trait = hedonist
		}
		modifier = {
			factor = 0.333
			is_weak_trigger = yes
		}
		modifier = {
			factor = 0.333
			trait = clubfooted
		}
		modifier = {
			factor = 0.75
			trait = content
		}
		modifier = {
			factor = 0.25
			trait = craven
		}
		modifier = {
			factor = 0.1
			trait = slothful
		}
		modifier = {
			factor = 0.667
			OR = {
				trait = elusive_shadow
				trait = intricate_webweaver
			}
		}
		modifier = {
			factor = 0.333
			OR = {
				trait = flamboyant_schemer
				trait = amateurish_plotter
			}
		}
		modifier = {
			factor = 8
			trait = brilliant_strategist
		}
		modifier = {
			factor = 5
			trait = skilled_tactician
		}
		modifier = {
			factor = 3
			trait = tough_soldier
		}
		modifier = {
			factor = 2
			trait = misguided_warrior
		}
		modifier = {
			factor = 0.75
			NOT = { martial = 10 } # implies martial = 8 or 9 (martial < 8 is disabled for AI)
		}
		# TODO: martial scaling should be less coarse-grained
		modifier = {
			factor = 1.5
			martial = 12
		}
		modifier = {
			factor = 1.5
			martial = 15
		}
		modifier = {
			factor = 1.5
			martial = 18
		}
		modifier = {
			factor = 1.5
			martial = 21
		}
		modifier = {
			factor = 1.5
			martial = 24
		}
	}
	success = {
		OR = {
			trait = trained_warrior
			trait = skilled_warrior
			trait = master_warrior
		}
	}
	abort = {
		OR = {
			NOR = {
				is_ruler = yes
				liege = { job_marshal = { character = ROOT } }
			}
			is_adult = no # weird stuff happens.
			age = 50
			prisoner = yes
			trait = incapable
			trait = blinded
			
			# and ladies should abort if conditions change such that they can no longer command armies
			NOR = {
				is_female = no
				AND = {
					religion = norse_pagan
					liege = { religion = norse_pagan }
					trait = martial_lady_pagan
				}
				AND = {
					religion = norse_pagan_reformed
					liege = { religion = norse_pagan_reformed }
					trait = martial_lady_pagan
				}
				AND = {
					religion = german_pagan
					liege = { religion = german_pagan_reformed }
					trait = martial_lady_pagan
				}
				AND = {
					religion = german_pagan_reformed
					liege = { religion = german_pagan_reformed }
					trait = martial_lady_pagan
				}
				AND = {
					religion_group = zoroastrian_group
					culture_group = iranian
					any_dynasty_member = { higher_tier_than = baron }
					trait = martial_lady_tengri
					OR = {
						AND = {
							liege = { religion_group = zoroastrian_group }
							liege = {culture_group = iranian }
						}
						independent = yes
					}
				}
				AND = {
					is_ruler = yes
					independent = yes
					OR = {
						trait = martial_lady
						trait = martial_lady_tengri
						trait = martial_lady_pagan
						martial = 12
					}
				}
				liege = {
					OR = {
						has_law = true_cognatic_succession 
						has_law = enatic_cognatic_succession
						has_law = enatic_succession
					}
				}
				AND = {
					independent = yes
					OR = {
						has_law = true_cognatic_succession
						has_law = enatic_cognatic_succession
						has_law = enatic_succession
					}
				}
				has_character_flag = special_marshal
			}
			
			NOR = { # external code might demote a character
				trait = poor_warrior
				trait = trained_warrior
				trait = skilled_warrior
				trait = master_warrior
			}
		}
	}
	abort_effect = {
		# (optional) possibly notify the player of why the ambition aborted in certain cases (prison, reaching age 50-- the rest is obvious)
	}
	effect = {
		prestige = 50
	}
}

# trained_warrior -> skilled_warrior
obj_cta_2 = {
	type = character
	
	creation_effect = {
	}
	
	potential = {
		OR = {
			is_ruler = yes
			liege = { job_marshal = { character = ROOT } }
		}
		trait = trained_warrior
		NOR = {
			trait = poor_warrior
			trait = skilled_warrior
			trait = master_warrior
		}
		NOT = { has_character_flag = cta_done }
	}
	
	allow = {
		NOR = {
			is_adult = no
			age = 50
			prisoner = yes
			trait = incapable
			trait = blinded
		}
		# ladies, if you can command armies for your liege/yourself (and meet the base criteria),
		# then this ambition is for you too.
		OR = {
			is_female = no
			AND = {
				religion = norse_pagan
				liege = { religion = norse_pagan }
				trait = martial_lady_pagan
			}
			AND = {
				religion = norse_pagan_reformed
				liege = { religion = norse_pagan_reformed }
				trait = martial_lady_pagan
			}
			AND = {
				religion = german_pagan
				liege = { religion = german_pagan_reformed }
				trait = martial_lady_pagan
			}
			AND = {
				religion = german_pagan_reformed
				liege = { religion = german_pagan_reformed }
				trait = martial_lady_pagan
			}
			AND = {
				religion_group = zoroastrian_group
				culture_group = iranian
				any_dynasty_member = { higher_tier_than = baron }
				trait = martial_lady_tengri
				OR = {
					AND = {
						liege = { religion_group = zoroastrian_group }
						liege = {culture_group = iranian }
					}
					independent = yes
				}
			}
			AND = {
				is_ruler = yes
				independent = yes
				OR = {
					trait = martial_lady
					trait = martial_lady_tengri
					trait = martial_lady_pagan
					martial = 12
				}
			}
			liege = {
				OR = {
					has_law = true_cognatic_succession 
					has_law = enatic_cognatic_succession
					has_law = enatic_succession
				}
			}
			AND = {
				independent = yes
				OR = {
					has_law = true_cognatic_succession
					has_law = enatic_cognatic_succession
					has_law = enatic_succession
				}
			}
			has_character_flag = special_marshal
		}
	}
	chance = {
		factor = 100
		
		modifier = {
			factor = 0
			NOT = { martial = 8 }
		}
		modifier = {
			factor = 10
			liege = { job_marshal = { character = ROOT } }
		}
		modifier = {
			factor = 0.75
			age = 40
		}
		modifier = {
			factor = 0.333
			age = 45
		}
		modifier = {
			factor = 1.25
			trait = patient
		}
		modifier = {
			factor = 2
			trait = diligent
		}
		modifier = {
			factor = 2
			trait = diligent
			martial = 12
		}
		modifier = {
			factor = 1.5
			trait = ambitious
		}
		modifier = {
			factor = 1.5
			trait = ambitious
			martial = 12
		}
		modifier = {
			factor = 2.5
			trait = brave
		}
		modifier = {
			factor = 2.5
			trait = crusader
		}
		modifier = {
			factor = 2.5
			trait = mujahid
		}
		modifier = {
			factor = 1.75
			# already has proven battle experience, likely candidate to be in future battles
			OR = { 
				trait = scarred 
				trait = scarred_female
			}
		}
		modifier = {
			factor = 2
			is_strong_trigger = yes
		}
		modifier = {
			factor = 6
			trait = duelist
		}
		modifier = {
			factor = 2.5
			trait = hunter
		}
		modifier = {
			factor = 0.25
			trait = hedonist
		}
		modifier = {
			factor = 0.333
			is_weak_trigger = yes
		}
		modifier = {
			factor = 0.333
			trait = clubfooted
		}
		modifier = {
			factor = 0.75
			trait = content
		}
		modifier = {
			factor = 0.25
			trait = craven
		}
		modifier = {
			factor = 0.1
			trait = slothful
		}
		modifier = {
			factor = 0.667
			OR = {
				trait = elusive_shadow
				trait = intricate_webweaver
			}
		}
		modifier = {
			factor = 0.333
			OR = {
				trait = flamboyant_schemer
				trait = amateurish_plotter
			}
		}
		modifier = {
			factor = 8
			trait = brilliant_strategist
		}
		modifier = {
			factor = 5
			trait = skilled_tactician
		}
		modifier = {
			factor = 3
			trait = tough_soldier
		}
		modifier = {
			factor = 2
			trait = misguided_warrior
		}
		modifier = {
			factor = 0.75
			NOT = { martial = 10 } # implies martial = 8 or 9 (martial < 8 is disabled for AI)
		}
		# TODO: martial scaling should be less coarse-grained
		modifier = {
			factor = 1.5
			martial = 12
		}
		modifier = {
			factor = 1.5
			martial = 15
		}
		modifier = {
			factor = 1.5
			martial = 18
		}
		modifier = {
			factor = 1.5
			martial = 21
		}
		modifier = {
			factor = 1.5
			martial = 24
		}
	}
	success = {
		OR = {
			trait = skilled_warrior
			trait = master_warrior
		}
	}
	abort = {
		OR = {
			NOR = {
				is_ruler = yes
				liege = { job_marshal = { character = ROOT } }
			}
			is_adult = no # weird stuff happens.
			age = 50
			prisoner = yes
			trait = incapable
			trait = blinded
			
			# and ladies should abort if conditions change such that they can no longer command armies
			NOR = {
				is_female = no
				AND = {
					religion = norse_pagan
					liege = { religion = norse_pagan }
					trait = martial_lady_pagan
				}
				AND = {
					religion = norse_pagan_reformed
					liege = { religion = norse_pagan_reformed }
					trait = martial_lady_pagan
				}
				AND = {
					religion = german_pagan
					liege = { religion = german_pagan_reformed }
					trait = martial_lady_pagan
				}
				AND = {
					religion = german_pagan_reformed
					liege = { religion = german_pagan_reformed }
					trait = martial_lady_pagan
				}
				AND = {
					religion_group = zoroastrian_group
					culture_group = iranian
					any_dynasty_member = { higher_tier_than = baron }
					trait = martial_lady_tengri
					OR = {
						AND = {
							liege = { religion_group = zoroastrian_group }
							liege = {culture_group = iranian }
						}
						independent = yes
					}
				}
				AND = {
					is_ruler = yes
					independent = yes
					OR = {
						trait = martial_lady
						trait = martial_lady_tengri
						trait = martial_lady_pagan
						martial = 12
					}
				}
				liege = {
					OR = {
						has_law = true_cognatic_succession 
						has_law = enatic_cognatic_succession
						has_law = enatic_succession
					}
				}
				AND = {
					independent = yes
					OR = {
						has_law = true_cognatic_succession
						has_law = enatic_cognatic_succession
						has_law = enatic_succession
					}
				}
				has_character_flag = special_marshal
			}
			
			# external code might demote a character
			trait = poor_warrior
			NOR = {
				trait = poor_warrior
				trait = trained_warrior
				trait = skilled_warrior
				trait = master_warrior
			}
		}
	}
	abort_effect = {
		# (optional) possibly notify the player of why the ambition aborted in certain cases (prison, reaching age 50-- the rest is obvious)
	}
	effect = {
		prestige = 75
	}
}

# skilled_warrior -> master_warrior
obj_cta_3 = {
	type = character
	
	creation_effect = {
	}
	
	potential = {
		trait = skilled_warrior
		NOR = {
			trait = poor_warrior
			trait = trained_warrior
			trait = master_warrior
		}
		NOT = { has_character_flag = cta_done }
		OR = {
			is_ruler = yes
			liege = { job_marshal = { character = ROOT } }
		}
	}
	
	allow = {
		NOR = {
			is_adult = no
			age = 50
			prisoner = yes
			trait = incapable
			trait = blinded
		}
		# ladies, if you can command armies for your liege/yourself (and meet the base criteria),
		# then this ambition is for you too.
		OR = {
			is_female = no
			AND = {
				religion = norse_pagan
				liege = { religion = norse_pagan }
				trait = martial_lady_pagan
			}
			AND = {
				religion = norse_pagan_reformed
				liege = { religion = norse_pagan_reformed }
				trait = martial_lady_pagan
			}
			AND = {
				religion = german_pagan
				liege = { religion = german_pagan_reformed }
				trait = martial_lady_pagan
			}
			AND = {
				religion = german_pagan_reformed
				liege = { religion = german_pagan_reformed }
				trait = martial_lady_pagan
			}
			AND = {
				religion_group = zoroastrian_group
				culture_group = iranian
				any_dynasty_member = { higher_tier_than = baron }
				trait = martial_lady_tengri
				OR = {
					AND = {
						liege = { religion_group = zoroastrian_group }
						liege = {culture_group = iranian }
					}
					independent = yes
				}
			}
			AND = {
				is_ruler = yes
				independent = yes
				OR = {
					trait = martial_lady
					trait = martial_lady_tengri
					trait = martial_lady_pagan
					martial = 12
				}
			}
			liege = {
				OR = {
					has_law = true_cognatic_succession 
					has_law = enatic_cognatic_succession
					has_law = enatic_succession
				}
			}
			AND = {
				independent = yes
				OR = {
					has_law = true_cognatic_succession
					has_law = enatic_cognatic_succession
					has_law = enatic_succession
				}
			}
			has_character_flag = special_marshal
		}
	}
	chance = {
		factor = 100
		
		modifier = {
			factor = 0
			NOT = { martial = 8 }
		}
		modifier = {
			factor = 10
			liege = { job_marshal = { character = ROOT } }
		}
		modifier = {
			factor = 0.75
			age = 40
		}
		modifier = {
			factor = 0.333
			age = 45
		}
		modifier = {
			factor = 1.25
			trait = patient
		}
		modifier = {
			factor = 2
			trait = diligent
		}
		modifier = {
			factor = 2
			trait = diligent
			martial = 12
		}
		modifier = {
			factor = 1.5
			trait = ambitious
		}
		modifier = {
			factor = 1.5
			trait = ambitious
			martial = 12
		}
		modifier = {
			factor = 2.5
			trait = brave
		}
		modifier = {
			factor = 2.5
			trait = crusader
		}
		modifier = {
			factor = 2.5
			trait = mujahid
		}
		modifier = {
			factor = 1.75
			# already has proven battle experience, likely candidate to be in future battles
			OR = { 
				trait = scarred 
				trait = scarred_female
			}
		}
		modifier = {
			factor = 2
			is_strong_trigger = yes
		}
		modifier = {
			factor = 6
			trait = duelist
		}
		modifier = {
			factor = 2.5
			trait = hunter
		}
		modifier = {
			factor = 0.25
			trait = hedonist
		}
		modifier = {
			factor = 0.333
			is_weak_trigger = yes
		}
		modifier = {
			factor = 0.333
			trait = clubfooted
		}
		modifier = {
			factor = 0.75
			trait = content
		}
		modifier = {
			factor = 0.25
			trait = craven
		}
		modifier = {
			factor = 0.1
			trait = slothful
		}
		modifier = {
			factor = 0.667
			OR = {
				trait = elusive_shadow
				trait = intricate_webweaver
			}
		}
		modifier = {
			factor = 0.333
			OR = {
				trait = flamboyant_schemer
				trait = amateurish_plotter
			}
		}
		modifier = {
			factor = 8
			trait = brilliant_strategist
		}
		modifier = {
			factor = 5
			trait = skilled_tactician
		}
		modifier = {
			factor = 3
			trait = tough_soldier
		}
		modifier = {
			factor = 2
			trait = misguided_warrior
		}
		modifier = {
			factor = 0.75
			NOT = { martial = 10 } # implies martial = 8 or 9 (martial < 8 is disabled for AI)
		}
		# TODO: martial scaling should be less coarse-grained
		modifier = {
			factor = 1.5
			martial = 12
		}
		modifier = {
			factor = 1.5
			martial = 15
		}
		modifier = {
			factor = 1.5
			martial = 18
		}
		modifier = {
			factor = 1.5
			martial = 21
		}
		modifier = {
			factor = 1.5
			martial = 24
		}
	}
	success = {
		trait = master_warrior
	}
	abort = {
		OR = {
			NOR = {
				is_ruler = yes
				liege = { job_marshal = { character = ROOT } }
			}
			is_adult = no # weird stuff happens.
			age = 50
			prisoner = yes
			trait = incapable
			trait = blinded
			
			# and ladies should abort if conditions change such that they can no longer command armies
			NOR = {
				is_female = no
				AND = {
					religion = norse_pagan
					liege = { religion = norse_pagan }
					trait = martial_lady_pagan
				}
				AND = {
					religion = norse_pagan_reformed
					liege = { religion = norse_pagan_reformed }
					trait = martial_lady_pagan
				}
				AND = {
					religion = german_pagan
					liege = { religion = german_pagan_reformed }
					trait = martial_lady_pagan
				}
				AND = {
					religion = german_pagan_reformed
					liege = { religion = german_pagan_reformed }
					trait = martial_lady_pagan
				}
				AND = {
					religion_group = zoroastrian_group
					culture_group = iranian
					any_dynasty_member = { higher_tier_than = baron }
					trait = martial_lady_tengri
					OR = {
						AND = {
							liege = { religion_group = zoroastrian_group }
							liege = {culture_group = iranian }
						}
						independent = yes
					}
				}
				AND = {
					is_ruler = yes
					independent = yes
					OR = {
						trait = martial_lady
						trait = martial_lady_tengri
						trait = martial_lady_pagan
						martial = 12
					}
				}
				liege = {
					OR = {
						has_law = true_cognatic_succession 
						has_law = enatic_cognatic_succession
						has_law = enatic_succession
					}
				}
				AND = {
					independent = yes
					OR = {
						has_law = true_cognatic_succession
						has_law = enatic_cognatic_succession
						has_law = enatic_succession
					}
				}
				has_character_flag = special_marshal
			}
			
			# external code might demote a character
			trait = poor_warrior
			trait = trained_warrior
			NOR = {
				trait = poor_warrior
				trait = trained_warrior
				trait = skilled_warrior
				trait = master_warrior
			}
		}
	}
	abort_effect = {
		# (optional) possibly notify the player of why the ambition aborted in certain cases (prison, reaching age 50-- the rest is obvious)
	}
	effect = {
		prestige = 100
	}
}

obj_increase_demesne_1 = {
	type = character
	
	potential = {
		is_ruler = yes
		is_landed = yes
		num_of_count_titles = 1
		NOT = { demesne_size = 2 }
		OR = {
			ai = no
			NOT = { has_character_flag = obj_demesne }
		}
	}

	allow = {
		is_adult = yes
		NOT = { trait = incapable }
		demesne_efficiency = 1.01
	}
	chance = {
		factor = 50

		modifier = {
			factor = 1.5
			prestige = 100
		}
		modifier = {
			factor = 1.5
			prestige = 250
		}
		modifier = {
			factor = 1.5
			prestige = 400
		}
		modifier = {
			factor = 1.5
			trait = envious
		}
		modifier = {
			factor = 0.1
			trait = humble
		}
		modifier = {
			factor = 10.0
			trait = ambitious
		}
		modifier = {
			factor = 0
			trait = content
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		demesne_size = 2
	}
	abort = {
		OR = {
			trait = incapable
			is_ruler = no
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		if = {
			limit = { NOT = { has_character_flag = obj_demesne } }
			change_stewardship = 1
			if = {
				limit = { independent = no }
				liege = {
					reverse_opinion = {
						who = ROOT
						modifier = opinion_happy
						months = 120
					}
				}
			}
		}
		if = {
			limit = { has_character_flag = obj_demesne }
			prestige = 25
		}
		set_character_flag = obj_demesne
	}
}

obj_increase_demesne_2 = {
	type = character
	
	potential = {
		is_ruler = yes
		is_landed = yes
		num_of_count_titles = 1
		demesne_size = 2
		NOT = { demesne_size = 3 }
		OR = {
			ai = no
			NOT = { has_character_flag = obj_demesne }
		}
	}

	allow = {
		is_adult = yes
		NOT = { trait = incapable }
		demesne_efficiency = 1.01
	}
	chance = {
		factor = 50

		modifier = {
			factor = 1.5
			prestige = 100
		}
		modifier = {
			factor = 1.5
			prestige = 250
		}
		modifier = {
			factor = 1.5
			prestige = 400
		}
		modifier = {
			factor = 1.5
			trait = envious
		}
		modifier = {
			factor = 0.1
			trait = humble
		}
		modifier = {
			factor = 10.0
			trait = ambitious
		}
		modifier = {
			factor = 0
			trait = content
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		demesne_size = 3
	}
	abort = {
		OR = {
			trait = incapable
			is_ruler = no
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		if = {
			limit = { NOT = { has_character_flag = obj_demesne } }
			change_stewardship = 1
			if = {
				limit = { independent = no }
				liege = {
					reverse_opinion = {
						who = ROOT
						modifier = opinion_happy
						months = 120
					}
				}
			}
		}
		if = {
			limit = { has_character_flag = obj_demesne }
			prestige = 25
		}
		set_character_flag = obj_demesne
	}
}

obj_increase_demesne_3 = {
	type = character
	
	potential = {
		is_ruler = yes
		is_landed = yes
		num_of_count_titles = 1
		demesne_size = 3
		NOT = { demesne_size = 4 }
		OR = {
			ai = no
			NOT = { has_character_flag = obj_demesne }
		}
	}

	allow = {
		is_adult = yes
		NOT = { trait = incapable }
		demesne_efficiency = 1.01
	}
	chance = {
		factor = 50

		modifier = {
			factor = 1.5
			prestige = 100
		}
		modifier = {
			factor = 1.5
			prestige = 250
		}
		modifier = {
			factor = 1.5
			prestige = 400
		}
		modifier = {
			factor = 1.5
			trait = envious
		}
		modifier = {
			factor = 0.1
			trait = humble
		}
		modifier = {
			factor = 10.0
			trait = ambitious
		}
		modifier = {
			factor = 0
			trait = content
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		demesne_size = 4
	}
	abort = {
		OR = {
			trait = incapable
			is_ruler = no
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		if = {
			limit = { NOT = { has_character_flag = obj_demesne } }
			change_stewardship = 1
			if = {
				limit = { independent = no }
				liege = {
					reverse_opinion = {
						who = ROOT
						modifier = opinion_happy
						months = 120
					}
				}
			}
		}
		if = {
			limit = { has_character_flag = obj_demesne }
			prestige = 25
		}
		set_character_flag = obj_demesne
	}
}

obj_increase_demesne_4 = {
	type = character
	
	potential = {
		is_ruler = yes
		is_landed = yes
		num_of_count_titles = 1
		demesne_size = 4
		NOT = { demesne_size = 5 }
		OR = {
			ai = no
			NOT = { has_character_flag = obj_demesne }
		}
	}

	allow = {
		is_adult = yes
		NOT = { trait = incapable }
		demesne_efficiency = 1.01
	}
	chance = {
		factor = 50

		modifier = {
			factor = 1.5
			prestige = 100
		}
		modifier = {
			factor = 1.5
			prestige = 250
		}
		modifier = {
			factor = 1.5
			prestige = 400
		}
		modifier = {
			factor = 1.5
			trait = envious
		}
		modifier = {
			factor = 0.1
			trait = humble
		}
		modifier = {
			factor = 10.0
			trait = ambitious
		}
		modifier = {
			factor = 0
			trait = content
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		demesne_size = 5
	}
	abort = {
		OR = {
			trait = incapable
			is_ruler = no
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		if = {
			limit = { NOT = { has_character_flag = obj_demesne } }
			change_stewardship = 1
			if = {
				limit = { independent = no }
				liege = {
					reverse_opinion = {
						who = ROOT
						modifier = opinion_happy
						months = 120
					}
				}
			}
		}
		if = {
			limit = { has_character_flag = obj_demesne }
			prestige = 25
		}
		set_character_flag = obj_demesne
	}
}

obj_increase_demesne_5 = {
	type = character
	
	potential = {
		is_ruler = yes
		is_landed = yes
		num_of_count_titles = 1
		demesne_size = 5
		NOT = { demesne_size = 6 }
		OR = {
			ai = no
			NOT = { has_character_flag = obj_demesne }
		}
	}

	allow = {
		is_adult = yes
		NOT = { trait = incapable }
		demesne_efficiency = 1.01
	}
	chance = {
		factor = 50

		modifier = {
			factor = 1.5
			prestige = 100
		}
		modifier = {
			factor = 1.5
			prestige = 250
		}
		modifier = {
			factor = 1.5
			prestige = 400
		}
		modifier = {
			factor = 1.5
			trait = envious
		}
		modifier = {
			factor = 0.1
			trait = humble
		}
		modifier = {
			factor = 10.0
			trait = ambitious
		}
		modifier = {
			factor = 0
			trait = content
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		demesne_size = 6
	}
	abort = {
		OR = {
			trait = incapable
			is_ruler = no
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		if = {
			limit = { NOT = { has_character_flag = obj_demesne } }
			change_stewardship = 1
			if = {
				limit = { independent = no }
				liege = {
					reverse_opinion = {
						who = ROOT
						modifier = opinion_happy
						months = 120
					}
				}
			}
		}
		if = {
			limit = { has_character_flag = obj_demesne }
			prestige = 25
		}
		set_character_flag = obj_demesne
	}
}

obj_increase_demesne_6 = {
	type = character
	
	potential = {
		is_ruler = yes
		is_landed = yes
		num_of_count_titles = 1
		demesne_size = 6
		NOT = { demesne_size = 7 }
		OR = {
			ai = no
			NOT = { has_character_flag = obj_demesne }
		}
	}

	allow = {
		is_adult = yes
		NOT = { trait = incapable }
		demesne_efficiency = 1.01
	}
	chance = {
		factor = 50

		modifier = {
			factor = 1.5
			prestige = 100
		}
		modifier = {
			factor = 1.5
			prestige = 250
		}
		modifier = {
			factor = 1.5
			prestige = 400
		}
		modifier = {
			factor = 1.5
			trait = envious
		}
		modifier = {
			factor = 0.1
			trait = humble
		}
		modifier = {
			factor = 10.0
			trait = ambitious
		}
		modifier = {
			factor = 0
			trait = content
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		demesne_size = 7
	}
	abort = {
		OR = {
			trait = incapable
			is_ruler = no
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		if = {
			limit = { NOT = { has_character_flag = obj_demesne } }
			change_stewardship = 1
			if = {
				limit = { independent = no }
				liege = {
					reverse_opinion = {
						who = ROOT
						modifier = opinion_happy
						months = 120
					}
				}
			}
		}
		if = {
			limit = { has_character_flag = obj_demesne }
			prestige = 25
		}
		set_character_flag = obj_demesne
	}
}

obj_increase_demesne_7 = {
	type = character
	
	potential = {
		is_ruler = yes
		is_landed = yes
		num_of_count_titles = 1
		demesne_size = 7
		NOT = { demesne_size = 8 }
		OR = {
			ai = no
			NOT = { has_character_flag = obj_demesne }
		}
	}

	allow = {
		is_adult = yes
		NOT = { trait = incapable }
		demesne_efficiency = 1.01
	}
	chance = {
		factor = 50

		modifier = {
			factor = 1.5
			prestige = 100
		}
		modifier = {
			factor = 1.5
			prestige = 250
		}
		modifier = {
			factor = 1.5
			prestige = 400
		}
		modifier = {
			factor = 1.5
			trait = envious
		}
		modifier = {
			factor = 0.1
			trait = humble
		}
		modifier = {
			factor = 10.0
			trait = ambitious
		}
		modifier = {
			factor = 0
			trait = content
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		demesne_size = 8
	}
	abort = {
		OR = {
			trait = incapable
			is_ruler = no
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		if = {
			limit = { NOT = { has_character_flag = obj_demesne } }
			change_stewardship = 1
			if = {
				limit = { independent = no }
				liege = {
					reverse_opinion = {
						who = ROOT
						modifier = opinion_happy
						months = 120
					}
				}
			}
		}
		if = {
			limit = { has_character_flag = obj_demesne }
			prestige = 25
		}
		set_character_flag = obj_demesne
	}
}

obj_increase_demesne_8 = {
	type = character
	
	potential = {
		is_ruler = yes
		is_landed = yes
		num_of_count_titles = 1
		demesne_size = 8
		NOT = { demesne_size = 9 }
		OR = {
			ai = no
			NOT = { has_character_flag = obj_demesne }
		}
	}

	allow = {
		is_adult = yes
		NOT = { trait = incapable }
		demesne_efficiency = 1.01
	}
	chance = {
		factor = 50

		modifier = {
			factor = 1.5
			prestige = 100
		}
		modifier = {
			factor = 1.5
			prestige = 250
		}
		modifier = {
			factor = 1.5
			prestige = 400
		}
		modifier = {
			factor = 1.5
			trait = envious
		}
		modifier = {
			factor = 0.1
			trait = humble
		}
		modifier = {
			factor = 10.0
			trait = ambitious
		}
		modifier = {
			factor = 0
			trait = content
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		demesne_size = 9
	}
	abort = {
		OR = {
			trait = incapable
			is_ruler = no
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		if = {
			limit = { NOT = { has_character_flag = obj_demesne } }
			change_stewardship = 1
			if = {
				limit = { independent = no }
				liege = {
					reverse_opinion = {
						who = ROOT
						modifier = opinion_happy
						months = 120
					}
				}
			}
		}
		if = {
			limit = { has_character_flag = obj_demesne }
			prestige = 25
		}
		set_character_flag = obj_demesne
	}
}

obj_increase_demesne_9 = {
	type = character
	
	potential = {
		is_ruler = yes
		is_landed = yes
		num_of_count_titles = 1
		demesne_size = 9
		NOT = { demesne_size = 10 }
		OR = {
			ai = no
			NOT = { has_character_flag = obj_demesne }
		}
	}

	allow = {
		is_adult = yes
		NOT = { trait = incapable }
		demesne_efficiency = 1.01
	}
	chance = {
		factor = 50

		modifier = {
			factor = 1.5
			prestige = 100
		}
		modifier = {
			factor = 1.5
			prestige = 250
		}
		modifier = {
			factor = 1.5
			prestige = 400
		}
		modifier = {
			factor = 1.5
			trait = envious
		}
		modifier = {
			factor = 0.1
			trait = humble
		}
		modifier = {
			factor = 10.0
			trait = ambitious
		}
		modifier = {
			factor = 0
			trait = content
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		demesne_size = 10
	}
	abort = {
		OR = {
			trait = incapable
			is_ruler = no
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		if = {
			limit = { NOT = { has_character_flag = obj_demesne } }
			change_stewardship = 1
			if = {
				limit = { independent = no }
				liege = {
					reverse_opinion = {
						who = ROOT
						modifier = opinion_happy
						months = 120
					}
				}
			}
		}
		if = {
			limit = { has_character_flag = obj_demesne }
			prestige = 25
		}
		set_character_flag = obj_demesne
	}
}

obj_become_duke = {
	type = character
	
	potential = {
		is_ruler = yes
		is_landed = yes
		tier = count
	}

	allow = {
		is_adult = yes
		NOT = { trait = incapable }
		NOT = { trait = content }
	}
	chance = {
		factor = 20
		modifier = {
			factor = 1.5
			demesne_size = 2
		}
		modifier = {
			factor = 1.5
			demesne_size = 3
		}
		modifier = {
			factor = 1.5
			demesne_size = 4
		}
		modifier = {
			factor = 10
			any_claim = { tier = DUKE }
		}
		modifier = {
			factor = 2
			trait = ambitious
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		higher_tier_than = count
	}
	abort = {
		OR = {
			is_ruler = no
			NOT = { higher_tier_than = baron }
			trait = incapable
			trait = content
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		prestige = 50
	}
}

obj_become_multiduke = {
	type = character
	
	potential = {
		is_ruler = yes
		is_landed = yes
		tier = duke
		NOT = { num_of_duke_titles = 2 }
	}

	allow = {
		is_adult = yes
		NOT = { trait = incapable }
		NOT = { trait = content }
	}
	chance = {
		factor = 20
		modifier = {
			factor = 1.5
			demesne_size = 2
		}
		modifier = {
			factor = 1.5
			demesne_size = 3
		}
		modifier = {
			factor = 1.5
			demesne_size = 4
		}
		modifier = {
			factor = 1.5
			demesne_size = 5
		}
		modifier = {
			factor = 2
			trait = ambitious
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		num_of_duke_titles = 2
	}
	abort = {
		OR = {
			is_ruler = no
			NOT = { higher_tier_than = count }
			trait = incapable
			trait = content
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		prestige = 100
	}
}

obj_become_emperor = {
	type = character
	
	potential = {
		ai = no
		is_ruler = yes
		is_landed = yes
		lower_tier_than = EMPEROR
		NOT = { has_character_flag = obj_increase_title_3 }
	}

	allow = {
		is_adult = yes
		NOT = { trait = incapable }
		OR = {
			primary_title = { tier = KING }
			any_claim = { tier = EMPEROR }
			liege = { primary_title = { tier = EMPEROR has_law = succ_feudal_elective } }
		}
	}
	chance = {
		factor = 0
	}
	success = {
		higher_tier_than = king
	}
	abort = {
		OR = {
			trait = incapable
			is_ruler = no
		}
	}
	abort_effect = {
	}
	effect = {
		prestige = 500
		set_character_flag = obj_increase_title_3
	}
}

obj_go_crusade = {
	type = character
	
	potential = {
		ai = no
		is_ruler = yes
		religion = catholic
		NOT = { has_character_flag = obj_go_crusade }
		NOT = { trait = crusader }
		OR = {
			is_female = no
			AND = {
				religion = norse_pagan
				liege = { religion = norse_pagan }
				trait = martial_lady_pagan
			}
			AND = {
				religion = norse_pagan_reformed
				liege = { religion = norse_pagan_reformed }
				trait = martial_lady_pagan
			}
			AND = {
				religion = german_pagan
				liege = { religion = german_pagan_reformed }
				trait = martial_lady_pagan
			}
			AND = {
				religion = german_pagan_reformed
				liege = { religion = german_pagan_reformed }
				trait = martial_lady_pagan
			}
			AND = {
				religion_group = zoroastrian_group
				culture_group = iranian
				any_dynasty_member = { higher_tier_than = baron }
				trait = martial_lady_tengri
				OR = {
					AND = {
						liege = { religion_group = zoroastrian_group }
						liege = {culture_group = iranian }
					}
					independent = yes
				}
			}
			AND = {
				is_ruler = yes
				independent = yes
				OR = {
					trait = martial_lady
					trait = martial_lady_tengri
					trait = martial_lady_pagan
					martial = 12
				}
			}
			liege = {
				OR = {
					has_law = true_cognatic_succession 
					has_law = enatic_cognatic_succession
					has_law = enatic_succession
				}
			}
			AND = {
				independent = yes
				OR = {
					has_law = true_cognatic_succession
					has_law = enatic_cognatic_succession
					has_law = enatic_succession
				}
			}
			has_character_flag = special_marshal
		}
	}

	allow = {
		prisoner = no
		is_adult = yes
		religion_head = { has_called_crusade = yes }
		NOT = { trait = incapable }
	}
	chance = {
		factor = 0
	}
	success = {
		trait = crusader
	}
	abort = {
		OR = {
			prisoner = yes
			is_ruler = no
			trait = incapable
			NOT = {
				religion_head = { has_called_crusade = yes }
			}
			NOT = { religion = catholic }
		}
	}
	abort_effect = {
	}
	effect = {
		if = {
			limit = { any_vassal = { leads_faction = faction_tradition } }
			custom_tooltip = { text = TRADITIONFACTIONMOODPLUS }
			hidden_tooltip = {
				random_vassal = { limit = { leads_faction = faction_tradition } set_variable = { which = "faction_mood_increase" value = 2 } }
				character_event = { id = PlusFaction.200 days = 1 } #recalculate faction moods
			}
		}
		hidden_tooltip = { change_variable = { which = "lifestyle_martial" value = 1 } }
		piety = 100
		set_character_flag = obj_go_crusade
	}
}

obj_go_jihad = {
	type = character
	
	potential = {
		ai = no
		is_ruler = yes
		is_female = no
		religion_group = muslim
		NOT = { has_character_flag = obj_go_crusade }
		NOT = { trait = mujahid }
		NOT = { trait = decadent }
	}

	allow = {
		prisoner = no
		is_adult = yes
		NOT = { trait = incapable }
		religion_head = { has_called_crusade = yes }
	}
	chance = {
		factor = 0
	}
	success = {
		trait = mujahid
	}
	abort = {
		OR = {
			prisoner = yes
			is_ruler = no
			trait = incapable
			trait = decadent
			NOT = {
				religion_head = { has_called_crusade = yes }
			}
			NOT = { religion_group = muslim }
		}
	}
	abort_effect = {
		set_character_flag = obj_aborted
		clr_character_flag = obj_check
	}
	effect = {
		if = {
			limit = { any_vassal = { leads_faction = faction_tradition } }
			custom_tooltip = { text = TRADITIONFACTIONMOODPLUS }
			hidden_tooltip = {
				random_vassal = { limit = { leads_faction = faction_tradition } set_variable = { which = "faction_mood_increase" value = 2 } }
				character_event = { id = PlusFaction.200 days = 1 } #recalculate faction moods
			}
		}
		hidden_tooltip = { change_variable = { which = "lifestyle_martial" value = 1 } }
		piety = 100
		set_character_flag = obj_go_crusade
	}
}

obj_break_out_of_prison = {
	type = character
	
	potential = {
		prisoner = yes
	}

	allow = {
		is_adult = yes
		NOT = { trait = incapable }
	}
	chance = {
		factor = 10000
	}
	success = {
		prisoner = no
	}
	abort = {
		trait = incapable
	}
	abort_effect = {
	}
	effect = {
		change_intrigue = 1
		set_character_flag = obj_break_out_of_prison
	}
}

obj_win_a_war = {
	type = character
	
	potential = {
		war = no
		OR = {
			ai = no
			NOT = { has_character_flag = obj_win_a_war }
		}
		is_ruler = yes
		NOT = { has_character_modifier = victory_timer }
	}

	allow = {
		prisoner = no
		is_adult = yes
		NOT = { trait = incapable }
	}

	chance = {
		factor = 100
		modifier = {
			factor = 0
			independent = no
		}
		modifier = {
			factor = 0.25
			is_female = yes
		}
		modifier = {
			factor = 0
			trait = craven
		}
		modifier = {
			factor = 2.0
			trait = brave
		}
		modifier = {
			factor = 1.5
			trait = ambitious
		}
		modifier = {
			factor = 0.5
			trait = content
		}
		modifier = {
			factor = 1.5
			is_strong_trigger = yes
		}
		modifier = {
			factor = 1.5
			martial = 10
		}
		modifier = {
			factor = 1.5
			martial = 15
		}
		modifier = {
			factor = 1.5
			martial = 20
		}
		modifier = {
			factor = 0.5
			NOT = { martial = 5 }
		}
		modifier = {
			factor = 0.5
			NOT = { martial = 3 }
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		has_character_modifier = victory_timer
	}
	abort = {
		OR = {
			prisoner = yes
			trait = incapable
			is_ruler = no
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			change_variable = { which = "lifestyle_martial" value = 1 }
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		if = {
			limit = { any_vassal = { leads_faction = faction_glory } }
			custom_tooltip = { text = GLORYFACTIONMOODPLUS }
			hidden_tooltip = {
				random_vassal = { limit = { leads_faction = faction_glory } set_variable = { which = "faction_mood_increase" value = 2 } }
				character_event = { id = PlusFaction.200 days = 1 } #recalculate faction moods
			}
		}
		if = {
			limit = { NOT = { has_character_flag = obj_win_a_war } }
			change_martial = 1
			prestige = 50
		}
		if = {
			limit = { has_character_flag = obj_win_a_war }
			prestige = 25
		}
		set_character_flag = obj_win_a_war
	}
}

obj_convert_a_province = {
	type = character
	
	potential = {
		is_ruler = yes
		OR = {
			ai = no
			NOT = { has_character_flag = obj_convert_a_province }
		}
		any_realm_province = {
			NOT = { religion = ROOT }
		}
	}

	allow = {
		is_adult = yes
		war = no
		NOT = { trait = incapable }
		NOT = { has_character_modifier = convert_province_timer }
	}

	chance = {
		factor = 100

		modifier = {
			factor = 0
			trait = cynical
		}
		modifier = {
			factor = 2.0
			trait = crusader
		}
		modifier = {
			factor = 2.0
			trait = zealous
		}
		modifier = {
			factor = 1.5
			learning = 10
		}
		modifier = {
			factor = 1.5
			learning = 15
		}
		modifier = {
			factor = 1.5
			learning = 20
		}
		modifier = {
			factor = 0.5
			NOT = { learning = 5 }
		}
		modifier = {
			factor = 0.5
			NOT = { learning = 3 }
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		has_character_modifier = convert_province_timer
	}
	abort = {
		OR = {
			trait = incapable
			is_ruler = no
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		if = {
			limit = { any_vassal = { leads_faction = faction_tradition } }
			custom_tooltip = { text = TRADITIONFACTIONMOODPLUS }
			hidden_tooltip = {
				random_vassal = { limit = { leads_faction = faction_tradition } set_variable = { which = "faction_mood_increase" value = 2 } }
				character_event = { id = PlusFaction.200 days = 1 } #recalculate faction moods
			}
		}
		if = {
			limit = { NOT = { has_character_flag = obj_convert_a_province } }
			change_learning = 1
			piety = 50
		}
		if = {
			limit = { has_character_flag = obj_convert_a_province }
			piety = 25
		}
		set_character_flag = obj_convert_a_province
	}
}

obj_adopt_a_lifestyle = {
	type = character
	
	potential = {
		NOT = { lifestyle_traits = 1 }
		NOT = { has_character_flag = obj_adopt_a_lifestyle }
		NOT = { has_character_flag = lifestyle_pick }
	}

	allow = {
		prisoner = no
		age = 25
		NOT = { trait = incapable }
		OR = {
			diplomacy = 5
			martial = 5
			intrigue = 5
			stewardship = 5
			learning = 5
		}
	}

	chance = {
		factor = 50

		modifier = {
			factor = 1.5
			trait = diligent
		}
		modifier = {
			factor = 0.5
			trait = slothful
		}
		modifier = {
			factor = 0.5
			is_ruler = yes
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		lifestyle_traits = 1
	}
	abort = {
		OR = {
			prisoner = yes
			trait = incapable
			AND = {
				NOT = { diplomacy = 5 }
				NOT = { martial = 5 }
				NOT = { intrigue = 5 }
				NOT = { stewardship = 5 }
				NOT = { learning = 5 }
			}
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		prestige = 50
		set_character_flag = obj_adopt_a_lifestyle
	}
}

obj_gain_honorary_title = {
	type = character
	
	potential = {
		independent = no
		liege = {
			OR = {
				is_feudal = yes
				is_tribal = yes
			}
		}
		OR = {
			ai = no
			NOT = { has_character_flag = obj_gain_honorary_title }
		}
	}

	allow = {
		prisoner = no
		is_adult = yes
		NOT = { trait = incapable }
		NOT = { has_character_modifier = planning_claimant_adventure }
		NOR = {
			has_minor_title = title_keeper_of_swans
			has_minor_title = title_master_of_the_horse
			has_minor_title = title_master_of_the_hunt
			has_minor_title = title_high_almoner
			has_minor_title = title_cupbearer
			has_minor_title = title_seneschal
			has_minor_title = title_despot
			has_minor_title = title_sebastokrator
			has_minor_title = title_kouropalates
			has_minor_title = title_caesar
			has_minor_title = title_anthypatos
			has_minor_title = title_court_dwarf
			has_minor_title = title_court_jester
			has_minor_title = title_food_taster
			has_minor_title = title_court_calligrapher
			has_minor_title = title_court_musician
			has_minor_title = title_court_poet
			has_minor_title = title_chief_architect
			has_minor_title = title_imperial_eunuch
			has_minor_title = title_high_judge
			has_minor_title = title_high_admiral
			has_minor_title = title_state_inquisitor
			has_minor_title = title_volva
			has_minor_title = title_lawspeaker
			has_minor_title = title_drottseti
			has_minor_title = title_court_skald
			has_minor_title = title_marksman
			has_minor_title = title_hirdman
			has_minor_title = title_baghatur
			has_minor_title = title_cherbi
			has_minor_title = title_darkhan
			has_minor_title = title_noyan
			has_minor_title = title_shahrwaraz
			has_minor_title = title_kardarigan
			has_minor_title = title_shahin
			has_minor_title = title_pushtigban_salar
			has_minor_title = title_spahbod
			has_minor_title = title_eran_ambaragbed
			has_minor_title = title_champion
			has_minor_title = title_master_of_the_blade
			has_minor_title = title_master_of_the_bow
			has_minor_title = title_venerable_elder
			has_minor_title = title_yabgu
			has_minor_title = title_ishad
			has_minor_title = title_kundur
			has_minor_title = title_vestalis
			has_minor_title = title_vestalis_maxima
			has_minor_title = title_pagan_wizard
			has_minor_title = title_censor
			has_minor_title = title_aedile
			has_minor_title = title_magister_equitum
			has_minor_title = title_flamen_dialis
			has_minor_title = title_flaminica_dialis
			has_minor_title = title_flamen_martialis
			has_minor_title = title_flaminica_martialis
			has_minor_title = title_flamen_quirinalis
			has_minor_title = title_flaminica_quirinalis			
			has_minor_title = title_uchelwr
			has_minor_title = title_laoch
			has_minor_title = title_royal_champion
			has_minor_title = title_vates
			has_minor_title = title_court_bard
		}
	}

	chance = {
		factor = 50

		modifier = {
			factor = 0.1
			is_female = yes
		}
		modifier = {
			factor = 2.0
			trait = ambitious
		}
		modifier = {
			factor = 2.0
			trait = proud
		}
		modifier = {
			factor = 0.5
			trait = content
		}
		modifier = {
			factor = 0.5
			trait = humble
		}
		modifier = {
			factor = 0.5
			is_ruler = yes
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		custom_tooltip = {
			text = custom_minor_title
		}
		hidden_tooltip = {
			OR = {
				has_minor_title = title_keeper_of_swans
				has_minor_title = title_master_of_the_horse
				has_minor_title = title_master_of_the_hunt
				has_minor_title = title_high_almoner
				has_minor_title = title_cupbearer
				has_minor_title = title_seneschal
				has_minor_title = title_despot
				has_minor_title = title_sebastokrator
				has_minor_title = title_kouropalates
				has_minor_title = title_caesar
				has_minor_title = title_anthypatos
				has_minor_title = title_court_dwarf
				has_minor_title = title_court_calligrapher
				has_minor_title = title_court_musician
				has_minor_title = title_court_poet
				has_minor_title = title_chief_architect
				has_minor_title = title_imperial_eunuch
				has_minor_title = title_high_judge
				has_minor_title = title_high_admiral
				has_minor_title = title_state_inquisitor
				has_minor_title = title_volva
				has_minor_title = title_lawspeaker
				has_minor_title = title_drottseti
				has_minor_title = title_court_skald
				has_minor_title = title_marksman
				has_minor_title = title_hirdman
				has_minor_title = title_baghatur
				has_minor_title = title_cherbi
				has_minor_title = title_darkhan
				has_minor_title = title_noyan
				has_minor_title = title_shahrwaraz
				has_minor_title = title_kardarigan
				has_minor_title = title_shahin
				has_minor_title = title_pushtigban_salar
				has_minor_title = title_spahbod
				has_minor_title = title_eran_ambaragbed
				has_minor_title = title_champion
				has_minor_title = title_master_of_the_blade
				has_minor_title = title_master_of_the_bow
				has_minor_title = title_venerable_elder
				has_minor_title = title_yabgu
				has_minor_title = title_ishad
				has_minor_title = title_kundur
				has_minor_title = title_vestalis
				has_minor_title = title_vestalis_maxima
				has_minor_title = title_pagan_wizard
				has_minor_title = title_censor
				has_minor_title = title_aedile
				has_minor_title = title_magister_equitum
				has_minor_title = title_flamen_dialis
				has_minor_title = title_flaminica_dialis
				has_minor_title = title_flamen_martialis
				has_minor_title = title_flaminica_martialis
				has_minor_title = title_flamen_quirinalis
				has_minor_title = title_flaminica_quirinalis				
				has_minor_title = title_uchelwr
				has_minor_title = title_laoch
				has_minor_title = title_royal_champion
				has_minor_title = title_vates
				has_minor_title = title_court_bard
			}
		}
	}
	abort = {
		OR = {
			has_character_modifier = planning_claimant_adventure
			prisoner = yes
			trait = incapable
			independent = yes
			liege = {
				is_feudal = no
				is_tribal = no
			}
			has_minor_title = title_court_jester
			has_minor_title = title_food_taster
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		if = {
			limit = { NOT = { has_character_flag = obj_gain_honorary_title } }
			prestige = 50
		}
		if = {
			limit = { has_character_flag = obj_gain_honorary_title }
			prestige = 25
		}
		liege = {
			reverse_opinion = {
				modifier = opinion_honorary_title
				who = ROOT
				years = 10
			}
		}
		set_character_flag = obj_gain_honorary_title
	}
}

obj_gain_estates_1 = {
	type = character
	
	potential = {
		is_ruler = no
		liege = { is_nomadic = no }
		liege = { is_tribal = no }
		NOR = {
			trait = monk
			trait = nun
			trait = eunuch
			trait = incapable
			has_character_modifier = estates_1
			has_character_modifier = estates_2
			has_character_modifier = estates_3
			has_character_modifier = estates_4
			has_character_modifier = estates_5
			has_character_flag = flag_denied_estates
			has_character_flag = obj_gain_estates
		}
	}

	allow = {
		prisoner = no
		is_adult = yes
		OR = {
			is_female = no
			liege = {
				OR = {
					has_law = true_cognatic_succession
					has_law = enatic_cognatic_succession
					has_law = enatic_succession
				}
			}
			liege = {
				is_close_relative = ROOT
				has_law = cognatic_succession
			}
		}
		NOT = { spouse = { is_ruler = yes } }
		NOT = { has_minor_title = title_guru }
	}

	chance = {
		factor = 100

		modifier = {
			factor = 0.1
			NOT = {
				num_of_children = 1
				liege = {
					is_close_relative = ROOT
				}
			}
		}
		modifier = {
			factor = 0.25
			is_female = yes
		}
		modifier = {
			factor = 0
			is_primary_heir = yes
		}
		modifier = {
			factor = 2.0
			liege = {
				dynasty = ROOT
			}
		}
		modifier = {
			factor = 2.0
			liege = {
				is_close_relative = ROOT
			}
		}
		modifier = {
			factor = 5.0
			trait = decadent
		}
		modifier = {
			factor = 2.0
			trait = ambitious
		}
		modifier = {
			factor = 2.0
			trait = proud
		}
		modifier = {
			factor = 2.0
			trait = greedy
		}
		modifier = {
			factor = 0.5
			trait = content
		}
		modifier = {
			factor = 0.5
			trait = humble
		}
		modifier = {
			factor = 0.5
			trait = charitable
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		OR = {
			has_character_modifier = estates_1
			has_character_modifier = estates_2
			has_character_modifier = estates_3
			has_character_modifier = estates_4
			has_character_modifier = estates_5
		}
	}
	abort = {
		OR = {
			has_character_flag = flag_denied_estates
			prisoner = yes
			trait = incapable
			trait = eunuch
			has_minor_title = title_guru
			trait = monk
			trait = nun
			is_ruler = yes
			spouse = { is_ruler = yes }
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		prestige = 50
		liege = {
			reverse_opinion = {
				modifier = opinion_estates_obj
				who = ROOT
				years = 10
			}
		}
		set_character_flag = obj_gain_estates
	}
}

obj_gain_estates_2 = {
	type = character
	
	potential = {
		is_ruler = no
		has_character_modifier = estates_1
		NOT = { trait = monk }
		NOT = { trait = nun }
		NOT = { trait = incapable }
		NOT = { trait = eunuch }
		liege = { is_nomadic = no }
		liege = { is_tribal = no }
	}

	allow = {
		prisoner = no
		is_adult = yes
		OR = {
			is_female = no
			liege = {
				OR = {
					has_law = true_cognatic_succession
					has_law = enatic_cognatic_succession
					has_law = enatic_succession
				}
			}
			liege = {
				is_close_relative = ROOT
				has_law = cognatic_succession
			}
		}
		NOT = { spouse = { is_ruler = yes } }
		NOT = { has_minor_title = title_guru }
	}

	chance = {
		factor = 50

		modifier = {
			has_character_flag = obj_gain_estates
			factor = 0.5
		}
		modifier = {
			factor = 0
			is_primary_heir = yes
		}
		modifier = {
			factor = 5.0
			trait = decadent
		}
		modifier = {
			factor = 2.0
			trait = ambitious
		}
		modifier = {
			factor = 2.0
			trait = proud
		}
		modifier = {
			factor = 2.0
			trait = greedy
		}
		modifier = {
			factor = 0.5
			trait = content
		}
		modifier = {
			factor = 0.5
			trait = humble
		}
		modifier = {
			factor = 0.5
			trait = charitable
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		OR = {
			has_character_modifier = estates_2
			has_character_modifier = estates_3
			has_character_modifier = estates_4
			has_character_modifier = estates_5
		}
	}
	abort = {
		OR = {
			prisoner = yes
			trait = incapable
			trait = eunuch
			has_minor_title = title_guru
			trait = monk
			trait = nun
			is_ruler = yes
			spouse = { is_ruler = yes }
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		prestige = 50
		liege = {
			reverse_opinion = {
				modifier = opinion_estates_obj
				who = ROOT
				years = 10
			}
		}
		set_character_flag = obj_gain_estates
	}
}

obj_gain_estates_3 = {
	type = character
	
	potential = {
		is_ruler = no
		NOT = { trait = monk }
		NOT = { trait = nun }
		NOT = { trait = incapable }
		NOT = { trait = eunuch }
		has_character_modifier = estates_2
		liege = { is_nomadic = no }
		liege = { is_tribal = no }
	}

	allow = {
		prisoner = no
		is_adult = yes
		OR = {
			is_female = no
			liege = {
				OR = {
					has_law = true_cognatic_succession
					has_law = enatic_cognatic_succession
					has_law = enatic_succession
				}
			}
			liege = {
				is_close_relative = ROOT
				has_law = cognatic_succession
			}
		}
		NOT = { spouse = { is_ruler = yes } }
		NOT = { has_minor_title = title_guru }
	}

	chance = {
		factor = 50

		modifier = {
			has_character_flag = obj_gain_estates
			factor = 0.5
		}
		modifier = {
			factor = 0
			is_primary_heir = yes
		}
		modifier = {
			factor = 5.0
			trait = decadent
		}
		modifier = {
			factor = 2.0
			trait = ambitious
		}
		modifier = {
			factor = 2.0
			trait = proud
		}
		modifier = {
			factor = 2.0
			trait = greedy
		}
		modifier = {
			factor = 0.5
			trait = content
		}
		modifier = {
			factor = 0.5
			trait = humble
		}
		modifier = {
			factor = 0.5
			trait = charitable
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		OR = {
			has_character_modifier = estates_3
			has_character_modifier = estates_4
			has_character_modifier = estates_5
		}
	}
	abort = {
		OR = {
			prisoner = yes
			trait = incapable
			trait = eunuch
			has_minor_title = title_guru
			trait = monk
			trait = nun
			is_ruler = yes
			spouse = { is_ruler = yes }
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		prestige = 50
		liege = {
			reverse_opinion = {
				modifier = opinion_estates_obj
				who = ROOT
				years = 10
			}
		}
		set_character_flag = obj_gain_estates
	}
}

obj_gain_estates_4 = {
	type = character
	
	potential = {
		is_ruler = no
		NOT = { trait = monk }
		NOT = { trait = nun }
		NOT = { trait = incapable }
		NOT = { trait = eunuch }
		has_character_modifier = estates_3
		liege = { is_nomadic = no }
		liege = { is_tribal = no }
	}

	allow = {
		prisoner = no
		is_adult = yes
		OR = {
			is_female = no
			liege = {
				OR = {
					has_law = true_cognatic_succession
					has_law = enatic_cognatic_succession
					has_law = enatic_succession
				}
			}
			liege = {
				is_close_relative = ROOT
				has_law = cognatic_succession
			}
		}
		NOT = { spouse = { is_ruler = yes } }
		NOT = { has_minor_title = title_guru }
	}

	chance = {
		factor = 50

		modifier = {
			has_character_flag = obj_gain_estates
			factor = 0.5
		}
		modifier = {
			factor = 0
			is_primary_heir = yes
		}
		modifier = {
			factor = 5.0
			trait = decadent
		}
		modifier = {
			factor = 2.0
			trait = ambitious
		}
		modifier = {
			factor = 2.0
			trait = proud
		}
		modifier = {
			factor = 2.0
			trait = greedy
		}
		modifier = {
			factor = 0.5
			trait = content
		}
		modifier = {
			factor = 0.5
			trait = humble
		}
		modifier = {
			factor = 0.5
			trait = charitable
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		OR = {
			has_character_modifier = estates_4
			has_character_modifier = estates_5
		}
	}
	abort = {
		OR = {
			prisoner = yes
			trait = incapable
			trait = eunuch
			has_minor_title = title_guru
			trait = monk
			trait = nun
			is_ruler = yes
			spouse = { is_ruler = yes }
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		prestige = 50
		liege = {
			reverse_opinion = {
				modifier = opinion_estates_obj
				who = ROOT
				years = 10
			}
		}
		set_character_flag = obj_gain_estates
	}
}

obj_gain_estates_5 = {
	type = character
	
	potential = {
		is_ruler = no
		NOT = { trait = monk }
		NOT = { trait = nun }
		NOT = { trait = incapable }
		NOT = { trait = eunuch }
		has_character_modifier = estates_4
		liege = { is_nomadic = no }
		liege = { is_tribal = no }
	}

	allow = {
		prisoner = no
		is_adult = yes
		OR = {
			is_female = no
			liege = {
				OR = {
					has_law = true_cognatic_succession
					has_law = enatic_cognatic_succession
					has_law = enatic_succession
				}
			}
			liege = {
				is_close_relative = ROOT
				has_law = cognatic_succession
			}
		}
		NOT = { has_minor_title = title_guru }
	}

	chance = {
		factor = 50

		modifier = {
			has_character_flag = obj_gain_estates
			factor = 0.5
		}
		modifier = {
			factor = 0
			is_primary_heir = yes
		}
		modifier = {
			factor = 5.0
			trait = decadent
		}
		modifier = {
			factor = 2.0
			trait = ambitious
		}
		modifier = {
			factor = 2.0
			trait = proud
		}
		modifier = {
			factor = 2.0
			trait = greedy
		}
		modifier = {
			factor = 0.5
			trait = content
		}
		modifier = {
			factor = 0.5
			trait = humble
		}
		modifier = {
			factor = 0.5
			trait = charitable
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		has_character_modifier = estates_5
	}
	abort = {
		OR = {
			prisoner = yes
			trait = incapable
			trait = eunuch
			has_minor_title = title_guru
			trait = monk
			trait = nun
			is_ruler = yes
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		prestige = 50
		liege = {
			reverse_opinion = {
				modifier = opinion_estates_obj
				who = ROOT
				years = 10
			}
		}
		set_character_flag = obj_gain_estates
	}
}

obj_befriend_liege = {
	type = character
	
	potential = {
		ai = no
		independent = no
		liege = {
			NOR = {
				is_married = ROOT
				is_lover = ROOT
				is_friend = ROOT
				is_rival = ROOT
				war_with = ROOT
			}
		}
	}

	allow = {
		is_adult = yes
		NOT = { trait = incapable }
		liege = {
			same_sex = ROOT
			is_adult = yes
			opinion = { who = ROOT value = -25 }
			NOR = {
				trait = incapable
				num_of_friends = 3
				opinion = { who = ROOT value = 75 }	
			}
		}
	}

	chance = {
		factor = 0
	}

	success = {
		liege = {
			opinion = {
				who = ROOT
				value = 75
			}
		}
	}
	abort = {
		OR = {
			trait = incapable
			independent = yes
			liege = { war_with = ROOT }
			liege = { is_friend = ROOT }
			liege = { is_rival = ROOT }
			liege = { trait = incapable }
			liege = {
				num_of_friends = 2
				NOT = { is_friend = ROOT }
			}
			NOT = {
				liege = {
					opinion = {
						who = ROOT
						value = -50
					}
				}
			}
			NOT = {
				liege = {
					reverse_opinion = {
						who = ROOT
						value = -50
					}
				}
			}
		}
	}
	abort_effect = {
	}
	effect = {
		liege = {
			add_friend = ROOT
		}
		if = {
			limit = {
				NOT = { has_character_flag = obj_befriend_liege }
			}
			prestige = 100
		}
		if = {
			limit = {
				has_character_flag = obj_befriend_liege
			}
			prestige = 25
		}
		set_character_flag = obj_befriend_liege
	}
}

obj_befriend_top_liege = {
	type = character
	
	potential = {
		ai = no
		independent = no
		top_liege = {
			NOR = {
				is_liege_of = ROOT
				is_married = ROOT
				is_lover = ROOT
				is_friend = ROOT
				is_rival = ROOT
				war_with = ROOT
			}
		}
	}

	allow = {
		is_adult = yes
		NOT = { trait = incapable }
		top_liege = {
			same_sex = ROOT
			is_adult = yes
			opinion = { who = ROOT value = -25 }
			NOR = {
				trait = incapable
				num_of_friends = 3
				opinion = { who = ROOT value = 75 }	
			}
		}
	}

	chance = {
		factor = 0
	}

	success = {
		top_liege = {
			opinion = {
				who = ROOT
				value = 75
			}
		}
	}
	abort = {
		OR = {
			trait = incapable
			independent = yes
			top_liege = { war_with = ROOT }
			top_liege = { is_friend = ROOT }
			NOT = {
				top_liege = {
					opinion = {
						who = ROOT
						value = -50
					}
				}
			}
			NOT = {
				top_liege = {
					reverse_opinion = {
						who = ROOT
						value = -50
					}
				}
			}
		}
	}
	abort_effect = {
	}
	effect = {
		top_liege = {
			add_friend = ROOT
		}
		if = {
			limit = {
				NOT = { has_character_flag = obj_befriend_liege }
			}
			prestige = 100
		}
		if = {
			limit = {
				has_character_flag = obj_befriend_liege
			}
			prestige = 25
		}
		set_character_flag = obj_befriend_liege
	}
}

obj_befriend_relhead = {
	type = character
	
	potential = {
		ai = no
		religion_head = {
			is_alive = yes
			NOR = {
				is_vassal_or_below = ROOT
				is_married = ROOT
				is_lover = ROOT
				is_friend = ROOT
				is_rival = ROOT
				war_with = ROOT
			}
		}
	}

	allow = {
		is_adult = yes
		NOT = { trait = incapable }
		religion_head = {
			same_sex = ROOT
			is_adult = yes
			opinion = { who = ROOT value = -25 }
			NOR = {
				trait = incapable
				num_of_friends = 3
				opinion = { who = ROOT value = 75 }	
			}
		}
	}
	chance = {
		factor = 0
	}

	success = {
		religion_head = {
			opinion = {
				who = ROOT
				value = 75
			}
		}
	}
	abort = {
		OR = {
			trait = incapable
			NOT = { religion_head = { is_alive = yes } }
			religion_head = { war_with = ROOT }
			religion_head = { is_friend = ROOT }
			religion_head = {
				is_liege_of = ROOT
			}
			NOT = {
				religion_head = {
					opinion = {
						who = ROOT
						value = -50
					}
				}
			}
			NOT = {
				religion_head = {
					reverse_opinion = {
						who = ROOT
						value = -50
					}
				}
			}
		}
	}
	abort_effect = {
	}
	effect = {
		if = {
			limit = { any_vassal = { leads_faction = faction_tradition } }
			custom_tooltip = { text = TRADITIONFACTIONMOODPLUS }
			hidden_tooltip = {
				random_vassal = { limit = { leads_faction = faction_tradition } set_variable = { which = "faction_mood_increase" value = 2 } }
				character_event = { id = PlusFaction.200 days = 1 } #recalculate faction moods
			}
		}
		religion_head = {
			add_friend = ROOT
		}
		if = {
			limit = {
				NOT = { has_character_flag = obj_befriend_relhead }
			}
			piety = 100
		}
		if = {
			limit = {
				has_character_flag = obj_befriend_relhead
			}
			piety = 25
		}
		set_character_flag = obj_befriend_relhead
	}
}

obj_make_a_friend = {
	type = character
	
	potential = {
		NOT = { has_character_flag = friend_ambition }
		NOT = { num_of_friends = 1 }
	}

	allow = {
		prisoner = no
		is_adult = yes
		diplomacy = 8
		NOR = { 
			age = 70
			trait = incapable
			trait = shy
		}
	}

	chance = {
		factor = 10

		modifier = {
			factor = 2.0
			trait = gregarious
		}

		modifier = {
			factor = 2.0
			trait = kind
		}

		modifier = {
			factor = 1.5
			trait = just
		}

		modifier = {
			factor = 0.1
			is_married = no
		}

		modifier = {
			factor = 0.75
			trait = envious
		}

		modifier = {
			factor = 0.5
			trait = cruel
		}

		modifier = {
			factor = 0.5
			trait = ambitious
		}

		modifier = {
			factor = 0.5
			trait = deceitful
		}

		modifier = {
			factor = 0.75
			age = 50
		}

		modifier = {
			factor = 0.75
			age = 55
		}

		modifier = {
			factor = 0.5
			age = 60
		}

		modifier = {
			factor = 0.5
			is_female = yes
		}

		modifier = {
			factor = 0.5
			is_ruler = no
		}

	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		num_of_friends = 1
	}

	abort = {
		OR = {
			trait = incapable
			trait = shy
			age = 70
			NOT = { diplomacy = 8 }
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}

	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}

	effect = {
		hidden_tooltip = {
			change_variable = { which = "lifestyle_diplomacy" value = 1 }
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		change_diplomacy = 1
		set_character_flag = friend_ambition
	}
}

obj_get_nick = {
	type = character
	
	potential = {
		is_ruler = yes
		has_nickname = no
	}

	allow = {
		prisoner = no
		is_adult = yes
		NOT = { trait = incapable }
		NOT = { trait = humble }
		prestige = 500
	}
	chance = {
		factor = 25

		modifier = {
			factor = 2.0
			prestige = 1000
		}

		modifier = {
			factor = 2.0
			prestige = 2000
		}

	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		has_nickname = yes
	}
	abort = {
		OR = {
			trait = humble
			trait = incapable
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}

	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}

	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		change_diplomacy = 1
		prestige = 100
	}
}

obj_change_nick = {
	type = character
	
	potential = {
		ai = no
		is_ruler = yes
		has_nickname = yes
		NOT = { has_character_flag = gave_up_change_nick }
	}

	allow = {
		prisoner = no
		is_adult = yes
		NOT = { trait = incapable }
		NOT = { trait = humble }
		prestige = 500
	}
	creation_effect = {
		prestige = -200
	}
	chance = {
		factor = 0
	}
	success = {
		NOT = { has_nickname = yes }
	}
	abort = {
		OR = {
			prisoner = yes
			trait = incapable
			trait = humble
			is_ruler = no
			has_character_flag = gave_up_change_nick
		}
	}
	abort_effect = {
	}
	effect = {
	}
}

obj_spouse_councillor = {
	type = character
	
	potential = {
		is_female = yes
		is_married = yes
		independent = no
		spouse = {
			independent = no
			is_councillor = no
		}
	}

	allow = {
		prisoner = no
		NOT = { trait = incapable }
		spouse = {
			prisoner = no
			is_female = no
			NOT = { trait = incapable }
			NOT = { is_liege_of = ROOT }
			OR = {
				martial = 8
				diplomacy = 8
				stewardship = 8
				intrigue = 8
				learning = 8
			}
		}
	}
	chance = {
		factor = 25

		modifier = {
			factor = 2.0
			trait = ambitious
		}

		modifier = {
			factor = 1.5
			trait = envious
		}

		modifier = {
			factor = 0.5
			trait = content
		}

		modifier = {
			factor = 1.25
			spouse = {
				OR = {
				trait = intricate_webweaver
				trait = charismatic_negotiator
				trait = fortune_builder
				trait = skilled_tactician
				trait = scholarly_theologian
				}
			}
		}

		modifier = {
			factor = 0.01
			spouse = {
				is_dumb_trigger = yes
			}
		}

	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		spouse = {
			is_councillor = yes
		}
	}

	abort = {
		OR = {
			prisoner = yes
			is_married = no
			independent = yes
			trait = incapable
			spouse = {
				OR = {
					prisoner = yes
					independent = yes
					trait = incapable
					liege = { character = ROOT }
				}
			}
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}

	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}

	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		prestige = 20
	}
}

obj_known_for_virtue = {
	type = character
	
	potential = {
		is_ruler = yes
		NOT = { religion_group = indian_group }
		NOT = { has_character_flag = obj_become_paragon_of_virtue }
		NOT = { has_character_flag = known_for_virtue }
	}

	allow = {
		is_adult = yes
		piety = 0
		NOT = { piety = 500 }
		NOT = { trait = cruel }
		NOT = { trait = impaler }
		NOT = { trait = incapable }
		NOT = { trait = decadent }
	}
	chance = {
		factor = 50

		modifier = {
			factor = 1.25
			trait = patient
		}
		modifier = {
			factor = 0.01
			NOT = { tier = king }
			NOT = { tier = emperor }
		}
		modifier = {
			factor = 0
			NOT = { piety = 100 }
		}
		modifier = {
			factor = 10.0
			OR = {
				trait = detached_priest
				trait = martial_cleric
				trait = scholarly_theologian
				trait = mastermind_theologian
			}
		}
		modifier = {
			factor = 10.0
			trait = zealous
		}
		modifier = {
			factor = 0.01
			trait = cynical
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		piety = 500
	}
	abort = {
		OR = {
			is_ruler = no
			NOT = { piety = 0 }
			trait = cruel
			trait = impaler
			trait = incapable
			trait = decadent
			religion_group = indian_group
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		change_learning = 1
		piety = 50
		set_character_flag = known_for_virtue
	}
}

obj_lower_decadence50 = {
	type = character
	
	potential = {
		is_adult = yes
		is_ruler = yes
		uses_decadence = yes
	}
	allow = {
		NOT = {decadence = 55}
		decadence = 50
		NOT = { trait = incapable }
		NOT = {has_character_modifier = lower_decadence_obj_timer}
	}
	chance = {
		factor = 100

		modifier = {
			factor = 1.25
			trait = diligent
		}
		modifier = {
			factor = 1.25
			trait = naive_appeaser
		}
		modifier = {
			factor = 1.5
			trait = ambitious
		}
		modifier = {
			factor = 0.01
			trait = content
		}
		modifier = {
			factor = 0.01
			trait = slothful
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		NOT = {decadence = 40}
	}
	abort = {
		OR = {
			trait = incapable
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
		clr_character_flag = berber_life
		clr_character_flag = bandit_camp
		clr_character_flag = dromedary_hunt
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		prestige = 100
		hidden_tooltip = {
			add_character_modifier = {
				name = lower_decadence_obj_timer
				duration = 1825 #5 years
			}
		}
		clr_character_flag = lower_decadence_success
		clr_character_flag = berber_life
		clr_character_flag = bandit_camp
		clr_character_flag = dromedary_hunt
	}
}

obj_lower_decadence55 = {
	type = character

	potential = {
		is_adult = yes
		is_ruler = yes
		uses_decadence = yes
	}
	allow = {
		NOT = {decadence = 60}
		decadence = 55
		NOT = { trait = incapable }
		NOT = {has_character_modifier = lower_decadence_obj_timer}
	}
	chance = {
		factor = 100

		modifier = {
			factor = 1.25
			trait = diligent
		}
		modifier = {
			factor = 1.25
			trait = naive_appeaser
		}
		modifier = {
			factor = 1.5
			trait = ambitious
		}
		modifier = {
			factor = 0.01
			trait = content
		}
		modifier = {
			factor = 0.01
			trait = slothful
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		NOT = {decadence = 45}
	}
	abort = {
		OR = {
			trait = incapable
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
		clr_character_flag = berber_life
		clr_character_flag = bandit_camp
		clr_character_flag = dromedary_hunt
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		prestige = 100
		hidden_tooltip = {
			add_character_modifier = {
				name = lower_decadence_obj_timer
				duration = 1825 #5 years
			}
		}
		clr_character_flag = lower_decadence_success
		clr_character_flag = berber_life
		clr_character_flag = bandit_camp
		clr_character_flag = dromedary_hunt
	}
}

obj_lower_decadence65 = {
	type = character

	potential = {
		is_adult = yes
		is_ruler = yes
		uses_decadence = yes
	}
	allow = {
		NOT = {decadence = 70}
		decadence = 65
		NOT = { trait = incapable }
		NOT = {has_character_modifier = lower_decadence_obj_timer}
	}
	chance = {
		factor = 100

		modifier = {
			factor = 1.25
			trait = diligent
		}
		modifier = {
			factor = 1.25
			trait = naive_appeaser
		}
		modifier = {
			factor = 1.5
			trait = ambitious
		}
		modifier = {
			factor = 0.01
			trait = content
		}
		modifier = {
			factor = 0.01
			trait = slothful
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		NOT = {decadence = 55}
	}
	abort = {
		OR = {
			trait = incapable
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
		clr_character_flag = berber_life
		clr_character_flag = bandit_camp
		clr_character_flag = dromedary_hunt
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		prestige = 100
		hidden_tooltip = {
			add_character_modifier = {
				name = lower_decadence_obj_timer
				duration = 1825 #5 years
			}
		}
		clr_character_flag = lower_decadence_success
		clr_character_flag = berber_life
		clr_character_flag = bandit_camp
		clr_character_flag = dromedary_hunt
	}
}

obj_lower_decadence70 = {
	type = character

	potential = {
		is_adult = yes
		is_ruler = yes
		uses_decadence = yes
	}
	allow = {
		NOT = {decadence = 75}
		decadence = 70
		NOT = { trait = incapable }
		NOT = {has_character_modifier = lower_decadence_obj_timer}
	}
	chance = {
		factor = 100

		modifier = {
			factor = 1.25
			trait = diligent
		}
		modifier = {
			factor = 1.25
			trait = naive_appeaser
		}
		modifier = {
			factor = 1.5
			trait = ambitious
		}
		modifier = {
			factor = 0.01
			trait = content
		}
		modifier = {
			factor = 0.01
			trait = slothful
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		NOT = {decadence = 60}
	}
	abort = {
		OR = {
			trait = incapable
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
		clr_character_flag = berber_life
		clr_character_flag = bandit_camp
		clr_character_flag = dromedary_hunt
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		prestige = 100
		hidden_tooltip = {
			add_character_modifier = {
				name = lower_decadence_obj_timer
				duration = 1825 #5 years
			}
		}
		clr_character_flag = lower_decadence_success
		clr_character_flag = berber_life
		clr_character_flag = bandit_camp
		clr_character_flag = dromedary_hunt
	}
}

obj_lower_decadence75 = {
	type = character

	potential = {
		is_adult = yes
		is_ruler = yes
		uses_decadence = yes
	}
	allow = {
		NOT = {decadence = 80}
		decadence = 75
		NOT = { trait = incapable }
		NOT = {has_character_modifier = lower_decadence_obj_timer}
	}
	chance = {
		factor = 100

		modifier = {
			factor = 1.25
			trait = diligent
		}
		modifier = {
			factor = 1.25
			trait = naive_appeaser
		}
		modifier = {
			factor = 1.5
			trait = ambitious
		}
		modifier = {
			factor = 0.01
			trait = content
		}
		modifier = {
			factor = 0.01
			trait = slothful
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		NOT = {decadence = 65}
	}
	abort = {
		OR = {
			trait = incapable
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
		clr_character_flag = berber_life
		clr_character_flag = bandit_camp
		clr_character_flag = dromedary_hunt
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		prestige = 100
		hidden_tooltip = {
			add_character_modifier = {
				name = lower_decadence_obj_timer
				duration = 1825 #5 years
			}
		}
		clr_character_flag = lower_decadence_success
		clr_character_flag = berber_life
		clr_character_flag = bandit_camp
		clr_character_flag = dromedary_hunt
	}
}

obj_lower_decadence80 = {
	type = character

	potential = {
		is_adult = yes
		is_ruler = yes
		uses_decadence = yes
	}
	allow = {
		decadence = 80
		NOT = { trait = incapable }
		NOT = {has_character_modifier = lower_decadence_obj_timer}
	}
	chance = {
		factor = 100

		modifier = {
			factor = 1.25
			trait = diligent
		}
		modifier = {
			factor = 1.25
			trait = naive_appeaser
		}
		modifier = {
			factor = 1.5
			trait = ambitious
		}
		modifier = {
			factor = 0.01
			trait = content
		}
		modifier = {
			factor = 0.01
			trait = slothful
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		NOT = {decadence = 70}
	}
	abort = {
		OR = {
			trait = incapable
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
		clr_character_flag = berber_life
		clr_character_flag = bandit_camp
		clr_character_flag = dromedary_hunt
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		prestige = 100
		hidden_tooltip = {
			add_character_modifier = {
				name = lower_decadence_obj_timer
				duration = 1825 #5 years
			}
		}
		clr_character_flag = lower_decadence_success
		clr_character_flag = berber_life
		clr_character_flag = bandit_camp
		clr_character_flag = dromedary_hunt
	}
}

obj_reign_20_years = {
	type = character
	
	potential = {
		NOT = { ruled_years = 20 }
		is_ruler = yes
	}

	allow = {
		is_adult = yes
		prisoner = no
		NOT = { trait = incapable }
	}
	chance = {
		factor = 5
		modifier = {
			factor = 0
			NOT = { ruled_years = 5 }
		}
		modifier = {
			factor = 0.5
			independent = no
		}
		modifier = {
			factor = 2.0
			ruled_years = 10
		}
		modifier = {
			factor = 2.0
			ruled_years = 15
		}
		modifier = {
			factor = 5.0
			ruled_years = 18
		}
	}
	success = {
		ruled_years = 20
	}
	abort = {
		OR = {
			trait = incapable
			is_ruler = no
			prisoner = yes
		}
	}
	abort_effect = {
	}
	effect = {
		change_stewardship = 1
		prestige = 50
	}
}

obj_peace_10_year = {
	type = character
	
	creation_effect = {
		add_character_modifier = {
			name = "peace_declared_10_timer"
			duration = 3650
		}
	}
	
	potential = {
		ai = no
		mercenary = no
		is_ruler = yes
		NOT = { has_character_modifier = peace_declared_10_timer }
	}	
	
	allow = {
		is_adult = yes
		prisoner = no
		NOT = { trait = incapable }
		NOT = { trait = ambitious }
		war = no
	}
	chance = {
		factor = 0
	}
	success = {
		NOT = { has_character_modifier = peace_declared_10_timer }
	}
	abort = {
		OR = {
			trait = incapable
			trait = ambitious
			war = yes
			prisoner = yes
		}
	}
	abort_effect = {
		remove_character_modifier = peace_declared_10_timer
	}
	effect = {
		change_stewardship = 1
		piety = 50
		if = {
			limit = {
				infamy = 50
				has_game_rule = {
					name = defensive_pacts
					value = on
				}
			}
			random_list = {
				1 = { change_infamy = { value = -20 localisation = PEACEFULL_RULERSHIP } }
				5 = { change_infamy = { value = -15 localisation = PEACEFULL_RULERSHIP } }
				9 = { change_infamy = { value = -10 localisation = PEACEFULL_RULERSHIP } }
			}
			
		}
		if = {
			limit = {
				infamy = 10
				NOT = { infamy = 50 }
				has_game_rule = {
					name = defensive_pacts
					value = on
				}
			}
			random_list = {
				1 = { change_infamy = { value = -10 localisation = PEACEFULL_RULERSHIP } }
				5 = { change_infamy = { value = -5 localisation = PEACEFULL_RULERSHIP } }
			}
		}
		if = {
			limit = {
				infamy = 2
				NOT = { infamy = 10 }
				has_game_rule = {
					name = defensive_pacts
					value = on
				}
			}
			change_infamy = { value = -2 localisation = PEACEFULL_RULERSHIP }
		}
		if = {
			limit = {
				NOT = { infamy = 2 }
				has_game_rule = {
					name = defensive_pacts
					value = on
				}
			}
			prestige = 250
		}
	}
}

obj_great_council = {
	type = character
	
	potential = {
		independent = yes
		OR = {
			job_chancellor = {
				diplomacy = 20
			}
			job_marshal = {
				martial = 20
			}
			job_treasurer = {
				stewardship = 20
			}
			job_spymaster = {
				intrigue = 20
			}
			job_spiritual = {
				learning = 20
			}
		}
		NOT = { has_character_flag = great_council_formed }
	}

	allow = {
		is_adult = yes
		prisoner = no
		NOT = { trait = incapable }
		NAND = {
			job_chancellor = {
				diplomacy = 20
			}
			job_marshal = {
				martial = 20
			}
			job_treasurer = {
				stewardship = 20
			}
			job_spymaster = {
				intrigue = 20
			}
			job_spiritual = {
				learning = 20
			}
		}
	}
	chance = {
		factor = 1
		modifier = {
			factor = 2.0
			ruled_years = 20
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		job_chancellor = {
			diplomacy = 20
		}
		job_marshal = {
			martial = 20
		}
		job_treasurer = {
			stewardship = 20
		}
		job_spymaster = {
			intrigue = 20
		}
		job_spiritual = {
			learning = 20
		}
	}
	abort = {
		OR = {
			trait = incapable
			independent = no
			is_ruler = no
			prisoner = yes
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		prestige = 200
		hidden_tooltip = {
			set_character_flag = great_council_formed
		}
	}
}

obj_civilize_province = {
	type = character
	
	potential = {
		is_ruler = yes
		any_realm_province = {
			NOR = {
				culture = ROOT
				owner = { culture = PREV }
			}
		}
		NOT = { has_character_flag = civilized_province }
		NOT = { has_law = culture_conversion_0 }
	}
	
	allow = {
		prisoner = no
		is_adult = yes
		NOT = { trait = incapable }
	}
	chance = {
		factor = 5
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		has_character_flag = civilized_province
	}
	abort = {
		OR = {
			AND = {
				NOT = { has_character_flag = civilized_province}
				NOT = {
					any_realm_province = {
						NOR = {
							culture = ROOT
							owner = { culture = PREV }
						}
					}
				}
			}
			trait = incapable
			prisoner = yes
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		if = {
			limit = {
				NOT = { has_character_flag = already_civilized_province}
			}
			change_stewardship = 1
			set_character_flag = already_civilized_province
		}
		prestige = 100
		clr_character_flag = civilized_province
	}
}

obj_be_legitimized = {
	type = character
	
	potential = {
		trait = bastard
		religion_group = christian
		OR = {
			is_ruler = no
			NOR = {
				is_theocracy = yes
				trait = nun
				trait = monk
			}
		}
		NOR = {
			any_liege = { holy_order = yes }
			has_character_flag = refused_legitimacy_attempt
		}
	}

	allow = {
		is_adult = yes
		prisoner = no
		real_father = {
			is_alive = yes
			is_vassal_or_below = ROOT
			NOT = { reverse_has_opinion_modifier = { who = ROOT modifier = denounced_child } }
		}
		NOR = {
			age = 30
			trait = content
			trait = humble
			trait = craven
			is_dumb_trigger = yes
			trait = incapable
		}
	}
	chance = {
		factor = 50
		modifier = {
			factor = 0
			is_female = yes
			is_married = yes
			spouse = { is_ruler = yes }
			NOT = { is_ruler = yes }
		}
		modifier = {
			factor = 0
			is_ruler = yes
			current_heir = {
				is_child_of = ROOT
				dynasty = ROOT
			}
		}
		modifier = {
			factor = 0.1
			is_female = yes
			has_law = agnatic_succession
		}
		modifier = {
			factor = 0.5
			trait = patient
		}
		modifier = {
			factor = 0.5
			trait = trusting
		}
		modifier = {
			factor = 0.5
			trait = shy
		}
		modifier = {
			factor = 0.1
			real_father = {
				NOT = { religion = ROOT }
			}
		}
		modifier = {
			factor = 5
			is_female = no
			real_father = {
				NOT = {
					any_child = {
						NOT = { trait = bastard }
						is_older_than = ROOT
					}
				}
			}
		}
		modifier = {
			factor = 5
			trait = ambitious
		}
		modifier = {
			factor = 1.5
			trait = envious
		}
		modifier = {
			factor = 1.5
			trait = proud
		}
		modifier = {
			factor = 1.5
			trait = brave
		}
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}
	success = {
		NOT = { trait = bastard }
	}
	abort = {
		OR = {
			NOT = {
				real_father = {
					is_alive = yes
					ROOT = { any_liege = { character = PREVPREV } }
					NOT = { reverse_has_opinion_modifier = { who = ROOT modifier = denounced_child } }
				}
			}
			age = 45
			trait = content
			trait = humble
			trait = craven
			trait = incapable
			trait = nun
			trait = monk
			prisoner = yes
			any_liege = { holy_order = yes }
			NOT = { religion_group = christian }
			has_character_flag = refused_legitimacy_attempt
			AND = {
				is_ruler = yes
				capital_holding = { holding_type = temple }
			}
			AND = {
				ai = yes
				is_female = yes
				is_married = yes
				spouse = { is_ruler = yes }
			}
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
		change_intrigue = 1
		prestige = 50
	}
}

obj_druze_esoteric_learning = {
	type = character
	potential = {
		religion = druze
		trait = druze_juhhal
	}
	allow = {
		prisoner = no
		NOT = { trait = incapable }
		NOT = { trait = cynical }
		learning = 8
	}
	creation_effect = {
		if = {
			limit = { ai = yes }
			add_character_modifier = {
				name = "ai_objective_timer"
				duration = 1825
				hidden = yes
			}
		}
	}	
	chance = {
		factor = 5
		modifier = {
			factor = 0
			NOR = {
				trait = detached_priest
				trait = martial_cleric
				trait = scholarly_theologian
				trait = mastermind_theologian
				trait = zealous
			}
		}
		modifier = {
			factor = 0
			NOT = { age = 25 }
		}
		modifier = {
			factor = 0.5
			NOT = { age = 35 }
		}
		modifier = {
			factor = 0.5
			is_female = yes
		}
		modifier = {
			factor = 2
			trait = zealous
		}
		modifier = {
			factor = 0.5
			trait = detached_priest
		}
		modifier = {
			factor = 1.5
			trait = martial_cleric
		}
		modifier = {
			factor = 2.5
			trait = scholarly_theologian
		}
		modifier = {
			factor = 5
			trait = mastermind_theologian
		}
	}
	success = {
		trait = druze_uqqal	
	}
	abort = {
		OR = {
			trait = incapable
			trait = cynical
			prisoner = yes
			NOT = { religion = druze }
			NOT = { learning = 8 }
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		if = {
			limit = { ai = yes }
			remove_character_modifier = ai_objective_timer
		}
	}
	effect = {
		hidden_tooltip = {
			if = {
				limit = { ai = yes }
				remove_character_modifier = ai_objective_timer
			}
		}
        piety = 100
	}
}

obj_become_saint = {
	type = character
	
	potential = {
		is_adult = yes
		prisoner = no
		is_heretic = no
		religion_group = christian
		rightful_religious_head_scope = { is_alive = yes }
		NOR = {
			has_character_flag = failed_become_saint
			trait = paragon
			trait = incapable
			trait = inbred
			trait = imbecile
		}
	}
	
	allow = {
		OR = {
			piety = 100
			AND = {
				piety = 0
				is_theocracy = yes
			}
		}
		OR = {
			NOT = { trait = possessed }
			has_character_modifier = voice_of_jesus
		}
		NOR = {
			trait = cynical
			trait = lunatic
			trait = excommunicated
			trait = bad_priest_christian
		}
	}
	
	chance = {
		factor = 25
		modifier = {
			factor = 0
			NOR = {
				trait = zealous
				trait = humble
				trait = nun
				trait = monk
				trait = desert_father
				trait = desert_mother
				trait = scholarly_theologian
				trait = mastermind_theologian
				is_theocracy = yes
			}
		}
		modifier = {
			factor = 0.1
			OR = {
				trait = proud
				trait = ambitious
				trait = cruel
				trait = content
			}
		}
		modifier = {
			factor = 0.1
			NOT = { trait = humble }
		}
		modifier = {
			factor = 0.5
			trait = greedy
		}
		modifier = {
			factor = 0.5
			trait = gluttonous
		}
		modifier = {
			factor = 0.5
			trait = envious
		}
		modifier = {
			factor = 0.75
			trait = wroth
		}
		modifier = {
			factor = 5
			trait = zealous
		}
		modifier = {
			factor = 2
			OR = {
				trait = nun
				trait = monk
				trait = desert_father
				trait = desert_mother
			}
		}
		modifier = {
			factor = 2
			is_theocracy = yes
		}
		modifier = {
			factor = 2
			rightful_religious_head = ROOT
		}
		modifier = {
			factor = 1.5
			trait = celibate
		}
		modifier = {
			factor = 1.25
			trait = patient
		}
		modifier = {
			factor = 1.25
			trait = chaste
		}
		modifier = {
			factor = 1.25
			trait = charitable
		}
		modifier = {
			factor = 1.25
			trait = temperate
		}
		modifier = {
			factor = 1.25
			trait = diligent
		}
		modifier = {
			factor = 1.25
			trait = kind
		}
	}

	creation_effect = {
		hidden_tooltip = {
			character_event = { id = Plus.2610 }
		}
	}
	success = {
		trait = paragon
	}
	abort = {
		OR = {
			prisoner = yes
			is_heretic = yes
			trait = incapable
			trait = cynical
			trait = lunatic
			trait = excommunicated
			trait = bad_priest_christian
			AND = {
				trait = possessed
				NOT = { has_character_modifier = voice_of_jesus }
			}
			NOT = { religion_group = christian }
			NOT = { rightful_religious_head_scope = { is_alive = yes } }
			has_character_flag = failed_become_saint
			AND = {
				ai = yes
				NOT = { has_character_modifier = ai_objective_timer }
			}
		}
	}
	abort_effect = {
		piety = -100
		hidden_tooltip = {
			set_variable = { which = "theosis_ambition" value = 0 }
			clr_character_flag = sainthood_built_church
			clr_character_flag = sainthood_treat_sick
			clr_character_flag = sainthood_heal_sick
			clr_character_flag = sainthood_visit_ascetic
			clr_character_flag = sainthood_take_vows
			clr_character_flag = sainthood_too_much_wealth
			clr_character_flag = sainthood_stigmata
			clr_character_flag = sainthood_priest_support
			clr_character_flag = sainthood_priest_doubt
			clr_character_flag = sainthood_piety1
			clr_character_flag = sainthood_piety2
			clr_character_flag = sainthood_piety3
			clr_character_flag = sainthood_piety4
			clr_character_flag = sainthood_high_learning
			clr_character_flag = sainthood_high_diplomacy
			clr_character_flag = sainthood_high_martial
			clr_character_flag = sainthood_mystic
			clr_character_flag = sainthood_impaler
			clr_character_flag = sainthood_chaste
			clr_character_flag = sainthood_celibate
			clr_character_flag = sainthood_charitable
			clr_character_flag = sainthood_kind
			clr_character_flag = sainthood_humble
			clr_character_flag = sainthood_honest
			clr_character_flag = sainthood_just
			clr_character_flag = sainthood_theologian
			clr_character_flag = sainthood_voice_of_jesus
		}
	}
	effect = {
		piety = 1000
		hidden_tooltip = {
			set_variable = { which = "theosis_ambition" value = 0 }
			clr_character_flag = sainthood_built_church
			clr_character_flag = sainthood_treat_sick
			clr_character_flag = sainthood_heal_sick
			clr_character_flag = sainthood_visit_ascetic
			clr_character_flag = sainthood_take_vows
			clr_character_flag = sainthood_too_much_wealth
			clr_character_flag = sainthood_stigmata
			clr_character_flag = sainthood_priest_support
			clr_character_flag = sainthood_priest_doubt
			clr_character_flag = sainthood_piety1
			clr_character_flag = sainthood_piety2
			clr_character_flag = sainthood_piety3
			clr_character_flag = sainthood_piety4
			clr_character_flag = sainthood_high_learning
			clr_character_flag = sainthood_high_diplomacy
			clr_character_flag = sainthood_high_martial
			clr_character_flag = sainthood_mystic
			clr_character_flag = sainthood_impaler
			clr_character_flag = sainthood_chaste
			clr_character_flag = sainthood_celibate
			clr_character_flag = sainthood_charitable
			clr_character_flag = sainthood_kind
			clr_character_flag = sainthood_humble
			clr_character_flag = sainthood_honest
			clr_character_flag = sainthood_just
			clr_character_flag = sainthood_theologian
			clr_character_flag = sainthood_voice_of_jesus
		}
	}
}

