Bone-Market-Solver/bonemarketsolver/challenge_functions.py

28 lines
747 B
Python
Raw Normal View History

# This is a constant used to calculate difficulty checks. You almost certainly do not need to change this.
DIFFICULTY_SCALER = 0.6
def narrow_challenge(difficulty_level: int, stat: int):
offset = 6 - difficulty_level
stat += offset
if stat > 9:
return 1
elif stat < 2:
return .1
else:
return stat/10
def broad_challenge(difficulty_level: int, stat: int):
2021-08-24 12:40:18 +00:00
chance = DIFFICULTY_SCALER*stat/difficulty_level * 100
chance = chance // 1
chance /= 100
return chance
def mean_outcome(success: int, failure: int, chance: float):
mean_success = success*chance
mean_failure = failure*(1-chance)
combined_mean_outcome = mean_success + mean_failure
return combined_mean_outcome