summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2018-07-04 17:50:49 +0200 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2018-07-04 17:50:49 +0200 |
commit | d3a88c205888228191141faeb085e3c67ea3ebd0 (patch) | |
tree | c4547d0be9613f177a81386e7e79d16634a8a47e | |
parent | 80bac96c93e7141ced7c2a56d9c1f236f304ea93 (diff) |
Revert "Had determinism issues with stats."
This reverts commit 80bac96c93e7141ced7c2a56d9c1f236f304ea93.
Turns out the rounding error is caused by the armor malus.
-rw-r--r-- | src/battlemap/src/Struct/Character.elm | 33 | ||||
-rw-r--r-- | src/battlemap/src/Struct/Statistics.elm | 24 |
2 files changed, 13 insertions, 44 deletions
diff --git a/src/battlemap/src/Struct/Character.elm b/src/battlemap/src/Struct/Character.elm index 5ff8a60..f361501 100644 --- a/src/battlemap/src/Struct/Character.elm +++ b/src/battlemap/src/Struct/Character.elm @@ -58,9 +58,7 @@ type alias PartiallyDecoded = att : Struct.Attributes.Type, awp : Int, swp : Int, - ar : Int, - mvt : Int, - mhp : Int + ar : Int } type Rank = @@ -111,14 +109,7 @@ finish_decoding add_char = location = add_char.lc, health = add_char.hea, attributes = add_char.att, - statistics = - (Struct.Statistics.new - add_char.att - weapon_set - armor - add_char.mhp - add_char.mvt - ), + statistics = (Struct.Statistics.new add_char.att weapon_set armor), player_ix = add_char.pla, enabled = add_char.ena, defeated = add_char.dea, @@ -203,14 +194,7 @@ set_weapons : Struct.WeaponSet.Type -> Type -> Type set_weapons weapons char = {char | weapons = weapons, - statistics = - (Struct.Statistics.new - char.attributes - weapons - char.armor - (Struct.Statistics.get_max_health char.statistics) - (Struct.Statistics.get_movement_points char.statistics) - ) + statistics = (Struct.Statistics.new char.attributes weapons char.armor) } decoder : (Json.Decode.Decoder (Type, Int, Int, Int)) @@ -233,8 +217,6 @@ decoder = |> (Json.Decode.Pipeline.required "awp" Json.Decode.int) |> (Json.Decode.Pipeline.required "swp" Json.Decode.int) |> (Json.Decode.Pipeline.required "ar" Json.Decode.int) - |> (Json.Decode.Pipeline.required "mvt" Json.Decode.int) - |> (Json.Decode.Pipeline.required "mhp" Json.Decode.int) ) ) @@ -250,14 +232,7 @@ fill_missing_equipment awp swp ar char = weapon_set = (Struct.WeaponSet.new awp swp) in {char | - statistics = - (Struct.Statistics.new - char.attributes - weapon_set - ar - (Struct.Statistics.get_max_health char.statistics) - (Struct.Statistics.get_movement_points char.statistics) - ), + statistics = (Struct.Statistics.new char.attributes weapon_set ar), weapons = weapon_set, armor = ar } diff --git a/src/battlemap/src/Struct/Statistics.elm b/src/battlemap/src/Struct/Statistics.elm index 24634ac..5b7eb87 100644 --- a/src/battlemap/src/Struct/Statistics.elm +++ b/src/battlemap/src/Struct/Statistics.elm @@ -113,11 +113,9 @@ new : ( Struct.Attributes.Type -> Struct.WeaponSet.Type -> Struct.Armor.Type -> - Int -> - Int -> Type ) -new att wp_set ar max_health max_mvt = +new att wp_set ar = let active_weapon = (Struct.WeaponSet.get_active_weapon wp_set) actual_att = @@ -134,18 +132,14 @@ new att wp_set ar max_health max_mvt = dmg_bmod = (damage_base_mod (toFloat strength)) in { - movement_points = max_mvt, - -- Operation is not deterministic, yet can't afford to differ from the - -- server's value. As a result, we have to rely on the server's value. --- (gentle_squared_growth_f --- (average [mind, constitution, constitution, speed, speed, speed]) --- ), - max_health = max_health, - -- Operation is not deterministic, yet can't afford to differ from the - -- server's value. As a result, we have to rely on the server's value. --- (gentle_squared_growth_f --- (average [constitution, constitution, constitution, mind]) --- ), + movement_points = + (gentle_squared_growth_f + (average [mind, constitution, constitution, speed, speed, speed]) + ), + max_health = + (gentle_squared_growth_f + (average [constitution, constitution, constitution, mind]) + ), dodges = (clamp 0 |