FLEETORDER_ORBIT_PLANET_BOMBARDMENT = {

	policy_orbital_bombardment_bombardment_selective = {
		icon = GFX_d_under_orbital_bombardment_1
		visible = {
			always = yes
		}

		days_remove = -1
		complete_effect = {
			if = {
				limit = { has_decision  = policy_orbital_bombardment_bombardment_armageddon }
				remove_decision_on_cooldown = policy_orbital_bombardment_bombardment_armageddon
			}
			if = {
				limit = { has_decision  = policy_orbital_bombardment_bombardment_indiscriminate }
				remove_decision_on_cooldown = policy_orbital_bombardment_bombardment_indiscriminate
			}
			if = {
				limit = { has_decision  = orbital_bombardment_abduction_name }
				remove_decision_on_cooldown = orbital_bombardment_abduction_name
			}
			set_variable = {
				var = global.bombardment_intensity
				value = 1
				tooltip = bombardment_intensity_tt1
			}
		}
	}

	policy_orbital_bombardment_bombardment_indiscriminate = {
		icon = GFX_d_under_orbital_bombardment_2
		visible = {
			
		}

		days_remove = -1
		complete_effect = {
			if = {
				limit = { has_decision  = policy_orbital_bombardment_bombardment_selective }
				remove_decision_on_cooldown = policy_orbital_bombardment_bombardment_selective
			}
			if = {
				limit = { has_decision  = policy_orbital_bombardment_bombardment_armageddon }
				remove_decision_on_cooldown = policy_orbital_bombardment_bombardment_armageddon
			}
			if = {
				limit = { has_decision  = orbital_bombardment_abduction_name }
				remove_decision_on_cooldown = orbital_bombardment_abduction_name
			}
			set_variable = {
				var = global.bombardment_intensity
				value = 2
				tooltip = bombardment_intensity_tt2
			}
		}
	}

	policy_orbital_bombardment_bombardment_armageddon = {
		icon = GFX_d_under_orbital_bombardment_3
		visible = {

		}

		days_remove = -1
		complete_effect = {
			if = {
				limit = { has_decision  = policy_orbital_bombardment_bombardment_selective }
				remove_decision_on_cooldown = policy_orbital_bombardment_bombardment_selective
			}
			if = {
				limit = { has_decision  = policy_orbital_bombardment_bombardment_indiscriminate }
				remove_decision_on_cooldown = policy_orbital_bombardment_bombardment_indiscriminate
			}
			if = {
				limit = { has_decision  = orbital_bombardment_abduction_name }
				remove_decision_on_cooldown = orbital_bombardment_abduction_name
			}
			set_variable = {
				var = global.bombardment_intensity
				value = 4
				tooltip = bombardment_intensity_tt4
			}
		}
	}

	orbital_bombardment_abduction_name = {
		icon = GFX_d_under_orbital_bombardment_4
		visible = {

		}

		days_remove = -1
		complete_effect = {
			if = {
				limit = { has_decision  = policy_orbital_bombardment_bombardment_selective }
				remove_decision_on_cooldown = policy_orbital_bombardment_bombardment_selective
			}
			if = {
				limit = { has_decision  = policy_orbital_bombardment_bombardment_indiscriminate }
				remove_decision_on_cooldown = policy_orbital_bombardment_bombardment_indiscriminate
			}
			if = {
				limit = { has_decision  = policy_orbital_bombardment_bombardment_armageddon }
				remove_decision_on_cooldown = policy_orbital_bombardment_bombardment_armageddon
			}
			set_variable = {
				var = global.bombardment_intensity
				value = 1
				tooltip = bombardment_intensity_tt5
			}
		}
	}

	orbital_bombardment_surrender_allowed = {
		icon = GFX_menu_icon_policies
		
		visible = {
			has_country_flag = Orbital_Surrender_Acceptance_flag
			NOT = { has_country_flag = allow_orbital_bombardment_surrender_flag }
		}
		complete_effect = {
			set_country_flag = allow_orbital_bombardment_surrender_flag
		}
	}

	orbital_bombardment_surrender_forbidden = {
		icon = GFX_menu_icon_policies

		visible = {
			has_country_flag = Orbital_Surrender_Acceptance_flag
			has_country_flag = allow_orbital_bombardment_surrender_flag
		}
		complete_effect = {
			clr_country_flag = allow_orbital_bombardment_surrender_flag
		}
	}

	bombardment_focus = {
		icon = GFX_point_of_interest

		visible = {
			NOT = { has_country_flag = has_target_TAG }
			check_variable = { global.bombardment_intensity > 0 }
			has_country_flag = activate_bombardment_flag
			has_war = yes
		}

		target_trigger = {
			FROM = {
				has_war_with = ROOT
				is_major = yes
			}
		}

		complete_effect = {
			set_country_flag = has_target_TAG
			FROM = {
				set_country_flag = is_target_TAG
				set_variable = {
					ROOT.target_TAG_var = THIS.id
				}
			}
		}
	}

	stop_bombardment_focus = {
		icon = GFX_point_of_interest

		visible = {
			has_country_flag = has_target_TAG
		}

		target_trigger = {
			FROM = {
				has_country_flag = is_target_TAG
			}
		}

		complete_effect = {
			clr_country_flag = has_target_TAG
			clear_variable = target_TAG_var
			FROM = {
				clr_country_flag = is_target_TAG
			}
		}
	}

	stop_bombardment_focus_0 = {
		icon = GFX_point_of_interest

		visible = {
			has_country_flag = has_target_TAG
			NOT = {
				any_country = {
					has_country_flag = is_target_TAG
				}
			}
		}

		complete_effect = {
			clr_country_flag = has_target_TAG
			clear_variable = target_TAG_var
			FROM = {
				clr_country_flag = is_target_TAG
			}
		}
	}

	activate_bombardment = {
		icon = GFX_alert
		visible = {
			NOT = { has_country_flag = activate_bombardment_flag }
			check_variable = { global.bombardment_intensity > 0 }
			has_war = yes
		}
		
		complete_effect = {
			set_country_flag = activate_bombardment_flag
			hidden_effect = {
				country_event = {
					id = stt.100
					hours = 4
					random_hours = 4
				}
				random_country = {
					limit = {
						has_war_with = ROOT
					}
					country_event = {
						id = stt.103
						hours = 12
						random_hours = 12
					}
				}
			}
		}
	}

	stop_bombardment = {
		icon = GFX_alert
		visible = {
			has_country_flag = activate_bombardment_flag
		}
		available = {
			NOT = { has_country_flag = has_target_TAG }
		}

		complete_effect = {
			clr_country_flag = activate_bombardment_flag
		}
	}
}

orbital_bombardment_warning = {
	reduce_25_country_devastation = {
		icon = GFX_menu_icon_policies
		visible = {
			is_debug = yes
			has_dynamic_modifier = {
				modifier = ORBITAL_BOMBARDMENT_1
				scope = ROOT
			}
		}
		complete_effect = {
			add_to_variable = { country_devastation_typr1_var = 0.25 }
			add_to_variable = { country_devastation = -0.25 }
		}
	}

	reduce_5_country_devastation = {
		icon = GFX_menu_icon_policies
		visible = {
			is_debug = yes
			has_dynamic_modifier = {
				modifier = ORBITAL_BOMBARDMENT_1
				scope = ROOT
			}
		}
		complete_effect = {
			add_to_variable = { country_devastation_typr1_var = 0.05 }
			add_to_variable = { country_devastation = -0.05 }
		}
	}

	under_bombardment = {
		icon = GFX_alert
		days_mission_timeout = 14

		activation = {
			has_country_flag = bombed_flag
		}
		available = {
			always = no
		}
		cancel_trigger = {
			NOT = { has_country_flag = bombed_flag }
		}
		is_good = no

		timeout_effect = {
			add_manpower = -200000
			add_political_power = -100
			custom_effect_tooltip = under_bombardment_tt
		}
	}

	rebuilding_our_country = {
		icon = GFX_job_low_tech_laborer
		days_mission_timeout = 14

		activation = {
			has_dynamic_modifier = { modifier = ORBITAL_BOMBARDMENT_1 scope = ROOT }
			NOT = { has_country_flag = bombed_flag }
		}
		available = {
			always = no
		}
		cancel_trigger = {
			NOT = {
				has_dynamic_modifier = { modifier = ORBITAL_BOMBARDMENT_1 scope = ROOT }
			}
		}
		is_good = yes

		timeout_effect = {
			custom_effect_tooltip = rebuilding_our_country_tt
			hidden_effect = {
				if = {
					limit = {
						has_dynamic_modifier = { modifier = ORBITAL_BOMBARDMENT_1 scope = ROOT }
						has_war = yes
						NOT = { has_country_flag = bombed_flag }
					}
					add_to_variable = { country_devastation_typr1_var = 0.01 }
					add_to_variable = { country_devastation = -0.01 }
				}
				else_if = {
					limit = {
						has_dynamic_modifier = { modifier = ORBITAL_BOMBARDMENT_1 scope = ROOT }
						has_war = no
						NOT = { has_country_flag = bombed_flag }
					}
					add_to_variable = { country_devastation_typr1_var = 0.02 }
					add_to_variable = { country_devastation = -0.02 }
				}
				if = {
					limit = {
						check_variable = { country_devastation_typr2_var < 0 }
						check_variable = { country_devastation < 0.75 }
					}
					set_variable = { country_devastation_typr2_var = 0 }
				}
				if = {
					limit = {
						OR = {
							check_variable = { country_devastation > 1 }
							check_variable = { country_devastation_typr1_var < -1 }
						}
					}
					set_variable = { country_devastation = 1 }
					set_variable = { country_devastation_typr1_var = -1 }
				}
				if = {
					limit = {
						check_variable = { country_devastation < 0 }
						has_dynamic_modifier = { modifier = ORBITAL_BOMBARDMENT_1 scope = ROOT }
					}
					remove_dynamic_modifier = { modifier = ORBITAL_BOMBARDMENT_1 scope = ROOT }
					set_variable = {
						country_devastation_typr1_var = 0
					}
					set_variable = {
						country_devastation_typr2_var = 0
					}
					set_variable = {
						country_devastation = 0
					}
				}
			}
		}
	}

	planet_automation_clear_blockers = {
		icon = GFX_job_low_tech_laborer
		days_remove = 120

		state_target = yes
		on_map_mode = map_only
		target_trigger = {
			FROM = {
				is_controlled_by_ROOT_or_ally = yes
				has_dynamic_modifier = { modifier = irradiated }
				has_dynamic_modifier = { modifier = ruined_district }
			}
		}
		available = {
			check_variable = { ROOT.num_of_civilian_factories_available_for_projects > 15 }
			NOT = { has_country_flag = bombed_flag }
		}

		modifier = {
			civilian_factory_use = 15
		}
		remove_effect = {
			FROM = {
				remove_dynamic_modifier = {
					modifier = irradiated
				}
				remove_dynamic_modifier = {
					modifier = ruined_district
				}
			}
		}

		ai_will_do = {
			base = 0
			modifier = {
				AND = {
					check_variable = {
						ROOT.num_of_civilian_factories_available_for_projects > 16
					}
					NOT = { has_country_flag = bombed_flag }
				}
				add = 10
			}
		}
	}
}