# Ascension Perks Broadened - The Open Charter (ap_open_charter)
# Documentation: vanilla common/zones/99_HOW_TO_ZONE.txt
# Built from vanilla zone_urban (common/zones/00_zones.txt).
#
# - Appears in any slot that accepts the "urban" or "habitat_urban" zone sets: the city district's
#   slot_city_01/02 (also on hive, machine, arcology-capable, ring world and shattered ring planets),
#   the megacity architects' slot_*_urban slots, nomad arkship city slots (slot_ark_city_01/02
#   include "urban") and habitat slots.
# - Takes any building (no excluded sets), up to two zones per planet, 3 building slots each
#   (UIOD shows at most 3 building slots in a secondary zone, so 6 in one zone did not work).
# - districts_per_building = 0.5: each district of the host district unlocks two slots, so the
#   3 slots open with 2 districts.
# - If the owner loses the perk (or the planet changes hands), potential fails and the zone
#   converts to zone_urban.

zone_apb_open_charter = {
	icon = GFX_district_specialization_urban
	base_buildtime = @zone_buildtime

	potential = { # planet scope
		hidden_trigger = {
			owner? = {
				has_ascension_perk = ap_open_charter
				is_wilderness_empire = no
			}
		}
	}

	unlock = { # planet scope
		hidden_trigger = {
			owner? = {
				has_ascension_perk = ap_open_charter
				is_wilderness_empire = no
			}
		}
	}

	convert_to = {
		zone_urban
	}

	resources = {
		category = planet_zones
		inline_script = {
			script = buildings/nomadic_cost_switcher
			REGULAR_RESOURCE = minerals
			NOMADIC_RESOURCE = alloys
			COST = @zone_cost
			NOMADIC_COST_MULT = 0.5
		}
	}

	max_buildings = 3
	districts_per_building = 0.5

	planet_limit = {
		base = 2
	}

	zone_sets = {
		urban
		habitat_urban
	}

	included_buildings = {
		all
	}

	planet_modifier = {
		zone_building_slots_add = 3
	}

	ai_priority = 1
	ai_weight_coefficient = 0.1
}
