summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2019-03-22 19:02:58 +0100
committernsensfel <SpamShield0@noot-noot.org>2019-03-22 19:02:58 +0100
commitcaf0e9497229abb56a7428e60b19ee3d05fa7e9c (patch)
tree21272443e733fb9396947f969e01cfe85e6481bd /src/battle/src/View
parent397e54affd6d434ea5d055f34cbac637867cde0a (diff)
[Broken] More factoring in progress...
Diffstat (limited to 'src/battle/src/View')
-rw-r--r--src/battle/src/View/Character.elm58
-rw-r--r--src/battle/src/View/Controlled/CharacterCard.elm135
-rw-r--r--src/battle/src/View/Gauge.elm75
3 files changed, 37 insertions, 231 deletions
diff --git a/src/battle/src/View/Character.elm b/src/battle/src/View/Character.elm
index e65f947..d9c2b31 100644
--- a/src/battle/src/View/Character.elm
+++ b/src/battle/src/View/Character.elm
@@ -13,9 +13,10 @@ import Html.Events
import Util.Html
-- Battle Characters -----------------------------------------------------------
-import BattleCharacters.Struct.Armor
import BattleCharacters.Struct.Portrait
+import BattleCharacters.View.Portrait
+
-- Local Module ----------------------------------------------------------------
import Constants.UI
@@ -158,53 +159,6 @@ get_icon_actual_html model char =
]
)
-get_portrait_body_html : Struct.Character.Type -> (Html.Html Struct.Event.Type)
-get_portrait_body_html char =
- (Html.div
- [
- (Html.Attributes.class "character-portrait-body"),
- (Html.Attributes.class
- (
- "asset-character-portrait-"
- ++
- (BattleCharacters.Struct.Portrait.get_id
- (Struct.Character.get_portrait char)
- )
- )
- )
- ]
- [
- ]
- )
-
-get_portrait_armor_html : Struct.Character.Type -> (Html.Html Struct.Event.Type)
-get_portrait_armor_html char =
- (Html.div
- [
- (Html.Attributes.class "character-portrait-armor"),
- (Html.Attributes.class
- (
- "asset-armor-"
- ++
- (BattleCharacters.Struct.Armor.get_image_id
- (Struct.Character.get_armor char)
- )
- )
- ),
- (Html.Attributes.class
- (
- "asset-armor-variation-"
- ++
- (BattleCharacters.Struct.Portrait.get_body_id
- (Struct.Character.get_portrait char)
- )
- )
- )
- ]
- [
- ]
- )
-
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
@@ -214,7 +168,7 @@ get_portrait_html : (
(Html.Html Struct.Event.Type)
)
get_portrait_html viewer_ix char =
- (Html.div
+ (BattleCharacters.View.Portrait.get_html
[
(Html.Attributes.class
(
@@ -225,7 +179,6 @@ get_portrait_html viewer_ix char =
"character-enemy"
)
),
- (Html.Attributes.class "character-portrait"),
(Html.Attributes.class
(
"character-portrait-team-"
@@ -237,10 +190,7 @@ get_portrait_html viewer_ix char =
(Struct.Event.LookingForCharacter (Struct.Character.get_index char))
)
]
- [
- (get_portrait_body_html char),
- (get_portrait_armor_html char)
- ]
+ char
)
get_icon_html : (
diff --git a/src/battle/src/View/Controlled/CharacterCard.elm b/src/battle/src/View/Controlled/CharacterCard.elm
index 0ece1fa..680e3fc 100644
--- a/src/battle/src/View/Controlled/CharacterCard.elm
+++ b/src/battle/src/View/Controlled/CharacterCard.elm
@@ -19,6 +19,10 @@ import Util.Html
import Battle.Struct.Omnimods
import Battle.Struct.Statistics
+import Battle.View.Gauge
+import Battle.View.Statistic
+import Battle.View.DamageType
+
-- Battle Characters -----------------------------------------------------------
import BattleCharacters.Struct.Armor
import BattleCharacters.Struct.Weapon
@@ -31,7 +35,6 @@ import Struct.HelpRequest
import Struct.Navigator
import View.Character
-import View.Gauge
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
@@ -64,7 +67,7 @@ get_health_bar char =
(Struct.Character.get_statistics char)
)
in
- (View.Gauge.get_html
+ (Battle.View.Gauge.get_html
("HP: " ++ (String.fromInt current) ++ "/" ++ (String.fromInt max))
(100.0 * ((toFloat current)/(toFloat max)))
[(Html.Attributes.class "character-card-health")]
@@ -132,7 +135,7 @@ get_active_movement_bar maybe_navigator char =
Nothing ->
max
in
- (View.Gauge.get_html
+ (Battle.View.Gauge.get_html
("MP: " ++ (String.fromInt current) ++ "/" ++ (String.fromInt max))
(100.0 * ((toFloat current)/(toFloat max)))
[(Html.Attributes.class "character-card-movement")]
@@ -151,7 +154,7 @@ get_inactive_movement_bar char =
(Struct.Character.get_statistics char)
)
in
- (View.Gauge.get_html
+ (Battle.View.Gauge.get_html
(
"MP: "
++
@@ -252,42 +255,6 @@ get_weapon_field_header damage_multiplier 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.text
- (category ++ ": " ++ (String.fromInt value))
- )
- ]
- )
-
-get_multiplied_mod_html : Float -> (String, Int) -> (Html.Html Struct.Event.Type)
-get_multiplied_mod_html multiplier mod =
- let (category, value) = mod in
- (Html.div
- [
- (Html.Attributes.class "character-card-mod")
- ]
- [
- (Html.div
- [
- (Html.Attributes.class "omnimod-icon"),
- (Html.Attributes.class ("omnimod-icon-" ++ category))
- ]
- [
- ]
- ),
- (Html.text
- (String.fromInt (ceiling ((toFloat value) * multiplier)))
- )
- ]
- )
-
get_weapon_details : (
Battle.Struct.Omnimods.Type ->
Float ->
@@ -303,10 +270,15 @@ get_weapon_details omnimods damage_multiplier weapon =
(get_weapon_field_header damage_multiplier weapon),
(Html.div
[
- (Html.Attributes.class "info-card-omnimods-listing")
+ (Html.Attributes.class "omnimod-attack-mods")
]
(List.map
- (get_multiplied_mod_html damage_multiplier)
+ (\(k, v) ->
+ (Battle.View.DamageType.get_html
+ (Battle.Struct.DamageType.decode k)
+ (ceiling ((toFloat v) * damage_multiplier))
+ )
+ )
(Battle.Struct.Omnimods.get_attack_mods omnimods)
)
)
@@ -347,69 +319,18 @@ get_armor_details omnimods armor =
(Html.text (BattleCharacters.Struct.Armor.get_name armor))
]
),
- (Html.div
- [
- (Html.Attributes.class "info-card-omnimods-listing")
- ]
- (List.map
- (get_mod_html)
- (Battle.Struct.Omnimods.get_defense_mods omnimods)
- )
- )
- ]
- )
-
-stat_name : String -> (Html.Html Struct.Event.Type)
-stat_name name =
- (Html.div
- [
- (Html.Attributes.class "character-card-stat-name")
- ]
- [
- (Html.text name)
- ]
- )
-
-stat_val : Int -> Bool -> (Html.Html Struct.Event.Type)
-stat_val val perc =
- (Html.div
- [
- (Html.Attributes.class "character-card-stat-val")
- ]
- [
- (Html.text
- (
- (String.fromInt val)
- ++
- (if perc then "%" else "")
+ (List.map
+ (\(k, v) ->
+ (Battle.View.DamageType.get_html
+ (Battle.Struct.DamageType.decode k)
+ v
+ )
)
+ (Battle.Struct.Omnimods.get_defense_mods omnimods)
)
]
)
-get_relevant_stats : (
- Battle.Struct.Statistics.Type ->
- (Html.Html Struct.Event.Type)
- )
-get_relevant_stats stats =
- (Html.div
- [
- (Html.Attributes.class "character-card-stats")
- ]
- [
- (stat_name "Dodge"),
- (stat_val (Battle.Struct.Statistics.get_dodges stats) True),
- (stat_name "Parry"),
- (stat_val (Battle.Struct.Statistics.get_parries stats) True),
- (stat_name "Accu."),
- (stat_val (Battle.Struct.Statistics.get_accuracy stats) False),
- (stat_name "2xHit"),
- (stat_val (Battle.Struct.Statistics.get_double_hits stats) True),
- (stat_name "Crit."),
- (stat_val (Battle.Struct.Statistics.get_critical_hits stats) True)
- ]
- )
-
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
@@ -503,7 +424,12 @@ get_summary_html char_turn player_ix char =
),
(get_weapon_details omnimods damage_modifier active_weapon),
(get_armor_details omnimods (Struct.Character.get_armor char)),
- (get_relevant_stats char_statistics),
+ (Html.div
+ []
+ (Battle.View.Statistic.get_all_but_gauges_html
+ char_statistics
+ )
+ ),
(get_weapon_summary damage_modifier inactive_weapon)
]
)
@@ -562,7 +488,12 @@ get_full_html player_ix char =
),
(get_weapon_details omnimods damage_modifier active_weapon),
(get_armor_details omnimods armor),
- (get_relevant_stats char_statistics),
+ (Html.div
+ []
+ (Battle.View.Statistic.get_all_but_gauges_html
+ char_statistics
+ )
+ ),
(get_weapon_summary damage_modifier inactive_weapon)
]
)
diff --git a/src/battle/src/View/Gauge.elm b/src/battle/src/View/Gauge.elm
deleted file mode 100644
index 50dbea3..0000000
--- a/src/battle/src/View/Gauge.elm
+++ /dev/null
@@ -1,75 +0,0 @@
-module View.Gauge exposing (get_html)
-
--- Elm -------------------------------------------------------------------------
-import Html
-import Html.Attributes
-
--- Local Module ----------------------------------------------------------------
-import Struct.Event
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_text_div : (
- String ->
- List (Html.Attribute Struct.Event.Type) ->
- (Html.Html Struct.Event.Type)
- )
-get_text_div text extra_txt_attr =
- (Html.div
- (
- [(Html.Attributes.class "gauge-text")]
- ++ extra_txt_attr
- )
- [
- (Html.text text)
- ]
- )
-
-get_bar_div : (
- Float ->
- List (Html.Attribute Struct.Event.Type) ->
- (Html.Html Struct.Event.Type)
- )
-get_bar_div percent extra_bar_attr =
- (Html.div
- (
- [
- (Html.Attributes.style
- "width"
- ((String.fromFloat percent) ++ "%")
- ),
- (Html.Attributes.class
- "gauge-bar"
- )
- ]
- ++
- extra_bar_attr
- )
- [
- ]
- )
-
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_html : (
- String ->
- Float ->
- List (Html.Attribute Struct.Event.Type) ->
- List (Html.Attribute Struct.Event.Type) ->
- List (Html.Attribute Struct.Event.Type) ->
- (Html.Html Struct.Event.Type)
- )
-get_html text percent extra_div_attr extra_bar_attr extra_txt_attr =
- (Html.div
- (
- [(Html.Attributes.class "gauge")]
- ++ extra_div_attr
- )
- [
- (get_text_div text extra_txt_attr),
- (get_bar_div percent extra_bar_attr)
- ]
- )