###############
#### Reformy
#### byzsla_slav_panteon_unity - Ujednolicenie panteonu
#### byzsla_slav_writing_off_scriptures - Spisanie kanonu pism
#### byzsla_slav_great_zerca - Ustanowienie Wielkiego Żercy
###############
#### byzsla_slav_great_volhv - Ustanowienie Wielkiego Wołchwa
###############

decisions = {

#### byzsla_slav_panteon_unity - Ujednolicenie panteonu
	byzsla_slav_panteon_unity = {
		is_high_prio = yes
		potential = {
			NOT = { has_global_flag = byzsla_slavic_reforma_panteon_start }
			NOT = { has_global_flag = byzsla_slavic_reforma_panteon_koniec }
			NOT = { has_global_flag = byzsla_slavic_reforma_pismo_koniec }
			NOT = { has_character_flag = byzsla_slavic_reforma_pismo_start }
			has_dlc = "The Old Gods"
			is_playable = yes
			is_ruler = yes
			age = 16
			prisoner = no
			religion = slavic_pagan
			independent = yes
		}
		allow = {
			war = no
			any_demesne_title = {
				is_occupied = no
			}
			capital_scope = { 
				TECH_RELIGIOUS_CUSTOMS = 1
			}
			piety = 500
			wealth = 100
			num_of_holy_sites = 1
			OR = {
				AND = {
					tier = emperor 
					is_nomadic = no
				}
				AND = {
					tier = king
					is_nomadic = no
					diplomacy = 10
				}
				AND = {
					is_nomadic = yes
					martial = 16
				}
			}
			custom_tooltip = {
				text = byzsla_slav_sprawny_wodz
				hidden_tooltip = {
					prisoner = no
					NOT = { trait = possessed }
					NOT = { trait = in_hiding }
					NOT = { trait = incapable }
					is_ill = no
					has_regent = no
					in_command = no
				}
			}
			custom_tooltip = {
				text = byzsla_slav_zdolny_szaman
				hidden_tooltip = {
					job_spiritual = {
						OR = {
							trait = genius 
							AND = {
								is_priest = yes
								learning = 16
							}
						}
					}
				}
			}
		}
		effect = {
			set_character_flag = byzsla_slavic_reforma_panteon_start
			set_global_flag = byzsla_slavic_reforma_panteon_start
			add_trait = byzsla_slavic_rytual
			piety = -500
			job_spiritual = {
				death = {
					killer = ROOT
					death_reason = death_sacrificed
				}
			}
			character_event = {
				id = byzsla_slavic_event.1
			}
		}
	}
#### byzsla_slav_writing_off_scriptures - Spisanie kanonu pism

	byzsla_slav_writing_off_scriptures = {
		is_high_prio = yes
		potential = {
			has_global_flag = byzsla_slavic_reforma_panteon_koniec
			NOT = { has_global_flag = byzsla_slavic_reforma_pismo_koniec }
			NOT = { has_character_flag = byzsla_slavic_reforma_pismo_start }
			has_dlc = "The Old Gods"
			is_playable = yes
			is_ruler = yes
			age = 16
			prisoner = no
			religion = slavic_pagan
			independent = yes
		}
		allow = {
			war = no
			any_demesne_title = {
				is_occupied = no
			}
			capital_scope = { 
				TECH_NOBLE_CUSTOMS = 1
				TECH_POPULAR_CUSTOMS = 1
				TECH_RELIGIOUS_CUSTOMS = 2
			}
			piety = 500
			wealth = 100
			num_of_holy_sites = 1
			OR = {
				AND = {
					tier = emperor 
					is_nomadic = no
				}
				AND = {
					tier = king
					is_nomadic = no
					diplomacy = 10
				}
				AND = {
					is_nomadic = yes
					martial = 18
				}
			}
			custom_tooltip = {
				text = byzsla_slav_sprawny_wodz
				hidden_tooltip = {
					prisoner = no
					NOT = { trait = possessed }
					NOT = { trait = in_hiding }
					NOT = { trait = incapable }
					is_ill = no
					has_regent = no
					in_command = no
				}
			}
			custom_tooltip = {
				text = byzsla_slav_zdolny_szaman
				hidden_tooltip = {
					job_spiritual = {
						OR = {
							trait = genius 
							AND = {
								is_priest = yes
								learning = 16
							}
						}
					}
				}
			}
		}
		effect = {
			set_character_flag = byzsla_slavic_reforma_pismo_start
			add_trait = byzsla_slavic_rytual
			piety = -750
			job_spiritual = {
				death = {
					killer = ROOT
					death_reason = death_sacrificed
				}
			}
			random_list = {
				30 = {
					character_event = { id = byzsla_slavic_event.14 days = 50 }
				}
				70 = {
					character_event = { id = byzsla_slavic_event.13 days = 50 }
				}
			}
		}
	}

#### byzsla_slav_great_zerca - Ustanowienie Wielkiego Żercy

	byzsla_slav_great_zerca = {
		is_high_prio = yes
		potential = {
			has_global_flag = byzsla_slavic_reforma_pismo_koniec
			has_dlc = "The Old Gods"
			is_playable = yes
			is_ruler = yes
			age = 16
			prisoner = no
			religion = slavic_pagan
			independent = yes
			NOT = { is_title_active = d_slavic_pagan_reformed }
		}
		allow = {
			war = no
			any_demesne_title = {
				is_occupied = no
			}
			capital_scope = { 
				TECH_NOBLE_CUSTOMS = 2
				TECH_POPULAR_CUSTOMS = 2
				TECH_RELIGIOUS_CUSTOMS = 2
				TECH_CITY_CONSTRUCTION = 2
			}
			piety = 500
			wealth = 100
			num_of_holy_sites = 1
			OR = {
				AND = {
					tier = emperor 
					is_nomadic = no
				}
				AND = {
					tier = king
					is_nomadic = no
					diplomacy = 10
				}
				AND = {
					is_nomadic = yes
					martial = 18
				}
			}
			custom_tooltip = {
				text = byzsla_slav_sprawny_wodz
				hidden_tooltip = {
					prisoner = no
					NOT = { trait = possessed }
					NOT = { trait = in_hiding }
					NOT = { trait = incapable }
					is_ill = no
					has_regent = no
					in_command = no
				}
			}
			custom_tooltip = {
				text = byzsla_slav_posiadanie_zercy
				hidden_tooltip = {
					any_vassal = {
						is_theocracy = yes 
						learning = 13
						religion = slavic_pagan
						primary_title = { higher_tier_than = BARON } 
					}
				}
			}
		}
		effect = {
			piety = -750
			give_nickname = byzsla_slavic_nick_reformator
			activate_title = { title = d_slavic_pagan_reformed status = yes }
			custom_tooltip = {
				text = byzsla_slav_proba_reformy3
				random_vassal = {
					limit = {
						is_theocracy = yes 
						learning = 13
						religion = slavic_pagan
						primary_title = { higher_tier_than = BARON } 
					}
					d_slavic_pagan_reformed = {
						grant_title = PREV
					}
					set_defacto_liege = ROOT
				}
				narrative_event = { id = byzsla_slavic_event.20 days = 1 }
				if = {
					limit = {
						has_global_flag = byzsla_druzyna_arkony_flaga
					}
					c_druzyna_arkony = {
						destroy_landed_title = THIS
						owner = {
							death = {
								death_reason = death_execution
							}
						}
					}
					activate_title = { title = c_druzyna_arkony2 status = yes }
					activate_title = { title = c_druzyna_arkony status = no } 
				}
			}
		}
	}

#### byzsla_slav_great_volhv - Ustanowienie Wielkiego Wołchwa
	byzsla_slav_great_volhv = {
		is_high_prio = yes
		potential = {
			religion = chram_vales
			OR = {
				any_independent_ruler = {
					any_realm_character = {
						NOT = {
							has_landed_title = d_great_volhv
						}
					}
				}
				any_independent_ruler = {
					any_vassal = {
						NOT = {
							has_landed_title = d_great_volhv
						}
					}
				}
				any_independent_ruler = {
					NOT = {
						has_landed_title = d_great_volhv
					}
				}
			}
		}
		
		allow = {
			piety = 750
			prestige = 750
			num_of_holy_sites = 1
			capital_scope = { 
				TECH_NOBLE_CUSTOMS = 2
				TECH_POPULAR_CUSTOMS = 2
				TECH_RELIGIOUS_CUSTOMS = 3
			}
			custom_tooltip = {
				text = byzsla_slav_sprawny_wodz
				hidden_tooltip = {
					prisoner = no
					NOT = { trait = possessed }
					NOT = { trait = in_hiding }
					NOT = { trait = incapable }
					is_ill = no
					has_regent = no
					in_command = no
				}
			}
			OR = {
				AND = {
					tier = emperor 
					is_nomadic = no
				}
				AND = {
					tier = king
					is_nomadic = no
					diplomacy = 10
				}
				AND = {
					is_nomadic = yes
					martial = 13
				}
			}
			any_courtier = {
				is_priest = yes
				learning = 13
				religion = chram_vales
			}
		}
		effect = {
			activate_title = { title = d_great_volhv status = yes }
			piety = 1000
			give_nickname = byzsla_slavic_nick_reformator
			religion_authority = {
					modifier = byzsla_slavic_ustanowienie_ww
					years = 20
			}
			custom_tooltip = {
				text = byzsla_slav_proba_reformy_herezja
				random_courtier = {
					limit = {
						is_priest = yes
						learning = 13
						religion = chram_vales
					}
					d_great_volhv = {
						grant_title = PREV
					}
				}
			}
		}
	}
}
