﻿###DECISIONS LIST###

##
# Found a Viet Empire
# Found the Majapahit Empire
# Found a Ryukyu Empire
# Found the Siam Kingdom
# Found the Establish the Darussalam
# Found the Found the Empire of Brunei
##

##################################################
# Found a Viet Empire
# by Ali Kara
##################################################
### Found the Viet Empire ###
form_dai_viet_empire_decision = {
	picture = {
		reference = "gfx/interface/illustrations/event_story/tgp_dynastic_cycle_stability.dds"
	}
	desc = form_dai_viet_empire_decision_desc
	selection_tooltip = form_dai_viet_empire_decision_tooltip
	decision_group_type = major
	sort_order = 120

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

	is_shown = {
		culture ?= { has_cultural_pillar = heritage_viet }
		is_playable_character = yes
		NOT = {  #Can only do it once.
			is_target_in_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:flag_created_dai_viet_empire
			}
		}
		capital_province ?= { geographical_region = custom_viet_lands }
		highest_held_title_tier <= tier_kingdom
	}

	is_valid = {
		top_liege = this
		highest_held_title_tier = tier_kingdom
		has_title = title:k_viet
		has_title = title:k_champa
		rule_title_creation_imperial_power_projection_title_creation_trigger = yes
	}

	is_valid_showing_failures_only = {
		is_landed = yes
		is_available_adult = yes
	}

	cost = {
		prestige = 2000
	}

	effect = {
		if = {
			limit = {
				is_ai = no
			}
			add_achievement_global_variable_effect = {
				VARIABLE = achieved_ep4_14_daits_how_you_do_it_achievement
				VALUE = yes
			}
		}
		show_as_tooltip = {
			form_dai_viet_empire_decision_scripted_effect = yes
		}
		save_scope_as = founder
		trigger_event = {
			id = major_decisions.4000
		}
		every_player = {
			limit = {
				this != root
				is_within_diplo_range = { CHARACTER = root }
			}
			trigger_event = {
				id = major_decisions.4001
			}
		}
		hidden_effect = {
			add_to_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:flag_created_dai_viet_empire
			}
			set_global_variable = {
				name = flag_created_dai_viet_empire
				value = scope:founder
			}
		}
	}

	ai_will_do = {
		base = 100
	}
}

##################################################
# Found the Majapahit Empire
# by Ali Kara
##################################################
### Found the Majapahit Empire ###
form_majapahit_empire_decision = {
	picture = {
		reference = "gfx/interface/illustrations/event_scenes/tgp_asia_throne_room.dds"
	}
	desc = form_majapahit_empire_decision_desc
	selection_tooltip = form_majapahit_empire_decision_tooltip
	decision_group_type = major
	sort_order = 120

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

	is_shown = {
		is_playable_character = yes
		culture ?= {
			OR = {
				this = culture:javanese
				any_parent_culture_or_above = { this = culture:javanese }
			}
		}
		NOT = {  #Can only do it once.
			is_target_in_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:flag_created_majapahit_empire
			}
		}
		highest_held_title_tier <= tier_kingdom
	}

	is_valid = {
		top_liege = this
		highest_held_title_tier = tier_kingdom
		faith.religion = {
			is_in_family = rf_eastern
		}
		custom_tooltip = {
			text = form_majapahit_empire_decision_requirement_1_tt
			title:d_SUM_palembang = {
				this = { is_title_created = yes }
				holder = {
					OR = {
						is_vassal_or_below_of = ROOT
						is_tributary_of = ROOT
						this = ROOT
					}
				}
			}
		}
		custom_tooltip = {
			text = form_majapahit_empire_decision_requirement_2_tt
			title:d_JAV_taruma = {
				this = { is_title_created = yes }
				holder = {
					OR = {
						is_vassal_or_below_of = ROOT
						is_tributary_of = ROOT
						this = ROOT
					}
				}
			}
		}
		custom_tooltip = {
			text = form_majapahit_empire_decision_requirement_3_tt
			title:d_JAV_mataram = {
				this = { is_title_created = yes }
				holder = {
					OR = {
						is_vassal_or_below_of = ROOT
						is_tributary_of = ROOT
						this = ROOT
					}
				}
			}
		}
		custom_tooltip = {
			text = form_majapahit_empire_decision_requirement_4_tt
			title:c_JAV_madura = {
				this = { is_title_created = yes }
				holder = {
					OR = {
						is_vassal_or_below_of = ROOT
						is_tributary_of = ROOT
						this = ROOT
					}
				}
			}
		}
		has_title = title:k_yavakadvipa
		rule_title_creation_imperial_power_projection_title_creation_trigger = yes
	}

	is_valid_showing_failures_only = {
		is_landed = yes
		is_available_adult = yes
	}

	cost = {
		prestige = 1500
		piety = 1000
	}

	effect = {
		show_as_tooltip = {
			form_majapahit_empire_decision_scripted_effect = yes
		}
		save_scope_as = founder
		trigger_event = {
			id = major_decisions.5000
		}
		every_player = {
			limit = {
				this != root
				is_within_diplo_range = { CHARACTER = root }
			}
			trigger_event = {
				id = major_decisions.5001
			}
		}
		hidden_effect = {
			add_to_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:flag_created_majapahit_empire
			}
			set_global_variable = {
				name = flag_created_majapahit_empire
				value = scope:founder
			}
		}
	}

	ai_potential = {
		always = yes
	}

	ai_will_do = {
		base = 100
	}
}

##################################################
# Found a Ryukyu Empire
# by Ali Kara
##################################################
### Found a Ryukyuan Empire ###
form_ryukyu_empire_decision = {
	picture = {
		reference = "gfx/interface/illustrations/holding_types/tgp_shinto_temple.dds"
	}
	desc = form_ryukyu_empire_decision_desc
	selection_tooltip = form_ryukyu_empire_decision_tooltip
	decision_group_type = major
	sort_order = 120

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

	is_shown = {
		culture ?= culture:ryukyuan # Only Ryukyuan, to prevent other people hybridizing with Ryukyuan for the meme
		is_playable_character = yes
		NOT = {  #Can only do it once.
			is_target_in_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:flag_created_ryukyu_empire
			}
		}
		capital_province ?= { geographical_region = custom_ryukyu }
		highest_held_title_tier <= tier_kingdom
	}

	is_valid = {
		top_liege = this
		highest_held_title_tier = tier_kingdom
		has_title = title:c_amami
		has_title = title:c_ucinaa
		has_title = title:d_ruucuu
		has_title = title:k_ruucuu
		sub_realm_size >= 60
		rule_title_creation_imperial_power_projection_title_creation_trigger = yes
	}

	is_valid_showing_failures_only = {
		is_landed = yes
		is_available_adult = yes
	}

	cost = {
		prestige = 2300
		piety = 250
		gold = 750
	}

	effect = {
		show_as_tooltip = {
			form_ryukyu_empire_decision_scripted_effect = yes
		}
		save_scope_as = founder
		trigger_event = {
			id = major_decisions.6000
		}
		every_player = {
			limit = {
				this != root
				is_within_diplo_range = { CHARACTER = root }
			}
			trigger_event = {
				id = major_decisions.6003
			}
		}
		hidden_effect = {
			add_to_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:flag_created_ryukyu_empire
			}
			set_global_variable = {
				name = flag_created_ryukyu_empire
				value = scope:founder
			}
		}
	}

	ai_potential = {
		always = yes
	}

	ai_will_do = {
		base = 100
	}
}

##################################################
# Found the Siam Kingdom
# by Ali Kara
##################################################
### Found the Siam Kingdom ###
form_siam_kingdom_decision = {
	picture = {
		reference = "gfx/interface/illustrations/activity_splash_screens/tour_arrival_asia_welcome.dds"
	}
	desc = form_siam_kingdom_decision_desc
	selection_tooltip = form_siam_kingdom_decision_tooltip
	decision_group_type = major
	sort_order = 110

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

	is_shown = {
		culture ?= { has_cultural_pillar = heritage_tai }
		is_playable_character = yes
		capital_province ?= {
			OR = {
				geographical_region = world_asia_thailand
				geographical_region = world_asia_malaysia
			}
		}
		NOT = {  #Can only do it once.
			is_target_in_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:flag_created_siam_kingdom
			}
		}
		highest_held_title_tier <= tier_duchy
	}

	is_valid = {
		top_liege = this
		highest_held_title_tier = tier_duchy
		has_title = title:d_sukhothai
		culture = { has_cultural_pillar = heritage_tai } # just to inform the player
		custom_tooltip = {
			text = form_siam_kingdom_decision_requirement_1_tt
			title:d_lop_buri = {
				this = { is_title_created = yes }
				holder = {
					OR = {
						is_vassal_or_below_of = ROOT
						this = ROOT
					}
				}
			}
		}
		completely_controls = title:d_sukhothai
		completely_controls = title:d_lop_buri
	}

	is_valid_showing_failures_only = {
		is_landed = yes
		is_available_adult = yes
	}

	cost = {
		gold = 350
		prestige = 1000
		piety = 100
	}

	effect = {
		show_as_tooltip = {
			form_siam_kingdom_decision_scripted_effect = yes
		}
		save_scope_as = founder
		trigger_event = {
			id = major_decisions.7000
		}
		every_player = {
			limit = {
				this != root
				is_within_diplo_range = { CHARACTER = root }
			}
			trigger_event = {
				id = major_decisions.7001
			}
		}
		hidden_effect = {
			add_to_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:flag_created_siam_kingdom
			}
			set_global_variable = {
				name = flag_created_siam_kingdom
				value = scope:founder
			}
		}
	}

	ai_potential = {
		always = yes
	}

	ai_will_do = {
		base = 100
	}
}

##################################################
# Found the Brunei Kingdom
# by Ali Kara
##################################################
form_brunei_kingdom_decision = {
	picture = {
		reference = "gfx/interface/illustrations/activity_splash_screens/tour_arrival_mena_welcome.dds"
	}
	desc = form_brunei_kingdom_decision_desc
	selection_tooltip = form_brunei_kingdom_decision_tooltip
	decision_group_type = major
	sort_order = 110

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

	is_shown = {
		culture ?= { has_cultural_pillar = heritage_austronesian }
		religion ?= religion:islam_religion
		highest_held_title_tier <= tier_duchy
		capital_province ?= { geographical_region = custom_brunei_region }
		NOT = {  #Can only do it once.
			is_target_in_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:flag_created_brunei_kingdom
			}
		}
		is_playable_character = yes
	}

	is_valid = {
		top_liege = this
		is_independent_ruler = yes
		highest_held_title_tier = tier_duchy
		has_title = title:d_BOR_barune
		custom_tooltip = {
			text = form_brunei_kingdom_decision_requirement_1_tt
			title:d_BOR_santubong = {
				this = { is_title_created = yes }
				holder = {
					OR = {
						is_vassal_or_below_of = ROOT
						this = ROOT
					}
				}
			}
		}
		custom_tooltip = {
			text = form_brunei_kingdom_decision_requirement_2_tt
			title:c_BOR_berau = {
				this = { is_title_created = yes }
				holder = {
					OR = {
						is_vassal_or_below_of = ROOT
						this = ROOT
					}
				}
			}
		}
		completely_controls = title:d_BOR_barune
		completely_controls = title:d_BOR_santubong
	}

	is_valid_showing_failures_only = {
		is_landed = yes
		is_available_adult = yes
	}

	cost = {
		gold = 350
		piety = 1000
	}

	effect = {
		show_as_tooltip = {
			form_brunei_kingdom_decision_scripted_effect = yes
		}
		save_scope_as = founder
		trigger_event = {
			id = major_decisions.8000
		}
		hidden_effect = {
			add_to_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:flag_created_brunei_kingdom
			}
			set_global_variable = {
				name = flag_created_brunei_kingdom
				value = scope:founder
			}
		}
	}

	ai_potential = {
		always = yes
	}

	ai_will_do = {
		base = 100
	}
}

##################################################
# Found the Brunei Empire
# by Ali Kara
##################################################
form_brunei_empire_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/fp3/fp3_decision_foundation.dds"
	}
	desc = form_brunei_empire_decision_desc
	selection_tooltip = form_brunei_empire_decision_tooltip
	decision_group_type = major
	sort_order = 120

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

	is_shown = {
		highest_held_title_tier = tier_kingdom
		has_title = title:k_brunei
		NOT = {  #Can only do it once.
			is_target_in_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:flag_created_brunei_empire
			}
		}
		capital_province ?= { geographical_region = custom_brunei_region }
		culture ?= { has_cultural_pillar = heritage_austronesian }
		religion ?= religion:islam_religion
		is_playable_character = yes
	}

	is_valid = {
		top_liege = this
		is_independent_ruler = yes
		highest_held_title_tier = tier_kingdom
		capital_county.faith = root.faith
		has_title = title:k_brunei
		custom_tooltip = {
			text = form_brunei_empire_decision_requirement_1_tt
			title:d_PHI_sandao = {
				this = { is_title_created = yes }
				holder = {
					OR = {
						is_vassal_or_below_of = ROOT
						this = ROOT
					}
				}
			}
		}
		custom_tooltip = {
			text = form_brunei_empire_decision_requirement_2_tt
			title:c_PHI_sulu = {
				this = { is_title_created = yes }
				holder = {
					OR = {
						is_vassal_or_below_of = ROOT
						this = ROOT
					}
				}
			}
		}
		completely_controls = title:k_brunei
		completely_controls = title:k_tanjungnagara
		completely_controls = title:d_PHI_sandao
		completely_controls = title:c_PHI_sulu
		rule_title_creation_imperial_power_projection_title_creation_trigger = yes
	}

	is_valid_showing_failures_only = {
		is_landed = yes
		is_available_adult = yes
	}

	cost = {
		gold = 600
		piety = 2250
	}

	effect = {
		show_as_tooltip = {
			form_brunei_empire_decision_scripted_effect = yes
		}
		save_scope_as = founder
		trigger_event = {
			id = major_decisions.9000
		}
		hidden_effect = {
			add_to_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:flag_created_brunei_empire
			}
			set_global_variable = {
				name = flag_created_brunei_empire
				value = scope:founder
			}
		}
	}

	ai_potential = {
		always = yes
	}

	ai_will_do = {
		base = 100
	}
}
