﻿
namespace = south_asia

### Become Chakravarti
# by Petter Vilberg
# south_asia.0001 # I became Chakravarti
# south_asia.0002 # My liege became Chakravarti
# south_asia.0003 # My liege became Chakravarti - convert?
# south_asia.0004 # Someone became Chakravarti
###


################
# Become Chakravarti events
# south_asia.0001 - 0004
#

################
# by Henrik Lohmander
# Found the Empire of Hindustan (Sultans of Delhi)
# south_asia.0050

#I united India
south_asia.0001 = {
	type = character_event
	title = south_asia.0001.t
	desc = south_asia.0001.desc
	theme = realm
	left_portrait = {
		character = root
		animation = personality_bold
	}
	
	immediate = {
		play_music_cue = "mx_cue_epic_sacral_moment"
		unite_india_decision_effect = yes
		add_trait = chakravarti
		legend_seed_new_title_effect = yes
	}

	option = {
		name = south_asia.0001.a
		add_prestige = massive_prestige_value
		add_prestige_level = 2
		faith = {
			if = {
				limit = {
					NOT = { has_doctrine = divine_destiny_doctrine }
				}
				add_doctrine = divine_destiny_doctrine
			}
			change_fervor = {
				value = major_fervor_gain
				desc = fervor_gain_chakravarti
			}
		}
	}
}


#My ruler became Chakravarti
south_asia.0002 = {
	type = character_event
	title = south_asia.0002.t
	desc = {
		desc = south_asia.0002.intro
		desc = south_asia.0002.text
	}
	theme = realm
	left_portrait = {
		character = scope:chakravarti
		animation = personality_bold
	}
	
	immediate = {
		play_music_cue = "mx_cue_epic_sacral_moment"
		show_as_tooltip = {
			scope:chakravarti = {
				add_trait_force_tooltip = chakravarti
				hidden_effect = { set_primary_title_to = title:h_india }
				faith = {
					add_doctrine = divine_destiny_doctrine
					change_fervor = {
						value = major_fervor_gain
						desc = fervor_gain_chakravarti
					}
				}
			}
		}
	}

	option = {
		name = south_asia.0002.a
		if = {
			limit = {
				faith = scope:chakravarti.faith
			}
			scope:chakravarti = {
				add_opinion = {
					target = root
					modifier = followed_the_chakravarti_opinion
				}
			}
		}
	}

	option = {
		name = south_asia.0002.b
		trigger = {
			faith != scope:chakravarti.faith
		}
		set_character_faith_with_conversion = scope:chakravarti.faith
		scope:chakravarti = {
			add_opinion = {
				target = root
				modifier = followed_the_chakravarti_opinion
			}
		}
	}
}

#My ruler became Chakravarti - non-Indian religion
south_asia.0003 = {
	type = character_event
	title = south_asia.0002.t
	desc = {
		desc = south_asia.0002.intro
		desc = south_asia.0003.text
	}
	theme = realm
	left_portrait = {
		character = scope:chakravarti
		animation = personality_bold
	}
	
	immediate = {
		play_music_cue = "mx_cue_epic_sacral_moment"
		show_as_tooltip = {
			scope:chakravarti = {
				add_trait_force_tooltip = chakravarti
				hidden_effect = { set_primary_title_to = title:h_india }
				faith = {
					add_doctrine = divine_destiny_doctrine
					change_fervor = {
						value = major_fervor_gain
						desc = fervor_gain_chakravarti
					}
				}
			}
		}
		legend_seed_new_title_effect = yes
	}

	option = {
		name = south_asia.0003.a
		set_character_faith_with_conversion = scope:chakravarti.faith
		scope:chakravarti = {
			add_opinion = {
				target = root
				modifier = followed_the_chakravarti_opinion
			}
		}
		ai_chance = {
			base = 100
			opinion_modifier = {
				opinion_target = scope:chakravarti
			}
		}
	}

	option = {
		name = south_asia.0003.b
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 1
			}
		}
	}
}


#Someone became Chakravarti
south_asia.0004 = {
	type = character_event
	title = south_asia.0002.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						faith.religion = faith:vaishnavism.religion
						faith.religion = faith:theravada.religion
						faith.religion = faith:digambara.religion		
					}
				}
				desc = south_asia.0004.relevant_religion
			}
			desc = south_asia.0004.desc
		}
		desc = south_asia.0004.text
	}
	theme = realm
	left_portrait = {
		character = scope:chakravarti
		animation = personality_bold
	}
	
	immediate = {
		#Indian faith coreligionists get a positive music cue.
		if = {
			limit = {
				OR = {
					faith = { religion_tag = hinduism_religion }
					faith = { religion_tag = buddhism_religion }
					faith = { religion_tag = jainism_religion }
				}
			}
			play_music_cue = "mx_cue_epic_sacral_moment"
		}
		#Everyone else sees a terrifying empire.
		else = { play_music_cue = "mx_cue_combat_2" }
		show_as_tooltip = {
			scope:chakravarti = {
				add_trait_force_tooltip = chakravarti
				hidden_effect = { set_primary_title_to = title:h_india }
				faith = {
					add_doctrine = divine_destiny_doctrine
					change_fervor = {
						value = major_fervor_gain
						desc = fervor_gain_chakravarti
					}
				}
			}
		}
	}

	option = {
		name = south_asia.0004.a
		trigger = {
			OR = {
				faith.religion = faith:vaishnavism.religion
				faith.religion = faith:theravada.religion
				faith.religion = faith:digambara.religion		
			}
		}
	}

	option = {
		name = south_asia.0004.b
		fallback = yes
	}
}

#
# END Become Chakravarti events
#################


##############
#Take Stewardship of the Sacred River
# south_asia.0011-0013
# by Petter Vilberg

#I have become the Lady/Lord of the Ganges
south_asia.0011 = {
	type = character_event
	title = south_asia.0011.t
	desc = south_asia.0011.desc
	theme = faith
	left_portrait = {
		character = root
		animation = personality_zealous
	}
	override_background = { reference = throne_room_india }

	immediate = { play_music_cue = "mx_cue_sacredrite" }

	option = {
		name = south_asia.0011.a
		take_stewardship_of_the_sacred_river_effect = yes
		legend_seed_great_deed_region_effect = {
			REGION = geographical_region:custom_ganges_plain
		}
	}
}


#Someone has claimed stewardship of the Ganges
south_asia.0012 = {
	type = character_event
	title = south_asia.0011.t
	desc = south_asia.0012.desc
	theme = faith
	left_portrait = {
		character = scope:ruler_of_ganges
		animation = personality_zealous
	}
	override_background = { reference = throne_room_india }

	option = {
		name = {
			text = south_asia.0012.a.like
			trigger = {
				opinion = {
					target = scope:ruler_of_ganges
					value >= 0
				}
			}
		}
		name = {
			text = south_asia.0012.a.dislike
		}
		show_as_tooltip = {
			scope:ruler_of_ganges = {
				give_nickname = nick_the_ladylord_of_the_ganges
				add_character_modifier = {
					modifier = ruler_of_the_ganges_modifier
				}
			}
		}
	}
}


#Someone has claimed my title as steward of the Ganges
south_asia.0013 = {
	type = character_event
	title = south_asia.0013.t
	desc = south_asia.0013.desc
	theme = faith
	left_portrait = {
		character = scope:ruler_of_ganges
		animation = personality_zealous
	}
	override_background = { reference = throne_room_india }

	immediate = {
		add_opinion = {
			target = scope:ruler_of_ganges
			modifier = humbled_opinion
			opinion = -40	
		}
		remove_character_modifier = ruler_of_the_ganges_modifier
	}

	option = {
		name = south_asia.0013.a
		if = {
			limit = { has_nickname = nick_the_ladylord_of_the_ganges }
			remove_nickname = yes
		}
		show_as_tooltip = {
			scope:ruler_of_ganges = {
				add_opinion = {
					target = root
					modifier = weak_opinion
					opinion = -20	
				}
				give_nickname = nick_the_ladylord_of_the_ganges
				add_character_modifier = {
					modifier = ruler_of_the_ganges_modifier
				}
			}
		}
	}
}


#I have become King of Bene Israel
south_asia.0021 = {
	type = character_event
	title = south_asia.0021.t
	desc = south_asia.0021.desc
	theme = faith
	left_portrait = {
		character = scope:founder
		animation = personality_zealous
	}
	override_background = { reference = throne_room_india }

	immediate = {
		unite_bene_israel_effect = yes
		legend_seed_new_title_effect = yes
	}

	option = {
		name = south_asia.0021.a
		show_as_tooltip = { unite_bene_israel_effect = yes }
	}
}

#Someone else became King of Bene Israel
south_asia.0022 = {
	type = character_event
	title = south_asia.0021.t
	desc = south_asia.0021.desc
	theme = faith
	left_portrait = {
		character = scope:founder
		animation = personality_zealous
	}
	override_background = { reference = throne_room_india }

	option = {
		name = south_asia.0021.a
		scope:founder = { show_as_tooltip = { unite_bene_israel_effect = yes } }
		trigger = {
			OR = {
				faith = faith:malabarism
				is_vassal_of = scope:founder
			}
		}
	}

	option = {
		name = south_asia.0021.b
		scope:founder = { show_as_tooltip = { unite_bene_israel_effect = yes } }
		trigger = {
			religion = religion:judaism_religion
			NOT = { faith = faith:malabarism }
		}
	}

	option = {
		name = south_asia.0021.c
		scope:founder = { show_as_tooltip = { unite_bene_israel_effect = yes } }
		trigger = {
			NOT = { religion = religion:judaism_religion }
		}
	}
}


######################################
##    Spread the Theravada Faith    ##
##								    ##
##			by Nick Meredith        ##
##			in memory of RDH        ##
######################################

#Holding event for preliminary path choices
south_asia.0030 = {
	type = character_event
	title = south_asia.0030.t
	desc = south_asia.0030.desc
	theme = faith

	override_background = { reference = throne_room_india }

	immediate = {
		play_music_cue = "mx_cue_sacredrite" 
		faith:theravada = {
			save_scope_as = theravada_faith
		}

		random_vassal = {
			limit = {
				faith = faith:ari
				is_powerful_vassal = yes
			}
		save_scope_as = ari_vassal
		}

		add_character_flag = proselytiser
	}

	left_portrait = {
		character = root
		animation = personality_zealous
	}
	right_portrait = {
		character = realm_priest
		animation = personality_zealous
	}

	#Impose Theravada in its purest form
	option = {
		name = south_asia.0030.a

		save_scope_value_as = {
			name = impose
			value = yes
		}

		add_prestige = minor_prestige_value
		add_piety = medium_piety_value

		stress_impact = {
			zealous = miniscule_stress_impact_loss
			stubborn = miniscule_stress_impact_loss
			cynical = medium_stress_gain
			compassionate = miniscule_stress_impact_gain
		}

		every_county_in_region = {
			region = world_burma
			custom = south_asia.0030.a.tt
			limit = {
				target_is_de_facto_liege_or_above = root.primary_title
			}
			change_county_control = -10			
			random = {
				chance = 20
				set_county_faith = faith:theravada
			}
		}

		every_player = {
			limit = {
				this != root
				top_liege != this
				capital_province = {
					geographical_region = world_burma
				}
			}
			trigger_event = south_asia.0038
		}
	
		every_vassal = {
			limit = {
				NOT = { faith = faith:theravada }
			}

			custom = south_asia.0030.a.ari.tt
			random = {
				chance = 80
				set_character_faith = faith:theravada
				add_opinion = {
					target = root
					modifier = angry_opinion
					opinion = -40
				}
			}

			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = -10
			}
		}
		
		hidden_effect = {
			add_to_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:spread_theravada_faith_flag
			}
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_zeal = 3
			}
		}
	}

	#Syncretise the faiths
	option = {
		name = south_asia.0030.b
	
		save_scope_value_as = {
			name = syncretise
			value = yes
		}

		stress_impact = {
			zealous = medium_stress_gain
			stubborn = minor_stress_gain
			cynical = medium_stress_loss
			compassionate = minor_stress_loss
		}
	
		
		every_county_in_region = {
			region = world_burma
			custom = south_asia.0030.a.tt
			limit = {
				NOT = { faith = faith:theravada }
				target_is_de_facto_liege_or_above = root.primary_title
			}
			random = {
				chance = 50
				add_county_modifier = county_listened_to_locals_modifier
			}
		}

		every_player = {
			limit = {
				this != root
				top_liege != this
				capital_province = {
					geographical_region = world_burma
				}
			}
		trigger_event = south_asia.0038
		}

		every_vassal = {
			limit = {
				NOT = { faith = faith:theravada }
			}

			custom = south_asia.0030.b.theravada.tt

			random = {
				chance = 30
				set_character_faith = faith:ari
			}
		}

		hidden_effect = {
			add_to_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:spread_theravada_faith_flag 
			}
		}

		ai_chance = {
			base = 100
		}
	}
	
	#Get-out option so you can re-take decision later
	option = {
		name = south_asia.0030.c
	}

	after = {
		if = {
			limit = { exists = scope:impose }
			title:k_pagan.holder = {
				trigger_event = {
					id = south_asia.0031
					days = { 30 35 }
				}
			}
		}
		else_if = {
			limit = { exists = scope:syncretise }
			title:k_pagan.holder = {
				trigger_event = {
					id = south_asia.0032
					days = { 30 35 }
				}
			}
		}
	}
}

#Situation Escalates
south_asia.0031 = {
	type = character_event
	title = south_asia.0031.t
	desc = south_asia.0031.desc
	theme = faith

	override_background = { reference = temple_scope }

	left_portrait = {
		character = root
		animation = anger
	}
	 right_portrait = {
		character = scope:ari_vassal
		animation = disapproval
	}

	trigger = {
		has_faith = faith:theravada
	}

	immediate = {
		random_vassal = {
			limit = {
				faith = faith:ari
				is_powerful_vassal = yes
				}
		save_scope_as = ari_vassal
		}
	}
	
	#Crush Insurrectionists
	option = {
		name = south_asia.0031.a

		save_scope_value_as = {
			name = crush
			value = yes
		}
 
		add_prestige = medium_prestige_value
		add_piety = medium_piety_value
		add_dread = minor_dread_gain

		stress_impact = {
			wrathful = miniscule_stress_impact_loss
			zealous = miniscule_stress_impact_loss
			craven = minor_stress_gain
			compassionate = medium_stress_gain
			callous = miniscule_stress_impact_loss
			sadistic = miniscule_stress_impact_loss
			forgiving = major_stress_gain
		}

		every_county_in_region = {
			region = world_burma
			custom = south_asia.0031.a.tt

			limit = {
				target_is_de_facto_liege_or_above = root.primary_title
			}

			change_county_control = -10
		}

		every_player = {
			limit = {
				this != root
				top_liege != this
				capital_province = {
					geographical_region = world_burma
				}
			}
		trigger_event = south_asia.0039
		}
		
		every_vassal = {
			custom = south_asia.0034.vassals
			add_opinion = {
				target = root
				opinion = -20
				modifier = cruelty_opinion
			}
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_zeal = 3
			}
		}
	}

	#Reconcile
	option = {
		name = south_asia.0031.b

		save_scope_value_as = {
			name = reconcile
			value = yes
		}
		
		add_prestige = minor_prestige_loss
	
		stress_impact = {
			wrathful = minor_stress_gain
			zealous = medium_stress_gain
			craven = miniscule_stress_impact_loss
			compassionate = miniscule_stress_impact_loss
			callous = medium_stress_gain
			sadistic = medium_stress_gain
			}

		every_vassal = {
			limit = {
				faith = faith:theravada
			}
			custom = south_asia.0031.b.theravada
			add_opinion = {
				target = root
				opinion = -10
				modifier = disappointed_opinion
			}
		}

		every_vassal = {
			limit = {
			   faith = faith:ari
			}
			custom = south_asia.0030.a.ari.tt
			add_opinion = {
				target = root
				opinion = 10
				modifier = pleased_opinion
			}
		}
		ai_chance = {
			base = 100
		}
	}	

#String them up
	option = {
		name = south_asia.0031.c

		save_scope_value_as = {
			name = string
			value = yes
		}

		add_prestige = medium_prestige_loss
		add_piety = medium_piety_value
		add_dread = major_dread_gain
		
		trigger = {
			OR = {
				has_trait = vengeful
				has_trait = zealous
			}
		}
		
		trait = zealous
		trait = vengeful
		
		add_internal_flag = dangerous

		stress_impact = {
			wrathful = major_stress_loss
			compassionate = major_stress_gain
			craven = major_stress_gain
			callous = major_stress_loss
			sadistic = major_stress_loss
		}

		every_vassal = {
			limit = {
			   faith = faith:ari
			}
			custom = south_asia.0030.a.ari.tt
			add_opinion = {
				target = root
				opinion = -50
				modifier = angry_opinion
			}
		}

		every_vassal = {
			limit = {
				NOT = {
					faith = faith:ari
				}
			}
			custom = south_asia.0031.c.all.tt
			add_opinion = {
				target = root
				opinion = -20
				modifier = scared_opinion
			}
		}
	}

	#Do Nothing
	option = {
		name = south_asia.0031.d
		ai_chance = {
			base = 100
		}
	}
	
	after = {
		if = {
			limit = { exists = scope:crush }
			title:k_pagan.holder = {
				trigger_event = {
					id = south_asia.0033
					days = { 30 35 }
				}
			}
		}
		else_if = {
			limit = { exists = scope:reconcile }
			title:k_pagan.holder = {
				trigger_event = {
					id = south_asia.0034
					days = { 30 35 }
				}
			}
		}
		else_if = {
			limit = { exists = scope:string }
			title:k_pagan.holder = {
				trigger_event = {
					id = south_asia.0033
					days = { 30 35 }
				}
			}
		}
	}
}

#Tensions Ease
south_asia.0032 = {
	type = character_event
	title = south_asia.0032.t
	desc = south_asia.0032.desc
	theme = realm
 
	override_background = { reference = throne_room_india }

	left_portrait = {
		character = root
		animation = personality_compassionate
	}

	right_portrait = {
		character = realm_priest
		animation = personality_content
	}

	trigger = {
		has_faith = faith:theravada
	}	
	
	#Invite Lankan Refugees
	option = {
		name = south_asia.0032.a
		
		save_scope_value_as = {
			name = refugees
			value = yes
		}
		
		custom_tooltip = south_asia.0032.a.tt

		stress_impact = {
			shy = minor_stress_gain
		}

		every_ruler = {
			custom = south_asia.0032.a.ruler.tt
				limit = {
					culture = culture:sinhala
					faith = faith:theravada
				}

			add_opinion = {
				target = root
				opinion = 10
				modifier = pious_opinion
			}
		}

		#Add lankan refugees to court
		hidden_effect = {
			create_character = {
				location = root.capital_province
				culture = culture:sinhala
				faith = faith:theravada
				gender_female_chance = root_faith_clergy_gender_female_chance
				trait = education_learning_2
				trait = temperate
				trait = devoted
				learning = { 15 18 }
				save_scope_as = lankan1
			}

			create_character = {
				location = root.capital_province
				culture = culture:sinhala
				faith = faith:theravada
				gender_female_chance = root_faith_clergy_gender_female_chance
				trait = education_learning_3
				trait = calm
				trait = devoted
				learning = { 12 14 }
				save_scope_as = lankan2
			}
		
			add_visiting_courtier = scope:lankan1
			add_visiting_courtier = scope:lankan2
		}

		send_interface_message = {
			type = event_religious_good_text
			title = south_asia.0032.a.tt
			desc = south_asia.0032.a.lankan
			left_icon = scope:lankan1
			right_icon = scope:lankan2
		}

		ai_chance = {
			base = 100
		}
	}

	#Take the Lead
	option = {
		name = south_asia.0032.b
		
		add_prestige = minor_prestige_value
		
		save_scope_value_as = {
			name = lead
			value = yes
		}

		stress_impact = {
			ambitious = miniscule_stress_impact_loss
			content = major_stress_gain
		}

		faith = {
			change_fervor = {
				value = minor_fervor_value
				desc = fervor_gain_theravada
			}
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_zeal = 3
			}
		}
	}
	after = {
		if = {
			limit = { exists = scope:refugees }
			title:k_pagan.holder = {
				trigger_event = {
					id = south_asia.0035
					days = { 30 35 }
				}
			}
		}
		else_if = {
			limit = { exists = scope:lead }
			title:k_pagan.holder = {
				trigger_event = {
					id = south_asia.0035
					days = { 30 35 }
				}
			}
		}
	}
}

#Religious Will Imposed
south_asia.0033 = {
	type = character_event
	title = south_asia.0033.t
	desc = south_asia.0033.desc
	theme = dread
	
	left_portrait = {
		character = root
		animation = personality_callous
	}
	 right_portrait = {
		character = scope:ari_vassal
		animation = shock
	}
   
	trigger = {
		has_faith = faith:theravada
	}
	
	#Demand conversion
	option = {
		name = south_asia.0033.a
		
		add_piety = major_piety_value
		give_nickname = nick_the_ruthless

		stress_impact = {
			cynical = major_stress_gain
		}

		every_vassal = {
			limit = {
				faith = faith:ari
			}		

			custom = south_asia.0030.a.ari.tt
			set_character_faith_with_conversion = faith:theravada
			add_opinion = {
				target = root
				opinion = -80
				modifier = hate_opinion
			}
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_zeal = 3
			}
		}
	}

	#Let them go
	option = {
		name = south_asia.0033.b
		
		add_prestige = minor_prestige_loss

		stress_impact = {
			zealous = major_stress_gain
			}        
 
		every_vassal = {
			limit = {
				faith = faith:theravada 
			}
			custom = south_asia.0034.vassals
			add_opinion = {
				target = root
				opinion = 10
				modifier = grateful_opinion
			}
		}
		ai_chance = {
			base = 100
		}
	}
	
	#Imprison the nonbelievers
	option = {
		name = south_asia.0033.c
		
		add_prestige = medium_piety_value
		add_treasury_or_gold = major_treasury_or_gold_value
		add_dread = medium_dread_gain
		give_nickname = nick_the_tyrant

		trigger = {
			OR = {
				has_trait = vengeful
				has_trait = zealous
				has_trait = callous
			}
		}
		
		trait = zealous
		trait = vengeful
		trait = callous
		
		add_internal_flag = dangerous

		stress_impact = {
			wrathful = medium_stress_loss
			zealous = medium_stress_loss
			compassionate = major_stress_gain
			callous = medium_stress_loss
			sadistic = major_stress_loss
			forgiving = massive_stress_gain
		}

		every_vassal = {
			limit = {
				faith = faith:ari
				is_ai = yes
			}
			save_scope_as = ari_vassal_imprisoned
			imprison_character_effect = {
				IMPRISONER = root
				TARGET = scope:ari_vassal_imprisoned
			}
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_zeal = 3
			}
		}	
	}
}

#Religious Conflict Averted
south_asia.0034 = {
	type = character_event
	title = south_asia.0034.t
	desc = south_asia.0034.desc
	theme = faith
	
	left_portrait = {
		character = root
		animation = happiness
	}
	
	trigger = {
		has_faith = faith:theravada
	}
	
	#Appease
	option = {
		name = south_asia.0034.a
		
		add_prestige = minor_prestige_value

		stress_impact = {
			compassionate = medium_stress_loss
			forgiving = medium_stress_loss
			}
	
		every_county_in_region = {
		region = world_burma
		custom = south_asia.0030.a.tt
		limit = {
			target_is_de_facto_liege_or_above = root.primary_title
		}
		change_county_control = 10
		}		
	
		every_vassal = {
		custom_tooltip = south_asia.0034.vassals
			add_opinion = {
				target = root
				modifier = impressed_opinion
				opinion = 10
			}
		}

		ai_chance = {
			base = 100
		}
	}

	#Proselytise
	option = {
		name = south_asia.0034.b
		
		add_piety = major_piety_value

		add_learning_skill = 2

		stress_impact = {
			zealous = minor_stress_loss
			}
		
		every_county_in_region = {
			region = world_burma
			custom_tooltip = south_asia.0034.aricounties
			limit = {
				target_is_de_facto_liege_or_above = root.primary_title
				faith = faith:ari
				}
			random = {
			chance = 50
			set_county_faith = faith:theravada
			}
		}

		ai_chance = {
			base = 100
		}
	}
}

#Preserving Theravadan Homelands
south_asia.0035 = {
	type = character_event
	title = south_asia.0035.t
	desc = south_asia.0035.desc
	theme = faith
	
	left_portrait = {
		character = root
		animation = worry
	}

	right_portrait = {
		character = realm_priest
		animation = worry
	}

	immediate = {
		faith:ari = {
			save_scope_as = ari_faith
		}
	}

	trigger = {
		has_faith = faith:theravada
	}

	#Send Monks
	option = {
		name = south_asia.0035.a
 
		save_scope_value_as = {
			name = monks
			value = yes
		}

		add_piety = minor_piety_value


		every_county_in_region = {
			region = custom_lanka
				limit = {
					holder = {
						faith = faith:theravada
						is_ai = yes
					}
				}
			custom = south_asia.0035.a.lanka
			set_county_faith = faith:theravada
		}

		every_player = {
			limit = {
				capital_province = {
					geographical_region = custom_lanka
				}
				faith = faith:theravada
				top_liege = this
			}
		trigger_event = south_asia.0041
		}
	}
	
	#Send Emissaries
	option = {
		name = south_asia.0035.b

		add_prestige = minor_prestige_value
	   
		save_scope_value_as = {
			name = emissaries
			value = yes
		}

		every_independent_ruler = {
			limit = {
				faith = faith:theravada
				is_landed = yes
				capital_province = {
					geographical_region = custom_lanka
				}
			}

			add_opinion = {
				target = root
				modifier = impressed_opinion
				opinion = 50
			}
		}
		
		every_independent_ruler = {
			limit = {
				faith = faith:theravada
				is_landed = yes
				capital_province = {
						NOT = {
							geographical_region = custom_lanka
						}
					}
				}

			custom = south_asia.0035.b.theravada.tt

			add_opinion = {
				target = root
				modifier = pious_opinion
				opinion = 10
			}
		}

		ai_chance = {
			base = 100
		}
	}
	after = {
		if = {
			limit = { exists = scope:monks }
			title:k_pagan.holder = {
				trigger_event = {
					id = south_asia.0036
					days = { 30 35 }
				}
			}
		}
		else_if = {
			limit = { exists = scope:emissaries }
			title:k_pagan.holder = {
				trigger_event = {
					id = south_asia.0036
					days = { 30 35 }
				}
			}
		}
	}
}

#Deal with the Ari
south_asia.0036 = {
	type = character_event
	title = south_asia.0036.t
	desc = south_asia.0036.desc
	theme = faith
	
	left_portrait = {
		character = root
		animation = rage
	}

	right_portrait = {
		character = realm_priest
		animation = personality_bold
	}  

	trigger = {
		has_faith = faith:theravada
	}

	immediate = {
		faith:ari = {
			save_scope_as = ari_faith
		}
	}

	#Turn the people against them
	option = {
		name = south_asia.0036.a

		save_scope_value_as = {
			name = people
			value = yes
		}

		add_piety = minor_piety_value

		capital_county = {
			add_county_modifier = {
				modifier = divide_and_conquer_modifier
				days = 2000
			}
		}

		ai_chance = {
			base = 100
		}
	}

	#Drive them into the forests
	option = {
		name = south_asia.0036.b
		
		add_prestige = medium_prestige_value
		add_treasury_or_gold = minor_treasury_or_gold_value

		save_scope_value_as = {
			name = forests
			value = yes
		}

		every_player = {
			limit = {
				this != root
				top_liege != this
				capital_province = {
					geographical_region = world_burma
				}
			}
			trigger_event = south_asia.0040
		}

		#Convert all counties to Theravada...
		every_county_in_region = {
			custom = south_asia.0036.b.tt
			region = world_burma
				limit = {
					title_province = {
						NOT = {
							geographical_region = custom_arakan_mountains
						}
					}
					target_is_de_facto_liege_or_above = root.primary_title
				}
			set_county_faith = faith:theravada
		}

		#...and then re-add Ari to simulate driving them out into forests and mountains.
		every_county_in_region = {
			region = custom_arakan_mountains
				limit = {
					target_is_de_facto_liege_or_above = root.primary_title
				}
			set_county_faith = faith:ari
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_zeal = 3
			}
		}
	}

	after = {
		if = {
			limit = { exists = scope:people }
			title:k_pagan.holder = {
				trigger_event = {
					id = south_asia.0037
					days = { 30 35 }
				}
			}
		}
		else_if = {
			limit = { exists = scope:forests }
			title:k_pagan.holder = {
				trigger_event = {
					id = south_asia.0037
					days = { 30 35 }
				}
			}
		}
	}
}


#The Faith Secured
south_asia.0037 = {
	type = character_event
	title = south_asia.0037.t
	desc = south_asia.0037.desc
	theme = faith

	left_portrait = {
		character = root
		animation = personality_honorable
	}

	override_background = { reference = throne_room_india }    

	immediate = {
		play_music_cue = "mx_cue_epic_sacral_moment"
		add_prestige = major_prestige_value
		add_piety = major_piety_value
	}

	#Nickname pls
	option = {
		name = south_asia.0037.a
		
		give_nickname = nick_the_missionary

		ai_chance = {
			base = 100
		}
	}

	#No nickname, gib opinion and lifestyle experience
	option = {
		name = south_asia.0037.b
		
		every_vassal = {
			custom = south_asia.0037.b.tt
			add_opinion = {
				target = root
				modifier = impressed_opinion
				opinion = 20
			}
		}

		ai_chance = {
			base = 100
		}
	}
}

#Inform any vassal players of the chain beginning
south_asia.0038 = {
	type = character_event
	title = south_asia.0038.t
	desc = south_asia.0038.desc
	theme = diplomacy
	left_portrait = {
		character = scope:proselytiser
		animation = personality_zealous
	}
	right_portrait = {
		character = root
		animation = personality_honorable
	}

	immediate = {
		if = {
			limit = {
				any_independent_ruler = {
					has_character_flag = proselytiser
				}
			}
		}
		save_scope_as = proselytiser
	}

	option = {
		name = { #Theravadan adherents are happy
			trigger = {
				faith = faith:theravada
				liege = scope:proselytiser
				capital_province = {
					geographical_region = world_burma
				}
			}
			text = south_asia.0038.a
		}
		name = { #Ari adherents are not happy
			trigger = {
				faith = faith:ari
				liege = scope:proselytiser
				capital_province = {
					geographical_region = world_burma
				}
			}
			text = south_asia.0038.b
		}
		name = { #If you're neither Ari nor Theravadan you aren't too bothered
			trigger = {
					NOR = {
						faith = faith:theravada
						faith = faith:ari
					}
					liege = scope:proselytiser
					capital_province = {
						geographical_region = world_burma
					}
				}
			text = south_asia.0038.c
		}

		show_as_tooltip = {
			every_county_in_region = {
				region = world_burma
				custom = south_asia.0038.tt

				limit = {
					holder = root
				}
			}
		}
	}
}

#Inform any vassal players of the chain ending violently
south_asia.0039 = {
	type = character_event
	title = south_asia.0039.t
	desc = south_asia.0039.desc
	theme = diplomacy
	left_portrait = {
		character = scope:proselytiser
		animation = personality_callous
	}
	right_portrait = {
		character = root
		animation = worry
	}

	option = {
		name = { #Theravadan adherents are happy
			trigger = {
				faith = faith:theravada
				liege = scope:proselytiser
				capital_province = {
					geographical_region = world_burma
				}
			}
			text = south_asia.0039.a
		}
		name = { #Ari adherents are not happy
			trigger = {
				faith = faith:ari
				liege = scope:proselytiser
				capital_province = {
					geographical_region = world_burma
				}
			}
			text = south_asia.0039.b
		}
		name = { #If you're neither Ari nor Theravadan you aren't too bothered
			trigger = {
					NOR = {
						faith = faith:theravada
						faith = faith:ari
					}
					liege = scope:proselytiser
					capital_province = {
						geographical_region = world_burma
					}
				}
			text = south_asia.0039.c
		}

		show_as_tooltip = {
			every_county_in_region = {
				region = world_burma

				limit = {
					holder = root
				}
				change_county_control = -10
			}
		}
	}
}


#Inform any vassal players of the chain ending peacefully
south_asia.0040 = {
	type = character_event
	title = south_asia.0040.t
	desc = south_asia.0040.desc
	theme = diplomacy
	left_portrait = {
		character = scope:proselytiser
		animation = personality_honorable
	}
	right_portrait = {
		character = root
		animation = idle
	}

	option = {
		name = { #Theravadan adherents are happy
			trigger = {
				faith = faith:theravada
				liege = scope:proselytiser
				capital_province = {
					geographical_region = world_burma
				}
			}
			text = south_asia.0040.a
		}
		name = { #Ari adherents are not happy
			trigger = {
				faith = faith:ari
				liege = scope:proselytiser
				capital_province = {
					geographical_region = world_burma
				}
			}
			text = south_asia.0040.b
		}
		name = { #If you're neither Ari nor Theravadan you aren't too botherd
			trigger = {
					NOR = {
						faith = faith:theravada
						faith = faith:ari
					}
					liege = scope:proselytiser
					capital_province = {
						geographical_region = world_burma
					}
				}
			text = south_asia.0040.c
		}
		show_as_tooltip = {
			every_county_in_region = {
				region = world_burma
				custom = south_asia.0040.tt

				limit = {
					holder = root
				}
			}
		}
	}
}

#Inform Lankan players of the monks arriving
south_asia.0041 = {
	type = character_event
	title = south_asia.0041.t
	desc = south_asia.0041.desc
	theme = diplomacy
	left_portrait = {
		character = scope:proselytiser
		animation = personality_zealous
	}
	right_portrait = {
		character = root
		animation = personality_honorable
	}

	immediate = { #Unop: Added this part since proselytiser is needed for loc & portrait
		if = {
			limit = {
				any_independent_ruler = {
					has_character_flag = proselytiser
				}
			}
		}
		save_scope_as = proselytiser
	}

	option = {
		name = { #Theravadan adherent is happy
			text = south_asia.0041.a #Unop: Misc indent
		}
	}
}

#Empire of Hindustan (Sultans of Delhi)

#	I founded the Empire of Hindustan
south_asia.0050 = {
	type = character_event
	title = south_asia.0050.t
	desc = south_asia.0050.desc
	theme = realm
	override_background = { reference = bp2_study_indian }
	left_portrait =	{
		character = scope:founder
		animation = sword_coup_degrace
	}

	immediate = {
		play_music_cue = "mx_cue_epic_sacral_moment"
		found_empire_of_hindustan_scripted_effect = yes
	}

	#
	option = {
		name = south_asia.0050.a
		trigger = {
			NOT = {
				capital_county = title:c_delhi
			}
		}
		title:b_indraprastha = {
			set_title_name = c_delhi
		}
		set_realm_capital = title:c_delhi
		title:e_hindustan = {
			set_capital_county = title:c_delhi
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = south_asia.0050.b
		trigger = {
			NOT = {
				capital_county = title:c_lahur
			}
			title:c_lahur.holder = root
		}
		set_realm_capital = title:c_lahur
		title:e_hindustan = {
			set_capital_county = title:c_lahur
		}
		ai_chance = {
			base = 0
		}
	}



	option = {
		name = south_asia.0050.c #Stay with current capital
		trigger = {
			capital_province = {
				geographical_region = world_india
			}
		}
		#
		ai_chance = {
			base = 0
			modifier = {
				NOR = {
					has_title = title:c_lahur
					has_title = title:c_delhi
				}
				add = 100
			}
		}
	}

	after = {
		give_nickname = nick_the_great
		add_prestige_experience = monumental_fame_gain
		every_vassal = {
			add_opinion = {
				modifier = found_the_empire_of_hindustan_opinion
				target = root
			}
			custom = found_the_empire_of_hindustan_decision_effects_vassal_opinion.tt
		}
		hidden_effect = {
			title:e_hindustan = {
				set_capital_county = root.capital_county
			} #Regardless of outcome we still update the default capital for e_hindustan.
			domicile ?= { move_domicile = root.top_liege.capital_province }
		}
		legend_seed_new_title_effect = yes
	}
	
}

#Someone else founded the Empire of Hindustan
south_asia.0051 = {
	type = character_event
	title = south_asia.0051.t
	desc = south_asia.0051.desc
	theme = realm
	override_background = { reference = bp2_study_indian }
	left_portrait =	{
		character = scope:founder
		animation = sword_coup_degrace
	}

	immediate = {
		play_music_cue = "mx_cue_epic_sacral_moment"
	}

	#
	#Well, that happened.
	option = {
		name = {	#Other emperors are threatened.
			trigger = {
				highest_held_title_tier = tier_empire
			}
			text = south_asia.0051.a
		}
		name = {	#The old emperor of this region is not happy
			trigger = { has_title = title:e_rajastan }
			text = south_asia.0051.b
		}
		name = {
			trigger = {
				NOR = {
					highest_held_title_tier = tier_empire
					any_liege_or_above = { this = scope:founder }
				}
				faith.religion = religion:islam_religion
			}
			text = south_asia.0051.c 
		}
		name = {
			trigger = {
				NOR = {
					highest_held_title_tier = tier_empire
					any_liege_or_above = { this = scope:founder }
					faith.religion = religion:islam_religion
				}
			}
			text = south_asia.0051.d 
		}
		name = {
			trigger = {
				any_liege_or_above = { this = scope:founder }
			}
			text = south_asia.0051.e
		}
		ai_chance = {	#Solo option.
			base = 100
		}
	}
	
}
