﻿###EK NOTE: Removed references to vanilla heritages
###EK NOTE: Removed references to vanilla titles
###EK NOTE: pirates use a renamed tribal court, so they can't access 'normal' ones

###############
# COURT TYPES #
###############
court_diplomatic = {
	default = yes

	background = "gfx/interface/icons/culture_pillars/ethos_courtly.dds"
	
	is_shown = {
		NOR = {
			government_has_flag = government_is_tribal
			government_has_flag = government_is_nomadic
		}
		OR = {
			culture = { has_cultural_pillar = ethos_courtly }
			culture = { has_cultural_pillar = ethos_egalitarian }
			culture = { has_cultural_pillar = ethos_stoic }
		}
		NOT = { government_has_flag = government_is_pirate }#EK EDIT
	}
	
	is_valid = {
		NOR = {
			government_has_flag = government_is_tribal
			government_has_flag = government_is_nomadic
		}
		OR = {
			culture = { has_cultural_pillar = ethos_courtly }
			culture = { has_cultural_pillar = ethos_egalitarian }
			culture = { has_cultural_pillar = ethos_stoic }
		}
		NOT = { government_has_flag = government_is_pirate }#EK EDIT
	}
	
	cost = {
		prestige = {
			add = 500
		}
	}
	
	level_perk = {
		court_grandeur = 1
		owner_modifier = {
		}

		owner_modifier_description = court_diplomatic_acceptance_bonus_desc
	}
	
	level_perk = {
		court_grandeur = 4
		owner_modifier = {
			tyranny_gain_mult = -0.2
		}
	}
	
	level_perk = {
		court_grandeur = 7
		owner_modifier = {
			councillor_opinion = 10
		}
	}
	
	level_perk = {
		court_grandeur = 10
		owner_modifier = {
			max_personal_schemes_add = 1
		}
	}
	
	#time_perk = {
	#	required_months_in_court = 12 
	#	owner_modifier = { monthly_income_mult = -0.05 }
	#	courtier_guest_modifier = { monthly_income_mult = -0.05 }
	#}
	#
	#time_perk = {
	#	required_months_in_court = 24 
	#	courtier_guest_modifier = { monthly_income_mult = -0.06 }
	#}

	ai_will_do = {
		value = 0
		add = {
			if = {
				limit = {
					OR = {
						culture = { has_cultural_pillar = ethos_courtly }
						culture = { has_cultural_pillar = ethos_egalitarian }
						culture = { has_cultural_pillar = ethos_stoic }
					}
				}
				add = diplomacy
				if = {
					limit = {
						has_trait = gregarious
					}
					add = 25
				}
				if = {
					limit = {
						has_education_diplomacy_trigger = yes
					}
					add = 25
				}
				if = {
					limit = {
						has_lifestyle = diplomacy_lifestyle
					}
					add = 50
				}
			}
		}
	}
}

court_warlike = {
	background = "gfx/interface/icons/culture_pillars/ethos_stoic.dds"

	is_shown = {
		NOR = {
			government_has_flag = government_is_tribal
			government_has_flag = government_is_nomadic
		}
		OR = {
			culture = { has_cultural_pillar = ethos_bellicose }
			culture = { has_cultural_pillar = ethos_bureaucratic }
			culture = { has_cultural_pillar = ethos_stoic }
		}
		NOT = { government_has_flag = government_is_pirate }#EK EDIT
	}
	
	is_valid = {
		NOR = {
			government_has_flag = government_is_tribal
			government_has_flag = government_is_nomadic
		}
		OR = {
			culture = { has_cultural_pillar = ethos_bellicose }
			culture = { has_cultural_pillar = ethos_bureaucratic }
			culture = { has_cultural_pillar = ethos_stoic }
		}
		NOT = { government_has_flag = government_is_pirate }#EK EDIT
	}
	
	cost = {
		prestige = {
			add = 500
		}
	}
	
	level_perk = {
		court_grandeur = 1
		owner_modifier = {
			knight_effectiveness_mult = 0.1
		}
	}
	
	level_perk = {
		court_grandeur = 4
		owner_modifier = {
			happy_powerful_vassal_levy_contribution_add = 0.1
		}
	}
	
	level_perk = {
		court_grandeur = 7
		owner_modifier = {
			counter_efficiency = 0.1
		}
	}
	
	level_perk = {
		court_grandeur = 10
		owner_modifier = {
			men_at_arms_limit = 1
		}
	}

	ai_will_do = {
		value = 0
		add = {
			if = {
				limit = {
					OR = {
						culture = { has_cultural_pillar = ethos_bellicose }
						culture = { has_cultural_pillar = ethos_bureaucratic }
						culture = { has_cultural_pillar = ethos_stoic }
					}
				}
				add = martial
				#EK DISABLED
				#if = {
				#	limit = {
				#		OR = {
				#			culture = { has_cultural_pillar = heritage_turkic }
				#			culture = { has_cultural_pillar = heritage_mongolic }
				#		}
				#	}
				#	add = 25
				#}
				if = {
					limit = {
						has_trait = wrathful
					}
					add = 25
				}
				if = {
					limit = {
						faith = { has_doctrine = tenet_warmonger }
					}
					add = 25
				}
				if = {
					limit = {
						has_education_martial_trigger = yes
					}
					add = 25
				}
				if = {
					limit = {
						has_lifestyle = martial_lifestyle
					}
					add = 50
				}
			}
		}
	}
}

court_administrative = {
	background = "gfx/interface/icons/culture_pillars/ethos_bureaucratic.dds"
	
	is_shown = {
		NOR = {
			government_has_flag = government_is_tribal
			government_has_flag = government_is_nomadic
		}
		OR = {
			culture = { has_cultural_pillar = ethos_communal }
			culture = { has_cultural_pillar = ethos_egalitarian }
			culture = { has_cultural_pillar = ethos_spiritual }
			culture = { has_cultural_pillar = ethos_bureaucratic }
		}
		NOT = { government_has_flag = government_is_pirate }#EK EDIT
	}
	
	is_valid = {
		NOR = {
			government_has_flag = government_is_tribal
			government_has_flag = government_is_nomadic
		}
		OR = {
			culture = { has_cultural_pillar = ethos_communal }
			culture = { has_cultural_pillar = ethos_egalitarian }
			culture = { has_cultural_pillar = ethos_spiritual }
			culture = { has_cultural_pillar = ethos_bureaucratic }
		}
		NOT = { government_has_flag = government_is_pirate }#EK EDIT
	}
	
	cost = {
		prestige = {
			add = 500
		}
	}
	
	level_perk = {
		court_grandeur = 1
		owner_modifier = {
			build_gold_cost = -0.05
			build_speed = -0.1
		}
	}
	
	level_perk = {
		court_grandeur = 4
		owner_modifier = {
		}

		owner_modifier_description = accept_culture_task_more_effective_desc
	}
	
	level_perk = {
		court_grandeur = 7
		owner_modifier = {
			character_capital_county_monthly_development_growth_add = 0.2
		}
	}
	
	level_perk = {
		court_grandeur = 10
		owner_modifier = {
			vassal_tax_contribution_mult = 0.1
		}
	}

	ai_will_do = {
		value = 0
		add = {
			if = {
				limit = {
					OR = {
						culture = { has_cultural_pillar = ethos_communal }
						culture = { has_cultural_pillar = ethos_egalitarian }
						culture = { has_cultural_pillar = ethos_spiritual }
						culture = { has_cultural_pillar = ethos_bureaucratic }
					}
				}
				add = stewardship
				if = {
					limit = {
						has_trait = diligent
					}
					add = 25
				}
				if = {
					limit = {
						has_education_stewardship_trigger = yes
					}
					add = 25
				}
				if = {
					limit = {
						has_lifestyle = stewardship_lifestyle
					}
					add = 50
				}
			}
		}
	}
}

court_intrigue = {
	background = "gfx/interface/icons/culture_pillars/ethos_communal.dds"
	
	is_shown = {
		NOR = {
			government_has_flag = government_is_tribal
			government_has_flag = government_is_nomadic
		}
		OR = {
			culture = { has_cultural_pillar = ethos_bellicose }
			culture = { has_cultural_pillar = ethos_communal }
		}
		NOT = { government_has_flag = government_is_pirate }#EK EDIT
	}
	
	is_valid = {
		NOR = {
			government_has_flag = government_is_tribal
			government_has_flag = government_is_nomadic
		}
		OR = {
			culture = { has_cultural_pillar = ethos_bellicose }
			culture = { has_cultural_pillar = ethos_communal }
		}
		NOT = { government_has_flag = government_is_pirate }#EK EDIT
	}
	
	cost = {
		prestige = {
			add = 500
		}
	}
	
	level_perk = {
		court_grandeur = 1
		owner_modifier = {
			owned_scheme_secrecy_add = 5
		}
	}
	
	level_perk = {
		court_grandeur = 4
		owner_modifier = {
		}

		owner_modifier_description = support_schemes_task_more_effective_desc
	}
	
	level_perk = {
		court_grandeur = 7
		owner_modifier = {
		}

		owner_modifier_description = court_intrigue_agent_acceptance_desc
	}
	
	level_perk = {
		court_grandeur = 10
		owner_modifier = {
			max_hostile_schemes_add = 1
		}
	}

	ai_will_do = {
		value = 0
		add = {
			if = {
				limit = {
					OR = {
						culture = { has_cultural_pillar = ethos_bellicose }
						culture = { has_cultural_pillar = ethos_communal }
						# any_held_title = { this = title:e_byzantium } #EK EDIT
					}
				}
				add = intrigue
				#EK DISABLED
				#if = {
				#	limit = {
				#		any_held_title = { this = title:e_byzantium }
				#	}
				#	add = 25
				#}
				if = {
					limit = {
						OR = {
							has_trait = sadistic
							has_trait = callous
							has_trait = disloyal
						}
					}
					add = 25
				}
				if = {
					limit = {
						has_education_intrigue_trigger = yes
					}
					add = 25
				}
				if = {
					limit = {
						has_lifestyle = intrigue_lifestyle
					}
					add = 50
				}
			}
		}
	}
}

court_scholarly = {
	background = "gfx/interface/icons/culture_pillars/ethos_spiritual.dds"
	
	is_shown = {
		NOR = {
			government_has_flag = government_is_tribal
			government_has_flag = government_is_nomadic
		}
		OR = {
			culture = { has_cultural_pillar = ethos_courtly }
			culture = { has_cultural_pillar = ethos_spiritual }
		}
		NOT = { government_has_flag = government_is_pirate }#EK EDIT
	}
	
	is_valid = {
		NOR = {
			government_has_flag = government_is_tribal
			government_has_flag = government_is_nomadic
		}
		OR = {
			culture = { has_cultural_pillar = ethos_courtly }
			culture = { has_cultural_pillar = ethos_spiritual }
		}
		NOT = { government_has_flag = government_is_pirate }#EK EDIT
	}
	
	cost = {
		prestige = {
			add = 500
		}
	}
	
	level_perk = {
		court_grandeur = 1
		owner_modifier = {
		}

		owner_modifier_description = scholarly_inspiration_frequency_desc
	}
	
	level_perk = {
		court_grandeur = 4
		owner_modifier = {
			courtier_and_guest_opinion = 15
		}
	}
	
	level_perk = {
		court_grandeur = 7
		owner_modifier = {
			monthly_lifestyle_xp_gain_mult = 0.1
		}
	}
	
	level_perk = {
		court_grandeur = 10
		owner_modifier = {
			learning_per_prestige_level = 1
		}
		courtier_guest_modifier = {
			learning = 1
		}

		#owner_modifier_description = scholarly_book_quality_desc
	}

	ai_will_do = {
		value = 0
		add = {
			if = {
				limit = {
					OR = {
						culture = { has_cultural_pillar = ethos_courtly }
						culture = { has_cultural_pillar = ethos_spiritual }
					}
				}
				add = learning
				if = {
					limit = {
						has_trait = patient
					}
					add = 25
				}
				if = {
					limit = {
						faith = { has_doctrine = doctrine_pluralism_pluralistic }
					}
					add = 25
				}
				if = {
					limit = {
						has_education_learning_trigger = yes
					}
					add = 25
				}
				if = {
					limit = {
						has_lifestyle = learning_lifestyle
					}
					add = 50
				}
			}
		}
	}
}

### EK NOTE: Very meh. We use it for pirate realms instead
# Good news is that we can tie court types to governments ig /shrug
court_tribal = {
	background = "gfx/interface/icons/culture_pillars/ethos_stoic.dds"

	is_shown = {
		OR = {
			government_has_flag = government_is_tribal
			government_has_flag = government_is_pirate #EK EDIT
		}
	}
	
	is_valid = {
		OR = {
			government_has_flag = government_is_tribal
			government_has_flag = government_is_pirate #EK EDIT
		}
	}
	
	cost = {
		prestige = {
			add = 500
		}
	}
	time_perk = {
		required_months_in_court = 12
		courtier_guest_modifier = { prowess_no_portrait = 1 }
	}
	time_perk = {
		required_months_in_court = 24
		courtier_guest_modifier = { prowess_no_portrait = 1 }
	}
	time_perk = {
		required_months_in_court = 36
		courtier_guest_modifier = { prowess_no_portrait = 1 }
	}
	level_perk = {
		court_grandeur = 1
		owner_modifier = {
			knight_effectiveness_mult = 0.05
		}
	}
	level_perk = {
		court_grandeur = 3
		owner_modifier = {
			raid_speed = 0.2
			max_loot_mult = 0.2
		}
	}
	
	level_perk = {
		court_grandeur = 5
		owner_modifier = {
			dread_gain_mult = 0.25
		}
	}
	
	level_perk = {
		court_grandeur = 7
		owner_modifier = {
			vassal_opinion = 5
		}
	}
	
	level_perk = {
		court_grandeur = 10
		owner_modifier = {
			men_at_arms_maintenance = -0.25
		}
	}

	ai_will_do = {
		value = 0
		add = {
			if = {
				limit = {
					OR = {
						culture = { has_cultural_pillar = ethos_bellicose }
						culture = { has_cultural_pillar = ethos_bureaucratic }
						culture = { has_cultural_pillar = ethos_stoic }
					}
				}
				add = martial
				#EK DISABLED
				#if = {
				#	limit = {
				#		OR = {
				#			culture = { has_cultural_pillar = heritage_turkic }
				#			culture = { has_cultural_pillar = heritage_mongolic }
				#		}
				#	}
				#	add = 25
				#}
				if = {
					limit = {
						has_trait = wrathful
					}
					add = 25
				}
				if = {
					limit = {
						faith = { has_doctrine = tenet_warmonger }
					}
					add = 25
				}
				if = {
					limit = {
						has_education_martial_trigger = yes
					}
					add = 25
				}
				if = {
					limit = {
						has_lifestyle = martial_lifestyle
					}
					add = 50
				}
				if = {
					limit = {
						NOT = {
							government_has_flag = government_is_tribal
						}
					}
					add = -5000
				}
			}
		}
	}
}

court_nomadic = {
	background = "gfx/interface/icons/culture_pillars/ethos_bellicose.dds"

	is_shown = {
		government_has_flag = government_is_nomadic
	}
	
	is_valid = {
		government_has_flag = government_is_nomadic
	}
	
	cost = {
		prestige = {
			add = 500
		}
	}
	time_perk = {
		required_months_in_court = 12
		courtier_guest_modifier = {
			prowess_no_portrait = 1
			trait_track_hunter_xp_gain_mult = 0.05
		}
	}
	time_perk = {
		required_months_in_court = 36
		courtier_guest_modifier = {
			prowess_no_portrait = 1
			trait_track_hunter_xp_gain_mult = 0.15
		}
	}
	time_perk = {
		required_months_in_court = 60
		courtier_guest_modifier = {
			prowess_no_portrait = 1
			trait_track_hunter_xp_gain_mult = 0.2
		}
	}
	level_perk = {
		court_grandeur = 1
		owner_modifier = {
			herd_capacity_mult = 0.15
		}
	}
	level_perk = {
		court_grandeur = 2
		owner_modifier = {
			raid_speed = 0.2
			max_loot_mult = 0.2
		}
	}
	level_perk = {
		court_grandeur = 3
		owner_modifier = {
			trait_track_hunter_xp_gain_mult = 0.25
		}
	}

	level_perk = {
		court_grandeur = 4
		owner_modifier = {
			herd_gain_mult = 0.05
		}
	}
	
	level_perk = {
		court_grandeur = 6
		owner_modifier = {
			dread_baseline_add = 10
		}
	}
	
	level_perk = {
		court_grandeur = 8
		owner_modifier = {
			direct_vassal_opinion = 5
		}
	}
	
	level_perk = {
		court_grandeur = 10
		owner_modifier = {
			herd_conversion = 0.02
		}
	}

	ai_will_do = {
		value = 100
		add = {
			if = {
				limit = {
					OR = {
						culture = { has_cultural_pillar = ethos_bellicose }
						culture = { has_cultural_pillar = ethos_bureaucratic }
						culture = { has_cultural_pillar = ethos_stoic }
					}
				}
				add = martial
				#if = {
				#	limit = {
				#		OR = {
				#			culture = { has_cultural_pillar = heritage_turkic }
				#			culture = { has_cultural_pillar = heritage_mongolic }
				#		}
				#	}
				#	add = 25
				#}
				if = {
					limit = {
						has_trait = wrathful
					}
					add = 25
				}
				if = {
					limit = {
						faith = { has_doctrine = tenet_warmonger }
					}
					add = 25
				}
				if = {
					limit = {
						has_education_martial_trigger = yes
					}
					add = 25
				}
				if = {
					limit = {
						has_lifestyle = martial_lifestyle
					}
					add = 50
				}
				if = {
					limit = {
						NOT = {
							government_has_flag = government_is_nomadic
						}
					}
					add = -5000
				}
			}
		}
	}
}
