﻿statdecay_effect = {
	if = {
		limit = {
			NOR = {
			has_trait = education_martial_1
			has_trait = education_martial_2
			has_trait = education_martial_3
			has_trait = education_martial_4
			has_trait = education_martial_5
			}
			martial >= 20
			age >= 30
			age < 40
		}
		random = {
		chance = 10
			add_character_modifier = {
			modifier = martial_soft_modifier
			}
		}
	}
	if = {
		limit = {
			NOR = {
			has_trait = education_martial_1
			has_trait = education_martial_2
			has_trait = education_martial_3
			has_trait = education_martial_4
			has_trait = education_martial_5
			}
			martial >= 20
			age >= 40
			age < 50
		}
		random = {
		chance = 20
			add_character_modifier = {
			modifier = martial_soft_modifier
			}
		}
	}
	if = {
		limit = { 
			martial >= 15
			age >= 50
			age < 60
		}
		random = {
		chance = 30
			add_character_modifier = {
			modifier = martial_soft_modifier
			}
		}
	}
	if = {
		limit = { 
			martial >= 10
			age >= 60
			age < 70
		}
		random = {
		chance = 40
			add_character_modifier = {
			modifier = martial_soft_modifier
			}
		}
	}
	if = {
		limit = { 
			martial >= 10
			age >= 70
		}
		random = {
		chance = 50
			add_character_modifier = {
			modifier = martial_soft_modifier
			}
		}
	}
	if = {
		limit = {
			NOR = {
			has_trait = education_diplomacy_1
			has_trait = education_diplomacy_2
			has_trait = education_diplomacy_3
			has_trait = education_diplomacy_4
			has_trait = education_diplomacy_5
			}
			diplomacy >= 20
			age >= 30
			age < 40
		}
		random = {
		chance = 10
			add_character_modifier = {
			modifier = diplomacy_soft_modifier
			}
		}
	}
	if = {
		limit = {
			NOR = {
			has_trait = education_diplomacy_1
			has_trait = education_diplomacy_2
			has_trait = education_diplomacy_3
			has_trait = education_diplomacy_4
			has_trait = education_diplomacy_5
			}
			diplomacy >= 20
			age >= 40
			age < 50
		}
		random = {
		chance = 20
			add_character_modifier = {
			modifier = diplomacy_soft_modifier
			}
		}
	}
	if = {
		limit = { 
			diplomacy >= 15
			age >= 50
			age < 60
		}
		random = {
		chance = 30
			add_character_modifier = {
			modifier = diplomacy_soft_modifier
			}
		}
	}
	if = {
		limit = { 
			diplomacy >= 10
			age >= 60
			age < 70
		}
		random = {
		chance = 40
			add_character_modifier = {
			modifier = diplomacy_soft_modifier
			}
		}
	}
	if = {
		limit = { 
			diplomacy >= 10
			age >= 70
		}
		random = {
		chance = 50
			add_character_modifier = {
			modifier = diplomacy_soft_modifier
			}
		}
	}
	if = {
		limit = {
			NOR = {
			has_trait = education_intrigue_1
			has_trait = education_intrigue_2
			has_trait = education_intrigue_3
			has_trait = education_intrigue_4
			has_trait = education_intrigue_5
			}
			intrigue >= 20
			age >= 30
			age < 40
		}
		random = {
		chance = 10
			add_character_modifier = {
			modifier = intrigue_soft_modifier
			}
		}
	}
	if = {
		limit = {
			NOR = {
			has_trait = education_intrigue_1
			has_trait = education_intrigue_2
			has_trait = education_intrigue_3
			has_trait = education_intrigue_4
			has_trait = education_intrigue_5
			}
			intrigue >= 20
			age >= 40
			age < 50
		}
		random = {
		chance = 20
			add_character_modifier = {
			modifier = intrigue_soft_modifier
			}
		}
	}
	if = {
		limit = { 
			intrigue >= 15
			age >= 50
			age < 60
		}
		random = {
		chance = 30
			add_character_modifier = {
			modifier = intrigue_soft_modifier
			}
		}
	}
	if = {
		limit = { 
			intrigue >= 10
			age >= 60
			age < 70
		}
		random = {
		chance = 40
			add_character_modifier = {
			modifier = intrigue_soft_modifier
			}
		}
	}
	if = {
		limit = { 
			intrigue >= 10
			age >= 70
		}
		random = {
		chance = 50
			add_character_modifier = {
			modifier = intrigue_soft_modifier
			}
		}
	}
	if = {
		limit = {
			NOR = {
			has_trait = education_learning_1
			has_trait = education_learning_2
			has_trait = education_learning_3
			has_trait = education_learning_4
			has_trait = education_learning_5
			}
			learning >= 20
			age >= 30
			age < 40
		}
		random = {
		chance = 10
			add_character_modifier = {
			modifier = learning_soft_modifier
			}
		}
	}
	if = {
		limit = {
			NOR = {
			has_trait = education_learning_1
			has_trait = education_learning_2
			has_trait = education_learning_3
			has_trait = education_learning_4
			has_trait = education_learning_5
			}
			learning >= 20
			age >= 40
			age < 50
		}
		random = {
		chance = 20
			add_character_modifier = {
			modifier = learning_soft_modifier
			}
		}
	}
	if = {
		limit = { 
			learning >= 15
			age >= 50
			age < 60
		}
		random = {
		chance = 30
			add_character_modifier = {
			modifier = learning_soft_modifier
			}
		}
	}
	if = {
		limit = { 
			learning >= 10
			age >= 60
			age < 70
		}
		random = {
		chance = 40
			add_character_modifier = {
			modifier = learning_soft_modifier
			}
		}
	}
	if = {
		limit = { 
			learning >= 10
			age >= 70
		}
		random = {
		chance = 50
			add_character_modifier = {
			modifier = learning_soft_modifier
			}
		}
	}
	if = {
		limit = {
			NOR = {
			has_trait = education_stewardship_1
			has_trait = education_stewardship_2
			has_trait = education_stewardship_3
			has_trait = education_stewardship_4
			has_trait = education_stewardship_5
			}
			stewardship >= 20
			age >= 30
			age < 40
		}
		random = {
		chance = 10
			add_character_modifier = {
			modifier = stewardship_soft_modifier
			}
		}
	}
	if = {
		limit = {
			NOR = {
			has_trait = education_stewardship_1
			has_trait = education_stewardship_2
			has_trait = education_stewardship_3
			has_trait = education_stewardship_4
			has_trait = education_stewardship_5
			}
			stewardship >= 20
			age >= 40
			age < 50
		}
		random = {
		chance = 20
			add_character_modifier = {
			modifier = stewardship_soft_modifier
			}
		}
	}
	if = {
		limit = { 
			stewardship >= 15
			age >= 50
			age < 60
		}
		random = {
		chance = 30
			add_character_modifier = {
			modifier = stewardship_soft_modifier
			}
		}
	}
	if = {
		limit = { 
			stewardship >= 10
			age >= 60
			age < 70
		}
		random = {
		chance = 40
			add_character_modifier = {
			modifier = stewardship_soft_modifier
			}
		}
	}
	if = {
		limit = { 
			stewardship >= 10
			age >= 70
		}
		random = {
		chance = 50
			add_character_modifier = {
			modifier = stewardship_soft_modifier
			}
		}
	}
	
#Diseases
	if = {
		limit = {
			OR = {
			has_trait = typhus
			has_trait = cancer
			has_trait = measles
			has_trait = dysentery
			has_trait = pneumonic
			has_trait = smallpox
			has_trait = ergotism
			}	
		}
		random = {
		chance = 75
			random_list = {
			20 = { add_character_modifier = { modifier = martial_soft_modifier } }
			20 = { add_character_modifier = { modifier = diplomacy_soft_modifier } }
			20 = { add_character_modifier = { modifier = intrigue_soft_modifier } }
			20 = { add_character_modifier = { modifier = learning_soft_modifier } }
			20 = { add_character_modifier = { modifier = stewardship_soft_modifier } }
			}
		}
	}

#Hardcap
	if = {
		limit = {
			age >= 30
			highest_skill_value >= 40
		}
		random = {
		chance = 25
			random_list = {
			20 = { add_character_modifier = { modifier = martial_soft_modifier } }
			20 = { add_character_modifier = { modifier = diplomacy_soft_modifier } }
			20 = { add_character_modifier = { modifier = intrigue_soft_modifier } }
			20 = { add_character_modifier = { modifier = learning_soft_modifier } }
			20 = { add_character_modifier = { modifier = stewardship_soft_modifier } }
			}
		}
	}
	if = {
		limit = { 
			martial >= 40
			age >= 30
		}
		random = {
		chance = 25
			add_character_modifier = {
			modifier = martial_soft_modifier
			}
		}
	}
	if = {
		limit = { 
			diplomacy >= 40
			age >= 30
		}
		random = {
		chance = 25
			add_character_modifier = {
			modifier = diplomacy_soft_modifier
			}
		}
	}
	if = {
		limit = { 
			learning >= 40
			age >= 30
		}
		random = {
		chance = 25
			add_character_modifier = {
			modifier = learning_soft_modifier
			}
		}
	}
	if = {
		limit = { 
			intrigue >= 40
			age >= 30
		}
		random = {
		chance = 25
			add_character_modifier = {
			modifier = intrigue_soft_modifier
			}
		}
	}
	if = {
		limit = { 
			stewardship >= 40
			age >= 30
		}
		random = {
		chance = 25
			add_character_modifier = {
			modifier = stewardship_soft_modifier
			}
		}
	}
}