
### Byzantine-focused Restore Rome Story Cycle
### by Chad Uhl

ep3_story_cycle_restoring_rome = {

	on_setup = {
		story_owner = {
			trigger_event = {
				id = ep3_roman_restoration.0001
				days = 2
			}
		}
	}

	# We only pass on the story if the title heir is the Player
	on_owner_death = {
		if = {
			limit = {
				story_owner = { has_title = title:h_roman_empire }
				title:h_roman_empire.current_heir = { is_ai = no }
			}
			make_story_owner = title:h_roman_empire.current_heir
		}
		else_if = {
			limit = {
				story_owner = { has_title = title:h_eastern_roman_empire }
				title:h_eastern_roman_empire.current_heir = { is_ai = no }
			}
			make_story_owner = title:h_eastern_roman_empire.current_heir
		}
		else_if = {
			limit = {
				story_owner = { has_title = title:e_byzantium }
				title:e_byzantium.current_heir = { is_ai = no }
			}
			make_story_owner = title:e_byzantium.current_heir
		}
	}

	# Rome = New Game +
	# aka ramp up difficulty
	effect_group = {
		days = 120
		
		trigger = {
			story_owner = {
				is_ai = no
				is_roman_emperor_excluding_byzantium_trigger = yes
			}
			has_variable = roman_empire_hard_mode
		}

		triggered_effect = {
			trigger = { always = yes }
			effect = {
				story_owner = {
					trigger_event = { on_action = ep3_restored_rome_on_action }
				}
			}
		}
	}

	#Maintenance group
	effect_group = {
		days = 1
		trigger = {
			story_owner = { is_landed = no }
		}
		triggered_effect = {
			trigger = { always = yes }
			effect = {
				#You became a landless adventurer with different lifestyles! Ending story prematurely.
				story_owner = { save_scope_as = story_owner }
				debug_log = "Roman Restoration invalidated"
				debug_log_scopes = yes
				end_story = yes
			}
		}
	}
}
