###################################
#
# THE SONS OF ABRAHAM 
# - Jewish Events
#
###################################

namespace = SoA

# Third Temple Construction Begun
character_event = {
	id = SoA.100
	desc = EVTDESC_SoA_100
	picture = GFX_evt_castle_construction
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	hide_from = yes
	
	option = {
		name = EVTOPTA_SoA_100
		set_global_flag = building_third_temple
		custom_tooltip = { text = third_temple_construction }
	}
}

# Third Temple Built
narrative_event = {
	id = SoA.101
	title = EVTNAME_SoA_101
	desc = EVTDESC_SoA_101
	picture = GFX_evt_jerusalem_captured_jews
	border = GFX_event_narrative_frame_religion
	major = yes
	
	is_triggered_only = yes
	
	hide_from = yes
	
	immediate = {
		set_global_flag = jewish_priesthood_founded
		activate_title = { title = d_jewish status = yes }
		random_realm_lord = {
			limit = {
				is_theocracy = yes
				has_landed_title = b_jerusalem
			}
			d_jewish = { grant_title = PREV }
			save_event_target_as = new_kohen_gadol
			set_defacto_liege = ROOT
			pf_liege_change_effect = yes
			break = yes
		}
		random_realm_lord = {
			limit = {
				is_theocracy = yes
				any_demesne_title = { is_holy_site = ROOT }
			}
			b_jerusalem = { grant_title = PREV }
			d_jewish = { grant_title = PREV }
			save_event_target_as = new_kohen_gadol
			set_defacto_liege = ROOT
			pf_liege_change_effect = yes
			break = yes
		}
		create_random_priest = {
			random_traits = yes
			dynasty = random
			religion = jewish
			culture = ROOT
			age = 50
			health = 7
			trait = quick
			trait = zealous
			trait = yehudi
			trait = scholar
			trait = mastermind_theologian
			attributes = {
				learning = 8
			}
		}
		new_character = {
			b_jerusalem = { grant_title = PREV }
			d_jewish = { grant_title = PREV }
			save_event_target_as = new_kohen_gadol
			set_defacto_liege = ROOT
		}
	}
	
	option = {
		name = EVTOPTA_SoA_550
		trigger = {
			religion_group = jewish_group
		}
		if = {
			limit = { character = ROOT }
			prestige = 500
			piety = 500
			religion_authority = {
				modifier = third_temple_built
			}
		}
	}
	option = {
		name = EVTOPTB_TOG_6004
		trigger = {
			NOR = {
				religion_group = jewish_group
				religion_group = muslim
			}
		}
	}
	option = {
		name = EVTOPTC_TOG_6004
		trigger = {
			religion_group = muslim
		}
	}
}

# Creation of Israel
narrative_event = {
	id = SoA.102
	title = EVTNAME_SoA_102
	desc = EVTDESC_SoA_102
	picture = GFX_evt_jerusalem_captured_jews
	border = GFX_event_narrative_frame_religion
	
	is_triggered_only = yes
	
	hide_from = yes
	
	option = {
		name = EVTOPTA_SoA_102
		primary_title = {
			k_israel = {
				grant_title = ROOT
				copy_title_laws = PREV
			}
		}
	}
}

# Jews Expelled
character_event = {
	id = SoA.105
	desc = EVTDESC_SoA_105
	picture = GFX_evt_jewish_market
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	hide_from = yes
	
	option = {
		name = EVTOPTA_SoA_105

		prestige = -200
		banish_religion = jewish
		
		if = {
			limit = { trait = just }
			remove_trait = just
		}
		if = {
			limit = { trait = charitable }
			remove_trait = charitable
		}
		if = {
			limit = {
				NOT = { trait = greedy }
				trait = arbitrary
			}
			random_list = {
				50 = {
					add_trait = greedy
					hidden_tooltip = {
						character_event = {
							id = 38252 #Notify Greedy
						}
					}
				}
				50 = { }
			}
		}
		if = {
			limit = {
				NOT = { trait = arbitrary }
				trait = greedy
			}
			random_list = {
				50 = {
					add_trait = arbitrary
					hidden_tooltip = {
						character_event = {
							id = 38266 #Notify Arbitrary
						}
					}
				}
				50 = { }
			}
		}
		if = {
			limit = {
				NOT = { trait = arbitrary }
				NOT = { trait = greedy }
			}
			random_list = {
				25 = {
					add_trait = arbitrary
					hidden_tooltip = {
						character_event = {
							id = 38266 #Notify Arbitrary
						}
					}
				}
				25 = {
					add_trait = greedy
					hidden_tooltip = {
						character_event = {
							id = 38252 #Notify Greedy
						}
					}
				}
				50 = { }
			}
		}
		if = {
			limit = { any_vassal = { leads_faction = faction_prosperity } }
			custom_tooltip = { text = PROSPERITYFACTIONMOODMINUS }
		}
		if = {
			limit = { any_vassal = { leads_faction = faction_tradition } }
			custom_tooltip = { text = TRADITIONFACTIONMOODPLUS }
		}
		hidden_tooltip = { character_event = { id = PlusFaction.200 days = 1 } } #recalculate faction moods
		any_demesne_title = {
			limit = {
				tier = baron
				has_building = ct_jewish_community_3
			}
			remove_building = ct_jewish_community_3
			ROOT = { piety = -30 wealth = 150 }
		}
		any_demesne_title = {
			limit = {
				tier = baron
				NOT = { has_building = ct_jewish_community_3 }
				has_building = ct_jewish_community_2
			}
			remove_building = ct_jewish_community_2
			ROOT = { piety = -20 wealth = 100 }
		}
		any_demesne_title = {
			limit = {
				tier = baron
				NOT = { has_building = ct_jewish_community_3 }
				NOT = { has_building = ct_jewish_community_2 }
				has_building = ct_jewish_community_1
			}
			remove_building = ct_jewish_community_1
			ROOT = { piety = -10 wealth = 50 }
		}
		any_realm_lord = {
			limit = {
				lower_tier_than = king
				ai = yes
				NOT = { any_liege = { NOT = { character = ROOT } ai = no } }
				any_liege = { character = ROOT }
				OR = {
					AND = {
						tier = baron
						liege = { character = ROOT }
					}
					primary_title = {
						crownlaw_title = {
							OR = {
								has_law = crown_authority_3
								has_law = crown_authority_4
							}
						}
					}
				}
				any_demesne_province = {
					has_building = ct_jewish_community_1
				}
			}
			any_demesne_title = {
				limit = {
					tier = baron
					has_building = ct_jewish_community_3
				}
				remove_building = ct_jewish_community_3
				ROOT = { piety = -30 wealth = 150 }
			}
			any_demesne_title = {
				limit = {
					tier = baron
					NOT = { has_building = ct_jewish_community_3 }
					has_building = ct_jewish_community_2
				}
				remove_building = ct_jewish_community_2
				ROOT = { piety = -20 wealth = 100 }
			}
			any_demesne_title = {
				limit = {
					tier = baron
					NOT = { has_building = ct_jewish_community_3 }
					NOT = { has_building = ct_jewish_community_2 }
					has_building = ct_jewish_community_1
				}
				remove_building = ct_jewish_community_1
				ROOT = { piety = -10 wealth = 50 }
			}
		}
		any_realm_lord = {
			limit = {
				lower_tier_than = king
				ai = no
				NOT = { any_liege = { NOT = { character = ROOT } ai = no } }
				OR = {
					AND = {
						tier = baron
						liege = { character = ROOT }
					}
					primary_title = {
						crownlaw_title = {
							OR = {
								has_law = crown_authority_3
								has_law = crown_authority_4
							}
						}
					}
				}
				OR = {
					any_demesne_province = {
						has_building = ct_jewish_community_1
					}
					any_realm_lord = {
						any_liege = { character = PREVPREV }
						any_demesne_province = {
							has_building = ct_jewish_community_1
						}
					}
				}
			}
			character_event = { id = Plus.705 tooltip = EVTTOOLTIP710005 }
		}		
		
		hidden_tooltip = {
			any_realm_lord = {
				limit = { 
					OR = {
						ai = no
						has_character_modifier = borrowed_from_jews
					}
				}
				character_event = { id = SoA.107 }
			}
		}
	}
}

# Jews Welcomed Back
character_event = {
	id = SoA.106
	desc = EVTDESC_SoA_106
	picture = GFX_evt_jewish_market
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	hide_from = yes
	
	option = {
		name = EVTOPTA_SoA_106
		prestige = 50
		hidden_tooltip = {
			any_realm_lord = {
				limit = { ai = no }
				character_event = { id = SoA.108 }
			}
		}
	}
}

# Jews Welcomed Back due to ruler now being Jewish!
character_event = {
	id = SoA.566
	desc = EVTDESC_SoA_566
	picture = GFX_evt_jewish_market
	border = GFX_event_normal_frame_religion
	
	only_playable = yes
	religion_group = jewish_group
	only_independent = yes
	
	trigger = {
		has_dlc = "Sons of Abraham"
		has_character_modifier = expelled_jewish
	}
	
	mean_time_to_happen = {
		days = 1
	}

	option = {
		name = EVTOPTA_SoA_566
		prestige = 50
		remove_character_modifier = expelled_jewish
		custom_tooltip = {
			text = jews_are_welcome
		}
		hidden_tooltip = {
			any_realm_lord = {
				limit = { ai = no }
				character_event = { id = SoA.108 }
			}
		}
	}
}

# Jews Expelled (Notifier for Vassals)
character_event = {
	id = SoA.107
	desc = EVTDESC_SoA_107
	picture = GFX_evt_jewish_market
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SoA_107
		trigger = {
			NOT = { has_character_modifier = borrowed_from_jews }
		}
	}
	option = {
		name = EVTOPTB_SoA_107
		trigger = {
			has_character_modifier = borrowed_from_jews
		}
		remove_character_modifier = borrowed_from_jews
	}
}

# Jews Welcomed Back (Notifier for Vassals)
character_event = {
	id = SoA.108
	desc = EVTDESC_SoA_108
	picture = GFX_evt_jewish_market
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SoA_107
	}
}

### Jewish Court Events

# Jewish Diplomat Appears at Court (Ashkenazi)
character_event = {
	id = SoA.200
	desc = EVTDESC_SoA_200
	picture = GFX_evt_emissary
	border = GFX_event_normal_frame_religion
	
	min_age = 16
	prisoner = no
	only_playable = yes
	capable_only = yes
	only_independent = yes
	
	trigger = {
		has_dlc = "Sons of Abraham"
		OR = {
			religion_group = christian
			religion_group = muslim
			religion_group = zoroastrian_group
			religion_group = jewish_group
			culture = khazar
			culture = han
		}	
		NOR = {
			capital_scope = { region = world_europe_west_iberia }
		    has_character_flag = jewish_chancellor
			has_character_modifier = expelled_jewish
			has_character_flag = pogrom
			trait = incapable
			is_inaccessible_trigger = yes
		}
	}
	
	mean_time_to_happen = {
		years = 120
	}
	
	option = {
		name = EVTOPTA_SoA_200
		set_character_flag = jewish_chancellor
		create_character = {
			random_traits = yes
			culture = ashkenazi
			dynasty = culture
			religion = jewish
			female = no
			age = 30
			trait = charismatic_negotiator
			attributes = {
				diplomacy = 10
			}
			flag = ai_flag_refuse_conversion			
		}
	}
}

# Jewish Administrator Appears at Court (Ashkenazi)
character_event = {
	id = SoA.201
	desc = EVTDESC_SoA_201
	picture = GFX_evt_emissary
	border = GFX_event_normal_frame_religion
	
	min_age = 16
	prisoner = no
	only_playable = yes
	capable_only = yes
	only_independent = yes
	
	trigger = {
		has_dlc = "Sons of Abraham"
		OR = {
			religion_group = christian
			religion_group = muslim
			religion_group = zoroastrian_group
			religion_group = jewish_group
			culture = khazar
			culture = han
		}	
		NOR = {
			capital_scope = { region = world_europe_west_iberia }
			has_character_flag = jewish_chancellor
			has_character_modifier = expelled_jewish
			has_character_flag = pogrom
			is_inaccessible_trigger = yes
			trait = incapable
		}
	}
	
	mean_time_to_happen = {
		years = 120
	}
	
	option = {
		name = EVTOPTA_SoA_200
		set_character_flag = jewish_chancellor
		create_character = {
			random_traits = yes
			culture = ashkenazi
			dynasty = culture
			religion = jewish
			female = no
			age = 30
			trait = fortune_builder
			attributes = {
				stewardship = 10
			}
			flag = ai_flag_refuse_conversion
		}
	}
}

# Jewish Spy Appears at Court (Ashkenazi)
character_event = {
	id = SoA.202
	desc = EVTDESC_SoA_202
	picture = GFX_evt_emissary
	border = GFX_event_normal_frame_religion
	
	min_age = 16
	prisoner = no
	only_playable = yes
	capable_only = yes
	only_independent = yes
	
	trigger = {
		has_dlc = "Sons of Abraham"
		OR = {
			religion_group = christian
			religion_group = muslim
			religion_group = zoroastrian_group
			religion_group = jewish_group
			culture = khazar
			culture = han
		}	
		NOR = {
			capital_scope = { region = world_europe_west_iberia }
			has_character_flag = jewish_chancellor
			has_character_modifier = expelled_jewish
			has_character_flag = pogrom
			trait = incapable
			is_inaccessible_trigger = yes
		}
	}
	
	mean_time_to_happen = {
		years = 120
	}
	
	option = {
		name = EVTOPTA_SoA_200
		set_character_flag = jewish_chancellor
		create_character = {
			random_traits = yes
			culture = ashkenazi
			dynasty = culture
			religion = jewish
			female = no
			age = 30
			trait = intricate_webweaver
			attributes = {
				intrigue = 10
			}
			flag = ai_flag_refuse_conversion
		}
	}
}

# Jewish Diplomat Appears at Court (Sephardic)
character_event = {
	id = SoA.203
	desc = EVTDESC_SoA_200
	picture = GFX_evt_emissary
	border = GFX_event_normal_frame_religion
	
	min_age = 16
	prisoner = no
	only_playable = yes
	capable_only = yes
	only_independent = yes
	
	trigger = {
		has_dlc = "Sons of Abraham"
		capital_scope = { region = world_europe_west_iberia }
		OR = {
			religion_group = christian
			religion_group = muslim
			religion_group = zoroastrian_group
			religion_group = jewish_group
		}	
		NOR = {
			has_character_flag = jewish_chancellor
			has_character_modifier = expelled_jewish
			has_character_flag = pogrom
			trait = incapable
			is_inaccessible_trigger = yes
		}
	}
	
	mean_time_to_happen = {
		years = 120
	}
	
	option = {
		name = EVTOPTA_SoA_200
		set_character_flag = jewish_chancellor
		create_character = {
			random_traits = yes
			culture = sephardi
			dynasty = culture
			religion = jewish
			female = no
			age = 30
			trait = charismatic_negotiator
			attributes = {
				diplomacy = 10
			}
			flag = ai_flag_refuse_conversion
		}
	}
}

# Jewish Administrator Appears at Court (Sephardic)
character_event = {
	id = SoA.204
	desc = EVTDESC_SoA_201
	picture = GFX_evt_emissary
	border = GFX_event_normal_frame_religion
	
	min_age = 16
	prisoner = no
	only_playable = yes
	capable_only = yes
	only_independent = yes
	
	trigger = {
		has_dlc = "Sons of Abraham"
		capital_scope = { region = world_europe_west_iberia }
		OR = {
			religion_group = christian
			religion_group = muslim
			religion_group = zoroastrian_group
			religion_group = jewish_group
		}	
		NOR = {
			has_character_flag = jewish_chancellor
			has_character_modifier = expelled_jewish
			has_character_flag = pogrom
			trait = incapable
			is_inaccessible_trigger = yes
		}
	}
	
	mean_time_to_happen = {
		years = 120
	}
	
	option = {
		name = EVTOPTA_SoA_200
		set_character_flag = jewish_chancellor
		create_character = {
			random_traits = yes
			culture = sephardi
			dynasty = culture
			religion = jewish
			female = no
			age = 30
			trait = fortune_builder
			attributes = {
				stewardship = 10
			}
			flag = ai_flag_refuse_conversion
		}
	}
}

# Jewish Spy Appears at Court (Sephardic)
character_event = {
	id = SoA.205
	desc = EVTDESC_SoA_202
	picture = GFX_evt_emissary
	border = GFX_event_normal_frame_religion
	
	min_age = 16
	prisoner = no
	only_playable = yes
	capable_only = yes
	only_independent = yes
	
	trigger = {
		has_dlc = "Sons of Abraham"
		capital_scope = { region = world_europe_west_iberia }
		OR = {
			religion_group = christian
			religion_group = muslim
			religion_group = zoroastrian_group
			religion_group = jewish_group
		}	
		NOR = {
			has_character_flag = jewish_chancellor
			has_character_modifier = expelled_jewish
			has_character_flag = pogrom
			trait = incapable
			is_inaccessible_trigger = yes
		}
	}
	
	mean_time_to_happen = {
		years = 120
	}
	
	option = {
		name = EVTOPTA_SoA_200
		set_character_flag = jewish_chancellor
		create_character = {
			random_traits = yes
			culture = sephardi
			dynasty = culture
			religion = jewish
			female = no
			age = 30
			trait = intricate_webweaver
			attributes = {
				intrigue = 10
			}
			flag = ai_flag_refuse_conversion
		}
	}
}

### Jewish Passover

# Invitation Sent
character_event = {
	id = SoA.500
	desc = EVTDESC_SoA_500
	picture = GFX_evt_synagogue
	border = GFX_event_normal_frame_religion
	
	hide_from = yes
	
	only_rulers = yes
	min_age = 16
	capable_only = yes
	prisoner = no
	has_character_flag = planning_passover
	
	trigger = {
		war = no
		month = 3
		NOT = { month = 5 }
		is_not_busy_trigger = yes
		NOT = { is_inaccessible_trigger = yes }
	}
	
	mean_time_to_happen = {
		days = 1
	}
	
	option = {
		name = EVTOPTA_SoA_500
		clr_character_flag = planning_passover
		set_character_flag = holding_passover
		any_vassal = {
			limit = {
				religion_group = jewish_group
				has_regent = no
				war = no
			}
			character_event = { id = SoA.501 days = 2 tooltip = EVTTOOLTIP_SoA_501 }
		}
		custom_tooltip = { text = passover_invitations_sent }
		hidden_tooltip = {
			character_event = { id = SoA.503 days = 10 }
			character_event = { id = SoA.504 days = 12 }
			character_event = { id = SoA.599 days = 25 } # Safety catch flag clearing
			add_character_modifier = {
				name = do_not_disturb
				days = 13
				hidden = yes
			}
		}
	}
}

# Invitation Received
character_event = {
	id = SoA.501
	desc = EVTDESC_SoA_501
	picture = GFX_evt_synagogue
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes

	trigger = { NOT = { is_inaccessible_trigger = yes } }
	
	option = {
		name = EVTOPTA_SoA_501
		ai_chance = {
			factor = 80
			modifier = {
				factor = 0
				NOT = {	opinion = { who = ROOT value = -20 } }
			}
		}
		custom_tooltip = { text = passover_accepted }
		set_character_flag = attending_passover
		hidden_tooltip = {
			character_event = { id = SoA.503 days = 8 }
			character_event = { id = SoA.599 days = 20 } # Safety catch flag clearing
			add_character_modifier = {
				name = do_not_disturb
				days = 13
				hidden = yes
			}
		}
		end_inaccessibility_effect = yes
	}
	option = {
		name = EVTOPTB_SoA_501
		ai_chance = {
			factor = 20
		}
		FROM = {
			opinion = {
				modifier = opinion_refused_passover
				who = ROOT
			}
		}
		custom_tooltip = { text = passover_declined }
		hidden_tooltip = {
			FROM = { character_event = { id = SoA.502 } }
		}
	}
}

# Invitation Refused
character_event = {
	id = SoA.502
	desc = EVTDESC_SoA_502
	picture = GFX_evt_synagogue
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SoA_502
		opinion = {
			modifier = opinion_refused_passover
			who = FROM
		}
	}
}

# Passover Sedar Begins
character_event = {
	id = SoA.503
	desc = EVTDESC_SoA_503
	picture = GFX_evt_synagogue
	border = GFX_event_normal_frame_religion
	
	hide_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SoA_503
	}
}

# Passover Sedar Ends (Host)
character_event = {
	id = SoA.504
	desc = EVTDESC_SoA_504
	picture = GFX_evt_synagogue
	border = GFX_event_normal_frame_religion
	
	hide_from = yes
	
	is_triggered_only = yes
	
	immediate = {
		add_character_modifier = {
			name = held_passover_timer
			duration = 100
			hidden = yes
			inherit = yes
		}
	}
	
	option = { # Next Time in Jerusalem!
		trigger = {
			NOT = {
				any_realm_title = {
					title = c_jerusalem
				}
			}
		}
		name = EVTOPTA_SoA_504
		any_vassal = {
			limit = { has_character_flag = attending_passover }
			opinion = {
				modifier = opinion_passover
				who = ROOT
			}
		}
		hidden_tooltip = {
			any_vassal = {
				limit = { has_character_flag = attending_passover }
				character_event = { id = SoA.505 }
			}
		}
		prestige = 5
		piety = 5
		if = {
			limit = { any_vassal = { leads_faction = faction_court } }
			custom_tooltip = { text = COURTFACTIONMOODPLUS }
		}
		hidden_tooltip = {
			remove_do_not_disturb_effect = yes
			clr_character_flag = holding_passover
		}
	}
	
	option = { # Once More in Jerusalem!
		trigger = {
			any_realm_title = {
				title = c_jerusalem
			}
		}
		name = EVTOPTB_SoA_504
		any_vassal = {
			limit = { has_character_flag = attending_passover }
			opinion = {
				modifier = opinion_passover
				who = ROOT
			}
		}
		hidden_tooltip = {
			any_vassal = {
				limit = { has_character_flag = attending_passover }
				character_event = { id = SoA.505 }
			}
		}
		piety = 5
		prestige = 5
		if = {
			limit = { 
				OR = {
					NOT = { has_character_flag = passover_mood_boost }
					had_character_flag = {
						flag = passover_mood_boost
						days = 1825
					}
				}
			}
			if = {
				limit = { any_vassal = { leads_faction = faction_court } }
				custom_tooltip = { text = COURTFACTIONMOODPLUS }
			}
		}
		hidden_tooltip = {
			remove_do_not_disturb_effect = yes
			clr_character_flag = holding_passover
		}
	}	
}

# Passover Sedar Ends (Guest)
character_event = {
	id = SoA.505
	desc = EVTDESC_SoA_505
	picture = GFX_evt_synagogue
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SoA_504
		clr_character_flag = attending_passover
		hidden_tooltip = {
			remove_do_not_disturb_effect = yes
		}
	}
}

### Jewish Councillor Events

# Chancellor (Hidden)
character_event = {
	id = SoA.560
	hide_window = yes
	
	min_age = 16
	only_capable = yes
	prisoner = no
	religion_group = jewish_group
	
	trigger = {
		has_job_title = job_chancellor
		employer = {
			NOT = { religion_group = jewish_group }
		}
	}
	
	mean_time_to_happen = {
		months = 400
		modifier = {
			factor = 0.5
			OR = {
				has_focus = focus_scholarship
				liege = { has_focus = focus_scholarship }
			}
		}
	}
	
	immediate = {
		employer = {
			character_event = { id = SoA.561 }
		}
	}
}

# Chancellor
character_event = {
	id = SoA.561
	desc = EVTDESC_SoA_561
	picture = GFX_evt_jewish_market
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SoA_561
		culture_techpoints = 50
	}
}

# Steward (Hidden)
character_event = {
	id = SoA.562
	hide_window = yes
	
	min_age = 16
	only_capable = yes
	prisoner = no
	religion_group = jewish_group
	
	trigger = {
		has_job_title = job_treasurer
		employer = {
			NOT = { religion_group = jewish_group }
		}
	}
	
	mean_time_to_happen = {
		months = 400
		modifier = {
			factor = 0.5
			OR = {
				has_focus = focus_scholarship
				liege = { has_focus = focus_scholarship }
			}
		}
	}
	
	immediate = {
		employer = {
			character_event = { id = SoA.563 }
		}
	}
}

# Steward
character_event = {
	id = SoA.563
	desc = EVTDESC_SoA_563
	picture = GFX_evt_jewish_market
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SoA_561
		economy_techpoints = 50
	}
}

# Spymaster (Hidden)
character_event = {
	id = SoA.564
	hide_window = yes
	
	min_age = 16
	only_capable = yes
	prisoner = no
	religion_group = jewish_group
	
	trigger = {
		has_job_title = job_spymaster
		employer = {
			NOT = { religion_group = jewish_group }
		}
	}
	
	mean_time_to_happen = {
		months = 400
		modifier = {
			factor = 0.5
			OR = {
				has_focus = focus_scholarship
				liege = { has_focus = focus_scholarship }
			}
		}
	}
	
	immediate = {
		employer = {
			character_event = { id = SoA.565 }
		}
	}
}

# Spymaster
character_event = {
	id = SoA.565
	desc = EVTDESC_SoA_565
	picture = GFX_evt_jewish_market
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SoA_561
		military_techpoints = 50
	}
}


###########################################
# Flag management                         #
###########################################

# Safety catch - clears character flags and modifiers
character_event = {
	id = SoA.599

	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		clr_character_flag = holding_passover
		clr_character_flag = attending_passover
	}
}

