# Build the war college: occupies 5 civs for 90 days via the
# wc_under_construction_modifier (civilian_factory_use = 5). The outer
# guard refuses to fire if construction is already running OR the
# country doesn't have 5 free civs. The same checks live in the build
# button's click_enabled trigger so the button greys out at the same
# threshold; this is belt-and-suspenders.
wc_build_college_effect = {
	if = {
		limit = {
			NOT = { check_variable = { wc_built = 1 } }
			NOT = { check_variable = { wc_construction_active = 1 } }
			num_of_civilian_factories_available_for_projects > 4
		}
		set_variable = { wc_construction_active = 1 }
		set_variable = { wc_construction_days_remaining = 90 }
		# Init the progress-bar x offset at "fully clipped" so the bar
		# starts empty before the first on_daily recomputation.
		set_variable = { wc_construction_bar_x = -377 }
		add_timed_idea = {
			idea = wc_under_construction 
			days = 90
		}
	}
}

wc_complete_construction_effect = {
	set_variable = { wc_built = 1 }
	set_variable = { wc_construction_active = 0 }
	set_variable = { wc_construction_days_remaining = 0 }

	# Seed the academy tier/upgrade variables so the academy tab is
	# usable the moment construction finishes (without this, tier vars
	# would be 0 and the row labels would render as "T0").
	wc_academy_init_defaults_effect = yes
}
