# Crown World (ap_crown_world)
# One planet per empire holds the title (carrier flag apb_crown_world).
# Effects: common/scripted_effects/apb_crown_world_effects.txt

# First naming, or naming again after the old Crown World was lost. Free.
decision_apb_name_crown_world = {
	owned_planets_only = yes
	icon = decision_politics

	potential = {
		exists = owner
		is_colony = yes
		owner = {
			has_ascension_perk = ap_crown_world
			NOT = {
				any_owned_planet = {
					has_carrier_flag = apb_crown_world
				}
			}
		}
	}

	effect = {
		custom_tooltip = decision_apb_name_crown_world_effect
		hidden_effect = {
			apb_crown_name_world = yes
		}
	}

	# The AI only ever names its capital.
	ai_weight = {
		weight = 100
		modifier = {
			factor = 0
			is_capital = no
		}
	}
}

# Move the title from the current Crown World to this planet.
decision_apb_move_crown_world = {
	owned_planets_only = yes
	icon = decision_politics

	resources = {
		category = decisions
		cost = {
			influence = 150
		}
	}

	potential = {
		exists = owner
		is_colony = yes
		NOT = { has_carrier_flag = apb_crown_world }
		owner = {
			has_ascension_perk = ap_crown_world
			any_owned_planet = {
				has_carrier_flag = apb_crown_world
			}
		}
	}

	allow = {
		custom_tooltip = {
			fail_text = decision_apb_move_crown_world_cooldown
			owner = {
				NOT = { has_country_flag = apb_crown_move_cooldown }
			}
		}
	}

	effect = {
		custom_tooltip = decision_apb_move_crown_world_effect
		hidden_effect = {
			owner = {
				every_owned_planet = {
					limit = { has_carrier_flag = apb_crown_world }
					apb_crown_strip_world = yes
				}
				set_timed_country_flag = {
					flag = apb_crown_move_cooldown
					days = 3600
				}
			}
			apb_crown_name_world = yes
		}
	}

	ai_weight = {
		weight = 0
	}
}
