#############################################
#
# Bankruptcy events
#
# Event ID 38000-38099 is reserved
#
#############################################

namespace = Plus
namespace = PlusFaction

#reserved: Plus.625 to Plus.629

# A loan is due
character_event = {
	id = 38002
	desc = EVTDESC38002
	picture = GFX_evt_council
	
	only_rulers = yes

	trigger = {
		OR = {
			has_character_modifier = loan_50_hidden
			has_character_modifier = loan_100_hidden
			has_character_modifier = loan_200_hidden
			has_character_modifier = loan_400_hidden
			has_character_modifier = loan_600_hidden
			has_character_modifier = loan_800_hidden
			has_character_modifier = loan_1000_hidden
		}
		NOR = {
			has_character_flag = loan_in_progress		
			has_character_modifier = loan_50
			has_character_modifier = loan_100
			has_character_modifier = loan_200
			has_character_modifier = loan_400
			has_character_modifier = loan_600
			has_character_modifier = loan_800
			has_character_modifier = loan_1000
		}
	}

	mean_time_to_happen = {
		days = 1
	}
	
	immediate = {
		set_character_flag = loan_in_progress
	}

	option = {
		name = EVTOPTA38002 # Return the money
		trigger = {
			OR = {
				AND = {
					has_character_modifier = loan_50_hidden
					wealth = 62.5
				}
				AND = {
					has_character_modifier = loan_100_hidden
					wealth = 125
				}
				AND = {
					has_character_modifier = loan_200_hidden
					wealth = 250
				}
				AND = {
					has_character_modifier = loan_400_hidden
					wealth = 500
				}
				AND = {
					has_character_modifier = loan_600_hidden
					wealth = 750
				}
				AND = {
					has_character_modifier = loan_800_hidden
					wealth = 1000
				}
				AND = {
					has_character_modifier = loan_1000_hidden
					wealth = 1250
				}
			}
		}
		if = {
			limit = {
				has_character_modifier = loan_50_hidden
			}
			wealth = -62.5
			hidden_tooltip = {
				remove_character_modifier = loan_50_hidden
			}
		}
		if = {
			limit = {
				has_character_modifier = loan_100_hidden
			}
			wealth = -125
			hidden_tooltip = {
				remove_character_modifier = loan_100_hidden
			}
		}
		if = {
			limit = {
				has_character_modifier = loan_200_hidden
			}
			wealth = -250
			hidden_tooltip = {
				remove_character_modifier = loan_200_hidden
			}
		}
		if = {
			limit = {
				has_character_modifier = loan_400_hidden
			}
			wealth = -500
			hidden_tooltip = {
				remove_character_modifier = loan_400_hidden
			}
		}
		if = {
			limit = {
				has_character_modifier = loan_600_hidden
			}
			wealth = -750
			hidden_tooltip = {
				remove_character_modifier = loan_600_hidden
			}
		}
		if = {
			limit = {
				has_character_modifier = loan_800_hidden
			}
			wealth = -1000
			hidden_tooltip = {
				remove_character_modifier = loan_800_hidden
			}
		}
		if = {
			limit = {
				has_character_modifier = loan_1000_hidden
			}
			wealth = -1250
			hidden_tooltip = {
				remove_character_modifier = loan_1000_hidden
			}
		}
		if = {
			limit = { NOT = { has_character_modifier = borrowed_from_jews } }
			clr_character_flag = loan_taken
		}
		clr_character_flag = loan_in_progress
	}
	option = {
		name = "EVTOPTB38002" # Pay the interest
		trigger = {
			NOR = {
				AND = {
					has_character_modifier = loan_50_hidden
					wealth = 62.5
				}
				AND = {
					has_character_modifier = loan_100_hidden
					wealth = 125
				}
				AND = {
					has_character_modifier = loan_200_hidden
					wealth = 250
				}
				AND = {
					has_character_modifier = loan_400_hidden
					wealth = 500
				}
				AND = {
					has_character_modifier = loan_600_hidden
					wealth = 750
				}
				AND = {
					has_character_modifier = loan_800_hidden
					wealth = 1000
				}
				AND = {
					has_character_modifier = loan_1000_hidden
					wealth = 1250
				}
			}
			OR = {
				AND = {
					has_character_modifier = loan_50_hidden
					wealth = 12
				}
				AND = {
					has_character_modifier = loan_100_hidden
					wealth = 25
				}
				AND = {
					has_character_modifier = loan_200_hidden
					wealth = 50
				}
				AND = {
					has_character_modifier = loan_400_hidden
					wealth = 100
				}
				AND = {
					has_character_modifier = loan_600_hidden
					wealth = 150
				}
				AND = {
					has_character_modifier = loan_800_hidden
					wealth = 200
				}
				AND = {
					has_character_modifier = loan_1000_hidden
					wealth = 250
				}
			}
		}
		if = {
			limit = { has_character_modifier = loan_50_hidden }
			hidden_tooltip = {
				add_character_modifier = {
					name = loan_50
					duration = 730
					inherit = yes
				}
			}
			wealth = -12
		}
		if = {
			limit = { has_character_modifier = loan_100_hidden }
			hidden_tooltip = {
				add_character_modifier = {
					name = loan_100
					duration = 730
					inherit = yes
				}
			}
			wealth = -25
		}
		if = {
			limit = { has_character_modifier = loan_200_hidden }
			hidden_tooltip = {
				add_character_modifier = {
					name = loan_200
					duration = 730
					inherit = yes
				}
			}
			wealth = -50
		}
		if = {
			limit = { has_character_modifier = loan_400_hidden }
			hidden_tooltip = {
				add_character_modifier = {
					name = loan_400
					duration = 730
					inherit = yes
				}
			}
			wealth = -100
		}
		if = {
			limit = { has_character_modifier = loan_600_hidden }
			hidden_tooltip = {
				add_character_modifier = {
					name = loan_100
					duration = 730
					inherit = yes
				}
			}
			wealth = -150
		}
		if = {
			limit = { has_character_modifier = loan_800_hidden }
			hidden_tooltip = {
				add_character_modifier = {
					name = loan_800
					duration = 730
					inherit = yes
				}
			}
			wealth = -200
		}
		if = {
			limit = { has_character_modifier = loan_1000_hidden }
			hidden_tooltip = {
				add_character_modifier = {
					name = loan_1000
					duration = 730
					inherit = yes
				}
			}
			wealth = -250
		}
		custom_tooltip = {
			text = EVTTOOLTIP38002B
		}
		clr_character_flag = loan_in_progress
	}
	option = {
		name = EVTOPTC38002 # Cannot afford it
		trigger = {
			NOR = {
				AND = {
					has_character_modifier = loan_50_hidden
					wealth = 62.5
				}
				AND = {
					has_character_modifier = loan_100_hidden
					wealth = 125
				}
				AND = {
					has_character_modifier = loan_200_hidden
					wealth = 250
				}
				AND = {
					has_character_modifier = loan_400_hidden
					wealth = 500
				}
				AND = {
					has_character_modifier = loan_600_hidden
					wealth = 750
				}
				AND = {
					has_character_modifier = loan_800_hidden
					wealth = 1000
				}
				AND = {
					has_character_modifier = loan_1000_hidden
					wealth = 1250
				}
			}
		}
		if = {
			limit = { has_character_modifier = loan_50_hidden }
			hidden_tooltip = {
				add_character_modifier = {
					name = loan_50
					duration = 730
					inherit = yes
				}
			}
			prestige = -25
		}
		if = {
			limit = { has_character_modifier = loan_100_hidden }
			hidden_tooltip = {
				add_character_modifier = {
					name = loan_100
					duration = 730
					inherit = yes
				}
			}
			prestige = -50
		}
		if = {
			limit = { has_character_modifier = loan_200_hidden }
			hidden_tooltip = {
				add_character_modifier = {
					name = loan_200
					duration = 730
					inherit = yes
				}
			}
			prestige = -100
		}
		if = {
			limit = { has_character_modifier = loan_400_hidden }
			hidden_tooltip = {
				add_character_modifier = {
					name = loan_400
					duration = 730
					inherit = yes
				}
			}
			prestige = -200
		}
		if = {
			limit = { has_character_modifier = loan_600_hidden }
			hidden_tooltip = {
				add_character_modifier = {
					name = loan_600
					duration = 730
					inherit = yes
				}
			}
			prestige = -300
		}
		if = {
			limit = { has_character_modifier = loan_800_hidden }
			hidden_tooltip = {
				add_character_modifier = {
					name = loan_800
					duration = 730
					inherit = yes
				}
			}
			prestige = -400
		}
		if = {
			limit = { has_character_modifier = loan_1000_hidden }
			hidden_tooltip = {
				add_character_modifier = {
					name = loan_1000
					duration = 730
					inherit = yes
				}
			}
			prestige = -500
		}
		custom_tooltip = {
			text = EVTTOOLTIP38002B
		}
		clr_character_flag = loan_in_progress
	}
	option = {
		name = EVTOPTD38002 # Get rid of them!
		ai_chance = {
			factor = 1
			modifier = {
				factor = 0
				NOR = {
					trait = wroth
					trait = lunatic
					trait = possessed
				}
			}
		}
		if = {
			limit = { has_character_modifier = loan_50_hidden }
			hidden_tooltip = {
				remove_character_modifier = loan_50_hidden
			}
			prestige = -100
		}
		if = {
			limit = { has_character_modifier = loan_100_hidden }
			hidden_tooltip = {
				remove_character_modifier = loan_100_hidden
			}
			prestige = -200
		}
		if = {
			limit = { has_character_modifier = loan_200_hidden }
			hidden_tooltip = {
				remove_character_modifier = loan_200_hidden
			}
			prestige = -400
		}
		if = {
			limit = { has_character_modifier = loan_400_hidden }
			hidden_tooltip = {
				remove_character_modifier = loan_400_hidden
			}
			prestige = -800
		}
		if = {
			limit = { has_character_modifier = loan_600_hidden }
			hidden_tooltip = {
				remove_character_modifier = loan_600_hidden
			}
			prestige = -1200
		}
		if = {
			limit = { has_character_modifier = loan_800_hidden }
			hidden_tooltip = {
				remove_character_modifier = loan_800_hidden
			}
			prestige = -1600
		}
		if = {
			limit = { has_character_modifier = loan_1000_hidden }
			hidden_tooltip = {
				remove_character_modifier = loan_1000_hidden
			}
			prestige = -2000
		}
		any_demesne_title = {
			limit = { tier = count }
			location = {
				add_province_modifier = {
					name = offended_moneylenders
					duration = 3650
				}
			}
		}
		set_character_flag = offended_moneylenders
		clr_character_flag = loan_in_progress
		if = {
			limit = { NOT = { has_character_modifier = borrowed_from_jews } }
			clr_character_flag = loan_taken
		}
		if = {
			limit = { any_vassal = { leads_faction = faction_prosperity } }
			custom_tooltip = { text = PROSPERITYFACTIONMOODMINUS }
			hidden_tooltip = {
				random_vassal = { limit = { leads_faction = faction_prosperity } set_variable = { which = "faction_mood_decrease" value = 8 } }
				character_event = { id = PlusFaction.200 days = 1 }
			}
		}
	}
}

# Ruler in red, lean on vassals
character_event = {
	id = 38010
	desc = EVTDESC38010
	picture = GFX_evt_council
	
	only_playable = yes
	prisoner = no
	
	trigger = {
		OR = {
			NOT = { wealth = -50 }
			AND = {
				ai = yes
				has_character_modifier = ai_austerity
			}
		}
		any_vassal = {
			wealth = 10
			NOT = { has_character_flag = took_extra_tax }
		}
	}
	
	mean_time_to_happen = {
		months = 60
		modifier = {
			factor = 0.5
			ai = yes
			has_character_modifier = ai_austerity
		}
		modifier = {
			factor = 0.25
			has_character_flag = loan_taken
		}
	}
	
	option = {
		name = EVTOPTA38010 # ask one vassal for large
		ai_chance = {
			factor = 10
		}
		trigger = {
			any_vassal = {
				wealth = 200
				NOT = { has_character_flag = took_extra_tax }
				opinion = { who = ROOT value =  0 }
			}
		}
		random_vassal = {
			limit = {
				wealth = 200
				NOT = { has_character_flag = took_extra_tax }
				opinion = { who = ROOT value =  0 }
			}
			opinion = {
				modifier = got_money_request
				who = ROOT
				years = 10
				multiplier = 3
			}
			set_character_flag = large_payment_from_vassal
			character_event = { id = 38011 days = 1 tooltip = EVTTOOLTIP38013 }
			set_character_flag = took_extra_tax
		}
	}
	option = {
		name = EVTOPTA38010 # ask one vassal for large
		ai_chance = {
			factor = 10
		}
		trigger = {
			NOT = {
				any_vassal = {
					wealth = 200
					NOT = { has_character_flag = took_extra_tax }
					opinion = { who = ROOT value =  0 }
				}
			}
			any_vassal = {
				wealth = 200
				NOT = { has_character_flag = took_extra_tax }
			}
		}
		random_vassal = {
			limit = {
				wealth = 200
				NOT = { has_character_flag = took_extra_tax }
			}
			opinion = {
				modifier = got_money_request
				who = ROOT
				years = 10
				multiplier = 3
			}
			set_character_flag = large_payment_from_vassal
			character_event = { id = 38011 days = 1 tooltip = EVTTOOLTIP38013 }
			set_character_flag = took_extra_tax
		}
	}
	option = {
		name = EVTOPTC38010 # ask one vassal for medium
		trigger = {
			any_vassal = {
				wealth = 50
				NOT = { has_character_flag = took_extra_tax }
				opinion = { who = ROOT value =  0 }
			}
		}
		ai_chance = {
			factor = 1
			modifier = {
				factor = 10
				wealth = -100
			}
		}
		random_vassal = {
			limit = {
				wealth = 50
				NOT = { has_character_flag = took_extra_tax }
				opinion = { who = ROOT value =  0 }
			}
			opinion = {
				modifier = got_money_request
				who = ROOT
				years = 10
			}
			set_character_flag = medium_payment_from_vassal
			character_event = { id = 38011 days = 1 tooltip = EVTTOOLTIP38012 }
			set_character_flag = took_extra_tax
		}
	}
	option = {
		name = EVTOPTC38010 # ask one vassal for medium
		trigger = {
			NOT = {
				any_vassal = {
					wealth = 50
					NOT = { has_character_flag = took_extra_tax }
					opinion = { who = ROOT value =  0 }
				}
			}
			any_vassal = {
				wealth = 50
				NOT = { has_character_flag = took_extra_tax }
			}
		}
		ai_chance = {
			factor = 1
			modifier = {
				factor = 10
				wealth = -100
			}
		}
		random_vassal = {
			limit = {
				wealth = 50
				NOT = { has_character_flag = took_extra_tax }
			}
			opinion = {
				modifier = got_money_request
				who = ROOT
				years = 10
			}
			set_character_flag = medium_payment_from_vassal
			character_event = { id = 38011 days = 1 tooltip = EVTTOOLTIP38012 }
			set_character_flag = took_extra_tax
		}
	}
	option = {
		name = EVTOPTB38010 # ask one vassal for small
		trigger = {
			any_vassal = {
				wealth = 10
				NOT = { has_character_flag = took_extra_tax }
				opinion = { who = ROOT value =  0 }
			}
		}
		ai_chance = {
			factor = 1
		}
		random_vassal = {
			limit = {
				wealth = 10
				NOT = { has_character_flag = took_extra_tax }
				opinion = { who = ROOT value =  0 }
			}
			opinion = {
				modifier = got_money_request
				who = ROOT
				years = 2
			}
			character_event = { id = 38011 days = 1 tooltip = EVTTOOLTIP38011 }
			set_character_flag = small_payment_from_vassal
			set_character_flag = took_extra_tax
		}
	}
	option = {
		name = EVTOPTB38010 # ask one vassal for small
		trigger = {
			NOT = {
				any_vassal = {
					wealth = 10
					NOT = { has_character_flag = took_extra_tax }
					opinion = { who = ROOT value =  0 }
				}
			}
			any_vassal = {
				wealth = 10
				NOT = { has_character_flag = took_extra_tax }
				opinion = { who = ROOT value =  0 }
			}
		}
		ai_chance = {
			factor = 1
		}
		random_vassal = {
			limit = {
				wealth = 10
				NOT = { has_character_flag = took_extra_tax }
			}
			opinion = {
				modifier = got_money_request
				who = ROOT
				years = 2
			}
			character_event = { id = 38011 days = 1 tooltip = EVTTOOLTIP38011 }
			set_character_flag = small_payment_from_vassal
			set_character_flag = took_extra_tax
		}
	}
}

# Request for tax from vassal
character_event = {
	id = 38011
	desc = EVTDESC38011
	picture = GFX_evt_council
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_38011
		trigger = {
			has_dlc = "Zeus"
			has_character_flag = large_payment_from_vassal
			NOT = {
				holds_favor_on = FROM
			}
		}
		ai_chance = {
			factor = 5
			modifier = {
				factor = 1.5
				opinion = { who = from value =  25 }
			}
			modifier = {
				factor = 2
				opinion = { who = from value =  50 }
			}
			modifier = {
				factor = 3
				opinion = { who = from value =  75 }
			}
			modifier = {
				factor = 0
				NOT = { opinion = { who = from value =  0 } }
			}
		}
		custom_tooltip = {
			text = EVTOPTA_38011_TOOLTIP
			hidden_tooltip = {
				add_favor = FROM
				wealth = -250
				FROM = { character_event = { id = 38016 days = 1 } }
			}
		}
	}	
	option = {
		name = ACCEPT
		ai_chance = {
			factor = 1
			modifier = {
				factor = 1.5
				opinion = { who = from value = 25 }
			}
			modifier = {
				factor = 2
				opinion = { who = from value = 50 }
			}
			modifier = {
				factor = 3
				opinion = { who = from value = 75 }
			}
			modifier = {
				factor = 0
				NOT = { opinion = { who = from value = 0 } }
			}
		}
		if = {
			limit = { has_character_flag = large_payment_from_vassal }
			wealth = -200
		}
		if = {
			limit = { has_character_flag = medium_payment_from_vassal }
			wealth = -50
		}
		if = {
			limit = { has_character_flag = small_payment_from_vassal }
			wealth = -10
		}
		hidden_tooltip = {
			FROM = { character_event = { id = 38015 days = 1 } }
		}
	}
	option = {
		name = DECLINE
		ai_chance = {
			factor = 1
			modifier = {
				factor = 2
				NOT = { opinion = { who = FROM value =  10 } }
			}
			modifier = {
				factor = 0
				opinion = { who = FROM value = 90 }
			}
			modifier = {
				factor = 0.1
				FROM = { ai = yes }
			}
		}
		clr_character_flag = small_payment_from_vassal
		clr_character_flag = medium_payment_from_vassal
		clr_character_flag = large_payment_from_vassal
		reverse_opinion = {
			modifier = refused_money_request
			who = FROM
			years = 10
		}
		hidden_tooltip = {
			FROM = { character_event = { id = 38014 days = 1 } }
		}
	}
}

# Vassal refuses to pay
character_event = {
	id = 38014
	desc = EVTDESC38014
	picture = GFX_evt_council
	
	is_triggered_only = yes
	
	option = {
		name = OK
		prestige = -25
	}
}

# Vassal agrees to pay
character_event = {
	id = 38015
	desc = EVTDESC38015
	picture = GFX_evt_council
	
	is_triggered_only = yes
	
	option = {
		name = OK
		if = {
			limit = {
				FROM = { has_character_flag = large_payment_from_vassal }
			}
			wealth = 250
		}
		if = {
			limit = {
				FROM = { has_character_flag = medium_payment_from_vassal }
			}
			wealth = 50
		}
		if = {
			limit = {
				FROM = { has_character_flag = small_payment_from_vassal }
			}
			wealth = 10
		}
		FROM = {
			clr_character_flag = small_payment_from_vassal
			clr_character_flag = medium_payment_from_vassal
			clr_character_flag = large_payment_from_vassal
		}
	}
}

#Payment accepted, for favor
character_event = {
	id = 38016
	desc = EVTDESC38016
	picture = GFX_evt_council
	
	is_triggered_only = yes
	
	option = {
		name = OK
		custom_tooltip = {
			text = EVTOPT_38016_TOOLTIP
			wealth = 250
		}
		FROM = {
			clr_character_flag = small_payment_from_vassal
			clr_character_flag = medium_payment_from_vassal
			clr_character_flag = large_payment_from_vassal
		}
	}
	
}

# Ruler is in the red. Seize Church Properties
character_event = {
	id = 38020
	desc = EVTDESC38020
	picture = GFX_evt_pope_feast
	
	only_playable = yes
	religion_group = christian
	prisoner = no
	
	trigger = {
		OR = {
			NOT = { wealth = -50 }
			AND = {
				ai = yes
				has_character_modifier = ai_austerity
				OR = {
					piety = 100
					trait = cynical
				}
			}
		}
		NOT = { has_character_flag = stolen_church_properties }
		NOT = { trait = zealous }
		any_vassal = {
			is_theocracy = yes
			prisoner = no
		}
	}
	
	mean_time_to_happen = {
		months = 48
	}
	
	option = {
		name = EVTOPTA38020 # There are fat bishop, seize them !
		ai_chance = {
			factor = 1
			modifier = {
				factor = 0
				NOT = { trait = cynical }
			}
		}
		trigger = {
			any_vassal = {
				is_theocracy = yes
				prisoner = no
				any_demesne_title = {
					tier = baron
					num_of_buildings = 1
				}
			}
		}
		random_vassal = {
			limit = {
				is_theocracy = yes
				prisoner = no
				any_demesne_title = {
					tier = baron
					num_of_buildings = 1
				}
			}	
			character_event = { id = 38021 days = 1 tooltip = EVTTOOLTIP38021 }
			opinion = {
				who = ROOT
				modifier = opinion_arrest_attempt
				months = 240
			}
			imprison = yes
		}
		wealth = 300
		add_trait = cruel
		set_character_flag = destroyed_church_properties
		set_character_flag = stolen_church_properties
		if = {
			limit = { any_vassal = { leads_faction = faction_tradition } }
			custom_tooltip = { text = TRADITIONFACTIONMOODMINUS }
			hidden_tooltip = {
				random_vassal = { limit = { leads_faction = faction_tradition } set_variable = { which = "faction_mood_decrease" value = 8 } }
				character_event = { id = PlusFaction.200 days = 1 }
			}
		}
	}
	option = {
		name = EVTOPTB38020 # Time are harsh, force them to share the costs !
		wealth = 100
		random = {
			chance = 25
			random_vassal = {
				limit = {
					is_theocracy = yes
					prisoner = no
				}
				character_event = { id = 38021 days = 1 tooltip = EVTTOOLTIP38021 }
			}
		}
		set_character_flag = stolen_church_properties
		if = {
			limit = { any_vassal = { leads_faction = faction_tradition } }
			custom_tooltip = { text = TRADITIONFACTIONMOODMINUS }
			hidden_tooltip = {
				random_vassal = { limit = { leads_faction = faction_tradition } set_variable = { which = "faction_mood_decrease" value = 4 } }
				character_event = { id = PlusFaction.200 days = 1 }
			}
		}
	}
	option = {
		name = EVTOPTC38020 # Compromise with them to find money !
		wealth = 50
		piety = -25
		prestige = -50
		set_character_flag = stolen_church_properties
	}
	option = {
		name = EVTOPTD38020 # Never ! I will save my Christian soul !
		piety = 50
		if = {
			limit = { NOT = { trait = zealous } }
			change_stewardship = -1
			add_trait = zealous
		}
		set_character_flag = stolen_church_properties
		if = {
			limit = { any_vassal = { leads_faction = faction_tradition } }
			custom_tooltip = { text = TRADITIONFACTIONMOODPLUS }
			hidden_tooltip = {
				random_vassal = { limit = { leads_faction = faction_tradition } set_variable = { which = "faction_mood_increase" value = 1 } }
				character_event = { id = PlusFaction.200 days = 1 }
			}
		}
	}
}

# If a building is specified, then that one is exempt
character_event = {
	id = 38021
	desc = "EVTDESC38021"
	picture = GFX_evt_lunatic
	
	is_triggered_only = yes
	
	immediate = {
		if = {
			limit = {
				FROM = { has_character_flag = destroyed_church_properties }
			}
			FROM = { clr_character_flag = destroyed_church_properties }
			random_demesne_title = {
				limit = { tier = baron }
				destroy_random_building = yes
			}
			wealth = -300
		}
		if = {
			limit = {
				FROM = { NOT = { has_character_flag = destroyed_church_properties } }
			}
			wealth = -100
		}
	}
	
	option = {
		name = EVTOPTA38021 # They are cursed in the eyes of God!
		ai_chance = {
			factor = 1
			modifier = {
				factor = 10
				NOT = { opinion = { who = from value =  50 } }
			}
			modifier = {
				factor = 10
				trait = zealous
			}
			modifier = {
				factor = 100
				prisoner = yes
			}
		}
		FROM = { character_event = { id = 38022 days = 63 tooltip = EVTTOOLTIP38022 } }
	}
	option = {
		name = EVTOPTB38021 # Jesus said to forgive them for their sins.
		ai_chance = {
			factor = 1
			modifier = {
				factor = 2
				trait = kind
			}
			modifier = {
				factor = 1.5
				trait = humble
			}
			modifier = {
				factor = 0
				prisoner = yes
			}
		}
		opinion = {
			modifier = grudge_from_sin
			who = ROOT

		}
	}
}

# We have been judged in the eyes of God
character_event = {
	id = 38022
	desc = EVTDESC38022
	picture = GFX_evt_bad_news
	
	is_triggered_only = yes
	hide_from = yes
	
	option = {
		name = EVTOPTA38022
		add_trait = excommunicated
		piety = -50
	}
}
	
# On-Action: Mercs go on a rampage
letter_event = {
	id = 38050
	desc = EVTDESC38050
	
	is_triggered_only = yes
	
	trigger = {
		ai = no
	}
	
	option = {
		name = EVTOPTA38050
	}
}

# On-Action: Mercs leave in disgust
letter_event = {
	id = 38051
	desc = EVTDESC38051
	
	is_triggered_only = yes
	
	trigger = {
		ai = no
	}
	
	option = {
		name = EVTOPTA38051
	}
}

# On-Action: Mercs switch side FROM you
letter_event = {
	id = 38052
	desc = EVTDESC38052
	
	is_triggered_only = yes
	
	trigger = {
		ai = no
	}
	
	option = {
		name = EVTOPTA38052
	}
}

# On-Action: Mercs switch side TO you
letter_event = {
	id = 38053
	desc = EVTDESC38053
	
	is_triggered_only = yes
	
	trigger = {
		ai = no
	}
	
	option = {
		name = EVTOPTA38053
	}
}

# On-Action: Holy Order leaves your service
letter_event = {
	id = 38054
	desc = EVTDESC38054
	border = GFX_event_letter_frame_war
	
	is_triggered_only = yes
	
	trigger = {
		ai = no
	}
	
	option = {
		name = EVTOPTA38054
	}
}

# Offer to buy a title from indebted liege
character_event = {
	id = 38060
	desc = EVTDESC38060
	picture = GFX_evt_council
	
	only_playable = yes
	min_age = 16
	only_capable = yes
	prisoner = no
	
	trigger = {
		NOT = { has_character_flag = offered_to_buy_liege_titles }
		liege = {
			NOT = { character = ROOT }
		}
		liege = {
			NOT = { wealth = -50 }
			any_demesne_title = {
				has_de_jure_pretension = ROOT
				can_be_given_away = yes
				lower_tier_than = DUKE
				NAND = {
					tier = count
					location = {
						is_capital = yes
					}
				}
			}
		}
		wealth = 300
	}
	
	immediate = {
		liege = {
			random_demesne_title = {
				limit = {
					has_de_jure_pretension = ROOT
					can_be_given_away = yes
					lower_tier_than = ROOT
					NOT = {
						AND = {
							tier = count
							location = {
								is_capital = yes
							}
						}
					}
				}
				save_event_target_as = title_for_sale
			}
		}
		set_character_flag = offered_to_buy_liege_titles
	}
	
	mean_time_to_happen = {
		months = 60
		
		modifier = {
			factor = 0.75
			liege = { NOT = { wealth = -75 } }
		}
		modifier = {
			factor = 0.75
			liege = { NOT = { wealth = -100 } }
		}
		modifier = {
			factor = 0.75
			liege = { NOT = { wealth = -125 } }
		}
		modifier = {
			factor = 0.75
			liege = { NOT = { wealth = -150 } }
		}
		modifier = {
			factor = 0.75
			wealth = 600
		}
		modifier = {
			factor = 0.75
			wealth = 700
		}
		modifier = {
			factor = 0.75
			wealth = 800
		}
		modifier = {
			factor = 0.75
			wealth = 900
		}
	}

	option = {
		trigger = {
			has_dlc = "Zeus"
			NOT = {
				liege = { owes_favor_to = ROOT }
			}
		}
		name = EVTOPTC38060
		ai_chance = { factor = 100 }
		liege = { character_event = { id = 38062 days = 1 tooltip = EVTTOOLTIP38061 } }
		liege = {
			tooltip = {
				event_target:title_for_sale = {
					grant_title = ROOT
				}
			}
		}
	}	
	option = {
		name = EVTOPTA38060
		ai_chance = { factor = 100 }
		liege = {
			character_event = { id = 38061 days = 1 tooltip = EVTTOOLTIP38061 }
		}
		liege = {
			tooltip = {
				event_target:title_for_sale = {
					grant_title = ROOT
				}
			}
		}
	}
	option = {
		name = EVTOPTB38060
		ai_chance = { factor = 0 }
	}
}

# Liege receives offer to sell land
character_event = {
	id = 38061
	desc = EVTDESC38061
	picture = GFX_evt_council
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA38061
		ai_chance = { factor = 100 }
		wealth = 500
		event_target:title_for_sale = {
			grant_title = FROM
		}
		FROM = {
			wealth = -500
		}
	}
	option = {
		name = EVTOPTB38061
		ai_chance = { factor = 0 }
	}
}

# Liege receives offer to sell land for favor
character_event = {
	id = 38062
	desc = EVTDESC38062
	picture = GFX_evt_council
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA38062
		ai_chance = { factor = 100 }
		wealth = 300
		event_target:title_for_sale = {
			grant_title = FROM
		}
		FROM = {
			wealth = -300
			add_favor = ROOT
		}
	}
	option = {
		name = EVTOPTB38062
		ai_chance = { factor = 0 }
	}
}

# A loan from the jews is due
character_event = {
	id = Plus.625
	desc = EVTDESC_Plus_625
	picture = GFX_evt_council
	
	only_rulers = yes

	trigger = {
		NOR = {
			has_character_flag = loan_in_progress_jewish
			has_character_modifier = loan_timer_jews
		}
		has_character_modifier = borrowed_from_jews
	}

	immediate = {
		set_character_flag = loan_in_progress_jewish
	}

	mean_time_to_happen = {
		days = 1
	}

	option = {
		name = EVTOPTA38002 # Return the money
		trigger = {
			wealth = 350
		}
		wealth = -350
		remove_character_modifier = borrowed_from_jews
		clr_character_flag = loan_in_progress_jewish
		if = {
			limit = {
				NOR = {
					has_character_modifier = loan_50_hidden
					has_character_modifier = loan_100_hidden
					has_character_modifier = loan_200_hidden
					has_character_modifier = loan_400_hidden
					has_character_modifier = loan_600_hidden
					has_character_modifier = loan_800_hidden
					has_character_modifier = loan_1000_hidden
				}
			}
			clr_character_flag = loan_taken
		}		
	}
	option = {
		name = EVTOPTB38002 # Pay the interest
		trigger = {
			NOT = {
				wealth = 350
			}
			wealth = 50
		}
		custom_tooltip = {
			text = EVTTOOLTIP38002B
			hidden_tooltip = {
				wealth = -50
				add_character_modifier = {
					name = "loan_timer_jews"
					duration = 730
					inherit = yes
				}
			}
		}
		clr_character_flag = loan_in_progress_jewish
	}
	option = {
		name = EVTOPTC38002 # Cannot afford it
		trigger = {
			NOT = { wealth = 50 }
		}
		prestige = -150
		hidden_tooltip = {
			remove_character_modifier = loan_timer_jews
			add_character_modifier = {
				name = "loan_timer_jews"
				duration = 730
				inherit = yes
			}
		}
		custom_tooltip = { text = EVTTOOLTIP38002B }
		clr_character_flag = loan_in_progress_jewish
	}
	option = {
		name = EVTOPTD38002 # Get rid of them!
		ai_chance = {
			factor = 1
			modifier = {
				factor = 0
				NOR = {
					trait = wroth
					trait = lunatic
					trait = possessed
				}
			}
			modifier = {
				factor = 0
				OR = {
					trait = sympathy_judaism
					any_spouse = {
						religion = jewish
					}
					any_child = {
						religion = jewish
					}	
				}
			}
		}
		any_demesne_title = {
			limit = { tier = count }
			location = {
				add_province_modifier = {
					name = offended_moneylenders
					duration = 3650
				}
			}
		}
		add_character_modifier = {
			name = expelled_jewish
			duration = 21900
			inherit = no
		}
		custom_tooltip = {
			text = jews_are_expelled
		}
		prestige = -600		
		hidden_tooltip = {
			character_event = { id = SoA.105 }
			add_character_modifier = {
				name = expelled_jews_timer
				duration = 21900
				hidden = yes
				inherit = yes
			}
			set_character_flag = pogrom
		}		
		if = {
			limit = { has_character_modifier = loan_timer_jews }
			remove_character_modifier = loan_timer_jews
		}	
		remove_character_modifier = borrowed_from_jews
		set_character_flag = offended_moneylenders
		clr_character_flag = loan_in_progress_jewish
		if = {
			limit = {
				NOR = {
					has_character_modifier = loan_50_hidden
					has_character_modifier = loan_100_hidden
					has_character_modifier = loan_200_hidden
					has_character_modifier = loan_400_hidden
					has_character_modifier = loan_600_hidden
					has_character_modifier = loan_800_hidden
					has_character_modifier = loan_1000_hidden
				}
			}
			clr_character_flag = loan_taken
		}
		if = {
			limit = { any_vassal = { leads_faction = faction_prosperity } }
			custom_tooltip = { text = PROSPERITYFACTIONMOODMINUS }
			hidden_tooltip = {
				random_vassal = { limit = { leads_faction = faction_prosperity } set_variable = { which = "faction_mood_decrease" value = 8 } }
				character_event = { id = PlusFaction.200 days = 1 }
			}
		}
	}
}
 
