###########################
# Forked Minds (ap_forked_minds)
###########################
namespace = apb_forked

# Choose which class to fork. Fired by the edict apb_fork_instance.
# Only classes with an eligible leader (apb_can_be_forked) are offered; the edict's allow needs at least one.
country_event = {
	id = apb_forked.1
	title = apb_forked.1.name
	desc = apb_forked.1.desc
	picture = GFX_evt_glitchy_matrix
	show_sound = event_laboratory_sound
	is_triggered_only = yes

	option = {
		name = apb_forked.1.scientist
		trigger = {
			any_owned_leader = {
				leader_class = scientist
				apb_can_be_forked = yes
			}
		}
		apb_forked_clone_best = { CLASS = scientist }
	}
	option = {
		name = apb_forked.1.commander
		trigger = {
			any_owned_leader = {
				leader_class = commander
				apb_can_be_forked = yes
			}
		}
		apb_forked_clone_best = { CLASS = commander }
	}
	option = {
		name = apb_forked.1.official
		trigger = {
			any_owned_leader = {
				leader_class = official
				apb_can_be_forked = yes
			}
		}
		apb_forked_clone_best = { CLASS = official }
	}

	# Fallback: the leader was lost before the choice. Refund and reset the cooldown.
	option = {
		name = apb_forked.1.none
		trigger = {
			NOT = {
				any_owned_leader = {
					OR = {
						leader_class = scientist
						leader_class = commander
						leader_class = official
					}
					apb_can_be_forked = yes
				}
			}
		}
		add_resource = { influence = 100 }
		hidden_effect = {
			remove_country_flag = apb_fork_cooldown
		}
	}
}
