namespace = nhs2_army_reforms

###################################################
### ARMY REFORMS
###################################################

# 1st army reform
country_event = {
	id = nhs2_army_reforms.1
	title = nhs2_army_reforms.1.t
	desc = nhs2_army_reforms.1.d
	picture = FORTENHANCE_eventPicture
	
	fire_only_once = yes

	trigger = {
		nhs_check_all_elysian_tags = { CONDITION = tag }
		is_year = 1452
		OR = {
			num_of_cities = 5
			is_year = 1455
		}
		if = {
			limit = {
				OR = {
					has_dlc = "Cradle of Civilization"
					has_dlc = "Domination"
				}
				OR = {
					has_country_flag = nhs_new_flight_taken_turks
					has_country_flag = nhs_new_flight_taken_orhan
				}
			}
			had_country_flag = {
				flag = to_had_janissary_events_2
				days = 120
			}
		}
		NOT = { has_global_flag = nhs_europe_discovered }
		NOT = { has_country_flag = nhs_first_a_reform }
		NOT = { has_country_flag = nhs_second_a_reform }
		NOT = { has_country_flag = nhs_third_a_reform }
		NOT = { has_country_flag = nhs_fourth_a_reform }
		NOT = {
			OR = {
				is_year = 1600
				mil_tech = 16
			}
		}
		NOT = {
			OR = {
				is_year = 1690
				mil_tech = 23
			}
		}
		is_at_war = no
	}
	
	immediate = {
		hidden_effect = {
			set_country_flag = nhs_first_a_reform
			clr_country_flag = nhs_second_a_reform
			clr_country_flag = nhs_third_a_reform
			clr_country_flag = nhs_fourth_a_reform
			clr_country_flag = nhs_recent_a_reform
			set_country_flag = nhs_recent_a_reform
		}
	}

	option = {
		name = "nhs2_army_reforms.1.a"
		ai_chance = {
			factor = 50
			modifier = {
				factor = 1.5
				religion_group = pagan
			}
			modifier = {
				factor = 0.5
				NOT = { religion_group = pagan }
			}
		}
		custom_tooltip = nhs2_army_reforms.1.t1
		custom_tooltip = nhs_new_line_tt
		custom_tooltip = to_nhs_enable_native_mercenary_companies_tt
		add_country_modifier = {
			name = to_ad_conscript_natives
			duration = -1
			desc = to_until_a_new_age_mission_tt
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 365
		}
		clr_country_flag = nhs_fire_reform
		
	}

	option = {
		name = "nhs2_army_reforms.1.b"
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0.5
				religion_group = pagan
			}
			modifier = {
				factor = 1.5
				NOT = { religion_group = pagan }
			}
		}
		custom_tooltip = nhs2_army_reforms.1.t2
		custom_tooltip = nhs_new_line_tt
		add_country_modifier = {
			name = to_ad_expand_militia
			duration = -1
			desc = to_until_a_new_age_mission_tt
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 365
		}
		clr_country_flag = nhs_fire_reform
	}
	
	option = {
		name = "nhs2_army_reforms.1.c"
		trigger = {
			custom_trigger_tooltip = {
				tooltip = nhs_has_taken_turks_tt
				OR = {
					has_country_flag = nhs_new_flight_taken_turks
					has_country_flag = nhs_new_flight_taken_orhan
				}
			}
			hidden_trigger = {
				NOT = {
					OR = {
						has_dlc = "Cradle of Civilization"
						has_dlc = "Domination"
					}
				}
			}
		}
		highlight = yes
		ai_chance = {
			factor = 300
		}
		custom_tooltip = nhs2_army_reforms.1.t3
		custom_tooltip = nhs_new_line_tt
		add_country_modifier = {
			name = to_ad_janissaries
			duration = -1
			desc = to_until_a_new_age_mission_tt
		}
		to_check_exarch_nationalism_all_subjects = {}
		add_country_modifier = {
			name = to_reforming_army
			duration = 730
		}
		every_country = {
			limit = {
				NOT = { border_distance = { who = ROOT distance = 100 } }
				technology_group = north_american
			}
			add_opinion = {
				who = ROOT
				modifier = nhs2_jannisaries_angry
			}
		}
		clr_country_flag = nhs_fire_reform
	}

	option = {
		name = "nhs2_army_reforms.1.e"
		trigger = {
			has_country_modifier = to_orhan_janissaries
		}
		highlight = yes
		ai_chance = {
			factor = 300
		}
		custom_tooltip = nhs2_army_reforms.1.t4
		custom_tooltip = nhs_new_line_tt
		add_country_modifier = {
			name = to_ad_encourage_janissaries
			duration = -1
			desc = to_until_a_new_age_mission_tt
		}
		to_check_exarch_nationalism_all_subjects = {}
		add_country_modifier = {
			name = to_ad_janissary_core
			duration = -1
			desc = to_until_a_new_age_mission_tt
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 730
		}
		clr_country_flag = nhs_fire_reform
	}
}

# 2nd army reform
country_event = {
	id = nhs2_army_reforms.2
	title = nhs2_army_reforms.2.t
	desc = nhs2_army_reforms.2.d
	picture = elysian_army_eventPicture
	
	is_triggered_only = yes

	trigger = {
		NOT = { has_country_flag = nhs_second_a_reform }
		NOT = { has_country_flag = nhs_third_a_reform }
		NOT = { has_country_flag = nhs_fourth_a_reform }
	}
	
	immediate = {
		hidden_effect = {
			clr_country_flag = nhs_first_a_reform
			set_country_flag = nhs_second_a_reform
			clr_country_flag = nhs_third_a_reform
			clr_country_flag = nhs_fourth_a_reform
			clr_country_flag = nhs_recent_a_reform
			set_country_flag = nhs_recent_a_reform
		}
	}

	after = {
		if = {
			limit = {
				OR = {
					has_country_flag = nhs_new_flight_taken_turks
					has_country_flag = nhs_new_flight_taken_orhan
				}
				NOT = {
					OR = {
						has_dlc = "Cradle of Civilization"
						has_dlc = "Domination"
					}
				}
			}
			country_event = { id = to_janissary_events.3 }
		}
	}

	option = { # Reconnaissance and Ambush
		name = "nhs2_army_reforms.2.a"
		ai_chance = {
			factor = 50
		}
		custom_tooltip = nhs2_army_reforms.2.t1
		custom_tooltip = nhs_new_line_tt
		nhs_remove_reforms = yes
		add_country_modifier = {
			name = to_ad_lessons_from_the_frontier
			duration = -1
			desc = to_until_mil_tech_16_tt
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 912
		}
		clr_country_flag = nhs_fire_reform
		nhs_reset_elysian_sprites = yes
	}
	option = { # Reform Theme System
		name = "nhs2_army_reforms.2.b"
		ai_chance = {
			factor = 20
		}
		custom_tooltip = nhs2_army_reforms.2.t2
		custom_tooltip = nhs_new_line_tt
		nhs_remove_reforms = yes
		add_country_modifier = {
			name = to_ad_reformed_theme_system
			duration = -1
			desc = to_until_mil_tech_16_tt
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 1825
		}
		clr_country_flag = nhs_fire_reform
		nhs_reset_elysian_sprites = yes
	}
	option = { ## European
		name = "nhs2_army_reforms.2.c"
		ai_chance = {
			factor = 30
			modifier = {
				factor = 0.33
				NOT = { religion_group = christian }
			}
		}
		
		custom_tooltip = nhs2_army_reforms.2.t3
		custom_tooltip = nhs_new_line_tt
		nhs_remove_reforms = yes
		add_country_modifier = {
			name = to_ad_foreign_advisors
			duration = -1
			desc = to_until_mil_tech_16_tt
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 2920
		}
		clr_country_flag = nhs_fire_reform
		nhs_reset_elysian_sprites = yes
	}
	option = { ## Greek Fire
		name = "nhs2_army_reforms.2.e"
		trigger = {
			nhs_has_fire_all_cases = yes
			hidden_trigger = {
				NOT = { has_country_modifier = nhs_greekfire_later }
			}
		}
		highlight = yes
		ai_chance = {
			factor = 0
		}
		custom_tooltip = nhs2_army_reforms.2.t4
		custom_tooltip = nhs_new_line_tt
		
		nhs_remove_reforms = yes
		if = {
			limit = {
				OR = {
					has_country_flag = nhs2_had_greek_fire
					nhs_has_fire_depleting_modifier = yes
				}
			}
			custom_tooltip = nhs_bonuses_later_tooltip
			tooltip = {
				add_country_modifier = {
					name = to_ad_greek_fire
					duration = -1
					desc = to_until_mil_tech_16_tt
				}
			}
		}
		else = {
			add_country_modifier = {
				name = to_ad_greek_fire
				duration = -1
				desc = to_until_mil_tech_16_tt
			}
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 3650
		}
		set_country_flag = nhs_fire_reform
		nhs_set_greek_fire_sprites = yes
	}
}

# 3rd army reform (~1600)
country_event = {
	id = nhs2_army_reforms.3
	title = nhs2_army_reforms.3.t
	picture = ARMY_CHARGE_eventPicture
	
	desc = {
		trigger = {
			NOT = {
				AND = {
					nhs_has_fire_all_cases = yes
					NOT = { has_country_modifier = nhs_greekfire_later }
				}
			}
		}
		desc = nhs2_army_reforms.3.da
	}
	desc = {
		trigger = {
			nhs_has_fire_all_cases = yes
			NOT = { has_country_modifier = nhs_greekfire_later }
		}
		desc = nhs2_army_reforms.3.db
	}
	
	fire_only_once = yes

	trigger = {
		nhs_check_all_elysian_tags = { CONDITION = tag }
		mil_tech = 16
		is_at_war = no
		NOT = {
			mil_tech = 23
		}
		NOT = { has_country_flag = nhs_third_a_reform }
		NOT = { has_country_flag = nhs_fourth_a_reform }
		NOT = { has_country_modifier = nhs_handicap_settlers }
	}
	
	immediate = {
		hidden_effect = {
			clr_country_flag = nhs_first_a_reform
			clr_country_flag = nhs_second_a_reform
			set_country_flag = nhs_third_a_reform
			clr_country_flag = nhs_fourth_a_reform
			clr_country_flag = nhs_recent_a_reform
			set_country_flag = nhs_recent_a_reform
		}
	}

	option = { ## Pike and Shot
		name = "nhs2_army_reforms.3.a"
		ai_chance = {
			factor = 70
		}
		custom_tooltip = nhs2_army_reforms.3.t1
		custom_tooltip = nhs_new_line_tt
		nhs_remove_reforms = yes
		add_country_modifier = {
			name = to_ad_pike_and_shot
			duration = -1
			desc = to_until_mil_tech_23_tt
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 365
		}
		to_add_settler_heritage_three = yes
		clr_country_flag = nhs_fire_reform
		nhs_reset_elysian_sprites = yes
	}
	option = { ## Volley Fire
		name = "nhs2_army_reforms.3.b"
		ai_chance = {
			factor = 30
		}
		custom_tooltip = nhs2_army_reforms.3.t2
		custom_tooltip = nhs_new_line_tt
		nhs_remove_reforms = yes
		if = {
			limit = {
				has_dlc = "Cradle of Civilization"
			}
			custom_tooltip = to_add_ad_volley_fire_tt
			hidden_effect = {
				add_country_modifier = {
					name = to_ad_volley_fire
					duration = -1
				}
			}
		}
		else = {
			custom_tooltip = to_add_ad_volley_fire_nodlc_tt
			hidden_effect = {
				add_country_modifier = {
					name = to_ad_volley_fire_nodlc
					duration = -1
				}
			}
		}
		custom_tooltip = to_penalty_above_max_fl_tt
		custom_tooltip = nhs_new_line_tt
		add_country_modifier = {
			name = to_reforming_army
			duration = 1825
		}
		custom_tooltip = nhs_new_line_tt
		to_add_settler_heritage_three = yes
		clr_country_flag = nhs_fire_reform
		nhs_reset_elysian_sprites = yes
	}
	option = { ## Cavalry (if picked cataprach modifier)
		name = "nhs2_army_reforms.3.c"
		ai_chance = {
			factor = 0
		}
		custom_tooltip = nhs2_army_reforms.3.t3
		custom_tooltip = nhs_new_line_tt
		
		nhs_remove_reforms = yes
		add_country_modifier = {
			name = to_ad_cataphract_army_core
			duration = -1
			desc = to_until_mil_tech_23_tt
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 730
		}
		to_add_settler_heritage_three = yes
		clr_country_flag = nhs_fire_reform
		nhs_reset_elysian_sprites = yes
	}
	option = { ## MOAR Greek Fire 
		name = "nhs2_army_reforms.3.e"
		trigger = {
			nhs_has_fire_all_cases = yes
			hidden_trigger = {
				NOT = { has_country_modifier = nhs_greekfire_later }
			}
		}
		highlight = yes
		ai_chance = {
			factor = 0
		}
		custom_tooltip = nhs2_army_reforms.3.t4
		custom_tooltip = nhs_new_line_tt
		
		nhs_remove_reforms = yes
		if = {
			limit = {
				OR = {
					has_country_flag = nhs2_had_greek_fire
					nhs_has_fire_depleting_modifier = yes
				}
			}
			custom_tooltip = nhs_bonuses_later_tooltip
			tooltip = {
				add_country_modifier = {
					name = to_ad_greek_fire2
					duration = -1
					desc = to_until_mil_tech_23_tt
				}
			}
		}
		else = {
			add_country_modifier = {
				name = to_ad_greek_fire2
				duration = -1
				desc = to_until_mil_tech_23_tt
			}
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 3650
		}
		set_country_flag = nhs_fire_reform

		to_add_settler_heritage_three = yes
		nhs_set_greek_fire_sprites = yes
	}
}

# 4th army reform (~1690)
country_event = {
	id = nhs2_army_reforms.4
	title = nhs2_army_reforms.4.t
	desc = nhs2_army_reforms.4.d
	picture = elysian_rifleman_eventPicture
	
	fire_only_once = yes

	trigger = {
		nhs_check_all_elysian_tags = { CONDITION = tag }
		mil_tech = 23
		is_at_war = no
		NOT = { has_country_flag = nhs_fourth_a_reform }
	}
	
	immediate = {
		hidden_effect = {
			clr_country_flag = nhs_first_a_reform
			clr_country_flag = nhs_second_a_reform
			clr_country_flag = nhs_third_a_reform
			set_country_flag = nhs_fourth_a_reform
			clr_country_flag = nhs_recent_a_reform
			set_country_flag = nhs_recent_a_reform
		}
	}
	
	option = { ## Administration Reform
		name = "nhs2_army_reforms.4.a"
		ai_chance = {
			factor = 50
		}
		custom_tooltip = nhs2_army_reforms.4.t1
		custom_tooltip = nhs_new_line_tt
		nhs_remove_reforms = yes
		add_country_modifier = {
			name = to_ad_administration_reform
			duration = -1
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 1460
		}
		remove_country_modifier = nhs_settler_heritage
		remove_country_modifier = nhs_settler_heritage_two
		remove_country_modifier = nhs_settler_heritage_three
		clr_country_flag = nhs_fire_reform
		nhs_reset_elysian_sprites = yes
	}
	option = { ## Profesional army
		name = "nhs2_army_reforms.4.b"
		ai_chance = {
			factor = 50
		}
		custom_tooltip = nhs2_army_reforms.4.t2
		custom_tooltip = nhs_new_line_tt
		nhs_remove_reforms = yes
		custom_tooltip = nhs_new_line_tt
		if = {
			limit = {
				is_at_war = yes
			}
			custom_tooltip = to_can_no_longer_recruit_normal_mercs_tt
			custom_tooltip = to_keep_current_merc_companies_until_war_ends_tt
		}
		else = {
			custom_tooltip = to_can_no_longer_recruit_normal_mercs_disband_tt
		}
		custom_tooltip = to_replace_mercenary_ideas_tt
		hidden_effect = {
			if = {
				limit = {
					has_idea_group = mercenary_ideas
				}
				country_event = { id = nhs2_army_reforms.6 }
			}
			if = {
				limit = {
					is_at_war = no
				}
				while = {
					limit = {
						any_hired_mercenary_company = {
							to_is_non_free_mercenary_company = yes
						}
					}
					random_hired_mercenary_company = {
						limit = {
							to_is_non_free_mercenary_company = yes
						}
						disband_mercenary_company = THIS
					}
				}
			}
		}
		custom_tooltip = nhs_new_line_tt
		if = {
			limit = {
				has_dlc = "Cradle of Civilization"
			}
			custom_tooltip = to_add_ad_professional_army_tt
			hidden_effect = {
				add_country_modifier = {
					name = to_ad_professional_army
					duration = -1
				}
			}
		}
		else = {
			custom_tooltip = to_add_ad_professional_army_nodlc_tt
			hidden_effect = {
				add_country_modifier = {
					name = to_ad_professional_army_nodlc
					duration = -1
				}
			}
		}
		custom_tooltip = to_penalty_above_max_fl_2_tt
		custom_tooltip = nhs_new_line_tt
		add_country_modifier = {
			name = to_reforming_army
			duration = 2920
		}
		remove_country_modifier = nhs_settler_heritage
		remove_country_modifier = nhs_settler_heritage_two
		remove_country_modifier = nhs_settler_heritage_three
		clr_country_flag = nhs_fire_reform
		nhs_reset_elysian_sprites = yes
	}
	option = { ## Global Army, something to do with easier transport and mobilisation
		name = "nhs2_army_reforms.4.c"
		ai_chance = {
			factor = 0
		}
		custom_tooltip = nhs2_army_reforms.4.t3
		custom_tooltip = nhs_new_line_tt
		nhs_remove_reforms = yes
		if = {
			limit = {
				has_dlc = "Cradle of Civilization"
			}
			custom_tooltip = nhs_no_proffesionalism_loss_for_mercs_tt
		}
		add_country_modifier = {
			name = to_ad_expeditionary_forces
			duration = -1
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 1825
		}
		remove_country_modifier = nhs_settler_heritage
		remove_country_modifier = nhs_settler_heritage_two
		remove_country_modifier = nhs_settler_heritage_three
		clr_country_flag = nhs_fire_reform
		nhs_reset_elysian_sprites = yes
	}
	option = { ## Improved Cavalry
		name = "nhs2_army_reforms.4.f"
		ai_chance = {
			factor = 0
		}
		custom_tooltip = nhs2_army_reforms.4.t5
		custom_tooltip = nhs_new_line_tt
		tooltip = {
			nhs_remove_reforms = yes
			add_country_modifier = {
				name = to_ad_hussars_and_cataphracts
				duration = -1
			}
		}
		
		if = {
			limit = {
				NOT = { has_country_modifier = to_ad_cataphract_army_core }
			}
			add_country_modifier = {
				name = to_reforming_army
				duration = 1825
			}
		}
		
		hidden_effect = {
			nhs_remove_reforms = yes
			add_country_modifier = {
				name = to_ad_hussars_and_cataphracts
				duration = -1
			}
		}
		remove_country_modifier = nhs_settler_heritage
		remove_country_modifier = nhs_settler_heritage_two
		remove_country_modifier = nhs_settler_heritage_three
		clr_country_flag = nhs_fire_reform
		nhs_reset_elysian_sprites = yes
	}
	option = { ## Last stage of Greek Fire, combined arms
		name = "nhs2_army_reforms.4.e"
		trigger = {
			nhs_has_fire_all_cases = yes
			hidden_trigger = {
				NOT = { has_country_modifier = nhs_greekfire_later }
			}
		}
		highlight = yes
		ai_chance = {
			factor = 0
		}
		custom_tooltip = nhs2_army_reforms.4.t4
		custom_tooltip = nhs_new_line_tt
		
		nhs_remove_reforms = yes
		if = {
			limit = {
				OR = {
					has_country_flag = nhs2_had_greek_fire
					nhs_has_fire_depleting_modifier = yes
				}
			}
			custom_tooltip = nhs_bonuses_later_tooltip
			tooltip = {
				add_country_modifier = {
					name = to_ad_greek_fire3
					duration = -1
				}
			}
		}
		else = {
			add_country_modifier = {
				name = to_ad_greek_fire3
				duration = -1
			}
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 3650
		}
		remove_country_modifier = nhs_settler_heritage
		remove_country_modifier = nhs_settler_heritage_two
		remove_country_modifier = nhs_settler_heritage_three
		set_country_flag = nhs_fire_reform
		nhs_set_greek_fire_sprites = yes
	}
}

# Switch Mercenary Army Reform
country_event = {
	id = nhs2_army_reforms.6
	title = nhs2_army_reforms.6.t
	desc = nhs2_army_reforms.6.d
	picture = WESTERNISATION_eventPicture

	is_triggered_only = yes
	
	option = {	# Aristocratic
		name = nhs2_army_reforms.6.a
		trigger = {
			NOT = { has_idea_group = aristocracy_ideas }
			has_government_attribute = enables_aristocratic_idea_group
		}
		to_replace_merc_ideas_with_group = {
			IDEA_GROUP = aristocracy_ideas
			TRIGGER = "has_government_attribute = enables_aristocratic_idea_group"
			IDEA_1 = noble_knights
			IDEA_2 = serfdom
			IDEA_3 = noble_resilience
			IDEA_4 = noble_officers
			IDEA_5 = international_nobility
			IDEA_6 = rightful_conquest
			IDEA_7 = local_nobility
		}
	}
	option = {	# Plutocratic
		name = nhs2_army_reforms.6.b
		trigger = {
			NOT = { has_idea_group = plutocracy_ideas }
			has_government_attribute = enables_plutocratic_idea_group
		}
		to_replace_merc_ideas_with_group = {
			IDEA_GROUP = plutocracy_ideas
			TRIGGER = "has_government_attribute = enables_plutocratic_idea_group"
			IDEA_1 = tradition_of_payment
			IDEA_2 = abolished_serfdom
			IDEA_3 = bill_of_rights
			IDEA_4 = free_merchants
			IDEA_5 = free_subjects
			IDEA_6 = free_cities
			IDEA_7 = emancipation
		}
	}
	option = {	# Horde, idk why but might as well
		name = nhs2_army_reforms.6.c
		trigger = {
			NOT = { has_idea_group = horde_gov_ideas }
			has_government_attribute = enables_horde_idea_group
		}
		to_replace_merc_ideas_with_group = {
			IDEA_GROUP = horde_gov_ideas
			TRIGGER = "has_government_attribute = enables_horde_idea_group"
			IDEA_1 = horse_lords
			IDEA_2 = beyond_the_sun
			IDEA_3 = mandate_of_the_khan
			IDEA_4 = there_shall_be_no_grass
			IDEA_5 = horde_loyalty
			IDEA_6 = watchers_of_the_silk_road
			IDEA_7 = a_magnanimous_empire
		}
	}
	option = {	# Theocracy
		name = nhs2_army_reforms.6.e
		trigger = {
			NOT = { has_idea_group = theocracy_gov_ideas }
			has_government_attribute = enables_divine_idea_group
		}
		to_replace_merc_ideas_with_group = {
			IDEA_GROUP = theocracy_gov_ideas
			TRIGGER = "has_government_attribute = enables_divine_idea_group"
			IDEA_1 = servants_of_god
			IDEA_2 = by_the_grace_of_god
			IDEA_3 = friends_in_high_places
			IDEA_4 = flesh_is_weak
			IDEA_5 = alpha_and_omega
			IDEA_6 = conviction_of_sin
			IDEA_7 = martyrs
		}
	}
	option = {	# Offensive
		name = nhs2_army_reforms.6.f
		trigger = {
			NOT = { has_idea_group = offensive_ideas }
		}
		to_replace_merc_ideas_with_group = {
			IDEA_GROUP = offensive_ideas
			IDEA_1 = bayonet_leaders
			IDEA_2 = national_conscripts
			IDEA_3 = superior_firepower
			IDEA_4 = glorious_arms
			IDEA_5 = engineer_corps
			IDEA_6 = grand_army
			IDEA_7 = napoleonic_warfare
		}
	}
	option = {	# Defensive
		name = nhs2_army_reforms.6.g
		trigger = {
			NOT = { has_idea_group = defensive_ideas }
		}
		to_replace_merc_ideas_with_group = {
			IDEA_GROUP = defensive_ideas
			IDEA_1 = battlefield_commisions
			IDEA_2 = military_drill
			IDEA_3 = improved_manuever
			IDEA_4 = regimental_system
			IDEA_5 = defensive_mentality
			IDEA_6 = supply_trains
			IDEA_7 = improved_foraging
		}
	}
	option = {	# Quality
		name = nhs2_army_reforms.6.h
		trigger = {
			NOT = { has_idea_group = quality_ideas }
		}
		to_replace_merc_ideas_with_group = {
			IDEA_GROUP = quality_ideas
			IDEA_1 = private_to_marshal
			IDEA_2 = quality_education
			IDEA_3 = finest_of_horses
			IDEA_4 = escort_ships
			IDEA_5 = naval_drill
			IDEA_6 = copper_bottoms
			IDEA_7 = massed_battery
		}
	}
	option = {	# Quantity
		name = nhs2_army_reforms.6.i
		trigger = {
			NOT = { has_idea_group = quantity_ideas }
		}
		to_replace_merc_ideas_with_group = {
			IDEA_GROUP = quantity_ideas
			IDEA_1 = mass_army
			IDEA_2 = the_young_can_serve
			IDEA_3 = enforced_service
			IDEA_4 = camp_followers
			IDEA_5 = reinforcement_drafts
			IDEA_6 = the_old_and_infirm
			IDEA_7 = expanded_supply_trains
		}
	}
	option = {	# Naval
		name = nhs2_army_reforms.6.j
		trigger = {
			NOT = { has_idea_group = naval_ideas }
		}
		to_replace_merc_ideas_with_group = {
			IDEA_GROUP = naval_ideas
			IDEA_1 = boarding_parties
			IDEA_2 = improved_rams
			IDEA_3 = naval_cadets
			IDEA_4 = naval_glory
			IDEA_5 = press_gangs
			IDEA_6 = oak_forests_for_ships
			IDEA_7 = superior_seamanship
		}
	}
	option = {	# Refund
		name = nhs2_army_reforms.6.k
		to_refund_mercenary_ideas = yes
	}
}

# Switch reform
country_event = {
	id = nhs2_army_reforms.5
	title = nhs2_army_reforms.5.t
	desc = nhs2_army_reforms.5.d
	picture = BYZANTINE_EAGLE_eventPicture

	is_triggered_only = yes

	option = {
		name = "nhs2_army_reforms.1.a"
		trigger = {
			has_country_modifier = to_ad_expand_militia
		}
		custom_tooltip = nhs2_army_reforms.1.t1
		custom_tooltip = nhs_new_line_tt
		ai_chance = {
			factor = 50
			modifier = {
				factor = 1.5
				religion_group = pagan
			}
			modifier = {
				factor = 0.5
				NOT = { religion_group = pagan }
			}
		}
		nhs_remove_reforms = yes
		add_country_modifier = {
			name = to_ad_conscript_natives
			duration = -1
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 365
		}
		hidden_effect = {
			clr_country_flag = nhs_recent_a_reform
			set_country_flag = nhs_recent_a_reform
		}
	}
	option = {
		name = "nhs2_army_reforms.1.b"
		trigger = {
			has_country_modifier = to_ad_conscript_natives
		}
		custom_tooltip = nhs2_army_reforms.1.t2
		custom_tooltip = nhs_new_line_tt
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0.5
				religion_group = pagan
			}
			modifier = {
				factor = 1.5
				NOT = { religion_group = pagan }
			}
		}
		nhs_remove_reforms = yes
		add_country_modifier = {
			name = to_ad_expand_militia
			duration = -1
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 365
		}
		hidden_effect = {
			clr_country_flag = nhs_recent_a_reform
			set_country_flag = nhs_recent_a_reform
		}
	}
	##### 2
	
	option = { # Reconnaissance and Ambush
		name = "nhs2_army_reforms.2.a"
		trigger = {
			OR = {
				has_country_modifier = to_ad_foreign_advisors
				has_country_modifier = to_ad_reformed_theme_system
				has_country_modifier = to_ad_greek_fire
			}
		}
		custom_tooltip = nhs2_army_reforms.2.t1
		custom_tooltip = nhs_new_line_tt
		ai_chance = {
			factor = 50
		}
		nhs_remove_reforms = yes
		add_country_modifier = {
			name = to_ad_lessons_from_the_frontier
			duration = -1
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 912
		}
		clr_country_flag = nhs_fire_reform
		hidden_effect = {
			clr_country_flag = nhs_recent_a_reform
			set_country_flag = nhs_recent_a_reform
		}
		nhs_reset_elysian_sprites = yes
	}
	option = { # Reform Theme System
		name = "nhs2_army_reforms.2.b"
		trigger = {
			OR = {
				has_country_modifier = to_ad_foreign_advisors
				has_country_modifier = to_ad_lessons_from_the_frontier
				has_country_modifier = to_ad_greek_fire
			}
		}
		ai_chance = {
			factor = 20
		}
		custom_tooltip = nhs2_army_reforms.2.t2
		custom_tooltip = nhs_new_line_tt
		nhs_remove_reforms = yes
		add_country_modifier = {
			name = to_ad_reformed_theme_system
			duration = -1
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 1825
		}
		clr_country_flag = nhs_fire_reform
		nhs_reset_elysian_sprites = yes
	}
	option = { ## European
		name = "nhs2_army_reforms.2.c"
		trigger = {
			OR = {
				has_country_modifier = to_ad_lessons_from_the_frontier
				has_country_modifier = to_ad_reformed_theme_system
				has_country_modifier = to_ad_greek_fire
			}
		}
		ai_chance = {
			factor = 30
			modifier = {
				factor = 0.33
				NOT = { religion_group = christian }
			}
		}
		custom_tooltip = nhs2_army_reforms.2.t3
		custom_tooltip = nhs_new_line_tt
		nhs_remove_reforms = yes
		add_country_modifier = {
			name = to_ad_foreign_advisors
			duration = -1
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 2920
		}
		clr_country_flag = nhs_fire_reform
		hidden_effect = {
			clr_country_flag = nhs_recent_a_reform
			set_country_flag = nhs_recent_a_reform
		}
		nhs_reset_elysian_sprites = yes
	}
	option = { ## Greek Fire
		name = "nhs2_army_reforms.2.c"
		trigger = {
			nhs_has_fire_all_cases = yes
			hidden_trigger = {
				NOT = { has_country_modifier = nhs_greekfire_later }
				OR = {
					has_country_modifier = to_ad_lessons_from_the_frontier
					has_country_modifier = to_ad_reformed_theme_system
					has_country_modifier = to_ad_foreign_advisors
				}
			}
		}
		highlight = yes
		ai_chance = {
			factor = 0
		}
		custom_tooltip = nhs2_army_reforms.2.t3
		custom_tooltip = nhs_new_line_tt
		nhs_remove_reforms = yes
		if = {
			limit = {
				OR = {
					has_country_flag = nhs2_had_greek_fire
					nhs_has_fire_depleting_modifier = yes
				}
			}
			custom_tooltip = nhs_bonuses_later_tooltip
			tooltip = {
				add_country_modifier = {
					name = to_ad_greek_fire
					duration = -1
				}
			}
		}
		else = {
			add_country_modifier = {
				name = to_ad_greek_fire
				duration = -1
			}
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 3650
		}
		set_country_flag = nhs_fire_reform
		hidden_effect = {
			clr_country_flag = nhs_recent_a_reform
			set_country_flag = nhs_recent_a_reform
		}
		nhs_set_greek_fire_sprites = yes
	}
	
	##### 3
	
	option = { ## Pike and Shot
		name = "nhs2_army_reforms.3.a"
		trigger = {
			OR = {
				has_country_modifier = to_ad_cataphract_army_core
				has_country_modifier = to_ad_volley_fire
				has_country_modifier = to_ad_volley_fire_nodlc
				has_country_modifier = to_ad_greek_fire2
			}
		}
		ai_chance = {
			factor = 70
		}
		custom_tooltip = nhs2_army_reforms.3.t1
		custom_tooltip = nhs_new_line_tt
		nhs_remove_reforms = yes
		add_country_modifier = {
			name = to_ad_pike_and_shot
			duration = -1
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 2555
		}
		clr_country_flag = nhs_fire_reform
		hidden_effect = {
			clr_country_flag = nhs_recent_a_reform
			set_country_flag = nhs_recent_a_reform
		}
		nhs_reset_elysian_sprites = yes
	}
	option = { # Volley Fire
		name = "nhs2_army_reforms.3.b"
		trigger = {
			OR = {
				has_country_modifier = to_ad_pike_and_shot
				has_country_modifier = to_ad_cataphract_army_core
				has_country_modifier = to_ad_greek_fire2
			}
		}
		ai_chance = {
			factor = 30
		}
		custom_tooltip = nhs2_army_reforms.3.t2
		custom_tooltip = nhs_new_line_tt
		nhs_remove_reforms = yes
		if = {
			limit = {
				has_dlc = "Cradle of Civilization"
			}
			custom_tooltip = to_add_ad_volley_fire_tt
			hidden_effect = {
				add_country_modifier = {
					name = to_ad_volley_fire
					duration = -1
				}
			}
		}
		else = {
			custom_tooltip = to_add_ad_volley_fire_nodlc_tt
			hidden_effect = {
				add_country_modifier = {
					name = to_ad_volley_fire_nodlc
					duration = -1
				}
			}
		}
		custom_tooltip = to_penalty_above_max_fl_tt
		custom_tooltip = nhs_new_line_tt
		add_country_modifier = {
			name = to_reforming_army
			duration = 1825
		}
		clr_country_flag = nhs_fire_reform
		hidden_effect = {
			clr_country_flag = nhs_recent_a_reform
			set_country_flag = nhs_recent_a_reform
		}
		nhs_reset_elysian_sprites = yes
	}
	option = { ## Cavalry (if picked cataprach modifier)
		trigger = {
			OR = {
				has_country_modifier = to_ad_pike_and_shot
				has_country_modifier = to_ad_volley_fire
				has_country_modifier = to_ad_volley_fire_nodlc
				has_country_modifier = to_ad_greek_fire2
			}
		}
		name = "nhs2_army_reforms.3.c"
		ai_chance = {
			factor = 0
		}
		custom_tooltip = nhs2_army_reforms.3.t3
		custom_tooltip = nhs_new_line_tt
		nhs_remove_reforms = yes
		add_country_modifier = {
			name = to_ad_cataphract_army_core
			duration = -1
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 730
		}
		clr_country_flag = nhs_fire_reform
		hidden_effect = {
			clr_country_flag = nhs_recent_a_reform
			set_country_flag = nhs_recent_a_reform
		}
		nhs_reset_elysian_sprites = yes
	}
	option = { ## MOAR Greek Fire 
		name = "nhs2_army_reforms.3.e"
		trigger = {
			nhs_has_fire_all_cases = yes
			hidden_trigger = {
				NOT = { has_country_modifier = nhs_greekfire_later }
				OR = {
					has_country_modifier = to_ad_pike_and_shot
					has_country_modifier = to_ad_cataphract_army_core
					has_country_modifier = to_ad_volley_fire
					has_country_modifier = to_ad_volley_fire_nodlc
				}
			}
		}
		highlight = yes
		ai_chance = {
			factor = 0
		}
		custom_tooltip = nhs2_army_reforms.3.t4
		custom_tooltip = nhs_new_line_tt
		nhs_remove_reforms = yes
		if = {
			limit = {
				OR = {
					has_country_flag = nhs2_had_greek_fire
					nhs_has_fire_depleting_modifier = yes
				}
			}
			custom_tooltip = nhs_bonuses_later_tooltip
			tooltip = {
				add_country_modifier = {
					name = to_ad_greek_fire2
					duration = -1
				}
			}
		}
		else = {
			add_country_modifier = {
				name = to_ad_greek_fire2
				duration = -1
			}
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 3650
		}
		set_country_flag = nhs_fire_reform
		hidden_effect = {
			clr_country_flag = nhs_recent_a_reform
			set_country_flag = nhs_recent_a_reform
		}
		nhs_set_greek_fire_sprites = yes
	}
	
	#### 4
	
	option = { ## Massed muskets
		name = "nhs2_army_reforms.4.a"
		ai_chance = {
			factor = 50
		}
		trigger = {
			OR = {
				has_country_modifier = to_ad_professional_army
				has_country_modifier = to_ad_professional_army_nodlc
				has_country_modifier = to_ad_expeditionary_forces
				has_country_modifier = to_ad_greek_fire3
				has_country_modifier = to_ad_hussars_and_cataphracts
			}
		}
		custom_tooltip = nhs2_army_reforms.4.t1
		custom_tooltip = nhs_new_line_tt
		nhs_remove_reforms = yes
		add_country_modifier = {
			name = to_ad_administration_reform
			duration = -1
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 1460
		}
		clr_country_flag = nhs_fire_reform
		hidden_effect = {
			clr_country_flag = nhs_recent_a_reform
			set_country_flag = nhs_recent_a_reform
		}
		nhs_reset_elysian_sprites = yes
	}
	option = { ## New Model Army. profesional army (quality)
		name = "nhs2_army_reforms.4.b"
		trigger = {
			OR = {
				has_country_modifier = to_ad_administration_reform
				has_country_modifier = to_ad_expeditionary_forces
				has_country_modifier = to_ad_greek_fire3
				has_country_modifier = to_ad_hussars_and_cataphracts
			}
		}
		ai_chance = {
			factor = 50
		}
		custom_tooltip = nhs2_army_reforms.4.t2
		custom_tooltip = nhs_new_line_tt
		nhs_remove_reforms = yes
		custom_tooltip = nhs_new_line_tt
		if = {
			limit = {
				is_at_war = yes
			}
			custom_tooltip = to_can_no_longer_recruit_normal_mercs_tt
			custom_tooltip = to_keep_current_merc_companies_until_war_ends_tt
		}
		else = {
			custom_tooltip = to_can_no_longer_recruit_normal_mercs_disband_tt
		}
		custom_tooltip = to_replace_mercenary_ideas_tt
		hidden_effect = {
			if = {
				limit = {
					has_idea_group = mercenary_ideas
				}
				country_event = { id = nhs2_army_reforms.6 }
			}
			if = {
				limit = {
					is_at_war = no
				}
				while = {
					limit = {
						any_hired_mercenary_company = {
							to_is_non_free_mercenary_company = yes
						}
					}
					random_hired_mercenary_company = {
						limit = {
							to_is_non_free_mercenary_company = yes
						}
						disband_mercenary_company = THIS
					}
				}
			}
		}
		custom_tooltip = nhs_new_line_tt
		if = {
			limit = {
				has_dlc = "Cradle of Civilization"
			}
			custom_tooltip = to_add_ad_professional_army_tt
			hidden_effect = {
				add_country_modifier = {
					name = to_ad_professional_army
					duration = -1
				}
			}
		}
		else = {
			custom_tooltip = to_add_ad_professional_army_nodlc_tt
			hidden_effect = {
				add_country_modifier = {
					name = to_ad_professional_army_nodlc
					duration = -1
				}
			}
		}
		custom_tooltip = to_penalty_above_max_fl_2_tt
		custom_tooltip = nhs_new_line_tt
		add_country_modifier = {
			name = to_reforming_army
			duration = 2920
		}
		clr_country_flag = nhs_fire_reform
		hidden_effect = {
			clr_country_flag = nhs_recent_a_reform
			set_country_flag = nhs_recent_a_reform
		}
		nhs_reset_elysian_sprites = yes
	}
	option = { ## Global Army, something to do with easier transport and mobilisation
		trigger = {
			OR = {
				has_country_modifier = to_ad_administration_reform
				has_country_modifier = to_ad_professional_army
				has_country_modifier = to_ad_professional_army_nodlc
				has_country_modifier = to_ad_greek_fire3
				has_country_modifier = to_ad_hussars_and_cataphracts
			}
		}
		name = "nhs2_army_reforms.4.c"
		ai_chance = {
			factor = 0
		}
		custom_tooltip = nhs2_army_reforms.4.t3
		custom_tooltip = nhs_new_line_tt
		nhs_remove_reforms = yes
		if = {
			limit = {
				has_dlc = "Cradle of Civilization"
			}
			custom_tooltip = nhs_no_proffesionalism_loss_for_mercs_tt
		}
		add_country_modifier = {
			name = to_ad_expeditionary_forces
			duration = -1
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 1825
		}
		clr_country_flag = nhs_fire_reform
		hidden_effect = {
			clr_country_flag = nhs_recent_a_reform
			set_country_flag = nhs_recent_a_reform
		}
		nhs_reset_elysian_sprites = yes
	}
	option = { ## Improved Cavalry
		name = "nhs2_army_reforms.4.f"
		trigger = {
			OR = {
				has_country_modifier = to_ad_administration_reform
				has_country_modifier = to_ad_professional_army
				has_country_modifier = to_ad_professional_army_nodlc
				has_country_modifier = to_ad_expeditionary_forces
				has_country_modifier = to_ad_greek_fire3
			}
		}
		ai_chance = {
			factor = 0
		}
		custom_tooltip = nhs2_army_reforms.4.t5
		custom_tooltip = nhs_new_line_tt
		nhs_remove_reforms = yes
		add_country_modifier = {
			name = to_ad_hussars_and_cataphracts
			duration = -1
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 1825
		}
		clr_country_flag = nhs_fire_reform
		nhs_reset_elysian_sprites = yes
	}
	option = { ## Last stage of Greek Fire, combined arms
		name = "nhs2_army_reforms.4.e"
		trigger = {
			nhs_has_fire_all_cases = yes
			hidden_trigger = {
				NOT = { has_country_modifier = nhs_greekfire_later }
				OR = {
					has_country_modifier = to_ad_administration_reform
					has_country_modifier = to_ad_professional_army
					has_country_modifier = to_ad_professional_army_nodlc
					has_country_modifier = to_ad_expeditionary_forces
					has_country_modifier = to_ad_hussars_and_cataphracts
				}
			}
		}
		highlight = yes
		ai_chance = {
			factor = 0
		}
		custom_tooltip = nhs2_army_reforms.4.t4
		custom_tooltip = nhs_new_line_tt
		nhs_remove_reforms = yes
		if = {
			limit = {
				OR = {
					has_country_flag = nhs2_had_greek_fire
					nhs_has_fire_depleting_modifier = yes
				}
			}
			custom_tooltip = nhs_bonuses_later_tooltip
			tooltip = {
				add_country_modifier = {
					name = to_ad_greek_fire3
					duration = -1
				}
			}
		}
		else = {
			add_country_modifier = {
				name = to_ad_greek_fire3
				duration = -1
			}
		}
		add_country_modifier = {
			name = to_reforming_army
			duration = 3650
		}
		set_country_flag = nhs_fire_reform
		hidden_effect = {
			clr_country_flag = nhs_recent_a_reform
			set_country_flag = nhs_recent_a_reform
		}
		nhs_set_greek_fire_sprites = yes
	}
	option = { ## Nevermind
		name = "nhs2_army_reforms.5.a"
		ai_chance = {
			factor = 50
		}
		if = {
			limit = {
				has_country_flag = nhs_got10mil
			}
			add_mil_power = 10
			clr_country_flag = nhs_got10mil
		}
		if = {
			limit = {
				has_country_flag = nhs_got20mil
			}
			add_mil_power = 20
			clr_country_flag = nhs_got20mil
		}
		if = {
			limit = {
				has_country_flag = nhs_got30mil
			}
			add_mil_power = 30
			clr_country_flag = nhs_got30mil
		}
		if = {
			limit = {
				has_country_flag = nhs_got40mil
			}
			add_mil_power = 40
			clr_country_flag = nhs_got40mil
		}
		if = {
			limit = {
				has_country_flag = nhs_got50mil
			}
			add_mil_power = 50
			clr_country_flag = nhs_got50mil
		}
		if = {
			limit = {
				has_country_flag = nhs_got60mil
			}
			add_mil_power = 60
			clr_country_flag = nhs_got60mil
		}
		if = {
			limit = {
				has_country_flag = nhs_got70mil
			}
			add_mil_power = 70
			clr_country_flag = nhs_got70mil
		}
		if = {
			limit = {
				has_country_flag = nhs_got80mil
			}
			add_mil_power = 80
			clr_country_flag = nhs_got80mil
		}
		if = {
			limit = {
				has_country_flag = nhs_got90mil
			}
			add_mil_power = 90
			clr_country_flag = nhs_got90mil
		}
		if = {
			limit = {
				has_country_flag = nhs_got100mil
			}
			add_mil_power = 100
			clr_country_flag = nhs_got100mil
		}

		# Deprecated, but kept if someone just happened to have the event open
		if = {
			limit = {
				has_country_flag = nhs_got65mil
			}
			add_mil_power = 65
			clr_country_flag = nhs_got65mil
		}
		if = {
			limit = {
				has_country_flag = nhs_got95mil
			}
			add_mil_power = 95
			clr_country_flag = nhs_got95mil
		}
		if = {
			limit = {
				has_country_flag = nhs_got110mil
			}
			add_mil_power = 110
			clr_country_flag = nhs_got110mil
		}
		if = {
			limit = {
				has_country_flag = nhs_got125mil
			}
			add_mil_power = 125
			clr_country_flag = nhs_got125mil
		}
		if = {
			limit = {
				has_country_flag = nhs_got140mil
			}
			add_mil_power = 140
			clr_country_flag = nhs_got140mil
		}
		if = {
			limit = {
				has_country_flag = nhs_got155mil
			}
			add_mil_power = 155
			clr_country_flag = nhs_got155mil
		}
		if = {
			limit = {
				has_country_flag = nhs_got170mil
			}
			add_mil_power = 170
			clr_country_flag = nhs_got170mil
		}
		if = {
			limit = {
				has_country_flag = nhs_got185mil
			}
			add_mil_power = 185
			clr_country_flag = nhs_got185mil
		}
		if = {
			limit = {
				has_country_flag = nhs_got200mil
			}
			add_mil_power = 200
			clr_country_flag = nhs_got200mil
		}
	}
}