######################################
#
# Polygamy Events
#
# Event ID 89000 - 89249 reserved
#
######################################

### Wives fall in love with each other
character_event = {
	id = 89000
	desc = "EVTDESC89000"
	picture = GFX_evt_lovers
	
	trigger = {
		religion_group = muslim
		is_female = yes
		is_married = yes
		trait = homosexual
		spouse = {
			any_spouse = {
				NOT = { character = ROOT }
				trait = homosexual
				is_alive = yes
				at_location = ROOT
			}
		}
		NOT = {
			has_character_flag = thelma
			has_character_flag = louise
		}
	}
	
	mean_time_to_happen = {
		months = 3
	}
		
	option = {
		name = "EVTOPTA89000"
		set_character_flag = thelma
		spouse = {
			any_spouse = {
				limit = {
					trait = homosexual
					NOT = { character = ROOT }
				}
				set_character_flag = louise
				add_lover = ROOT
			}
			hidden_tooltip = {
				character_event = { id = 89001 days = 14 }
			}
		}
	}
}
					
# Husband finds out
character_event = {
	id = 89001
	desc = "EVTDESC89001"
	picture = GFX_evt_lovers
	
	is_triggered_only = yes
	
	option = { # Accept it.
		name = "EVTOPTA89001"
		decadence = 2
		any_spouse = {
			limit = { has_character_flag = thelma }
			opinion = {
				modifier = opinion_grateful
				who = ROOT
				months = 12
			}
		}
		any_spouse = {
			limit = { has_character_flag = louise }
			opinion = {
				modifier = opinion_grateful
				who = ROOT
				months = 12
			}
		}
	}
	option = { # Order them to stop.
		name = "EVTOPTB89001"
		hidden_tooltip = {
			character_event = { id = 89002 days = 30 }
		}
		piety = 20
	}
	option = { # Execute them
		name = "EVTOPTC89001"
		any_spouse = {
			limit = { has_character_flag = thelma }
			death = { death_reason = death_execution killer = ROOT }
		}
		any_spouse = {
			limit = { has_character_flag = louise }
			death = { death_reason = death_execution killer = ROOT }
		}
	}
}

# Husband finds out they've fled!
character_event = {
	id = 89002
	desc = "EVTDESC89002"
	picture = GFX_evt_bad_news
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA89002"
		character_event = { id = 89003 tooltip = "EVTTOOLTIP89003" }
	}
}

# The wives drive their carriage over a cliff
character_event = {
	id = 89003
	desc = "EVTDESC89003"
	picture = GFX_evt_moors
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA89003"
		any_spouse = {
			limit = { has_character_flag = thelma }
			death = { death_reason = death_suicide }
		}
		any_spouse = {
			limit = { has_character_flag = louise }
			death = { death_reason = death_suicide }
		}
	}
}

### Secondary Wife schemes to become First Wife

# Secondary Wife thinks she should be First Wife
character_event = {
	id = 89005
	desc = "EVTDESC89005"
	picture = GFX_evt_quarrel
	
	capable_only = yes
	prisoner = no
	
	trigger = {
		is_female = yes
		age = 16
		is_married = yes
		is_pregnant = no
		NOT = { trait = in_hiding }
		is_main_spouse = no
		religion_group = muslim
	}
	
	mean_time_to_happen = {
	months = 420
		modifier = {
			factor = 0.25
			trait = envious
		}
		modifier = {
			factor = 0.25
			trait = ambitious
		}
		modifier = {
			factor = 0.5
			trait = deceitful
		}
		modifier = {
			factor = 2.0
			trait = kind
		}
		modifier = {
			factor = 2.0
			trait = shy
		}
		modifier = {
			factor = 4.0
			trait = content
		}
	}
	
	option = { # Kill First Wife!
		name = "EVTOPTA89005"
		#tooltip_info = 
		trigger = {
			OR = {
				trait = cruel
				trait = deceitful
				trait = lunatic
			}
		}
		set_character_flag = plotting_second_wife
		ai_chance = { factor = 40 }
		random_list = {
			50 = {
				spouse = {
					random_spouse = {
						limit = { is_main_spouse = yes }
						death = {
							death_reason = death_murder
							killer = ROOT
						}
					}
					character_event = { id = 89006 days = 4 tooltip = "EVTTOOLTIP89007" }
				}
			}
			50 = {
				spouse = {
					random_spouse = {
						limit = { is_main_spouse = yes }
						character_event = { id = 89007 days = 4 tooltip = "EVTTOOLTIP89007" }
					}
				}
			}
		}
	}
	option = { # Woo husband
		name = "EVTOPTB89005"
		set_character_flag = plotting_second_wife
		ai_chance = { factor = 40 }
		spouse = {
			character_event = { id = 89010 days = 4 tooltip = "EVTTOOLTIP89010" }
		}
	}
	option = { # Do nothing
		name = "EVTOPTC89005"
		ai_chance = { factor = 20 }
		random_list = {
			50 = { 
				if = {
					limit = {
						NOT = {
							trait = content
							trait = ambitious
						}
					}
					add_trait = content
					piety = 20
				}
			}
			50 = {
				piety = 20
			}
		}
	}
}

# First Wife is murdered by Second Wife
character_event = {
	id = 89006
	desc = "EVTDESC89006"
	picture = GFX_evt_death
	
	is_triggered_only = yes
	
	option = { # Accept it
		name = "EVTOPTA89006"
	}
	option = { # Send killer to prison
		name = "EVTOPTB89006"
		random_spouse = {
			limit = { has_character_flag = plotting_second_wife }
			imprison = yes
			clr_character_flag = plotting_second_wife
		}
	}
	option = { # Have killer executed
		name = "EVTOPTC89006"
		random_spouse = {
			limit = { has_character_flag = plotting_second_wife }
			death = {
				death_reason = death_execution
				killer = ROOT
			}
			clr_character_flag = plotting_second_wife
		}
	}
}

# First Wife is informed of failed murder attempt
character_event = {
	id = 89007
	desc = "EVTDESC89007"
	picture = GFX_evt_shadow
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA89007"
		spouse = {
			character_event = { id = 89008 days = 4 tooltip = "EVTTOOLTIP89008" }
		}
	}
}

# Husband is informed of failed murder attempt
character_event = {
	id = 89008
	desc = "EVTDESC89008"
	picture = GFX_evt_shadow
	
	is_triggered_only = yes
	
	option = { # Execute wife
		name = "EVTOPTA89008"
		random_spouse = {
			limit = { has_character_flag = plotting_second_wife }
			death = {
				death_reason = death_execution
				killer = ROOT
			}
			clr_character_flag = plotting_second_wife
		}
	}
	option = { # Imprison wife
		name = "EVTOPTB89008" 
		random_spouse = {
			limit = { has_character_flag = plotting_second_wife }
			imprison = yes
			clr_character_flag = plotting_second_wife
		}
	}
	option = { # Tell wife to fight own battles
		name = "EVTOPTC89008"
		random_spouse = {
			limit = { is_main_spouse = yes }
			hidden_tooltip = {
				character_event = { id = 89009 days = 4 tooltip = "EVTTOOLTIP89009" }
			}
			opinion = {
				who = ROOT
				modifier = opinion_very_disappointed
				years = 2
			}
		}
	}
}

# First Wife told to fight her own battles.
character_event = {
	id = 89009
	desc = "EVTDESC89009"
	picture = GFX_evt_quarrel
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA89009"
	}
}

# Second Wife tries to manipulate Husband
character_event = {
	id = 89010
	desc = "EVTDESC89010"
	picture = GFX_evt_quarrel
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA89010"
		random_spouse = {
			limit = { is_main_spouse = yes }
			opinion = {
				who = ROOT
				modifier = opinion_very_disappointed
				years = 4
			}
			hidden_tooltip = {
				character_event = { id = 89011 days = 16 }
			}
		}
		FROM = {
			make_primary_spouse = yes
			opinion = {
				who = ROOT
				modifier = opinion_happy
				years = 2
			}
		}
	}
	option = {
		name = "EVTOPTB89010"
		FROM = {
			opinion = {
				who = ROOT
				modifier = opinion_disappointed
				years = 2
			}
		}
	}
}

# Former First Wife schemes against new First Wife
character_event = {
	id = 89011
	desc = "EVTDESC89011"
	picture = GFX_evt_quarrel
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA89011"
		ai_chance = { factor = 30 }
		random_list = {
			30 = {
				spouse = {
					random_spouse = {
						limit = { is_main_spouse = yes }
						death = {
							death_reason = death_murder
							killer = ROOT
						}
					}
					hidden_tooltip = {
						character_event = { id = 89012 }
					}
				}
			}
			70 = {
			}
		}
	}
	option = {
		name = "EVTOPTB89011"
		ai_chance = { factor = 70 }
	}
}

# Former First Wife murders new First Wife
character_event = {
	id = 89012
	desc = "EVTDESC89012"
	picture = GFX_evt_death
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA89012"
		decadence = 5
	}
	option = {
		name = "EVTOPTB89012"
		FROM = { imprison = yes }
	}
	option = {
		name = "EVTOPTC89012"
		FROM = {
			death = {
				death_reason = death_execution
				killer = ROOT
			}
		}
	}
}

### First Wife thinks her son should get a county if he is not heir
character_event = {
	id = 89015
	desc = "EVTDESC89015"
	picture = GFX_evt_quarrel
	
	capable_only = yes
	prisoner = no
	
	trigger = {
		is_female = yes
		num_of_children = 1
		age = 16
		is_married = yes
		is_pregnant = no
		is_main_spouse = yes
		religion_group = muslim
		spouse = { demesne_size = 5 }
		spouse = { religion_group = muslim }
		NOT = { has_character_flag = envious_mother }
		any_child = {
			is_primary_heir = no
			is_alive = yes
			age = 14
		}
		NOT = { any_child = { is_primary_heir = yes } }
		NOT = { any_child = { has_character_flag = first_wife_son } }
	}
	
	mean_time_to_happen = {
		months = 320
		modifier = {
			factor = 0.25
			trait = envious
		}
		modifier = {
			factor = 0.5
			trait = ambitious
		}
		modifier = {
			factor = 2.0
			trait = slothful
		}
		modifier = {
			factor = 4.0
			trait = content
		}
	}
		
	
	option = { # Speak to husband
		name = "EVTOPTA89015"
		ai_chance = { factor = 100 }
		set_character_flag = envious_mother
		any_child = {
			limit = { 
				age = 14
				is_primary_heir = no
			}
			set_character_flag = first_wife_son
			character_event = { id = 89016 days = 2 tooltip = "EVTTOOLTIP89016" }
		}
	}
	option = { # Do nothing
		ai_chance = { factor = 0 }
		name = "EVTOPTB89015"
	}
}

# Son informed
character_event = {
	id = 89016
	desc = "EVTDESC89016"
	picture = GFX_evt_quarrel
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA89016"
		father = { character_event = { id = 89017 days = 2 tooltip = "EVTTOOLTIP89017" } }
	}
}

# Husband informed
character_event = {
	id = 89017
	desc = "EVTDESC89017"
	picture = GFX_evt_quarrel
	
	is_triggered_only = yes
	
	option = { # Grant county
		name = "EVTOPTA89017"
		random_demesne_title = {
			limit = {
				NOT = {	tier = duke }
				NOT = {	tier = king }
				NOT = {	tier = emperor }
				NOT = {	location = { is_capital = yes }	}
			}
			ROOT = {
				any_child = {
					limit = { has_character_flag = first_wife_son }
					grant_title = PREVPREV
				}
			}
		}
	}
	option = { # Say no
		name = "EVTOPTB89017"
		FROM = {
			mother = {
				opinion = {
					who = ROOT
					modifier = opinion_very_disappointed
					years = 2
				}
			}
		}
		hidden_tooltip = {
			any_child = {
				limit = { has_character_flag = first_wife_son }
				character_event = { id = 89018 days = 2 }
			}
		}
	}
}

# Son informed he is not getting county
character_event = {
	id = 89018
	desc = "EVTDESC89018"
	picture = GFX_evt_quarrel
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA89018"
		FROM = {
			opinion = {
				who = ROOT
				modifier = opinion_disappointed
				years = 2
			}
		}
	}
}
		

### Secondary Wife plots to kill heir
character_event = {
	id = 89020
	desc = "EVTDESC89020"
	picture = GFX_evt_quarrel
	
	capable_only = yes
	prisoner = no
	
	trigger = {
		is_female = yes
		num_of_children = 1
		age = 16
		is_married = yes
		is_pregnant = no
		NOT = { trait = in_hiding }
		religion_group = muslim
		any_child = {
			is_alive = yes
			is_primary_heir = no
			is_pretender = yes
		}
		spouse = {
			any_child = { 
				is_primary_heir = yes
				ai = yes
				is_alive = yes
				NOT = { age = 16 }
				mother = { NOT = { character = ROOT } }
				at_location = ROOT
			}
		}
		NOT = {
			any_child = { is_primary_heir = yes	}
			has_character_flag = murdering_wife
		}
	}
	
	mean_time_to_happen = {
		months = 420
		modifier = {
			factor = 0.25
			trait = envious
		}
		modifier = {
			factor = 0.5
			trait = ambitious
		}
		modifier = {
			factor = 2.0
			trait = slothful
		}
		modifier = {
			factor = 4.0
			trait = content
		}
	}
	
	option = { # Murder heir
		name = "EVTOPTA89020"
		ai_chance = { factor = 100 }
		set_character_flag = murdering_wife
		random_list = {
			35 = {
				spouse = {
					any_child = {
						limit = { is_primary_heir = yes }
						character_event = { id = 89023 days = 4 tooltip = "EVTTOOLTIP89023" }
					}
					hidden_tooltip = {
						random_list = {
							50 = {
								character_event = { id = 89024 tooltip = "EVTTOOLTIP89024" }
								any_child = {
									limit = { is_primary_heir = yes }
									death = { death_reason = death_murder_unknown }
								}
							}
							50 = {
								character_event = { id = 89025 tooltip = "EVTTOOLTIP89025" }
								any_child = {
									limit = { is_primary_heir = yes }
									death = { death_reason = death_murder killer = ROOT }
								}
							}
						}
					}
				}
			}
			65 = {
				spouse = {
					any_child = {
						limit = { is_primary_heir = yes }
						character_event = { id = 89021 days = 4 tooltip = "EVTTOOLTIP89021" }
					}
					hidden_tooltip = {
						character_event = { id = 89022 tooltip = "EVTTOOLTIP89022" }
					}
				}
			}
		}
	}
	option = { # Do nothing
		ai_chance = { factor = 0 }
		name = "EVTOPTB89020"
	}
}

# Heir is informed of failed attempt
character_event = {
	id = 89021
	desc = "EVTDESC89021"
	picture = GFX_evt_quarrel
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA89021"
	}
}

# Husband is informed of failed attempt
character_event = {
	id = 89022
	desc = "EVTDESC89022"
	picture = GFX_evt_quarrel
	
	is_triggered_only = yes
	
	option = { # Kill wife
		name = "EVTOPTA89022"
		FROM = { death = { death_reason = death_execution killer = ROOT } }
	}
	option = { # Imprison wife
		name = "EVTOPTB89022"
		FROM = { imprison = yes }
		hidden_tooltip = {
			any_child = {
				limit = { is_primary_heir = yes }
				opinion = {
					who = FROM
					modifier = attempted_murder
					years = 30
				}
				mother = {
					opinion = {
						who = FROM
						modifier = attempted_murder
						years = 30
					}
				}
			}
		}
	}
	option = { # Do nothing
		name = "EVTOPTC89022"
		any_child = {
			limit = { is_primary_heir = yes }
			opinion = {
				who = ROOT
				modifier = opinion_very_disappointed
				years = 2
			}
			mother = {
				opinion = {
					who = ROOT
					modifier = opinion_very_disappointed
					years = 2
				}
			}
		}
		hidden_tooltip = {
			any_child = {
				limit = { is_primary_heir = yes }
				opinion = {
					who = FROM
					modifier = attempted_murder
					years = 30
				}
				mother = {
					opinion = {
						who = FROM
						modifier = attempted_murder
						years = 30
					}
				}
			}
		}
	}
}

# Heir is killed
character_event = {
	id = 89023
	desc = "EVTDESC89023"
	picture = GFX_evt_quarrel
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA89023"
	}
}

# Husband informed heir is killed, killer is unknown
character_event = {
	id = 89024
	desc = "EVTDESC89024"
	picture = GFX_evt_quarrel
	
	hide_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA89024"
	}
}

# Husband informed heir is killed, killer is known
character_event = {
	id = 89025
	desc = "EVTDESC89025"
	picture = GFX_evt_quarrel
	
	is_triggered_only = yes
	
	option = { # Kill wife
		name = "EVTOPTA89025"
		FROM = { death = { death_reason = death_execution killer = ROOT } }
	}
	option = { # Imprison wife
		name = "EVTOPTB89025"
		FROM = { imprison = yes }
		hidden_tooltip = {
			any_spouse = {
				limit = {
					NOT = { character = FROM }
				}
				opinion = {
					who = FROM
					modifier = evil_murderer
					years = 40
				}
			}
		}
	}
	option = { # Do nothing
		name = "EVTOPTC89025"
		any_spouse = {
			limit = {
				NOT = { character = FROM }
			}
			opinion = {
				who = ROOT
				modifier = opinion_very_disappointed
				years = 8
			}
			opinion = {
				who = FROM
				modifier = evil_murderer
				years = 40
			}
		}
	}
}

### Evil wife plots to kill sons that aren't hers
character_event = {
	id = 89030
	desc = "EVTDESC89030"
	picture = GFX_evt_quarrel
	
	capable_only = yes
	prisoner = no
	
	trigger = {
		is_female = yes
		num_of_children = 1
		age = 16
		is_married = yes
		is_pregnant = no
		NOT = { trait = in_hiding }
		religion_group = muslim
		any_child = {
			is_alive = yes
		}
		spouse = {
			any_child = {
				ai = yes
				is_alive = yes
				NOT = { age = 16 }
				mother = { NOT = { character = ROOT } }
				is_primary_heir = no
				at_location = ROOT
			}
		}
		NOT = { trait = kind }
	}
	
	mean_time_to_happen = {
		months = 820
		modifier = {
			factor = 0.25
			trait = envious
		}
		modifier = {
			factor = 0.25
			trait = cruel
		}
		modifier = {
			factor = 0.5
			trait = ambitious
		}
		modifier = {
			factor = 0.75
			trait = greedy
		}
		modifier = {
			factor = 5.0
			trait = honest
		}
		modifier = {
			factor = 5.0
			trait = just
		}
		modifier = {
			factor = 5.0
			trait = content
		}
	}
	
	option = { # Murder son
		name = "EVTOPTA89020"
		ai_chance = { factor = 100 }
		random_list = {
			50 = {
				spouse = {
					random_child = {
						limit = {
							NOT = { age = 16 }
							mother = { NOT = { character = ROOT } }
							is_primary_heir = no
							is_alive = yes
						}
						set_character_flag = victim_son
						character_event = { id = 89033 days = 4 tooltip = "EVTTOOLTIP89023" }
					}
					hidden_tooltip = {
						random_list = {
							50 = {
								character_event = { id = 89034 tooltip = "EVTTOOLTIP89024" }
								any_child = {
									limit = { has_character_flag = victim_son }
									death = { death_reason = death_murder_unknown }
								}
							}
							50 = {
								character_event = { id = 89035 tooltip = "EVTTOOLTIP89025" }
								any_child = {
									limit = { has_character_flag = victim_son }
									death = { death_reason = death_murder killer = ROOT }
								}
							}
						}
					}
				}
			}
			50 = {
				spouse = {
					random_child = {
						limit = {
							NOT = { age = 16 }
							mother = { NOT = { character = ROOT } }
							is_primary_heir = no
							is_alive = yes
						}
						character_event = { id = 89031 days = 4 tooltip = "EVTTOOLTIP89021" }
					}
					hidden_tooltip = {
						character_event = { id = 89032 tooltip = "EVTTOOLTIP89022" }
					}
				}
			}
		}
	}
	option = { # Do nothing
		ai_chance = { factor = 0 }
		name = "EVTOPTB89020"
	}
}

# Son is informed of failed attempt
character_event = {
	id = 89031
	desc = "EVTDESC89021"
	picture = GFX_evt_quarrel
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA89021"
		clr_character_flag = victim_son
	}
}

# Husband is informed of failed attempt
character_event = {
	id = 89032
	desc = "EVTDESC89032"
	picture = GFX_evt_quarrel
	
	is_triggered_only = yes
	
	option = { # Kill wife
		name = "EVTOPTA89022"
		FROM = { death = { death_reason = death_execution killer = ROOT } }
	}
	option = { # Imprison wife
		name = "EVTOPTB89022"
		FROM = { imprison = yes }
		hidden_tooltip = {
			any_child = {
				limit = { has_character_flag = victim_son }
				opinion = {
					who = FROM
					modifier = attempted_murder
					years = 30
				}
				mother = {
					opinion = {
						who = FROM
						modifier = attempted_murder
						years = 30
					}
				}
			}
		}
	}
	option = { # Do nothing
		name = "EVTOPTC89022"
		any_child = {
			limit = { has_character_flag = victim_son }
			opinion = {
				who = ROOT
				modifier = opinion_very_disappointed
				years = 2
			}
			mother = {
				opinion = {
					who = ROOT
					modifier = opinion_very_disappointed
					years = 2
				}
			}
		}
		hidden_tooltip = {
			any_child = {
				limit = { has_character_flag = victim_son }
				opinion = {
					who = FROM
					modifier = attempted_murder
					years = 30
				}
				mother = {
					opinion = {
						who = FROM
						modifier = attempted_murder
						years = 30
					}
				}
			}
		}
	}
}

# Son is killed
character_event = {
	id = 89033
	desc = "EVTDESC89023"
	picture = GFX_evt_quarrel
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA89023"
		clr_character_flag = victim_son
	}
}

# Husband informed son is killed, killer is unknown
character_event = {
	id = 89034
	desc = "EVTDESC89034"
	picture = GFX_evt_quarrel
	
	hide_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA89024"
	}
}

# Husband informed son is killed, killer is known
character_event = {
	id = 89035
	desc = "EVTDESC89035"
	picture = GFX_evt_quarrel
	
	is_triggered_only = yes
	
	option = { # Kill wife
		name = "EVTOPTA89025"
		FROM = { death = { death_reason = death_execution killer = ROOT } }
	}
	option = { # Imprison wife
		name = "EVTOPTB89025"
		FROM = { imprison = yes }
		hidden_tooltip = {
			any_spouse = {
				limit = {
					NOT = { character = FROM }
				}
				opinion = {
					who = FROM
					modifier = evil_murderer
					years = 40
				}
			}
		}
	}
	option = { # Do nothing
		name = "EVTOPTC89025"
		any_spouse = {
			limit = {
				NOT = { character = FROM }
			}
			opinion = {
				who = ROOT
				modifier = opinion_very_disappointed
				years = 8
			}
			opinion = {
				who = FROM
				modifier = evil_murderer
				years = 40
			}
		}
	}
}