2021-08-24 12:29:48 +00:00
|
|
|
# This is a constant used to calculate difficulty checks. You almost certainly do not need to change this.
|
|
|
|
DIFFICULTY_SCALER = 0.6
|
|
|
|
|
2021-08-24 11:18:20 +00:00
|
|
|
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
|
|
|
|
|
2021-08-24 12:29:48 +00:00
|
|
|
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
|
2021-08-24 12:29:48 +00:00
|
|
|
|
|
|
|
return chance
|
|
|
|
|
2021-08-24 11:18:20 +00:00
|
|
|
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
|