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

de_jure_laws = {

# CROWN AUTHORITY

	crown_authority_0 = {
		show_as_title = yes
		group = crown_authority
		default = yes
		
		feudal_opinion = 20
		city_opinion = 20
		temple_opinion = 20
		
		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_infidel_revokation = no
			#set_allow_free_revokation = no
		}
		
		city_vassal_min_levy = 0.0
		castle_vassal_min_levy = 0.0
		temple_vassal_min_levy = 0.0
	}
	
	crown_authority_1 = {
		show_as_title = yes
		group = crown_authority
		
		feudal_opinion = 15
		city_opinion = 15
		temple_opinion = 15
		
		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 }
			}
		}
		ai_will_revoke = {
			factor = 0
		}
		
		pass_effect = {
			hidden_tooltip = {
				if = { 
					limit = {
						has_law = crown_authority_0
					}
					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 = no
			set_the_kings_peace = no
			set_the_kings_full_peace = no
			set_protected_inheritance = no
			set_allow_title_revokation = yes
			set_allow_free_infidel_revokation = no
			#set_allow_free_revokation = no
		}
		
		city_vassal_min_levy = 0.2
		castle_vassal_min_levy = 0.2
		temple_vassal_min_levy = 0.2
	}
	
	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 
				
				custom_tooltip = { 
					text = TT_NOT_UNREFORMED_PAGAN
					hidden_tooltip = {
						OR = {
							NOT = { religion_group = pagan_group }
							is_reformed_religion = yes
							religion = bon
							religion = bon_reformed
						}
					}
				}
			}
			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 }
			}
		}
		ai_will_revoke = {
			factor = 0
		}
		
		pass_effect = {
			hidden_tooltip = {
				if = { 
					limit = {
						has_law = crown_authority_1
					}
					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 = no
			set_the_kings_peace = yes
			set_the_kings_full_peace = no
			set_protected_inheritance = no
			set_allow_title_revokation = yes
			set_allow_free_infidel_revokation = yes
			#set_allow_free_revokation = no
		}
		
		city_vassal_min_levy = 0.4
		castle_vassal_min_levy = 0.4
		temple_vassal_min_levy = 0.4
	}
	
	crown_authority_3 = {
		show_as_title = yes
		group = crown_authority
		
		feudal_opinion = 5
		city_opinion = 5
		temple_opinion = 5
		
		allow = {
			holder_scope = { 
				is_republic = no 
				custom_tooltip = {
					text = TT_NOT_UNREFORMED_PAGAN
					hidden_tooltip = {
						OR = {
							NOT = { religion_group = pagan_group }
							is_reformed_religion = yes
							religion = bon
							religion = bon_reformed
						}
					}
				}
			}
			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 }
				}
			}
		}
		ai_will_revoke = {
			factor = 0
		}
		
		pass_effect = {
			hidden_tooltip = {
				if = { 
					limit = {
						has_law = crown_authority_2
					}
					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 = no
			set_protected_inheritance = yes
			set_allow_title_revokation = yes
			set_allow_free_infidel_revokation = yes
			#set_allow_free_revokation = no
		}
		
		city_vassal_min_levy = 0.6
		castle_vassal_min_levy = 0.6
		temple_vassal_min_levy = 0.6
	}
	
	crown_authority_4 = {
		show_as_title = yes
		group = crown_authority
		
		feudal_opinion = 0
		city_opinion = 0
		temple_opinion = 0
		
		allow = {
			holder_scope = { 
				is_republic = no 
				custom_tooltip = {
					text = TT_NOT_UNREFORMED_PAGAN
					hidden_tooltip = {
						OR = {
							NOT = { religion_group = pagan_group }
							is_reformed_religion = yes
							religion = bon
							religion = bon_reformed
						}
					}
				}
			}
			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.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_infidel_revokation = yes
			#set_allow_free_revokation = yes
		}
		
		city_vassal_min_levy = 0.8
		castle_vassal_min_levy = 0.8
		temple_vassal_min_levy = 0.8
	}
	
# INVESTITURE

	# Papal Investiture
	investiture_law_0 = {
		show_as_title = yes
		group = investiture_law
		default = yes
		potential = {
			holder_scope = {
				OR = {
					religion = catholic
					religion = fraticelli
				}
				is_tribal = no
				is_nomadic = no
				NOT = {
					rightful_religious_head_scope = {
						character = ROOT
					}
				}
			}
		}
		allow = {
			year = 1000
		}
		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 = 25 # vassals with bishops will appreciate this law
		temple_all_opinion = 50 # Bishops will tend to be more loyal to the Crown
		group = investiture_law
		potential = {
			holder_scope = {
				OR = {
					religion = catholic
					religion = fraticelli
				}
				is_tribal = no
				is_nomadic = no
				NOT = {
					rightful_religious_head_scope = {
						character = ROOT
					}
				}
			}
		}
		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
		}
	}	
}
