| summaryrefslogtreecommitdiff | 
diff options
| -rw-r--r-- | other/attrib_stats.txt | 18 | ||||
| -rw-r--r-- | src/type/statistics.erl | 73 | 
2 files changed, 91 insertions, 0 deletions
| diff --git a/other/attrib_stats.txt b/other/attrib_stats.txt index 264772f..a5f7107 100644 --- a/other/attrib_stats.txt +++ b/other/attrib_stats.txt @@ -9,16 +9,22 @@  {Stats     {Movement Points        Controlled by: Speed +      ((Speed)^1.8)/20     }     {Health        Controlled by: Constitution +      ((Constitution)^1.8)/20     }     {Dodges        Controlled by: average(Dexterity, Mind, Speed) +      Max: 75% +      Min: 5%     }     {Parries        Controlled by: average(Dexterity, Speed, Strength)        Melee only +      Max: 75% +      Min: 0%     }     {Physical Weapons        {Damage @@ -26,12 +32,18 @@        }        {Accuracy           Controlled by: Dexterity +         Max: 100% +         Min: 15%        }        {Double Hits           Controlled by: Speed +         Max: 100% +         Min: 0%        }        {Critical Hits           Controlled by: Intelligence +         Max: 100% +         Min: 0%        }     }     {Magical Weapons @@ -40,12 +52,18 @@        }        {Accuracy           Controlled by: Mind +         Max: 100% +         Min: 15%        }        {Double Hits           Controlled by: Speed +         Max: 100% +         Min: 0%        }        {Critical Hits           Controlled by: Dexterity +         Max: 100% +         Min: 0%        }     }  } 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)) +   }. | 


