summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-06-06 16:42:42 +0200
committernsensfel <SpamShield0@noot-noot.org>2018-06-06 16:42:42 +0200
commit82081d45fd64294f4bc417085e06284f3487b32f (patch)
tree1da77dd39829f8bfdcbf200df6a12a0a53edf661 /src/shared/struct/sh_statistics.erl
parentee9c2ac044cc77b80f30420c8f0788cad4281084 (diff)
...
Diffstat (limited to 'src/shared/struct/sh_statistics.erl')
-rw-r--r--src/shared/struct/sh_statistics.erl29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/shared/struct/sh_statistics.erl b/src/shared/struct/sh_statistics.erl
index 7cf2b06..92cd8d6 100644
--- a/src/shared/struct/sh_statistics.erl
+++ b/src/shared/struct/sh_statistics.erl
@@ -54,17 +54,14 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--spec ceil (float()) -> integer().
-ceil (F) ->
+-spec float_to_int (float()) -> integer().
+float_to_int (F) ->
I = trunc(F),
case (F > I) of
true -> (I + 1);
_ -> I
end.
--spec float_to_int (float()) -> integer().
-float_to_int (F) -> ceil(F).
-
-spec min_max (number(), number(), number()) -> number().
min_max (Min, Max, V) -> min(Max, max(Min, V)).
@@ -146,21 +143,21 @@ get_damages (Stats) ->
-spec new
(
- attributes:type(),
- {weapon:id(), weapon:id()}
+ sh_attributes:type(),
+ {sh_weapon:id(), sh_weapon:id()}
)
-> type().
new (BaseAttributes, WeaponIDs) ->
{ActiveWeaponID, _} = WeaponIDs,
- ActiveWeapon = weapon:from_id(ActiveWeaponID),
- {MinDamage, MaxDamage} = weapon:get_damages(ActiveWeapon),
- Attributes = weapon:apply_to_attributes(BaseAttributes, ActiveWeapon),
- Constitution = attributes:get_constitution(Attributes),
- Dexterity = attributes:get_dexterity(Attributes),
- Intelligence = attributes:get_intelligence(Attributes),
- Mind = attributes:get_mind(Attributes),
- Speed = attributes:get_speed(Attributes),
- Strength = attributes:get_strength(Attributes),
+ ActiveWeapon = sh_weapon:from_id(ActiveWeaponID),
+ {MinDamage, MaxDamage} = sh_weapon:get_damages(ActiveWeapon),
+ Attributes = sh_weapon:apply_to_attributes(BaseAttributes, ActiveWeapon),
+ Constitution = sh_attributes:get_constitution(Attributes),
+ Dexterity = sh_attributes:get_dexterity(Attributes),
+ Intelligence = sh_attributes:get_intelligence(Attributes),
+ Mind = sh_attributes:get_mind(Attributes),
+ Speed = sh_attributes:get_speed(Attributes),
+ Strength = sh_attributes:get_strength(Attributes),
DamageBaseModifier = damage_base_modifier(Strength),
#statistics