﻿namespace = raj

# The Jewel in the Crown
raj.1 = {
	type = country_event
	placement = ROOT

	title = raj.1.t
	desc = raj.1.d
	flavor = raj.1.f

	duration = 3

	event_image = {
		video = "ep1_transfer_of_authority"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"

	icon = "gfx/interface/icons/event_icons/event_scales.dds"

	minor_left_icon = c:GBR
	minor_right_icon = c:BIC

	trigger = {
	}

	immediate = {
		c:BIC = {
			save_scope_as = company_country
			trigger_event = { id = raj.7 days = 0 popup = yes }
		}
		c:GBR = {
			save_scope_as = british_raj_country
		}
		set_variable = {
			name = british_raj_var
		}
	}

	option = {
		name = raj.1.a
		default_option = yes
		custom_tooltip = activate_british_raj
		if = {
			limit = {
				has_diplomatic_pact = {
					who = c:BIC
					type = chartered_company
				}
			}
			c:BIC ?= {
				decrease_autonomy = yes
			}
		}
		c:BIC = {
			set_variable = doctrine_of_lapse_ended
			custom_tooltip = doctrine_of_lapse_disabled
			remove_modifier = modifier_india_company_rule
			add_modifier = modifier_india_crown_rule
			if = {
				limit = {
					NOT = {
						has_law = law_type:law_appointed_bureaucrats
					}
				}
				activate_law = law_type:law_appointed_bureaucrats
			}
			if = {
				limit = {
					NOT = {
						has_law = law_type:law_autocracy
					}
				}
				activate_law = law_type:law_autocracy
			}
			if = {
				limit = {
					NOR = {
						has_law = law_type:law_hindu_caste_enforced
						has_law = law_type:law_hindu_caste_codified
					}
				}
				activate_law = law_type:law_hindu_caste_codified
			}
			ig:ig_industrialists = {
				set_interest_group_name = ig_government_of_india
			}
			if = {
				limit = {
					game_date < 1862.1.1
				}
				create_character = { 
					template = BIC_charles_canning
					on_created = {
						set_as_interest_group_leader = yes
						set_character_as_ruler = yes
					}
				}
			}
			else_if = {
				limit = {
					game_date < 1879.1.1
				}
				create_character = { 
					template = BIC_john_lawrence
					on_created = {
						set_as_interest_group_leader = yes
						set_character_as_ruler = yes
					}
				}
			}
			else = {
				create_character = { 
					culture = cu:british
					interest_group = ig:ig_industrialists
					on_created = {
						set_as_interest_group_leader = yes
						set_character_as_ruler = yes
					}
				}
			}
		}
	}
}

# The Doctrine of Lapse
raj.2 = {
	type = country_event
	placement = ROOT

	title = raj.2.t
	desc = {
		first_valid = {
			triggered_desc = {
				desc = raj.2.d1
				trigger = {
					ruler = {
						age > 60
					}
					NOT = {
						exists = heir
					}
				}
			}
			triggered_desc = {
				desc = raj.2.d2
				trigger = {
					exists = heir
				}
			}
		}
	}
	flavor = raj.2.f

	duration = 3

	event_image = {
		video = "ep1_redcoats"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"

	icon = "gfx/interface/icons/event_icons/event_skull.dds"

	minor_left_icon = c:BIC

	immediate = {
		c:BIC ?= {
			save_scope_as = overlord_scope
		}
	}

	option = {
		name = raj.2.a
		default_option = yes
		ai_chance = {
			base = 90
		}
		if = {
			limit = { # Should never happen, but just to be sure.
				is_player = yes
			}
			play_as = scope:overlord_scope
		}
		if = {
			limit = {
				gold_reserves > 0
			}
			custom_tooltip = {
				text = transfers_treasury_to_eic_tt
				scope:overlord_scope ?= {
					add_treasury = {
						value = prev.gold_reserves
					}
				}
			}
		}
		scope:overlord_scope ?= {
			annex = ROOT
		}
	}

	option = {
		name = raj.2.b
		ai_chance = {
			base = 10
			modifier = {
				trigger = {
					liberty_desire > 25
				}
				add = 10
			}
			modifier = {
				trigger = {
					liberty_desire > 50
				}
				add = 25
			}
			modifier = {
				trigger = {
					liberty_desire > 75
				}
				add = 25
			}
			modifier = {
				trigger = {
					any_country = {
						has_diplomatic_pact = {
							who = ROOT
							type = guarantee_independence
						}	
					}
				}
				add = 100
			}
		}
		create_diplomatic_play = {
			target_country = scope:overlord_scope
			type = dp_independence
			add_war_goal = { holder = scope:overlord_scope target_country = ROOT type = annex_country }
		}
	}
}

# Cartridge Grease
raj.3 = {
	type = country_event
	placement = ROOT

	title = raj.3.t
	desc = raj.3.d
	flavor = raj.3.f

	duration = 3

	event_image = {
		video = "middleeast_battlefield_trenches"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"

	icon = "gfx/interface/icons/event_icons/event_military.dds"

	trigger = {
		NOT = { has_variable = greasy_cartridges }
		any_scope_pop = {
			is_pop_type = soldiers
			OR = {
				religion = rel:hindu
				religion = rel:sunni
				religion = rel:shiite
			}
		}
	}

	immediate = {
		set_variable = greasy_cartridges
		add_journal_entry = { type = je_avert_sepoy_mutiny }
	}

	option = {
		name = raj.3.a
		# country_military_goods_cost_mult
		add_modifier = {
			name = changed_cartridges
			months = normal_modifier_time
		}

		ai_chance = {
			base = 25
		}
	}

	option = {
		name = raj.3.b
		default_option = yes
		add_radicals = {
			pop_type = soldiers
			religion = rel:hindu
			value = large_radicals
		}
		add_radicals = {
			pop_type = soldiers
			religion = rel:sunni
			value = large_radicals
		}
		add_radicals = {
			pop_type = soldiers
			religion = rel:shiite
			value = large_radicals
		}

		ai_chance = {
			base = 75
		}
	}
}

# Overseas Service
raj.4 = {
	type = country_event
	placement = ROOT

	title = raj.4.t
	desc = raj.4.d
	flavor = raj.4.f

	duration = 3

	event_image = {
		video = "middleeast_battlefield_trenches"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"

	icon = "gfx/interface/icons/event_icons/event_military.dds"

	trigger = {
		NOT = { has_variable = kala_pani_event }
		is_at_war = yes
		any_scope_pop = {
			is_pop_type = soldiers
			religion = rel:hindu
		}
	}

	immediate = {
		set_variable = {
			name = kala_pani_event
		}
		rel:hindu = { save_scope_as = hindu_pop }
	}

	option = {
		name = raj.4.a
		ig:ig_armed_forces = {
			add_modifier = {
				name = hindu_overseas_exemption
				months = normal_modifier_time
			}
		}
		if = {
			limit = {
				exists = c:GBR
				is_subject_of = c:GBR
			}
			change_relations = {
				country = c:GBR
				value = -20
			}
		}

		ai_chance = {
			base = 10
			modifier = { # If the EIC is quite unstable, the AI shouldn't rock the boat.
				trigger = {
					has_journal_entry = je_uneasy_raj
					je:je_uneasy_raj ?= { 
						OR = {
							"scripted_bar_progress(sepoy_mutiny_progress_bar_bengal)" < uneasy_raj_stability_medium_upper_bound
							"scripted_bar_progress(sepoy_mutiny_progress_bar_bombay)" < uneasy_raj_stability_medium_upper_bound
							"scripted_bar_progress(sepoy_mutiny_progress_bar_madras)" < uneasy_raj_stability_medium_upper_bound
						}
					}
				}
				add = 20
			}
			modifier = {
				trigger = {
					has_journal_entry = je_uneasy_raj
					je:je_uneasy_raj ?= { 
						OR = {
							"scripted_bar_progress(sepoy_mutiny_progress_bar_bengal)" < uneasy_raj_stability_medium_lower_bound
							"scripted_bar_progress(sepoy_mutiny_progress_bar_bombay)" < uneasy_raj_stability_medium_lower_bound
							"scripted_bar_progress(sepoy_mutiny_progress_bar_madras)" < uneasy_raj_stability_medium_lower_bound
						}
					}
				}
				add = 40
			}
		}
	}

	option = {
		name = raj.4.b
		default_option = yes
		add_radicals = {
			pop_type = officers
			religion = rel:hindu
			value = small_radicals
		}
		add_radicals = {
			pop_type = soldiers
			religion = rel:hindu
			value = small_radicals
		}

		custom_tooltip = {
			text = sepoy_mutiny_progress_from_events_tt
			set_variable = { 
				name = bengal_progress_from_events_var_add_5 
				value = -1
				months = normal_modifier_time
			}
			set_variable = { 
				name = bombay_progress_from_events_var_add_5
				value = -1
				months = normal_modifier_time
			}
			set_variable = { 
				name = madras_progress_from_events_var_add_5
				value = -1
				months = normal_modifier_time
			}
		}

		ai_chance = {
			base = 90
			modifier = { # If the EIC is quite unstable, the AI shouldn't rock the boat.
				trigger = {
					has_journal_entry = je_uneasy_raj
					je:je_uneasy_raj ?= { 
						OR = {
							"scripted_bar_progress(sepoy_mutiny_progress_bar_bengal)" < uneasy_raj_stability_medium_upper_bound
							"scripted_bar_progress(sepoy_mutiny_progress_bar_bombay)" < uneasy_raj_stability_medium_upper_bound
							"scripted_bar_progress(sepoy_mutiny_progress_bar_madras)" < uneasy_raj_stability_medium_upper_bound
						}
					}
				}
				add = -30
			}
			modifier = {
				trigger = {
					has_journal_entry = je_uneasy_raj
					je:je_uneasy_raj ?= { 
						OR = {
							"scripted_bar_progress(sepoy_mutiny_progress_bar_bengal)" < uneasy_raj_stability_medium_lower_bound
							"scripted_bar_progress(sepoy_mutiny_progress_bar_bombay)" < uneasy_raj_stability_medium_lower_bound
							"scripted_bar_progress(sepoy_mutiny_progress_bar_madras)" < uneasy_raj_stability_medium_lower_bound
						}
					}
				}
				add = -60
			}
		}
	}
}


# Suspected Conversion Project
raj.5 = {
	type = country_event
	placement = scope:missionaries_suspicion_state

	title = raj.5.t
	desc = raj.5.d
	flavor = raj.5.f

	duration = 3

	event_image = {
		video = "southamerica_christianity"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"

	icon = "gfx/interface/icons/event_icons/event_protest.dds"

	trigger = {
		NOT = { has_variable = suspected_conversions }
		any_scope_state = {
			any_scope_pop = {
				OR = {
					religion = rel:hindu
					religion = rel:sunni
					religion = rel:shiite
				}
			}
			any_scope_pop = {
				is_pop_type = clergymen
				religion = { has_discrimination_trait = christian }
			}
		}
	}

	immediate = {
		set_variable = {
			name = suspected_conversions
			years = 3
		}
		random_scope_state = {
			limit = {
				any_scope_pop = {
					OR = {
						religion = rel:hindu
						religion = rel:sunni
						religion = rel:shiite
					}
				}
				any_scope_pop = {
					is_pop_type = clergymen
					religion = { has_discrimination_trait = christian }
				}
			}
			save_scope_as = missionaries_suspicion_state
			random_scope_pop = {
				limit = {
					OR = {
						religion = rel:hindu
						religion = rel:sunni
						religion = rel:shiite
					}
				}
				save_scope_as = not_suspected_missionaries_pop
			}
			random_scope_pop = {
				limit = {
					is_pop_type = clergymen
					religion = { has_discrimination_trait = christian }
				}
				religion = { save_scope_as = suspected_missionaries }
				save_scope_as = suspected_missionaries_pop
			}
		}
	}

	option = {
		name = raj.5.a
		scope:missionaries_suspicion_state = {
			# state_conversion_mult
			add_modifier = {
				name = promised_no_proselytization
				months = long_modifier_time
			}
		}	
		if = {
			limit = {
				AND = {
					c:BIC ?= this
					ig:ig_devout = {
						leader = {
		        			has_ideology = ideology:ideology_traditionalist_minoritarian
		        		}
					}
				}		
			}
			ig:ig_devout = {
				add_modifier = {
					name = promised_no_missionaries
					months = normal_modifier_time
				}
			}
		}
		scope:missionaries_suspicion_state = {
			add_radicals_in_state = {
				religion = scope:suspected_missionaries_pop.religion
				value = medium_radicals
			}
		}

		ai_chance = {
			base = 75
			modifier = { # If the EIC is quite unstable, the AI shouldn't rock the boat.
				trigger = {
					has_journal_entry = je_uneasy_raj
					je:je_uneasy_raj ?= { 
						OR = {
							"scripted_bar_progress(sepoy_mutiny_progress_bar_bengal)" < uneasy_raj_stability_medium_upper_bound
							"scripted_bar_progress(sepoy_mutiny_progress_bar_bombay)" < uneasy_raj_stability_medium_upper_bound
							"scripted_bar_progress(sepoy_mutiny_progress_bar_madras)" < uneasy_raj_stability_medium_upper_bound
						}
					}
				}
				add = 25
			}
			modifier = {
				trigger = {
					has_journal_entry = je_uneasy_raj
					je:je_uneasy_raj ?= { 
						OR = {
							"scripted_bar_progress(sepoy_mutiny_progress_bar_bengal)" < uneasy_raj_stability_medium_lower_bound
							"scripted_bar_progress(sepoy_mutiny_progress_bar_bombay)" < uneasy_raj_stability_medium_lower_bound
							"scripted_bar_progress(sepoy_mutiny_progress_bar_madras)" < uneasy_raj_stability_medium_lower_bound
						}
					}
				}
				add = 50
			}
		}
	}

	option = {
		name = raj.5.b
		default_option = yes
		scope:missionaries_suspicion_state = {
			add_radicals_in_state = {
				religion = scope:not_suspected_missionaries_pop.religion
				value = small_radicals
			}
			add_loyalists_in_state = {
				religion = scope:suspected_missionaries_pop.religion
				value = medium_radicals
			}
		}
		if = {
			limit = {
				has_journal_entry = je_uneasy_raj
			}
			custom_tooltip = {
				text = sepoy_mutiny_progress_from_events_tt
				set_variable = { 
					name = bengal_progress_from_events_var_add_6
					value = -1
					months = normal_modifier_time
				}
				set_variable = { 
					name = bombay_progress_from_events_var_add_6
					value = -1
					months = normal_modifier_time
				}
				set_variable = { 
					name = madras_progress_from_events_var_add_6
					value = -1
					months = normal_modifier_time
				}
			}
		}

		ai_chance = {
			base = 75
			modifier = { # If the EIC is quite unstable, the AI shouldn't rock the boat.
				trigger = {
					has_journal_entry = je_uneasy_raj
					je:je_uneasy_raj ?= { 
						OR = {
							"scripted_bar_progress(sepoy_mutiny_progress_bar_bengal)" < uneasy_raj_stability_medium_upper_bound
							"scripted_bar_progress(sepoy_mutiny_progress_bar_bombay)" < uneasy_raj_stability_medium_upper_bound
							"scripted_bar_progress(sepoy_mutiny_progress_bar_madras)" < uneasy_raj_stability_medium_upper_bound
						}
					}
				}
				add = -25
			}
			modifier = {
				trigger = {
					has_journal_entry = je_uneasy_raj
					je:je_uneasy_raj ?= { 
						OR = {
							"scripted_bar_progress(sepoy_mutiny_progress_bar_bengal)" < uneasy_raj_stability_medium_lower_bound
							"scripted_bar_progress(sepoy_mutiny_progress_bar_bombay)" < uneasy_raj_stability_medium_lower_bound
							"scripted_bar_progress(sepoy_mutiny_progress_bar_madras)" < uneasy_raj_stability_medium_lower_bound
						}
					}
				}
				add = -50
			}
		}
	}
}


# Mughal Mutiny!
raj.6 = {
	type = country_event
	placement = c:MUG.capital

	title = raj.6.t
	desc = raj.6.d
	flavor = raj.6.f

	duration = 3

	event_image = {
		video = "asia_sepoy_mutiny"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"

	icon = "gfx/interface/icons/event_icons/event_protest.dds"

	immediate = {
		add_radicals = {
			religion = rel:sunni
			value = 0.05
		}
		add_radicals = {
			religion = rel:shiite
			value = 0.05
		}
		add_radicals = {
			religion = rel:hindu
			value = 0.2
		}
		
		
		
		c:BIC = {
			every_scope_state = {
				limit = {
					is_incorporated = yes
				}
				set_variable = bic_incorporated_state
			}
		}
		if = {
			limit = {
				NOT = { exists = c:MUG }
				exists = s:STATE_DELHI.region_state:BIC
			}
			create_country = {
				tag = MUG
				origin = c:BIC
				state = s:STATE_DELHI.region_state:BIC
			}
		}
		else_if = {
			limit = {
				exists = c:MUG
				exists = s:STATE_DELHI.region_state:BIC
			}
			s:STATE_DELHI.region_state:BIC = { set_state_owner = c:MUG }
		}
		else_if = {
			limit = {
				NOT = { exists = c:MUG }
			}
			random_country = {
				limit = {
					is_secessionist = yes
					any_scope_state = {
						state_region = s:STATE_DELHI
					}
				}
				change_tag = MUG
			}
		}
		if = {
			limit = { exists = s:STATE_AWADH.region_state:BIC }
			s:STATE_AWADH.region_state:BIC = { set_state_owner = c:MUG }
		}
		if = {
			limit = { exists = s:STATE_CENTRAL_INDIA.region_state:BIC }
			s:STATE_CENTRAL_INDIA.region_state:BIC = { set_state_owner = c:MUG }
		}
		if = {
			limit = { exists = s:STATE_BIHAR.region_state:BIC }
			s:STATE_BIHAR.region_state:BIC = { set_state_owner = c:MUG }
		}
		if = {
			limit = {
				NOT = {
					any_diplomatic_play = {
						any_scope_play_involved = { this = c:MUG }
						any_scope_play_involved = { this = c:BIC }
						is_diplomatic_play_type = dp_secession
					}
				}
			}
			create_diplomatic_play = {
				name = sepoy_mutiny
				type = dp_annex_war
				escalation = 80
				target_state = s:STATE_DELHI.region_state:MUG

				add_war_goal = {
					holder = c:MUG
					type = conquer_state
					target_state = s:STATE_NORTH_BENGAL.region_state:BIC
				}
				add_war_goal = {
					holder = c:MUG
					type = conquer_state
					target_state = s:STATE_PUNJAB.region_state:BIC
				}
			}
		}
		add_modifier = {
			name = weakened_by_mutiny
			months = normal_modifier_time
		}
		c:MUG = {
			add_modifier = {
				name = war_for_independence
				months = normal_modifier_time
			}
			activate_law = law_type:law_monarchy
			activate_law = law_type:law_oligarchy
			create_character = {
				first_name = "Bakht"			
				last_name = "Khan"
				historical = yes
				birth_date = 1797.3.6 # excact date unknown. 
				culture = cu:avadhi
				is_general = yes
				religion = sunni
				interest_group = ig_armed_forces
				ideology = ideology_jingoist_leader
				traits = { 
					stalwart_defender 
					experienced_artillery_commander 
				}
			}
		}
		if = {
			limit = {
				c:AWA = {
				is_subject_of = c:BIC
				}
		}
		c:AWA = {
			trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:BAS = {
				is_subject_of = c:BIC
				}
		}
		c:BAS = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:BER = {
				is_subject_of = c:BIC
				}
		}
		c:BER = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:BHO = {
				is_subject_of = c:BIC
				}
		}
		c:BHO = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:BIK = {
				is_subject_of = c:BIC
				}
		}
		c:BIK = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:BUN = {
				is_subject_of = c:BIC
				}
		}
		c:BUN = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:GWA = {
				is_subject_of = c:BIC
				}
		}
		c:GWA = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:JAI = {
				is_subject_of = c:BIC
				}
		}
		c:HYD = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:HYD = {
				is_subject_of = c:BIC
				}
		}
		c:JAI = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:IND = {
				is_subject_of = c:BIC
				}
		}
		c:IND = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:JAS = {
				is_subject_of = c:BIC
				}
		}
		c:JAS = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:JOD = {
				is_subject_of = c:BIC
				}
		}
		c:JOD = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:KUT = {
				is_subject_of = c:BIC
				}
		}
		c:KUT = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:MEW = {
				is_subject_of = c:BIC
				}
		}
		c:MEW = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:MYS = {
				is_subject_of = c:BIC
				}
		}
		c:MYS = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:NAG = {
				is_subject_of = c:BIC
				}
		}
		c:NAG = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:NEP = {
				is_subject_of = c:BIC
				}
		}
		c:NEP = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:ORI = {
				is_subject_of = c:BIC
				}
		}
		c:ORI = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:TRA = {
				is_subject_of = c:BIC
				}
		}
		c:TRA = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		
	}

	option = {
		name = raj.6.a
		default_option = yes
		add_journal_entry = { type = je_sepoy_mutiny }
		hidden_effect = {
			c:MUG = {
				create_character = {
					first_name = "Mirza_Mughal"
					last_name = "Gurkani"
					historical = yes
					birth_date = 1817.1.5 # excact date unknown. 
					culture = cu:avadhi
					is_general = yes
					religion = sunni
					interest_group = ig_landowners
					ideology = ideology_royalist
					traits = { 
						resupply_commander 
						basic_political_operator 
					}
				}
				create_character = {
					first_name = "Bahadur_Shah"
					last_name = "Gurkani"
					historical = yes
					birth_date = 1775.10.24
					culture = cu:avadhi
					ruler = yes
					religion = sunni
					noble = yes
					interest_group = ig_landowners
					ideology = ideology_royalist
					traits = { 
						reserved 
						romantic 
						expensive_tastes
					}
				}
				create_character = { # Mirza Fakhru historically died in 1856, potentially from poisoning.
					first_name = "Mirza_Fakhru"			
					last_name = "Gurkani"
					historical = yes
					birth_date = 1818.4.1 # excact date unknown. 
					culture = cu:avadhi
					heir = yes
					religion = sunni
					noble = yes
					interest_group = ig_landowners
					ideology = ideology_royalist
					traits = {
					}
				}
			}
		}
	}

	option = {
		name = raj.6.b
		trigger = {
			is_player = yes
		}
		add_journal_entry = { type = je_sepoy_mutiny }
		play_as = c:MUG
		hidden_effect = {
			c:MUG = {
				create_character = {
					first_name = "Mirza_Mughal"
					last_name = "Gurkani"
					historical = yes
					birth_date = 1817.1.5 # excact date unknown. 
					culture = cu:avadhi
					is_general = yes
					religion = sunni
					interest_group = ig_landowners
					ideology = ideology_royalist
					traits = { 
						resupply_commander 
						basic_political_operator 
					}
				}
				create_character = {
					first_name = "Bahadur_Shah"					
					last_name = "Gurkani"
					historical = yes
					birth_date = 1775.10.24
					culture = cu:avadhi
					ruler = yes
					religion = sunni
					noble = yes
					interest_group = ig_landowners
					ideology = ideology_royalist
					traits = { 
						reserved 
						romantic 
						expensive_tastes
					}
				}
				create_character = { # Mirza Fakhru historically died in 1856, potentially from poisoning.
					first_name = "Mirza_Fakhru"			
					last_name = "Gurkani"
					historical = yes
					birth_date = 1818.4.1 # excact date unknown. 
					culture = cu:avadhi
					heir = yes
					religion = sunni
					noble = yes
					interest_group = ig_landowners
					ideology = ideology_royalist
					traits = { 
					}
				}
			}
		}
	}
}

# End of the Company
raj.7 = {
	type = country_event
	placement = ROOT

	title = raj.7.t
	desc = raj.1.d
	flavor = raj.1.f

	duration = 3

	event_image = {
		video = "asia_hinduism_sikhism"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"

	icon = "gfx/interface/icons/event_icons/event_scales.dds"

	minor_left_icon = c:GBR
	minor_right_icon = c:BIC

	trigger = {
	}

	immediate = {
		c:BIC = {
			save_scope_as = company_country
		}
		c:GBR = {
			save_scope_as = british_raj_country
		}
	}

	option = {
		name = raj.7.a
		default_option = yes
		custom_tooltip = activate_british_raj
		custom_tooltip = doctrine_of_lapse_disabled
		if = {
			limit = {
			has_modifier = bic_bailout_modifier
			}
			remove_modifier = bic_bailout_modifier
		}
		show_as_tooltip = {
			c:GBR = {
				create_diplomatic_pact = {
					country = c:BIC
					type = puppet
				}
			}
			activate_law = law_type:law_appointed_bureaucrats
		}
	}
}

# End of the Company
raj.7 = {
	type = country_event
	placement = ROOT

	title = raj.7.t
	desc = raj.1.d
	flavor = raj.1.f

	duration = 3

	event_image = {
		video = "ep1_transfer_of_authority"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"

	icon = "gfx/interface/icons/event_icons/event_scales.dds"

	minor_left_icon = c:GBR
	minor_right_icon = c:BIC

	trigger = {
	}

	immediate = {
		c:BIC = {
			save_scope_as = company_country
		}
		c:GBR = {
			save_scope_as = british_raj_country
		}
	}

	option = {
		name = raj.7.a
		default_option = yes
		custom_tooltip = activate_british_raj
		custom_tooltip = doctrine_of_lapse_disabled
		if = {
			limit = {
			has_modifier = bic_bailout_modifier
			}
			remove_modifier = bic_bailout_modifier
		}
		if = {
			limit = {
				has_company = company_type:company_east_india_company
			}
			remove_company = company_type:company_east_india_company
		}
		show_as_tooltip = {
			c:GBR = {
				create_diplomatic_pact = {
					country = c:BIC
					type = colony
				}
			}
			if = {
				limit = {
					NOT = {
						has_law = law_type:law_appointed_bureaucrats
					}
				}
				activate_law = law_type:law_appointed_bureaucrats
			}
			if = {
				limit = {
					NOT = {
						has_law = law_type:law_autocracy
					}
				}
				activate_law = law_type:law_autocracy
			}
			if = {
				limit = {
					OR = {
						NOT = {
							has_law = law_type:law_hindu_caste_enforced
						}
						NOT = {
							has_law = law_type:law_hindu_caste_codified
						}
					}
				}
				activate_law = law_type:law_hindu_caste_codified
			}
		}
		# Remove exempt from service from medium loyalty vassals
		every_country = {
			limit = {
				has_variable = sepoy_mutiny_princely_state_medium_loyalty_var
			}
			if = {
				limit = {
					root = {
						has_diplomatic_pact = {
							who = prev
							type = exempt_from_service
						}
					}
				}
				root = {
					remove_diplomatic_pact = {
						country = prev
						type = exempt_from_service
					}
				}
			}
		}
	}
}

# Mutiny Leadership
raj.61 = {
	type = country_event
	placement = c:PAN.capital

	title = raj.61.t
	desc = raj.61.d
	flavor = raj.61.f

	duration = 3

	event_image = {
		video = "asia_poor_people_moving"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"

	icon = "gfx/interface/icons/event_icons/event_protest.dds"

	immediate = {
	}

	option = {
		name = raj.61.a
		default_option = yes
		c:BIC = {
		trigger_event = { id = raj.62 popup = yes }
			}
		
		ai_chance = {
			base = 75		
			
			modifier = {
				trigger = {
					c:PAN = {
					is_subject_of = c:BIC
					}
				}
				add = 100
			}	
		}
	}

	option = {
		name = raj.61.b
		c:BIC = {
		trigger_event = { id = raj.6 popup = yes }
			}
		change_relations = { 
				country = c:BIC 
				value = 30 
			}
		ai_chance = {
			base = 25
			
			modifier = {
				trigger = {
					c:BIC = {
					has_variable = meerut_rebels
					}
				}
				add = -25
			}
		}
	}
}

# Sikh Mutiny!
raj.62 = {
	type = country_event
	placement = c:PAN.capital

	title = raj.62.t
	desc = raj.62.d
	flavor = raj.62.f

	duration = 3

	event_image = {
		video = "asia_sepoy_mutiny"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"

	icon = "gfx/interface/icons/event_icons/event_protest.dds"

	immediate = {
		add_radicals = {
			religion = rel:sunni
			value = 0.05
		}
		add_radicals = {
			religion = rel:shiite
			value = 0.05
		}
		add_radicals = {
			religion = rel:hindu
			value = 0.2
		}
		
		c:PAN = {
		add_modifier = {
				name = war_for_independence
				months = normal_modifier_time
			}
		}
		
		if = {
			limit = { exists = s:STATE_DELHI.region_state:BIC }
			s:STATE_DELHI.region_state:BIC = {
			set_state_owner = c:PAN
			set_state_type = incorporated
			}
		}
		if = {
			limit = { exists = s:STATE_AWADH.region_state:BIC }
			s:STATE_AWADH.region_state:BIC = {
			set_state_owner = c:PAN
			set_state_type = incorporated
			}
		}
		#if = {
		#	limit = { exists = s:STATE_BIHAR.region_state:BIC }
		#	s:STATE_BIHAR.region_state:BIC = { set_state_owner = c:PAN }
		#}
		if = {
			limit = { exists = s:STATE_PUNJAB.region_state:BIC }
			s:STATE_PUNJAB.region_state:BIC = { set_state_owner = c:PAN }
		}
		if = {
			limit = { exists = s:STATE_PASHTUNISTAN.region_state:BIC }
			s:STATE_PASHTUNISTAN.region_state:BIC = { set_state_owner = c:PAN }
		}
		if = {
			limit = { exists = s:STATE_KASHMIR.region_state:BIC }
			s:STATE_KASHMIR.region_state:BIC = { set_state_owner = c:PAN }
		}
		
		c:BIC = {
			every_scope_state = {
				limit = {
					is_incorporated = yes
				}
				set_variable = bic_incorporated_state
			}
		}
		
		
			
		if = {
			limit = {

				c:PAN = {
				is_subject_of = root
				}
			}
			create_diplomatic_play = {
				name = sepoy_mutiny
				type = dp_return_state
				escalation = 80
				target_state = s:STATE_DELHI.region_state:PAN
				add_war_goal = {
					holder = root
					type = annex_country
					target_country = c:PAN
				}								
				add_war_goal = {
					holder = c:PAN
					type = conquer_state
					target_state = s:STATE_BIHAR.region_state:BIC
				}
			}
		}
		else_if = {
			limit = {

				c:PAN = {
				NOT = {
				is_subject_of = root
					}
				}
			}
			create_diplomatic_play = {
				name = sepoy_mutiny
				type = dp_conquer_state
				escalation = 80
				target_state = s:STATE_DELHI.region_state:PAN
				add_war_goal = {
					holder = c:BIC
					type = conquer_state
					target_state = s:STATE_AWADH.region_state:PAN
				}
				add_war_goal = {
					holder = c:PAN
					type = conquer_state
					target_state = s:STATE_BIHAR.region_state:BIC
				}
			}
		}
		
		add_modifier = {
			name = weakened_by_mutiny
			months = normal_modifier_time
		}
		if = {
			limit = {
				c:AWA = {
				is_subject_of = c:BIC
				}
		}
		c:AWA = {
			trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:BAS = {
				is_subject_of = c:BIC
				}
		}
		c:BAS = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:BER = {
				is_subject_of = c:BIC
				}
		}
		c:BER = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:BHO = {
				is_subject_of = c:BIC
				}
		}
		c:BHO = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:BIK = {
				is_subject_of = c:BIC
				}
		}
		c:BIK = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:BUN = {
				is_subject_of = c:BIC
				}
		}
		c:BUN = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:GWA = {
				is_subject_of = c:BIC
				}
		}
		c:GWA = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:JAI = {
				is_subject_of = c:BIC
				}
		}
		c:HYD = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:HYD = {
				is_subject_of = c:BIC
				}
		}
		c:JAI = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:IND = {
				is_subject_of = c:BIC
				}
		}
		c:IND = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:JAS = {
				is_subject_of = c:BIC
				}
		}
		c:JAS = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:JOD = {
				is_subject_of = c:BIC
				}
		}
		c:JOD = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:KUT = {
				is_subject_of = c:BIC
				}
		}
		c:KUT = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:MEW = {
				is_subject_of = c:BIC
				}
		}
		c:MEW = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:MYS = {
				is_subject_of = c:BIC
				}
		}
		c:MYS = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:NAG = {
				is_subject_of = c:BIC
				}
		}
		c:NAG = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:NEP = {
				is_subject_of = c:BIC
				}
		}
		c:NEP = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:ORI = {
				is_subject_of = c:BIC
				}
		}
		c:ORI = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:TRA = {
				is_subject_of = c:BIC
				}
		}
		c:TRA = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		
	}

	option = {
		name = raj.62.a
		default_option = yes
		add_journal_entry = { type = je_sepoy_mutiny }
	}

	option = {
		name = raj.62.b
		trigger = {
			is_player = yes
		}
		add_journal_entry = { type = je_sepoy_mutiny }
		play_as = c:PAN
	}
}

# To Mutiny, or not to Mutiny
raj.63 = {
	type = country_event
	placement = root

	title = raj.63.t
	desc = raj.63.d
	flavor = raj.63.f

	duration = 3

	event_image = {
		video = "asia_sepoy_mutiny"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"

	icon = "gfx/interface/icons/event_icons/event_protest.dds"

	immediate = {
	c:BIC = { 
			save_scope_as = bic_sec_scope
		}
		
			random_diplomatic_play = {
			limit = {
				any_scope_play_involved = {
					
						this = c:BIC
					
				}
				target = {
					c:MUG ?= this
				}
			}
			save_scope_as = mug_diplo_play
			}
			random_diplomatic_play = {
			limit = {
				any_scope_play_involved = {
					
						this = c:BIC
					
				}
				target = {
					c:PAN ?= this
				}
			}
			save_scope_as = pan_diplo_play
			}
			random_diplomatic_play = {
			limit = {
				any_scope_play_involved = {
					
						this = c:BIC
					
				}
				target = {
					c:MAR ?= this
				}
			}
			save_scope_as = mar_diplo_play
			}
		}
	

	option = {
		name = raj.63.a
		default_option = yes
		custom_tooltip = sepoy_freedom_tt
		
		add_modifier = {
			name = war_for_independence
			}
		
		change_relations = {
			country = c:BIC
			value = -30
		}
			
		
		if = {
			limit = {
			
			scope:mug_diplo_play = {
				target = {
					c:MUG ?= this
				}
			}
		}
		change_relations = {
			country = c:MUG
			value = 50
		}
		scope:mug_diplo_play = {
				remove_initiator_backers = { root }
			}
		scope:mug_diplo_play = {
				add_target_backers = { root }
			}
		}
		if = {
			limit = {
			
			scope:pan_diplo_play = {
				target = {
					c:PAN ?= this
				}
			}
		}
		change_relations = {
			country = c:PAN
			value = 50
		}
		scope:pan_diplo_play = {
				remove_initiator_backers = { root }
			}
		scope:pan_diplo_play = {
				add_target_backers = { root }
			}
		}
		if = {
			limit = {
			
			scope:mar_diplo_play = {
				target = {
					c:MAR ?= this
				}
			}
		}
		change_relations = {
			country = c:MAR
			value = 50
		}
		scope:mar_diplo_play = {
				remove_initiator_backers = { root }
			}
		scope:mar_diplo_play = {
				add_target_backers = { root }
			}
		}
		
		ai_chance = {
			base = 1		
			
			modifier = {
				trigger = {
					c:BIC = {
					relations:root < relations_threshold:cordial
					}
				}
				add = 5
			}
			modifier = {
				trigger = {
					c:BIC = {
					has_variable = punjab_attacking_var
					}
				}
				add = 5
			}
		}
	}

	option = {
		name = raj.63.b
		
		change_relations = { 
				country = c:BIC 
				value = 30 
			}
			
			ai_chance = {
			base = 1		
			
			modifier = {
				trigger = {
					c:BIC = {
					relations:root >= relations_threshold:cordial
					}
				}
				add = 5
			}
			modifier = {
				trigger = {
					c:BIC = {
					relations:root >= relations_threshold:amicable
					}
				}
				add = 5
			}
				modifier = {
				trigger = {
					c:BIC = {
						has_diplomatic_pact = {
						who = root
						type = dominion
						}
					}
				}
				add = 5
			}
				modifier = {
				trigger = {
					c:BIC = {
						has_diplomatic_pact = {
						who = root
						type = protectorate
						}
					}
				}
				add = 10
			}
		}
	}
}

# Follow into War
raj.64 = {
	type = country_event
	placement = root

	title = raj.64.t
	desc = raj.64.d
	flavor = raj.64.f

	duration = 3

	event_image = {
		video = "asia_sepoy_mutiny"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"

	icon = "gfx/interface/icons/event_icons/event_protest.dds"

	immediate = {
	c:BIC = { 
			save_scope_as = bic_sec_scope
		}
	}

	option = {
		name = raj.64.a
		default_option = yes
		if = {
			limit = {
				c:AWA = {
				is_subject_of = c:BIC
				}
				c:AWA = root
		}
		c:AWA = {
		add_modifier = {
			name = war_for_independence
			}
		}
		scope:bic_sec_scope = {		
			create_diplomatic_play = {
				name = secession
				target_country = c:AWA
				type = dp_me_secession
				escalation = 80
				add_war_goal = {
					holder = c:AWA
					type = independence
					}
				}
			}
		}
		if = {
			limit = {
				c:BAS = {
				is_subject_of = c:BIC
				}
				c:BAS = root
		}
		c:BAS = {
		add_modifier = {
			name = war_for_independence
			}
		}
		scope:bic_sec_scope = {		
			create_diplomatic_play = {
				name = secession
				target_country = c:BAS
				type = dp_me_secession
				escalation = 80
				add_war_goal = {
					holder = c:BAS
					type = independence
					}
				}
			}
		}
		if = {
			limit = {
				c:BER = {
				is_subject_of = c:BIC
				}
				c:BER = root
		}
		c:BER = {
		add_modifier = {
			name = war_for_independence
			}
		}
		scope:bic_sec_scope = {		
			create_diplomatic_play = {
				name = secession
				target_country = c:BER
				type = dp_me_secession
				escalation = 80
				add_war_goal = {
					holder = c:BER
					type = independence
					}
				}
			}
		}
		if = {
			limit = {
				c:BHO = {
				is_subject_of = c:BIC
				}
				c:BHO = root
		}
		c:BHO = {
		add_modifier = {
			name = war_for_independence
			}
		}
		scope:bic_sec_scope = {		
			create_diplomatic_play = {
				name = secession
				target_country = c:BHO
				type = dp_me_secession
				escalation = 80
				add_war_goal = {
					holder = c:BHO
					type = independence
					}
				}
			}
		}
		if = {
			limit = {
				c:BIK = {
				is_subject_of = c:BIC
				}
				c:BIK = root
		}
		c:BIK = {
		add_modifier = {
			name = war_for_independence
			}
		}
		scope:bic_sec_scope = {		
			create_diplomatic_play = {
				name = secession
				target_country = c:BIK
				type = dp_me_secession
				escalation = 80
				add_war_goal = {
					holder = c:BIK
					type = independence
					}
				}
			}
		}
		if = {
			limit = {
				c:BUN = {
				is_subject_of = c:BIC
				}
				c:BUN = root
		}
		c:BUN = {
		add_modifier = {
			name = war_for_independence
			}
		}
		scope:bic_sec_scope = {		
			create_diplomatic_play = {
				name = secession
				target_country = c:BUN
				type = dp_me_secession
				escalation = 80
				add_war_goal = {
					holder = c:BUN
					type = independence
					}
				}
			}
		}
		if = {
			limit = {
				c:GWA = {
				is_subject_of = c:BIC
				}
				c:GWA = root
		}
		c:GWA = {
		add_modifier = {
			name = war_for_independence
			}
		}
		scope:bic_sec_scope = {		
			create_diplomatic_play = {
				name = secession
				target_country = c:GWA
				type = dp_me_secession
				escalation = 80
				add_war_goal = {
					holder = c:GWA
					type = independence
					}
				}
			}
		}
		if = {
			limit = {
				c:HYD = {
				is_subject_of = c:BIC
				}
				c:HYD = root
		}
		c:HYD = {
		add_modifier = {
			name = war_for_independence
			}
		}
		scope:bic_sec_scope = {		
			create_diplomatic_play = {
				name = secession
				target_country = c:HYD
				type = dp_me_secession
				escalation = 80
				add_war_goal = {
					holder = c:HYD
					type = independence
					}
				}
			}
		}
		if = {
			limit = {
				c:JAI = {
				is_subject_of = c:BIC
				}
				c:JAI = root
		}
		c:JAI = {
		add_modifier = {
			name = war_for_independence
			}
		}
		scope:bic_sec_scope = {		
			create_diplomatic_play = {
				name = secession
				target_country = c:JAI
				type = dp_me_secession
				escalation = 80
				add_war_goal = {
					holder = c:JAI
					type = independence
					}
				}
			}
		}
		if = {
			limit = {
				c:IND = {
				is_subject_of = c:BIC
				}
				c:IND = root
		}
		c:IND = {
		add_modifier = {
			name = war_for_independence
			}
		}
		scope:bic_sec_scope = {		
			create_diplomatic_play = {
				name = secession
				target_country = c:IND
				type = dp_me_secession
				escalation = 80
				add_war_goal = {
					holder = c:IND
					type = independence
					}
				}
			}
		}
		if = {
			limit = {
				c:JAS = {
				is_subject_of = c:BIC
				}
				c:JAS = root
		}
		c:JAS = {
		add_modifier = {
			name = war_for_independence
			}
		}
		scope:bic_sec_scope = {		
			create_diplomatic_play = {
				name = secession
				target_country = c:JAS
				type = dp_me_secession
				escalation = 80
				add_war_goal = {
					holder = c:JAS
					type = independence
					}
				}
			}
		}
		if = {
			limit = {
				c:JOD = {
				is_subject_of = c:BIC
				}
				c:JOD = root
		}
		c:JOD = {
		add_modifier = {
			name = war_for_independence
			}
		}
		scope:bic_sec_scope = {		
			create_diplomatic_play = {
				name = secession
				target_country = c:JOD
				type = dp_me_secession
				escalation = 80
				add_war_goal = {
					holder = c:JOD
					type = independence
					}
				}
			}
		}
		if = {
			limit = {
				c:KUT = {
				is_subject_of = c:BIC
				}
				c:KUT = root
		}
		c:KUT = {
		add_modifier = {
			name = war_for_independence
			}
		}
		scope:bic_sec_scope = {		
			create_diplomatic_play = {
				name = secession
				target_country = c:KUT
				type = dp_me_secession
				escalation = 80
				add_war_goal = {
					holder = c:KUT
					type = independence
					}
				}
			}
		}
		if = {
			limit = {
				c:MEW = {
				is_subject_of = c:BIC
				}
				c:MEW = root
		}
		c:MEW = {
		add_modifier = {
			name = war_for_independence
			}
		}
		scope:bic_sec_scope = {		
			create_diplomatic_play = {
				name = secession
				target_country = c:MEW
				type = dp_me_secession
				escalation = 80
				add_war_goal = {
					holder = c:MEW
					type = independence
					}
				}
			}
		}
		if = {
			limit = {
				c:MYS = {
				is_subject_of = c:BIC
				}
				c:MYS = root
		}
		c:MYS = {
		add_modifier = {
			name = war_for_independence
			}
		}
		scope:bic_sec_scope = {		
			create_diplomatic_play = {
				name = secession
				target_country = c:MYS
				type = dp_me_secession
				escalation = 80
				add_war_goal = {
					holder = c:MYS
					type = independence
					}
				}
			}
		}
		if = {
			limit = {
				c:NAG = {
				is_subject_of = c:BIC
				}
				c:NAG = root
		}
		c:NAG = {
		add_modifier = {
			name = war_for_independence
			}
		}
		scope:bic_sec_scope = {		
			create_diplomatic_play = {
				name = secession
				target_country = c:NAG
				type = dp_me_secession
				escalation = 80
				add_war_goal = {
					holder = c:NAG
					type = independence
					}
				}
			}
		}
		if = {
			limit = {
				c:NEP = {
				is_subject_of = c:BIC
				}
				c:NEP = root
		}
		c:NEP = {
		add_modifier = {
			name = war_for_independence
			}
		}
		scope:bic_sec_scope = {		
			create_diplomatic_play = {
				name = secession
				target_country = c:NEP
				type = dp_me_secession
				escalation = 80
				add_war_goal = {
					holder = c:NEP
					type = independence
					}
				}
			}
		}
		if = {
			limit = {
				c:ORI = {
				is_subject_of = c:BIC
				}
				c:ORI = root
		}
		c:ORI = {
		add_modifier = {
			name = war_for_independence
			}
		}
		scope:bic_sec_scope = {		
			create_diplomatic_play = {
				name = secession
				target_country = c:ORI
				type = dp_me_secession
				escalation = 80
				add_war_goal = {
					holder = c:ORI
					type = independence
					}
				}
			}
		}
		if = {
			limit = {
				c:TRA = {
				is_subject_of = c:BIC
				}
				c:TRA = root
		}
		c:TRA = {
		add_modifier = {
			name = war_for_independence
			}
		}
		scope:bic_sec_scope = {		
			create_diplomatic_play = {
				name = secession
				target_country = c:TRA
				type = dp_me_secession
				escalation = 80
				add_war_goal = {
					holder = c:TRA
					type = independence
					}
				}
			}
		}
		ai_chance = {
			base = 10		
			
			modifier = {
				trigger = {
					c:BIC = {
					relations:root < relations_threshold:cordial
					}
				}
				add = 5
			}	
		}
	}

	option = {
		name = raj.64.b
		
		change_relations = { 
				country = c:BIC 
				value = 30 
			}
			
			ai_chance = {
			base = 10		
			
			modifier = {
				trigger = {
					c:BIC = {
					relations:root >= relations_threshold:cordial
					}
				}
				add = 5
			}
			modifier = {
				trigger = {
					c:BIC = {
					relations:root >= relations_threshold:amicable
					}
				}
				add = 5
			}
				modifier = {
				trigger = {
					c:BIC = {
						has_diplomatic_pact = {
						who = root
						type = dominion
						}
					}
				}
				add = 5
			}
				modifier = {
				trigger = {
					c:BIC = {
						has_diplomatic_pact = {
						who = root
						type = protectorate
						}
					}
				}
				add = 10
			}
		}
	}
}

# Foreign Service Pay
raj.65 = {
	type = country_event
	placement = ROOT

	title = raj.65.t
	desc = raj.65.d
	flavor = raj.65.f

	duration = 3

	event_image = {
		video = "middleeast_battlefield_trenches"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"

	icon = "gfx/interface/icons/event_icons/event_military.dds"

	trigger = {
		NOT = { has_variable = foreign_service_pay }
		any_scope_pop = {
			is_pop_type = soldiers
			OR = {
				religion = rel:hindu
				religion = rel:sunni
				religion = rel:shiite
			}
		}
	}

	immediate = {
		set_variable = foreign_service_pay
	}

	option = {
		name = raj.65.a
		default_option = yes
		add_radicals = {
			pop_type = soldiers
			religion = rel:hindu
			value = large_radicals
		}
		add_radicals = {
			pop_type = soldiers
			religion = rel:sunni
			value = large_radicals
		}
		add_radicals = {
			pop_type = soldiers
			religion = rel:shiite
			value = large_radicals
		}

		ai_chance = {
			base = 60
		}
	}

	option = {
		name = raj.65.b
		
		add_modifier = {
			name = bic_foreign_pay_modifier
			multiplier = money_amount_multiplier_very_small
			years = 5
		}
		
		add_radicals = {
			pop_type = soldiers
			religion = rel:hindu
			strata = poor
			value = medium_radicals
		}
		add_radicals = {
			pop_type = soldiers
			religion = rel:sunni
			strata = poor
			value = medium_radicals
		}
		add_radicals = {
			pop_type = soldiers
			religion = rel:shiite
			strata = poor
			value = medium_radicals
		}

		ai_chance = {
			base = 30
		}
	}
	option = {
		name = raj.65.c
		
		

		if = {
			limit = {
			has_modifier = sepoy_modifier
			}
			remove_modifier = sepoy_modifier
			ig:ig_landowners = {
				add_modifier = {
			name = more_upset_officers_modifier
			years = 5
				}
			}
		}
		else = {
		add_modifier = {
			name = bic_more_foreign_pay_modifier
			multiplier = money_amount_multiplier_small
			years = 5
			}
			ig:ig_landowners = {
		add_modifier = {
			name = upset_officers_modifier
			years = 5
			}
		}
	}
		ai_chance = {
			base = 10
		}
	}
}

# Promotion then Retirement
raj.66 = {
	type = country_event
	placement = ROOT

	title = raj.66.t
	desc = raj.66.d
	flavor = raj.66.f

	duration = 3

	event_image = {
		video = "middleeast_battlefield_trenches"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"

	icon = "gfx/interface/icons/event_icons/event_military.dds"

	trigger = {
		NOT = { has_variable = promotion_then_retirement }
		any_scope_pop = {
			is_pop_type = soldiers
			OR = {
				religion = rel:hindu
				religion = rel:sunni
				religion = rel:shiite
			}
		}
	}

	immediate = {
		set_variable = promotion_then_retirement
	}

	option = {
		name = raj.66.a
		default_option = yes
		add_radicals = {
			pop_type = soldiers
			religion = rel:hindu
			value = large_radicals
		}
		add_radicals = {
			pop_type = soldiers
			religion = rel:sunni
			value = large_radicals
		}
		add_radicals = {
			pop_type = soldiers
			religion = rel:shiite
			value = large_radicals
		}

		ai_chance = {
			base = 60
		}
	}

	option = {
		name = raj.66.b
		
		add_radicals = {
			pop_type = soldiers
			religion = rel:hindu
			value = small_radicals
		}
		add_radicals = {
			pop_type = soldiers
			religion = rel:sunni
			value = small_radicals
		}
		add_radicals = {
			pop_type = soldiers
			religion = rel:shiite
			value = small_radicals
		}
		add_radicals = {
			pop_type = officers
			religion = rel:christian
			value = small_radicals
		}

		ai_chance = {
			base = 30
		}
	}
	option = {
		name = raj.66.c
		
		ig:ig_landowners = {
		add_modifier = {
			name = competitive_jobs_modifier
			years = 5
			}
		}

		ai_chance = {
			base = 10
		}
	}
}

# Replacing Religion
raj.67 = {
	type = country_event
	placement = ROOT

	title = raj.67.t
	desc = raj.67.d
	flavor = raj.67.f

	duration = 3

	event_image = {
		video = "asia_politician_parliament_motion"
	}
	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"

	icon = "gfx/interface/icons/event_icons/event_military.dds"

	trigger = {
		NOT = { has_variable = replacing_religion }
		any_scope_building = {
				is_building_type = building_university
			}
	}

	immediate = {
		set_variable = replacing_religion
	}

	option = {
		name = raj.67.a
		default_option = yes
		add_loyalists = {
			pop_type = academics
			value = large_radicals
		}
		add_radicals = {
			religion = rel:hindu
			value = medium_radicals
		}

		ai_chance = {
			base = 60
		}
	}

	option = {
		name = raj.67.b
		add_radicals = {
			religion = rel:hindu
			value = small_radicals
		}

		ai_chance = {
			base = 20
		}
	}
	option = {
		name = raj.67.c
		
		ig:ig_intelligentsia = {
		add_modifier = {
			name = indian_educators_modifier
			years = 5
			}
		}
		
		ai_chance = {
			base = 10
		}
	}
}


# Hindu Widows' Remarriage Act"
raj.68 = {
	type = country_event
	placement = ROOT

	title = raj.68.t
	desc = raj.68.d
	flavor = raj.68.f

	duration = 3

	event_image = {
		video = "asia_politician_parliament_motion"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"

	icon = "gfx/interface/icons/event_icons/event_military.dds"

	trigger = {
		NOT = { has_variable = remarriage_act }
	}

	immediate = {
		set_variable = remarriage_act
	}

	option = {
		name = raj.68.a
		
		add_modifier = {
		name = no_remarriage_act_modifier
		years = 5
		}
		
		add_radicals = {
			pop_type = academics
			value = medium_radicals
		}

		ai_chance = {
			base = 25
		}
	}

	option = {
		name = raj.68.b
		default_option = yes
		add_radicals = {
			religion = rel:hindu
			value = small_radicals
		}
		add_loyalists = {
			pop_type = academics
			value = medium_radicals
		}

		ai_chance = {
			base = 75
		}
	}
}

#At Artillery Point
raj.69 = {
	type = country_event
	placement = ROOT

	title = raj.69.t
	desc = raj.69.d
	flavor = raj.69.f

	duration = 3

	event_image = {
		video = "middleeast_battlefield_trenches"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"

	icon = "gfx/interface/icons/event_icons/event_military.dds"

	trigger = {
		NOT = { has_variable = artillery_point }
		any_scope_pop = {
			is_pop_type = soldiers
			OR = {
				religion = rel:hindu
				religion = rel:sunni
				religion = rel:shiite
			}
		}
	}

	immediate = {
		set_variable = artillery_point
	}

	option = {
		name = raj.69.a
		
		add_radicals = {
			pop_type = soldiers
			religion = rel:hindu
			value = large_radicals
		}
		add_radicals = {
			pop_type = soldiers
			religion = rel:sunni
			value = large_radicals
		}
		add_radicals = {
			pop_type = soldiers
			religion = rel:shiite
			value = large_radicals
		}

		ai_chance = {
			base = 25
		}
	}

	option = {
		name = raj.69.b
		default_option = yes
				
		add_modifier = {
			name = bic_cancel_parade_modifier
			years = 5
		}

		ai_chance = {
			base = 75
		}
	}
}

# Mangal Pandey
raj.70 = {
	type = country_event
	placement = ROOT

	title = raj.70.t
	desc = raj.70.d
	flavor = raj.70.f

	duration = 3

	event_image = {
		video = "unspecific_military_parade"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"

	icon = "gfx/interface/icons/event_icons/event_military.dds"

	trigger = {
		NOT = { has_variable = mangal_pandey }
		any_scope_pop = {
			is_pop_type = soldiers
			OR = {
				religion = rel:hindu
				religion = rel:sunni
				religion = rel:shiite
			}
		}
	}

	immediate = {
		set_variable = mangal_pandey
	}

	option = {
		name = raj.70.a
		default_option = yes
		add_radicals = {
			pop_type = soldiers
			religion = rel:hindu
			value = very_large_radicals
		}
		add_radicals = {
			pop_type = soldiers
			religion = rel:sunni
			value = very_large_radicals
		}
		add_radicals = {
			pop_type = soldiers
			religion = rel:shiite
			value = very_large_radicals
		}
		

		ai_chance = {
			base = 75
		}
	}

	option = {
		name = raj.70.b
		add_radicals = {
			pop_type = soldiers
			religion = rel:hindu
			value = small_radicals
		}
		add_radicals = {
			pop_type = soldiers
			religion = rel:sunni
			value = small_radicals
		}
		add_radicals = {
			pop_type = soldiers
			religion = rel:shiite
			value = small_radicals
		}
		
		ig:ig_landowners = {
		add_modifier = {
			name = not_harsh_enough_modifier
			years = 5
			}
		}

		ai_chance = {
			base = 25
		}
	}
}


# Arson
raj.71 = {
	type = country_event
	placement = ROOT

	title = raj.71.t
	desc = raj.71.d
	flavor = raj.71.f

	duration = 3

	event_image = {
		video = "unspecific_fire"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"

	icon = "gfx/interface/icons/event_icons/event_military.dds"

	trigger = {
		NOT = { has_variable = bic_arson }
		any_scope_pop = {
			is_pop_type = soldiers
			OR = {
				religion = rel:hindu
				religion = rel:sunni
				religion = rel:shiite
			}
		}
	}

	immediate = {
		set_variable = bic_arson
	}

	option = {
		name = raj.71.a
		default_option = yes
		add_loyalists = {
			pop_type = soldiers
			religion = rel:hindu
			value = small_radicals
		}
		add_loyalists = {
			pop_type = soldiers
			religion = rel:sunni
			value = small_radicals
		}
		add_loyalists = {
			pop_type = soldiers
			religion = rel:shiite
			value = small_radicals
		}
		
		random_scope_state = {
			limit = {
				state_region = s:STATE_DELHI
			}
			state_region = {
				add_devastation = 10 
			}
		}
		ai_chance = {
			base = 75
		}
	}

	option = {
		name = raj.71.b
		
		random_scope_state = {
			limit = {
				state_region = s:STATE_DELHI
			}
			state_region = {
				add_devastation = 50 
			}
		}

		ai_chance = {
			base = 25
		}
	}
}

# Drill or Jail
raj.72 = {
	type = country_event
	placement = ROOT

	title = raj.72.t
	desc = raj.72.d
	flavor = raj.72.f

	duration = 3

	event_image = {
		video = "middleeast_battlefield_trenches"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"

	icon = "gfx/interface/icons/event_icons/event_military.dds"

	trigger = {
		has_variable = foreign_service_pay
		has_variable = promotion_then_retirement
		has_variable = replacing_religion
		has_variable = remarriage_act
		has_variable = artillery_point
		has_variable = mangal_pandey
		has_variable = bic_arson
		has_variable = drill_or_jail		
		any_scope_pop = {
			is_pop_type = soldiers
			OR = {
				religion = rel:sunni
				religion = rel:shiite
			}
		}
	}

	immediate = {
		set_variable = drill_or_jail
	}

	option = {
		name = raj.72.a
		default_option = yes

		add_radicals = {
			pop_type = soldiers
			religion = rel:sunni
			value = very_large_radicals
		}
		add_radicals = {
			pop_type = soldiers
			religion = rel:shiite
			value = very_large_radicals
		}
		trigger_event = { id = sepoy_mutiny_events.3 popup = yes }
		
		ai_chance = {
			base = 75
		}
	}

	option = {
		name = raj.72.b
		
		ig:ig_landowners = {
		add_modifier = {
			name = fired_officer_modifier
			years = 5
			}
		}
		
		ai_chance = {
			base = 25
		}
	}
}

# Meerut rebels (next event offers allegiance to the Mughal Emperor)
raj.73 = {
	type = country_event
	placement = ROOT

	title = raj.73.t
	desc = raj.73.d
	flavor = raj.73.f

	duration = 3

	event_image = {
		video = "unspecific_vandalized_storefront"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"

	icon = "gfx/interface/icons/event_icons/event_military.dds"


	immediate = {
		set_variable = meerut_rebels
	}

	option = {
		name = raj.73.a
		default_option = yes
		
		trigger_event = { id = raj.6 popup = yes }

		ai_chance = {
			base = 20
		}
	}

	option = {
		name = raj.73.b
		
		trigger_event = { id = raj.74 popup = yes }

		ai_chance = {
			base = 5
		}
	}
	
	option = {
		name = raj.73.c
		trigger = {
		exists = c:PAN
		}
		c:PAN = {
		trigger_event = { id = raj.61 popup = yes }
		}

		ai_chance = {
			base = 10
		}
	}
	
	option = {
		name = raj.73.e
		trigger = {
		exists = c:PAN
		is_player = yes
		}
		
		play_as = c:PAN
		c:PAN = {
		trigger_event = { id = raj.61 popup = yes }
		}
		ai_chance = {
			base = 0
		}
	}
}

# Maratha Mutiny!
raj.74 = {
	type = country_event
	placement = c:MUG.capital

	title = raj.74.t
	desc = raj.74.d
	flavor = raj.74.f

	duration = 3

	event_image = {
		video = "asia_sepoy_mutiny"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"

	icon = "gfx/interface/icons/event_icons/event_protest.dds"

	immediate = {
		add_radicals = {
			religion = rel:sunni
			value = 0.05
		}
		add_radicals = {
			religion = rel:shiite
			value = 0.05
		}
		add_radicals = {
			religion = rel:hindu
			value = 0.2
		}
		
		
		
		c:BIC = {
			every_scope_state = {
				limit = {
					is_incorporated = yes
				}
				set_variable = bic_incorporated_state
			}
		}
		if = {
			limit = {
				NOT = { exists = c:MAR }
				exists = s:STATE_BOMBAY.region_state:BIC
			}
			create_country = {
				tag = MAR
				origin = c:BIC
				state = s:STATE_BOMBAY.region_state:BIC
			}
		}
		
		if = {
			limit = { exists = s:STATE_AWADH.region_state:BIC }
			s:STATE_AWADH.region_state:BIC = {
			set_state_owner = c:MAR
			set_state_type = incorporated
			}
		}
		if = {
			limit = { exists = s:STATE_CENTRAL_INDIA.region_state:BIC }
			s:STATE_CENTRAL_INDIA.region_state:BIC = {
			set_state_owner = c:MAR
			set_state_type = incorporated
			}
		}
		if = {
			limit = { exists = s:STATE_GUJARAT.region_state:BIC }
			s:STATE_GUJARAT.region_state:BIC = {
			set_state_owner = c:MAR
			set_state_type = incorporated
			}
		}		
		
			create_diplomatic_play = {
				name = sepoy_mutiny
				type = dp_annex_war
				escalation = 80
				target_state = s:STATE_BOMBAY.region_state:MAR

				add_war_goal = {
					holder = c:MAR
					type = conquer_state
					target_state = s:STATE_DELHI.region_state:BIC
				}
				add_war_goal = {
					holder = c:MAR
					type = conquer_state
					target_state = s:STATE_BIHAR.region_state:BIC
				}
			}
		
		add_modifier = {
			name = weakened_by_mutiny
			months = normal_modifier_time
		}
		c:MAR = {
			add_modifier = {
				name = war_for_independence
				months = normal_modifier_time
			}
			activate_law = law_type:law_monarchy
			activate_law = law_type:law_oligarchy
			create_character = {
				is_general = yes
				interest_group = ig_armed_forces
				ideology = ideology_jingoist_leader
				traits = { 
					stalwart_defender 
				}
			}
		}
		if = {
			limit = {
				c:AWA = {
				is_subject_of = c:BIC
				}
		}
		c:AWA = {
			trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:BAS = {
				is_subject_of = c:BIC
				}
		}
		c:BAS = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:BER = {
				is_subject_of = c:BIC
				}
		}
		c:BER = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:BHO = {
				is_subject_of = c:BIC
				}
		}
		c:BHO = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:BIK = {
				is_subject_of = c:BIC
				}
		}
		c:BIK = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:BUN = {
				is_subject_of = c:BIC
				}
		}
		c:BUN = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:GWA = {
				is_subject_of = c:BIC
				}
		}
		c:GWA = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:JAI = {
				is_subject_of = c:BIC
				}
		}
		c:HYD = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:HYD = {
				is_subject_of = c:BIC
				}
		}
		c:JAI = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:IND = {
				is_subject_of = c:BIC
				}
		}
		c:IND = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:JAS = {
				is_subject_of = c:BIC
				}
		}
		c:JAS = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:JOD = {
				is_subject_of = c:BIC
				}
		}
		c:JOD = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:KUT = {
				is_subject_of = c:BIC
				}
		}
		c:KUT = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:MEW = {
				is_subject_of = c:BIC
				}
		}
		c:MEW = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:MYS = {
				is_subject_of = c:BIC
				}
		}
		c:MYS = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:NAG = {
				is_subject_of = c:BIC
				}
		}
		c:NAG = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:NEP = {
				is_subject_of = c:BIC
				}
		}
		c:NEP = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:ORI = {
				is_subject_of = c:BIC
				}
		}
		c:ORI = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
		if = {
			limit = {
				c:TRA = {
				is_subject_of = c:BIC
				}
		}
		c:TRA = {
		trigger_event = { id = raj.63 popup = yes }
			}
		}
	}

	option = {
		name = raj.74.a
		default_option = yes
		add_journal_entry = { type = je_sepoy_mutiny }
		
	}

	option = {
		name = raj.74.b
		trigger = {
			is_player = yes
		}
		add_journal_entry = { type = je_sepoy_mutiny }
		play_as = c:MAR
		
	}
}