###########################
# Nepalese Events
###########################
# By esmaerla and IratePirate
###########################

add_namespace = nepal

country_event = { # Intro to Nepal
	id = nepal.1
	immediate = { log = "[GetDateText]: [Root.GetName]: event nepal.1" }
	title = nepal.1.t
	desc = nepal.1.d
	picture = GFX_report_event_nepal_village
	is_triggered_only = yes
	
	#minor_flavor = yes
	trigger = {
		is_ai = no
		NOT = { has_global_flag = player_dislikes_colonial_flavour_flag }
	}

	option = {
		name = nepal.1.a
		add_stability = 0.01
	}
}

country_event = {
	id = nepal.5 # original KR/KX event
	immediate = { log = "[GetDateText]: [Root.GetName]: event nepal.5" }
	title = nepal.5.t # Passing of Tribhuvan Shah
	desc = nepal.5.d # After a period of illness, the king of Nepal, Tribhuvan, passed away this very morning. He is succeeded by his son, Mahendra.

	fire_only_once = yes
	is_triggered_only = yes

	option = {
		name = nepal.5.a # May he rest in peace
		create_country_leader = {
			name = "Mahendra"
			picture = "gfx/leaders/NEP/Portrait_Nepal_Mahendra.png"
			expire = "1.1.1"
			ideology = neo_feudalism_subtype
		}
		create_country_leader = {
			name = "Mahendra"
			picture = "gfx/leaders/NEP/Portrait_Nepal_Mahendra.png"
			expire = "1.1.1"
			ideology = oligarchy_subtype
		}
		create_country_leader = {
			name = "Mahendra"
			picture = "gfx/leaders/NEP/Portrait_Nepal_Mahendra.png"
			expire = "1.1.1"
			ideology = progressive_conservatism_subtype
		}
		add_stability = -0.02
	}
}

country_event = { 
	id = nepal.6 # original KR/KX event
	immediate = { log = "[GetDateText]: [Root.GetName]: event nepal.6" }
	title = nepal.6.t
	desc = nepal.6.d
	picture = GFX_report_event_NEP_chandra_shumsher_sons
	is_triggered_only = yes
	fire_only_once = yes
	trigger = { NOT = { has_global_flag = IMPERIUM_ON } }
	option = {
		name = nepal.6.a
		add_popularity = {
			ideology = authoritarian_democrat
			popularity = 0.2
		}
	}

	option = {
		name = nepal.6.b
		set_politics = {
			ruling_party = paternal_autocrat
			elections_allowed = no
		}
		add_popularity = {
			ideology = paternal_autocrat
			popularity = 0.2
		}
		swap_ideas = {
			remove_idea = NEP_Juddha_Shumsher_Rana_hog_ade
			add_idea = NEP_Mohan_Shumsher_Rana_hog_pau
		}
	}

	option = {
		name = nepal.6.c
		set_politics = {
			ruling_party = social_conservative
			elections_allowed = no
		}
		add_popularity = {
			ideology = social_conservative
			popularity = 0.2
		}
		swap_ideas = {
			remove_idea = NEP_Juddha_Shumsher_Rana_hog_ade
			add_idea = NEP_Padma_Shumsher_Rana_hog_sco
		}
	}
}

# Peace events
country_event = {
	id = nepal.10 # original KR/KX event
	title = nepal.10.t
	desc = nepal.10.d
	picture = GFX_report_event_RAJ_army

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event nepal.10 option nepal.10.a"
		name = nepal.10.a #Yes, let's end this
		if = {
			limit = {
				is_indian_tag = yes
			}
			814 = {
				remove_claim_by = ROOT
				remove_core_of = ROOT
				if = {
					limit = { is_owned_by = ROOT }
					transfer_state_to = FROM
				}
			}
			887 = {
				remove_claim_by = ROOT
				remove_core_of = ROOT
				if = {
					limit = { is_owned_by = ROOT }
					transfer_state_to = FROM
				}
			}
		}
		else = {
			DEH = {
				if = {
					limit = { is_ally_with = ROOT }
					country_event = nepal.11
				}
			}
			PRF = {
				if = {
					limit = { is_ally_with = ROOT }
					country_event = nepal.11
				}
			}
			BHC = {
				if = {
					limit = { is_ally_with = ROOT }
					country_event = nepal.11
				}
			}
			FROM = { white_peace_with_ROOT = yes }
		}
	}
	option = {
		log = "[GetLogInfo]: event nepal.10 option nepal.10.b"
		name = nepal.10.b #No, we will fight them all!
		ai_chance = { base = 0 }
		add_war_support = -0.10
	}
}

country_event = {
	id = nepal.11 # original KR/KX event
	title = nepal.11.t
	desc = nepal.11.d
	picture = GFX_report_event_RAJ_army

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event nepal.11 option nepal.11.a"
		name = nepal.11.a
		add_political_power = -50
		814 = {
			remove_claim_by = ROOT
			remove_core_of = ROOT
			if = {
				limit = { is_owned_by = ROOT }
				transfer_state_to = FROM.FROM
			}
		}
		887 = {
			remove_claim_by = ROOT
			remove_core_of = ROOT
			if = {
				limit = { is_owned_by = ROOT }
				transfer_state_to = FROM.FROM
			}
		}
	}
}

country_event = { #Stalemate in War with Nepal
	id = nepal.20 # original KR/KX event
	title = nepal.20.t
	picture = GFX_report_event_RAJ_army

	desc = {
		text = nepal.20.d.claims
		trigger = { has_event_target = claimant }
	}
	desc = {
		text = nepal.20.d.noclaims
		trigger = { NOT = { has_event_target = claimant } }
	}

	is_triggered_only = yes

	immediate = {
		if = {
			limit = {
				NEP = {
					any_owned_state = {
						is_claim_or_core_of_ROOT = yes
						is_controlled_by_ROOT_or_ally = yes
					}
				}
			}
			save_event_target_as = claimant
		}
	}

	option = {
		log = "[GetLogInfo]: event nepal.20 option nepal.20.a"
		name = nepal.20.a #Yes, let's end this now
		trigger = {
			OR = {
			is_faction_leader = yes
			is_in_faction = no
			}
		}
		NEP = { country_event = nepal.22 }
	}

	option = {
		log = "[GetLogInfo]: event nepal.20 option nepal.20.b"
		name = nepal.20.b #We will ask our faction leader to negotiate a peace
		trigger = {
			AND = {
			is_in_faction = yes
			is_faction_leader = no
			}
		}
		set_temp_variable = { target = faction_leader }
		var:target = { country_event = nepal.21 }
	}

	option = {
		log = "[GetLogInfo]: event nepal.20 option nepal.20.c"
		name = nepal.20.c #No! We will take Kathmandu or die trying
		ai_chance = { base = 0 }
		add_war_support = -0.10
		add_stability = -0.10
	}
}

country_event = { #Peace with Nepal?
	id = nepal.21 # original KR/KX event
	title = nepal.21.t
	picture = GFX_report_event_RAJ_army

	desc = {
		text = nepal.21.d.claims
		trigger = { has_event_target = claimant }
	}
	desc = {
		text = nepal.21.d.noclaims
		trigger = { NOT = { has_event_target = claimant } }
	}

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event nepal.21 option nepal.21.a"
		name = nepal.21.a #Then let's end this now
		NEP = { country_event = nepal.22 }
	}

	option = {
		log = "[GetLogInfo]: event nepal.21 option nepal.21.b"
		name = nepal.21.b #The war doesn't end until Kathmandu falls
		ai_chance = { base = 0 }
		add_war_support = -0.05
		add_stability = -0.05
		FROM = {
			add_war_support = -0.10
			add_stability = -0.10
		}
	}
}

country_event = { #Peace with India?
	id = nepal.22
	title = nepal.22.t
	picture = GFX_report_event_RAJ_army

	desc = {
		text = nepal.22.d.claims
		trigger = { has_event_target = claimant }
	}
	desc = {
		text = nepal.22.d.noclaims
		trigger = { NOT = { has_event_target = claimant } }
	}

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event nepal.22 option nepal.22.a"
		name = nepal.22.a #Yes, let's end this now
		if = {
			limit = { has_event_target = claimant }
			add_political_power = -100
			every_owned_state = {
				limit = {
					OR = {
						is_core_of = event_target:claimant
						is_claimed_by = event_target:claimant
					}
				}
				if = {
					limit = { is_claimed_by = ROOT }
					remove_claim_by = ROOT
				}
				if = {
					limit = { is_core_of = ROOT }
					remove_core_of = ROOT
				}
				transfer_state_to = event_target:claimant
			}
		}
		else = {
			add_political_power = 50
		}
		FROM = { white_peace_with_ROOT = yes }
	}

	option = {
		log = "[GetLogInfo]: event nepal.22 option nepal.22.b"
		name = nepal.22.b #Absolutely not!
		ai_chance = { base = 0 }
		add_war_support = -0.10
		add_stability = -0.10
	}
}