###########################
# Mexico Events
# By Tristan 'Enjoy' Edge, aged 30 and 2 months
###########################

add_namespace = mexico

# General Cedillo revolts

#country_event = {
#	id = mexico.1
#	title = mexico.1.title
#	desc = mexico.1.desc
#	
#	picture = GFX_report_event_yugoslavian_cavalry
#	
#	fire_only_once = yes
#	
#	is_triggered_only = yes
#		
#	immediate = {
#		set_global_flag = flag_mexico_cedillo_has_revolted
#		hidden_effect = {
#			if = {
#				limit = {
#					has_government = neutrality
#				}
#				set_variable = {
#					var = civil_war_size_var
#					value = party_popularity@fascism
#				}
#				start_civil_war = {
#					ideology = fascism
#					size = civil_war_size_var
#					keep_unit_leaders = { 700 701 702 703 704 705 706 707 708 709 710 711 712 }
#					states = { 479 480 }
#				}
#			}
#			if = {
#				limit = {
#					NOT = { has_government = neutrality }
#				}
#				set_variable = {
#					var = civil_war_size_var
#					value = party_popularity@neutrality
#				}
#				start_civil_war = {
#					ideology = neutrality
#					size = civil_war_size_var
#					keep_unit_leaders = { 700 701 702 703 704 705 706 707 708 709 710 711 712 }
#					states = { 479 480 }
#				}
#			}
#			random_other_country = {
#				limit = {
#					original_tag = MEX
#					has_war_with = ROOT
#				}
#				hidden_effect = {
#					division_template = {
#						name = "Brigada de Infanteria"
#						division_names_group = SPAN_INFB_01
#						regiments = {
#							infantry = { x = 0 y = 0 }
#							infantry = { x = 0 y = 1 }
#							infantry = { x = 0 y = 2 }
#						}
#						priority = 0
#					}
#					random_owned_controlled_state = {
#						create_unit = {
#							division = "division_template = \"Brigada de Infanteria\" start_experience_factor = 0.2 force_equipment_variants = { infantry_equipment_0 = { owner = \"GER\" } }"
#							owner = PREV
#						}
#					}
#					random_owned_controlled_state = {
#						create_unit = {
#							division = "division_template = \"Brigada de Infanteria\" start_experience_factor = 0.2 force_equipment_variants = { infantry_equipment_0 = { owner = \"ENG\" } }"
#							owner = PREV
#						}
#					}
#					random_owned_controlled_state = {
#						create_unit = {
#							division = "division_template = \"Brigada de Infanteria\" start_experience_factor = 0.2 force_equipment_variants = { infantry_equipment_0 = { owner = \"USA\" } }"
#							owner = PREV
#						}
#					}
#					random_owned_controlled_state = {
#						create_unit = {
#							division = "division_template = \"Brigada de Infanteria\" start_experience_factor = 0.2 force_equipment_variants = { infantry_equipment_0 = { owner = \"GER\" } }"
#							owner = PREV
#						}
#					}
#					random_owned_controlled_state = {
#						create_unit = {
#							division = "division_template = \"Brigada de Infanteria\" start_experience_factor = 0.2 force_equipment_variants = { infantry_equipment_0 = { owner = \"ENG\" } }"
#							owner = PREV
#						}
#					}
#					random_owned_controlled_state = {
#						create_unit = {
#							division = "division_template = \"Brigada de Infanteria\" start_experience_factor = 0.2 force_equipment_variants = { infantry_equipment_0 = { owner = \"USA\" } }"
#							owner = PREV
#						}
#					}
#					random_owned_controlled_state = {
#						create_unit = {
#							division = "division_template = \"Brigada de Infanteria\" start_experience_factor = 0.2 force_equipment_variants = { infantry_equipment_0 = { owner = \"GER\" } }"
#							owner = PREV
#						}
#					}
#					random_owned_controlled_state = {
#						create_unit = {
#							division = "division_template = \"Brigada de Infanteria\" start_experience_factor = 0.2 force_equipment_variants = { infantry_equipment_0 = { owner = \"ENG\" } }"
#							owner = PREV
#						}
#					}
#					random_owned_controlled_state = {
#						create_unit = {
#							division = "division_template = \"Brigada de Infanteria\" start_experience_factor = 0.2 force_equipment_variants = { infantry_equipment_0 = { owner = \"USA\" } }"
#							owner = PREV
#						}
#					}
#					random_owned_controlled_state = {
#						create_unit = {
#							division = "division_template = \"Brigada de Infanteria\" start_experience_factor = 0.2 force_equipment_variants = { infantry_equipment_0 = { owner = \"USA\" } }"
#							owner = PREV
#						}
#					}
#				}
#				add_field_marshal_role = {
#					character = MEX_saturnino_cedillo
#					traits = { trait_reckless }
#					skill = 3
#					attack_skill = 4
#					defense_skill = 2
#					planning_skill = 2
#					logistics_skill = 2
#				}
#				add_corps_commander_role = { # Fictitious
#					character = MEX_manuel_sanchez
#					traits = { harsh_leader }
#					skill = 3
#					attack_skill = 2
#					defense_skill = 2
#					planning_skill = 3
#					logistics_skill = 3
#				}
#				if = {
#					limit = {
#						has_government = neutrality
#					}
#					add_country_leader_role = {
#						character = MEX_saturnino_cedillo
#						country_leader = {
#							expire = "1965.1.1"
#							ideology = despotism
#							traits = {
#								strongman_of_san_luis_potosi
#							}
#						}
#						promote_leader = yes
#					}
#				}
#				if = {
#					limit = {
#						has_government = fascism
#					}
#					add_country_leader_role = {
#						character = MEX_saturnino_cedillo
#						country_leader = {
#							expire = "1965.1.1"
#							ideology = fascism_ideology
#							traits = {
#								strongman_of_san_luis_potosi
#							}
#						}
#						promote_leader = yes
#					}
#				}
#			}
#		}
#	}
#	
#	option = {
#		name = mexico.1.a
#	}
#}

# Mexico has nationalised the oil fields, Britain and America are informed that their oil companies are demanding compensation

country_event = {
	id = mexico.2
	title = mexico.2.title
	desc = mexico.2.desc
	
	picture = GFX_report_event_journalists_speech
	
	is_triggered_only = yes

	option = {
		name = mexico.2.a
		
		add_political_power = -25
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 10
				FROM = {
					has_government = ROOT
				}
			}
			modifier = {
				factor = 0.1
				FROM = {
					is_enemy_ideology = yes
				}
			}
		}
	}
	option = {
		name = mexico.2.b
		
		add_opinion_modifier = {
			target = FROM
			modifier = embargo
		}
		
		FROM = {
			send_embargo = ROOT
			custom_effect_tooltip = embargo_relation_tt
			country_event = {
				days = 1
				id = mexico.3
			}
		}
		ai_chance = {
			factor = 80
			modifier = {
				factor = 0.5
				has_war = yes
			}
			modifier = {
				factor = 0
				has_government = communism
				FROM = {
					has_government = communism
				}
			}
		}
	}
	option = {
		name = mexico.2.c
		
		add_stability = -0.1
		add_war_support = -0.1
		
		create_wargoal = {
			type = puppet_wargoal_focus
			target = FROM
		}
		
		add_opinion_modifier = {
			target = FROM
			modifier = embargo
		}
		
		FROM = {
			add_opinion_modifier = {
				target = ROOT
				modifier = embargo
			}
			country_event = {
				days = 1
				id = mexico.3
			}
		}
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				has_stability < 0.4
			}
			modifier = {
				factor = 0
				has_war_support < 0.4
			}
			modifier = {
				factor = 0
				has_war = yes
			}
			modifier = {
				factor = 0
				is_historical_focus_on = yes
			}
			modifier = {
				factor = 0
				has_government = communism
				FROM = {
					has_government = communism
				}
			}
		}
	}
}

# Mexico is informed that they are under embargo

country_event = {
	id = mexico.3
	title = mexico.3.title
	desc = mexico.3.desc
	
	picture = GFX_report_event_merchant_ship_01
	
	is_triggered_only = yes

	option = {
		name = mexico.3.a

		if = {
			limit = {
				NOT = {
					has_global_flag = flag_mexico_embargo_has_incited_cedillo
				}
			}
			set_global_flag = flag_mexico_embargo_has_incited_cedillo
			MEX_increase_cedillo_tension = yes # Supposedly, Cedillo rebelled because he thought the imperial powers would support him after the oil nationalisation
		}
	}
}

# Mexico has compensated the oil firms, Britain and America are informed and must lift any embargo or face political pressure

country_event = {
	id = mexico.4
	title = mexico.4.title
	desc = mexico.4.desc
	
	picture = GFX_report_event_FDR_speech
	
	is_triggered_only = yes

	option = {
		name = mexico.4.a
		
		if = {
			limit = {
				has_opinion_modifier = embargo
			}
			
			remove_opinion_modifier = { target = FROM modifier = embargo }
			
			FROM = {
				remove_opinion_modifier = { target = ROOT modifier = embargo }
			}
		}
		
		ai_chance = {
			factor = 80
		}
	}
	option = {
		name = mexico.4.b
		
		trigger = {
			has_opinion_modifier = embargo
		}
		
		add_political_power = -25
		
		ai_chance = {
			factor = 20
			modifier = {
				factor = 0.1
				has_war = yes
			}
			modifier = {
				factor = 0.5
				tag = USA
				is_historical_focus_on = yes
			}
		}
	}
}

# Mexico asks to join someone's faction via focus

country_event = {
	id = mexico.8
	title = mexico.8.title
	desc = mexico.8.desc
	
	picture = GFX_report_event_canadian_tank
	
	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			save_event_target_as = alliance_inviter
			FROM = { save_event_target_as = alliance_applicant }
		}
	}
	
	option = {
		name = mexico.8.a
		
		if = {
			limit = {
				original_tag = ENG
			}
			add_to_tech_sharing_group = MEX_ENG_tech_group
			
			FROM = {
				add_to_tech_sharing_group = MEX_ENG_tech_group
			}
		}
		
		if = {
			limit = {
				original_tag = GER
			}
			add_to_tech_sharing_group = MEX_GER_tech_group
			
			FROM = {
				add_to_tech_sharing_group = MEX_GER_tech_group
			}
		}
		
		if = {
			limit = {
				original_tag = SOV
			}
			add_to_tech_sharing_group = MEX_SOV_tech_group
			
			FROM = {
				add_to_tech_sharing_group = MEX_SOV_tech_group
			}
		}
		
		if = {
			limit = {
				original_tag = USA
			}
			add_to_tech_sharing_group = MEX_USA_tech_group
			
			FROM = {
				add_to_tech_sharing_group = MEX_USA_tech_group
			}
		}
		
		if = {
			limit = {
				is_faction_leader = yes
			}
			add_to_faction = FROM
			hidden_effect = {
				news_event = { id = news.289 hours = 12 }
			}
			FROM = { country_event = { id = generic.3 hours = 6 } }
		}
		
		if = {
			limit = {
				is_faction_leader = no
			}
			random_other_country = {
				limit = {
					is_in_faction_with = ROOT
					is_faction_leader = yes
				}
				country_event = {
					id = mexico.9
					days = 1
				}
			}
		}
		
		ai_chance = {
			factor = 75
			modifier = {
				factor = 2.0
				has_war = yes
			}
			modifier = {
				factor = 0.5
				MEX = {
					has_war = yes
					any_enemy_country = {
						NOT = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 0
				MEX = {
					has_war = yes
					any_enemy_country = {
						NOT = {
							has_war_with = ROOT
						}
						OR = {
							has_government = ROOT
							is_major = yes
						}
					}
				}
			}
		}
	}
	
	option = {
		name = mexico.8.b
		
		FROM = { 
			country_event = { id = generic.4 hours = 6 }
		}
		
		ai_chance = {
			factor = 25
			modifier = {
				factor = 0.1
				MEX = {
					OR = {
						has_government = ROOT
						is_major = yes
						is_ai = no
					}
				}
			}
		}
	}
}

# Mexico is being sponsored to join a faction by a third party (ENG/GER/SOV/USA)
# Attempt to catch a request to USA going to ENG, but knowing HoI4 anything could happen

country_event = {
	id = mexico.9
	title = mexico.9.title
	desc = mexico.9.desc
	
	picture = GFX_report_event_soviet_soldiers_tank
	
	is_triggered_only = yes
	
	immediate = {
		hidden_effect = {
			save_event_target_as = alliance_inviter
		}
	}
	
	option = {
		name = mexico.9.a

		add_to_faction = MEX
				
		hidden_effect = {
			news_event = { id = news.289 hours = 12 }
		}
		
		MEX = { country_event = { id = generic.3 hours = 6 } }
		
		ai_chance = {
			factor = 90
			modifier = {
				factor = 2.0
				has_war = yes
			}
			modifier = {
				factor = 0.5
				MEX = {
					has_war = yes
					any_enemy_country = {
						NOT = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 0
				MEX = {
					has_war = yes
					any_enemy_country = {
						NOT = {
							has_war_with = ROOT
						}
						OR = {
							has_government = ROOT
							is_major = yes
						}
					}
				}
			}
		}
	}
	
	option = {
		name = mexico.9.b
				
		FROM = { 
			country_event = { id = generic.4 hours = 6 }
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0.1
				MEX = {
					OR = {
						has_government = ROOT
						is_major = yes
						is_ai = no
					}
				}
			}
		}
	}
}

# Mexico invites a Latin American country to join its right-wing faction, the Latin American Order

country_event = {
	id = mexico.10
	title = mexico.10.title
	desc = mexico.10.desc
	
	picture = GFX_report_event_generic_read_write
	
	is_triggered_only = yes

	option = {
		name = mexico.10.a

		set_country_flag = flag_joined_mexican_faction # Used to turn on an AI strategy to stay in Mexico's faction
		
		FROM = {
			add_to_faction = ROOT
			country_event = { id = generic.6 hours = 6 } 
		}
		
		ai_chance = {
			factor = 75
			modifier = {
				factor = 2.0
				has_war = yes
			}
			modifier = {
				factor = 0.5
				NOT = {
					has_government = FROM
				}
			}
			modifier = {
				factor = 0.1
				is_historical_focus_on = yes
				NOT = {
					has_government = FROM
				}
			}
			modifier = {
				factor = 0.5
				MEX = {
					has_war = yes
					any_enemy_country = {
						NOT = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 0
				MEX = {
					has_war = yes
					any_enemy_country = {
						NOT = {
							has_war_with = ROOT
						}
						OR = {
							has_government = ROOT
							is_major = yes
						}
					}
				}
			}
		}
	}
	
	option = {
		name = mexico.10.b
		
		FROM = {
			country_event = { id = generic.7 hours = 6 }
		}
		
		ai_chance = {
			factor = 25
		}
	}
}

# Mexico invites a Latin American country to join its left-wing faction, the Bolivarian Alliance

country_event = {
	id = mexico.11
	title = mexico.11.title
	desc = mexico.11.desc
	
	picture = GFX_report_event_generic_communist_congress
	
	is_triggered_only = yes

	option = {
		name = mexico.11.a
		
		set_country_flag = flag_joined_mexican_faction # Used to turn on an AI strategy to stay in Mexico's faction

		FROM = {
			add_to_faction = ROOT
			country_event = { id = generic.6 hours = 6 } 
		}
		
		ai_chance = {
			factor = 75
			modifier = {
				factor = 2.0
				has_war = yes
			}
			modifier = {
				factor = 0.5
				NOT = {
					has_government = FROM
				}
			}
			modifier = {
				factor = 0.1
				is_historical_focus_on = yes
				NOT = {
					has_government = FROM
				}
			}
			modifier = {
				factor = 0.5
				MEX = {
					has_war = yes
					any_enemy_country = {
						NOT = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 0
				MEX = {
					has_war = yes
					any_enemy_country = {
						NOT = {
							has_war_with = ROOT
						}
						OR = {
							has_government = ROOT
							is_major = yes
						}
					}
				}
			}
		}
	}
	
	option = {
		name = mexico.11.b
		
		FROM = {
			country_event = { id = generic.7 hours = 6 }
		}
		
		ai_chance = {
			factor = 25
		}
	}
}

# Mexico asks Britain to sell Belize after aligning towards them

country_event = {
	id = mexico.12
	title = mexico.12.title
	desc = mexico.12.desc
	
	picture = GFX_report_event_generic_conference
	
	is_triggered_only = yes
	
	option = {
		name = mexico.12.a
		
		311 = {
			set_state_name = "Belice"
		}
		
		add_political_power = 25
		
		MEX = {
			transfer_state = 311
			add_state_core = 311
			country_event = {
				id = mexico.13
				days = 1
			}
		}
		
		ai_chance = {
			factor = 50
			
			modifier = {
				factor = 2.0
				has_government = FROM
			}
			
			modifier = {
				factor = 2.0
				is_in_faction_with = FROM
			}
		}
	}
	
	option = {
		name = mexico.12.b
		
		MEX = {
			country_event = {
				id = mexico.14
				days = 1
			}
		}
		
		ai_chance = {
			factor = 50
			
			modifier = {
				factor = 2.0
				has_war = yes
			}
		}
	}
}

# Mexico is informed that Belize was granted to them

country_event = {
	id = mexico.13
	title = mexico.13.title
	desc = mexico.13.desc
	
	picture = GFX_report_event_generic_read_write
	
	is_triggered_only = yes

	option = {
		name = mexico.13.a
	}
}

# Mexico is informed Britain refused to turn over Belize

country_event = {
	id = mexico.14
	title = mexico.14.title
	desc = mexico.14.desc
	
	picture = GFX_report_event_british_inspect_troops
	
	is_triggered_only = yes

	option = {
		name = mexico.14.a
	}
}

# Archbishop Pascual Diaz y Barreto passes away

country_event = {
	id = mexico.15
	title = mexico.15.title
	desc = mexico.15.desc
	
	picture = GFX_report_event_europe_funeral
	
	fire_only_once = yes
	
	trigger = {
		tag = MEX
		has_dlc = "Man the Guns"
	}
	
	mean_time_to_happen = {
		months = 6 # Historically died in May 1936
	}
	
	option = {
		name = mexico.15.a # Rest in peace
		
		MEX_increase_church_power = yes
		
		ai_chance = {
			factor = 90
			modifier = {
				factor = 0.1
				has_completed_focus = MEX_focus_state_education
			}
			modifier = {
				factor = 10
				has_active_mission = MEX_mission_second_cristiada
			}
			modifier = {
				factor = 10
				OR = {
					has_idea = MEX_church_power_2
					has_idea = MEX_church_power_1
				}
				NOT = { has_global_flag = flag_second_mexican_civil_war }
			}
		}
	}
	option = {
		name = mexico.15.b # Burn in hell
		
		MEX_decrease_church_power = yes
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0.1
				has_completed_focus = MEX_focus_antidisestablishmentarianism
			}
			modifier = {
				factor = 10
				has_active_mission = MEX_mission_second_revolution
			}
			modifier = {
				factor = 10
				OR = {
					has_idea = MEX_church_power_4
					has_idea = MEX_church_power_5
				}
				NOT = { has_global_flag = flag_second_mexican_civil_war }
			}
		}
	}
}

# Oil worker strike

country_event = {
	id = mexico.16
	title = mexico.16.title
	desc = mexico.16.desc
	
	picture = GFX_report_event_american_hunger_march
	
	fire_only_once = yes
	
	trigger = {
		tag = MEX
		
		date > 1937.1.1
		
		NOT = {
			OR = {
				has_completed_focus = MEX_focus_strike_breaking

				has_completed_focus = MEX_focus_royal_dutch_shell
				
				has_completed_focus = MEX_focus_nationalize_the_oil_fields
				
				focus_progress = {
					focus = MEX_focus_royal_dutch_shell
					progress > 0.01
				}
				
				focus_progress = {
					focus = MEX_focus_nationalize_the_oil_fields
					progress > 0.01
				}
			}
		}
		has_dlc = "Man the Guns"
	}
	
	mean_time_to_happen = {
		months = 12 # Historically started in November 1937
	}
	
	option = {
		name = mexico.16.a # Support the strikers
		
		if = {
			limit = {
				OR = {
					has_idea = MEX_cedillo_tension
					has_idea = MEX_cedillo_tension_2
					has_idea = MEX_cedillo_tension_3
				}
			}
			MEX_increase_cedillo_tension = yes # Supposedly, Cedillo rebelled because he thought the imperial powers would support him after the oil nationalisation
			add_political_power = -100
		}
		else = {
			add_political_power = -150
		}
		
		ai_chance = {
			factor = 100
		}
	}

	option = {
		name = mexico.16.b # Support the oil companies
		
		add_stability = -0.05
		
		ai_chance = {
			factor = 0
		}
	}
}

# Trotsky arrives from Norway

country_event = {
	id = mexico.17
	title = mexico.17.title
	desc = mexico.17.desc
	
	picture = GFX_report_event_communists_cheer
	
	is_triggered_only = yes

	fire_only_once = yes
	
	trigger = {  
		OR = {
			has_government = neutrality
			AND = {
				has_government = communism
				NOT = {
					has_country_leader = { ruling_only = yes character = MEX_dionisio_encina }
				} 
			}
		}
		NOT = {
			has_global_flag = trotsky_not_welcome_in_mexico
		}
		NOT = {
			SOV_is_left_opposition = yes 
			NOT = { SOV_soviet_civil_war_not_started = yes } # IF the civil war has already started, and Left Opposition has risen up, Trotsky probably won't appear in Mexico
		}
		NOT = {
			has_global_flag = flag_trotsky_dead
		}
	}

	option = {
		name = mexico.17.a # We aren't Stalin's puppets, let him stay
		
		if = {
			limit = {
				SOV = {
					has_country_leader = { character = SOV_iosif_stalin }
				}
			}
			SOV = {
				add_opinion_modifier = {
					target = ROOT
					modifier = mexico_trotskyite_wreckers
				}
			}
		}
		USA = {
			add_opinion_modifier = {
				target = ROOT
				modifier = mexico_snubbed_stalin
			}
		}
		set_global_flag = trotsky_exile_mexico
		set_global_flag = AAT_trotsky_in_mexico
		ai_chance = {
			factor = 1
			
			modifier = {
				add = 100
				OR = {
					has_game_rule = {
						rule = MEX_ai_behavior
						option = DEFAULT
					}
					has_country_flag = MEX_AI_SECULAR_REPUBLIC 
					has_game_rule = {
						rule = MEX_ai_behavior
						option = SECULAR_REPUBLIC
					}
					has_country_flag = MEX_AI_SOCIAL_CATHOLICISM 
					has_game_rule = {
						rule = MEX_ai_behavior
						option = SOCIAL_CATHOLICISM
					}
					has_country_flag = MEX_AI_FASCIST_DICTATORSHIP 
					has_game_rule = {
						rule = MEX_ai_behavior
						option = FASCIST_DICTATORSHIP
					}
				}
			}
			
			modifier = {
				add = 100
				is_historical_focus_on = yes
				NOT = {
					OR = {
						has_country_flag = MEX_AI_THEOCRATIC_ORDER 
						has_game_rule = {
							rule = MEX_ai_behavior
							option = THEOCRATIC_ORDER
						}
						has_country_flag = MEX_AI_SOVIET_REPUBLIC 
						has_game_rule = {
							rule = MEX_ai_behavior
							option = SOVIET_REPUBLIC
						}
						has_country_flag = MEX_AI_CARDENISMO 
						has_game_rule = {
							rule = MEX_ai_behavior
							option = CARDENISMO
						}
					}
				}
			}
		}
	}
	
	option = {
		trigger = {
			SOV = {
				has_country_leader = { character = SOV_iosif_stalin }
			}
			NOT = {
				has_war_with = SOV
			}
		}
		
		name = mexico.17.b # Send him to Stalin to face trial for his crimes
				
		if = {
			limit = {
				SOV = {
					has_country_leader = { character = SOV_iosif_stalin }
				}
				NOT = {
					has_country_leader = {
						character = MEX_hernan_laborde
						ruling_only = yes
					}
				}
			}
			SOV = {
				add_opinion_modifier = {
					target = ROOT
					modifier = mexico_extradited_trotsky
				}
				country_event = {
					id = mexico.21
					days = 1
				}
			}
		}
		USA = {
			add_opinion_modifier = {
				target = ROOT
				modifier = mexico_communist_menace
			}
		}
		ai_chance = {
			factor = 0
			
			modifier = {
				add = 100
				OR = {
					has_country_flag = MEX_AI_THEOCRATIC_ORDER 
					has_game_rule = {
						rule = MEX_ai_behavior
						option = THEOCRATIC_ORDER
					}
					has_country_flag = MEX_AI_SOVIET_REPUBLIC 
					has_game_rule = {
						rule = MEX_ai_behavior
						option = SOVIET_REPUBLIC
					}
				}
			}
		}
	}
	
	option = {
		name = mexico.17.c # Invite him to join the government
		
		trigger = {
			OR = {
				has_government = communism
				has_government = neutrality
			}
			has_dlc = "Man the Guns"
		}
		
		custom_effect_tooltip = available_chief_of_army
		show_ideas_tooltip = MEX_leon_trotsky
		
		add_stability = -0.03
		
		if = {
			limit = {
				SOV = {
					has_country_leader = { character = SOV_iosif_stalin }
				}
			}
			SOV = {
				add_opinion_modifier = {
					target = ROOT
					modifier = mexico_trotskyite_wreckers
				}
			}
		}
		USA = {
			add_opinion_modifier = {
				target = ROOT
				modifier = mexico_communist_menace
			}
		}
		
		set_global_flag = flag_mexico_invited_trotsky_to_government
		set_global_flag = AAT_trotsky_in_mexico
		
		ai_chance = {
			factor = 0
			
			modifier = {
				add = 100
				OR = {
					has_country_flag = MEX_AI_CARDENISMO 
					has_game_rule = {
						rule = MEX_ai_behavior
						option = CARDENISMO
					}
				}
			}
		}
	}
}

# The 1940 election begins
# First the player is asked if he wants to change the law to remain in office a second term
# Doing so is likely to incite a second revolution (Diaz reigned for 30 years)

country_event = {
	id = mexico.18
	title = mexico.18.title
	desc = mexico.18.desc
	
	picture = GFX_report_event_election_vote
	
	is_triggered_only = yes

	trigger = {
		original_tag = MEX
		date < 1942.1.1
		has_dlc = "Man the Guns"
	}
	
	option = {
		name = mexico.18.a
		
		country_event = {
			id = mexico.19
			days = 1
		}
		
		ai_chance = {
			factor = 75
		}
	}
	
	option = {
		name = mexico.18.b
		
		trigger = {
			NOT = {
				has_government = democratic
			}
		}
		
		add_stability = -0.03
		
		if = {
			limit = {
				has_government = neutrality
			}
			set_politics = {
				ruling_party = neutrality
				elections_allowed = no
			}
		}
		
		if = {
			limit = {
				has_government = fascism
			}
			set_politics = {
				ruling_party = fascism
				elections_allowed = no
			}
		}
		
		if = {
			limit = {
				has_government = communism
			}
			set_politics = {
				ruling_party = communism
				elections_allowed = no
			}
		}
		
		ai_chance = {
			factor = 25
			
			modifier = {
				factor = 0
				is_historical_focus_on = yes
			}
		}
	}
}

# The successor is now selected. Will depend on the choice of policies and current leader.
# The previous event implies the law on successors is being strictly applied so candidates are not eligible if they have been president before!

country_event = {
	id = mexico.19
	title = mexico.19.title
	desc = mexico.19.desc
	
	picture = GFX_report_event_election_vote
	
	is_triggered_only = yes
	
	# Neutrality
	
	option = { # Left-wing successor: Francisco Mugica
		name = mexico.19.a
		
		trigger = {
			NOT = {
				has_country_leader = {
					character = MEX_francisco_mugica
				}
			}
			has_government = neutrality
		}

		add_country_leader_role = {
			character = MEX_francisco_mugica
			country_leader = {
				expire = "1965.1.1"
				ideology = moderatism
				traits = {
					revolutionary_general
				}
			}
			promote_leader = yes
		}
		
		hidden_effect = { # Juan Andreu complains he was not selected
			if = {
				limit = {
					USA = {
						is_subject = no
						exists = yes
						NOT = {
							has_war_with = ROOT
						}
					}
				}
				country_event = {
					id = mexico.20
					days = 1
				}
			}
		}
	}
	
	option = { # Compromise successor: Manuel Avila
		name = mexico.19.b
		
		trigger = {
			NOT = {
				has_country_leader = {
					character = MEX_manuel_avila_camacho
				}
			}
			has_government = neutrality
		}

		add_country_leader_role = {
			character = MEX_manuel_avila_camacho
			country_leader = {
				expire = "1965.1.1"
				ideology = oligarchism
				traits = {
					the_gentleman_president
				}
			}
			promote_leader = yes
		}
		
		hidden_effect = { # Juan Andreu complains he was not selected
			if = {
				limit = {
					USA = {
						is_subject = no
						exists = yes
						NOT = {
							has_war_with = ROOT
						}
					}
				}
				country_event = {
					id = mexico.20
					days = 1
				}
			}
		}
	}
	
	option = { # Right-wing successor: Saturnino Cedillo
		name = mexico.19.c
		
		trigger = {
			NOT = {
				has_global_flag = flag_mexico_cedillo_has_revolted
			}
			has_completed_focus = MEX_focus_support_general_cedillo
			NOT = {
				has_country_leader = {
					character = MEX_saturnino_cedillo
				}
			}
			has_government = neutrality
		}

		add_country_leader_role = {
			character = MEX_saturnino_cedillo
			country_leader = {
				expire = "1965.1.1"
				ideology = despotism
				traits = {
					strongman_of_san_luis_potosi
				}
			}
			promote_leader = yes
		}
	}
	
	#option = { # Far-right candidate: Juan Andreu
	#	name = mexico.19.d
	#	
	#	trigger = {
	#		NOT = {
	#			has_country_leader = {
	#				character = MEX_juan_andreu
	#			}
	#		}
	#		has_government = neutrality
	#	}

	#	add_country_leader_role = {
	#		character = MEX_juan_andreu
	#		country_leader = {
	#			expire = "1965.1.1"
	#			ideology = oligarchism
	#			traits = {
	#				the_silver_president
	#			}
	#		}
	#		promote_leader = yes
	#	}
	#}

	# Democratic
	
	option = { # Far-left successor: Vicente Lombardo
		name = mexico.19.e
		
		trigger = {
			has_completed_focus = MEX_focus_confederation_of_mexican_workers
			NOT = {
				has_country_leader = {
					character = MEX_vicente_lombardo
				}
			}
			has_government = democratic
		}

		add_country_leader_role = {
			character = MEX_vicente_lombardo
			country_leader = {
				expire = "1965.1.1"
				ideology = socialism
				traits = {
					the_dean_of_mexican_marxism
				}
			}
			promote_leader = yes
		}
		
		hidden_effect = { # Juan Andreu complains he was not selected
			if = {
				limit = {
					USA = {
						is_subject = no
						exists = yes
						NOT = {
							has_war_with = ROOT
						}
					}
				}
				country_event = {
					id = mexico.20
					days = 1
				}
			}
		}
		
		ai_chance = {
			factor = 10
		}
	}
	
	option = { # Left-wing successor: Francisco Mugica
		name = mexico.19.f
		
		trigger = {
			NOT = {
				has_country_leader = {
					character = MEX_francisco_mugica
				}
			}
			has_government = democratic
		}

		add_country_leader_role = {
			character = MEX_francisco_mugica
			country_leader = {
				expire = "1965.1.1"
				ideology = socialism
				traits = {
					revolutionary_general
				}
			}
			promote_leader = yes
		}
		
		hidden_effect = { # Juan Andreu complains he was not selected
			if = {
				limit = {
					USA = {
						is_subject = no
						exists = yes
						NOT = {
							has_war_with = ROOT
						}
					}
				}
				country_event = {
					id = mexico.20
					days = 1
				}
			}
		}
		
		ai_chance = {
			factor = 30
		}
	}
	
	option = { # Right-wing successor: Manuel Avila
		name = mexico.19.g
		
		trigger = {
			NOT = {
				has_country_leader = {
					character = MEX_manuel_avila_camacho
				}
			}
			has_government = democratic
		}

		add_country_leader_role = {
			character = MEX_manuel_avila_camacho
			country_leader = {
				expire = "1965.1.1"
				ideology = conservatism
				traits = {
					the_gentleman_president
				}
			}
			promote_leader = yes
		}
		
		hidden_effect = { # Juan Andreu complains he was not selected
			if = {
				limit = {
					USA = {
						is_subject = no
						exists = yes
						NOT = {
							has_war_with = ROOT
						}
					}
				}
				country_event = {
					id = mexico.20
					days = 1
				}
			}
		}
		
		ai_chance = {
			factor = 50
			modifier = {
				factor = 10
				is_historical_focus_on = yes
			}
		}
	}
	
	#option = { # Far-right candidate: Juan Andreu
	#	name = mexico.19.h
	#	
	#	trigger = {
	#		NOT = {
	#			has_country_leader = {
	#				character = MEX_juan_andreu
	#			}
	#		}
	#		has_government = democratic
	#	}

	#	add_country_leader_role = {
	#		character = MEX_juan_andreu
	#		country_leader = {
	#			expire = "1965.1.1"
	#			ideology = conservatism
	#			traits = {
	#				the_silver_president
	#			}
	#		}
	#		promote_leader = yes
	#	}
	#}
	
	# Communist
	
	option = { # Trades unionist successor: Vicente Lombardo
		name = mexico.19.i
		
		trigger = {
			has_completed_focus = MEX_focus_confederation_of_mexican_workers
			NOT = {
				has_country_leader = {
					character = MEX_vicente_lombardo
				}
			}
			has_government = communism
		}

		add_country_leader_role = {
			character = MEX_vicente_lombardo
			country_leader = {
				expire = "1965.1.1"
				ideology = marxism
				traits = {
					the_dean_of_mexican_marxism
				}
			}
			promote_leader = yes
		}
	}
	
	option = { # Social democratic successor: Francisco Mugica
		name = mexico.19.j
		
		trigger = {
			NOT = {
				has_country_leader = {
					character = MEX_francisco_mugica
				}
			}
			has_government = communism
		}

		add_country_leader_role = {
			character = MEX_francisco_mugica
			country_leader = {
				expire = "1965.1.1"
				ideology = marxism
				traits = {
					revolutionary_general
				}
			}
			promote_leader = yes
		}
	}

	option = { # Stalinist successor: Dionisio Encina
		name = mexico.19.k
		
		trigger = {
			NOT = {
				has_country_leader = {
					character = MEX_dionisio_encina
				}
			}

			has_government = communism
			NOT = {
				has_completed_focus = MEX_focus_communist_revolution
			}			
			NOT = {
				has_global_flag = flag_mexico_invited_trotsky_to_government
			}
		}

		add_country_leader_role = {
			promote_leader = yes
			character = MEX_dionisio_encina
			country_leader = {
				expire = "1965.1.1"
				ideology = stalinism
				traits = {
					staunch_stalinist
				}
			}
		}
	}
	
	option = { # Trotskyist successor: Hernan Laborde
		name = mexico.19.l
		
		trigger = {
			NOT = {
				has_country_leader = {
					character = MEX_hernan_laborde
				}
			}
			has_government = communism
			OR = {
				NOT = {
					has_global_flag = flag_mexico_invited_trotsky_to_government
				}
				AND = { # If Trotsky is in power, he steps down and Laborde is successor
					has_global_flag = flag_mexico_invited_trotsky_to_government
					has_country_leader = { character = MEX_leon_trotsky }
				}
			}
		}

		promote_character = MEX_hernan_laborde
	}

	option = { # Trotsky himself
		name = mexico.19.m
		
		trigger = {
			NOT = {
				has_country_leader = { character = MEX_leon_trotsky }
			}
			NOT = { has_global_flag = flag_trotsky_dead }
			NOT = {
				SOV = {
					has_country_leader = { character = SOV_lev_trotsky }
				}
			}
			has_government = communism
			has_global_flag = flag_mexico_invited_trotsky_to_government
			NOT = { has_global_flag = flag_trotsky_has_returned_to_ussr_from_mexico }
		}
		MEX_leon_trotsky = {
			add_country_leader_role = {
				promote_leader = yes
				country_leader = {
					ideology = leninism
					expire = "1965.1.1.1"
					traits = {
						exiled_revolutionary
					}
				}
			}
		}
	}
	
	option = { # Continuity candidate: Saturnino Cedillo
		name = mexico.19.n
		
		trigger = {
			NOT = {
				OR = {
					has_global_flag = flag_mexico_cedillo_has_revolted
					has_country_leader = {
						character = MEX_saturnino_cedillo
					}
				}	
			}
			has_completed_focus = MEX_focus_support_general_cedillo
			has_government = fascism
		}

		add_country_leader_role = {
			character = MEX_saturnino_cedillo
			country_leader = {
				expire = "1965.1.1"
				ideology = fascism_ideology
				traits = {
					strongman_of_san_luis_potosi
				}
			}
			promote_leader = yes
		}
	}

	#option = { # Fascist candidate: Juan Andreu
	#	name = mexico.19.o
	#	
	#	trigger = {
	#		NOT = {
	#			has_country_leader = {
	#				character = MEX_juan_andreu
	#			}
	#		}
	#		has_government = fascism
	#	}

	#	create_country_leader = {
	#		character = MEX_juan_andreu
	#		desc = "POLITICS_JUAN_ANDREU_DESC"
	#		picture = "GFX_portrait_mex_juan_andreu"
	#		expire = "1965.1.1"
	#		ideology = fascism_ideology
	#		traits = {
	#			the_silver_president
	#		}
	#	}
	#}

	option = { # Religious candidate: Jesus Degollado Guizar
		name = mexico.19.p
		
		trigger = {
			has_completed_focus = MEX_focus_legion_of_christ
			NOT = {
				has_country_leader = {
					character = MEX_jesus_degollado_guizar
				}
			}
			has_government = fascism
		}

		add_country_leader_role = {
			character = MEX_jesus_degollado_guizar
			country_leader = {
				expire = "1965.1.1"
				ideology = falangism
				traits = {
					cristero_general
				}
			}
			promote_leader = yes
		}
	}

	option = { # Falangist candidate: Salvador Abascal
		name = mexico.19.q
		
		trigger = {
			NOT = {
				has_country_leader = {
					character = MEX_salvador_abascal
				}
			}
			has_government = fascism
		}
		if = {
			limit = {
				has_country_leader = { #If he is already country leader, fake tooltip
					character = MEX_salvador_abascal
					ruling_only = no
				}
			}
			effect_tooltip = {
				add_country_leader_role = {
					character = MEX_salvador_abascal
					country_leader = {
						expire = "1965.1.1"
						ideology = falangism
						traits = {
							fascist_militia_leader
						}
					}
					promote_leader = yes
				}
			}
		}
		else = {
			add_country_leader_role = {
				character = MEX_salvador_abascal
				country_leader = {
					expire = "1965.1.1"
					ideology = falangism
					traits = {
						fascist_militia_leader
					}
				}
				promote_leader = yes
			}
		}
	}

	option = { # Neither Trotsky nor Laborde: Valentin Campa
		name = mexico.19.r
		
		trigger = {
			has_country_leader = {
			 	ruling_only = yes
			 	character = MEX_hernan_laborde
			}				
		}

		add_country_leader_role = {
			character = MEX_valentin_campa
			country_leader = {
				expire = "1965.1.1"
				ideology = leninism
				traits = {
					railroad_enthusiast
				}
			}
			promote_leader = yes
		}
	}

	# That should be enough for now. # (After endless new character system adjustments): Yes it was definitely enough

}

# If a centre/left-wing neutral or democratic leader is selected, Juan Andreu complains (historic)
# Only triggered if America exists, is independent and not at war with Mexico (flavour text reasons)

country_event = {
	id = mexico.20
	title = mexico.20.title
	desc = mexico.20.desc
	
	picture = GFX_report_event_election_vote
	
	is_triggered_only = yes

	option = {
		name = mexico.20.a
	}
}

# Stalin is informed that Trotsky has been apprehended by Mexico and extradited

country_event = {
	id = mexico.21
	title = mexico.21.title
	desc = mexico.21.desc
	
	picture = GFX_report_event_stalin_propaganda
	
	is_triggered_only = yes

	trigger = {
		NOT = {
			has_global_flag = flag_trotsky_dead
		}
	}

	immediate = {
		hidden_effect = {
			if = {
				limit = {
					tag = SOV
				}
				SOV_kill_trotsky_effect = yes
			}
		}
	}
	
	option = {
		name = mexico.21.a

		effect_tooltip = {
			retire_character = SOV_lev_trotsky
		}
		swap_ideas = {
			remove_idea = trotskyite_plot_nsb
			add_idea = trotskyite_plot_purged
		}
	}
}

# USSR is inviting Trotsky to return and lead their anti-Stalin coup
# Mexico loses access to Trotsky

country_event = {
	id = mexico.22
	title = mexico.22.title
	desc = mexico.22.desc
	
	picture = GFX_report_event_soviet_purge_politicians
	
	fire_only_once = yes
	
	trigger = {
		OR = {
			AND = {
				tag = MEX
				has_global_flag = flag_trotsky_returning_to_ussr_from_mexico
				has_global_flag = flag_mexico_invited_trotsky_to_government
			}
			AND = {
				tag = NOR 
				has_global_flag = flag_trotsky_returning_to_ussr_from_norway
				has_global_flag = trotsky_in_norwegian_government
			}
		}
		NOT = {
			has_global_flag = flag_trotsky_dead
		}
		OR = {
			has_dlc = "Man the Guns"
			has_aat = yes 
		}
	}
	
	mean_time_to_happen = {
		days = 1
	}
	
	option = {
		name = mexico.22.a
		if = {
			limit = { tag = MEX }
			if = {
				limit = {
					has_idea = MEX_leon_trotsky
				}			
				remove_ideas = MEX_leon_trotsky
				
				add_political_power = 100
			}
			set_global_flag = flag_trotsky_has_returned_to_ussr_from_mexico # Prevents taking Trotsky as Chief of Staff
			add_stability = 0.02 # Divisive to have a Russian Bolshevik cabinet minister (gave -0.03 on recruiting him)
			if = {
				limit = {
					has_country_leader = { character = MEX_leon_trotsky }
				}
				promote_character = MEX_hernan_laborde
			}
		}
	}
}

# Unrestricted submarine warfare

# German submarines sank some oilers in 1942, which brought Mexico into the war

# First event offers Germany a short bonus to convoy raiding in exchange for the risk of diplomatic repercussions

country_event = {
	id = mexico.23
	title = mexico.23.title
	desc = mexico.23.desc
	
	picture = GFX_report_event_merchant_ship_01
	
	fire_only_once = yes
	
	trigger = {
		tag = GER
		
		has_war_with = USA
		
		NOT = {
			has_war_with = MEX
		}
		
		has_navy_size = { unit = submarine size > 9 }
		
		OR = {
			ships_in_area = { # Gulf of Mexico
				type = submarine
				area = 52
				size > 0
			}
			ships_in_area = { # Carribean Sea
				type = submarine
				area = 53
				size > 0
			}
			ships_in_area = { # Florida Coast
				type = submarine
				area = 170
				size > 0
			}
			ships_in_area = { # Eastern Seaboard
				type = submarine
				area = 54
				size > 0
			}
			ships_in_area = { # Sargasso Sea
				type = submarine
				area = 57
				size > 0
			}
			ships_in_area = { # Demerara Plain
				type = submarine
				area = 59
				size > 0
			}
		}
		has_dlc = "Man the Guns"
	}
	
	mean_time_to_happen = {
		months = 24
		
		modifier = {
			factor = 0.5
			has_tech = unrestricted_submarine_warfare
		}
	}
	
	option = {
		name = mexico.23.a # Sink them
		
		add_war_support = 0.01
		
		add_timed_idea = {
			idea = mexico_german_submarine_happy_time
			days = 90
		}
		
		MEX = {
			country_event = {
				id = mexico.24
				days = 1
			}
		}
		
		ai_chance = {
			factor = 100
		}
	}
	option = {
		name = mexico.23.b # Best not
		
		ai_chance = {
			factor = 0
		}
	}
}

# Mexico is informed of the attacks by German submarines and gets the opportunity to enter the war against Germany

country_event = {
	id = mexico.24
	title = mexico.24.title
	desc = mexico.24.desc
	
	picture = GFX_report_event_merchant_ship_01
	
	is_triggered_only = yes

	option = {
		name = mexico.24.a # Join the war against Germany
		
		trigger = {
			NOT = {
				has_war_with = USA
			}
			is_in_faction = no
			has_dlc = "Man the Guns"
		}
		
		add_war_support = 0.01
		
		random_other_country = {
			limit = {
				is_in_faction_with = USA
				is_faction_leader = yes
			}
			country_event = {
				id = mexico.25
				days = 1
			}
		}
		
		ai_chance = {
			factor = 70
			
			modifier = {
				factor = 0.1
				USA = {
					surrender_progress > 0.1
				}
			}
			modifier = {
				factor = 0.5
				has_war = yes
			}
		}
	}
	
	option = {
		name = mexico.24.b # What can we do?
		
		add_stability = 0.01
		
		ai_chance = {
			factor = 30
			
			modifier = {
				factor = 0.5
				is_historical_focus_on = yes
			}
		}
	}
}

# USA's faction leader (ie USA or ENG) gets asked to add Mexico to the war against Germany

country_event = {
	id = mexico.25
	title = mexico.25.title
	desc = mexico.25.desc
	
	picture = GFX_report_event_merchant_ship_01
	
	is_triggered_only = yes
	
	option = {
		name = mexico.25.a # Every little helps
		
		trigger = {
			NOT = {
				has_war_with = MEX
			}
			has_dlc = "Man the Guns"
		}
		
		add_to_faction = MEX
		
		MEX = {
			add_to_war = {
				targeted_alliance = ROOT
				enemy = GER
			}
		}
		
		hidden_effect = {
			news_event = {
				id = mexico.26
				days = 1
			}
		}
		
		ai_chance = {
			factor = 85
			
			modifier = {
				factor = 0.5
				MEX = {
					has_war = yes
				}
			}
		}
	}
	
	option = {
		name = mexico.25.b # Mexico? Bahahaha
		
		add_political_power = 25
		
		ai_chance = {
			factor = 15
			
			modifier = {
				factor = 0.5
				is_historical_focus_on = yes
			}
		}
	}
}

# News event for Mexico joining the war against Germany after submarine attacks

news_event = {
	id = mexico.26
	title = mexico.26.title
	desc = mexico.26.desc
	
	picture = GFX_news_event_020
	
	major = yes
	
	is_triggered_only = yes
	
	option = {
		name = mexico.26.a
		
		trigger = {
			OR = {
				original_tag = MEX
				is_in_faction_with = MEX
				has_war_with = GER
			}
		}
	}
	option = {
		name = mexico.26.b
		
		trigger = {
			OR = {
				original_tag = GER
				is_in_faction_with = GER
				has_war_with = MEX
			}
		}
	}
	option = {
		name = mexico.26.c
		
		trigger = {
			NOT = {
				OR = {
					original_tag = MEX
					is_in_faction_with = MEX
					has_war_with = MEX
					original_tag = GER
					is_in_faction_with = GER
					has_war_with = GER
				}
			}
		}
	}
}

# Papal encyclical on Mexico issued by Pope Pius XI

country_event = {
	id = mexico.27
	title = mexico.27.title
	desc = mexico.27.desc
	
	picture = GFX_report_event_europe_funeral
	
	fire_only_once = yes
	
	trigger = {
		tag = MEX
		
		date > 1937.1.1
		
		has_civil_war = no

		NOT = {
			has_global_flag = flag_second_mexican_civil_war
		}
		has_dlc = "Man the Guns"
	}
	
	mean_time_to_happen = {
		months = 6 # Historically published 28 March 1937
	}
	
	option = {
		name = mexico.27.a # It is good that the anti-Church violence has ended.
		
		MEX_increase_church_power = yes
		
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0.1
				has_completed_focus = MEX_focus_state_education
			}
			modifier = {
				factor = 10
				has_active_mission = MEX_mission_second_cristiada
			}
			modifier = {
				factor = 10
				OR = {
					has_idea = MEX_church_power_2
					has_idea = MEX_church_power_1
				}
				NOT = { has_global_flag = flag_second_mexican_civil_war }
			}
		}
	}
	option = {
		name = mexico.27.b # Superstitious propaganda, prevent publication of this treason!
		
		MEX_decrease_church_power = yes
		
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0.1
				has_completed_focus = MEX_focus_antidisestablishmentarianism
			}
			modifier = {
				factor = 10
				has_active_mission = MEX_mission_second_revolution
			}
			modifier = {
				factor = 10
				OR = {
					has_idea = MEX_church_power_4
					has_idea = MEX_church_power_5
				}
				NOT = { has_global_flag = flag_second_mexican_civil_war }
			}
		}
	}
}

# The renewed attacks on the church incite a Second Cristiada


# News event for Second Cristiada

news_event = {
	id = mexico.29
	title = mexico.29.title
	desc = mexico.29.desc
	
	picture = GFX_news_event_mex_civil_war
	
	major = yes
	
	is_triggered_only = yes
	
	option = {
		name = mexico.29.a
		
		trigger = {
			OR = {
				original_tag = MEX
				is_in_faction_with = MEX
			}
			has_dlc = "Man the Guns"
		}
	}
	option = {
		name = mexico.29.b
		
		trigger = {
			has_war_with = MEX
		}
	}
	option = {
		name = mexico.29.c
		
		trigger = {
			NOT = {
				OR = {
					original_tag = MEX
					is_in_faction_with = MEX
					has_war_with = MEX
				}
			}
		}
	}
}

# The rapid ascent of the church incites a civil war from the anti-Church military and far-left


# News event for Second Mexican Revolution

news_event = {
	id = mexico.31
	title = mexico.31.title
	desc = mexico.31.desc
	
	picture = GFX_news_event_mex_civil_war
	
	major = yes
	
	is_triggered_only = yes
	
	option = {
		name = mexico.31.a
		
		trigger = {
			OR = {
				original_tag = MEX
				is_in_faction_with = MEX
			}
		}
	}
	option = {
		name = mexico.31.b
		
		trigger = {
			has_war_with = MEX
		}
	}
	option = {
		name = mexico.31.c
		
		trigger = {
			NOT = {
				OR = {
					original_tag = MEX
					is_in_faction_with = MEX
					has_war_with = MEX
				}
			}
		}
	}
}

# Zoot Suit Riots occur in America

country_event = {
	id = mexico.32
	title = mexico.32.title
	desc = mexico.32.desc
	
	picture = GFX_report_event_mex_civil_war
	
	fire_only_once = yes
	
	trigger = {
		tag = USA
		
		date > 1941.1.1
		
		has_war = yes # Ostensibly over fabrics in short supply during wartime. Sumptuary laws help create an orderly and peaceful society under God
		
		has_government = democratic # Bigger concerns if they are fascists or communists
		
		country_exists = MEX
		
		NOT = {
			has_war_with = MEX
		}
		has_dlc = "Man the Guns"
	}
	
	mean_time_to_happen = {
		months = 24 # Historically June 1943
	}
	
	option = {
		name = mexico.32.a
		
		add_stability = 0.01
		add_political_power = -25
		
		ai_chance = {
			factor = 50
			
			modifier = {
				factor = 0.5
				is_historical_focus_on = yes
			}
		}
	}
	
	option = {
		name = mexico.32.b
		
		add_stability = -0.01
		add_war_support = 0.01
		
		MEX = {
			country_event = {
				days = 1
				id = mexico.33
			}
		}
		
		ai_chance = {
			factor = 50
		}
	}
}

country_event = {
	id = mexico.33
	title = mexico.33.title
	desc = mexico.33.desc
	
	picture = GFX_report_event_mex_civil_war
	
	is_triggered_only = yes

	option = {
		name = mexico.33.a
		
		MEX_decrease_church_power = yes
		
		add_stability = -0.01
		add_war_support = 0.01
		
		ai_chance = {
			factor = 50
			
			modifier = {
				factor = 2.0
				is_in_faction_with = FROM
			}
			modifier = {
				factor = 0.1
				has_government = fascism
			}
			modifier = {
				factor = 10
				has_active_mission = MEX_mission_second_revolution
			}
			modifier = {
				factor = 10
				OR = {
					has_idea = MEX_church_power_4
					has_idea = MEX_church_power_5
				}
				NOT = { has_global_flag = flag_second_mexican_civil_war }
			}
		}
	}
	
	option = {
		name = mexico.33.b
		
		add_stability = 0.01
		add_war_support = -0.01
		
		add_opinion_modifier = {
			target = FROM
			modifier = protest_action
		}
		
		reverse_add_opinion_modifier = {
			target = FROM
			modifier = protest_action
		}
		
		ai_chance = {
			factor = 50
			
			modifier = {
				factor = 2.0
				NOT = {
					has_government = FROM
				}
			}
		}
	}
}

# Germany is asked if they want to give Mexico tank licences for closer relations

country_event = {
	id = mexico.34
	title = mexico.34.title
	desc = mexico.34.desc
	
	picture = GFX_report_event_generic_panzer_attack
	
	is_triggered_only = yes

	option = {
		name = mexico.34.a
		
		trigger = {
			NOT = {
				has_war_with = MEX
			}
		}
		
		effect_tooltip = {
			add_opinion_modifier = {
				target = MEX
				modifier = mexico_german_resource_exchange
			}
			
			MEX = {
				add_opinion_modifier = {
					target = ROOT
					modifier = mexico_german_resource_exchange
				}
			}
		
			if = {
				limit = {
					has_dlc = "Death or Dishonor"
				}
				if = {
					limit = {
						has_tech = advanced_light_tank
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = light_tank_equipment_3
						}
						cost_factor = 0
					}
				}
				else_if = {
					limit = {
						has_tech = improved_light_tank
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = light_tank_equipment_2
						}
						cost_factor = 0
					}
				}
				else_if = {
					limit = {
						has_tech = basic_light_tank
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = light_tank_equipment_1
						}
						cost_factor = 0
					}
				}
				if = {
					limit = {
						has_tech = advanced_medium_tank
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = medium_tank_equipment_3
						}
						cost_factor = 0
					}
				}
				else_if = {
					limit = {
						has_tech = improved_medium_tank
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = medium_tank_equipment_2
						}
						cost_factor = 0
					}
				}
				else_if = {
					limit = {
						has_tech = basic_medium_tank
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = medium_tank_equipment_1
						}
						cost_factor = 0
					}
				}
				if = {
					limit = {
						has_tech = advanced_heavy_tank
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = heavy_tank_equipment_3
						}
						cost_factor = 0
					}
				}
				else_if = {
					limit = {
						has_tech = improved_heavy_tank
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = heavy_tank_equipment_2
						}
						cost_factor = 0
					}
				}
				else_if = {
					limit = {
						has_tech = basic_heavy_tank
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = heavy_tank_equipment_1
						}
						cost_factor = 0
					}
				}
				if = {
					limit = {
						has_tech = advanced_light_tank_chassis
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = light_tank_chassis_3
						}
						cost_factor = 0
					}
				}
				else_if = {
					limit = {
						has_tech = improved_light_tank_chassis
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = light_tank_chassis_2
						}
						cost_factor = 0
					}
				}
				else_if = {
					limit = {
						has_tech = basic_light_tank_chassis
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = light_tank_chassis_1
						}
						cost_factor = 0
					}
				}
				if = {
					limit = {
						has_tech = advanced_medium_tank_chassis
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = medium_tank_chassis_3
						}
						cost_factor = 0
					}
				}
				else_if = {
					limit = {
						has_tech = improved_medium_tank_chassis
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = medium_tank_chassis_2
						}
						cost_factor = 0
					}
				}
				else_if = {
					limit = {
						has_tech = basic_medium_tank_chassis
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = medium_tank_chassis_1
						}
						cost_factor = 0
					}
				}
				if = {
					limit = {
						has_tech = advanced_heavy_tank_chassis
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = heavy_tank_chassis_3
						}
						cost_factor = 0
					}
				}
				else_if = {
					limit = {
						has_tech = improved_heavy_tank_chassis
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = heavy_tank_chassis_2
						}
						cost_factor = 0
					}
				}
				else_if = {
					limit = {
						has_tech = basic_heavy_tank_chassis
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = heavy_tank_chassis_1
						}
						cost_factor = 0
					}
				}
				MEX = {
					add_tech_bonus = {
						name = armor
						bonus = 1.0
						uses = 1
						category = armor
					}
				}
			}
			if = {
				limit = {
					NOT = { has_dlc = "Death or Dishonor" }
				}
				MEX = {
					add_tech_bonus = {
						name = armor
						bonus = 1.0
						uses = 2
						category = armor
					}
				}
			}
			MEX = {
				give_resource_rights = { receiver = GER state = 476 }
				country_event = {
					days = 1
					id = mexico.35
				}
			}
		}
		
		hidden_effect = {
			MEX = {
				country_event = {
					days = 1
					id = mexico.35
				}
			}
		}
			
		ai_chance = {
			factor = 50
			
			modifier = {
				factor = 2.0
				has_government = FROM
			}

			modifier = {
				factor = 2.0
				FROM = {
					is_in_faction = no
				}
			}
		}
	}
	
	option = {
		name = mexico.34.b
		
		MEX = {
			country_event = {
				days = 1
				id = mexico.36
			}
		}
		
		ai_chance = {
			factor = 50
			
			modifier = {
				factor = 0
				FROM = {
					is_in_faction_with = ROOT
				}
			}

			modifier = {
				factor = 2.0
				FROM = {
					is_enemy_ideology = yes
				}
			}

			modifier = {
				factor = 2.0
				FROM = {
					is_in_faction_with = USA
				}
			}
			
			modifier = {
				factor = 2.0
				FROM = {
					is_in_faction_with = ENG
				}
			}
			
			modifier = {
				factor = 2.0
				FROM = {
					is_in_faction_with = SOV
				}
			}
		}
	}
}

# Mexico is informed Germany is giving them free tank licences

country_event = {
	id = mexico.35
	title = mexico.35.title
	desc = mexico.35.desc
	
	picture = GFX_report_event_generic_panzer_attack
	
	is_triggered_only = yes

	option = {
		name = mexico.35.a
		
		add_opinion_modifier = {
			target = GER
			modifier = mexico_german_resource_exchange
		}
	
		GER = {
			add_opinion_modifier = {
				target = ROOT
				modifier = mexico_german_resource_exchange
			}

			if = {
				limit = {
					has_dlc = "Death or Dishonor"
				}
				if = {
					limit = {
						has_tech = advanced_light_tank
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = light_tank_equipment_3
						}
						cost_factor = 0
					}
				}
				else_if = {
					limit = {
						has_tech = improved_light_tank
						
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = light_tank_equipment_2
						}
						cost_factor = 0
					}
				}
				else_if = {
					limit = {
						has_tech = basic_light_tank
						
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = light_tank_equipment_1
						}
						cost_factor = 0
					}
				}
				if = {
					limit = {
						has_tech = advanced_medium_tank
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = medium_tank_equipment_3
						}
						cost_factor = 0
					}
				}
				else_if = {
					limit = {
						has_tech = improved_medium_tank
					
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = medium_tank_equipment_2
						}
						cost_factor = 0
					}
				}
				else_if = {
					limit = {
						has_tech = basic_medium_tank
					
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = medium_tank_equipment_1
						}
						cost_factor = 0
					}
				}
				if = {
					limit = {
						has_tech = advanced_heavy_tank
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = heavy_tank_equipment_3
						}
						cost_factor = 0
					}
				}
				else_if = {
					limit = {
						has_tech = improved_heavy_tank
						
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = heavy_tank_equipment_2
						}
						cost_factor = 0
					}
				}
				else_if = {
					limit = {
						has_tech = basic_heavy_tank
						
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = heavy_tank_equipment_1
						}
						cost_factor = 0
					}
				}
				if = {
					limit = {
						has_tech = advanced_light_tank_chassis
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = light_tank_chassis_3
						}
						cost_factor = 0
					}
				}
				else_if = {
					limit = {
						has_tech = improved_light_tank_chassis
						
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = light_tank_chassis_2
						}
						cost_factor = 0
					}
				}
				else_if = {
					limit = {
						has_tech = basic_light_tank_chassis
						
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = light_tank_chassis_1
						}
						cost_factor = 0
					}
				}
				if = {
					limit = {
						has_tech = advanced_medium_tank_chassis
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = medium_tank_chassis_3
						}
						cost_factor = 0
					}
				}
				else_if = {
					limit = {
						has_tech = improved_medium_tank_chassis
					
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = medium_tank_chassis_2
						}
						cost_factor = 0
					}
				}
				else_if = {
					limit = {
						has_tech = basic_medium_tank_chassis
					
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = medium_tank_chassis_1
						}
						cost_factor = 0
					}
				}
				if = {
					limit = {
						has_tech = advanced_heavy_tank_chassis
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = heavy_tank_chassis_3
						}
						cost_factor = 0
					}
				}
				else_if = {
					limit = {
						has_tech = improved_heavy_tank_chassis
						
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = heavy_tank_chassis_2
						}
						cost_factor = 0
					}
				}
				else_if = {
					limit = {
						has_tech = basic_heavy_tank_chassis
						
					}
					create_production_license = {
						target = MEX
						equipment = {
							type = heavy_tank_chassis_1
						}
						cost_factor = 0
					}
				}
				MEX = {
					add_tech_bonus = {
						name = armor
						bonus = 1.0
						uses = 1
						category = armor
					}
				}
			}
			if = {
				limit = {
					NOT = { has_dlc = "Death or Dishonor" }
				}
				MEX = {
					add_tech_bonus = {
						name = armor
						bonus = 1.0
						uses = 2
						category = armor
					}
				}
			}
			give_resource_rights = { receiver = GER state = 476 }
		}
	}
}

# Mexico is informed Germany refuses to give tank licences for free

country_event = {
	id = mexico.36
	title = mexico.36.title
	desc = mexico.36.desc
	
	picture = GFX_report_event_generic_panzer_attack
	
	is_triggered_only = yes

	option = {
		name = mexico.36.a
	}
}

# Operation Just Cause - Mexico seizes the Panama Canal and is informed of success

country_event = {
	id = mexico.40
	title = mexico.40.title
	desc = mexico.40.desc
	
	picture = GFX_report_event_soviet_soldiers_tank
	
	is_triggered_only = yes

	option = {
		name = mexico.40.a
		
		transfer_state = 685

		add_war_support = 0.05

		army_experience = 25
	}
}

# Operation Just Cause succeeded - America gets opportunity to retaliate

country_event = {
	id = mexico.41
	title = mexico.41.title
	desc = mexico.41.desc
	
	picture = GFX_report_event_soviet_soldiers_tank
	
	is_triggered_only = yes
	
	option = {
		name = mexico.41.a
				
		army_experience = 25

		add_political_power = 100
		
		add_opinion_modifier = {
			target = MEX
			modifier = embargo
		}
		
		MEX = {
			add_opinion_modifier = {
				target = ROOT
				modifier = embargo
			}
		}
		
		set_global_flag = flag_america_plans_to_punish_mexico_for_canal_attack

		hidden_effect = {
			news_event = {
				id = mexico.44
			}
		}

		ai_chance = {
			factor = 50
			modifier = {
				factor = 0.5
				is_historical_focus_on = yes
			}
		}
	}
	
	option = {
		name = mexico.41.b
		
		army_experience = 25

		add_war_support = 0.05
		
		create_wargoal = {
			type = puppet_wargoal_focus
			target = MEX
		}
		
		add_opinion_modifier = {
			target = MEX
			modifier = embargo
		}
		
		MEX = {
			add_opinion_modifier = {
				target = ROOT
				modifier = embargo
			}
		}
		
		set_global_flag = flag_america_ignores_mexican_attack_on_canal

		hidden_effect = {
			news_event = {
				id = mexico.44
			}
		}

		ai_chance = {
			factor = 50
			modifier = {
				factor = 0.5
				has_war = yes
			}
		}
	}
}

# Operation Just Cause - Mexican attack on Panama Canal failed

country_event = {
	id = mexico.42
	title = mexico.42.title
	desc = mexico.42.desc
	
	picture = GFX_report_event_soviet_soldiers_tank
	
	is_triggered_only = yes

	option = {
		name = mexico.42.a
		
		add_war_support = -0.05

		army_experience = 25
	}
}

# Operation Just Cause failed - America gets opportunity to retaliate

country_event = {
	id = mexico.43
	title = mexico.43.title
	desc = mexico.43.desc
	
	picture = GFX_report_event_usa_macarthur_speech
	
	is_triggered_only = yes
	
	option = {
		name = mexico.43.a
				
		army_experience = 25
		
		add_opinion_modifier = {
			target = MEX
			modifier = embargo
		}
		
		MEX = {
			add_opinion_modifier = {
				target = ROOT
				modifier = embargo
			}
		}
		
		set_global_flag = flag_america_plans_to_punish_mexico_for_canal_attack

		hidden_effect = {
			news_event = {
				id = mexico.45
			}
		}

		ai_chance = {
			factor = 50
			modifier = {
				factor = 0.5
				is_historical_focus_on = yes
			}
		}
	}
	
	option = {
		name = mexico.43.b
		
		army_experience = 25
		
		create_wargoal = {
			type = puppet_wargoal_focus
			target = MEX
		}
		
		add_opinion_modifier = {
			target = MEX
			modifier = embargo
		}
		
		MEX = {
			add_opinion_modifier = {
				target = ROOT
				modifier = embargo
			}
		}
		
		set_global_flag = flag_america_ignores_mexican_attack_on_canal

		hidden_effect = {
			news_event = {
				id = mexico.45
			}
		}

		ai_chance = {
			factor = 50
			modifier = {
				factor = 0.5
				has_war = yes
			}
		}
	}
}

# News event for a successful seizure of Panama Canal

news_event = {
	id = mexico.44
	title = mexico.44.title

	desc = { # 
		text = mexico.44.desc1
		trigger = {
			has_global_flag = flag_america_plans_to_punish_mexico_for_canal_attack
		}
	}
	desc = { # 
		text = mexico.44.desc2
		trigger = {
			has_global_flag = flag_america_ignores_mexican_attack_on_canal
		}
	}
	
	picture = GFX_news_event_039
	
	major = yes
	
	is_triggered_only = yes
	
	option = {
		name = mexico.44.a
		
		trigger = {
			OR = {
				original_tag = MEX
				is_in_faction_with = MEX
			}
		}
	}
	option = {
		name = mexico.44.b
		
		trigger = {
			OR = {
				original_tag = USA
				is_in_faction_with = USA
			}
		}
	}
	option = {
		name = mexico.44.c
		
		trigger = {
			NOT = {
				OR = {
					original_tag = MEX
					is_in_faction_with = MEX
					original_tag = USA
					is_in_faction_with = USA
				}
			}
		}
	}
}

# News event for the seizure of Panama Canal failing

news_event = {
	id = mexico.45
	title = mexico.45.title

	desc = { # 
		text = mexico.45.desc1
		trigger = {
			has_global_flag = flag_america_plans_to_punish_mexico_for_canal_attack
		}
	}
	desc = { # 
		text = mexico.45.desc2
		trigger = {
			has_global_flag = flag_america_ignores_mexican_attack_on_canal
		}
	}
	
	picture = GFX_news_event_usa_japan_at_war
	
	major = yes
	
	is_triggered_only = yes
	
	option = {
		name = mexico.45.a
		
		trigger = {
			OR = {
				original_tag = MEX
				is_in_faction_with = MEX
			}
		}
	}
	option = {
		name = mexico.45.b
		
		trigger = {
			OR = {
				original_tag = USA
				is_in_faction_with = USA
			}
		}
	}
	option = {
		name = mexico.45.c
		
		trigger = {
			NOT = {
				OR = {
					original_tag = MEX
					is_in_faction_with = MEX
					original_tag = USA
					is_in_faction_with = USA
				}
			}
		}
	}
}

# News event for Mexico creating Latin American Order faction

news_event = {
	id = mexico.46
	title = mexico.46.title
	desc = mexico.46.desc
	
	picture = GFX_news_event_053
	
	major = yes
	
	is_triggered_only = yes
	
	option = {
		name = mexico.46.a
		
		trigger = {
			OR = {
				original_tag = MEX
				is_in_faction_with = MEX
			}
		}
	}
	option = {
		name = mexico.46.b
		
		trigger = {
			has_war_with = MEX
		}
	}
	option = {
		name = mexico.46.c
		
		trigger = {
			NOT = {
				OR = {
					original_tag = MEX
					is_in_faction_with = MEX
					has_war_with = MEX
				}
			}
		}
	}
}

# News event for Mexico creating Bolivarian Alliance

news_event = {
	id = mexico.47
	title = mexico.47.title
	desc = mexico.47.desc
	
	picture = GFX_news_event_gathering_protest
	
	major = yes
	
	is_triggered_only = yes
	
	option = {
		name = mexico.46.a
		
		trigger = {
			OR = {
				original_tag = MEX
				is_in_faction_with = MEX
			}
		}
	}
	option = {
		name = mexico.46.b
		
		trigger = {
			has_war_with = MEX
		}
	}
	option = {
		name = mexico.46.c
		
		trigger = {
			NOT = {
				OR = {
					original_tag = MEX
					is_in_faction_with = MEX
					has_war_with = MEX
				}
			}
		}
	}
}

# Mexico sends a shipment of military supplies to a Spanish Civil War participant

country_event = {
	id = mexico.50
	title = mexico.50.title
	desc = mexico.50.desc
	
	picture = GFX_report_event_merchant_ship_01
	
	is_triggered_only = yes
	
	option = {
		name = mexico.50.a

		add_equipment_to_stockpile = {
			type = infantry_equipment_0
			amount = 250
			producer = "MEX"
		}
	}
}

# Shipment intended for Spain is sunk

country_event = {
	id = mexico.51
	title = mexico.51.title
	desc = mexico.51.desc
	
	picture = GFX_report_event_merchant_ship_01

	is_triggered_only = yes

	option = {
		name = mexico.51.a
	}
}

country_event = {
	id = mexico.52
	title = mexico.52.title
	desc = {
		text = mexico.52.desc_not_trotsky
		trigger = {
			NOT = {
				MEX = {
					has_country_leader = { ruling_only = yes character = MEX_leon_trotsky }
				}			
			}	
		}
	}
	desc = {
		text = mexico.52.desc_trotsky
		trigger = {			
			MEX = {
				has_country_leader = { ruling_only = yes character = MEX_leon_trotsky }
			}				
		}
	}		
	picture = GFX_report_event_soviet_purge_politicians

	is_triggered_only = yes

	option = { #ask other communist faction leaders to dismantle their faction and join Trotsky
		name = mexico.52.a
		every_other_country = {
			limit = {
				is_in_faction_with = ROOT
			}
			country_event = {
				id = mexico.53
			}
		}
		dismantle_faction = yes
		MEX = {
			add_to_faction = PREV
		}
		ai_chance = {
			factor = 70
		}		
	}	
	option = {
		name = mexico.52.b #Never! Stalinism best -ism.
		ai_chance = {
			factor = 30
		}		
	}
}
country_event = {
	id = mexico.53
	title = mexico.53.title
	desc = mexico.53.desc
	
	picture = GFX_report_event_communists_cheer

	is_triggered_only = yes

	option = { #ask minor communist countries to join Trotsky
		name = mexico.53.a
		MEX = {
			add_to_faction = ROOT
		}
		ai_chance = {
			factor = 90
		}		
	}	
	option = {
		name = mexico.53.b
		#Never! Stalinism best -ism.
		ai_chance = {
			factor = 10
		}		
	}
}
# Enforce Decolonization event - release or else!!!!
country_event = {
	id = mexico.54
	title = mexico.54.title
	desc = mexico.54.desc
	picture = GFX_report_event_soviet_purge_politicians

	is_triggered_only = yes
	
	# Accept - We will release
	option = {
		name = mexico.54.a
		ai_chance = {
			factor = 34
			modifier = {
				factor = 1.5
				strength_ratio = {
					tag = MEX
					ratio < 0.5
				}
			}
			modifier = {
				factor = 2
				strength_ratio = {
					tag = MEX
					ratio < 0.3
				}
			}
			modifier = {
				factor = 2
				strength_ratio = {
					tag = MEX
					ratio < 0.2
				}
			}
			modifier = {
				factor = 2
				strength_ratio = {
					tag = MEX
					ratio < 0.1
				}
			}
			modifier = {
				factor = 0
				strength_ratio = {
					tag = MEX
					ratio > 1.6
				}
			}
		}
		if = {
			limit = {
				original_tag = USA
				owns_state = 686
				has_full_control_of_state = 686
			}
			release = PUE
			PUE = {
				add_timed_idea = {
					idea = MEX_bolivarian_agitation
					days = 720
				}			
				set_country_flag = received_MEX_bolivarian_agitation
			}
		}
		if = {
			limit = {
				original_tag = HOL
				owns_state = 695
				has_full_control_of_state = 695
			}
			release = CRC
			CRC = {
				add_timed_idea = {
					idea = MEX_bolivarian_agitation
					days = 720
				}
				set_country_flag = received_MEX_bolivarian_agitation
			}
		}
		if = {
			limit = {
				original_tag = HOL
				owns_state = 309
				has_full_control_of_state = 309
			}
			release = SUR
			SUR = {
				add_timed_idea = {
					idea = MEX_bolivarian_agitation
					days = 720
				}			
				set_country_flag = received_MEX_bolivarian_agitation
			}
		}
		if = {
			limit = {
				original_tag = FRA
				owns_state = 694
				has_full_control_of_state = 694
			}
			release = GDL
			GDL = {
				add_timed_idea = {
					idea = MEX_bolivarian_agitation
					days = 720
				}
				set_country_flag = received_MEX_bolivarian_agitation
			}
		}
		if = {
			limit = {
				original_tag = FRA
				owns_state = 310
				has_full_control_of_state = 310
			}
			release = CAY
			CAY = {
				add_timed_idea = {
					idea = MEX_bolivarian_agitation
					days = 720
				}
				set_country_flag = received_MEX_bolivarian_agitation
			}
		}
		if = {
			limit = {
				original_tag = ENG
				owns_state = 687
				has_full_control_of_state = 687
			}
			release = GYA
			GYA = {
				add_timed_idea = {
					idea = MEX_bolivarian_agitation
					days = 720
				}			
				set_country_flag = received_MEX_bolivarian_agitation
			}
		}
		if = {
			limit = {
				original_tag = ENG
				owns_state = 689
				has_full_control_of_state = 689
			}
			release = JAM
			JAM = {
				add_timed_idea = {
					idea = MEX_bolivarian_agitation
					days = 720
				}			
				set_country_flag = received_MEX_bolivarian_agitation
			}
		}		
		if = {
			limit = {
				original_tag = ENG
				owns_state = 691
				has_full_control_of_state = 691
			}
			release = TRI
			TRI = {
				add_timed_idea = {
					idea = MEX_bolivarian_agitation
					days = 720
				}			
				set_country_flag = received_MEX_bolivarian_agitation
			}
		}
		if = {
			limit = {
				original_tag = ENG
				owns_state = 692
				has_full_control_of_state = 692
				owns_state = 308
				has_full_control_of_state = 308				
			}
			release = BAS
			BAS = {
				add_timed_idea = {
					idea = MEX_bolivarian_agitation
					days = 720
				}			
				set_country_flag = received_MEX_bolivarian_agitation
			}
		}
		if = {
			limit = {
				original_tag = ENG
				owns_state = 690
				has_full_control_of_state = 690
				owns_state = 693
				has_full_control_of_state = 693				
			}
			release = BAH
			BAH = {
				add_timed_idea = {
					idea = MEX_bolivarian_agitation
					days = 720
				}			
				set_country_flag = received_MEX_bolivarian_agitation
			}
		}								
		FROM = { country_event = { id = mexico.55 hours = 6 } }
	}

	# Reject - We will NOT release
	option = {
		name = mexico.54.b
		ai_chance = {
			factor = 66
			modifier = {
				factor = 1.5
				strength_ratio = {
					tag = MEX
					ratio > 0.7
				}
			}
			modifier = {
				factor = 2
				strength_ratio = {
					tag = MEX
					ratio > 0.85
				}
			}
			modifier = {
				factor = 2
				strength_ratio = {
					tag = MEX
					ratio > 1
				}
			}
			modifier = {
				factor = 2
				strength_ratio = {
					tag = MEX
					ratio > 1.2
				}
			}
			modifier = {
				factor = 2
				strength_ratio = {
					tag = MEX
					ratio > 1.4
				}
			}
		}
		FROM = { country_event = { id = mexico.56 hours = 6 } }
		effect_tooltip = {
			FROM = { 
				create_wargoal = {
					type = puppet_wargoal_focus
					target = ROOT
				}
			}
		}
	}
}
# Enforce Decolonization event - FROM has released
country_event = {
	id = mexico.55
	title = mexico.55.title
	desc = mexico.55.desc
	picture = GFX_report_event_soviet_purge_politicians

	is_triggered_only = yes
	
	# Ok
	option = {
		name = mexico.55.a
		#TODO_Drikus effect_tooltip
	}
}

# Enforce Decolonization event - FROM has refused to release!
country_event = {
	id = mexico.56
	title = mexico.56.title
	desc = mexico.56.desc
	picture = GFX_report_event_soviet_purge_politicians 

	is_triggered_only = yes
	
	# Ok
	option = {
		name = mexico.56.a
		create_wargoal = {
			type = puppet_wargoal_focus
			target = FROM
		}
	}
}

news_event = {
	id = mexico.57
	title = mexico.57.title
	desc = mexico.57.desc
	
	picture = GFX_news_event_023
	
	major = yes
	
	is_triggered_only = yes
	
	option = {
		name = mexico.57.a
		
		trigger = {
			OR = {
				original_tag = MEX
				is_in_faction_with = MEX
			}
		}
	}
	option = {
		name = mexico.57.b
		
		trigger = {
			OR = {
				original_tag = SOV
				is_in_faction_with = SOV
				has_war_with = MEX
			}
		}
	}
	option = {
		name = mexico.57.c
		
		trigger = {
			NOT = {
				OR = {
					original_tag = MEX
					is_in_faction_with = MEX
					has_war_with = MEX
					original_tag = SOV
					is_in_faction_with = SOV
				}
			}
		}
	}
}
