﻿#EK NOTE: removed mentions of byzantium
##################################################

#	Royal Court Other Decisions List

#	Adopt Puppy - doot a puppo
#	Introduce a Fashion at Court - make a bold fashion statement

##################################################

#############################################
# Have the Jester Entertain You
#############################################

jester_entertainment_decision = {
	picture = { reference = "gfx/interface/illustrations/decisions/decision_pet_dog.dds" }
	desc = jester_entertainment_decision_desc
	selection_tooltip = jester_entertainment_decision_tooltip
	ai_check_interval = 24
	sort_order = 150
	
	cooldown = { years = 2 }
	
	ai_potential = {
		stress > 0
	}
	
	is_shown = {
		highest_held_title_tier >= tier_duchy
		is_landed_or_landless_administrative = yes
		employs_court_position = court_jester_court_position
	}

	is_valid_showing_failures_only = {
		age >= 12
		court_position:court_jester_court_position ?= {
			is_physically_able_ai_adult = yes
		}
		NOR = {
			is_available = no
			is_incapable = yes
		}
	}

	effect = {
		custom_tooltip = jester_decision_rewards
		trigger_event = {
			on_action = jester_ongoing
		}
		close_view = {
			view = decisions
			player = root
		}
	}

	ai_will_do = {
		base = 100
	}
}

#############################################
# Adopt Puppy								#
# by Joe Parkin								#
#############################################

adopt_puppy_decision = {
	title = adopt_puppy_decision_name
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_pet_dog.dds"
	}
	desc = adopt_puppy_decision_desc
	selection_tooltip = adopt_puppy_decision_tooltip
	cooldown = { years = 5 }
	sort_order = 89

	is_shown = {
		is_landed_or_landless_administrative = yes
		is_lowborn = no
		OR = {
			# House has the Dog Lovers modifier from Hold Court event
			AND = {
				exists = house
				house = { has_house_modifier = hold_court_8140_house_modifier }
			}
			# Or the character has the Kennel upgrade in their Estate
			domicile ?= { has_domicile_parameter = estate_unlock_adopt_puppy_decision }
		}
	}

	is_valid_showing_failures_only = {
		# Does not already have a pet.
		custom_tooltip = {
			text = adopt_puppy_decision_already_pet_tt
			NOR = {
				any_owned_story = { story_type = story_cycle_pet_dog }
				any_owned_story = { story_type = story_cycle_pet_cat }
				has_character_modifier = dog_story_modifier
				has_character_modifier = cat_story_modifier
			}
		}
	}

	effect = {
		show_as_tooltip = { start_dog_story_cycle_effect = yes }
		trigger_event = hold_court.8142
	}

	cost = { gold = minor_gold_value }

	ai_check_interval = 60
	
	ai_potential = {
		# Has enough gold.
		short_term_gold >= minor_gold_value
		NOR = {
			has_trait = lazy
			has_trait = callous
		}
	}

	ai_will_do = {
		base = 100
		# You're richer.
		modifier = {
			add = 50
			faith = { has_doctrine_parameter = gruesome_festivals_active }
			short_term_gold >= massive_gold_value
		}
		modifier = {
			add = 50
			faith = { has_doctrine_parameter = gruesome_festivals_active }
			short_term_gold >= monumental_gold_value
		}
	}
}


#############################################
# Introduce a New Fashion at Court			#
# by James Beaumont							#
#############################################

introduce_a_new_fashion_at_court_decision = {
	#EK DISABLED: no Byzantium
	#picture = {
	#	trigger = {
	#		NOR = {
	#			government_has_flag = government_is_tribal
	#			government_has_flag = government_is_theocracy
	#			top_liege ?= { government_has_flag = government_is_tribal }
	#			top_liege ?= { government_has_flag = government_is_theocracy }
	#		}
	#		OR = {
	#			culture = { has_cultural_pillar = heritage_byzantine }
	#			top_liege ?= {
	#				OR = {
	#					culture = { has_cultural_pillar = heritage_byzantine }
	#					capital_barony ?= title:b_constantinople
	#					primary_title ?= title:e_byzantium
	#					primary_title ?= title:e_roman_empire
	#				}
	#			}
	#		}
	#	}
	#	reference = "gfx/interface/illustrations/decisions/ep3_cerimonial_decision.dds"
	#}
	picture = {
		trigger = {
			government_has_flag = government_is_nomadic
		}
		reference = "gfx/interface/illustrations/event_scenes/mpo_tent_interior_mongol.dds"
	}
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_knight_kneeling.dds"
	}
	desc = introduce_a_new_fashion_at_court_decision_desc
	selection_tooltip = introduce_a_new_fashion_at_court_decision_tooltip
	cooldown = { years = 5 }
	sort_order = 80

	is_shown = {
		NOT = { has_title = title:k_fashion } # Kingdom of Fashion is very much the end-game of this interaction
		NOT = { faith = { has_doctrine_parameter = naked_adherents_active } } # Must wear clothes
		is_available_at_peace_adult = yes
		is_landed_or_landless_administrative = yes
		# Either has a royal court with high fashion or is part of a royal court with high fashion
		OR = {
			AND = {
				has_royal_court = yes
				has_dlc_feature = royal_court
				OR = {
					amenity_level = {
						type = court_fashion
						value >= 4
					}
					has_nickname = nick_prince_of_fashion
				}
			}
			AND = {
				liege = { has_royal_court = yes }
				has_royal_court = no # Narrative flow of the event is a bit weird if it's unclear which royal court it's taking place in
				OR = {
					liege = {
						amenity_level = {
							type = court_fashion
							value >= 4
						}
					}
					has_nickname = nick_prince_of_fashion
				}
			}
		}
	}

	is_valid_showing_failures_only = {
		# Standard checks
		is_available_at_peace_adult = yes
		# Court does not currently have a fashion trend
		trigger_if = {
			limit = {
				OR = {
					AND = {
						root = { has_royal_court = yes }
						root = { has_character_flag = fashion_trend_flag }
					}
					AND = {
						exists = root.liege
						NOT = { liege = root }
						root.liege = { has_royal_court = yes }
						root = { has_royal_court = no }
						root.liege = { has_character_flag = fashion_trend_flag }
					}
				}
			}
			custom_description = {
				text = court_already_has_a_fashion_tend_tt
				always = no
			}
		}
		any_courtier_or_guest = {
			NOT = { faith = { has_doctrine_parameter = naked_adherents_active } }
			is_available_at_peace_adult = yes
		}
	}

	effect = {
		hidden_effect = {
			if = {
				limit = {
					has_royal_court = yes
				}
				add_character_flag = {
					flag = fashion_trend_flag
					years = 3
				}
			}
			else = {
				liege = {
					add_character_flag = {
						flag = fashion_trend_flag
						years = 3
					}
				}
			}
			random_list = {
				# Determine what the strange fashion choice is
				10 = {
					add_character_flag = { flag = flag_big_collar years = 1 }
				}
				10 = {
					add_character_flag = { flag = flag_head_dress years = 1 }
				}
				10 = {
					add_character_flag = { flag = flag_gold_boots years = 1 }
				}
				10 = {
					add_character_flag = { flag = flag_sleeveless years = 1 }
				}
				10 = {
					add_character_flag = { flag = flag_commoner_clothes years = 1 }
				}
			}
			save_scope_as = actor
			# Get someone to potentially oppose the fashion choice
			random_courtier_or_guest = {
				limit = {
					NOT = { faith = { has_doctrine_parameter = naked_adherents_active } }
					is_available_at_peace_adult = yes
				}
				weight = {
					base = 1
					compare_modifier = { # Diplo duel should look for high diplo characters
						value = diplomacy
						multiplier = 0.25
					}
					modifier = { # Rivals should want to insult their rival
						has_relation_rival = root
						add = 10
					}
					modifier = { # Increase visibility for other players
						is_ai = no
						factor = 2
					}
				}
				save_scope_as = recipient
				trigger_event = court_amenities_interactions.0010
			}
		}
		custom_tooltip = {
			text = introduce_new_fashion_duel_tooltip
		}
	}

	cost = {
		gold = minor_gold_value
		prestige = medium_prestige_value
	}

	ai_check_interval = 60 # Fashion trends last for five years
	
	ai_potential = {
		# Has enough gold.
		short_term_gold >= minor_gold_value
		liege = { # Shouldn't snipe the opportunity away from the player
			is_ai = yes
		}
	}

	ai_will_do = {
		base = 25
		# You're a fashionista
		modifier = {
			add = 50
			has_trait = seducer
		}
		modifier = {
			add = 50
			has_trait = avaricious
		}
	}
}

#############################################
# Finance Culture Development				#
# by Maxence Voleau 						#
#############################################

promote_other_culture_development_decision = {
	title = promote_other_culture_development_decision_name
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_misc.dds"
	}
	desc = promote_other_culture_development_decision_desc
	selection_tooltip = promote_other_culture_development_decision_tooltip
	cooldown = { years = 10 }
	sort_order = 90

	is_shown = {
		exists = dynasty
		dynasty = {
			has_dynasty_perk = ep1_culture_legacy_5
		}
	}

	is_valid_showing_failures_only = {
		custom_tooltip = {
			text = promote_other_culture_development_decision_not_acceptance_tt
			any_sub_realm_county = {
				count > 0
				AND = {
					NOT = { culture = root.culture}
					culture = {
						cultural_acceptance = {
							target = ROOT.culture
							value >= 75
						}
					}
				}
			}
		}
	}

	effect = {

		#Add a modifier on the character who spent the money
		add_character_modifier = {
			modifier = promote_culture_leader_modifier
			years = 10
		}

		#Collect the list of Cultures which will be affected 
		hidden_effect = {
			every_sub_realm_county = {
				if = {
					limit = {
						NOT = { 
							culture = {
								any_in_list = {
									list = promoted_culture
									this = prev
								}
							}
						}
						NOT = {	root.culture = culture }
						culture = {
							cultural_acceptance = {
								target = ROOT.culture
								value >= 75
							}
						}
					}
					culture = { add_to_temporary_list = promoted_culture }
				}
			}
		}

		#Generate intelligible effect
		if = {
			limit = {
				any_in_list = {
					list = promoted_culture
					count > 0
				}
			}
			every_in_list = {
				list = promoted_culture
				this =  { save_scope_as = current_culture }
				custom_tooltip = promote_other_culture_development_decision_effect_summary #see if a modifier can be injected for better effect
			}
		}
		else = {
			custom_tooltip = promote_other_culture_development_decision_no_effect
		}
		
		#Apply the actual effect: add a County Modifier on the relevant Counties
		hidden_effect = {
			every_sub_realm_county = {
				if = {
					limit = {
						NOT = { culture = root.culture }
						culture = {
							cultural_acceptance = {
								target = root.culture
								value >= 75
							}
						}
					}
				 	add_county_modifier = {
				 		modifier = promote_culture_modifier
				 		years = 10
				 	}
				}
			}
		}
	}

	cost = {
		gold = {
			value = minor_gold_value
			every_sub_realm_county = {
				if = {
					limit = {
						NOT = { culture = root.culture }
						culture = {
							cultural_acceptance = {
								target = root.culture
								value >= 75
							}
						}
					}
					add = 10
				}
			}
		} 
	}

	ai_check_interval = 120
	
	ai_potential = {
		is_at_war = no
		# Has enough gold.
		short_term_gold >= ai_war_chest_desired_gold_value
		NOR = {
			has_trait = lazy
			has_trait = callous
		}
	}

	ai_will_do = {
		base = 100
	}
}
