IBR_gibraltar_dam_category = {

	IBR_gibraltar_dam_mission = {

		icon = GFX_decision_generic_decision

		allowed = {
			original_tag = IBR
		}

		icon = GFX_decision_generic_mission

		available = {
			hidden_trigger = {
				IBR = {
					controls_state = 118
					has_country_flag = IBR_impossible_dam_flag
				}
			}
		}

		visible = {
			IBR = {
				controls_state = 118
			}
		}

		selectable_mission = no
		days_mission_timeout = 365
		is_good = no
		fire_only_once = yes

		days_remove = IBR_maintain_dam_days?0
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_gibraltar_dam_mission"
		}

		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_gibraltar_dam_mission"
		}

		timeout_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision timeout IBR_gibraltar_dam_mission"
			activate_mission = IBR_gibraltar_dam_mission
			set_temp_variable = {IBR_dam_cost_temp = 0}
			add_to_temp_variable = {IBR_dam_cost_temp = IBR_dam_cost}
			divide_temp_variable = {IBR_dam_cost_temp = 1000}
			set_variable = {IBR_misc_costs_dam_variable = IBR_dam_cost_temp}
			if = {
				limit = {
					NOT = {
						has_idea = IBR_The_Gibraltar_Dam_Abandoned
					}
				}
				IBR = {
					add_to_variable = {IBR_dam_budget = 3 }
					clamp_variable = {
						var = IBR_dam_budget
						min = 0
						max = 2000
					}
				}
			}
		}

		ai_will_do = {
			factor = 5
		}
	}
	IBR_replace_dam_chairman = {

		icon = GFX_decision_generic_political_action


		allowed = {
			tag = IBR
		}

		visible = {
			NOT = {
				has_country_flag = IBR_abandoned_dam_flag
			}
		}

		fire_only_once = no

		days_re_enable = 120

		cost = 0

		ai_will_do = {
			factor = 1
		}

		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_replace_dam_chairman"
			set_country_flag = IBR_change_dam_chairman_flag
		}
	}
	IBR_choose_manuel_elices = {

		allowed = {
			tag = IBR
		}
		visible = {
			has_country_flag = IBR_change_dam_chairman_flag
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					has_country_flag = IBR_manuel_elices_dam
				}
			}
		}

		fire_only_once = no

		days_re_enable = 120

		cost = 0

		ai_will_do = {
			factor = 1
		}

		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_choose_manuel_elices"
			clr_country_flag = IBR_change_dam_chairman_flag
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				clr_country_flag = IBR_leopoldo_sotelo_dam
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				clr_country_flag = IBR_rui_sanches_dam
			}
			set_country_flag = IBR_manuel_elices_dam
			custom_effect_tooltip = IBR_manuel_elices_tt
		}
	}
	IBR_choose_leopoldo_sotelo = {

		allowed = {
			tag = IBR
		}
		visible = {
			has_country_flag = IBR_change_dam_chairman_flag
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
			}
		}

		fire_only_once = no

		days_re_enable = 120

		cost = 0

		ai_will_do = {
			factor = 1
		}

		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_choose_leopoldo_sotelo"
			clr_country_flag = IBR_change_dam_chairman_flag
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				clr_country_flag = IBR_manuel_elices_dam
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				clr_country_flag = IBR_rui_sanches_dam
			}
			set_country_flag = IBR_leopoldo_sotelo_dam
			custom_effect_tooltip = IBR_leopoldo_sotelo_tt
		}
	}
	IBR_choose_rui_sanches = {

		allowed = {
			tag = IBR
		}
		visible = {
			has_country_flag = IBR_change_dam_chairman_flag
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					has_country_flag = IBR_rui_sanches_dam
				}
			}
		}

		fire_only_once = no

		days_re_enable = 120

		cost = 0

		ai_will_do = {
			factor = 1
		}

		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_choose_rui_sanches"
			clr_country_flag = IBR_change_dam_chairman_flag
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				clr_country_flag = IBR_manuel_elices_dam
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				clr_country_flag = IBR_leopoldo_sotelo_dam
			}
			set_country_flag = IBR_rui_sanches_dam
			custom_effect_tooltip = IBR_rui_sanches_tt
		}
	}
	IBR_abandon_dam_decision = {

		icon = GFX_decision_generic_break_treaty


		allowed = {
			tag = IBR
		}

		visible = {
			AND = {
				NOT = {
					has_country_flag = IBR_abandoned_dam_flag
					has_country_flag = IBR_abandon_dam_question_flag
					has_country_flag = IBR_finished_dam_flag
				}
			}
		}

		fire_only_once = no

		days_re_enable = 7

		cost = 0

		ai_will_do = {
			factor = 0
		}

		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_abandon_dam_decision"
			set_country_flag = IBR_abandon_dam_question_flag
		}
	}
	IBR_abandon_dam_no_decision = {

		icon = GFX_decision_generic_break_treaty


		allowed = {
			tag = IBR
		}

		visible = {
			hidden_trigger = {
				has_country_flag = IBR_abandon_dam_question_flag
				NOT = {
					has_country_flag = IBR_abandoned_dam_flag
					has_country_flag = IBR_finished_dam_flag
					has_decision = IBR_abandon_dam_yes_decision
				}
			}
		}

		cancel_if_not_visible = yes

		fire_only_once = yes

		cost = 0

		ai_will_do = {
			factor = 0
		}

		days_remove = 7

		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_abandon_dam_no_decision"
			clr_country_flag = IBR_abandon_dam_question_flag
		}
	}
	IBR_abandon_dam_yes_decision = {

		icon = GFX_decision_generic_break_treaty


		allowed = {
			tag = IBR

		}

		visible = {
			hidden_trigger = {
				has_country_flag = IBR_abandon_dam_question_flag
				NOT = {
					has_country_flag = IBR_abandoned_dam_flag
					has_country_flag = IBR_finished_dam_flag
					has_decision = IBR_abandon_dam_no_decision
				}
			}
		}

		cancel_if_not_visible = yes

		fire_only_once = yes

		cost = 0

		ai_will_do = {
			factor = 0
		}

		days_remove = 7

		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_abandon_dam_yes_decision"
			if = {
				limit = {
					not = {
						has_country_flag = IBR_finished_dam_flag
					}
				}
				IBR_abandon_dam = yes
				clr_country_flag = IBR_gib_scaffolds_unsafe
				set_country_flag = IBR_dam_abandoned_flag
				custom_effect_tooltip = IBR_abandon_dam_tt
			}
			clr_country_flag = IBR_abandon_dam_question_flag
		}
	}
	IBR_add_1_dam_budget_decision = {

		icon = GFX_decision_black_market_money


		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				has_country_flag = IBR_abandoned_dam_flag
			}
		}

		fire_only_once = no

		days_re_enable = 60

		cost = 5

		ai_will_do = {
			factor = 1
		}

		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_add_1_dam_budget_decision"
			IBR_add_1_dam_budget = yes
		}
	}
	IBR_add_2_dam_budget_decision = {

		icon = GFX_decision_black_market_money


		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				has_country_flag = IBR_abandoned_dam_flag
			}
		}

		fire_only_once = no

		days_re_enable = 90

		cost = 10

		ai_will_do = {
			factor = 1
		}

		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_add_2_dam_budget_decision"
			IBR_add_2_dam_budget = yes
		}
	}
	IBR_add_3_dam_budget_decision = {

		icon = GFX_decision_black_market_money


		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				has_country_flag = IBR_abandoned_dam_flag
			}
		}

		fire_only_once = no

		days_re_enable = 120

		cost = 15

		ai_will_do = {
			factor = 1
		}

		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_add_3_dam_budget_decision"
			IBR_add_3_dam_budget = yes
		}
	}
#UPGRADES 
#########################################################################################################
	IBR_finish_administration_building = {

		icon = GFX_decision_generic_construction

		available = {
			check_variable = {
				var = IBR_dam_budget
				value = 3
				compare = greater_than_or_equals
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					check_variable = {
						var = IBR_dam_workers
						value = 0
						compare = less_than
					}
				}
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		fire_only_once = yes

		custom_cost_trigger = {always = yes }
		custom_cost_text = IBR_dam_3_millions


		ai_will_do = {
			factor = 1
		}

		days_remove = 260
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_finish_administration_building"
			subtract_from_variable = {
				var = IBR_dam_budget
				value = 3
			}
			clamp_variable = {
				var = IBR_dam_budget
				min = 0
				max = 2000
			}
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 0.6
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 0.6
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.5
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 0.8
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 0.8
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.5
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 1
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 1
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.3
				}
			}
			add_manpower = -50
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_finish_administration_building"
			add_to_variable = {
				var = IBR_dam_progress
				value = 1.5
			}
			set_country_flag = IBR_dam_admin_flag
			custom_effect_tooltip = IBR_dam_admin_tt
			add_manpower = 50
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 0.5
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 0.5
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.1
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 0.6
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 0.6
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.1
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 0.7
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 0.7
				}
			}
			hidden_effect = {
				country_event = {
					id = IBR.3146
					days = 2
				}
			}
			hidden_effect = {
				country_event = {
					id = IBR.31471
					days = 122
				}
			}
			set_country_flag = IBR_gib_scaffolds_unsafe
		}
	}
#########################################################################################################
	IBR_establish_surveillance = {

		icon = GFX_decision_generic_independence

		available = {
			check_variable = {
				var = IBR_dam_budget
				value = 4
				compare = greater_than_or_equals
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		allowed = {
			tag = IBR
		}

		visible = {
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					check_variable = {
						var = IBR_dam_workers
						value = 0
						compare = less_than
					}
				}
			}
			has_country_flag = IBR_dam_admin_flag
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		fire_only_once = yes

		custom_cost_trigger = {always = yes }
		custom_cost_text = IBR_dam_4_millions


		ai_will_do = {
			factor = 1
		}

		days_remove = IBR_dam_time
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_establish_surveillance"
			subtract_from_variable = {
				var = IBR_dam_budget
				value = 4
			}
			clamp_variable = {
				var = IBR_dam_budget
				min = 0
				max = 2000
			}
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 2
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 2
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.3
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 2.2
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 2.2
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.3
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 2.6
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 2.6
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.1
				}
			}
			add_manpower = -50
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_establish_surveillance"
			add_to_variable = {
				var = IBR_dam_progress
				value = 2
			}
			set_country_flag = IBR_dam_cameras_flag
			custom_effect_tooltip = IBR_dam_cameras_tt
			add_manpower = 50
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 0.8
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 0.8
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 0.6
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 0.6
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 0.8
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 0.8
				}
			}
		}
	}
#########################################################################################################
	IBR_finish_lights = {

		icon = GFX_decision_generic_construction

		available = {
			check_variable = {
				var = IBR_dam_budget
				value = 4
				compare = greater_than_or_equals
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					check_variable = {
						var = IBR_dam_workers
						value = 0
						compare = less_than
					}
				}
			}
			has_country_flag = IBR_dam_admin_flag
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		fire_only_once = yes

		custom_cost_trigger = {always = yes }
		custom_cost_text = IBR_dam_4_millions


		ai_will_do = {
			factor = 1
		}

		days_remove = IBR_dam_time
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_finish_lights"
			subtract_from_variable = {
				var = IBR_dam_budget
				value = 4
			}
			clamp_variable = {
				var = IBR_dam_budget
				min = 0
				max = 2000
			}
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 2
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 2
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.3
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 2.2
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 2.2
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.3
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 2.6
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 2.6
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.1
				}
			}
			add_manpower = -50
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_finish_lights"
			add_to_variable = {
				var = IBR_dam_progress
				value = 2
			}
			set_country_flag = IBR_dam_lights_flag
			custom_effect_tooltip = IBR_dam_lights_tt
			add_manpower = 50
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 0.8
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 0.8
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 0.6
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 0.6
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 0.8
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 0.8
				}
			}
		}
	}
#########################################################################################################
	IBR_finish_east_plumbing = {

		icon = GFX_decision_generic_construction

		available = {
			check_variable = {
				var = IBR_dam_budget
				value = 7
				compare = greater_than_or_equals
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					check_variable = {
						var = IBR_dam_workers
						value = 0
						compare = less_than
					}
				}
			}
			has_country_flag = IBR_dam_admin_flag
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		fire_only_once = yes

		custom_cost_trigger = {always = yes }
		custom_cost_text = IBR_dam_7_millions


		ai_will_do = {
			factor = 1
		}

		days_remove = IBR_dam_time
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_finish_east_plumbing"
			subtract_from_variable = {
				var = IBR_dam_budget
				value = 7
			}
			clamp_variable = {
				var = IBR_dam_budget
				min = 0
				max = 2000
			}
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.3
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 4.3
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.7
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.6
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 4.6
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.7
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.9
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 4.9
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.3
				}
			}
			add_manpower = -50
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_finish_east_plumbing"
			add_to_variable = {
				var = IBR_dam_progress
				value = 3
			}
			set_country_flag = IBR_east_plumbing_flag
			custom_effect_tooltip = IBR_east_plumbing_tt
			add_manpower = 50
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.1
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 4.1
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.2
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.2
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 4.2
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.2
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 4
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 4
				}
			}
		}
	}
#########################################################################################################
	IBR_finish_west_plumbing = {

		icon = GFX_decision_generic_construction

		available = {
			check_variable = {
				var = IBR_dam_budget
				value = 7
				compare = greater_than_or_equals
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					check_variable = {
						var = IBR_dam_workers
						value = 0
						compare = less_than
					}
				}
			}
			has_country_flag = IBR_dam_admin_flag
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		fire_only_once = yes

		custom_cost_trigger = {always = yes }
		custom_cost_text = IBR_dam_7_millions


		ai_will_do = {
			factor = 1
		}

		days_remove = IBR_dam_time
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_finish_west_plumbing"
			subtract_from_variable = {
				var = IBR_dam_budget
				value = 7
			}
			clamp_variable = {
				var = IBR_dam_budget
				min = 0
				max = 2000
			}
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.3
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 4.3
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.7
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.6
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 4.6
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.7
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.9
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 4.9
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.3
				}
			}
			add_manpower = -50
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_finish_west_plumbing"
			add_to_variable = {
				var = IBR_dam_progress
				value = 3
			}
			set_country_flag = IBR_west_plumbing_flag
			custom_effect_tooltip = IBR_west_plumbing_tt
			add_manpower = 50
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.1
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 4.1
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.2
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.2
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 4.2
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.2
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 4
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 4
				}
			}
		}
	}
#########################################################################################################
	IBR_finish_east_lock = {

		icon = GFX_decision_shipyard

		available = {
			check_variable = {
				var = IBR_dam_budget
				value = 7
				compare = greater_than_or_equals
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					check_variable = {
						var = IBR_dam_workers
						value = 0
						compare = less_than
					}
				}
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
			has_country_flag = IBR_east_plumbing_flag
		}

		fire_only_once = yes

		custom_cost_trigger = {always = yes }
		custom_cost_text = IBR_dam_7_millions


		ai_will_do = {
			factor = 1
		}

		days_remove = IBR_dam_time
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_finish_east_lock"
			subtract_from_variable = {
				var = IBR_dam_budget
				value = 7
			}
			clamp_variable = {
				var = IBR_dam_budget
				min = 0
				max = 2000
			}
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.3
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 4.3
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.7
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.6
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 4.6
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.7
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.9
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 4.9
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.3
				}
			}
			add_manpower = -50
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_finish_east_lock"
			add_to_variable = {
				var = IBR_dam_progress
				value = 5
			}
			set_country_flag = IBR_east_lock_flag
			clr_country_flag = IBR_east_plumbing_flag
			custom_effect_tooltip = IBR_east_lock_tt
			add_manpower = 50
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.1
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 4.1
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.2
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.2
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 4.2
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.2
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 4
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 4
				}
			}
		}
	}
#########################################################################################################
	IBR_finish_west_lock = {

		icon = GFX_decision_shipyard

		available = {
			check_variable = {
				var = IBR_dam_budget
				value = 7
				compare = greater_than_or_equals
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					check_variable = {
						var = IBR_dam_workers
						value = 0
						compare = less_than
					}
				}
			}
			has_country_flag = IBR_west_plumbing_flag
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		fire_only_once = yes

		custom_cost_trigger = {always = yes }
		custom_cost_text = IBR_dam_7_millions


		ai_will_do = {
			factor = 1
		}

		days_remove = IBR_dam_time
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_finish_west_lock"
			subtract_from_variable = {
				var = IBR_dam_budget
				value = 7
			}
			clamp_variable = {
				var = IBR_dam_budget
				min = 0
				max = 2000
			}
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.3
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 4.3
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.7
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.6
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 4.6
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.7
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.9
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 4.9
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.3
				}
			}
			add_manpower = -50
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_finish_west_lock"
			add_to_variable = {
				var = IBR_dam_progress
				value = 5
			}
			set_country_flag = IBR_west_lock_flag
			clr_country_flag = IBR_west_plumbing_flag
			custom_effect_tooltip = IBR_west_lock_tt
			add_manpower = 50
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.1
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 4.1
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.2
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.2
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 4.2
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.2
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 4
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 4
				}
			}
		}
	}
#########################################################################################################
	IBR_build_gibraltar_station = {

		icon = GFX_decision_generic_construction

		available = {
			check_variable = {
				var = IBR_dam_budget
				value = 3
				compare = greater_than_or_equals
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					check_variable = {
						var = IBR_dam_workers
						value = 0
						compare = less_than
					}
				}
			}
			has_country_flag = IBR_dam_admin_flag
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		fire_only_once = yes

		custom_cost_trigger = {always = yes }
		custom_cost_text = IBR_dam_3_millions


		ai_will_do = {
			factor = 1
		}

		days_remove = IBR_dam_time
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_build_gibraltar_station"
			subtract_from_variable = {
				var = IBR_dam_budget
				value = 3
			}
			clamp_variable = {
				var = IBR_dam_budget
				min = 0
				max = 2000
			}
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 2
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 2
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.2
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 2.2
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 2.2
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.2
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 2.4
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 2.4
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.1
				}
			}
			add_manpower = -50
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_build_gibraltar_station"
			add_to_variable = {
				var = IBR_dam_progress
				value = 2.5
			}
			set_country_flag = IBR_gib_station_flag
			custom_effect_tooltip = IBR_gib_station_tt
			add_manpower = 50
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 1.8
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 1.8
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 1.8
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 1.8
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 1.7
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 1.7
				}
			}
		}
	}
#########################################################################################################
	IBR_build_tangier_station = {

		icon = GFX_decision_generic_construction

		available = {
			check_variable = {
				var = IBR_dam_budget
				value = 3
				compare = greater_than_or_equals
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					check_variable = {
						var = IBR_dam_workers
						value = 0
						compare = less_than
					}
				}
			}
			has_country_flag = IBR_dam_admin_flag
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		fire_only_once = yes

		custom_cost_trigger = {always = yes }
		custom_cost_text = IBR_dam_3_millions


		ai_will_do = {
			factor = 1
		}

		days_remove = IBR_dam_time
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_build_tangier_station"
			subtract_from_variable = {
				var = IBR_dam_budget
				value = 3
			}
			clamp_variable = {
				var = IBR_dam_budget
				min = 0
				max = 2000
			}
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 2
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 2
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.2
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 2.2
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 2.2
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.2
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 2.4
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 2.4
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.1
				}
			}
			add_manpower = -50
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_build_tangier_station"
			add_to_variable = {
				var = IBR_dam_progress
				value = 2.5
			}
			set_country_flag = IBR_tan_station_flag
			custom_effect_tooltip = IBR_tan_station_tt
			add_manpower = 50
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 1.8
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 1.8
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 1.8
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 1.8
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 1.7
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 1.7
				}
			}
		}
	}
#########################################################################################################
	IBR_open_dam_train = {

		icon = GFX_decision_generic_construction

		available = {
			check_variable = {
				var = IBR_dam_budget
				value = 2.5
				compare = greater_than_or_equals
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					check_variable = {
						var = IBR_dam_workers
						value = 0
						compare = less_than
					}
				}
			}
			AND = {
				has_country_flag = IBR_gib_station_flag
				has_country_flag = IBR_tan_station_flag
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}

		}

		fire_only_once = yes

		custom_cost_trigger = {always = yes }
		custom_cost_text = IBR_dam_2_5_millions


		ai_will_do = {
			factor = 1
		}

		days_remove = IBR_dam_time
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_open_dam_train"
			subtract_from_variable = {
				var = IBR_dam_budget
				value = 2.5
			}
			clamp_variable = {
				var = IBR_dam_budget
				min = 0
				max = 2000
			}
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 1
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 1
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.4
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 1.2
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 1.2
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.4
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 1.5
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 1.5
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.1
				}
			}
			add_manpower = -50
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_open_dam_train"
			add_to_variable = {
				var = IBR_dam_progress
				value = 2.5
			}
			set_country_flag = IBR_dam_train_flag
			custom_effect_tooltip = IBR_train_line_tt
			clr_country_flag = IBR_gib_station_flag
			clr_country_flag = IBR_tan_station_flag
			add_manpower = 50
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 0.8
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 0.8
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.2
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 0.8
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 0.8
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.2
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 0.7
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 0.7
				}
			}
		}
	}
#########################################################################################################
	IBR_dig_hydroelectric_tunnels = {

		icon = GFX_decision_generic_construction

		available = {
			check_variable = {
				var = IBR_dam_budget
				value = 10
				compare = greater_than_or_equals
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					check_variable = {
						var = IBR_dam_workers
						value = 0
						compare = less_than
					}
				}
			}
			has_country_flag = IBR_dam_admin_flag
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		fire_only_once = yes

		custom_cost_trigger = {always = yes }
		custom_cost_text = IBR_dam_10_millions


		ai_will_do = {
			factor = 1
		}

		days_remove = IBR_dam_time
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_dig_hydroelectric_tunnels"
			subtract_from_variable = {
				var = IBR_dam_budget
				value = 10
			}
			clamp_variable = {
				var = IBR_dam_budget
				min = 0
				max = 2000
			}
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 6.2
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 6.2
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.8
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 6.4
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 6.4
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.8
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 6.6
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 6.6
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.4
				}
			}
			add_manpower = -300
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_dig_hydroelectric_tunnels"
			add_to_variable = {
				var = IBR_dam_progress
				value = 5
			}
			set_country_flag = IBR_hydro_tunnels_flag
			custom_effect_tooltip = IBR_hydro_tunnels_tt
			add_manpower = 300
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.9
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 4.9
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.1
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.7
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 4.7
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.1
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.4
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 4.4
				}
			}
		}
	}
#########################################################################################################
	IBR_build_power_plant = {

		icon = GFX_decision_generic_construction

		available = {
			check_variable = {
				var = IBR_dam_budget
				value = 5
				compare = greater_than_or_equals
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					check_variable = {
						var = IBR_dam_workers
						value = 0
						compare = less_than
					}
				}
			}
			has_country_flag = IBR_hydro_tunnels_flag
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		fire_only_once = yes

		custom_cost_trigger = {always = yes }
		custom_cost_text = IBR_dam_5_millions


		ai_will_do = {
			factor = 1
		}

		days_remove = IBR_dam_time
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_build_power_plant"
			subtract_from_variable = {
				var = IBR_dam_budget
				value = 5
			}
			clamp_variable = {
				var = IBR_dam_budget
				min = 0
				max = 2000
			}
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 2.3
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 2.3
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.4
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 2.7
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 2.7
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.4
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 2.9
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 2.9
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.1
				}
			}
			add_manpower = -50
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_build_power_plant"
			add_to_variable = {
				var = IBR_dam_progress
				value = 5
			}
			set_country_flag = IBR_power_plant_flag
			custom_effect_tooltip = IBR_power_plant_tt
			clr_country_flag = IBR_hydro_tunnels_flag
			add_manpower = 50
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 2
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 2
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.1
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 1.8
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 1.8
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.1
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 1.6
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 1.6
				}
			}
		}
	}
#########################################################################################################
	IBR_install_turbines = {

		icon = GFX_decision_generic_construction

		available = {
			check_variable = {
				var = IBR_dam_budget
				value = 7
				compare = greater_than_or_equals
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					check_variable = {
						var = IBR_dam_workers
						value = 0
						compare = less_than
					}
				}
			}
			has_country_flag = IBR_power_plant_flag
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		fire_only_once = yes

		custom_cost_trigger = {always = yes }
		custom_cost_text = IBR_dam_7_millions


		ai_will_do = {
			factor = 1
		}

		days_remove = IBR_dam_time
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_install_turbines"
			subtract_from_variable = {
				var = IBR_dam_budget
				value = 7
			}
			clamp_variable = {
				var = IBR_dam_budget
				min = 0
				max = 2000
			}
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 6.2
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 6.2
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.8
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 6.4
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 6.4
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.8
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 6.6
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 6.6
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.4
				}
			}
			add_manpower = -300
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_install_turbines"
			add_to_variable = {
				var = IBR_dam_progress
				value = 5.5
			}
			set_country_flag = IBR_turbines_flag
			custom_effect_tooltip = IBR_turbines_tt
			clr_country_flag = IBR_power_plant_flag
			add_manpower = 300
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.9
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 4.9
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.1
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.7
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 4.7
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.1
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.4
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 4.4
				}
			}
		}
	}
#########################################################################################################
	IBR_install_generators = {

		icon = GFX_decision_generic_construction

		available = {
			check_variable = {
				var = IBR_dam_budget
				value = 15
				compare = greater_than_or_equals
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					check_variable = {
						var = IBR_dam_workers
						value = 0
						compare = less_than
					}
				}
			}
			has_country_flag = IBR_turbines_flag
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		fire_only_once = yes

		custom_cost_trigger = {always = yes }
		custom_cost_text = IBR_dam_15_millions


		ai_will_do = {
			factor = 1
		}

		days_remove = IBR_dam_time
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_install_generators"
			subtract_from_variable = {
				var = IBR_dam_budget
				value = 15
			}
			clamp_variable = {
				var = IBR_dam_budget
				min = 0
				max = 2000
			}
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 9.1
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 9.1
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 1.3
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 9.5
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 9.5
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 1.3
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 9.8
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 9.8
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.8
				}
			}
			add_manpower = -300
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_install_generators"
			add_to_variable = {
				var = IBR_dam_progress
				value = 5
			}
			set_country_flag = IBR_generators_flag
			custom_effect_tooltip = IBR_generators_tt
			clr_country_flag = IBR_turbines_flag
			add_manpower = 300
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 7.4
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 7.4
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.2
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 7
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 7
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.2
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 6.2
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 6.2
				}
			}
		}
	}
#########################################################################################################
	IBR_attach_plant = {

		icon = GFX_decision_generic_construction

		available = {
			check_variable = {
				var = IBR_dam_budget
				value = 5
				compare = greater_than_or_equals
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					check_variable = {
						var = IBR_dam_workers
						value = 0
						compare = less_than
					}
				}
			}
			has_country_flag = IBR_generators_flag
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		fire_only_once = yes

		custom_cost_trigger = {always = yes }
		custom_cost_text = IBR_dam_5_millions


		ai_will_do = {
			factor = 1
		}

		days_remove = IBR_dam_time
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_attach_plant"
			subtract_from_variable = {
				var = IBR_dam_budget
				value = 5
			}
			clamp_variable = {
				var = IBR_dam_budget
				min = 0
				max = 2000
			}
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.1
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 4.1
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.4
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.5
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 4.5
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.4
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 4.8
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 4.8
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.2
				}
			}
			add_manpower = -50
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_attach_plant"
			add_to_variable = {
				var = IBR_dam_progress
				value = 4
			}
			set_country_flag = IBR_plant_attached_flag
			custom_effect_tooltip = IBR_attach_plant_tt
			clr_country_flag = IBR_generators_flag
			add_manpower = 50
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 3.7
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 3.7
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.1
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 3.6
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 3.6
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.1
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 3.2
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 3.2
				}
			}
		}
	}
#########################################################################################################
	IBR_complete_monument = {

		icon = GFX_decision_generic_construction

		available = {
			check_variable = {
				var = IBR_dam_budget
				value = 1
				compare = greater_than_or_equals
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
			NOT = {
				has_country_flag = IBR_in_crisis
			}
		}

		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					check_variable = {
						var = IBR_dam_workers
						value = 0
						compare = less_than
					}
				}

			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
			AND = {
				has_country_flag = IBR_plant_attached_flag
				has_country_flag = IBR_dam_train_flag
				has_country_flag = IBR_radio_dam_flag
				has_country_flag = IBR_east_lock_flag
				has_country_flag = IBR_west_lock_flag
				has_country_flag = IBR_dam_cameras_flag
				has_country_flag = IBR_dam_lights_flag
			}
		}

		fire_only_once = yes

		custom_cost_trigger = {always = yes }
		custom_cost_text = IBR_dam_1_millions


		ai_will_do = {
			factor = 1
		}

		days_remove = IBR_dam_time
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_complete_monument"
			subtract_from_variable = {
				var = IBR_dam_budget
				value = 1
			}
			clamp_variable = {
				var = IBR_dam_budget
				min = 0
				max = 2000
			}
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_complete_monument"
			add_to_variable = {
				var = IBR_dam_progress
				value = 1
			}
			custom_effect_tooltip = IBR_dam_monument_tt
			clr_country_flag = IBR_plant_attached_flag
			clr_country_flag = IBR_dam_train_flag
			clr_country_flag = IBR_radio_dam_flag
			clr_country_flag = IBR_east_lock_flag
			clr_country_flag = IBR_west_lock_flag
			clr_country_flag = IBR_dam_cameras_flag
			clr_country_flag = IBR_dam_lights_flag
			set_country_flag = IBR_finished_dam_flag

			if = {
				limit = { has_country_flag = IBR_Salazar_transition }

				hidden_effect = {
					country_event = {
						id = IBR.1004
						days = 1
					}
				}
			}
			else_if = {
				limit = { has_country_flag = IBRDemUnion }

				hidden_effect = {
					country_event = {
						id = IBR.1003
						days = 1
					}
				}
			}
			else = {
				hidden_effect = {
					country_event = {
						id = IBR.1002
						days = 1
					}
				}
			}
		}
	}
#########################################################################################################
	IBR_radio_tower_gibraltar = {

		icon = GFX_decision_generic_propaganda

		available = {
			check_variable = {
				var = IBR_dam_budget
				value = 3
				compare = greater_than_or_equals
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					check_variable = {
						var = IBR_dam_workers
						value = 0
						compare = less_than
					}
				}
			}
			has_country_flag = IBR_dam_admin_flag
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		fire_only_once = yes

		custom_cost_trigger = {always = yes }
		custom_cost_text = IBR_dam_3_millions


		ai_will_do = {
			factor = 1
		}

		days_remove = IBR_dam_time
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_radio_tower_gibraltar"
			subtract_from_variable = {
				var = IBR_dam_budget
				value = 3
			}
			clamp_variable = {
				var = IBR_dam_budget
				min = 0
				max = 2000
			}
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 0.9
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 0.9
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.1
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 1.1
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 1.1
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.1
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_upgrades
					value = 1.3
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 1.3
				}
			}
			add_manpower = -20
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_radio_tower_gibraltar"
			add_to_variable = {
				var = IBR_dam_progress
				value = 2
			}
			set_country_flag = IBR_radio_dam_flag
			custom_effect_tooltip = IBR_radio_tower_gib_tt
			add_manpower = 20
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 0.8
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 0.8
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 0.8
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 0.8
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_upgrades
					value = 0.6
				}
				subtract_from_variable = {
					var = IBR_dam_cost
					value = 0.6
				}
			}
		}
	}
#WORKERS
#########################################################################################################
	IBR_rise_salaries_gibraltar = {

		icon = GFX_decision_black_market_money

		available = {
			check_variable = {
				var = IBR_dam_budget
				value = 2
				compare = greater_than_or_equals
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					has_country_flag = IBR_finished_dam_flag
				}
			}
			has_country_flag = IBR_dam_admin_flag
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		fire_only_once = no

		days_re_enable = 365

		custom_cost_trigger = {always = yes }
		custom_cost_text = IBR_dam_2_millions


		ai_will_do = {
			factor = 1
		}

		days_remove = 30
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_rise_salaries_gibraltar"
			subtract_from_variable = {
				var = IBR_dam_budget
				value = 2
			}
			clamp_variable = {
				var = IBR_dam_budget
				min = 0
				max = 2000
			}
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_workers
					value = 2
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 2
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_workers
					value = 2
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 2
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_workers
					value = 2
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 2
				}
			}
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_rise_salaries_gibraltar"
			custom_effect_tooltip = IBR_salary_rise_gib_tt
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 1
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 1
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 1.2
				}
			}
		}
	}
	IBR_improve_security_gibraltar = {

		icon = GFX_decision_generic_construction

		available = {
			check_variable = {
				var = IBR_dam_budget
				value = 1
				compare = greater_than_or_equals
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					has_country_flag = IBR_finished_dam_flag
				}
			}
			has_country_flag = IBR_dam_admin_flag
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		fire_only_once = no

		days_re_enable = 210

		custom_cost_trigger = {always = yes }
		custom_cost_text = IBR_dam_1_millions


		ai_will_do = {
			factor = 1
		}

		days_remove = 30
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_improve_security_gibraltar"
			subtract_from_variable = {
				var = IBR_dam_budget
				value = 1
			}
			clamp_variable = {
				var = IBR_dam_budget
				min = 0
				max = 2000
			}
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_workers
					value = 1
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 1
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_workers
					value = 1
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 1
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_workers
					value = 1
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 1
				}
			}
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_improve_security_gibraltar"
			custom_effect_tooltip = IBR_improve_sec_gib_tt
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.5
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.5
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 0.8
				}
			}
		}
	}
	IBR_improve_quarters_gibraltar = {

		icon = GFX_decision_generic_construction

		available = {
			check_variable = {
				var = IBR_dam_budget
				value = 3
				compare = greater_than_or_equals
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					has_country_flag = IBR_finished_dam_flag
				}

			}
			has_country_flag = IBR_dam_admin_flag
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		fire_only_once = no

		days_re_enable = 720

		custom_cost_trigger = {always = yes }
		custom_cost_text = IBR_dam_3_millions


		ai_will_do = {
			factor = 1
		}

		days_remove = 150
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_improve_quarters_gibraltar"
			subtract_from_variable = {
				var = IBR_dam_budget
				value = 3
			}
			clamp_variable = {
				var = IBR_dam_budget
				min = 0
				max = 2000
			}
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_workers
					value = 3
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 3
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_workers
					value = 3
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 3
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				add_to_variable = {
					var = IBR_dam_cost_workers
					value = 3
				}
				add_to_variable = {
					var = IBR_dam_cost
					value = 3
				}
			}
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_improve_quarters_gibraltar"
			custom_effect_tooltip = IBR_improve_room_gib_tt
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 2
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 2
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 2.4
				}
			}
		}
	}
	IBR_allow_union_gibraltar = {

		icon = GFX_decision_generic_civil_support

		available = {
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		allowed = {
			tag = IBR

		}

		visible = {
			OR = {
				has_country_flag = IBR_abandoned_dam_flag
				has_country_flag = IBR_finished_dam_flag
			}
			has_country_flag = IBR_dam_admin_flag
			OR = {
				has_government = despotism
				has_government = conservatism
				has_government = liberalism
				has_government = paternalism
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		fire_only_once = yes

		custom_cost_trigger = {always = yes }

		ai_will_do = {
			factor = 1
		}

		days_remove = 210
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_allow_union_gibraltar"
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_allow_union_gibraltar"
			custom_effect_tooltip = IBR_allow_union_gib_tt
			TNO_improve_trade_unions_policy_effectiveness_med = yes
			add_political_power = -50
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 5
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 5
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				add_to_variable = {
					var = IBR_dam_workers
					value = 6
				}
			}
		}
	}
#############################################################################
	IBR_electrical_equipment_gibraltar = {

		icon = GFX_decision_generic_industry

		available = {
			check_variable = {
				var = IBR_dam_budget
				value = 1
				compare = greater_than_or_equals
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					has_country_flag = IBR_finished_dam_flag
				}

			}
			has_country_flag = IBR_dam_admin_flag
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		fire_only_once = no

		days_re_enable = 365

		custom_cost_trigger = {always = yes }
		custom_cost_text = IBR_dam_1_millions


		ai_will_do = {
			factor = 1
		}

		days_remove = 90
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_electrical_equipment_gibraltar"
			subtract_from_variable = {
				var = IBR_dam_budget
				value = 1
			}
			clamp_variable = {
				var = IBR_dam_budget
				min = 0
				max = 2000
			}
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_electrical_equipment_gibraltar"
			custom_effect_tooltip = IBR_elect_gib_tt
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_maintenance
					value = 1
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_maintenance
					value = 1.2
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_maintenance
					value = 1
				}
			}
		}
	}
	IBR_upgrade_cranes_gibraltar = {

		icon = GFX_decision_generic_construction

		available = {
			check_variable = {
				var = IBR_dam_budget
				value = 5
				compare = greater_than_or_equals
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					has_country_flag = IBR_finished_dam_flag
				}

			}
			has_country_flag = IBR_dam_admin_flag
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		fire_only_once = no

		days_re_enable = 2300

		custom_cost_trigger = {always = yes }
		custom_cost_text = IBR_dam_5_millions


		ai_will_do = {
			factor = 1
		}

		days_remove = 160
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_upgrade_cranes_gibraltar"
			subtract_from_variable = {
				var = IBR_dam_budget
				value = 5
			}
			clamp_variable = {
				var = IBR_dam_budget
				min = 0
				max = 2000
			}
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_upgrade_cranes_gibraltar"
			custom_effect_tooltip = IBR_upgrade_cranes_tt
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_maintenance
					value = 5
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_maintenance
					value = 5.4
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_maintenance
					value = 5
				}
			}
		}
	}
	IBR_hire_engineers_gibraltar = {

		icon = GFX_decision_generic_political_discourse

		available = {
			check_variable = {
				var = IBR_dam_budget
				value = 1.5
				compare = greater_than_or_equals
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					has_country_flag = IBR_finished_dam_flag
				}

			}
			has_country_flag = IBR_dam_admin_flag
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		fire_only_once = no

		days_re_enable = 720

		custom_cost_trigger = {always = yes }
		custom_cost_text = IBR_dam_1_5_millions


		ai_will_do = {
			factor = 1
		}

		days_remove = 90
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_hire_engineers_gibraltar"
			subtract_from_variable = {
				var = IBR_dam_budget
				value = 1.5
			}
			clamp_variable = {
				var = IBR_dam_budget
				min = 0
				max = 2000
			}
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_hire_engineers_gibraltar"
			custom_effect_tooltip = IBR_hire_engineers_gib_tt
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_maintenance
					value = 1.5
				}
				add_to_variable = {
					var = IBR_dam_cost_workers
					value = 1.5
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.3
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_maintenance
					value = 1.9
				}
				add_to_variable = {
					var = IBR_dam_cost_workers
					value = 1.5
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.3
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_maintenance
					value = 1.5
				}
				add_to_variable = {
					var = IBR_dam_cost_workers
					value = 1.5
				}
				subtract_from_variable = {
					var = IBR_dam_workers
					value = 0.5
				}
			}
		}
	}
	IBR_reinforce_scaffolding_gibraltar = {

		icon = GFX_decision_generic_construction
		available = {
			check_variable = {
				var = IBR_dam_budget
				value = 1.5
				compare = greater_than_or_equals
			}
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		allowed = {
			tag = IBR

		}

		visible = {
			NOT = {
				OR = {
					has_country_flag = IBR_abandoned_dam_flag
					has_country_flag = IBR_finished_dam_flag
				}
			}
			has_country_flag = IBR_dam_admin_flag
			NOT = {
				has_global_flag = Iberian_Wars
			}
		}

		fire_only_once = no

		days_re_enable = 1000

		custom_cost_trigger = {always = yes }
		custom_cost_text = IBR_dam_1_5_millions


		ai_will_do = {
			factor = 1
		}

		days_remove = 90
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision IBR_reinforce_scaffolding_gibraltar"
			subtract_from_variable = {
				var = IBR_dam_budget
				value = 1.5
			}
			clamp_variable = {
				var = IBR_dam_budget
				min = 0
				max = 2000
			}
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove IBR_reinforce_scaffolding_gibraltar"
			custom_effect_tooltip = IBR_scaff_gib_tt
			if = {
				limit = {
					has_country_flag = IBR_manuel_elices_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_maintenance
					value = 1.5
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_leopoldo_sotelo_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_maintenance
					value = 1.7
				}
			}
			if = {
				limit = {
					has_country_flag = IBR_rui_sanches_dam
				}
				subtract_from_variable = {
					var = IBR_dam_cost_maintenance
					value = 1.5
				}
			}
			clr_country_flag = IBR_gib_scaffolds_unsafe
		}
	}
}