From c70d77cea8ef6d98c3c1f50728e45b655d7b2a54 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Sat, 14 Sep 2019 12:51:50 +0200 Subject: Removes code smell, fixes roster editor atts view. It's still not coloring the negative values correctly, though. --- src/roster-editor/src/View/ArmorSelection.elm | 2 +- src/roster-editor/src/View/CharacterCard.elm | 46 ++++++---------------- src/roster-editor/src/View/GlyphBoardSelection.elm | 19 --------- src/roster-editor/src/View/GlyphManagement.elm | 2 +- src/roster-editor/src/View/GlyphSelection.elm | 2 +- src/roster-editor/src/View/WeaponSelection.elm | 24 +---------- 6 files changed, 15 insertions(+), 80 deletions(-) (limited to 'src/roster-editor') diff --git a/src/roster-editor/src/View/ArmorSelection.elm b/src/roster-editor/src/View/ArmorSelection.elm index 0a3beb5..671e56e 100644 --- a/src/roster-editor/src/View/ArmorSelection.elm +++ b/src/roster-editor/src/View/ArmorSelection.elm @@ -62,7 +62,7 @@ get_armor_html armor = ) ] ), - (Battle.View.Omnimods.get_html + (Battle.View.Omnimods.get_signed_html (BattleCharacters.Struct.Armor.get_omnimods armor) ) ] diff --git a/src/roster-editor/src/View/CharacterCard.elm b/src/roster-editor/src/View/CharacterCard.elm index 0dc8c4c..ef211e9 100644 --- a/src/roster-editor/src/View/CharacterCard.elm +++ b/src/roster-editor/src/View/CharacterCard.elm @@ -203,38 +203,6 @@ get_weapon_field_header is_active_wp weapon = ] ) -get_mod_html : (String, Int) -> (Html.Html Struct.Event.Type) -get_mod_html mod = - let - (category, value) = mod - in - (Html.div - [ - (Html.Attributes.class "info-card-mod"), - (Html.Attributes.class - ( - if (value < 0) - then "omnimod-negative-value" - else - if (value > 0) - then "omnimod-positive-value" - else "omnimod-nil-value" - ) - ) - ] - [ - (Html.div - [ - (Html.Attributes.class "omnimod-icon"), - (Html.Attributes.class ("omnimod-icon-" ++ category)) - ] - [ - ] - ), - (Html.text (String.fromInt value)) - ] - ) - get_weapon_details : ( Struct.UI.Tab -> Bool -> @@ -259,7 +227,7 @@ get_weapon_details current_tab is_active_wp weapon = ( if (is_active_wp && (current_tab == Struct.UI.WeaponSelectionTab)) then - (Battle.View.Omnimods.get_html + (Battle.View.Omnimods.get_signed_html (BattleCharacters.Struct.Weapon.get_omnimods weapon) ) else (Util.Html.nothing) @@ -293,7 +261,7 @@ get_armor_details current_tab armor = ( if (current_tab == Struct.UI.ArmorSelectionTab) then - (Battle.View.Omnimods.get_html + (Battle.View.Omnimods.get_signed_html (BattleCharacters.Struct.Armor.get_omnimods armor) ) else (Util.Html.nothing) @@ -467,6 +435,14 @@ get_full_html current_tab char = ) (BattleCharacters.Struct.Equipment.get_glyph_board equipment) ), - (Battle.View.Omnimods.get_user_friendly_html omnimods) + (Battle.View.Omnimods.get_unsigned_html + (Battle.Struct.Omnimods.apply_damage_modifier + (Battle.Struct.Omnimods.get_attribute_mod + Battle.Struct.Attributes.DamageModifier + omnimods + ) + omnimods + ) + ) ] ) diff --git a/src/roster-editor/src/View/GlyphBoardSelection.elm b/src/roster-editor/src/View/GlyphBoardSelection.elm index 803b362..b9edfa8 100644 --- a/src/roster-editor/src/View/GlyphBoardSelection.elm +++ b/src/roster-editor/src/View/GlyphBoardSelection.elm @@ -7,9 +7,6 @@ import Html import Html.Attributes import Html.Events --- Battle ---------------------------------------------------------------------- -import Battle.View.Omnimods - -- Battle Characters ----------------------------------------------------------- import BattleCharacters.Struct.GlyphBoard @@ -20,22 +17,6 @@ import Struct.Model -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- -get_mod_html : (String, Int) -> (Html.Html Struct.Event.Type) -get_mod_html mod = - let - (category, value) = mod - in - (Html.div - [ - (Html.Attributes.class "info-card-mod") - ] - [ - (Html.text - (category ++ ": " ++ (String.fromInt value)) - ) - ] - ) - get_glyph_board_html : ( BattleCharacters.Struct.GlyphBoard.Type -> (Html.Html Struct.Event.Type) diff --git a/src/roster-editor/src/View/GlyphManagement.elm b/src/roster-editor/src/View/GlyphManagement.elm index a636516..458b713 100644 --- a/src/roster-editor/src/View/GlyphManagement.elm +++ b/src/roster-editor/src/View/GlyphManagement.elm @@ -76,7 +76,7 @@ get_glyph_html invalid_family_ids modifier (index, glyph) = ++ "%)" ) ), - (Battle.View.Omnimods.get_html + (Battle.View.Omnimods.get_signed_html (Battle.Struct.Omnimods.scale ((toFloat modifier) / 100.0) (BattleCharacters.Struct.Glyph.get_omnimods glyph) diff --git a/src/roster-editor/src/View/GlyphSelection.elm b/src/roster-editor/src/View/GlyphSelection.elm index 67faf59..9cc825d 100644 --- a/src/roster-editor/src/View/GlyphSelection.elm +++ b/src/roster-editor/src/View/GlyphSelection.elm @@ -75,7 +75,7 @@ get_glyph_html invalid_family_ids factor glyph = ] [ (Html.text (BattleCharacters.Struct.Glyph.get_name glyph)), - (Battle.View.Omnimods.get_html + (Battle.View.Omnimods.get_signed_html (Battle.Struct.Omnimods.scale factor (BattleCharacters.Struct.Glyph.get_omnimods glyph) diff --git a/src/roster-editor/src/View/WeaponSelection.elm b/src/roster-editor/src/View/WeaponSelection.elm index 7844237..361db6b 100644 --- a/src/roster-editor/src/View/WeaponSelection.elm +++ b/src/roster-editor/src/View/WeaponSelection.elm @@ -25,28 +25,6 @@ import Struct.Model -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- -get_mod_html : (String, Int) -> (Html.Html Struct.Event.Type) -get_mod_html mod = - let - (category, value) = mod - in - (Html.div - [ - (Html.Attributes.class "info-card-mod") - ] - [ - (Html.div - [ - (Html.Attributes.class "omnimod-icon"), - (Html.Attributes.class ("omnimod-icon-" ++ category)) - ] - [ - ] - ), - (Html.text (String.fromInt value)) - ] - ) - get_weapon_html : ( BattleCharacters.Struct.Weapon.Type -> (Html.Html Struct.Event.Type) @@ -116,7 +94,7 @@ get_weapon_html weapon = ) ] ), - (Battle.View.Omnimods.get_html + (Battle.View.Omnimods.get_signed_html (BattleCharacters.Struct.Weapon.get_omnimods weapon) ) ] -- cgit v1.2.3-70-g09d2