create_codex_cumanicus_decision = {

	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_misc.dds"
	}
	decision_group_type = major
	
	desc = create_codex_cumanicus_decision_desc
	ai_check_interval = 36
	
	is_shown = {
		has_culture = culture:cuman
		highest_held_title_tier = 5
		NOT = {
			is_target_in_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:codex_cumanicus
			}
		}
	}
	

	is_valid = {
		culture ?= {
            has_innovation = innovation_ledger
        }
		prestige_level >= 5
		learning >= 10
		employs_court_position = chronicler_court_position
	}
	
	cost = {
		gold = 300
		prestige = 300
	}
	
	effect = {
	
		save_scope_as = codex_cumanicus_maker
		
		create_artifact = {
			name = "Codex Cumanicus"
			description = "This book contains the language of the cumans and is a means by which Cumans and settled people can learn to communicate with one another."
			type = book
			visuals = book
			rarity = illustrious
			template = general_unique_template
			modifier = artifact_court_grandeur_baseline_add_5_modifier
			modifier = artifact_learn_language_scheme_phase_duration_add_4_modifier
			modifier = artifact_learn_language_scheme_phase_duration_add_4_modifier
			modifier = artifact_learn_language_scheme_phase_duration_add_4_modifier
			modifier = artifact_learn_language_scheme_phase_duration_add_4_modifier
			modifier = artifact_vassal_limit_5_modifier
			modifier = artifact_vassal_limit_5_modifier
			modifier = artifact_monthly_dynasty_prestige_4_modifier
			modifier = artifact_stewardship_3_modifier
		}
		root.dynasty = {
			add_dynasty_prestige = 500
		}
		
		hidden_effect = {
			add_to_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:codex_cumanicus
			}
			set_global_variable = {
				name = codex_cumanicus
				value = scope:codex_cumanicus_maker
			}
		}

	}
	ai_will_do = {
		base = 100
	}
	ai_potential = {
        always = yes
	}
	
}