﻿#0DDA81669D82071FFC98852036157A7D2A020645

#8866F12120CAB1B7B6F6BEBC1B52B40334068C4D
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
	}
	if = {
		limit = {
			has_trait = lifestyle_steward
		}
		add = steward_collect_taxes_steward_trait_bonus_scale
	}
}

#F2EC274E5CD34A38985BE1DA927A4AB749FC1862
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
	add = steward_develop_county_steward_trait_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
	}
}

#D49B556B3A9406EACC7980AEAD651BDBD8BFE320
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
		}
	}
	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_parameter = same_faith_promote_culture_bonus_active
			}
			scope:county.faith = scope:councillor_liege.faith
		}
		add = {
			value = scope:councillor.promote_culture_communal_identity_bonus
			desc = STEWARD_PROMOTE_CULTURE_COMMUNAL_IDENTITY_BONUS_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
				county_has_province_with_terrain = {
					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
		}
	}
	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
	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:councillor_liege.culture = { has_cultural_pillar = heritage_syriac }
			exists = scope:county
			scope:county = {
				has_county_modifier = promote_culture_beth_nahrain_modifier
				NOT = {
					culture = { has_cultural_pillar = heritage_syriac }
				}
			}
		}
		add = {
			value = promote_culture_beth_nahrain_bonus
			desc = steward_promote_culture_beth_nahrain
		}
	}

	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
		}
	}
	if = { # Council expertise 3
		limit = {
			scope:councillor = {
				has_trait_xp = { trait = lifestyle_steward value >= 100 }
			}
		}
		add = {
			value = steward_promote_culture_steward_trait_bonus
			desc = STEWARD_PROMOTE_CULTURE_STEWARD_3_TRAIT_BONUS_VALUE
		}
	}
	else_if = { # Council expertise 2
		limit = {
			scope:councillor = {
				has_trait_xp = { trait = lifestyle_steward value >= 50 }
			}
		}
		add = {
			value = steward_promote_culture_steward_trait_bonus
			desc = STEWARD_PROMOTE_CULTURE_STEWARD_2_TRAIT_BONUS_VALUE
		}
	}
	else_if = { # Council expertise 1
		limit = {
			scope:councillor = {
				has_trait = lifestyle_steward
			}
		}
		add = {
			value = steward_promote_culture_steward_trait_bonus
			desc = STEWARD_PROMOTE_CULTURE_STEWARD_1_TRAIT_BONUS_VALUE
		}
	}
}

#02BF9BEF91F04FE032596E80B37AFADEA084B0B2
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
	}
	add = steward_accept_culture_steward_trait_bonus
}

#D0617C97C0EE5D537B141B93FB718D759B88B1B0
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
	}
	add = steward_accept_culture_steward_trait_bonus
}


# ========================= New value ===============================================

steward_task_steward_1_value = 0.05
steward_task_steward_2_value = 0.10
steward_task_steward_3_value = 0.15

steward_collect_taxes_steward_trait_bonus_scale = {
	add = steward_collect_taxes_scale_base
	if = {
		limit = {
			has_trait_xp = { trait = lifestyle_steward value >= 100 }
		}
		multiply = steward_task_steward_3_value
	}
	else_if = {
		limit = {
			has_trait_xp = { trait = lifestyle_steward value >= 50 }
		}
		multiply = steward_task_steward_2_value
	}
	else_if = {
		limit = {
			has_trait = lifestyle_steward
		}
		multiply = steward_task_steward_1_value
	}
}



steward_develop_county_steward_trait_bonus_monthly_increase = {
	if = {
		limit = {
			has_trait_xp = { trait = lifestyle_steward value >= 100 }
		}
		add = steward_develop_county_base_total
		multiply = steward_task_steward_3_value
	}
	else_if = {
		limit = {
			has_trait_xp = { trait = lifestyle_steward value >= 50 }
		}
		add = steward_develop_county_base_total
		multiply = steward_task_steward_2_value
	}
	else_if = {
		limit = {
			has_trait = lifestyle_steward
		}
		add = steward_develop_county_base_total
		multiply = steward_task_steward_1_value
	}
}

steward_promote_culture_steward_trait_bonus = {
	add = steward_promote_culture_base_total
	if = {
		limit = {
			has_trait_xp = { trait = lifestyle_steward value >= 100 }
		}
		multiply = steward_task_steward_3_value
	}
	else_if = {
		limit = {
			has_trait_xp = { trait = lifestyle_steward value >= 50 }
		}
		multiply = steward_task_steward_2_value
	}
	else_if = {
		limit = {
			has_trait = lifestyle_steward
		}
		multiply = steward_task_steward_1_value
	}
}

### convince_dejure
steward_convince_dejure_steward_trait_bonus = {
	add = steward_convince_dejure_base_total
	if = {
		limit = {
			has_trait_xp = { trait = lifestyle_steward value >= 100 }
		}
		multiply = steward_task_steward_3_value
	}
	else_if = {
		limit = {
			has_trait_xp = { trait = lifestyle_steward value >= 50 }
		}
		multiply = steward_task_steward_2_value
	}
	else_if = {
		limit = {
			has_trait = lifestyle_steward
		}
		multiply = steward_task_steward_1_value
	}
}

### accept culture
steward_accept_culture_steward_trait_bonus = {
	add = steward_accept_culture_base_total
	if = {
		limit = {
			has_trait_xp = { trait = lifestyle_steward value >= 100 }
		}
		multiply = steward_task_steward_3_value
	}
	else_if = {
		limit = {
			has_trait_xp = { trait = lifestyle_steward value >= 50 }
		}
		multiply = steward_task_steward_2_value
	}
	else_if = {
		limit = {
			has_trait = lifestyle_steward
		}
		multiply = steward_task_steward_1_value
	}
}