﻿# Setup Regula notification settings

on_game_start = {
	on_actions = {
		regula_set_notifcation_settings
		regula_set_ward_settings
		regula_set_regula_settings
		regula_set_bloodline_tally_goals
		regula_set_religion_consanguinity_doctrine
		regula_set_religion_homosexuality_doctrine
		delay = { days = 1 }	# Set delay here in case we have the vanilla game rule gender equality set to opposite
		regula_set_religion_gender_doctrines
	}
}

# Set default settings for notifications
regula_set_notifcation_settings = {
    effect = {
		# Notification Settings
		set_global_variable = {
			name = fascinare_events_enabled
			value = yes
		}

		set_global_variable = {
			name = ward_enslavement_events_enabled
			value = yes
		}
    }
}

# Set default settings for ward events
regula_set_ward_settings = {
    effect = {
		# Notification Settings
		set_global_variable = {
			name = regula_wards
			value = 0
		}
    }
}

# Set default settings for other regula effects
regula_set_regula_settings = {
    effect = {
		clear_global_variable_list = regula_undying_character_list
		set_global_variable = {
			name = regula_undying_character_list
			value = list()
		}

		# % Chance of Females being born when female offspring holy site is held
		# Male chance is 100% - this value
		set_global_variable = {
			name = regula_female_offspring_holy_site_chance
			value = 75
		}
    }
}

# Setup our bloodline tally goal variables
# This tally is the amount of each objective we have completed
# The bools are to see if we have achieved the goal yet, they start as false/no
regula_set_bloodline_tally_goals = {
	effect = {
		set_global_variable = {
			name = regula_fascinare_tally
			value = 0
		}
		set_global_variable = {
			name = regula_domitans_tally
			value = 0
		}
		set_global_variable = {
			name = regula_contubernalis_tally
			value = 0
		}
		set_global_variable = {
			name = regula_domination_war_tally
			value = 0
		}
		set_global_variable = {
			name = regula_servitude_war_tally
			value = 0
		}
		set_global_variable = {
			name = regula_potestas_queen_tally
			value = 0
		}
		set_global_variable = {
			name = regula_obedience_tally
			value = 0
		}

		set_global_variable = {
			name = regula_potestas_queen_bloodline_active
			value = no
		}
		set_global_variable = {
			name = regula_servitude_war_bloodline_active
			value = no
		}
		set_global_variable = {
			name = regula_domination_war_bloodline_active
			value = no
		}
		set_global_variable = {
			name = regula_contubernalis_bloodline_active
			value = no
		}
		set_global_variable = {
			name = regula_domitans_bloodline_active
			value = no
		}
		set_global_variable = {
			name = regula_fascinare_bloodline_active
			value = no
		}
		set_global_variable = {
			name = regula_obedience_bloodline_active
			value = no
		}
	}
}

# Here we make sure the religion doctrines are set the way we want
# Currently this is hardcoded to doctrine = doctrine_gender_female_dominated and doctrine = doctrine_clerical_gender_female_only
regula_set_religion_gender_doctrines = {
	effect = {
		religion:regula_religion = {
			every_faith = {
				limit = {
					has_doctrine = doctrine_gender_male_dominated
				}
				remove_doctrine = doctrine_gender_male_dominated
				add_doctrine = doctrine_gender_female_dominated
			}

			every_faith = {
				limit = {
					has_doctrine = doctrine_clerical_gender_male_only
				}
				remove_doctrine = doctrine_clerical_gender_male_only
				add_doctrine = doctrine_clerical_gender_female_only
			}
		}
	}
}

regula_set_religion_consanguinity_doctrine = {
	effect = {
		religion:regula_religion = {
			every_faith = {
				limit = {
					has_game_rule = regula_faith_customization_consanguinity_aunt_nephew_and_uncle_niece
				}
				remove_doctrine = doctrine_consanguinity_unrestricted
				add_doctrine = doctrine_consanguinity_aunt_nephew_and_uncle_niece
			}

			every_faith = {
				limit = {
					has_game_rule = regula_faith_customization_consanguinity_cousins
				}
				remove_doctrine = doctrine_consanguinity_unrestricted
				add_doctrine = doctrine_consanguinity_cousins
			}

			every_faith = {
				limit = {
					has_game_rule = regula_faith_customization_consanguinity_restricted
				}
				remove_doctrine = doctrine_consanguinity_unrestricted
				add_doctrine = doctrine_consanguinity_restricted
			}
		}
	}
}

regula_set_religion_homosexuality_doctrine = {
	effect = {
		religion:regula_religion = {
			every_faith = {
				limit = {
					has_game_rule = regula_faith_customization_homosexuality_shunned
				}
				remove_doctrine = doctrine_homosexuality_accepted
				add_doctrine = doctrine_homosexuality_shunned
			}

			every_faith = {
				limit = {
					has_game_rule = regula_faith_customization_homosexuality_crime
				}
				remove_doctrine = doctrine_homosexuality_accepted
				add_doctrine = doctrine_homosexuality_crime
			}
		}
	}
}