summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2019-01-29 18:11:57 +0100
committernsensfel <SpamShield0@noot-noot.org>2019-01-29 18:11:57 +0100
commit5f08adbfe0dea0acd832f8ff8dddbc6fe5234200 (patch)
tree917db36c395e0e634ecffd7b8a77e7d791475680 /src
parente7f43fd8b82ec6fdd118557e5c87ab0697e179a1 (diff)
Unstucks characters that are on 0% due to luck.
I haven't tested this luck mechanism with medium or high chances actions yet.
Diffstat (limited to 'src')
-rw-r--r--src/shared/shr_roll.erl8
1 files changed, 7 insertions, 1 deletions
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))
}.