﻿# Modifiers which affect heresy join chance for a given character.
#
# Base weight is expected to be 100.
#
# scope = the character being evaluated.
# TARGET = the target of the heresy conspiracy.
regula_heresy_character_join_modifier = {
	# Factors which increase likelihood.
	modifier = {
		add = 1000
		has_relation_nemesis = $TARGET$
	}

	modifier = {
		add = 300
		has_relation_rival = $TARGET$
	}

	modifier = {
		add = 100
		has_trait = ambitious
	}

	modifier = {
		add = 100
		has_trait = zealous
	}

	modifier = {
		add = 30
		has_trait = deceitful
	}

	modifier = {
		add = 30
		has_trait = cynical
	}

	modifier = {
		add = 30
		num_sinful_traits = {
			value > 0
			target = $TARGET$.faith
		}
	}

	# Factors which decrease likelihood.
	modifier = {
		add = -1000
		OR = {
			has_relation_best_friend = $TARGET$
			has_relation_soulmate = $TARGET$
			has_relation_lover = $TARGET$
		}
	}

	modifier = {
		add = -300
		has_relation_friend = $TARGET$
	}

	modifier = {
		add = -100
		has_trait = craven
	}

	modifier = {
		add = -100
		has_trait = content
	}

	modifier = {
		add = -30
		has_trait = humble
	}

	modifier = {
		add = -30
		num_virtuous_traits = {
			value > 0
			target = $TARGET$.faith
		}
	}

	# Ending Adjustments.
	# All else being equal, prefer female conspirators.
	modifier = {
		factor = 2
		is_female = yes
	}
}

# Modifiers which affect capture chance for a given character by the inquisitor.
#
# CHARACTER = the character being evaluated.
# HERESY_TARGET = the target of the heresy conspiracy.
regula_heresy_character_capture_modifier = {
	# Factors which increase likelihood.
	# Prefer to capture the higher ranked conspirators.
	modifier = {
		factor = {
			value = 1
			add = $CHARACTER$.highest_held_title_tier
		}
	}

	# Older would be easier to capture.
	modifier = {
		factor = 1.5
		$CHARACTER$.age > 60
	}

	# More sinful would be more closely watched by the faithful.
	modifier = {
		factor = 1.5
		$CHARACTER$ = {
			num_sinful_traits = {
				value > 0
				target = $HERESY_TARGET$.faith
			}
		}
	}

	# Factors which decrease likelihood.
	# In prime of life => Has an easier time evading.
	modifier = {
		factor = 0.5
		$CHARACTER$.age <= 30
	}

	# More virtuous might be left off easily by the faithful.
	modifier = {
		factor = 0.8
		$CHARACTER$ = {
			num_virtuous_traits = {
				value > 0
				target = $HERESY_TARGET$.faith
			}
		}
	}

	# Hidden state, evading capture is all about being sneaky.
	modifier = {
		factor = {
			value = 1
			subtract = {
				value = $CHARACTER$.intrigue
				divide = 50
			}
			min = 0.1
		}
		$HERESY_TARGET$ = {
			regula_heresy_story_against_character_in_public_state_trigger = no
		}
	}

	# Public state, how fast you can run might be more important.
	modifier = {
		factor = {
			value = 1
			subtract = {
				value = $CHARACTER$.prowess
				divide = 50
			}
			min = 0.1
		}
		$HERESY_TARGET$ = {
			regula_heresy_story_against_character_in_public_state_trigger = yes
		}
	}

	# Both ways - fervor can raise or lower as a comparison between conspirator
	# and magister faith fervor.
	modifier = {
		# Idea behind the calculation here:
		# Magister Fervor 100, Conspirator 0 => 2.0x
		# Magister Fervor 0, Conspirator 100 => 0.1x
		# Magister Fervor 100, Conspirator 100 => 1.0x
		# Magister Fervor 100, Conspirator 50 => 1.5x
		# Magister Fervor 50, Conspirator 100 => 0.5x
		factor = {
			value = 100
			add = $HERESY_TARGET$.faith.fervor
			subtract = $CHARACTER$.faith.fervor
			divide = 100
			min = 0.1
		}
	}
}
