﻿##Pax Mongolica
### Peace of the Great Khan ###
mpo_pax_mongolica_decision = {
	picture = {
		reference = "gfx/interface/illustrations/event_scenes/mpo_city_steppe.dds"
	}
	decision_group_type = nomad_major
	sort_order = 120

	is_shown = {
		government_has_flag = government_is_nomadic
		exists = situation:the_great_steppe
		any_character_situation = {
			this = situation:the_great_steppe
		}
		NOT = { has_variable = pax_mongolica_var }
	}

	is_valid = {
		dynasty ?= { has_dynasty_perk = mpo_nomad_legacy_5 }
		OR = {
			has_realm_law = nomadic_authority_4
			has_realm_law = nomadic_authority_5
		}
	}

	is_valid_showing_failures_only = {
		is_available_adult = yes
	}

	cost = {
		gold = {
			value = 0
			if = {
				limit = {
					has_treasury = no
				}
				add = monumental_gold_value
			}
		}
		treasury = {
			value = 0
			if = {
				limit = {
					has_treasury = yes
				}
				add = monumental_gold_value
			}
		}
		prestige = {
			value = massive_prestige_value
		}
	}


	effect = {
		set_variable = pax_mongolica_var
		# Rewards given out in the event
		show_as_tooltip = {
			add_character_modifier = {
				modifier = pax_mongolica_ruler_modifier # Forever
			}
			custom_tooltip = pax_mongolica_every_county_in_steppe_tt
			every_realm_county = {
				limit = {
					is_landless_type_title = no
					any_county_situation = { this = situation:the_great_steppe }
					holder.dynasty = root.dynasty
				}
				random_county_province = {
					limit = { has_holding = no }
					set_holding_type = city_holding
				}
			}
			if = {
				limit = {
					NOT = {
						culture = { has_innovation = innovation_city_planning }
					}
				}
				culture = { add_innovation = innovation_city_planning }
			}
			else_if = {
				limit = {
					NOT = {
						culture = { has_innovation = innovation_development_01 }
					}
				}
				culture = { add_innovation = innovation_development_01 }
			}
			else = {
				culture = { add_random_innovation = culture_group_civic }
			}
		}
		trigger_event = mpo_decisions_events.0400
	}

	ai_check_interval_by_tier = {
		barony = 0
		county = 0
		duchy = 0
		kingdom = 0
		empire = 24
		hegemony = 24
	}

	ai_potential = {
		prestige >= massive_prestige_value
	}

	ai_will_do = {
		base = 30
		modifier = {
			add = -100
			NOT = {
				prestige >= {
					value = monumental_gold_value
					multiply = 2
				}
			}
		}
		modifier = {
			add = -100
			NOT = {
				prestige >= {
					value = massive_prestige_value
					multiply = 2
				}
			}
		}
		modifier = {
			add = 50
			highest_held_title_tier >= tier_empire
		}
	}
}
