########################################################
# MINOR TITLES
# Characters can have any number of these
########################################################
#	grant_limit: Max number of holders.
#	realm_in_name: Append the name of the country after the title (Queen [of Sweden])
#	allowed_to_hold: conditions for the character to hold the title
#	allowed_to_grant: conditions for a ruler to grant the title
#	regent: This is the title for regents (not really "minor")
#	gain_effect: fires when the title is granted
#	lose_effect: fires when a title is lost through most causes
#	retire_effect: fires when a title is lost due to the character stepping down
#	death_effect: fires when a title is lost due to the character dying
#	message: should fire a message to the its owner when set
#	The other fields are all character modifiers.

#######################################
# HARD: AUTO-GRANTED - DO NOT REMOVE!
#######################################
title_regent = {
	realm_in_name = yes
	dignity = 0.9
	revoke_allowed = no
	is_voter = yes
	
	monthly_salary = 0.1
	monthly_prestige = 1.50
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}

title_appointed_regent = {
	is_high_prio = yes
	realm_in_name = yes
	dignity = 0.9
	grant_limit = 1
	opinion_effect = 10
	revoke_allowed = yes

	monthly_salary = 0.05
	monthly_prestige = 0.75

	allowed_to_hold = {
		is_adult = yes
		prisoner = no
		NOT = { trait = incapable }
		has_regent = no
	}
	
	allowed_to_grant = {
		has_regent = no
		NOT = {
			has_game_rule = {
				name = regencies
				value = off
			}
		}
	}
	revoke_trigger = {
		FROM = { has_regent = no }
	}

	gain_effect = {
	}

	lose_effect = {
	}
	message = yes
}

title_ruler_consort = {
	dignity = 0.88
	show_as_title = yes
	realm_in_name = yes
	spouse_context = yes # Title name as if the other gender version of the spouse's ruler title
	revoke_allowed = no
	
	monthly_salary = 0.1
	monthly_prestige = 0.5
	
	gain_effect = {
	}
	
	lose_effect = {
	}

	message = no
}

title_tanist = {
	dignity = 0.86
	show_as_title = yes
	realm_in_name = yes
	revoke_allowed = no
	
	monthly_salary = 0.07
	monthly_prestige = 0.75
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = no
}

title_queen_mother = {
	dignity = 0.85
	show_as_title = yes
	realm_in_name = yes
	revoke_allowed = no
	
	monthly_salary = 0.05
	monthly_prestige = 1.00
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = no
}

title_prince = {
	dignity = 0.8
	show_as_title = yes
	realm_in_name = yes
	revoke_allowed = no
	
	monthly_salary = 0.05
	monthly_prestige = 0.25
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = no
}

# Pagan consort
title_courtesan = {
	dignity = 0.05
	#realm_in_name = yes
	revoke_allowed = no
	
	monthly_salary = 0.02
	monthly_prestige = 0.10
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = no
}

title_male_consort = {
	dignity = 0.05
	#realm_in_name = yes
	revoke_allowed = no
	
	monthly_salary = 0.02
	monthly_prestige = 0.10
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = no
}

# Commander, granted via its own interaction, so very special
title_commander = {
	is_high_prio = yes
	
	attribute = martial
	dignity = 0.05
	opinion_effect = 5
	realm_in_name = yes
	
	monthly_salary = 0.05
	monthly_prestige = 0.50
	#combat_rating = 10 # Reactivate if we get this working
	
	revoke_allowed = no # Handled by diplomatic interaction
	
	allowed_to_grant = {
		NOT = { culture = wilderness }
	}
	
	allowed_to_hold = {
		NOT = { culture = wilderness }
		NOT = { 
			primary_title = { temporary = yes } 
		}
		liege = { character = FROM }
		OR = {
			AND = {
				OR = {
					male_can_hold_minor_title_trigger = yes
					female_can_hold_minor_commander_title_trigger = yes
					trait = dryad_race
					trait = sorcerer
				}
				is_adult = yes
			}
			has_character_flag = special_marshal
		}

		prisoner = no
		NOT = { trait = incapable }
		NOT = { is_inaccessible_trigger = yes }
		NOT = { trait = witcher }
		NOT = { has_character_modifier = refusing_to_lead }
		OR = { 
			NOT = { liege = { has_law = succ_byzantine_elective } }  #Either not Imperial...
			higher_real_tier_than = BARON #...Or potential commander is vassal...
			NOT = { #...Or there are no valid vassal candidates that can be commanders.
				custom_tooltip = { 
					text = tooltip_byzantine_empire_can_appoint_commanders
					liege = { 
						any_vassal = { 
							higher_real_tier_than = BARON
							NOT = { 
								primary_title = { temporary = yes } 
							}
							OR = {
								AND = {
									OR = {
										male_can_hold_minor_title_trigger = yes
										female_can_hold_minor_commander_title_trigger = yes
									}

									is_adult = yes
								}
								has_character_flag = special_marshal
							}
							
							prisoner = no
							NOT = { trait = incapable }
							NOT = { is_inaccessible_trigger = yes }
							NOT = { trait = witcher }
							NOT = { has_character_modifier = refusing_to_lead }
							NOR = {
								has_job_title = job_chancellor
								has_job_title = job_marshal
								has_job_title = job_treasurer
								has_job_title = job_spymaster
								has_job_title = job_spiritual
								has_minor_title = title_commander
							}
						} 
					} 
				} 
			}
		}
	}
	
	gain_effect = {
		if = {
			limit = {
				liege = { 
					has_law = succ_byzantine_elective 
				}
			}
			character_event = { id = HFP.20805 days = 1 } 
		}
		hidden_effect = { # Because this cannot be added in the passive effects, for some code reason
			add_character_modifier = {
	        	name = hidden_commander_bonus
	        	duration = -1
	        	hidden = yes
	        }
		}
	}
	lose_effect = {
		if = {
			limit = {
				liege = { has_law = succ_byzantine_elective }
			}
			character_event = { id = HFP.20803 days = 1 } #Make sure the commander is not being made a sub-vassal.
			
		}
		hidden_effect = {
			remove_character_modifier = hidden_commander_bonus
		}
	}
	
	message = yes
}

#######################################
# SOFT: GRANTABLE - FULLY MODDABLE
#######################################

title_court_eunuch = {
	dignity = 0.01
	realm_in_name = yes
	grant_limit = 1
	opinion_effect = 10
	
	monthly_salary = 0.02
	monthly_prestige = 0.25
	
	allowed_to_hold = {
		NOT = { 
			primary_title = { temporary = yes } 
		}
		is_adult = yes
		trait = eunuch
	}
	
	allowed_to_grant = {			
		OR = {
			is_feudal = yes
			is_tribal = yes
		}
		primary_title = {
			OR = {
				tier = king
				tier = emperor
			}
		}
	}
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}

title_court_dwarf = {
	dignity = 0.01
	realm_in_name = yes
	grant_limit = 1
	opinion_effect = 10
	
	monthly_salary = 0.02
	monthly_prestige = 0.25
	
	allowed_to_hold = {
		NOT = { 
			primary_title = { temporary = yes } 
		}
		is_adult = yes
		trait = dwarf
	}
	
	allowed_to_grant = {
		always = no # Disabled
		OR = {
			is_feudal = yes
			is_tribal = yes
		}
		primary_title = {
			OR = {
				tier = king
				tier = emperor
			}
		}
	}
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}

title_court_jester = {
	dignity = 0.01
	realm_in_name = yes
	grant_limit = 1
	opinion_effect = -5
	
	monthly_salary = 0.02
	monthly_prestige = -0.25
	
	is_unique = yes
	
	allowed_to_hold = {
		NOT = { 
			primary_title = { temporary = yes } 
		}
		is_adult = yes
	}
	
	allowed_to_grant = {
		NOT = { has_landed_title = e_hakland }
		OR = {
			is_feudal = yes
			is_tribal = yes
		}
		primary_title = {
			OR = {
				tier = king
				tier = emperor
			}
		}
	}
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}

# Keeper of the King's Swans
title_keeper_of_swans = {
	dignity = 0.05
	realm_in_name = yes
	grant_limit = 1
	opinion_effect = 5
	
	monthly_salary = 0.01
	monthly_prestige = 0.50
	
	is_unique = yes
	
	allowed_to_hold = {
		NOT = { 
			primary_title = { temporary = yes } 
		}
		is_adult = yes
		NOT = { trait = incapable } 
	}
	allowed_to_grant = {
		NOT = { has_landed_title = e_hakland }
		OR = {
			is_feudal = yes
			is_tribal = yes
		}
		primary_title = {
			OR = {
				tier = king
				tier = emperor
			}
		}
	}
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}

#title_master_of_the_horse = {

#}

title_master_of_the_hunt = {
	dignity = 0.05
	realm_in_name = yes
	grant_limit = 1
	opinion_effect = 5
	
	monthly_salary = 0.02
	monthly_prestige = 0.40
	
	is_unique = yes
	
	allowed_to_hold = {
		NOT = { 
			primary_title = { temporary = yes } 
		}
		is_adult = yes
		OR = { 
			male_can_hold_minor_title_trigger = yes
			female_can_hold_minor_title_trigger = yes
		}
		NOT = { trait = incapable } 
	}
	
	allowed_to_grant = {
		NOT = { has_landed_title = e_hakland }
		
		OR = {
			is_feudal = yes
			is_tribal = yes
		}
	}
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}

title_high_almoner = {
	dignity = 0.03
	realm_in_name = yes
	grant_limit = 1
	opinion_effect = 5
	
	monthly_salary = 0.02
	monthly_prestige = 0.40
	
	is_unique = yes
	
	allowed_to_hold = {
		NOT = { 
			primary_title = { temporary = yes } 
		}
		is_adult = yes
		NOT = { trait = incapable } 
	}
	
	allowed_to_grant = {
		NOT = { has_landed_title = e_hakland }
		OR = {
			is_feudal = yes
			is_tribal = yes
		}
	}
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}

title_cupbearer = {
	dignity = 0.1
	realm_in_name = yes
	grant_limit = 1
	opinion_effect = 5
	
	monthly_salary = 0.05
	monthly_prestige = 0.60
	
	is_unique = yes
	
	allowed_to_hold = {
		NOT = { 
			primary_title = { temporary = yes } 
		}
		is_adult = yes
		OR = {
			male_can_hold_minor_title_trigger = yes
			female_can_hold_minor_title_trigger = yes
		}
		NOT = { trait = incapable } 
	}
	
	allowed_to_grant = {
		NOT = { has_landed_title = e_hakland }
		
		
		OR = {
			is_feudal = yes
			is_tribal = yes
		}
	}
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}

title_seneschal = {
	dignity = 0.15
	realm_in_name = yes
	grant_limit = 1
	opinion_effect = 10
	
	monthly_salary = 0.05
	monthly_prestige = 0.60
	
	is_unique = yes
	
	allowed_to_hold = {
		NOT = { 
			primary_title = { temporary = yes } 
		}
		is_adult = yes
		OR = { 
			male_can_hold_minor_title_trigger = yes
			female_can_hold_minor_title_trigger = yes
		}

		NOT = { trait = incapable } 
	}
	
	allowed_to_grant = {
		OR = {
			is_feudal = yes
			is_tribal = yes
		}
		primary_title = {
			OR = {
				tier = king
				tier = emperor
			}
		}
	}
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}

title_paramount_knight = {
	dignity = 0.8
	grant_limit = 0 
	opinion_effect = 0

	monthly_prestige = 1.50
	
	allowed_to_hold = {
		NOT = { trait = incapable } 
	}

	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}

# MERCHANT REPUBLIC TITLES

# State Inquisitor
title_state_inquisitor = {
	dignity = 0.06
	realm_in_name = yes
	grant_limit = 3
	opinion_effect = 6
	
	monthly_salary = 0.02
	monthly_prestige = 0.40
	
	is_unique = yes
	
	allowed_to_hold = {
		NOT = { 
			primary_title = { temporary = yes } 
		}
		is_adult = yes
		OR = { 
			male_can_hold_minor_title_trigger = yes
			female_can_hold_minor_title_trigger = yes
		}
		NOT = { trait = incapable } 
	}

	allowed_to_grant = {
		is_merchant_republic = yes
	}
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}

title_high_admiral = {
	dignity = 0.1
	realm_in_name = yes
	grant_limit = 1
	opinion_effect = 10
	
	monthly_salary = 0.05
	monthly_prestige = 0.60
	
	is_unique = yes
	
	allowed_to_hold = {
		NOT = { 
			primary_title = { temporary = yes } 
		}
		is_adult = yes
		OR = { 
			male_can_hold_minor_title_trigger = yes
			female_can_hold_minor_commander_title_trigger = yes
		}
		NOT = { trait = incapable } 
	}
	
	allowed_to_grant = {
		is_merchant_republic = yes
	}
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}

title_high_judge = {
	dignity = 0.15
	realm_in_name = yes
	grant_limit = 1
	opinion_effect = 10
	
	monthly_salary = 0.05
	monthly_prestige = 0.60
	
	is_unique = yes
	
	allowed_to_hold = {
		NOT = { 
			primary_title = { temporary = yes } 
		}
		is_adult = yes
		OR = { 
			male_can_hold_minor_title_trigger = yes
			female_can_hold_minor_title_trigger = yes
		}
		NOT = { trait = incapable } 
	}

	allowed_to_grant = {
		is_merchant_republic = yes
	}
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}

# Special - This title determines the heir of a Patrician
title_patrician_heir = {
	is_high_prio = yes
	
	dignity = 0.05
	realm_in_name = yes
	grant_limit = 1
	opinion_effect = 25
	
	patrician_heir = yes
	
	monthly_salary = 0.01
	monthly_prestige = 0.20
	
	allowed_to_hold = {
		OR = { 
			male_can_hold_minor_title_trigger = yes
			female_can_hold_minor_title_trigger = yes
		}
		is_landed = no
		dynasty = FROM
		NOT = { trait = bastard }
		NOT = { trait = monk }
		NOT = { trait = nun }
		NOT = { trait = eunuch }
		is_theocracy = no
	}

	allowed_to_grant = {
		is_patrician = yes
	}
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}

# NORSE PAGAN TITLES

title_volva = {
	dignity = 0.050
	grant_limit = 1
	opinion_effect = 5
	
	monthly_salary = 0.02
	monthly_prestige = 0.25
	
	is_unique = yes
	
	allowed_to_hold = {
		NOT = { 
			primary_title = { temporary = yes } 
		}
		is_adult = yes
		is_female = yes
		trait = mystic
		OR = {
			religion = freya
		}
	}
	
	allowed_to_grant = {	
		religion = freya
	}
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}

title_lawspeaker = {
	dignity = 0.2
	realm_in_name = yes
	grant_limit = 1
	opinion_effect = 10
	
	monthly_salary = 0.1
	monthly_prestige = 0.75
	
	is_unique = yes
	
	allowed_to_hold = {
		NOT = { 
			primary_title = { temporary = yes } 
		}
		is_adult = yes
		religion = freya
		NOT = { trait = incapable } 
	}
	
	allowed_to_grant = {	
		OR = {
			is_feudal = yes
			is_tribal = yes
		}
		religion = freya
	}
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}

title_drottseti = {
	dignity = 0.15
	realm_in_name = yes
	grant_limit = 1
	opinion_effect = 10
	
	monthly_salary = 0.1
	monthly_prestige = 0.5
	
	is_unique = yes
	
	allowed_to_hold = {
		NOT = { 
			primary_title = { temporary = yes } 
		}
		is_adult = yes
		NOT = { trait = incapable } 
	}
	
	allowed_to_grant = {
		OR = {
			is_feudal = yes
			is_tribal = yes
		}
		OR = {
			religion = freya
		}
		higher_tier_than = DUKE
	}
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}

title_court_skald = {
	dignity = 0.15
	realm_in_name = yes
	grant_limit = 1
	opinion_effect = 10
	
	monthly_salary = 0.075
	monthly_prestige = 0.75
	
	is_unique = yes
	
	allowed_to_hold = {
		NOT = { 
			primary_title = { temporary = yes } 
		}
		is_adult = yes
		trait = poet
		NOT = { trait = incapable } 
	}

	allowed_to_grant = {
		OR = {
			is_feudal = yes
			is_tribal = yes
		}
		religion = freya
	}
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}

title_marksman = {
	dignity = 0.1
	realm_in_name = yes
	grant_limit = 1
	opinion_effect = 10
	
	monthly_salary = 0.075
	monthly_prestige = 0.75
	
	is_unique = yes
	
	allowed_to_hold = {
		NOT = { 
			primary_title = { temporary = yes } 
		}
		is_adult = yes
		OR = { 
			male_can_hold_minor_title_trigger = yes
			female_can_hold_minor_commander_title_trigger = yes
		}
		NOT = { trait = incapable } 
	}

	allowed_to_grant = {
		OR = {
			is_feudal = yes
			is_tribal = yes
		}
		religion = freya
	}
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}

title_hirdman = {
	dignity = 0.075
	grant_limit = 4
	opinion_effect = 5
	
	monthly_salary = 0.005
	monthly_prestige = 0.25
	
	is_unique = yes
	
	allowed_to_hold = {
		NOT = { 
			primary_title = { temporary = yes } 
		}
		is_adult = yes
		OR = { 
			male_can_hold_minor_title_trigger = yes
			female_can_hold_minor_title_trigger = yes
		}
		NOT = { trait = incapable } 
	}

	allowed_to_grant = {
		OR = {
			is_feudal = yes
			is_tribal = yes
		}
		religion = freya
	}
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}
title_councilmember_king = {
	is_high_prio = yes
	dignity = 0.050
	grant_limit = 1
	opinion_effect = 10
	monthly_salary = 0.00
	monthly_prestige = 0.75
	is_voter = yes
	allowed_to_grant = {
		higher_tier_than = DUKE
		has_dlc = "Zeus"
		primary_title = { has_law = law_voting_power_1 }
	}
	
	allowed_to_hold = {
		NOT = { 
			primary_title = { temporary = yes } 
		}
		can_be_councilmember_king_trigger = yes
	}
	revoke_trigger = {
		FROM = {
			primary_title = {
				NOT = { 
					AND = {
						has_law = succession_voting_power_1
						ROOT = { is_powerful_vassal = yes }
					}
				}
			}
		}
	}
	gain_effect = {
	}
	lose_effect = {
		if = {
			limit = {
				FROM = {
					NOT = {
						has_character_flag = swapping_councillors
					}
				}
			}
			opinion = { who = FROM modifier = opinion_fired_from_council }
			opinion = { who = FROM modifier = opinion_recently_fired }
		}
	}
	retire_effect = {
	}
	message = yes
}
title_councilmember_emperor = {
	is_high_prio = yes
	dignity = 0.060
	grant_limit = 1
	opinion_effect = 10
	monthly_salary = 0.00
	monthly_prestige = 1.00
	is_voter = yes
	allowed_to_grant = {
		higher_tier_than = KING
		has_dlc = "Zeus"
		primary_title = { has_law = law_voting_power_1 }
	}
	
	allowed_to_hold = {
		NOT = { 
			primary_title = { temporary = yes } 
		}
		can_be_councilmember_emperor_trigger = yes
	}
	revoke_trigger = {
		FROM = {
			primary_title = {
				NOT = { 
					AND = {
						has_law = succession_voting_power_1
						ROOT = { is_powerful_vassal = yes }
					}
				}
			}
		}
	}
	gain_effect = {
	}
	lose_effect = {
		if = {
			limit = {
				FROM = {
					NOT = {
						has_character_flag = swapping_councillors
					}
				}
			}
			opinion = { who = FROM modifier = opinion_fired_from_council }
			opinion = { who = FROM modifier = opinion_recently_fired }
		}
	}
	retire_effect = {
	}

	message = yes
}

#TAOIST TITLES

title_court_architect = {
	dignity = 0.03
	realm_in_name = yes
	grant_limit = 1
	opinion_effect = 5
	
	monthly_salary = 0.02
	monthly_prestige = 0.40
	
	is_unique = yes
	
	allowed_to_hold = {
		NOT = { 
			primary_title = { temporary = yes } 
		}
		is_adult = yes
		OR = { 
			male_can_hold_minor_title_trigger = yes
			female_can_hold_minor_commander_title_trigger = yes
		}
		NOT = { trait = incapable } 
	}

	allowed_to_grant = {
		is_feudal = yes
		primary_title = {
			OR = {
				tier = king
				tier = emperor
			}
		}
		religion = taoist
	}
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}

title_zhangshi = {
	dignity = 0.05
	realm_in_name = yes
	grant_limit = 1
	opinion_effect = 5
	
	monthly_salary = 0.02
	monthly_prestige = 0.40
	
	is_unique = yes
	
	allowed_to_hold = {
		NOT = { 
			primary_title = { temporary = yes } 
		}
		is_adult = yes
		OR = { 
			male_can_hold_minor_title_trigger = yes
			female_can_hold_minor_title_trigger = yes
		}
		NOT = { trait = incapable } 
	}

	allowed_to_grant = {
		OR = {
			is_feudal = yes
			is_tribal = yes
		}
		religion = taoist
	}
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}

title_canjun = {
	dignity = 0.15
	realm_in_name = yes
	grant_limit = 1
	opinion_effect = 10
	
	monthly_salary = 0.075
	monthly_prestige = 0.75
	
	is_unique = yes

	allowed_to_hold = {
		NOT = { 
			primary_title = { temporary = yes } 
		}
		is_adult = yes
		OR = { 
			male_can_hold_minor_title_trigger = yes
			female_can_hold_minor_commander_title_trigger = yes
		}
		NOT = { trait = incapable } 
	}
	
	allowed_to_grant = {
		OR = {
			is_feudal = yes
			is_tribal = yes
		}
		religion = taoist
	}
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}

title_yuhou = {
	dignity = 0.15
	realm_in_name = yes
	grant_limit = 1
	opinion_effect = 10
	
	monthly_salary = 0.075
	monthly_prestige = 0.75
	
	is_unique = yes

	allowed_to_hold = {
		NOT = { 
			primary_title = { temporary = yes } 
		}
		is_adult = yes
		OR = { 
			male_can_hold_minor_title_trigger = yes
			female_can_hold_minor_title_trigger = yes
		}
		NOT = { trait = incapable } 
	}
	
	allowed_to_grant = {
		OR = {
			is_feudal = yes
			is_tribal = yes
		}
		religion = taoist
	}
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}

title_historiographer = {
	dignity = 0.15
	realm_in_name = yes
	grant_limit = 1
	opinion_effect = 10
	
	monthly_salary = 0.075
	monthly_prestige = 0.75

	is_unique = yes
	
	allowed_to_hold = {
		NOT = { 
			primary_title = { temporary = yes } 
		}
		is_adult = yes
		OR = { 
			male_can_hold_minor_title_trigger = yes
			female_can_hold_minor_title_trigger = yes
		}
		NOT = { trait = incapable } 
		learning = 7
	}
	
	allowed_to_grant = {
		OR = {
			is_feudal = yes
			is_tribal = yes
		}
		religion = taoist
	}
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}


## Court Physician
title_court_physician = {
	is_high_prio = yes
	attribute = learning
    dignity = 5
    realm_in_name = yes
	grant_limit = 1
	opinion_effect = 10
	monthly_salary = 0.2
	monthly_prestige = 0.5
	
	allowed_to_grant = {
		OR = {
			higher_tier_than = BARON
			is_patrician = yes
		}
		has_dlc = "Reapers"
	}
	
	allowed_to_hold = {
		custom_tooltip = {
			text = court_physician_tooltip_1
			NOT = {
				primary_title = { temporary = yes } 
			}
		}
		custom_tooltip = {
			text = court_physician_tooltip_2
			OR = {
				religion = druidic
				religion = dryad_religion
				male_can_hold_minor_title_trigger = yes
				female_can_hold_minor_title_trigger = yes
			}
		}
		OR = {
			learning = 15
			AND = {
				learning = 10
				OR = {
					trait = druid
					trait = physician
					trait = scholar
					trait = mystic
				}
			}
			custom_tooltip = { 
				text = educated_court_physician
				hidden_tooltip = {
					has_character_flag = is_court_physician
				}
			}
		}
		
		is_adult = yes

		prisoner = no
		NOT = { trait = in_hiding }
		NOT = { trait = incapable }
	}

	revoke_trigger = {
		custom_tooltip = {
			text = revoke_court_physician_being_treated_tt
			NOT = { FROM = { has_character_flag = being_treated } }
		}
	}
	
	gain_effect = {
	}
	lose_effect = {
	}
	retire_effect = {
	}

	message = yes
}


#MNM hermetics apprentice
title_hermetics_apprentice = {
	is_high_prio = yes
	attribute = learning
    dignity = 1
    realm_in_name = no
	grant_limit = 1
	opinion_effect = 10
	monthly_salary = 0.1
	monthly_prestige = 0.1
	revoke_allowed = no
	
	allowed_to_grant = {
		has_dlc = "Mystics"
		society_member_of = hermetics
		ai = no
	}
	
	allowed_to_hold = {
		custom_tooltip = {
			text = court_physician_tooltip_1
			NOT = {
				primary_title = { temporary = yes } 
			}
		}
		is_adult = yes
		OR = {
			society_member_of = hermetics
			is_in_society = no
		}

		NOT = { trait = in_hiding }
		NOT = { trait = incapable }
		prisoner = no
		
		hidden_trigger = {
			liege = { society_member_of = hermetics }
			ai = yes
			NOT = { has_character_flag = completed_apprenticeship }
			OR = {
				FROM = { ai = no }
				learning = 10
				is_smart_trigger = yes
				trait = gardener
				trait = scholar
				trait = mystic
			}
		}
	}
	
	gain_effect = {
		if = {
			limit = { NOT = { society_member_of = hermetics } }
			join_society = hermetics
		}
		character_event = { id = MNM.1413 days = 4500 random = 1000 }  #Some years later, the apprenticeship ends

		opinion = { 
			modifier = opinion_hermetic_apprentice
			who = FROM
			years = 100
		}
		FROM = {
			if = {
				limit = { has_quest = quest_hermetics_find_apprentice }
				character_event = { id = MNM.1409 }
			}
		}
	}
	lose_effect = {
		remove_opinion = { 
			modifier = opinion_hermetic_apprentice
			who = FROM
		}
	}
	retire_effect = {
	}

	message = yes
}


###JADE DRAGON MINOR TITLES###

title_china_emperor = {			# this title is not granted by a character to another, it is automatically obtained
								# when one character becomes emperor of china. It is used solely to identify them as such
	is_offmap_holder = yes
	offmap_power = offmap_china
	show_as_title = yes
	dignity = 1000 				# this should always be higher than 0, or it won't be applied in all cases
}

title_administrator = {
	is_high_prio = no
    dignity = 0.9
    realm_in_name = no
	grant_limit = 1
	opinion_effect = 10
	monthly_salary = 0.1
	monthly_prestige = 0.1
	
	allowed_to_grant = {
		has_dlc = "Jade Dragon"
		any_courtier = { has_character_modifier = jd_administrator }
	}
	
	allowed_to_hold = {
		custom_tooltip = {
			text = title_administrator_modifier_tt
			has_character_modifier = jd_administrator
		}
		NOT = { trait = in_hiding }
		NOT = { trait = incapable }
		prisoner = no
	}

	revoke_trigger = {
		always = yes
	}
	
	gain_effect = {
		if = {
			limit = {
				has_character_flag = jd_administrator_golden_age #courtier is from golden age
			}
			liege = {
				add_character_modifier = {
					name = employing_jd_administrator_golden_age
					duration = -1
				}
			}
		}
		else = {
			liege = {
				add_character_modifier = {
					name = employing_jd_administrator
					duration = -1
				}
			}
		}
	}
	lose_effect = {
		liege = {
			if = {
				limit = { has_character_modifier = employing_jd_administrator }
				remove_character_modifier = employing_jd_administrator
			}
			if = {
				limit = { has_character_modifier = employing_jd_administrator_golden_age }
				remove_character_modifier = employing_jd_administrator_golden_age
			}
		}
	}
	retire_effect = {
		liege = {
			if = {
				limit = { has_character_modifier = employing_jd_administrator }
				remove_character_modifier = employing_jd_administrator
			}
			if = {
				limit = { has_character_modifier = employing_jd_administrator_golden_age }
				remove_character_modifier = employing_jd_administrator_golden_age
			}
		}
	}
	death_effect = {
		liege = {
			if = {
				limit = { has_character_modifier = employing_jd_administrator }
				remove_character_modifier = employing_jd_administrator
			}
			if = {
				limit = { has_character_modifier = employing_jd_administrator_golden_age }
				remove_character_modifier = employing_jd_administrator_golden_age
			}
		}
	}

	message = yes
}

title_master_engineer = {
	is_high_prio = no
    dignity = 0.9
    realm_in_name = no
	grant_limit = 1
	opinion_effect = 10
	monthly_salary = 0.1
	monthly_prestige = 0.1
	
	allowed_to_grant = {
		has_dlc = "Jade Dragon"
		any_courtier = { has_character_modifier = jd_master_engineer }
	}
	
	allowed_to_hold = {
		custom_tooltip = {
			text = title_master_engineer_modifier_tt
			has_character_modifier = jd_master_engineer
		}
		NOT = { trait = in_hiding }
		NOT = { trait = incapable }
		prisoner = no
	}

	revoke_trigger = {
		always = yes
	}
	
	gain_effect = {
		if = {
			limit = { has_character_flag = master_engineer_just_spawned }
            character_event = { id = JD.20033 days = 10 } 
            clr_character_flag = master_engineer_just_spawned
            break = yes
		}
        if = {
            limit = {
                has_character_flag = china_master_engineer_golden_age
            }
            character_event = { id = JD.20033 days = 1460 random = 542 } 
        }
		else = {
            character_event = { id = JD.20033 days = 2920 random = 1095 } 
        }
	}
	lose_effect = {
		clear_delayed_event = { id = JD.20033 }
	}
	retire_effect = {
		clear_delayed_event = { id = JD.20033 }	
	}
	death_effect = {
		clear_delayed_event = { id = JD.20033 }
	}

	message = yes
}

# Special Title. Do not Delete or alter the name of the tag!
# The Teacher serves as the default Educator for all children at court who are not close relatives of the ruler
title_teacher = {
	dignity = 0.1
	grant_limit = 1
	opinion_effect = 5
	
	monthly_salary = 0.02

	is_unique = yes
	
	allowed_to_grant = {
		has_dlc = "Zeus"
		is_theocracy = no
		OR = {
			is_republic = no
			is_patrician = yes
		}
		is_landed = yes
		is_playable = yes
	}
	
	allowed_to_hold = {
		is_adult = yes
		is_ruler = no
		prisoner = no
		NOR = {
			trait = incapable
			trait = infirm
			trait = imbecile
		} 
		learning = 5
	}
	
	gain_effect = {
	}
	lose_effect = {
	}

	message = yes
}
