﻿###########################
# Portugal Events
# By Timon and Zankoas
###########################

add_namespace = por

#Liberalisation
country_event = {
	id = por.1
	immediate = { log = "[GetDateText]: [Root.GetName]: event por.1" }
	title = por.1.t
	desc = por.1.d
	picture = GFX_report_event_macao

	is_triggered_only = yes
	fire_only_once = yes

	option = {
		name = por.1.a
		add_political_power = 30
	}
	option = {
		name = por.1.b
		set_politics = {
			ruling_party = authoritarian_democrat
			elections_allowed = no
		}
		add_popularity = {
			ideology = authoritarian_democrat
			popularity = 0.25
		}
		country_event = {
			id = por.2
			days = 6
		}
		add_stability = -0.01
	}
}
#Exiles return
country_event = {
	id = por.2
	immediate = { log = "[GetDateText]: [Root.GetName]: event por.2" }
	title = por.2.t
	desc = por.2.d
	picture = GFX_report_event_macao

	is_triggered_only = yes
	fire_only_once = yes

	option = {
		name = por.2.a
		set_party_name = {
			ideology = social_liberal
			long_name = POR_MON_social_liberal_party_long
			name = POR_MON_social_liberal_party
		}
		set_party_name = {
			ideology = market_liberal
			long_name = POR_MON_market_liberal_party_long
			name = POR_MON_market_liberal_party
		}
		set_party_name = {
			ideology = social_conservative
			long_name = POR_MON_social_conservative_party_long
			name = POR_MON_social_conservative_party
		}
		create_country_leader = {
			name = "Duarte II"
			desc = "POLITICS_DUARTE_BRAGANCA_DESC"
			picture = "gfx/leaders/POR/Portrait_Portugal_Duarte_Nuno.png"
			ideology = centrist_subtype
		}

		create_country_leader = {
			name = "Duarte II"
			desc = "POLITICS_DUARTE_BRAGANCA_DESC"
			picture = "gfx/leaders/POR/Portrait_Portugal_Duarte_Nuno.png"
			ideology = marlib_classical_liberalism_subtype
		}

		create_country_leader = {
			name = "Duarte II"
			desc = "POLITICS_DUARTE_BRAGANCA_DESC"
			picture = "gfx/leaders/POR/Portrait_Portugal_Duarte_Nuno.png"
			ideology = christian_democracy_subtype
		}
		country_event = {
			id = por.3
			days = 17
		}		
	}
}

#An alliance with the republicans?
country_event = {
	id = por.3
	immediate = { log = "[GetDateText]: [Root.GetName]: event por.3" }
	title = por.3.t
	desc = por.3.d
	picture = GFX_report_event_macao

	is_triggered_only = yes
	fire_only_once = yes

	option = {
		name = por.3.a
		add_popularity = {
			ideology = authoritarian_democrat
			popularity = 0.05
		}
	}
	option = {
		name = por.3.b
		set_politics = {
			ruling_party = social_conservative
			elections_allowed = no
		}
		add_popularity = {
			ideology = social_conservative
			popularity = 0.25
		}
		hidden_effect = {
			set_cosmetic_tag = POR_LIBERAL_EMPIRE
		}
	}
	option = {
		name = por.3.c
		set_politics = {
			ruling_party = market_liberal
			elections_allowed = no
		}
		add_popularity = {
			ideology = market_liberal
			popularity = 0.25
		}
		hidden_effect = {
			set_cosmetic_tag = POR_LIBERAL_EMPIRE
		}
	}
	option = {
		name = por.3.e
		set_politics = {
			ruling_party = social_liberal
			elections_allowed = no
		}
		add_popularity = {
			ideology = social_liberal
			popularity = 0.25
		}
		hidden_effect = {
			set_cosmetic_tag = POR_LIBERAL_EMPIRE
		}
	}
}

# Intro Event
country_event = {
	id = por.4
	immediate = { log = "[GetDateText]: [Root.GetName]: event por.4" }
	title = por.4.t
	desc = por.4.d
	picture = GFX_report_event_POR_intro

	is_triggered_only = yes
	fire_only_once = yes

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

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

### Portuguese Lonesome Events

#Colonial Expedition of 1936 / This Gives PP For This Little Adorable Imperialist!
country_event = {
	id = por.300
	immediate = { log = "[GetDateText]: [Root.GetName]: event por.300" }
	title = por.300.t
	desc = por.300.d
	picture = GFX_report_event_POR_1936_colony_show

	is_triggered_only = yes

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

	option = { # Grand!
		name = por.300.a
		add_political_power = 20
	}
}

# Black Monday Hits Portugal! / Standard Event For Maluses
country_event = {
	id = por.301
	immediate = { log = "[GetDateText]: [Root.GetName]: event por.301" }
	title = por.301.t
	desc = por.301.d

	is_triggered_only = yes

	option = { #Filho da puta!
		name = por.301.a
		add_ideas = POR_black_monday
		add_stability = -0.2
		add_war_support = -0.2
		add_political_power = -100
	}
}

# The Coronation of Maria Ana as Maria Ana I de Bragança of Portugal \ PP Booster For New Regime

country_event = {
	id = por.302
	immediate = { log = "[GetDateText]: [Root.GetName]: event por.302" }
	title = por.302.t
	desc = por.302.d

	is_triggered_only = yes

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

	option = { #Long Live the Queen!
		name = por.302.a
		add_stability = 0.01
	}
}

# The Coronation of Maria Adelaide as Maria III of Portugal \ PP Booster for New Regime

country_event = {
	id = por.303
	immediate = { log = "[GetDateText]: [Root.GetName]: event por.303" }
	title = por.303.t
	desc = por.303.d
	picture = GFX_report_event_POR_Maria_III

	is_triggered_only = yes

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

	option = { #Long Live the Queen!
		name = por.303.a
		add_political_power = 20
	}
}

### End of Portuguese Lonesome Events

### The Spanish Civil War and Post Civil War Events

# The Assassination of the King of Portugal! \ Happens if the CNT-FAI Win, Reference To An Earlier Assassination

country_event = {
	id = por.304
	title = por.304.t
	desc = por.304.d
	picture = GFX_report_event_POR_assassination

	fire_only_once = yes

trigger = {
		tag = POR
		has_country_leader = {
			name = "Duarte II"
			ruling_only = yes
		}
		has_authoritarian_government = yes
		is_neighbor_of = CNT
		is_subject = no
		has_war = no
		CNT = {
			has_war = no
			is_subject = no
			is_neighbor_of = POR
		}
		NOT = {
			has_global_flag = spanish_civil_war
		}
	}

	mean_time_to_happen = {
		days = 90
	}

	immediate = {
		log = "[GetDateText]: [Root.GetName]: event por.304"
		remove_portuguese_monarchy = yes
		hidden_effect = {
			create_country_leader = {
				name = "Maria III"
				desc = "POLITICS_MARIA_ADLEAIDE_BRAGANCA_DESC"
				picture = "gfx/leaders/POR/Portrait_Portugal_Maria_Adelaide.png"
				expire = "1.1.1"
				ideology = integralism_subtype
				female = yes
			}
			create_country_leader = {
				name = "Maria III"
				desc = "POLITICS_MARIA_ADLEAIDE_BRAGANCA_DESC"
				picture = "gfx/leaders/POR/Portrait_Portugal_Maria_Adelaide.png"
				expire = "1.1.1"
				ideology = absolute_monarchy_subtype
				female = yes
			}
			create_country_leader = {
				name = "Maria III"
				desc = "POLITICS_MARIA_ADLEAIDE_BRAGANCA_DESC"
				picture = "gfx/leaders/POR/Portrait_Portugal_Maria_Adelaide.png"
				expire = "1.1.1"
				ideology = authoritarian_democrat_subtype
				female = yes
			}
			country_event = { id = por.303 days = 30 }
			PAF = {
				country_event = {
					id = por.303 
					days = 30
				}
			}
		}
	}

	option = { # The CNT-FAI must surrender those responsible! / CNT-FAI Is Given An Ultimatum, With War As A Consequence
		name = por.304.a
		ai_chance = {
			factor = 90
		}

		CNT = {
			country_event = {
				id = por.305
				days = 10
			}
		}
	}

	option = { # We must be cautious in this situation...
		name = por.304.b
		ai_chance = {
			factor = 10
			modifier = {
				factor = 9
				strength_ratio = {
					tag = CNT
					ratio < 0.5
				}
			}
		}

		add_stability = -0.2
		add_political_power = -100

		POR = {
			add_opinion_modifier = {
				target = CNT
				modifier = POR_angered_at_regicide
			}
		}
	}
}

# Portugal Demands That We Arrest Their King's Assassins! / CNT-FAI picks war now or later essentially.

country_event = {
	id = por.305
	immediate = { log = "[GetDateText]: [Root.GetName]: event por.305" }
	title = por.305.t
	desc = por.305.d
	picture = GFX_report_event_POR_assassination_demand

	is_triggered_only = yes

	fire_only_once = yes

trigger = {
		country_exists = POR
		NOT = {
			has_war_with = POR
		}
	}

	option = { #They are only criminals to us anyway... / CNT-FAI Hands Over the Assassins Thus No War
		name = por.305.a
		ai_chance = {
			factor = 80
		}

		add_stability = -0.01
		add_political_power = -50

		POR = {
			country_event = {
				id = por.306
				days = 5
			}
		}
	}

	option = { #We refuse to sell out these heroes! / CNT-FAI Refuses The Request Thus War
		name = por.305.b
		ai_chance = {
			factor = 20
		}

		add_political_power = 25
		POR = {
			country_event = {
				id = por.307
				days = 5
			}
		}
	}
}

# The CNT-FAI Accept Our Ultimatum, Portugal Reaction Event / POR gains 50 PP, No Relations Penalty With CNT-FAI

country_event = {
	id = por.306
	immediate = { log = "[GetDateText]: [Root.GetName]: event por.306" }
	title = por.306.t
	desc = por.306.d
	picture = GFX_report_event_POR_demand_accept

	is_triggered_only = yes

	fire_only_once = yes

trigger = {
		country_exists = CNT
		NOT = {
			has_war_with = CNT
		}
	}

	option = { #We have no choice, but ... to thank them for their efforts...
		name = por.306.a

		add_political_power = 50

		POR = {
			add_opinion_modifier = {
				target = CNT
				modifier = POR_happy_they_got_assassins
			}
		}
	}
}

# The CNT-FAI Refuse Our Ultimatum, Portugal Reaction Event / POR DOWs CNT And Really Hates Them

country_event = {
	id = por.307
	immediate = { log = "[GetDateText]: [Root.GetName]: event por.307" }
	title = por.307.t
	desc = por.307.d
	picture = GFX_report_event_POR_demand_accept

	is_triggered_only = yes

	fire_only_once = yes

trigger = {
		country_exists = CNT
		NOT = {
			has_war_with = CNT
		}
	}

	option = { #We have no choice, but ... declare war!
		name = por.307.a
		ai_chance = {
			factor = 1
		}
		add_war_support = 0.1
		declare_war_on = {
			target = CNT
			type = annex_everything
		}
	}
	option = { #We can't fight....even if our people hate us
		name = por.307.b
		ai_chance = {
			factor = 0
		}

		add_war_support = -0.2
		add_stability = -0.2
		add_political_power = -100
		CNT = {
			country_event = {
				id = por.307001
				days = 1
			}
		}
	}
}

# Telling CNT-FAI that POR backed down

country_event = {
	id = por.307001
	immediate = { log = "[GetDateText]: [Root.GetName]: event por.307001" }
	title = por.307001.t
	desc = por.307001.d
	picture = GFX_report_event_POR_demand_accept

	is_triggered_only = yes

	fire_only_once = yes

	option = { #How nice
		name = por.307001.a
		add_political_power = 50
	}
}

# Occupy Galicia?

country_event = {
	id = por.308
	immediate = { log = "[GetDateText]: [Root.GetName]: event por.308" }
	title = por.308.t
	desc = por.308.d
	picture = GFX_report_event_POR_galicia

	fire_only_once = yes

trigger = {
		tag = POR
		has_global_flag = spanish_civil_war
		country_exists = CAR
		country_exists = CNT
		171 = {
			is_owned_and_controlled_by = CAR
		}
		CNT = {
			controls_state = 41
		}
		CNT = {
			any_war_score > 0.7
		}
	}

	mean_time_to_happen = {
		days = 60
	}

	option = { #We must secure Galicia from the failing Carlists!
		name = por.308.a
		add_state_claim = 171
		ai_chance = {
			factor = 1
		}
		CAR = {
			country_event = {
				id = por.309
				days = 1
			}
		}
	}

	option = { #We will not stab them in the back.
		name = por.308.b
		ai_chance = {
			factor = 0
		}
	}
}


# Carlist Reaction to Portuguese Seizure of Galicia
country_event = {
	id = por.309
	title = por.309.t
	desc = por.309.d

	is_triggered_only = yes

trigger = {
		171 = {
			is_owned_and_controlled_by = CAR
		}
	}

	immediate = {
		log = "[GetDateText]: [Root.GetName]: event por.309"
		POR = {
			transfer_state = 171
		}
	}

	option = { #We will correct this later...
		name = por.309.a
		CAR = {
			add_opinion_modifier = {
				target = POR
				modifier = POR_Jackals
			}
		}
	}
}

# Seize Olivença?
country_event = {
	id = por.310
	title = por.310.t
	desc = por.310.d
	picture = GFX_Portugal_310
	
	fire_only_once = yes
	
	mean_time_to_happen = {
		days = 90
	}
	
	trigger = {
		tag = POR
		has_global_flag = spanish_civil_war
		SPR = { owns_state = 1316 }
		SPR = { has_full_control_of_state = 1316 }
	}
	
	option = { #Let's liberate the town from the Spanish Yoke!
	name = por.310.a
	ai_chance = { factor = 90 } 
	
	add_political_power = 30
	add_state_core = 1316
	SPR = { country_event = { id = por.311 days = 1 } }
	
	}
	
	option = { #We can't antagonize the old Kingdom...
	name = por.310.b
	ai_chance = { factor = 10 } 
	
	}

}

# Kingdom of Spain Reaction 

country_event = {
	id = por.311
	title = por.311.t
	desc = por.311.d
	picture = GFX_Portugal_310

	is_triggered_only = yes

	immediate = { 
	POR = { 
	transfer_state = 1316 
	1316 = { set_state_name = "Olivença" }
		}
	}
	
	option = { #They are nothing more than Jackals!
	name = por.311.a 
	
	add_political_power = -10
	
	SPR = { add_opinion_modifier = {
			target = POR
			modifier = POR_Jackals 
		} }
	}
}


### End of the Spanish Civil War and Post Civil War Events

### Portuguese Event To Do Matters of the Realm Focus Tree Basically

country_event = { #For King and Country, Paternal Autocrat Path
	id = por.313
	immediate = { log = "[GetDateText]: [Root.GetName]: event por.313" }
	title = por.313.t
	desc = por.313.d
	picture = GFX_report_event_POR_entente
	is_triggered_only = yes

	option = {
		name = por.313.a
		if = {
			limit = {
				tag = POR
			}
		hidden_effect = {
			set_politics = {
				ruling_party = paternal_autocrat
				elections_allowed = no
			}
			add_popularity = { ideology = national_populist popularity = -0.3 }
		}

		remove_all_ministers = yes

		add_ideas = {
			POR_Henrique_Mitchell_de_Paiva_Cabral_Couceiro_hog_pau
			POR_Maria_Adelaide_de_BraganCa_for_pau
			POR_Jose_Norton_de_Matos_eco_pau
			POR_JBotelho_Moniz_sec_pau
		}
		add_stability = -0.01
		}
		add_political_power = 20
	}
}

country_event = { #The Burden We Bear, National Populist Path
	id = por.314
	immediate = { log = "[GetDateText]: [Root.GetName]: event por.314" }
	title = por.314.t
	desc = por.314.d
	picture = GFX_report_event_POR_entente
	is_triggered_only = yes

	option = {
		name = por.314.a
		add_stability = 0.01
	}
}

### End of Matters of the Realm Stuff

### Portuguese Alliance Events

# Portugal Formally Rejoins the Entente
country_event = {
	id = por.315
	immediate = { log = "[GetDateText]: [Root.GetName]: event por.315" }
	title = por.315.t
	desc = por.315.d

	fire_only_once = yes
	is_triggered_only  = yes

trigger = {
		tag = POR
		has_war = no
		is_subject = no
		is_in_faction = no
		NOT = {
			has_socialist_government = yes
			MAF = {
				has_idea = MAF_border_shit_show
			}
		}
		country_exists = ENT
		ENT = {
			is_faction_leader = yes
			has_socialist_government = no
		}
		OR = {
			date > 1939.1.1
			has_global_flag = MAF_NoAttack_Portugal
			957 = { is_owned_by_ROOT_or_subject = yes }
		}
	}

	option = { #"We will formally rejoin the Entente!"
		ai_chance = {
			factor = 70
		}
		name = por.315.a
		ENT = {
			country_event = por.316
		}
		add_political_power = -20
	}

	option = { #"We'll refrain for now."
		ai_chance = {
			factor = 30
		}
		name = por.315.b
	}
}

# Portugal Asks Us To Rejoin the Entente Formally

country_event = {
	id = por.316
	immediate = { log = "[GetDateText]: [Root.GetName]: event por.316" }
	title = por.316.t
	desc = por.316.d

	is_triggered_only = yes

	option = {
		name = por.316.a
		add_to_faction = POR
		ai_chance = {
			factor = 100
		}
		add_political_power = -20
	}
	option = {
		name = por.316.b
		add_to_faction = POR
		ai_chance = {
			factor = 0
		}
	}
}

### Portuguese Updates on MAF Events

country_event = {
	id = por.321
	immediate = { log = "[GetDateText]: [Root.GetName]: event por.321" }
	title = por.321.t
	desc = por.321.d
	picture = GFX_report_event_brewing

	is_triggered_only = yes

	option = {
		name = por.321.a
		add_political_power = 20
	}
}


country_event = {
	id = por.322
	immediate = { log = "[GetDateText]: [Root.GetName]: event por.322" }
	title = por.322.t
	desc = por.322.d
	picture = GFX_report_event_railway2

	is_triggered_only = yes

	fire_only_once = yes

	option = {
		name = por.322.a
		add_stability = -0.01
		add_war_support = 0.01
	}
}

### End of Portuguese Updates on MAF Events

country_event = {# Fate of the Lusitanian Integralist Movement in the Face of the Dual Monarchy
	id = por.323
	immediate = { log = "[GetDateText]: [Root.GetName]: event por.323" }
	title = por.323.t
	desc = por.323.d
	picture = GFX_Portugal_312

	is_triggered_only = yes

	fire_only_once = yes

	option = {
		name = por.323.a
		add_political_power = 100
	}
	option = {
		name = por.323.b
		add_political_power = 50
		POR = { add_opinion_modifier = { target = BRA modifier = large_increase } }
		BRA = { add_opinion_modifier = { target = POR modifier = large_increase } }
		give_guarantee = BRA
		BRA = { give_guarantee = POR }
	}
	option = {
		name = por.323.c
		add_political_power = 100
		BRA = { get_current_government_type = yes }
		POR = { puppet = BRA }
		BRA = { restore_previous_government_type = yes }
	}
	option = {
		name = por.323.e
		BRA = {
			every_unit_leader = {
				set_nationality = POR
			}
		}
		POR = {
			annex_country = {
			target = BRA
			transfer_troops = yes
			}
		}
		every_state = {
			limit = { is_core_of = BRA }
			add_core_of = POR
		}
		add_state_core = 300
		set_cosmetic_tag = POR_BRA
		add_political_power = -300
		add_stability = -0.1
	}
}

country_event = {# Fate of the Lusitanian Integralist Movement in the Face of the Dual Monarchy
	id = por.324
	immediate = { log = "[GetDateText]: [Root.GetName]: event por.323" }
	title = por.323.t
	desc = por.323.d
	picture = GFX_Portugal_312

	is_triggered_only = yes

	fire_only_once = yes

	option = {
		name = por.323.a
		add_political_power = 100
	}
	option = {
		name = por.323.b
		add_political_power = 50
		BRA = { add_opinion_modifier = { target = POR modifier = large_increase } }
		POR = { add_opinion_modifier = { target = BRA modifier = large_increase } }
		give_guarantee = POR
		POR = { give_guarantee = BRA }
	}
	option = {
		name = por.323.c
		add_political_power = 100
		POR = { get_current_government_type = yes }
		BRA = { puppet = POR }
		POR = { restore_previous_government_type = yes }
	}
	option = {
		name = por.323.e
		add_political_power = 50
		BRA = {
			annex_country = {
			target = POR
			transfer_troops = yes
			}
		}
		every_state = {
			limit = { is_core_of = POR }
			add_core_of = BRA
		}
		add_state_core = 300
		set_cosmetic_tag = POR_BRA
	}
}

country_event = {# The Fate of our Familial Ties
	id = por.325
	immediate = { log = "[GetDateText]: [Root.GetName]: event por.325" }
	title = por.325.t
	desc = por.325.d
	picture = GFX_report_event_generic_diplomacy3

	fire_only_once = yes
	is_triggered_only = yes

	option = {
		name = por.325.a
		ai_chance = {
			factor = 0
		}
		add_political_power = -50
		add_stability = -0.05
		create_wargoal = {
			type = annex_everything
			target = BRA
		}
		create_wargoal = {
			type = annex_everything
			target = URG
		}
		every_state = {
			limit = { is_core_of = BRA }
			add_core_of = POR
		}
		add_state_core = 300
		set_cosmetic_tag = POR_BRA
	}
	option = {
		name = por.325.b
		ai_chance = {
			factor = 100
		}
		add_political_power = 75
		add_stability = 0.05
	}
}

country_event = {# The Fate of our Familial Ties
	id = por.326
	immediate = { log = "[GetDateText]: [Root.GetName]: event por.325" }
	title = por.325.t
	desc = por.325.d
	picture = GFX_report_event_generic_diplomacy3

	fire_only_once = yes
	is_triggered_only = yes

	option = {
		name = por.325.a
		ai_chance = {
			factor = 0
		}
		add_political_power = -50
		add_stability = -0.05
		create_wargoal = {
			type = annex_everything
			target = POR
		}
		every_state = {
			limit = { is_core_of = POR }
			add_core_of = BRA
		}
		set_cosmetic_tag = POR_BRA
	}
	option = {
		name = por.325.b
		ai_chance = {
			factor = 100
		}
		add_political_power = 75
		add_stability = 0.05
	}
}
