| summaryrefslogtreecommitdiff | 
diff options
| author | nsensfel <SpamShield0@noot-noot.org> | 2018-08-30 17:59:48 +0200 | 
|---|---|---|
| committer | nsensfel <SpamShield0@noot-noot.org> | 2018-08-30 17:59:48 +0200 | 
| commit | f2b31148888f8d29e4d9a71cacc19fbb97e52d5c (patch) | |
| tree | f6fdb8326ecde6a5c5aac18a2d0f330a88d310e4 /src/shared | |
| parent | 03cbc5e41dc2a0c88dfe53e7143048eba8f774de (diff) | |
Changes the damage multiplier formula.
Diffstat (limited to 'src/shared')
| -rw-r--r-- | src/shared/struct/shr_omnimods.erl | 34 | ||||
| -rw-r--r-- | src/shared/struct/shr_statistics.erl | 2 | 
2 files changed, 32 insertions, 4 deletions
| diff --git a/src/shared/struct/shr_omnimods.erl b/src/shared/struct/shr_omnimods.erl index 7e279e8..bfd9d25 100644 --- a/src/shared/struct/shr_omnimods.erl +++ b/src/shared/struct/shr_omnimods.erl @@ -187,29 +187,57 @@ get_attack_damage (AttackModifier, AttackerOmnimods, DefenderOmnimods) ->     AttackerOmnimodsAttmods = 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]),              case dict:find(Name, DefenderOmnimodsDefmods) of -               {ok, Def} when (Def >= ModifiedDmg) -> CurrentResult; -               {ok, Def} -> (CurrentResult + (ModifiedDmg - Def)); -               _ -> (CurrentResult + ModifiedDmg) +               {ok, Def} when (Def >= ModifiedDmg) -> +                  io:format +                  ( +                     "Defender had ~p ~p armor, ignoring damage.~n", +                     [Def, Name] +                  ), +                  CurrentResult; + +               {ok, Def} -> +                  DamageTaken = (ModifiedDmg - Def), +                  io:format +                  ( +                     "Defender had ~p ~p armor, taking ~p damage.~n", +                     [Def, Name, DamageTaken] +                  ), +                  (CurrentResult + DamageTaken); +               _ -> +                  io:format +                  ( +                     "Defender had no ~p armor, taking full damage.~n", +                     [Name] +                  ), +                  (CurrentResult + ModifiedDmg)              end           end,           0,           AttackerOmnimodsAttmods        ), +   io:format("Defender took a total of ~p damage.~n", [Result]), +     Result.  %%% Export diff --git a/src/shared/struct/shr_statistics.erl b/src/shared/struct/shr_statistics.erl index 4249d52..726d4bf 100644 --- a/src/shared/struct/shr_statistics.erl +++ b/src/shared/struct/shr_statistics.erl @@ -90,7 +90,7 @@ sudden_exp_growth (V) -> float_to_int(math:pow(4.0, V / 25.0)).  %already_high_slow_growth (V) -> float_to_int(30 * math:log((V + 5)/4)).  -spec damage_base_modifier (non_neg_integer()) -> float(). -damage_base_modifier (Strength) -> ((math:pow(Strength, 1.8) / 2000.0) - 0.75). +damage_base_modifier (Strength) -> (math:pow((Strength + 10)*4, 1.5) / 3000.0).  -spec make_movement_points_safe (non_neg_integer()) -> non_neg_integer().  make_movement_points_safe (Val) -> min_max(0, 200, Val). | 


