﻿default_tax_collector = {
	tax_factor = 0.2
	levies_factor = 0.2
	ai_will_do = {
		value = default_tax_obligation_ai_will_do

		# Always take at least one default tax collector slot
		if = {
			limit = { scope:num_slots_with_obligation = 0 }
			add = 100
		}
		if = {
			limit = { scope:liege.culture = { has_cultural_parameter = unlock_tax_obligation_deqhan } }
			add = -1000
		}
	}
}

strict_taxation_tax_collector = {
	tax_factor = 0.4
	levies_factor = 0.2

	liege_modifier = {
		domain_tax_mult = 0.01
	}

	subject_modifier = {
		men_at_arms_limit = -1
		opinion_of_liege = -30
		monthly_piety_gain_mult = 0.1
	}

	ai_will_do = {
		value = tax_obligation_base_ai_will_do
		if = {
			limit = {
				scope:liege = {
					ai_greed >= 75 # The AI has to be very greedy
					ai_compassion <= 0 # And not kind enough to have qualms about it
				}
			}
			add = 2
		}
		if = {
			limit = { scope:liege.culture = { has_cultural_parameter = unlock_tax_obligation_deqhan } }
			add = -1
		}
	}
}

jizya_special_rights_tax_collector = {
	is_valid = {
		scope:liege.faith = {
			has_doctrine_parameter = unlock_jizya_contract
		}
	}

	is_vassal_valid = {
		custom_description = {
			text = vassal_has_the_wrong_religion
			subject = scope:vassal
			NOT = { scope:vassal.religion = scope:liege.religion }
		}
	}

	tax_factor = 1
	levies_factor = -0.75

	subject_modifier = {
		monthly_prestige = -0.2
	}

	flag = vassal_contract_cannot_revoke_titles
	flag = religiously_protected

	ai_will_do = {
		value = tax_obligation_base_ai_will_do
		if = {
			limit = {
				scope:num_slots_with_obligation = 0 # And only if we don't have Jizya already

				scope:liege = {
					OR = {
						# The AI has at least this many vassals to warrant Jizya being used
						any_vassal = {
							count >= tax_obligation_half_of_slot
							government_has_flag = government_is_clan
							NOT = { religion = scope:liege.religion }
						}

						# Or a large enough portion of their vassals are of another religion
						any_vassal = {
							percent >= 0.25
							government_has_flag = government_is_clan
							NOT = { religion = scope:liege.religion }
						}
					}
				}
			}
			add = 5
		}
	}
}

iqta_special_rights_tax_collector = {
	levies_factor = 0.1

	liege_modifier = {
		#men_at_arms_maintenance = -0.01
		#men_at_arms_recruitment_cost = -0.01
		maa_damage_mult = 0.01
	}

	subject_modifier = {
		men_at_arms_cap = 1
		men_at_arms_maintenance = -0.1
		men_at_arms_recruitment_cost = -0.1
		opinion_of_liege = 15
	}

	ai_will_do = {
		value = tax_obligation_base_ai_will_do

		scope:liege = {
			if = {
				limit = {
					OR = {
						AND = {
							ai_greed <= 0 # The AI shouldn't be greedy, since they won't care in that case
							ai_compassion >= 0 # The AI has to the somewhat compassionate to consider being nice to their vassals
						}
					}
				}
				if = {
					limit = { # Increase the score a lot if there are several vassal who REALLY doesn't like their liege
						any_vassal = {
							count >= tax_obligation_half_of_slot
							opinion = {
								target = scope:liege
								value <= -80
							}
						}
					}
					add = 4
				}
				else_if = {
					limit = { # Increase it only slightly if the vassals only somewhat dislike their liege
						any_vassal = {
							count >= tax_obligation_half_of_slot
							opinion = {
								target = scope:liege
								value <= -40
							}
						}
					}
					add = 2
				}
			}
		}
	}
}

ghazi_special_rights_tax_collector = {
	tax_factor = 0.1
	
	is_vassal_valid = {
		custom_description = {
			text = vassal_has_the_wrong_faith
			subject = scope:vassal
			scope:vassal.faith = scope:liege.faith
		}
	}

	liege_modifier = {
		monthly_piety_gain_mult = 0.02
		zealot_opinion = 1
	}

	subject_modifier = {
		men_at_arms_limit = 1
		monthly_piety = 0.5
		monthly_war_income_mult = 0.1
		monthly_county_control_growth_add = 0.25
		army_siege_value_mult = 0.15
		raid_speed = 0.15
		ai_war_cooldown = -0.5
		ai_war_chance = 1
		ai_zeal = 50
		ai_energy = 25
	}

	flag = vassal_contract_cheaper_religious_war
	flag = vassal_contract_increase_prestige_cb_cost
	flag = vassal_contract_allow_raiding

	ai_will_do = {
		value = tax_obligation_base_ai_will_do

		if = {
			limit = {
				scope:liege = {
					ai_has_warlike_personality = yes # AI should like wars to use Ghazi
					ai_zeal >= 0
					any_vassal = {
						count >= {
							value = scope:num_vassal_slots
							divide = 100
							multiply = 90
						}
						faith = scope:liege.faith
					}
				}
			}
			add = 2
		}
	}
}

### FP3 Tax Decrees
deqhan_special_rights_tax_collector = {
	is_shown = {
		has_fp3_dlc_trigger = yes
	}
	is_valid = {
		scope:liege.culture = { has_cultural_parameter = unlock_tax_obligation_deqhan }
	}
	tax_factor = 0.35
	levies_factor = 0.35

	liege_modifier = {
		legitimacy_gain_mult = 0.01
	}

	subject_modifier = {
		men_at_arms_cap = -1
		men_at_arms_limit = -1
		monthly_prestige_gain_mult = 0.2
	}

	ai_will_do = {
		value = tax_obligation_base_ai_will_do
		add = 3
	}
}

maguh_special_rights_tax_collector = {
	is_shown = {
		has_fp3_dlc_trigger = yes
	}

	is_valid = {
		scope:liege = {
			dynasty ?= {
				has_dynasty_perk = fp3_khvarenah_legacy_4
			}
		}
	}

	liege_modifier = {
		development_growth_factor = 0.01
	}
	
	subject_modifier = {
		men_at_arms_cap = -1
		men_at_arms_limit = -1
		character_capital_county_monthly_development_growth_add = 0.1
		holding_build_gold_cost = -0.1
		build_gold_cost = -0.1
		opinion_of_liege = 15
	}

	ai_will_do = {
		value = tax_obligation_base_ai_will_do
		add = 1
	}
}

muqata_special_rights_tax_collector = {
	is_shown = {
		has_fp3_dlc_trigger = yes
	}

	liege_modifier = {
		monthly_prestige = 0.1
	}

	subject_modifier = {
		men_at_arms_cap = -1
		men_at_arms_limit = 1	
		development_growth_factor = 0.1
		county_opinion_add = 10
		opinion_of_liege = 30
		epidemic_resistance = 10
		travel_danger = -5
	}

	ai_will_do = {
		value = tax_obligation_base_ai_will_do
	}
}
