﻿###########################
#Philippines Events
###########################
#By PPsyrius
###########################

add_namespace = phil

country_event = { #Introduction
	id = phil.0
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.0" }
	title = phil.0.t
	desc = phil.0.d
	picture = GFX_report_event_samoa

	is_triggered_only = yes

	trigger = {
		is_ai = no
		NOT = { has_global_flag = player_dislikes_colonial_flavour_flag }
	}
	#minor_flavor = yes

	option = {
		name = phil.0.a
	}
}

country_event = { #Syndicalist uprising in Manilla
	id = phil.1
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.1" }
	title = phil.1.t
	desc = phil.1.d
	picture = GFX_report_event_factory

	is_triggered_only = yes

	trigger = {
		tag = PHI
	}

	option = { #
		name = phil.1.a
		ai_chance = {
			factor = 40
		}
		add_stability = -0.01
		hidden_effect = {
			PHI = { country_event = { id = PHI.political.020 hours = 24 } } #The Declaration of the Republic
		}
	}
}

#The Army Counter-Coup
country_event = { #A counter-coup?
	id = phil.2
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.2" }
	title = phil.2.t
	desc = phil.2.d
	picture = GFX_report_event_spain_civil_war_soldiers

	is_triggered_only = yes

	option = { #The army joins the rebels and the government is toppled
		name = phil.2.a
		ai_chance = {
			factor = 60
			modifier = {
				factor = 0
				OR = {
					has_game_rule = {
						rule = PHI_politic
						option = PHI_POLITIC_DEMOCRACY
						}
					has_game_rule = {
						rule = PHI_politic
						option = PHI_POLITIC_DICTATOR
						}
				}
			}
		}
		clr_country_flag = GEA_support_philp_military
		add_political_power = -100
		add_stability = -0.10
		set_politics = {
			ruling_party = syndicalist
			elections_allowed = no
		}
		hidden_effect = {
			if = {
				limit = { country_exists = GEA }
				GEA = {
					country_event = { id = Ostasien.61 days = 2 }
				}
			}
			#This immediately causes a Syndicalist victory
			news_event = { id = worldnews.60 days = 1 }
			set_country_flag = PHI_SOCIALIST
			add_popularity = {
				ideology = totalist
				popularity = 0.08
			}
			add_popularity = {
				ideology = radical_socialist
				popularity = 0.16
			}
			add_popularity = {
				ideology = syndicalist
				popularity = 0.29
			}
			add_popularity = {
				ideology = social_democrat
				popularity = 0.11
			}
			remove_all_ministers = yes
			create_country_leader = {
				name = "Crisanto Evangelista"
				picture = "gfx/leaders/PHI/Portrait_Philippines_Crisanto_Evangelista.png"
				expire = "1943.6.2"
				ideology = syndicalist_subtype
			}
			add_ideas = {
				PHI_Pedro_Abad_Santos_hog_syn
				PHI_Casto_Alejandrino_for_syn
				PHI_Herminegildo_Cruz_eco_syn
				PHI_Guillermo_Capadocia_sec_syn
			}
		}
	}

	option = { #Loyal units storm the capital and evict the Syndicalists
		name = phil.2.b
		ai_chance = {
			factor = 30
			modifier = {
				factor = 2
				has_country_flag = GEA_support_philp_military
			}
			modifier = {
				factor = 0
				has_game_rule = {
					rule = PHI_politic
					option = PHI_POLITIC_SOCIALIST
				}
			}
		}
		clr_country_flag = GEA_support_philp_military
		add_political_power = -200
		add_stability = -0.20
		hidden_effect = {
			country_event = { id = phil.4 days = 1 }
		}
	}
}

country_event = { #The Revolution is Defeated
	id = phil.4
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.4" }
	title = phil.4.t
	desc = phil.4.d
	picture = GFX_report_event_PHI_manila_uprising2

	is_triggered_only = yes

	option = {
		name = phil.4.a #Democracy
		ai_chance = {
			factor = 20
			modifier = {
				factor = 0
				has_game_rule = {
					rule = PHI_politic
					option = PHI_POLITIC_DICTATOR
					}
			}
		}
		add_political_power = 100
		add_stability = 0.10
		set_country_flag = PHI_DEMOCRACY
		hidden_effect = {
			news_event = { id = worldnews.58 days = 1 }
			add_popularity = {
				ideology = social_democrat
				popularity = 0.02
			}
			add_popularity = {
				ideology = social_liberal
				popularity = 0.16
			}
			add_popularity = {
				ideology = market_liberal
				popularity = 0.08
			}
			add_popularity = {
				ideology = social_conservative
				popularity = 0.04
			}
		}
	}

	option = {
		#This ends in a military coup
		name = phil.4.b #Military Junta
		ai_chance = {
			factor = 80
			modifier = {
				factor = 0
				has_game_rule = {
					rule = PHI_politic
					option = PHI_POLITIC_DEMOCRACY
					}
			}
		}
		add_political_power = -100
		add_stability = -0.10
		set_country_flag = PHI_DICTATOR
		set_party_name = { #KTP
			ideology = authoritarian_democrat
			long_name = PHI_authoritarian_democrat_party_KTP_long
			name = PHI_authoritarian_democrat_party_KTP
		}
		set_politics = {
			ruling_party = authoritarian_democrat
			elections_allowed = no
		}
		hidden_effect = {
			news_event = { id = worldnews.59 days = 1 }
			add_popularity = {
				ideology = social_conservative
				popularity = 0.02
			}
			add_popularity = {
				ideology = authoritarian_democrat
				popularity = 0.27
			}
			add_popularity = {
				ideology = paternal_autocrat
				popularity = 0.11
			}
			add_popularity = {
				ideology = national_populist
				popularity = 0.09
			}
			create_country_leader = {
				name = "Basilio J. Valdes"
				picture = "gfx/leaders/PHI/Portrait_Philippines_Basilio_J_Valdez.png"
				expire = "1970.1.26"
				ideology = authdem_junta_subtype
			}
			remove_all_ministers = yes
			add_ideas = {
				PHI_Basilio_J_Valdez_hog_ade
				PHI_Ferdinand_Marcos_for_sco
				PHI_Ramon_Magsaysay_eco_sco
				PHI_Benigno_Aquino_sr_sec_ade
			}
		}
	}
}

country_event = { #Economical crisis approaching
	id = phil.6
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.6" }
	title = phil.6.t
	desc = phil.6.d

	fire_only_once = yes

	is_triggered_only = yes

	trigger = {
		tag = PHI
		is_subject = no
		has_war = no
		OR = {
			has_country_flag = PHI_DEMOCRACY
			has_country_flag = PHI_DICTATOR
			has_country_flag = PHI_SOCIALIST
		}
	}

	option = {
		name = phil.6.a #Expand Armed Forces
		ai_chance = {
			factor = 33
		}
		set_country_flag = PHI_ARMY
		hidden_effect = {
			country_event = {
				id = phil.7
				days = 50
			}
		}
	}
	option = {
		name = phil.6.b #Industrial
		ai_chance = {
			factor = 34
		}
		set_country_flag = PHI_INDUSTRY
		hidden_effect = {
			country_event = {
				id = phil.7
				days = 50
			}
		}
	}
	option = {
		name = phil.6.c #Mining
		ai_chance = {
			factor = 33
		}
		set_country_flag = PHI_MINING
		hidden_effect = {
			country_event = {
				id = phil.7
				days = 50
			}
		}
	}
}

country_event = { #Economical development plan
	id = phil.7
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.7" }
	title = phil.7.t

	desc = {
		text = phil.7.d.main
		trigger = {
			NOT = {
				GER = { has_country_flag = PHI_refused_aid }
				JAP = { has_country_flag = PHI_refused_aid }
				AST = { has_country_flag = PHI_refused_aid }
				FRA = { has_country_flag = PHI_refused_aid }
				USA = { has_country_flag = PHI_refused_aid }
			}
		}
	}
	desc = {
		text = phil.7.d.return
		trigger = {
			OR = {
				GER = { has_country_flag = PHI_refused_aid }
				JAP = { has_country_flag = PHI_refused_aid }
				AST = { has_country_flag = PHI_refused_aid }
				FRA = { has_country_flag = PHI_refused_aid }
				USA = { has_country_flag = PHI_refused_aid }
			}
		}
	}

	is_triggered_only = yes

	option = {
		name = phil.7.a #GER
		trigger = {
			GER = {
				is_faction_leader = yes
				has_socialist_government = no
				NOT = { has_war_with = ROOT }
				NOT = { has_country_flag = PHI_refused_aid }
			}
			OR = {
				is_in_faction_with = GER
				is_in_faction = no
			}
			NOT = { is_in_array = { global.asian_economic_sphere = "PHI" } }
			has_socialist_government = no
		}
		ai_chance = {
			factor = 20
		}
		if = {
			limit = { has_country_flag = PHI_ARMY }
			GER = { country_event = phil.8 }
		}
		if = {
			limit = { has_country_flag = PHI_INDUSTRY }
			GER = { country_event = phil.9 }
		}
		if = {
			limit = { has_country_flag = PHI_MINING }
			GER = { country_event = phil.10 }
		}
		reverse_add_opinion_modifier = { target = JAP modifier = KR_disapproves_of_govt }
	}
	option = {
		name = phil.7.b #JAP
		trigger = {
			JAP = {
				is_faction_leader = yes
				has_socialist_government = no
				NOT = { has_war_with = ROOT }
				NOT = { has_country_flag = PHI_refused_aid }
			}
			OR = {
				is_in_faction_with = JAP
				is_in_faction = no
			}
			has_socialist_government = no
		}
		ai_chance = {
			factor = 80
			modifier = {
				factor = 2
				is_in_array = { global.asian_economic_sphere = "PHI" }
			}
		}
		if = {
			limit = { has_country_flag = PHI_ARMY }
			JAP = { country_event = phil.8 }
		}
		if = {
			limit = { has_country_flag = PHI_INDUSTRY }
			JAP = { country_event = phil.9 }
		}
		if = {
			limit = { has_country_flag = PHI_MINING }
			JAP = { country_event = phil.10 }
		}
		reverse_add_opinion_modifier = { target = GER modifier = KR_disapproves_of_govt }
	}
	option = {
		name = phil.7.c #Australia + Entente
		trigger = {
			AST = {
				exists = yes
				has_socialist_government = no
				is_in_faction_with = CAN
				NOT = { has_war_with = ROOT }
				NOT = { has_country_flag = PHI_refused_aid }
			}
			OR = {
				is_in_faction_with = AST
				is_in_faction = no
			}
			NOT = { is_in_array = { global.asian_economic_sphere = "PHI" } }
			has_socialist_government = no
		}
		ai_chance = {
			factor = 20
		}
		if = {
			limit = { has_country_flag = PHI_ARMY }
			AST = { country_event = phil.8 }
		}
		if = {
			limit = { has_country_flag = PHI_INDUSTRY }
			AST = { country_event = phil.9 }
		}
		if = {
			limit = { has_country_flag = PHI_MINING }
			AST = { country_event = phil.10 }
		}
		reverse_add_opinion_modifier = { target = GER modifier = KR_disapproves_of_govt }
		reverse_add_opinion_modifier = { target = JAP modifier = KR_disapproves_of_govt }
	}
	option = {
		name = phil.7.e #Commune of France
		trigger = {
			FRA = {
				is_faction_leader = yes
				has_socialist_government = yes
				NOT = { has_war_with = ROOT }
				NOT = { has_country_flag = PHI_refused_aid }
			}
			OR = {
				is_in_faction_with = FRA
				is_in_faction = no
			}
			NOT = { is_in_array = { global.asian_economic_sphere = "PHI" } }
			has_socialist_government = yes
		}
		ai_chance = {
			factor = 80
		}
		if = {
			limit = { has_country_flag = PHI_ARMY }
			FRA = { country_event = phil.8 }
		}
		if = {
			limit = { has_country_flag = PHI_INDUSTRY }
			FRA = { country_event = phil.9 }
		}
		if = {
			limit = { has_country_flag = PHI_MINING }
			FRA = { country_event = phil.10 }
		}
		reverse_add_opinion_modifier = { target = GER modifier = KR_disapproves_of_govt }
		reverse_add_opinion_modifier = { target = JAP modifier = KR_disapproves_of_govt }
		reverse_add_opinion_modifier = { target = CAN modifier = KR_disapproves_of_govt }
		reverse_add_opinion_modifier = { target = AST modifier = KR_disapproves_of_govt }
	}
	option = {
		name = phil.7.f #USA
		trigger = {
			USA = {
				has_elected_government = yes
				NOT = {
					has_war_with = CAL
					has_war_with = TEX
					has_war_with = CSA
					has_war_with = ROOT
					has_country_flag = PHI_refused_aid
				}
			}
			NOT = { is_in_array = { global.asian_economic_sphere = "PHI" } }
			is_in_faction = no
			has_elected_government = yes
		}
		ai_chance = {
			factor = 20
		}
		if = {
			limit = { has_country_flag = PHI_ARMY }
			USA = { country_event = phil.8 }
		}
		if = {
			limit = { has_country_flag = PHI_INDUSTRY }
			USA = { country_event = phil.9 }
		}
		if = {
			limit = { has_country_flag = PHI_MINING }
			USA = { country_event = phil.10 }
		}
		reverse_add_opinion_modifier = { target = JAP modifier = KR_disapproves_of_govt }
	}
	option = {
		name = phil.7.g #nobody
		ai_chance = {
			factor = 1
		}
		add_stability = -0.10
	}
}

country_event = { #A request from the Philippines
	id = phil.8
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.8" }
	title = phil.8.t
	desc = phil.8.d

	is_triggered_only = yes

	option = {
		name = phil.8.a #Help Philly
		ai_chance = {
			factor = 80
			modifier = {
				factor = 0.5
				has_political_power < 100
			}
			modifier = {
				factor = 0.5
				has_political_power < 0
			}
		}
		add_political_power = -100
		reverse_add_opinion_modifier = { target = PHI modifier = PHI_aid_help } #100
		add_timed_idea = {
			idea = PHI_aid_big
			days = 30
		}
		hidden_effect = {
			FROM = {
				country_event = { id = phil.11 days = 350 }
			}
		}
	}
	option = {
		name = phil.8.b #Ignore Philly
		ai_chance = {
			factor = 20
			modifier = {
				factor = 0.5
				has_political_power > 100
			}
		}
		set_country_flag = PHI_refused_aid
		reverse_add_opinion_modifier = { target = PHI modifier = PHI_aid_ignore } #-50
		hidden_effect = {
			FROM = {
				country_event = { id = phil.7 days = 3 }
			}
		}
	}
}

country_event = { #A request from the Philippines
	id = phil.9
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.9" }
	title = phil.9.t
	desc = phil.9.d

	is_triggered_only = yes

	option = {
		name = phil.9.a #Help Philly
		ai_chance = {
			factor = 80
			modifier = {
				factor = 0.5
				has_political_power < 100
			}
			modifier = {
				factor = 0.5
				has_political_power < 0
			}
		}
		add_political_power = -100
		reverse_add_opinion_modifier = { target = PHI modifier = PHI_aid_help } #100
		add_timed_idea = {
			idea = PHI_aid_small
			days = 30
		}
		hidden_effect = {
			FROM = {
				country_event = { id = phil.12 days = 350 }
			}
		}
	}
	option = {
		name = phil.9.b #Ignore Philly
		ai_chance = {
			factor = 20
			modifier = {
				factor = 0.5
				has_political_power > 100
			}
		}
		set_country_flag = PHI_refused_aid
		reverse_add_opinion_modifier = { target = PHI modifier = PHI_aid_ignore } #-50
		hidden_effect = {
			FROM = {
				country_event = { id = phil.7 days = 3 }
			}
		}
	}
}

country_event = { #A request from the Philippines
	id = phil.10
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.10" }
	title = phil.10.t
	desc = phil.10.d

	is_triggered_only = yes

	option = {
		name = phil.10.a #Help Philly
		ai_chance = {
			factor = 80
			modifier = {
				factor = 0.5
				has_political_power < 100
			}
			modifier = {
				factor = 0.5
				has_political_power < 0
			}
		}
		add_political_power = -100
		reverse_add_opinion_modifier = { target = PHI modifier = PHI_aid_help } #100
		add_timed_idea = {
			idea = PHI_aid_small
			days = 30
		}
		hidden_effect = {
			FROM = {
				country_event = { id = phil.13 days = 350 }
			}
		}
	}
	option = {
		name = phil.10.b #Ignore Philly
		ai_chance = {
			factor = 20
			modifier = {
				factor = 0.5
				has_political_power > 100
			}
		}
		set_country_flag = PHI_refused_aid
		reverse_add_opinion_modifier = { target = PHI modifier = PHI_aid_ignore } #-50
		hidden_effect = {
			FROM = {
				country_event = { id = phil.7 days = 3 }
			}
		}
	}
}

country_event = { #New units raised
	id = phil.11
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.11" }
	title = phil.11.t
	desc = phil.11.d

	is_triggered_only = yes

	option = {
		name = phil.11.a #Great!
		add_stability = 0.05
		add_ideas = PHI_mil_bonus
		custom_effect_tooltip = PHI_germil_tt
		hidden_effect = {
			load_oob = "PHI_modernized_mil"
		}
		set_country_flag = PHI_received_aid_@FROM
	}
}

country_event = { #New factories built
	id = phil.12
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.12" }
	title = phil.12.t
	desc = phil.12.d

	is_triggered_only = yes

	option = {
		name = phil.12.a #Great!
		add_political_power = 50
		add_ideas = PHI_ind_bonus
		random_owned_controlled_state = {
			prioritize = { 623 }
			limit = { is_core_of = ROOT }
			add_extra_state_shared_building_slots = 2
			add_building_construction = {
				type = industrial_complex
				level = 2
				instant_build = yes
			}
		}
		set_country_flag = PHI_received_aid_@FROM
	}
}

country_event = { #Economical expansion
	id = phil.13
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.13" }
	title = phil.13.t
	desc = phil.13.d

	is_triggered_only = yes

	option = {
		name = phil.13.a #Great!
		add_political_power = 50
		add_ideas = PHI_eco_bonus
		if = {
			limit = { owns_state = 623 }
			add_resource = {
				type = steel
				amount = 8
				state = 623
			}
		}
		if = {
			limit = { owns_state = 627 }
			add_resource = {
				type = tungsten
				amount = 4
				state = 627
			}
		}
		if = {
			limit = { owns_state = 628 }
			add_resource = {
				type = aluminium
				amount = 4
				state = 628
			}
		}
		set_country_flag = PHI_received_aid_@FROM
	}
}

country_event = { #A naval base in the Philippines?
	id = phil.14
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.14" }
	title = phil.14.t
	desc = phil.14.d

	fire_only_once = yes

	trigger = {
		OR = {
			tag = GER
			tag = JAP
		}
		is_faction_leader = yes
		623 = { is_owned_and_controlled_by = PHI }
		"PHI" = {
			exists = yes
			is_in_faction = no
			is_subject = no
			NOT = { has_war_with = ROOT }
			controls_all_owned_states = yes
			has_socialist_government = no
			has_country_flag = PHI_received_aid_@ROOT
		}
		if = {
			limit = { tag = GER }
			NOT = { has_war_with = FRA }
		}
		OR = {
			has_war = no
			controls_all_owned_states = yes
		}
	}

	mean_time_to_happen = {
		months = 6
	}

	option = {
		name = phil.14.a #Propose them a deal
		ai_chance = {
			factor = 70
		}
		"PHI" = {
			country_event = phil.15
		}
	}
	option = {
		name = phil.14.b #We don't need them
		ai_chance = {
			factor = 30
		}
		"PHI" = { clr_country_flag = PHI_received_aid_@ROOT }
	}
}

country_event = { #A proposal for naval base
	id = phil.15
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.15" }
	title = phil.15.t
	desc = phil.15.d

	is_triggered_only = yes

	option = {
		name = phil.15.a #Not for Sale!
		ai_chance = {
			factor = 30
			modifier = {
				factor = 2
				FROM = { NOT = { tag = JAP } }
				is_in_array = { global.asian_economic_sphere = ROOT }
			}
		}
		clr_country_flag = PHI_received_aid_@FROM
		add_stability = 0.10
		FROM = {
			country_event = { id = phil.21 days = 1 }
		}
	}
	option = {
		name = phil.15.b #Counter-propose for free factories
		ai_chance = {
			factor = 70
		}
		FROM = {
			country_event = { id = phil.16 days = 1 }
		}
	}
}

country_event = { #Philippinean demands
	id = phil.16
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.16" }
	title = phil.16.t
	desc = phil.16.d
	picture = GFX_report_event_spain_civil_war_soldiers

	is_triggered_only = yes

	trigger = {
		FROM = {
			exists = yes
			is_in_faction = no
			NOT = { has_war_with = ROOT }
		}
	}

	option = {
		name = phil.16.a #Not worth the trouble
		ai_chance = {
			factor = 20
		}
		FROM = {
			clr_country_flag = PHI_received_aid_@ROOT
			country_event = { id = phil.21 days = 1 }
		}
	}
	option = {
		name = phil.16.b #It's a deal!
		ai_chance = {
			factor = 80
		}
		add_political_power = -50
		add_timed_idea = {
			idea = PHI_aid_big
			days = 30
		}
		reverse_add_opinion_modifier = { target = PHI modifier = PHI_continue_aid } #50
		hidden_effect = {
			FROM = {
				country_event = {
					id = phil.17
					days = 200
				}
			}
		}
	}
}

country_event = { #Naval base inaugurated
	id = phil.17
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.17" }
	title = phil.17.t
	desc = phil.17.d

	is_triggered_only = yes

	trigger = {
		FROM = {
			exists = yes
			NOT = { has_war_with = ROOT }
		}
	}

	option = {
		name = phil.17.a #Great!
		clr_country_flag = PHI_received_aid_@FROM
		set_country_flag = PHI_naval_base_@FROM
		623 = { #Luzon
			if = {
				limit = { is_owned_by = PHI }
				add_building_construction = {
					type = naval_base
					province = 12213
					level = 3
					instant_build = yes
				}
			}
		}
		random_owned_controlled_state = {
			limit = { is_core_of = ROOT }
			add_extra_state_shared_building_slots = 1
			add_building_construction = {
				type = industrial_complex
				level = 1
				instant_build = yes
			}
		}
		random_owned_controlled_state = {
			limit = { is_core_of = ROOT }
			add_extra_state_shared_building_slots = 1
			add_building_construction = {
				type = industrial_complex
				level = 1
				instant_build = yes
			}
		}
		if = {
			limit = {
				NOT = {
					is_in_faction_with = FROM
					gives_military_access_to = FROM
				}
			}
			effect_tooltip = { give_military_access = FROM }
		}
		reverse_add_opinion_modifier = { target = FROM modifier = KR_approves_of_govt }
		hidden_effect = {
			FROM = {
				country_event = phil.18
			}
		}
	}
}

country_event = { #New base in the Philippines
	id = phil.18
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.18" }
	title = phil.18.t
	desc = phil.18.d

	is_triggered_only = yes

	option = {
		name = phil.18.a #Great!
		reverse_add_opinion_modifier = { target = FROM modifier = KR_approves_of_govt }
		if = {
			limit = {
				NOT = {
					is_in_faction_with = FROM
					FROM = { gives_military_access_to = ROOT }
				}
			}
			FROM = { give_military_access = ROOT }
		}
	}
}

country_event = { #An alliance with the Philippines?
	id = phil.19
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.19" }
	title = phil.19.t
	desc = phil.19.d
	picture = GFX_report_event_spain_civil_war_soldiers

	fire_only_once = yes

	is_triggered_only = yes

	trigger = {
		OR = {
			tag = GER
			tag = JAP
			tag = CAN
			tag = GBR
		}
		is_faction_leader = yes
		"PHI" = {
			exists = yes
			is_in_faction = no
			has_war = no
			has_socialist_government = no
			has_country_flag = PHI_naval_base_@ROOT
		}
		OR = {
			has_war = no
			surrender_progress < 0.20
		}
	}

	option = {
		name = phil.19.a #Not interested
		ai_chance = {
			factor = 20
		}
	}
	option = {
		name = phil.19.b #Make a proprosal
		ai_chance = {
			factor = 80
		}
		"PHI" = {
			country_event = phil.20
		}
	}
}

country_event = { #Join their faction?
	id = phil.20
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.20" }
	title = phil.20.t
	desc = phil.20.d

	is_triggered_only = yes

	option = {
		name = phil.20.a #Too Dangerous
		ai_chance = {
			factor = 20
			modifier = {
				factor = 0
				FROM = { tag = JAP }
				is_in_array = { global.asian_economic_sphere = ROOT }
			}
		}
		add_stability = 0.05
		FROM = {
			country_event = { id = phil.21 days = 1 }
		}
	}
	option = {
		name = phil.20.b #Accept the Proposal
		ai_chance = {
			factor = 80
			modifier = {
				factor = 0.5
				FROM = { NOT = { tag = JAP } }
				is_in_array = { global.asian_economic_sphere = ROOT }
			}
		}
		add_war_support = 0.05
		FROM = {
			add_to_faction = ROOT
		}
	}
}

country_event = { #Deal refused
	id = phil.21
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.21" }
	title = phil.21.t
	desc = phil.21.d

	is_triggered_only = yes

	option = {
		name = phil.21.a
		add_opinion_modifier = { target = FROM modifier = KR_disapproves_of_govt }
	}
}

country_event = { #The Sabah Dispute
	id = phil.22
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.22" }
	title = phil.22.t
	desc = phil.22.d
	picture = GFX_report_event_spain_civil_war_soldiers

	fire_only_once = yes

	trigger = {
		tag = PHI
		is_subject = no
		FRA = {
			NOT = {
				has_war_with = PHI
			}
		}
		JAP = {
			NOT = {
				has_war_with = PHI
			}
		}
		"PHI" = {
			is_in_faction_with = GEA
		}
		OR = {
			828 = {
				is_controlled_by = GEA
				} #Sabah
			828 = {
				is_controlled_by = MLY
			}
			828 = {
				is_controlled_by = SAR
			}
		}
	}

	mean_time_to_happen = {
		months = 24
	}

	option = {
		name = phil.22.a #Dial Germany
		ai_chance = {
			factor = 60
		}
		"PHI" = {
			add_state_claim = 828
		}
		hidden_effect = {
			GEA = {
				country_event = phil.23
			}
		}
	}
	option = {
		name = phil.22.b #Present Our Claims
		ai_chance = {
			factor = 30
		}
		"PHI" = {
			add_state_claim = 828
		}
		"PHI" = {
			add_political_power = -20
			} #1 dissent
	}
	option = {
		name = phil.22.c #F@ck Sabah, we're not interested
		ai_chance = {
			factor = 10
		}
		"PHI" = {
			add_political_power = -100
			} #5 dissent
		add_opinion_modifier = {
			target = GEA
			modifier = PHI_Sabah_GER
			} #10
	}
}

country_event = { #Philippine claims to Sabah
	id = phil.23
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.23" }
	title = phil.23.t
	desc = phil.23.d
	picture = GFX_report_event_spain_civil_war_soldiers

	is_triggered_only = yes

	option = {
		name = phil.23.a #Cede Sabah to them
		ai_chance = {
			factor = 20
		}
		GEA = {
			add_political_power = -20
			} #1 dissent
		add_opinion_modifier = {
			target = PHI
			modifier = PHI_filipino_Sabah
			} #50
		"PHI" = {
			remove_state_claim = 828 #Sabah
			add_state_core = 828
			transfer_state = 828
		}
	}
	option = {
		name = phil.23.b #They must pay for it
		ai_chance = {
			factor = 40
		}
		hidden_effect = {
			"PHI" = {
				country_event = phil.24
			}
		}
		GEA = {
			add_political_power = -20
			} #1 dissent
	}
	option = {
		name = phil.23.c #Sabah is our clay!
		ai_chance = {
			factor = 40
		}
		add_opinion_modifier = {
			target = PHI
			modifier = PHI_Sabah_GER_ignore
			} #-10
	}
}

country_event = { #German Proposal
	id = phil.24
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.24" }
	title = phil.24.t
	desc = phil.24.d
	picture = GFX_report_event_spain_civil_war_soldiers

	is_triggered_only = yes

	option = {
		name = phil.24.a #Accept their demands
		ai_chance = {
			factor = 75
		}
		hidden_effect = {
			GEA = {
				country_event = phil.25
			}
		}
		"PHI" = {
			add_political_power = 20
			} #-1 dissent
		"PHI" = {
			add_timed_idea = {
				idea = PHI_Sabah_purchase
				days = 30
			}
		}
		GEA = {
			add_timed_idea = {
				idea = PHI_Sabah_income
				days = 30
			}
		}
	}
	option = {
		name = phil.24.b #Too expensive
		ai_chance = {
			factor = 25
		}
		"PHI" = {
			add_political_power = -20
			} #1 dissent
	}
}

country_event = { #The Transfer of Sabah
	id = phil.25
	title = phil.25.t
	desc = phil.25.d
	picture = GFX_report_event_spain_civil_war_soldiers

	is_triggered_only = yes

	immediate = {
		log = "[GetDateText]: [Root.GetName]: event phil.25"
		"PHI" = {
			remove_state_claim = 828 #Sabah
			add_state_core = 828
			transfer_state = 828
		}
		add_opinion_modifier = {
			target = PHI
			modifier = PHI_filipino_Sabah
			} #50
	}
	option = {
		name = phil.23.a #OK
	}
}

country_event = { #The Sabah Dispute
	id = phil.40
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.40" }
	title = phil.40.t
	desc = phil.40.d
	picture = GFX_report_event_spain_civil_war_soldiers

	fire_only_once = yes

	trigger = {
		tag = PHI
		is_in_faction = yes
		is_subject = no
		828 = {
			is_not_claim_or_core_of_ROOT = yes
			owner = {
				OR = {
					tag = GER
					tag = MLY
					tag = SAR
				}
				NOT = {
					is_in_faction_with = ROOT
					has_war_with = ROOT
					is_subject_of = ROOT
				}
			}
		}
	}

	mean_time_to_happen = {
		months = 6
	}

	option = {
		name = phil.40.a #Present Our Claims
		ai_chance = {
			factor = 75
		}
		add_war_support = 0.05
		add_state_claim = 828
		828 = {
			owner = {
				add_opinion_modifier = { target = ROOT modifier = PHI_Sabah_menace }
				country_event = phil.41
				if = {
					limit = { is_subject = yes }
					overlord = {
						add_opinion_modifier = { target = ROOT modifier = PHI_Sabah_menace }
						country_event = phil.41
					}
				}
			}
		}
	}
	option = {
		name = phil.40.b #F@ck Sabah, we're not interested
		ai_chance = {
			factor = 25
		}
		add_political_power = -50
	}
}

country_event = { #Philippinean claims to Sabah
	id = phil.41
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.41" }
	title = phil.41.t
	desc = phil.41.d
	picture = GFX_report_event_spain_civil_war_soldiers

	is_triggered_only = yes

	option = {
		name = phil.41.a #Wait, What?!?!
	}
}

country_event = { #Claiming Sabah
	id = phil.42
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.42" }
	title = phil.42.t
	desc = phil.42.d
	picture = GFX_report_event_spain_civil_war_soldiers

	fire_only_once = yes

	trigger = {
		tag = PHI
		is_in_faction_with = JAP
		828 = {
			is_controlled_by = JAP
		}
	}

	mean_time_to_happen = {
		months = 6
	}

	option = {
		name = phil.42.a #Present Our Claims
		ai_chance = {
			factor = 99
		}
		if = {
			limit = {
				828 = {
					NOT = { is_claimed_by = ROOT }
				}
			}
			add_state_claim = 828
		}
		JAP = {
			country_event = phil.43
		}
	}
	option = {
		name = phil.42.b #F@ck Sabah, we're not interested
		ai_chance = {
			factor = 1
		}
		add_political_power = -50
	}
}

country_event = { #The Phillipines claim Sabah
	id = phil.43
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.43" }
	title = phil.43.t
	desc = phil.43.d
	picture = GFX_report_event_spain_civil_war_soldiers

	is_triggered_only = yes

	option = {
		name = phil.43.a #Transfer Sabah to Them
		ai_chance = {
			factor = 99
		}
		"PHI" = {
			add_opinion_modifier = { target = ROOT modifier = KR_returned_land }
			remove_state_claim = 828 #Sabah
			add_state_core = 828
			transfer_state = 828
		}
	}
	option = {
		name = phil.43.b #Nope
		ai_chance = {
			factor = 1
		}
		add_political_power = 20
		"PHI" = {
			add_opinion_modifier = {
				target = ROOT
				modifier = PHI_JAP_Sabah_nope
			}
		}
	}
}

country_event = { #Seizing the moment
	id = phil.44
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.44" }
	title = phil.44.t
	desc = phil.44.d
	picture = GFX_report_event_spain_civil_war_soldiers

	fire_only_once = yes

	is_triggered_only = yes

	trigger = {
		tag = PHI
		is_subject = no
		GER = {
			has_war = yes
			surrender_progress > 0.50
			NOT = {
				has_war_with = ROOT
				is_in_faction_with = ROOT
			}
		}
		828 = {
			OR = {
				is_owned_and_controlled_by = GER
				owner = {
					is_subject_of = GER
					controls_state = 828
				}
			}
		}
	}

	option = {
		name = phil.44.a #Seize Sabah!
		ai_chance = {
			factor = 90
		}
		add_political_power = 50
		if = {
			limit = {
				828 = {
					NOT = { is_claimed_by = ROOT }
				}
			}
			add_state_claim = 828
		}
		828 = {
			owner = {
				add_opinion_modifier = { target = ROOT modifier = KR_outraged }
				country_event = phil.45
				if = {
					limit = { is_subject = yes }
					overlord = {
						add_opinion_modifier = { target = ROOT modifier = KR_outraged }
					}
				}
			}
		}
	}
	option = {
		name = phil.44.b #Too Dangerous
		ai_chance = {
			factor = 10
		}
		add_political_power = -50
	}
}

country_event = { #The Phillipines attack North Borneo
	id = phil.45
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.45" }
	title = phil.45.t
	desc = phil.45.d
	picture = GFX_report_event_spain_civil_war_soldiers

	is_triggered_only = yes

	option = {
		name = phil.45.a #Evacuate!
		ai_chance = {
			factor = 90
		}
		"PHI" = {
			transfer_state = 828
			remove_state_claim = 828 #Sabah
			add_state_core = 828
		}
	}
	option = {
		name = phil.45.b #This will not go unpunished! War!
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				"PHI" = { is_in_faction = yes }
			}
			modifier = {
				factor = 0
				surrender_progress > 0.65
			}
			modifier = {
				factor = 200
				NOT = { tag = GER }
				controls_all_owned_states = yes
			}
		}
		"PHI" = {
			transfer_state = 828
			declare_war_on = {
				target = ROOT
				type = annex_everything
			}
		}
	}
}

country_event = { #A naval base in the Philippines? (Entente)
	id = phil.52
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.52" }
	title = phil.52.t
	desc = phil.52.d

	fire_only_once = yes

	trigger = {
		tag = ENT
		is_faction_leader = yes
		623 = { is_owned_and_controlled_by = PHI }
		"PHI" = {
			exists = yes
			is_in_faction = no
			is_subject = no
			NOT = { has_war_with = ROOT }
			controls_all_owned_states = yes
			has_country_flag = PHI_received_aid_@AST
		}
		OR = {
			has_war = no
			controls_all_owned_states = yes
		}
	}

	mean_time_to_happen = {
		months = 6
	}

	option = {
		name = phil.14.a #Propose them a deal
		ai_chance = {
			factor = 70
		}
		"PHI" = {
			country_event = phil.15
		}
	}
	option = {
		name = phil.14.b #We don't need them
		ai_chance = {
			factor = 30
		}
		"PHI" = { clr_country_flag = PHI_received_aid_@AST }
	}
}

country_event = { #Syndicalism in East Asia
	id = phil.69
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.69" }
	title = phil.69.t

	desc = {
		text = phil.69.d.bhc
		trigger = {
			BHC = {
				exists = yes
				has_socialist_government = yes
				NOT = { is_in_faction_with = ROOT }
				OR = {
					is_in_faction = no
					is_faction_leader = yes
				}
			}
		}
	}

	desc = {
		text = phil.69.d.nobhc
		trigger = {
			BHC = {
				OR = {
					exists = no
					has_socialist_government = no
					is_in_faction_with = ROOT
					AND = {
						is_in_faction = yes
						is_faction_leader = no
					}
				}
			}
		}
	}

	fire_only_once = yes

	trigger = {
		OR = {
			tag = FRA
			tag = ENG
		}
		is_faction_leader = yes
		has_socialist_government = yes
		"PHI" = {
			exists = yes
			is_in_faction = no
			is_subject = no
			NOT = { has_war_with = ROOT }
			controls_all_owned_states = yes
			has_socialist_government = yes
			has_country_flag = PHI_received_aid_@FRA
		}
		OR = {
			has_war = no
			surrender_progress < 0.25
		}
	}

	mean_time_to_happen = {
		months = 6
	}

	option = {
		name = phil.69.a #Internationale
		ai_chance = {
			factor = 90
			modifier = {
				factor = 3
				AST = { is_in_faction_with = ROOT }
			}
		}
		"PHI" = {
			country_event = phil.20
		}
	}
	option = {
		name = phil.69.b #East Asian Syndicalism
		trigger = {
			BHC = {
				exists = yes
				has_socialist_government = yes
				NOT = { is_in_faction_with = ROOT }
				OR = {
					is_in_faction = no
					is_faction_leader = yes
				}
			}
		}
		ai_chance = {
			factor = 90
			modifier = {
				factor = 3
				has_war_with = GER
				AST = { NOT = { is_in_faction_with = ROOT } }
			}
		}
		BHC = {
			country_event = phil.70
		}
	}
	option = {
		name = phil.69.c #No, we're too lazy for this
		ai_chance = {
			factor = 10
			modifier = {
				factor = 10
				has_war_with = GER
				AST = { NOT = { is_in_faction_with = ROOT } }
				BHC = {
					OR = {
						exists = no
						has_socialist_government = no
						is_in_faction_with = ROOT
						AND = {
							is_in_faction = yes
							is_faction_leader = no
						}
					}
				}
			}
		}
		"PHI" = { clr_country_flag = PHI_received_aid_@FRA }
	}
}

country_event = { #An alliance with the Philippines? (for BHC)
	id = phil.70
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.70" }
	title = phil.70.t
	desc = phil.70.d

	is_triggered_only = yes

	option = {
		name = phil.70.a #Not interested
		ai_chance = {
			factor = 10
		}
		FROM = {
			country_event = phil.21
		}
	}
	option = {
		name = phil.70.b #Make a proprosal
		ai_chance = {
			factor = 90
		}
		"PHI" = {
			country_event = phil.71
		}
	}
}

country_event = { #An alliance in syndicalist Asia??
	id = phil.71
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.71" }
	title = phil.71.t
	desc = phil.71.d

	is_triggered_only = yes

	option = {
		name = phil.71.a #Too Dangerous
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				FROM = { tag = JAP }
				is_in_array = { global.asian_economic_sphere = ROOT }
			}
		}
		add_stability = 0.05
		FROM = {
			country_event = { id = phil.21 days = 1 }
		}
	}
	option = {
		name = phil.71.b #Accept the Proposal
		ai_chance = {
			factor = 90
			modifier = {
				factor = 0.5
				FROM = { NOT = { tag = JAP } }
				is_in_array = { global.asian_economic_sphere = ROOT }
			}
		}
		FROM = {
			if = {
				limit = { is_faction_leader = yes }
				effect_tooltip = { add_to_faction = ROOT }
			}
			else = {
				effect_tooltip = {
					create_faction = syndicalist_asia
					add_to_faction = ROOT
				}
			}
			hidden_effect = {
				country_event = phil.72
			}
		}
	}
}

country_event = { #Has joined the BHC
	id = phil.72
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.72" }
	title = phil.72.t
	desc = phil.72.d

	is_triggered_only = yes

	option = {
		name = phil.72.a
		add_political_power = 50
		if = {
			limit = { is_faction_leader = yes }
			add_to_faction = FROM
		}
		else = {
			create_faction = syndicalist_asia
			add_to_faction = FROM
		}
	}
}

country_event = { #Re-establish ties with the USA?
	id = phil.80
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.80" }
	title = phil.80.t
	desc = phil.80.d

	fire_only_once = yes

	is_triggered_only = yes

	trigger = {
		tag = USA
		is_subject = no
		has_socialist_government = no
		has_completed_focus = USA_back_in_business
		"PHI" = {
			exists = yes
			is_in_faction = no
			is_subject = no
			NOT = { has_war_with = ROOT }
			controls_all_owned_states = yes
			has_socialist_government = no
			has_country_flag = PHI_received_aid_@ROOT
		}
		OR = {
			has_war = no
			controls_all_owned_states = yes
		}
	}

	option = {
		name = phil.14.a #Propose them a deal
		ai_chance = {
			factor = 70
		}
		"PHI" = {
			country_event = phil.83
		}
	}
	option = {
		name = phil.14.b #We don't need them
		ai_chance = {
			factor = 30
		}
		"PHI" = { clr_country_flag = PHI_received_aid_@ROOT }
	}
}

country_event = { #Agrees to re-establish ties
	id = phil.82
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.82" }
	title = phil.82.t
	desc = phil.82.d

	is_triggered_only = yes

	option = {
		name = phil.82.a
		add_political_power = 50
		FROM = { add_opinion_modifier = { target = ROOT modifier = KR_close_allies } }
		give_guarantee = FROM
		diplomatic_relation = {
			country = FROM
			relation = non_aggression_pact
		}
	}
}

country_event = { #A proposal from the Americans
	id = phil.83
	immediate = { log = "[GetDateText]: [Root.GetName]: event phil.83" }
	title = phil.83.t
	desc = phil.83.d
	picture = GFX_report_event_spain_civil_war_soldiers
	is_triggered_only = yes

	option = { #This is a return to colonialism, we're not interested
		name = phil.83.a
		FROM = {
			country_event = { id = phil.21 days = 1 }
		}
	}
	option = { #Accept the Proposal
		name = phil.83.b
		add_political_power = -100
		USA = {
			add_opinion_modifier = { target = ROOT modifier = KR_close_allies }
			effect_tooltip = {
				give_guarantee = PHI
				diplomatic_relation = {
					country = PHI
					relation = non_aggression_pact
				}
			}
			country_event = phil.82
		}
	}
}

