###########################
# FP2 CULTURAL TRADITIONS 
###########################

#######################
# Aragonese Specific
#######################

tradition_fp2_state_ransoming = {
	category = realm

	layers = {
		0 = steward
		1 = western
		4 = state_ransoming.dds
	}
	
	is_shown = {
		# DLC check.
		has_fp2_dlc_trigger = yes
	}

	# Anyone can take this.
	
	parameters = {
		knights_die_less_but_are_captured_more = yes
		characters_more_likely_to_be_captured_in_sieges = yes
		can_demand_higher_ransoms_from_lower_tiers = yes
	}

	character_modifier = {
		hard_casualty_modifier = -0.5
		monthly_war_income_mult = -0.25
	}

	county_modifier = {
		# Naturally, people are more keen to turn up to serve.
		levy_size = 0.1
	}
	
	cost = {
		prestige = {
			# Base cost.
			add = {
				value = tradition_base_cost
				desc = BASE
				format = "BASE_VALUE_FORMAT"
			}
			# Ethos requirement.
			if = {
				limit = {
					NOR = {
						culture_pillar:ethos_bellicose = { is_in_list = traits }
						culture_pillar:ethos_communal = { is_in_list = traits }
					}
				}
				add = {
					value = tradition_incompatible_ethos_penalty
					desc = not_bellicose_or_communal_desc
				}
			}
			# Heritage or language
			if = {
				limit = {
					NOR = {
						has_cultural_pillar = heritage_iberian
						AND = {
							exists = culture_head
							culture_head = { knows_language = language_iberian }
						}
					}
				}
				add = {
					value = tradition_unfulfilled_criteria_penalty
					desc = lack_iberian_heritage_or_language_penalty_desc
				}
			}
			# General replacement stuff.
			multiply = tradition_replacement_cost_if_relevant
		}
	}
	
	ai_will_do = {
		value = 100
	}
}

#######################
# Castilian Specific
#######################

tradition_fp2_strategy_gamers = {
	category = ritual

	layers = {
		0 = diplo
		1 = western
		4 = board_gamers.dds
	}
	
	is_shown = {
		# DLC check.
		has_fp2_dlc_trigger = yes
	}

	# Anyone can take this.
	
	parameters = {
		commanders_likelier_to_gain_commander_traits = yes
		may_challenge_to_board_games = yes
		may_wager_land_on_board_games = yes
	}

	character_modifier = {
		movement_speed = 0.1
		prowess = medium_skill_penalty
		martial = medium_skill_bonus
	}
	
	cost = {
		prestige = {
			# Base cost.
			add = {
				value = tradition_base_cost
				desc = BASE
				format = "BASE_VALUE_FORMAT"
			}
			# Ethos requirement.
			if = {
				limit = {
					NOR = {
						culture_pillar:ethos_bellicose = { is_in_list = traits }
						culture_pillar:ethos_courtly = { is_in_list = traits }
					}
				}
				add = {
					value = tradition_incompatible_ethos_penalty
					desc = not_bellicose_or_courtly_desc
				}
			}
			# Either high martial, high learning, or a chess board required.
			if = {
				limit = { exists = culture_head }
				if = {
					limit = {
						culture_head = {
							NOR = {
								martial >= very_high_skill_rating
								learning >= very_high_skill_rating
								any_character_artifact = { has_variable = can_be_used_for_board_games }
							}
						}
					}
					add = {
						value = tradition_unfulfilled_criteria_penalty
						desc = lack_martial_learning_or_chess_board_penalty_desc
					}
				}
			}
			
			multiply = tradition_replacement_cost_if_relevant
		}
	}
	
	ai_will_do = {
		value = 0
		
		if = {
			limit = { exists = culture_head }
			culture_head = {
				# Absolute nerds.
				if = {
					limit = {
						martial >= extremely_high_skill_rating
						learning >= extremely_high_skill_rating
						has_trait = scholar
					}
					add = 100
				}
				# People who got suckered in & accidentally started a trend.
				if = {
					limit = {
						any_character_artifact = { has_variable = can_be_used_for_board_games }
					}
					add = 100
				}
			}
		}
	}
}

#######################
# Andalusian Specific
#######################

tradition_fp2_malleable_subjects = {
	category = realm

	layers = {
		0 = intrigue
		1 = mena
		4 = malleable_subjects.dds
	}
	
	is_shown = {
		# DLC check.
		has_fp2_dlc_trigger = yes
		has_cultural_pillar = heritage_iberian
	}

	can_pick = {
		# Must be of a suitable heritage.
		custom_tooltip = {
			text = iberian_heritage_trigger
			has_cultural_pillar = heritage_iberian
		}
	}
	
	parameters = {
		doesnt_care_about_culture_faith_in_factions = yes
		wants_to_learn_liege_language = yes
		harder_to_convert_county_culture_without_heritage = yes
		easier_to_convert_county_culture_with_heritage = yes
		powerful_foreign_knights_find_you_attractive = yes
		# ^[blushes]
	}

	character_modifier = {
		mercenary_hire_cost_mult = -0.5
		vassal_levy_contribution_mult = 0.25
		different_culture_opinion = 10
		ignore_negative_opinion_of_culture = yes
	}

	culture_modifier = {
		mercenary_count_mult = 2
		cultural_acceptance_gain_mult = 0.25
	}

	cost = {
		prestige = {
			# Base cost.
			add = {
				value = tradition_base_cost
				desc = BASE
				format = "BASE_VALUE_FORMAT"
			}
			# Ethos requirement.
			if = {
				limit = {
					NOR = {
						culture_pillar:ethos_egalitarian = { is_in_list = traits }
						culture_pillar:ethos_courtly = { is_in_list = traits }
					}
				}
				add = {
					value = tradition_incompatible_ethos_penalty
					desc = not_egalitarian_or_courtly_desc
				}
			}
			
			multiply = tradition_replacement_cost_if_relevant
		}
	}
	
	ai_will_do = {
		value = 0
		# Players might want this, but the AI never does.
	}
}

#######################
# Generic
#######################

tradition_fp2_ritualised_friendship = {
	category = societal

	layers = {
		0 = diplo
		1 = western
		4 = ritualised_friendship.dds
	}
	
	is_shown = {
		# DLC check.
		#has_fp2_dlc_trigger = yes
	}

	can_pick = {
		# Must have at least one friend. No friendless losers. Especially you, Nick.
		custom_tooltip = {
			text = need_at_least_one_friend
			culture_head ?= {
				any_relation = {
					type = friend
					count >= 1
				}
			}
		}
	}
	
	parameters = {
		automatic_befriend_access = yes
		may_propose_best_friendship = yes
		strong_hooks_and_stress_effects_best_friends = yes
		may_select_friendship_synergy_bonus = yes
	}

	character_modifier = {
		scheme_phase_duration_against_friend_add = 20
		scheme_phase_duration_against_best_friend_add = 40
	}
	
	cost = {
		prestige = {
			# Base cost.
			add = {
				value = tradition_base_cost
				desc = BASE
				format = "BASE_VALUE_FORMAT"
			}
			# No ethos requirement: everyone likes friends.
			# Need at least three friends.
			if = {
				limit = { exists = culture_head }
				if = {
					limit = {
						culture_head = {
							any_relation = {
								type = friend
								count < 3
							}
						}
					}
					add = {
						value = tradition_unfulfilled_criteria_penalty
						desc = guess_you_need_more_friends_desc
					}
				}
			}
			
			multiply = tradition_replacement_cost_if_relevant
		}
	}
	
	ai_will_do = {
		value = 0

		if = {
			limit = { exists = culture_head }
			culture_head = {
				# Some traits make you want to codify this more...
				if = {
					limit = { has_trait = gregarious }
					add = 50
				}
				if = {
					limit = { has_trait = just }
					add = 25
				}
				if = {
					limit = { has_trait = compassionate }
					add = 25
				}
				# ... but arbitrary characters have zero interest in anything nearly so formal
				if = {
					limit = { has_trait = arbitrary }
					add = -200
				}
				# We don't modify down for shy because, if anything, you'd expect a shy person to be more serious about the few friends they *do* have.
				# Having lots of friends makes you more likely to want this.
				if = {
					limit = {
						any_relation = {
							type = friend
							count >= 4
						}
					}
					add = 50
				}
				# As does having a best friend already.
				if = {
					limit = {
						any_relation = {
							type = best_friend
							count >= 1
						}
					}
					add = 25
				}
				# And certain lifestyles also make you want to focus on this.
				if = {
					limit = { has_focus = martial_chivalry_focus }
					add = 10
				}
			}
		}
	}
}
