namespace = ui_overhaul_qhd_ascension
### on_press_begin
country_event = {
	id = ui_overhaul_qhd_ascension.00
	hide_window = yes
	is_triggered_only = yes
	trigger = {
		NOT = { has_global_flag = ui_overhaul_qhd_ascension_tech_popup }
		is_ai = no
	}
	immediate = {
		event_target:global_event_country = {
			set_variable = {
				which = uiod_max_ascension_perk_slots
				value = 0
			}
			set_variable = {
				which = uiod_max_tradition_categories
				value = @max_tradition_trees
			}
			set_variable = {
				which = uiod_ascension_limit
				value = @max_tradition_trees
			}
		}
		set_global_flag = ui_overhaul_qhd_ascension_tech_popup
		country_event = { id = ui_overhaul_qhd_ascension.10 }
		every_country = {
			country_event = { id = ui_overhaul_qhd_ascension.02 }
		}
	}
}
### on_single_player_save_game_load
event = {
	id = ui_overhaul_qhd_ascension.01
	hide_window = yes
	is_triggered_only = yes
	trigger = {
		NOT = { has_global_flag = ui_overhaul_qhd_ascension_tech_popup }
	}
	immediate = {
		every_country = {
			limit = {
				NOT = { has_country_flag = ui_overhaul_qhd_ascension_perk_set }
			}
			country_event = { id = ui_overhaul_qhd_ascension.02 }
			if = {
				limit = {
					NOT = { has_global_flag = ui_overhaul_qhd_ascension_tech_popup }
					is_ai = no
				}
				event_target:global_event_country = {
					set_variable = {
						which = uiod_max_ascension_perk_slots
						value = 0
					}
					set_variable = {
						which = uiod_max_tradition_categories
						value = @max_tradition_trees
					}
					set_variable = {
						which = uiod_ascension_limit
						value = @max_tradition_trees
					}
				}
				set_global_flag = ui_overhaul_qhd_ascension_tech_popup
				country_event = { id = ui_overhaul_qhd_ascension.10 }
			}
		}
	}
}
### set starting value for current ascension perk slots
### on_country_created
country_event = {
	id = ui_overhaul_qhd_ascension.02
	hide_window = yes
	is_triggered_only = yes
	immediate = {
		set_variable = {
			which = uiod_current_ascension_perk_slots
			value = 1
		}
		set_country_flag = ui_overhaul_qhd_ascension_perk_set
	}
}
### on_tech_increased
country_event = {
	id = ui_overhaul_qhd_ascension.05
	hide_window = yes
	is_triggered_only = yes
	trigger = {
		last_increased_tech = ui_tech_ascension_theory_repeatable
	}
	immediate = {
		change_variable = {
			which = uiod_current_ascension_perk_slots
			value = 1
		}
	}
}
### main event
country_event = {
	id = ui_overhaul_qhd_ascension.10
	title = ui_overhaul_qhd_ascension.10.name
	desc = ui_overhaul_qhd_ascension.10.desc
	picture = GFX_evt_announcement
	show_sound = event_announcement
	is_triggered_only = yes
	location = ROOT
	trigger = {
		is_ai = no
	}
	option = {
		name = ui_overhaul_qhd_ascension.10.no
		set_global_flag = ui_overhaul_qhd_ascension_tech_disabled
	}
	option = {
		name = ui_overhaul_qhd_ascension.10.a
		event_target:global_event_country = {
			set_variable = {
				which = uiod_max_ascension_perk_slots
				value = 4
			}
		}
	}
	option = {
		name = ui_overhaul_qhd_ascension.10.b
		event_target:global_event_country = {
			set_variable = {
				which = uiod_max_ascension_perk_slots
				value = 8
			}
		}
	}
	option = {
		name = ui_overhaul_qhd_ascension.10.c
		trigger = {
			event_target:global_event_country = {
				check_variable_arithmetic = {
					which = uiod_max_tradition_categories
					add = 12
					value <= 100
				}
			}
		}
		event_target:global_event_country = {
			set_variable = {
				which = uiod_max_ascension_perk_slots
				value = 12
			}
		}
	}
	option = {
		name = ui_overhaul_qhd_ascension.10.d
		trigger = {
			event_target:global_event_country = {
				check_variable_arithmetic = {
					which = uiod_max_tradition_categories
					add = 16
					value <= 100
				}
			}
		}
		event_target:global_event_country = {
			set_variable = {
				which = uiod_max_ascension_perk_slots
				value = 16
			}
		}
	}
	option = {
		name = ui_overhaul_qhd_ascension.10.e
		trigger = {
			event_target:global_event_country = {
				check_variable_arithmetic = {
					which = uiod_max_tradition_categories
					add = 20
					value <= 100
				}
			}
		}
		event_target:global_event_country = {
			set_variable = {
				which = uiod_max_ascension_perk_slots
				value = 20
			}
		}
	}
	option = {
		name = ui_overhaul_qhd_ascension.10.f
		trigger = {
			event_target:global_event_country = {
				check_variable_arithmetic = {
					which = uiod_max_tradition_categories
					add = 24
					value <= 100
				}
			}
		}
		event_target:global_event_country = {
			set_variable = {
				which = uiod_max_ascension_perk_slots
				value = 24
			}
		}
	}
	option = {
		name = ui_overhaul_qhd_ascension.10.g
		trigger = {
			event_target:global_event_country = {
				check_variable_arithmetic = {
					which = uiod_max_tradition_categories
					add = 28
					value <= 100
				}
			}
		}
		event_target:global_event_country = {
			set_variable = {
				which = uiod_max_ascension_perk_slots
				value = 28
			}
		}
	}
	option = {
		name = ui_overhaul_qhd_ascension.10.h
		trigger = {
			event_target:global_event_country = {
				check_variable_arithmetic = {
					which = uiod_max_tradition_categories
					add = 36
					value <= 100
				}
			}
		}
		event_target:global_event_country = {
			set_variable = {
				which = uiod_max_ascension_perk_slots
				value = 36
			}
		}
	}
	option = {
		name = ui_overhaul_qhd_ascension.10.i
		trigger = {
			event_target:global_event_country = {
				check_variable_arithmetic = {
					which = uiod_max_tradition_categories
					add = 44
					value <= 100
				}
			}
		}
		event_target:global_event_country = {
			set_variable = {
				which = uiod_max_ascension_perk_slots
				value = 44
			}
		}
	}
	option = {
		name = ui_overhaul_qhd_ascension.10.j
		trigger = {
			event_target:global_event_country = {
				check_variable_arithmetic = {
					which = uiod_max_tradition_categories
					add = 52
					value <= 100
				}
			}
		}
		event_target:global_event_country = {
			set_variable = {
				which = uiod_max_ascension_perk_slots
				value = 52
			}
		}
	}
	option = {
		name = ui_overhaul_qhd_ascension.10.k
		trigger = {
			event_target:global_event_country = {
				check_variable_arithmetic = {
					which = uiod_max_tradition_categories
					add = 60
					value <= 100
				}
			}
		}
		event_target:global_event_country = {
			set_variable = {
				which = uiod_max_ascension_perk_slots
				value = 60
			}
		}
	}
	option = {
		name = ui_overhaul_qhd_ascension.10.l
		trigger = {
			event_target:global_event_country = {
				check_variable_arithmetic = {
					which = uiod_max_tradition_categories
					add = 68
					value <= 100
				}
			}
		}
		event_target:global_event_country = {
			set_variable = {
				which = uiod_max_ascension_perk_slots
				value = 68
			}
		}
	}
	option = {
		name = ui_overhaul_qhd_ascension.10.m
		trigger = {
			event_target:global_event_country = {
				check_variable_arithmetic = {
					which = uiod_max_tradition_categories
					add = 76
					value <= 100
				}
			}
		}
		event_target:global_event_country = {
			set_variable = {
				which = uiod_max_ascension_perk_slots
				value = 76
			}
		}
	}
	option = {
		name = ui_overhaul_qhd_ascension.10.n
		trigger = {
			event_target:global_event_country = {
				check_variable_arithmetic = {
					which = uiod_max_tradition_categories
					add = 84
					value <= 100
				}
			}
		}
		event_target:global_event_country = {
			set_variable = {
				which = uiod_max_ascension_perk_slots
				value = 84
			}
		}
	}
	option = {
		name = ui_overhaul_qhd_ascension.10.o
		trigger = {
			event_target:global_event_country = {
				check_variable_arithmetic = {
					which = uiod_max_tradition_categories
					add = 92
					value <= 100
				}
			}
		}
		event_target:global_event_country = {
			set_variable = {
				which = uiod_max_ascension_perk_slots
				value = 92
			}
		}
	}
	after = {
		event_target:global_event_country = {
			change_variable = {
				which = uiod_ascension_limit
				value = this.uiod_max_ascension_perk_slots
			}
		}
	}
}
### debug
#country_event = {
#	id = ui_overhaul_qhd_ascension.50
#	title = ui_overhaul_qhd_ascension.50.name
#	desc = ui_overhaul_qhd_ascension.50.desc
#	picture = GFX_evt_unity_symbol
#	is_triggered_only = yes
#	trigger = {
#		# last_increased_tech = ui_tech_ascension_theory_repeatable
#	}
#	immediate = {
#	}
#	option = {
#		name = "max <= current" # ui_overhaul_qhd_ascension.50.a
#		allow = {
#			event_target:global_event_country = {
#				check_variable = {
#					which = uiod_max_ascension_perk_slots
#					value <= Prev.uiod_current_ascension_perk_slots
#				}
#			}
#		}
#	}
#	option = {
#		name = "max < current" # ui_overhaul_qhd_ascension.50.a
#		allow = {
#			event_target:global_event_country = {
#				check_variable = {
#					which = uiod_max_ascension_perk_slots
#					value < Prev.uiod_current_ascension_perk_slots
#				}
#			}
#		}
#	}
#	option = {
#		name = "max = current" # ui_overhaul_qhd_ascension.50.a
#		allow = {
#			event_target:global_event_country = {
#				check_variable = {
#					which = uiod_max_ascension_perk_slots
#					value = Prev.uiod_current_ascension_perk_slots
#				}
#			}
#		}
#	}
#	option = {
#		name = "max > current" # ui_overhaul_qhd_ascension.50.a
#		allow = {
#			event_target:global_event_country = {
#				check_variable = {
#					which = uiod_max_ascension_perk_slots
#					value > Prev.uiod_current_ascension_perk_slots
#				}
#			}
#		}
#	}
#	option = {
#		name = "max >= current" # ui_overhaul_qhd_ascension.50.a
#		allow = {
#			event_target:global_event_country = {
#				check_variable = {
#					which = uiod_max_ascension_perk_slots
#					value >= Prev.uiod_current_ascension_perk_slots
#				}
#			}
#		}
#	}
#}