######################
# EXPERIENCE VALUES FOR PERK POINTS (used for add_focus_lifestyle_xp)
######################

# Use these values
miniscule_lifestyle_xp = 25
minor_lifestyle_xp = 50
medium_lifestyle_xp = 100
major_lifestyle_xp = 300
massive_lifestyle_xp = 500		# Half of xp needed for 1 perk point
monumental_lifestyle_xp = 1000	# Enough for 1 perk point... but why give XP instead of just awarding a full perk?

travel_minor_lifestyle_xp = {
	value = minor_lifestyle_xp
	multiply = 1.5
	if = {
		limit = {
			has_perk = been_there_done_that_perk
		}
		multiply = been_there_done_that_multiplier_value
	}
}

travel_medium_xp = {
	value = medium_lifestyle_xp
	multiply = 1.5
	if = {
		limit = {
			has_perk = been_there_done_that_perk
		}
		multiply = been_there_done_that_multiplier_value
	}
}

travel_major_xp = {
	value = major_lifestyle_xp
	multiply = 1.5
	if = {
		limit = {
			has_perk = been_there_done_that_perk
		}
		multiply = been_there_done_that_multiplier_value
	}
}



# DEPRECATED VALUES - DO NOT USE - WILL BE DELETED!
miniscule_lifestyle_experience = 25
minor_lifestyle_experience = 50
medium_lifestyle_experience = 100
major_lifestyle_experience = 300
massive_lifestyle_experience = 500		# Half of xp needed for 1 perk point
monumental_lifestyle_experience = 1000	# Enough for 1 perk point



#######################################
# LIFESTYLE PERK VALUES
#######################################

max_perk_amount_per_lifestyle = 30

###############
# INTRIGUE
###############

# Digging for Dirt
digging_for_dirt_perk_percentage = 25
# Court of Shadows
court_of_shadows_perk_percentage = 50
# Court of Shadows Admin Bonus
court_of_shadows_perk_admin_percentage = 10
# Prepared for Anything
prepared_for_anything_perk_secondary_percentage = 15
#Dark Insights perk values
dark_insights_stat_increase_chance = 50 # The chance of gaining a stat point from torturing people
dark_insights_prowess_increase_maximum = 5 # The maximum amount of Prowess that can be gained from Dark Insights
dark_insights_intrigue_increase_maximum = 5 # The maximum amount of Intrigue that can be gained from Dark Insights
home_advantage_perk_bonus = 50 # Bonus granted to seduce schemes against courtiers
smooth_operator_perk_bonus = 25 # Bonus granted to seduce schemes



################
# MARTIAL
################

# Courtship Perk values
courtship_court_success_chance_bonus_value = 30
elope_court_success_chance_bonus_value = 30

# Promising Prospects Perk
promising_prospects_self_value = 50
promising_prospects_other_value = 25

# Peacemaker Perk
peacemaker_value = 10

# Bellum Justum Perk
bellum_justum_discount_percentage = 50

# Strict Organization Perk
strict_organization_percentage = 20

# Hard Rule
hard_rule_military_power_increase = 20

#################
# DIPLOMACY
#################

# Adaptive Traditions Perk
adaptive_traditions_perk_impact_percent = 25

# Accomplished Forger Perk
accomplished_forger_percentage = 75

# Thicker Than Water Perk
thicker_than_water_bonus = 25

# Flatterer Perk
flatterer_bonus = 30

# True Ruler Perk
true_ruler_value = 20

# Accomplished Forger
minor_buy_claim_prestige_value = {
	value = minor_prestige_value
	multiply = 5
}
medium_buy_claim_prestige_value = {
	value = minor_buy_claim_prestige_value
	multiply = 2
}
major_buy_claim_prestige_value = {
	value = medium_buy_claim_prestige_value
	multiply = 2
}
massive_buy_claim_prestige_value = {
	value = major_buy_claim_prestige_value
	multiply = 2
}
minor_buy_claim_prestige_loss = {
	value = 0
	subtract = minor_buy_claim_prestige_value
}
medium_buy_claim_prestige_loss = {
	value = 0
	subtract = medium_buy_claim_prestige_value
}
major_buy_claim_prestige_loss = {
	value = 0
	subtract = major_buy_claim_prestige_value
}
massive_buy_claim_prestige_loss = {
	value = 0
	subtract = massive_buy_claim_prestige_value
}

groomed_to_rule_value = 20


################
# STEWARDSHIP
################

# Tax Man
tax_man_perk_percentage = 25

# Chains of Loyalty
chains_of_loyalty_percentage = 25

planned_cultivation_percentage = 20


demand_payment_current_gold_value = {
	value = scope:recipient.gold
}
demand_payment_gold_to_pay = {
	value = scope:recipient.golden_obligation_value
}

duty_focus_value = -20


###############
# LEARNING
###############

# Clerical Justifications
clerical_justifications_percentage = 20

# Learn on the Job
learn_on_the_job_percentage = 20

# Zealous Proselytizer
zealous_proselytizer_percentage = 25

# Sanctioned Loopholes
minor_buy_claim_piety_value = {
	value = minor_piety_value
	multiply = 5
}
medium_buy_claim_piety_value = {
	value = minor_buy_claim_piety_value
	multiply = 2
}
major_buy_claim_piety_value = {
	value = medium_buy_claim_piety_value
	multiply = 2
}
massive_buy_claim_piety_value = {
	value = major_buy_claim_piety_value
	multiply = 2
}
minor_buy_claim_piety_loss = {
	value = 0
	subtract = minor_buy_claim_piety_value
}
medium_buy_claim_piety_loss = {
	value = 0
	subtract = medium_buy_claim_piety_value
}
major_buy_claim_piety_loss = {
	value = 0
	subtract = major_buy_claim_piety_value
}
massive_buy_claim_piety_loss = {
	value = 0
	subtract = massive_buy_claim_piety_value
}



##############################################
# EVENT VALUES
################################################

###########################
# LIFESTYLE FRIEND VALUES #
###########################



diplomacy_foreign_affairs_focus_friend_points = {
	value = 0
	if = {
		limit = {
			OR = { #You must have a matching focus or a high skill
				has_lifestyle = diplomacy_lifestyle
				diplomacy >= decent_skill_rating
			}
		}
		add = diplomacy
		subtract = low_skill_rating
		if = {
			limit = { has_focus_or_focus_trait_trigger = { FOCUS = diplomacy_foreign_affairs_focus } }
			add = 10
		}
		if = {
			limit = { has_trait = gregarious }
			add = 5
		}
		if = {
			limit = { has_council_position = councillor_chancellor }
			add = 10
		}
	}
}


diplomacy_majesty_focus_friend_points = {
	value = 0
	if = {
		limit = {
			OR = { #You must have a matching focus or a high skill
				has_lifestyle = diplomacy_lifestyle
				diplomacy >= decent_skill_rating
			}
		}
		add = diplomacy
		subtract = low_skill_rating
		if = {
			limit = { has_focus_or_focus_trait_trigger = { FOCUS = diplomacy_majesty_focus } }
			add = 10
		}
		if = {
			limit = { has_trait = arrogant }
			add = 5
		}
		add = highest_held_title_tier
		add = prestige_level
	}
}

diplomacy_family_focus_friend_points = {
	value = 0
	if = {
		limit = {
			OR = { #You must have a matching focus or a high skill
				has_lifestyle = diplomacy_lifestyle
				diplomacy >= decent_skill_rating
			}
		}
		add = diplomacy
		subtract = low_skill_rating
		if = {
			limit = { has_focus_or_focus_trait_trigger = { FOCUS = diplomacy_family_focus } }
			add = 10
		}
		every_child = {
			limit = {
				opinion = {
					target = root
					value >= medium_positive_opinion
				}
			}
			add = 3
		}
		add = {
			value = ai_compassion
			divide = high_positive_ai_value
			multiply = 10
		}
	}
}

martial_strategy_focus_friend_points = {
	value = 0
	if = {
		limit = {
			OR = { #You must have a matching focus or a high skill
				has_lifestyle = martial_lifestyle
				martial >= decent_skill_rating
			}
		}
		add = martial
		subtract = low_skill_rating
		if = {
			limit = { has_focus_or_focus_trait_trigger = { FOCUS = martial_strategy_focus } }
			add = 10
		}
		add = {
			value = number_of_commander_traits
			multiply = 3
		}
		if = {
			limit = { has_council_position = councillor_marshal }
			add = 10
		}
	}
}

martial_authority_focus_friend_points = {
	value = 0
	if = {
		limit = {
			OR = { #You must have a matching focus or a high skill
				has_lifestyle = martial_lifestyle
				martial >= decent_skill_rating
			}
		}
		add = martial
		subtract = low_skill_rating
		if = {
			limit = { has_focus_or_focus_trait_trigger = { FOCUS = martial_authority_focus } }
			add = 10
		}
		if = {
			limit = { has_council_position = councillor_marshal }
			add = 10
		}
	}
}

martial_chivalry_focus_friend_points = {
	value = 0
	if = {
		limit = {
			OR = { #You must have a matching focus or a high skill
				has_lifestyle = martial_lifestyle
				prowess >= decent_skill_rating
			}
		}
		add = prowess
		subtract = low_skill_rating
		if = {
			limit = { has_focus_or_focus_trait_trigger = { FOCUS = martial_chivalry_focus } }
			add = 10
		}
		if = {
			limit = { has_trait = lifestyle_blademaster }
			add = 10
		}
		if = {
			limit = { has_trait = brave }
			add = 5
		}
		if = {
			limit = { is_knight = yes }
			add = 10
		}
	}
}

stewardship_wealth_focus_friend_points = {
	value = 0
	if = {
		limit = {
			OR = { #You must have a matching focus or a high skill
				has_lifestyle = stewardship_lifestyle
				stewardship >= decent_skill_rating
			}
		}
		add = stewardship
		subtract = low_skill_rating
		if = {
			limit = { has_focus_or_focus_trait_trigger = { FOCUS = stewardship_wealth_focus } }
			add = 10
		}
		add = {
			value = ai_greed
			divide = high_positive_ai_value
			multiply = 10
		}
		if = {
			limit = { has_council_position = councillor_steward }
			add = 10
		}
	}
}

stewardship_domain_focus_friend_points = {
	value = 0
	if = {
		limit = {
			OR = { #You must have a matching focus or a high skill
				has_lifestyle = stewardship_lifestyle
				stewardship >= decent_skill_rating
			}
		}
		add = stewardship
		subtract = low_skill_rating
		if = {
			limit = { has_focus_or_focus_trait_trigger = { FOCUS = stewardship_domain_focus } }
			add = 10
		}
		if = {
			limit = { has_council_position = councillor_steward }
			add = 10
		}
	}
}

stewardship_duty_focus_friend_points = {
	value = 0
	if = {
		limit = {
			OR = { #You must have a matching focus or a high skill
				has_lifestyle = stewardship_lifestyle
				stewardship >= decent_skill_rating
			}
		}
		add = stewardship
		subtract = low_skill_rating
		if = {
			limit = { has_focus_or_focus_trait_trigger = { FOCUS = stewardship_duty_focus } }
			add = 10
		}
		if = {
			limit = { has_trait = diligent }
			add = 10
		}
		every_vassal = {
			limit = {
				is_powerful_vassal = yes
				opinion = {
					target = root
					value >= medium_positive_opinion
				}
			}
			add = 3
		}
	}
}

intrigue_skulduggery_focus_friend_points = {
	value = 0
	if = {
		limit = {
			OR = { #You must have a matching focus or a high skill
				has_lifestyle = intrigue_lifestyle
				intrigue >= decent_skill_rating
			}
		}
		add = intrigue
		subtract = low_skill_rating
		if = {
			limit = { has_focus_or_focus_trait_trigger = { FOCUS = intrigue_skulduggery_focus } }
			add = 10
		}
		if = {
			limit = { has_trait = patient }
			add = 5
		}
		add = {
			value = ai_honor
			divide = high_negative_ai_value
			multiply = 10
		}
	}
}

intrigue_temptation_focus_friend_points = {
	value = 0
	if = {
		limit = {
			OR = { #You must have a matching focus or a high skill
				has_lifestyle = intrigue_lifestyle
				intrigue >= decent_skill_rating
			}
		}
		add = intrigue
		subtract = low_skill_rating
		if = {
			limit = { has_focus_or_focus_trait_trigger = { FOCUS = intrigue_temptation_focus } }
			add = 10
		}
		if = {
			limit = { has_trait = lustful }
			add = 5
		}
		add = {
			value = ai_honor
			divide = high_negative_ai_value
			multiply = 10
		}
		every_relation = {
			type = lover
			add = 3
		}
		add = {
			value = attraction
			divide = high_positive_attraction
			multiply = 10
		}
		if = {
			limit = { is_deviant_trigger = yes }
			add = 5
		}
		if = {
			limit = {
				has_trait = celibate
			}
			add = -100
		}
		if = {
			limit = {
				OR = {
					has_trait = chaste
					has_sexuality = asexual
				}
			}
			add = -10
		}
	}
}

intrigue_intimidation_focus_friend_points = {
	value = 0
	if = {
		limit = {
			OR = { #You must have a matching focus or a high skill
				has_lifestyle = intrigue_lifestyle
				intrigue >= decent_skill_rating
			}
		}
		add = intrigue
		subtract = low_skill_rating
		if = {
			limit = { has_focus_or_focus_trait_trigger = { FOCUS = intrigue_intimidation_focus } }
			add = 10
		}
		if = {
			limit = { has_trait = sadistic }
			add = 5
		}
		add = {
			value = ai_compassion
			divide = high_negative_ai_value
			multiply = 10
		}
		add = {
			value = dread
			divide = high_dread
			multiply = 10
		}
	}
}

learning_medicine_focus_friend_points = {
	value = 0
	if = {
		limit = {
			OR = { #You must have a matching focus or a high skill
				has_lifestyle = learning_lifestyle
				learning >= decent_skill_rating
			}
		}
		add = learning
		subtract = low_skill_rating
		if = {
			limit = { has_focus_or_focus_trait_trigger = { FOCUS = learning_medicine_focus } }
			add = 10
		}
		if = {
			limit = { has_trait = lifestyle_physician }
			add = 10
		}
		if = {
			limit = { has_trait = lifestyle_herbalist }
			add = 10
		}
		if = {
			limit = { has_trait = temperate }
			add = 5
		}
		add = {
			value = ai_compassion
			divide = high_negative_ai_value
			multiply = 5
		}
	}
}

learning_scholarship_focus_friend_points = {
	value = 0
	if = {
		limit = {
			OR = { #You must have a matching focus or a high skill
				has_lifestyle = learning_lifestyle
				learning >= decent_skill_rating
			}
		}
		add = learning
		subtract = low_skill_rating
		if = {
			limit = { has_focus_or_focus_trait_trigger = { FOCUS = learning_scholarship_focus } }
			add = 10
		}
		if = {
			limit = { has_trait = diligent }
			add = 5
		}
		add = {
			value = ai_rationality
			divide = high_positive_ai_value
			multiply = 5
		}
		add = {
			value = ai_zeal
			divide = high_negative_ai_value
			multiply = 3
		}
	}
}

learning_theology_focus_friend_points = {
	value = 0
	if = {
		limit = {
			OR = { #You must have a matching focus or a high skill
				has_lifestyle = learning_lifestyle
				learning >= decent_skill_rating
			}
		}
		add = learning
		subtract = low_skill_rating
		if = {
			limit = { has_focus_or_focus_trait_trigger = { FOCUS = learning_theology_focus } }
			add = 10
		}
		if = {
			limit = { has_trait = lifestyle_mystic }
			add = 10
		}
		add = {
			value = ai_zeal
			divide = high_positive_ai_value
			multiply = 5
		}
		add = {
			value = num_virtuous_traits
			multiply = 4	
		}
	}
}



#############
# DIPLOMACY #
#############

# Returns a total value between 0.0 and 1.0 based on how relevant this character is to root's chosen focus.
# Irrelevant characters tend towards 0.0 and 0.1, while highly relevant ones will tend towards 0.75 and 1.0
# Examples of highly relevant characters include a powerful vassal while in the Majesty focus, or a neighboring independent King while in the Foreign Affairs focus.
diplomacy_roots_focus_based_character_relevance_weighting = {
	value = 0
	if = {
		# Majesty-focused charaters prefer someone in their realm of high standing.
		limit = {
			root = { has_focus = diplomacy_majesty_focus }
		}
		if = {
			limit = { # Target is my direct liege.
				this = root.liege
			}
			add = 1.0
		}
		else_if = {
			limit = { # Target is one of my powerful vassals.
				is_powerful_vassal_of = root
			}
			add = 0.70
		}
		else_if = {
			limit = { # Target is one of my direct vassals.
				is_vassal_of = root
			}
			add = 0.35
		}
		else_if = {
			limit = { # Target is one of my courtiers.
				is_courtier_of = root
			}
			add = 0.05
		}
	}
	if = {
		# Family-focused characters prefer direct relations or those who are part of their dynasty.
		limit = {
			root = { has_focus = diplomacy_family_focus }
		}

		# Family Check
		if = {
			limit = {
				is_close_family_of = root
			}
			add = 0.40
		}
		else_if = {
			limit = {
				is_extended_family_of = root
			}
			add = 0.25
		}

		# Consort Check
		if = {
			limit = {
				is_spouse_of = root
			}
			add = 0.45
		}
		else_if = {
			limit = {
				is_concubine_of = root
			}
			add = 0.05
		}

		# Dynasty Check
		if = {
			limit = {
				house = root.house
			}
			add = 0.15
		}
		else_if = {
			limit = {
				dynasty = root.dynasty
			}
			add = 0.05
		}
	}
	if = {
		# Foreign Affairs-focused characters prefer those who are not in their realm.
		limit = {
			root = { has_focus = diplomacy_foreign_affairs_focus }
		}
		if = {
			limit = { # Is the ruler of a completely independent realm.
				is_independent_ruler = yes
			}
			add = 0.50
		}
		else_if = {
			limit = { # We are at least in different realms.
				NOT = { top_liege = root.top_liege }
			}
			add = 0.35
		}
		else_if = {
			limit = { # We are at least not part of the same vassal-liege chain.
				save_temporary_scope_as = this_character
				NOT = {
					target_is_liege_or_above = root
					root = { target_is_liege_or_above = scope:this_character }
				}
			}
			add = 0.10
		}

		# Foreign Affairs-focused characters also have a stronger preference for foreigners of an equal or higher rank!
		if = {
			limit = { # Same tier as us (or higher)
				NOT = { top_liege = root.top_liege }
				tier_difference = {
					target = root
					value = 0
				}
			}
			add = 0.25
		}
		else_if = {
			limit = { # Only 1 tier below us
				NOT = { top_liege = root.top_liege }
				tier_difference = {
					target = root
					value = 1
				}
			}
			add = 0.10
		}

		# It is a little weird for a vassal ruler to be debating an independent ruler of a higher rank, so we should avoid it where possible!
		if = {
			limit = {
				root = {
					is_independent_ruler = no
				}
				is_independent_ruler = yes
				highest_held_title_tier > root.highest_held_title_tier
			}
			add = -0.50
		}
	}
}


#############################
# LIFESTYLE TRAIT VALUES
#############################

### Mystic
mystic_first_rank_up_threshold = 2
mystic_second_rank_up_threshold = 3

small_lifestyle_random_xp_low = 5
small_lifestyle_random_xp_mid = 20
small_lifestyle_random_xp_high = 40
medium_lifestyle_random_xp_low = 55
medium_lifestyle_random_xp_high = 80

lifestyle_mystic_xp_gain_minor_value = {
	value = { 3 5 }
}

lifestyle_blademaster_xp_gain_minor_value = {
	value = { 3 7 }
}

negative_small_lifestyle_random_xp_low = -5
negative_small_lifestyle_random_xp_mid = -20
negative_small_lifestyle_random_xp_high = -40
negative_medium_lifestyle_random_xp_low = -55
negative_medium_lifestyle_random_xp_high = -80

trait_third_level_value = 60

################################
# LIFESTYLE WANDERER VALUES
################################
wanderer_current_lifestyle_monthly_bonus = {
	value = 0
	if = {
		limit = {
			has_trait = lifestyle_traveler
		}
		add = 10
	}
	if = {
		limit = {
			has_trait_xp = {
				trait = lifestyle_traveler
				track = travel
				value = 100
			}
		}
		add = 40
	}
	else_if = {
		limit = {
			has_trait_xp = {
				trait = lifestyle_traveler
				track = travel
				value >= 50
			}
		}
		add = 20
	}
}


voyager_journey_planner_value = {
	value = 0.8
}

wanderer_destination_prestige_value = {
	value = 50
}

wanderer_finally_there_prestige_value = {
	value = 10
}

been_there_done_that_multiplier_value = {
	value = 1.3
}

point_of_interest_prestige_value = {
	add = {
		add = medium_prestige_gain
		multiply = been_there_done_that_check_multiplier_value
	}
	add = wanderer_destination_prestige_value_with_effects
}

point_of_interest_piety_value = {
	value = medium_piety_gain
	if = {
		limit = {
			root = { has_perk = been_there_done_that_perk }
		}
		multiply = been_there_done_that_multiplier_value
	}
}

wanderer_destination_prestige_value_with_effects = {
	if = {
		limit = {
			root = { has_focus = wanderer_destination_focus }
		}
		add = {
			add = wanderer_destination_prestige_value
			multiply = been_there_done_that_check_multiplier_value
		}
	}
	if = {
		limit = {
			root = {
				has_perk = finally_there_perk 
			}
		}
		add = {
			add = wanderer_finally_there_prestige_value
			multiply = been_there_done_that_check_multiplier_value
		}
	}
}

been_there_done_that_check_multiplier_value = {
	value = 1
	if = {
		limit = {
			root = { has_perk = been_there_done_that_perk }
		}
		multiply = been_there_done_that_multiplier_value
	}
}

voyager_souvenirs_aplenty_script_value = {
	value = {
		add = location.county.development_level
		subtract = root.capital_county.development_level
		divide = 5 # Dividing it down, so there needs to be a noticeable difference between destination and capital to have an effect
		if = {
			limit = {
				is_ai = yes
			}
			divide = 2 # Dividing it down extra much for AI, so we don't see a huge boost across the world
		}
		multiply = 100 # We are multiplying it, because it will be used for development progress, rather than outright development
		min = 10
		max = voyager_souvenirs_aplenty_max_value
	}
}

voyager_souvenirs_aplenty_max_value = {
	value = 200
}

# Know your land, know your people, Perk
surveyor_marriage_perk_self_value = 50
surveyor_marriage_perk_other_value = 25

inspection_unfitting_ruler_value = {
	value = 1
	county.holder = {
		add = dread
	}
	desc = MODIFIER_DEFINITION_UNFITTING_RULER_DESC
}

internal_affairs_local_corruption_value = {
	value = 100
	subtract = county_control
	min = 1
	max = 100
	desc = MODIFIER_DEFINITION_LOCAL_CORRUPTION_DESC
}
