eoanb_category_second_opium_war = {

	#Fortify Tianjin
	QNG_decision_tianjin_forts = {
		icon = fort
		allowed = { tag = QNG }
		
		available = {
			has_completed_focus = QNG_focus_prepare_taku_fort_cannons
			controls_province = 13741
		}
		
		fire_only_once = yes
		cost = 20
		days_remove = 14
		
		modifier = {
			production_speed_buildings_factor = -0.5
		}
		
		
		complete_effect = {
			custom_effect_tooltip = fortified_taku_tooltip
		}

		remove_effect = {
			126 = { 
				add_building_construction = { 
					type = bunker 
					level = 1 
					instant_build = yes 
					province = 13741 
				} 
			}
			set_country_flag = QNG_taku_fortified
		}

		ai_will_do = {
			factor = 1000
		}
	}
	
	#Fortify Canton
	QNG_decision_canton_forts = {
		icon = fort
		allowed = { tag = QNG }
		
		available = {
			has_completed_focus = QNG_focus_fortify_canton
			controls_province = 1047
		}
		
		fire_only_once = yes
		cost = 20
		days_remove = 14
		
		modifier = {
			production_speed_buildings_factor = -0.5
		}
		
		
		complete_effect = {
			592 = { 
				add_building_construction = { 
					type = bunker 
					level = 1 
					instant_build = yes 
					province = 1047 
				}
			}
		}

		remove_effect = {
			set_country_flag = QNG_canton_fortified
			custom_effect_tooltip = fortified_canton_tooltip
		}	

		ai_will_do = {
			factor = 1000
		}
	}
	
	#Tianjin Garrison
	QNG_decision_tianjin_garrison = {
		icon = feudal_warriors
		allowed = { tag = QNG }
		
		available = {
			has_completed_focus = QNG_focus_use_local_provincial_armies
			controls_province = 1171 
		}
		
		fire_only_once = yes

		custom_cost_trigger = {
			has_political_power > 24
			has_army_experience > 24
			command_power > 49
		}
		custom_cost_text = eoanb_political_power_25_army_experience_25_command_power_50
		
		days_remove = 14
		
		
		complete_effect = {
			add_political_power = -25
			army_experience = -25
			add_command_power = -50
		}

		remove_effect = {
			load_oob = QNG_sow_tianjin_troops
		}

		ai_will_do = {
			factor = 1000
		}
	}
	
	#Canton Garrison
	QNG_decision_canton_garrison = {
		icon = feudal_warriors
		allowed = { tag = QNG }
		
		available = {
			has_completed_focus = QNG_focus_use_local_provincial_armies
			controls_province = 1047 
		}
		
		fire_only_once = yes

		custom_cost_trigger = {
			has_political_power > 24
			has_army_experience > 24
			command_power > 49
		}
		custom_cost_text = eoanb_political_power_25_army_experience_25_command_power_50
		
		days_remove = 14
		
		
		complete_effect = {
			add_political_power = -25
			army_experience = -25
			add_command_power = -50
		}

		remove_effect = {
			load_oob = QNG_sow_guangzhou_troops
		}

		ai_will_do = {
			factor = 1000
		}
	}

	#ENG: Prepare to Assault Canton
	eoanb_decision_sow_ENG_prep = {
		icon = generic_prepare_civil_war
		allowed = { tag = ENG }

		visible = {
			has_global_flag = eoanb_flag_sow_ongoing
		}

		fire_only_once = yes
		cost = 0

		custom_cost_trigger = {
			command_power > 9
		}
		custom_cost_text = decision_cost_CP_10

		complete_effect = {
			add_command_power = -10
			custom_effect_tooltip = eoanb_tt_decision_ENG_hongkong_troops_sow
			country_event = secondopiumwarnew.1
			hidden_effect = {
				load_oob = "ENG_sow_hongkong_troops"
				FRA = {
					country_event = { id = secondopiumwarnew.2 days = 7 }
				}
			}
		}

		ai_will_do = {
			factor = 1000
		}
	}

	#ENG: Issue an ultimatum to QNG
	eoanb_decision_sow_ENG_ultimatum_1 = {
		icon = generic_decision
		allowed = { tag = ENG }

		available = {
			OR = {
				has_global_flag = SOW_anglo_french_yes
				has_global_flag = SOW_anglo_french_no
			}
		}

		visible = {
			has_global_flag = eoanb_flag_sow_ongoing
		}

		fire_only_once = yes
		cost = 0

		custom_cost_trigger = {
			command_power > 14
		}
		custom_cost_text = decision_cost_CP_15

		complete_effect = {
			add_command_power = -15
			QNG = { country_event = { id = secondopiumwarnew.4 days = 1 } }
		}

		ai_will_do = {
			factor = 1000
			modifier = {
				factor = 0
				date < 1857.12.26
			}
		}
	}

	#ENG: Assault on Canton/Guangzhou
	eoanb_decision_sow_LEG_assault_canton = {
		icon = generic_prepare_civil_war
		allowed = { tag = ENG }

		available = {
			always = no
		}

		visible = {
			OR = {
				tag = ENG
				AND = {
					tag = FRA
					has_global_flag = SOW_anglo_french_yes
				}
			}
			has_global_flag = eoanb_flag_sow_ongoing
			has_global_flag = eoanb_flag_sow_canton
		}

		fire_only_once = yes
		days_remove = 8
		cost = 0

		remove_effect = {
			custom_effect_tooltip = eoanb_decision_sow_LEG_assault_taku_effect_tt
			hidden_effect = {
				ENG = { 
					country_event = { id = britain.127 days = 30 } 
				}
				QNG = {
					activate_mission = eoanb_mission_sow_defend_canton
				}
			}
		}

		ai_will_do = {
			factor = 1000
		}
	}

	#ENG: Assault Taku 1
	eoanb_decision_sow_LEG_assault_taku1 = {
		icon = generic_prepare_civil_war
		allowed = { tag = ENG }

		available = {
			always = no
		}

		visible = {
			OR = {
				tag = ENG
				AND = {
					tag = FRA
					has_global_flag = SOW_anglo_french_yes
				}
			}
		}

		fire_only_once = yes
		days_remove = 140
		cost = 0

		remove_effect = {
			custom_effect_tooltip = eoanb_decision_sow_LEG_assault_taku_effect_tt
			hidden_effect = {
				ENG = {
					country_event = { id = secondopiumwarnew.14 hours = 2 }
				}
				QNG = {
					country_event = { id = secondopiumwarnew.14 hours = 2 }
				}
				if = {
					limit = { has_global_flag = SOW_anglo_french_yes }
					FRA = {
						country_event = { id = secondopiumwarnew.14 hours = 2 }
					}
				}
			}
		}

		ai_will_do = {
			factor = 1000
		}
	}

	#ENG: Assault Taku 2
	eoanb_decision_sow_LEG_assault_taku_2 = {
		icon = generic_prepare_civil_war
		allowed = { tag = ENG }

		available = {
			always = no
		}

		visible = {
			has_global_flag = eoanb_flag_sow_ongoing
			has_global_flag = SOW_taku_forts
		}

		fire_only_once = yes
		days_remove = 4
		cost = 0

		remove_effect = {
			custom_effect_tooltip = eoanb_decision_sow_LEG_assault_taku_effect_tt
			hidden_effect = {
				QNG = { country_event = secondopiumwarnew.39 }
				ENG = { country_event = secondopiumwarnew.40 }
				if = {
					limit = { has_global_flag = SOW_anglo_french_yes }
					FRA = { country_event = secondopiumwarnew.40 }
				}
			}
		}

		ai_will_do = {
			factor = 1000
		}
	}

	#ENG: Assault Taku 3
	eoanb_decision_sow_LEG_assault_taku_3 = {
		icon = generic_prepare_civil_war
		allowed = { tag = ENG }

		available = {
			always = no
		}

		visible = {
			has_global_flag = eoanb_flag_sow_ongoing
			has_global_flag = SOW_taku_forts
		}

		fire_only_once = yes
		days_remove = 412
		cost = 0

		remove_effect = {
			custom_effect_tooltip = eoanb_decision_sow_LEG_assault_taku_3_effect_tt
			hidden_effect = {
				QNG = {
					set_country_flag = QNG_third_take_fort_assault_flag
					country_event = { id = secondopiumwarnew.12 days = 1 }
				}
			}
		}

		ai_will_do = {
			factor = 1000
		}
	}

	#ENG: Assault on Beijing
	eoanb_decision_sow_LEG_assault_Bejing = {
		icon = generic_prepare_civil_war
		allowed = { tag = ENG }

		available = {
			always = no
		}

		visible = {
			OR = {
				tag = ENG
				AND = { 
					tag = FRA
					has_global_flag = SOW_anglo_french_yes
				}
			}
			has_global_flag = eoanb_flag_sow_ongoing
		}

		fire_only_once = yes
		days_remove = 30
		cost = 0

		remove_effect = {
			custom_effect_tooltip = eoanb_decision_sow_LEG_assault_Bejing_effect_tt
			hidden_effect = {
				QNG = {
					activate_mission = eoanb_mission_sow_defend_bejing
				}
			}
		}

		ai_will_do = {
			factor = 1000
		}
	}

	#RUS: Send Ultimatum to QNG
	eoanb_mission_sow_RUS_send_ultimatum = {
		icon = generic_prepare_civil_war
		allowed = { tag = RUS }

		available = {
			if = {
				limit = { is_ai = yes }
				has_political_power > 20
			}
			else = {
				army_manpower_in_state = {
					type = infantry
					amount > 5000
					state = 564
				}
			}
		}

		activation = {
			always = no
		}

		fire_only_once = yes
		is_good = no
		days_mission_timeout = 365

		highlight_states = {
			highlight_state_targets = { state = 564 }
		}

		timeout_effect = {
			add_political_power = -20
			add_war_support = -0.02
		}

		complete_effect = {
			QNG = {
				country_event = secondopiumwarnew.30
			}
		}

		ai_will_do = {
			factor = 1000
		}
	}

	#QNG: Defend Canton
	eoanb_mission_sow_defend_canton = {
		icon = generic_naval
		allowed = { tag = QNG }

		available = {
			controls_state = 592
			army_manpower_in_state = {
				type = infantry
				amount > 40000
				state = 592
			}
			has_country_flag = QNG_canton_fortified
		}
		
		activation = {
			always = no
		}

		selectable_mission = no
		is_good = no
		fire_only_once = yes
		days_mission_timeout = 9
		
		highlight_states = {
			highlight_state_targets = { state = 592 }
		}
		
		complete_effect = {
			ENG = { country_event = secondopiumwarnew.7 }
			hidden_effect = {
				QNG = { country_event = secondopiumwarnew.7 }
				if = {
					limit = { has_global_flag = SOW_anglo_french_yes }
					FRA = { country_event = secondopiumwarnew.7 }
				}
			}
		}
		
		timeout_effect = {
			country_event = secondopiumwarnew.11
			hidden_effect = {
				ENG = { country_event = secondopiumwarnew.11 }
				if = {
					limit = { has_global_flag = SOW_anglo_french_yes }
					FRA = { country_event = secondopiumwarnew.11 }
				}
			}
		}

		ai_will_do = {
			factor = 100
		}
	}

	#QNG: Defend Taku Forts 3
	eoanb_mission_sow_defend_taku_3 = {
		icon = generic_naval
		allowed = { tag = QNG }

		available = {
			controls_state = 126
			army_manpower_in_state = {
				type = infantry
				amount > 40000
				state = 126
			}
			has_country_flag = QNG_taku_fortified
		}
		
		activation = {
			always = no
		}

		selectable_mission = no
		is_good = no
		fire_only_once = yes
		days_mission_timeout = 9
		
		highlight_states = {
			highlight_state_targets = { state = 126 }
		}
		
		complete_effect = {
			ENG = { country_event = secondopiumwarnew.13 }
			hidden_effect = {
				QNG = { country_event = secondopiumwarnew.13 }
				if = {
					limit = { has_global_flag = SOW_anglo_french_yes }
					FRA = { country_event = secondopiumwarnew.13 }
				}
			}
		}
		
		timeout_effect = {
			country_event = secondopiumwarnew.35
			hidden_effect = {
				ENG = { country_event = secondopiumwarnew.17 }
				if = {
					limit = { has_global_flag = SOW_anglo_french_yes }
					FRA = { country_event = secondopiumwarnew.36 }
				}
				USA = { country_event = secondopiumwarnew.34 }
			}
		}

		ai_will_do = {
			factor = 100
		}
	}

	#QNG: Defend Beijing
	eoanb_mission_sow_defend_bejing = {
		icon = generic_naval
		allowed = { tag = QNG }

		available = {
			controls_state = 608
			army_manpower_in_state = {
				type = infantry
				amount > 10000
				state = 608
			}
			army_manpower_in_state = {
				type = infantry
				amount > 10000
				state = 609
			}
			army_manpower_in_state = {
				type = infantry
				amount > 40000
				state = 126
			}
		}
		
		activation = {
			always = no
		}

		selectable_mission = no
		is_good = no
		fire_only_once = yes
		days_mission_timeout = 7
		
		highlight_states = {
			highlight_state_targets = { state = 608 }
		}
		
		complete_effect = {
			ENG = { country_event = secondopiumwarnew.13 }
			hidden_effect = {
				QNG = { country_event = secondopiumwarnew.13 }
				if = {
					limit = { has_global_flag = SOW_anglo_french_yes }
					FRA = { country_event = secondopiumwarnew.13 }
				}
			}
		}
		
		timeout_effect = {
			country_event = secondopiumwarnew.24
			ENG = { add_manpower = -21 }
			QNG = { add_manpower = -5000 }
			if = {
				limit = { has_global_flag = SOW_anglo_french_yes }
				FRA = { add_manpower = -16 }
			}
		}

		ai_will_do = {
			factor = 100
		}
	}

	#QNG: Defend Manchuria
	eoanb_mission_sow_defend_manchuria = {
		icon = generic_naval
		allowed = { tag = QNG }

		available = {
			controls_state = 612
			army_manpower_in_state = {
				type = infantry
				amount > 40000
				state = 612
			}
		}
		
		activation = {
			always = no
		}

		selectable_mission = no
		is_good = no
		fire_only_once = yes
		days_mission_timeout = 14
		
		highlight_states = {
			highlight_state_targets = { state = 612 }
		}
		
		complete_effect = {
			RUS = { country_event = secondopiumwarnew.32 }
			hidden_effect = {
				QNG = { country_event = secondopiumwarnew.32 }
			}
		}
		
		timeout_effect = {
			QNG = { country_event = secondopiumwarnew.31 }
			hidden_effect = {
				RUS = { country_event = secondopiumwarnew.31 }
			}
		}

		ai_will_do = {
			factor = 100
		}
	}

	#QNG: Learn from the War
	eoanb_decision_sow_learn_from_the_war = {
		icon = generic_construction
		allowed = { tag = QNG }

		available = {
			has_completed_focus = QNG_focus_defeat_from_the_west_again
		}

		visible = {
			OR = {
				has_idea = CHI_idea_army_defeated
				has_idea = CHI_idea_army_destroyed
			}
		}

		fire_only_once = no
		cost = 100
		days_remove = 60

		remove_effect = {
			if = {
				limit = { has_idea = CHI_idea_army_destroyed }
				swap_ideas = {
					remove_idea = CHI_idea_army_destroyed
					add_idea = CHI_idea_army_defeated
				}
			}
			else_if = {
				limit = { has_idea = CHI_idea_army_defeated }
				remove_ideas = CHI_idea_army_defeated
			}
		}

		ai_will_do = {
			factor = 1000
		}
	}
}
