﻿slower_game_rule_value = 0.5
significantly_slower_game_rule_value = 0.25
faster_game_rule_value = 2
significantly_faster_game_rule_value = 4

random_harm_spiteful_diverse_skilled_value = 15
random_harm_spiteful_multi_skilled_value = 18
random_harm_spiteful_specialist_skilled_value = 23

random_harm_spiteful_perks_in_tree_total_value = 20

harm_game_rule_likelihood_minor_increase_value = 0.1
harm_game_rule_likelihood_medium_increase_value = 0.25
harm_game_rule_likelihood_major_increase_value = 0.4

harm_game_rule_likelihood_value = {
	value = 0
	# Set a base from the for various game rule configurations.
	## Default.
	if = {
		limit = {
			OR = {
				has_game_rule = harm_dangerous
				has_game_rule = harm_spiteful
			}
		}
		add = 1
	}
	## Reduced.
	else_if = {
		limit = { has_game_rule = harm_illusion_of_safety }
		add = 0.25
	}
	## Disabled.
	### Covered in the trigger.
	## Increased.
	else_if = {
		limit = {
			OR = {
				has_game_rule = harm_tragic
				has_game_rule = harm_tragically_spiteful
			}
		}
		add = 1.5
	}
	## Increased even further for interesting characters.
	if = {
		limit = {
			# Must have an appropriate game rule.
			OR = {
				has_game_rule = harm_spiteful
				has_game_rule = harm_tragically_spiteful
			}
		}
		# And be suitably worthwhile!
		## Highly skilled.
		if = {
			limit = {
				calc_true_if = {
					amount >= 4
					diplomacy >= random_harm_spiteful_diverse_skilled_value
					martial >= random_harm_spiteful_diverse_skilled_value
					stewardship >= random_harm_spiteful_diverse_skilled_value
					intrigue >= random_harm_spiteful_diverse_skilled_value
					learning >= random_harm_spiteful_diverse_skilled_value
					prowess >= random_harm_spiteful_diverse_skilled_value
				}
				calc_true_if = {
					amount >= 2
					diplomacy >= random_harm_spiteful_multi_skilled_value
					martial >= random_harm_spiteful_multi_skilled_value
					stewardship >= random_harm_spiteful_multi_skilled_value
					intrigue >= random_harm_spiteful_multi_skilled_value
					learning >= random_harm_spiteful_multi_skilled_value
					prowess >= random_harm_spiteful_multi_skilled_value
				}
				OR = {
					diplomacy >= random_harm_spiteful_specialist_skilled_value
					martial >= random_harm_spiteful_specialist_skilled_value
					stewardship >= random_harm_spiteful_specialist_skilled_value
					intrigue >= random_harm_spiteful_specialist_skilled_value
					learning >= random_harm_spiteful_specialist_skilled_value
					prowess >= random_harm_spiteful_specialist_skilled_value
				}
			}
			add = harm_game_rule_likelihood_medium_increase_value
		}
		## Positive genetic traits.
		### First, we check number.
		#### We don't tolerate excess.
		if = {
			limit = { num_of_good_genetic_traits >= 2 }
			add = harm_game_rule_likelihood_minor_increase_value
		}
		#### Let alone impractical excess.
		else_if = {
			limit = { num_of_good_genetic_traits >= 3 }
			add = harm_game_rule_likelihood_medium_increase_value
		}
		### Then we check quality.
		#### Some buffs.
		if = {
			limit = {
				OR = {
					has_trait = beauty_good_1
					has_trait = intellect_good_1
					has_trait = physique_good_1
				}
			}
			add = harm_game_rule_likelihood_minor_increase_value
		}
		#### Clearly doing some breeding.
		else_if = {
			limit = {
				OR = {
					has_trait = beauty_good_2
					has_trait = intellect_good_2
					has_trait = physique_good_2
				}
			}
			add = harm_game_rule_likelihood_medium_increase_value
		}
		#### Remember: you opted into this.
		else_if = {
			limit = {
				OR = {
					has_trait = beauty_good_3
					has_trait = intellect_good_3
					has_trait = physique_good_3
				}
			}
			add = harm_game_rule_likelihood_major_increase_value
		}
		## Notable levels of prestige or piety.
		if = {
			limit = {
				OR = {
					prestige_level >= max_prestige_level
					piety_level >= max_piety_level
				}
			}
			add = harm_game_rule_likelihood_minor_increase_value
		}
		## Very young or getting old & in charge of an important realm.
		if = {
			limit = {
				OR = {
					AND = {
						age <= 28
						OR = {
							highest_held_title_tier >= tier_kingdom
							realm_size >= monumental_realm_size
						}
					}
					AND = {
						age >= 66
						OR = {
							highest_held_title_tier >= tier_kingdom
							realm_size >= monumental_realm_size
						}
					}
				}
			}
			add = harm_game_rule_likelihood_medium_increase_value
		}
		## Has capped out a noble number of perk trees.
		if = {
			limit = {
				calc_true_if = {
					amount >= 2
					perks_in_diplomacy_lifestyle >= random_harm_spiteful_perks_in_tree_total_value
					perks_in_martial_lifestyle >= random_harm_spiteful_perks_in_tree_total_value
					perks_in_stewardship_lifestyle >= random_harm_spiteful_perks_in_tree_total_value
					perks_in_intrigue_lifestyle >= random_harm_spiteful_perks_in_tree_total_value
					perks_in_learning_lifestyle >= random_harm_spiteful_perks_in_tree_total_value
				}
			}
			add = harm_game_rule_likelihood_medium_increase_value
		}
	}
	# But uhhh, make sure it never gets too ungodly kill-crazy.
	max = 2.5
}
