MTG_naval_treaties = {
	MTG_abandon_treaty_democratic = {

		icon = generic
			
	
		available = {
			OR = {
				threat > 0.2
				has_global_flag = MTG_second_london_conference
			}
		}
	
		cost = 150
		fire_only_once = yes
		ai_will_do = {
			factor = 0
		}
	
		visible = {
			has_naval_treaty_trigger = yes
			OR = {
				has_government = democratic
				has_government = neutrality
			}
		}
	
		complete_effect = {
			remove_naval_treaty_effect = yes
			every_other_country = {
				limit = {
					has_naval_treaty_trigger = yes
				}
				country_event = MTG_naval_treaty.7
			}
			if = {
				limit = {
					has_global_flag = {
						flag = MTG_naval_treaty_signatories
						value < 3
					}
				}
				random_other_country = {
					limit = {
						has_naval_treaty_trigger = yes
					}
					remove_naval_treaty_effect = yes
				}
				clr_global_flag = MTG_naval_treaty_signatories
				hidden_effect = { news_event = mtg_news.60 }
			}
			if = {
				limit = {
					has_global_flag = MTG_naval_treaty_signatories
				}
				modify_global_flag = {
					flag = MTG_naval_treaty_signatories
					value = -1
				}
			}
			if = {
				limit = {
					not = {
						any_other_country = {
							OR = {
								has_idea = MTG_naval_treaty_cheating_reduced
								has_idea = MTG_naval_treaty_adherent_reduced
							}
						}
					}
				}
				every_other_country = {
					limit = {
						OR = {
							has_idea = MTG_naval_treaty_cheating
							has_idea = MTG_naval_treaty_adherent
						}
					}
					activate_mission = MTG_escalator_clause_invocation_mission
					custom_effect_tooltip = MTG_escalator_clause_tt
				}
			}
		}
	}

	MTG_abandon_treaty_fascist = {

		icon = generic
			
	
		available = {
			OR = {
				threat > 0.2
				has_global_flag = MTG_second_london_conference
			}
		}
	
		cost = 25
		fire_only_once = yes
		ai_will_do = {
			factor = 1
			modifier = {
				OR = {
					tag = ITA
					tag = JAP
				}
				add = 1
			}
			modifier = {
				tag = USA
				has_civil_war = no
				add = 5
			}
			modifier = {
				tag = JAP
				is_historical_focus_on = yes
				add = 50
			}
			modifier = {
				tag = JAP
				is_historical_focus_on = yes
				date > 1937.03.01
				factor = 10
			}
		}
	
		visible = {
			has_naval_treaty_trigger = yes
			OR = {
				has_government = fascism
				has_government = communism
			}
		}
	
		complete_effect = {
			remove_naval_treaty_effect = yes
			every_other_country = {
				limit = {
					has_naval_treaty_trigger = yes
				}
				country_event = { id = MTG_naval_treaty.7 days = 2 }
			}
			if = {
				limit = {
					has_global_flag = {
						flag = MTG_naval_treaty_signatories
						value < 3
					}
				}
				random_other_country = {
					limit = {
						has_naval_treaty_trigger = yes
					}
					remove_naval_treaty_effect = yes
				}
				clr_global_flag = MTG_naval_treaty_signatories
				hidden_effect = { news_event = mtg_news.60 }
			}
			if = {
				limit = {
					has_global_flag = MTG_naval_treaty_signatories
				}
				modify_global_flag = {
					flag = MTG_naval_treaty_signatories
					value = -1
				}
			}
			if = {
				limit = {
					not = {
						any_other_country = {
							OR = {
								has_idea = MTG_naval_treaty_cheating_reduced
								has_idea = MTG_naval_treaty_adherent_reduced
							}
						}
					}
				}
				every_other_country = {
					limit = {
						OR = {
							has_idea = MTG_naval_treaty_cheating
							has_idea = MTG_naval_treaty_adherent
						}
					}
					activate_mission = MTG_escalator_clause_invocation_mission
					custom_effect_tooltip = MTG_escalator_clause_tt
				}
			}
		}
	}

	MTG_cheat_on_treaty = {

		icon = generic
			
	
		available = {
			
		}
	
		cost = 50
		fire_only_once = yes
		ai_will_do = {
			factor = 3
			modifier = {
				tag = JAP
				factor = 5 #The Yamato is a 35,000 ton ship what are you talking about
			}
		}
	
		visible = {
			OR = {
				has_idea = MTG_naval_treaty_adherent
				has_idea = MTG_naval_treaty_adherent_reduced
			}
			OR = {
				has_government = fascism
				has_government = communism
			}
		}
	
		complete_effect = {
			if = {
				limit = {
					has_idea = MTG_naval_treaty_adherent
				}
				swap_ideas = {
					remove_idea = MTG_naval_treaty_adherent
					add_idea = MTG_naval_treaty_cheating
				}
			}
			if = {
				limit = {
					has_idea = MTG_naval_treaty_adherent_reduced
				}
				swap_ideas = {
					remove_idea = MTG_naval_treaty_adherent_reduced
					add_idea = MTG_naval_treaty_cheating_reduced
				}
			}
		}
	}
	MTG_invite_FROM_to_treaty = {

		icon = generic_naval
			
	
		available = {
			
		}

		target_root_trigger = {
			has_naval_treaty_trigger = yes
		}

		target_trigger = {
			FROM = { 
				has_war = no
				has_naval_treaty_trigger = no
				NOT = { has_country_flag = MTG_naval_treaty_abandoned }
				NOT = { has_country_flag = MTG_refused_naval_treaty }
				if = {
					limit = { ENG = { has_naval_treaty_trigger = yes } }
					naval_strength_comparison = {
						other = ENG
						ratio > 0.35
						sub_unit_def_weights = {
							carrier = 0.25
							battleship = 1
							battle_cruiser = 0.8
							heavy_cruiser = 0.5
						}
					}
				}
				else_if = {
					limit = { USA = { has_naval_treaty_trigger = yes } }
					naval_strength_comparison = {
						other = USA
						ratio > 0.35
						sub_unit_def_weights = {
							carrier = 0.25
							battleship = 1
							battle_cruiser = 0.8
							heavy_cruiser = 0.5
						}
					}
				}
				else = {
					has_navy_size = {
						type = capital_ship
						size > 15
					}
				}
			}
		}
		cost = 50
		fire_only_once = yes
		ai_will_do = {
			factor = 0
			modifier = {
				OR = {
					tag = ENG
					tag = USA
				}
				has_government = democratic
				add = 10
			}
		}
	
		visible = {
			has_naval_treaty_trigger = yes
		}
	
		complete_effect = {
			FROM = {
				country_event = MTG_naval_treaty.1
			}
		}
	}
	MTG_send_treaty_warning_to_FROM_previous_signatory = {

		icon = generic_naval
			
	
		available = {
			
		}

		target_root_trigger = {
			has_naval_treaty_trigger = yes
		}

		target_trigger = {
			FROM = { 
				has_war = no
				has_country_flag = MTG_naval_treaty_abandoned
				if = {
					limit = { ENG = { has_naval_treaty_trigger = yes } }
					naval_strength_comparison = {
						other = ENG
						ratio > 0.8
						sub_unit_def_weights = {
							carrier = 0.25
							battleship = 1
							battle_cruiser = 0.8
							heavy_cruiser = 0.5
						}
					}
				}
				else_if = {
					limit = { USA = { has_naval_treaty_trigger = yes } }
					naval_strength_comparison = {
						other = USA
						ratio > 0.8
						sub_unit_def_weights = {
							carrier = 0.25
							battleship = 1
							battle_cruiser = 0.8
							heavy_cruiser = 0.5
						}
					}
				}
				else = {
					has_navy_size = {
						type = capital_ship
						size > 20
					}
				}
			}
		}
		cost = 50
		fire_only_once = yes
		ai_will_do = {
			factor = 10
			modifier = {
				is_historical_focus_on = yes
				factor = 0
			}
		}
	
		visible = {
			has_naval_treaty_trigger = yes
		}
	
		complete_effect = {
			FROM = {
				country_event = { id = MTG_naval_treaty.4 }
			}
		}
	}
	MTG_send_treaty_warning_to_FROM = {

		icon = generic_naval
			
	
		available = {
			
		}

		target_root_trigger = {
			has_naval_treaty_trigger = yes
		}

		target_trigger = {
			FROM = {
				OR = {
					AND = {
						has_war = no
						not = { has_country_flag = MTG_naval_treaty_abandoned }
						NOT = { has_country_flag = MTG_refused_naval_treaty }
						has_naval_treaty_trigger = no
						if = {
							limit = { ENG = { has_naval_treaty_trigger = yes } }
							naval_strength_comparison = {
								other = ENG
								ratio > 1
								sub_unit_def_weights = {
									carrier = 0.5
									battleship = 1
									battle_cruiser = 0.8
									heavy_cruiser = 0.5
								}
							}
						}
						else_if = {
							limit = { USA = { has_naval_treaty_trigger = yes } }
							naval_strength_comparison = {
								other = USA
								ratio > 1
								sub_unit_def_weights = {
									carrier = 0.5
									battleship = 1
									battle_cruiser = 0.8
									heavy_cruiser = 0.5
								}
							}
						}
						else = {
							has_navy_size = {
								type = capital_ship
								size > 50
							}
						}
					}
					AND = {
						has_naval_treaty_trigger = yes
						if = {
							limit = { ENG = { has_naval_treaty_trigger = yes } }
							naval_strength_comparison = {
								other = ENG
								ratio > 1.1
								sub_unit_def_weights = {
									carrier = 0.5
									battleship = 1
									battle_cruiser = 0.8
									heavy_cruiser = 0.5
								}
							}
						}
						else_if = {
							limit = { USA = { has_naval_treaty_trigger = yes } }
							naval_strength_comparison = {
								other = USA
								ratio > 1.1
								sub_unit_def_weights = {
									carrier = 0.5
									battleship = 1
									battle_cruiser = 0.8
									heavy_cruiser = 0.5
								}
							}
						}
						else = {
							has_navy_size = {
								type = capital_ship
								size > 50
							}
						}
					}
				}
			}
		}
		cost = 50
		fire_only_once = yes
		ai_will_do = {
			factor = 10
			modifier = {
				NOT = {
					OR = {
						TAG = ENG
						TAG = USA
					}
				}
				factor = 0
			}
			modifier = {
				ROOT = { 
					OR = {
						has_government = democratic 
						has_government = neutrality #if nonaligned Japan is the only remaining signatory, dont do weird 
					}
				}
				FROM = { has_government = democratic }
				factor = 0
			}
		}
	
		visible = {
			has_naval_treaty_trigger = yes
		}
	
		complete_effect = {
			FROM = {
				country_event = { id = MTG_naval_treaty.4 }
			}
		}
	}
	MTG_treaty_reduction_mission = {

		icon = generic_naval	
		allowed = {
			always = no
		}
		available = {
			if = {
				limit = { ENG = { has_naval_treaty_trigger = yes } }
				naval_strength_comparison = {
					other = ENG
					ratio < 0.8
					sub_unit_def_weights = {
						carrier = 0.25
						battleship = 1
						battle_cruiser = 0.8
						heavy_cruiser = 0.5
					}
				}
			}
			else_if = {
				limit = { USA = { has_naval_treaty_trigger = yes } }
				naval_strength_comparison = {
					other = USA
					ratio < 0.8
					sub_unit_def_weights = {
						carrier = 0.25
						battleship = 1
						battle_cruiser = 0.8
						heavy_cruiser = 0.5
					}
				}
			}
			else = {
				has_navy_size = {
					type = capital_ship
					size < 20
				}
			}
		}
		days_mission_timeout = 30
	
		visible = {
			
		}
		timeout_effect = {
			every_other_country = {
				limit = {
					has_naval_treaty_trigger = yes
				}
				create_wargoal = {
					type = puppet_wargoal_focus
					target = ROOT
				}
			}
		}
		complete_effect = {
			
		}
	}
	MTG_treaty_reduction_signatory_mission = {

		icon = generic_naval	
		allowed = {
			always = no
		}
		available = {
			if = {
				limit = { ENG = { has_naval_treaty_trigger = yes } }
				naval_strength_comparison = {
					other = ENG
					ratio < 1
					sub_unit_def_weights = {
						carrier = 0.5
						battleship = 1
						battle_cruiser = 0.8
						heavy_cruiser = 0.5
					}
				}
			}
			else_if = {
				limit = { USA = { has_naval_treaty_trigger = yes } }
				naval_strength_comparison = {
					other = USA
					ratio < 1
					sub_unit_def_weights = {
						carrier = 0.5
						battleship = 1
						battle_cruiser = 0.8
						heavy_cruiser = 0.5
					}
				}
			}
			else = {
				has_navy_size = {
					type = capital_ship
					size < 50
				}
			}
		}
		is_good = no
		#activation = {
		#	if = {
		#		limit = { ENG = { has_naval_treaty_trigger = yes } }
		#		naval_strength_comparison = {
		#			other = ENG
		#			ratio > 1.1
		#			sub_unit_def_weights = {
		#				carrier = 0.5
		#				battleship = 1
		#				battle_cruiser = 0.8
		#				heavy_cruiser = 0.5
		#			}
		#		}
		#	}
		#	else_if = {
		#		limit = { USA = { has_naval_treaty_trigger = yes } }
		#		naval_strength_comparison = {
		#			other = USA
		#			ratio > 1.1
		#			sub_unit_def_weights = {
		#				carrier = 0.5
		#				battleship = 1
		#				battle_cruiser = 0.8
		#				heavy_cruiser = 0.5
		#			}
		#		}
		#	}
		#	else = {
		#		has_navy_size = {
		#			type = capital_ship
		#			size > 50
		#		}
		#	}
		#	has_naval_treaty_trigger = yes
		#}
		days_mission_timeout = 30
	
		visible = {
			
		}
		timeout_effect = {
			add_stability = -0.1
			add_political_power = -35
		}
		complete_effect = {
			
		}
	}
	MTG_treaty_renew_mission = {

		icon = generic_naval	
		
		available = {
			hidden_trigger = {
				always = no
			}
		}
		days_mission_timeout = 120
		
		activation = {
			has_naval_treaty_trigger = yes
			has_global_flag = MTG_second_london_conference
		}

		visible = {
			has_naval_treaty_trigger = yes
		}
		timeout_effect = {
			clr_global_flag = MTG_second_london_conference 
		}
		complete_effect = {
			
		}
	}
	MTG_escalator_clause_invocation_mission = {

		icon = generic_naval	
		allowed = {
			always = no
		}
		available = {
			hidden_trigger = {
				always = no
			}
		}
		days_mission_timeout = 365
	
		visible = {
			has_naval_treaty_trigger = yes
		}
		timeout_effect = {
			if = {
				limit = {
					has_idea = MTG_naval_treaty_adherent
				}
				swap_ideas = {
					remove_idea = MTG_naval_treaty_adherent
					add_idea = MTG_naval_treaty_adherent_reduced
				}
			}
			else_if = {
				limit = {
					has_idea = MTG_naval_treaty_cheating
				}
				swap_ideas = {
					remove_idea = MTG_naval_treaty_cheating
					add_idea = MTG_naval_treaty_cheating_reduced
				}
			}
		}
		complete_effect = {
			
		}
	}
}
