﻿NCharacter = {

	RANDOM_CHARACTER_MIN_FERTILITY = 0.4
	RANDOM_CHARACTER_MAX_FERTILITY = 0.8

	#CHANGED

	RANDOM_CHARACTER_MIN_HEALTH = 3.6
	RANDOM_CHARACTER_MAX_HEALTH = 4.9
	RANDOM_CHARACTER_AGE_MIN_HEALTH = 2.6 # This is the minimum starting base health characters get after adjustments for age
	
	#CHANGED
	
	BASE_FERTILITY = 0.62 #CHANGED 0.5
	BASE_HEALTH = 4.2 #CHANGED 5.0
	
	MALE_ATTRACTION_CUTOFF_AGE = 59		# After this age, the attraction of traits no longer have any effect #changed 65
	FEMALE_ATTRACTION_CUTOFF_AGE = 46	# After this age, the attraction of traits no longer have any effect #changed 50

	#Health levels and descriptions for every level
	HEALTH_STATE_LEVELS_VALUES = {
		0.0
		1.5
		3.0
		4.5
		6.0
	}


}

NOldAge = {
	LOWER_HEALTH_START_AGE = 27 # At this age characters start getting the chance to lose health each year
	LOWER_HEALTH_BASE_CHANCE = 0.08 # This is the base chance of losing health at the START_AGE #CHANGED 0.075
	LOWER_HEALTH_YEARLY_INCREASE = 0.02 # This is the yearly increase of the chance to lose health #CHANGED 0.022
	LOWER_HEALTH_AMOUNT = -0.100 # This is the health change on each failed yearly health roll #CHANGED -0.125
	HEALTH_PENALTY_PER_YEAR_IN_POOL = 0.1 # For each year in the pool, your effective health is this much lower. This disappears entirely when you leave the pool 
	
	# This DIE values are used with a quadratic chance.
	DIE_HEALTH_TRESHOLD = 2.9 # Characters have a chance to die each DEATH_CHECK_INTERVAL days they have less health than this #CHANGED 3.0
	DIE_HEALTH_CHANCE_ZERO = 0.5 # This is the DEATH_CHECK_INTERVAL chance that a character dies at zero health (or lower)
	
	DEATH_CHECK_INTERVAL = 21 # Check if the character should die from health this often (in days)
	DEATH_MINIMUM_DELAY = 7 # If marked for death, they will die at least this many days after the check
	DEATH_MAXIMUM_DELAY = 21 # If marked for death, they will die no more than this many days after the check. With these numbers, that means if someone becomes deathly ill, they have a high chance of dying between 7 and 40 days (30 days from the DEATH_CHECK_INTERVAL) after contracting the health penalty

	LOWER_PROWESS_START_AGE = 42 # At this age characters start getting the chance to lose prowess each year
	LOWER_PROWESS_BASE_CHANCE = 0.1 # This is the base chance of losing prowess at the START_AGE
	LOWER_PROWESS_YEARLY_INCREASE = 0.015 # This is the yearly increase of the chance to lose prowess
	LOWER_PROWESS_MAX_CHANCE = 0.75 # This is the maximum chance to lose prowess
	LOWER_PROWESS_FACTOR = 0.1 # This is the prowess change mutliplier on each failed yearly roll
	
}

NChildbirth = {
	MIN_REPRODUCTION_AGE_IN_HISTORY_DB = 12 # If a historical parent is younger than this when their child is born, we log an error
	MIN_FEMALE_REPRODUCTION_AGE = 16
	MAX_FEMALE_REPRODUCTION_AGE = 45
	MIN_MALE_REPRODUCTION_AGE = 16
	BASE_NR_OF_CHILDREN_PER_COUPLE = { 2 2 3 4 4 4 } # Based on tier of character or parents; whichever is higher Unlanded, Baron, Count, ..., Emperor
	CHANCE_OF_LOWERED_CHILD_LIMIT = 0.2	# Chance that the child limit is lowered by 1
	EXTRA_CHILDREN_FOR_RULERS = 2 # If either character is a ruler, they get extra children
	CHARACTER_IN_POOL_CHILD_LIMIT = -2	# If in the pool, child limit is modified by this
	CHILD_BIRTH_TO_PREGNANCY_WAIT = 3
	MALE_FERTILITY_MULTIPLIER_LIMITS = { 70 60 50 40 35 } # Ages where fertility multiplier is applied 25 means up to 25, needs to be sorted in descending order
	MALE_FERTILITY_MULTIPLIER = { 0.1 0.2 0.4 0.8 0.9 1.0 } # Multiplier values based on age limits from FERTILITY_MULTIPLIER_LIMITS should have an extra value at the beginning for characters older than first limit
	FEMALE_FERTILITY_MULTIPLIER_LIMITS = { 40 36 32 27 23 } # Ages where fertility multiplier is applied 25 means up to 25, needs to be sorted in descending order
	FEMALE_FERTILITY_MULTIPLIER = { 0.1 0.2 0.4 0.6 0.8 1.0 } # Multiplier values based on age limits from FERTILITY_MULTIPLIER_LIMITS should have an extra value at the beginning for characters older than first limit
	MOTHER_FERTILITY_REDUCTION_PER_PREVIOUS_CHILD = 0.05
	LOW_FERTILITY = 0.1
	PRIMARY_SPOUSE_FERTILITY_MULTIPLIER = 1
	SECONDARY_SPOUSE_FERTILITY_MULTIPLIER = 0.6
	CONCUBINE_FERTILITY_MULTIPLIER = 0.6
	NOT_SPOUSE_FERTILITY_MULTIPLIER = 0.4
	NON_RULER_FERTILITY_MULTIPLIER = 0.6	# If neither parent is a ruler, resulting fertility gets multiplied by this
	FERTILITY_CHANCE_MULTIPLIER = 5.15 # Fertility is an average between the father and the mother (if the mother has 0.3 and the father 0.5, the average is 0.4), this number is then multiplied by this multiplier to produce the percentage chance of impregnation. Impregnation is checked every month. #CHANGED 4.75 
	MIN_FERTILITY_CHANCE = 1
	MAX_FERTILITY_CHANCE = 30
	TWIN_BASE_CHANCE = 0.03
	TWIN_BONUS_MAX_AGE = 35
	TWIN_BONUS_MIN_AGE = 20
	TWIN_BONUS_CHANCE = 0.04
	TWIN_MOTHER_HAD_TWINS_BONUS = 0.06
	TWIN_GRANDMOTHER_HAD_TWINS_BONUS = 0.03
	IDENTICAL_TWIN_CHANCE = 0.02
	PREGNANCY_DAYS = 280
	DAYS_TO_PREGNANCY_REVEAL = 60
	FEMALE_CHANCE = 44
	NEWBORN_HEALTH_BASE = 3.3
	NEWBORN_HEALTH_SPAN = 1.9
	NEWBORN_HEALTH_FEMALE_BONUS = 0.1
	INHERIT_RECESSIVE_GENE_CHANCE = 0.25	# Probability of a recessive gene being picked as a child's dominant/recessive gene. Only used for portraits

	ACTIVE_TRAIT_CHANCE_ACTIVE_ACTIVE = 55			# Chance of outright inheriting a genetic trait if both parents have it
	ACTIVE_TRAIT_CHANCE_ACTIVE_INACTIVE = 40		# Chance of outright inheriting a genetic trait if one parent has it, and one is carrying it recessively
	ACTIVE_TRAIT_CHANCE_ACTIVE_NONE = 25			# Chance of outright inheriting a genetic trait if one parent has it
	ACTIVE_TRAIT_CHANCE_INACTIVE_INACTIVE = 15		# Chance of outright inheriting a genetic trait if both parents are carrying it
	ACTIVE_TRAIT_CHANCE_INACTIVE_NONE = 5			# Chance of outright inheriting a genetic trait if one parent is carrying it
	INACTIVE_TRAIT_CHANCE_ACTIVE_ACTIVE = 100		# Chance of recessively inheriting a genetic trait if both parents have it. Deliberately over 100% so even if it is a bad trait, the modifiers to inheritance won't let you avoid it
	INACTIVE_TRAIT_CHANCE_ACTIVE_INACTIVE = 80		# Chance of recessively inheriting a genetic trait if one parent has it, and one is carrying it recessively
	INACTIVE_TRAIT_CHANCE_ACTIVE_NONE = 60     		# Chance of recessively inheriting a genetic trait if one parent has it
	INACTIVE_TRAIT_CHANCE_INACTIVE_INACTIVE = 45		# Chance of recessively inheriting a genetic trait if both parents are carrying it
	INACTIVE_TRAIT_CHANCE_INACTIVE_NONE = 30		# Chance of recessively inheriting a genetic trait if one parent is carrying it
	
	# General logic for tiered trait inheritance:
	# 1. Start from highest trait
	# 2. Calc active chance. Lower tiers ( including inactive ) count as inactive of the tier. Each level down beyond the first multiplies chance by a define
	# 3. If active, use it; DONE
	# 4. Otherwise, go down a tier, if inactive pretend 1 more parent has that tier active, otherwise 1 more parent has it inactive.GOTO 2
	MATCHED_TRAIT_DIFFERENCE_MULT = 0.2				# 0.2 When trying to inherit a tiered genetic trait, and the other person has one of lower tier, we pretend that means they've  got the higher tier one recessively, and reduce the chance of inheritance by this much per tier further down than 1 the other parent's trait is
	TIER_TRAIT_REDUCTION_MULT = 0.4					# 0.4 When going down a tier, add this chance
	
	FERTILITY_LEVELS = {
		0.0
		0.2
		0.6
		0.8 }	# The thresholds for each fertility level
		
	EXTRA_CHILDREN_FOR_PLAYERS = 0 # Num of extra children players can have before reaching living child limit
	EXTRA_CHILDREN_PER_EXTRA_SPOUSE = 1 # Num of extra children per spouse above one before reaching living child limit
	EXTRA_CHILDREN_PER_EXTRA_CONCUBINE = 1 # Num of extra children per concubine above one before reaching living child limit
	EXTRA_FERTILITY_FOR_FIRST_CHILD = 0.0 # Extra fertility if the couple are primary spouses and have no children together
	EXTRA_FERTILITY_FOR_FIRST_RULER_CHILD = 0.4 # Extra fertility if the couple are primary spouses and have no children together, and at least one of them is a ruler
	DIVINE_MARRIAGE_FERTILITY_MULTIPLIER = 0.9 # Multiplier if the couple is close or extended family and their faith allows divine marriage
	CLOSE_FAMILY_FERTILITY_MULTIPLIER = 0.9 # Multiplier if the couple is close family and their faith does not allow divine marriage
	EXTENDED_FAMILY_FERTILITY_MULTIPLIER = 0.9 # Multiplier if the couple is extended family and their faith does not allow divine marriage
	FERTILITY_IN_POOL_MULTIPLIER = 0.15	# Characters in the pool will have their fertility multiplied by this
}