namespace = FEE_Deccan_Events

# A New Capital
country_event = {
	id = FEE_Deccan_Events.1
	title = FEE_Deccan_Events.1.T
	desc = FEE_Deccan_Events.1.D
	picture = CITY_VIEW_eventPicture

	fire_only_once = yes

	goto = 544

	trigger = {
		is_or_was_tag = { tag = AHM }
		is_year = 1494
		owns = 544
	}

	mean_time_to_happen = {
		months = 12
	}

	option = {
		name = FEE_Deccan_Events.1.OPT1

		ai_chance = {
			factor = 0.5
		}

		if = {
			limit = {
				NOT = { capital = 544 }
			}
			set_capital = 544
		}
		544 = {
			add_permanent_province_modifier = {
				name = fee_dec_a_new_capital
				duration = -1
			}
		}
	}

	option = {
		name = FEE_Deccan_Events.1.OPT2

		ai_chance = {
			factor = 0.25
		}

		add_treasury = -25
		if = {
			limit = {
				NOT = { capital = 544 }
			}
			set_capital = 544
		}
		544 = {
			add_random_development = 3
		}
	}

	option = {
		name = FEE_Deccan_Events.1.OPT3

		trigger = {
			NOT = { capital = 544 }
		}

		ai_chance = {
			factor = 0.25
		}

		add_adm_power = 50
	}
}

# Public Water Network
country_event = {
	id = FEE_Deccan_Events.2
	title = FEE_Deccan_Events.2.T
	desc = FEE_Deccan_Events.2.D
	picture = CITY_DEVELOPMENT_eventPicture

	fire_only_once = yes

	goto = 569

	trigger = {
		569 = {
			owned_by = ROOT
			development = 15
			num_of_buildings_in_province = 4
		}
	}

	mean_time_to_happen = {
		months = 12
	}

	option = {
		name = FEE_Deccan_Events.2.OPT1

		ai_chance = {
			factor = 0.5
			modifier = {
				factor = 0.5
				NOT = { years_of_income = 0.5 }
			}
		}

		add_years_of_income = -0.5
		569 = {
			add_base_tax = 2
			add_permanent_province_modifier = {
				name = fee_dec_public_waterworks_of_bijapur
				duration = -1
			}
		}
	}

	option = {
		name = FEE_Deccan_Events.2.OPT2

		ai_chance = {
			factor = 0.35
			modifier = {
				factor = 0.5
				NOT = { years_of_income = 0.25 }
			}
		}

		add_years_of_income = -0.25
		569 = {
			add_permanent_province_modifier = {
				name = fee_dec_mediocre_public_waterworks_of_bijapur
				duration = -1
			}
		}
	}

	option = {
		name = FEE_Deccan_Events.2.OPT3

		ai_chance = {
			factor = 0.15
		}

		add_years_of_income = 0.1
		569 = {
			add_base_tax = -2
			add_permanent_province_modifier = {
				name = fee_dec_not_enough_water
				duration = 3650
			}
			particularist_rebels = 3
		}
	}
}

# The Hundred Bazaars
country_event = {
	id = FEE_Deccan_Events.3
	title = FEE_Deccan_Events.3.T
	desc = FEE_Deccan_Events.3.D
	picture = MERCHANTS_TALKING_eventPicture

	fire_only_once = yes

	goto = 569

	trigger = {
		DIP = 4
		569 = {
			owned_by = ROOT
			has_trade_building_trigger = yes
			has_production_building_trigger = yes
			base_production = 7
		}
	}

	mean_time_to_happen = {
		months = 12
	}

	immediate = {
		hidden_effect = {
			set_global_flag = fee_the_hundred_bazaars_event
		}
	}

	option = {
		name = FEE_Deccan_Events.3.OPT1

		ai_chance = {
			factor = 0.9
			modifier = {
				factor = 0.5
				NOT = { years_of_income = 1 }
			}
		}

		add_years_of_income = -1
		add_country_modifier = {
			name = fee_dec_bijapuri_mint
			duration = 18250
		}
		569 = {
			add_or_upgrade_trade_building = yes
			add_permanent_province_modifier = {
				name = fee_dec_hundred_bazaars
				duration = -1
			}
		}
	}

	option = {
		name = FEE_Deccan_Events.3.OPT2

		ai_chance = {
			factor = 0.1
		}

		add_years_of_income = 0.25
		add_corruption = 3
		add_country_modifier = {
			name = fee_dec_unrestricted_free_market
			duration = 18250
		}
		569 = {
			add_permanent_province_modifier = {
				name = fee_dec_unregulated_trade
				duration = -1
			}
		}
	}

	option = {
		name = FEE_Deccan_Events.3.OPT3

		highlight = yes
		trigger = {
			is_or_was_tag = { tag = MUG }
		}

		ai_chance = {
			factor = 1
			modifier = {
				factor = 0.5
				NOT = { years_of_income = 1.25 }
			}
		}

		set_country_flag = fee_dec_southern_capital
		add_years_of_income = -1.25
		add_country_modifier = {
			name = fee_dec_bijapuri_mint
			duration = 18250
		}
		if = {
			limit = {
				NOT = { capital = 569 }
			}
			set_capital = 569
		}
		569 = {
			add_or_upgrade_trade_building = yes
			add_permanent_province_modifier = {
				name = fee_dec_hundred_bazaars
				duration = -1
			}
			add_permanent_province_modifier = {
				name = fee_dec_new_imperial_capital
				duration = -1
				hidden = yes
			}
			deccan_region = {
				limit = {
					owned_by = ROOT
				}
				add_permanent_province_modifier = {
					name = fee_dec_new_imperial_capital_region
					duration = -1
				}
			}
			coromandel_region = {
				limit = {
					owned_by = ROOT
				}
				add_permanent_province_modifier = {
					name = fee_dec_new_imperial_capital_region
					duration = -1
				}
			}
		}
	}

	option = {
		name = FEE_Deccan_Events.3.OPT4

		highlight = yes
		trigger = {
			is_or_was_tag = { tag = MUG }
		}

		ai_chance = {
			factor = 1
			modifier = {
				factor = 0.5
				NOT = { years_of_income = 1.25 }
			}
		}

		add_years_of_income = -1.25
		add_country_modifier = {
			name = fee_dec_bijapuri_mint
			duration = 18250
		}
		569 = {
			add_or_upgrade_trade_building = yes
			add_permanent_province_modifier = {
				name = fee_dec_hundred_bazaars
				duration = -1
			}
			add_permanent_province_modifier = {
				name = fee_dec_winter_capital_of_the_mughals
				duration = -1
			}
			deccan_region = {
				limit = {
					owned_by = ROOT
				}
				add_permanent_province_modifier = {
					name = fee_dec_winter_capital_of_the_mughals_region
					duration = -1
				}
			}
		}
	}
}

# Cultural Center for the Deccan
country_event = {
	id = FEE_Deccan_Events.4
	title = FEE_Deccan_Events.4.T
	desc = FEE_Deccan_Events.4.D
	picture = GOOD_WITH_MONARCH_eventPicture

	fire_only_once = yes

	goto = 569

	trigger = {
		OR = {
			is_or_was_tag = { tag = MUG }
			is_or_was_tag = { tag = BIJ }
		}
		has_global_flag = fee_the_hundred_bazaars_event
		is_year = 1600
		religion_group = muslim
		owns = 569
		569 = {
			OR = {
				is_capital_of = ROOT
				has_province_modifier = fee_dec_winter_capital_of_the_mughals
			}
			OR = {
				NOT = { has_dlc = "Mandate of Heaven" }
				is_prosperous = yes
			}
		}
	}

	mean_time_to_happen = {
		months = 12
	}

	option = {
		name = FEE_Deccan_Events.4.OPT1

		569 = {
			add_permanent_province_modifier = {
				name = fee_dec_deccani_cultural_center
				duration = -1
			}
		}
	}
}

# The Darush-Shafa
country_event = {
	id = FEE_Deccan_Events.5
	title = FEE_Deccan_Events.5.T
	desc = FEE_Deccan_Events.5.D
	picture = COLONIZATION_eventPicture

	fire_only_once = yes

	trigger = {
		owns = 569
		religion_group = muslim
		is_year = 1540
		OR = {
			full_idea_group = innovativeness_ideas
			full_idea_group = infrastructure_ideas
			AND = {
				has_dlc = "Rule Britannia"
				innovativeness = 100
			}
		}
	}

	mean_time_to_happen = {
		months = 12
	}

	option = {
		name = FEE_Deccan_Events.5.OPT1

		ai_chance = {
			factor = 0.5
			modifier = {
				factor = 0.5
				NOT = { years_of_income = 0.5 }
			}
		}

		add_years_of_income = -0.5
		add_innovativeness_or_monarch_power = {
			amount = 5
			adm = 50
			dip = 50
			mil = 50
		}
		add_country_modifier = {
			name = fee_dec_hospitals_of_bijapur
			duration = -1
		}
	}

	option = {
		name = FEE_Deccan_Events.5.OPT2

		ai_chance = {
			factor = 0.5
		}

		add_prestige_or_monarch_power = { amount = 3 }
		add_years_of_income = 0.2
	}
}

# Ratirahasya - How to please a King
country_event = {
	id = FEE_Deccan_Events.6
	title = FEE_Deccan_Events.6.T
	desc = FEE_Deccan_Events.6.D
	picture = COLONIZATION_eventPicture

	trigger = {
		capital_scope = {
			region = deccan_region
		}
		DIP = 3
		has_idea_group = court_ideas
		has_regency = no
		NOT = { has_ruler_flag = fee_has_had_ratirahasya }
	}

	mean_time_to_happen = {
		months = 12
	}

	immediate = {
		hidden_effect = {
			set_ruler_flag = fee_has_had_ratirahasya
		}
	}

	option = {
		name = FEE_Deccan_Events.6.OPT1

		ai_chance = { factor = 0.5 }

		add_adm_power = -100
		if = {
			limit = {
				uses_piety = yes
			}
			add_piety = -0.15
			add_prestige_or_monarch_power = { amount = 25 }
			add_ruler_modifier = {
				name = fee_dec_institutionalized_ratirahasya
				duration = -1
			}
		}
		else_if = {
			limit = {
				religion = hinduism
			}
			add_prestige_or_monarch_power = { amount = 25 }
			add_ruler_modifier = {
				name = fee_dec_blessings_of_kamadeva
				duration = -1
			}
		}
		else = {
			add_adm_power = -25
			add_prestige = -10
			add_ruler_modifier = {
				name = fee_dec_ratirahasya_in_the_court
				duration = -1
			}
		}
	}

	option = {
		name = FEE_Deccan_Events.6.OPT2

		ai_chance = { factor = 0.5 }

		if = {
			limit = {
				uses_piety = yes
			}
			add_piety = 0.15
			add_prestige = -10
			add_ruler_modifier = {
				name = fee_dec_throw_this_smut_out
				duration = -1
			}
		}
		else_if = {
			limit = {
				religion = hinduism
			}
			add_prestige = -10
			add_adm_power = 100
			add_ruler_modifier = {
				name = fee_dec_sensualism_censored
				duration = -1
			}
		}
		else = {
			add_adm_power = 25
			add_prestige_or_monarch_power = { amount = 25 }
			add_ruler_modifier = {
				name = fee_dec_hindu_rituals_censored
				duration = -1
			}
		}
	}
}

# Expand Golkonda Fort
country_event = {
	id = FEE_Deccan_Events.7
	title = FEE_Deccan_Events.7.T
	desc = FEE_Deccan_Events.7.D
	picture = FORT_eventPicture

	fire_only_once = yes

	trigger = {
		owns = 542
		is_year = 1507
		NOT = { is_year = 1590 }
	}

	mean_time_to_happen = {
		months = 60
	}

	option = {
		name = FEE_Deccan_Events.7.OPT1

		add_treasury = -25
		542 = {
			add_base_manpower = 1
			add_permanent_province_modifier = {
				name = fee_dec_expansion_golkonda_fort
				duration = -1
			}
		}
	}

	option = {
		name = FEE_Deccan_Events.7.OPT2

		add_mil_power = 15
	}
}

# Move the capital
country_event = {
	id = FEE_Deccan_Events.8
	title = FEE_Deccan_Events.8.T
	desc = FEE_Deccan_Events.8.D
	picture = FORT_eventPicture

	fire_only_once = yes

	trigger = {
		tag = GOC
		owns = 542
		is_year = 1570
		NOT = { is_year = 1620 }
	}

	mean_time_to_happen = {
		months = 30
	}

	option = {
		name = FEE_Deccan_Events.8.OPT1
		ai_chance = {
			factor = 90
		}

		add_mil_power = 25
		set_capital = 542
		542 = {
			add_base_tax = 1
			add_base_production = 1
		}
	}

	option = {
		name = FEE_Deccan_Events.8.OPT2
		ai_chance = {
			factor = 10
		}

		add_treasury = 10
	}
}