### State-Based Drop Nuke Effect

drop_nuke_one_effect = {
	### For Region
	### Drop One Nuke
	
	### For <= 5 MM pop, kill 7.5-15%

	### For <= 10 MM pop, kill 6-12%

	### For 10 - 20 MM pop, kill 5-10%

	### For > 20 MM pop, kill 4-8%

	if = {
		limit = {
			state_population <= 5000000
		}
		random_list = {
			30 = {
				kill_population_percent_in_state = {
					percent = 0.075
				}
			}
			30 = {
				kill_population_percent_in_state = {
					percent = 0.1
				}
			}
			20 = {
				kill_population_percent_in_state = {
					percent = 0.125
				}
			}
			20 = {
				kill_population_percent_in_state = {
					percent = 0.15
				}
			}
		}
	}
	else_if = {
		limit = {
			state_population <= 10000000
		}
		random_list = {
			30 = {
				kill_population_percent_in_state = {
					percent = 0.06
				}
			}
			30 = {
				kill_population_percent_in_state = {
					percent = 0.08
				}
			}
			20 = {
				kill_population_percent_in_state = {
					percent = 0.1
				}
			}
			20 = {
				kill_population_percent_in_state = {
					percent = 0.12
				}
			}
		}
	}
	else_if = {
		limit = {
			state_population <= 20000000
		}
		random_list = {
			30 = {
				kill_population_percent_in_state = {
					percent = 0.05
				}
			}
			40 = {
				kill_population_percent_in_state = {
					percent = 0.075
				}
			}
			30 = {
				kill_population_percent_in_state = {
					percent = 0.10
				}
			}
		}
	}
	else = {
		random_list = {
			30 = {
				kill_population_percent_in_state = {
					percent = 0.04
				}
			}
			40 = {
				kill_population_percent_in_state = {
					percent = 0.06
				}
			}
			30 = {
				kill_population_percent_in_state = {
					percent = 0.08
				}
			}
		}
	}

	### Additional Nuclear Attack Effect
	random_list = {
		88 = {
			## Nothing
		}
		2 = {
			add_modifier = {
    				name = mod_nuclear_state_severe_fallout
				is_decaying = yes
   				months = 24
			}
		}
		2 = {
			add_modifier = {
    				name = mod_nuclear_state_infrastructure_collapse
				is_decaying = yes
   				months = 12
			}
		}
		2 = {
			add_modifier = {
    				name = mod_nuclear_state_rampant_anarchy
				is_decaying = yes
   				months = 12
			}
		}
		2 = {
			add_modifier = {
    				name = mod_nuclear_state_total_energy_grid_meltdown
				is_decaying = yes
   				months = 8
			}
		}
		2 = {
			kill_population_percent_in_state = {
				percent = 0.04
			}
			add_modifier = {
    				name = mod_nuclear_state_nuclear_famine
				is_decaying = yes
   				months = 8
			}
		}
		2 = {
			kill_population_percent_in_state = {
				percent = 0.02
			}
			add_modifier = {
    				name = mod_nuclear_state_mutated_flora_and_fauna
				is_decaying = yes
   				months = 48
			}
		}
	}

	#random = {
       	#	chance = 0.04   
       	#	regional_ecological_collapse_effect = yes
   	#}

	if = {
		limit = {
			NOT = {
				has_global_variable = nuclear_winter_happened
			}
		}
		random = {
       			chance = 1
       			global_ecological_collapse_effect = yes
   		}
	}

	state_region = {
		random_list = {
			50 = {
			add_devastation = 10
			}
			75 = {
				add_devastation = 12.5
			}
			100 = {
				add_devastation = 15
			}
			100 = {
				add_devastation = 17.5
			}
			100 = {
				add_devastation = 20
			}
			75 = {
				add_devastation = 22.5
			}
			50 = {
				add_devastation = 25
			}
		}
	}	
}

# Ecological Devastation Effect

state_ecological_collapse_effect = {
	random_list = {
		20 = {
			kill_population_percent_in_state = {
				percent = 0.01
			}
		}
		30 = {
			kill_population_percent_in_state = {
				percent = 0.02
			}
		}
		30 = {
			kill_population_percent_in_state = {
				percent = 0.03
			}
		}
		20 = {
			kill_population_percent_in_state = {
				percent = 0.04
			}
		}
	}
	
	### Add Modifier
	random_list = {
		30 = {
			add_modifier = {
    				name = mod_nuclear_state_ecological_collapse_base
   				is_decaying = yes # Optional, if yes, it will decay, default is no
   				months = 96
			}
		}
		40 = {
			add_modifier = {
    				name = mod_nuclear_state_ecological_collapse_base
				multiplier = 1.25
   				is_decaying = yes # Optional, if yes, it will decay, default is no
   				months = 96
			}
		}
		30 = {
			add_modifier = {
    				name = mod_nuclear_state_ecological_collapse_base
				multiplier = 1.5
   				is_decaying = yes # Optional, if yes, it will decay, default is no
   				months = 96
			}
		}
	}

}


regional_ecological_collapse_effect = {
	### For state

	strategic_region = {
		every_scope_state = {
			##
			state_ecological_collapse_effect = yes
		}
	}

	trigger_event = mod_nuclear_ecological_disaster.10

}



global_ecological_collapse_effect = {
	### No Scope

	set_global_variable = {
		name = nuclear_winter_happened
		months = 144
	}

	every_state_region = {
		random_list = {
			50 = {
				add_devastation = 4
			}
			50 = {
				add_devastation = 6
			}
		}
	}

	every_state = {
		state_ecological_collapse_effect = yes
	}

	trigger_event = mod_nuclear_ecological_disaster.20

}





