| summaryrefslogtreecommitdiff | 
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2018-08-28 20:21:52 +0200 | 
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2018-08-28 20:21:52 +0200 | 
| commit | 8005656eb5d6a08464dc3718ab18c0a441f79025 (patch) | |
| tree | a615f7de595328e42b0c6ea338ef572d0840969f /src/shared/struct | |
| parent | a3d6240681596d16f81c69387a819931d2d513a5 (diff) | |
Fixes damage calculation.
Diffstat (limited to 'src/shared/struct')
| -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. | 


