﻿@crown_authority_cooldown_2_years = 50

realm_administration_law = {
	default = realm_administration_law_0
	cumulative = no
	flag = realm_law
	
	realm_administration_law_0 = {
		modifier = {
			clergy_opinion = 10
		}

		can_keep = { 
			highest_held_title_tier	>= 2
			realm_law_use_realm_administration_law = yes
		}

		can_pass = {
			trigger_if = {
				limit = { 
					OR = {
						has_realm_law = realm_administration_law_1
						has_realm_law = realm_administration_law_2
						has_realm_law = realm_administration_law_3
					}
				}
				custom_tooltip = {
					subject = root
					text = "has_crown_authority_cooldown_2"
					NOT = {
						has_variable = crown_authority_cooldown_2
					}
				}
			}
		}

		on_pass = {
			# Increment cooldown breaker tally, if appropriate.
			# calculate_authority_cooldown_break_effect = yes
			# Set regular cooldown.
			set_variable = {
				name = crown_authority_cooldown_2
				years = @crown_authority_cooldown_2_years
			}
		}

		pass_cost = { 
			gold = {
				value = 0
				if = {
					limit = {
						is_ai = no
					}
					add = 50
				}
			} 
		}
	}
	
	realm_administration_law_1 = {
		modifier = {
			domain_tax_mult = -0.10
			levy_size = -0.10
			vassal_levy_contribution_mult = 0.10
			vassal_tax_contribution_mult = 0.10
			character_capital_county_monthly_development_growth_add = 0.10
			vassal_limit = 10
			vassal_opinion = 10
		}

		can_keep = { 
			highest_held_title_tier	>= 3
			realm_law_use_realm_administration_law = yes
			capital_province.county = { development_level >= 15 }
		}

		can_pass = {
			trigger_if = {
				limit = { 
					OR = {
						has_realm_law = realm_administration_law_0
						has_realm_law = realm_administration_law_2
						has_realm_law = realm_administration_law_3
					}
				}
				custom_tooltip = {
					subject = root
					text = "has_crown_authority_cooldown_2"
					NOT = {
						has_variable = crown_authority_cooldown_2
					}
				}
			}
		}
		
		pass_cost = { 
			gold = {
				value = 0
				if = {
					limit = {
						is_ai = no
					}
					add = 250
				}
			} 
		}
		
		on_pass = {
			# Increment cooldown breaker tally, if appropriate.
			# calculate_authority_cooldown_break_effect = yes
			# Set regular cooldown.
			set_variable = {
				name = crown_authority_cooldown_2
				years = @crown_authority_cooldown_2_years
			}
		}

		ai_will_do = {
			if = {
				limit = {
					has_realm_law = realm_administration_law_0		
				}
				value = 1
			}
		}
	}
	
	realm_administration_law_2 = {
		modifier = { 
			domain_tax_mult = -0.20
			levy_size = -0.20
			vassal_levy_contribution_mult = 0.20
			vassal_tax_contribution_mult = 0.20
			character_capital_county_monthly_development_growth_add = 0.20
			vassal_limit = 20
			general_opinion = 10
		}
		
		can_keep = { 
			highest_held_title_tier	>= 4
			realm_law_use_realm_administration_law = yes
			capital_province.county = { development_level >= 25 }
			capital_province = {
				is_county_capital = yes
				has_special_building = yes 
			}
		}
		
		can_pass = {
			trigger_if = {
				limit = { 
					OR = {
						has_realm_law = realm_administration_law_0
						has_realm_law = realm_administration_law_1
						has_realm_law = realm_administration_law_3
					}
				}
				custom_tooltip = {
					subject = root
					text = "has_crown_authority_cooldown_2"
					NOT = {
						has_variable = crown_authority_cooldown_2
					}
				}
			}
		}

		pass_cost = { 
			gold = {
				value = 0
				if = {
					limit = {
						is_ai = no
					}
					add = 500
				}
			} 
		}
		
		on_pass = {
			# Increment cooldown breaker tally, if appropriate.
		 	# calculate_authority_cooldown_break_effect = yes
			# Set regular cooldown.
			set_variable = {
				name = crown_authority_cooldown_2
				years = @crown_authority_cooldown_2_years
			}
		}

		ai_will_do = {
			if = {
				limit = {
					has_realm_law = realm_administration_law_1
				}
				value = 1
			}
		}
	}
	
	realm_administration_law_3 = {
		modifier = { 
			domain_tax_mult = -0.30
			levy_size = -0.30
			vassal_levy_contribution_mult = 0.30
			vassal_tax_contribution_mult = 0.30
			character_capital_county_monthly_development_growth_add = 0.30
			vassal_limit = 30
			general_opinion = 20
		}
		
		can_keep = {
			highest_held_title_tier	>= 5
			realm_law_use_realm_administration_law = yes
			is_independent_ruler = yes
			capital_province.county = { development_level >= 25 }
			capital_province = {
				is_county_capital = yes
				has_special_building = yes 
			}
		}
	
		can_pass = {
			trigger_if = {
				limit = { 
					OR = {
						has_realm_law = realm_administration_law_0
						has_realm_law = realm_administration_law_1
						has_realm_law = realm_administration_law_2
					}
				}
				custom_tooltip = {
					subject = root
					text = "has_crown_authority_cooldown_2"
					NOT = {
						has_variable = crown_authority_cooldown_2
					}
				}
			}
		}
		
		pass_cost = { 
			gold = {
				value = 0
				if = {
					limit = {
						is_ai = no
					}
					add = 1000
				}
			} 
		}
		
		on_pass = {
			# Increment cooldown breaker tally, if appropriate.
		 	# calculate_authority_cooldown_break_effect = yes
			# Set regular cooldown.
			set_variable = {
				name = crown_authority_cooldown_2
				years = @crown_authority_cooldown_2_years
			}
		}

		ai_will_do = {
			if = {
				limit = {
					has_realm_law = realm_administration_law_2
				}
				value = 1
			}
		}
	}
}

