MTG_naval_treaties = {

	MTG_abandon_treaty_democratic = {

		icon = generic

		available = {
			OR = {
				threat > 0.2
				has_global_flag = MTG_second_london_conference
			}
		}

		visible = {
			has_naval_treaty_trigger = yes
			OR = {
				has_government = neutrality
			}
		}

		fire_only_once = yes

		cost = 150

		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
				}
			}
		}

		ai_will_do = {
			factor = 0
		}
	}

	MTG_abandon_treaty_fascist = {

		icon = generic

		available = {
			OR = {
				threat > 0.2
				has_global_flag = MTG_second_london_conference
			}
		}

		visible = {
			has_naval_treaty_trigger = yes
			OR = { 
				has_government = absolutist
				has_government = communism
				has_government = fascism
				has_government = radical
			}
		}

		fire_only_once = yes

		cost = 25

		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
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	MTG_cheat_on_treaty = {

		icon = generic

		available = {
			
		}

		visible = {
			OR = {
				has_idea = MTG_naval_treaty_adherent
				has_idea = MTG_naval_treaty_adherent_reduced
			}
			OR = {
				has_government = absolutist
				has_government = communism
				has_government = fascism
				has_government = radical
			}
		}

		fire_only_once = yes

		cost = 50

		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
				}
			}
		}

		ai_will_do = {
			factor = 0
		}
	}

	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 }
				has_navy_size = {
					type = capital_ship
					size > 15
				}
			}
		}

		visible = {
			has_naval_treaty_trigger = yes
		}

		fire_only_once = yes

		cost = 50

		complete_effect = {
			FROM = {
				country_event = MTG_naval_treaty.1
			}
		}

		ai_will_do = {
			factor = 3
			modifier = {
				has_government = democratic
				add = 10
			}
		}
	}

	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
				has_navy_size = {
					type = capital_ship
					size > 20
				}
			}
		}

		visible = {
			has_naval_treaty_trigger = yes
		}

		fire_only_once = yes

		cost = 50

		complete_effect = {
			FROM = {
				country_event = { id = MTG_naval_treaty.4 }
			}
		}

		ai_will_do = {
			factor = 10
		}
	}

	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
						has_navy_size = { 
							type = capital_ship
							size > 50
						}
					}
					AND = {
						has_naval_treaty_trigger = yes
						has_navy_size = {
							type = capital_ship
							size > 50
						}
					}
				}
			}
		}

		visible = {
			has_naval_treaty_trigger = yes
		}

		fire_only_once = yes

		cost = 50

		complete_effect = {
			FROM = {
				country_event = { id = MTG_naval_treaty.4 }
			}
		}

		ai_will_do = {
			factor = 10
		}
	}

	MTG_treaty_reduction_mission = {

		icon = generic_naval

		allowed = {
			always = no
		}

		available = {
			has_navy_size = {
				type = capital_ship
				size < 20
			}
		}

		days_mission_timeout = 30

		visible = {
			
		}

		complete_effect = {
			
		}

		timeout_effect = {
			every_other_country = {
				limit = {
					has_naval_treaty_trigger = yes
				}
				create_wargoal = {
					type = puppet_wargoal_focus
					target = ROOT
				}
			}
		}
	}

	MTG_treaty_reduction_signatory_mission = {

		icon = generic_naval

		is_good = no

		allowed = {
			always = no
		}

		available = {
			has_navy_size = {
				type = capital_ship
				size < 50
			}
		}

		days_mission_timeout = 30

		visible = {
			
		}

		complete_effect = {
			
		}

		timeout_effect = {
			add_stability = -0.1
			add_political_power = -35
		}
	}

	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
		}

		complete_effect = {
			
		}

		timeout_effect = {
			clr_global_flag = MTG_second_london_conference 
		}
	}

	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
		}

		complete_effect = {
			
		}

		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
				}
			}
		}
	}
}

