# Estonia Flavor Events: secularization and freethought (1880-1939)
# POPs become atheist organically: the vanilla conversion engine spreads
# the state religion daily once same-culture seed POPs of that religion
# exist in a province. These events steer consciousness/militancy, grant
# province modifiers that boost conversion, and (for the state atheism
# path) change the state religion itself, which the engine then spreads.
# IDs 95541-95560 reserved for this file.
#
# Note: pop religion cannot be set directly by effects; only the state
# religion can be changed (country scope). Seed POPs are defined in
# history/pops/1836.1.1/Estonia.txt so conversion has valid targets.

#########################################################################
# 95541 - Darwin in the lecture halls
#########################################################################
country_event = {
	id = 95541
	title = "EVTNAME95541"
	desc = "EVTDESC95541"
	picture = "darwin"

	fire_only_once = yes

	trigger = {
		OR = {
			tag = EST
			tag = UBD
		}
		year = 1879
		empiricism = 1
		owns = 352 # Tartu - the university city
	}

	mean_time_to_happen = {
		months = 36
	}

	option = {
		name = "EVTOPTA95541"
		set_country_flag = darwin_debates_allowed
		352 = {
			add_province_modifier = { name = darwin_debates duration = 3650 }
		}
		any_pop = {
			limit = {
				culture = estonian
				type = clerks
			}
			consciousness = 2
		}
		any_pop = {
			limit = {
				culture = estonian
				type = clergymen
			}
			militancy = 1
		}
		# The unbelievers take heart from the public victory of science
		any_pop = {
			limit = {
				has_pop_religion = atheist
			}
			consciousness = 2
		}
	}
	option = {
		name = "EVTOPTB95541"
		set_country_flag = darwin_debates_banned
		any_pop = {
			limit = {
				culture = estonian
				type = clerks
			}
			consciousness = 1
			militancy = 1
		}
		prestige = -1
	}
}

#########################################################################
# 95542 - The Freethinkers' Society of Tartu
#########################################################################
country_event = {
	id = 95542
	title = "EVTNAME95542"
	desc = "EVTDESC95542"
	picture = "meeting"

	fire_only_once = yes

	trigger = {
		OR = {
			tag = EST
			tag = UBD
		}
		has_country_flag = darwin_debates_allowed
		year = 1885
	}

	mean_time_to_happen = {
		months = 30
	}

	option = {
		name = "EVTOPTA95542"
		set_country_flag = freethinkers_society
		352 = {
			add_province_modifier = { name = freethinkers_tartu duration = 3650 }
		}
		any_pop = {
			limit = {
				culture = estonian
				type = clergymen
			}
			militancy = 2
		}
		# The society organizes: unbelievers become proselytizers of the
		# new outlook, conscious POPs convert faster
		any_pop = {
			limit = {
				has_pop_religion = atheist
			}
			consciousness = 2
		}
	}
	option = {
		name = "EVTOPTB95542"
		any_pop = {
			limit = {
				culture = estonian
				type = clerks
			}
			militancy = 2
		}
	}
}

#########################################################################
# 95543 - The secular schools question
#########################################################################
country_event = {
	id = 95543
	title = "EVTNAME95543"
	desc = "EVTDESC95543"
	picture = "School"

	fire_only_once = yes

	trigger = {
		OR = {
			tag = EST
			tag = UBD
		}
		year = 1901
		has_country_flag = freethinkers_society
	}

	mean_time_to_happen = {
		months = 36
	}

	option = {
		name = "EVTOPTA95543"
		set_country_flag = secular_schools
		any_owned = {
			limit = {
				owner = { has_country_flag = secular_schools }
			}
			add_province_modifier = { name = secular_schools_mod duration = 3650 }
		}
		any_pop = {
			limit = {
				culture = estonian
				type = clergymen
			}
			militancy = 3
		}
	}
	option = {
		name = "EVTOPTB95543"
		set_country_flag = church_schools_kept
		any_pop = {
			limit = {
				culture = estonian
				type = clergymen
			}
			militancy = -2
			consciousness = 1
		}
	}
}

#########################################################################
# 95544 - The quiet congregations (repeatable spread)
#########################################################################
country_event = {
	id = 95544
	title = "EVTNAME95544"
	desc = "EVTDESC95544"
	picture = "Administration"

	trigger = {
		OR = {
			tag = EST
			tag = UBD
		}
		has_country_flag = secular_schools
		religion = atheist
	}

	mean_time_to_happen = {
		months = 12

		# The freethought press and the movement's own organizations carry
		# the quiet congregations from town to town much faster
		modifier = {
			factor = 0.5
			has_country_flag = freethought_press_patronized
		}
	}

	option = {
		name = "EVTOPTA95544"
		# The conversion engine works per province: reach every province
		# where unbelievers already live, not just one
		any_owned = {
			limit = {
				owner = { OR = { tag = EST tag = UBD } }
				any_pop = { has_pop_religion = atheist }
				NOT = { has_province_modifier = quiet_congregations }
			}
			add_province_modifier = { name = quiet_congregations duration = 730 }
		}
		any_pop = {
			limit = {
				has_pop_religion = atheist
			}
			consciousness = 1
		}
	}
	option = {
		name = "EVTOPTB95544"
		prestige = 1
		any_pop = {
			limit = {
				has_pop_religion = atheist
			}
			militancy = 1
		}
	}
}

#########################################################################
# 95545 - The Great Awakening (backslide)
#########################################################################
country_event = {
	id = 95545
	title = "EVTNAME95545"
	desc = "EVTDESC95545"
	picture = "churchmexico"

	fire_only_once = yes

	trigger = {
		OR = {
			tag = EST
			tag = UBD
		}
		religion = atheist
		average_militancy = 5
	}

	mean_time_to_happen = {
		months = 24
	}

	option = {
		name = "EVTOPTA95545"
		religion = protestant
		clr_country_flag = secular_schools
		clr_country_flag = freethinkers_society
		clr_country_flag = darwin_debates_allowed
		any_pop = {
			limit = {
				has_pop_religion = atheist
			}
			militancy = -3
		}
	}
	option = {
		name = "EVTOPTB95545"
		set_country_flag = state_atheism_persevered
		any_pop = {
			limit = {
				NOT = { has_pop_religion = atheist }
			}
			militancy = 2
		}
	}
}


##########################################################################
# 95548 - The Freethinkers Are Here (diagnostic: confirms atheist POPs loaded)
##########################################################################
country_event = {
	id = 95554
	title = "EVTNAME95554"
	desc = "EVTDESC95554"
	picture = "Administration"
	fire_only_once = yes

	trigger = {
		owns = 349
		349 = {
			any_pop = { has_pop_religion = atheist }
		}
	}

	mean_time_to_happen = {
		days = 5
	}

	option = {
		name = "EVTOPTA95554"
		set_country_flag = freethinkers_present
	}
}

########################################################################
# 95549 - The League of Militant Atheists: the revolution's own church
########################################################################
# A proletarian dictatorship turns its guns on the altars: with the
# state already atheist, the League forces the issue, driving the
# remaining faithful toward the conversion engine's targets.
country_event = {
	id = 95555
	title = "EVTNAME95555"
	desc = "EVTDESC95555"
	picture = "Riot"
	fire_only_once = yes
	trigger = {
		OR = {
			tag = EST
			tag = UBD
		}
		government = proletarian_dictatorship
		religion = atheist
	}
	mean_time_to_happen = {
		months = 6
	}
	option = {
		name = "EVTOPTA95555"
		set_country_flag = militant_atheists_organized
		# The League's lectures and demonstrations reach every province:
		# the engine converts per province, so blanket the country
		any_owned = {
			add_province_modifier = {
				name = quiet_congregations
				duration = -1
			}
		}
		# The faithful are shamed into the party's reading circles;
		# conscious POPs convert faster
		any_pop = {
			limit = {
				NOT = { has_pop_religion = atheist }
			}
			consciousness = 2
			militancy = -1
		}
	}
	option = {
		name = "EVTOPTB95555"
		# Softer line: win them with bread, not with decrees
		set_country_flag = league_soft_line
		any_pop = {
			limit = {
				NOT = { has_pop_religion = atheist }
			}
			militancy = -2
		}
		prestige = 1
	}
}
