namespace = nhs_secret_flightevents

### Startup Event
country_event = {
	id = nhs_secret_flightevents.33
	title = nhs_secret_flightevents.33.t
	desc = nhs_secret_flightevents.33.d
	picture = BYZ_BYZANTINE_EAGLE_eventPicture

	hidden = yes
	is_triggered_only = yes
	fire_only_once = yes
	
	trigger = {
		tag = BYZ
		NOT = { is_year = 1445 }
		is_random_new_world = no
	}
	
	immediate = {
		hidden_effect = {
			to_trigger_galata_flight_event = yes
		}
	}
	option = {
		name = nhs_secret_flightevents.33.a
	}
}

### Galata Offer for a Ship
country_event = {
	id = nhs_new_flightevents.34
	title = nhs_new_flightevents.34.t
	desc = nhs_new_flightevents.34.d
	picture = indiangfx_MERCHANTS_TALKING_eventPicture

	is_triggered_only = yes
	fire_only_once = yes
	
	trigger = {
		has_country_modifier = byz_flight
	}
	option = {
		trigger = {
			has_country_flag = nhs_new_flight_taken_turks
			NOT = { has_country_flag = nhs_new_flight_sold_morea_to_genoa }
		}
		ai_chance = {
			factor = 45
		}
		name = "nhs_new_flightevents.34.a"
		add_treasury = -50
		define_general = {
			name = "Gjergj Kastrioti Skanderbeg"
			fire = 5
			shock = 5
			manuever = 5
			siege = 0
		}
		custom_tooltip = nhs_new_flight_taken_botha_tt
		set_country_flag = nhs_new_flight_taken_albanians
		set_global_flag = nhs_new_flight_orhan_override
		set_global_flag = nhs_new_flightevents_galata_bail
		hidden_effect = {
			country_event = { id = nhs_hidden_flightevents.35 }
			if = {
				limit = {
					exists = ALB
					ALB = {
						has_ruler = "Gjergj Skanderbeg"
					}
				}
				ALB = {
					exile_ruler_as = { name = nhs_ignore }
				}
			}
		}
	}
	option = {
		trigger = {
			has_country_flag = nhs_new_flight_taken_albanians
			NOT = { has_country_flag = nhs_new_flight_sold_morea_to_genoa }
		}
		ai_chance = {
			factor = 45
			modifier = {
				factor = 0
				TUR = {
					ai = no
				}
			}
		}
		name = "nhs_new_flightevents.34.b"
		add_treasury = -50
		define_advisor = {
			type = commandant
			name = "Orhan Celebi"
			skill = 2
			culture = turkish
			religion = sunni
			cost_multiplier = 0.25
			female = no
			age = 32
		}
		custom_tooltip = nhs_new_flight_taken_botht_tt
		set_country_flag = nhs_new_flight_taken_turks
		set_global_flag = nhs_new_flight_orhan_override
		set_global_flag = nhs_new_flightevents_galata_bail
		hidden_effect = {
			country_event = { id = nhs_hidden_flightevents.35 }
		}
	}
	option = {
		trigger = {
			AND = {
				has_country_flag = nhs_new_flight_sold_morea_to_genoa
				has_country_flag = nhs_new_flight_taken_turks
			}
		}
		ai_chance = {
			factor = 45
		}
		name = "nhs_new_flightevents.34.c"
		add_treasury = -10
		define_general = {
			name = "Gjergj Kastrioti Skanderbeg"
			fire = 5
			shock = 5
			manuever = 5
			siege = 0
		}
		custom_tooltip = nhs_new_flight_genoese_generosity_tt
		custom_tooltip = nhs_new_line_tt
		custom_tooltip = nhs_new_flight_taken_botha_tt
		set_country_flag = nhs_new_flight_taken_albanians
		set_global_flag = nhs_new_flight_orhan_override
		set_global_flag = nhs_new_flightevents_moreagalata_bail
		hidden_effect = {
			country_event = { id = nhs_hidden_flightevents.35 }
			if = {
				limit = {
					exists = ALB
					ALB = {
						has_ruler = "Gjergj Skanderbeg"
					}
				}
				ALB = {
					exile_ruler_as = { name = nhs_ignore }
				}
			}
		}
	}
	option = { #Pay up Genoa2
		trigger = {
			AND = {
				has_country_flag = nhs_new_flight_sold_morea_to_genoa
				has_country_flag = nhs_new_flight_taken_albanians
			}
		}
		ai_chance = {
			factor = 45
			modifier = {
				factor = 0
				TUR = {
					ai = no
				}
			}
		}
		name = "nhs_new_flightevents.34.e"
		add_treasury = -10
		define_advisor = {
			type = commandant
			name = "Orhan Celebi"
			skill = 2
			culture = turkish
			religion = sunni
			cost_multiplier = 0.25
			female = no
			age = 32
		}
		custom_tooltip = nhs_new_flight_genoese_generosity_tt
		custom_tooltip = nhs_new_line_tt
		custom_tooltip = nhs_new_flight_taken_botht_tt
		set_country_flag = nhs_new_flight_taken_turks
		set_global_flag = nhs_new_flight_orhan_override
		set_global_flag = nhs_new_flightevents_moreagalata_bail
		hidden_effect = {
			country_event = { id = nhs_hidden_flightevents.35 }
		}
	}
	option = {
  		trigger = {
			if = {
				limit = {
					OR = {
						has_country_flag = nhs_new_flight_taken_albanians
						has_country_flag = nhs_new_flight_taken_turks
					}
				}
			}
		}
		ai_chance = {
			factor = 10
		}
		name = "nhs_new_flightevents.34.f"
		add_treasury = 20
		add_prestige = 10
		add_opinion = {
			who = GEN
			modifier = insulted
		}
		custom_tooltip = nhs_new_flight_genoese_bailreject_tt
		set_global_flag = nhs_new_flightevents_galata_reject
	}
}

### Queue for Endgame events
country_event = {
	id = nhs_hidden_flightevents.35
	title = nhs_hidden_flightevents.35.t
	desc = nhs_hidden_flightevents.35.d
	picture = muslimgfx_EXPLORERS_eventPicture

	hidden = yes
	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			to_trigger_extra_rebel_flight_events = yes
		}
	}
	option = {
		name = "nhs_hidden_flightevents.35.a"	
	}
}

### Turks gain Orhan and Albania surrender if you take both Orhan and Skanderbeg
country_event = {
	id = nhs_new_flightevents.35
	title = nhs_new_flightevents.35.t
	desc = nhs_new_flightevents.35.d
	picture = muslimgfx_BORDER_TENSION_eventPicture

	fire_only_once = yes
	is_triggered_only = yes

	option = {
		name = "nhs_new_flightevents.35.a"
		ai_chance = {
			factor = 50
		}
		add_claim = 145
		add_claim = 330
		every_province = {
			limit = {
				owned_by = RUM
			}
			cede_province = ROOT
			add_core = ROOT
		}
		every_province = {
			limit = {
				owned_by = ALB
			}
			cede_province = ROOT
		}
		every_province = {
			limit = {
				owned_by = ATH
			}
			cede_province = ROOT
		}
		every_province = {
			limit = {
				owned_by = EPI
			}
			cede_province = ROOT
		}
		if = {
			limit = {
				exists = MOE
				MOE = {
					is_subject = no
				}
			}
			TUR = {
				country_event = { id = nhs_secret_flightevents.36 days = 30 }
			}
		}
		else = {
			TUR = {
				country_event = { id = nhs_secret_flightevents.37 days = 30 }
			}
		}		
	}
}

### Aftermath of taking both men with you if Morea free
country_event = {
	id = nhs_secret_flightevents.36
	title = nhs_secret_flightevents.36.t
	desc = nhs_secret_flightevents.36.d
	picture = muslimgfx_LAND_MILITARY_eventPicture

	fire_only_once = yes
	is_triggered_only = yes

	option = {
		name = "nhs_secret_flightevents.36.a"
		ai_chance = {
			factor = 20
		}
		declare_war_with_cb = {
			who = MOE
			casus_belli = cb_conquest
			war_goal_province = 330
		}
	}

	option = {
		name = "nhs_secret_flightevents.36.b"
		ai_chance = {
			factor = 20
		}
		declare_war_with_cb = {
			who = TRE
			casus_belli = cb_conquest
			war_goal_province = 145
		}
		GEO = {
			white_piece = ROOT
		}
	}

	option = {
		name = "nhs_secret_flightevents.36.c"
		ai_chance = {
			factor = 20
		}
		declare_war_with_cb = {
			who = TRE
			casus_belli = cb_conquest
			war_goal_province = 145
		}
		declare_war_with_cb = {
			who = MOE
			casus_belli = cb_conquest
			war_goal_province = 330
		}
		GEO = {
			white_piece = ROOT
		}
	}

	option = {
		name = "nhs_secret_flightevents.36.e"
		ai_chance = {
			factor = 40
		}
		add_prestige = 10
	}
}

### Aftermath of taking both men with you if Morea subject
country_event = {
	id = nhs_secret_flightevents.37
	title = nhs_secret_flightevents.37.t
	desc = nhs_secret_flightevents.37.d
	picture = muslimgfx_LAND_MILITARY_eventPicture

	fire_only_once = yes
	is_triggered_only = yes

	option = {
		name = "nhs_secret_flightevents.37.a"
		ai_chance = {
			factor = 18
		}
		declare_war_with_cb = {
			who = MOE
			casus_belli = cb_conquest
			war_goal_province = 330
		}
	}

	option = {
		name = "nhs_secret_flightevents.37.b"
		ai_chance = {
			factor = 26
		}
		declare_war_with_cb = {
			who = TRE
			casus_belli = cb_conquest
			war_goal_province = 145
		}
		GEO = {
			white_piece = ROOT
		}
	}

	option = {
		name = "nhs_secret_flightevents.37.c"
		ai_chance = {
			factor = 16
		}
		declare_war_with_cb = {
			who = TRE
			casus_belli = cb_conquest
			war_goal_province = 145
		}
		declare_war_with_cb = {
			who = MOE
			casus_belli = cb_conquest
			war_goal_province = 330
		}
		GEO = {
			white_piece = ROOT
		}
	}

	option = {
		name = "nhs_secret_flightevents.37.e"
		ai_chance = {
			factor = 40
		}
		add_prestige = 10
	}
}

### Galatan Enterprise upon landing
country_event = {
	id = nhs_newer_flightevents.40
	title = nhs_newer_flightevents.40.t
	desc = nhs_newer_flightevents.40.d
	picture = muslimgfx_COLONIZATION_eventPicture

	fire_only_once = yes
	is_triggered_only = yes
	
	trigger = {
		tag = NHS
		owns = 953
	}

	option = {
		name = "nhs_newer_flightevents.40.a"
		ai_chance = {
			factor = 100
		}
		if = {
			limit = {
				has_global_flag = nhs_new_flight_orhan_override
			}
			custom_tooltip = nhs_new_flight_taken_turks_end_tt
			custom_tooltip = nhs_new_line_tt
			set_country_flag = nhs_new_flight_taken_orhan
		}
		if = {
			limit = {
				has_global_flag = nhs_new_flightevents_galata_bail
			}
			custom_tooltip = nhs_new_galata_bail_tt
			hidden_effect = {
				add_treasury = -50
			}
		}
		if = {
			limit = {
				has_global_flag = nhs_new_flightevents_moreagalata_bail
			}
			custom_tooltip =  nhs_new_galatamorea_bail_tt
			hidden_effect = {
				add_treasury = -10
			}
		}
		if = {
			limit = {
				has_global_flag = nhs_new_flightevents_galata_reject
			}
			custom_tooltip = nhs_new_galatareject_tt
			hidden_effect = {
				add_treasury = 20
			}
		}
		hidden_effect = {	
			clr_global_flag = nhs_new_flightevents_galata_bail
			clr_global_flag = nhs_new_flightevents_moreagalata_bail
			clr_global_flag = nhs_new_flightevents_galata_reject
			clr_global_flag = nhs_new_flight_orhan_override
		}
	}
}