##################################################
#
#	Royal Court Court Grandeur Level & Amenity Decisions List
#
#	COURT GRANDEUR LEVELS
#
#	AMENITIES
#	Order Mass Eviction			-	Pay a little prestige to boot out all the guests from your palace.
#	Exoticise a Grand Hall		-	Arrange for a fancy new room with decor inspired by a culture you adore.
#
##################################################



#############################################
# Order Mass Eviction						#
# by Ewan Cowhig Croft						#
#############################################

# Pay a little prestige to boot out all the guests from your palace.
### Order Mass Eviction ###
order_mass_eviction_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_realm.dds"
	}
	ai_check_interval = 0

	sort_order = 79

	desc = order_mass_eviction_decision_desc
	selection_tooltip = order_mass_eviction_decision_tooltip

	is_shown = {
		# Standard filter checks.
		is_playable_character = yes
		has_royal_court = yes
		has_dlc_feature = royal_court
		# Has a suitable lack of rooms.
		amenity_level = {
			target = court_lodging_standards
			value <= medium_amenity_level
		}
	}

	is_valid = {
		# Restate the amenity level requirement so it's visible.
		amenity_level = {
			target = court_lodging_standards
			value <= medium_amenity_level
		}
		# At least one guest if you have more than the minimum amenities.
		trigger_if = {
			limit = {
				amenity_level = {
					target = court_lodging_standards
					value > low_amenity_level
				}
			}
			custom_description = {
				text = AT_LEAST_ONE_GUEST_TRIGGER
				any_pool_guest = { }
			}
		}
		# At least one guest or evictable  courtier if you have low amenities.
		trigger_else = {
			OR = {
				custom_description = {
					text = AT_LEAST_ONE_GUEST_TRIGGER
					any_pool_guest = { }
				}
				custom_description = {
					text = AT_LEAST_ONE_UNIMPORTANT_COURTIER_TRIGGER
					any_courtier = {
						order_mass_eviction_decision_evictable_courtier_trigger = yes
						count >= 1
					}
				}
			}
		}
	}

	is_valid_showing_failures_only = {
		is_alive = yes
		not = { exists = involved_activity }
		is_imprisoned = no
		has_contagious_deadly_disease_trigger = no
	}

	effect = {
		show_as_tooltip = { order_mass_eviction_decision_guests_only_effect = yes }
		if = {
			limit = {
				amenity_level = {
					target = court_lodging_standards
					value > low_amenity_level
				}
			}
			custom_tooltip = order_mass_eviction_decision.tt.courtier_option
		}
		trigger_event = ep1_decision.0101
	}

	cost = { prestige = order_mass_eviction_decision_cost_value }

	cooldown = { years = 20 }

	ai_potential = {
		# The AI can use the regular system; this decision is just for players.
		always = no
	}

	ai_will_do = {
		base = 0
	}
}

#############################################
# Exoticise a Grand Hall					#
# by Ewan Cowhig Croft						#
#############################################

# Arrange for a major room to be remodelled with decor inspired by a more grandiose culture.
### Exoticize a Grand Hall ###
exoticise_a_grand_hall_decision = {
#	picture = {
#		trigger = {
#			NOR = {
#				government_has_flag = government_is_tribal
#				government_has_flag = government_is_theocracy
#				government_has_flag = government_is_nomadic
#				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
#						is_roman_emperor_primary_title_trigger = yes
#					}
#				}
#			}
#		}
#		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 = {
		trigger = {
			government_has_flag = government_is_celestial
		}
		reference = "gfx/interface/illustrations/event_scenes/tgp_asia_throne_room.dds"
	}
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_knight_kneeling.dds"
	}

	ai_check_interval_by_tier = {
		barony = 0
		county = 0
		duchy = 0
		kingdom = 120
		empire = 120
		hegemony = 120
	}

	sort_order = 80

	desc = exoticise_a_grand_hall_decision_desc
	selection_tooltip = exoticise_a_grand_hall_decision_tooltip

	is_shown = {
		# Standard filter checks.
		is_playable_character = yes
		has_royal_court = yes
		has_dlc_feature = royal_court
		# Has suitably amazing rooms.
		amenity_level = {
			target = court_lodging_standards
			value >= very_high_amenity_level
		}
		# Grandeur requirements.
		OR = {
			# AI need to border a player or an empire.
			AND = {
				is_ai = yes
				OR = {
					any_player = {
						has_royal_court = yes
						any_neighboring_and_across_water_realm_same_rank_owner = { this = root }
						any_neighboring_and_across_water_top_liege_realm_owner = { this = root }
					}
					any_neighboring_and_across_water_top_liege_realm_owner = { this.primary_title.tier = tier_empire }
				}
			}
			# Players handle this in the is_valid block.
			is_ai = no
		}
	}

	is_valid = {
		# Players just have to have royal courts nicer than theirs.
		trigger_if = {
			limit = { is_ai = no }
			OR = {
				custom_description = {
					text = exoticise_a_grand_hall_decision.tt.any_valid_empire
					any_empire = { exoticise_a_grand_hall_decision_list_builder_guts_trigger = yes }
				}
				custom_description = {
					text = exoticise_a_grand_hall_decision.tt.any_valid_kingdom
					any_kingdom = { exoticise_a_grand_hall_decision_list_builder_guts_trigger = yes }
				}
			}
		}
	}

	is_valid_showing_failures_only = {
		is_alive = yes
		not = { exists = involved_activity }
		is_imprisoned = no
	}

	effect = {
		# Save the current gold count for refund purposes.
		## Since this is a large & variable gold cost, we use a firmer refund system to prevent player market manipulation.
		set_variable = {
			name = exoticise_a_grand_hall_decision_refund_value
			value = exoticise_a_grand_hall_decision_cost_value
		}
		# Trigger the decision.
		trigger_event = ep1_decision.0111
		# And some flavour.
		custom_tooltip = exoticise_a_grand_hall_decision.tt.you_ponder
	}

	cost = { gold = exoticise_a_grand_hall_decision_cost_value }

	cooldown = { years = 10 }

	ai_potential = {
		# Keep this restricted to a few likely types
		OR = {
			has_trait = humble
			has_trait = gregarious
			has_trait = profligate
			has_trait = adventurer
		}
		# And they need the gold to make the purchase at all.
		short_term_gold >= exoticise_a_grand_hall_decision_cost_value
	}

	ai_will_do = {
		base = 0
		# We add 25% per each of the qualifying traits they have.
		modifier = {
			add = 25
			has_trait = humble
		}
		modifier = {
			add = 25
			has_trait = gregarious
		}
		modifier = {
			add = 25
			has_trait = profligate
		}
		modifier = {
			add = 25
			has_trait = adventurer
		}
	}
}
