namespace = FEE_Religious_Events

#########	Catholic events	#########

# Masterpiece of Religious Renaissance Art
country_event = {
	id = FEE_Religious_Events.1
	title = FEE_Religious_Events.1.T
	desc = FEE_Religious_Events.1.D
	picture = IMPORTANT_STATUE_eventPicture

	trigger = {
		NOT = { is_religion_enabled = protestant }
		religion = catholic
	}

	mean_time_to_happen = {
		months = 840
		modifier = {
			factor = 0.8
			advisor = artist
		}
	}

	#Display it for the entire Christian world to see
	option = {
		name = FEE_Religious_Events.1.OPT1

		change_religious_influence_equivalent_fee = { add = 10 }
		add_prestige_or_monarch_power = { amount = 10 }
	}

	#Perfect timing, I was just in need of some money
	option = {
		name = FEE_Religious_Events.1.OPT2
		trigger = {
			ai = no
		}

		add_years_of_income = 0.3
		add_reform_desire = 0.01
		change_religious_influence_equivalent_fee = { remove = 5 }
	}

	#This will show the people how pious I am
	option = {
		name = FEE_Religious_Events.1.OPT3

		add_stability_or_adm_power = yes
		change_religious_influence_equivalent_fee = { remove = 5 }
	}
}

# Growth of Popular Piety
country_event = {
	id = FEE_Religious_Events.2
	title = FEE_Religious_Events.2.T
	desc = FEE_Religious_Events.2.D
	picture = RELIGION_eventPicture

	trigger = {
		NOT = { is_religion_enabled = protestant }
		religion = catholic
		reform_desire = 0.02
		OR = {
			NOT = { has_country_flag = fee_popular_piety_timer }
			had_country_flag = {
				flag = fee_popular_piety_timer
				days = 18250
			}
		}
	}

	mean_time_to_happen = {
		months = 600
		modifier = {
			factor = 1.2
			advisor = inquisitor
		}
		modifier = {
			factor = 0.9
			advisor = theologian
		}
	}

	immediate = {
		hidden_effect = {
			clr_country_flag = fee_popular_piety_timer
			set_country_flag = fee_popular_piety_timer
		}
	}

	# These people should listen to the pope
	option = {
		name = FEE_Religious_Events.2.OPT1
		trigger = {
			ai = no
		}

		add_reform_desire = 0.01
		change_religious_influence_equivalent_fee = { add = 15 }
		add_country_modifier = {
			name = fee_religious_piety_resisted
			duration = 3650
		}
	}

	# People should always strive for new ways to express their faith
	option = {
		name = FEE_Religious_Events.2.OPT2

		change_religious_influence_equivalent_fee = { remove = 15 }
		add_country_modifier = {
			name = fee_religious_piety_supported
			duration = 3650
		}
	}
}


#########	Protestant Events	#########

# Johannes Bugenhagen, second Apostle of the North
country_event = {
	id = FEE_Religious_Events.100
	title = FEE_Religious_Events.100.T
	desc = FEE_Religious_Events.100.D
	picture = ADVISOR_eventPicture

	trigger = {
		OR = {
			capital_scope = { region = scandinavia_region }
			tag = MKL
			tag = POM
			tag = HSA
			tag = EFR
			tag = BRU
			tag = SHL
			tag = BRE
		}
		NOT = { is_year = 1560 }
		NOT = { has_country_flag = fee_prot_johannes_bugenhagen }
		religion = protestant
		any_province = { religion = catholic }
	}

	mean_time_to_happen = {
		months = 480
		modifier = {
			factor = 0.8
			ADM = 4
		}
		modifier = {
			factor = 0.8
			has_idea_group = humanist_ideas
		}
	}

	immediate = {
		hidden_effect = {
			set_country_flag = fee_prot_johannes_bugenhagen
		}
	}

	option = {
		name = FEE_Religious_Events.100.OPT1
		define_advisor = {
			type = inquisitor
			name = "Johannes Bugenhagen"
			skill = 2
			discount = yes
		}
	}

	option = {
		name = FEE_Religious_Events.100.OPT2
		add_stability_or_adm_power = yes
	}
}

# A Protestant in [Owner.GetAdjective] Lands
province_event = {
	id = FEE_Religious_Events.101
	title = FEE_Religious_Events.101.T
	desc = FEE_Religious_Events.101.D
	picture = RELIGION_eventPicture

	trigger = {
		religion = catholic
		is_religion_enabled = protestant
		NOT = { is_year = 1650 }
		NOT = {
			owner = {
				OR = {
					religion = catholic
					religion = reformed
					religion = protestant
				}
			}
		}
	}

	mean_time_to_happen = {
		months = 720
		modifier = {
			factor = 0.9
			owner = {
				has_idea_group = humanist_ideas
			}
		}
		modifier = {
			factor = 1.1
			owner = {
				has_idea_group = religious_ideas
			}
		}
	}

	option = {
		name = FEE_Religious_Events.101.OPT1

		change_religion = protestant
	}
}

#########	Coptic Events	#########

# Apostle Intombed
country_event = {
	id = FEE_Religious_Events.300
	title = FEE_Religious_Events.300.T
	desc = FEE_Religious_Events.300.D
	picture = RELIGION_eventPicture

	major = yes
	fire_only_once = yes

	goto = 539

	trigger = {
		owns = 539
		has_global_modifier_value = {
			which = tolerance_heathen
			value = 0
		}
	}

	mean_time_to_happen = {
		months = 12
	}

	immediate = {
		hidden_effect = {
			set_global_flag = fee_apostle_intombed_event
		}
	}

	option = {
		name = FEE_Religious_Events.300.OPT1

		ai_chance = { factor = 0.6 }

		539 = {
			change_religion = coptic
			add_base_tax = 3
			add_or_upgrade_tax_building = yes
			add_province_modifier = {
				name = fee_religious_basilica_of_thomas_the_apostle
				duration = -1
			}
		}
	}

	option = {
		name = FEE_Religious_Events.300.OPT2

		ai_chance = { factor = 0.4 }

		add_prestige_or_monarch_power = { amount = 25 }
		539 = {
			change_religion = coptic
			add_base_tax = -1
		}
	}
}

# Saint Thomas Christians
country_event = {
	id = FEE_Religious_Events.301
	title = FEE_Religious_Events.301.T
	desc = FEE_Religious_Events.301.D
	picture = RELIGION_eventPicture

	fire_only_once = yes

	trigger = {
		has_global_flag = fee_apostle_intombed_event
		owns = 535
		owns = 534
		owns = 4412
		owns = 537
		owns = 529
		owns = 4416
		owns = 2100
		owns = 539
		539 = {
			religion_group = christian
		}
	}

	mean_time_to_happen = {
		months = 12
	}

	immediate = {
		hidden_effect = {
			set_global_flag = fee_saint_thomas_christians_event
		}
	}

	option = {
		name = FEE_Religious_Events.301.OPT1

		ai_chance = { factor = 0.5 }

		custom_tooltip = FEE_Religious_Events.301.tt.1
		tooltip = {
			add_province_modifier = {
				name = fee_religious_nestorian_religious_center_coptic
				duration = -1
			}
		}
		custom_tooltip = FEE_Religious_Events.301.tt.2
		tooltip = {
			add_province_modifier = {
				name = fee_religious_nestorian_religious_center_not_coptic
				duration = -1
			}
		}
		custom_tooltip = FEE_Religious_Events.301.tt.3
		hidden_effect = {
			every_owned_province = {
				limit = {
					OR = {
						province_id = 535
						province_id = 534
						province_id = 4412
						province_id = 537
						province_id = 529
						province_id = 4416
						province_id = 2100
						province_id = 539
					}
				}
				change_religion = coptic
				if = {
					limit = {
						ROOT = { religion = coptic }
					}
					add_province_modifier = {
						name = fee_religious_nestorian_religious_center_coptic
						duration = -1
					}
				}
				else = {
					add_province_modifier = {
						name = fee_religious_nestorian_religious_center_not_coptic
						duration = -1
					}
				}
			}
		}
	}

	option = {
		name = FEE_Religious_Events.301.OPT2

		ai_chance = { factor = 0.5 }

		custom_tooltip = FEE_Religious_Events.301.tt.4
		tooltip = {
			add_province_modifier = {
				name = fee_religious_christian_ghetto_christian
				duration = -1
			}
		}
		custom_tooltip = FEE_Religious_Events.301.tt.5
		tooltip = {
			add_province_modifier = {
				name = fee_religious_christian_ghetto_not_christian
				duration = -1
			}
		}
		custom_tooltip = FEE_Religious_Events.301.tt.6
		hidden_effect = {
			every_owned_province = {
				limit = {
					OR = {
						province_id = 535
						province_id = 534
						province_id = 4412
						province_id = 537
						province_id = 529
						province_id = 4416
						province_id = 2100
						province_id = 539
					}
				}
				if = {
					limit = {
						ROOT = { religion_group = christian }
					}
					add_province_modifier = {
						name = fee_religious_christian_ghetto_christian
						duration = -1
					}
				}
				else = {
					add_province_modifier = {
						name = fee_religious_christian_ghetto_not_christian
						duration = -1
					}
				}
			}
		}
	}
}

# The Ezharappallikal
country_event = {
	id = FEE_Religious_Events.302
	title = FEE_Religious_Events.302.T
	desc = FEE_Religious_Events.302.D
	picture = RELIGION_eventPicture

	fire_only_once = yes

	trigger = {
		has_global_flag = fee_saint_thomas_christians_event
		owns = 535
		owns = 529
		owns = 539
		coptic = 1
	}

	mean_time_to_happen = {
		months = 12
	}

	immediate = {
		hidden_effect = {
			set_global_flag = fee_the_ezharappallikal_event
		}
	}

	option = {
		name = FEE_Religious_Events.302.OPT1

		ai_chance = { factor = 0.95 }

		add_prestige_or_monarch_power = { amount = 25 }
		if = {
			limit = {
				has_estate = estate_brahmins
			}
			add_estate_loyalty = {
				estate = estate_brahmins
				loyalty = 15
			}
		}
		else_if = {
			limit = {
				has_estate = estate_church
			}
			add_estate_loyalty = {
				estate = estate_church
				loyalty = 15
			}
		}
		every_owned_province = {
			limit = {
				OR = {
					province_id = 535
					province_id = 529
					province_id = 539
					religion = coptic
				}
			}
			add_local_autonomy = -30
			add_province_modifier = {
				name = fee_religious_ezharappallikal
				duration = 18250
			}
		}
	}

	option = {
		name = FEE_Religious_Events.302.OPT2

		ai_chance = { factor = 0.05 }

		change_religion = coptic
		add_country_modifier = {
			name = fee_religious_thomist_christian_bastion
			duration = 5475
		}
		535 = {
			change_religion = coptic
			add_or_upgrade_tax_building = yes
			hidden_effect = {
				add_province_modifier = {
					name = fee_religious_nestorian_religious_center_coptic
					duration = -1
				}
			}
		}
		529 = {
			change_religion = coptic
			add_or_upgrade_tax_building = yes
			hidden_effect = {
				add_province_modifier = {
					name = fee_religious_nestorian_religious_center_coptic
					duration = -1
				}
			}
		}
		539 = {
			change_religion = coptic
			add_or_upgrade_tax_building = yes
			hidden_effect = {
				add_province_modifier = {
					name = fee_religious_nestorian_religious_center_coptic
					duration = -1
				}
			}
		}
		custom_tooltip = FEE_Religious_Events.302.tt.1
		tooltip = {
			add_province_modifier = {
				name = fee_religious_nestorian_religious_center_coptic
				duration = -1
			}
		}
		custom_tooltip = FEE_Religious_Events.302.tt.2
		tooltip = {
			add_province_modifier = {
				name = fee_religious_nestorian_religious_center_not_coptic
				duration = -1
			}
		}
		custom_tooltip = FEE_Religious_Events.302.tt.3
	}
}