summaryrefslogtreecommitdiff |
diff options
author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2019-09-10 21:07:44 +0200 |
---|---|---|
committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2019-09-10 21:07:44 +0200 |
commit | cfdd37c261bfb814740aa8cec30177f9c5f85d36 (patch) | |
tree | babd5443c8219186d80d8dbbdb3d6340db1748ea /src/shared | |
parent | efc878dc634cdbf9ba976858ee6872fc7a59b485 (diff) |
Should fix damage calculation.
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/struct/shr_omnimods.erl | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/shared/struct/shr_omnimods.erl b/src/shared/struct/shr_omnimods.erl index f452e34..c31e372 100644 --- a/src/shared/struct/shr_omnimods.erl +++ b/src/shared/struct/shr_omnimods.erl @@ -1,5 +1,7 @@ -module(shr_omnimods). +-include("tacticians/attributes.hrl"). + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -268,31 +270,27 @@ apply_to_attributes (Omnimods, Attributes) -> Omnimods#omnimods.attmods ). -% FIXME: 'base' is no longer used. -spec get_attack_damage (float(), type(), type()) -> non_neg_integer(). -get_attack_damage (AttackModifier, AttackerOmnimods, DefenderOmnimods) -> - AttackerOmnimodsAttmods = AttackerOmnimods#omnimods.atkmods, +get_attack_damage (AttackMultiplier, AttackerOmnimods, DefenderOmnimods) -> + AttackerOmnimodsAtkmods = AttackerOmnimods#omnimods.atkmods, DefenderOmnimodsDefmods = DefenderOmnimods#omnimods.defmods, io:format("Attack!~n"), - BaseDefense = - case dict:find(base, DefenderOmnimodsDefmods) of - {ok, BaseDefValue} -> BaseDefValue; - _ -> 0 - end, - - io:format("Defender base defense: ~p~n", [BaseDefense]), - Result = dict:fold ( fun (Name, BaseDmg, CurrentResult) -> io:format("Precalc damage from ~p: ~p~n", [Name, BaseDmg]), NormDmg = max(0, BaseDmg), - ModifiedDmg = - (shr_math_util:ceil(NormDmg * AttackModifier) - BaseDefense), - io:format("Actual attack damage from ~p: ~p~n", [Name, ModifiedDmg]), + ModifiedDmg = (shr_math_util:ceil(NormDmg * AttackMultiplier)), + + io:format + ( + "Actual attack damage from ~p: ~p~n", + [Name, ModifiedDmg] + ), + case dict:find(Name, DefenderOmnimodsDefmods) of {ok, Def} when (Def >= ModifiedDmg) -> io:format @@ -310,6 +308,7 @@ get_attack_damage (AttackModifier, AttackerOmnimods, DefenderOmnimods) -> [Def, Name, DamageTaken] ), (CurrentResult + DamageTaken); + _ -> io:format ( @@ -320,7 +319,7 @@ get_attack_damage (AttackModifier, AttackerOmnimods, DefenderOmnimods) -> end end, 0, - AttackerOmnimodsAttmods + AttackerOmnimodsAtkmods ), io:format("Defender took a total of ~p damage.~n", [Result]), |