summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/struct/shr_omnimods.erl | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/shared/struct/shr_omnimods.erl b/src/shared/struct/shr_omnimods.erl index 2d06493..4abfef2 100644 --- a/src/shared/struct/shr_omnimods.erl +++ b/src/shared/struct/shr_omnimods.erl @@ -164,21 +164,19 @@ get_attack_damage (AttackModifier, AttackerOmnimods, DefenderOmnimods) -> AttackerOmnimodsAttmods = AttackerOmnimods#omnimods.atkmods, DefenderOmnimodsDefmods = DefenderOmnimods#omnimods.defmods, - S0Calc = - apply_coefficient_to_mods(-1*AttackModifier, AttackerOmnimodsAttmods), - S1Calc = merge_mods(DefenderOmnimodsDefmods, S0Calc), - Result = dict:fold ( - fun (_Name, Val, CurrResult) -> - case (Val > 0) of - true -> (CurrResult + Val); - _ -> CurrResult + fun (Name, BaseDmg, CurrentResult) -> + ModifiedDmg = shr_math:ceil(BaseDmg * AttackModifier), + case dict:find(Name, DefenderOmnimodsDefmods) of + {ok, Def} when (Def >= ModifiedDmg) -> CurrentResult; + {ok, Def} -> (CurrentResult + (ModifiedDmg - Def)); + _ -> (CurrentResult + ModifiedDmg) end end, 0, - S1Calc + AttackerOmnimodsAttmods ), Result. |