﻿##################################################
# INDEX
#
# Huntsmaster		-	huntsmaster_attribute
# Blademaster		-	blademaster_attribute
# Master of Revels  -	master_of_revels_attribute
# House Knight  	-	house_knight_attribute

##################################################
# CONTROL VALUES

@lifestyle_bonus_tier_1_value = 0.15
@lifestyle_bonus_tier_2_value = 0.25
@lifestyle_bonus_tier_3_value = 0.35
#
@army_supply_bonus_tier_1_value = 0.25
@army_supply_bonus_tier_2_value = 0.5
#
@knight_effectiveness_tier_1_value = 0.4
@knight_effectiveness_tier_2_value = 0.8

##################################################
# LIFESTYLE TRAIT ATTRIBUTES

# Huntsmaster
huntsmaster_attribute = {
	adjective = "accolade_hunt_leading"
	noun = "accolade_huntsmaster"
	accolade_categories = { eminent rare_traits prowess ranged_fighter activities hunting educator logistics subtle courtly leader equestrian }

	potential = {
		prowess >= accolade_prowess_requirement_value
	}
	
	weight = {
		# Should be a pretty common pick if you've bothered to unlock the legacy
		value = accolade_fascinating_base_value
		# Scope over to the liege to see if they even want this accolade.
		# culture
		if = {
			limit = {
				culture = {
					OR = {
						has_cultural_tradition = tradition_bush_hunting
						has_cultural_tradition = tradition_hunters
						has_cultural_tradition = tradition_sacred_hunts
					}
				}
			}
			add = 200
		}
		# traits
		if = {
			limit = {
				hunt_lifestyle_track_greater_equal_trigger = { TRACK = hunter GREATER_EQUAL = 100 }
			}
			add = 200
		}
		# Finally, weight for opinion.
		if = {
			limit = {
				exists = liege
			}
			multiply = accolade_opinion_multiplier_value
		}
		scope:owner ?= {
			# Culture
			if = {
				limit = {
					culture = {
						OR = {
							has_cultural_tradition = tradition_forest_fighters
							has_cultural_tradition = tradition_jungle_warriors
							has_cultural_tradition = tradition_land_of_the_bow
						}
					}
				}
				add = 200
			}
			if = {
				limit = {
					culture = {
						OR = {
							has_cultural_tradition = tradition_bush_hunting
							has_cultural_tradition = tradition_hunters
							has_cultural_tradition = tradition_sacred_hunts
						}
					}
				}
				add = 400
			}
			# liege's interest in hunting
			if = {
				limit = {
					OR = {
						hunt_lifestyle_track_greater_equal_trigger = { TRACK = hunter GREATER_EQUAL = 20 }
						has_trait = brave
						has_trait = diligent
					}
				}
				add = 200
			}
			## Factor 0s.
			if = {
				limit = {
					OR = {
						has_trait = craven
						has_trait = lazy
					}
				}
				multiply = 0
			}
		}
	}
	ranks = {
		# Rank 1
		100 = {
			liege_modifier = {
				trait_track_hunter_xp_gain_mult = @lifestyle_bonus_tier_1_value
			}
			accolade_parameters = { acclaimed_knight_trains_hunting }
		}
		# Rank 2
		300 = {
			liege_modifier = {
				trait_track_hunter_xp_gain_mult = @lifestyle_bonus_tier_1_value
			}
			accolade_parameters = { acclaimed_knight_trains_hunting }
		}
		# Rank 3
		600 = {
			liege_modifier = {
				trait_track_hunter_xp_gain_mult = @lifestyle_bonus_tier_2_value
			}
			accolade_parameters = {
				acclaimed_knight_trains_hunting
				acclaimed_knight_reduces_hunting_danger
			}
		}
		# Rank 4
		1000 = {
			liege_modifier = {
				trait_track_hunter_xp_gain_mult = @lifestyle_bonus_tier_2_value
			}
			accolade_parameters = {
				acclaimed_knight_trains_hunting
				acclaimed_knight_reduces_hunting_danger
			}
		}
		# Rank 5
		1500 = {
			liege_modifier = {
				trait_track_hunter_xp_gain_mult = @lifestyle_bonus_tier_3_value
			}
			accolade_parameters = {
				acclaimed_knight_trains_hunting
				acclaimed_knight_reduces_hunting_danger_high
			}
		}
		# Rank 6
		2100 = {
			liege_modifier = {
				trait_track_hunter_xp_gain_mult = @lifestyle_bonus_tier_3_value
			}
			accolade_parameters = {
				acclaimed_knight_trains_hunting
				acclaimed_knight_reduces_hunting_danger_high
			}
		}
	}
}

# Blademaster
blademaster_attribute = {
	adjective = "accolade_blade_besting"
	noun = "accolade_blademaster"
	accolade_categories = { eminent rare_traits prowess infantry educator army_bonus knights_bonus tournaments activities militant champion aggressive }

	potential = {
		prowess >= accolade_prowess_requirement_value
	}
	
	weight = {
		# Should be a pretty common pick if you've bothered to unlock the legacy
		value = accolade_fascinating_base_value
		# Scope over to the liege to see if they even want this accolade.
		# culture
		if = {
			limit = {
				culture = {
					OR = {
						has_cultural_tradition = tradition_druzhina
						has_cultural_tradition = tradition_futuwaa
						has_cultural_tradition = tradition_khadga_puja
						has_cultural_tradition = tradition_talent_acquisition
						has_cultural_tradition = tradition_swords_for_hire
						has_cultural_tradition = tradition_warriors_by_merit
						has_cultural_tradition = tradition_only_the_strong
						has_cultural_tradition = tradition_martial_admiration
						has_cultural_tradition = tradition_fp1_trials_by_combat
						has_cultural_tradition = tradition_chanson_de_geste
					}
				}
			}
			add = 200
		}
		# Finally, weight for opinion.
		if = {
			limit = {
				exists = liege
			}
			multiply = accolade_opinion_multiplier_value
		}
		scope:owner ?= {
			# Culture
			if = {
				limit = {
					culture = {
						OR = {
							has_cultural_pillar = ethos_bellicose
							has_cultural_pillar = ethos_stoic
						}
					}
				}
				add = 100
			}
			if = {
				limit = {
					culture = {
						OR = {
							has_cultural_tradition = tradition_druzhina
							has_cultural_tradition = tradition_futuwaa
							has_cultural_tradition = tradition_khadga_puja
							has_cultural_tradition = tradition_talent_acquisition
							has_cultural_tradition = tradition_swords_for_hire
							has_cultural_tradition = tradition_warriors_by_merit
							has_cultural_tradition = tradition_only_the_strong
							has_cultural_tradition = tradition_martial_admiration
							has_cultural_tradition = tradition_fp1_trials_by_combat
							has_cultural_tradition = tradition_chanson_de_geste
						}
					}
				}
				add = 400
			}
			if = {
				limit = {
					culture = {
						OR = {
							has_cultural_tradition = tradition_fp1_performative_honour
							has_cultural_tradition = tradition_chivalry
							has_cultural_tradition = tradition_warrior_culture
							has_cultural_tradition = tradition_fp1_the_right_to_prove
							has_cultural_tradition = tradition_garuda_warriors
						}
					}
				}
				add = 200
			}
			if = {
				limit = {
					culture = {
						OR = {
							has_cultural_tradition = tradition_strength_in_numbers
							has_cultural_tradition = tradition_pacifism
						}
					}
				}
				add = -400
			}
			# liege's interest in fighting
			if = {
				limit = {
					OR = {
						has_trait = brave
						has_trait = gallant
						has_trait = arrogant
					}
				}
				add = 200
			}
			## Factor 0s.
			if = {
				limit = {
					OR = {
						has_trait = craven
						has_trait = lazy
					}
				}
				multiply = 0
			}
		}
	}
	ranks = { 
		# Rank 1
		100 = {
			liege_modifier = {
				trait_track_lifestyle_blademaster_xp_gain_mult = @lifestyle_bonus_tier_1_value
			}
			accolade_parameters = { 
				acclaimed_knight_trains_swordfighting
				accolade_increase_hostile_knight_death_low
			}
		}
		# Rank 2
		300 = {
			liege_modifier = {
				trait_track_lifestyle_blademaster_xp_gain_mult = @lifestyle_bonus_tier_1_value
			}
			accolade_parameters = { 
				acclaimed_knight_trains_swordfighting
				accolade_increase_hostile_knight_death_low
			}
		}
		# Rank 3
		600 = {
			liege_modifier = {
				trait_track_lifestyle_blademaster_xp_gain_mult = @lifestyle_bonus_tier_2_value
				knight_effectiveness_mult = @knight_effectiveness_tier_1_value
			}
			accolade_parameters = {
				acclaimed_knight_trains_swordfighting
				accolade_increase_hostile_knight_death_medium
			}
		}
		# Rank 4
		1000 = {
			liege_modifier = {
				trait_track_lifestyle_blademaster_xp_gain_mult = @lifestyle_bonus_tier_2_value
				knight_effectiveness_mult = @knight_effectiveness_tier_1_value
			}
			accolade_parameters = {
				acclaimed_knight_trains_swordfighting
				accolade_increase_hostile_knight_death_medium
			}
		}
		# Rank 5
		1500 = {
			liege_modifier = {
				trait_track_lifestyle_blademaster_xp_gain_mult = @lifestyle_bonus_tier_3_value
				knight_effectiveness_mult = @knight_effectiveness_tier_2_value
			}
			accolade_parameters = {
				acclaimed_knight_trains_swordfighting
				acclaimed_knight_tournament_invite_acceptance_bonus
				accolade_increase_hostile_knight_death_high
			}
		}
		# Rank 6
		2100 = {
			liege_modifier = {
				trait_track_lifestyle_blademaster_xp_gain_mult = @lifestyle_bonus_tier_3_value
				knight_effectiveness_mult = @knight_effectiveness_tier_2_value
			}
			accolade_parameters = {
				acclaimed_knight_trains_swordfighting
				acclaimed_knight_tournament_invite_acceptance_bonus
				accolade_increase_hostile_knight_death_high
			}
		}
	}
}

# Reveller
master_of_revels_attribute = {
	adjective = "accolade_revel_leading"
	noun = "accolade_master_of_revels"
	accolade_categories = { eminent rare_traits social diplomacy activities foreign_relations vassal_manager educator army_bonus prestige courtly leader subtle }

	potential = {
		prowess >= accolade_prowess_requirement_value
	}
	
	weight = {
		# Should be a pretty common pick if you've bothered to unlock the legacy
		value = accolade_fascinating_base_value
		# Scope over to the liege to see if they even want this accolade.
		scope:owner ?= {
			# Faith
			if = {
				limit = {
					faith = {
						OR = {
							has_doctrine = tenet_monasticism
							has_doctrine = tenet_gnosticism
							has_doctrine = tenet_mendicant_preachers
						}
					}
				}
				add = -100
			}
			if = {
				limit = {
					faith = {
						OR = {
							has_doctrine = tenet_natural_primitivism
							has_doctrine = tenet_ritual_hospitality
							has_doctrine = tenet_sun_worship
						}
					}
				}
				add = 100
			}
			if = {
				limit = {
					faith = {
						OR = {
							has_doctrine = tenet_ritual_celebrations
							has_doctrine = tenet_hedonistic
						}
					}
				}
				add = 400
			}
			# Culture
			if = {
				limit = {
					culture = {
						OR = {
							has_cultural_pillar = ethos_courtly
							has_cultural_pillar = ethos_egalitarian
						}
					}
				}
				add = 200
			}
			if = {
				limit = {
					culture = {
						OR = {
							has_cultural_tradition = tradition_esteemed_hospitality
							has_cultural_tradition = tradition_wedding_ceremonies
							has_cultural_tradition = tradition_welcoming
							has_cultural_tradition = tradition_music_theory
						}
					}
				}
				add = 200
			}
			if = {
				limit = {
					culture = {
						OR = {
							has_cultural_tradition = tradition_festivities
							has_cultural_tradition = tradition_culinary_art
						}
					}
				}
				add = 500
			}
			if = {
				limit = {
					culture = {
						has_cultural_tradition = tradition_modest
					}
				}
				add = -200
			}
			# liege's interest in hunting
			if = {
				limit = {
					OR = {
						has_trait = lifestyle_reveler
						has_trait = gluttonous
						has_trait = gregarious
						has_trait = profligate
						has_trait = lustful
						has_trait = drunkard
					}
				}
				add = 200
			}
		}
		# knight culture
		if = {
			limit = {
				culture = {
					OR = {
						has_cultural_tradition = tradition_festivities
						has_cultural_tradition = tradition_music_theory
						has_cultural_tradition = tradition_welcoming
					}
				}
			}
			add = 200
		}
		# traits
		if = {
			limit = {
				OR = {
					has_trait_xp = {
						trait = lifestyle_reveler
						value >= 100
					}
					has_trait = gregarious
				}
			}
			add = 200
		}
		# Finally, weight for opinion.
		if = {
			limit = {
				exists = liege
			}
			multiply = accolade_opinion_multiplier_value
		}
		## Factor 0s.
		scope:owner ?= {
			#Faith
			if = {
				limit = {
					faith = {
						has_doctrine = tenet_asceticism
					}
				}
				multiply = 0
			}
			if = {
				limit = {
					OR = {
						has_trait = temperate
						has_trait = shy
						has_trait = diligent
					}
				}
				multiply = 0
			}
		}
	}
	ranks = {
		# Rank 1
		100 = {
			liege_modifier = {
				lifestyle_reveler_xp_gain_mult = @lifestyle_bonus_tier_1_value
			}
			accolade_parameters = { acclaimed_knight_trains_reveling }
		}
		# Rank 2
		300 = {
			liege_modifier = {
				lifestyle_reveler_xp_gain_mult = @lifestyle_bonus_tier_1_value
			}
			accolade_parameters = { acclaimed_knight_trains_reveling }
		}
		# Rank 3
		600 = {
			liege_modifier = {
				lifestyle_reveler_xp_gain_mult = @lifestyle_bonus_tier_2_value
			}
			accolade_parameters = {
				acclaimed_knight_trains_reveling
				acclaimed_knight_prestige_from_victory
			}
		}
		# Rank 4
		1000 = {
			liege_modifier = {
				lifestyle_reveler_xp_gain_mult = @lifestyle_bonus_tier_2_value
			}
			accolade_parameters = {
				acclaimed_knight_trains_reveling
				acclaimed_knight_prestige_from_victory
			}
		}
		# Rank 5
		1500 = {
			liege_modifier = {
				lifestyle_reveler_xp_gain_mult = @lifestyle_bonus_tier_3_value
			}
			accolade_parameters = {
				acclaimed_knight_trains_reveling
				acclaimed_knight_feast_wedding_invite_acceptance_bonus
				acclaimed_knight_prestige_from_victory_high
			}
		}
		# Rank 6
		2100 = {
			liege_modifier = {
				lifestyle_reveler_xp_gain_mult = @lifestyle_bonus_tier_3_value
			}
			accolade_parameters = {
				acclaimed_knight_trains_reveling
				acclaimed_knight_feast_wedding_invite_acceptance_bonus
				acclaimed_knight_prestige_from_victory_high
			}
		}
	}
}

# House Knight
house_knight_attribute = {
	adjective = "accolade_house"
	noun = "accolade_house_knight"
	accolade_categories = { eminent relationship dynasty educator defensive champion }

	potential = {
		prowess >= accolade_prowess_requirement_value
		house ?= liege.house
		NOT = {
			has_trait = denounced
		}
		dynasty = {
			has_dynasty_perk = kin_legacy_4
		}
	}
	
	weight = {
		# Should be a pretty common pick if you've bothered to unlock the legacy
		value = accolade_standard_base_value
		# Scope over to the liege to see if they even want this accolade.
		scope:owner ?= {
			# Culture
			if = {
				limit = {
					culture = { has_cultural_pillar = ethos_communal }
				}
				add = 100
			}
			if = {
				limit = {
					culture = {
						OR = {
							has_cultural_tradition = tradition_family_entrepreneurship
							has_cultural_tradition = tradition_tribe_unity
							has_cultural_tradition = tradition_mystical_ancestors
							has_cultural_tradition = tradition_strong_kinship
						}
					}
				}
				add = 200
			}
			# Faith
			if = {
				limit = {
					faith = {
						has_doctrine = tenet_divine_marriage
					}
				}
				add = 100
			}
			# family problems
			if = {
				limit = {
					OR = {
						has_trait = kinslayer_1
						has_trait = kinslayer_2
						has_trait = kinslayer_3
						has_trait = disinherited
					}
				}
				add = -200
			}
		}
		# good blood
		if = {
			limit = {
				OR = {
					has_trait = consecrated_blood
					has_trait = divine_blood
					has_trait = sayyid
					has_trait = saoshyant_descendant
					has_trait = pure_blooded
					has_trait = golden_lineage
				}
			}
			add = 200
		}
		# bad blood
		if = {
			limit = {
				OR = {
					has_trait = scaly
					has_trait = clubfooted
					has_trait = dwarf
					has_trait = hunchbacked
					has_trait = spindly
					has_trait = physique_bad
					has_trait = beauty_bad
					has_trait = intellect_bad
				}
			}
			add = -200
		}
		# Finally, weight for opinion.
		if = {
			limit = {
				exists = liege
			}
			multiply = accolade_opinion_multiplier_value
		}
		scope:owner ?= {
			## Factor 0s.
			if = {
				limit = { has_trait = denounced }
				multiply = 0
			}
		}
	}
	ranks = {
		# Rank 1
		100 = {
			accolade_parameters = {
				accolade_defends_family_low
			}
		}
		# Rank 2
		300 = {
			accolade_parameters = {
				accolade_defends_family_low
			}
		}
		# Rank 3
		600 = {
			liege_modifier = { monthly_dynasty_prestige_mult = 0.05 }
			accolade_parameters = { acclaimed_knight_inspires_family accolade_defends_family_medium }
		}
		# Rank 4
		1000 = {
			liege_modifier = { monthly_dynasty_prestige_mult = 0.05 }
			accolade_parameters = { acclaimed_knight_inspires_family accolade_defends_family_medium }
		}
		# Rank 5
		1500 = {
			liege_modifier = { monthly_dynasty_prestige_mult = 0.15 }
			accolade_parameters = { acclaimed_knight_inspires_family_high accolade_defends_family_high }
		}
		# Rank 6
		2100 = {
			liege_modifier = { monthly_dynasty_prestige_mult = 0.15 }
			accolade_parameters = { acclaimed_knight_inspires_family_high accolade_defends_family_high }
		}
	}
}
