summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2018-01-17 16:34:10 +0100 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2018-01-17 16:34:10 +0100 |
commit | 437d7bea7d2f018ba81741ae691dc543df535eeb (patch) | |
tree | c13b7a130ade07e1c66d5b6c89d898983a14c9ae /src/calc/calc_stats.erl | |
parent | 0cbf2c544d133ba32dc668d30b071cb033496ba3 (diff) |
Starting a new branch to add stats.
Diffstat (limited to 'src/calc/calc_stats.erl')
-rw-r--r-- | src/calc/calc_stats.erl | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/calc/calc_stats.erl b/src/calc/calc_stats.erl new file mode 100644 index 0000000..65a3aec --- /dev/null +++ b/src/calc/calc_stats.erl @@ -0,0 +1,29 @@ +-module(calc_stats). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-export +( + [ + weapon_min_damage/2, + weapon_hit_chances/1 + ] +). +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +weapon_min_damage (WeaponProf) -> + +weapon_hit_chances (WeaponProf) -> + HitChance = 50 + trunc(math:ceil(WeaponProf / 2)), + case HitChance of + % Not a satisfactory way to handle double hits, as it does not allow + % the players to specialize their characters for it. + N when N > 75 -> {HitChance, 75 - HitChance}; + _ -> {HitChance, 0} + end. |