﻿@crown_authority_cooldown_years = 20
@tribal_authority_cooldown_years = 10

crown_authority = {
	default = crown_authority_1
	cumulative = yes
	flag = realm_law
	
	crown_authority_0 = {
		modifier = {
			direct_vassal_opinion = 10
			#feudal_government_tax_contribution_mult = -0.1
			#vassal_levy_contribution_mult = -0.1
		}

		can_keep = { realm_law_use_crown_authority = yes }
	}
	
	crown_authority_1 = {
		modifier = {
			direct_vassal_opinion = -10
			#feudal_government_tax_contribution_mult = 0.1
			#vassal_levy_contribution_mult = 0.1
		}
		flag = title_revocation_allowed
		flag = vassal_retraction_allowed
		flag = can_change_partition_succession_laws

		can_keep = { realm_law_use_crown_authority = yes }

		can_pass = {
			trigger_if = {
				limit = { has_realm_law = crown_authority_0 }
				custom_description = {
					subject = root
					text = "has_crown_authority_cooldown"
					NAND = {
						has_variable = crown_authority_cooldown
						NOT = {
							culture = { has_innovation = innovation_all_things }
						}
					}
				}
			}
			root.culture = { has_innovation = innovation_plenary_assemblies }
		}
		
		pass_cost = {
			prestige = {
				if = {
					limit = {
						NOR = {
							has_realm_law = crown_authority_2
							has_realm_law = crown_authority_3
						}
					}
					add = increase_crown_authority_prestige_cost
				}
			}
		}
		
		on_pass = {
			# Increment cooldown breaker tally, if appropriate.
			calculate_authority_cooldown_break_effect = yes
			# Set regular cooldown.
			set_variable = {
				name = crown_authority_cooldown
				years = @crown_authority_cooldown_years
			}
		}

		ai_will_do = {
			if = {
				limit = { has_realm_law = crown_authority_0 }
				value = 1
			}
		}
	}
	
	crown_authority_2 = {
		modifier = {
			direct_vassal_opinion = -10
			feudal_government_tax_contribution_mult = 0.1
			vassal_levy_contribution_mult = 0.1
		}
		flag = vassal_refusal_is_treason
		flag = can_change_succession_laws
		flag = titles_cannot_leave_realm_on_succession # Hardcoded flag
		
		can_keep = { realm_law_use_crown_authority = yes }

		can_pass = {
			trigger_if = {
				limit = {
					NOT = { has_realm_law = crown_authority_3 }
				}
				has_realm_law = crown_authority_1
				custom_description = {
					subject = root
					text = "has_crown_authority_cooldown"
					NAND = {
						has_variable = crown_authority_cooldown
						NOT = {
							culture = { has_innovation = innovation_all_things }
						}
					}
				}
			}
			root.culture = { has_innovation = innovation_royal_prerogative }
		}

		pass_cost = {
			prestige = {
				if = {
					limit = {
						NOT = { has_realm_law = crown_authority_3 }
					}
					add = increase_crown_authority_prestige_cost
				}
			}
		}
		
		on_pass = {
			# Increment cooldown breaker tally, if appropriate.
			calculate_authority_cooldown_break_effect = yes
			# Set regular cooldown.
			set_variable = {
				name = crown_authority_cooldown
				years = @crown_authority_cooldown_years
			}
		}

		ai_will_do = {
			if = {
				limit = { has_realm_law = crown_authority_1 }
				value = 1
			}
		}
	}
	
	crown_authority_3 = {
		modifier = {
			direct_vassal_opinion = -20
			feudal_government_tax_contribution_mult = 0.25
			vassal_levy_contribution_mult = 0.25
		}
		flag = can_designate_heirs
		
		can_keep = { realm_law_use_crown_authority = yes }

		can_pass = {
			has_realm_law = crown_authority_2
			custom_description = {
				subject = root
				text = "has_crown_authority_cooldown"
				NAND = {
					has_variable = crown_authority_cooldown
					NOT = {
						culture = { has_innovation = innovation_all_things }
					}
				}
			}
			root.culture = { has_innovation = innovation_royal_prerogative }
		}
		
		pass_cost = {
			prestige = {
				if = {
					limit = {
						NOT = { has_realm_law = crown_authority_3 }
					}
					add = increase_crown_authority_prestige_cost
				}
			}
		}
		
		on_pass = {
			# Increment cooldown breaker tally, if appropriate.
			calculate_authority_cooldown_break_effect = yes
			# Set regular cooldown.
			set_variable = {
				name = crown_authority_cooldown
				years = @crown_authority_cooldown_years
			}
		}
	}
}

tribal_authority = {
	default = tribal_authority_1
	cumulative = yes
	flag = realm_law
	
	tribal_authority_0 = {
		modifier = { direct_vassal_opinion = 10 }

		can_keep = { realm_law_use_crown_authority = no }
		#Imprisonment is disabled if you have this law. Script is in the interaction, currently in 00_prison_interactions.
	}
	
	tribal_authority_1 = {
		modifier = { direct_vassal_opinion = -10 }
		flag = can_change_succession_laws

		can_keep = { realm_law_use_crown_authority = no }

		can_pass = {
			trigger_if = {
				limit = { has_realm_law = tribal_authority_0 }
				custom_description = {
					subject = root
					text = "has_tribal_authority_cooldown"
					NAND = {
						has_variable = tribal_authority_cooldown
						NOT = {
							culture = { has_innovation = innovation_all_things }
						}
					}
				}
			}
		}
		
		pass_cost = {
			prestige = {
				if = {
					limit = {
						NOR = {
							has_realm_law = tribal_authority_2
							has_realm_law = tribal_authority_3
						}
					}
					add = increase_tribal_authority_prestige_cost
				}
			}
		}
		
		on_pass = {
			# Increment cooldown breaker tally, if appropriate.
			calculate_authority_cooldown_break_effect = yes
			# Set regular cooldown.
			set_variable = {
				name = tribal_authority_cooldown
				years = @tribal_authority_cooldown_years
			}
		}

		ai_will_do = {
			if = {
				limit = { has_realm_law = tribal_authority_0 }
				value = 1
			}
		}
	}
	
	tribal_authority_2 = {
		modifier = { direct_vassal_opinion = -10 }
		flag = title_revocation_allowed
		flag = vassal_retraction_allowed
		
		can_keep = { realm_law_use_crown_authority = no }
		
		can_pass = {
			trigger_if = {
				limit = {
					NOT = { has_realm_law = tribal_authority_3 }
				}
				has_realm_law = tribal_authority_1
				custom_description = {
					subject = root
					text = "has_tribal_authority_cooldown"
					NAND = {
						has_variable = tribal_authority_cooldown
						NOT = {
							culture = { has_innovation = innovation_all_things }
						}
					}
				}
			}
		}

		pass_cost = {
			prestige = {
				if = {
					limit = {
						NOT = { has_realm_law = tribal_authority_3 }
					}
					add = increase_tribal_authority_prestige_cost
				}
			}
		}
		
		on_pass = {
			# Increment cooldown breaker tally, if appropriate.
			calculate_authority_cooldown_break_effect = yes
			# Set regular cooldown.
			set_variable = {
				name = tribal_authority_cooldown
				years = @tribal_authority_cooldown_years
			}
		}

		ai_will_do = {
			if = {
				limit = { has_realm_law = tribal_authority_1 }
				value = 1
			}
		}
	}
	
	tribal_authority_3 = {
		modifier = { direct_vassal_opinion = -20 }
		#Settling is disabled unless you have this law. Script is in the decisions, currently in 80_major_decisions.
		#Reforming pagan religions (but not creating other faiths) is disabled unless you have this law. Script is in the reformation prereqs, currently in 00_rules.
		
		can_keep = { realm_law_use_crown_authority = no }
		
		can_pass = {
			has_realm_law = tribal_authority_2
			custom_description = {
				subject = root
				text = "has_tribal_authority_cooldown"
				NAND = {
						has_variable = tribal_authority_cooldown
						NOT = {
							culture = { has_innovation = innovation_all_things }
						}
					}
			}
		}
		
		pass_cost = { prestige = increase_tribal_authority_prestige_cost }
		
		on_pass = {
			# Increment cooldown breaker tally, if appropriate.
			calculate_authority_cooldown_break_effect = yes
			# Set regular cooldown.
			set_variable = {
				name = tribal_authority_cooldown
				years = @tribal_authority_cooldown_years
			}
		}

		ai_will_do = {
			if = {
				limit = { has_realm_law = tribal_authority_2 }
				value = 1
			}
		}
	}
}
######额外
military_system = { ##军事制度
	default = chivalry_system
	cumulative = no
	flag = military_law
	flag = imperial_law
	chivalry_system = {
		modifier = {
			knight_limit = 4
			knight_effectiveness_mult = 0.25
		}		
		can_keep = { realm_law_use_crown_authority = yes }

		pass_cost = {
			prestige = 1000
		}
		
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}	
	conscription = {
		modifier = {
			levy_size = 0.5
			men_at_arms_cap = -5
		}

		can_keep = { realm_law_use_crown_authority = yes }
		pass_cost = {
			prestige = 1000
		}
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}	
	professional_army = {
		modifier = {
			men_at_arms_cap = 5
			men_at_arms_maintenance = -0.25
		}		
		can_keep = { realm_law_use_crown_authority = yes }
		pass_cost = {
			prestige = 1000
		}
		
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}
	
	mercenary = {
		modifier = {
			mercenary_hire_cost_mult = -0.5
			men_at_arms_cap = -5
		}		
		can_keep = { realm_law_use_crown_authority = yes }


		pass_cost = {
			prestige = 1000
		}
		
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}
}
ruling_system = { ##帝国制度
	default = natural_law
	cumulative = no
	flag = ruling_law
	flag = imperial_law
	natural_law = {
		modifier = {
		}

		can_keep = { realm_law_use_crown_authority = yes }
		
		pass_cost = {
			prestige = 1000
		}
		
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}	
	codified_law = {
		modifier = {
			dread_baseline_add = 50
			dread_decay_mult = -0.1
			tyranny_gain_mult = 0.50
		}

		can_keep = { realm_law_use_crown_authority = yes }
		pass_cost = {
			prestige = 1000
		}
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}
	moral_law = {
		modifier = {
			dynasty_house_opinion = 10
			dynasty_opinion = 10
			scheme_power = -10
		}

		can_keep = { realm_law_use_crown_authority = yes }
		pass_cost = {
			prestige = 1000
		}
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}			
	customary_law = {
		modifier = {
			long_reign_bonus_mult = 0.3
			short_reign_duration_mult = 0.2
		}
		
		can_keep = { realm_law_use_crown_authority = yes }


		pass_cost = {
			prestige = 1000
		}
		
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}
}
diplomacy_system = { ##外交姿态
	default = diplomacy_balance
	cumulative = no
	flag = diplomacy_law
	flag = imperial_law
	diplomacy_balance = {
		modifier = {
		}

		can_keep = { 
			realm_law_use_crown_authority = yes
		}
		
		pass_cost = {
			prestige = 1000
		}
		
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}	
	diplomacy_guest = {
		modifier = {
			courtier_and_guest_opinion = 20
			ignore_negative_culture_opinion = yes
			vassal_opinion = -10
		}

		can_keep = { 
			realm_law_use_crown_authority = yes
		}
		pass_cost = {
			prestige = 1000
		}
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}	
	diplomacy_inner = {
		modifier = {
			vassal_opinion = 10
			fellow_vassal_opinion = 10
			independent_ruler_opinion = -10
		}

		can_keep = { 
			realm_law_use_crown_authority = yes
		}
		pass_cost = {
			prestige = 1000
		}
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}
		
	diplomacy_outer = {
		modifier = {
			vassal_opinion = -5
			independent_ruler_opinion = 10
		}
		
		can_keep = { 
			realm_law_use_crown_authority = yes
		}

		pass_cost = {
			prestige = 1000
		}
		
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}
}
#####
tax_law = { ##税法
	default = general_taxes
	cumulative = no
	flag = tax_law
	flag = imperial_law
	general_taxes = {
		modifier = {
		}

		can_keep = { 
			realm_law_use_crown_authority = yes
		}
		
		pass_cost = {
			prestige = 1000
		}
		
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}	
	higher_taxes = {
		modifier = {
			domain_tax_mult = 0.2
			county_opinion_add = -10
		}

		can_keep = { 
			realm_law_use_crown_authority = yes
		}
		pass_cost = {
			prestige = 1000
		}
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}
	harsh_taxes = {
		modifier = {
			domain_tax_mult = 0.4
			county_opinion_add = -20
		}

		can_keep = { 
			realm_law_use_crown_authority = yes
		}
		pass_cost = {
			prestige = 1000
		}
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}
		
	low_taxes = {
		modifier = {
			domain_tax_mult = -0.4
			county_opinion_add = 10
			monthly_county_control_change_add = 0.2
		}
		
		can_keep = { 
			realm_law_use_crown_authority = yes
		}


		pass_cost = {
			prestige = 1000
		}
		
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}
}
declare_war = { ##宣战权
	default = defaul_declare_war
	cumulative = no
	flag = declare_wars
	flag = imperial_law
	defaul_declare_wars = {
		modifier = {
		}

		can_keep = { 
			realm_law_use_crown_authority = yes
		}
		
		pass_cost = {
			prestige = 1000
		}
		
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}
	foreign_wars_banned = {
		modifier = {
		}
		flag = vassal_foreign_wars_banned
		can_keep = { 
			realm_law_use_crown_authority = yes
			OR = {
				has_realm_law = crown_authority_2
				has_realm_law = crown_authority_3
			}
		}
		can_pass = {
		}
		pass_cost = {
			prestige = 1000
		}
		
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}	
	internal_wars_banned = {
		modifier = {

		}

		can_keep = { 
			realm_law_use_crown_authority = yes
			OR = {
				has_realm_law = crown_authority_2
				has_realm_law = crown_authority_3
			}
		}
		flag = vassal_internal_wars_banned
		pass_cost = {
			prestige = 1000
		}
		can_pass = {
		}
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
		ai_will_do = {
			if = {
				limit = { has_realm_law = crown_authority_2 }
				value = 1
			}
			if = {
				limit = { has_realm_law = crown_authority_3 }
				value = 1
			}
		}
	}
	all_wars_banned = {
		modifier = {
		}
		flag = vassal_all_wars_banned
		can_keep = { 
			realm_law_use_crown_authority = yes
			has_realm_law = crown_authority_3
		}
		can_pass = {
		}

		pass_cost = {
			prestige = 1000
		}
		
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
		ai_will_do = {
			if = {
				limit = { has_realm_law = crown_authority_3 }
				value = 1
			}
		}
	}
}
religious_law = { ##宗教法
	default = defaul_religious_law
	cumulative = no
	flag = religious_law
	flag = imperial_law
	defaul_religious_law = {
		modifier = {
		}

		can_keep = { 
			realm_law_use_crown_authority = yes			
		}
		
		pass_cost = {
			prestige = 1000
		}
		
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}	
	free_religious_law = {
		modifier = {

		}
		modifier = {
			ignore_different_faith_opinion = yes
			different_faith_county_opinion_mult = -0.8
		}
		can_keep = { 
			realm_law_use_crown_authority = yes
			OR = {
				is_independent_ruler = yes
				custom_description = {
					text = "religiously_protected"
					vassal_contract_has_flag = religiously_protected
				}
			}
		}
		pass_cost = {
			prestige = 1000
		}
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}
	tithe_law = {
		modifier = {
		}
		
		can_keep = { 
			realm_law_use_crown_authority = yes
		}
		modifier = {
			domain_tax_different_faith_mult = 0.45
			different_faith_county_opinion_mult = -0.1
		}
		pass_cost = {
			prestige = 1000
		}
		
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}	
	inquisition = {
		modifier = {
		}
		
		can_keep = { 
			realm_law_use_crown_authority = yes
		}
		modifier = {
			different_faith_opinion = -100
			different_faith_county_opinion_mult = 0.5
		}
		pass_cost = {
			prestige = 1000
		}
		
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}
}
#############宫廷
beard_law = { ##胡子法
	default = none_beard_law
	cumulative = no
	flag = beard_law
	flag = imperial_law
	none_beard_law = {
		modifier = {
		}
		can_keep = { 
			realm_law_use_crown_authority = yes			
		}		
		pass_cost = {
			prestige = 1000
		}		
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}	
	no_beard = {
		modifier = {

		}
		modifier = {
			vassal_opinion = -10
			courtier_and_guest_opinion = -10
			cultural_head_fascination_mult = 0.1
		}
		can_keep = { 
			realm_law_use_crown_authority = yes
		}
		pass_cost = {
			prestige = 1000
		}
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}
}
court_art = { ##宫廷艺术
	default = my_court_art
	cumulative = no
	flag = art_law
	flag = imperial_law
	my_court_art = {
		modifier = {
		}
		can_keep = { 
			realm_law_use_crown_authority = yes			
		}		
		pass_cost = {
			prestige = 1000
		}		
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}	
	liege_court_art = {
		modifier = {

		}
		modifier = {
			liege_opinion = 10
			same_culture_opinion = -10
		}
		can_keep = { 
			realm_law_use_crown_authority = yes
			is_independent_ruler = no
		}
		pass_cost = {
			prestige = 1000
		}
		on_pass = {
			set_variable = {
				name = country_law_cooldown
				years = 10
			}
		}
	}
}