﻿###########################
# RAJ TFV events Events
###########################

add_namespace = tfv_raj

#RAF funding
country_event = {
	id = tfv_raj.1
	title = tfv_raj.1.t	
	desc = tfv_raj.1.desc	#
	picture = GFX_report_event_fighters
	
	is_triggered_only = yes
	immediate = {
		set_variable = {fighter_buy_amount = 100}
	}

	option = { 
		name = tfv_raj.1.a
		ai_chance = {
			base = 100
		}
		ENG = { country_event = { id = tfv_raj.2 } }
	}
	option = { 
		name = tfv_raj.1.b
		trigger = {
			OR = {
				AND = {
					has_tech = early_fighter
					NOT = { has_tech = fighter1}
				}

				AND = {
					has_tech = iw_small_airframe
					NOT = { has_tech = basic_small_airframe }
				}
			}
		}

		if = {
			limit = {
				NOT = { has_dlc = "By Blood Alone" }
			}
			add_equipment_to_stockpile = { type = fighter_equipment_0.000 amount = var:fighter_buy_amount producer = RAJ }
		}
		else = {
			bba_get_fighter_ENG_effect = yes	
		}

		clear_variable = fighter_buy_amount
	}
	option = { 
		name = tfv_raj.1.b
		trigger = {
			OR = {
				AND = {
					has_tech = fighter1
					NOT = { has_tech = fighter2 }
				}
				AND = {
					has_tech = basic_small_airframe
					NOT = { has_tech = improved_small_airframe }
				}
			}
		}
		
		if = {
			limit = {
				NOT = { has_dlc = "By Blood Alone" }
			}
			add_equipment_to_stockpile = { type = fighter_equipment_10.000 amount = var:fighter_buy_amount producer = RAJ }
		}
		else = {
			bba_get_fighter_ENG_effect = yes	
		}

		clear_variable = fighter_buy_amount
	}
	option = { 
		name = tfv_raj.1.b
		trigger = {
			OR = {
				AND = {
					has_tech = fighter2
					NOT = { has_tech = fighter3 }
				}
				AND = {
					has_tech = improved_small_airframe
					NOT  = { has_tech = advanced_small_airframe }
				}
			}
		}
		if = {	
			limit = {
				NOT = { has_dlc = "By Blood Alone" }
			}
			add_equipment_to_stockpile = { type = fighter_equipment_20.000 amount = var:fighter_buy_amount producer = RAJ }
		}
		else = {
			bba_get_fighter_ENG_effect = yes
		}
		clear_variable = fighter_buy_amount
	}
	option = { 
		name = tfv_raj.1.b
		trigger = {
			OR = {
				has_tech = fighter3
				has_tech = advanced_small_airframe
			}
		}
		if = {	
			limit = {
				NOT = { has_dlc = "By Blood Alone" }
			}
			add_equipment_to_stockpile = { type = fighter_equipment_30.000 amount = var:fighter_buy_amount producer = RAJ }
		}
		else = {
			bba_get_fighter_ENG_effect = yes
		}

		clear_variable = fighter_buy_amount
	}

}

country_event = {
	id = tfv_raj.2
	title = tfv_raj.2.t	
	desc = tfv_raj.2.desc	#
	picture = GFX_report_event_fighters
	
	is_triggered_only = yes
	immediate = {
		set_variable = {fighter_buy_amount = 100}
	}

	option = { 
		name = tfv_raj.2.a
		trigger = {
			OR = {
				AND = {
					has_tech = early_fighter
					NOT = { has_tech = fighter1}
				}

				AND = {
					has_tech = iw_small_airframe
					NOT = { has_tech = basic_small_airframe }
				}
			}
		}
		
		if = {
			limit = {
				NOT = { has_dlc = "By Blood Alone" }
			}
			add_equipment_to_stockpile = { type = fighter_equipment_0.000 amount = var:fighter_buy_amount producer = ENG }
		}
		else = {
			bba_get_fighter_ENG_effect = yes	
		}

		clear_variable = fighter_buy_amount
	}
	option = { 
		name = tfv_raj.2.a
		trigger = {
			OR = {
				AND = {
					has_tech = fighter1
					NOT = { has_tech = fighter2 }
				}
				AND = {
					has_tech = basic_small_airframe
					NOT = { has_tech = improved_small_airframe }
				}
			}
		}
		if = {
			limit = {
				NOT = { has_dlc = "By Blood Alone" }
			}
			add_equipment_to_stockpile = { type = fighter_equipment_10.000 amount = var:fighter_buy_amount producer = ENG }
		}
		else = {
			bba_get_fighter_ENG_effect = yes	
		}

		clear_variable = fighter_buy_amount
	}
	option = { 
		name = tfv_raj.2.a
		trigger = {
			OR = {
				AND = {
					has_tech = fighter2
					NOT = { has_tech = fighter3 }
				}
				AND = {
					has_tech = improved_small_airframe
					NOT  = { has_tech = advanced_small_airframe }
				}
			}
		}
		if = {	
			limit = {
				NOT = { has_dlc = "By Blood Alone" }
			}
			add_equipment_to_stockpile = { type = fighter_equipment_20.000 amount = var:fighter_buy_amount producer = ENG }
		}
		else = {
			bba_get_fighter_ENG_effect = yes
		}
		clear_variable = fighter_buy_amount
	}
	option = { 
		name = tfv_raj.2.a
		trigger = {
			OR = {
				has_tech = fighter3
				has_tech = advanced_small_airframe
			}
		}
		if = {	
			limit = {
				NOT = { has_dlc = "By Blood Alone" }
			}
			add_equipment_to_stockpile = { type = fighter_equipment_30.000 amount = var:fighter_buy_amount producer = ENG }
		}
		else = {
			bba_get_fighter_ENG_effect = yes
		}

		clear_variable = fighter_buy_amount
	}

}

#RAJ gets famine - Trigger/randomness event
country_event = {
	id = tfv_raj.20
	
	hidden = yes
	
	immediate = {
		country_event = { id = tfv_raj.21 days = 300 }
	}

	trigger = {
		#compare_autonomy_state < autonomy_dominion
		has_capitulated = no
		NOT = { surrender_progress > 0.5 }
		original_tag = RAJ
		has_idea = RAJ_risk_of_famine
		has_war = yes		
	}

	mean_time_to_happen = { days = 150 }

}

#RAJ gets famine - Actual event
country_event = {
	id = tfv_raj.21
	title = tfv_raj.21.t
	desc = tfv_raj.21.desc	#
	picture = GFX_report_event_indian_famine
	
	is_triggered_only = yes

	fire_only_once = yes

	immediate = {
		hidden_effect = {
			remove_ideas = RAJ_risk_of_famine
			add_timed_idea = { idea = RAJ_famine days = 365 }
			news_event = { id = news.272 }
			news_event = { id = news.273 days = 365 }
		}
	}
			
	trigger = {
		#compare_autonomy_state < autonomy_dominion
		has_capitulated = no
		NOT = { surrender_progress > 0.5 }
		original_tag = RAJ
		has_idea = RAJ_risk_of_famine
	}

	option = {
		name = tfv_raj.21.a
		effect_tooltip = {
			remove_ideas = RAJ_risk_of_famine
			add_timed_idea = { idea = RAJ_famine days = 365 }
		}
	}
}

#RAJ asks help from Soviet to break free from ENG
#Event for SOV
country_event = {
	id = tfv_raj.30
	title = tfv_raj.30.t
	desc = tfv_raj.30.desc
	picture = GFX_report_event_bose
	
	is_triggered_only = yes

	fire_only_once = yes

	immediate = {
		RAJ = {
			OVERLORD = {
				save_event_target_as = Britain
			}
		}
	}

	#Help
	option = {
		name = tfv_raj.30.a
		ai_chance = {
			base = 1
			modifier = {
				factor = 0
				SOV_can_help_against_ENG = no				
			}
			modifier = {
				factor = 2
				has_opinion = {
					target = RAJ
					value > 75
				}
				has_opinion = {
					target = ENG
					value < 0
				}
			}
			modifier = {
				factor = 2
				ROOT_will_help_RAJ = yes
			}			
			modifier = {
				factor = 2		
				communism > 0.5
			}
		}	
		set_global_flag = RAJ_seek_help_from_soviet_promised
		if = {
			limit = {
				RAJ = { NOT = { has_war_together_with = ENG } }
				NOT = { has_war_with = ENG }
			}
			ENG = { country_event = { id = tfv_raj.31 hours = 6 } }
			else = {
				#Answer event - Accept
				RAJ = { country_event = { id = tfv_raj.32 } }
			}
		}
	}

	#No
	option = {
		name = tfv_raj.30.b
		ai_chance = {
			base = 2
			modifier = {
				add = 4
				ROOT_will_help_RAJ = no
			}
		}
		#Answer event - Reject
		RAJ = { country_event = { id = tfv_raj.33 } }
	}
}

#RAJ asks help from Soviet to break free from ENG
#Event for ENG. Let them go or not
country_event = {
	id = tfv_raj.31
	title = tfv_raj.31.t
	desc = tfv_raj.31.desc

	picture = GFX_report_event_aid_pact
	
	is_triggered_only = yes
	fire_only_once = yes

	#Let them go free
	option = {
		name = tfv_raj.31.a
		ai_chance = {
			base = 0
		}
		effect_tooltip = {
			set_autonomy = {
				target = RAJ
				autonomy_state = autonomy_free				
			}
			SOV = { add_to_faction = RAJ }			
		}
		RAJ = { country_event = { id = tfv_raj.34 hours = 6 } }
		hidden_effect = { news_event = { id = news.281 hours = 12 } }
	}

	#Exploit them some more
	option = {
		name = tfv_raj.31.b
		ai_chance = {
			base = 1
		}
		set_global_flag = RAJ_seek_help_from_soviet_ENG_reject
		RAJ = { country_event = { id = tfv_raj.32 } } #Answer event
	}
}

#RAJ asks help from Soviet to break free from ENG
#Event for RAJ. SOV supports us
country_event = {
	id = tfv_raj.32
	title = tfv_raj.32.t
	desc = {
		text = tfv_raj.32.desc_SOV_helps
		trigger = {
			has_global_flag = RAJ_seek_help_from_soviet_promised
			NOT = { has_global_flag = RAJ_seek_help_from_soviet_ENG_reject }
		}
	}
	desc = {
		text = tfv_raj.32.desc_SOV_helps_ENG_reject
		trigger = {
			has_global_flag = RAJ_seek_help_from_soviet_promised
			has_global_flag = RAJ_seek_help_from_soviet_ENG_reject
		}
	}
	
	picture = GFX_report_event_stalin_meeting
	
	is_triggered_only = yes

	fire_only_once = yes

	option = {
		name = tfv_raj.32.a
	}

}

#RAJ asks help from Soviet to break free from ENG
#Event for RAJ. Soviet rejects.
country_event = {
	id = tfv_raj.33
	title = tfv_raj.33.t
	desc = tfv_raj.33.desc
	picture = GFX_report_event_stalin_02
	
	is_triggered_only = yes

	fire_only_once = yes

	option = {
		name = tfv_raj.33.a
	}

}

#RAJ asks help from Soviet to break free from ENG
#Event for RAJ. The Brits have decided to let us go.
country_event = {
	id = tfv_raj.34
	title = tfv_raj.34.t
	desc = tfv_raj.34.desc
	picture = GFX_report_event_partition_of_india
	
	is_triggered_only = yes

	fire_only_once = yes

	option = {
		name = tfv_raj.34.a
		diplomatic_relation = {
			country = ENG
			relation = puppet
			active = no
		}
		SOV = { add_to_faction = RAJ }
		add_popularity = {
			ideology = communism
			popularity = 0.35
		}
		set_politics = {
			ruling_party = communism
			elections_allowed = no
		}
		hidden_effect = {
			news_event = { id = news.281 hours = 6 }
		}
	}

}

#RAJ asks help from Germany to break free from ENG
#Event for GER
country_event = {
	id = tfv_raj.40
	title = tfv_raj.40.t
	desc = tfv_raj.40.desc
	picture = GFX_report_event_bose_meeting
	
	is_triggered_only = yes

	fire_only_once = yes

	immediate = {
		RAJ = {
			OVERLORD = {
				save_event_target_as = Britain
			}
		}
	}

	#Help
	option = {
		name = tfv_raj.40.a
		ai_chance = {
			base = 1
			modifier = {
				factor = 0
				GER_can_help_against_ENG = no				
			}
			modifier = {
				factor = 2
				has_opinion = {
					target = RAJ
					value > 75
				}
				has_opinion = {
					target = ENG
					value < 0
				}
			}
			modifier = {
				factor = 2
				ROOT_will_help_RAJ = yes
			}			
			modifier = {
				factor = 2		
				fascism > 0.5
			}
		}	
		set_global_flag = RAJ_seek_help_from_germany_promised
		if = {
			limit = {
				RAJ = { NOT = { has_war_together_with = ENG } }
				NOT = { has_war_with = ENG }
			}
			ENG = { country_event = { id = tfv_raj.41 hours = 6 } }
			else = {
				#Answer event - Accept
				RAJ = { country_event = { id = tfv_raj.42 } }
			}
		}
	}

	#No
	option = {
		name = tfv_raj.40.b
		ai_chance = {
			base = 1
			modifier = {
				add = 4
				ROOT_will_help_RAJ = no
			}
		}
		#Answer event - Reject
		RAJ = { country_event = { id = tfv_raj.43 } }
	}
}

#RAJ asks help from Germany to break free from ENG
#Event for ENG. Let them go or not
country_event = {
	id = tfv_raj.41
	title = tfv_raj.41.t
	desc = tfv_raj.41.desc

	picture = GFX_report_event_german_politician_speech
	
	is_triggered_only = yes
	fire_only_once = yes

	#Let them go free
	option = {
		name = tfv_raj.41.a
		ai_chance = {
			base = 0
		}
		effect_tooltip = {
			set_autonomy = {
				target = RAJ
				autonomy_state = autonomy_free
			}
			GER = { add_to_faction = RAJ }
		}
		RAJ = { country_event = { id = tfv_raj.44 hours = 6 } }
		hidden_effect = { news_event = { id = news.280 hours = 12 } }
	}

	#Exploit them some more
	option = {
		name = tfv_raj.41.b
		ai_chance = {
			base = 1
		}
		set_global_flag = RAJ_seek_help_from_germany_ENG_reject
		RAJ = { country_event = { id = tfv_raj.42 } } #Answer event
	}
}

#RAJ asks help from Germany to break free from ENG
#Event for RAJ. GER supports us
country_event = {
	id = tfv_raj.42
	title = tfv_raj.42.t
	desc = {
		text = tfv_raj.42.desc_GER_helps
		trigger = {
			has_global_flag = RAJ_seek_help_from_germany_promised
			NOT = { has_global_flag = RAJ_seek_help_from_germany_ENG_reject }
		}
	}
	desc = {
		text = tfv_raj.42.desc_GER_helps_ENG_reject
		trigger = {
			has_global_flag = RAJ_seek_help_from_germany_ENG_reject
			has_global_flag = RAJ_seek_help_from_germany_promised
		}
	}
	
	picture = GFX_report_event_bose_meeting
	
	is_triggered_only = yes

	fire_only_once = yes

	option = {
		name = tfv_raj.42.a	
	}

}

#RAJ asks help from Germany to break free from ENG
#Event for RAJ. Germany rejects.
country_event = {
	id = tfv_raj.43
	title = tfv_raj.43.t
	desc = tfv_raj.43.desc
	picture = GFX_report_event_soldiers_parade
	
	is_triggered_only = yes

	fire_only_once = yes

	option = {
		name = tfv_raj.43.a
	}

}

#RAJ asks help from Germany to break free from ENG
#Event for RAJ. The Brits have decided to let us go.
country_event = {
	id = tfv_raj.44
	title = tfv_raj.44.t
	desc = tfv_raj.44.desc
	picture = GFX_report_event_partition_of_india
	
	is_triggered_only = yes

	fire_only_once = yes

	option = {
		name = tfv_raj.44.a
		diplomatic_relation = {
			country = ENG
			relation = puppet
			active = no
		}
		GER = { add_to_faction = RAJ }
		add_popularity = {
			ideology = fascism
			popularity = 0.35
		}
		set_politics = {
			ruling_party = fascism
			elections_allowed = no
		}
		hidden_effect = {
			news_event = { id = news.280 hours = 6 }
		}
	}

}

##################################################
#RAJ_battaglione_azad_hindoustan focus completed
##################################################
country_event = {
	id = tfv_raj.201
	title = tfv_raj.201.t				# ITA receives paratrooper division from RAJ
	desc = tfv_raj.201.desc
	picture = GFX_report_event_indian_parade
	
	is_triggered_only = yes
	
	option = {
		name = tfv_raj.201.a
		
		if = {
			limit = {
				RAJ = { is_ai = yes }
			}
		
			division_template = {
				name = "Battaglione Azad Hindoustan" #Hindu paratrooper division created for Italy
				division_names_group = ITA_PAR_01
				is_locked = yes
				regiments = {
					paratrooper = { x = 0 y = 0 }
					paratrooper = { x = 0 y = 1 }
					paratrooper = { x = 0 y = 2 }

					paratrooper = { x = 1 y = 0 }
					paratrooper = { x = 1 y = 1 }
					paratrooper = { x = 1 y = 2 }
				}
			}

			random_owned_controlled_state = {
				prioritize = { 2 }
				
				custom_effect_tooltip = tfv_raj_focus_paratrooper_tt
				hidden_effect = {
					create_unit = { 
						division = "name = \"Battaglione Azad Hindoustan\" division_template = \"Battaglione Azad Hindoustan\" start_experience_factor = 1.0" 
						owner = ITA
					}
				}
			}
			
			else = {
				custom_effect_tooltip = tfv_raj_focus_paratrooper_tt
			}
		}
	}
}

##################################################
#Quit India movement resistance events
##################################################
country_event = {
	id = tfv_raj.210
	title = tfv_raj.210.t
	desc = tfv_raj.210.desc
	picture = GFX_report_event_generic_ruins
	
	is_triggered_only = yes
	
	trigger = {
		has_completed_focus = RAJ_quit_india_movement
		is_puppet = yes
	}
	
	option = {
		name = tfv_raj.210.a
		
		random_owned_controlled_state = {
			prioritize = { 431 } #West Bengal
			
			limit = {
				industrial_complex > 0
			}
			damage_building = {
				type = industrial_complex
				damage = 0.6
			}
		}
		
		hidden_effect = { 
			country_event = { id = tfv_raj.211 days = 20 random_days = 40 }
		}
	}
}

country_event = {
	id = tfv_raj.211
	title = tfv_raj.211.t
	desc = tfv_raj.211.desc
	picture = GFX_report_event_generic_ruins
	
	is_triggered_only = yes
	
	trigger = {
		has_completed_focus = RAJ_quit_india_movement
		is_puppet = yes
	}
	
	option = {
		name = tfv_raj.211.a
		
		random_owned_controlled_state = {
			prioritize = { 426 } #Orissa
			
			limit = {
				arms_factory > 0
			}
			damage_building = {
				type = arms_factory
				damage = 0.7
			}
		}
		
		hidden_effect = { 
			country_event = { id = tfv_raj.212 days = 20 random_days = 40 }
		}
	}
}

country_event = {
	id = tfv_raj.212
	title = tfv_raj.212.t
	desc = tfv_raj.212.desc
	picture = GFX_report_event_generic_ruins
	
	is_triggered_only = yes
	
	trigger = {
		has_completed_focus = RAJ_quit_india_movement
		is_puppet = yes
	}
	
	option = {
		name = tfv_raj.212.a
		
		random_owned_controlled_state = {
			prioritize = { 429 } #Bombay
			
			limit = {
				industrial_complex > 0
			}
			damage_building = {
				type = industrial_complex
				damage = 0.4
			}
		}
	}
}