﻿
##################################################
# Found New Hegemony
# by Aka
##################################################

found_hegemony_decision = {
    picture = {
        reference = "gfx/interface/illustrations/decisions/decision_dynasty_house.dds"
    }	decision_group_type = major
	ai_check_interval_by_tier = {
		barony = 0
		county = 0
		duchy = 0
		kingdom = 0
		empire = 60
		hegemony = 0
	}
	desc = found_hegemony_decision_desc

	is_shown = {
		highest_held_title_tier = tier_empire
		OR = {
			top_liege = this
			any_held_title = {
				count >= 3
				title_tier = empire
			}
		}
		NOT = {
			has_game_rule = off_custom_kingdoms
		}
		is_landed_or_landless_administrative = yes
		is_confederation_member = no
	}																	
	is_valid = {
		prestige_level >= 5
		trigger_if = {
			limit = {
				government_has_flag = government_is_nomadic
			}
			OR = {
				sub_realm_size >= 60
				AND = {
					custom_description = {
						text = found_hegemony_decision_three_empires_held
						any_held_title = {
							count >= 3
							title_tier = empire
						}
					}
					sub_realm_size >= 80
				}
			}
		}
		trigger_else = {
			OR = {
				sub_realm_size >= 180
				AND = {
					custom_description = {
						text = found_hegemony_decision_three_empires_held
						any_held_title = {
							count >= 3
							title_tier = empire
						}
					}
					sub_realm_size >= 120
				}
			}
		}

		trigger_if = {
			limit = {
				government_has_flag = government_is_nomadic
			}
			OR = {
				has_realm_law = nomadic_authority_5
				has_realm_law = nomadic_authority_4
			}
		}


		rule_title_creation_imperial_power_projection_title_creation_trigger = yes
	}

	is_valid_showing_failures_only = {
		top_liege = this
		is_available_adult = yes
		is_at_war = no
	}

	cost = {
		gold = {
			value = 2000
			if = {
				limit = {
					OR = {
						government_has_flag = government_is_nomadic
						has_treasury = yes
					}
				}
				multiply = 0
			}
		}
		treasury = {
			value = 2000
			if = {
				limit = {
					has_treasury = no
				}
				multiply = 0
			}
		}
		prestige = 3000
		piety = {
			value = 800
			if = {
				limit = {
					government_has_flag = government_is_nomadic
				}
				multiply = 0
			}
		}
	}

	effect = {
		if = {
			limit = {
				NOT = { government_has_flag = government_is_nomadic }
			}
			create_custom_hegemony_effect = yes
			gain_heroic_legend_seed_tooltip_effect = yes
			hidden_effect = {
				legend_seed_new_title_effect = yes
			}
		}
		else = {
			create_custom_hegemony_effect = yes
		}
		if = {
			limit = {
				is_ai = no
				NOT = { exists = global_var:found_hegemony_decision  }
			}
			set_global_variable = {
				name = found_hegemony_decision
				value = root
			}
			set_global_variable = {
				name = found_hegemony_decision_hegemony
				value = root.primary_title
			}
		}
	}

	ai_potential = {
		always = yes
	}

	ai_will_do = {
		base = 100
	}
}











