summaryrefslogtreecommitdiff |
diff options
author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2019-08-10 14:49:13 +0200 |
---|---|---|
committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2019-08-10 14:49:13 +0200 |
commit | 9d45e68f8daa748c58e28c77434b1377c508e32f (patch) | |
tree | b7f254c97bc3f533bbd9d5a731def016a7f90376 | |
parent | 65c103dae552d511a0ec3bd03ef402ecc71501e3 (diff) |
Statistics -> Attributes.
-rw-r--r-- | include/base_attributes.hrl | 110 | ||||
-rw-r--r-- | src/battle/mechanic/action/btl_action_attack.erl | 46 | ||||
-rw-r--r-- | src/battle/mechanic/action/btl_action_move.erl | 4 | ||||
-rw-r--r-- | src/battle/struct/btl_character.erl | 8 | ||||
-rw-r--r-- | src/shared/struct/shr_attributes.erl (renamed from src/shared/struct/shr_statistics.erl) | 78 | ||||
-rw-r--r-- | src/shared/struct/shr_character.erl | 32 | ||||
-rw-r--r-- | src/shared/struct/shr_omnimods.erl | 28 |
7 files changed, 135 insertions, 171 deletions
diff --git a/include/base_attributes.hrl b/include/base_attributes.hrl index 86d123d..e0b61e3 100644 --- a/include/base_attributes.hrl +++ b/include/base_attributes.hrl @@ -1,97 +1,61 @@ -define(ATTRIBUTE_DAMAGE_MODIFIER_MIN, 0). -define(ATTRIBUTE_DAMAGE_MODIFIER_MAX, 300). -define(ATTRIBUTE_DAMAGE_MODIFIER_DEFAULT, 100). --define -( - ATTRIBUTE_DAMAGE_MODIFIER_SCALE_FACTOR, - ( - (?ATTRIBUTE_DAMAGE_MODIFIER_DEFAULT - ?ATTRIBUTE_DAMAGE_MODIFIER_MIN) - / (?ATTRIBUTE_DAMAGE_MODIFIER_MAX - ?ATTRIBUTE_DAMAGE_MODIFIER_MIN) - ) -). --define -( - ATTRIBUTE_DAMAGE_MODIFIER_SCALE_UNIT, - (?ATTRIBUTE_DAMAGE_MODIFIER_SCALE_FACTOR * ?ATTRIBUTE_DAMAGE_MODIFIER_MAX) -) +-define(ATTRIBUTE_DAMAGE_MODIFIER_COST, 1). -define(ATTRIBUTE_MOVEMENT_POINTS_MIN, 8). -define(ATTRIBUTE_MOVEMENT_POINTS_MAX, 200). -define(ATTRIBUTE_MOVEMENT_POINTS_DEFAULT, 32). --define -( - ATTRIBUTE_MOVEMENT_POINTS_SCALE_FACTOR, - ( - (?ATTRIBUTE_MOVEMENT_POINTS_DEFAULT - ?ATTRIBUTE_MOVEMENT_POINTS_MIN) - / (?ATTRIBUTE_MOVEMENT_POINTS_MAX - ?ATTRIBUTE_MOVEMENT_POINTS_MIN) - ) -). --define -( - ATTRIBUTE_MOVEMENT_POINTS_SCALE_UNIT, - (?ATTRIBUTE_MOVEMENT_POINTS_SCALE_FACTOR * ?ATTRIBUTE_MOVEMENT_POINTS_MAX) -) +-define(ATTRIBUTE_MOVEMENT_POINTS_COST, 1). -define(ATTRIBUTE_HEALTH_MIN, 1). -define(ATTRIBUTE_HEALTH_MAX, 500). -define(ATTRIBUTE_HEALTH_DEFAULT, 100). --define -( - ATTRIBUTE_HEALTH_SCALE_FACTOR, - ( - (?ATTRIBUTE_HEALTH_DEFAULT - ?ATTRIBUTE_HEALTH_MIN) - / (?ATTRIBUTE_HEALTH_MAX - ?ATTRIBUTE_HEALTH_MIN) - ) -). --define -( - ATTRIBUTE_HEALTH_SCALE_UNIT, - (?ATTRIBUTE_HEALTH_SCALE_FACTOR * ?ATTRIBUTE_HEALTH_MAX) -) +-define(ATTRIBUTE_HEALTH_COST, 1). --define(ATTRIBUTE_DODGE_MIN, 1). +-define(ATTRIBUTE_DODGE_MIN, 0). -define(ATTRIBUTE_DODGE_MAX, 175). -define(ATTRIBUTE_DODGE_DEFAULT, 50). --define -( - ATTRIBUTE_DODGE_SCALE_FACTOR, - ( - (?ATTRIBUTE_DODGE_DEFAULT - ?ATTRIBUTE_DODGE_MIN) - / (?ATTRIBUTE_DODGE_MAX - ?ATTRIBUTE_DODGE_MIN) - ) -). --define -( - ATTRIBUTE_DODGE_SCALE_UNIT, - (?ATTRIBUTE_DODGE_SCALE_FACTOR * ?ATTRIBUTE_DODGE_MAX) -) +-define(ATTRIBUTE_DODGE_COST, 1). + +-define(ATTRIBUTE_PARRIES_MIN, 0). +-define(ATTRIBUTE_PARRIES_MAX, 100). +-define(ATTRIBUTE_PARRIES_DEFAULT, 5). +-define(ATTRIBUTE_PARRIES_COST, 1). + +-define(ATTRIBUTE_ACCURACY_MIN, 0). +-define(ATTRIBUTE_ACCURACY_MAX, 100). +-define(ATTRIBUTE_ACCURACY_DEFAULT, 50). +-define(ATTRIBUTE_ACCURACY_COST, 1). + +-define(ATTRIBUTE_DOUBLE_HITS_MIN, 0). +-define(ATTRIBUTE_DOUBLE_HITS_MAX, 100). +-define(ATTRIBUTE_DOUBLE_HITS_DEFAULT, 5). +-define(ATTRIBUTE_DOUBLE_HITS_COST, 1). + +-define(ATTRIBUTE_CRITICAL_HITS_MIN, 0). +-define(ATTRIBUTE_CRITICAL_HITS_MAX, 100). +-define(ATTRIBUTE_CRITICAL_HITS_DEFAULT, 10). +-define(ATTRIBUTE_CRITICAL_HITS_COST, 1). -define(ATTRIBUTE_DEFENSE_SCORE_MIN, 0). -define(ATTRIBUTE_DEFENSE_SCORE_MAX, 300). -define(ATTRIBUTE_DEFENSE_SCORE_BASE, 50). --define -( - ATTRIBUTE_DEFENSE_SCORE_SCALE_FACTOR, - ( - (?ATTRIBUTE_DEFENSE_SCORE_DEFAULT - ?ATTRIBUTE_DEFENSE_SCORE_MIN) - / (?ATTRIBUTE_DEFENSE_SCORE_MAX - ?ATTRIBUTE_DEFENSE_SCORE_MIN) - ) -). --define -( - ATTRIBUTE_DEFENSE_SCORE_SCALE_UNIT, - (?ATTRIBUTE_DEFENSE_SCORE_SCALE_FACTOR * ?ATTRIBUTE_DEFENSE_SCORE_MAX) -) +-define(ATTRIBUTE_DEFENSE_SCORE_COST, 1). + +-define(ATTRIBUTE_ATTACK_SCORE_MIN, 0). +-define(ATTRIBUTE_ATTACK_SCORE_MAX, 300). +-define(ATTRIBUTE_ATTACK_SCORE_BASE, 50). +-define(ATTRIBUTE_ATTACK_SCORE_COST, 1). -define ( - ATTRIBUTE_POINTS, - trunc + ATTRIBUTE_ARMOR_POINTS, ( - (?ATTRIBUTE_DAMAGE_MODIFIER_SCALE_FACTOR * 100) - + (?ATTRIBUTE_MOVEMENT_POINTS_SCALE_FACTOR * 100) - + (?ATTRIBUTE_HEALTH_SCALE_FACTOR * 100) - + (?ATTRIBUTE_DODGE_SCALE_FACTOR * 100) - + (?ATTRIBUTE_DEFENSE_SCORE_FACTOR * 100) + (?ATTRIBUTE_DAMAGE_MODIFIER_COST * ?ATTRIBUTE_DAMAGE_MODIFIER_BASE) + + (?ATTRIBUTE_MOVEMENT_POINTS_COST * ?ATTRIBUTE_MOVEMENT_POINTS_BASE) + + (?ATTRIBUTE_HEALTH_COST * ?ATTRIBUTE_HEALTH_BASE) + + (?ATTRIBUTE_DODGE_COST * ?ATTRIBUTE_DODGE_BASE) + + (?ATTRIBUTE_DEFENSE_SCORE_COST * ?ATTRIBUTE_DEFENSE_SCORE_BASE) ) ). diff --git a/src/battle/mechanic/action/btl_action_attack.erl b/src/battle/mechanic/action/btl_action_attack.erl index 56524af..04becc8 100644 --- a/src/battle/mechanic/action/btl_action_attack.erl +++ b/src/battle/mechanic/action/btl_action_attack.erl @@ -18,14 +18,14 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -spec roll_precision_modifier ( - shr_statistics:type(), - shr_statistics:type(), + shr_attributes:type(), + shr_attributes:type(), integer() ) -> {float(), integer(), integer()}. -roll_precision_modifier (Statistics, TargetStatistics, TargetLuck) -> - TargetDodges = shr_statistics:get_dodges(TargetStatistics), - Accuracy = shr_statistics:get_accuracy(Statistics), +roll_precision_modifier (Attributes, TargetAttributes, TargetLuck) -> + TargetDodges = shr_attributes:get_dodges(TargetAttributes), + Accuracy = shr_attributes:get_accuracy(Attributes), MissChance = max(0, (TargetDodges - Accuracy)), {Roll, _IsSuccess, PositiveModifier, NegativeModifier} = @@ -43,12 +43,12 @@ roll_precision_modifier (Statistics, TargetStatistics, TargetLuck) -> -spec roll_critical_modifier ( - shr_statistics:type(), + shr_attributes:type(), integer() ) -> {float(), integer(), integer()}. -roll_critical_modifier (Statistics, Luck) -> - CriticalHitChance = shr_statistics:get_critical_hits(Statistics), +roll_critical_modifier (Attributes, Luck) -> + CriticalHitChance = shr_attributes:get_critical_hits(Attributes), {_Roll, IsSuccess, PositiveModifier, NegativeModifier} = shr_roll:percentage_with_luck(CriticalHitChance, Luck), @@ -63,12 +63,12 @@ roll_critical_modifier (Statistics, Luck) -> -spec roll_parry ( - shr_statistics:type(), + shr_attributes:type(), integer() ) -> {boolean(), integer(), integer()}. -roll_parry (DefenderStatistics, DefenderLuck) -> - DefenderParryChance = shr_statistics:get_parries(DefenderStatistics), +roll_parry (DefenderAttributes, DefenderLuck) -> + DefenderParryChance = shr_attributes:get_parries(DefenderAttributes), {_Roll, IsSuccess, PositiveModifier, NegativeModifier} = shr_roll:percentage_with_luck(DefenderParryChance, DefenderLuck), @@ -265,12 +265,12 @@ effect_of_attack {ParryIsSuccessful, ParryPositiveLuckMod, ParryNegativeLuckMod} = case TargetCanParry of true -> - TargetStatistics = - shr_character:get_statistics + TargetAttributes = + shr_character:get_attributes ( btl_character:get_base_character(TargetCharacter) ), - roll_parry(TargetStatistics, TargetLuck); + roll_parry(TargetAttributes, TargetLuck); false -> {false, 0, 0} end, @@ -282,20 +282,20 @@ effect_of_attack end, AttackerBaseCharacter = btl_character:get_base_character(Attacker), - AttackerStatistics = shr_character:get_statistics(AttackerBaseCharacter), + AttackerAttributes = shr_character:get_attributes(AttackerBaseCharacter), DefenderBaseCharacter = btl_character:get_base_character(S0Defender), - DefenderStatistics = shr_character:get_statistics(DefenderBaseCharacter), + DefenderAttributes = shr_character:get_attributes(DefenderBaseCharacter), {PrecisionModifier, PrecisionPositiveLuckMod, PrecisionNegativeLuckMod} = roll_precision_modifier ( - AttackerStatistics, - DefenderStatistics, + AttackerAttributes, + DefenderAttributes, S0DefenderLuck ), {CriticalModifier, CriticalPositiveLuckMod, CriticalNegativeLuckMod} = - roll_critical_modifier(AttackerStatistics, S0AttackerLuck), + roll_critical_modifier(AttackerAttributes, S0AttackerLuck), Damage = shr_omnimods:get_attack_damage @@ -303,7 +303,7 @@ effect_of_attack ( PrecisionModifier * CriticalModifier - * shr_statistics:get_damage_modifier(AttackerStatistics) + * shr_attributes:get_damage_modifier(AttackerAttributes) ), shr_character:get_omnimods(AttackerBaseCharacter), shr_character:get_omnimods(DefenderBaseCharacter) @@ -513,12 +513,12 @@ handle_attack_sequence ) of true -> - Statistics = - shr_character:get_statistics + Attributes = + shr_character:get_attributes ( btl_character:get_base_character(S0Character) ), - DoubleAttackChance = shr_statistics:get_double_hits(Statistics), + DoubleAttackChance = shr_attributes:get_double_hits(Attributes), {_Roll, IsSuccessful, PositiveModifier, NegativeModifier} = shr_roll:percentage_with_luck(DoubleAttackChance, S0PlayerLuck), diff --git a/src/battle/mechanic/action/btl_action_move.erl b/src/battle/mechanic/action/btl_action_move.erl index 643912c..ebc79db 100644 --- a/src/battle/mechanic/action/btl_action_move.erl +++ b/src/battle/mechanic/action/btl_action_move.erl @@ -369,9 +369,9 @@ get_path_cost_and_destination (CharacterIX, Character, Update, Path) -> get_movement_points (Action, Character) -> case btl_action:get_movement_points(Action) of -1 -> - shr_statistics:get_movement_points + shr_attributes:get_movement_points ( - shr_character:get_statistics + shr_character:get_attributes ( btl_character:get_base_character(Character) ) diff --git a/src/battle/struct/btl_character.erl b/src/battle/struct/btl_character.erl index 790c809..f5f7ee0 100644 --- a/src/battle/struct/btl_character.erl +++ b/src/battle/struct/btl_character.erl @@ -111,10 +111,10 @@ -> {boolean(), integer()}. handle_max_health_change (OldBaseChar, NewBaseChar, OldHealth) -> OldMaxHealth = - shr_statistics:get_health(shr_character:get_statistics(OldBaseChar)), + shr_attributes:get_health(shr_character:get_attributes(OldBaseChar)), NewMaxHealth = - shr_statistics:get_health(shr_character:get_statistics(NewBaseChar)), + shr_attributes:get_health(shr_character:get_attributes(NewBaseChar)), case (OldMaxHealth == NewMaxHealth) of true -> {false, OldHealth}; @@ -427,14 +427,14 @@ new Location, Base ) -> - Statistics = shr_character:get_statistics(Base), + Attributes = shr_character:get_attributes(Base), #btl_char { player_ix = PlayerIX, rank = Rank, location = Location, - current_health = shr_statistics:get_health(Statistics), + current_health = shr_attributes:get_health(Attributes), is_active = (PlayerIX == 0), is_defeated = false, base = Base diff --git a/src/shared/struct/shr_statistics.erl b/src/shared/struct/shr_attributes.erl index a5ba69f..cd3aedf 100644 --- a/src/shared/struct/shr_statistics.erl +++ b/src/shared/struct/shr_attributes.erl @@ -1,11 +1,11 @@ --module(shr_statistics). +-module(shr_attributes). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -record ( - statistics, + attributes, { movement_points :: non_neg_integer(), health :: non_neg_integer(), @@ -18,7 +18,7 @@ } ). --opaque type() :: #statistics{}. +-opaque type() :: #attributes{}. -export_type([type/0]). @@ -54,41 +54,41 @@ %% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -spec mod_movement_points (integer(), type()) -> type(). -mod_movement_points (Mod, Stats) -> - Stats#statistics +mod_movement_points (Mod, Atts) -> + Atts#attributes { - movement_points = (Stats#statistics.movement_points + Mod) + movement_points = (Atts#attributes.movement_points + Mod) }. -spec mod_health (integer(), type()) -> type(). -mod_health (Mod, Stats) -> - Stats#statistics{ health = (Stats#statistics.health + Mod) }. +mod_health (Mod, Atts) -> + Atts#attributes{ health = (Atts#attributes.health + Mod) }. -spec mod_dodges (integer(), type()) -> type(). -mod_dodges (Mod, Stats) -> - Stats#statistics{ dodges = (Stats#statistics.dodges + Mod) }. +mod_dodges (Mod, Atts) -> + Atts#attributes{ dodges = (Atts#attributes.dodges + Mod) }. -spec mod_parries (integer(), type()) -> type(). -mod_parries (Mod, Stats) -> - Stats#statistics{ parries = (Stats#statistics.parries + Mod) }. +mod_parries (Mod, Atts) -> + Atts#attributes{ parries = (Atts#attributes.parries + Mod) }. -spec mod_accuracy (integer(), type()) -> type(). -mod_accuracy (Mod, Stats) -> - Stats#statistics{ accuracy = (Stats#statistics.accuracy + Mod) }. +mod_accuracy (Mod, Atts) -> + Atts#attributes{ accuracy = (Atts#attributes.accuracy + Mod) }. -spec mod_double_hits (integer(), type()) -> type(). -mod_double_hits (Mod, Stats) -> - Stats#statistics{ double_hits = (Stats#statistics.double_hits + Mod) }. +mod_double_hits (Mod, Atts) -> + Atts#attributes{ double_hits = (Atts#attributes.double_hits + Mod) }. -spec mod_critical_hits (integer(), type()) -> type(). -mod_critical_hits (Mod, Stats) -> - Stats#statistics{ critical_hits = (Stats#statistics.critical_hits + Mod) }. +mod_critical_hits (Mod, Atts) -> + Atts#attributes{ critical_hits = (Atts#attributes.critical_hits + Mod) }. -spec mod_damage_modifier (integer(), type()) -> type(). -mod_damage_modifier (Mod, Stats) -> - Stats#statistics +mod_damage_modifier (Mod, Atts) -> + Atts#attributes { - damage_modifier = (Stats#statistics.damage_modifier + Mod) + damage_modifier = (Atts#attributes.damage_modifier + Mod) }. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -96,35 +96,35 @@ mod_damage_modifier (Mod, Stats) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%% Accessors -spec get_movement_points (type()) -> non_neg_integer(). -get_movement_points (Stats) -> max(0, Stats#statistics.movement_points). +get_movement_points (Atts) -> max(0, Atts#attributes.movement_points). -spec get_health (type()) -> non_neg_integer(). -get_health (Stats) -> max(1, Stats#statistics.health). +get_health (Atts) -> max(1, Atts#attributes.health). -spec get_dodges (type()) -> non_neg_integer(). -get_dodges (Stats) -> max(0, Stats#statistics.dodges). +get_dodges (Atts) -> max(0, Atts#attributes.dodges). -spec get_parries (type()) -> non_neg_integer(). -get_parries (Stats) -> max(0, Stats#statistics.parries). +get_parries (Atts) -> max(0, Atts#attributes.parries). -spec get_accuracy (type()) -> non_neg_integer(). -get_accuracy (Stats) -> max(0, Stats#statistics.accuracy). +get_accuracy (Atts) -> max(0, Atts#attributes.accuracy). -spec get_double_hits (type()) -> non_neg_integer(). -get_double_hits (Stats) -> max(0, Stats#statistics.double_hits). +get_double_hits (Atts) -> max(0, Atts#attributes.double_hits). -spec get_critical_hits (type()) -> non_neg_integer(). -get_critical_hits (Stats) -> max(0, Stats#statistics.critical_hits). +get_critical_hits (Atts) -> max(0, Atts#attributes.critical_hits). -spec get_damage_modifier (type()) -> non_neg_integer(). -get_damage_modifier (Stats) -> max(0, Stats#statistics.damage_modifier). +get_damage_modifier (Atts) -> max(0, Atts#attributes.damage_modifier). -spec get_damage_multiplier (type()) -> float(). -get_damage_multiplier (Stats) -> (get_damage_modifier(Stats) / 100). +get_damage_multiplier (Atts) -> (get_damage_modifier(Atts) / 100). -spec default () -> type(). default () -> - #statistics + #attributes { movement_points = 0, health = 1, @@ -137,11 +137,11 @@ default () -> }. -spec apply_mod (atom(), integer(), type()) -> type(). -apply_mod(mheal, Value, Stats) -> mod_health(Value, Stats); -apply_mod(mpts, Value, Stats) -> mod_movement_points(Value, Stats); -apply_mod(dodg, Value, Stats) -> mod_dodges(Value, Stats); -apply_mod(pary, Value, Stats) -> mod_parries(Value, Stats); -apply_mod(accu, Value, Stats) -> mod_accuracy(Value, Stats); -apply_mod(dhit, Value, Stats) -> mod_double_hits(Value, Stats); -apply_mod(crit, Value, Stats) -> mod_critical_hits(Value, Stats); -apply_mod(dmgm, Value, Stats) -> mod_damage_modifier(Value, Stats). +apply_mod(mheal, Value, Atts) -> mod_health(Value, Atts); +apply_mod(mpts, Value, Atts) -> mod_movement_points(Value, Atts); +apply_mod(dodg, Value, Atts) -> mod_dodges(Value, Atts); +apply_mod(pary, Value, Atts) -> mod_parries(Value, Atts); +apply_mod(accu, Value, Atts) -> mod_accuracy(Value, Atts); +apply_mod(dhit, Value, Atts) -> mod_double_hits(Value, Atts); +apply_mod(crit, Value, Atts) -> mod_critical_hits(Value, Atts); +apply_mod(dmgm, Value, Atts) -> mod_damage_modifier(Value, Atts). diff --git a/src/shared/struct/shr_character.erl b/src/shared/struct/shr_character.erl index c2155cf..869a742 100644 --- a/src/shared/struct/shr_character.erl +++ b/src/shared/struct/shr_character.erl @@ -24,7 +24,7 @@ name :: binary(), equipment :: shr_equipment:type(), is_using_secondary :: boolean(), - statistics :: shr_statistics:type(), + attributes :: shr_attributes:type(), equipment_but_weapons_omnimods :: shr_omnimods:type(), extra_omnimods :: shr_omnimods:type(), omnimods :: shr_omnimods:type() @@ -45,7 +45,7 @@ [ get_name/1, get_equipment/1, - get_statistics/1, + get_attributes/1, get_active_weapon/1, get_inactive_weapon/1, get_omnimods/1, @@ -169,15 +169,15 @@ set_equipment (Eq, Char) when is_record(Char, shr_char) -> Char#shr_char.extra_omnimods ), - NewStatistics = - shr_omnimods:apply_to_statistics(NewOmnimods, shr_statistics:default()), + NewAttributes = + shr_omnimods:apply_to_attributes(NewOmnimods, shr_attributes:default()), Char#shr_char { equipment = Eq, equipment_but_weapons_omnimods = EquipmentButWeaponsOmnimods, omnimods = NewOmnimods, - statistics = NewStatistics + attributes = NewAttributes }; set_equipment (EqRef, CharRef) when is_record(CharRef, shr_char_ref) -> CharRef#shr_char_ref{ equipment = EqRef }. @@ -232,14 +232,14 @@ switch_weapons (Char) when is_record(Char, shr_char) -> ActiveWeaponOmnimods ), - NewStatistics = - shr_omnimods:apply_to_statistics(NewOmnimods, shr_statistics:default()), + NewAttributes = + shr_omnimods:apply_to_attributes(NewOmnimods, shr_attributes:default()), Char#shr_char { is_using_secondary = (not Char#shr_char.is_using_secondary), omnimods = NewOmnimods, - statistics = NewStatistics + attributes = NewAttributes }; switch_weapons (Char) when is_record(Char, shr_char_ref) -> Char#shr_char_ref @@ -284,8 +284,8 @@ get_inactive_weapon (#shr_char_ref{ is_using_secondary = B, equipment = E }) -> true -> shr_equipment:get_primary_weapon(E) end. --spec get_statistics (type()) -> shr_statistics:type(). -get_statistics (Char) -> Char#shr_char.statistics. +-spec get_attributes (type()) -> shr_attributes:type(). +get_attributes (Char) -> Char#shr_char.attributes. -spec get_omnimods (type()) -> shr_omnimods:type(). get_omnimods (Char) -> Char#shr_char.omnimods. @@ -303,14 +303,14 @@ set_extra_omnimods (O, Char) -> O ), - NewStatistics = - shr_omnimods:apply_to_statistics(NewOmnimods, shr_statistics:default()), + NewAttributes = + shr_omnimods:apply_to_attributes(NewOmnimods, shr_attributes:default()), Char#shr_char { extra_omnimods = O, omnimods = NewOmnimods, - statistics = NewStatistics + attributes = NewAttributes }. -spec resolve (shr_omnimods:type(), unresolved()) -> type(). @@ -330,8 +330,8 @@ resolve (LocalOmnimods, CharRef) -> LocalOmnimods ), - NewStatistics = - shr_omnimods:apply_to_statistics(NewOmnimods, shr_statistics:default()), + NewAttributes = + shr_omnimods:apply_to_attributes(NewOmnimods, shr_attributes:default()), #shr_char { @@ -339,7 +339,7 @@ resolve (LocalOmnimods, CharRef) -> equipment_but_weapons_omnimods = EquipmentButWeaponsOmnimods, equipment = Eq, is_using_secondary = CharRef#shr_char_ref.is_using_secondary, - statistics = NewStatistics, + attributes = NewAttributes, omnimods = NewOmnimods, extra_omnimods = LocalOmnimods }. diff --git a/src/shared/struct/shr_omnimods.erl b/src/shared/struct/shr_omnimods.erl index fd35a94..7602e1f 100644 --- a/src/shared/struct/shr_omnimods.erl +++ b/src/shared/struct/shr_omnimods.erl @@ -10,7 +10,7 @@ ( omnimods, { - stamods :: mods(), + attmods :: mods(), atkmods :: mods(), defmods :: mods() } @@ -45,7 +45,7 @@ -export ( [ - apply_to_statistics/2, + apply_to_attributes/2, get_attack_damage/3 ] ). @@ -89,10 +89,10 @@ encode_mods (Mods) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Creation -spec new (list(entry()), list(entry()), list(entry())) -> type(). -new (StatisticMods, AttackMods, DefenseMods) -> +new (AttributeMods, AttackMods, DefenseMods) -> #omnimods { - stamods = dict:from_list(StatisticMods), + attmods = dict:from_list(AttributeMods), atkmods = dict:from_list(AttackMods), defmods = dict:from_list(DefenseMods) }. @@ -105,7 +105,7 @@ default () -> new([], [], []). merge (OmniA, OmniB) -> OmniA#omnimods { - stamods = merge_mods(OmniA#omnimods.stamods, OmniB#omnimods.stamods), + attmods = merge_mods(OmniA#omnimods.attmods, OmniB#omnimods.attmods), atkmods = merge_mods(OmniA#omnimods.atkmods, OmniB#omnimods.atkmods), defmods = merge_mods(OmniA#omnimods.defmods, OmniB#omnimods.defmods) }. @@ -114,23 +114,23 @@ merge (OmniA, OmniB) -> apply_coefficient (Coef, Omnimods) -> Omnimods#omnimods { - stamods = apply_coefficient_to_mods(Coef, Omnimods#omnimods.stamods), + attmods = apply_coefficient_to_mods(Coef, Omnimods#omnimods.attmods), atkmods = apply_coefficient_to_mods(Coef, Omnimods#omnimods.atkmods), defmods = apply_coefficient_to_mods(Coef, Omnimods#omnimods.defmods) }. --spec apply_to_statistics +-spec apply_to_attributes ( type(), - shr_statistics:type() + shr_attributes:type() ) - -> shr_statistics:type(). -apply_to_statistics (Omnimods, Statistics) -> + -> shr_attributes:type(). +apply_to_attributes (Omnimods, Attributes) -> dict:fold ( - fun shr_statistics:apply_mod/3, - Statistics, - Omnimods#omnimods.stamods + fun shr_attributes:apply_mod/3, + Attributes, + Omnimods#omnimods.attmods ). -spec get_attack_damage (float(), type(), type()) -> non_neg_integer(). @@ -196,7 +196,7 @@ get_attack_damage (AttackModifier, AttackerOmnimods, DefenderOmnimods) -> encode (Omnimods) -> { [ - {<<"stam">>, encode_mods(Omnimods#omnimods.stamods)}, + {<<"attm">>, encode_mods(Omnimods#omnimods.attmods)}, {<<"atkm">>, encode_mods(Omnimods#omnimods.atkmods)}, {<<"defm">>, encode_mods(Omnimods#omnimods.defmods)} ] |