# Crown level (de jure) laws
# Laws ending with 0 will be default laws at game start

de_jure_laws = {

# CROWN AUTHORITY (renamed CROWN OBLIGATIONS and split out CROWN LEVIES)
	crown_authority_0 = {
		show_as_title = yes
		group = crown_authority
		default = yes
		
		feudal_opinion = 5
		city_opinion = 5
		temple_opinion = 5
		
		allow = {
			holder_scope = { is_republic = no }
			has_law = crown_authority_1
		}
		potential = {
			NOT = { has_dlc = "Zeus" }
			holder_scope = {
				is_tribal = no
				is_nomadic = no
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0
		}
		ai_will_revoke = {
			factor = 0
		}
		effect = {
			hidden_tooltip = {
				revoke_law = crown_authority_0
				revoke_law = crown_authority_1
				revoke_law = crown_authority_2
				revoke_law = crown_authority_3
				revoke_law = crown_authority_4
			}
			
			#set_appoint_generals = no
			#set_appoint_regents = no
			set_the_kings_peace = no
			set_the_kings_full_peace = no
			set_protected_inheritance = no
			set_allow_title_revokation = no
			#set_allow_free_revokation = no
		}
	}
	
	crown_authority_1 = {
		show_as_title = yes
		group = crown_authority
		
		feudal_opinion = -5
		city_opinion = -5
		temple_opinion = -5
		
		allow = {
			OR = {
				has_law = crown_authority_0
				has_law = crown_authority_2
			}
		}
		potential = {
			NOT = { has_dlc = "Zeus" }
			holder_scope = {
				is_tribal = no
				is_nomadic = no
			}
		}
		revoke_allowed = {
			always = no
		}			
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				NOT = { has_law = crown_authority_0 }
			}
			modifier = { factor = 2 holder_scope = { trait = ambitious } }
			modifier = { factor = 0.5 holder_scope = { trait = content } }
			modifier = { factor = 1.2 holder_scope = { trait = greedy } }
			modifier = { factor = 0.8 holder_scope = { trait = charitable } }
			modifier = { factor = 1.2 holder_scope = { trait = envious } }
			modifier = { factor = 0.8 holder_scope = { trait = kind } }
			modifier = { factor = 1.2 holder_scope = { trait = proud } }
			modifier = { factor = 0.8 holder_scope = { trait = humble } }
		}
		ai_will_revoke = {
			factor = 0
		}
		
		pass_effect = {
			hidden_tooltip = {
				if = { 
					limit = {
						has_law = crown_authority_0
					}
					any_de_jure_vassal = {
						limit = {
							OR = {
								religion_group = ROOT
								is_liege_or_above = ROOT
							}
						}
						opinion = {
							who = ROOT
							modifier = opinion_increased_authority
							months = 60
						}
					}
				}
			}
		}
		
		effect = {
			hidden_tooltip = {
				revoke_law = crown_authority_0
				revoke_law = crown_authority_1
				revoke_law = crown_authority_2
				revoke_law = crown_authority_3
				revoke_law = crown_authority_4
			}
			#set_appoint_generals = yes
			#set_appoint_regents = no
			set_the_kings_peace = no
			set_protected_inheritance = yes
			set_allow_title_revokation = no
			
			#set_allow_free_revokation = no
		}
	}
	
	crown_authority_2 = {
		show_as_title = yes
		group = crown_authority
		
		feudal_opinion = -10
		city_opinion = -10
		temple_opinion = -10
		
		allow = {
			holder_scope = { 
				is_republic = no 
			}
			OR = {
				has_law = crown_authority_1
				has_law = crown_authority_3
			}
		}
		potential = {
			NOT = { has_dlc = "Zeus" }
			holder_scope = {
				is_tribal = no
				is_nomadic = no
			}
		}
		revoke_allowed = {
			always = no
		}			
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.01
			}
			modifier = {
				factor = 0
				NOT = { has_law = crown_authority_1 }
			}
			modifier = { factor = 2 holder_scope = { trait = ambitious } }
			modifier = { factor = 0.5 holder_scope = { trait = content } }
			modifier = { factor = 1.2 holder_scope = { trait = greedy } }
			modifier = { factor = 0.8 holder_scope = { trait = charitable } }
			modifier = { factor = 1.2 holder_scope = { trait = envious } }
			modifier = { factor = 0.8 holder_scope = { trait = kind } }
			modifier = { factor = 1.2 holder_scope = { trait = proud } }
			modifier = { factor = 0.8 holder_scope = { trait = humble } }
		}
		ai_will_revoke = {
			factor = 0
		}
		
		pass_effect = {
			hidden_tooltip = {
				if = { 
					limit = {
						has_law = crown_authority_1
					}
					any_de_jure_vassal = {
						limit = {
							OR = {
								religion_group = ROOT
								is_liege_or_above = ROOT
							}
						}
						opinion = {
							who = ROOT
							modifier = opinion_increased_authority
							months = 60
						}
					}
				}
			}
		}
		
		effect = {
			hidden_tooltip = {
				revoke_law = crown_authority_0
				revoke_law = crown_authority_1
				revoke_law = crown_authority_2
				revoke_law = crown_authority_3
				revoke_law = crown_authority_4
			}
			#set_appoint_generals = yes
			#set_appoint_regents = no
			set_the_kings_peace = no
			set_protected_inheritance = yes
			set_allow_title_revokation = yes
			#set_allow_free_revokation = no
		}
	}
	
	crown_authority_3 = {
		show_as_title = yes
		group = crown_authority
		
		feudal_opinion = -15
		city_opinion = -15
		temple_opinion = -15
		
		allow = {
			holder_scope = { 
				is_republic = no 
			}
			OR = {
				has_law = crown_authority_2
				has_law = crown_authority_4
			}
		}
		potential = {
			NOT = { has_dlc = "Zeus" }
			holder_scope = {
				is_tribal = no
				is_nomadic = no
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.005
			}
			modifier = {
				factor = 0
				OR = {
					NOT = { has_law = crown_authority_2 }
					NOT = { ruled_years = 20 }
				}
			}
			modifier = { factor = 0 NOT = { has_law = crown_authority_2 } }
			modifier = { factor = 0.01 }
			modifier = { factor = 2 holder_scope = { trait = ambitious } }
			modifier = { factor = 0.5 holder_scope = { trait = content } }
			modifier = { factor = 1.2 holder_scope = { trait = greedy } }
			modifier = { factor = 0.8 holder_scope = { trait = charitable } }
			modifier = { factor = 1.2 holder_scope = { trait = envious } }
			modifier = { factor = 0.8 holder_scope = { trait = kind } }
			modifier = { factor = 1.2 holder_scope = { trait = proud } }
			modifier = { factor = 0.8 holder_scope = { trait = humble } }
		}
		ai_will_revoke = {
			factor = 0
		}
		
		pass_effect = {
			hidden_tooltip = {
				if = { 
					limit = {
						has_law = crown_authority_2
					}
					any_de_jure_vassal = {
						limit = {
							OR = {
								religion_group = ROOT
								is_liege_or_above = ROOT
							}
						}
						opinion = {
							who = ROOT
							modifier = opinion_increased_authority
							months = 60
						}
					}
				}
			}
		}
		
		effect = {
		
			hidden_tooltip = {
				revoke_law = crown_authority_0
				revoke_law = crown_authority_1
				revoke_law = crown_authority_2
				revoke_law = crown_authority_3
				revoke_law = crown_authority_4
			}
			#set_appoint_generals = yes
			#set_appoint_regents = yes
			set_the_kings_peace = yes
			set_protected_inheritance = yes
			set_allow_title_revokation = yes
			#set_allow_free_revokation = no
		}
	}
	
	crown_authority_4 = {
		show_as_title = yes
		group = crown_authority
		
		feudal_opinion = -20
		city_opinion = -20
		temple_opinion = -20
		
		allow = {
			has_law = crown_authority_3
		}
		potential = {
			NOT = { has_dlc = "Zeus" }
			holder_scope = {
				is_republic = no
				is_tribal = no
				is_nomadic = no
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.001
			}
			modifier = {
				factor = 0
				OR = {
					NOT = { has_law = crown_authority_3 }
					NOT = { ruled_years = 20 }
				}
			}
		}
		
		ai_will_revoke = {
			factor = 0
		}
		
		pass_effect = {
			hidden_tooltip = {
				if = { 
					limit = {
						has_law = crown_authority_3
					}
					any_de_jure_vassal = {
						limit = {
							OR = {
								religion = ROOT
								is_liege_or_above = ROOT
							}
						}
						opinion = {
							who = ROOT
							modifier = opinion_increased_authority
							months = 60
						}
					}
				}
			}
		}
		
		effect = {
			hidden_tooltip = {
				revoke_law = crown_authority_0
				revoke_law = crown_authority_1
				revoke_law = crown_authority_2
				revoke_law = crown_authority_3
				revoke_law = crown_authority_4
			}
			#set_appoint_generals = yes
			#set_appoint_regents = yes
			set_the_kings_peace = yes
			set_the_kings_full_peace = yes
			set_protected_inheritance = yes
			set_allow_title_revokation = yes
			#set_allow_free_revokation = yes
		}
	}
	
# INVESTITURE

	# Papal Investiture
	investiture_law_0 = {
		show_as_title = yes
		group = investiture_law
		default = yes
		potential = {
			always = no
		}
		revoke_allowed = {
			always = no
		}			
		ai_will_do = {
			factor = 0
		}
		ai_will_revoke = {
			factor = 0
		}
		effect = {
			hidden_tooltip = {
				revoke_law = investiture_law_0
				revoke_law = investiture_law_1
			}
			set_investiture = head
		}
	}
	
	# Free Investiture
	investiture_law_1 = {
		show_as_title = yes
		rel_head_opinion = -30
		free_invest_vassal_opinion = 10 # vassals with bishops will appreciate this law
		temple_all_opinion = 10 # Bishops will tend to be more loyal to the Crown
		group = investiture_law
		potential = {
			always = no
		}
		allow = {
			holy_order = no
		}
		revoke_allowed = {
			always = no
		}			
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.002 # Rare to do this
			}
			modifier = {
				factor = 0
				OR = {
					holder_scope = {
						NOT = { trait = cynical }
					}
					NOT = { has_law = investiture_law_0 }
				}
			}
		}
		ai_will_revoke = {
			factor = 0
		}
		effect = {
			hidden_tooltip = {
				revoke_law = investiture_law_0
				revoke_law = investiture_law_1
			}
			set_investiture = any
		}
	}
	
}
