﻿enforce_pecheneg_rule_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/fp3/fp3_decision_strength.dds"
	}
	decision_group_type = major
	ai_check_interval = 36
	desc = enforce_pecheneg_rule_decision_desc

	is_shown = {
		has_title = title:k_pechenegs
		has_culture = culture:pecheneg
		NOT = {
			is_target_in_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:unite_the_people_decision
			}
		}
	}
	
	is_valid = {
		completely_controls = title:k_dacia
		completely_controls = title:k_moldavia
		completely_controls = title:d_dobrudja
		faith = faith:orthodox
		martial >= 15
		culture = {
			cultural_acceptance = {
				target = culture:vlach
				value >= 40
			}
		}
	}
	
	is_valid_showing_failures_only = {
		is_imprisoned = no
		is_available_adult = yes
		is_at_war = no
	}
	
	effect = {
	root = {
		save_scope_as = founder
		}
		add_to_global_variable_list = {
			name = unavailable_unique_decisions
			target = flag:unite_the_people_decision
		}
		root.dynasty = {
		add_dynasty_prestige = 2000
	}
	
	add_trait = diplomat
	
	set_nickname_effect = { NICKNAME = nick_the_magnificent }
	
	destroy_title = title:k_dacia
	destroy_title = title:k_moldavia
	
	custom_tooltip = {
		text = absorb_vlachs_effect
		title:d_transylvanian_alps = { set_de_jure_liege_title = title:k_pechenegs }
		title:d_muntenia = { set_de_jure_liege_title = title:k_pechenegs }
		title:d_oltenia = { set_de_jure_liege_title = title:k_pechenegs }
		title:d_bukovina = { set_de_jure_liege_title = title:k_pechenegs }
		title:d_moldova = { set_de_jure_liege_title = title:k_pechenegs }
		title:d_bugeac = { set_de_jure_liege_title = title:k_pechenegs }
		title:d_dobrudja = { set_de_jure_liege_title = title:k_pechenegs}
	}
	
	if = {
		limit = {
			has_education_martial_trigger = yes
			NOT = {
				has_trait = education_martial_5
				}
			}
			remove_trait = education_martial_1
			remove_trait = education_martial_2
			remove_trait = education_martial_3
			remove_trait = education_martial_4
			custom_tooltip = {
				text = gain_5th_lvl_education_martial_tt
				add_trait = education_martial_5
			}
		
		}
		trigger_event = enforce_pecheneg_rule_decision.001		
	}
	
	cost = {
		gold = 500
		prestige = {
			value = {
				add = 0
				if = {
					limit = {
						government_has_flag = government_is_tribal
					}
					add = medium_prestige_value
				}
			}
		}
		herd = {
			value = {
				add = 0
				if = {
					limit = {
						government_has_flag = government_is_nomadic
					}
					add = medium_herd_value_static
				}
			}
		}
	}
	
	ai_will_do = {
		base = 100
	}
	ai_potential = {
        always = yes
	}
}