summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/roster-editor/src/Struct/HelpRequest.elm8
-rw-r--r--src/roster-editor/src/View/MessageBoard/Help.elm2
-rw-r--r--src/shared/battle/Battle/Struct/Attributes.elm2
-rw-r--r--src/shared/battle/Battle/Struct/Statistics.elm6
-rw-r--r--src/shared/battle/Battle/View/Attribute.elm28
-rw-r--r--src/shared/battle/Battle/View/DamageType.elm44
-rw-r--r--src/shared/battle/Battle/View/Omnimods.elm123
-rw-r--r--src/shared/battle/Battle/View/Statistic.elm57
8 files changed, 139 insertions, 131 deletions
diff --git a/src/roster-editor/src/Struct/HelpRequest.elm b/src/roster-editor/src/Struct/HelpRequest.elm
index 50d2ee6..6fa0af2 100644
--- a/src/roster-editor/src/Struct/HelpRequest.elm
+++ b/src/roster-editor/src/Struct/HelpRequest.elm
@@ -1,7 +1,15 @@
module Struct.HelpRequest exposing (Type(..))
+-- Battle ----------------------------------------------------------------------
+import Battle.Struct.Attributes
+import Battle.Struct.Statistics
+import Battle.Struct.DamageType
+
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
--------------------------------------------------------------------------------
type Type =
None
+ | Attribute Battle.Struct.Attributes.Category
+ | Statistic Battle.Struct.Statistics.Category
+ | DamageType Battle.Struct.DamageType.Type
diff --git a/src/roster-editor/src/View/MessageBoard/Help.elm b/src/roster-editor/src/View/MessageBoard/Help.elm
index eea0c8a..dbd0412 100644
--- a/src/roster-editor/src/View/MessageBoard/Help.elm
+++ b/src/roster-editor/src/View/MessageBoard/Help.elm
@@ -29,5 +29,7 @@ get_html model =
case model.help_request of
Struct.HelpRequest.None ->
(View.MessageBoard.Help.Guide.get_html_contents model)
+
+ _ -> (View.MessageBoard.Help.Guide.get_html_contents model)
)
)
diff --git a/src/shared/battle/Battle/Struct/Attributes.elm b/src/shared/battle/Battle/Struct/Attributes.elm
index 6f6fe10..db16b5c 100644
--- a/src/shared/battle/Battle/Struct/Attributes.elm
+++ b/src/shared/battle/Battle/Struct/Attributes.elm
@@ -169,7 +169,7 @@ decode_category str =
"spe" -> Speed
_ -> Strength
-encode_category : Category -> string
+encode_category : Category -> String
encode_category cat =
case cat of
Constitution -> "con"
diff --git a/src/shared/battle/Battle/Struct/Statistics.elm b/src/shared/battle/Battle/Struct/Statistics.elm
index 43bd27d..97547fe 100644
--- a/src/shared/battle/Battle/Struct/Statistics.elm
+++ b/src/shared/battle/Battle/Struct/Statistics.elm
@@ -13,7 +13,8 @@ module Battle.Struct.Statistics exposing
decode_category,
encode_category,
mod,
- new_raw
+ new_raw,
+ is_percent
)
-- Elm -------------------------------------------------------------------------
@@ -220,3 +221,6 @@ encode_category cat =
Accuracy -> "accu"
DoubleHits -> "dhit"
CriticalHits -> "crit"
+
+is_percent : Category -> Bool
+is_percent cat = ((cat /= MaxHealth) && (cat /= MovementPoints))
diff --git a/src/shared/battle/Battle/View/Attribute.elm b/src/shared/battle/Battle/View/Attribute.elm
index abf71c3..091f3c3 100644
--- a/src/shared/battle/Battle/View/Attribute.elm
+++ b/src/shared/battle/Battle/View/Attribute.elm
@@ -9,9 +9,10 @@ module Battle.View.Attribute exposing
-- Elm -------------------------------------------------------------------------
import Html
import Html.Attributes
+import Html.Events
-- Battle ----------------------------------------------------------------------
-import Battle.Struct.Attribute
+import Battle.Struct.Attributes
-- Local Module ----------------------------------------------------------------
import Struct.Event
@@ -25,9 +26,9 @@ import Struct.HelpRequest
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
get_html : (
- Battle.Struct.Attribute.Category ->
+ Battle.Struct.Attributes.Category ->
Int ->
- (List (Html.Html Struct.Event.Type))
+ (Html.Html Struct.Event.Type)
)
get_html attribute value =
(Html.div
@@ -45,9 +46,9 @@ get_html attribute value =
(Html.Attributes.class
(
"omnimod-icon-"
- ++ (Battle.Struct.Attribute.encode_category attribute)
+ ++ (Battle.Struct.Attributes.encode_category attribute)
)
- ),
+ )
]
[
]
@@ -57,14 +58,14 @@ get_html attribute value =
(Html.Attributes.class "omnimod-value")
]
[
- (Html.text (String.FromInt value))
+ (Html.text (String.fromInt value))
]
)
]
)
get_signed_html : (
- Battle.Struct.Attribute.Category ->
+ Battle.Struct.Attributes.Category ->
Int ->
(Html.Html Struct.Event.Type)
)
@@ -89,9 +90,9 @@ get_signed_html attribute value =
(Html.Attributes.class
(
"omnimod-icon-"
- ++ (Battle.Struct.Attribute.encode_category attribute)
+ ++ (Battle.Struct.Attributes.encode_category attribute)
)
- ),
+ )
]
[
]
@@ -103,12 +104,9 @@ get_signed_html attribute value =
[
(Html.text
(
- (
- if (value < 0)
- then "-"
- else "+"
- )
- ++ (String.FromInt value)
+ if (value > 0)
+ then ("+" ++ (String.fromInt value))
+ else (String.fromInt value)
)
)
]
diff --git a/src/shared/battle/Battle/View/DamageType.elm b/src/shared/battle/Battle/View/DamageType.elm
index 0a76092..eee2838 100644
--- a/src/shared/battle/Battle/View/DamageType.elm
+++ b/src/shared/battle/Battle/View/DamageType.elm
@@ -6,7 +6,8 @@ module Battle.View.DamageType exposing
-- Elm -------------------------------------------------------------------------
import Html
-import Html.DamageTypes
+import Html.Attributes
+import Html.Events
import List
@@ -27,7 +28,7 @@ import Struct.HelpRequest
get_html : (
Battle.Struct.DamageType.Type ->
Int ->
- (List (Html.Html Struct.Event.Type))
+ (Html.Html Struct.Event.Type)
)
get_html damage_type value =
(Html.div
@@ -41,23 +42,23 @@ get_html damage_type value =
[
(Html.div
[
- (Html.DamageTypes.class "omnimod-icon"),
- (Html.DamageTypes.class
+ (Html.Attributes.class "omnimod-icon"),
+ (Html.Attributes.class
(
"omnimod-icon-"
++ (Battle.Struct.DamageType.encode damage_type)
)
- ),
+ )
]
[
]
),
(Html.div
[
- (Html.DamageTypes.class "omnimod-value")
+ (Html.Attributes.class "omnimod-value")
]
[
- (Html.text (String.FromInt value))
+ (Html.text (String.fromInt value))
]
)
]
@@ -73,8 +74,8 @@ get_signed_html damage_type value =
[
(
if (value < 0)
- then (Html.DamageTypes.class "omnimod-negative")
- else (Html.DamageTypes.class "omnimod-positive")
+ then (Html.Attributes.class "omnimod-negative")
+ else (Html.Attributes.class "omnimod-positive")
),
(Html.Events.onClick
(Struct.Event.RequestedHelp
@@ -85,30 +86,27 @@ get_signed_html damage_type value =
[
(Html.div
[
- (Html.DamageTypes.class "omnimod-icon"),
- (Html.DamageTypes.class
+ (Html.Attributes.class "omnimod-icon"),
+ (Html.Attributes.class
(
"omnimod-icon-"
++ (Battle.Struct.DamageType.encode damage_type)
)
- ),
+ )
]
[
]
),
(Html.div
[
- (Html.DamageTypes.class "omnimod-value")
+ (Html.Attributes.class "omnimod-value")
]
[
(Html.text
(
- (
- if (value < 0)
- then "-"
- else "+"
- )
- ++ (String.FromInt value)
+ if (value > 0)
+ then ("+" ++ (String.fromInt value))
+ else (String.fromInt value)
)
)
]
@@ -117,15 +115,15 @@ get_signed_html damage_type value =
)
get_all_html : (
- (List Battle.Struct.DamageTypes.Type) ->
+ (List (Battle.Struct.DamageType.Type, Int)) ->
(List (Html.Html Struct.Event.Type))
)
get_all_html damage_types =
- (List.map (get_html) damage_types)
+ (List.map (\(d, v) -> (get_html d v)) damage_types)
get_all_signed_html : (
- (List Battle.Struct.DamageTypes.Type) ->
+ (List (Battle.Struct.DamageType.Type, Int)) ->
(List (Html.Html Struct.Event.Type))
)
get_all_signed_html damage_types =
- (List.map (get_signed_html) damage_types)
+ (List.map (\(d, v) -> (get_signed_html d v)) damage_types)
diff --git a/src/shared/battle/Battle/View/Omnimods.elm b/src/shared/battle/Battle/View/Omnimods.elm
index a946c35..6a61c4b 100644
--- a/src/shared/battle/Battle/View/Omnimods.elm
+++ b/src/shared/battle/Battle/View/Omnimods.elm
@@ -12,7 +12,14 @@ import Html.Attributes
import Html.Events
-- Battle ----------------------------------------------------------------------
+import Battle.Struct.Attributes
+import Battle.Struct.DamageType
import Battle.Struct.Omnimods
+import Battle.Struct.Statistics
+
+import Battle.View.Attribute
+import Battle.View.DamageType
+import Battle.View.Statistic
-- Local Module ----------------------------------------------------------------
import Struct.Event
@@ -20,66 +27,6 @@ import Struct.Event
--------------------------------------------------------------------------------
-- 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)),
- (
- if (value < 0)
- then (Html.Attributes.class "omnimod-icon-negative")
- else (Html.Attributes.class "omnimod-icon-positive")
- )
- ]
- [
- ]
- ),
- (Html.text (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)),
- (
- if (value < 0)
- then (Html.Attributes.class "omnimod-icon-negative")
- else (Html.Attributes.class "omnimod-icon-positive")
- )
- ]
- [
- ]
- ),
- (Html.text
- (
- (String.fromInt value)
- ++ " ("
- ++(String.fromInt (ceiling ((toFloat value) * multiplier)))
- ++ ")"
- )
- )
- ]
- )
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
@@ -100,7 +47,12 @@ get_html_with_modifier attack_multiplier omnimods =
(Html.Attributes.class "omnimod-attack-mods")
]
(List.map
- (get_multiplied_mod_html attack_multiplier)
+ (\(k, v) ->
+ (Battle.View.DamageType.get_signed_html
+ (Battle.Struct.DamageType.decode k)
+ (ceiling ((toFloat v) * attack_multiplier))
+ )
+ )
(Battle.Struct.Omnimods.get_attack_mods omnimods)
)
),
@@ -109,7 +61,12 @@ get_html_with_modifier attack_multiplier omnimods =
(Html.Attributes.class "omnimod-defense-mods")
]
(List.map
- (get_mod_html)
+ (\(k, v) ->
+ (Battle.View.DamageType.get_signed_html
+ (Battle.Struct.DamageType.decode k)
+ v
+ )
+ )
(Battle.Struct.Omnimods.get_defense_mods omnimods)
)
),
@@ -118,7 +75,12 @@ get_html_with_modifier attack_multiplier omnimods =
(Html.Attributes.class "omnimod-attribute-mods")
]
(List.map
- (get_mod_html)
+ (\(k, v) ->
+ (Battle.View.Attribute.get_signed_html
+ (Battle.Struct.Attributes.decode_category k)
+ v
+ )
+ )
(Battle.Struct.Omnimods.get_attributes_mods omnimods)
)
),
@@ -127,7 +89,12 @@ get_html_with_modifier attack_multiplier omnimods =
(Html.Attributes.class "omnimod-statistics-mods")
]
(List.map
- (get_mod_html)
+ (\(k, v) ->
+ (Battle.View.Statistic.get_signed_html
+ (Battle.Struct.Statistics.decode_category k)
+ v
+ )
+ )
(Battle.Struct.Omnimods.get_statistics_mods omnimods)
)
)
@@ -146,7 +113,12 @@ get_html omnimods =
(Html.Attributes.class "omnimod-attack-mods")
]
(List.map
- (get_mod_html)
+ (\(k, v) ->
+ (Battle.View.DamageType.get_signed_html
+ (Battle.Struct.DamageType.decode k)
+ v
+ )
+ )
(Battle.Struct.Omnimods.get_attack_mods omnimods)
)
),
@@ -155,7 +127,12 @@ get_html omnimods =
(Html.Attributes.class "omnimod-defense-mods")
]
(List.map
- (get_mod_html)
+ (\(k, v) ->
+ (Battle.View.DamageType.get_signed_html
+ (Battle.Struct.DamageType.decode k)
+ v
+ )
+ )
(Battle.Struct.Omnimods.get_defense_mods omnimods)
)
),
@@ -164,7 +141,12 @@ get_html omnimods =
(Html.Attributes.class "omnimod-attribute-mods")
]
(List.map
- (get_mod_html)
+ (\(k, v) ->
+ (Battle.View.Attribute.get_signed_html
+ (Battle.Struct.Attributes.decode_category k)
+ v
+ )
+ )
(Battle.Struct.Omnimods.get_attributes_mods omnimods)
)
),
@@ -173,7 +155,12 @@ get_html omnimods =
(Html.Attributes.class "omnimod-statistics-mods")
]
(List.map
- (get_mod_html)
+ (\(k, v) ->
+ (Battle.View.Statistic.get_signed_html
+ (Battle.Struct.Statistics.decode_category k)
+ v
+ )
+ )
(Battle.Struct.Omnimods.get_statistics_mods omnimods)
)
)
diff --git a/src/shared/battle/Battle/View/Statistic.elm b/src/shared/battle/Battle/View/Statistic.elm
index 4e2e91a..a3ac669 100644
--- a/src/shared/battle/Battle/View/Statistic.elm
+++ b/src/shared/battle/Battle/View/Statistic.elm
@@ -8,10 +8,11 @@ module Battle.View.Statistic exposing
-- Elm -------------------------------------------------------------------------
import Html
-import Html.Statistics
+import Html.Attributes
+import Html.Events
-- Battle ----------------------------------------------------------------------
-import Battle.Struct.Statistic
+import Battle.Struct.Statistics
-- Local Module ----------------------------------------------------------------
import Struct.Event
@@ -25,9 +26,9 @@ import Struct.HelpRequest
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
get_html : (
- Battle.Struct.Statistic.Category ->
+ Battle.Struct.Statistics.Category ->
Int ->
- (List (Html.Html Struct.Event.Type))
+ (Html.Html Struct.Event.Type)
)
get_html statistic value =
(Html.div
@@ -41,30 +42,36 @@ get_html statistic value =
[
(Html.div
[
- (Html.Statistics.class "omnimod-icon"),
- (Html.Statistics.class
+ (Html.Attributes.class "omnimod-icon"),
+ (Html.Attributes.class
(
"omnimod-icon-"
- ++ (Battle.Struct.Statistic.encode_category statistic)
+ ++ (Battle.Struct.Statistics.encode_category statistic)
)
- ),
+ )
]
[
]
),
(Html.div
[
- (Html.Statistics.class "omnimod-value")
+ (Html.Attributes.class "omnimod-value")
]
[
- (Html.text ((String.FromInt value) ++ "%"))
+ (Html.text
+ (
+ if (Battle.Struct.Statistics.is_percent statistic)
+ then ((String.fromInt value) ++ "%")
+ else (String.fromInt value)
+ )
+ )
]
)
]
)
get_signed_html : (
- Battle.Struct.Statistic.Category ->
+ Battle.Struct.Statistics.Category ->
Int ->
(Html.Html Struct.Event.Type)
)
@@ -73,8 +80,8 @@ get_signed_html statistic value =
[
(
if (value < 0)
- then (Html.Statistics.class "omnimod-negative")
- else (Html.Statistics.class "omnimod-positive")
+ then (Html.Attributes.class "omnimod-negative")
+ else (Html.Attributes.class "omnimod-positive")
),
(Html.Events.onClick
(Struct.Event.RequestedHelp
@@ -85,31 +92,35 @@ get_signed_html statistic value =
[
(Html.div
[
- (Html.Statistics.class "omnimod-icon"),
- (Html.Statistics.class
+ (Html.Attributes.class "omnimod-icon"),
+ (Html.Attributes.class
(
"omnimod-icon-"
- ++ (Battle.Struct.Statistic.encode_category statistic)
+ ++ (Battle.Struct.Statistics.encode_category statistic)
)
- ),
+ )
]
[
]
),
(Html.div
[
- (Html.Statistics.class "omnimod-value")
+ (Html.Attributes.class "omnimod-value")
]
[
(Html.text
(
(
- if (value < 0)
- then "-"
- else "+"
+ if (value > 0)
+ then ("+" ++ (String.fromInt value))
+ else (String.fromInt value)
+ )
+ ++
+ (
+ if (Battle.Struct.Statistics.is_percent statistic)
+ then "%"
+ else ""
)
- ++ (String.FromInt value)
- ++ "%"
)
)
]