﻿### EK NOTE: Removed references to vanilla decisions and innovations

# Can't reference a named value that hasn't been defined yet, so this file is late in the load order
# Feel free to use other files as well, but be careful about load order
# Please remove the example formulas once there's a few real formulas


steward_learn_on_the_job_scale = {
	value = 0
	if = {
		limit = {
			liege = { has_perk = learn_on_the_job_perk }
		}
		add = stewardship
		multiply = {
			add = learn_on_the_job_percentage
			divide = 100
		}
		floor = yes
		min = 1
	}
}

kurultai_steward_learn_on_the_job_scale = {
	value = 0
	if = {
		limit = {
			liege = { has_perk = learn_on_the_job_perk }
			highest_skill = stewardship
		}
		add = stewardship
		multiply = {
			add = learn_on_the_job_percentage
			divide = 100
		}
		floor = yes
		min = 1
	}
}

### Reliable House modifier
steward_reliable_house_scale = {
	value = 0
	if = {
		limit = {
			exists = liege.dynasty
			liege.dynasty = { has_dynasty_perk = fp2_coterie_legacy_2 }
			house = liege.house
		}
		add = stewardship
		multiply = {
			add = council_reliable_house_percentage
			divide = 100
		}
		floor = yes
		min = 1
	}
}


#########################################
########## COLLECT TAXES TASK ###########
#########################################

steward_collect_taxes_scale_base = {
	add = stewardship
	divide = 2
}

steward_collect_taxes_perk_bonus_scale = {
	add = steward_collect_taxes_scale_base
	multiply = {
		add = tax_man_perk_percentage
		divide = 100
	}
}

steward_collect_taxes_erudition_bonus_scale = {
	add = steward_collect_taxes_scale_base
	multiply = {
		add = erudition_legacy_5_percentage
		divide = 100
	}
}

steward_collect_taxes_family_business_bonus_scale = {
	add = steward_collect_taxes_scale_base
	multiply = {
		add = family_business_councillors_percentage
		divide = 100
	}
}

steward_collect_taxes_consulted_house_bonus_scale = {
	add = steward_collect_taxes_scale_base
	multiply = {
		add = consulted_house_councillors_percentage
		divide = 100
	}
}

steward_collect_taxes_scale_tooltip_total = {
	add = steward_collect_taxes_scale_base
	if = {
		limit = {
			scope:councillor_liege = { has_perk = tax_man_perk }
		}
		add = steward_collect_taxes_perk_bonus_scale
	}
	if = {
		limit = {
			councillor_liege_has_erudition_legacy_5_perk = yes
		}
		add = steward_collect_taxes_erudition_bonus_scale
	}
	if = {
		limit = {
			councillor_liege_has_family_business_bonus = yes
		}
		add = steward_collect_taxes_family_business_bonus_scale
	}
	if = {
		limit = {
			councillor_liege_has_consulted_house_bonus = yes
		}
		add = steward_collect_taxes_consulted_house_bonus_scale
	}
}

steward_collect_taxes_total_scale = {
	add = steward_collect_taxes_scale_tooltip_total
	divide = 100
}

steward_collect_taxes_bonus_tax_income  = {
	add = medium_gold_value
	multiply = stewardship
	divide = 10
}

#########################################
######### DEVELOP COUNTY TASK ###########
#########################################

steward_develop_county_full_progress = {
	if = {
		limit = { exists = scope:county }
		add = scope:county.development_rate
	}
}

steward_develop_county_current_progress = {
	value = 0
	if = {
		limit = { exists = scope:county }
		add = scope:county.development_towards_level_increase
	}
}

steward_develop_county_base = {
	add = 0.1
}

steward_develop_county_monthly_increase = {
	add = stewardship
	multiply = 0.175
}

steward_develop_county_base_total = {
	add = steward_develop_county_base
	add = steward_develop_county_monthly_increase
}

steward_develop_county_modifier_scale = {
	add = steward_develop_county_base_total
	divide = 100
}

# Relation impact
steward_develop_county_monthly_increase_friend_bonus = {
	if = {
		limit = {
			scope:councillor_liege = {
				has_relation_friend = scope:councillor
				NOT = { has_relation_best_friend = scope:councillor }
			}
		}
		value = steward_develop_county_base_total
		multiply = {
			add = council_friend_impact_percentage
			divide = 100
		}
	}
}
steward_develop_county_monthly_increase_best_friend_bonus = {
	if = {
		limit = {
			scope:councillor_liege = {
				has_relation_best_friend = scope:councillor
			}
		}
		value = steward_develop_county_base_total
		multiply = {
			add = council_best_friend_impact_percentage
			divide = 100
		}
	}
}
steward_develop_county_monthly_increase_rival_bonus = {
	if = {
		limit = {
			scope:councillor_liege = {
				has_relation_rival = scope:councillor
				NOT = { has_relation_nemesis = scope:councillor }
			}
		}
		value = steward_develop_county_base_total
		multiply = {
			add = council_rival_impact_percentage
			divide = 100
		}
	}
}
steward_develop_county_monthly_increase_nemesis_bonus = {
	if = {
		limit = {
			scope:councillor_liege = {
				has_relation_nemesis = scope:councillor
			}
		}
		value = steward_develop_county_base_total
		multiply = {
			add = council_nemesis_impact_percentage
			divide = 100
		}
	}
}

steward_develop_county_perk_bonus_monthly_increase = {
	value = 0
	if = {
		limit = {
			liege = { has_perk = planned_cultivation_perk }
		}
		add = steward_develop_county_base_total
		multiply = {
			add = planned_cultivation_percentage
			divide = 100
		}
	}
}

steward_develop_county_erudition_bonus_monthly_increase = {
	value = 0
	add = steward_develop_county_base_total
	multiply = {
		add = erudition_legacy_5_percentage
		divide = 100
	}
}

steward_develop_county_family_business_monthly_increase = {
	value = 0
	add = steward_develop_county_base_total
	multiply = {
		add = family_business_councillors_percentage
		divide = 100
	}
}

steward_develop_county_consulted_house_monthly_increase = {
	value = 0
	add = steward_develop_county_base_total
	multiply = {
		add = consulted_house_councillors_percentage
		divide = 100
	}
}

steward_develop_county_total = {
	add = steward_develop_county_base
	add = steward_develop_county_monthly_increase
	add = steward_develop_county_monthly_increase_friend_bonus
	add = steward_develop_county_monthly_increase_best_friend_bonus
	add = steward_develop_county_monthly_increase_rival_bonus
	add = steward_develop_county_monthly_increase_nemesis_bonus
	add = steward_develop_county_perk_bonus_monthly_increase
	if = {
		limit = {
			councillor_liege_has_erudition_legacy_5_perk = yes
		}
		add = steward_develop_county_erudition_bonus_monthly_increase
	}
	if = {
		limit = {
			councillor_liege_has_family_business_bonus = yes
		}
		add = steward_develop_county_family_business_monthly_increase
	}
}

steward_develop_county_tribal_penalty = {
	value = 0
	if = {
		limit = {
			scope:councillor_liege = {
				should_apply_tribal_development_penalty_trigger = yes
			}
		}
		add = scope:councillor.steward_develop_county_total
		add = scope:councillor.steward_develop_county_perk_bonus_monthly_increase
		multiply = -0.5
	}
}

steward_develop_county_perk_bonus_modifier_scale = {
	value = 0
	if = {
		limit = {
			liege = { has_perk = planned_cultivation_perk }
		}
		add = steward_develop_county_modifier_scale
		multiply = 0.2
	}
}

current_development_penalty = {
	value = 0
	if = {
		limit = {
			exists = scope:county
		}
		add = scope:councillor.steward_develop_county_base_total
		add = scope:councillor.steward_develop_county_perk_bonus_monthly_increase
		add = scope:councillor.steward_develop_county_tribal_penalty
		multiply = {
			subtract = scope:county.development_level
			multiply = {
				value = 9.13 # Due to the way the development penalty is calculated, this means you reach maximum penalty at Development Level 10.
				# If you want really mathy-stuff, the formula is: Monthly Increase - (Monthly Increase(Development Level/100)*Above Number)
				if = {
					limit = { culture = { has_innovation = innovation_development_04 } }
					multiply = 0.1111 # With Rennisance Thought, this is increased to Development Level 90.
				}
				else_if = {
					limit = { culture = { has_innovation = innovation_development_03 } }
					multiply = 0.1818 # With Urbanization, Development Level 55.
				}
				else_if = {
					limit = { culture = { has_innovation = innovation_development_02 } }
					multiply = 0.2856 # With Communal Government, Development Level 35.
				}
				else_if = {
					limit = { culture = { has_innovation = innovation_development_01 } }
					multiply = 0.5000 # With the Public Works innovation, Development Level 20.
				}
			}
			divide = 100
			min = -0.875 # This is the maximum penalty.
		}
	}
}

#########################################
######### PROMOTE CULTURE TASK ##########
#########################################

steward_promote_culture_base = 0.25

steward_promote_culture_monthly_increase = {
	add = stewardship
	divide = 20
}

steward_promote_culture_contextual_bonuses = {
	# Relation Bonuses/Penalties
	if = { # Friend
		limit = {
			scope:councillor_liege = {
				has_relation_friend = scope:councillor
				NOT = { has_relation_best_friend = scope:councillor }
			}
		}
		add = {
			value = scope:councillor.steward_promote_culture_monthly_increase_friend_bonus
			desc = COUNCILLOR_IS_YOUR_FRIEND
		}
	}
	if = { # Best Friend
		limit = {
			scope:councillor_liege = {
				has_relation_best_friend = scope:councillor
			}
		}
		add = {
			value = scope:councillor.steward_promote_culture_monthly_increase_best_friend_bonus
			desc = COUNCILLOR_IS_YOUR_BEST_FRIEND
		}
	}
	if = { # Rival
		limit = {
			scope:councillor_liege = {
				has_relation_rival = scope:councillor
				NOT = { has_relation_nemesis = scope:councillor }
			}
		}
		add = {
			value = scope:councillor.steward_promote_culture_monthly_increase_rival_bonus
			desc = COUNCILLOR_IS_YOUR_RIVAL
		}
	}
	if = { # Nemesis
		limit = {
			scope:councillor_liege = {
				has_relation_nemesis = scope:councillor
			}
		}
		add = {
			value = scope:councillor.steward_promote_culture_monthly_increase_nemesis_bonus
			desc = COUNCILLOR_IS_YOUR_NEMESIS
		}
	}
	if = {
		limit = {
			councillor_liege_has_erudition_legacy_5_perk = yes
		}
		add = {
			value = steward_promote_culture_erudition_bonus
			desc = ERUDITION_DYNASTY_PERK_BONUS_VALUE
		}
	}
	if = {
		limit = {
			councillor_liege_has_family_business_bonus = yes
		}
		add = {
			value = scope:councillor.steward_promote_culture_family_business_bonus
			desc = FAMILY_BUSINESS_BONUS_VALUE
		}
	}
	if = {
		limit = {
			exists = scope:county
			scope:councillor_liege.culture = {
				is_hybrid_culture = yes
				culture_age < culture_hybrid_cooldown
				any_parent_culture = {
					this = scope:county.culture
				}
			}
		}
		add = {
			value = scope:councillor.promote_culture_hybrid_culture_vs_parents_bonus
			desc = STEWARD_PROMOTE_CULTURE_HYBRID_VS_PARENTS_BONUS_MODIFIER
		}
	}
	### EK EDIT: Communal & Cultural Identity doctrine
	# EK NOTE: As vanilla, we only give a bonus here
	# Giving a malus would make it almost impossible to get out of a wrong faith + culture combo, and culture conversion is already blocked by Nativity Regions
	if = {
		limit = {
			exists = scope:county
			scope:councillor_liege.culture = {
				is_divergent_culture = yes
				culture_age < culture_hybrid_cooldown # Intentional
				any_parent_culture = {
					this = scope:county.culture
				}
			}
		}
		add = {
			value = scope:councillor.promote_culture_divergent_culture_vs_parents_bonus
			desc = STEWARD_PROMOTE_CULTURE_DIVERGENT_VS_PARENTS_BONUS_MODIFIER
		}
	}
	if = {
		limit = {
			exists = scope:county
			scope:councillor_liege.faith = { has_doctrine = doctrine_cultural_identity_culture }
			scope:county.faith = scope:councillor_liege.faith
		}
		add = {
			value = scope:councillor.promote_culture_communal_identity_bonus
			desc = COURT_CHAPLAIN_CONVERSION_CULTURE_TIES_MODIFIER
		}
	}
	else_if = {
		limit = {
			exists = scope:county
			scope:councillor_liege.faith = { has_doctrine = doctrine_cultural_identity_culture_exclusive }
			scope:county.faith = scope:councillor_liege.faith
		}
		add = {
			value = scope:councillor.promote_culture_communal_identity_culture_exclusive_bonus
			desc = COURT_CHAPLAIN_CONVERSION_CULTURE_EXCLUSIVE_TIES_MODIFIER
		}
	}
	else_if = {
		limit = {
			exists = scope:county
			scope:councillor_liege.faith = { has_doctrine = doctrine_cultural_identity_heritage }
			scope:county.faith = scope:councillor_liege.faith
		}
		add = {
			value = scope:councillor.promote_culture_communal_identity_heritage_bonus
			desc = COURT_CHAPLAIN_CONVERSION_HERITAGE_TIES_MODIFIER
		}
	}
	else_if = {
		limit = {
			exists = scope:county
			scope:councillor_liege.faith = { has_doctrine = doctrine_cultural_identity_heritage_exclusive }
			scope:county.faith = scope:councillor_liege.faith
		}
		add = {
			value = scope:councillor.promote_culture_communal_identity_heritage_exclusive_bonus
			desc = COURT_CHAPLAIN_CONVERSION_HERITAGE_EXCLUSIVE_TIES_MODIFIER
		}
	}
	if = {
		limit = {
			exists = scope:county
			scope:councillor_liege.faith = { has_doctrine_parameter = easier_to_convert_culture_in_same_faith_mountains }
			scope:county = {
				faith = scope:councillor_liege.faith
				any_county_province = {
					OR = {
						terrain = mountains
						terrain = desert_mountains
					}
				}
			}
		}
		add = {
			value = scope:councillor.promote_culture_easier_to_convert_culture_in_same_faith_mountains_bonus
			desc = STEWARD_PROMOTE_CULTURE_EASIER_TO_CONVERT_CULTURE_IN_SAME_FAITH_MOUNTAINS_BONUS
		}
	}
	###EK DISABLED: Removed reference to vanilla innovation
	# if = {
		# limit = {
			# scope:councillor_liege.culture = {
				# has_innovation = innovation_east_settling
			# }
		# }
		# add = {
			# value = scope:councillor.promote_culture_east_settling_bonus
			# desc = STEWARD_PROMOTE_CULTURE_INNOVATION_BONUS_EAST_SETTLING
		# }
	# }
	if = {
		limit = {
			exists = scope:county
			scope:county = { has_county_modifier = 6210_architect_county_modifier }
		}
		add = {
			value = scope:councillor.6210_architect_promote_culture_bonus
			desc = COURT_CHAPLAIN_CONVERSION_LOCAL_COUNTY_MODIFIERS
		}
	}
	if = {
		limit = {
			exists = scope:county
			scope:county = { has_county_modifier = easier_to_culture_convert }
		}
		add = {
			value = scope:councillor.easier_to_convert_bonus
			desc = COURT_CHAPLAIN_CONVERSION_LOCAL_COUNTY_MODIFIERS
		}
	}
	if = {
		limit = {
			scope:councillor_liege = { has_character_modifier = court_fashion_culture_modifier }
		}
		add = {
			value = scope:councillor.steward_fashion_bonus
			desc = COUNCILLOR_LIEGE_MODIFIERS_BONUS
		}
	}
	#Reduce for various county modifiers.
	# Cultural Traditions
	## Bonuses
	if = {
		limit = {
			exists = scope:county
			scope:county.culture = { has_cultural_parameter = easier_to_convert_county_culture_with_heritage }
			scope:councillor_liege.culture = { has_same_culture_heritage = scope:county.culture }
		}
		add = {
			value = conversion_culture_easier_to_culture_change_with_heritage_value
			desc = TRADITION_EASIER_TO_CULTURE_CONVERT_WITH_HERITAGE_MODIFIER
		}
	}
	if = {
		limit = {
			councillor_liege_has_erudition_legacy_5_perk = yes
		}
		add = {
			value = steward_promote_culture_erudition_bonus_monthly_increase
			desc = ERUDITION_DYNASTY_PERK_BONUS_VALUE
		}
	}
	if = {
		limit = {
			councillor_liege_has_family_business_bonus = yes
		}
		add = {
			value = steward_promote_culture_family_business_monthly_increase
			desc = FAMILY_BUSINESS_BONUS_VALUE
		}
	}
	if = {
		limit = {
			councillor_liege_has_consulted_house_bonus = yes
		}
		add = {
			value = steward_promote_culture_consulted_house_monthly_increase
			desc = CONSULTED_HOUSE_BONUS_VALUE
		}
	}
	if = {
		limit = {
			scope:county = {
				OR = {
					has_county_modifier = 3020_own_culture_monument
					has_county_modifier = 3020_multicultural_monument
				}
			}
		}
		add = {
			value = hold_court_3020_culture_bonus
			desc = 3020_MONUMENT_VALUE
		}
	}
	## Penalties
	if = {
		limit = {
			exists = scope:county
			scope:county.culture = { has_cultural_parameter = harder_to_convert_county_culture_without_heritage }
			NOT = {
				scope:councillor_liege.culture = { has_same_culture_heritage = scope:county.culture }
			}
		}
		add = {
			value = conversion_culture_resistant_to_culture_change_without_heritage_value
			desc = TRADITION_HARDER_TO_CULTURE_CONVERT_WITHOUT_HERITAGE_MODIFIER
		}
	}

	if = {
		limit = {
			exists = scope:county
			scope:county.culture = { has_cultural_parameter = harder_to_convert_county_culture }
		}
		add = {
			value = conversion_culture_resistant_to_culture_change
			desc = TRADITION_HARDER_TO_CULTURE_CONVERT
		}
	}

	# Struggles
	## Penalties
	if = {
		limit = {
			exists = scope:county
			scope:county = {
				any_county_struggle = { has_struggle_phase_parameter = county_culture_conversion_in_region_proceeds_slower }
			}
		}
		add = {
			value = conversion_culture_resistant_to_culture_change_due_to_struggle_phase_value
			desc = STRUGGLE_HARDER_TO_CULTURE_CONVERT_DUE_TO_STRUGGLE_PHASE_MODIFIER
		}
	}
	## Bonuses
	if = {
		limit = {
			exists = scope:county
			scope:county = {
				any_county_struggle = { has_struggle_phase_parameter = county_culture_conversion_in_region_proceeds_faster }
			}
		}
		add = {
			value = conversion_culture_accepting_of_culture_change_due_to_struggle_phase_value
			desc = STRUGGLE_EASIER_TO_CULTURE_CONVERT_DUE_TO_STRUGGLE_PHASE_MODIFIER
		}
	}
	# Decisions ### EK EDIT: Removed references to vanilla heritages
	# if = {
		# limit = {
			# OR = {
				# scope:councillor_liege.culture = { has_cultural_pillar = heritage_goidelic }
				# scope:councillor_liege.culture = { has_cultural_pillar = heritage_brythonic }
			# }
			# exists = scope:county
			# scope:county = {
				# has_county_modifier = reclaim_britannia_culture_modifier
				# NOR= {
					# culture = { has_cultural_pillar = heritage_goidelic }
					# culture = { has_cultural_pillar = heritage_brythonic }
				# }
			# }
		# }
		# add = {
			# value = promote_culture_reclaimed_brittania_bonus
			# desc = STEWARD_PROMOTE_CULTURE_RECLAIMING_BRITANNIA
		# }
	# }

	#if = {
	#	limit = {
	#		scope:county.culture ?= { has_cultural_pillar = heritage_iranian }
	#		exists = global_var:fp3_struggle_ending  
	#		global_var:fp3_struggle_ending = flag:fp3_struggle_rekindle_iran_ending
#
#			NOT = {
#				scope:councillor_liege.culture = { has_same_culture_heritage = scope:county.culture }
#			}
#		}
#		add = {
#			value = conversion_culture_resistant_to_culture_change
#			desc = struggle_persia_ending_rekindle_iran_harder_to_convert_culture_reason
#		}
#	}

#	if = {
#		limit = {
#			scope:councillor_liege.culture = { has_cultural_pillar = heritage_iranian }
#			exists = global_var:fp3_struggle_ending  
#			global_var:fp3_struggle_ending = flag:fp3_struggle_rekindle_iran_ending
#
#			NOT = {
#				scope:councillor_liege.culture = { has_same_culture_heritage = scope:county.culture }
#			}
#		}
#		add = {
#			value = conversion_culture_easy
#			desc = struggle_persia_ending_rekindle_iran_harder_to_convert_culture_reason
#		}
#	}
	# Events
	if = {
		limit = {
			exists = scope:county
			scope:county = {
				has_county_modifier = governance_1073_conversion_resistance_modifier
			}
		}
		add = {
			value = scope:councillor.promote_culture_local_traditions_respected_penalty
			desc = STEWARD_PROMOTE_CULTURE_LOCAL_TRADITIONS_RESPECTED
		}
	}
	if = {
		limit  = {
			exists = scope:county
			scope:county = {
				has_county_modifier = county_shuubiyya_modifier
			}
		}
		add = {
			value = scope:councillor.promote_culture_shuubiyya_penalty
			desc = STEWARD_PROMOTE_CULTURE_SHUUBIYYA
		}
	}
	if = {
		limit = {
			exists = scope:county
			scope:county = {
				OR = {
					has_county_modifier = enthusiastic_nomad_settlement_saharan_modifier
					has_county_modifier = nomad_settlement_saharan_modifier
				}
			}
		}
		add = {
			value = scope:councillor.promote_culture_allowed_nomad_settlement_penalty
			desc = STEWARD_PROMOTE_CULTURE_ALLOWED_NOMAD_SETTLEMENT
		}
	}
	if = {
		limit = {
			exists = scope:county
			scope:county = { has_county_modifier = hold_court_8190_vassal_modifier }
		}
		add = {
			value = scope:councillor.court_8190_vassal_modifier_value
			desc = COURT_CHAPLAIN_CONVERSION_LOCAL_COUNTY_MODIFIERS
		}
	}
	
	### EK EDIT: Slashed the speed of culture conversion, unless you're native to the province
	### NOTE: WHEN ADDING A NEW REGION NATIVITY/EDITING EXISTING ONES, DON'T FORGET TO PUT IT HERE
	### NOTE: For now it has to be handled manually, but at one point I'd love to be able to just read a list and use @ or whatnot to have a generic trigger
	# Something like
	# AND = {
		# scope:county.title_province = { geographical_region = custom_nativity_@REGION }
		# scope:councillor_liege.culture = { has_innovation = innovation_native_@REGION }
	# }
	if = {
		limit  = {
			exists = scope:county
			exists = scope:county.var:culture_to_convert
		}
		if = { # Is our culture native from here?
			limit = {
				scope:county = {
					is_target_in_variable_list = {
						name = native_culture_list
						target = scope:county.var:culture_to_convert
					}
				}
			}
		}
		else_if = { # What if we're an Orcish culture being settled in Orsinium? Which is treated as if the culture in question was native
			limit = { 
				scope:county.var:culture_to_convert = { has_cultural_parameter = can_found_orsinium } 
				scope:county = { target_is_de_jure_liege_or_above = title:k_orsinium }
			}
		}
		else_if = { # We aren't native, but are we nomadic?
			limit = { scope:county.var:culture_to_convert = { has_innovation = innovation_native_nomadic } }
			add = {
				value = scope:councillor.promote_culture_nomadic_culture_convert_to
				desc = NOMADIC_CULTURE_CULTURE_CONVERT_TO
			}
		}
		else = { # We aren't welcome here
			add = {
				value = scope:councillor.promote_culture_not_native_culture_convert_to
				desc = NOT_NATIVE_REGION_REASON
			}
		}
	}
	else_if = {
		limit  = { exists = scope:county }
		if = { # Is our culture native from here?
			limit = {
				scope:county = {
					is_target_in_variable_list = {
						name = native_culture_list
						target = scope:councillor_liege.culture
					}
				}
			}
		}
		else_if = { # We aren't native, but are we nomadic?
			limit = { scope:councillor_liege.culture = { has_innovation = innovation_native_nomadic } }
			add = {
				value = scope:councillor.promote_culture_nomadic_culture_convert_to
				desc = NOMADIC_CULTURE_CULTURE_CONVERT_TO
			}
		}
		else = { # We aren't welcome here
			add = {
				value = scope:councillor.promote_culture_not_native_culture_convert_to
				desc = NOT_NATIVE_REGION_REASON
			}
		}
	}
	else = {}
	if = {
		limit = {
			# Nomadic cultures are easier to convert
			scope:county.culture = { has_innovation = innovation_native_nomadic }
		}
		add = {
			value = scope:councillor.promote_culture_nomadic_culture_convert_from
			desc = NOMADIC_CULTURE_CULTURE_CONVERT_FROM
		}
	}
}

steward_promote_culture_monthly_increase_friend_bonus = {
	value = steward_promote_culture_monthly_increase
	multiply = {
		value = council_friend_impact_percentage
		divide = 100
	}
}

steward_promote_culture_base_total = {
	add = steward_promote_culture_base
	add = steward_promote_culture_monthly_increase
}

steward_promote_culture_monthly_increase_best_friend_bonus = {
	value = steward_promote_culture_base_total
	multiply = {
		value = council_best_friend_impact_percentage
		divide = 100
	}
}
steward_promote_culture_monthly_increase_rival_bonus = {
	value = steward_promote_culture_base_total
	multiply = {
		value = council_rival_impact_percentage
		divide = 100
	}
}
steward_promote_culture_monthly_increase_nemesis_bonus = {
	value = steward_promote_culture_base_total
	multiply = {
		value = council_nemesis_impact_percentage
		divide = 100
	}
}

steward_promote_culture_erudition_bonus = {
	add = steward_promote_culture_base_total
	multiply = {
		add = erudition_legacy_5_percentage
		divide = 100
	}
}

steward_promote_culture_family_business_bonus = {
	add = steward_promote_culture_base_total
	multiply = {
		add = family_business_councillors_percentage
		divide = 100
	}
}

### EK EDIT: Cultural & Communal Identity doctrines
promote_culture_communal_identity_bonus = {
	value = 0
	add = steward_promote_culture_base_total
	multiply = 0.50
}

promote_culture_easier_to_convert_culture_in_same_faith_mountains_bonus_root_value = 0.5

promote_culture_easier_to_convert_culture_in_same_faith_mountains_bonus_loc_control = {
	value = promote_culture_easier_to_convert_culture_in_same_faith_mountains_bonus_root_value
	multiply = 100
}

promote_culture_easier_to_convert_culture_in_same_faith_mountains_bonus = {
	value = steward_promote_culture_base_total
	multiply = promote_culture_easier_to_convert_culture_in_same_faith_mountains_bonus_root_value
}

###EK ADDITION
promote_culture_communal_identity_culture_exclusive_bonus = {
	value = 0
	add = steward_promote_culture_base_total
	multiply = 1
}
promote_culture_communal_identity_heritage_bonus = {
	value = 0
	add = steward_promote_culture_base_total
	multiply = 0.25
}
promote_culture_communal_identity_heritage_exclusive_bonus = {
	value = 0
	add = steward_promote_culture_base_total
	multiply = 0.5
}
#####EK ADDITION END

promote_culture_hybrid_culture_vs_parents_bonus = {
	value = 0
	add = steward_promote_culture_base_total
	multiply = 1.5
}

promote_culture_divergent_culture_vs_parents_bonus = {
	value = 0
	add = steward_promote_culture_base_total
	multiply = 1.3
}

promote_culture_east_settling_bonus = {
	value = 0
	add = steward_promote_culture_base_total
	multiply = 0.15
}

promote_culture_reclaimed_brittania_bonus = {
	value = steward_promote_culture_base_total
	multiply = 0.75
}

promote_culture_beth_nahrain_bonus = {
	value = steward_promote_culture_base_total
	multiply = 0.75
}

steward_promote_culture_erudition_bonus_monthly_increase = {
	value = steward_promote_culture_base_total
	multiply = {
		add = erudition_legacy_5_percentage
		divide = 100
	}
}

steward_promote_culture_family_business_monthly_increase = {
	value = steward_promote_culture_base_total
	multiply = {
		add = family_business_councillors_percentage
		divide = 100
	}
}

steward_promote_culture_consulted_house_monthly_increase = {
	value = steward_promote_culture_base_total
	multiply = {
		add = consulted_house_councillors_percentage
		divide = 100
	}
}

hold_court_3020_culture_bonus = {
	value = 0.1
}

promote_culture_local_traditions_respected_penalty = {
	value = 0
	add = steward_promote_culture_base_total
	multiply = -0.75
}

promote_culture_shuubiyya_penalty = {
	value = 0
	if = {
		limit = {
			exists = scope:county
			scope:county = {
				has_county_modifier = county_shuubiyya_modifier
			}
		}
		add = steward_promote_culture_base_total
		multiply = -0.75
	}
}

promote_culture_allowed_nomad_settlement_penalty = {
	value = 0
	add = steward_promote_culture_base_total
	multiply = -0.8
}

promote_culture_development_penalty = {
	value = 0
	if = {
		limit = { exists = scope:county }
		add = scope:councillor.steward_promote_culture_base_total
		add = scope:councillor.steward_promote_culture_contextual_bonuses
		multiply = {
			subtract = scope:county.development_level
			divide = 100
			min = -0.9
		}
	}
}

conversion_culture_easier_to_culture_change_with_heritage_value = {
	value = 0
	add = steward_promote_culture_base
	multiply = 0.3
}

conversion_culture_resistant_to_culture_change_without_heritage_value = {
	value = 0
	subtract = steward_promote_culture_base_total
	multiply = 0.5
}

conversion_culture_resistant_to_culture_change = {
	value = 0
	subtract = steward_promote_culture_base_total
	multiply = 0.5
}

conversion_culture_resistant_to_culture_change_due_to_struggle_phase_value = {
	value = 0
	subtract = steward_promote_culture_base
	multiply = 0.5
}

conversion_culture_accepting_of_culture_change_due_to_struggle_phase_value = {
	value = 0
	subtract = steward_promote_culture_base
	multiply = -0.5
}

conversion_culture_easy = {
	value = 0
	add = steward_promote_culture_base_total
	multiply = 0.5
}

###EK ADDITION: Nativity
promote_culture_nomadic_culture_convert_to = {
	value = 0
	add = steward_promote_culture_base_total
	multiply = -0.5
}
promote_culture_not_native_culture_convert_to = {
	value = 0
	add = steward_promote_culture_base_total
	multiply = -0.71
}

promote_culture_nomadic_culture_convert_from = {
	value = 0
	add = steward_promote_culture_base_total
	multiply = 1
}
#EK ADDITION END

#########################################
######## CONVINCE DE JURE TASK ##########
#########################################

steward_convince_dejure_base = 0.1

steward_convince_dejure_monthly_increase = {
	add = stewardship
	divide = 20
}

steward_convince_dejure_monthly_increase_friend_bonus = {
	value = steward_convince_dejure_monthly_increase
	multiply = {
		value = council_friend_impact_percentage
		divide = 100
	}
}
steward_convince_dejure_base_total = {
	add = steward_convince_dejure_monthly_increase
	add = steward_convince_dejure_monthly_increase_friend_bonus
}
steward_convince_dejure_monthly_increase_best_friend_bonus = {
	value = steward_convince_dejure_base_total
	multiply = {
		value = council_best_friend_impact_percentage
		divide = 100
	}
}
steward_convince_dejure_monthly_increase_rival_bonus = {
	value = steward_convince_dejure_base_total
	multiply = {
		value = council_rival_impact_percentage
		divide = 100
	}
}
steward_convince_dejure_monthly_increase_nemesis_bonus = {
	value = steward_convince_dejure_base_total
	multiply = {
		value = council_nemesis_impact_percentage
		divide = 100
	}
}

steward_convince_dejure_erudition_bonus = {
	add = steward_convince_dejure_base_total
	multiply = {
		add = erudition_legacy_5_percentage
		divide = 100
	}
}

steward_convince_dejure_family_business_bonus = {
	add = steward_convince_dejure_base_total
	multiply = {
		add = family_business_councillors_percentage
		divide = 100
	}
}

steward_convince_dejure_consulted_house_bonus = {
	add = steward_convince_dejure_base_total
	multiply = {
		add = consulted_house_councillors_percentage
		divide = 100
	}
}

#########################################
######### ACCEPT CULTURE TASK ###########
#########################################

task_accept_culture_base_progress = {
	value = 0.01
	multiply = scope:councillor_liege.primary_title.tier
}

steward_accept_culture_base_total = {
	add = task_accept_culture_base_progress
	add = steward_accept_culture_yearly_increase
}

steward_accept_culture_yearly_increase = {
	add = stewardship
	multiply = 0.005
}

steward_accept_culture_erudition_bonus_yearly_increase = {
	add = steward_accept_culture_base_total
	multiply = {
		add = erudition_legacy_5_percentage
		divide = 100
	}
}

steward_accept_culture_customs_bonus_yearly_increase = {
	add = steward_accept_culture_base_total
	multiply = {
		add = customs_legacy_percentage
		divide = 100
	}
}

# Relation impact
steward_accept_culture_yearly_increase_friend_bonus = {
	if = {
		limit = {
			scope:councillor_liege = {
				has_relation_friend = scope:councillor
				NOT = { has_relation_best_friend = scope:councillor }
			}
		}
		value = steward_accept_culture_base_total
		multiply = {
			add = council_friend_impact_percentage
			divide = 100
		}
	}
}
steward_accept_culture_yearly_increase_best_friend_bonus = {
	if = {
		limit = {
			scope:councillor_liege = {
				has_relation_best_friend = scope:councillor
			}
		}
		value = steward_accept_culture_base_total
		multiply = {
			add = council_best_friend_impact_percentage
			divide = 100
		}
	}
}
steward_accept_culture_yearly_increase_rival_bonus = {
	if = {
		limit = {
			scope:councillor_liege = {
				has_relation_rival = scope:councillor
				NOT = { has_relation_nemesis = scope:councillor }
			}
		}
		value = steward_accept_culture_base_total
		multiply = {
			add = council_rival_impact_percentage
			divide = 100
		}
	}
}
steward_accept_culture_yearly_increase_nemesis_bonus = {
	if = {
		limit = {
			scope:councillor_liege = {
				has_relation_nemesis = scope:councillor
			}
		}
		value = steward_accept_culture_base_total
		multiply = {
			add = council_nemesis_impact_percentage
			divide = 100
		}
	}
}
steward_accept_culture_yearly_increase_independent_bonus = {
	value = 0
	if = {
		limit = {
			scope:councillor_liege = {
				is_independent_ruler = yes
			}
		}
		add = {
			value = steward_accept_culture_base_total
			multiply = 5
		}
	}
}

steward_accept_culture_court_type_bonus = {
	value = 0
	if = {
		limit = {
			scope:councillor_liege = {
				has_royal_court = yes
				has_dlc_feature = royal_court
				has_court_type = court_administrative
				court_grandeur_current_level >= 4
			}
		}
		add = steward_accept_culture_base_total
		multiply = {
			value = court_administrative_steward_task_bonus
			divide = 100
		}
	}
}

task_accept_culture_total_base_value = {
	add = task_accept_culture_base_progress
	add = steward_accept_culture_yearly_increase
	if = {
		limit = {
			councillor_liege_has_customs_legacy_perk = yes
		}
		add = steward_accept_culture_customs_bonus_yearly_increase
	}
	if = {
		limit = {
			councillor_liege_has_erudition_legacy_5_perk = yes
		}
		add = steward_accept_culture_erudition_bonus_yearly_increase
	}
	add = steward_accept_culture_yearly_increase_friend_bonus
	add = steward_accept_culture_yearly_increase_best_friend_bonus
	add = steward_accept_culture_yearly_increase_rival_bonus
	add = steward_accept_culture_yearly_increase_nemesis_bonus
	if = {
		limit = {
			councillor_liege_has_family_business_bonus = yes
		}
		add = steward_accept_culture_family_business_bonus_yearly_increase
	}
	if = {
		limit = {
			exists = scope:county
			scope:councillor.culture = scope:county.culture
		}
		add = steward_accept_culture_yearly_increase_same_culture_bonus
	}
}

task_accept_culture_progress = {
	add = task_accept_culture_base_progress
	add = steward_accept_culture_yearly_increase
	if = {
		limit = {
			councillor_liege_has_customs_legacy_perk = yes
		}
		add = steward_accept_culture_customs_bonus_yearly_increase
	}
	if = {
		limit = {
			councillor_liege_has_erudition_legacy_5_perk = yes
		}
		add = steward_accept_culture_erudition_bonus_yearly_increase
	}
	if = {
		limit = {
			councillor_liege_has_family_business_bonus = yes
		}
		add = steward_accept_culture_family_business_bonus_yearly_increase
	}
	if = {
		limit = {
			councillor_liege_has_consulted_house_bonus = yes
		}
		add = steward_accept_culture_consulted_house_bonus_yearly_increase
	}
	add = steward_accept_culture_yearly_increase_friend_bonus
	add = steward_accept_culture_yearly_increase_best_friend_bonus
	add = steward_accept_culture_yearly_increase_rival_bonus
	add = steward_accept_culture_yearly_increase_nemesis_bonus
	add = steward_accept_culture_yearly_increase_independent_bonus
	add = steward_accept_culture_court_type_bonus
	if = {
		limit = {
			exists = scope:county
			scope:councillor.culture = scope:county.culture
		}
		add = steward_accept_culture_yearly_increase_same_culture_bonus
	}
}

steward_accept_culture_family_business_bonus_yearly_increase = {
	add = steward_accept_culture_base_total
	multiply = {
		add = family_business_councillors_percentage
		divide = 100
	}
}

steward_accept_culture_consulted_house_bonus_yearly_increase = {
	add = steward_accept_culture_base_total
	multiply = {
		add = consulted_house_councillors_percentage
		divide = 100
	}
}

steward_accept_culture_yearly_increase_same_culture_bonus = {
	value = steward_accept_culture_base_total
	multiply = 0.25
}
