﻿
character_infection_chance_default_value = {
	value = 10
	#If you're already sick/weak you're screwed
	if = { 
		limit = { 
			OR = {
				has_trait = sickly
				has_trait = inbred
				health <= poor_health
			}
		}
		add = 20
	}
	#Epidemic Intensity
	if = {
		limit = {
			scope:epidemic ?= {
				outbreak_intensity = apocalyptic
				epidemic_type.epidemic_trait = trait:bubonic_plague
			}
		}
		add = 40
	}
	else_if = {
		limit = {
			scope:epidemic ?= {
				outbreak_intensity = apocalyptic
				NOT = { epidemic_type.epidemic_trait = trait:bubonic_plague }
			}
		}
		add = 30
	}
	else_if = {
		limit = {
			scope:epidemic ?= {
				outbreak_intensity = major
			}
		}
		add = 20
	}
	else = { #minor
		add = 10
	}
	#Let's see if you have any advantageous traits/perks / Wash your hands is included in the social distancing calculation, these are purely health related
	if = {
		limit = {
			has_trait = athletic
		}
		add = -4
	}
	if = {
		limit = {
			has_perk = iron_constitution_perk
		}
		add = -6
	}
	if = {
		limit = {
			has_perk = healthy_perk
		}
		add = -8
	}
	if = {
		limit = {
			has_trait = whole_of_body
		}
		add = -10
	}
	#Things to bump the numbers
	if = {
		limit = {
			is_foreign_court_or_pool_guest = yes
		}
		add = 40
	}
	if = {
		limit = {
			is_ruler = no
		}
		add = 10
	}
	#Children getting hit with measles
	if = {
		limit = {
			scope:epidemic.epidemic_type.epidemic_trait = trait:measles
			is_adult = no
		}
		add = 20
	}
	#"Old" people get hit more in general
	if = {
		limit = {
			age >= 65
		}
		add = 40
	}
	else_if = {
		limit = {
			age >= 50
		}
		add = 20
	}
	# Camp resistance.
    # Slight buff.
    if = {
        limit = {
            host.domicile ?= { has_domicile_parameter = camp_infection_chance_buff_1 }
        }
        add = -10
    }
    # Max buff.
    else_if = {
        limit = {
            host.domicile ?= { has_domicile_parameter = camp_infection_chance_buff_6 }
        }
        add = -40
    }
    # Very high buff.
    else_if = {
        limit = {
            host.domicile ?= { has_domicile_parameter = camp_infection_chance_buff_5 }
        }
        add = -30
    }
    # High buff.
    else_if = {
        limit = {
            host.domicile ?= { has_domicile_parameter = camp_infection_chance_buff_4 }
        }
        add = -25
    }
    # Medium buff.
    else_if = {
        limit = {
            host.domicile ?= { has_domicile_parameter = camp_infection_chance_buff_3 }
        }
        add = -20
    }
    # Small buff.
    else_if = {
        limit = {
            host.domicile ?= { has_domicile_parameter = camp_infection_chance_buff_2 }
        }
        add = -15
    }
	#Would you follow social distancing?
	#your numerical social distance value gets transformed here into a bonus/malus
	add = {
		value = would_follow_social_distancing_value
		multiply = -1 #inverted value
	}
	# LMF added: because the Wash Your Hands perk says it reduces the chance of your courtiers catching diseases but currently only affects yourself
	if = {
		limit = {
			is_courtier = yes
			liege = { has_perk = wash_your_hands_perk }
		}
		add = -10
	}
	#How infected is your location?
	#Follows the infection rate thresholds set for the barony/county modifiers
	if = {
		limit = {
			location = { epidemic_resistance > 80 }
		}
		multiply = 0.25
	}
	else_if = {
		limit = {
			location = { epidemic_resistance > 50 }
		}
		multiply = 0.5
	}
	else_if = {
		limit = {
			location = { epidemic_resistance > 10 }
		}
		multiply = 0.75
	}
	#Are you taking proper measures?
	if = {
		limit = {
			OR = {
				has_character_modifier = isolating_modifier
				has_trait = seclusion #LMF added: seclusion is the equivalent of isolating
			}
		}
		multiply = 0.25 #75% less likely
	}
	if = {
		limit = {
			has_character_modifier = hiding_from_epidemic
		}
		multiply = 0.25 #75% less likely
	}
	min = 1 # Never totally immune
}

