###########################
# ENG Events
###########################

add_namespace = eng

# US congress elections - outcome
country_event = {
	id = eng.30
	title = eng.30.t
	desc = eng.30.desc
	picture = GFX_fra_com

	is_triggered_only = yes

	option = {
		name = eng.30.a
		clear_variable = sen_loc
		clear_variable = ror_loc
		clear_variable = senators_for_reelection
		clear_variable = representatives_for_reelection
	}

}
# elections - new president, opposition/support switch roles
country_event = {
	id = eng.31
	title = eng.31.t
	desc = eng.31.desc
	picture = GFX_report_event_king_speech

	is_triggered_only = yes

	option = {
		name = eng.31.a
		clear_variable = sen_loc
		clear_variable = ror_loc
		clear_variable = senators_for_reelection
		clear_variable = representatives_for_reelection
	}

}
# elections in the US - player has a majority guaranteed
country_event = {
	id = eng.32
	title = eng.32.t
	desc = eng.32.desc
	picture = GFX_report_event_king_speech

	fire_only_once = yes
	trigger = {
				has_country_flag = elections_good_1
				has_country_flag = elections_good_2
				has_country_flag = elections_good_3
				date > 1937.12.1
				date < 1938.2.1	
				has_government = democratic
			}

	option = {
		name = eng.32.a
		ENG_return_majority = yes
	}

}

# elections in the US - player has a majority guaranteed
country_event = {
	id = eng.33
	title = eng.32.t
	desc = eng.33.desc
	picture = GFX_report_event_king_speech
	fire_only_once = yes
	trigger = {
		original_tag = ENG
		OR = {
			has_completed_focus = ENG_accept_provisional_prime_minister
			fascism > 0.5		
		}
	}

	option = {
		name = eng.33.a
		ENG_return_majority = yes
	}

}

#midterm elections
country_event = {
	id = eng.35
	title = eng.35.t
	desc = eng.35.desc
	picture = GFX_report_event_king_speech
	hidden = yes
	is_triggered_only = yes

	immediate = {
		if = {
			limit = {
				NOT = {
					OR = {
						has_completed_focus = ENG_accept_provisional_prime_minister
						has_completed_focus = ENG_concessions_to_the_trade_unions
					}
				}
			}
			random_list = {
				50 = {
					set_variable = { election_factor = random }
					add_to_variable = { election_factor = -0.6 }
					ENG_election_senate = yes
					ENG_election_house = yes
					country_event = eng.30
				}
				50 = {
					set_variable = { election_factor = random }
					add_to_variable = { election_factor = -0.3 }
					ENG_election_senate = yes
					ENG_election_house = yes
					country_event = eng.30
				}
			}
		}
		else = {
			country_event = eng.32
		}
	}
	option = {
		name = eng.35.a
		
	}
}
#small support event - senate
country_event = {
	id = eng.40
	title = eng.40.t
	desc = eng.40.desc
	picture = GFX_report_event_king_speech

	is_triggered_only = yes
	trigger = {
		tag = ENG
		NOT = {
			OR = {
				has_completed_focus = ENG_accept_provisional_prime_minister
				has_completed_focus = ENG_concessions_to_the_trade_unions
			}
		}
	}

	option = {
		name = eng.40.a
		ENG_senate_small_support = yes
		hidden_effect = {
			if = {
				limit = { has_government = democratic }
				country_event = { id = eng.50 days = 70 random = 10 }
			}
		}
	}

}
# small support event - house
country_event = {
	id = eng.41
	title = eng.41.t
	desc = eng.41.desc
	picture = GFX_report_event_king_speech

	is_triggered_only = yes
	trigger = {
		tag = ENG
		NOT = {
			OR = {
				has_completed_focus = ENG_accept_provisional_prime_minister
				has_completed_focus = ENG_concessions_to_the_trade_unions
			}
		}
	}

	option = {
		name = eng.41.a
		ENG_house_small_support = yes
		hidden_effect = {
			if = {
				limit = { has_government = democratic }
				country_event = { id = eng.51 days = 70 random = 10 }
			}
		}
	}

}

#small opposition event - senate
country_event = {
	id = eng.42
	title = eng.42.t
	desc = eng.42.desc
	picture = GFX_report_event_king_speech

	is_triggered_only = yes
	
	trigger = {
		tag = ENG
		NOT = {
			OR = {
				has_completed_focus = ENG_accept_provisional_prime_minister
				has_completed_focus = ENG_concessions_to_the_trade_unions
			}
		}
	}

	option = {
		name = eng.42.a
		ENG_senate_small_opposition = yes
		hidden_effect = {
			if = {
				limit = { has_government = democratic }
				country_event = { id = eng.50 days = 70 random = 10 }
			}
		}
	}

}
# small opposition event - house
country_event = {
	id = eng.43
	title = eng.43.t
	desc = eng.43.desc
	picture = GFX_report_event_king_speech

	is_triggered_only = yes
	trigger = {
		tag = ENG
		NOT = {
			OR = {
				has_completed_focus = ENG_accept_provisional_prime_minister
				has_completed_focus = ENG_concessions_to_the_trade_unions
			}
		}
	}

	option = {
		name = eng.43.a
		ENG_house_small_opposition = yes
		hidden_effect = {
			if = {
				limit = { has_government = democratic }
				country_event = { id = eng.51 days = 70 random = 10 }
			}
		}
	}

}

#medium support event - senate
country_event = {
	id = eng.44
	title = eng.44.t
	desc = eng.44.desc
	picture = GFX_report_event_king_speech

	is_triggered_only = yes
	trigger = {
		tag = ENG
		NOT = {
			OR = {
				has_completed_focus = ENG_accept_provisional_prime_minister
				has_completed_focus = ENG_concessions_to_the_trade_unions
			}
		}
	}

	option = {
		name = eng.44.a
		ENG_senate_medium_support = yes
		hidden_effect = {
			if = {
				limit = { has_government = democratic }
				country_event = { id = eng.50 days = 70 random = 10 }
			}
		}
	}

}
# medium support event - house
country_event = {
	id = eng.45
	title = eng.45.t
	desc = eng.45.desc
	picture = GFX_report_event_king_speech

	is_triggered_only = yes
	trigger = {
		tag = ENG
		NOT = {
			OR = {
				has_completed_focus = ENG_accept_provisional_prime_minister
				has_completed_focus = ENG_concessions_to_the_trade_unions
			}
		}
	}

	option = {
		name = eng.45.a
		ENG_house_medium_support = yes
		hidden_effect = {
			if = {
				limit = { has_government = democratic }
				country_event = { id = eng.51 days = 70 random = 10 }
			}
		}
	}

}

#medium opposition event - senate
country_event = {
	id = eng.46
	title = eng.46.t
	desc = eng.46.desc
	picture = GFX_report_event_king_speech

	is_triggered_only = yes
	trigger = {
		tag = ENG
		NOT = {
			OR = {
				has_completed_focus = ENG_accept_provisional_prime_minister
				has_completed_focus = ENG_concessions_to_the_trade_unions
			}
		}
	}

	option = {
		name = eng.46.a
		ENG_senate_medium_opposition = yes
		hidden_effect = {
			if = {
				limit = { has_government = democratic }
				country_event = { id = eng.50 days = 70 random = 10 }
			}
		}
	}

}
# medium opposition event - house
country_event = {
	id = eng.47
	title = eng.47.t
	desc = eng.47.desc
	picture = GFX_report_event_king_speech

	is_triggered_only = yes
	trigger = {
		tag = ENG
		NOT = {
			OR = {
				has_completed_focus = ENG_accept_provisional_prime_minister
				has_completed_focus = ENG_concessions_to_the_trade_unions
			}
		}
	}

	option = {
		name = eng.47.a
		ENG_house_medium_opposition = yes
		hidden_effect = {
			if = {
				limit = { has_government = democratic }
				country_event = { id = eng.51 days = 70 random = 10 }
			}
		}
	}

}

# dispatcher event - senate
country_event = {
	id = eng.50
	Hidden = yes
	is_triggered_only = yes
	trigger = {
		tag = ENG
		NOT = {
			OR = {
				has_completed_focus = ENG_accept_provisional_prime_minister
				has_completed_focus = ENG_concessions_to_the_trade_unions
			}
		}
	}

	immediate = {
		random_list = {
			20 = { 
				modifier = {
					not = { congress_medium_support_trigger = yes }
					factor = 1.25
				}
				modifier = {
					not = { congress_low_support_trigger = yes }
					factor = 2
				}
				country_event = { id = eng.40 days = 15 random = 6 } #small support
			} 
			20 = { 
				modifier = {
					check_variable = { var = senators_support value = quorum_high compare = greater_than_or_equals }
					factor = 3
				}
				modifier = {
					has_idea_with_trait = fascist_demagogue
					factor = 2
				}
				modifier = {
					has_idea_with_trait = communist_revolutionary
					factor = 2
				}
				country_event = { id = eng.42 days = 20 random = 6 } #small opposition 
			} 
			15 = { 
				modifier = {
					not = { congress_medium_support_trigger = yes }
					factor = 1.25
				}
				modifier = {
					not = { congress_low_support_trigger = yes }
					factor = 2
				}
				country_event = { id = eng.44 days = 20 random = 10 } #medium support
			} 
			15 = { 
				modifier = {
					check_variable = { var = senators_support value = quorum_high compare = greater_than_or_equals }
					factor = 3
				}
				modifier = {
					has_idea_with_trait = fascist_demagogue
					factor = 2
				}
				modifier = {
					has_idea_with_trait = communist_revolutionary
					factor = 2
				}
				country_event = { id = eng.46 days = 20 random = 10 }  #medium opposition
			}
			30 = { #investment opportunity
				modifier = {
					has_country_flag = ENG_congress_investment
					factor = 0
				}
				country_event = { id = eng.60 days = 10 random = 15 } 
			} 
		}
	}
}

# dispatcher event - house
country_event = {
	id = eng.51
	Hidden = yes
	is_triggered_only = yes
	trigger = {
		tag = ENG
		NOT = {
			OR = {
				has_completed_focus = ENG_accept_provisional_prime_minister
				has_completed_focus = ENG_concessions_to_the_trade_unions
			}
		}
	}

	immediate = {
		random_list = {
			35 = { 
				modifier = {
					check_variable = { representatives_support < 218 }
					factor = 1.5
				}
				modifier = {
					check_variable = { representatives_support < 180 }
					factor = 3
				}
				country_event = { id = eng.41 days = 15 random = 6 } #small support
			} 
			25 = {
				modifier = {
					check_variable = { representatives_support > 260 }
					factor = 2
				}
				modifier = {
					check_variable = { representatives_support < 180 }
					factor = 0.5
				}
				modifier = {
					has_idea_with_trait = fascist_demagogue
					factor = 2
				}
				modifier = {
					has_idea_with_trait = communist_revolutionary
					factor = 2
				} 
				country_event = { id = eng.43 days = 20 random = 6 } #small opposition
			} 
			25 = { 
				modifier = {
					check_variable = { representatives_support < 180 }
					factor = 1.5
				}
				modifier = {
					check_variable = { representatives_support < 100 }
					factor = 10
				}
				country_event = { id = eng.45 days = 25 random = 10 } #medium support
			} 
			15 = { 
				modifier = {
					check_variable = { representatives_support > 260 }
					factor = 2
				}
				modifier = {
					check_variable = { representatives_support > 400 }
					factor = 10
				}
				modifier = {
					check_variable = { representatives_support < 180 }
					factor = 0.5
				}
				modifier = {
					check_variable = { representatives_support < 100 }
					factor = 0
				}
				modifier = {
					has_idea_with_trait = fascist_demagogue
					factor = 2
				}
				modifier = {
					has_idea_with_trait = communist_revolutionary
					factor = 2
				}
				country_event = { id = eng.47 days = 30 random = 15 } #medium opposition
			} 
		}
	}
}
# senator wants investment in their state - hidden dispatch event
country_event = {
	id = eng.60
	hidden = yes
	is_triggered_only = yes
	trigger = {
		tag = ENG
		NOT = {
			OR = {
				has_completed_focus = ENG_accept_provisional_prime_minister
				has_completed_focus = ENG_concessions_to_the_trade_unions
			}
		}
	}

	immediate = {
		set_country_flag = ENG_congress_investment
		if = {
			limit = { has_event_target = ENG_congress_investment_state }
			clear_global_event_target = ENG_congress_investment_state
		}
		random_list = {
			25 = {
				modifier = {
					NOT = {
						any_owned_state = {
							is_core_of = ROOT
							is_controlled_by = ROOT
							free_building_slots = {
								building = industrial_complex
								size > 0
								include_locked = no
							}
						}
					}
					factor = 0
				}
				random_owned_state = {
					limit = {
						is_core_of = ROOT
						is_controlled_by = ROOT
						free_building_slots = {
							building = industrial_complex
							size > 0
							include_locked = no
						}
					}
					
					save_global_event_target_as = ENG_congress_investment_state
					state_event = { id = eng.61 trigger_for = controller }
				}
			}
			25 = {
				modifier = {
					NOT = {
						any_owned_state = {
							is_core_of = ROOT
							is_controlled_by = ROOT
							free_building_slots = {
								building = arms_factory
								size > 0
								include_locked = no
							}
						}
					}
					factor = 0
				}
				random_owned_state = {
					limit = {
						is_core_of = ROOT
						is_controlled_by = ROOT
						free_building_slots = {
							building = arms_factory
							size > 0
							include_locked = no
						}
					}
					save_global_event_target_as = ENG_congress_investment_state
					state_event = { id = eng.62 trigger_for = controller }
				}
			}
			25 = { 
				modifier = {
					NOT = {
						any_owned_state = {
							is_core_of = ROOT
							is_controlled_by = ROOT
							is_coastal = yes
							free_building_slots = {
								building = dockyard
								size > 0
								include_locked = no
							}
						}
					}
					factor = 0
				}
				random_owned_state = {
					limit = {
						is_core_of = ROOT
						is_controlled_by = ROOT
						is_coastal = yes
						free_building_slots = {
							building = dockyard
							size > 0
							include_locked = no
						}
					}
					save_global_event_target_as = ENG_congress_investment_state
					state_event = { id = eng.64 trigger_for = controller }
				}
			}
			25 = {
				modifier = {
					NOT = {
						any_owned_state = {
							is_core_of = ROOT
							free_building_slots = {
								building = infrastructure
								size > 0
								include_locked = no
							}
						}
					}
					factor = 0
				}
				
				random_owned_state = {
					limit = {
						is_core_of = ROOT
						is_controlled_by = ROOT
						free_building_slots = {
							building = infrastructure
							size > 0
							include_locked = no
						}
					}
					save_global_event_target_as = ENG_congress_investment_state
					state_event = { id = eng.63 trigger_for = controller }
				}
			}
		}
		hidden_effect = {
			country_event = { id = eng.50 days = 70 random = 10 }
		}
	}
}
# senator wants investment in civilian factory
country_event = {
	id = eng.61
	title = eng.61.t
	desc = eng.61.desc
	picture = GFX_report_event_king_speech
	
	is_triggered_only = yes
	

	option = {
		name = eng.61.a #accept
		ai_chance = {
			factor = 0
		}
		unlock_decision_tooltip = { decision = ENG_invest_in_state_factory show_effect_tooltip = yes }
		event_target:ENG_congress_investment_state = {
			set_state_flag = ENG_congress_build_factory
			set_variable = { factory_goal = industrial_complex_level }
			add_to_variable = { factory_goal = 1 }
		}
	}
	option = {
		name = eng.61.b #refuse
		ai_chance = {
			factor = 100
		}
		ROOT = { clr_country_flag = ENG_congress_investment }
		clear_global_event_target = ENG_congress_investment_state
	}
}

# senator wants investment in military factory
country_event = {
	id = eng.62
	title = eng.61.t
	desc = eng.62.desc
	picture = GFX_report_event_king_speech
	
	is_triggered_only = yes
	

	option = {
		name = eng.62.a #accept
		ai_chance = {
			factor = 0
		}
		unlock_decision_tooltip = { decision = ENG_invest_in_state_arms_factory show_effect_tooltip = yes }
		event_target:ENG_congress_investment_state = {
			set_state_flag = ENG_congress_build_arms_factory
			set_variable = { arms_factory_goal = arms_factory_level }
			add_to_variable = { arms_factory_goal = 1 }
		}
	}
	option = {
		name = eng.62.b #refuse
		ai_chance = {
			factor = 100
		}
		ROOT = { clr_country_flag = ENG_congress_investment }
		clear_global_event_target = ENG_congress_investment_state
	}
}
# senator wants investment in infrastructure
country_event = {
	id = eng.63
	title = eng.63.t
	desc = eng.63.desc
	picture = GFX_report_event_king_speech
	
	is_triggered_only = yes
	

	option = {
		name = eng.63.a #accept
		ai_chance = {
			factor = 0
		}
		unlock_decision_tooltip = { decision = ENG_invest_in_state_infrastructure show_effect_tooltip = yes }
		event_target:ENG_congress_investment_state = {
			set_state_flag = ENG_congress_build_infrastructure
			set_variable = { infrastructure_goal = infrastructure_level }
			add_to_variable = { infrastructure_goal = 1 }
		}
	}
	option = {
		name = eng.63.b #refuse
		ai_chance = {
			factor = 100
		}
		ROOT = { clr_country_flag = ENG_congress_investment }
		clear_global_event_target = ENG_congress_investment_state
	}
}
# senator wants investment in dockyards
country_event = {
	id = eng.64
	title = eng.64.t
	desc = eng.64.desc
	picture = GFX_report_event_king_speech
	
	is_triggered_only = yes
	

	option = {
		name = eng.64.a #accept
		ai_chance = {
			factor = 0
		}
		unlock_decision_tooltip = { decision = ENG_invest_in_state_dockyard show_effect_tooltip = yes }
		event_target:ENG_congress_investment_state = {
			set_state_flag = ENG_congress_build_dockyard
			set_variable = { dockyard_goal = building_level@dockyard }
			add_to_variable = { dockyard_goal = 1 }
		}
	}
	option = {
		name = eng.64.b #refuse
		ai_chance = {
			factor = 100
		}
		ROOT = { clr_country_flag = ENG_congress_investment }
		clear_global_event_target = ENG_congress_investment_state
	}
}