GUAY_military_coup = {
	
	# Expand the Forestry in Araucania
	GUAY_military_coup_mission  = {
		icon = GFX_decision_revolt 
		allowed = {
			OR = {
				original_tag = URG
				original_tag = PAR
			}
		}
		visible = {
			always = yes
		}
		is_good = no
		available = {   has_completed_focus = GUAY_appease_the_generals }

		activation = {
			has_civil_war = no
			has_completed_focus = GUAY_coup_detat
			NOT = { has_completed_focus = GUAY_appease_the_generals }
		}
		days_mission_timeout = 750
		timeout_effect = {
			start_civil_war = {
				ideology = neutrality
				#ruling_party = <tag_ideology>
				size = 0.6 # (0-1) Size modifier of the revolt. Affects stockpile, army, air and navy as well
			}
		}
	}
}

GUAY_military_play_cat = {
	GUAY_military_play_arg = {
		name = ARMY_ON_BORDER_WAR_TOOLTIP
		allowed = {
			OR = {
				original_tag = URG
				original_tag = PAR
			}
		}
		visible = {
			always = yes
		}

		is_good = no
		available = {
			if = {
				limit = {
					original_tag = PAR
				}

				957 = {
					is_controlled_by = ROOT
				}
			}
			else = {
				510 = {
					is_controlled_by = ROOT
				}
			}

		}
		fire_only_once = yes
		activation = {
			OR = {
				has_war_with = ARG
				any_enemy_country = {
					original_tag = ARG
					ARG = { has_civil_war = yes }
				}
			}
			has_completed_focus = GUAY_rekindle_old_gripes
		}
		days_mission_timeout = 365 #Remember to change loc if needed
		complete_effect = {
			if = {
				limit = { ARG = { has_civil_war = yes } }
				every_country = {
					limit = { original_tag = ARG }
					country_event = { id = JUNO_guay_events.6 hours = 2 } 
				} 
			}
			else = {
				ARG = { country_event = { id = JUNO_guay_events.6 hours = 2 } }
			}
		}
		timeout_effect = {
			add_stability = -0.1
			add_war_support = -0.15
		}
	}

	GUAY_military_play_bra = {
		name = ARMY_ON_BORDER_WAR_TOOLTIP
		allowed = {
			OR = {
				original_tag = URG
				original_tag = PAR
			}
		}
		visible = {
			always = yes
		}
		is_good = no
		available = { 
			if = {
				limit = {
					original_tag = PAR
				}

				504 = {
					is_controlled_by = ROOT
				}
			}
			else = {
				502 = {
					is_controlled_by = ROOT
				}
			}

		}
		fire_only_once = yes
		activation = {
			OR = {
				has_war_with = BRA
				any_enemy_country = {
					original_tag = BRA
					BRA = { has_civil_war = yes }
				}
			}
			has_completed_focus = GUAY_rekindle_old_gripes
		}
		days_mission_timeout = 365
		complete_effect = {
			if = {
				limit = { BRA = { has_civil_war = yes } }
				every_country = {
					limit = { original_tag = BRA }
					country_event = { id = JUNO_guay_events.6 hours = 2 } 
				} 
			}
			else = {
				BRA = { country_event = { id = JUNO_guay_events.6 hours = 2 } }
			}
		}
		timeout_effect = {
			add_stability = -0.1
			add_war_support = -0.15
		}
	}
}


GUAY_meet_with_the_old_powers_cat = {
	GUAY_meet_with_USA = {
		icon = GFX_decision_generic_factory
		priority = 99

		allowed = {
			OR = {
				original_tag = URG
				original_tag = PAR
			}
		}
		visible = {
			always = yes
		}

		available = { 
			USA = {
				exists = yes
				is_subject = no
				has_capitulated = no
				NOT = { has_war_with = ROOT }
			}
		}
		cost = 0
		complete_effect = {
			add_ideas = idea_GUYA_old_powers_USA
			set_variable = { old_power_partner = USA }
		}
	}

	GUAY_meet_with_FRA = {
		icon = GFX_decision_generic_fortification
		priority = 99

		allowed = {
			OR = {
				original_tag = URG
				original_tag = PAR
			}
		}
		visible = {
			always = yes
		}

		available = { 
			FRA = {
				exists = yes
				is_subject = no
				has_capitulated = no
				NOT = { has_war_with = ROOT }
			}
		}
		cost = 0
		complete_effect = {
			add_ideas = idea_GUYA_old_powers_FRA
			set_variable = { old_power_partner = FRA }
		}
	}	



	GUAY_meet_with_ENG = {

		icon = GFX_decision_hol_draw_up_staff_plans
		allowed = {
			OR = {
				original_tag = URG
				original_tag = PAR
			}
		}
		visible = {
			always = yes
		}

		available = { 
			ENG = {
				exists = yes
				is_subject = no
				has_capitulated = no
				NOT = { has_war_with = ROOT }
			}
		}
		cost = 0
		complete_effect = {
			add_ideas = idea_GUYA_old_powers_ENG

			add_doctrine_cost_reduction = {
				cost_reduction = 0.35
				uses = 2
				category = special_forces_doctrine 
				name = idea_GUYA_old_powers_ENG
			}
			set_variable = { old_power_partner = ENG }
		}
	}

	GUAY_meet_with_SOV = {
		icon = GFX_decision_SWE_set_army_budget
		allowed = {
			OR = {
				original_tag = URG
				original_tag = PAR
			}
		}
		visible = {
			always = yes
		}

		available = { 
			SOV = {
				exists = yes
				is_subject = no
				has_capitulated = no
				NOT = { has_war_with = ROOT }
			}
		}
		cost = 0
		complete_effect = {
			add_ideas = idea_GUYA_old_powers_SOV
			set_variable = { old_power_partner = SOV }
		}
	}

	GUAY_meet_with_GER = {
		icon = GFX_decision_ger_reichskommissariats
		allowed = {
			OR = {
				original_tag = URG
				original_tag = PAR
			}
		}
		visible = {
			always = yes
		}

		available = { 
			GER = {
				exists = yes
				is_subject = no
				has_capitulated = no
				NOT = { has_war_with = ROOT }
			}
		}
		cost = 0
		complete_effect = {
			add_ideas = idea_GUYA_old_powers_GER
			set_variable = { old_power_partner = GER }
		}
	}

	GUAY_meet_with_JAP = {
		icon = GFX_decision_jap_conquer_china

		allowed = {
			OR = {
				original_tag = URG
				original_tag = PAR
			}
		}
		visible = {
			always = yes
		}

		available = { 
			JAP = {
				exists = yes
				is_subject = no
				has_capitulated = no
				NOT = { has_war_with = ROOT }
			}
		}
		cost = 0
		complete_effect = {
			add_ideas = idea_GUYA_old_powers_JAP
			set_variable = { old_power_partner = JAP }
		}
	}

	GUAY_meet_with_ITA = {
		icon = GFX_decision_eng_blackshirt_speech
		allowed = {
			OR = {
				original_tag = URG
				original_tag = PAR
			}
		}
		visible = {
			always = yes
		}

		available = { 
			ITA = {
				exists = yes
				is_subject = no
				has_capitulated = no
				NOT = { has_war_with = ROOT }
			}
		}
		cost = 0
		complete_effect = {
			add_ideas = idea_GUYA_old_powers_ITA
			set_variable = { old_power_partner = ITA }
		}
	}
}

GUAY_laissez_faire_cat = {
	GUAY_land_owners_finding_funding  = {
		icon = GFX_decision_gre_paying_ifc_debt
		allowed = {
			OR = {
				original_tag = URG
				original_tag = PAR
			}
		}
		visible = {
			has_war = no 
			is_subject = no
			date < 1942.1.1
		}
		is_good = yes
		available = { hidden_trigger = { always = no } has_war = no is_subject = no date < 1942.1.1 }

		activation = {
			has_completed_focus = GUAY_laissez_faire 
		}
		days_mission_timeout = 270
		timeout_effect = {

			custom_effect_tooltip = GUAY_laissez_faire_stats

			random_state = {
				limit = {
					is_controlled_by = ROOT
					impassable = no
				}
				random_list = {
					seed = random 
					1.5 = {
						modifier = {
							free_building_slots = {
								building = industrial_complex
								size < 1
							}
							factor = 0
						}
						modifier = {
							ROOT = {
								has_completed_focus = GUAY_empower_the_land_owners
							}
							factor = 2.5
						}
						modifier = {
							has_variable = ROOT.is_literally_not_a_factory
							add = var:ROOT.is_literally_not_a_factory
						}
						if = {
							limit = {
								has_variable = ROOT.is_literally_not_a_factory
							}
							clear_variable = ROOT.is_literally_not_a_factory
						}
						add_building_construction = {
							type = industrial_complex
							level = 1
							instant_build = yes
						}

						ROOT = { add_to_variable = { built_a_civ = 1 } }
					}
					1.5 = {
						modifier = {
							free_building_slots = {
								building = arms_factory
								size < 1  
							}
							factor = 0
						}
						modifier = {
							ROOT = {
								has_completed_focus = GUAY_empower_the_land_owners
							}
							factor = 2.5
						}
						modifier = {
							has_variable = ROOT.is_literally_not_a_factory
							add = var:ROOT.is_literally_not_a_factory
						}
						if = {
							limit = {
								has_variable = ROOT.is_literally_not_a_factory
							}
							clear_variable = ROOT.is_literally_not_a_factory
						}

						add_building_construction = {
							type = arms_factory
							level = 1
							instant_build = yes
						}

						ROOT = { add_to_variable = { built_a_mil = 1 } }
					}
					2 = {
						modifier = {
							free_building_slots = {
								building = dockyard
								size < 1 
							}
							factor = 0
						}
						modifier = {
							ROOT = {
								any_core_state = {
									is_coastal = no
								}
							}
							factor = 0
						}
						add_building_construction = {
							type = dockyard
							level = 1
							instant_build = yes
						}
						modifier = {
							ROOT = {
								has_completed_focus = GUAY_empower_the_land_owners
							}
							factor = 2.5
						}
						add_to_variable = { ROOT.is_literally_not_a_factory = 0.1 }
						ROOT = { add_to_variable = { built_a_dockyard = 1 } }
					}
					3 = {
						modifier = {
							infrastructure > 4
							factor = 0
						}
						add_building_construction = {
							type = infrastructure
							level = 1
							instant_build = yes
						}
						add_to_variable = { ROOT.is_literally_not_a_factory = 0.15 }
						ROOT = { add_to_variable = { built_a_infra = 1 } }
					}
					3 = {
						modifier = {
							air_base > 9
							factor = 0
						}
						add_building_construction = {
							type = air_base
							level = 1
							instant_build = yes
						}
						add_to_variable = { ROOT.is_literally_not_a_factory = 0.25 }
						ROOT = { add_to_variable = { built_an_airbase = 1 } }
					}

					3 = {
						modifier = {
							anti_air_building > 4
							factor = 0
						}

						modifier = {
							ROOT = { NOT = {  has_tech = interwar_antiair } }
							factor = 0
						}
						add_building_construction = {
							type = anti_air_building
							level = 1
							instant_build = yes
						}
						add_to_variable = { ROOT.is_literally_not_a_factory = 0.2 }
						ROOT = { add_to_variable = { built_an_aa = 1 } }
					}

					2 = {
						modifier = {
							radar_station > 4
							factor = 0
						}

						modifier = { #level 1
							ROOT = { NOT = {  has_tech = radio_detection } }
							factor = 0
						}

						modifier = { #level 2
							radar_station > 0
							ROOT = { NOT = {  has_tech = cavity_magnatron } }
							factor = 0
						}

						#modifier = { #level 3
						#	radar_station > 2
						#	ROOT = { NOT = {  has_tech = improved_cavity_magnatron } }
						#	factor = 0
						#}

						modifier = { #level 4
							radar_station > 3
							ROOT = { NOT = {  has_tech = centimetric_radar } }
							factor = 0
						}
						modifier = { #level 5
							radar_station > 4
							ROOT = { NOT = {  has_tech = phased_array } }
							factor = 0
						}

						modifier = { #level 6
							radar_station > 4
							ROOT = { NOT = {  has_tech = monopulse_radar } }
							factor = 0
						}

						add_building_construction = {
							type = radar_station
							level = 1
							instant_build = yes
						}
						add_to_variable = { ROOT.is_literally_not_a_factory = 0.25 }
						ROOT = { add_to_variable = { built_a_radar = 1 } }
					}

					0.1 =	{
						add_building_construction = {
							type = supply_node
							province = {
								all_provinces = yes
							}
							level = 1
							instant_build = yes
						}
						add_to_variable = { ROOT.is_literally_not_a_factory = 0.2 }
						ROOT = { add_to_variable = { built_a_hub = 1 } }
					}

					2 = {
						modifier = {
							free_building_slots = {
								building = industrial_complex
								size < 1 
							}
							factor = 2
						}
						modifier = {
							ROOT = {
								has_completed_focus = GUAY_empower_the_land_owners
							}
							factor = 2.5
						}
						add_extra_state_shared_building_slots = 1
						add_to_variable = { ROOT.is_literally_not_a_factory = 0.1 }
						ROOT = { add_to_variable = { added_slot = 1 } }

					}
				}
					
			}
			activate_mission = GUAY_land_owners_finding_funding
		}
	}
}

form_liga_federal_cat = {

	form_liga_federal_dec = {

		icon = generic_form_nation

		allowed = {
			original_tag = URG
			has_dlc = "Trial of Allegiance"
		}

		available = {
			is_subject = no
			controls_state = 946
			controls_state = 300
			controls_state = 945
			controls_state = 510
			controls_state = 956

		}

		visible = {
			original_tag = URG
			NOT = { has_global_flag = form_liga_federal_flag }
		}

		complete_effect = {
			set_cosmetic_tag = LGF_UNIFIED
			510 = { add_core_of = ROOT }
			956 = { add_core_of = ROOT }

			hidden_effect = {
				#news_event = { id = wtt_news.55 hours = 6 }
				set_global_flag = form_liga_federal_flag
			}
		}

		ai_will_do = {
			factor = 200
			modifier = {
				factor = 0
				is_historical_focus_on = yes
			}
		}
	}
}