summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2018-07-11 18:02:26 +0200 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2018-07-11 18:02:26 +0200 |
commit | acb9dd3220a3edcac93aa11d1d74d008e2fb23ed (patch) | |
tree | 98b45af3f7eb9c7d812ed33a07e6a0f665a7a8cd /src/shared/struct | |
parent | fde827cba1ff3d889135c74ee1978098465fd200 (diff) |
"sh_" -> "shr_".
Diffstat (limited to 'src/shared/struct')
-rw-r--r-- | src/shared/struct/shr_armor.erl (renamed from src/shared/struct/sh_armor.erl) | 46 | ||||
-rw-r--r-- | src/shared/struct/shr_attributes.erl (renamed from src/shared/struct/sh_attributes.erl) | 14 | ||||
-rw-r--r-- | src/shared/struct/shr_db_item.erl (renamed from src/shared/struct/sh_db_item.erl) | 10 | ||||
-rw-r--r-- | src/shared/struct/shr_db_query.erl (renamed from src/shared/struct/sh_db_query.erl) | 30 | ||||
-rw-r--r-- | src/shared/struct/shr_db_user.erl (renamed from src/shared/struct/sh_db_user.erl) | 2 | ||||
-rw-r--r-- | src/shared/struct/shr_statistics.erl (renamed from src/shared/struct/sh_statistics.erl) | 30 | ||||
-rw-r--r-- | src/shared/struct/shr_weapon.erl (renamed from src/shared/struct/sh_weapon.erl) | 22 |
7 files changed, 77 insertions, 77 deletions
diff --git a/src/shared/struct/sh_armor.erl b/src/shared/struct/shr_armor.erl index cea2ce9..65445ca 100644 --- a/src/shared/struct/sh_armor.erl +++ b/src/shared/struct/shr_armor.erl @@ -1,4 +1,4 @@ --module(sh_armor). +-module(shr_armor). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -106,61 +106,61 @@ from_id (4) -> }. -spec random_id () -> id(). -random_id () -> sh_roll:between(0, 4). +random_id () -> shr_roll:between(0, 4). -spec apply_to_attributes ( type(), - sh_attributes:type() + shr_attributes:type() ) - -> sh_attributes:type(). + -> shr_attributes:type(). apply_to_attributes (Ar, Att) -> - Constitution = sh_attributes:get_constitution(Att), - Dexterity = sh_attributes:get_dexterity(Att), - Speed = sh_attributes:get_speed(Att), - Strength = sh_attributes:get_strength(Att), - Mind = sh_attributes:get_mind(Att), - Impact = sh_math_util:ceil(20.0 * Ar#armor.coef), - HalfImpact = sh_math_util:ceil(10.0 * Ar#armor.coef), + Constitution = shr_attributes:get_constitution(Att), + Dexterity = shr_attributes:get_dexterity(Att), + Speed = shr_attributes:get_speed(Att), + Strength = shr_attributes:get_strength(Att), + Mind = shr_attributes:get_mind(Att), + Impact = shr_math_util:ceil(20.0 * Ar#armor.coef), + HalfImpact = shr_math_util:ceil(10.0 * Ar#armor.coef), Category = Ar#armor.category, case Category of - kinetic -> sh_attributes:set_unsafe_mind((Mind - Impact), Att); + kinetic -> shr_attributes:set_unsafe_mind((Mind - Impact), Att); leather -> - sh_attributes:set_unsafe_constitution + shr_attributes:set_unsafe_constitution ( (Constitution - HalfImpact), - sh_attributes:set_unsafe_dexterity((Dexterity - HalfImpact), Att) + shr_attributes:set_unsafe_dexterity((Dexterity - HalfImpact), Att) ); chain -> - sh_attributes:set_unsafe_constitution + shr_attributes:set_unsafe_constitution ( (Constitution - HalfImpact), - sh_attributes:set_unsafe_dexterity + shr_attributes:set_unsafe_dexterity ( (Dexterity - HalfImpact), - sh_attributes:set_unsafe_speed((Speed - Impact), Att) + shr_attributes:set_unsafe_speed((Speed - Impact), Att) ) ); plate -> - sh_attributes:set_unsafe_constitution + shr_attributes:set_unsafe_constitution ( (Constitution - HalfImpact), - sh_attributes:set_unsafe_dexterity + shr_attributes:set_unsafe_dexterity ( (Dexterity - HalfImpact), - sh_attributes:set_unsafe_speed + shr_attributes:set_unsafe_speed ( (Speed - Impact), - sh_attributes:set_unsafe_strength((Strength - Impact), Att) + shr_attributes:set_unsafe_strength((Strength - Impact), Att) ) ) ) end. --spec get_resistance_to (sh_weapon:damage_type(), type()) -> non_neg_integer(). +-spec get_resistance_to (shr_weapon:damage_type(), type()) -> non_neg_integer(). get_resistance_to (DamageType, Armor) -> ArmorCategory = Armor#armor.category, BaseResistance = @@ -182,4 +182,4 @@ get_resistance_to (DamageType, Armor) -> ArmorCoefficient = Armor#armor.coef, ActualResistance = (ArmorCoefficient * BaseResistance), - sh_math_util:ceil(ActualResistance). + shr_math_util:ceil(ActualResistance). diff --git a/src/shared/struct/sh_attributes.erl b/src/shared/struct/shr_attributes.erl index 9b4478f..23824e4 100644 --- a/src/shared/struct/sh_attributes.erl +++ b/src/shared/struct/shr_attributes.erl @@ -1,4 +1,4 @@ --module(sh_attributes). +-module(shr_attributes). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -126,10 +126,10 @@ set_unsafe_strength (Val, Att) -> set_strength(make_safe(Val), Att). random () -> #attributes { - constitution = sh_roll:percentage(), - dexterity = sh_roll:percentage(), - intelligence = sh_roll:percentage(), - mind = sh_roll:percentage(), - speed = sh_roll:percentage(), - strength = sh_roll:percentage() + constitution = shr_roll:percentage(), + dexterity = shr_roll:percentage(), + intelligence = shr_roll:percentage(), + mind = shr_roll:percentage(), + speed = shr_roll:percentage(), + strength = shr_roll:percentage() }. diff --git a/src/shared/struct/sh_db_item.erl b/src/shared/struct/shr_db_item.erl index 3692a88..546462e 100644 --- a/src/shared/struct/sh_db_item.erl +++ b/src/shared/struct/shr_db_item.erl @@ -1,4 +1,4 @@ --module(sh_db_item). +-module(shr_db_item). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -8,7 +8,7 @@ db_item, { id :: any(), - perm :: sh_db_user:permission(), + perm :: shr_db_user:permission(), val :: any() } ). @@ -47,7 +47,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --spec new (any(), sh_db_user:permission(), any()) -> type(). +-spec new (any(), shr_db_user:permission(), any()) -> type(). new (ID, Permission, Value) -> #db_item { @@ -59,13 +59,13 @@ new (ID, Permission, Value) -> -spec get_id (type()) -> any(). get_id (#db_item { id = Result }) -> Result. --spec get_permission (type()) -> sh_db_user:permission(). +-spec get_permission (type()) -> shr_db_user:permission(). get_permission (#db_item { perm = Result }) -> Result. -spec get_value (type()) -> any(). get_value (#db_item { val = Result }) -> Result. --spec set_permission (sh_db_user:permission(), type()) -> type(). +-spec set_permission (shr_db_user:permission(), type()) -> type(). set_permission (Perm, Item) -> Item#db_item{ perm = Perm }. -spec set_value (any(), type()) -> type(). diff --git a/src/shared/struct/sh_db_query.erl b/src/shared/struct/shr_db_query.erl index 47d85d6..284cc2c 100644 --- a/src/shared/struct/sh_db_query.erl +++ b/src/shared/struct/shr_db_query.erl @@ -1,4 +1,4 @@ --module(sh_db_query). +-module(shr_db_query). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -36,7 +36,7 @@ ( set_perm, { - perm :: sh_db_user:permission() + perm :: shr_db_user:permission() } ). @@ -54,7 +54,7 @@ { db :: atom(), id :: any(), - user :: sh_db_user:user(), + user :: shr_db_user:user(), ops :: list(db_query_master_op()) } ). @@ -92,7 +92,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --spec get_user (db_query()) -> sh_db_user:user(). +-spec get_user (db_query()) -> shr_db_user:user(). get_user (#db_query{ user = Result }) -> Result. -spec apply_update_indexed (#update_indexed{}, any()) -> any(). @@ -142,27 +142,27 @@ apply_op_to (Op, Elem) when is_record(Op, update_indexed) -> -spec apply_master_op_to ( db_query_master_op(), - sh_db_item:type() + shr_db_item:type() ) - -> sh_db_item:type(). + -> shr_db_item:type(). apply_master_op_to (MOp, Elem) when is_record(MOp, set_perm) -> NewPerm = MOp#set_perm.perm, - sh_db_item:set_permission(NewPerm, Elem); + shr_db_item:set_permission(NewPerm, Elem); apply_master_op_to (MOp, Elem) when is_record(MOp, set_val) -> NewVal = MOp#set_val.val, - sh_db_item:set_value(NewVal, Elem); + shr_db_item:set_value(NewVal, Elem); apply_master_op_to (MOp, Elem) -> - OldValue = sh_db_item:get_value(Elem), + OldValue = shr_db_item:get_value(Elem), NewValue = apply_op_to(MOp, OldValue), - sh_db_item:set_value(NewValue, Elem). + shr_db_item:set_value(NewValue, Elem). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --spec new (atom(), any(), sh_db_user:user(), list(op())) -> type(). +-spec new (atom(), any(), shr_db_user:user(), list(op())) -> type(). new (DBName, ObjectID, User, Ops) -> #db_query { @@ -199,14 +199,14 @@ get_entry_id (#db_query{ id = Result }) -> Result. -spec apply_to ( db_query(), - sh_db_item:type() + shr_db_item:type() ) - -> ({'ok', sh_db_item:type()} | 'error'). + -> ({'ok', shr_db_item:type()} | 'error'). apply_to (DBQuery, DBItem) -> true = - sh_db_user:can_access + shr_db_user:can_access ( - sh_db_item:get_permission(DBItem), + shr_db_item:get_permission(DBItem), get_user(DBQuery) ), MOps = DBQuery#db_query.ops, diff --git a/src/shared/struct/sh_db_user.erl b/src/shared/struct/shr_db_user.erl index f2d4dfe..01840e2 100644 --- a/src/shared/struct/sh_db_user.erl +++ b/src/shared/struct/shr_db_user.erl @@ -1,4 +1,4 @@ --module(sh_db_user). +-module(shr_db_user). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/shared/struct/sh_statistics.erl b/src/shared/struct/shr_statistics.erl index 497cf41..cf48d96 100644 --- a/src/shared/struct/sh_statistics.erl +++ b/src/shared/struct/shr_statistics.erl @@ -1,4 +1,4 @@ --module(sh_statistics). +-module(shr_statistics). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -143,28 +143,28 @@ get_damages (Stats) -> -spec new ( - sh_attributes:type(), - {sh_weapon:id(), sh_weapon:id()}, - sh_armor:id() + shr_attributes:type(), + {shr_weapon:id(), shr_weapon:id()}, + shr_armor:id() ) -> type(). new (BaseAttributes, WeaponIDs, ArmorID) -> {ActiveWeaponID, _} = WeaponIDs, - ActiveWeapon = sh_weapon:from_id(ActiveWeaponID), - {MinDamage, MaxDamage} = sh_weapon:get_damages(ActiveWeapon), - Armor = sh_armor:from_id(ArmorID), + ActiveWeapon = shr_weapon:from_id(ActiveWeaponID), + {MinDamage, MaxDamage} = shr_weapon:get_damages(ActiveWeapon), + Armor = shr_armor:from_id(ArmorID), Attributes = - sh_armor:apply_to_attributes + shr_armor:apply_to_attributes ( Armor, - sh_weapon:apply_to_attributes(ActiveWeapon, BaseAttributes) + shr_weapon:apply_to_attributes(ActiveWeapon, BaseAttributes) ), - 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), + Constitution = shr_attributes:get_constitution(Attributes), + Dexterity = shr_attributes:get_dexterity(Attributes), + Intelligence = shr_attributes:get_intelligence(Attributes), + Mind = shr_attributes:get_mind(Attributes), + Speed = shr_attributes:get_speed(Attributes), + Strength = shr_attributes:get_strength(Attributes), DamageBaseModifier = damage_base_modifier(Strength), #statistics diff --git a/src/shared/struct/sh_weapon.erl b/src/shared/struct/shr_weapon.erl index 74c7a42..3ecb749 100644 --- a/src/shared/struct/sh_weapon.erl +++ b/src/shared/struct/shr_weapon.erl @@ -1,4 +1,4 @@ --module(sh_weapon). +-module(shr_weapon). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -124,7 +124,7 @@ get_ranges (Wp) -> get_damages (Wp) -> Coef = Wp#weapon.coef, {Min, Max} = damages_of_type(Wp#weapon.range_type, Wp#weapon.damage_mod), - {sh_math_util:ceil(Min * Coef), sh_math_util:ceil(Max * Coef)}. + {shr_math_util:ceil(Min * Coef), shr_math_util:ceil(Max * Coef)}. -spec can_parry (type()) -> boolean(). can_parry (Wp) -> (Wp#weapon.range_type == melee). @@ -382,23 +382,23 @@ from_id (24) -> }. -spec random_id () -> id(). -random_id () -> sh_roll:between(0, 24). +random_id () -> shr_roll:between(0, 24). -spec apply_to_attributes ( type(), - sh_attributes:type() + shr_attributes:type() ) - -> sh_attributes:type(). + -> shr_attributes:type(). apply_to_attributes (Weapon, Attributes) -> - Dexterity = sh_attributes:get_dexterity(Attributes), - Speed = sh_attributes:get_speed(Attributes), + Dexterity = shr_attributes:get_dexterity(Attributes), + Speed = shr_attributes:get_speed(Attributes), RangeModifier = Weapon#weapon.range_mod, DamageModifier = Weapon#weapon.damage_mod, Impact = (20.0 * Weapon#weapon.coef), - FullImpact = sh_math_util:ceil(Impact), - QuarterImpact = sh_math_util:ceil(Impact / 4.0), + FullImpact = shr_math_util:ceil(Impact), + QuarterImpact = shr_math_util:ceil(Impact / 4.0), ResultingDexterity = case RangeModifier of @@ -411,8 +411,8 @@ apply_to_attributes (Weapon, Attributes) -> light -> (Speed - QuarterImpact) end, - S0Attributes = sh_attributes:set_unsafe_speed(ResultingSpeed, Attributes), + S0Attributes = shr_attributes:set_unsafe_speed(ResultingSpeed, Attributes), S1Attributes = - sh_attributes:set_unsafe_dexterity(ResultingDexterity, S0Attributes), + shr_attributes:set_unsafe_dexterity(ResultingDexterity, S0Attributes), S1Attributes. |