| summaryrefslogtreecommitdiff | 
diff options
Diffstat (limited to 'src/calc')
| -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. | 


