From 68d3f1d7fd3703a8aef68bd6e9f89a84eab5e539 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Tue, 28 Aug 2018 21:20:32 +0200 Subject: Adds 'base' defense, applied to all damage types. Since it's applied to all damage types, 'base' defense points are much more valuable than defense points that are only applied when facing a specific element. --- src/shared/struct/shr_omnimods.erl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/shared/struct/shr_omnimods.erl b/src/shared/struct/shr_omnimods.erl index 4abfef2..03ec5af 100644 --- a/src/shared/struct/shr_omnimods.erl +++ b/src/shared/struct/shr_omnimods.erl @@ -63,7 +63,7 @@ cleanup_entry_list (ModList) -> -spec apply_coefficient_to_mods (float(), mods()) -> mods(). apply_coefficient_to_mods (Coef, Mods) -> - dict:map(fun ({_Name, Val}) -> shr_util:ceil(Coef * Val) end, Mods). + dict:map(fun (_Name, Val) -> shr_math_util:ceil(Coef * Val) end, Mods). -spec merge_mods (mods(), mods()) -> mods(). merge_mods (ModsA, ModsB) -> @@ -164,11 +164,18 @@ get_attack_damage (AttackModifier, AttackerOmnimods, DefenderOmnimods) -> AttackerOmnimodsAttmods = AttackerOmnimods#omnimods.atkmods, DefenderOmnimodsDefmods = DefenderOmnimods#omnimods.defmods, + BaseDefense = + case dict:find(base, DefenderOmnimodsDefmods) of + {ok, BaseDefValue} -> BaseDefValue; + _ -> 0 + end, + Result = dict:fold ( fun (Name, BaseDmg, CurrentResult) -> - ModifiedDmg = shr_math:ceil(BaseDmg * AttackModifier), + ModifiedDmg = + (shr_math_util:ceil(BaseDmg * AttackModifier) - BaseDefense), case dict:find(Name, DefenderOmnimodsDefmods) of {ok, Def} when (Def >= ModifiedDmg) -> CurrentResult; {ok, Def} -> (CurrentResult + (ModifiedDmg - Def)); -- cgit v1.2.3-70-g09d2