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

# ADMINISTRATIVE GOVERNMENT
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 = {
					top_liege != this
				}
				liege = { has_realm_law = province_war_law_0 }
			}
		}
		
		can_pass = {
			trigger_if = {
				limit = {
					top_liege != this
					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 = {
					top_liege = this
				}
				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 = {
					top_liege != this
				}
				liege = { has_realm_law = province_war_law_1 }
			}
		}

		can_pass = {
			trigger_if = {
				limit = {
					top_liege = this
				}
				custom_tooltip = {
					text = admin_law_cooldown_desc
					NOT = { has_variable = admin_law_cooldown }
				}
			}
			trigger_if = {
				limit = {
					top_liege != this
					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 = {
					top_liege = this
				}
				custom_tooltip = {
					text = have_bureaucracy_2_or_higher
					OR = {
						has_realm_law = imperial_bureaucracy_2
						has_realm_law = imperial_bureaucracy_3
					}
				}
			}
			trigger_if = {
				limit = {
					top_liege != this
				}
				liege = { has_realm_law = province_war_law_2 }
			}
		}

		can_pass = {
			trigger_if = {
				limit = {
					top_liege = this
				}
				custom_tooltip = {
					text = admin_law_cooldown_desc
					NOT = { has_variable = admin_law_cooldown }
				}
			}
			trigger_if = {
				limit = {
					top_liege != this
					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_builder_or_pious_builder_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 = {
					top_liege = this
				}
				custom_tooltip = {
					text = have_bureaucracy_3
					has_realm_law = imperial_bureaucracy_3
				}
			}
			trigger_if = {
				limit = {
					top_liege != this
				}
				liege = { has_realm_law = province_war_law_3 }
			}
		}

		can_pass = {
			trigger_if = {
				limit = {
					top_liege = this
				}
				custom_tooltip = {
					text = admin_law_cooldown_desc
					NOT = { has_variable = admin_law_cooldown }
				}
			}
			trigger_if = {
				limit = {
					top_liege != this
					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 = {
			if = {
				limit = {
					has_realm_law = province_war_law_2
					ai_has_pious_builder_personality = yes
				}
				value = 1
			}
		}
	}
}

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 = {
					top_liege != this
				}
				liege = { has_realm_law = province_border_law_0 }
			}
		}
		
		can_pass = {
			trigger_if = {
				limit = {
					top_liege != this
					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 = {
					top_liege = this
					realm_law_use_imperial_bureaucracy = 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 = {
					top_liege = this
					realm_law_use_celestial_bureaucracy = yes
				}
				custom_tooltip = {
					text = have_celestial_bureaucracy_2_or_higher
					OR = {
						has_realm_law = celestial_bureaucracy_2
						has_realm_law = celestial_bureaucracy_3
					}
				}
			}
			trigger_if = {
				limit = {
					top_liege != this
				}
				liege = { has_realm_law = province_border_law_1 }
			}
		}

		can_pass = {
			trigger_if = {
				limit = {
					top_liege = this
				}
				custom_tooltip = {
					text = admin_law_cooldown_desc
					NOT = { has_variable = admin_law_cooldown }
				}
			}
			trigger_if = {
				limit = {
					top_liege != this
					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 = {
					top_liege = this
					realm_law_use_imperial_bureaucracy = yes
				}
				custom_tooltip = {
					text = have_bureaucracy_3
					has_realm_law = imperial_bureaucracy_3
				}
			}
			trigger_if = {
				limit = {
					top_liege = this
					realm_law_use_celestial_bureaucracy = yes
				}
				custom_tooltip = {
					text = have_celestial_bureaucracy_3
					has_realm_law = celestial_bureaucracy_3
				}
			}
			trigger_if = {
				limit = {
					top_liege != this
				}
				liege = { has_realm_law = province_border_law_2 }
			}
		}

		can_pass = {
			trigger_if = {
				limit = {
					top_liege = this
				}
				custom_tooltip = {
					text = admin_law_cooldown_desc
					NOT = { has_variable = admin_law_cooldown }
				}
			}
			trigger_if = {
				limit = {
					top_liege != this
					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
		}
	}
}

# CELESTIAL GOVERNMENT
celestial_army_liege_law = {
	# NOTE: This law is mirrored by `celestial_army_vassal_law`!
	# The top-liege has `celestial_army_liege_law` and all vassals have the `celestial_army_vassal_law` at the same level.

	default = celestial_army_liege_law_0
	cumulative = no
	flag = admin_law
	
	celestial_army_liege_law_0 = {
		modifier = {
			celestial_government_tax_contribution_add = -0.05
		}
		
		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
		}
		
		can_pass = {
			custom_tooltip = {
				text = admin_law_cooldown_desc
				NOT = { has_variable = admin_law_cooldown }
			}
		}

		on_pass = {
			## Set cooldown
			set_variable = {
				name = admin_law_cooldown
				years = @admin_law_cooldown_value
			}
		}

		ai_will_do = {
			value = 0
			if = {
				limit = {
					NOR = { # Rulers should keep any higher levels
						has_realm_law = celestial_army_liege_law_1
						has_realm_law = celestial_army_liege_law_2
						has_realm_law = celestial_army_liege_law_3
					}
				}
				add = 1
			}
		}
	}
	
	celestial_army_liege_law_1 = {
		modifier = {
			celestial_government_vassal_opinion = -5
			men_at_arms_title_cap = 1
		}
		flag = admin_title_troop_cost_reduction

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
			custom_tooltip = {
				text = have_celestial_bureaucracy_1_or_higher
				OR = {
					has_realm_law = celestial_bureaucracy_1
					has_realm_law = celestial_bureaucracy_2
					has_realm_law = celestial_bureaucracy_3
				}
			}
		}

		can_pass = {
			is_independent_ruler = yes
			custom_tooltip = {
				text = admin_law_cooldown_desc
				NOT = { has_variable = admin_law_cooldown }
			}
		}
		
		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 = {
					NOR = { # Rulers should keep any higher levels
						has_realm_law = celestial_army_liege_law_2
						has_realm_law = celestial_army_liege_law_3
					}
					OR = {
						ai_has_cautious_personality = yes
						ai_has_warlike_personality = yes
					}
				}
				add = 2
			}
		}
	}
	
	celestial_army_liege_law_2 = {
		modifier = {
			celestial_government_vassal_opinion = -10
		}
		flag = admin_title_troop_cost_reduction_high

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
			custom_tooltip = {
				text = have_celestial_bureaucracy_2_or_higher
				OR = {
					has_realm_law = celestial_bureaucracy_2
					has_realm_law = celestial_bureaucracy_3
				}
			}
		}

		can_pass = {
			is_independent_ruler = yes
			custom_tooltip = {
				text = admin_law_cooldown_desc
				NOT = { has_variable = admin_law_cooldown }
			}
		}
		
		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 = {
					NOT = { # Rulers should keep any higher levels
						has_realm_law = celestial_army_liege_law_3
					}
					OR = { # AI should want this if warlike, or if in the expansion phase, regardless of personality
						ai_has_warlike_personality = yes
						situation:dynastic_cycle ?= {
							situation_current_phase = situation_dynastic_cycle_phase_stability_expansion
						}
					}
				}
				add = 3
			}
		}
	}
	
	celestial_army_liege_law_3 = {
		modifier = {
			celestial_government_vassal_opinion = -15
			men_at_arms_title_cap = 2
		}
		flag = admin_title_troop_cost_reduction_very_high
	
		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
			custom_tooltip = {
				text = have_celestial_bureaucracy_3
				has_realm_law = celestial_bureaucracy_3
			}
			trigger_if = {
				limit = {
					this = title:h_china.holder
				}
				situation:dynastic_cycle ?= {
					situation_current_phase = situation_dynastic_cycle_phase_stability_expansion
				}
			}
		}
	
		can_pass = {
			is_independent_ruler = yes
			custom_tooltip = {
				text = admin_law_cooldown_desc
				NOT = { has_variable = admin_law_cooldown }
			}
		}
		
		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 = {
					ai_has_warlike_personality = yes
				}
				add = 4
			}
		}
	}
}

celestial_army_vassal_law = {
	default = celestial_army_vassal_law_0
	cumulative = no
	flag = admin_law
	
	celestial_army_vassal_law_0 = {
		modifier = {
			celestial_government_tax_contribution_add = -0.05
			men_at_arms_cap = 2
		}
		
		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = no
			trigger_if = {
				limit = {
					liege = { is_independent_ruler = yes }
				}
				liege = { has_realm_law = celestial_army_liege_law_0 }
			}
			trigger_else = {
				liege = { has_realm_law = celestial_army_vassal_law_0 }
			}
		}
		
		can_pass = {
			trigger_if = {
				limit = {
					liege = {
						OR = {
							has_realm_law = celestial_army_liege_law_0
							has_realm_law = celestial_army_vassal_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 = 0
		}
	}

	celestial_army_vassal_law_1 = {
		modifier = {
			men_at_arms_cap = -2
			men_at_arms_title_cap = 1
		}

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = no
			trigger_if = {
				limit = {
					liege = { is_independent_ruler = yes }
				}
				liege = { has_realm_law = celestial_army_liege_law_1 }
			}
			trigger_else = {
				liege = { has_realm_law = celestial_army_vassal_law_1 }
			}
		}

		can_pass = {
			trigger_if = {
				limit = {
					liege = {
						OR = {
							has_realm_law = celestial_army_liege_law_1
							has_realm_law = celestial_army_vassal_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
		}
	}
	
	celestial_army_vassal_law_2 = {
		modifier = {
			men_at_arms_cap = -20
			men_at_arms_title_cap = 2
		}

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = no
			trigger_if = {
				limit = {
					liege = { is_independent_ruler = yes }
				}
				liege = { has_realm_law = celestial_army_liege_law_2 }
			}
			trigger_else = {
				liege = { has_realm_law = celestial_army_vassal_law_2 }
			}
		}

		can_pass = {
			trigger_if = {
				limit = {
					liege = {
						OR = {
							has_realm_law = celestial_army_liege_law_2
							has_realm_law = celestial_army_vassal_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
		}
	}
	
	celestial_army_vassal_law_3 = {
		modifier = {
			men_at_arms_cap = -20
			men_at_arms_title_cap = 4
		}

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = no
			trigger_if = {
				limit = {
					liege = { is_independent_ruler = yes }
				}
				liege = { has_realm_law = celestial_army_liege_law_3 }
			}
			trigger_else = {
				liege = { has_realm_law = celestial_army_vassal_law_3 }
			}
		}

		can_pass = {
			trigger_if = {
				limit = {
					liege = {
						OR = {
							has_realm_law = celestial_army_liege_law_3
							has_realm_law = celestial_army_vassal_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
		}
	}
}

celestial_retirement_law = {
	default = celestial_retirement_law_5
	cumulative = no
	flag = admin_law
	
	celestial_retirement_law_0 = {
		flag = celestial_retirement_age_0
		flag = celestial_retirement_law
		
		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			trigger_if = {
				limit = {
					top_liege = this
				}
				custom_tooltip = {
					text = have_celestial_bureaucracy_1_or_higher
					NOT = { realm_law_group_at_minimum_level = celestial_bureaucracy }
				}
			}
			trigger_if = {
				limit = {
					top_liege != this
				}
				liege = { has_realm_law = celestial_retirement_law_0 }
			}
		}

		can_pass = {
			trigger_if = {
				limit = {
					top_liege = this
				}
				custom_tooltip = {
					text = admin_law_cooldown_desc
					NOT = { has_variable = admin_law_cooldown }
				}
			}
			trigger_if = {
				limit = {
					top_liege != this
					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
		}
	}
	
	celestial_retirement_law_1 = {
		flag = celestial_retirement_age_1
		flag = celestial_retirement_law

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			trigger_if = {
				limit = {
					top_liege = this
				}
				custom_tooltip = {
					text = have_celestial_bureaucracy_1_or_higher
					NOT = { realm_law_group_at_minimum_level = celestial_bureaucracy }
				}
			}
			trigger_if = {
				limit = {
					top_liege != this
				}
				liege = { has_realm_law = celestial_retirement_law_1 }
			}
		}

		can_pass = {
			trigger_if = {
				limit = {
					top_liege = this
				}
				custom_tooltip = {
					text = admin_law_cooldown_desc
					NOT = { has_variable = admin_law_cooldown }
				}
			}
			trigger_if = {
				limit = {
					top_liege != this
					liege = { has_realm_law = celestial_retirement_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
		}
	}
	
	celestial_retirement_law_2 = {
		flag = celestial_retirement_age_2
		flag = celestial_retirement_law

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			trigger_if = {
				limit = {
					top_liege = this
				}
				custom_tooltip = {
					text = have_celestial_bureaucracy_1_or_higher
					NOT = { realm_law_group_at_minimum_level = celestial_bureaucracy }
				}
			}
			trigger_if = {
				limit = {
					top_liege != this
				}
				liege = { has_realm_law = celestial_retirement_law_2 }
			}
		}

		can_pass = {
			trigger_if = {
				limit = {
					top_liege = this
				}
				custom_tooltip = {
					text = admin_law_cooldown_desc
					NOT = { has_variable = admin_law_cooldown }
				}
			}
			trigger_if = {
				limit = {
					top_liege != this
					liege = { has_realm_law = celestial_retirement_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
		}
	}
	
	celestial_retirement_law_3 = {
		flag = celestial_retirement_age_3
		flag = celestial_retirement_law

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			trigger_if = {
				limit = {
					top_liege = this
				}
				custom_tooltip = {
					text = have_celestial_bureaucracy_1_or_higher
					NOT = { realm_law_group_at_minimum_level = celestial_bureaucracy }
				}
			}
			trigger_if = {
				limit = {
					top_liege != this
				}
				liege = { has_realm_law = celestial_retirement_law_3 }
			}
		}

		can_pass = {
			trigger_if = {
				limit = {
					top_liege = this
				}
				custom_tooltip = {
					text = admin_law_cooldown_desc
					NOT = { has_variable = admin_law_cooldown }
				}
			}
			trigger_if = {
				limit = {
					top_liege != this
					liege = { has_realm_law = celestial_retirement_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
		}
	}
	
	celestial_retirement_law_4 = {
		flag = celestial_retirement_age_4
		flag = celestial_retirement_law

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			trigger_if = {
				limit = {
					top_liege = this
				}
				custom_tooltip = {
					text = have_celestial_bureaucracy_1_or_higher
					NOT = { realm_law_group_at_minimum_level = celestial_bureaucracy }
				}
			}
			trigger_if = {
				limit = {
					top_liege != this
				}
				liege = { has_realm_law = celestial_retirement_law_4 }
			}
		}

		can_pass = {
			trigger_if = {
				limit = {
					top_liege = this
				}
				custom_tooltip = {
					text = admin_law_cooldown_desc
					NOT = { has_variable = admin_law_cooldown }
				}
			}
			trigger_if = {
				limit = {
					top_liege != this
					liege = { has_realm_law = celestial_retirement_law_4 }
				}
				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
		}
	}

	celestial_retirement_law_5 = {
		flag = celestial_retirement_age_5
		flag = celestial_retirement_law

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			trigger_if = {
				limit = {
					top_liege != this
				}
				liege = { has_realm_law = celestial_retirement_law_5 }
			}
		}
		
		can_pass = {
			trigger_if = {
				limit = {
					top_liege != this
					liege = { has_realm_law = celestial_retirement_law_5 }
				}
				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 = 0
		}
	}
}

# BORDER WARS
border_wars_laws = {
	default = top_liege_redirected_to_border_wars_law
	cumulative = no
	flag = imperial_policy

	top_liege_redirected_to_border_wars_law = {
		flag = top_liege_redirected_to_border_wars_law

		can_keep = {
			is_landed = yes
			highest_held_title_tier >= tier_duchy
			#Empire or lower tier
		    highest_held_title_tier < tier_hegemony
	    	#Small realm size
	    	sub_realm_size < border_war_sized_realm_value
	    	#Not an antagonitsic house
	    	house ?= {
	    		NOT = { has_house_unity_stage = antagonistic }
	    	}
	    	#Not defending in any civil wars
	    	NOT = {
	    		any_character_war = {
	    			primary_defender = root
	    			using_civil_war_cb_trigger = yes
	    		}
	    	}
	    }

		on_pass = {
	        primary_title = {
	        	set_vassal_wars_are_redirected_to_holder = yes
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	top_liege_not_redirected_to_border_wars_law = {
		flag = top_liege_not_redirected_to_border_wars_law

		can_keep = {
	        is_independent_ruler = yes
			is_landed = yes
			highest_held_title_tier >= tier_duchy
			custom_description = {
	    		text = border_wars_laws_triggers
	    		value = sub_realm_size
			    OR = {
			    	#hegemonies
			    	highest_held_title_tier >= tier_hegemony
			    	#any large realm
			    	sub_realm_size >= border_war_sized_realm_value
			    	#antagonistic houses
			    	house ?= {
			    		has_house_unity_stage = antagonistic
			    	}
			    	#defending in a civil war
		    		any_character_war = {
		    			primary_defender = root
		    			using_civil_war_cb_trigger = yes
		    		}
				}
			}
		}

		on_pass = {
	        primary_title = {
	        	set_vassal_wars_are_redirected_to_holder = no
			}
		}
		should_start_with = {
		    OR = {
		    	#hegemonies
		    	highest_held_title_tier >= tier_hegemony
		    	#any large realm
		    	sub_realm_size >= border_war_sized_realm_value
		    	#antagonistic houses
		    	house ?= {
		    		has_house_unity_stage = antagonistic
		    	}
		    	#defending in a civil war
	    		any_character_war = {
	    			primary_defender = root
	    			using_civil_war_cb_trigger = yes
	    		}
			}
		}
		ai_will_do = {
			value = 0
		}
	}
}

# REGENCY
grand_secretariat_laws = {
	default = grand_chancellor_law
	cumulative = no
	flag = imperial_policy

	grand_chancellor_law = {
		flag = grand_chancellor_law
		can_have = {
			has_title = title:h_china
			government_has_flag = government_is_celestial
		}
		can_pass = {
			exists = title:e_minister_chancellor.holder
	 		OR = {
	 			situation:dynastic_cycle ?= {
	 				situation_current_phase = situation_dynastic_cycle_phase_stability_advancement
	 			}
	 			is_movement_in_power = {
	 				MOVEMENT = advancement_movement
	 			}
	 		}
			custom_tooltip = {
				text = admin_law_cooldown_desc
				NOT = { has_variable = admin_law_cooldown }
			}
		}

		on_pass = {
			hidden_effect = {
				designate_diarch = title:e_minister_chancellor.holder
				diarch = {
					depose_diarch = yes
				}
			}
			## Set cooldown
			set_variable = {
				name = admin_law_cooldown
				years = @admin_law_cooldown_value
			}
		}

		ai_will_do = {
			value = 10
			if = {
 				limit = {
		 			is_movement_in_power = {
		 				MOVEMENT = advancement_movement
		 			}
	 			}
	 			add = 1
	 		}
			if = {
 				limit = {
	 				situation:dynastic_cycle ?= {
	 					situation_current_phase = situation_dynastic_cycle_phase_stability_expansion
	 				}
	 			}
				add = -10
			}
			if = {
				limit = {
					title:e_minister_grand_marshal.holder = {
						is_ai = no
						NOT = { has_court_position = favored_minister_court_position }
					}
				}
				add = 20
			}
			if = {
				limit = {
					diarch = {
						has_variable = asked_to_be_secretary_director
					}
				}
				add = -1000
			}
		}
	}

	grand_marshal_law = {
		flag = grand_marshal_law
		can_have = {
			has_title = title:h_china
			government_has_flag = government_is_celestial
		}

		can_pass = {
			exists = title:e_minister_grand_marshal.holder
 			situation:dynastic_cycle ?= {
 				NOR = {
 					situation_current_phase = situation_dynastic_cycle_phase_stability_advancement
 					situation_current_phase = situation_dynastic_cycle_phase_instability
 				}
				situation_participant_group:expansion_movement ?= {
					save_temporary_scope_as = my_movement
					
					custom_tooltip = {
						text = my_movement_is_not_in_power
						exists = var:movement_favored
					}
				}
 			}
			custom_tooltip = {
				text = admin_law_cooldown_desc
				NOT = { has_variable = admin_law_cooldown }
			}
		}

		on_pass = {
			hidden_effect = {
				designate_diarch = title:e_minister_grand_marshal.holder
				diarch = {
					depose_diarch = yes
				}
			}
			## Set cooldown
			set_variable = {
				name = admin_law_cooldown
				years = @admin_law_cooldown_value
			}
		}

		ai_will_do = {
			value = -2
			if = {
 				limit = {
		 			is_movement_in_power = {
		 				MOVEMENT = expansion_movement
		 			}
	 			}
				add = 1
			}
			if = {
				limit = {
					title:e_minister_chancellor.holder ?= {
						is_ai = no
						NOT = { has_court_position = favored_minister_court_position }
					}
				}
				add = 20
			}
			if = {
 				limit = {
 					exists = title:e_minister_grand_marshal.holder
 					title:e_minister_grand_marshal.holder.merit_level >= root.diarch.merit_level
 					title:e_minister_grand_marshal.holder.merit >= root.diarch.merit
	 			}
				add = 1
			}
			if = {
				limit = {
					exists = root.diarch.var:movement_power
					exists = var:movement_power
				}
				if = {
	 				limit = {
			 			var:movement_power >= root.diarch.var:movement_power
		 			}
					add = 1
				}
				else = {
					add = -1
				}
			}
			if = {
				limit = {
					diarch = {
						has_variable = asked_to_be_secretary_director
					}
				}
				add = -1000
			}
		}
	}

	grand_censor_law = {
		flag = grand_censor_law
		can_have = {
			has_title = title:h_china
			government_has_flag = government_is_celestial
		}

		can_pass = {
			exists = title:e_minister_censor.holder
 			situation:dynastic_cycle ?= {
 				NOR = {
 					situation_current_phase = situation_dynastic_cycle_phase_stability_expansion
 					situation_current_phase = situation_dynastic_cycle_phase_stability_advancement
 				}
			}
 			situation:dynastic_cycle.situation_participant_group:conservative_movement ?= {
				save_temporary_scope_as = my_movement
				
				custom_tooltip = {
					text = my_movement_is_not_in_power
					exists = var:movement_favored
				}
			}
			custom_tooltip = {
				text = admin_law_cooldown_desc
				NOT = { has_variable = admin_law_cooldown }
			}
		}

		on_pass = {
			hidden_effect = {
				designate_diarch = title:e_minister_censor.holder
				diarch = {
					depose_diarch = yes
				}
			}
			## Set cooldown
			set_variable = {
				name = admin_law_cooldown
				years = @admin_law_cooldown_value
			}
		}

		ai_will_do = {
			value = -2
			if = {
 				limit = {
		 			is_movement_in_power = {
		 				MOVEMENT = conservative_movement
		 			}
	 			}
				add = 1
			}
			if = {
				limit = {
					title:e_minister_chancellor.holder = {
						is_ai = no
						NOT = { has_court_position = favored_minister_court_position }
					}
				}
				add = 20
			}
			if = {
 				limit = {
 					exists = title:e_minister_censor.holder
 					title:e_minister_censor.holder.merit_level >= root.diarch.merit_level
 					title:e_minister_censor.holder.merit >= root.diarch.merit
	 			}
				add = 1
			}
			if = {
				limit = {
					exists = root.diarch.var:movement_power
					exists = var:movement_power
				}
				if = {
	 				limit = {
			 			var:movement_power >= root.diarch.var:movement_power
		 			}
					add = 1
				}
				else = {
					add = -1
				}
			}
			if = {
				limit = {
					diarch = {
						has_variable = asked_to_be_secretary_director
					}
				}
				add = -1000
			}
		}
	}
}

candidate_score_laws = {
	default = candidate_score_merit_law
	cumulative = no
	flag = imperial_policy

	candidate_score_merit_law = {
		flag = candidate_score_merit_law
		can_have = {
			has_title = title:h_china
			government_has_flag = government_is_celestial
		}
		can_pass = {
 			NOT = {
	 			is_movement_in_power = {
	 				MOVEMENT = conservative_movement
				}
			}
 			can_pass_candidate_score_merit_law_trigger = yes
			custom_tooltip = {
				text = admin_law_cooldown_desc
				NOT = { has_variable = admin_law_cooldown }
			}
	 	}

		pass_cost = {
			influence = 1000
			treasury = {
				value = realm_size
				multiply = 10
			}
		}

		on_pass = {
			## Set cooldown
			set_variable = {
				name = admin_law_cooldown
				years = @admin_law_cooldown_value
			}
		}

		ai_will_do = { #AI can only do it if convinced through Movement Petition
			value = 0
		}
	}

	candidate_score_prestige_law = {
		flag = candidate_score_prestige_law
		can_have = {
			has_title = title:h_china
			government_has_flag = government_is_celestial
		}

		can_pass = {
 			is_movement_in_power = {
 				MOVEMENT = conservative_movement
			}
			can_pass_candidate_score_prestige_law_trigger = yes
			custom_tooltip = {
				text = admin_law_cooldown_desc
				NOT = { has_variable = admin_law_cooldown }
			}
		}

		pass_cost = {
			influence = 1000
			treasury = {
				value = realm_size
				multiply = 10
			}
		}

		on_pass = {
			## Set cooldown
			set_variable = {
				name = admin_law_cooldown
				years = @admin_law_cooldown_value
			}
		}

		ai_will_do = { #AI can only do it if convinced through Movement Petition
			value = 0
		}
	}
}

budget_allocation_salary_law = {
	is_treasury_budget_group = yes

	flag = treasury_budget_law
	flag = treasury_budget_salary

	default = budget_allocation_salary_30

	budget_allocation_salary_0 = {
		shown_in_encyclopedia = no

		flag = salary_budget_law_major_negative_impact

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_salary_budget_allocation = 0.0

			vassal_opinion = -30
			vassal_tax_mult = -0.3
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		on_pass = {
			add_legitimacy = {
				value = treasury_budget_law_change_legitimacy_loss_base
				multiply = 4
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_salary_5 = {
		shown_in_encyclopedia = no

		flag = salary_budget_law_major_negative_impact

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_salary_budget_allocation = 0.05

			vassal_opinion = -25
			vassal_tax_mult = -0.25
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		on_pass = {
			add_legitimacy = {
				value = treasury_budget_law_change_legitimacy_loss_base
				multiply = 4
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_salary_10 = {
		shown_in_encyclopedia = no

		flag = salary_budget_law_major_negative_impact

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_salary_budget_allocation = 0.10

			vassal_opinion = -20
			vassal_tax_mult = -0.20
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		on_pass = {
			add_legitimacy = {
				value = treasury_budget_law_change_legitimacy_loss_base
				multiply = 3
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_salary_15 = {
		shown_in_encyclopedia = no

		flag = salary_budget_law_major_negative_impact

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_salary_budget_allocation = 0.15

			vassal_opinion = -15
			vassal_tax_mult = -0.15
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		on_pass = {
			add_legitimacy = {
				value = treasury_budget_law_change_legitimacy_loss_base
				multiply = 2
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_salary_20 = {
		shown_in_encyclopedia = no

		flag = salary_budget_law_major_negative_impact

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_salary_budget_allocation = 0.20

			vassal_opinion = -10
			vassal_tax_mult = -0.1
		}

		on_pass = {
			add_legitimacy = {
				value = treasury_budget_law_change_legitimacy_loss_base
				multiply = 1
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_salary_25 = {
		shown_in_encyclopedia = no

		flag = salary_budget_law_minor_negative_impact

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_salary_budget_allocation = 0.25

			vassal_opinion = -5
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_salary_30 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		should_start_with = {
			always = yes
		}

		modifier = {
			treasury_salary_budget_allocation = 0.30
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_salary_35 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_salary_budget_allocation = 0.35
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_salary_40 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_salary_budget_allocation = 0.40
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_salary_45 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_salary_budget_allocation = 0.45
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_salary_50 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_salary_budget_allocation = 0.50
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_salary_55 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_salary_budget_allocation = 0.55
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_salary_60 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_salary_budget_allocation = 0.60
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_salary_65 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_salary_budget_allocation = 0.65
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_salary_70 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_salary_budget_allocation = 0.70
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_salary_75 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_salary_budget_allocation = 0.75
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_salary_80 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_salary_budget_allocation = 0.80
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_salary_85 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_salary_budget_allocation = 0.85
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_salary_90 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_salary_budget_allocation = 0.90
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_salary_95 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_salary_budget_allocation = 0.95
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_salary_100 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_salary_budget_allocation = 1.00
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}
}

budget_allocation_ministry_law = {
	is_treasury_budget_group = yes

	flag = treasury_budget_law
	flag = treasury_budget_ministry

	default = budget_allocation_ministry_25

	budget_allocation_ministry_0 = {
		shown_in_encyclopedia = no

		flag = ministry_budget_law_major_negative_impact

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_ministry_budget_allocation = 0

			vassal_tax_mult = -0.2
			monthly_legitimacy_add = -20
			courtly_opinion = -30
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		on_pass = {
			add_legitimacy = {
				value = treasury_budget_law_change_legitimacy_loss_base
				multiply = 4
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_ministry_5 = {
		shown_in_encyclopedia = no

		flag = ministry_budget_law_major_negative_impact

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_ministry_budget_allocation = 0.05

			vassal_tax_mult = -0.15
			monthly_legitimacy_add = -15
			courtly_opinion = -25
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		on_pass = {
			add_legitimacy = {
				value = treasury_budget_law_change_legitimacy_loss_base
				multiply = 4
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_ministry_10 = {
		shown_in_encyclopedia = no

		flag = ministry_budget_law_major_negative_impact

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_ministry_budget_allocation = 0.10

			vassal_tax_mult = -0.1
			monthly_legitimacy_add = -10
			courtly_opinion = -20
		}

		on_pass = {
			add_legitimacy = {
				value = treasury_budget_law_change_legitimacy_loss_base
				multiply = 3
			}
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}


	budget_allocation_ministry_15 = {
		shown_in_encyclopedia = no

		flag = ministry_budget_law_major_negative_impact

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_ministry_budget_allocation = 0.15

			vassal_tax_mult = -0.05
			monthly_legitimacy_add = -5
			courtly_opinion = -15
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		on_pass = {
			add_legitimacy = {
				value = treasury_budget_law_change_legitimacy_loss_base
				multiply = 1
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_ministry_20 = {
		shown_in_encyclopedia = no

		flag = ministry_budget_law_minor_negative_impact

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_ministry_budget_allocation = 0.20

			courtly_opinion = -10
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_ministry_25 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_ministry_budget_allocation = 0.25
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_ministry_30 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
		}

		ai_will_do = {
			value = 0
		}

		should_start_with = {
			always = yes
		}

		modifier = {
			treasury_ministry_budget_allocation = 0.30
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_ministry_35 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_ministry_budget_allocation = 0.35
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_ministry_40 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_ministry_budget_allocation = 0.40
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_ministry_45 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_ministry_budget_allocation = 0.45
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_ministry_50 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_ministry_budget_allocation = 0.50
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_ministry_55 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_ministry_budget_allocation = 0.55
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_ministry_60 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_ministry_budget_allocation = 0.60
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_ministry_65 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_ministry_budget_allocation = 0.65
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_ministry_70 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_ministry_budget_allocation = 0.70
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_ministry_75 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_ministry_budget_allocation = 0.75
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_ministry_80 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_ministry_budget_allocation = 0.80
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_ministry_85 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_ministry_budget_allocation = 0.85
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_ministry_90 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_ministry_budget_allocation = 0.9
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_ministry_95 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_ministry_budget_allocation = 0.95
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_ministry_100 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_law_use_celestial_bureaucracy = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_ministry_budget_allocation = 1.0
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}
}

budget_allocation_military_law = {
	is_treasury_budget_group = yes

	flag = treasury_budget_law
	flag = treasury_budget_military

	default = budget_allocation_military_20

	budget_allocation_military_0 = {
		shown_in_encyclopedia = no

		flag = military_budget_law_major_negative_impact

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_military_budget_allocation = 0

			glory_hound_opinion = -35
			army_damage_mult = -0.4
			army_toughness_mult = -0.4
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		on_pass = {
			add_legitimacy = {
				value = treasury_budget_law_change_legitimacy_loss_base
				multiply = 4
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_military_5 = {
		shown_in_encyclopedia = no

		flag = military_budget_law_major_negative_impact

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_military_budget_allocation = 0.05

			glory_hound_opinion = -30
			army_damage_mult = -0.3
			army_toughness_mult = -0.3
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		on_pass = {
			add_legitimacy = {
				value = treasury_budget_law_change_legitimacy_loss_base
				multiply = 2
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_military_10 = {
		shown_in_encyclopedia = no

		flag = military_budget_law_major_negative_impact

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_military_budget_allocation = 0.10

			glory_hound_opinion = -25
			army_damage_mult = -0.2
			army_toughness_mult = -0.2
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		on_pass = {
			add_legitimacy = {
				value = treasury_budget_law_change_legitimacy_loss_base
				multiply = 1
			}
		}

		ai_will_do = {
			value = 0
		}
	}


	budget_allocation_military_15 = {
		shown_in_encyclopedia = no

		flag = military_budget_law_major_negative_impact

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_military_budget_allocation = 0.15

			glory_hound_opinion = -20
			army_damage_mult = -0.1
			army_toughness_mult = -0.1
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_military_20 = {
		shown_in_encyclopedia = no

		flag = military_budget_law_minor_negative_impact

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		should_start_with = {
			always = yes
		}

		modifier = {
			treasury_military_budget_allocation = 0.20

			glory_hound_opinion = -10
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_military_25 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_military_budget_allocation = 0.25

			glory_hound_opinion = -5
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_military_30 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		ai_will_do = {
			value = 0
		}

		modifier = {
			treasury_military_budget_allocation = 0.30
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_military_35 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_military_budget_allocation = 0.35
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_military_40 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_military_budget_allocation = 0.40
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_military_45 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_military_budget_allocation = 0.45
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_military_50 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_military_budget_allocation = 0.50
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_military_55 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_military_budget_allocation = 0.55
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_military_60 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_military_budget_allocation = 0.60
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_military_65 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_military_budget_allocation = 0.65
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_military_70 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_military_budget_allocation = 0.70
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_military_75 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_military_budget_allocation = 0.75
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_military_80 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_military_budget_allocation = 0.8
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_military_85 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_military_budget_allocation = 0.85
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_military_90 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_military_budget_allocation = 0.9
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_military_95 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_military_budget_allocation = 0.95
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}

	budget_allocation_military_100 = {
		shown_in_encyclopedia = no

		can_keep = {
			realm_uses_treasury_laws_trigger = yes
			is_independent_ruler = yes
		}

		modifier = {
			treasury_military_budget_allocation = 1.0
		}

		pass_cost = {
			prestige = {
				add = change_admin_budget_law_prestige_cost
			}
		}

		ai_will_do = {
			value = 0
		}
	}
}
