﻿# group = this is the law_group a law belongs to
# icon = graphical icon shown in-game
# modifier = {} modifier on country for having adopted this law
# cultural_acceptance_rule and religious_acceptance_rule are triggers in the pop scope used to check if a pop should be accepted or discriminated against

law_state_religion = {
	group = lawgroup_church_and_state
	
	icon = "gfx/interface/icons/law_icons/state_religion.dds"
	
	progressiveness = -50
	
	on_enact = {
		recalculate_pop_ig_support = yes
		if = {
			limit = {
				has_law = law_type:law_state_atheism
			}
			set_state_religion = root.country_definition.religion
		}
		if = {
			limit = {
				has_modifier = antireligious_policies
			}
			remove_modifier = antireligious_policies
		}
	}
	
	modifier = {
		country_clergymen_pol_str_mult = 0.5
		country_authority_add = 200

		country_acceptance_state_religion_add = 20
		country_acceptance_shared_religious_trait_add = 0
		country_acceptance_religion_base_add = -20	

		country_allow_conversion_violent_hostility_bool = yes
		country_allow_conversion_cultural_erasure_bool = yes
		country_allow_conversion_open_prejudice_bool = yes
		country_allow_conversion_second_rate_citizen_bool = yes
		country_allow_conversion_full_acceptance_bool = yes
	}

	can_impose = {
		OR = {
			AND = {
				is_in_same_power_bloc = scope:target_country
				AND = {
					modifier:country_can_impose_same_lawgroup_church_and_state_in_power_bloc_bool = yes
					has_law = scope:law
				}
			}
			can_impose_law_default = yes
		}
	}

	ai_will_do = {
		exists = ruler
		ruler = {
			has_ideology = ideology:ideology_theocrat
		}
	}

	ai_enact_weight_modifier = { #Petitions
		value = 0
		
		if = {
			limit = { ai_has_enact_weight_modifier_journal_entries = yes }
			add = 750
		}
	}
	
	ai_impose_chance = {
		value = 0
		
		if = {
			limit = {
				has_law = law_type:law_state_religion
				power_bloc ?= { has_identity = identity:identity_religious }
				religion = scope:target_country.religion			
			}
			
			add = base_impose_law_weight	
			
			# Very important for religious blocs
			if = {
				limit = { scope:target_country = { has_law = law_type:law_freedom_of_conscience } }
				multiply = 2 
			}
			else = {
				multiply = 5
			}
		}
			
		if = {
			limit = {
				scope:target_country = {
					c:BIC ?= this
					OR = {	
						has_journal_entry = je_british_dictate_plantations
						has_journal_entry = je_british_dictate_military
						has_journal_entry = je_british_dictate_universities
					}
				}
			}
			multiply = 0
		}
	}
}

law_freedom_of_conscience = {
	group = lawgroup_church_and_state
	
	icon = "gfx/interface/icons/law_icons/freedom_of_conscience.dds"
	
	progressiveness = 0

	unlocking_technologies = {
		rationalism
	}

	disallowing_laws = {
		law_theocracy
	}
	
	on_enact = {
		recalculate_pop_ig_support = yes
		if = {
			limit = {
				has_law = law_type:law_state_atheism
			}
			set_state_religion = root.country_definition.religion
		}
		if = {
			limit = {
				has_modifier = antireligious_policies
			}
			remove_modifier = antireligious_policies
		}
	}
	
	modifier = {
		country_clergymen_pol_str_mult = 0.25
		country_authority_add = 100

		country_acceptance_state_religion_add = 10
		country_acceptance_shared_religious_trait_add = 10
		country_acceptance_religion_base_add = 0

		country_allow_conversion_violent_hostility_bool = yes
		country_allow_conversion_cultural_erasure_bool = yes
		country_allow_conversion_open_prejudice_bool = yes
		country_allow_conversion_second_rate_citizen_bool = yes
		country_allow_conversion_full_acceptance_bool = yes
	}
	
	can_impose = {
		OR = {
			AND = {
				is_in_same_power_bloc = scope:target_country
				AND = {
					modifier:country_can_impose_same_lawgroup_church_and_state_in_power_bloc_bool = yes
					has_law = scope:law
				}
			}
			can_impose_law_default = yes
		}
	}

	ai_enact_weight_modifier = { #Petitions
		value = 0
		
		if = {
			limit = { ai_has_enact_weight_modifier_journal_entries = yes }
			add = 750
		}
		
		if = {
			limit = { 
				has_journal_entry = je_sick_man_education
				has_law = law_type:law_state_religion
			}
			add = 1000
		}				
	}
}

law_total_separation = {
	group = lawgroup_church_and_state
	
	icon = "gfx/interface/icons/law_icons/total_separation.dds"
	
	progressiveness = 50

	unlocking_technologies = {
		empiricism
	}

	disallowing_laws = {
		law_theocracy
	}

	can_enact = {
		OR = {
			is_power_bloc_leader = no
			power_bloc ?= {
				NOT = { has_identity = identity:identity_religious }
			}
		}
	}
	
	on_enact = {
		recalculate_pop_ig_support = yes
		if = {
			limit = {
				has_law = law_type:law_state_atheism
			}
			set_state_religion = root.country_definition.religion
		}
		if = {
			limit = {
				has_modifier = antireligious_policies
			}
			remove_modifier = antireligious_policies
		}
	}

	modifier = {
		country_acceptance_state_religion_add = 10
		country_acceptance_shared_religious_trait_add = 10
		country_acceptance_religion_base_add = 10

		country_allow_conversion_violent_hostility_bool = yes
		country_allow_conversion_cultural_erasure_bool = yes
		country_allow_conversion_open_prejudice_bool = yes
		country_allow_conversion_second_rate_citizen_bool = yes
		country_allow_conversion_full_acceptance_bool = yes
	}
	
	can_impose = {
		OR = {
			AND = {
				is_in_same_power_bloc = scope:target_country
				AND = {
					modifier:country_can_impose_same_lawgroup_church_and_state_in_power_bloc_bool = yes
					has_law = scope:law
				}
			}
			can_impose_law_default = yes
		}
	}

	ai_enact_weight_modifier = { #Petitions
		value = 0
		
		if = {
			limit = { ai_has_enact_weight_modifier_journal_entries = yes }
			add = 750
		}			
	}
}

law_state_atheism = {
	group = lawgroup_church_and_state
	
	icon = "gfx/interface/icons/law_icons/state_atheism.dds"

	progressiveness = 0

	unlocking_technologies = {
		empiricism
	}

	disallowing_laws = {
		law_theocracy
	}
	
	can_enact = {
		ig:ig_devout = {
			is_in_government = no
		}
		OR = {
			is_power_bloc_leader = no
			power_bloc ?= {
				NOT = { has_identity = identity:identity_religious }
			}
		}
	}

	modifier = {
		country_clergymen_pol_str_mult = -0.5
		state_conversion_mult = 1.0
		country_authority_add = 200
		country_acceptance_state_religion_add = 20
		country_acceptance_shared_religious_trait_add = 0
		country_acceptance_religion_base_add = -20

		country_allow_conversion_violent_hostility_bool = yes
		country_allow_conversion_cultural_erasure_bool = yes
		country_allow_conversion_open_prejudice_bool = yes
		country_allow_conversion_second_rate_citizen_bool = yes
		country_allow_conversion_full_acceptance_bool = yes
	}
	
	on_enact = {
		add_modifier = {
			name = antireligious_policies
			months = long_modifier_time
		}
		custom_tooltip = {
			text = state_atheism_conversion_tt
			every_scope_state = {
				limit = {
					is_incorporated = yes
				}
				convert_population = {
					target = rel:atheist
					value = 0.25
				}
			}
		}
		recalculate_pop_ig_support = yes
	}

	on_activate = {
		set_state_religion = rel:atheist
	}

	can_impose = {
		OR = {
			AND = {
				is_in_same_power_bloc = scope:target_country
				AND = {
					modifier:country_can_impose_same_lawgroup_church_and_state_in_power_bloc_bool = yes
					has_law = scope:law
				}
			}
			can_impose_law_default = yes
		}
	}

	ai_enact_weight_modifier = { #Petitions
		value = 0
		
		if = {
			limit = { ai_has_enact_weight_modifier_journal_entries = yes }
			add = 750
		}
	}
	
	ai_impose_chance = {
		value = 0
		
		if = {
			limit = {
				has_law = law_type:law_state_atheism
				power_bloc ?= { has_identity = identity:identity_ideological_union }			
			}
			
			add = base_impose_law_weight	
			
			# Atheist leaders of ideological unions want to spread the cult of reason
			if = {
				limit = { scope:target_country = { has_law = law_type:law_total_separation } }
				multiply = 0.5
			}
			else = {
				multiply = 2
			}
		}
			
		if = {
			limit = {
				scope:target_country = {
					c:BIC ?= this
					OR = {	
						has_journal_entry = je_british_dictate_plantations
						has_journal_entry = je_british_dictate_military
						has_journal_entry = je_british_dictate_universities
					}
				}
			}
			multiply = 0
		}
	}
}