﻿stalwart_leader_perk = {
	lifestyle = martial_lifestyle
	tree = chivalry
	position = { 1 0 }
	icon = node_martial

	auto_selection_weight = {
		value = 11
		if = {
			limit = {
				has_education_martial_trigger = yes
			}
			add = 1989
		}
		if = {
			limit = {
				has_focus = martial_chivalry_focus
			}
			multiply = 5
		}
		if = {
			limit = {
				can_start_new_lifestyle_tree_trigger = no
			}
			multiply = 0
		}
	}

	government_character_modifier = {
		flag = government_is_landless_adventurer
		trait_track_foot_xp_gain_mult = 0.2
	}

	character_modifier = {
		prowess = 4
		trait_track_foot_xp_gain_mult = 0.05
	}

	effect = {
		custom_description_no_bullet = {
			text = stalwart_leader_perk_effect
		}
		if = {
			limit = { government_has_flag = government_is_nomadic }
			custom_description_no_bullet = { text = unlock_dueling_for_everyone_effect }
		}
		else_if = {
			limit = {
				culture ?= { has_cultural_parameter = stalwart_leader_non_admin_duels }
			}
			custom_description_no_bullet = { text = unlocks_stalwart_leader_non_admin_duels_effect }
		}
		else = {
			custom_description_no_bullet = { text = unlock_dueling_rivals_effect }
		}

		if = {
			limit = {
				government_has_flag = government_is_landless_adventurer
				has_ep2_dlc_trigger = yes
			}
			custom_tooltip = {
				text = adventurer_stalwart_leader_perk_effect
			}
		}
	}
}

courtship_perk = {
	lifestyle = martial_lifestyle
	tree = chivalry
	position = { 0 1 }
	icon = node_martial

	parent = stalwart_leader_perk

	government_character_modifier = {
		flag = government_is_landless_adventurer
		courting_scheme_phase_duration_add = monumental_scheme_phase_duration_bonus_value
		elope_scheme_phase_duration_add = monumental_scheme_phase_duration_bonus_value
	}

	character_modifier = {
		courting_scheme_phase_duration_add = medium_scheme_phase_duration_bonus_value
		elope_scheme_phase_duration_add = medium_scheme_phase_duration_bonus_value
	}
	effect = {
		custom_description_no_bullet = {
			text = courtship_perk_effect
		}
	}
}

promising_prospects_perk = {
	lifestyle = martial_lifestyle
	tree = chivalry
	position = { 0 2 }
	icon = node_martial

	parent = courtship_perk

	effect = {
		custom_description_no_bullet = {
			text = promising_prospects_perk_effect
		}
	}
}

loyalty_and_respect_perk = {
	lifestyle = martial_lifestyle
	tree = chivalry
	position = { 0 3 }
	icon = node_martial

	parent = promising_prospects_perk

	effect = {
		if = {
			limit = {
				NOT = { government_has_flag = government_is_landless_adventurer }
			}
			custom_description_no_bullet = {
				text = loyalty_and_respect_perk_stats_effect
			}
		}
		if = {
			limit = {
				government_has_flag = government_is_nomadic
			}
			custom_description_no_bullet = {
				text = loyalty_and_respect_perk_obedience_effect
			}
		}
		if = {
			limit = {
				government_has_mechanic = administrative
				government_allows = merit
			}
			custom_description_no_bullet = {
				text = candidate_pool_loyalty_and_respect_perk_effect
			}
		}
	}

	government_character_modifier = {
		flag = government_is_landless_adventurer
		trait_track_wit_xp_gain_mult = 0.25
	}

	character_modifier = {
		spouse_opinion = 50
	}
}

chivalric_dominance_perk = {
	lifestyle = martial_lifestyle
	tree = chivalry
	position = { 2 1 }
	icon = node_martial

	parent = stalwart_leader_perk

	government_character_modifier = {
		flag = government_is_administrative
		invert_check = yes
		knight_effectiveness_mult = 0.75
	}
	government_character_modifier = {
		flag = government_is_landless_adventurer
		invert_check = yes
		accolade_glory_gain_mult = 0.1
	}

	government_character_modifier = {
		flag = government_is_landless_adventurer
		trait_track_horse_xp_gain_mult = 0.25
	}
	government_character_modifier = {
		flag = government_is_administrative
		same_heritage_county_advantage_add = 5
	}

	effect = {
		if = {
			limit = {
				has_pam_dlc_trigger = yes
				actor_incite_holy_war_shown_trigger = yes
			}
			custom_description_no_bullet = { text = chivalric_dominance_perk_incite_war_effect }
		}
	}
}

never_back_down_perk = {
	lifestyle = martial_lifestyle
	tree = chivalry
	position = { 2 2 }
	icon = node_martial

	parent = chivalric_dominance_perk

	character_modifier = {
		advantage = 5
		hard_casualty_modifier = -0.2
		tourney_participant_xp_gain_mult = 0.1
	}
}

kingsguard_perk = {
	lifestyle = martial_lifestyle
	tree = chivalry
	position = { 2 3 }
	icon = node_martial

	parent = never_back_down_perk

	government_character_modifier = {
		flag = government_is_landless_adventurer
		trait_track_bow_xp_gain_mult = 0.25
	}

	government_character_modifier = {
		flag = government_is_administrative
		invert_check = yes
		knight_limit = 4
	}
	government_character_modifier = {
		flag = government_is_administrative
		knight_limit = 2
	}
	government_character_modifier = {
		flag = government_is_theocracy
		enemy_hostile_scheme_success_chance_add = -5
		character_travel_safety = 10
	}
}

peacemaker_perk = {
	lifestyle = martial_lifestyle
	tree = chivalry
	position = { 1 4 }
	icon = node_martial

	parent = loyalty_and_respect_perk
	parent = kingsguard_perk

	effect = {
		custom_description_no_bullet = { text = peacemaker_perk_effect }
		if = {
			limit = {
				government_has_flag = government_is_mandala
				house ?= { has_house_aspiration_parameter = aspect_of_serenity }
				is_house_head = yes
			}
			custom_description_no_bullet = { text = mandala_peacemaker_perk_serenity_effect }
		}
	}
}

gallant_perk = {
	lifestyle = martial_lifestyle
	tree = chivalry
	position = { 1 5 }
	icon = trait_gallant

	parent = peacemaker_perk

	trait = gallant
	effect = {
		add_trait_force_tooltip = gallant
	}
}
