namespace = byzsla_slavic_event_sektyroda

############################
######## Proste
############################
#### byzsla_slavic_event_sektyroda.1 - Losowanie efektów
#### byzsla_slavic_event_sektyroda.2 - Wybór sekty 
############################
######## światło dnia
############################
#### byzsla_slavic_event_sektyroda.3 - Wzrost dyplomacji
#### byzsla_slavic_event_sektyroda.4 - Przyjaciel współsekciarz
#### byzsla_slavic_event_sektyroda.5 - Przyjaciel innowierca
#### byzsla_slavic_event_sektyroda.6 - Znalezienie starca
#### byzsla_slavic_event_sektyroda.7 - Porpawa relacji masowa
#### byzsla_slavic_event_sektyroda.8 - Wsparcie ruchu abstynenckiego
#### byzsla_slavic_event_sektyroda.9 - Efekty propagacji abstynencji
############################
######## światło nocy
############################
#### byzsla_slavic_event_sektyroda.10 - Wzrost nauki
#### byzsla_slavic_event_sektyroda.11 - Wzrost intry
#### byzsla_slavic_event_sektyroda.12 - Przyjaciel współsekciarz
#### byzsla_slavic_event_sektyroda.13 - Wykrycie spisku
#### byzsla_slavic_event_sektyroda.14 - Samouleczenie psychiki
#### byzsla_slavic_event_sektyroda.15 - Budowa komnaty tajemnic
#### byzsla_slavic_event_sektyroda.16 - Koniec budowy
############################

character_event = {
	id = byzsla_slavic_event_sektyroda.1

	is_triggered_only = yes
	hide_window = yes

	immediate = {
		if = {
			limit = { religion = chram_roda }
			character_event = { id = byzsla_slavic_event_sektyroda.1 days = 1000 random = 400 }
		}
		random_list = {
			#Staty
			20 = {
				if = {
					limit = { trait = swiatlo_dnia }
					character_event = { id = byzsla_slavic_event_sektyroda.3 }
				}
				if = {
					limit = { trait = swiatlo_nocy }
					random_list = {
						50 = { character_event = { id = byzsla_slavic_event_sektyroda.10 } }
						50 = { character_event = { id = byzsla_slavic_event_sektyroda.11 } }
					}
				}
			}
			#Przyjaciele
			17 = {
				if = {
					limit = { trait = swiatlo_nocy }
					character_event = { id = byzsla_slavic_event_sektyroda.12 }
				}
				if = {
					limit = { trait = swiatlo_dnia }
					random_list = {
						50 = { character_event = { id = byzsla_slavic_event_sektyroda.4 } }
						50 = { character_event = { id = byzsla_slavic_event_sektyroda.5 } }
					}
				}
			}
			#Inne 1
			23 = {
				if = {
					limit = { trait = swiatlo_nocy }
					character_event = { id = byzsla_slavic_event_sektyroda.13 }
				}
				if = {
					limit = { trait = swiatlo_dnia }
					character_event = { id = byzsla_slavic_event_sektyroda.6 }
				}
			}
			#Inne 2
			17 = {
				if = {
					limit = { trait = swiatlo_nocy }
					character_event = { id = byzsla_slavic_event_sektyroda.14 }
				}
				if = {
					limit = { trait = swiatlo_dnia }
					character_event = { id = byzsla_slavic_event_sektyroda.7 }
				}
			}
			#Koncowe
			50 = {
				if = {
					limit = { trait = swiatlo_nocy }
					character_event = { id = byzsla_slavic_event_sektyroda.15 }
				}
				if = {
					limit = { trait = swiatlo_dnia }
					character_event = { id = byzsla_slavic_event_sektyroda.8 }
				}
			}
			#Nic
			80 = {
				#NOTHING
			}
		}
	}
}

#### byzsla_slavic_event_sektyroda.2 - Wybór sekty 

character_event = {
	id = byzsla_slavic_event_sektyroda.2
	desc = desc_byzsla_slavic_event_sektyroda.2
	picture = GFX_evt_midwinter_blot_oldgods
	
	is_triggered_only = yes
	hide_from = yes
		
	trigger = {
		ROOT = {
			religion = chram_roda
			NOT = { trait = swiatlo_dnia }
			NOT = { trait = swiatlo_nocy }
		}
	}
	option = {
		name = optA_byzsla_slavic_event_sektyroda.2
		add_trait = swiatlo_dnia
	}
	option = {
		name = optB_byzsla_slavic_event_sektyroda.2
		add_trait = swiatlo_nocy
	}
}

############################
######## światło dnia
############################
#### byzsla_slavic_event_sektyroda.3 - Wzrost dyplomacji

character_event = {
	id = byzsla_slavic_event_sektyroda.3
	desc = desc_byzsla_slavic_event_sektyroda.3
	
	border = GFX_event_normal_frame_diplomacy
	picture = GFX_evt_family
	
	is_triggered_only = yes
	hide_from = yes
		
	trigger = {
		religion = chram_roda
		trait = swiatlo_dnia 
	}
	option = {
		name = optA_byzsla_slavic_event_sektyroda.3
		change_diplomacy = 1
	}
}

#### byzsla_slavic_event_sektyroda.4 - Przyjaciel współsekciarz

character_event = {
	id = byzsla_slavic_event_sektyroda.4
	desc = desc_byzsla_slavic_event_sektyroda.4
	
	border = GFX_event_normal_frame_diplomacy
	picture = GFX_evt_family
	
	is_triggered_only = yes
	hide_from = yes
		
	trigger = {
		religion = chram_roda
		trait = swiatlo_dnia
		any_courtier = {
			trait = swiatlo_dnia
			NOT = { is_friend = ROOT }
		}
	}
	option = {
		name = optA_byzsla_slavic_event_sektyroda.4
		random_courtier = {
			limit = {
				trait = swiatlo_dnia
				NOT = { is_friend = ROOT }
			}
			add_friend = ROOT
		}
	}
	option = {
		name = optB_byzsla_slavic_event_sektyroda.4
		piety = 25
	}
}

#### byzsla_slavic_event_sektyroda.5 - Przyjaciel innowierca

character_event = {
	id = byzsla_slavic_event_sektyroda.5
	desc = desc_byzsla_slavic_event_sektyroda.5
	
	border = GFX_event_normal_frame_diplomacy
	picture = GFX_evt_family
	
	is_triggered_only = yes
	hide_from = yes
		
	trigger = {
		religion = chram_roda
		trait = swiatlo_dnia
		any_courtier = {
			NOT = { religion = chram_roda }
			NOT = { is_friend = ROOT }
		}
	}
	option = {
		name = optA_byzsla_slavic_event_sektyroda.4
		random_courtier = {
			limit = {
			NOT = { religion = chram_roda }
				NOT = { is_friend = ROOT }
			}
			add_friend = ROOT
		}
	}
	option = {
		name = optB_byzsla_slavic_event_sektyroda.4
		piety = 25
	}
}

#### byzsla_slavic_event_sektyroda.6 - Znalezienie starca

character_event = {
	id = byzsla_slavic_event_sektyroda.6
	desc = desc_byzsla_slavic_event_sektyroda.6
	
	border = GFX_event_normal_frame_diplomacy
	picture = GFX_evt_family
	
	is_triggered_only = yes
	hide_from = yes
		
	trigger = {
		religion = chram_roda
		trait = swiatlo_dnia
		any_courtier = {
			NOT = {
				has_character_flag = byzsla_starzec
			}
		}
	}
	immediate = {
		create_character = {
			random_traits = yes
			dynasty = none
			religion = chram_roda
			culture = ROOT
			female = no
			age = 53
			attributes = {
				learning = 10
			}
			trait = mastermind_theologian
			trait = celibate
			trait = zealous
			trait = swiatlo_dnia
		}
		new_character = {
			set_character_flag = byzsla_starzec
		}
	}
	option = {
		name = optA_byzsla_slavic_event_sektyroda.6
		random_courtier = {
			limit = { has_character_flag = byzsla_starzec }
			opinion = { modifier = trusting_pos who = ROOT years = 10 } 
		}
	}
	option = {
		name = optB_byzsla_slavic_event_sektyroda.6
		random_courtier = {
			limit = { has_character_flag = byzsla_starzec }
			death = { death_reason = death_missing } 
		}
	}
}

#### byzsla_slavic_event_sektyroda.7 - Porpawa relacji masowa

character_event = {
	id = byzsla_slavic_event_sektyroda.7
	desc = desc_byzsla_slavic_event_sektyroda.7
	
	border = GFX_event_normal_frame_diplomacy
	picture = GFX_evt_library
	
	is_triggered_only = yes
	hide_from = yes
		
	trigger = {
		religion = chram_roda
		trait = swiatlo_dnia
		NOT = {
			has_character_modifier = rodowcy_opinia
		}
	}
	option = {
		name = optA_byzsla_slavic_event_sektyroda.7
		add_character_modifier = {
			name = rodowcy_opinia
			days = 730
		}
		prestige = 20
	}
	option = {
		name = optB_byzsla_slavic_event_sektyroda.7
		add_character_modifier = {
			name = rodowcy_opinia
			days = 730
		}
		piety = 20
	}
}

#### byzsla_slavic_event_sektyroda.8 - Wsparcie ruchu abstynenckiego

character_event = {
	id = byzsla_slavic_event_sektyroda.8
	desc = desc_byzsla_slavic_event_sektyroda.8
	
	border = GFX_event_normal_frame_diplomacy
	picture = GFX_evt_drunk
	
	is_triggered_only = yes
	hide_from = yes
		
	trigger = {
		religion = chram_roda
		trait = swiatlo_dnia
		NOT = {
			has_character_flag = rodowcy_antyalkoholizm
		}
	}
	immediate = {
		set_character_flag = rodowcy_antyalkoholizm
	}
	option = {
		name = optA_byzsla_slavic_event_sektyroda.8
		scaled_wealth = { value = -0.25 min = -20 }
		custom_tooltip = { text = byzsla_slavic_event_sektyroda_TT_antyalkoholizm }
		hidden_tooltip = { capital_scope = { save_event_target_as = pagan_capital } } #I promise this is needed
		event_target:pagan_capital = {
			add_province_modifier = {
				name = rodowcy_abstynencja_1
				years = 1
			}
		}
		hidden_tooltip = { 
			character_event = { id = byzsla_slavic_event_sektyroda.9 days = 365 } 
		}
	}
	option = {
		name = optB_byzsla_slavic_event_sektyroda.8
		piety = 100
	}
}

#### byzsla_slavic_event_sektyroda.9 - Efekty propagacji abstynencji

character_event = {
	id = byzsla_slavic_event_sektyroda.9
	desc = desc_byzsla_slavic_event_sektyroda.9
	
	border = GFX_event_normal_frame_diplomacy
	picture = GFX_evt_drunk
	
	is_triggered_only = yes
	hide_from = yes
	
	option = {
		name = optA_byzsla_slavic_event_sektyroda.8
		piety = 250
		capital_scope = {
			remove_province_modifier = rodowcy_abstynencja_1
			add_province_modifier = {
				name = rodowcy_abstynencja_2
				duration = 720
			}
		}
		custom_tooltip = { text = byzsla_slavic_event_sektyroda_TT_antyalkoholizm2 }
		hidden_tooltip = {
			any_courtier = {
				random = {
					chance = 50
					remove_trait = drunkard
				}
			}
		}
	}
}

############################
######## światło nocy
############################
#### byzsla_slavic_event_sektyroda.10 - Wzrost nauki


character_event = {
	id = byzsla_slavic_event_sektyroda.10
	desc = desc_byzsla_slavic_event_sektyroda.10
	
	border = GFX_event_normal_frame_religion
	picture = GFX_evt_library
	
	is_triggered_only = yes
	hide_from = yes
		
	trigger = {
		religion = chram_roda
		trait = swiatlo_nocy
	}
	option = {
		name = optA_byzsla_slavic_event_sektyroda.10
		change_learning = 1
	}
}

#### byzsla_slavic_event_sektyroda.11 - Wzrost intry

character_event = {
	id = byzsla_slavic_event_sektyroda.11
	desc = desc_byzsla_slavic_event_sektyroda.11
	
	border = GFX_event_normal_frame_intrigue
	picture = GFX_evt_shadowy_cabal
	
	is_triggered_only = yes
	hide_from = yes
		
	trigger = {
		religion = chram_roda
		trait = swiatlo_nocy
	}
	option = {
		name = optA_byzsla_slavic_event_sektyroda.10
		change_intrigue = 1
	}
}

#### byzsla_slavic_event_sektyroda.12 - Przyjaciel współsekciarz

character_event = {
	id = byzsla_slavic_event_sektyroda.12
	desc = desc_byzsla_slavic_event_sektyroda.4
	
	border = GFX_event_normal_frame_diplomacy
	picture = GFX_evt_family
	
	is_triggered_only = yes
	hide_from = yes
		
	trigger = {
		religion = chram_roda
		trait = swiatlo_nocy
		any_courtier = {
			trait = swiatlo_nocy
			NOT = { is_friend = ROOT }
		}
	}
	option = {
		name = optA_byzsla_slavic_event_sektyroda.4
		random_courtier = {
			limit = {
				trait = swiatlo_nocy
				NOT = { is_friend = ROOT }
			}
			add_friend = ROOT
		}
	}
	option = {
		name = optB_byzsla_slavic_event_sektyroda.4
		piety = 25
	}
}

#### byzsla_slavic_event_sektyroda.13 - Wykrycie spisku

character_event = {
	id = byzsla_slavic_event_sektyroda.13
	desc = desc_byzsla_slavic_event_sektyroda.13
	border = GFX_event_normal_frame_intrigue
	picture = GFX_evt_shadowy_cabal
	
	trigger = {
		religion = chram_roda
		trait = swiatlo_nocy
		any_realm_character = {
			has_plot = yes
			NOT = { plot_is_known_by = ROOT }
		}
	}
	
	immediate = {
		random_realm_character = {
			limit = {
				has_plot = yes
				NOT = { plot_is_known_by = ROOT }
			}
			save_event_target_as = god_plotter
		}
		random_realm_character = {
			limit = {
				has_plot = yes
				NOT = { plot_is_known_by = ROOT }
				is_landed = yes
			}
			save_event_target_as = god_plotter
		}
		random_realm_character = {
			limit = {
				has_plot = yes
				NOT = { plot_is_known_by = ROOT }
				plot_target_char = { is_close_relative = ROOT }
			}
			save_event_target_as = god_plotter
		}
		random_realm_character = {
			limit = {
				has_plot = yes
				NOT = { plot_is_known_by = ROOT }
				plot_target_char = { character = ROOT }
			}
			save_event_target_as = god_plotter
		}
		
		event_target:god_plotter = { plot_target_char = { save_event_target_as = god_plot_target } }
	
	}

	is_triggered_only = yes
	
	option = {
		name = optA_byzsla_slavic_event_sektyroda.13
		event_target:god_plotter = { reveal_plot = yes}
	}
}

#### byzsla_slavic_event_sektyroda.14 - Samouleczenie psychiki

character_event = {
	id = byzsla_slavic_event_sektyroda.14
	desc = desc_byzsla_slavic_event_sektyroda.14
	
	picture = GFX_evt_recovery
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	hide_from = yes
		
	trigger = {
		religion = chram_roda
		trait = swiatlo_nocy
		NOT = {
			has_character_modifier = rodowcy_zdrowie
		}
	}
	option = {
		name = optA_byzsla_slavic_event_sektyroda.14
		if = {
			limit = {
				trait = stressed
			}
			remove_trait = stressed
			break = yes
		}
		if = {
			limit = {
				trait = depressed
			}
			remove_trait = depressed
			break = yes
		}
		if = {
			limit = {
				trait = possessed
			}
			remove_trait = possessed
			add_trait = depressed
			break = yes
		}
		if = {
			limit = {
				trait = lunatic
			}
			remove_trait = lunatic
			add_trait = stressed
			break = yes
		}
		add_character_modifier = {
			name = rodowcy_zdrowie
			duration = 720
		}
	}
}

#### byzsla_slavic_event_sektyroda.15 - Budowa komnaty tajemnic

character_event = {
	id = byzsla_slavic_event_sektyroda.15
	desc = desc_byzsla_slavic_event_sektyroda.15
	
	border = GFX_event_normal_frame_economy
	picture = GFX_evt_castle_construction
	
	is_triggered_only = yes
	hide_from = yes
		
	trigger = {
		religion = chram_roda
		trait = swiatlo_nocy
		NOT = {
			has_character_flag = rodowcy_komnata
		}
	}
	immediate = {
		set_character_flag = rodowcy_komnata
	}
	option = {
		name = optA_byzsla_slavic_event_sektyroda.15
		scaled_wealth = { value = -0.25 min = -20 }
		custom_tooltip = { text = byzsla_slavic_event_sektyroda_TT_komnata }
		hidden_tooltip = { capital_scope = { save_event_target_as = pagan_capital } } #I promise this is needed
		event_target:pagan_capital = {
			add_province_modifier = {
				name = rodowcy_komnata_1
				years = 1
			}
		}
		hidden_tooltip = { 
			character_event = { id = byzsla_slavic_event_sektyroda.16 days = 365 } 
		}
	}
	option = {
		name = optB_byzsla_slavic_event_sektyroda.15
	}
}

#### byzsla_slavic_event_sektyroda.16 - Koniec budowy

character_event = {
	id = byzsla_slavic_event_sektyroda.16
	desc = desc_byzsla_slavic_event_sektyroda.16
	
	border = GFX_event_normal_frame_diplomacy
	picture = GFX_evt_castle_construction
	
	is_triggered_only = yes
	hide_from = yes
	
	option = {
		name = optA_byzsla_slavic_event_sektyroda.16
		capital_scope = {
			remove_province_modifier = rodowcy_komnata_1
			add_province_modifier = {
				name = rodowcy_komnata_2
				duration = 1440
			}
		}
		random_list = {
			50 = { change_intrigue = 1 }
			50 = { change_learning = 1 }
		}
		prestige = 100
		
		add_trait = cruel
	}
	option = {
		name = optB_byzsla_slavic_event_sektyroda.16
		capital_scope = {
			remove_province_modifier = rodowcy_komnata_1
			add_province_modifier = {
				name = rodowcy_komnata_2
				duration = 1440
			}
		}
		random_list = {
			50 = { change_intrigue = 1 }
			50 = { change_learning = 1 }
		}
	}
}