###########################
# GOE Events
###########################

add_namespace = GOE_generic_events


# French Government Collapses
country_event = {
	id = GOE_generic_events.1
	title = GOE_generic_events.1.t
	desc = GOE_generic_events.1.desc
	picture = GFX_report_event_generic_sign_treaty2
	is_triggered_only = yes
	# Support Vichy
	option = {
		name = GOE_generic_events.1.a
		trigger = {
		AND = {
			surrender_progress < 0.30
			has_capitulated = no # Can only switch sides if they have not already capitulated, i.e been captured by for example another Axis member
			}
		}
		ai_chance = {
			base = 10
		}
		# Syria supports us
		hidden_effect = {

			# Check if any of our states are to go as spoils to Iraq or other enemies 
			# Deir az Zur 
			IF = {
				limit = {
					680 = {
						is_owned_by = ROOT
						NOT = {
							is_controlled_by = ROOT
						}
					}
				}
				680 = {
					controller = {
						transfer_state = PREV
					}
				}
			}
			# Alexandretta 
			IF = {
				limit = {
					799 = {
						is_owned_by = ROOT
						NOT = {
							is_controlled_by = ROOT
						}
					}
				}
				799 = {
					controller = {
						transfer_state = PREV
					}
				}
			}
			# Aleppo 
			IF = {
				limit = {
					677 = {
						is_owned_by = ROOT
						NOT = {
							is_controlled_by = ROOT
						}
					}
				}
				677 = {
					controller = {
						transfer_state = PREV
					}
				}
			}
			# Damascus  
			IF = {
				limit = {
					554 = {
						is_owned_by = ROOT
						NOT = {
							is_controlled_by = ROOT
						}
					}
				}
				554 = {
					controller = {
						transfer_state = PREV
					}
				}
			}
			# Lebanon  
			IF = {
				limit = {
					553 = {
						is_owned_by = ROOT
						NOT = {
							is_controlled_by = ROOT
						}
					}
				}
				553 = {
					controller = {
						transfer_state = PREV
					}
				}
			}

			OVERLORD = {
				end_puppet = ROOT
			}
			drop_cosmetic_tag = yes
			IF = {
				limit = {
					original_tag = SYR
				}
				set_cosmetic_tag = SYR_vichy
				add_country_leader_role = {
					character = FRA_henri_dentz
					promote_leader = yes
					country_leader = {
						ideology = fascism_ideology
						expire = "1960.1.1.1" 
						traits = { eager_collaborator } 
					}
				}	
			}
			IF = {
				limit = {
					original_tag = LEB
				}
				set_cosmetic_tag = LEB_vichy
			}
		}
		VIC = {
			country_event = {
				id = GOE_generic_events.2
				hours = 1
			}
			puppet = {
			    target = ROOT
			    end_wars = yes
			    end_civil_wars = no 
			}
		}
	}	
	# Support Free France
	option = {
		name = GOE_generic_events.1.b
		ai_chance = {
			base = 0
			modifier = {
				add = 10
				is_historical_focus_on = no
			}
		}
		# Syria supports us
		FRA = {
			country_event = {
				id = GOE_generic_events.2
				hours = 1
			}
		}
		# Syria betrays us
		VIC = {
			country_event = {
				id = GOE_generic_events.3
				hours = 1
			}
		}
		custom_effect_tooltip = GOE_generic_events_1_tt
	}
	# Declare Independence
	option = {
		name = GOE_generic_events.1.c
		ai_chance = {
			base = 0
			modifier = {
				add = 10
				is_historical_focus_on = no
			}
			modifier = {
            	add = 50
            	surrender_progress > 0.30
            }
		}
		trigger = {
			has_capitulated = no # Can only declare independence if they have not already capitulated, i.e been captured by for example another Axis member  
		}
		# Syria betrays us
		VIC = {
			country_event = {
				id = GOE_generic_events.4
				hours = 1
			}
		}

		# Check if any of our states are to go as spoils to Iraq or other enemies 
		# Deir az Zur 
		IF = {
			limit = {
				680 = {
					is_owned_by = ROOT
					NOT = {
						is_controlled_by = ROOT
					}
				}
			}
			680 = {
				controller = {
					transfer_state = PREV
				}
			}
		}
		# Alexandretta 
		IF = {
			limit = {
				799 = {
					is_owned_by = ROOT
					NOT = {
						is_controlled_by = ROOT
					}
				}
			}
			799 = {
				controller = {
					transfer_state = PREV
				}
			}
		}
		# Aleppo 
		IF = {
			limit = {
				677 = {
					is_owned_by = ROOT
					NOT = {
						is_controlled_by = ROOT
					}
				}
			}
			677 = {
				controller = {
					transfer_state = PREV
				}
			}
		}
		# Damascus  
		IF = {
			limit = {
				554 = {
					is_owned_by = ROOT
					NOT = {
						is_controlled_by = ROOT
					}
				}
			}
			554 = {
				controller = {
					transfer_state = PREV
				}
			}
		}
		# Lebanon  
		IF = {
			limit = {
				553 = {
					is_owned_by = ROOT
					NOT = {
						is_controlled_by = ROOT
					}
				}
			}
			553 = {
				controller = {
					transfer_state = PREV
				}
			}
		}

		OVERLORD = {
			end_puppet = ROOT
		}
		drop_cosmetic_tag = yes

		every_country = {
			limit = {
				has_war_with = ROOT
			}
			white_peace = ROOT
		}
		IF = {
			limit = {
				is_in_faction = yes 
			}
			leave_faction = yes 
		}
		custom_effect_tooltip = GOE_generic_events_1_tt
	}
}

# Syria/Lebanon stays loyal to us
country_event = {
	id = GOE_generic_events.2
	title = GOE_generic_events.2.t
	desc = GOE_generic_events.2.desc
	picture = GFX_report_event_generic_sign_treaty2
	is_triggered_only = yes
	# ok
	option = {
		name = GOE_generic_events.2.a
		ai_chance = {
			base = 10
		}
	}	
}

# Syria/Lebanon betray us
country_event = {
	id = GOE_generic_events.3
	title = GOE_generic_events.3.t
	desc = GOE_generic_events.3.desc
	picture = GFX_report_event_generic_sign_treaty2
	is_triggered_only = yes
	# DoW FROM
	option = {
		name = GOE_generic_events.3.a
		ai_chance = {
			base = 1
			modifier = {
				factor = 20
				is_historical_focus_on = yes
			}
		}
		add_ai_strategy = { 
			type = conquer 
			id = FROM
			value = 100
		}
		create_wargoal = {
			target = FROM
			type = puppet_wargoal_focus
		}
		FROM = {
			country_event = {
				id = GOE_generic_events.5
				hours = 1
			}
		}
	}	
	# Oh well
	option = {
		name = GOE_generic_events.3.b
		ai_chance = {
			base = 10
		}
	}
}

# Syria/Lebanon declare independence
country_event = {
	id = GOE_generic_events.4
	title = GOE_generic_events.4.t
	desc = GOE_generic_events.4.desc
	picture = GFX_report_event_generic_sign_treaty2
	is_triggered_only = yes
	# DoW FROM
	option = {
		name = GOE_generic_events.4.a
		ai_chance = {
			base = 1
			modifier = {
				factor = 20
				is_historical_focus_on = no
			}
		}
		add_ai_strategy = { 
			type = conquer 
			id = FROM
			value = 100
		}
		create_wargoal = {
			target = FROM
			type = puppet_wargoal_focus
		}
		FROM = {
			country_event = {
				id = GOE_generic_events.5
				hours = 1
			}
		}
	}	
	# Oh well
	option = {
		name = GOE_generic_events.4.b
		ai_chance = {
			base = 10
		}
	}
}

# France declares war upon us
country_event = {
	id = GOE_generic_events.5
	title = GOE_generic_events.5.t
	desc = GOE_generic_events.5.desc
	picture = GFX_report_event_generic_sign_treaty2
	is_triggered_only = yes
	# ok
	option = {
		name = GOE_generic_events.5.a
		ai_chance = {
			base = 10
		}
		add_war_support = 0.1
		add_political_power = 50
	}	
}