From ce03028ccd575af1dc38b26d23569601d3b5d491 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Thu, 12 Sep 2019 10:42:33 +0200 Subject: Improves presentation of attributes in battle. --- src/shared/battle/Battle/View/Omnimods.elm | 69 +++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) (limited to 'src/shared/battle/Battle/View') diff --git a/src/shared/battle/Battle/View/Omnimods.elm b/src/shared/battle/Battle/View/Omnimods.elm index 8d8c4ce..7af5709 100644 --- a/src/shared/battle/Battle/View/Omnimods.elm +++ b/src/shared/battle/Battle/View/Omnimods.elm @@ -1,7 +1,8 @@ module Battle.View.Omnimods exposing ( get_html_with_modifier, - get_html + get_html, + get_user_friendly_html ) -- Elm ------------------------------------------------------------------------- @@ -136,3 +137,69 @@ get_html omnimods = ) ] ) + +get_user_friendly_html : ( + Battle.Struct.Omnimods.Type -> + (Html.Html Struct.Event.Type) + ) +get_user_friendly_html omnimods = + let + -- TODO: Add minimal values to omnimods (e.g. +1 to health). + scaled_omnimods = + (Battle.Struct.Omnimods.apply_damage_modifier + (Battle.Struct.Omnimods.get_attribute_mod + Battle.Struct.Attributes.DamageModifier + omnimods + ) + omnimods + ) + in + (Html.div + [ + (Html.Attributes.class "omnimod-listing") + ] + [ + (Html.div + [ + (Html.Attributes.class "omnimod-attack-mods") + ] + (List.map + (\(k, v) -> + (Battle.View.DamageType.get_html + (Battle.Struct.DamageType.decode k) + v + ) + ) + (Battle.Struct.Omnimods.get_attack_mods scaled_omnimods) + ) + ), + (Html.div + [ + (Html.Attributes.class "omnimod-defense-mods") + ] + (List.map + (\(k, v) -> + (Battle.View.DamageType.get_html + (Battle.Struct.DamageType.decode k) + v + ) + ) + (Battle.Struct.Omnimods.get_defense_mods omnimods) + ) + ), + (Html.div + [ + (Html.Attributes.class "omnimod-attributes-mods") + ] + (List.map + (\(k, v) -> + (Battle.View.Attribute.get_html + (Battle.Struct.Attributes.decode_category k) + v + ) + ) + (Battle.Struct.Omnimods.get_attribute_mods omnimods) + ) + ) + ] + ) -- cgit v1.2.3-70-g09d2