| summaryrefslogtreecommitdiff | 
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2019-09-14 12:51:50 +0200 | 
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2019-09-14 12:51:50 +0200 | 
| commit | c70d77cea8ef6d98c3c1f50728e45b655d7b2a54 (patch) | |
| tree | 01031bba806b37802f2cc7d98ebf3886ab987094 /src/shared/battle/Battle/View/Attribute.elm | |
| parent | a60955411ba7eb69cbcf8643cc8820c490d030f0 (diff) | |
Removes code smell, fixes roster editor atts view.
It's still not coloring the negative values correctly, though.
Diffstat (limited to 'src/shared/battle/Battle/View/Attribute.elm')
| -rw-r--r-- | src/shared/battle/Battle/View/Attribute.elm | 162 | 
1 files changed, 45 insertions, 117 deletions
| diff --git a/src/shared/battle/Battle/View/Attribute.elm b/src/shared/battle/Battle/View/Attribute.elm index 80e75f1..7e00b2f 100644 --- a/src/shared/battle/Battle/View/Attribute.elm +++ b/src/shared/battle/Battle/View/Attribute.elm @@ -1,9 +1,8 @@  module Battle.View.Attribute exposing     ( -      get_html, -      get_all_html, -      get_true_all_html, -      get_all_but_gauges_html, +      get_unsigned_html, +      get_all_unsigned_html, +      get_all_but_gauges_unsigned_html,        get_signed_html,        get_all_signed_html,        get_all_but_gauges_signed_html @@ -24,16 +23,13 @@ import Struct.HelpRequest  --------------------------------------------------------------------------------  -- LOCAL -----------------------------------------------------------------------  -------------------------------------------------------------------------------- - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- ---------------------------------------------------------------------------------  get_html : ( +      Bool ->        Battle.Struct.Attributes.Category ->        Int ->        (Html.Html Struct.Event.Type)     ) -get_html attribute value = +get_html signed attribute value =     (Html.div        [           (Html.Events.onClick @@ -45,54 +41,7 @@ get_html attribute value =              (                 if (value < 0)                 then "omnimod-negative-value" -               else -                  if (value > 0) -                  then "omnimod-positive-value" -                  else "omnimod-nil-value" -            ) -         ), -         (Html.Attributes.class "omnimod-icon"), -         (Html.Attributes.class -            ( -               "omnimod-icon-" -               ++ (Battle.Struct.Attributes.encode_category attribute) -            ) -         ) -      ] -      [ -         (Html.div -            [ -               (Html.Attributes.class "omnimod-value") -            ] -            [ -               (Html.text -                  ( -                     if (Battle.Struct.Attributes.is_percent attribute) -                     then ((String.fromInt value) ++ "%") -                     else (String.fromInt value) -                  ) -               ) -            ] -         ) -      ] -   ) - -get_signed_html : ( -      Battle.Struct.Attributes.Category -> -      Int -> -      (Html.Html Struct.Event.Type) -   ) -get_signed_html attribute value = -   (Html.div -      [ -         ( -            if (value < 0) -            then (Html.Attributes.class "omnimod-negative") -            else (Html.Attributes.class "omnimod-positive") -         ), -         (Html.Events.onClick -            (Struct.Event.RequestedHelp -               (Struct.HelpRequest.Attribute attribute) +               else "omnimod-positive-value"              )           ),           (Html.Attributes.class "omnimod-icon"), @@ -112,7 +61,7 @@ get_signed_html attribute value =                 (Html.text                    (                       ( -                        if (value > 0) +                        if ((value > 0) && signed)                          then ("+" ++ (String.fromInt value))                          else (String.fromInt value)                       ) @@ -129,86 +78,65 @@ get_signed_html attribute value =        ]     ) -get_all_html : ( +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_signed_html : ( +      Battle.Struct.Attributes.Category -> +      Int -> +      (Html.Html Struct.Event.Type) +   ) +get_signed_html attribute value = +   (get_html True attribute value) + +get_unsigned_html : ( +      Battle.Struct.Attributes.Category -> +      Int -> +      (Html.Html Struct.Event.Type) +   ) +get_unsigned_html attribute value = +   (get_html False attribute value) + +get_all_unsigned_html : (        Battle.Struct.Attributes.Type ->        (List (Html.Html Struct.Event.Type))     ) -get_all_html atts = +get_all_unsigned_html atts =     [ -      (get_html +      (get_unsigned_html           Battle.Struct.Attributes.Dodges           (Battle.Struct.Attributes.get_dodges atts)        ), -      (get_html +      (get_unsigned_html           Battle.Struct.Attributes.Parries           (Battle.Struct.Attributes.get_parries atts)        ), -      (get_html +      (get_unsigned_html           Battle.Struct.Attributes.Accuracy           (Battle.Struct.Attributes.get_accuracy atts)        ), -      (get_html +      (get_unsigned_html           Battle.Struct.Attributes.DoubleHits           (Battle.Struct.Attributes.get_double_hits atts)        ), -      (get_html +      (get_unsigned_html           Battle.Struct.Attributes.CriticalHits           (Battle.Struct.Attributes.get_critical_hits atts)        ), -      (get_html +      (get_unsigned_html           Battle.Struct.Attributes.MaxHealth           (Battle.Struct.Attributes.get_max_health atts)        ), -      (get_html +      (get_unsigned_html           Battle.Struct.Attributes.MovementPoints           (Battle.Struct.Attributes.get_movement_points atts)        ), -      (get_html +      (get_unsigned_html           Battle.Struct.Attributes.DamageModifier           (Battle.Struct.Attributes.get_damage_modifier atts)        )     ] -get_true_all_html : ( -      Battle.Struct.Attributes.Type -> -      (List (Html.Html Struct.Event.Type)) -   ) -get_true_all_html atts = -   [ -      (get_html -         Battle.Struct.Attributes.Dodges -         (Battle.Struct.Attributes.get_true_dodges atts) -      ), -      (get_html -         Battle.Struct.Attributes.Parries -         (Battle.Struct.Attributes.get_true_parries atts) -      ), -      (get_html -         Battle.Struct.Attributes.Accuracy -         (Battle.Struct.Attributes.get_true_accuracy atts) -      ), -      (get_html -         Battle.Struct.Attributes.DoubleHits -         (Battle.Struct.Attributes.get_true_double_hits atts) -      ), -      (get_html -         Battle.Struct.Attributes.CriticalHits -         (Battle.Struct.Attributes.get_true_critical_hits atts) -      ), -      (get_html -         Battle.Struct.Attributes.MaxHealth -         (Battle.Struct.Attributes.get_true_max_health atts) -      ), -      (get_html -         Battle.Struct.Attributes.MovementPoints -         (Battle.Struct.Attributes.get_true_movement_points atts) -      ), -      (get_html -         Battle.Struct.Attributes.DamageModifier -         (Battle.Struct.Attributes.get_true_damage_modifier atts) -      ) -   ] -  get_all_signed_html : (        Battle.Struct.Attributes.Type ->        (List (Html.Html Struct.Event.Type)) @@ -249,37 +177,37 @@ get_all_signed_html atts =        )     ] -get_all_but_gauges_html : ( +get_all_but_gauges_unsigned_html : (        Battle.Struct.Attributes.Type ->        (List (Html.Html Struct.Event.Type))     ) -get_all_but_gauges_html atts = +get_all_but_gauges_unsigned_html atts =     [ -      (get_html +      (get_unsigned_html           Battle.Struct.Attributes.Dodges           (Battle.Struct.Attributes.get_dodges atts)        ), -      (get_html +      (get_unsigned_html           Battle.Struct.Attributes.Parries           (Battle.Struct.Attributes.get_parries atts)        ), -      (get_html +      (get_unsigned_html           Battle.Struct.Attributes.Accuracy           (Battle.Struct.Attributes.get_accuracy atts)        ), -      (get_html +      (get_unsigned_html           Battle.Struct.Attributes.DoubleHits           (Battle.Struct.Attributes.get_double_hits atts)        ), -      (get_html +      (get_unsigned_html           Battle.Struct.Attributes.CriticalHits           (Battle.Struct.Attributes.get_critical_hits atts)        ), -      (get_html +      (get_unsigned_html           Battle.Struct.Attributes.CriticalHits           (Battle.Struct.Attributes.get_critical_hits atts)        ), -      (get_html +      (get_unsigned_html           Battle.Struct.Attributes.DamageModifier           (Battle.Struct.Attributes.get_damage_modifier atts)        ) | 


