summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/battle/Battle/View')
-rw-r--r--src/shared/battle/Battle/View/Attribute.elm181
-rw-r--r--src/shared/battle/Battle/View/DamageType.elm131
-rw-r--r--src/shared/battle/Battle/View/Gauge.elm75
-rw-r--r--src/shared/battle/Battle/View/Statistic.elm246
4 files changed, 633 insertions, 0 deletions
diff --git a/src/shared/battle/Battle/View/Attribute.elm b/src/shared/battle/Battle/View/Attribute.elm
new file mode 100644
index 0000000..abf71c3
--- /dev/null
+++ b/src/shared/battle/Battle/View/Attribute.elm
@@ -0,0 +1,181 @@
+module Battle.View.Attribute exposing
+ (
+ get_html,
+ get_all_html,
+ get_signed_html,
+ get_all_signed_html
+ )
+
+-- Elm -------------------------------------------------------------------------
+import Html
+import Html.Attributes
+
+-- Battle ----------------------------------------------------------------------
+import Battle.Struct.Attribute
+
+-- Local Module ----------------------------------------------------------------
+import Struct.Event
+import Struct.HelpRequest
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+get_html : (
+ Battle.Struct.Attribute.Category ->
+ Int ->
+ (List (Html.Html Struct.Event.Type))
+ )
+get_html attribute value =
+ (Html.div
+ [
+ (Html.Events.onClick
+ (Struct.Event.RequestedHelp
+ (Struct.HelpRequest.Attribute attribute)
+ )
+ )
+ ]
+ [
+ (Html.div
+ [
+ (Html.Attributes.class "omnimod-icon"),
+ (Html.Attributes.class
+ (
+ "omnimod-icon-"
+ ++ (Battle.Struct.Attribute.encode_category attribute)
+ )
+ ),
+ ]
+ [
+ ]
+ ),
+ (Html.div
+ [
+ (Html.Attributes.class "omnimod-value")
+ ]
+ [
+ (Html.text (String.FromInt value))
+ ]
+ )
+ ]
+ )
+
+get_signed_html : (
+ Battle.Struct.Attribute.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)
+ )
+ )
+ ]
+ [
+ (Html.div
+ [
+ (Html.Attributes.class "omnimod-icon"),
+ (Html.Attributes.class
+ (
+ "omnimod-icon-"
+ ++ (Battle.Struct.Attribute.encode_category attribute)
+ )
+ ),
+ ]
+ [
+ ]
+ ),
+ (Html.div
+ [
+ (Html.Attributes.class "omnimod-value")
+ ]
+ [
+ (Html.text
+ (
+ (
+ if (value < 0)
+ then "-"
+ else "+"
+ )
+ ++ (String.FromInt value)
+ )
+ )
+ ]
+ )
+ ]
+ )
+
+get_all_html : (
+ Battle.Struct.Attributes.Type ->
+ (List (Html.Html Struct.Event.Type))
+ )
+get_all_html atts =
+ [
+ (get_html
+ Battle.Struct.Attributes.Constitution
+ (Battle.Struct.Attributes.get_constitution atts)
+ ),
+ (get_html
+ Battle.Struct.Attributes.Strength
+ (Battle.Struct.Attributes.get_strength atts)
+ ),
+ (get_html
+ Battle.Struct.Attributes.Dexterity
+ (Battle.Struct.Attributes.get_dexterity atts)
+ ),
+ (get_html
+ Battle.Struct.Attributes.Speed
+ (Battle.Struct.Attributes.get_speed atts)
+ ),
+ (get_html
+ Battle.Struct.Attributes.Intelligence
+ (Battle.Struct.Attributes.get_intelligence atts)
+ ),
+ (get_html
+ Battle.Struct.Attributes.Mind
+ (Battle.Struct.Attributes.get_mind atts)
+ )
+ ]
+
+get_all_signed_html : (
+ Battle.Struct.Attributes.Type ->
+ (List (Html.Html Struct.Event.Type))
+ )
+get_all_signed_html atts =
+ [
+ (get_signed_html
+ Battle.Struct.Attributes.Constitution
+ (Battle.Struct.Attributes.get_constitution atts)
+ ),
+ (get_signed_html
+ Battle.Struct.Attributes.Strength
+ (Battle.Struct.Attributes.get_strength atts)
+ ),
+ (get_signed_html
+ Battle.Struct.Attributes.Dexterity
+ (Battle.Struct.Attributes.get_dexterity atts)
+ ),
+ (get_signed_html
+ Battle.Struct.Attributes.Speed
+ (Battle.Struct.Attributes.get_speed atts)
+ ),
+ (get_signed_html
+ Battle.Struct.Attributes.Intelligence
+ (Battle.Struct.Attributes.get_intelligence atts)
+ ),
+ (get_signed_html
+ Battle.Struct.Attributes.Mind
+ (Battle.Struct.Attributes.get_mind atts)
+ )
+ ]
diff --git a/src/shared/battle/Battle/View/DamageType.elm b/src/shared/battle/Battle/View/DamageType.elm
new file mode 100644
index 0000000..0a76092
--- /dev/null
+++ b/src/shared/battle/Battle/View/DamageType.elm
@@ -0,0 +1,131 @@
+module Battle.View.DamageType exposing
+ (
+ get_html,
+ get_signed_html
+ )
+
+-- Elm -------------------------------------------------------------------------
+import Html
+import Html.DamageTypes
+
+import List
+
+-- Battle ----------------------------------------------------------------------
+import Battle.Struct.DamageType
+
+-- Local Module ----------------------------------------------------------------
+import Struct.Event
+import Struct.HelpRequest
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+get_html : (
+ Battle.Struct.DamageType.Type ->
+ Int ->
+ (List (Html.Html Struct.Event.Type))
+ )
+get_html damage_type value =
+ (Html.div
+ [
+ (Html.Events.onClick
+ (Struct.Event.RequestedHelp
+ (Struct.HelpRequest.DamageType damage_type)
+ )
+ )
+ ]
+ [
+ (Html.div
+ [
+ (Html.DamageTypes.class "omnimod-icon"),
+ (Html.DamageTypes.class
+ (
+ "omnimod-icon-"
+ ++ (Battle.Struct.DamageType.encode damage_type)
+ )
+ ),
+ ]
+ [
+ ]
+ ),
+ (Html.div
+ [
+ (Html.DamageTypes.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.DamageTypes.class "omnimod-negative")
+ else (Html.DamageTypes.class "omnimod-positive")
+ ),
+ (Html.Events.onClick
+ (Struct.Event.RequestedHelp
+ (Struct.HelpRequest.DamageType damage_type)
+ )
+ )
+ ]
+ [
+ (Html.div
+ [
+ (Html.DamageTypes.class "omnimod-icon"),
+ (Html.DamageTypes.class
+ (
+ "omnimod-icon-"
+ ++ (Battle.Struct.DamageType.encode damage_type)
+ )
+ ),
+ ]
+ [
+ ]
+ ),
+ (Html.div
+ [
+ (Html.DamageTypes.class "omnimod-value")
+ ]
+ [
+ (Html.text
+ (
+ (
+ if (value < 0)
+ then "-"
+ else "+"
+ )
+ ++ (String.FromInt value)
+ )
+ )
+ ]
+ )
+ ]
+ )
+
+get_all_html : (
+ (List Battle.Struct.DamageTypes.Type) ->
+ (List (Html.Html Struct.Event.Type))
+ )
+get_all_html damage_types =
+ (List.map (get_html) damage_types)
+
+get_all_signed_html : (
+ (List Battle.Struct.DamageTypes.Type) ->
+ (List (Html.Html Struct.Event.Type))
+ )
+get_all_signed_html damage_types =
+ (List.map (get_signed_html) damage_types)
diff --git a/src/shared/battle/Battle/View/Gauge.elm b/src/shared/battle/Battle/View/Gauge.elm
new file mode 100644
index 0000000..29a97a0
--- /dev/null
+++ b/src/shared/battle/Battle/View/Gauge.elm
@@ -0,0 +1,75 @@
+module Battle.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)
+ ]
+ )
diff --git a/src/shared/battle/Battle/View/Statistic.elm b/src/shared/battle/Battle/View/Statistic.elm
new file mode 100644
index 0000000..4e2e91a
--- /dev/null
+++ b/src/shared/battle/Battle/View/Statistic.elm
@@ -0,0 +1,246 @@
+module Battle.View.Statistic exposing
+ (
+ get_html,
+ get_all_html,
+ get_signed_html,
+ get_all_signed_html
+ )
+
+-- Elm -------------------------------------------------------------------------
+import Html
+import Html.Statistics
+
+-- Battle ----------------------------------------------------------------------
+import Battle.Struct.Statistic
+
+-- Local Module ----------------------------------------------------------------
+import Struct.Event
+import Struct.HelpRequest
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+get_html : (
+ Battle.Struct.Statistic.Category ->
+ Int ->
+ (List (Html.Html Struct.Event.Type))
+ )
+get_html statistic value =
+ (Html.div
+ [
+ (Html.Events.onClick
+ (Struct.Event.RequestedHelp
+ (Struct.HelpRequest.Statistic statistic)
+ )
+ )
+ ]
+ [
+ (Html.div
+ [
+ (Html.Statistics.class "omnimod-icon"),
+ (Html.Statistics.class
+ (
+ "omnimod-icon-"
+ ++ (Battle.Struct.Statistic.encode_category statistic)
+ )
+ ),
+ ]
+ [
+ ]
+ ),
+ (Html.div
+ [
+ (Html.Statistics.class "omnimod-value")
+ ]
+ [
+ (Html.text ((String.FromInt value) ++ "%"))
+ ]
+ )
+ ]
+ )
+
+get_signed_html : (
+ Battle.Struct.Statistic.Category ->
+ Int ->
+ (Html.Html Struct.Event.Type)
+ )
+get_signed_html statistic value =
+ (Html.div
+ [
+ (
+ if (value < 0)
+ then (Html.Statistics.class "omnimod-negative")
+ else (Html.Statistics.class "omnimod-positive")
+ ),
+ (Html.Events.onClick
+ (Struct.Event.RequestedHelp
+ (Struct.HelpRequest.Statistic statistic)
+ )
+ )
+ ]
+ [
+ (Html.div
+ [
+ (Html.Statistics.class "omnimod-icon"),
+ (Html.Statistics.class
+ (
+ "omnimod-icon-"
+ ++ (Battle.Struct.Statistic.encode_category statistic)
+ )
+ ),
+ ]
+ [
+ ]
+ ),
+ (Html.div
+ [
+ (Html.Statistics.class "omnimod-value")
+ ]
+ [
+ (Html.text
+ (
+ (
+ if (value < 0)
+ then "-"
+ else "+"
+ )
+ ++ (String.FromInt value)
+ ++ "%"
+ )
+ )
+ ]
+ )
+ ]
+ )
+
+get_all_html : (
+ Battle.Struct.Statistics.Type ->
+ (List (Html.Html Struct.Event.Type))
+ )
+get_all_html stats =
+ [
+ (get_html
+ Battle.Struct.Statistics.Dodges
+ (Battle.Struct.Statistics.get_dodges stats)
+ ),
+ (get_html
+ Battle.Struct.Statistics.Parries
+ (Battle.Struct.Statistics.get_parries stats)
+ ),
+ (get_html
+ Battle.Struct.Statistics.Accuracy
+ (Battle.Struct.Statistics.get_accuracy stats)
+ ),
+ (get_html
+ Battle.Struct.Statistics.DoubleHits
+ (Battle.Struct.Statistics.get_double_hits stats)
+ ),
+ (get_html
+ Battle.Struct.Statistics.CriticalHits
+ (Battle.Struct.Statistics.get_critical_hits stats)
+ ),
+ (get_html
+ Battle.Struct.Statistics.MaxHealth
+ (Battle.Struct.Statistics.get_max_health stats)
+ ),
+ (get_html
+ Battle.Struct.Statistics.MovementPoints
+ (Battle.Struct.Statistics.get_movement_points stats)
+ )
+ ]
+
+get_all_signed_html : (
+ Battle.Struct.Statistics.Type ->
+ (List (Html.Html Struct.Event.Type))
+ )
+get_all_signed_html stats =
+ [
+ (get_signed_html
+ Battle.Struct.Statistics.Dodges
+ (Battle.Struct.Statistics.get_dodges stats)
+ ),
+ (get_signed_html
+ Battle.Struct.Statistics.Parries
+ (Battle.Struct.Statistics.get_parries stats)
+ ),
+ (get_signed_html
+ Battle.Struct.Statistics.Accuracy
+ (Battle.Struct.Statistics.get_accuracy stats)
+ ),
+ (get_signed_html
+ Battle.Struct.Statistics.DoubleHits
+ (Battle.Struct.Statistics.get_double_hits stats)
+ ),
+ (get_signed_html
+ Battle.Struct.Statistics.CriticalHits
+ (Battle.Struct.Statistics.get_critical_hits stats)
+ ),
+ (get_signed_html
+ Battle.Struct.Statistics.MaxHealth
+ (Battle.Struct.Statistics.get_max_health stats)
+ ),
+ (get_signed_html
+ Battle.Struct.Statistics.MovementPoints
+ (Battle.Struct.Statistics.get_movement_points stats)
+ )
+ ]
+
+get_all_but_gauges_html : (
+ Battle.Struct.Statistics.Type ->
+ (List (Html.Html Struct.Event.Type))
+ )
+get_all_but_gauges_html stats =
+ [
+ (get_html
+ Battle.Struct.Statistics.Dodges
+ (Battle.Struct.Statistics.get_dodges stats)
+ ),
+ (get_html
+ Battle.Struct.Statistics.Parries
+ (Battle.Struct.Statistics.get_parries stats)
+ ),
+ (get_html
+ Battle.Struct.Statistics.Accuracy
+ (Battle.Struct.Statistics.get_accuracy stats)
+ ),
+ (get_html
+ Battle.Struct.Statistics.DoubleHits
+ (Battle.Struct.Statistics.get_double_hits stats)
+ ),
+ (get_html
+ Battle.Struct.Statistics.CriticalHits
+ (Battle.Struct.Statistics.get_critical_hits stats)
+ )
+ ]
+
+get_all_but_gauges_signed_html : (
+ Battle.Struct.Statistics.Type ->
+ (List (Html.Html Struct.Event.Type))
+ )
+get_all_but_gauges_signed_html stats =
+ [
+ (get_signed_html
+ Battle.Struct.Statistics.Dodges
+ (Battle.Struct.Statistics.get_dodges stats)
+ ),
+ (get_signed_html
+ Battle.Struct.Statistics.Parries
+ (Battle.Struct.Statistics.get_parries stats)
+ ),
+ (get_signed_html
+ Battle.Struct.Statistics.Accuracy
+ (Battle.Struct.Statistics.get_accuracy stats)
+ ),
+ (get_signed_html
+ Battle.Struct.Statistics.DoubleHits
+ (Battle.Struct.Statistics.get_double_hits stats)
+ ),
+ (get_signed_html
+ Battle.Struct.Statistics.CriticalHits
+ (Battle.Struct.Statistics.get_critical_hits stats)
+ )
+ ]