namespace = crown_laws

################################################
# Fake opinion modifiers for tolerance law
################################################
# Hidden - Non-human or tolerant vassal opinion
character_event = {
	id = crown_laws.1
	
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {
		OR = {
			trait = elf_race
			trait = dwarf_race
			trait = halfling_race
			trait = gnome_race
			trait = dryad_race
			trait = tolerant
		}
		primary_title ={
			crownlaw_title = {
				has_law = tolerance_0
				ROOT = {
					top_liege = {
						has_landed_title = PREVPREV
						NOT = { reverse_has_opinion_modifier = { modifier = opinion_liege_intolerant_law who = ROOT } }
					}
				}
			}
		}
	}
	
	option = {
		name = OK
		top_liege = {
			reverse_opinion = { modifier = opinion_liege_intolerant_law who = ROOT years = 5000 }
		}
	}
}
# Hidden - Foreigner vassal opinion
character_event = {
	id = crown_laws.2
	
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {
		primary_title ={
			crownlaw_title = {
				has_law = tolerance_0
				ROOT = {
					top_liege = {
						has_landed_title = PREVPREV
						NOT = {
							culture = ROOT
							reverse_has_opinion_modifier = { modifier = opinion_liege_intolerant_law who = ROOT }
						}
					}
				}
			}
		}
	}
	
	option = {
		name = OK
		top_liege = {
			reverse_opinion = { modifier = opinion_liege_intolerant_law who = ROOT years = 5000 }
		}
	}
}
# Hidden - Racist vassal opinion
character_event = {
	id = crown_laws.3
	
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {
		trait = racist
		primary_title = {
			crownlaw_title = {
				has_law = tolerance_2
				ROOT = {
					top_liege = {
						has_landed_title = PREVPREV
						NOT = {
							reverse_has_opinion_modifier = { modifier = opinion_liege_tolerant_law who = ROOT }
						}
					}
				}
			}
		}
	}

	option = {
		name = OK
		top_liege = {
			reverse_opinion = { modifier = opinion_liege_tolerant_law who = ROOT years = 5000 }
		}
	}
}

# Refresh tolerance opinion on all de jure characters (on_law_vote_passed)
# TODO verify assumption that it fires for all impacted rulers
character_event = {
	id = crown_laws.4
	
	hide_window = yes
	is_triggered_only = yes
	
	option = {
		name = OK
		any_realm_character = {
			character_event = { id = crown_laws.1 }
			character_event = { id = crown_laws.2 }
			character_event = { id = crown_laws.3 }
		}
	}
}