From 5f08adbfe0dea0acd832f8ff8dddbc6fe5234200 Mon Sep 17 00:00:00 2001 From: nsensfel Date: Tue, 29 Jan 2019 18:11:57 +0100 Subject: Unstucks characters that are on 0% due to luck. I haven't tested this luck mechanism with medium or high chances actions yet. --- src/shared/shr_roll.erl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/shared') diff --git a/src/shared/shr_roll.erl b/src/shared/shr_roll.erl index e03d548..0e44d63 100644 --- a/src/shared/shr_roll.erl +++ b/src/shared/shr_roll.erl @@ -61,9 +61,15 @@ percentage_with_luck (Chance, Luck) -> ModedRoll = max(0, min((Roll - Luck), 100)), IsSuccess = (Roll =< ModedChance), + BadLuckBonus = + case (Luck < 0) of + true -> 1; + false -> 0 + end, + { ModedRoll, IsSuccess, - calculate_costs(IsSuccess, Roll, Chance), + (BadLuckBonus + calculate_costs(IsSuccess, Roll, Chance)), (-1 * calculate_costs(IsSuccess, Roll, ModedChance)) }. -- cgit v1.2.3-70-g09d2