summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/battle/Battle/View/Attribute.elm | 162 | ||||
-rw-r--r-- | src/shared/battle/Battle/View/DamageType.elm | 74 | ||||
-rw-r--r-- | src/shared/battle/Battle/View/Omnimods.elm | 30 |
3 files changed, 81 insertions, 185 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) ) diff --git a/src/shared/battle/Battle/View/DamageType.elm b/src/shared/battle/Battle/View/DamageType.elm index 1302407..bd1242d 100644 --- a/src/shared/battle/Battle/View/DamageType.elm +++ b/src/shared/battle/Battle/View/DamageType.elm @@ -1,6 +1,6 @@ module Battle.View.DamageType exposing ( - get_html, + get_unsigned_html, get_signed_html ) @@ -21,55 +21,21 @@ import Struct.HelpRequest -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- get_html : ( + Bool -> Battle.Struct.DamageType.Type -> Int -> (Html.Html Struct.Event.Type) ) -get_html damage_type value = +get_html signed damage_type value = (Html.div [ - (Html.Events.onClick - (Struct.Event.RequestedHelp - (Struct.HelpRequest.DamageType damage_type) - ) - ), - (Html.Attributes.class "omnimod-icon"), (Html.Attributes.class ( - "omnimod-icon-" - ++ (Battle.Struct.DamageType.encode damage_type) + if (value < 0) + then "omnimod-negative-value" + else "omnimod-positive-value" ) - ) - ] - [ - (Html.div - [ - (Html.Attributes.class "omnimod-value") - ] - [ - (Html.text (String.fromInt value)) - ] - ) - ] - ) - -get_signed_html : ( - Battle.Struct.DamageType.Type -> - Int -> - (Html.Html Struct.Event.Type) - ) -get_signed_html damage_type value = - (Html.div - [ - ( - if (value < 0) - then (Html.Attributes.class "omnimod-negative") - else (Html.Attributes.class "omnimod-positive") ), (Html.Events.onClick (Struct.Event.RequestedHelp @@ -92,7 +58,7 @@ get_signed_html damage_type value = [ (Html.text ( - if (value > 0) + if ((value > 0) && signed) then ("+" ++ (String.fromInt value)) else (String.fromInt value) ) @@ -102,16 +68,22 @@ get_signed_html damage_type value = ] ) -get_all_html : ( - (List (Battle.Struct.DamageType.Type, Int)) -> - (List (Html.Html Struct.Event.Type)) + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_unsigned_html : ( + Battle.Struct.DamageType.Type -> + Int -> + (Html.Html Struct.Event.Type) ) -get_all_html damage_types = - (List.map (\(d, v) -> (get_html d v)) damage_types) +get_unsigned_html damage_type value = + (get_html False damage_type value) -get_all_signed_html : ( - (List (Battle.Struct.DamageType.Type, Int)) -> - (List (Html.Html Struct.Event.Type)) +get_signed_html : ( + Battle.Struct.DamageType.Type -> + Int -> + (Html.Html Struct.Event.Type) ) -get_all_signed_html damage_types = - (List.map (\(d, v) -> (get_signed_html d v)) damage_types) +get_signed_html damage_type value = + (get_html True damage_type value) diff --git a/src/shared/battle/Battle/View/Omnimods.elm b/src/shared/battle/Battle/View/Omnimods.elm index 14da8ed..8693e9e 100644 --- a/src/shared/battle/Battle/View/Omnimods.elm +++ b/src/shared/battle/Battle/View/Omnimods.elm @@ -1,7 +1,7 @@ module Battle.View.Omnimods exposing ( - get_html_with_modifier, - get_html, + get_signed_html, + get_unsigned_html, get_user_friendly_html ) @@ -30,12 +30,8 @@ import Struct.Event -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- -get_html_with_modifier : ( - Float -> - Battle.Struct.Omnimods.Type -> - (Html.Html Struct.Event.Type) - ) -get_html_with_modifier attack_multiplier omnimods = +get_signed_html : Battle.Struct.Omnimods.Type -> (Html.Html Struct.Event.Type) +get_signed_html omnimods = (Html.div [ (Html.Attributes.class "omnimod-listing") @@ -49,7 +45,7 @@ get_html_with_modifier attack_multiplier omnimods = (\(k, v) -> (Battle.View.DamageType.get_signed_html (Battle.Struct.DamageType.decode k) - (ceiling ((toFloat v) * attack_multiplier)) + v ) ) (Battle.Struct.Omnimods.get_attack_mods omnimods) @@ -86,8 +82,8 @@ get_html_with_modifier attack_multiplier omnimods = ] ) -get_html : Battle.Struct.Omnimods.Type -> (Html.Html Struct.Event.Type) -get_html omnimods = +get_unsigned_html : Battle.Struct.Omnimods.Type -> (Html.Html Struct.Event.Type) +get_unsigned_html omnimods = (Html.div [ (Html.Attributes.class "omnimod-listing") @@ -99,7 +95,7 @@ get_html omnimods = ] (List.map (\(k, v) -> - (Battle.View.DamageType.get_signed_html + (Battle.View.DamageType.get_unsigned_html (Battle.Struct.DamageType.decode k) v ) @@ -113,7 +109,7 @@ get_html omnimods = ] (List.map (\(k, v) -> - (Battle.View.DamageType.get_signed_html + (Battle.View.DamageType.get_unsigned_html (Battle.Struct.DamageType.decode k) v ) @@ -127,7 +123,7 @@ get_html omnimods = ] (List.map (\(k, v) -> - (Battle.View.Attribute.get_signed_html + (Battle.View.Attribute.get_unsigned_html (Battle.Struct.Attributes.decode_category k) v ) @@ -169,7 +165,7 @@ get_user_friendly_html omnimods = ] (List.map (\(k, v) -> - (Battle.View.DamageType.get_html + (Battle.View.DamageType.get_unsigned_html (Battle.Struct.DamageType.decode k) (max 0 v) ) @@ -183,7 +179,7 @@ get_user_friendly_html omnimods = ] (List.map (\(k, v) -> - (Battle.View.DamageType.get_html + (Battle.View.DamageType.get_unsigned_html (Battle.Struct.DamageType.decode k) (max 0 v) ) @@ -197,7 +193,7 @@ get_user_friendly_html omnimods = ] (List.map (\(k, v) -> - (Battle.View.Attribute.get_html + (Battle.View.Attribute.get_unsigned_html (Battle.Struct.Attributes.decode_category k) (max 0 v) ) |