summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/type/statistics.erl | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/type/statistics.erl b/src/type/statistics.erl new file mode 100644 index 0000000..ad92917 --- /dev/null +++ b/src/type/statistics.erl @@ -0,0 +1,73 @@ +-module(statistics). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-record +( + statistics, + { + movement_points, + health, + dodges, + parries, + damage_min, + damage_max, + accuracy, + double_hits, + critical_hits + } +). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%% Accessors +-export +( + [ + get_movement_points/1, + get_health/1, + get_dodges/1, + get_parries/1, + get_damage_min/1, + get_damage_max/1, + get_accuracy/1, + get_double_hits/1, + get_critical_hits/1 + ] +). + +-export +( + [ + calc_for/2 + ] +). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%% Accessors +get_movement_points (Stats) -> Stats#statistics.movement_points. +get_health (Stats) -> Stats#statistics.health. +get_dodges (Stats) -> Stats#statistics.dodges. +get_parries (Stats) -> Stats#statistics.parries. +get_damage_min (Stats) -> Stats#statistics.damage_min. +get_damage_max (Stats) -> Stats#statistics.damage_max. +get_accuracy (Stats) -> Stats#statistics.accuracy. +get_double_hits (Stats) -> Stats#statistics.double_hits. +get_critical_hits (Stats) -> Stats#statistics.critical_hits. + +calc_for (Att, Wp) -> + #statistics + { + movement_points = + trunc(math:ceil(math:pow(attributes:get_speed(Att), 1.8)/20)), + health = + trunc(math:ceil(math:pow(attributes:get_constitution(Att), 1.8)/20)) + }. |