law_groups = {
	out_of_realm_inheritance_law = {
		allowed_for_councillors = yes
	}

	vassal_wars_law = {
		allowed_for_councillors = yes
	}
}

de_jure_laws = {
	# Out of Realm Inheritance
	out_of_realm_inheritance_law_0 = {
		group = out_of_realm_inheritance_law
		default = yes

		potential = {
			holder_scope = {
				is_feudal = yes
				NOT = { government = order_government }
			}
		}

		allow = {
			show_only_failed_conditions = yes
			has_law = out_of_realm_inheritance_law_1
		}

		pass_effect = {
			# log = "out_of_realm_inheritance_law_0 pass ([This.GetFullBaseName])"
		}

		effect = {
			# log = "out_of_realm_inheritance_law_0 ([This.GetFullBaseName])"
			revoke_law = out_of_realm_inheritance_law_1
			set_protected_inheritance = no
		}

		ai_will_do = {
			factor = 0
		}
	}

	out_of_realm_inheritance_law_1 = {
		group = out_of_realm_inheritance_law

		potential = {
			is_law_potential = out_of_realm_inheritance_law_0
		}

		allow = {
			show_only_failed_conditions = yes

			has_law = out_of_realm_inheritance_law_0

			trigger_if = {
				limit = { has_dlc = "Conclave" }

				show_only_failed_conditions = yes

				OR = {
					has_law = ze_administration_laws_1
					has_law = ze_administration_laws_2
				}
			}

			trigger_if = {
				limit = { is_crown_law_title = yes }

				show_only_failed_conditions = yes

				OR = {
					has_law = crown_authority_3
					has_law = crown_authority_4
				}
			}
			trigger_else_if = {
				limit = {
					has_crown_law_title = yes
					crownlaw_title = { holder_scope = { has_landed_title = ROOT } }
				}

				show_only_failed_conditions = yes

				crownlaw_title = {
					OR = {
						has_law = crown_authority_3
						has_law = crown_authority_4
					}
				}
			}

			holder_scope = {
				show_scope_change = no

				plus_law_prestige_trigger_1 = yes
				NOT = { trait = uncrowned }
			}
		}

		pass_effect = {
			# log = "out_of_realm_inheritance_law_1 pass ([This.GetFullBaseName])"
			plus_law_change_prestige_effect_1 = yes
		}

		effect = {
			# log = "out_of_realm_inheritance_law_1 ([This.GetFullBaseName])"

			tooltip = { # pass_effect doesn't generate tooltips
				plus_law_change_prestige_effect_1 = yes
			}

			set_protected_inheritance = yes
			revoke_law = out_of_realm_inheritance_law_0
		}

		ai_will_do = {
			factor = 0.05

			mult_modifier = {
				factor = 20

				holder_scope = {
					any_demesne_title = {
						current_heir = {
							NOT = { same_realm = PREVPREV }
						}
					}
				}
			}
		}
	}

	# VASSAL WAR DECLARATION LAWS
	vassal_wars_law_0 = {
		group = vassal_wars_law
		default = yes

		potential = {
			holder_scope = {
				is_feudal = yes
				NOT = { government = order_government }
			}

			OR = {
				has_law = crown_authority_0
				has_law = crown_authority_1
				has_law = crown_authority_2
				has_law = crown_authority_3
				has_law = crown_authority_4
			}
		}

		allow = {
			show_only_failed_conditions = yes

			trigger_if = {
				limit = { has_dlc = "Conclave" }

				show_only_failed_conditions = yes

				holder_scope = {
					show_scope_change = no
					has_law = law_voting_power_0
				}
			}

			trigger_if = {
				limit = {
					OR = {
						has_law = vassal_wars_law_0
						has_law = vassal_wars_law_1
						has_law = vassal_wars_law_2
					}
				}

				show_only_failed_conditions = yes

				OR = {
					has_law = vassal_wars_law_1
					has_law = vassal_wars_law_2
				}
			}
		}

		pass_effect = {
			# log = "vassal_wars_law_0 pass ([This.GetFullBaseName])"

			if = {
				limit = {
					has_game_started = yes
					NOT = { has_title_flag = non_manual_law_change } # No opinion penalty

					OR = {
						has_law = vassal_wars_law_1
						has_law = vassal_wars_law_2
					}
				}

				decreased_crown_authority_effect = yes
			}
		}

		effect = {
			# log = "vassal_wars_law_0 ([This.GetFullBaseName])"
			set_the_kings_peace = no
			set_the_kings_full_peace = no
			revoke_law = vassal_wars_law_1
			revoke_law = vassal_wars_law_2
		}

		ai_will_do = {
			factor = 0
		}
	}

	vassal_wars_law_1 = {
		group = vassal_wars_law

		tribal_opinion = -5
		feudal_opinion = -5

		potential = {
			is_law_potential = vassal_wars_law_0
		}

		allow = {
			show_only_failed_conditions = yes

			OR = {
				has_law = vassal_wars_law_0
				has_law = vassal_wars_law_2
			}

			trigger_if = {
				limit = { has_dlc = "Conclave" }

				show_only_failed_conditions = yes

				holder_scope = {
					show_scope_change = no
					has_law = law_voting_power_0
				}
			}

			trigger_if = {
				limit = { has_dlc = "Conclave" }

				show_only_failed_conditions = yes

				OR = {
					has_law = ze_administration_laws_1
					has_law = ze_administration_laws_2
				}
			}

			trigger_if = {
				limit = { has_dlc = "Conclave" }

				trigger_if = {
					limit = { is_crown_law_title = yes }

					show_only_failed_conditions = yes

					OR = {
						has_law = crown_authority_2
						has_law = crown_authority_3
						has_law = crown_authority_4
					}
				}
				trigger_else_if = {
					limit = {
						has_crown_law_title = yes
						crownlaw_title = { holder_scope = { has_landed_title = ROOT } }
					}

					crownlaw_title = {
						OR = {
							has_law = crown_authority_2
							has_law = crown_authority_3
							has_law = crown_authority_4
						}
					}
				}
			}
			trigger_else = {
				OR = {
					trigger_if = {
						limit = { is_crown_law_title = yes }
						has_law = crown_authority_4
					}
					trigger_else_if = {
						limit = {
							has_crown_law_title = yes
							crownlaw_title = { holder_scope = { has_landed_title = ROOT } }
						}

						crownlaw_title = { has_law = crown_authority_4 }
					}

					trigger_if = {
						limit = { is_crown_law_title = yes }

						trigger_if = {
							limit = { has_dlc = "Conclave" }
							has_law = ze_administration_laws_2
						}
						trigger_else = {
							has_law = imperial_administration
						}

						OR = {
							has_law = crown_authority_2
							has_law = crown_authority_3
						}
					}
					trigger_else_if = {
						limit = {
							has_crown_law_title = yes
							crownlaw_title = { holder_scope = { has_landed_title = ROOT } }
						}

						crownlaw_title = {
							trigger_if = {
								limit = { has_dlc = "Conclave" }
								has_law = ze_administration_laws_2
							}
							trigger_else = {
								has_law = imperial_administration
							}

							OR = {
								has_law = crown_authority_2
								has_law = crown_authority_3
							}
						}
					}

					trigger_if = {
						limit = { is_crown_law_title = yes }

						has_law = crown_authority_2

						holder_scope = {
							show_scope_change = no

							OR = {
								government = theocratic_feudal_government
								government = chinese_imperial_government
							}
						}
					}
					trigger_else_if = {
						limit = {
							has_crown_law_title = yes
							crownlaw_title = { holder_scope = { has_landed_title = ROOT } }
						}

						crownlaw_title = {
							has_law = crown_authority_2

							holder_scope = {
								show_scope_change = no

								OR = {
									government = theocratic_feudal_government
									government = chinese_imperial_government
								}
							}
						}
					}
				}
			}

			holder_scope = {
				show_scope_change = no

				trigger_if = {
					limit = { ROOT = { NOT = { has_law = vassal_wars_law_2 } } }
					plus_law_prestige_trigger_1 = yes
				}

				NOT = { trait = uncrowned }
			}
		}

		pass_effect = {
			# log = "vassal_wars_law_1 pass ([This.GetFullBaseName])"

			if = {
				limit = {
					has_game_started = yes
					NOT = { has_title_flag = non_manual_law_change } # No opinion penalty
				}

				if = {
					limit = { has_law = vassal_wars_law_0 }
					increased_crown_authority_effect = yes
				}
				else = {
					decreased_crown_authority_effect = yes
				}
			}

			if = {
				limit = { NOT = { has_law = vassal_wars_law_2 } }
				plus_law_change_prestige_effect_1 = yes
			}
		}

		effect = {
			# log = "vassal_wars_law_1 ([This.GetFullBaseName])"

			tooltip = { # pass_effect doesn't generate tooltips
				if = {
					limit = { NOT = { has_law = vassal_wars_law_2 } }
					plus_law_change_prestige_effect_1 = yes
				}
			}

			set_the_kings_peace = yes
			set_the_kings_full_peace = no
			revoke_law = vassal_wars_law_0
			revoke_law = vassal_wars_law_2
		}

		ai_will_do = {
			factor = 0.05
		}
	}

	vassal_wars_law_2 = {
		group = vassal_wars_law

		tribal_opinion = -10
		feudal_opinion = -10

		potential = {
			is_law_potential = vassal_wars_law_0
		}

		allow = {
			show_only_failed_conditions = yes

			has_law = vassal_wars_law_1

			trigger_if = {
				limit = { has_dlc = "Conclave" }

				show_only_failed_conditions = yes

				holder_scope = {
					show_scope_change = no
					has_law = law_voting_power_0
				}
			}

			OR = {
				trigger_if = {
					limit = { is_crown_law_title = yes }
					has_law = crown_authority_4
				}
				trigger_else_if = {
					limit = {
						has_crown_law_title = yes
						crownlaw_title = { holder_scope = { has_landed_title = ROOT } }
					}

					crownlaw_title = { has_law = crown_authority_4 }
				}

				trigger_if = {
					limit = { is_crown_law_title = yes }

					has_law = crown_authority_3

					trigger_if = {
						limit = { has_dlc = "Conclave" }
						has_law = ze_administration_laws_2
					}
					trigger_else = {
						has_law = imperial_administration
					}
				}
				trigger_else_if = {
					limit = {
						has_crown_law_title = yes
						crownlaw_title = { holder_scope = { has_landed_title = ROOT } }
					}

					crownlaw_title = {
						has_law = crown_authority_3

						trigger_if = {
							limit = { has_dlc = "Conclave" }
							has_law = ze_administration_laws_2
						}
						trigger_else = {
							has_law = imperial_administration
						}
					}
				}

				trigger_if = {
					limit = { is_crown_law_title = yes }

					has_law = crown_authority_2

					holder_scope = {
						show_scope_change = no

						OR = {
							government = theocratic_feudal_government
							government = chinese_imperial_government
						}
					}
				}
				trigger_else_if = {
					limit = {
						has_crown_law_title = yes
						crownlaw_title = { holder_scope = { has_landed_title = ROOT } }
					}

					crownlaw_title = {
						has_law = crown_authority_2

						holder_scope = {
							show_scope_change = no

							OR = {
								government = theocratic_feudal_government
								government = chinese_imperial_government
							}
						}
					}
				}
			}

			holder_scope = {
				show_scope_change = no
				plus_law_prestige_trigger_2 = yes
			}
		}

		pass_effect = {
			# log = "vassal_wars_law_2 pass ([This.GetFullBaseName])"
			plus_law_change_prestige_effect_2 = yes
		}

		effect = {
			# log = "vassal_wars_law_2 ([This.GetFullBaseName])"

			tooltip = { # pass_effect doesn't generate tooltips
				plus_law_change_prestige_effect_2 = yes
			}

			set_the_kings_peace = yes
			set_the_kings_full_peace = yes
			revoke_law = vassal_wars_law_0
			revoke_law = vassal_wars_law_1
		}

		ai_will_do = {
			factor = 0.05
		}
	}
}