# Hot-Swap Augments: three loadouts, one at a time.
# Everything a frame gives sits in the edict's own triggered modifiers, so it all
# ends the moment the edict is switched off:
#   1. the frame itself, off while the timed flag apb_augment_recal (180 days) is set
#   2. Worn In (half the bonus again, drawback cancelled), on while the flag
#      apb_augment_worn_<frame> is set (apb_augments.2, 3600 days after fitting)
#   3. a text-only line shown while Recalibrating
# Fitting a frame also starts a 720-day lock on all three (apb_augment_lock).
# The lock check lets the running edict through, so it can never grey out or
# cancel the frame that set it.
# Players only: AI empires are handled by apb_augments.4.

apb_augments_labour = {
	length = -1
	icon = "GFX_edict_type_policy"

	resources = {
		category = edicts
	}

	triggered_country_modifier = {
		potential = {
			NOT = { has_country_flag = apb_augment_recal }
		}
		planet_jobs_worker_produces_mult = 0.15
		planet_jobs_specialist_produces_mult = 0.05
		army_damage_mult = -0.20
	}

	triggered_country_modifier = {
		potential = {
			has_country_flag = apb_augment_worn_labour
		}
		planet_jobs_worker_produces_mult = 0.075
		planet_jobs_specialist_produces_mult = 0.025
		army_damage_mult = 0.20
	}

	triggered_country_modifier = {
		potential = {
			has_country_flag = apb_augment_recal
		}
		custom_tooltip = apb_augments_recalibrating_tt
	}

	potential = {
		has_ascension_perk = ap_hot_swap_augments
		is_ai = no
	}

	allow = {
		custom_tooltip = {
			fail_text = apb_augments_other_frame
			NOR = {
				has_edict = apb_augments_combat
				has_edict = apb_augments_research
			}
		}
		custom_tooltip = {
			fail_text = apb_augments_locked
			OR = {
				has_edict = apb_augments_labour
				NOT = { has_country_flag = apb_augment_lock }
			}
		}
	}

	effect = {
		custom_tooltip = apb_augments_fit_tt
		hidden_effect = {
			apb_augments_fit_frame = yes
		}
	}

	ai_weight = {
		weight = 0
	}
}

apb_augments_combat = {
	length = -1
	icon = "GFX_edict_type_policy"

	resources = {
		category = edicts
	}

	triggered_country_modifier = {
		potential = {
			NOT = { has_country_flag = apb_augment_recal }
		}
		army_damage_mult = 0.50
		army_health = 0.25
		ship_fire_rate_mult = 0.10
		planet_jobs_produces_mult = -0.05
	}

	triggered_country_modifier = {
		potential = {
			has_country_flag = apb_augment_worn_combat
		}
		army_damage_mult = 0.25
		army_health = 0.125
		ship_fire_rate_mult = 0.05
		planet_jobs_produces_mult = 0.05
	}

	triggered_country_modifier = {
		potential = {
			has_country_flag = apb_augment_recal
		}
		custom_tooltip = apb_augments_recalibrating_tt
	}

	potential = {
		has_ascension_perk = ap_hot_swap_augments
		is_ai = no
	}

	allow = {
		custom_tooltip = {
			fail_text = apb_augments_other_frame
			NOR = {
				has_edict = apb_augments_labour
				has_edict = apb_augments_research
			}
		}
		custom_tooltip = {
			fail_text = apb_augments_locked
			OR = {
				has_edict = apb_augments_combat
				NOT = { has_country_flag = apb_augment_lock }
			}
		}
	}

	effect = {
		custom_tooltip = apb_augments_fit_tt
		hidden_effect = {
			apb_augments_fit_frame = yes
		}
	}

	ai_weight = {
		weight = 0
	}
}

apb_augments_research = {
	length = -1
	icon = "GFX_edict_type_policy"

	resources = {
		category = edicts
	}

	triggered_country_modifier = {
		potential = {
			NOT = { has_country_flag = apb_augment_recal }
		}
		all_technology_research_speed = 0.10
		species_leader_exp_gain = 0.15
		pop_amenities_usage_mult = 0.10
	}

	triggered_country_modifier = {
		potential = {
			has_country_flag = apb_augment_worn_research
		}
		all_technology_research_speed = 0.05
		species_leader_exp_gain = 0.075
		pop_amenities_usage_mult = -0.10
	}

	triggered_country_modifier = {
		potential = {
			has_country_flag = apb_augment_recal
		}
		custom_tooltip = apb_augments_recalibrating_tt
	}

	potential = {
		has_ascension_perk = ap_hot_swap_augments
		is_ai = no
	}

	allow = {
		custom_tooltip = {
			fail_text = apb_augments_other_frame
			NOR = {
				has_edict = apb_augments_labour
				has_edict = apb_augments_combat
			}
		}
		custom_tooltip = {
			fail_text = apb_augments_locked
			OR = {
				has_edict = apb_augments_research
				NOT = { has_country_flag = apb_augment_lock }
			}
		}
	}

	effect = {
		custom_tooltip = apb_augments_fit_tt
		hidden_effect = {
			apb_augments_fit_frame = yes
		}
	}

	ai_weight = {
		weight = 0
	}
}
