From 437d7bea7d2f018ba81741ae691dc543df535eeb Mon Sep 17 00:00:00 2001 From: nsensfel Date: Wed, 17 Jan 2018 16:34:10 +0100 Subject: Starting a new branch to add stats. --- src/calc/calc_stats.erl | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/calc/calc_stats.erl (limited to 'src/calc/calc_stats.erl') 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. -- cgit v1.2.3-70-g09d2