law_groups = {
	court_marriage_authorization = {
		law_type = realm		
	}
	religious_tolerance_law = {
		law_type = realm
	}
}

laws = {
	court_marriage_authorization_0 = {
		group = court_marriage_authorization
		default = yes
		allow = {
		}
		potential = {
		}
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0.1
				always = yes
			}
			modifier = {
				holder_scope = {
					trait = charitable
				}
				factor = 0
			}
			modifier = {
				holder_scope = {
					trait = kind
				}
				factor = 0
			}
			modifier = {
				factor = 1
				holder_scope = {
					trait = cruel
				}
			}
			modifier = {
				factor = 1
				holder_scope = {
					trait = paranoid
				}
			}
		}
		ai_will_revoke = { factor = 0 }
		pass_effect = { }
		effect = {
			hidden_tooltip = {
				revoke_law = court_marriage_authorization_0
				revoke_law = court_marriage_authorization_1
			}
		}
	}
	court_marriage_authorization_1 = {
		group = court_marriage_authorization
		allow = {
		}
		potential = {
		}
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0.1
				always = yes
			}
			modifier = {
				holder_scope = {
					trait = charitable
				}
				factor = 1
			}
			modifier = {
				holder_scope = {
					trait = kind
				}
				factor = 1
			}
			modifier = {
				factor = 0
				holder_scope = {
					trait = cruel
				}
			}
			modifier = {
				factor = 0
				holder_scope = {
					trait = paranoid
				}
			}
		}
		ai_will_revoke = { factor = 0 }
		pass_effect = { }
		effect = {
			hidden_tooltip = {
				revoke_law = court_marriage_authorization_0
				revoke_law = court_marriage_authorization_1
			}
		}
	}
	tolerance_0 = {
		show_as_title = yes
		group = religious_tolerance_law
		
		city_opinion = 10
		church_opinion = -10
		
		potential = {
			temporary = no
			holder_scope = {
				is_landed = yes
			}
		}
		
		allow = {
			has_law = tolerance_1
			holder_scope = {
				OR = {
					independent = yes
					liege = {
						NAND = {
							religion = PREV
							primary_title = {
								has_law = tolerance_2
							}
						}
					}
				}
				trait = cynical
			}
		}
		
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0.1
				always = yes
			}
			modifier = {
				factor = 2
				holder_scope = {
					trait = hedonist
				}
				has_law = tolerance_1
			}
			modifier = {
				factor = 2
				holder_scope = {
					trait = kind
				}
				has_law = tolerance_1
			}
			modifier = {
				factor = 2
				holder_scope = {
					trait = charitable
				}
				has_law = tolerance_1
			}
			modifier = {
				factor = 0
				holder_scope = {
					OR = {
						trait = cruel
						trait = paranoid
					}
				}
			}
			modifier = {
				factor = 0.05
				holder_scope = {
					trait = zealous
				}
			}
			modifier = {
				factor = 10
				holder_scope = {
					trait = cynical
				}
			}
		}
		ai_will_revoke = {
			factor = 0
		}
			
		pass_effect = {
			holder_scope = {
				any_vassal = {
					limit = {
						religion = PREV
						trait = zealous
					}
					opinion = {
						who = PREV
						modifier = opinion_crazy_tolerant
						years = 5
					}
				}
				any_vassal = {
					limit = {
						OR = {
							NOT = {
								religion = PREV
							}
							trait = cynical
						}
					}
					opinion = {
						who = PREV
						modifier = opinion_wise_tolerant
						years = 5
					}
				}
			}
		}
		effect = {
			hidden_tooltip = {
				revoke_law = tolerance_0
				revoke_law = tolerance_1
				revoke_law = tolerance_2
				set_allow_free_infidel_revokation = no
			}
		}
	}
	tolerance_1 = {
		show_as_title = yes
		group = religious_tolerance_law
		default = yes
		
		potential = {
			temporary = no
			holder_scope = {
				is_landed = yes
			}
		}
		
		allow = {
			OR = {
				has_law = tolerance_0
				has_law = tolerance_2
			}
			NOT = { has_law = revoke_title_law_2 }
		}
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0.1
				always = yes
			}
			modifier = {
				factor = 3
				holder_scope = {
					trait = cruel
				}
				has_law = tolerance_0
			}
			modifier = {
				factor = 0.1
				holder_scope = {
					trait = zealous
				}
				has_law = tolerance_2
			}
			modifier = {
				factor = 5
				holder_scope = {
					trait = cynical
				}
				has_law = tolerance_2
			}
			modifier = {
				factor = 10
				holder_scope = {
					trait = zealous
				}
				has_law = tolerance_0
			}
			modifier = {
				factor = 0.2
				holder_scope = {
					trait = cynical
				}
				has_law = tolerance_0
			}
			modifier = {
				factor = 1.25
				holder_scope = {
					trait = paranoid
				}
				has_law = tolerance_0
			}
			modifier = {
				factor = 10
				holder_scope = {
					trait = kind
				}
				has_law = tolerance_2
			}
			modifier = {
				factor = 10
				holder_scope = {
					trait = charitable
				}
				has_law = tolerance_2
			}
			modifier = {
				factor = 0
				holder_scope = {
					trait = content
				}
			}
		}
		ai_will_revoke = {
			factor = 0
		}
		pass_effect = {
			holder_scope = {
				any_vassal = {
					limit = {
						has_opinion_modifier = {
							who = liege
							modifier = opinion_wise_tolerant
						}
					}
					remove_opinion = {
						who = liege
						modifier = opinion_wise_tolerant
					}
				}
				any_vassal = {
					limit = {
						has_opinion_modifier = {
							who = liege
							modifier = opinion_crazy_tolerant
						}
					}
					remove_opinion = {
						who = liege
						modifier = opinion_crazy_tolerant
					}
				}
				any_vassal = {
					limit = {
						has_opinion_modifier = {
							who = liege
							modifier = opinion_only_true_faith
						}
					}
					remove_opinion = {
						who = liege
						modifier = opinion_only_true_faith
					}
				}
				any_vassal = {
					limit = {
						has_opinion_modifier = {
							who = liege
							modifier = opinion_fanatic_oppressor
						}
					}
					remove_opinion = {
						who = liege
						modifier = opinion_fanatic_oppressor
					}
				}
			}
		}
		effect = {
			hidden_tooltip = {
				revoke_law = tolerance_0
				revoke_law = tolerance_1
				revoke_law = tolerance_2
			}
			set_allow_free_infidel_revokation = no
		}
	}
	tolerance_2 = {
		show_as_title = yes
		group = religious_tolerance_law
		
		city_opinion = -10
		temple_opinion = 10
		
		potential = {
			has_dlc = "Zeus"
			temporary = no
			holder_scope = { NOT = { is_landed = no } }
			NOT = { holder_scope = { has_religion_feature = religion_cosmopolitan } }
		}
		
		allow = {
			NOT = { holder_scope = { has_religion_feature = religion_cosmopolitan } }
			has_law = tolerance_1
			crownlaw_title = {
				has_holder = yes
				OR = {
					has_law = centralization_2
					has_law = centralization_3
					has_law = centralization_4
					holder_scope = { trait = zealous }
				}
			}
			holder_scope = {
				OR = {
					independent = yes
					liege = {
						OR = {
							religion = PREV
							primary_title = {
								NOT = {
									has_law = tolerance_0
								}
							}
						}
					}
				}
			}
			OR = {
				AND = {
					holder_scope = {
						is_tribal = yes
					}
					crownlaw_title = {
						OR = { 
							has_law = tribal_organization_1
							has_law = tribal_organization_2
							has_law = tribal_organization_3
							has_law = tribal_organization_4
						}
					}
				}
				AND = {
					NOT = { holder_scope = { is_nomadic = yes } }
					crownlaw_title = {
						has_law = revoke_title_law_1
					}
				}
			}
		}
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0.1
				always = yes
			}
			modifier = {
				holder_scope = {
					trait = charitable
				}
				factor = 0
			}
			modifier = {
				holder_scope = {
					trait = kind
				}
				factor = 0
			}
			modifier = {
				holder_scope = {
					trait = hedonist
				}
				factor = 0.5
			}
			modifier = {
				factor = 2
				holder_scope = {
					trait = cruel
				}
			}
			modifier = {
				factor = 1.75
				holder_scope = {
					trait = paranoid
				}
			}
			modifier = {
				factor = 1.25
				holder_scope = {
					trait = cynical
				}
			}
			modifier = {
				factor = 10
				holder_scope = {
					trait = zealous
				}
			}
		}
		ai_will_revoke = {
			factor = 0
		}
		
		pass_effect = {
			holder_scope = {
				any_vassal = {
					limit = {
						religion = PREV
						NOT = {
							trait = cynical
						}
					}
					opinion = {
						who = PREV
						modifier = opinion_only_true_faith
						years = 10
					}
				}
				any_vassal = {
					limit = {
						OR = {
							NOT = {
								religion = PREV
							}
							trait = cynical
						}
					}
					opinion = {
						who = PREV
						modifier = opinion_fanatic_oppressor
						years = 10
					}
				}
			}
		}
		effect = {
			hidden_tooltip = {
				revoke_law = tolerance_0
				revoke_law = tolerance_1
				revoke_law = tolerance_2
			}
			set_allow_free_infidel_revokation = yes
		}
	}
}
