#########################################
#
# Medieval Legends Events
#
# Id 10000-19999 is reserved
#
#########################################
#
# Written by Sara Wendel-rtqvist

### GATES OF HELL ###

#Gates of Hell - A strange gap has opened
narrative_event = {
	id = 10100
	title = "EVTNAME10100"
	desc = "EVTDESC10100"
	picture = GFX_evt_pagan
	
	only_playable = yes
	min_age = 20
	capable_only = yes
	prisoner = no
	war = no
	
	trigger = {
		in_command = no

		primary_title = { temporary = no }

		NOT = { is_inaccessible_trigger = yes }

		NOT = {
			has_character_modifier = flaming_gap
		}
		NOT = {
			has_character_modifier = gates_hell
		}
		NOT = {
			has_character_modifier = wailing_gap
		}
		NOR = {
			has_character_modifier = exorcism_gateshell
			has_character_modifier = cattle_gateshell
			has_character_modifier = sacrifice_gateshell
		}
	}
	
	mean_time_to_happen = {
		months = 10000
		
		modifier = {
			factor = 0.5
			trait = wroth
		}
		
		modifier = {
			factor = 1.5
			trait = chaste
		}
	}
	
	option = {
		name = "EVTOPTA10100" #Ignore it
		add_character_modifier = {
			name = flaming_gap
			duration = 730
		}
		if = {
			limit = {
				NOT = {
					trait = slothful
				}
			}
			random = {
				chance = 25
				
				add_trait = slothful
				hidden_tooltip = {
					character_event = {
						id = 38251 #Notify Slothful
					}
				}
			}
			break = yes
		}
		if = {
			limit = {
				trait = slothful
				NOT = {
					trait = content
				}
			}
			random = {
				chance = 25
				
				add_trait = content
				hidden_tooltip = {
					character_event = {
						id = 38279 #Notify Content
					}
				}
			}
		}
	}
	
	option = {
		name = "EVTOPTB10100"
		add_character_modifier = {
			name = flaming_gap
			duration = 730
		}
		narrative_event = {
			id = 10101
			days = 5
			random = 10
			tooltip = "EVTTOOLTIP10101"
		}
	}
}

#Flames and fiery stones!
narrative_event = {
	id = 10101
	title = "EVTNAME10101"
	desc = "EVTDESC10101"
	picture = GFX_evt_pagan
	
	only_playable = yes
	min_age = 20
	capable_only = yes
	prisoner = no
	war = no
	
	trigger = {
		has_character_modifier = flaming_gap
		in_command = no
	}
	
	mean_time_to_happen = {
		months = 12
		
		modifier = {
			factor = 0.5
			trait = lustful
		}
		
		modifier = {
			factor = 1.5
			trait = kind
		}
	}
	
	option = {
		name = "EVTOPTA10101" #Keep ignoring it
		remove_character_modifier = flaming_gap
		add_character_modifier = {
			name = wailing_gap
			duration = 730
		}
		location = {
			add_province_modifier = {
				name = peasants_upset
				duration = 730
			}
		}
	}
	
	option = {
		name = "EVTOPTB10101"
		remove_character_modifier = flaming_gap
		add_character_modifier = {
			name = wailing_gap
			duration = 730
		}
		narrative_event = {
			id = 10102
			days = 5
			random = 10
			tooltip = "EVTTOOLTIP10102"
		}
	}
}

#Wailings, screams and cries for help seems to emit from the burning gap
narrative_event = {
	id = 10102
	title = "EVTNAME10102"
	desc = "EVTDESC10102"
	picture = GFX_evt_pagan

	only_playable = yes
	min_age = 20
	capable_only = yes
	prisoner = no
	war = no
	
	trigger = {
		has_character_modifier = wailing_gap
		in_command = no
	}
	
	mean_time_to_happen = {
		months = 12
		
		modifier = {
			factor = 0.5
			trait = lustful
		}
		
		modifier = {
			factor = 1.5
			trait = kind
		}
	}
	
	option = {
		name = "EVTOPTA10102" #Keep ignoring it
		remove_character_modifier = wailing_gap
		add_character_modifier = {
			name = gates_hell
			duration = 1530
		}
	}
	
	option = {
		name = "EVTOPTB10102"
		custom_tooltip = {
			text = EVTTOOLTIP10103
		}
		remove_character_modifier = wailing_gap
		add_character_modifier = {
			name = gates_hell
			duration = 730
		}
		narrative_event = {
			id = 10103
			days = 5
			random = 10
		}
	}
}

#Close the gap
narrative_event = {
	id = 10103
	title = "EVTNAME10103"
	desc = "EVTDESC10103"
	picture = GFX_evt_pagan

	only_playable = yes
	min_age = 20
	capable_only = yes
	prisoner = no
	war = no

	trigger = {
		has_character_modifier = gates_hell
		in_command = no
		NOT = {
			has_character_flag = choose_solution_gh
		}
	}
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA10103" #By using exorcism
		set_character_flag = choose_solution_gh
		narrative_event = {
			id = 10104
			days = 5
			random = 10
			tooltip = "EVTTOOLTIP10104"
		}
	}
	
	option = {
		name = "EVTOPTB10103" #By feeding it cattle
		trigger = {
			treasury = 50
			NOT = {
				trait = greedy
			}
		}
		set_character_flag = choose_solution_gh
		narrative_event = {
			id = 10105
			days = 5
			random = 10
			tooltip = "EVTTOOLTIP10105"
		}
	}
	
	option = {
		name = "EVTOPTC10103" #By rolling down stones into it
		set_character_flag = choose_solution_gh
		narrative_event = {
			id = 10106
			days = 5
			random = 10
			tooltip = "EVTTOOLTIP10106"
		}
	}
	
	option = { #By sacrificing what the city held to be most dear
		name = "EVTOPTD10103"
		trigger = {
			any_child = {
				is_abroad = no
				prisoner = no
				is_alive = yes
				age = 10
				NOT = {
					age = 20
				}
				is_female = no
				NOT = {
					any_sibling = {
						is_older_than = PREV
						OR = {
							father = { character = ROOT }
							mother = { character = ROOT }
						}
					}
				}
			}
		}
		pacifists_lose_piety_effect = yes
		random_child = {
			limit = {
				is_abroad = no
				prisoner = no
				is_alive = yes
				age = 10
				NOT = {
					age = 20
				}
				is_female = no
				NOT = {
					any_sibling = {
						is_older_than = PREV
						OR = {
							father = { character = ROOT }
							mother = { character = ROOT }
						}
					}
				}
			}
			save_event_target_as = human_sacrifice
		}
		set_character_flag = choose_solution_gh
		narrative_event = {
			id = 10107
			days = 5
			random = 10
			tooltip = "EVTTOOLTIP10107"
		}
	}
}

#By using exorcism
narrative_event = {
	id = 10104
	title = "EVTNAME10104"
	desc = "EVTDESC10104"
	picture = GFX_evt_pagan
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA10104"
		random_list = {
			90 = {
				set_character_flag = gate_exorcism
				narrative_event = {
					id = 10108
					days = 5
					random = 10
					tooltip = "EVTTOOLTIP10108" #It worked!
				}
			}
			10 = {
				narrative_event = {
					id = 10109
					days = 5
					random = 10
					tooltip = "EVTTOOLTIP10109" #It didn't work!
				}
			}
		}
	}
	option = {
		name = "EVTOPTB10104"
		narrative_event = {
			id = 10103
			days = 5
			random = 10
			tooltip = "EVTTOOLTIP10103"
		}
	}
}

#By feeding it cattle
narrative_event = {
	id = 10105
	title = "EVTNAME10105"
	desc = "EVTDESC10105"
	picture = GFX_evt_pagan
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA10105"
		treasury = -50
		random_list = {
			90 = {
				set_character_flag = gate_cattle
				narrative_event = {
					id = 10108
					days = 5
					random = 10
					tooltip = "EVTTOOLTIP10108" #It worked!
				}
			}
			10 = {
				narrative_event = {
					id = 10109
					days = 30
					tooltip = "EVTTOOLTIP10109" #It didn't work!
				}
			}
		}
	}
	option = {
		name = "EVTOPTB10105"
		narrative_event = {
			id = 10103
			days = 5
			random = 10
			tooltip = "EVTTOOLTIP10103"
		}
	}
}

#By rolling down stones into it
narrative_event = {
	id = 10106
	title = "EVTNAME10106"
	desc = "EVTDESC10106"
	picture = GFX_evt_pagan
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA10106"
		random_list = {
			90 = {
				set_character_flag = gate_stones
				narrative_event = {
					id = 10108
					days = 5
					random = 10
					tooltip = "EVTTOOLTIP10108" #It worked!
				}
			}
			10 = {
				narrative_event = {
					id = 10109
					days = 5
					random = 10
					tooltip = "EVTTOOLTIP10109" #It didn't work!
				}
			}
		}
	}
	option = {
		name = "EVTOPTB10106"
		narrative_event = {
			id = 10103
			days = 5
			random = 10
			tooltip = "EVTTOOLTIP10103"
		}
	}
}

	
#By sacrificing what the city held to be most dear - child dies
narrative_event = {
	id = 10107
	title = "EVTNAME10107"
	desc = "EVTDESC10107"
	picture = GFX_evt_pagan
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA10107"
		
		event_target:human_sacrifice = {
			death = {
				death_reason = death_murder_fall
				killer = ROOT
			}
		}
		random_list = {
			90 = {
				set_character_flag = gate_human_sacrifice
				narrative_event = {
					id = 10108
					days = 5
					random = 10
					tooltip = "EVTTOOLTIP10108" #It worked!
				}
			}
			10 = {
				narrative_event = {
					id = 10109
					days = 5
					random = 10
					tooltip = "EVTTOOLTIP10109" #It didn't work!
				}
			}
		}
	}
	option = {
		name = "EVTOPTB10107" #I changed my mind!
		narrative_event = {
			id = 10103
			days = 5
			random = 10
			tooltip = "EVTTOOLTIP10103"
		}
	}
}

#It worked!
narrative_event = {
	id = 10108
	title = "EVTNAME10108"
	desc = "EVTDESC10108"
	picture = GFX_evt_pagan
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA10108"
		trigger = {
			has_character_flag = gate_exorcism
		}
		remove_character_modifier = gates_hell
		clr_character_flag = choose_solution_gh
		add_character_modifier = {
			name = exorcism_gateshell
			duration = 1825
		}
	}
	option = {
		name = "EVTOPTB10108"
		trigger = {
			has_character_flag = gate_cattle
		}
		remove_character_modifier = gates_hell
		clr_character_flag = choose_solution_gh
		add_character_modifier = {
			name = cattle_gateshell
			duration = 1825
		}
	}
	option = {
		name = "EVTOPTC10108"
		trigger = {
			has_character_flag = gate_stones
		}
		remove_character_modifier = gates_hell
		clr_character_flag = choose_solution_gh
		add_character_modifier = {
			name = stones_gateshell
			duration = 1825
		}
	}
	option = {
		name = "EVTOPTD10108"
		trigger = {
			has_character_flag = gate_human_sacrifice
		}
		remove_character_modifier = gates_hell
		clr_character_flag = choose_solution_gh
		add_character_modifier = {
			name = sacrifice_gateshell
			duration = 1825
		}
	}
}

#It did not work!
narrative_event = {
	id = 10109
	title = "EVTNAME10109"
	desc = "EVTDESC10109"
	picture = GFX_evt_pagan
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA10109" #Crap! Try something else
		prestige = -15
		clr_character_flag = choose_solution_gh
		narrative_event = {
			id = 10103
			days = 5
			random = 10
			tooltip = "EVTTOOLTIP10103"
		}
	}
}