#south east asian countries

add_namespace = asean

add_namespace = timorevent
add_namespace = bruneievent
add_namespace = malaysiaevent

#malaysia
country_event = {
	id = malaysiaevent.1
	title = malaysiaevent.1.t
	desc = malaysiaevent.1.d
	
	fire_only_once = yes
	is_triggered_only = yes
	
	trigger = {
		tag = MAL
	}

	immediate = {
		set_country_flag = cannot_join_faction_flag
		clr_country_flag = head_of_gov_ui_enabled
		set_politics = {	
			ruling_party = nationalist
			elections_allowed = no
		}
		add_popularity = {
			ideology = nationalist
			popularity = 0.6
		}
		create_country_leader = {
			name = "Affendi Buang"
			ideology = military_junta
			picture = GFX_INS_Abdul_Awang
		}
		
		change_economy_type_mixed_economy = yes
		change_government_type_military_dictatorship = yes
	}

	option = {
		name = malaysiaevent.1.a
	}
}
country_event = {
	id = malaysiaevent.2
	title = malaysiaevent.2.t
	desc = malaysiaevent.2.d
	
	fire_only_once = yes
	is_triggered_only = yes
	
	trigger = {
		tag = MAL
	}

	immediate = {
		create_country_leader = {
			name = "Ahmad Zahid Hamidi"
			ideology = radical_nationalism
			picture = GFX_INS_Abdul_Awang
		}
		set_party_name = {
			ideology = nationalist
			long_name = "United Malays National Organisation"
			name = "UMNO"
		}
		add_popularity = {
			ideology = nationalist
			popularity = 0.3
		}

		change_government_type_provisional_government = yes

		country_event = {
			id = malaysiaevent.3
			days = 45
			random_days = 14
		}
	}

	option = {
		name = malaysiaevent.2.a
	}
}

country_event = {
	id = malaysiaevent.3
	title = malaysiaevent.3.t
	desc = malaysiaevent.3.d
	
	fire_only_once = yes
	is_triggered_only = yes
	
	trigger = {
		tag = MAL
	}

	immediate = {
		set_cosmetic_tag = MAL_Nationalism
		change_government_type_presidential_dictatorship = yes
		clr_country_flag = cannot_join_faction_flag
		set_temp_variable = {
			var = global.JAP_influence_MAL_var_temp
			value = 0.7
		}
		JAP_add_MAL_influence = yes
		JAP = {
			give_guarantee = MAL
		}
	}

	option = {
		name = malaysiaevent.3.a
	}
}

country_event = {
	id = malaysiaevent.4
	title = malaysiaevent.4.t
	desc = malaysiaevent.4.d
	
	fire_only_once = yes
	is_triggered_only = yes
	
	trigger = {
		tag = MAL
	}

	immediate = {
		set_politics = {
			ruling_party = authoritarian_democrat
			elections_allowed = no
		}
		create_country_leader = {
			name = "Abdul Hadi bin Awang"
			ideology = islamic_authoritarian
			picture = GFX_INS_Abdul_Awang
		}
		set_party_name = {
			ideology = authoritarian_democrat
			long_name = "Pan-Malaysian Islamic Party"
			name = "PAS"
		}

		add_popularity = {
			ideology = authoritarian_democrat
			popularity = 0.7
		}

		change_government_type_provisional_government = yes

		country_event = {
			id = malaysiaevent.5
			days = 45
			random_days = 14
		}
	}

	option = {
		name = malaysiaevent.4.a
	}
}

country_event = {
	id = malaysiaevent.5
	title = malaysiaevent.5.t
	desc = malaysiaevent.5.d
	
	fire_only_once = yes
	is_triggered_only = yes
	
	trigger = {
		tag = MAL
	}

	immediate = {
		set_cosmetic_tag = MAL_Islamic
		change_government_type_theocracy = yes
		clr_country_flag = cannot_join_faction_flag
		set_temp_variable = {
			var = global.PRC_influence_MAL_var_temp
			value = 0.7
		}
		PRC_add_MAL_influence = yes
		PRC = {
			give_guarantee = MAL
		}
	}

	option = {
		name = malaysiaevent.5.a
	}
}

country_event = {
	id = malaysiaevent.6
	title = malaysiaevent.6.t
	desc = malaysiaevent.6.d
	
	fire_only_once = yes
	is_triggered_only = yes
	
	trigger = {
		tag = MAL
	}

	immediate = {
		clr_country_flag = cannot_join_faction_flag
		set_temp_variable = {
			var = global.PRC_influence_MAL_var_temp
			value = 0.7
		}
		PRC_add_MAL_influence = yes
		PRC = {
			give_guarantee = MAL
		}
	}

	option = {
		name = malaysiaevent.6.a
	}
}

#timor leste
country_event = {
	id = timorevent.1
	title = timorevent.1.t
	desc = timorevent.1.d
	
	fire_only_once = yes
	is_triggered_only = yes
	
	trigger = {
		tag = TTI
	}

	immediate = {
		set_politics = {	
			ruling_party = social_liberal
			last_election = "2022.19.4"
			election_frequency = 40
			elections_allowed = yes
		}

		create_country_leader = {
			name = "José Ramos Horta"
			picture = GFX_INS_Jose_Horta
			ideology = centrist
		}

		add_popularity = {
			ideology = social_liberal
			popularity = 0.5
		}
	}

	option = {
		name = timorevent.1.a
	}
	option = {
		name = timorevent.1.b
	}
}

country_event = {
	id = timorevent.2
	title = timorevent.2.t
	desc = timorevent.2.d
	
	fire_only_once = yes
	is_triggered_only = yes
	
	trigger = {
		tag = TTI
	}

	immediate = {
		PRC = {
			add_to_faction = TTI
		}
		TTI = {
			set_country_flag = eadi_member
		}
	}

	option = {
		name = timorevent.2.a
	}
}

country_event = {
	id = bruneievent.1
	title = bruneievent.1.t
	desc = bruneievent.1.d
	
	fire_only_once = yes
	is_triggered_only = yes
	
	trigger = {
		tag = BDS
	}

	immediate = {
		PRC = {
			add_to_faction = BDS
		}
		BDS = {
			set_country_flag = eadi_member
		}
	}

	option = {
		name = bruneievent.1.a
	}
}

# Malaysian King
country_event = {
	id = asean.1
	title = asean.1.t
	desc = asean.1.d
	picture = GFX_generic_media
	fire_only_once = yes
	is_triggered_only = yes
	
	trigger = {
		tag = MAL
	}

	option = {
		name = asean.1.a
		retire_character = MAL_sultan_abdullah_char
		add_field_marshal_role ={
			Character = MAL_sultan_ibrahim_iskandar_char
			traits={
				commander_in_chief
			}
			skill=2
			attack_skill=1
			defense_skill=1
			planning_skill=2
			logistics_skill=1
		}
	}
}

# Mahatir Resigns
country_event = {
	id = asean.3
	title = asean.3.t
	desc = asean.3.d
	picture = GFX_generic_media
	fire_only_once = yes
	is_triggered_only = yes
	
	trigger = {
		tag = MAL
	}

	option = {
		name = asean.3.a
		set_politics = {
			ruling_party = conservative
			elections_allowed = yes
			last_election = "2018.5.9"
        	election_frequency = 48
		}
		add_popularity = {
			ideology = conservative
			popularity = 0.15
		}
		hidden_effect = {
			country_event = { id = asean.4 days = 1004  }
		}
		set_temp_variable = {
			coalition_partner_var_temp = token:social_liberal
		}
		remove_from_coalition = yes
		set_temp_variable = {
			coalition_partner_var_temp = token:market_liberal
		}
		remove_from_coalition = yes
	}
}

# Malaysia 2022 Election
country_event = {
	id = asean.4
	title = asean.4.t
	desc = asean.4.d
	picture = GFX_generic_elections
	fire_only_once = yes
	is_triggered_only = yes
	
	trigger = {
		tag = MAL
		INS = {
			NOT = {
				has_country_flag = INS_won_confrontation_flag
			}
		}
	}

	option = {
		name = asean.4.a
		set_politics = {
			ruling_party = social_democrat
			elections_allowed = yes
			last_election = "2018.5.9"
        	election_frequency = 48
		}
		add_popularity = {
			ideology = social_democrat
			popularity = 0.15
		}
		set_temp_variable = {
			coalition_partner_var_temp = token:social_liberal
		}
		add_to_coalition = yes
		set_temp_variable = {
			coalition_partner_var_temp = token:market_liberal
		}
		add_to_coalition = yes
	}
}

# Singapore 2023 Election
country_event = {
	id = asean.5
	title = asean.5.t
	desc = asean.5.d
	picture = GFX_generic_elections
	
	is_triggered_only = yes
	immediate = {
		
	}
	
	option = {
		name = asean.5.a
		retire_character = SIG_halimah_yacob_char
	}
}
#PRO-JAP GOVERNMENT (yet to be fully implemented)
country_event = {
	id = asean.6
	title = asean.6.t
	desc = asean.6.d
	picture = GFX_generic_elections
	
	is_triggered_only = yes
	immediate = {
		
	}
	
	option = {
		name = asean.6.a
		hidden_effect = {
			if = {
				limit = {
					tag = LAO
				}
				set_cosmetic_tag = LAO_monarchist
				create_country_leader = {
					name = LAO_soulivong_savang_char
					picture = "gfx/leaders/LAO/LAO_soulivong_savang.png"
					ideology = absolute_monarchist
					traits = {
					}
				}
				create_country_leader = {
					name = LAO_soulivong_savang_char
					picture = "gfx/leaders/LAO/LAO_soulivong_savang.png"
					ideology = ultra_conservatism
					traits = {
					}
				}
				set_politics = {
					ruling_party = nationalist
					elections_allowed = no
				}
				set_party_name = {
					long_name = LAO_khun_lo_dynasty
					name = LAO_khun_lo_dynasty
					ideology = nationalist
				}
				clr_country_flag = head_of_gov_ui_enabled
				add_popularity = {
					ideology = nationalist
					popularity = 0.45
				}
				add_popularity = {
					ideology = authoritarian_democrat
					popularity = 0.15
				}
				add_popularity = {
					ideology = conservative
					popularity = 0.15
				}
			}
			else_if = {
				limit = {
					tag = CAM
				}
				set_politics = {
					ruling_party = social_liberal
					elections_allowed = yes
					election_frequency = 60
				}
				set_popularities = {
					social_liberal = 44
					conservative = 22
					market_liberal = 8
					authoritarian_democrat = 17
					social_democrat = 9
				}
			}
		}
	}
}