namespace = CIML

# Invite jews plan
character_event = {
	id = CIML.375
	title = EVTNAMECIML.375
	desc = EVTDESCCIML.375
	
	picture = GFX_evt_feast
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTACIML.375
		wealth = -50
		add_character_modifier = { 
			name = major_friend_of_the_jews
			months = -1 
		}
		character_event = { id = CIML.376 days = 300 }
		set_global_flag = invited_jews_into_jerusalem
	}
	option = {
		name = EVTOPTBCIML.375
		wealth = -50
		add_character_modifier = { 
			name = major_friend_of_the_jews
			months = -1 
		}
		character_event = { id = CIML.377 days = 300 }
		set_global_flag = invited_jews_into_jerusalem
	}
	option = {
		name = EVTOPTCCIML.375
	}
}

# Invite ashkenazis
character_event = {
	id = CIML.376
	title = EVTNAMECIML.376
	desc = EVTDESCCIML.376
	
	picture = GFX_evt_market
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTACIML.376
		774 = { religion = jewish }
		774 = { culture = ashkenazi }
		random = { 
			chance = 25  
			775 = { religion = jewish }
			775 { culture = ashkenazi }
		}
		random = { 
			chance = 25  
			776 = { religion = jewish }
			776 { culture = ashkenazi }
		}
		random = { 
			chance = 25  
			772 = { religion = jewish }
			772 { culture = ashkenazi }
		}
		random = { 
			chance = 25  
			773 = { religion = jewish }
			773 { culture = ashkenazi }
		}
	}
}

# Invite sephardis
character_event = {
	id = CIML.377
	title = EVTNAMECIML.377
	desc = EVTDESCCIML.377
	
	picture = GFX_evt_market
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTACIML.377
		774 = { religion = jewish }
		774 = { culture = sephardi }
		random = { 
			chance = 25  
			775 = { religion = jewish }
			775 { culture = sephardi }
		}
		random = { 
			chance = 25  
			776 = { religion = jewish }
			776 { culture = sephardi }
		}
		random = { 
			chance = 25  
			772 = { religion = jewish }
			772 { culture = sephardi }
		}
		random = { 
			chance = 25  
			773 = { religion = jewish }
			773 { culture = sephardi }
		}
	}
}

# Church reacts to ongoing pogrom
character_event = {
	id = CIML.378
	title = EVTNAMECIML.378
	desc = EVTDESCCIML.378
	picture = GFX_evt_firey_silhouette_hf
	
	only_playable = yes
	
	trigger = {
		religion_group = christian
		NOT = { religion = mandean }
		NOR = {
			government = nomadic_government
			government = tribal_government
			government = theocracy_government
			any_demesne_province = {
				OR = { 
					religion = jewish
					religion = samaritan
					religion = karaite
				}
			}
		}
		NOR = {
			has_character_modifier = minor_enemy_of_the_jews
			has_character_modifier = major_enemy_of_the_jews
			has_character_modifier = friend_of_the_jews
			has_character_modifier = expelled_jewish
			has_character_flag = ciml_jewish_event
		}
		OR = {
			independent = yes
			AND = {
				top_liege = { NOT = { has_character_modifier = expelled_jewish } }
				primary_title = { higher_tier_than = DUKE }
			}
		}
	}
	
	mean_time_to_happen = {
		months = 1800
	}

	option = {
		name = EVTOPTACIML.378
		piety = 50
		add_character_modifier = { 
			name = friend_of_the_jews
			months = 200
		}
	}
	option = {
		name = EVTOPTBCIML.378
		piety = -100
		trigger = {
			OR = {
				ai = no
				trait = cruel
				trait = possessed
			}
			NOR = {
				trait = kind
				secret_religion = jewish
				trait = sympathy_judaism
			}
		}
		if = { 
			limit = { 
				religion = catholic
				NOT = { trait = excommunicated }
			} 
			random = { 
				chance = 80  
				add_trait = excommunicated
			}
		}
		add_character_modifier = { 
			name = major_enemy_of_the_jews
			months = 400
		}
		add_character_modifier = { 
			name = defied_church
			months = 200
		}
	}
	
	after = {
		set_character_flag = ciml_jewish_event
	}

}

# Church demands justice after pogrom
character_event = {
	id = CIML.382
	title = EVTNAMECIML.382
	desc = EVTDESCCIML.382
	picture = GFX_evt_jewish_market
	
	only_playable = yes
	
	trigger = {
		religion_group = christian
		NOT = { religion = mandean }
		NOR = {
			government = nomadic_government
			government = tribal_government
			government = theocracy_government
			any_demesne_province = {
				OR = { 
					religion = jewish
					religion = samaritan
					religion = karaite
				}
			}
		}
		NOR = {
			has_character_modifier = minor_enemy_of_the_jews
			has_character_modifier = major_enemy_of_the_jews
			has_character_modifier = friend_of_the_jews
			has_character_modifier = expelled_jewish
			has_character_flag = ciml_jewish_event
		}
		OR = {
			independent = yes
			AND = {
				top_liege = { NOT = { has_character_modifier = expelled_jewish } }
				primary_title = { higher_tier_than = DUKE }
			}
		}
	}
	
	mean_time_to_happen = {
		months = 1800
	}
	
	option = {
		name = EVTOPTACIML.382
		piety = 50
		prestige = -50
		add_character_modifier = { 
			name = friend_of_the_jews
			months = 200
		}
	}
	option = {
		name = EVTOPTBCIML.382
		piety = -50
		prestige = 100
		add_character_modifier = { 
			name = defied_church
			months = 200
		}
	}
	
	after = {
		set_character_flag = ciml_jewish_event
	}
	
}

# Church demands tithes on former christian land
character_event = {
	id = CIML.380
	title = EVTNAMECIML.380
	desc = EVTDESCCIML.380
	picture = GFX_evt_jewish_market
	
	only_playable = yes
	
	trigger = {
		religion_group = christian
		NOR = { 
			religion = mandean 
		}
		NOR = {
			government = nomadic_government
			government = tribal_government
			government = theocracy_government
			any_demesne_province = {
				OR = { 
					religion = jewish
					religion = samaritan
					religion = karaite
				}
			}
		}
		NOR = {
			has_character_modifier = minor_enemy_of_the_jews
			has_character_modifier = major_enemy_of_the_jews
			has_character_modifier = friend_of_the_jews
			has_character_modifier = expelled_jewish
			has_character_flag = ciml_jewish_event
		}
		OR = {
			independent = yes
			AND = {
				top_liege = { NOT = { has_character_modifier = expelled_jewish } }
				primary_title = { higher_tier_than = DUKE }
			}
		}
	}
	
	mean_time_to_happen = {
		months = 1800
	}
	
	option = {
		name = EVTOPTACIML.380
		piety = 50
		add_character_modifier = { 
			name = minor_enemy_of_the_jews
			months = 200
		}
	}
	option = {
		name = EVTOPTBCIML.380
		piety = -50
		add_character_modifier = { 
			name = defied_church
			months = 200
		}
		add_character_modifier = { 
			name = friend_of_the_jews
			months = 125
		}
		if = { 
			limit = { 
				NOT = { trait = sympathy_judaism }
			} 
			random = { 
				chance = 20  
				add_trait = sympathy_judaism
			}
		}
	}
	
	after = {
		set_character_flag = ciml_jewish_event
	}
}

# Church demands distinctive dress
character_event = {
	id = CIML.381
	title = EVTNAMECIML.381
	desc = EVTDESCCIML.381
	picture = GFX_evt_jewish_market
	
	only_playable = yes
	
	trigger = {
		religion_group = christian
		NOR = {
			religion = mandean 
			religion = orthodox
			religion = apollinarian
			religion = barlaamite
			religion = bogomilist
			religion = monothelite
			religion = iconoclast
			religion = paulician
		}
		NOR = {
			government = nomadic_government
			government = tribal_government
			government = theocracy_government
			any_demesne_province = {
				OR = { 
					religion = jewish
					religion = samaritan
					religion = karaite
				}
			}
		}
		NOR = {
			has_character_modifier = minor_enemy_of_the_jews
			has_character_modifier = major_enemy_of_the_jews
			has_character_modifier = friend_of_the_jews
			has_character_modifier = expelled_jewish
			has_character_flag = ciml_jewish_event
		}
		OR = {
			independent = yes
			AND = {
				top_liege = { NOT = { has_character_modifier = expelled_jewish } }
				primary_title = { higher_tier_than = DUKE }
			}
		}
	}
	
	mean_time_to_happen = {
		months = 1800
	}
	
	option = {
		name = EVTOPTACIML.381
		piety = 50
		add_character_modifier = { 
			name = minor_enemy_of_the_jews
			months = 200
		}
	}
	option = {
		name = EVTOPTBCIML.381
		piety = -50
		add_character_modifier = { 
			name = defied_church
			months = 200
		}
		if = { 
			limit = { 
				NOT = { trait = sympathy_judaism }
			} 
			random = { 
				chance = 20  
				add_trait = sympathy_judaism
			}
		}
	}
	option = {
		name = EVTOPTCCIML.381
		tooltip_info = cruel
		trigger = {
			NOR = {
				trait = sympathy_judaism
				trait = kind
				trait = just
			}
			OR = {
				trait = cruel
				trait = impaler
			}
		}
		add_character_modifier = { 
			name = major_enemy_of_the_jews
			months = 200
		}
	}
	option = {
		name = EVTOPTDCIML.381
		tooltip_info = lunatic
		trigger = {
			OR = {
				trait = lunatic
				trait = possessed
				trait = imbecile
			}
		}
		piety = -10
		prestige = -10
		add_character_modifier = { 
			name = minor_enemy_of_the_jews
			months = 200
		}
	}
	
	after = {
		set_character_flag = ciml_jewish_event
	}
}

# Jews want to build a synagogue
character_event = {
	id = CIML.800
	title = EVTNAMECIML.800
	desc = EVTDESCCIML.800
	picture = GFX_evt_synagogue
	
	only_playable = yes
	
	trigger = {
		religion_group = christian
		NOT = { religion = mandean }
		NOR = {
			government = nomadic_government
			government = tribal_government
			government = theocracy_government
			any_demesne_province = {
				OR = { 
					religion = jewish
					religion = samaritan
					religion = karaite
				}
			}
		}
		NOR = {
			has_character_modifier = minor_enemy_of_the_jews
			has_character_modifier = major_enemy_of_the_jews
			has_character_modifier = friend_of_the_jews
			has_character_modifier = expelled_jewish
			has_character_flag = ciml_jewish_event
		}
		OR = {
			independent = yes
			AND = {
				top_liege = { NOT = { has_character_modifier = expelled_jewish } }
				primary_title = { higher_tier_than = DUKE }
			}
		}
	}
	
	mean_time_to_happen = {
		months = 1800
	}
	
	option = {
		name = EVTOPTACIML.800
		add_character_modifier = { 
			name = friend_of_the_jews
			months = 200
		}
		if = { 
			limit = { 
				NOT = { trait = sympathy_judaism }
			} 
			random = { 
				chance = 25  
				add_trait = sympathy_judaism
			}
		}
	}
	
	option = {
		name = EVTOPTBCIML.800
		trigger = {
			NOT = {
				trait = sympathy_judaism
			}
		}
		add_character_modifier = { 
			name = minor_enemy_of_the_jews
			months = 200
		}
	}
	
	option = {
		name = EVTOPTCCIML.800
		trigger = {
			NOT = {
				trait = charitable
			}
		}
		wealth = 100
		prestige = -50
		piety = -25
		if = { 
			limit = { 
				NOT = { trait = greedy }
			} 
			random = { 
				chance = 15  
				add_trait = greedy
			}
		}
	}
	
	option = {
		name = EVTOPTDCIML.800
		tooltip_info = greedy
		trigger = {
			trait = greedy
		}
		wealth = 120
		prestige = -50
		piety = -25
	}
	
	after = {
		set_character_flag = ciml_jewish_event
	}
}

# Church demands that jews cannot enter cristian baths
character_event = {
	id = CIML.801
	title = EVTNAMECIML.801
	desc = EVTDESCCIML.801
	picture = GFX_evt_jewish_market
	
	only_playable = yes
	
	trigger = {
		religion_group = christian
		NOR = { 
			religion = mandean
			religion = catholic
			religion = miaphysite
			religion = nestorian
			religion = cathar
			religion = fraticelli
			religion = waldensian
			religion = lollard
			religion = messalian
			religion = judaizer
			religion = chaldean
			religion = adoptionist
			religion = free_spirits
			religion = monophysite
		}
		NOR = {
			government = nomadic_government
			government = tribal_government
			government = theocracy_government
			any_demesne_province = {
				OR = { 
					religion = jewish
					religion = samaritan
					religion = karaite
				}
			}
		}
		NOR = {
			has_character_modifier = minor_enemy_of_the_jews
			has_character_modifier = major_enemy_of_the_jews
			has_character_modifier = friend_of_the_jews
			has_character_modifier = expelled_jewish
			has_character_flag = ciml_jewish_event
		}
		OR = {
			independent = yes
			AND = {
				top_liege = { NOT = { has_character_modifier = expelled_jewish } }
				primary_title = { higher_tier_than = DUKE }
			}
		}
	}
	
	mean_time_to_happen = {
		months = 1800
	}
	
	option = {
		name = EVTOPTACIML.801
		prestige = 10
		add_character_modifier = { 
			name = minor_enemy_of_the_jews
			months = 200
		}
	}
	
	option = {
		name = EVTOPTBCIML.801
		add_character_modifier = { 
			name = defied_church
			months = 200
		}
		add_character_modifier = { 
			name = friend_of_the_jews
			months = 225
		}
		if = { 
			limit = { 
				NOT = { trait = sympathy_judaism }
			} 
			random = { 
				chance = 20  
				add_trait = sympathy_judaism
			}
		}
	}
	
	option = {
		name = EVTOPTCCIML.801
		tooltip_info = learning
		trigger = {
			AND = {
				OR = {
					learning = 15
					year = 1100
				}
				OR = {
					religion = orthodox
					religion = barlaamite
				}
			}
		}
	}
	
	option = {
		name = EVTOPTDCIML.801
		tooltip_info = lunatic
		trigger = {
			OR = {
				trait = lunatic
				trait = possessed
			}
		}
		piety = -10
		prestige = -10
		add_character_modifier = { 
			name = minor_enemy_of_the_jews
			months = 200
		}
	}
	
	after = {
		set_character_flag = ciml_jewish_event
	}
}

# Christians in debt complain about jewish usury
character_event = {
	id = CIML.802
	title = EVTNAMECIML.802
	desc = EVTDESCCIML.802
	picture = GFX_evt_jewish_market
	
	only_playable = yes
	
	trigger = {
		religion_group = christian
		NOT = { religion = mandean }
		NOR = {
			government = nomadic_government
			government = tribal_government
			government = theocracy_government
			any_demesne_province = {
				OR = { 
					religion = jewish
					religion = samaritan
					religion = karaite
				}
			}
		}
		NOR = {
			has_character_modifier = minor_enemy_of_the_jews
			has_character_modifier = major_enemy_of_the_jews
			has_character_modifier = friend_of_the_jews
			has_character_modifier = expelled_jewish
			has_character_flag = ciml_jewish_event
		}
		OR = {
			independent = yes
			AND = {
				top_liege = { NOT = { has_character_modifier = expelled_jewish } }
				primary_title = { higher_tier_than = DUKE }
			}
		}
	}
	
	mean_time_to_happen = {
		months = 1800
	}
	
	option = {
		name = EVTOPTACIML.802
		add_character_modifier = { 
			name = minor_enemy_of_the_jews
			months = 200
		}
		prestige = 50
	}
	
	option = {
		name = EVTOPTBCIML.802
		add_character_modifier = { 
			name = friend_of_the_jews
			months = 120
		}
		add_character_modifier = { 
			name = supported_jewish_usury
			months = 120
		}
	}
	
	option = {
		name = EVTOPTCCIML.802
		add_character_modifier = { 
			name = supported_jewish_usury
			months = 120
		}
		piety = -100
		wealth = 100
	}
	
	option = {
		name = EVTOPTDCIML.802
		tooltip_info = diplomacy
		trigger = {
			diplomacy = 13
		}
	}
	
	after = {
		set_character_flag = ciml_jewish_event
	}
}

# Orthodox or Barlaam bishops want jewish physician fired due to quinisext canons
character_event = {
	id = CIML.811
	title = EVTNAMECIML.811
	desc = EVTDESCCIML.811
	
	picture = GFX_evt_court_physician
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTACIML.811
		add_character_modifier = { 
			name = defied_church
			months = 180
		}
	}
	option = {
		name = EVTOPTBCIML.811
		any_courtier_or_vassal = {
			limit = {
				has_minor_title = title_court_physician
			}
			remove_title = title_court_physician
		}
	}
	option = {
		name = EVTOPTCCIML.811
		tooltip_info = learning
		trigger = {
			AND = {
				OR = {
					learning = 15
					year = 1100
				}
				OR = {
					religion = orthodox
					religion = barlaamite
				}
			}
		}
	}
}