summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/shared/struct/shr_omnimods.erl')
-rw-r--r-- | src/shared/struct/shr_omnimods.erl | 11 |
1 files changed, 9 insertions, 2 deletions
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)); |