﻿
### Feudalization

#A decision to feudalize the entire realm (wow!)
convert_whole_realm_to_feudalism_decision = { #by Linnéa Thimrén
	picture = "gfx/interface/illustrations/decisions/decision_realm.dds"
	major = yes
	desc = convert_whole_realm_to_feudalism_decision_desc

	ai_check_interval = 36

	is_shown = {
		has_government = tribal_government
		OR = {
			is_independent_ruler = yes
			AND = {
				is_independent_ruler = no
				liege = {
					NOR = {
						has_government = feudal_government
						has_government = clan_government
					}
				}
			}
		}
	}

	is_valid = {
		has_realm_law = tribal_authority_3
		prestige_level >= 3 ## Was 2
		capital_province.county = {
			development_level >= convert_to_feudalism_development_requirement
		}
		OR = { ### Either year at least 1000 and of reformed faith, or all tribal innovations researched.
			AND = {
				custom_description = {
					text = faith_is_reformed
					subject = root
					faith = { NOT = { has_doctrine_parameter = unreformed } }
				}
				custom_description = {
					text = sane_year_1000
					current_date > 1000.1.1
				}
			}
			custom_description = { #You need to have ALL (non-regional/unique) tribal innovations!
			text = has_all_tribal_innovations
			subject = root.culture
				culture = {
					has_innovation = innovation_motte
					has_innovation = innovation_catapult
					has_innovation = innovation_barracks
					has_innovation = innovation_mustering_grounds
					has_innovation = innovation_bannus
					has_innovation = innovation_quilted_armor
					has_innovation = innovation_gavelkind
					has_innovation = innovation_crop_rotation
					has_innovation = innovation_city_planning
					has_innovation = innovation_casus_belli
					has_innovation = innovation_plenary_assemblies
					has_innovation = innovation_ledger
				}
			}
		}	
	}

	cost = {
		prestige = 200
	}

	effect = {
		trigger_event = major_decisions.0001
		save_scope_as = actor
		convert_whole_realm_to_feudalism_effect = yes
		hidden_effect = {
			every_vassal = {
				trigger_event = {
					id = major_decisions.0002
					days = 3
				}
			}
		}
	}

	ai_potential = {
		NOT = { has_title = title:e_mongol_empire } #Stop the Mongols from slowing their conquest.
	}

	ai_will_do = {
		base = 100
	}
}