######################
# County Corruption values
######################

miniscule_county_control_loss = -5
minor_county_control_loss = -10
medium_county_control_loss = -20
major_county_control_loss = -30
extreme_county_control_loss = -40
massive_county_control_loss = -50
monumental_county_control_loss = -75
miniscule_county_control_gain = 5
minor_county_control_gain = 10
medium_county_control_gain = 20
major_county_control_gain = 30
extreme_county_control_gain = 40
massive_county_control_gain = 50
monumental_county_control_gain = 75

low_county_control = 33
medium_county_control = 66
full_county_control = 100

low_county_control_limit = 35
high_county_control_limit = 95

high_control_county_corruption_removal_chance = 35

max_county_corruption_modifiers_at_once = 3

script_county_control = {
	value = 0
	add = county_control
}

county_corruption_modifier_count = {
	if = {
		limit = {
			has_county_modifier = county_corruption_inefficient_tax_collection_modifier
		}
		add = 1
	}
	if = {
		limit = {
			has_county_modifier = county_corruption_deserting_levies_modifier
		}
		add = 1
	}
	if = {
		limit = {
			has_county_modifier = county_corruption_smuggling_ring_modifier
		}
		add = 1
	}
	if = {
		limit = {
			has_county_modifier = county_corruption_inefficient_census_modifier
		}
		add = 1
	}
	if = {
		limit = {
			has_county_modifier = county_corruption_lack_of_sheriffs_modifier
		}
		add = 1
	}
	if = {
		limit = {
			has_county_modifier = county_corruption_lack_of_courts_modifier
		}
		add = 1
	}
	if = {
		limit = {
			has_county_modifier = county_corruption_thieves_guild_modifier
		}
		add = 1
	}
	if = {
		limit = {
			has_county_modifier = county_corruption_unsafe_highways_modifier
		}
		add = 1
	}
	if = {
		limit = {
			has_county_modifier = county_corruption_uncooperative_guilds_modifier
		}
		add = 1
	}
	if = {
		limit = {
			has_county_modifier = county_corruption_lackluster_administration_modifier
		}
		add = 1
	}
}

county_control_corruption_gain_chance = {
	add = low_county_control_limit
	#Account for actual county control
	subtract = county_control # At low_county_control_limit Control, there is a 0 percent chance of gaining Corruption

	divide = {
		add = 5 # A base of approximately 25% chance of gaining corruption per year at 0 Control
	}
	divide = { # Further reduce the chance of corruption per corruption modifier the County already has
		add = county_corruption_modifier_count
		multiply = 2
		min = 1
	}
}

in_debt_county_corruption_gain_chance = {
	value = 3

	add = { #Gold should always be a negative value at this point
		value = 0
		subtract = holder.gold
		multiply = 0.005 #Make it 1% more likely per -200 gold
		max = 5
	}

	#Make it linearly less likely to accrue additional modifiers for each modifiers you have
	divide = {
		add = 1
		add = county_corruption_modifier_count
	}	
}