﻿namespace = holy_stuff_etna_eruption_event

##################################################
# Etna Eruption Events
##################################################

holy_stuff_etna_eruption_event.0001 = { #Etna Eruption
	type = character_event
      cooldown = { years = 150 }
	title = holy_stuff_etna_eruption_event.0001.t
	desc = {
		first_valid = {
			triggered_desc = { #Has the Veil of St. Agatha
				trigger = { has_veil_of_st_agatha_trigger = yes }
				desc = holy_stuff_etna_eruption_event.0001.veil.desc
			}
			triggered_desc = { #Has not the Veil of St. Agatha
				trigger = {
					NOT = {
						has_veil_of_st_agatha_trigger = yes
					}
				}
				desc = holy_stuff_etna_eruption_event.0001.no.veil.desc
			}
		}
	}
	theme = realm
	override_background = {
		reference = wilderness_mountains
	}
	left_portrait = {
		character = root
		animation = worry
	}

	trigger = {
		etna_eruption_event_trigger = yes 
	}	

	immediate = {
		play_music_cue = "mx_cue_negative"

		title:c_messina = {
			save_scope_as = etna_county_location
		}
		title:b_catania = {
			save_scope_as = etna_barony_location
		}
	}

	option = {
		name = holy_stuff_etna_eruption_event.0001.a

		hidden_effect = {
			random_list = {
				51 = {
					trigger_event = {
						id = holy_stuff_etna_eruption_event.0002 #Eruption stops naturally
                                    days = { 5 8 }
					}
				}
				49 = {
					trigger_event = {
						id = holy_stuff_etna_eruption_event.0003 #Eruption continues 
                                    days = { 5 8 }
					}
				}
			}
		} 
	}

	option = {
		name = holy_stuff_etna_eruption_event.0001.b

		hidden_effect = {
			random_list = {
				50 = {
					trigger_event = {
						id = holy_stuff_etna_eruption_event.0002 #Eruption stops naturally
                                    days = { 5 8 }
					}
				}
				50 = {
					trigger_event = {
						id = holy_stuff_etna_eruption_event.0003 #Eruption continues 
                                    days = { 5 8 }
					}
				}
			}
		} 
	}

	option = {
		name = holy_stuff_etna_eruption_event.0001.c

		trigger = {
			has_veil_of_st_agatha_trigger = yes
		}

		hidden_effect = {
			random_list = {
				30 = {
					trigger_event = {
						id = holy_stuff_etna_eruption_event.0003 #Eruption continues
                                    days = { 5 8 }
					}
				}
				70 = {
					trigger_event = {
						id = holy_stuff_etna_eruption_event.0004 #Eruption stops miraculously
                                    days = { 5 8 }
					}
				}
			}
		} 
	}
}

holy_stuff_etna_eruption_event.0002 = { #Eruption stops naturally
	type = character_event
	title = holy_stuff_etna_eruption_event.0002.t
	desc = holy_stuff_etna_eruption_event.0002.desc
	theme = realm
	override_background = {
		reference = wilderness_mountains
	}
	left_portrait = {
		character = root
		animation = happiness
	}

	immediate = {
		play_music_cue = "mx_cue_positive_effect"

		title:c_messina = {
			save_scope_as = etna_county_location
		}
		title:b_catania = {
			save_scope_as = etna_barony_location
		}
	}

	option = {
		name = holy_stuff_etna_eruption_event.0002.a
	}

	option = {
		name = holy_stuff_etna_eruption_event.0002.b
	}
}

holy_stuff_etna_eruption_event.0003 = { #Eruption continues
	type = character_event
	title = holy_stuff_etna_eruption_event.0003.t
	desc = holy_stuff_etna_eruption_event.0003.desc
	theme = realm
	override_background = {
		reference = wilderness_mountains
	}
	left_portrait = {
		character = root
		animation = grief
	}

	immediate = {
		play_music_cue = "mx_cue_stress"

		title:c_messina = {
			save_scope_as = etna_county_location
		}
		title:b_catania = {
			save_scope_as = etna_barony_location
		}
 
            holy_stuff_etna_eruption_continues_scripted_effect = yes
	}

	option = {
		name = holy_stuff_etna_eruption_event.0003.a
	}

	option = {
		name = holy_stuff_etna_eruption_event.0003.b

		trigger = {
			has_trait = zealous
		}

            add_piety = miniscule_piety_loss
	}
}

holy_stuff_etna_eruption_event.0004 = { #Eruption stops miraculously
	type = character_event
	title = holy_stuff_etna_eruption_event.0004.t
	desc = holy_stuff_etna_eruption_event.0004.desc
	theme = realm
	override_background = {
		reference = wilderness_mountains
	}
	left_portrait = {
		character = root
		animation = personality_zealous
	}

	immediate = {
		play_music_cue = "mx_cue_epic_sacral_moment"

		title:c_messina = {
			save_scope_as = etna_county_location
		}
		title:b_catania = {
			save_scope_as = etna_barony_location
		}
		cp:councillor_court_chaplain = {
			save_scope_as = realm_priest
		}
		cp:councillor_steward = {
			save_scope_as = realm_steward
		}

            holy_stuff_etna_eruption_stops_miraculously_scripted_effect = yes

            add_piety = miniscule_piety_gain
	}

	option = {
		name = holy_stuff_etna_eruption_event.0004.a
	}

	option = {
		name = holy_stuff_etna_eruption_event.0004.b

		trigger = {
			has_trait = cynical
		}
	}
}
