namespace = est_greed

#Greed 1, bonus to country with lots of stored energy.
#country_event = {
#	id = est_greed.1
#	hide_window = yes
#	is_triggered_only = yes
#	
#	trigger = {	
#		has_active_tradition = tr_est_greed_1
#	}
#	
#	immediate = {	
#		switch = {
#			trigger = has_modifier
#			
#			mod_est_greed_1_1 = { remove_modifier = "mod_est_greed_1_1" }
#			mod_est_greed_1_2 = { remove_modifier = "mod_est_greed_1_2" }
#			mod_est_greed_1_3 = { remove_modifier = "mod_est_greed_1_3" }
#			mod_est_greed_1_4 = { remove_modifier = "mod_est_greed_1_4" }
#		}
#		if = {
#			limit = {
#				has_resource = {
#					type = energy
#					amount < 500 
#				}
#			}
#			#Nothing
#		}
#		else = {
#			if = {
#				limit = {
#					has_resource = {
#						type = energy
#						amount < 6000 
#					}
#				}
#				add_modifier = {
#					modifier = mod_est_greed_1_1
#					days = -1
#				}
#			}
#			else = {
#				if = {
#					limit = {
#						has_resource = {
#							type = energy
#							amount < 25000 
#						}
#					}
#					add_modifier = {
#						modifier = mod_est_greed_1_2
#						days = -1
#					}
#				}	
#				else = {
#					if = {
#						limit = {
#							has_resource = {
#								type = energy
#								amount < 80000 
#							}
#						}
#						add_modifier = {
#							modifier = mod_est_greed_1_3
#							days = -1
#						}
#					}
#					else = {
#						add_modifier = {
#							modifier = mod_est_greed_1_4
#							days = -1
#						}
#					}
#				}				
#			}
#		}
#	}
#}

#Greed 5, prepares factions to be bribed.
country_event = {
	id = est_greed.9
	hide_window = yes
	is_triggered_only = yes
	
	immediate = {	
		from = {
			if = {
				limit = {
					root = {
						Not = {
							has_country_flag = flag_est_greed_5_count_factions_1
						}
					}
				}
				set_pop_faction_flag = flag_est_greed_5_factions_1
				root = {
					set_timed_country_flag = {
						flag = flag_est_greed_5_count_factions_1
						days = 1
					}
				}
				break = yes
			}
			if = {
				limit = {
					root = {
						Not = {
							has_country_flag = flag_est_greed_5_count_factions_2
						}
					}
				}
				set_pop_faction_flag = flag_est_greed_5_factions_2
				root = {
					set_timed_country_flag = {
						flag = flag_est_greed_5_count_factions_2
						days = 1
					}
				}
				break = yes
			}
			if = {
				limit = {
					root = {
						Not = {
							has_country_flag = flag_est_greed_5_count_factions_3
						}
					}
				}
				set_pop_faction_flag = flag_est_greed_5_factions_3
				root = {
					set_timed_country_flag = {
						flag = flag_est_greed_5_count_factions_3
						days = 1
					}
				}
				break = yes
			}
			if = {
				limit = {
					root = {
						Not = {
							has_country_flag = flag_est_greed_5_count_factions_4
						}
					}
				}
				set_pop_faction_flag = flag_est_greed_5_factions_4
				root = {
					set_timed_country_flag = {
						flag = flag_est_greed_5_count_factions_4
						days = 1
					}
				}
				break = yes
			}
			if = {
				limit = {
					root = {
						Not = {
							has_country_flag = flag_est_greed_5_count_factions_5
						}
					}
				}
				set_pop_faction_flag = flag_est_greed_5_factions_5
				root = {
					set_timed_country_flag = {
						flag = flag_est_greed_5_count_factions_5
						days = 1
					}
				}
				break = yes
			}
			if = {
				limit = {
					root = {
						Not = {
							has_country_flag = flag_est_greed_5_count_factions_6
						}
					}
				}
				set_pop_faction_flag = flag_est_greed_5_factions_6
				root = {
					set_timed_country_flag = {
						flag = flag_est_greed_5_count_factions_6
						days = 1
					}
				}
				break = yes
			}
			if = {
				limit = {
					root = {
						Not = {
							has_country_flag = flag_est_greed_5_count_factions_7
						}
					}
				}
				set_pop_faction_flag = flag_est_greed_5_factions_7
				root = {
					set_timed_country_flag = {
						flag = flag_est_greed_5_count_factions_7
						days = 1
					}
				}
				break = yes
			}
			if = {
				limit = {
					root = {
						Not = {
							has_country_flag = flag_est_greed_5_count_factions_8
						}
					}
				}
				set_pop_faction_flag = flag_est_greed_5_factions_8
				root = {
					set_timed_country_flag = {
						flag = flag_est_greed_5_count_factions_8
						days = 1
					}
				}
				break = yes
			}
			if = {
				limit = {
					root = {
						Not = {
							has_country_flag = flag_est_greed_5_count_factions_9
						}
					}
				}
				set_pop_faction_flag = flag_est_greed_5_factions_9
				root = {
					set_timed_country_flag = {
						flag = flag_est_greed_5_count_factions_9
						days = 1
					}
				}
				break = yes
			}
			if = {
				limit = {
					root = {
						Not = {
							has_country_flag = flag_est_greed_5_count_factions_10
						}
					}
				}
				set_pop_faction_flag = flag_est_greed_5_factions_10
				root = {
					set_timed_country_flag = {
						flag = flag_est_greed_5_count_factions_10
						days = 1
					}
				}
				break = yes
			}
			if = {
				limit = {
					root = {
						Not = {
							has_country_flag = flag_est_greed_5_count_factions_11
						}
					}
				}
				set_pop_faction_flag = flag_est_greed_5_factions_11
				root = {
					set_timed_country_flag = {
						flag = flag_est_greed_5_count_factions_11
						days = 1
					}
				}
				break = yes
			}
			if = {
				limit = {
					root = {
						Not = {
							has_country_flag = flag_est_greed_5_count_factions_12
						}
					}
				}
				set_pop_faction_flag = flag_est_greed_5_factions_12
				root = {
					set_timed_country_flag = {
						flag = flag_est_greed_5_count_factions_12
						days = 1
					}
				}
				break = yes
			}
			if = {
				limit = {
					root = {
						Not = {
							has_country_flag = flag_est_greed_5_count_factions_13
						}
					}
				}
				set_pop_faction_flag = flag_est_greed_5_factions_13
				root = {
					set_timed_country_flag = {
						flag = flag_est_greed_5_count_factions_13
						days = 1
					}
				}
				break = yes
			}
			if = {
				limit = {
					root = {
						Not = {
							has_country_flag = flag_est_greed_5_count_factions_14
						}
					}
				}
				set_pop_faction_flag = flag_est_greed_5_factions_14
				root = {
					set_timed_country_flag = {
						flag = flag_est_greed_5_count_factions_14
						days = 1
					}
				}
				break = yes
			}
			if = {
				limit = {
					root = {
						Not = {
							has_country_flag = flag_est_greed_5_count_factions_15
						}
					}
				}
				set_pop_faction_flag = flag_est_greed_5_factions_15
				root = {
					set_timed_country_flag = {
						flag = flag_est_greed_5_count_factions_15
						days = 1
					}
				}
				break = yes
			}
			if = {
				limit = {
					root = {
						Not = {
							has_country_flag = flag_est_greed_5_count_factions_16
						}
					}
				}
				set_pop_faction_flag = flag_est_greed_5_factions_16
				root = {
					set_timed_country_flag = {
						flag = flag_est_greed_5_count_factions_16
						days = 1
					}
				}
				break = yes
			}
			if = {
				limit = {
					root = {
						Not = {
							has_country_flag = flag_est_greed_5_count_factions_17
						}
					}
				}
				set_pop_faction_flag = flag_est_greed_5_factions_17
				root = {
					set_timed_country_flag = {
						flag = flag_est_greed_5_count_factions_17
						days = 1
					}
				}
				break = yes
			}
			if = {
				limit = {
					root = {
						Not = {
							has_country_flag = flag_est_greed_5_count_factions_18
						}
					}
				}
				set_pop_faction_flag = flag_est_greed_5_factions_18
				root = {
					set_timed_country_flag = {
						flag = flag_est_greed_5_count_factions_18
						days = 1
					}
				}
				break = yes
			}
		}
	}
}

#Greed 5, menu for bribing factions.
country_event = {
	id = est_greed.10
	hide_window = no
	is_triggered_only = yes
	title = "est_event_greed_5.name"
	desc = "est_event_greed_5.desc"
	picture = GFX_evt_smugglers_in_bar
	
	option = {
		name = "est_event_greed_5.option.bribe"
		trigger = {
			has_country_flag = flag_est_greed_5_count_factions_1
		}
		random_pop_faction = {
			limit = {
				has_pop_faction_flag = flag_est_greed_5_factions_1
				Not = {
					has_modifier = mod_est_greed_5
				}
			}
			add_modifier = {
				modifier = "mod_est_greed_5"
				years = 10
			}
			root = {
				add_monthly_resource_mult = { 
					resource = energy 
					value = -3			
				}
			}
		}
	}
	option = {
		name = "est_event_greed_5.option.bribe"
		trigger = {
			has_country_flag = flag_est_greed_5_count_factions_2
		}
		random_pop_faction = {
			limit = {
				has_pop_faction_flag = flag_est_greed_5_factions_2
				Not = {
					has_modifier = mod_est_greed_5
				}
			}
			add_modifier = {
				modifier = "mod_est_greed_5"
				years = 10
			}
			root = {
				add_monthly_resource_mult = { 
					resource = energy 
					value = -3			
				}
			}
		}
	}
	option = {
		name = "est_event_greed_5.option.bribe"
		trigger = {
			has_country_flag = flag_est_greed_5_count_factions_3
		}
		random_pop_faction = {
			limit = {
				has_pop_faction_flag = flag_est_greed_5_factions_3
				Not = {
					has_modifier = mod_est_greed_5
				}
			}
			add_modifier = {
				modifier = "mod_est_greed_5"
				years = 10
			}
			root = {
				add_monthly_resource_mult = { 
					resource = energy 
					value = -3			
				}
			}
		}
	}
	option = {
		name = "est_event_greed_5.option.bribe"
		trigger = {
			has_country_flag = flag_est_greed_5_count_factions_4
		}
		random_pop_faction = {
			limit = {
				has_pop_faction_flag = flag_est_greed_5_factions_4
				Not = {
					has_modifier = mod_est_greed_5
				}
			}
			add_modifier = {
				modifier = "mod_est_greed_5"
				years = 10
			}
			root = {
				add_monthly_resource_mult = { 
					resource = energy 
					value = -3			
				}
			}
		}
	}
	option = {
		name = "est_event_greed_5.option.bribe"
		trigger = {
			has_country_flag = flag_est_greed_5_count_factions_5
		}
		random_pop_faction = {
			limit = {
				has_pop_faction_flag = flag_est_greed_5_factions_5
				Not = {
					has_modifier = mod_est_greed_5
				}
			}
			add_modifier = {
				modifier = "mod_est_greed_5"
				years = 10
			}
			root = {
				add_monthly_resource_mult = { 
					resource = energy 
					value = -3			
				}
			}
		}
	}
	option = {
		name = "est_event_greed_5.option.bribe"
		trigger = {
			has_country_flag = flag_est_greed_5_count_factions_6
		}
		random_pop_faction = {
			limit = {
				has_pop_faction_flag = flag_est_greed_5_factions_6
				Not = {
					has_modifier = mod_est_greed_5
				}
			}
			add_modifier = {
				modifier = "mod_est_greed_5"
				years = 10
			}
			root = {
				add_monthly_resource_mult = { 
					resource = energy 
					value = -3			
				}
			}
		}
	}
	option = {
		name = "est_event_greed_5.option.bribe"
		trigger = {
			has_country_flag = flag_est_greed_5_count_factions_7
		}
		random_pop_faction = {
			limit = {
				has_pop_faction_flag = flag_est_greed_5_factions_7
				Not = {
					has_modifier = mod_est_greed_5
				}
			}
			add_modifier = {
				modifier = "mod_est_greed_5"
				years = 10
			}
			root = {
				add_monthly_resource_mult = { 
					resource = energy 
					value = -3			
				}
			}
		}
	}
	option = {
		name = "est_event_greed_5.option.bribe"
		trigger = {
			has_country_flag = flag_est_greed_5_count_factions_8
		}
		random_pop_faction = {
			limit = {
				has_pop_faction_flag = flag_est_greed_5_factions_8
				Not = {
					has_modifier = mod_est_greed_5
				}
			}
			add_modifier = {
				modifier = "mod_est_greed_5"
				years = 10
			}
			root = {
				add_monthly_resource_mult = { 
					resource = energy 
					value = -3			
				}
			}
		}
	}
	option = {
		name = "est_event_greed_5.option.bribe"
		trigger = {
			has_country_flag = flag_est_greed_5_count_factions_9
		}
		random_pop_faction = {
			limit = {
				has_pop_faction_flag = flag_est_greed_5_factions_9
				Not = {
					has_modifier = mod_est_greed_5
				}
			}
			add_modifier = {
				modifier = "mod_est_greed_5"
				years = 10
			}
			root = {
				add_monthly_resource_mult = { 
					resource = energy 
					value = -3			
				}
			}
		}
	}
	option = {
		name = "est_event_greed_5.option.bribe"
		trigger = {
			has_country_flag = flag_est_greed_5_count_factions_10
		}
		random_pop_faction = {
			limit = {
				has_pop_faction_flag = flag_est_greed_5_factions_10
				Not = {
					has_modifier = mod_est_greed_5
				}
			}
			add_modifier = {
				modifier = "mod_est_greed_5"
				years = 10
			}
			root = {
				add_monthly_resource_mult = { 
					resource = energy 
					value = -3			
				}
			}
		}
	}
	option = {
		name = "est_event_greed_5.option.bribe"
		trigger = {
			has_country_flag = flag_est_greed_5_count_factions_11
		}
		random_pop_faction = {
			limit = {
				has_pop_faction_flag = flag_est_greed_5_factions_11
				Not = {
					has_modifier = mod_est_greed_5
				}
			}
			add_modifier = {
				modifier = "mod_est_greed_5"
				years = 10
			}
			root = {
				add_monthly_resource_mult = { 
					resource = energy 
					value = -3			
				}
			}
		}
	}
	option = {
		name = "est_event_greed_5.option.bribe"
		trigger = {
			has_country_flag = flag_est_greed_5_count_factions_12
		}
		random_pop_faction = {
			limit = {
				has_pop_faction_flag = flag_est_greed_5_factions_12
				Not = {
					has_modifier = mod_est_greed_5
				}
			}
			add_modifier = {
				modifier = "mod_est_greed_5"
				years = 10
			}
			root = {
				add_monthly_resource_mult = { 
					resource = energy 
					value = -3			
				}
			}
		}
	}
	option = {
		name = "est_event_greed_5.option.bribe"
		trigger = {
			has_country_flag = flag_est_greed_5_count_factions_13
		}
		random_pop_faction = {
			limit = {
				has_pop_faction_flag = flag_est_greed_5_factions_13
				Not = {
					has_modifier = mod_est_greed_5
				}
			}
			add_modifier = {
				modifier = "mod_est_greed_5"
				years = 10
			}
			root = {
				add_monthly_resource_mult = { 
					resource = energy 
					value = -3			
				}
			}
		}
	}
	option = {
		name = "est_event_greed_5.option.bribe"
		trigger = {
			has_country_flag = flag_est_greed_5_count_factions_14
		}
		random_pop_faction = {
			limit = {
				has_pop_faction_flag = flag_est_greed_5_factions_14
				Not = {
					has_modifier = mod_est_greed_5
				}
			}
			add_modifier = {
				modifier = "mod_est_greed_5"
				years = 10
			}
			root = {
				add_monthly_resource_mult = { 
					resource = energy 
					value = -3			
				}
			}
		}
	}
	option = {
		name = "est_event_greed_5.option.bribe"
		trigger = {
			has_country_flag = flag_est_greed_5_count_factions_15
		}
		random_pop_faction = {
			limit = {
				has_pop_faction_flag = flag_est_greed_5_factions_15
				Not = {
					has_modifier = mod_est_greed_5
				}
			}
			add_modifier = {
				modifier = "mod_est_greed_5"
				years = 10
			}
			root = {
				add_monthly_resource_mult = { 
					resource = energy 
					value = -3			
				}
			}
		}
	}
	option = {
		name = "est_event_greed_5.option.bribe"
		trigger = {
			has_country_flag = flag_est_greed_5_count_factions_16
		}
		random_pop_faction = {
			limit = {
				has_pop_faction_flag = flag_est_greed_5_factions_16
				Not = {
					has_modifier = mod_est_greed_5
				}
			}
			add_modifier = {
				modifier = "mod_est_greed_5"
				years = 10
			}
			root = {
				add_monthly_resource_mult = { 
					resource = energy 
					value = -3			
				}
			}
		}
	}
	option = {
		name = "est_event_greed_5.option.bribe"
		trigger = {
			has_country_flag = flag_est_greed_5_count_factions_17
		}
		random_pop_faction = {
			limit = {
				has_pop_faction_flag = flag_est_greed_5_factions_17
				Not = {
					has_modifier = mod_est_greed_5
				}
			}
			add_modifier = {
				modifier = "mod_est_greed_5"
				years = 10
			}
			root = {
				add_monthly_resource_mult = { 
					resource = energy 
					value = -3			
				}
			}
		}
	}
	option = {
		name = "est_event_greed_5.option.bribe"
		trigger = {
			has_country_flag = flag_est_greed_5_count_factions_18
		}
		random_pop_faction = {
			limit = {
				has_pop_faction_flag = flag_est_greed_5_factions_18
				Not = {
					has_modifier = mod_est_greed_5
				}
			}
			add_modifier = {
				modifier = "mod_est_greed_5"
				years = 10
			}
			root = {
				add_monthly_resource_mult = { 
					resource = energy 
					value = -3			
				}
			}
		}
	}
	option = {
		name = "est_event_greed_5.option.none"
	}
}
