﻿#####################
# ADMINISTRATIVE LAWS
#####################
@admin_law_cooldown_value = 5

province_war_law = {
	default = province_war_law_0
	cumulative = yes
	flag = admin_law
	
	province_war_law_0 = {
		modifier = {
		}
		flag = uses_imperial_bureaucracy

		can_keep = {
			realm_law_use_imperial_bureaucracy = yes
			trigger_if = {
				limit = {
					is_independent_ruler = no
				}
				liege = { has_realm_law = province_war_law_0 }
			}
		}
		
		can_pass = {
			trigger_if = {
				limit = {
					is_independent_ruler = no
					liege = { has_realm_law = province_war_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
			}
		}
	}
	
	province_war_law_1 = {
		modifier = {
		}
		flag = uses_imperial_bureaucracy
		flag = admin_vassal_wars_restricted

		can_keep = {
			realm_law_use_imperial_bureaucracy = yes
			trigger_if = {
				limit = {
					is_independent_ruler = yes
				}
				custom_tooltip = {
					text = have_bureaucracy_1_or_higher
					OR = {
						has_realm_law = imperial_bureaucracy_1
						has_realm_law = imperial_bureaucracy_2
						has_realm_law = imperial_bureaucracy_3
					}
				}
			}
			trigger_if = {
				limit = {
					is_independent_ruler = no
				}
				liege = { has_realm_law = province_war_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 = province_war_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 = {
				limit = {
					ai_has_warlike_personality = yes
				}
				value = 1
			}
			if = {
				limit = {
					has_realm_law = province_war_law_0
					ai_has_economical_boom_personality = yes
				}
				value = 1
			}
		}
	}
	
	province_war_law_2 = {
		modifier = {
		}
		flag = uses_imperial_bureaucracy
		flag = admin_vassal_wars_permission_only
		
		can_keep = {
			realm_law_use_imperial_bureaucracy = yes
			trigger_if = {
				limit = {
					is_independent_ruler = yes
				}
				custom_tooltip = {
					text = have_bureaucracy_2_or_higher
					OR = {
						has_realm_law = imperial_bureaucracy_2
						has_realm_law = imperial_bureaucracy_3
					}
				}
			}
			trigger_if = {
				limit = {
					is_independent_ruler = no
				}
				liege = { has_realm_law = province_war_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 = province_war_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 = {
			if = {
				limit = {
					has_realm_law = province_war_law_1
					ai_has_economical_boom_personality = yes
				}
				value = 1
			}
		}
	}
	
	province_war_law_3 = {
		modifier = {
		}
		flag = uses_imperial_bureaucracy
		flag = admin_vassal_wars_banned
		
		can_keep = {
			realm_law_use_imperial_bureaucracy = yes
			trigger_if = {
				limit = {
					is_independent_ruler = yes
				}
				custom_tooltip = {
					text = have_bureaucracy_3
					has_realm_law = imperial_bureaucracy_3
				}
			}
			trigger_if = {
				limit = {
					is_independent_ruler = no
				}
				liege = { has_realm_law = province_war_law_3 }
			}
		}

		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 = province_war_law_3 }
				}
				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 = {
			value = 0
		}
	}
}

province_border_law = {
	default = province_border_law_0
	cumulative = no
	flag = admin_law
	
	province_border_law_0 = {
		modifier = {
		}
		flag = uses_imperial_bureaucracy

		can_keep = {
			realm_law_use_imperial_bureaucracy = yes
			trigger_if = {
				limit = {
					is_independent_ruler = no
				}
				liege = { has_realm_law = province_border_law_0 }
			}
		}
		
		can_pass = {
			trigger_if = {
				limit = {
					is_independent_ruler = no
					liege = { has_realm_law = province_border_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
			}
		}

		ai_will_do = {
			value = 1
		}
	}
	
	province_border_law_1 = {
		modifier = {
			administrative_government_vassal_opinion = -5
		}
		flag = uses_imperial_bureaucracy
		flag = admin_vassal_border_restricted

		can_keep = {
			realm_law_use_imperial_bureaucracy = yes
			trigger_if = {
				limit = {
					is_independent_ruler = yes
				}
				custom_tooltip = {
					text = have_bureaucracy_2_or_higher
					OR = {
						has_realm_law = imperial_bureaucracy_2
						has_realm_law = imperial_bureaucracy_3
					}
				}
			}
			trigger_if = {
				limit = {
					is_independent_ruler = no
				}
				liege = { has_realm_law = province_border_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 = province_border_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 = {
			value = 0
			if = {
				limit = {
					OR = {
						ai_has_cautious_personality = yes
						ai_has_economical_boom_personality = yes
					}
				}
				add = 2
			}
		}
	}
	
	province_border_law_2 = {
		modifier = {
			administrative_government_vassal_opinion = -10
		}
		flag = uses_imperial_bureaucracy
		flag = admin_vassal_border_limit

		can_keep = {
			realm_law_use_imperial_bureaucracy = yes
			trigger_if = {
				limit = {
					is_independent_ruler = yes
				}
				custom_tooltip = {
					text = have_bureaucracy_3
					has_realm_law = imperial_bureaucracy_3
				}
			}
			trigger_if = {
				limit = {
					is_independent_ruler = no
				}
				liege = { has_realm_law = province_border_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 = province_border_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 = {
			value = 0
		}
	}
}
