﻿#####################
# EK ADMINISTRATIVE LAWS
#####################

@admin_law_cooldown_value = 5

religious_tolerance_law = {
	default = religious_tolerance_law_0
	cumulative = yes
	flag = admin_law
	
	#No religious tolerance - can convert hostile and evil, can't convert astray
	religious_tolerance_law_0 = {
		modifier = {
			zealot_opinion = 5
		}
		flag = uses_imperial_bureaucracy
		flag = admin_religious_tolerance_none

		can_keep = {
			realm_law_use_imperial_bureaucracy = yes
			trigger_if = {
				limit = {
					is_independent_ruler = no
				}
				liege = { has_realm_law = religious_tolerance_law_0 }
			}
		}
		
		can_pass = {
			trigger_if = {
				limit = {
					is_independent_ruler = no
					liege = { has_realm_law = religious_tolerance_law_0 }
				}
				custom_tooltip = {
					text = imperial_bureaucracy_pending_law_change
					always = no
				}
			}
		}

		on_pass = {
			## Set cooldown
			set_variable = {
				name = admin_law_cooldown
				years = @admin_law_cooldown_value
			}
		}
	}
	
	religious_tolerance_law_1 = {
		modifier = {
			different_faith_opinion = 10
			zealot_opinion = -15
		}
		flag = uses_imperial_bureaucracy
		flag = admin_religious_tolerance_partial

		can_keep = {
			realm_law_use_imperial_bureaucracy = yes
			trigger_if = {
				limit = {
					is_independent_ruler = yes
				}
				custom_tooltip = {
					text = have_cyrodiilic_cult_or_adaptive
					primary_title.state_faith ?= {
						OR = {
							has_doctrine = special_doctrine_cyrodiilic_cult
							has_doctrine = tenet_adaptive
							has_doctrine = doctrine_pluralism_pluralistic
							has_doctrine = special_doctrine_talos_cult
						}
					}
				}
			}
			trigger_if = {
				limit = {
					is_independent_ruler = no
				}
				liege = { has_realm_law = religious_tolerance_law_1 }
			}
		}

		can_pass = {
			trigger_if = {
				limit = {
					is_independent_ruler = yes
				}
				custom_tooltip = {
					text = admin_law_cooldown_desc
					NOT = { has_variable = admin_law_cooldown }
				}
			}
			trigger_if = {
				limit = {
					is_independent_ruler = no
					liege = { has_realm_law = religious_tolerance_law_1 }
				}
				custom_tooltip = {
					text = imperial_bureaucracy_pending_law_change
					always = no
				}
			}
		}
		
		pass_cost = {
			prestige = {
				add = admin_law_prestige_cost
			}
		}
		
		on_pass = {
			## Set cooldown
			set_variable = {
				name = admin_law_cooldown
				years = @admin_law_cooldown_value
			}
		}

		ai_will_do = {
			#If state has appropriate faith then ruler will try to pass this law
			if = {
				limit = {
					primary_title.state_faith ?= {
						OR = {
							has_doctrine = special_doctrine_cyrodiilic_cult
							has_doctrine = tenet_adaptive
							has_doctrine = doctrine_pluralism_pluralistic
							has_doctrine = special_doctrine_talos_cult
						}
					}
				}
				value = 100
			}
		}
	}
	
	religious_tolerance_law_2 = {
		modifier = {
			different_faith_opinion = 15
			zealot_opinion = -20
			same_faith_opinion = -10
		}
		flag = uses_imperial_bureaucracy
		flag = admin_religious_tolerance_full
		
		can_keep = {
			realm_law_use_imperial_bureaucracy = yes
			trigger_if = {
				limit = {
					is_independent_ruler = yes
				}
				custom_tooltip = {
					text = have_cyrodiilic_cult_or_adaptive
					primary_title.state_faith ?= {
						OR = {
							has_doctrine = special_doctrine_cyrodiilic_cult
							has_doctrine = tenet_adaptive
							has_doctrine = doctrine_pluralism_pluralistic
							has_doctrine = special_doctrine_talos_cult
						}
					}
				}
			}
			trigger_if = {
				limit = {
					is_independent_ruler = no
				}
				liege = { has_realm_law = religious_tolerance_law_2 }
			}
		}

		can_pass = {
			trigger_if = {
				limit = {
					is_independent_ruler = yes
				}
				custom_tooltip = {
					text = admin_law_cooldown_desc
					NOT = { has_variable = admin_law_cooldown }
				}
			}
			trigger_if = {
				limit = {
					is_independent_ruler = no
					liege = { has_realm_law = religious_tolerance_law_2 }
				}
				custom_tooltip = {
					text = imperial_bureaucracy_pending_law_change
					always = no
				}
			}
		}

		pass_cost = {
			prestige = {
				add = admin_law_prestige_cost
			}
		}
		
		on_pass = {
			## Set cooldown
			set_variable = {
				name = admin_law_cooldown
				years = @admin_law_cooldown_value
			}
		}

		ai_will_do = {
			#Lower than 1
			if = {
				limit = {
					primary_title.state_faith ?= {
						OR = {
							has_doctrine = special_doctrine_cyrodiilic_cult
							has_doctrine = tenet_adaptive
							has_doctrine = doctrine_pluralism_pluralistic
							has_doctrine = special_doctrine_talos_cult
						}
					}
				}
				value = 50
			}
			#Zealous is unlikely to do this
			if = {
				limit = {
					ai_zeal > medium_positive_ai_value
				}
				value = -1
			}
		}
	}
}